[gtk+/multitouch-for-3.4: 17/89] scrolledwindow: Remove priv->event_window
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/multitouch-for-3.4: 17/89] scrolledwindow: Remove priv->event_window
- Date: Thu, 23 Feb 2012 12:27:21 +0000 (UTC)
commit c1c6cd75aaaf42dcc3dd2d4c86fa45a8f999c793
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Nov 6 19:03:52 2011 +0100
scrolledwindow: Remove priv->event_window
It looks like a leftover from pre-captured-event iterations of
the patch, it is completely unnecessary now.
gtk/gtkscrolledwindow.c | 109 ++--------------------------------------------
1 files changed, 5 insertions(+), 104 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 2f6b162..3996230 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -166,7 +166,6 @@ struct _GtkScrolledWindowPrivate
gint min_content_height;
/* Kinetic scrolling */
- GdkWindow *event_window;
GdkEvent *button_press_event;
guint kinetic_scrolling_enabled : 1;
guint in_drag : 1;
@@ -220,10 +219,6 @@ static void gtk_scrolled_window_get_property (GObject *objec
GParamSpec *pspec);
static void gtk_scrolled_window_destroy (GtkWidget *widget);
-static void gtk_scrolled_window_realize (GtkWidget *widget);
-static void gtk_scrolled_window_unrealize (GtkWidget *widget);
-static void gtk_scrolled_window_map (GtkWidget *widget);
-static void gtk_scrolled_window_unmap (GtkWidget *widget);
static void gtk_scrolled_window_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen);
static gboolean gtk_scrolled_window_draw (GtkWidget *widget,
@@ -329,10 +324,6 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
gobject_class->get_property = gtk_scrolled_window_get_property;
widget_class->destroy = gtk_scrolled_window_destroy;
- widget_class->realize = gtk_scrolled_window_realize;
- widget_class->unrealize = gtk_scrolled_window_unrealize;
- widget_class->map = gtk_scrolled_window_map;
- widget_class->unmap = gtk_scrolled_window_unmap;
widget_class->screen_changed = gtk_scrolled_window_screen_changed;
widget_class->draw = gtk_scrolled_window_draw;
widget_class->size_allocate = gtk_scrolled_window_size_allocate;
@@ -1112,8 +1103,6 @@ gtk_scrolled_window_set_kinetic_scrolling (GtkScrolledWindow *scrolled_window,
priv->kinetic_scrolling_enabled = enable;
if (priv->kinetic_scrolling_enabled)
{
- if (priv->event_window)
- gdk_window_show (priv->event_window);
motion_event_list_init (&priv->motion_events, 3);
priv->button_press_id =
g_signal_connect (scrolled_window, "captured-event",
@@ -1158,8 +1147,6 @@ gtk_scrolled_window_set_kinetic_scrolling (GtkScrolledWindow *scrolled_window,
priv->release_timeout_id = 0;
}
motion_event_list_clear (&priv->motion_events);
- if (priv->event_window)
- gdk_window_hide (priv->event_window);
}
g_object_notify (G_OBJECT (scrolled_window), "kinetic-scrolling");
}
@@ -1246,83 +1233,6 @@ gtk_scrolled_window_destroy (GtkWidget *widget)
}
static void
-gtk_scrolled_window_realize (GtkWidget *widget)
-{
- GtkAllocation allocation;
- GdkWindow *window;
- GdkWindowAttr attributes;
- gint attributes_mask;
- gint border_width;
- GtkScrolledWindowPrivate *priv;
-
- priv = GTK_SCROLLED_WINDOW (widget)->priv;
-
- gtk_widget_set_realized (widget, TRUE);
-
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- gtk_widget_get_allocation (widget, &allocation);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = allocation.x + border_width;
- attributes.y = allocation.y + border_width;
- attributes.width = allocation.width - 2 * border_width;
- attributes.height = allocation.height - 2 * border_width;
- attributes.wclass = GDK_INPUT_ONLY;
- attributes.event_mask = gtk_widget_get_events (widget)
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_BUTTON1_MOTION_MASK;
- attributes_mask = GDK_WA_X | GDK_WA_Y;
-
- window = gtk_widget_get_parent_window (widget);
- gtk_widget_set_window (widget, window);
- g_object_ref (window);
-
- priv->event_window = gdk_window_new (window, &attributes, attributes_mask);
- gdk_window_set_user_data (priv->event_window, widget);
-}
-
-static void
-gtk_scrolled_window_unrealize (GtkWidget *widget)
-{
- GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
- GtkScrolledWindowPrivate *priv = scrolled_window->priv;
-
- if (priv->event_window)
- {
- gdk_window_set_user_data (priv->event_window, NULL);
- gdk_window_destroy (priv->event_window);
- priv->event_window = NULL;
- }
-
- GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->unrealize (widget);
-}
-
-static void
-gtk_scrolled_window_map (GtkWidget *widget)
-{
- GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
- GtkScrolledWindowPrivate *priv = scrolled_window->priv;
-
- if (priv->kinetic_scrolling_enabled && priv->event_window)
- gdk_window_show (priv->event_window);
-
- GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->map (widget);
-}
-
-static void
-gtk_scrolled_window_unmap (GtkWidget *widget)
-{
- GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
- GtkScrolledWindowPrivate *priv = scrolled_window->priv;
-
- if (priv->event_window)
- gdk_window_hide (priv->event_window);
-
- GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->unmap (widget);
-}
-
-static void
gtk_scrolled_window_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -2043,16 +1953,6 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
gtk_scrolled_window_relative_allocation (widget, &relative_allocation);
}
- if (priv->event_window)
- {
- gdk_window_move_resize (priv->event_window,
- relative_allocation.x + allocation->x,
- relative_allocation.y + allocation->y,
- relative_allocation.width,
- relative_allocation.height);
-
- }
-
if (priv->hscrollbar_visible)
{
if (!gtk_widget_get_visible (priv->hscrollbar))
@@ -2953,7 +2853,7 @@ gtk_scrolled_window_button_press_event (GtkWidget *widget,
gint threshold;
GtkWidget *event_widget;
GdkEventButton *event;
- GdkDevice *source_device;
+ GdkDevice *device, *source_device;
GdkInputSource source;
if (_event->type != GDK_BUTTON_PRESS)
@@ -2992,14 +2892,15 @@ gtk_scrolled_window_button_press_event (GtkWidget *widget,
if (priv->hscrollbar == event_widget || priv->vscrollbar == event_widget)
return FALSE;
- gdk_device_grab (gdk_event_get_device (_event),
- priv->event_window,
+ device = gdk_event_get_device (_event);
+ gdk_device_grab (device,
+ gtk_widget_get_window (widget),
GDK_OWNERSHIP_WINDOW,
TRUE,
GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK,
NULL,
event->time);
- gdk_window_lower (priv->event_window);
+ gtk_device_grab_add (widget, device, TRUE);
/* Reset motion buffer */
motion_event_list_reset (&priv->motion_events);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]