[gtk+] Deprecate and ignore the cursor blink settings



commit b2e666bf8f297eb998331fa8ce0062ce7a5198fa
Author: William Jon McCann <william jon mccann gmail com>
Date:   Wed Jun 26 12:32:31 2013 -0400

    Deprecate and ignore the cursor blink settings
    
    And hardcode them to reasonable values.

 gdk/wayland/gdkscreen-wayland.c |    3 --
 gdk/win32/gdkproperty-win32.c   |    3 --
 gdk/x11/gdksettings.c           |    3 --
 gtk/gtkentry.c                  |   51 ++++++++------------------------------
 gtk/gtksettings.c               |   15 +++++++++--
 gtk/gtktextview.c               |   52 ++++++++------------------------------
 6 files changed, 34 insertions(+), 93 deletions(-)
---
diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c
index 1593b61..a081e11 100644
--- a/gdk/wayland/gdkscreen-wayland.c
+++ b/gdk/wayland/gdkscreen-wayland.c
@@ -478,9 +478,6 @@ static TranslationEntry translations[] = {
   { "org.gnome.desktop.interface", "cursor-theme", "gtk-cursor-theme-name", G_TYPE_STRING, { .s = "Adwaita" 
} },
   { "org.gnome.desktop.interface", "cursor-size", "gtk-cursor-theme-size", G_TYPE_INT, { .i = 32 } },
   { "org.gnome.desktop.interface", "font-name", "gtk-font-name", G_TYPE_STRING, { .s = "Cantarell 11" } },
-  { "org.gnome.desktop.interface", "cursor-blink", "gtk-cursor-blink", G_TYPE_BOOLEAN,  { .b = TRUE } },
-  { "org.gnome.desktop.interface", "cursor-blink-time", "gtk-cursor-blink-time", G_TYPE_INT, { .i = 1200 } },
-  { "org.gnome.desktop.interface", "cursor-blink-timeout", "gtk-cursor-blink-timeout", G_TYPE_INT, { .i = 
3600 } },
   { "org.gnome.desktop.interface", "gtk-im-module", "gtk-im-module", G_TYPE_STRING, { .s = "simple" } },
   { "org.gnome.desktop.interface", "enable-animations", "gtk-enable-animations", G_TYPE_BOOLEAN, { .b = TRUE 
} },
   { "org.gnome.desktop.interface", "toolbar-style", "gtk-toolbar-style", G_TYPE_STRING, { .s = "both-horiz"} 
},
diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c
index 9c0fa50..161bae2 100644
--- a/gdk/win32/gdkproperty-win32.c
+++ b/gdk/win32/gdkproperty-win32.c
@@ -303,8 +303,6 @@ _gdk_win32_window_delete_property (GdkWindow *window,
   "Net/DoubleClickTime\0"     "gtk-double-click-time\0"
   "Net/DoubleClickDistance\0" "gtk-double-click-distance\0"
   "Net/DndDragThreshold\0"    "gtk-dnd-drag-threshold\0"
-  "Net/CursorBlink\0"         "gtk-cursor-blink\0"
-  "Net/CursorBlinkTime\0"     "gtk-cursor-blink-time\0"
   "Net/ThemeName\0"           "gtk-theme-name\0"
   "Net/IconThemeName\0"       "gtk-icon-theme-name\0"
   "Gtk/ColorPalette\0"        "gtk-color-palette\0"
@@ -318,7 +316,6 @@ _gdk_win32_window_delete_property (GdkWindow *window,
   "Gtk/Modules\0"             "gtk-modules\0"
   "Gtk/FileChooserBackend\0"  "gtk-file-chooser-backend\0"
   "Gtk/MenuBarAccel\0"        "gtk-menu-bar-accel\0"
-  "Gtk/CursorBlinkTimeout\0"  "gtk-cursor-blink-timeout\0"
   "Gtk/CursorThemeName\0"     "gtk-cursor-theme-name\0"
   "Gtk/CursorThemeSize\0"     "gtk-cursor-theme-size\0"
   "Gtk/TimeoutInitial\0"      "gtk-timeout-initial\0"
diff --git a/gdk/x11/gdksettings.c b/gdk/x11/gdksettings.c
index 2f02c34..d7e1b29 100644
--- a/gdk/x11/gdksettings.c
+++ b/gdk/x11/gdksettings.c
@@ -28,8 +28,6 @@ static const struct {
   {"Net/DoubleClickTime",     "gtk-double-click-time"},
   {"Net/DoubleClickDistance", "gtk-double-click-distance"},
   {"Net/DndDragThreshold",    "gtk-dnd-drag-threshold"},
-  {"Net/CursorBlink",         "gtk-cursor-blink"},
-  {"Net/CursorBlinkTime",     "gtk-cursor-blink-time"},
   {"Net/ThemeName",           "gtk-theme-name"},
   {"Net/IconThemeName",       "gtk-icon-theme-name"},
   {"Gtk/ColorPalette",        "gtk-color-palette"},
@@ -63,7 +61,6 @@ static const struct {
   {"Net/SoundThemeName",      "gtk-sound-theme-name"},
   {"Net/EnableInputFeedbackSounds", "gtk-enable-input-feedback-sounds"},
   {"Net/EnableEventSounds",   "gtk-enable-event-sounds"},
-  {"Gtk/CursorBlinkTimeout",  "gtk-cursor-blink-timeout"},
   {"Gtk/VisibleFocus",        "gtk-visible-focus"},
   {"Gtk/ShellShowsAppMenu",   "gtk-shell-shows-app-menu"},
   {"Gtk/ShellShowsMenubar",   "gtk-shell-shows-menubar"},
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index bc5f6e3..9d61264 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -123,6 +123,9 @@
 
 #define MAX_ICONS 2
 
+#define CURSOR_BLINK_TIME        1200
+#define CURSOR_BLINK_TIMEOUT_SEC 10
+
 #define IS_VALID_ICON_POSITION(pos)               \
   ((pos) == GTK_ENTRY_ICON_PRIMARY ||                   \
    (pos) == GTK_ENTRY_ICON_SECONDARY)
@@ -9737,15 +9740,7 @@ cursor_blinks (GtkEntry *entry)
   if (gtk_widget_has_focus (GTK_WIDGET (entry)) &&
       priv->editable &&
       priv->selection_bound == priv->current_pos)
-    {
-      GtkSettings *settings;
-      gboolean blink;
-
-      settings = gtk_widget_get_settings (GTK_WIDGET (entry));
-      g_object_get (settings, "gtk-cursor-blink", &blink, NULL);
-
-      return blink;
-    }
+    return TRUE;
   else
     return FALSE;
 }
@@ -9762,28 +9757,6 @@ get_middle_click_paste (GtkEntry *entry)
   return paste;
 }
 
-static gint
-get_cursor_time (GtkEntry *entry)
-{
-  GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (entry));
-  gint time;
-
-  g_object_get (settings, "gtk-cursor-blink-time", &time, NULL);
-
-  return time;
-}
-
-static gint
-get_cursor_blink_timeout (GtkEntry *entry)
-{
-  GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (entry));
-  gint timeout;
-
-  g_object_get (settings, "gtk-cursor-blink-timeout", &timeout, NULL);
-
-  return timeout;
-}
-
 static void
 show_cursor (GtkEntry *entry)
 {
@@ -9824,7 +9797,6 @@ blink_cb (gpointer data)
 {
   GtkEntry *entry;
   GtkEntryPrivate *priv; 
-  gint blink_timeout;
 
   entry = GTK_ENTRY (data);
   priv = entry->priv;
@@ -9842,9 +9814,8 @@ blink_cb (gpointer data)
   
   g_assert (priv->selection_bound == priv->current_pos);
   
-  blink_timeout = get_cursor_blink_timeout (entry);
-  if (priv->blink_time > 1000 * blink_timeout && 
-      blink_timeout < G_MAXINT/1000) 
+  if (priv->blink_time > 1000 * CURSOR_BLINK_TIMEOUT_SEC && 
+      CURSOR_BLINK_TIMEOUT_SEC < G_MAXINT/1000) 
     {
       /* we've blinked enough without the user doing anything, stop blinking */
       show_cursor (entry);
@@ -9853,15 +9824,15 @@ blink_cb (gpointer data)
   else if (priv->cursor_visible)
     {
       hide_cursor (entry);
-      priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_OFF_MULTIPLIER / 
CURSOR_DIVIDER,
+      priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_OFF_MULTIPLIER / 
CURSOR_DIVIDER,
                                            blink_cb,
                                            entry);
     }
   else
     {
       show_cursor (entry);
-      priv->blink_time += get_cursor_time (entry);
-      priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / 
CURSOR_DIVIDER,
+      priv->blink_time += CURSOR_BLINK_TIME;
+      priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_ON_MULTIPLIER / 
CURSOR_DIVIDER,
                                            blink_cb,
                                            entry);
     }
@@ -9880,7 +9851,7 @@ gtk_entry_check_cursor_blink (GtkEntry *entry)
       if (!priv->blink_timeout)
        {
          show_cursor (entry);
-         priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / 
CURSOR_DIVIDER,
+         priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_ON_MULTIPLIER / 
CURSOR_DIVIDER,
                                                blink_cb,
                                                entry);
        }
@@ -9907,7 +9878,7 @@ gtk_entry_pend_cursor_blink (GtkEntry *entry)
       if (priv->blink_timeout != 0)
        g_source_remove (priv->blink_timeout);
 
-      priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_PEND_MULTIPLIER / 
CURSOR_DIVIDER,
+      priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_PEND_MULTIPLIER / 
CURSOR_DIVIDER,
                                                      blink_cb,
                                                      entry);
       show_cursor (entry);
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 3438c97..67b3e24 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -370,8 +370,7 @@ gtk_settings_class_init (GtkSettingsClass *class)
    *
    * Whether the cursor should blink.
    *
