[gtk+/wip/carlosg/event-delivery: 50/75] gtkstack: Remove view window



commit b6e58bfd6f49f5d6c67396fc421168a976b1aa88
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Apr 5 16:30:07 2017 +0200

    gtkstack: Remove view window
    
    This widget already sets a clip area, so the view window can be safely
    removed.

 gtk/gtkstack.c |   31 +++++++------------------------
 1 files changed, 7 insertions(+), 24 deletions(-)
---
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index 1cde1ae..1c22339 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -133,7 +133,6 @@ typedef struct {
   GList *children;
 
   GdkWindow* bin_window;
-  GdkWindow* view_window;
 
   GtkStackChildInfo *visible_child;
 
@@ -323,14 +322,8 @@ gtk_stack_realize (GtkWidget *widget)
 
   gtk_css_gadget_get_content_allocation (priv->gadget, &allocation, NULL);
 
-  priv->view_window =
-    gdk_window_new_child (gtk_widget_get_window (GTK_WIDGET (stack)),
-                          GDK_ALL_EVENTS_MASK,
-                          &allocation);
-  gtk_widget_register_window (widget, priv->view_window);
-
   priv->bin_window =
-    gdk_window_new_child (priv->view_window,
+    gdk_window_new_child (gtk_widget_get_window (widget),
                           GDK_ALL_EVENTS_MASK,
                           &(GdkRectangle) {
                             get_bin_window_x (stack, &allocation),
@@ -345,8 +338,6 @@ gtk_stack_realize (GtkWidget *widget)
 
       gtk_widget_set_parent_window (info->widget, priv->bin_window);
     }
-
-  gdk_window_show (priv->bin_window);
 }
 
 static void
@@ -358,9 +349,6 @@ gtk_stack_unrealize (GtkWidget *widget)
   gtk_widget_unregister_window (widget, priv->bin_window);
   gdk_window_destroy (priv->bin_window);
   priv->bin_window = NULL;
-  gtk_widget_unregister_window (widget, priv->view_window);
-  gdk_window_destroy (priv->view_window);
-  priv->view_window = NULL;
 
   GTK_WIDGET_CLASS (gtk_stack_parent_class)->unrealize (widget);
 }
@@ -373,7 +361,7 @@ gtk_stack_map (GtkWidget *widget)
 
   GTK_WIDGET_CLASS (gtk_stack_parent_class)->map (widget);
 
-  gdk_window_show (priv->view_window);
+  gdk_window_show (priv->bin_window);
 }
 
 static void
@@ -382,7 +370,7 @@ gtk_stack_unmap (GtkWidget *widget)
   GtkStack *stack = GTK_STACK (widget);
   GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
 
-  gdk_window_hide (priv->view_window);
+  gdk_window_hide (priv->bin_window);
 
   GTK_WIDGET_CLASS (gtk_stack_parent_class)->unmap (widget);
 }
@@ -823,7 +811,7 @@ get_bin_window_x (GtkStack            *stack,
         x = -allocation->width * (1 - gtk_progress_tracker_get_ease_out_cubic (&priv->tracker, FALSE));
     }
 
-  return x;
+  return x + allocation->x;
 }
 
 static gint
@@ -841,7 +829,7 @@ get_bin_window_y (GtkStack            *stack,
         y = -allocation->height * (1 - gtk_progress_tracker_get_ease_out_cubic (&priv->tracker, FALSE));
     }
 
-  return y;
+  return y + allocation->y;
 }
 
 static void
@@ -2007,8 +1995,8 @@ gtk_stack_snapshot_slide (GtkWidget   *widget,
 
       gtk_widget_get_allocation (widget, &allocation);
 
-      x = get_bin_window_x (stack, &allocation);
-      y = get_bin_window_y (stack, &allocation);
+      x = get_bin_window_x (stack, &allocation) - allocation.x;
+      y = get_bin_window_y (stack, &allocation) - allocation.y;
 
       switch (priv->active_transition_type)
         {
@@ -2158,8 +2146,6 @@ gtk_stack_size_allocate (GtkWidget     *widget,
                            allocation,
                            gtk_widget_get_allocated_baseline (widget),
                            &clip);
-  clip.x += allocation->x;
-  clip.y += allocation->y;
 
   gtk_widget_set_clip (widget, &clip);
 }
@@ -2185,9 +2171,6 @@ gtk_stack_allocate (GtkCssGadget        *gadget,
 
   if (gtk_widget_get_realized (widget))
     {
-      gdk_window_move_resize (priv->view_window,
-                              allocation->x, allocation->y,
-                              allocation->width, allocation->height);
       gdk_window_move_resize (priv->bin_window,
                               get_bin_window_x (stack, allocation), get_bin_window_y (stack, allocation),
                               allocation->width, allocation->height);


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