summaryrefslogtreecommitdiff
path: root/gtk/gtkviewport.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-11-02 21:56:51 +0100
committerBenjamin Otte <otte@redhat.com>2016-11-02 22:00:29 +0100
commitd818f3fcd42cb1c9dd589458bd7f01ad2c97bf35 (patch)
tree14639d1f47367397575e7a0528c34a74f8e076d7 /gtk/gtkviewport.c
parentbb8b24da47bda36d277282bab46a7eb87dc02167 (diff)
downloadgtk+-d818f3fcd42cb1c9dd589458bd7f01ad2c97bf35.tar.gz
viewport: Turn into no-window widget
While doing so, get rid of the GdkWindow instead of keeping it.
Diffstat (limited to 'gtk/gtkviewport.c')
-rw-r--r--gtk/gtkviewport.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index ae200c6ed7..0a199ae501 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -462,7 +462,7 @@ gtk_viewport_init (GtkViewport *viewport)
priv = viewport->priv;
widget = GTK_WIDGET (viewport);
- gtk_widget_set_has_window (widget, TRUE);
+ gtk_widget_set_has_window (widget, FALSE);
gtk_widget_set_redraw_on_allocate (widget, FALSE);
priv->shadow_type = GTK_SHADOW_IN;
@@ -675,29 +675,18 @@ gtk_viewport_realize (GtkWidget *widget)
GtkBin *bin = GTK_BIN (widget);
GtkAdjustment *hadjustment = priv->hadjustment;
GtkAdjustment *vadjustment = priv->vadjustment;
- GtkAllocation allocation;
GtkAllocation view_allocation;
GtkWidget *child;
- GdkWindow *window;
gint event_mask;
- gtk_widget_set_realized (widget, TRUE);
-
- gtk_widget_get_allocation (widget, &allocation);
+ GTK_WIDGET_CLASS (gtk_viewport_parent_class)->realize (widget);
event_mask = gtk_widget_get_events (widget);
-
- window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
- event_mask | GDK_SCROLL_MASK | GDK_TOUCH_MASK | GDK_SMOOTH_SCROLL_MASK,
- &allocation);
- gtk_widget_set_window (widget, window);
- gtk_widget_register_window (widget, window);
-
gtk_css_gadget_get_content_allocation (priv->gadget,
&view_allocation, NULL);
- priv->view_window = gdk_window_new_child (window,
- 0,
+ priv->view_window = gdk_window_new_child (gtk_widget_get_window (widget),
+ event_mask | GDK_SCROLL_MASK | GDK_TOUCH_MASK | GDK_SMOOTH_SCROLL_MASK,
&view_allocation);
gtk_widget_register_window (widget, priv->view_window);
@@ -784,22 +773,12 @@ gtk_viewport_size_allocate (GtkWidget *widget,
gtk_widget_set_allocation (widget, allocation);
- if (gtk_widget_get_realized (widget))
- gdk_window_move_resize (gtk_widget_get_window (widget),
- allocation->x,
- allocation->y,
- allocation->width,
- allocation->height);
-
content_allocation = *allocation;
- content_allocation.x = content_allocation.y = 0;
gtk_css_gadget_allocate (priv->gadget,
&content_allocation,
gtk_widget_get_allocated_baseline (widget),
&clip);
- clip.x += allocation->x;
- clip.y += allocation->y;
gtk_widget_set_clip (widget, &clip);
}