Browse Source

Add xfce4-popup-windowmenu program.

This is simple script using the remote-event signal
for panel plugins.
upstream/xfce4-panel-4.10.1
Nick Schermer 13 years ago
parent
commit
dee2f22517
  1. 9
      plugins/windowmenu/Makefile.am
  2. 32
      plugins/windowmenu/windowmenu.c
  3. 22
      plugins/windowmenu/xfce4-popup-windowmenu.in

9
plugins/windowmenu/Makefile.am

@ -48,6 +48,15 @@ libwindowmenu_la_DEPENDENCIES = \
$(top_builddir)/libxfce4panel/libxfce4panel-$(LIBXFCE4PANEL_VERSION_API).la \
$(top_builddir)/common/libpanel-common.la
#
# xfce4-popup-windowmenu script
#
bin_SCRIPTS = \
xfce4-popup-windowmenu
xfce4-popup-windowmenu: xfce4-popup-windowmenu.in Makefile
$(AM_V_GEN) sed -e "s,\@bindir\@,$(bindir),g" $< >$@
#
# .desktop file
#

32
plugins/windowmenu/windowmenu.c

@ -98,6 +98,9 @@ static void window_menu_plugin_screen_position_changed (XfcePanelPlugin
static gboolean window_menu_plugin_size_changed (XfcePanelPlugin *panel_plugin,
gint size);
static void window_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin);
static gboolean window_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin,
const gchar *name,
const GValue *value);
static void window_menu_plugin_active_window_changed (WnckScreen *screen,
WnckWindow *previous_window,
WindowMenuPlugin *plugin);
@ -146,6 +149,7 @@ window_menu_plugin_class_init (WindowMenuPluginClass *klass)
plugin_class->screen_position_changed = window_menu_plugin_screen_position_changed;
plugin_class->size_changed = window_menu_plugin_size_changed;
plugin_class->configure_plugin = window_menu_plugin_configure_plugin;
plugin_class->remote_event = window_menu_plugin_remote_event;
g_object_class_install_property (gobject_class,
PROP_STYLE,
@ -514,6 +518,34 @@ window_menu_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
static gboolean
window_menu_plugin_remote_event (XfcePanelPlugin *panel_plugin,
const gchar *name,
const GValue *value)
{
WindowMenuPlugin *plugin = XFCE_WINDOW_MENU_PLUGIN (panel_plugin);
GdkEventButton event;
if (strcmp (name, "popup") == 0
&& GTK_WIDGET_VISIBLE (panel_plugin)
&& !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (plugin->button)))
{
/* create fake event */
event.type = GDK_BUTTON_PRESS;
event.button = 1;
event.time = gtk_get_current_event_time ();
window_menu_plugin_button_press_event (plugin->button, &event, plugin);
/* don't popup another menu */
return TRUE;
}
return FALSE;
}
static void
window_menu_plugin_active_window_changed (WnckScreen *screen,
WnckWindow *previous_window,

22
plugins/windowmenu/xfce4-popup-windowmenu.in

@ -0,0 +1,22 @@
#!/bin/sh
#
# Copyright (C) 2009 Nick Schermer <nick@xfce.org>
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU Library General Public License
# along with this library; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
#
exec @bindir@/xfce4-panel --plugin-event=windowmenu:popup:bool:true
# vim:set ts=2 sw=2 et ai:
Loading…
Cancel
Save