Blame SOURCES/6260348-pr3066.patch

045ef6
# HG changeset patch
045ef6
# User ssadetsky
045ef6
# Date 1467220169 -3600
045ef6
#      Wed Jun 29 18:09:29 2016 +0100
045ef6
# Node ID 9fffaa63c49d93bff70b96af9a86b7635bce44be
045ef6
# Parent  d0462c26152fc8bd5f79db7f1670777e807ef2b3
045ef6
6260348, PR3066: GTK+ L&F JTextComponent not respecting desktop caret blink rate
045ef6
Reviewed-by: alexsch, azvegint
045ef6
045ef6
diff -r d0462c26152f -r 9fffaa63c49d src/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java
045ef6
--- openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java	Tue Jun 28 19:44:50 2016 +0100
045ef6
+++ openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java	Wed Jun 29 18:09:29 2016 +0100
045ef6
@@ -1,5 +1,5 @@
045ef6
 /*
045ef6
- * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
045ef6
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
045ef6
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
045ef6
  *
045ef6
  * This code is free software; you can redistribute it and/or modify it
045ef6
@@ -93,7 +93,9 @@
045ef6
      */
045ef6
     static enum Settings {
045ef6
         GTK_FONT_NAME,
045ef6
-        GTK_ICON_SIZES
045ef6
+        GTK_ICON_SIZES,
045ef6
+        GTK_CURSOR_BLINK,
045ef6
+        GTK_CURSOR_BLINK_TIME
045ef6
     }
045ef6
 
045ef6
     /* Custom regions are needed for representing regions that don't exist
045ef6
diff -r d0462c26152f -r 9fffaa63c49d src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java
045ef6
--- openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Tue Jun 28 19:44:50 2016 +0100
045ef6
+++ openjdk/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Wed Jun 29 18:09:29 2016 +0100
045ef6
@@ -1,5 +1,5 @@
045ef6
 /*
045ef6
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
045ef6
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
045ef6
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
045ef6
  *
045ef6
  * This code is free software; you can redistribute it and/or modify it
045ef6
@@ -371,7 +371,17 @@
045ef6
         int vProgWidth  =  22 - (progXThickness * 2);
045ef6
         int vProgHeight =  80 - (progYThickness * 2);
045ef6
 
045ef6
-        Integer caretBlinkRate = Integer.valueOf(500);
045ef6
+        Integer caretBlinkRate;
045ef6
+        if (Boolean.FALSE.equals(GTKEngine.INSTANCE.getSetting(
045ef6
+                GTKEngine.Settings.GTK_CURSOR_BLINK))) {
045ef6
+            caretBlinkRate = Integer.valueOf(0);
045ef6
+        } else {
045ef6
+            caretBlinkRate = (Integer) GTKEngine.INSTANCE.getSetting(
045ef6
+                    GTKEngine.Settings.GTK_CURSOR_BLINK_TIME);
045ef6
+            if (caretBlinkRate == null) {
045ef6
+                caretBlinkRate = Integer.valueOf(500);
045ef6
+            }
045ef6
+        }
045ef6
         Insets zeroInsets = new InsetsUIResource(0, 0, 0, 0);
045ef6
 
045ef6
         Double defaultCaretAspectRatio = new Double(0.025);
045ef6
diff -r d0462c26152f -r 9fffaa63c49d src/solaris/native/sun/awt/gtk2_interface.c
045ef6
--- openjdk/jdk/src/solaris/native/sun/awt/gtk2_interface.c	Tue Jun 28 19:44:50 2016 +0100
045ef6
+++ openjdk/jdk/src/solaris/native/sun/awt/gtk2_interface.c	Wed Jun 29 18:09:29 2016 +0100
045ef6
@@ -1316,9 +1316,6 @@
045ef6
             {
045ef6
                 result = gtk2_widgets[_GTK_COMBO_BOX_TEXT_FIELD_TYPE] =
045ef6
                      (*fp_gtk_entry_new)();
045ef6
-
045ef6
-                GtkSettings* settings = fp_gtk_widget_get_settings(result);
045ef6
-                fp_g_object_set(settings, "gtk-cursor-blink", FALSE, NULL);
045ef6
             }
045ef6
             result = gtk2_widgets[_GTK_COMBO_BOX_TEXT_FIELD_TYPE];
045ef6
             break;
045ef6
@@ -1363,10 +1360,6 @@
045ef6
             {
045ef6
                 gtk2_widgets[_GTK_ENTRY_TYPE] =
045ef6
                     (*fp_gtk_entry_new)();
045ef6
-
045ef6
-                GtkSettings* settings =
045ef6
-                    fp_gtk_widget_get_settings(gtk2_widgets[_GTK_ENTRY_TYPE]);
045ef6
-                fp_g_object_set(settings, "gtk-cursor-blink", FALSE, NULL);
045ef6
             }
045ef6
             result = gtk2_widgets[_GTK_ENTRY_TYPE];
045ef6
             break;
045ef6
@@ -1558,9 +1551,6 @@
045ef6
             {
045ef6
                 result = gtk2_widgets[_GTK_SPIN_BUTTON_TYPE] =
045ef6
                     (*fp_gtk_spin_button_new)(NULL, 0, 0);
045ef6
-
045ef6
-                GtkSettings* settings = fp_gtk_widget_get_settings(result);
045ef6
-                fp_g_object_set(settings, "gtk-cursor-blink", FALSE, NULL);
045ef6
             }
045ef6
             result = gtk2_widgets[_GTK_SPIN_BUTTON_TYPE];
045ef6
             break;
045ef6
@@ -2510,14 +2500,20 @@
045ef6
 
045ef6
     return result;
045ef6
 }
045ef6
-/*
045ef6
+
045ef6
 jobject get_integer_property(JNIEnv *env, GtkSettings* settings, const gchar* key)
045ef6
 {
045ef6
-    gint    intval = NULL;
045ef6
-
045ef6
+    gint intval = NULL;
045ef6
     (*fp_g_object_get)(settings, key, &intval, NULL);
045ef6
     return create_Integer(env, intval);
045ef6
-}*/
045ef6
+}
045ef6
+
045ef6
+jobject get_boolean_property(JNIEnv *env, GtkSettings* settings, const gchar* key)
045ef6
+{
045ef6
+    gint intval = NULL;
045ef6
+    (*fp_g_object_get)(settings, key, &intval, NULL);
045ef6
+    return create_Boolean(env, intval);
045ef6
+}
045ef6
 
