elementaryart team mailing list archive
-
elementaryart team
-
Mailing list archive
-
Message #00361
[Merge] lp:~kekun-plazas/granite/centered-menu into lp:granite
Adrien Plazas has proposed merging lp:~kekun-plazas/granite/centered-menu into lp:granite.
Requested reviews:
elementary desktop team (elementaryart)
For more details, see:
https://code.launchpad.net/~kekun-plazas/granite/centered-menu/+merge/64386
Made the menu of ToogleButtonWithMenu popup centered under it.
--
https://code.launchpad.net/~kekun-plazas/granite/centered-menu/+merge/64386
Your team elementary desktop team is requested to review the proposed merge of lp:~kekun-plazas/granite/centered-menu into lp:granite.
=== modified file 'lib/Widgets/ToolButtonWithMenu.vala'
--- lib/Widgets/ToolButtonWithMenu.vala 2011-05-23 17:56:18 +0000
+++ lib/Widgets/ToolButtonWithMenu.vala 2011-06-13 11:22:36 +0000
@@ -229,11 +229,14 @@
menu.select_first (true);
try {
- menu.popup (null,
- null,
- get_menu_position,
- (ev == null) ? 0 : ev.button,
- (ev == null) ? get_current_event_time() : ev.time);
+ for (int i = 0; i < 2; i++) {
+ // Update the menu's size, then show it
+ menu.popup (null,
+ null,
+ get_menu_position,
+ (ev == null) ? 0 : ev.button,
+ (ev == null) ? get_current_event_time() : ev.time);
+ }
} finally {
// Highlight the parent
if (menu.attach_widget != null)
@@ -269,6 +272,8 @@
menu.attach_widget.get_window().get_origin (out x, out y);
Allocation allocation;
menu.attach_widget.get_allocation(out allocation);
+ Allocation menu_allocation;
+ menu.get_allocation(out menu_allocation);
x += allocation.x;
@@ -276,8 +281,12 @@
x += allocation.width;
x -= menu_width;
}
+ else{
+ x += allocation.width / 2;
+ x -= menu_allocation.width / 2;
+ }
- y += allocation.y;
+ y += allocation.y + 4;
int width, height;
menu.get_size_request(out width, out height);
Follow ups