From: Jerome St-Louis Date: Wed, 9 Jul 2014 14:33:35 +0000 (-0400) Subject: ecere/gui/XInterface: Reduced likelyhood of stealing focus X-Git-Tag: 0.44.10PR1~47 X-Git-Url: http://ecere.com/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44b16293b35c23040634e40b788831e281d0657b;hp=c3666b6c808b33481ce245b0ae27997c31c7e9ec;p=sdk ecere/gui/XInterface: Reduced likelyhood of stealing focus - Setting _net_wm_user_time to 0 prior to calling XMapWindow if it should not be activated (This problem was noted on saving in one IDE and another IDE asking to reloading changes) - Activating a window upon creation if creativeActivation is set to activate and the app is active --- diff --git a/ecere/src/gui/drivers/XInterface.ec b/ecere/src/gui/drivers/XInterface.ec index c525cf6..ccfb10e 100644 --- a/ecere/src/gui/drivers/XInterface.ec +++ b/ecere/src/gui/drivers/XInterface.ec @@ -2005,7 +2005,7 @@ class XInterface : Interface if(window.parent && window == window.parent.activeChild) break; incref window; - //if(window.creationActivation == activate) + //if(window.creationActivation == activate && guiApp.desktop.active) { if(modalRoot) modalRoot.ExternalActivate(true, true, window, null); // lastActive); @@ -2897,7 +2897,12 @@ class XInterface : Interface if(window.windowHandle && (!window.parent || !window.parent.display)) { if(window.visible && window.created) + { + long t = (window.creationActivation == activate && guiApp.desktop.active) ? (int)timeStamp : 0; + XChangeProperty(xGlobalDisplay, (X11Window)window.windowHandle, atoms[_net_wm_user_time], + XA_CARDINAL,32,PropModeReplace, (byte *)&t, 1); XMapWindow(xGlobalDisplay, (X11Window)window.windowHandle); + } if(window.state == minimized && atomsSupported[_net_wm_state]) return; if(window.nativeDecorations) @@ -3012,10 +3017,13 @@ class XInterface : Interface { if(!windowData.currentlyVisible) { + long t = (window.creationActivation == activate && guiApp.desktop.active) ? timeStamp : 0; + XChangeProperty(xGlobalDisplay, (X11Window)window.windowHandle, atoms[_net_wm_user_time], + XA_CARDINAL,32,PropModeReplace, (byte *)&t, 1); XMapWindow(xGlobalDisplay, (X11Window)window.windowHandle); windowData.currentlyVisible = true; WaitForViewableWindow(window); - if(window.creationActivation == activate && state != minimized) + if(window.creationActivation == activate && guiApp.desktop.active && state != minimized) ActivateRootWindow(window); } @@ -3135,6 +3143,9 @@ class XInterface : Interface //printf("Activate root window %s\n", window._class.name); if(!windowData.currentlyVisible) { + long t = (window.creationActivation == activate && guiApp.desktop.active) ? timeStamp : 0; + XChangeProperty(xGlobalDisplay, (X11Window)window.windowHandle, atoms[_net_wm_user_time], + XA_CARDINAL,32,PropModeReplace, (byte *)&t, 1); XMapWindow(xGlobalDisplay, (X11Window)window.windowHandle); WaitForViewableWindow(window); windowData.currentlyVisible = true;