[Xfce4-commits] [panel-plugins/xfce4-clipman-plugin] 02/03: Restore menu popup at cusror position

noreply at xfce.org noreply at xfce.org
Fri Mar 24 12:35:41 CET 2017


This is an automated email from the git hooks/post-receive script.

mmassonnet pushed a commit to branch master
in repository panel-plugins/xfce4-clipman-plugin.

commit 55bdffdb1a1f72f913331a00dab387df335568d6
Author: Mike Massonnet <m8t at gandi.net>
Date:   Tue Mar 7 22:22:43 2017 +0100

    Restore menu popup at cusror position
---
 panel-plugin/main-status-icon.c |  3 ---
 panel-plugin/plugin.c           | 46 +++++++++++++++++++++--------------------
 2 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/panel-plugin/main-status-icon.c b/panel-plugin/main-status-icon.c
index 6a0f1b5..9996d5f 100644
--- a/panel-plugin/main-status-icon.c
+++ b/panel-plugin/main-status-icon.c
@@ -81,9 +81,6 @@ main (gint argc,
   plugin = status_icon_register ();
   install_autostart_file ();
 
-  /* TODO this callback popups at systray position, need to popup at cursor
-   * position if option is set, this logic can be handled directly by
-   * plugin_popup_menu function. */
   g_signal_connect_swapped (app, "activate", G_CALLBACK (plugin_popup_menu), plugin);
 
   gtk_main ();
diff --git a/panel-plugin/plugin.c b/panel-plugin/plugin.c
index 6bc5c32..95cb088 100644
--- a/panel-plugin/plugin.c
+++ b/panel-plugin/plugin.c
@@ -342,32 +342,34 @@ plugin_configure (MyPlugin *plugin)
 void
 plugin_popup_menu (MyPlugin *plugin)
 {
+  if (xfconf_channel_get_bool (plugin->channel, "/tweaks/popup-at-pointer", FALSE))
+    {
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+      gtk_menu_popup (GTK_MENU (plugin->menu), NULL, NULL,
+                      NULL, NULL,
+                      0, gtk_get_current_event_time ());
+G_GNUC_END_IGNORE_DEPRECATIONS
+    }
+  else
+    {
 #ifdef PANEL_PLUGIN
-  gtk_menu_set_screen (GTK_MENU (plugin->menu), gtk_widget_get_screen (plugin->button));
-
-  if(!gtk_widget_has_grab(plugin->menu))
-  {
-    gtk_grab_add(plugin->menu);
-  }
-
-  gtk_menu_popup (GTK_MENU (plugin->menu), NULL, NULL,
-                  plugin->menu_position_func, plugin,
-                  0, gtk_get_current_event_time ());
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (plugin->button), TRUE);
-  xfce_panel_plugin_register_menu (plugin->panel_plugin, GTK_MENU (plugin->menu));
+      gtk_menu_set_screen (GTK_MENU (plugin->menu), gtk_widget_get_screen (plugin->button));
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+      gtk_menu_popup (GTK_MENU (plugin->menu), NULL, NULL,
+                      plugin->menu_position_func, plugin->panel_plugin,
+                      0, gtk_get_current_event_time ());
+G_GNUC_END_IGNORE_DEPRECATIONS
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (plugin->button), TRUE);
+      xfce_panel_plugin_register_menu (plugin->panel_plugin, GTK_MENU (plugin->menu));
 #elif defined (STATUS_ICON)
 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_menu_set_screen (GTK_MENU (plugin->menu), gtk_status_icon_get_screen (plugin->status_icon));
+      gtk_menu_set_screen (GTK_MENU (plugin->menu),
+                           gtk_status_icon_get_screen (plugin->status_icon));
+      gtk_menu_popup (GTK_MENU (plugin->menu), NULL, NULL,
+                      plugin->menu_position_func, plugin->status_icon,
+                      0, gtk_get_current_event_time ());
 G_GNUC_END_IGNORE_DEPRECATIONS
-
-  if(!gtk_widget_has_grab(plugin->menu))
-  {
-    gtk_grab_add(plugin->menu);
-  }
-
-  gtk_menu_popup (GTK_MENU (plugin->menu), NULL, NULL,
-                  plugin->menu_position_func, plugin->status_icon,
-                  0, gtk_get_current_event_time ());
 #endif
+  }
 }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list