winex11-_NET_ACTIVE_WINDOW: Avoid another user32 API.

This commit is contained in:
Zebediah Figura 2022-04-23 12:24:30 -05:00
parent 9d853b7c44
commit 7b5a66b852

View File

@ -1,4 +1,4 @@
From 028244e49e2918cdeb41be4c58f5a1bf2953829f Mon Sep 17 00:00:00 2001
From 8a422ed9bc83c91db731f36cdddf6b30b9926f76 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Wed, 10 Feb 2016 15:09:29 +0800
Subject: [PATCH] winex11.drv: Add support for _NET_ACTIVE_WINDOW. (v2)
@ -17,10 +17,10 @@ For bug #2155.
7 files changed, 65 insertions(+)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c
index 6b6f1a64ce8..71831034ca7 100644
index 175fde1fa40..9ed2cb57249 100644
--- a/dlls/win32u/driver.c
+++ b/dlls/win32u/driver.c
@@ -842,6 +842,10 @@ static BOOL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update )
@@ -843,6 +843,10 @@ static BOOL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update )
hdc, rect.left - dx, rect.top - dy, SRCCOPY, 0, 0 );
}
@ -31,7 +31,7 @@ index 6b6f1a64ce8..71831034ca7 100644
static void nulldrv_SetCapture( HWND hwnd, UINT flags )
{
}
@@ -1198,6 +1202,7 @@ static const struct user_driver_funcs lazy_load_driver =
@@ -1199,6 +1203,7 @@ static const struct user_driver_funcs lazy_load_driver =
nulldrv_MsgWaitForMultipleObjectsEx,
nulldrv_ReleaseDC,
nulldrv_ScrollDC,
@ -39,7 +39,7 @@ index 6b6f1a64ce8..71831034ca7 100644
nulldrv_SetCapture,
nulldrv_SetFocus,
loaderdrv_SetLayeredWindowAttributes,
@@ -1270,6 +1275,7 @@ void CDECL __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT v
@@ -1271,6 +1276,7 @@ void CDECL __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT v
SET_USER_FUNC(MsgWaitForMultipleObjectsEx);
SET_USER_FUNC(ReleaseDC);
SET_USER_FUNC(ScrollDC);
@ -48,7 +48,7 @@ index 6b6f1a64ce8..71831034ca7 100644
SET_USER_FUNC(SetFocus);
SET_USER_FUNC(SetLayeredWindowAttributes);
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index 147865e7af6..9a19eb9b446 100644
index e1bcd70d35a..74c8391b618 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -596,6 +596,9 @@ static void set_focus( Display *display, HWND hwnd, Time time )
@ -71,10 +71,10 @@ index 147865e7af6..9a19eb9b446 100644
Foreground window, because in most cases the messages sent
above must have already changed the foreground window, in which
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index 8f4bb9fd7e9..8f566f6f16e 100644
index 88d09145f8e..a495d8040f6 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -397,6 +397,7 @@ static const struct user_driver_funcs x11drv_funcs =
@@ -407,6 +407,7 @@ static const struct user_driver_funcs x11drv_funcs =
.pMsgWaitForMultipleObjectsEx = X11DRV_MsgWaitForMultipleObjectsEx,
.pReleaseDC = X11DRV_ReleaseDC,
.pScrollDC = X11DRV_ScrollDC,
@ -83,10 +83,10 @@ index 8f4bb9fd7e9..8f566f6f16e 100644
.pSetFocus = X11DRV_SetFocus,
.pSetLayeredWindowAttributes = X11DRV_SetLayeredWindowAttributes,
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index dd5c298c7a6..43865dd0600 100644
index 48500284b68..beabae8c428 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -2251,6 +2251,54 @@ BOOL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update )
@@ -2226,6 +2226,54 @@ BOOL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update )
}
@ -112,7 +112,7 @@ index dd5c298c7a6..43865dd0600 100644
+ {
+ XEvent xev;
+ struct x11drv_win_data *active = get_win_data( thread_data->active_window );
+ DWORD timestamp = GetMessageTime() - EVENT_x11_time_to_win32_time( 0 );
+ DWORD timestamp = NtUserGetThreadInfo()->message_time - EVENT_x11_time_to_win32_time( 0 );
+
+ 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 );
@ -142,10 +142,10 @@ index dd5c298c7a6..43865dd0600 100644
* SetCapture (X11DRV.@)
*/
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 07c36899eb3..cf561936d42 100644
index da037297745..e97d10bc395 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -218,6 +218,7 @@ extern void X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect,
@@ -220,6 +220,7 @@ extern void X11DRV_GetDC( HDC hdc, HWND hwnd, HWND top, const RECT *win_rect,
const RECT *top_rect, DWORD flags ) DECLSPEC_HIDDEN;
extern void X11DRV_ReleaseDC( HWND hwnd, HDC hdc ) DECLSPEC_HIDDEN;
extern BOOL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update ) DECLSPEC_HIDDEN;
@ -153,7 +153,7 @@ index 07c36899eb3..cf561936d42 100644
extern void X11DRV_SetCapture( HWND hwnd, UINT flags ) DECLSPEC_HIDDEN;
extern void X11DRV_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha,
DWORD flags ) DECLSPEC_HIDDEN;
@@ -372,6 +373,7 @@ struct x11drv_thread_data
@@ -374,6 +375,7 @@ struct x11drv_thread_data
Display *display;
XEvent *current_event; /* event currently being processed */
HWND grab_hwnd; /* window that currently grabs the mouse */
@ -161,7 +161,7 @@ index 07c36899eb3..cf561936d42 100644
HWND last_focus; /* last window that had focus */
XIM xim; /* input method */
HWND last_xic_hwnd; /* last xic window */
@@ -483,6 +485,7 @@ enum x11drv_atoms
@@ -481,6 +483,7 @@ enum x11drv_atoms
XATOM_DndSelection,
XATOM__ICC_PROFILE,
XATOM__MOTIF_WM_HINTS,
@ -170,10 +170,10 @@ index 07c36899eb3..cf561936d42 100644
XATOM__NET_STARTUP_INFO,
XATOM__NET_SUPPORTED,
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index 539f49197a3..732cea08890 100644
index 14ee13dc676..841f9a90a68 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -156,6 +156,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
@@ -140,6 +140,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
"DndSelection",
"_ICC_PROFILE",
"_MOTIF_WM_HINTS",