From 320260bf455de73b781dcc01b9997ca3ee41174b Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Sun, 9 Feb 2014 07:30:35 +0700 Subject: [PATCH 1/1] ecere/gui/drivers/XInterface: Refocusing on KeyPress to bring back the caret - e.g. after pressing media key volume-up in Ubuntu --- ecere/src/gui/drivers/XInterface.ec | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ecere/src/gui/drivers/XInterface.ec b/ecere/src/gui/drivers/XInterface.ec index d6c764c..fbaa1e2 100644 --- a/ecere/src/gui/drivers/XInterface.ec +++ b/ecere/src/gui/drivers/XInterface.ec @@ -1532,10 +1532,33 @@ class XInterface : Interface case KeyPress: { XKeyEvent * event = (XKeyEvent *) thisEvent; + incref window; + if(!window.active) + { + Window modalRoot = window.FindModal(); + XWindowData windowData; + + activeWindow = (X11Window)window.windowHandle; + + if(!window.parent || window != window.parent.activeChild) + { + if(modalRoot) + modalRoot.ExternalActivate(true, true, window, null); + else + window.ExternalActivate(true, true, window, null); // lastActive); + windowData = modalRoot ? modalRoot.windowData : window.windowData; + if(windowData && windowData.ic) + { + // XSetICValues(ic, XNClientWindow, window.windowHandle, XNFocusWindow, window.windowHandle, 0); + XSetICFocus(windowData.ic); + } + } + } //*XUnlockDisplay(xGlobalDisplay); ProcessKeyMessage(window, event->keycode, (event->keycode == lastKeyCode) ? 2 : 0, event); //*if(xGlobalDisplay) XLockDisplay(xGlobalDisplay); lastKeyCode = event->keycode; + delete window; break; } case KeyRelease: -- 1.8.3.1