1
0
mirror of https://github.com/moparisthebest/FireTray synced 2024-12-21 21:48:47 -05:00

force switching to original desktop when activating window.

There are simingly 2 problems here:
* window desktop is not set right after window move
* _NET_ACTIVE_WINDOW/gtk_window_present doesn't trigger desktop switch
This commit is contained in:
foudfou 2012-03-23 01:52:43 +01:00
parent 439fe3c38d
commit fdf76b9ca4
2 changed files with 19 additions and 2 deletions

View File

@ -24,7 +24,8 @@ const XATOMS_EWMH_GENERAL = [ "_NET_CLOSE_WINDOW", "_NET_WM_NAME",
"_NET_WM_DESKTOP", "_NET_WM_WINDOW_TYPE", "_NET_WM_STATE",
"_NET_WM_ALLOWED_ACTIONS", "_NET_WM_STRUT", "_NET_WM_STRUT_PARTIAL",
"_NET_WM_ICON_GEOMETRY", "_NET_WM_ICON", "_NET_WM_PID",
"_NET_WM_HANDLED_ICONS", "_NET_WM_USER_TIME", "_NET_FRAME_EXTENTS"
"_NET_WM_HANDLED_ICONS", "_NET_WM_USER_TIME", "_NET_FRAME_EXTENTS",
"_NET_CURRENT_DESKTOP"
];
const XATOMS_EWMH_WM_STATES = [
"_NET_WM_STATE_MODAL", "_NET_WM_STATE_STICKY",
@ -34,7 +35,7 @@ const XATOMS_EWMH_WM_STATES = [
"_NET_WM_STATE_FULLSCREEN", "_NET_WM_STATE_ABOVE", "_NET_WM_STATE_BELOW",
"_NET_WM_STATE_DEMANDS_ATTENTION"
];
const XATOMS_EWMH_ROOT = [ "_NET_ACTIVE_WINDOW" ]
const XATOMS_EWMH_ROOT = [ "_NET_ACTIVE_WINDOW" ];
const XATOMS = XATOMS_ICCCM
.concat(XATOMS_EWMH_WM_STATES)
.concat(XATOMS_EWMH_GENERAL)

View File

@ -350,8 +350,24 @@ firetray.Window = {
activate: function(xid) {
if (!firetray.Utils.prefService.getBoolPref('show_activates'))
return;
try {
firetray.Utils.timer(function() {
let winDesktop = firetray.Window.getXWindowDesktop(x11.Window(xid));
let rootWin = x11.XDefaultRootWindow(x11.current.Display);
firetray.WARN("winDesktop="+winDesktop+" rootWin="+rootWin+" xid="+xid);
if (winDesktop && rootWin) {
let dataSize = 3;
let data = ctypes.long(dataSize);
data[0] = winDesktop;
data[1] = 0;
data[2] = 0;
firetray.Window.xSendClientMessgeEvent(rootWin, x11.current.Atoms._NET_CURRENT_DESKTOP, data, dataSize);
}
gtk.gtk_window_present(firetray.Handler.gtkWindows.get(xid));
firetray.LOG("window raised");
}, 1000, Ci.nsITimer.TYPE_ONE_SHOT);
} catch(x) {firetray.ERROR(x);}
},
/**