[gtk+] Another attempt at fixing menu positioning corner cases
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Another attempt at fixing menu positioning corner cases
- Date: Fri, 6 Jan 2012 04:30:48 +0000 (UTC)
commit c74ac081433307472192ed5da958dc9109767c80
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jan 5 23:21:30 2012 -0500
Another attempt at fixing menu positioning corner cases
The code for moving the menu into monitor / workarea was duplicated,
once for the push-in scenario and once for without. The problem with
the second case is that we've stored the menu position before adjusting
it. That made us remember an out-of-monitor position that then later
triggered _another_ copy of this code in the size-request implementation.
Unify this to only have one copy of code, and only store the menu
position after adjusting it to be inside the monitor. This fixes both
statusicon menus that get popped up from the panel, outside the workarea,
to not have scroll arrows, and the gedit language menu which was not
placed in the monitor at all after the initial workarea commit.
As a side-effect of this change, we now make large scrolling menus
occupy the full height of the workarea. Before this change, we were
keeping either the top or bottom edge put while shrinking the menu
to fit in the monitor.
https://bugzilla.gnome.org/show_bug.cgi?id=667249
gtk/gtkmenu.c | 25 ++++++++++++-------------
1 files changed, 12 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index ac98589..40a841d 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -4783,23 +4783,22 @@ gtk_menu_position (GtkMenu *menu,
scroll_offset = 0;
- if (priv->initially_pushed_in)
+ if (y + requisition.height > monitor.y + monitor.height)
{
- if (y + requisition.height > monitor.y + monitor.height)
- {
- scroll_offset -= y + requisition.height - (monitor.y + monitor.height);
- y = (monitor.y + monitor.height) - requisition.height;
- }
-
- if (y < monitor.y)
- {
- scroll_offset += monitor.y - y;
- y = monitor.y;
- }
+ if (priv->initially_pushed_in)
+ scroll_offset += (monitor.y + monitor.height) - requisition.height - y;
+ y = (monitor.y + monitor.height) - requisition.height;
+ }
- x = CLAMP (x, monitor.x, MAX (monitor.x, monitor.x + monitor.width - requisition.width));
+ if (y < monitor.y)
+ {
+ if (priv->initially_pushed_in)
+ scroll_offset += monitor.y - y;
+ y = monitor.y;
}
+ x = CLAMP (x, monitor.x, MAX (monitor.x, monitor.x + monitor.width - requisition.width));
+
if (GTK_MENU_SHELL (menu)->priv->active)
{
priv->have_position = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]