mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
Properly discard xfc->appWindow on focus loss
This commit is contained in:
@@ -607,15 +607,10 @@ static BOOL xf_event_EnterNotify(xfContext* xfc, const XEnterWindowEvent* event,
|
||||
}
|
||||
else
|
||||
{
|
||||
xfAppWindow* appWindow;
|
||||
appWindow = xf_AppWindowFromX11Window(xfc, event->window);
|
||||
xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
|
||||
|
||||
/* keep track of which window has focus so that we can apply pointer updates */
|
||||
|
||||
if (appWindow)
|
||||
{
|
||||
xfc->appWindow = appWindow;
|
||||
}
|
||||
xfc->appWindow = appWindow;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -623,14 +618,19 @@ static BOOL xf_event_EnterNotify(xfContext* xfc, const XEnterWindowEvent* event,
|
||||
|
||||
static BOOL xf_event_LeaveNotify(xfContext* xfc, const XLeaveWindowEvent* event, BOOL app)
|
||||
{
|
||||
WINPR_UNUSED(event);
|
||||
|
||||
if (!app)
|
||||
{
|
||||
xfc->mouse_active = FALSE;
|
||||
XUngrabKeyboard(xfc->display, CurrentTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
|
||||
|
||||
/* keep track of which window has focus so that we can apply pointer updates */
|
||||
if (xfc->appWindow == appWindow)
|
||||
xfc->appWindow = NULL;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1079,6 +1079,9 @@ void xf_DestroyWindow(xfContext* xfc, xfAppWindow* appWindow)
|
||||
if (!appWindow)
|
||||
return;
|
||||
|
||||
if (xfc->appWindow == appWindow)
|
||||
xfc->appWindow = NULL;
|
||||
|
||||
if (appWindow->gc)
|
||||
XFreeGC(xfc->display, appWindow->gc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user