Module: wine Branch: master Commit: 82c6becb048b41202b8a816c8852853845e067d4 URL: https://gitlab.winehq.org/wine/wine/-/commit/82c6becb048b41202b8a816c8852853...
Author: Alexandros Frantzis alexandros.frantzis@collabora.com Date: Mon Apr 24 17:29:43 2023 +0300
winewayland.drv: Update display devices from the desktop window thread.
Use a driver internal window message to dispatch updates to display devices from the desktop window thread.
---
dlls/winewayland.drv/Makefile.in | 1 + dlls/winewayland.drv/wayland_output.c | 2 +- dlls/winewayland.drv/waylanddrv.h | 6 +++++ dlls/winewayland.drv/waylanddrv_main.c | 1 + dlls/winewayland.drv/window.c | 47 ++++++++++++++++++++++++++++++++++ 5 files changed, 56 insertions(+), 1 deletion(-)
diff --git a/dlls/winewayland.drv/Makefile.in b/dlls/winewayland.drv/Makefile.in index 3f9c052f2b0..454a7e5a4b4 100644 --- a/dlls/winewayland.drv/Makefile.in +++ b/dlls/winewayland.drv/Makefile.in @@ -10,4 +10,5 @@ SOURCES = \ wayland.c \ wayland_output.c \ waylanddrv_main.c \ + window.c \ xdg-output-unstable-v1.xml diff --git a/dlls/winewayland.drv/wayland_output.c b/dlls/winewayland.drv/wayland_output.c index 5ea04340347..4b2cb0505be 100644 --- a/dlls/winewayland.drv/wayland_output.c +++ b/dlls/winewayland.drv/wayland_output.c @@ -119,7 +119,7 @@ static void maybe_init_display_devices(void) /* We only update the display devices from the desktop process. */ if (GetCurrentProcessId() != desktop_pid) return;
- wayland_init_display_devices(TRUE); + NtUserPostMessage(desktop_hwnd, WM_WAYLAND_INIT_DISPLAY_DEVICES, 0, 0); }
static void wayland_output_mode_free_rb(struct rb_entry *entry, void *ctx) diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 600fcfce355..ecd144950c2 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -46,6 +46,11 @@ extern struct wayland process_wayland DECLSPEC_HIDDEN; * Definitions for wayland types */
+enum wayland_window_message +{ + WM_WAYLAND_INIT_DISPLAY_DEVICES = 0x80001000 +}; + struct wayland { BOOL initialized; @@ -107,5 +112,6 @@ void wayland_output_use_xdg_extension(struct wayland_output *output) DECLSPEC_HI
BOOL WAYLAND_UpdateDisplayDevices(const struct gdi_device_manager *device_manager, BOOL force, void *param) DECLSPEC_HIDDEN; +LRESULT WAYLAND_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) DECLSPEC_HIDDEN;
#endif /* __WINE_WAYLANDDRV_H */ diff --git a/dlls/winewayland.drv/waylanddrv_main.c b/dlls/winewayland.drv/waylanddrv_main.c index a578db76c66..1d9877f4518 100644 --- a/dlls/winewayland.drv/waylanddrv_main.c +++ b/dlls/winewayland.drv/waylanddrv_main.c @@ -32,6 +32,7 @@ static const struct user_driver_funcs waylanddrv_funcs = { .pUpdateDisplayDevices = WAYLAND_UpdateDisplayDevices, + .pWindowMessage = WAYLAND_WindowMessage };
static NTSTATUS waylanddrv_unix_init(void *arg) diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c new file mode 100644 index 00000000000..946ad6801a9 --- /dev/null +++ b/dlls/winewayland.drv/window.c @@ -0,0 +1,47 @@ +/* + * Wayland window handling + * + * Copyright 2020 Alexandros Frantzis for Collabora Ltd + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "config.h" + +#include "waylanddrv.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(waylanddrv); + +/********************************************************************** + * WAYLAND_WindowMessage + */ +LRESULT WAYLAND_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) +{ + switch (msg) + { + case WM_WAYLAND_INIT_DISPLAY_DEVICES: + wayland_init_display_devices(TRUE); + return 0; + default: + FIXME("got window msg %x hwnd %p wp %lx lp %lx\n", msg, hwnd, (long)wp, lp); + return 0; + } +}