attempt to catch minimize event that would be issued in Ubuntu 11.10

This commit is contained in:
foudfou 2012-04-10 22:42:06 +02:00
parent b8346e36c3
commit b2f270687d
2 changed files with 53 additions and 10 deletions

View File

@ -74,11 +74,41 @@ function x11_defines(lib) {
this.PropModePrepend = 1;
this.PropModeAppend = 2;
// Event names
this.DestroyNotify = 17;
this.UnmapNotify = 18;
this.MapNotify = 19;
this.PropertyNotify = 28;
this.ClientMessage = 33;
this.KeyPress = 2;
this.KeyRelease = 3;
this.ButtonPress = 4;
this.ButtonRelease = 5;
this.MotionNotify = 6;
this.EnterNotify = 7;
this.LeaveNotify = 8;
this.FocusIn = 9;
this.FocusOut = 10;
this.KeymapNotify = 11;
this.Expose = 12;
this.GraphicsExpose = 13;
this.NoExpose = 14;
this.VisibilityNotify = 15;
this.CreateNotify = 16;
this.DestroyNotify = 17;
this.UnmapNotify = 18;
this.MapNotify = 19;
this.MapRequest = 20;
this.ReparentNotify = 21;
this.ConfigureNotify = 22;
this.ConfigureRequest = 23;
this.GravityNotify = 24;
this.ResizeRequest = 25;
this.CirculateNotify = 26;
this.CirculateRequest = 27;
this.PropertyNotify = 28;
this.SelectionClear = 29;
this.SelectionRequest = 30;
this.SelectionNotify = 31;
this.ColormapNotify = 32;
this.ClientMessage = 33;
this.MappingNotify = 34;
this.GenericEvent = 35;
this.LASTEvent = 36; /* must be bigger than any event # */
// Xutils.h: definitions for initial window state
this.WithdrawnState = 0; /* for windows that are not mapped */
this.NormalState = 1; /* most applications want to start this way */

View File

@ -472,12 +472,13 @@ firetray.Window = {
let xany = ctypes.cast(xev, x11.XAnyEvent.ptr);
let xwin = xany.contents.window;
let winStates, isHidden;
switch (xany.contents.type) {
case x11.UnmapNotify:
F.LOG("UnmapNotify");
let winStates = firetray.Window.getXWindowStates(xwin);
let isHidden = winStates & FIRETRAY_XWINDOW_HIDDEN;
winStates = firetray.Window.getXWindowStates(xwin);
isHidden = winStates & FIRETRAY_XWINDOW_HIDDEN;
F.LOG("winStates="+winStates+", isHidden="+isHidden);
if (isHidden) {
let hides_on_minimize = firetray.Utils.prefService.getBoolPref('hides_on_minimize');
@ -486,15 +487,27 @@ firetray.Window = {
if (hides_single_window) {
firetray.Handler.hideSingleWindow(xwin);
} else
firetray.Handler.hideAllWindows();
firetray.Handler.hideAllWindows();
}
}
break;
default:
// F.LOG("xany.type="+xany.contents.type);
case x11.PropertyNotify:
let xprop = ctypes.cast(xev, x11.XPropertyEvent.ptr);
if (firetray.js.strEquals(xprop.contents.atom, x11.current.Atoms.WM_STATE) &&
firetray.js.strEquals(xprop.contents.state, x11.PropertyNewValue)) {
F.LOG("PropertyNotify: "+xprop.contents.atom+" send_event: "+xprop.contents.send_event+" state: "+xprop.contents.state);
winStates = firetray.Window.getXWindowStates(xwin);
isHidden = winStates & FIRETRAY_XWINDOW_HIDDEN;
if (isHidden) F.WARN("*** HIDDEN ***");
}
break;
// default:
// F.LOG("xany.type="+xany.contents.type);
// break;
}
} catch(x) {
F.ERROR(x);
}