[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-devel
Subject: [PATCH v2] winex11.drv: Request _NET_ACTIVE_WINDOW in SetFocus().
From: Zebediah Figura <zfigura () codeweavers ! com>
Date: 2018-05-31 14:25:00
Message-ID: 1527776700-16080-1-git-send-email-zfigura () codeweavers ! com
[Download RAW message or body]
From: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
---
dlls/winex11.drv/event.c | 32 ++++++++++++++++++++++++++++++++
dlls/winex11.drv/x11drv.h | 2 ++
dlls/winex11.drv/x11drv_main.c | 1 +
3 files changed, 35 insertions(+)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index a0bfe05..c23521e 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -818,6 +818,8 @@ static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev )
if (!focus_win)
{
+ x11drv_thread_data()->active_window = 0;
+
/* Abey : 6-Oct-99. Check again if the focus out window is the
Foreground window, because in most cases the messages sent
above must have already changed the foreground window, in which
@@ -1380,6 +1382,7 @@ void wait_for_withdrawn_state( HWND hwnd, BOOL set )
*/
void CDECL X11DRV_SetFocus( HWND hwnd )
{
+ struct x11drv_thread_data *thread_data = x11drv_thread_data();
struct x11drv_win_data *data;
HWND parent;
@@ -1395,6 +1398,35 @@ void CDECL X11DRV_SetFocus( HWND hwnd )
}
if (!data->managed || data->embedder) set_input_focus( data );
release_win_data( data );
+
+ if (data->mapped && data->managed && thread_data->active_window != hwnd)
+ {
+ struct x11drv_win_data *active = get_win_data( thread_data->active_window );
+ DWORD timestamp = GetMessageTime() - EVENT_x11_time_to_win32_time( 0 );
+ XEvent xev;
+
+ TRACE("setting _NET_ACTIVE_WINDOW to %p/%lx, current active %p/%lx\n",
+ data->hwnd, data->whole_window, active ? active->hwnd : NULL, active ? \
active->whole_window : 0 ); +
+ thread_data->active_window = hwnd;
+
+ xev.xclient.type = ClientMessage;
+ xev.xclient.window = data->whole_window;
+ xev.xclient.message_type = x11drv_atom(_NET_ACTIVE_WINDOW);
+ xev.xclient.serial = 0;
+ xev.xclient.display = data->display;
+ xev.xclient.send_event = True;
+ xev.xclient.format = 32;
+
+ xev.xclient.data.l[0] = 1; /* source: application */
+ xev.xclient.data.l[1] = timestamp;
+ xev.xclient.data.l[2] = active ? active->whole_window : 0;
+ xev.xclient.data.l[3] = 0;
+ xev.xclient.data.l[4] = 0;
+ XSendEvent( data->display, root_window, False, SubstructureRedirectMask | \
SubstructureNotifyMask, &xev ); +
+ if (active) release_win_data( active );
+ }
}
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 85a05a9..3ad4ffe 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -325,6 +325,7 @@ struct x11drv_thread_data
Display *display;
XEvent *current_event; /* event currently being processed */
HWND grab_hwnd; /* window that currently grabs the mouse */
+ HWND active_window; /* active window */
HWND last_focus; /* last window that had focus */
XIM xim; /* input method */
HWND last_xic_hwnd; /* last xic window */
@@ -433,6 +434,7 @@ enum x11drv_atoms
XATOM_DndSelection,
XATOM__ICC_PROFILE,
XATOM__MOTIF_WM_HINTS,
+ XATOM__NET_ACTIVE_WINDOW,
XATOM__NET_STARTUP_INFO_BEGIN,
XATOM__NET_STARTUP_INFO,
XATOM__NET_SUPPORTED,
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index e67a3c0..4654556 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -128,6 +128,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
"DndSelection",
"_ICC_PROFILE",
"_MOTIF_WM_HINTS",
+ "_NET_ACTIVE_WINDOW",
"_NET_STARTUP_INFO_BEGIN",
"_NET_STARTUP_INFO",
"_NET_SUPPORTED",
--
2.7.4
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic