[gimp] app: reimplement gimp_widget_flush_expose().



commit 7f05ec00cdcfa66072b0ecde858b371b162caca0
Author: Jehan <jehan girinstud io>
Date:   Tue Feb 19 15:31:50 2019 +0100

    app: reimplement gimp_widget_flush_expose().
    
    gimp_widget_flush_expose() has been removed since commit 3089a20167f.
    I now reimplemented it by simply checking if event sources are waiting
    to be processed.
    This was heavily needed as the statusbar was not showing any progress
    (at least on highly demanding process, such as saving or loading files),
    and therefore we were stuck with a seamingly frozen GUI.
    
    Despite the name, this does not apply to a widget in particular anymore,
    but to the whole program events.

 app/display/gimpstatusbar.c     | 20 ++++----------------
 app/widgets/gimpwidgets-utils.c |  7 +++++++
 app/widgets/gimpwidgets-utils.h |  2 ++
 3 files changed, 13 insertions(+), 16 deletions(-)
---
diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c
index c301a12d21..877f587220 100644
--- a/app/display/gimpstatusbar.c
+++ b/app/display/gimpstatusbar.c
@@ -441,10 +441,7 @@ gimp_statusbar_progress_start (GimpProgress *progress,
           statusbar->progress_shown = TRUE;
         }
 
-#if 0
-      /* FIXME flush_expose */
-      gimp_widget_flush_expose (bar);
-#endif
+      gimp_widget_flush_expose ();
 
       gimp_statusbar_override_window_title (statusbar);
 
@@ -503,10 +500,7 @@ gimp_statusbar_progress_set_text (GimpProgress *progress,
     {
       gimp_statusbar_replace (statusbar, "progress", NULL, "%s", message);
 
-#if 0
-      /* FIXME flush_expose */
-      gimp_widget_flush_expose (bar);
-#endif
+      gimp_widget_flush_expose ();
 
       gimp_statusbar_override_window_title (statusbar);
     }
@@ -544,10 +538,7 @@ gimp_statusbar_progress_set_value (GimpProgress *progress,
               gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar),
                                              percentage);
 
-#if 0
-              /* FIXME flush_expose */
-              gimp_widget_flush_expose (bar);
-#endif
+              gimp_widget_flush_expose ();
             }
         }
     }
@@ -582,10 +573,7 @@ gimp_statusbar_progress_pulse (GimpProgress *progress)
 
           gtk_progress_bar_pulse (GTK_PROGRESS_BAR (bar));
 
-#if 0
-          /* FIXME flush_expose */
-          gimp_widget_flush_expose (bar);
-#endif
+          gimp_widget_flush_expose ();
         }
     }
 }
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index 97ab148570..f437c5b6dc 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -1865,3 +1865,10 @@ gimp_color_profile_chooser_dialog_connect_path (GtkWidget   *dialog,
                     G_CALLBACK (connect_path_response),
                     NULL);
 }
+
+void
+gimp_widget_flush_expose (void)
+{
+  while (g_main_context_pending (NULL))
+    g_main_context_iteration (NULL, FALSE);
+}
diff --git a/app/widgets/gimpwidgets-utils.h b/app/widgets/gimpwidgets-utils.h
index c1db78d368..8fd6154160 100644
--- a/app/widgets/gimpwidgets-utils.h
+++ b/app/widgets/gimpwidgets-utils.h
@@ -126,5 +126,7 @@ void              gimp_color_profile_chooser_dialog_connect_path
                                                     GObject               *config,
                                                     const gchar           *property_name);
 
+void              gimp_widget_flush_expose         (void);
+
 
 #endif /* __APP_GIMP_WIDGETS_UTILS_H__ */


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