mirror of
https://github.com/moparisthebest/FireTray
synced 2025-03-11 06:50:18 -04:00
* fix gdk declarations + typo in FiretrayWindow.jsm
* unsuccessful attempt to catch a real minimize event with Gtk 'window-state-event' The problem is that GDK_WINDOW_STATE_ICONIFIED is fired on virtual desktop change... even both e->changed_mask and e->new_window_state get GDK_WINDOW_STATE_ICONIFIED ! Gdk obviously relies on WM_STATE, which may not be up-to-date. We better try to check _NET_WM_STATE at X11 level. See ex: http://trac.wxwidgets.org/ticket/10973
This commit is contained in:
parent
4cf525b692
commit
1e4254b26f
@ -53,36 +53,35 @@ Cu.import("resource://firetray/glib.jsm");
|
||||
function gobject_defines(lib) {
|
||||
|
||||
this.GdkEventMask = ctypes.int; // enum
|
||||
this.GDK_EXPOSURE_MASK = 1 << 1,
|
||||
this.GDK_POINTER_MOTION_MASK = 1 << 2,
|
||||
this.GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
|
||||
this.GDK_BUTTON_MOTION_MASK = 1 << 4,
|
||||
this.GDK_BUTTON1_MOTION_MASK = 1 << 5,
|
||||
this.GDK_BUTTON2_MOTION_MASK = 1 << 6,
|
||||
this.GDK_BUTTON3_MOTION_MASK = 1 << 7,
|
||||
this.GDK_BUTTON_PRESS_MASK = 1 << 8,
|
||||
this.GDK_BUTTON_RELEASE_MASK = 1 << 9,
|
||||
this.GDK_KEY_PRESS_MASK = 1 << 10,
|
||||
this.GDK_KEY_RELEASE_MASK = 1 << 11,
|
||||
this.GDK_ENTER_NOTIFY_MASK = 1 << 12,
|
||||
this.GDK_LEAVE_NOTIFY_MASK = 1 << 13,
|
||||
this.GDK_FOCUS_CHANGE_MASK = 1 << 14,
|
||||
this.GDK_STRUCTURE_MASK = 1 << 15,
|
||||
this.GDK_PROPERTY_CHANGE_MASK = 1 << 16,
|
||||
this.GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
|
||||
this.GDK_PROXIMITY_IN_MASK = 1 << 18,
|
||||
this.GDK_PROXIMITY_OUT_MASK = 1 << 19,
|
||||
this.GDK_SUBSTRUCTURE_MASK = 1 << 20,
|
||||
this.GDK_SCROLL_MASK = 1 << 21,
|
||||
this.GDK_ALL_EVENTS_MASK = 0x3FFFFE
|
||||
this.GDK_EXPOSURE_MASK = 1 << 1;
|
||||
this.GDK_POINTER_MOTION_MASK = 1 << 2;
|
||||
this.GDK_POINTER_MOTION_HINT_MASK = 1 << 3;
|
||||
this.GDK_BUTTON_MOTION_MASK = 1 << 4;
|
||||
this.GDK_BUTTON1_MOTION_MASK = 1 << 5;
|
||||
this.GDK_BUTTON2_MOTION_MASK = 1 << 6;
|
||||
this.GDK_BUTTON3_MOTION_MASK = 1 << 7;
|
||||
this.GDK_BUTTON_PRESS_MASK = 1 << 8;
|
||||
this.GDK_BUTTON_RELEASE_MASK = 1 << 9;
|
||||
this.GDK_KEY_PRESS_MASK = 1 << 10;
|
||||
this.GDK_KEY_RELEASE_MASK = 1 << 11;
|
||||
this.GDK_ENTER_NOTIFY_MASK = 1 << 12;
|
||||
this.GDK_LEAVE_NOTIFY_MASK = 1 << 13;
|
||||
this.GDK_FOCUS_CHANGE_MASK = 1 << 14;
|
||||
this.GDK_STRUCTURE_MASK = 1 << 15;
|
||||
this.GDK_PROPERTY_CHANGE_MASK = 1 << 16;
|
||||
this.GDK_VISIBILITY_NOTIFY_MASK = 1 << 17;
|
||||
this.GDK_PROXIMITY_IN_MASK = 1 << 18;
|
||||
this.GDK_PROXIMITY_OUT_MASK = 1 << 19;
|
||||
this.GDK_SUBSTRUCTURE_MASK = 1 << 20;
|
||||
this.GDK_SCROLL_MASK = 1 << 21;
|
||||
this.GDK_ALL_EVENTS_MASK = 0x3FFFFE;
|
||||
this.GSignalMatchType = ctypes.int; // enum
|
||||
this.G_SIGNAL_MATCH_ID = 1 << 0,
|
||||
this.G_SIGNAL_MATCH_DETAIL = 1 << 1,
|
||||
this.G_SIGNAL_MATCH_CLOSURE = 1 << 2,
|
||||
this.G_SIGNAL_MATCH_FUNC = 1 << 3,
|
||||
this.G_SIGNAL_MATCH_DATA = 1 << 4,
|
||||
this.G_SIGNAL_MATCH_UNBLOCKED = 1 << 5
|
||||
|
||||
this.G_SIGNAL_MATCH_ID = 1 << 0;
|
||||
this.G_SIGNAL_MATCH_DETAIL = 1 << 1;
|
||||
this.G_SIGNAL_MATCH_CLOSURE = 1 << 2;
|
||||
this.G_SIGNAL_MATCH_FUNC = 1 << 3;
|
||||
this.G_SIGNAL_MATCH_DATA = 1 << 4;
|
||||
this.G_SIGNAL_MATCH_UNBLOCKED = 1 << 5;
|
||||
this.gpointer = ctypes.voidptr_t;
|
||||
this.gulong = ctypes.unsigned_long;
|
||||
this.guint = ctypes.unsigned_int;
|
||||
@ -97,9 +96,11 @@ function gobject_defines(lib) {
|
||||
this.gsize = ctypes.unsigned_long;
|
||||
this.GCallback = ctypes.voidptr_t;
|
||||
this.GClosureNotify = this.gpointer;
|
||||
this.GConnectFlags = this.guint;
|
||||
this.GFunc = ctypes.void_t.ptr;
|
||||
this.GList = ctypes.StructType("GList");
|
||||
this.GConnectFlags = this.guint; // enum
|
||||
this.G_CONNECT_AFTER = 1 << 0;
|
||||
this.G_CONNECT_SWAPPED = 1 << 1;
|
||||
|
||||
this.GType = this.gsize;
|
||||
this.GData = ctypes.StructType("GData");
|
||||
@ -133,7 +134,10 @@ function gobject_defines(lib) {
|
||||
|
||||
this.g_signal_connect = function(instance, detailed_signal, handler, data) {
|
||||
return this.g_signal_connect_data(instance, detailed_signal, handler, data, null, 0);
|
||||
}
|
||||
};
|
||||
this.g_signal_connect_after = function(instance, detailed_signal, handler, data) {
|
||||
return this.g_signal_connect_data(instance, detailed_signal, handler, data, null, this.G_CONNECT_AFTER);
|
||||
};
|
||||
|
||||
lib.lazy_bind("g_object_unref", ctypes.void_t, this.gpointer);
|
||||
lib.lazy_bind("g_list_free", ctypes.void_t, this.GList.ptr);
|
||||
|
@ -203,10 +203,25 @@ firetray.Window = {
|
||||
LOG("restored WindowState: " + firetray.Handler.windows[xid].chromeWin.windowState);
|
||||
},
|
||||
|
||||
// http://www.gtkforums.com/viewtopic.php?t=1624
|
||||
onWindowState: function(gtkWidget, gdkEventState, userData){
|
||||
// LOG("window-state-event");
|
||||
// if(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED){
|
||||
let stopPropagation = true;
|
||||
LOG("window-state-event: "+gdkEventState.contents.new_window_state);
|
||||
|
||||
if (gdkEventState.contents.new_window_state & gdk.GDK_WINDOW_STATE_ICONIFIED) {
|
||||
let xid = firetray.Window.getXIDFromGtkWidget(gtkWidget);
|
||||
LOG(xid+" iconified: "+gdkEventState.contents.changed_mask+" "+gdkEventState.contents.new_window_state);
|
||||
|
||||
// let hides_on_minimize = firetray.Utils.prefService.getBoolPref('hides_on_minimize');
|
||||
// let hides_single_window = firetray.Utils.prefService.getBoolPref('hides_single_window');
|
||||
// if (hides_on_minimize) {
|
||||
// if (hides_single_window) {
|
||||
// firetray.Handler.hideSingleWindow(xid);
|
||||
// } else
|
||||
// firetray.Handler.hideAllWindows();
|
||||
// }
|
||||
}
|
||||
|
||||
let stopPropagation = true; // not usefull
|
||||
return stopPropagation;
|
||||
}
|
||||
|
||||
@ -296,7 +311,7 @@ firetray.Handler.getWindowIdFromChromeWindow = firetray.Window.getXIDFromChromeW
|
||||
firetray.Handler.unregisterWindow = function(win) {
|
||||
LOG("unregister window");
|
||||
|
||||
let xid = firetray.Window.getWinXIDFromChromeWindow(win);
|
||||
let xid = firetray.Window.getXIDFromChromeWindow(win);
|
||||
return this._unregisterWindowByXID(xid);
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user