[Pkg-mozext-commits] [firetray] 30/38: Fix right click could show/hide all windows on linux.
David Prévot
taffit at moszumanska.debian.org
Mon Apr 6 15:58:22 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository firetray.
commit eea985a19f63ff053f6e02d2672f116ac2856f04
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Wed Mar 25 02:22:20 2015 +0100
Fix right click could show/hide all windows on linux.
---
src/modules/FiretrayHandler.jsm | 2 +-
src/modules/linux/FiretrayGtkStatusIcon.jsm | 36 +++++++++++++++++++----------
src/modules/linux/FiretrayWindow.jsm | 13 -----------
3 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index 45b1592..ea6daf4 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -341,7 +341,7 @@ firetray.Handler = {
unregisterWindow: function(win) {},
hideWindow: function(winId) {},
showWindow: function(winId) {},
- activateLastWindowCb: function(gtkStatusIcon, gdkEvent, userData) {},
+ showAllWindowsAndActivate:function() {}, // linux
getActiveWindow: function() {},
windowGetAttention: function(winId) {},
showHidePopupMenuItems: function() {}, // linux
diff --git a/src/modules/linux/FiretrayGtkStatusIcon.jsm b/src/modules/linux/FiretrayGtkStatusIcon.jsm
index 87ceaab..6ba05eb 100644
--- a/src/modules/linux/FiretrayGtkStatusIcon.jsm
+++ b/src/modules/linux/FiretrayGtkStatusIcon.jsm
@@ -110,21 +110,13 @@ firetray.GtkStatusIcon = {
attachMiddleClickCallback: function(pref) {
log.debug("attachMiddleClickCallback pref="+pref);
- if (pref === FIRETRAY_MIDDLE_CLICK_ACTIVATE_LAST) {
- this.callbacks.iconMiddleClick = gtk.GCallbackStatusIconMiddleClick_t(
- firetray.Handler.activateLastWindowCb, null, FIRETRAY_CB_SENTINEL);
- } else if (pref === FIRETRAY_MIDDLE_CLICK_SHOW_HIDE) {
- this.callbacks.iconMiddleClick = gtk.GCallbackStatusIconMiddleClick_t(
- function(widget, event, data) {firetray.Handler.showHideAllWindows(); return true;},
- null, FIRETRAY_CB_SENTINEL);
- } else {
- log.error("Unknown pref value for 'middle_click': "+pref);
- return;
- }
+ let prefAsPtr = new gobject.gpointer(pref);
+ this.callbacks.iconMiddleClick = gtk.GCallbackStatusIconMiddleClick_t(
+ firetray.GtkStatusIcon.onButtonPressCb, null, FIRETRAY_CB_SENTINEL);
this.callbacks.iconMiddleClickId = gobject.g_signal_connect(
firetray.GtkStatusIcon.trayIcon,
"button-press-event", firetray.GtkStatusIcon.callbacks.iconMiddleClick,
- null);
+ prefAsPtr);
log.debug("g_connect middleClick="+this.callbacks.iconMiddleClickId);
},
@@ -153,6 +145,26 @@ firetray.GtkStatusIcon = {
return stopPropagation;
},
+ onButtonPressCb: function(widget, event, data) {
+ let gdkEventButton = ctypes.cast(event, gdk.GdkEventButton.ptr);
+ if (gdkEventButton.contents.button === 2 &&
+ gdkEventButton.contents.type === gdk.GDK_BUTTON_PRESS)
+ {
+ log.debug("MIDDLE CLICK");
+ let pref = ctypes.cast(data, ctypes.unsigned_int).value;
+ if (pref === FIRETRAY_MIDDLE_CLICK_ACTIVATE_LAST) {
+ firetray.Handler.showAllWindowsAndActivate();
+ } else if (pref === FIRETRAY_MIDDLE_CLICK_SHOW_HIDE) {
+ firetray.Handler.showHideAllWindows();
+ } else {
+ log.error("Unknown pref value for 'middle_click': "+pref);
+ }
+ }
+
+ let stopPropagation = false;
+ return stopPropagation;
+ },
+
setIconImageFromFile: function(filename) {
if (!firetray.GtkStatusIcon.trayIcon)
log.error("Icon missing");
diff --git a/src/modules/linux/FiretrayWindow.jsm b/src/modules/linux/FiretrayWindow.jsm
index 1a53252..7d3778b 100644
--- a/src/modules/linux/FiretrayWindow.jsm
+++ b/src/modules/linux/FiretrayWindow.jsm
@@ -702,19 +702,6 @@ firetray.Handler.showWindow = firetray.Window.show;
firetray.Handler.hideWindow = firetray.Window.hide;
firetray.Handler.showAllWindowsAndActivate = firetray.Window.showAllWindowsAndActivate;
-firetray.Handler.activateLastWindowCb = function(gtkStatusIcon, gdkEvent, userData) {
- log.debug("activateLastWindowCb");
-
- let gdkEventButton = ctypes.cast(gdkEvent, gdk.GdkEventButton.ptr);
- if (gdkEventButton.contents.button === 2 && gdkEventButton.contents.type === gdk.GDK_BUTTON_PRESS) {
- log.debug("MIDDLE CLICK");
-
- firetray.Window.showAllWindowsAndActivate();
- }
-
- let stopPropagation = false;
- return stopPropagation;
-};
/* NOTE: gtk_window_is_active() not reliable, and _NET_ACTIVE_WINDOW may not
always be set before 'focus-in-event' (gnome-shell/mutter 3.4.1). */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firetray.git
More information about the Pkg-mozext-commits
mailing list