[gtk+/wip/carlosg/event-delivery: 62/66] gtklayout: Remove widget window
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/carlosg/event-delivery: 62/66] gtklayout: Remove widget window
- Date: Mon, 10 Apr 2017 15:31:07 +0000 (UTC)
commit c0de098d894bc93ebf06e9d8476821f18563a15b
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Apr 6 14:50:28 2017 +0200
gtklayout: Remove widget window
It can be entirely replaced by a clip allocation on the widget.
gtk/gtklayout.c | 39 +++++++++++++++++----------------------
1 files changed, 17 insertions(+), 22 deletions(-)
---
diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c
index 670d5ef..cd71622 100644
--- a/gtk/gtklayout.c
+++ b/gtk/gtklayout.c
@@ -744,7 +744,7 @@ gtk_layout_init (GtkLayout *layout)
{
GtkLayoutPrivate *priv;
- gtk_widget_set_has_window (GTK_WIDGET (layout), TRUE);
+ gtk_widget_set_has_window (GTK_WIDGET (layout), FALSE);
layout->priv = gtk_layout_get_instance_private (layout);
priv = layout->priv;
@@ -774,24 +774,17 @@ gtk_layout_realize (GtkWidget *widget)
GtkLayout *layout = GTK_LAYOUT (widget);
GtkLayoutPrivate *priv = layout->priv;
GtkAllocation allocation;
- GdkWindow *window;
GList *tmp_list;
- gtk_widget_set_realized (widget, TRUE);
+ GTK_WIDGET_CLASS (gtk_layout_parent_class)->realize (widget);
gtk_widget_get_allocation (widget, &allocation);
- window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
- GDK_VISIBILITY_NOTIFY_MASK,
- &allocation);
- gtk_widget_set_window (widget, window);
- gtk_widget_register_window (widget, window);
-
- priv->bin_window = gdk_window_new_child (window,
+ priv->bin_window = gdk_window_new_child (gtk_widget_get_window (widget),
GDK_ALL_EVENTS_MASK,
&(GdkRectangle) {
- - gtk_adjustment_get_value (priv->hadjustment),
- - gtk_adjustment_get_value (priv->vadjustment),
+ allocation.x - gtk_adjustment_get_value (priv->hadjustment),
+ allocation.y - gtk_adjustment_get_value (priv->vadjustment),
MAX (priv->width, allocation.width),
MAX (priv->height, allocation.height)});
gtk_widget_register_window (widget, priv->bin_window);
@@ -829,7 +822,6 @@ gtk_layout_map (GtkWidget *widget)
}
gdk_window_show (priv->bin_window);
- gdk_window_show (gtk_widget_get_window (widget));
}
static void
@@ -880,17 +872,17 @@ gtk_layout_size_allocate (GtkWidget *widget,
if (gtk_widget_get_realized (widget))
{
- gdk_window_move_resize (gtk_widget_get_window (widget),
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- gdk_window_resize (priv->bin_window,
- MAX (priv->width, allocation->width),
- MAX (priv->height, allocation->height));
+ gdk_window_move_resize (priv->bin_window,
+ allocation->x - gtk_adjustment_get_value (priv->hadjustment),
+ allocation->y - gtk_adjustment_get_value (priv->vadjustment),
+ MAX (priv->width, allocation->width),
+ MAX (priv->height, allocation->height));
}
gtk_layout_set_hadjustment_values (layout);
gtk_layout_set_vadjustment_values (layout);
+
+ gtk_widget_set_clip (widget, allocation);
}
/* Container methods
@@ -984,8 +976,11 @@ gtk_layout_adjustment_changed (GtkAdjustment *adjustment,
if (gtk_widget_get_realized (GTK_WIDGET (layout)))
{
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (GTK_WIDGET (layout), &allocation);
gdk_window_move (priv->bin_window,
- - gtk_adjustment_get_value (priv->hadjustment),
- - gtk_adjustment_get_value (priv->vadjustment));
+ allocation.x - gtk_adjustment_get_value (priv->hadjustment),
+ allocation.y - gtk_adjustment_get_value (priv->vadjustment));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]