diff -u -aurN icewm-1.0.9.vanilla/src/default.h icewm-1.0.9.jake/src/default.h --- icewm-1.0.9.vanilla/src/default.h Tue Oct 9 09:54:03 2001 +++ icewm-1.0.9.jake/src/default.h Mon Jul 22 10:00:45 2002 @@ -215,6 +215,8 @@ XIV(bool, edgeHorzWorkspaceSwitching, false) XIV(bool, edgeVertWorkspaceSwitching, false) XIV(bool, edgeContWorkspaceSwitching, true) +XIV(bool, horzMonitorSwitching, true) +XIV(bool, vertMonitorSwitching, false) XIV(bool, showPopupsAbovePointer, false) XIV(bool, replayMenuCancelClick, false) XIV(bool, limitSize, true) @@ -542,6 +544,9 @@ OBV("HorizontalEdgeSwitch", &edgeHorzWorkspaceSwitching, "Workspace switches by moving mouse to left/right screen edge"), OBV("VerticalEdgeSwitch", &edgeVertWorkspaceSwitching, "Workspace switches by moving mouse to top/bottom screen edge"), OBV("ContinuousEdgeSwitch", &edgeContWorkspaceSwitching, "Workspace switches continuously when moving mouse to screen edge"), + OBV("MonitorSwitch", &horzMonitorSwitching, "In dual heads, use this option to have focus behave correctly"), + OBV("HorizontalMonitorSwitch", &horzMonitorSwitching, "In dual heads, use this option to have focus behave correctly"), + OBV("VerticalMonitorSwitch", &vertMonitorSwitching, "In dual heads, use this option to have focus behave correctly"), OBV("DesktopBackgroundCenter", ¢erBackground, "Display desktop background centered and not tiled"), OBV("SupportSemitransparency", &supportSemitransparency, "Support for semitransparent terminals like Eterm or gnome-terminal"), OBV("AutoReloadMenus", &autoReloadMenus, "Reload menu files automatically"), diff -u -aurN icewm-1.0.9.vanilla/src/wmmgr.cc icewm-1.0.9.jake/src/wmmgr.cc --- icewm-1.0.9.vanilla/src/wmmgr.cc Tue Oct 9 09:54:04 2001 +++ icewm-1.0.9.jake/src/wmmgr.cc Mon Jul 22 10:00:38 2002 @@ -633,7 +633,9 @@ #endif if (input) { + int tmpInt = 0; XSetInputFocus(app->display(), w, RevertToNone, CurrentTime); + XGetInputFocus(app->display(), &oldWinFocus, &tmpInt); } if (c && w == c->handle() && c->protocols() & YFrameClient::wpTakeFocus) { @@ -1714,8 +1716,9 @@ focusTopWindow(); } else { if (strongPointerFocus) { + int tmpInt = 0; XSetInputFocus(app->display(), PointerRoot, RevertToNone, CurrentTime); - + XGetInputFocus(app->display(), &oldWinFocus, &tmpInt); } } resetColormap(true); diff -u -aurN icewm-1.0.9.vanilla/src/ywindow.cc icewm-1.0.9.jake/src/ywindow.cc --- icewm-1.0.9.vanilla/src/ywindow.cc Tue Oct 9 09:54:04 2001 +++ icewm-1.0.9.jake/src/ywindow.cc Mon Jul 22 10:00:30 2002 @@ -137,6 +137,7 @@ fParentWindow = desktop; } insertWindow(); + onOtherDisplay = false; } YWindow::~YWindow() { @@ -170,7 +171,9 @@ } void YWindow::setWindowFocus() { + int tmpInt = 0; XSetInputFocus(app->display(), handle(), RevertToNone, CurrentTime); + XGetInputFocus(app->display(), &oldWinFocus, &tmpInt); } void YWindow::setTitle(char const * title) { @@ -825,6 +828,18 @@ } } #endif + if (horzMonitorSwitching || vertMonitorSwitching) { + if (crossing.type == EnterNotify && crossing.mode == NotifyNormal) { + if (crossing.same_screen && !parent() && onOtherDisplay) { + XSetInputFocus(app->display(), oldWinFocus, RevertToNone, CurrentTime); + onOtherDisplay = false; + } + } + else if (crossing.type == LeaveNotify && crossing.mode == NotifyNormal) { + if (!crossing.same_screen && !parent()) + onOtherDisplay = true; + } + } } void YWindow::handleClientMessage(const XClientMessageEvent &message) { diff -u -aurN icewm-1.0.9.vanilla/src/ywindow.h icewm-1.0.9.jake/src/ywindow.h --- icewm-1.0.9.vanilla/src/ywindow.h Tue Oct 9 09:54:04 2001 +++ icewm-1.0.9.jake/src/ywindow.h Mon Jul 22 10:00:55 2002 @@ -38,6 +38,8 @@ YWindow(YWindow *aParent = 0, Window win = 0); virtual ~YWindow(); + Window oldWinFocus; + void setStyle(unsigned long aStyle); void show(); @@ -241,6 +243,7 @@ bool fEnabled; bool fToplevel; + bool onOtherDisplay; typedef struct _YAccelerator { unsigned key; @@ -253,7 +256,7 @@ #ifdef CONFIG_TOOLTIP YToolTip *fToolTip; #endif - + static XButtonEvent fClickEvent; static YWindow *fClickWindow; static Time fClickTime;