[gimp/gimp-2-8] Bug 778966 - severe input lag with ruler and one window mode ...



commit a0a7cf2dcbd6be3bc893a3640d7045c6a20ef7f4
Author: Ell <ell_se yahoo com>
Date:   Wed Feb 22 18:31:39 2017 -0500

    Bug 778966 - severe input lag with ruler and one window mode ...
    
    .. due to gdk_pixbuf_scale() with themes using the pixbuf engine
    
    Make GimpDisplayShell a subclass of GtkEventBox, so that it gets its
    own window, isolating its events from those of its ancestors.
    
    In particular, the "expose" event handler of GtkNotebook, which the
    shell is a child of in SWM, is particularly slow with themes that
    use the pixbuf engine.  If the notebook and the shell use the same
    window, this can cause notable, and somtimes severe, lag when the
    rulers or scrollbars are updated frequently, such as when rapidly
    moving the cursor.

 app/display/gimpdisplayshell.c |   67 +++++++++++++++++++++++----------------
 app/display/gimpdisplayshell.h |    4 +-
 2 files changed, 41 insertions(+), 30 deletions(-)
---
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index a415023..be9da0f 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -161,7 +161,7 @@ static void   gimp_display_shell_transform_overlay (GimpDisplayShell *shell,
 
 
 G_DEFINE_TYPE_WITH_CODE (GimpDisplayShell, gimp_display_shell,
-                         GTK_TYPE_BOX,
+                         GTK_TYPE_EVENT_BOX,
                          G_IMPLEMENT_INTERFACE (GIMP_TYPE_PROGRESS,
                                                 gimp_display_shell_progress_iface_init)
                          G_IMPLEMENT_INTERFACE (GIMP_TYPE_COLOR_MANAGED,
@@ -275,9 +275,6 @@ gimp_color_managed_iface_init (GimpColorManagedInterface *iface)
 static void
 gimp_display_shell_init (GimpDisplayShell *shell)
 {
-  gtk_orientable_set_orientation (GTK_ORIENTABLE (shell),
-                                  GTK_ORIENTATION_VERTICAL);
-
   shell->options            = g_object_new (GIMP_TYPE_DISPLAY_OPTIONS, NULL);
   shell->fullscreen_options = g_object_new (GIMP_TYPE_DISPLAY_OPTIONS_FULLSCREEN, NULL);
   shell->no_image_options   = g_object_new (GIMP_TYPE_DISPLAY_OPTIONS_NO_IMAGE, NULL);
@@ -352,6 +349,7 @@ gimp_display_shell_constructed (GObject *object)
   GimpDisplayConfig     *config;
   GimpImage             *image;
   GimpColorDisplayStack *filter;
+  GtkWidget             *main_vbox;
   GtkWidget             *upper_hbox;
   GtkWidget             *right_vbox;
   GtkWidget             *lower_hbox;
@@ -427,34 +425,47 @@ gimp_display_shell_constructed (GObject *object)
    *
    *  shell
    *     |
-   *     +-- upper_hbox
-   *     |      |
-   *     |      +-- inner_table
-   *     |      |      |
-   *     |      |      +-- origin
-   *     |      |      +-- hruler
-   *     |      |      +-- vruler
-   *     |      |      +-- canvas
-   *     |      |
-   *     |      +-- right_vbox
-   *     |             |
-   *     |             +-- zoom_on_resize_button
-   *     |             +-- vscrollbar
-   *     |
-   *     +-- lower_hbox
-   *     |      |
-   *     |      +-- quick_mask
-   *     |      +-- hscrollbar
-   *     |      +-- navbutton
-   *     |
-   *     +-- statusbar
+   *     +-- main_vbox
+   *            |
+   *            +-- upper_hbox
+   *            |      |
+   *            |      +-- inner_table
+   *            |      |      |
+   *            |      |      +-- origin
+   *            |      |      +-- hruler
+   *            |      |      +-- vruler
+   *            |      |      +-- canvas
+   *            |      |
+   *            |      +-- right_vbox
+   *            |             |
+   *            |             +-- zoom_on_resize_button
+   *            |             +-- vscrollbar
+   *            |
+   *            +-- lower_hbox
+   *            |      |
+   *            |      +-- quick_mask
+   *            |      +-- hscrollbar
+   *            |      +-- navbutton
+   *            |
+   *            +-- statusbard
+   *
+   *  Note that we separate "shell" and "main_vbox", so that we can make
+   *  "shell" a GtkEventBox, giving it its own window.  This isolates our
+   *  events from those of our ancestors, avoiding some potential slowdowns,
+   *  and making things generally smoother.  See bug #778966.
    */
 
   /*  first, set up the container hierarchy  *********************************/
 
+  /*  the root vbox  */
+
+  main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+  gtk_container_add (GTK_CONTAINER (shell), main_vbox);
+  gtk_widget_show (main_vbox);
+
   /*  a hbox for the inner_table and the vertical scrollbar  */
   upper_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  gtk_box_pack_start (GTK_BOX (shell), upper_hbox, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (main_vbox), upper_hbox, TRUE, TRUE, 0);
   gtk_widget_show (upper_hbox);
 
   /*  the table containing origin, rulers and the canvas  */
@@ -473,7 +484,7 @@ gimp_display_shell_constructed (GObject *object)
    *  the navigation button
    */
   lower_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 1);
-  gtk_box_pack_start (GTK_BOX (shell), lower_hbox, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (main_vbox), lower_hbox, FALSE, FALSE, 0);
   gtk_widget_show (lower_hbox);
 
   /*  create the scrollbars  *************************************************/
@@ -680,7 +691,7 @@ gimp_display_shell_constructed (GObject *object)
   gimp_statusbar_set_shell (GIMP_STATUSBAR (shell->statusbar), shell);
   gimp_help_set_help_data (shell->statusbar, NULL,
                            GIMP_HELP_IMAGE_WINDOW_STATUS_BAR);
-  gtk_box_pack_end (GTK_BOX (shell), shell->statusbar, FALSE, FALSE, 0);
+  gtk_box_pack_end (GTK_BOX (main_vbox), shell->statusbar, FALSE, FALSE, 0);
 
   /*  pack all the widgets  **************************************************/
 
diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h
index 62d21e1..30bd0d6 100644
--- a/app/display/gimpdisplayshell.h
+++ b/app/display/gimpdisplayshell.h
@@ -47,7 +47,7 @@ typedef struct _GimpDisplayShellClass  GimpDisplayShellClass;
 
 struct _GimpDisplayShell
 {
-  GtkBox             parent_instance;
+  GtkEventBox        parent_instance;
 
   GimpDisplay       *display;
 
@@ -196,7 +196,7 @@ struct _GimpDisplayShell
 
 struct _GimpDisplayShellClass
 {
-  GtkBoxClass  parent_class;
+  GtkEventBoxClass  parent_class;
 
   void (* scaled)    (GimpDisplayShell *shell);
   void (* scrolled)  (GimpDisplayShell *shell);


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