提交 d15d3075 编写于 作者: S ssadetsky

6260348: GTK+ L&F JTextComponent not respecting desktop caret blink rate

Reviewed-by: alexsch, azvegint
上级 837330c6
/*
* Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -93,7 +93,9 @@ class GTKEngine {
*/
static enum Settings {
GTK_FONT_NAME,
GTK_ICON_SIZES
GTK_ICON_SIZES,
GTK_CURSOR_BLINK,
GTK_CURSOR_BLINK_TIME
}
/* Custom regions are needed for representing regions that don't exist
......
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -371,7 +371,17 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
int vProgWidth = 22 - (progXThickness * 2);
int vProgHeight = 80 - (progYThickness * 2);
Integer caretBlinkRate = Integer.valueOf(500);
Integer caretBlinkRate;
if (Boolean.FALSE.equals(GTKEngine.INSTANCE.getSetting(
GTKEngine.Settings.GTK_CURSOR_BLINK))) {
caretBlinkRate = Integer.valueOf(0);
} else {
caretBlinkRate = (Integer) GTKEngine.INSTANCE.getSetting(
GTKEngine.Settings.GTK_CURSOR_BLINK_TIME);
if (caretBlinkRate == null) {
caretBlinkRate = Integer.valueOf(500);
}
}
Insets zeroInsets = new InsetsUIResource(0, 0, 0, 0);
Double defaultCaretAspectRatio = new Double(0.025);
......
......@@ -1308,9 +1308,6 @@ static GtkWidget *gtk2_get_widget(WidgetType widget_type)
{
result = gtk2_widgets[_GTK_COMBO_BOX_TEXT_FIELD_TYPE] =
(*fp_gtk_entry_new)();
GtkSettings* settings = fp_gtk_widget_get_settings(result);
fp_g_object_set(settings, "gtk-cursor-blink", FALSE, NULL);
}
result = gtk2_widgets[_GTK_COMBO_BOX_TEXT_FIELD_TYPE];
break;
......@@ -1355,10 +1352,6 @@ static GtkWidget *gtk2_get_widget(WidgetType widget_type)
{
gtk2_widgets[_GTK_ENTRY_TYPE] =
(*fp_gtk_entry_new)();
GtkSettings* settings =
fp_gtk_widget_get_settings(gtk2_widgets[_GTK_ENTRY_TYPE]);
fp_g_object_set(settings, "gtk-cursor-blink", FALSE, NULL);
}
result = gtk2_widgets[_GTK_ENTRY_TYPE];
break;
......@@ -1550,9 +1543,6 @@ static GtkWidget *gtk2_get_widget(WidgetType widget_type)
{
result = gtk2_widgets[_GTK_SPIN_BUTTON_TYPE] =
(*fp_gtk_spin_button_new)(NULL, 0, 0);
GtkSettings* settings = fp_gtk_widget_get_settings(result);
fp_g_object_set(settings, "gtk-cursor-blink", FALSE, NULL);
}
result = gtk2_widgets[_GTK_SPIN_BUTTON_TYPE];
break;
......@@ -2502,14 +2492,20 @@ jobject get_string_property(JNIEnv *env, GtkSettings* settings, const gchar* key
return result;
}
/*
jobject get_integer_property(JNIEnv *env, GtkSettings* settings, const gchar* key)
{
gint intval = NULL;
(*fp_g_object_get)(settings, key, &intval, NULL);
return create_Integer(env, intval);
}*/
}
jobject get_boolean_property(JNIEnv *env, GtkSettings* settings, const gchar* key)
{
gint intval = NULL;
(*fp_g_object_get)(settings, key, &intval, NULL);
return create_Boolean(env, intval);
}
jobject gtk2_get_setting(JNIEnv *env, Setting property)
{
......@@ -2521,6 +2517,10 @@ jobject gtk2_get_setting(JNIEnv *env, Setting property)
return get_string_property(env, settings, "gtk-font-name");
case GTK_ICON_SIZES:
return get_string_property(env, settings, "gtk-icon-sizes");
case GTK_CURSOR_BLINK:
return get_boolean_property(env, settings, "gtk-cursor-blink");
case GTK_CURSOR_BLINK_TIME:
return get_integer_property(env, settings, "gtk-cursor-blink-time");
}
return NULL;
......
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -140,7 +140,9 @@ typedef enum _ColorType
typedef enum _Setting
{
GTK_FONT_NAME,
GTK_ICON_SIZES
GTK_ICON_SIZES,
GTK_CURSOR_BLINK,
GTK_CURSOR_BLINK_TIME
} Setting;
/* GTK types, here to eliminate need for GTK headers at compile time */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册