diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-04-29 20:48:45 +0200 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2014-04-29 20:48:45 +0200 |
| commit | fa1574f951a63d60f83f7bfb898b355405cd015f (patch) | |
| tree | 0df5893a8461257c0c1d0f8ed6eff16756741e90 /services | |
| parent | 6df8e0beb68f4564378f016befe32243c7151f38 (diff) | |
PanelService: cleanup the menu popup code, avoid unnecessary calls to gtk_widget_is_visible
(bzr r3791.2.3)
Diffstat (limited to 'services')
| -rw-r--r-- | services/panel-service.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/services/panel-service.c b/services/panel-service.c index 201fdd378..a161cacbd 100644 --- a/services/panel-service.c +++ b/services/panel-service.c @@ -2161,24 +2161,22 @@ panel_service_show_entry_common (PanelService *self, gtk_menu_shell_set_take_focus (GTK_MENU_SHELL (priv->last_menu), TRUE); gtk_menu_popup (priv->last_menu, NULL, NULL, positon_menu, self, button, CurrentTime); + gboolean visible = gtk_widget_is_visible (GTK_WIDGET (priv->last_menu)); - if (!gtk_widget_is_visible (GTK_WIDGET (priv->last_menu))) + if (!visible) { /* If the menu is not visible at this point, it's very likely that's * due to a keyboard grab, so let's try with a menu with no key-grab */ gtk_menu_shell_set_take_focus (GTK_MENU_SHELL (priv->last_menu), FALSE); gtk_menu_popup (priv->last_menu, NULL, NULL, positon_menu, self, button, CurrentTime); + visible = gtk_widget_is_visible (GTK_WIDGET (priv->last_menu)); } - GdkWindow *gdkwin = NULL; - - if (gtk_widget_is_visible (GTK_WIDGET (priv->last_menu))) - gdkwin = gtk_widget_get_window (GTK_WIDGET (priv->last_menu)); - - gtk_menu_reposition (priv->last_menu); - - if (gdkwin != NULL) + if (visible) { + gtk_menu_reposition (priv->last_menu); + + GdkWindow *gdkwin = gtk_widget_get_window (GTK_WIDGET (priv->last_menu)); gint left=0, top=0, width=0, height=0; gdk_window_get_geometry (gdkwin, NULL, NULL, &width, &height); |