-   * Also see the #GtkSettings:gtk-cursor-blink-timeout setting,
-   * which allows more flexible control over cursor blinking.
+   * Deprecated: 3.10: This setting is ignored.
    */
   result = settings_install_property_parser (class,
                                              g_param_spec_boolean ("gtk-cursor-blink",
@@ -381,6 +380,14 @@ gtk_settings_class_init (GtkSettingsClass *class)
                                                                    GTK_PARAM_READWRITE),
                                              NULL);
   g_assert (result == PROP_CURSOR_BLINK);
+
+  /**
+   * GtkSettings:gtk-cursor-blink-time:
+   *
+   * Length of the cursor blink cycle, in milliseconds.
+   *
+   * Deprecated: 3.10: This setting is ignored.
+   */
   result = settings_install_property_parser (class,
                                              g_param_spec_int ("gtk-cursor-blink-time",
                                                                P_("Cursor Blink Time"),
@@ -400,12 +407,14 @@ gtk_settings_class_init (GtkSettingsClass *class)
    * #GtkSettings:gtk-cursor-blink to %FALSE.
    *
    * Since: 2.12
+   *
+   * Deprecated: 3.10: This setting is ignored.
    */
   result = settings_install_property_parser (class,
                                              g_param_spec_int ("gtk-cursor-blink-timeout",
                                                                P_("Cursor Blink Timeout"),
                                                                P_("Time after which the cursor stops 
blinking, in seconds"),
-                                                               1, G_MAXINT, G_MAXINT,
+                                                               1, G_MAXINT, 10,
                                                                GTK_PARAM_READWRITE),
                                              NULL);
   g_assert (result == PROP_CURSOR_BLINK_TIMEOUT);
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index cec9c63..08c1ab0 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -119,6 +119,9 @@
 
 #define SPACE_FOR_CURSOR 1
 
+#define CURSOR_BLINK_TIME        1200
+#define CURSOR_BLINK_TIMEOUT_SEC 10
+
 #define GTK_TEXT_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_TEXT_VIEW, 
GtkTextViewPrivate))
 
 typedef struct _GtkTextWindow GtkTextWindow;
@@ -5417,20 +5420,12 @@ gtk_text_view_forall (GtkContainer *container,
 static gboolean
 cursor_blinks (GtkTextView *text_view)
 {
-  GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
-  gboolean blink;
-
 #ifdef DEBUG_VALIDATION_AND_SCROLLING
   return FALSE;
 #endif
   if (gtk_get_debug_flags () & GTK_DEBUG_UPDATES)
     return FALSE;
 
-  g_object_get (settings, "gtk-cursor-blink", &blink, NULL);
-
-  if (!blink)
-    return FALSE;
-
   if (text_view->priv->editable)
     {
       GtkTextMark *insert;
@@ -5440,7 +5435,7 @@ cursor_blinks (GtkTextView *text_view)
       gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &iter, insert);
       
       if (gtk_text_iter_editable (&iter, text_view->priv->editable))
-       return blink;
+       return TRUE;
     }
 
   return FALSE;
@@ -5458,29 +5453,6 @@ get_middle_click_paste (GtkTextView *text_view)
   return paste;
 }
 
-static gint
-get_cursor_time (GtkTextView *text_view)
-{
-  GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
-  gint time;
-
-  g_object_get (settings, "gtk-cursor-blink-time", &time, NULL);
-
-  return time;
-}
-
-static gint
-get_cursor_blink_timeout (GtkTextView *text_view)
-{
-  GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
-  gint time;
-
-  g_object_get (settings, "gtk-cursor-blink-timeout", &time, NULL);
-
-  return time;
-}
-
-
 /*
  * Blink!
  */
@@ -5491,7 +5463,6 @@ blink_cb (gpointer data)
   GtkTextView *text_view;
   GtkTextViewPrivate *priv;
   gboolean visible;
-  gint blink_timeout;
 
   text_view = GTK_TEXT_VIEW (data);
   priv = text_view->priv;
@@ -5512,24 +5483,23 @@ blink_cb (gpointer data)
 
   visible = gtk_text_layout_get_cursor_visible (priv->layout);
 
-  blink_timeout = get_cursor_blink_timeout (text_view);
-  if (priv->blink_time > 1000 * blink_timeout &&
-      blink_timeout < G_MAXINT/1000) 
+  if (priv->blink_time > 1000 * CURSOR_BLINK_TIMEOUT_SEC &&
+      CURSOR_BLINK_TIMEOUT_SEC < G_MAXINT/1000) 
     {
       /* we've blinked enough without the user doing anything, stop blinking */
       visible = 0;
       priv->blink_timeout = 0;
     } 
   else if (visible)
-    priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER / 
CURSOR_DIVIDER,
+    priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_OFF_MULTIPLIER / 
CURSOR_DIVIDER,
                                                   blink_cb,
                                                   text_view);
   else 
     {
-      priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_ON_MULTIPLIER / 
CURSOR_DIVIDER,
+      priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_ON_MULTIPLIER / 
CURSOR_DIVIDER,
                                                     blink_cb,
                                                     text_view);
-      priv->blink_time += get_cursor_time (text_view);
+      priv->blink_time += CURSOR_BLINK_TIME;
     }
 
   /* Block changed_handler while changing the layout's cursor visibility
@@ -5576,7 +5546,7 @@ gtk_text_view_check_cursor_blink (GtkTextView *text_view)
            {
              gtk_text_layout_set_cursor_visible (priv->layout, TRUE);
              
-             priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * 
CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
+             priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_OFF_MULTIPLIER / 
CURSOR_DIVIDER,
                                                             blink_cb,
                                                             text_view);
            }
@@ -5607,7 +5577,7 @@ gtk_text_view_pend_cursor_blink (GtkTextView *text_view)
       gtk_text_view_stop_cursor_blink (text_view);
       gtk_text_layout_set_cursor_visible (priv->layout, TRUE);
       
-      priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_PEND_MULTIPLIER / 
CURSOR_DIVIDER,
+      priv->blink_timeout = gdk_threads_add_timeout (CURSOR_BLINK_TIME * CURSOR_PEND_MULTIPLIER / 
CURSOR_DIVIDER,
                                                     blink_cb,
                                                     text_view);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]