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