[gimp/wip/Jehan/jumping-cursor-label: 2/3] app: get rid of macOS-only specific workaround code.




commit 2340b50c3e3beee40fbe1ba6a9d6c82e8c020255
Author: Jehan <jehan girinstud io>
Date:   Wed Mar 9 11:49:24 2022 +0100

    app: get rid of macOS-only specific workaround code.

 app/display/gimpstatusbar.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)
---
diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c
index 96209ddd86..ca2b209f4b 100644
--- a/app/display/gimpstatusbar.c
+++ b/app/display/gimpstatusbar.c
@@ -152,9 +152,6 @@ static gchar *  gimp_statusbar_vprintf            (const gchar       *format,
 static GdkPixbuf * gimp_statusbar_load_icon       (GimpStatusbar     *statusbar,
                                                    const gchar       *icon_name);
 
-static void     gimp_statusbar_cursor_label_set_text (GimpStatusbar  *statusbar,
-                                                      gchar          *buffer);
-
 static gboolean gimp_statusbar_queue_pos_redraw   (gpointer           data);
 
 
@@ -1327,7 +1324,7 @@ gimp_statusbar_update_cursor (GimpStatusbar       *statusbar,
 void
 gimp_statusbar_clear_cursor (GimpStatusbar *statusbar)
 {
-  gimp_statusbar_cursor_label_set_text (statusbar, "");
+  gtk_label_set_text (GTK_LABEL (statusbar->cursor_label), "");
   gtk_widget_set_sensitive (statusbar->cursor_label, TRUE);
 }
 
@@ -1798,7 +1795,8 @@ gimp_statusbar_load_icon (GimpStatusbar *statusbar,
   return icon;
 }
 
-static gboolean gimp_statusbar_queue_pos_redraw (gpointer data)
+static gboolean
+gimp_statusbar_queue_pos_redraw (gpointer data)
 {
   GimpStatusbar    *statusbar = GIMP_STATUSBAR (data);
   GimpDisplayShell *shell;
@@ -1854,7 +1852,7 @@ static gboolean gimp_statusbar_queue_pos_redraw (gpointer data)
 
   g_free (statusbar->cursor_string_last);
   gtk_label_set_width_chars (GTK_LABEL (statusbar->cursor_label), label_width_chars);
-  gimp_statusbar_cursor_label_set_text (statusbar, statusbar->cursor_string_todraw);
+  gtk_label_set_text (GTK_LABEL (statusbar->cursor_label), statusbar->cursor_string_todraw);
   statusbar->cursor_string_last = statusbar->cursor_string_todraw;
   statusbar->cursor_string_todraw = NULL;
 
@@ -1862,19 +1860,3 @@ static gboolean gimp_statusbar_queue_pos_redraw (gpointer data)
 
   return G_SOURCE_REMOVE;
 }
-
-static void gimp_statusbar_cursor_label_set_text (GimpStatusbar *statusbar, gchar *buffer)
-{
-#ifdef GDK_WINDOWING_QUARTZ
-  /*
-   * Without this code, on MacOS the cursor label leaps about in width as the label width is
-   * closely wrapped to the content which changes with each cursor move.
-   * Here is a discussion of the issue:
-   * https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/572#note_1389445
-   */
-  if (gtk_label_get_width_chars (GTK_LABEL (statusbar->cursor_label)) <= (gint)strlen (buffer) + 4)
-    gtk_label_set_width_chars (GTK_LABEL (statusbar->cursor_label), strlen (buffer) + 6);
-#endif
-
-  gtk_label_set_text (GTK_LABEL (statusbar->cursor_label), buffer);
-}


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