[gtk+/gtk-3-12] Don't forget to allocate popovers
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-12] Don't forget to allocate popovers
- Date: Tue, 28 Oct 2014 15:35:43 +0000 (UTC)
commit ad29e0a5a619a50269a719e6f9b146a575b8aa1e
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Sep 6 21:32:53 2014 -0400
Don't forget to allocate popovers
When GtkApplicationWindow has a menubar, we don't chain up
to the GtkWindow size_allocate, which used to position the
popovers. Move that to _gtk_window_set_allocation() which
is always called by GtkApplicationWindow.
https://bugzilla.gnome.org/show_bug.cgi?id=736205
gtk/gtkwindow.c | 73 +++++++++++++++++++++++++++----------------------------
1 files changed, 36 insertions(+), 37 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 8e14f77..fc64c98 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6963,6 +6963,35 @@ update_opaque_region (GtkWindow *window,
cairo_region_destroy (opaque_region);
}
+static void
+popover_size_allocate (GtkWidget *widget,
+ GtkWindowPopover *popover,
+ GtkWindow *window)
+{
+ cairo_rectangle_int_t rect;
+
+ if (!popover->window)
+ return;
+
+ if (GTK_IS_POPOVER (popover->widget))
+ gtk_popover_update_position (GTK_POPOVER (popover->widget));
+
+ popover_get_rect (popover, window, &rect);
+ gdk_window_move_resize (popover->window, rect.x, rect.y,
+ rect.width, rect.height);
+ rect.x = rect.y = 0;
+ gtk_widget_size_allocate (widget, &rect);
+
+ if (gtk_widget_is_drawable (GTK_WIDGET (window)) &&
+ gtk_widget_is_visible (widget))
+ {
+ if (!gdk_window_is_visible (popover->window))
+ gdk_window_show (popover->window);
+ }
+ else if (gdk_window_is_visible (popover->window))
+ gdk_window_hide (popover->window);
+}
+
/* _gtk_window_set_allocation:
* @window: a #GtkWindow
* @allocation: the original allocation for the window
@@ -6992,6 +7021,7 @@ _gtk_window_set_allocation (GtkWindow *window,
GtkAllocation child_allocation;
gint border_width;
GtkBorder window_border = { 0 };
+ GList *link;
g_assert (allocation != NULL);
g_assert (allocation_out != NULL);
@@ -7072,35 +7102,15 @@ _gtk_window_set_allocation (GtkWindow *window,
child_allocation.height = MAX (1, child_allocation.height - border_width * 2);
*allocation_out = child_allocation;
-}
-static void
-popover_size_allocate (GtkWidget *widget,
- GtkWindowPopover *popover,
- GtkWindow *window)
-{
- cairo_rectangle_int_t rect;
-
- if (!popover->window)
- return;
-
- if (GTK_IS_POPOVER (popover->widget))
- gtk_popover_update_position (GTK_POPOVER (popover->widget));
-
- popover_get_rect (popover, window, &rect);
- gdk_window_move_resize (popover->window, rect.x, rect.y,
- rect.width, rect.height);
- rect.x = rect.y = 0;
- gtk_widget_size_allocate (widget, &rect);
-
- if (gtk_widget_is_drawable (GTK_WIDGET (window)) &&
- gtk_widget_is_visible (widget))
+ link = priv->popovers;
+ while (link)
{
- if (!gdk_window_is_visible (popover->window))
- gdk_window_show (popover->window);
+ GtkWindowPopover *popover = link->data;
+ link = link->next;
+ popover_size_allocate (popover->widget, popover, window);
}
- else if (gdk_window_is_visible (popover->window))
- gdk_window_hide (popover->window);
+
}
static void
@@ -7108,25 +7118,14 @@ gtk_window_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkWindow *window = GTK_WINDOW (widget);
- GtkWindowPrivate *priv = window->priv;
GtkWidget *child;
GtkAllocation child_allocation;
- GList *link;
_gtk_window_set_allocation (window, allocation, &child_allocation);
child = gtk_bin_get_child (GTK_BIN (window));
if (child && gtk_widget_get_visible (child))
gtk_widget_size_allocate (child, &child_allocation);
-
- link = priv->popovers;
-
- while (link)
- {
- GtkWindowPopover *popover = link->data;
- link = link->next;
- popover_size_allocate (popover->widget, popover, window);
- }
}
static gint
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]