[gtk+] range: Use gdk_window_new_input()



commit 13d8ac83eefc3c939902e05c755b0dedd28ed975
Author: Benjamin Otte <otte redhat com>
Date:   Sun Nov 6 23:46:44 2016 +0100

    range: Use gdk_window_new_input()

 gtk/gtkrange.c |   38 +++++++++++---------------------------
 1 files changed, 11 insertions(+), 27 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 6c881af..e260d7b 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -1977,37 +1977,21 @@ gtk_range_realize (GtkWidget *widget)
   GtkAllocation allocation;
   GtkRange *range = GTK_RANGE (widget);
   GtkRangePrivate *priv = range->priv;
-  GdkWindow *window;
-  GdkWindowAttr attributes;
-  gint attributes_mask;
 
-  gtk_widget_set_realized (widget, TRUE);
-
-  window = gtk_widget_get_parent_window (widget);
-  gtk_widget_set_window (widget, window);
-  g_object_ref (window);
+  GTK_WIDGET_CLASS (gtk_range_parent_class)->realize (widget);
 
   gtk_widget_get_allocation (widget, &allocation);
 
-  attributes.window_type = GDK_WINDOW_CHILD;
-  attributes.x = allocation.x;
-  attributes.y = allocation.y;
-  attributes.width = allocation.width;
-  attributes.height = allocation.height;
-  attributes.wclass = GDK_INPUT_ONLY;
-  attributes.event_mask = gtk_widget_get_events (widget);
-  attributes.event_mask |= GDK_BUTTON_PRESS_MASK |
-                           GDK_BUTTON_RELEASE_MASK |
-                           GDK_SCROLL_MASK |
-                           GDK_SMOOTH_SCROLL_MASK |
-                           GDK_ENTER_NOTIFY_MASK |
-                           GDK_LEAVE_NOTIFY_MASK |
-                           GDK_POINTER_MOTION_MASK;
-
-  attributes_mask = GDK_WA_X | GDK_WA_Y;
-
-  priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
-                                       &attributes, attributes_mask);
+  priv->event_window = gdk_window_new_input (gtk_widget_get_parent_window (widget),
+                                             gtk_widget_get_events (widget)
+                                             | GDK_BUTTON_PRESS_MASK
+                                             | GDK_BUTTON_RELEASE_MASK
+                                             | GDK_SCROLL_MASK
+                                             | GDK_SMOOTH_SCROLL_MASK
+                                             | GDK_ENTER_NOTIFY_MASK
+                                             | GDK_LEAVE_NOTIFY_MASK
+                                             | GDK_POINTER_MOTION_MASK,
+                                             &allocation);
   gtk_widget_register_window (widget, priv->event_window);
 }
 


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