mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 03:44:06 +00:00
hw/xwin: Always set the X input focus to none when an X window loses focus
In the multiwindow WM, we need to cancel the X input focus if the Windows input focus has gone to the desktop, or another application's window. We could maybe avoid some unneeded work by not doing this if the WM_KILLFOCUS wParam is another window owned by us, which is immediately going to be given the X input focus. Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/736>
This commit is contained in:
committed by
Enrico Weigelt
parent
3954f766af
commit
0adc6ff90f
@@ -905,6 +905,7 @@ winMultiWindowWMProc(void *pArg)
|
|||||||
-- independently, the WM_TAKE_FOCUS protocol determines whether
|
-- independently, the WM_TAKE_FOCUS protocol determines whether
|
||||||
the WM should send a WM_TAKE_FOCUS ClientMessage.
|
the WM should send a WM_TAKE_FOCUS ClientMessage.
|
||||||
*/
|
*/
|
||||||
|
if (pNode->msg.iWindow)
|
||||||
{
|
{
|
||||||
Bool neverFocus = FALSE;
|
Bool neverFocus = FALSE;
|
||||||
xcb_get_property_cookie_t cookie;
|
xcb_get_property_cookie_t cookie;
|
||||||
@@ -928,6 +929,13 @@ winMultiWindowWMProc(void *pArg)
|
|||||||
pNode->msg.iWindow,
|
pNode->msg.iWindow,
|
||||||
pWMInfo->atmWmProtos, pWMInfo->atmWmTakeFocus);
|
pWMInfo->atmWmProtos, pWMInfo->atmWmTakeFocus);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* Set the input focus to none */
|
||||||
|
{
|
||||||
|
xcb_set_input_focus(pWMInfo->conn, XCB_INPUT_FOCUS_NONE,
|
||||||
|
XCB_NONE, XCB_CURRENT_TIME);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -808,9 +808,13 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
/* Remove our keyboard hook if it is installed */
|
/* Remove our keyboard hook if it is installed */
|
||||||
winRemoveKeyboardHookLL();
|
winRemoveKeyboardHookLL();
|
||||||
|
|
||||||
/* Revert the X focus as well, but only if the Windows focus is going to another window */
|
/* Revert the X focus as well */
|
||||||
if (!wParam && pWin)
|
if (fWMMsgInitialized)
|
||||||
DeleteWindowFromAnyEvents(pWin, FALSE);
|
{
|
||||||
|
wmMsg.msg = WM_WM_ACTIVATE;
|
||||||
|
wmMsg.iWindow = 0;
|
||||||
|
winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user