045ef6
 jobject gtk2_get_setting(JNIEnv *env, Setting property)
045ef6
 {
045ef6
@@ -2529,6 +2525,10 @@
045ef6
             return get_string_property(env, settings, "gtk-font-name");
045ef6
         case GTK_ICON_SIZES:
045ef6
             return get_string_property(env, settings, "gtk-icon-sizes");
045ef6
+        case GTK_CURSOR_BLINK:
045ef6
+            return get_boolean_property(env, settings, "gtk-cursor-blink");
045ef6
+        case GTK_CURSOR_BLINK_TIME:
045ef6
+            return get_integer_property(env, settings, "gtk-cursor-blink-time");
045ef6
     }
045ef6
 
045ef6
     return NULL;
045ef6
diff -r d0462c26152f -r 9fffaa63c49d src/solaris/native/sun/awt/gtk2_interface.h
045ef6
--- openjdk/jdk/src/solaris/native/sun/awt/gtk2_interface.h	Tue Jun 28 19:44:50 2016 +0100
045ef6
+++ openjdk/jdk/src/solaris/native/sun/awt/gtk2_interface.h	Wed Jun 29 18:09:29 2016 +0100
045ef6
@@ -1,5 +1,5 @@
045ef6
 /*
045ef6
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
045ef6
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
045ef6
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
045ef6
  *
045ef6
  * This code is free software; you can redistribute it and/or modify it
045ef6
@@ -140,7 +140,9 @@
045ef6
 typedef enum _Setting
045ef6
 {
045ef6
     GTK_FONT_NAME,
045ef6
-    GTK_ICON_SIZES
045ef6
+    GTK_ICON_SIZES,
045ef6
+    GTK_CURSOR_BLINK,
045ef6
+    GTK_CURSOR_BLINK_TIME
045ef6
 } Setting;
045ef6
 
045ef6
 /* GTK types, here to eliminate need for GTK headers at compile time */