From 5fad8dd1012ffe0f52105c47d814a341968db67d Mon Sep 17 00:00:00 2001 From: Elizabeth Figura Date: Thu, 22 Aug 2024 19:07:19 -0500 Subject: [PATCH] Rebase against 6a7bfbab10d653f6724e2917e0552515520e4fb3. --- ...andle-PAGE_WRITECOPY-protection.-try.patch | 22 ++++++------- ...f-a-WRITECOPY-page-has-been-modified.patch | 31 +++++++++++------- ...Fallback-to-copy-pages-for-WRITECOPY.patch | 18 +++++------ .../0001-winemac.drv-No-Flicker-patch.patch | 18 +++++------ ...user-configured-keyboard-layout-if-a.patch | 32 +++++++++---------- ...fixed-X11-keycode-to-scancode-conver.patch | 22 ++++++------- ...keyboard-scancode-auto-detection-by-.patch | 8 ++--- ...ling-of-window-attributes-for-WS_EX_.patch | 12 +++---- ...ow-Query-the-X-server-for-the-actual.patch | 12 +++---- staging/upstream-commit | 2 +- 10 files changed, 93 insertions(+), 84 deletions(-) diff --git a/patches/ntdll-WRITECOPY/0004-ntdll-Properly-handle-PAGE_WRITECOPY-protection.-try.patch b/patches/ntdll-WRITECOPY/0004-ntdll-Properly-handle-PAGE_WRITECOPY-protection.-try.patch index 4e67574d..fa796e73 100644 --- a/patches/ntdll-WRITECOPY/0004-ntdll-Properly-handle-PAGE_WRITECOPY-protection.-try.patch +++ b/patches/ntdll-WRITECOPY/0004-ntdll-Properly-handle-PAGE_WRITECOPY-protection.-try.patch @@ -1,4 +1,4 @@ -From 4a297f731112822e51086826f975bf5db9178e52 Mon Sep 17 00:00:00 2001 +From 8ec23a75cf45f9b2841b76504c827d368682c126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 4 Oct 2014 03:22:09 +0200 Subject: [PATCH] ntdll: Properly handle PAGE_WRITECOPY protection. (try 5) @@ -9,10 +9,10 @@ For now, only enable it when a special environment variable is set. 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index cf0c1598720..ff585c647bc 100644 +index b108e49ad4d..70211bbfa3d 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c -@@ -495,6 +495,21 @@ static void reserve_area( void *addr, void *end ) +@@ -506,6 +506,21 @@ static void reserve_area( void *addr, void *end ) #endif /* __APPLE__ */ } @@ -34,7 +34,7 @@ index cf0c1598720..ff585c647bc 100644 static void mmap_init( const struct preload_info *preload_info ) { -@@ -852,8 +867,19 @@ static int get_unix_prot( BYTE vprot ) +@@ -1136,8 +1151,19 @@ static int get_unix_prot( BYTE vprot ) { if (vprot & VPROT_READ) prot |= PROT_READ; if (vprot & VPROT_WRITE) prot |= PROT_WRITE | PROT_READ; @@ -55,7 +55,7 @@ index cf0c1598720..ff585c647bc 100644 if (vprot & VPROT_WRITEWATCH) prot &= ~PROT_WRITE; } if (!prot) prot = PROT_NONE; -@@ -1457,7 +1483,7 @@ static void update_write_watches( void *base, size_t size, size_t accessed_size +@@ -1817,7 +1843,7 @@ static void update_write_watches( void *base, size_t size, size_t accessed_size { TRACE( "updating watch %p-%p-%p\n", base, (char *)base + accessed_size, (char *)base + size ); /* clear write watch flag on accessed pages */ @@ -64,9 +64,9 @@ index cf0c1598720..ff585c647bc 100644 /* restore page protections on the entire range */ mprotect_range( base, size, 0, 0 ); } -@@ -2985,12 +3011,13 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack ) - set_page_vprot_bits( page, page_size, 0, VPROT_WRITEWATCH ); - mprotect_range( page, page_size, 0, 0 ); +@@ -4065,12 +4091,13 @@ NTSTATUS virtual_handle_fault( EXCEPTION_RECORD *rec, void *stack ) + mprotect_range( page, page_size, 0, 0 ); + } } - /* ignore fault if page is writable now */ - if (get_unix_prot( get_page_vprot( page )) & PROT_WRITE) @@ -81,8 +81,8 @@ index cf0c1598720..ff585c647bc 100644 + if (get_unix_prot( get_page_vprot( page ) ) & PROT_WRITE) ret = STATUS_SUCCESS; } mutex_unlock( &virtual_mutex ); - return ret; -@@ -3067,11 +3094,16 @@ static NTSTATUS check_write_access( void *base, size_t size, BOOL *has_write_wat + rec->ExceptionCode = ret; +@@ -4144,11 +4171,16 @@ static NTSTATUS check_write_access( void *base, size_t size, BOOL *has_write_wat { BYTE vprot = get_page_vprot( addr + i ); if (vprot & VPROT_WRITEWATCH) *has_write_watch = TRUE; @@ -101,5 +101,5 @@ index cf0c1598720..ff585c647bc 100644 } -- -2.28.0 +2.45.2 diff --git a/patches/ntdll-WRITECOPY/0005-ntdll-Track-if-a-WRITECOPY-page-has-been-modified.patch b/patches/ntdll-WRITECOPY/0005-ntdll-Track-if-a-WRITECOPY-page-has-been-modified.patch index 69835296..6510a189 100644 --- a/patches/ntdll-WRITECOPY/0005-ntdll-Track-if-a-WRITECOPY-page-has-been-modified.patch +++ b/patches/ntdll-WRITECOPY/0005-ntdll-Track-if-a-WRITECOPY-page-has-been-modified.patch @@ -1,4 +1,4 @@ -From e00479d767bf9bbb480be7b5c75dbd55812feb4d Mon Sep 17 00:00:00 2001 +From 10f273da9caa0b7c814f46b76279065a956393af Mon Sep 17 00:00:00 2001 From: Andrew Wesie Date: Fri, 24 Apr 2020 14:55:14 -0500 Subject: [PATCH] ntdll: Track if a WRITECOPY page has been modified. @@ -8,11 +8,11 @@ read-write page. Signed-off-by: Andrew Wesie --- - dlls/ntdll/unix/virtual.c | 24 +++++++++++++++++++----- - 1 file changed, 19 insertions(+), 5 deletions(-) + dlls/ntdll/unix/virtual.c | 30 ++++++++++++++++++++++++------ + 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index 75d5a3fc966..c91484432c1 100644 +index 5eadabf7dca..58fd4d0edfc 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -122,6 +122,7 @@ struct file_view @@ -23,7 +23,7 @@ index 75d5a3fc966..c91484432c1 100644 /* per-mapping protection flags */ #define VPROT_ARM64EC 0x0100 /* view may contain ARM64EC code */ #define VPROT_SYSTEM 0x0200 /* system view (underlying mmap not under our control) */ -@@ -1127,7 +1128,7 @@ static int get_unix_prot( BYTE vprot ) +@@ -1155,7 +1156,7 @@ static int get_unix_prot( BYTE vprot ) #if defined(__i386__) if (vprot & VPROT_WRITECOPY) { @@ -32,7 +32,7 @@ index 75d5a3fc966..c91484432c1 100644 prot = (prot & ~PROT_WRITE) | PROT_READ; else prot |= PROT_WRITE | PROT_READ; -@@ -1641,7 +1642,11 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz +@@ -1672,7 +1673,11 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz */ static DWORD get_win32_prot( BYTE vprot, unsigned int map_prot ) { @@ -45,7 +45,12 @@ index 75d5a3fc966..c91484432c1 100644 if (vprot & VPROT_GUARD) ret |= PAGE_GUARD; if (map_prot & SEC_NOCACHE) ret |= PAGE_NOCACHE; return ret; -@@ -1752,12 +1757,21 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr +@@ -1778,16 +1783,29 @@ static void mprotect_range( void *base, size_t size, BYTE set, BYTE clear ) + */ + static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vprot ) + { ++ int unix_prot; ++ if (view->protect & VPROT_WRITEWATCH) { /* each page may need different protections depending on write watch flag */ @@ -54,13 +59,17 @@ index 75d5a3fc966..c91484432c1 100644 mprotect_range( base, size, 0, 0 ); return TRUE; } ++ + if (enable_write_exceptions && is_vprot_exec_write( vprot )) vprot |= VPROT_WRITEWATCH; +- if (mprotect_exec( base, size, get_unix_prot(vprot) )) return FALSE; +- set_page_vprot( base, size, vprot ); ++ unix_prot = get_unix_prot(vprot); + + /* check that we can map this memory with PROT_WRITE since we cannot fail later */ + if (vprot & VPROT_WRITECOPY) + unix_prot |= PROT_WRITE; + - if (mprotect_exec( base, size, unix_prot )) return FALSE; -- set_page_vprot( base, size, vprot ); ++ if (mprotect_exec( base, size, unix_prot )) return FALSE; + /* each page may need different protections depending on writecopy */ + set_page_vprot_bits( base, size, vprot, ~vprot & ~VPROT_WRITTEN ); + if (vprot & VPROT_WRITECOPY) @@ -69,7 +78,7 @@ index 75d5a3fc966..c91484432c1 100644 return TRUE; } -@@ -3739,7 +3753,7 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack ) +@@ -4093,7 +4111,7 @@ NTSTATUS virtual_handle_fault( EXCEPTION_RECORD *rec, void *stack ) } if (vprot & VPROT_WRITECOPY) { @@ -79,5 +88,5 @@ index 75d5a3fc966..c91484432c1 100644 } /* ignore fault if page is writable now */ -- -2.40.1 +2.45.2 diff --git a/patches/ntdll-WRITECOPY/0008-ntdll-Fallback-to-copy-pages-for-WRITECOPY.patch b/patches/ntdll-WRITECOPY/0008-ntdll-Fallback-to-copy-pages-for-WRITECOPY.patch index 23b25a24..18fab046 100644 --- a/patches/ntdll-WRITECOPY/0008-ntdll-Fallback-to-copy-pages-for-WRITECOPY.patch +++ b/patches/ntdll-WRITECOPY/0008-ntdll-Fallback-to-copy-pages-for-WRITECOPY.patch @@ -1,4 +1,4 @@ -From f26f4f9338473fee2ad3901fe5b259ac26e66f3c Mon Sep 17 00:00:00 2001 +From 1d8b9ce07aaafd3184a118c8d986b54617571c7b Mon Sep 17 00:00:00 2001 From: Andrew Wesie Date: Tue, 28 Apr 2020 03:27:16 -0500 Subject: [PATCH] ntdll: Fallback to copy pages for WRITECOPY. @@ -16,12 +16,12 @@ Signed-off-by: Andrew Wesie 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index 8346baf77a9..457468b47d9 100644 +index 71fe33cdb0e..ba5701d7bfe 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c -@@ -1587,8 +1587,9 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr - return TRUE; - } +@@ -1796,8 +1796,9 @@ static BOOL set_vprot( struct file_view *view, void *base, size_t size, BYTE vpr + if (enable_write_exceptions && is_vprot_exec_write( vprot )) vprot |= VPROT_WRITEWATCH; + unix_prot = get_unix_prot(vprot); - /* check that we can map this memory with PROT_WRITE since we cannot fail later */ - if (vprot & VPROT_WRITECOPY) @@ -31,9 +31,9 @@ index 8346baf77a9..457468b47d9 100644 unix_prot |= PROT_WRITE; if (mprotect_exec( base, size, unix_prot )) return FALSE; -@@ -3335,10 +3336,26 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack ) - set_page_vprot_bits( page, page_size, 0, VPROT_WRITEWATCH ); - mprotect_range( page, page_size, 0, 0 ); +@@ -4111,10 +4112,26 @@ NTSTATUS virtual_handle_fault( EXCEPTION_RECORD *rec, void *stack ) + mprotect_range( page, page_size, 0, 0 ); + } } - if (vprot & VPROT_WRITECOPY) + if ((vprot & VPROT_WRITECOPY) && (vprot & VPROT_COMMITTED)) @@ -61,5 +61,5 @@ index 8346baf77a9..457468b47d9 100644 /* ignore fault if page is writable now */ if (get_unix_prot( get_page_vprot( page ) ) & PROT_WRITE) ret = STATUS_SUCCESS; -- -2.30.2 +2.45.2 diff --git a/patches/winemac.drv-no-flicker-patch/0001-winemac.drv-No-Flicker-patch.patch b/patches/winemac.drv-no-flicker-patch/0001-winemac.drv-No-Flicker-patch.patch index afb64dcb..6d7e14e8 100644 --- a/patches/winemac.drv-no-flicker-patch/0001-winemac.drv-No-Flicker-patch.patch +++ b/patches/winemac.drv-no-flicker-patch/0001-winemac.drv-No-Flicker-patch.patch @@ -1,4 +1,4 @@ -From ad91a015d40c8bea7dcb603ead7897e593ea173a Mon Sep 17 00:00:00 2001 +From 6d2e0b68dacbece60f35c2fb77effee0a6d8b07d Mon Sep 17 00:00:00 2001 From: Ken Thomases Date: Tue, 22 Jun 2021 07:56:43 +1000 Subject: [PATCH] winemac.drv: No Flicker patch @@ -10,22 +10,22 @@ Subject: [PATCH] winemac.drv: No Flicker patch 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h -index 19efc4dc7d4..2468d4219f6 100644 +index 5394a3f89fe..71ebfc9ff72 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h -@@ -44,6 +44,7 @@ +@@ -43,6 +43,7 @@ + extern BOOL allow_vsync; extern BOOL allow_set_gamma; extern BOOL allow_software_rendering; - extern BOOL disable_window_decorations; +extern BOOL force_backing_store; extern const char* debugstr_cf(CFTypeRef t); diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c -index 21b148ff558..3034fe2f780 100644 +index 009d9e694a5..3c9425e6f5f 100644 --- a/dlls/winemac.drv/macdrv_main.c +++ b/dlls/winemac.drv/macdrv_main.c -@@ -60,6 +60,7 @@ int use_precise_scrolling = TRUE; +@@ -59,6 +59,7 @@ int use_precise_scrolling = TRUE; int gl_surface_mode = GL_SURFACE_IN_FRONT_OPAQUE; int retina_enabled = FALSE; int enable_app_nap = FALSE; @@ -33,7 +33,7 @@ index 21b148ff558..3034fe2f780 100644 CFDictionaryRef localized_strings; -@@ -378,6 +379,9 @@ static void setup_options(void) +@@ -373,6 +374,9 @@ static void setup_options(void) if (!get_config_key(hkey, appkey, "EnableAppNap", buffer, sizeof(buffer))) enable_app_nap = IS_OPTION_TRUE(buffer[0]); @@ -44,7 +44,7 @@ index 21b148ff558..3034fe2f780 100644 processes in the prefix. */ if (!get_config_key(hkey, NULL, "RetinaMode", buffer, sizeof(buffer))) diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c -index 1c0b87d694a..b0a3e25fd73 100644 +index ac87cfc1313..68de39f49cd 100644 --- a/dlls/winemac.drv/opengl.c +++ b/dlls/winemac.drv/opengl.c @@ -1451,7 +1451,7 @@ static BOOL create_context(struct wgl_context *context, CGLContextObj share, uns @@ -57,5 +57,5 @@ index 1c0b87d694a..b0a3e25fd73 100644 if (core) -- -2.43.0 +2.45.2 diff --git a/patches/winex11-Fixed-scancodes/0005-winex11-Use-the-user-configured-keyboard-layout-if-a.patch b/patches/winex11-Fixed-scancodes/0005-winex11-Use-the-user-configured-keyboard-layout-if-a.patch index a9f049d2..0b22f719 100644 --- a/patches/winex11-Fixed-scancodes/0005-winex11-Use-the-user-configured-keyboard-layout-if-a.patch +++ b/patches/winex11-Fixed-scancodes/0005-winex11-Use-the-user-configured-keyboard-layout-if-a.patch @@ -1,4 +1,4 @@ -From 4c7d3e59dc62e62aac5ce273494e1a7cb5349bd1 Mon Sep 17 00:00:00 2001 +From 3e4287cf1f1824641954ce899abfcf68de7beaa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 6 Jan 2023 08:09:11 +0100 Subject: [PATCH] winex11: Use the user configured keyboard layout if any. @@ -12,10 +12,10 @@ Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45605 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c -index 1846bd923a5..fe87ae2235d 100644 +index 5b53a1b87b3..acd9def0f64 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c -@@ -929,7 +929,6 @@ static const struct { +@@ -928,7 +928,6 @@ static const struct { {0, NULL, NULL, NULL, NULL} /* sentinel */ }; @@ -23,7 +23,7 @@ index 1846bd923a5..fe87ae2235d 100644 /* maybe more of these scancodes should be extended? */ /* extended must be set for ALT_R, CTRL_R, -@@ -1084,6 +1083,26 @@ static const WORD xfree86_vendor_key_vkey[256] = +@@ -1083,6 +1082,26 @@ static const WORD xfree86_vendor_key_vkey[256] = 0, 0, 0, 0, 0, 0, 0, 0 /* 1008FFF8 */ }; @@ -50,7 +50,7 @@ index 1846bd923a5..fe87ae2235d 100644 WCHAR *x11drv_get_keyboard_layout_list( DWORD *length ) { WCHAR *tmp, *layouts = calloc( 1, sizeof(WCHAR) ); -@@ -1468,11 +1487,11 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev ) +@@ -1449,11 +1468,11 @@ BOOL X11DRV_KeyEvent( HWND hwnd, XEvent *xev ) * whichever matches most closely. * kbd_section must be held. */ @@ -64,7 +64,7 @@ index 1846bd923a5..fe87ae2235d 100644 KeySym keysym = 0; const char (*lkey)[MAIN_LEN][4]; unsigned max_seq = 0; -@@ -1570,6 +1589,7 @@ X11DRV_KEYBOARD_DetectLayout( Display *display ) +@@ -1550,6 +1569,7 @@ X11DRV_KEYBOARD_DetectLayout( Display *display ) main_key_tab[kbd_layout].comment); TRACE("detected layout is \"%s\"\n", main_key_tab[kbd_layout].comment); @@ -72,7 +72,7 @@ index 1846bd923a5..fe87ae2235d 100644 } -@@ -1605,7 +1625,7 @@ void X11DRV_InitKeyboard( Display *display ) +@@ -1585,7 +1605,7 @@ void X11DRV_InitKeyboard( Display *display ) { 0x41, 0x5a }, /* VK_A - VK_Z */ { 0, 0 } }; @@ -81,7 +81,7 @@ index 1846bd923a5..fe87ae2235d 100644 pthread_mutex_lock( &kbd_mutex ); XDisplayKeycodes(display, &min_keycode, &max_keycode); -@@ -1637,8 +1657,9 @@ void X11DRV_InitKeyboard( Display *display ) +@@ -1617,8 +1637,9 @@ void X11DRV_InitKeyboard( Display *display ) } XFreeModifiermap(mmp); @@ -94,18 +94,18 @@ index 1846bd923a5..fe87ae2235d 100644 syms = (keysyms_per_keycode > 4) ? 4 : keysyms_per_keycode; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h -index 52260474ad2..f6baca922ef 100644 +index 4f9ccd1e3f8..85012bf4bfc 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h -@@ -447,6 +447,7 @@ extern BOOL use_take_focus; +@@ -429,6 +429,7 @@ extern BOOL use_take_focus; extern BOOL use_primary_selection; extern BOOL use_system_cursors; extern BOOL grab_fullscreen; +extern int keyboard_layout; extern BOOL usexcomposite; extern BOOL managed_mode; - extern BOOL decorated_mode; -@@ -707,6 +708,7 @@ extern void init_recursive_mutex( pthread_mutex_t *mutex ); + extern BOOL private_color_map; +@@ -687,6 +688,7 @@ extern void init_recursive_mutex( pthread_mutex_t *mutex ); /* keyboard.c */ @@ -114,7 +114,7 @@ index 52260474ad2..f6baca922ef 100644 #define DEPTH_COUNT 3 diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c -index b83365861d4..842f03be998 100644 +index 56edca46f37..909de5e46eb 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -75,6 +75,7 @@ BOOL use_take_focus = TRUE; @@ -123,9 +123,9 @@ index b83365861d4..842f03be998 100644 BOOL grab_fullscreen = FALSE; +int keyboard_layout = -1; BOOL managed_mode = TRUE; - BOOL decorated_mode = TRUE; BOOL private_color_map = FALSE; -@@ -571,6 +572,9 @@ static void setup_options(void) + int primary_monitor = 0; +@@ -545,6 +546,9 @@ static void setup_options(void) if (!get_config_key( hkey, appkey, "GrabFullscreen", buffer, sizeof(buffer) )) grab_fullscreen = IS_OPTION_TRUE( buffer[0] ); @@ -136,5 +136,5 @@ index b83365861d4..842f03be998 100644 if (p) set_reg_string_value( hkey, "KeyboardLayoutList", p, len * sizeof(WCHAR) ); free( p ); -- -2.42.0 +2.45.2 diff --git a/patches/winex11-Fixed-scancodes/0008-winex11-Support-fixed-X11-keycode-to-scancode-conver.patch b/patches/winex11-Fixed-scancodes/0008-winex11-Support-fixed-X11-keycode-to-scancode-conver.patch index 1ba500df..a4293906 100644 --- a/patches/winex11-Fixed-scancodes/0008-winex11-Support-fixed-X11-keycode-to-scancode-conver.patch +++ b/patches/winex11-Fixed-scancodes/0008-winex11-Support-fixed-X11-keycode-to-scancode-conver.patch @@ -1,4 +1,4 @@ -From c61fac8a28ccc3f6bfb1e502cfc1e4027fe2d2c9 Mon Sep 17 00:00:00 2001 +From aea99c0314c0dd230b32d2936e8902bed6bd25b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 30 Nov 2022 18:46:00 +0100 Subject: [PATCH] winex11: Support fixed X11 keycode to scancode conversion. @@ -16,7 +16,7 @@ Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45605 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c -index dbc1e1ea689..6a71da1a5d9 100644 +index d06cef34035..74a0962434c 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -64,6 +64,46 @@ static const unsigned int ControlMask = 1 << 2; @@ -66,7 +66,7 @@ index dbc1e1ea689..6a71da1a5d9 100644 static int NumLockMask, ScrollLockMask, AltGrMask; /* mask in the XKeyEvent state */ static pthread_mutex_t kbd_mutex = PTHREAD_MUTEX_INITIALIZER; -@@ -1737,7 +1777,7 @@ void X11DRV_InitKeyboard( Display *display ) +@@ -1717,7 +1757,7 @@ void X11DRV_InitKeyboard( Display *display ) } TRACE("keycode %u => vkey %04X\n", e2.keycode, vkey); keyc2vkey[e2.keycode] = vkey; @@ -75,7 +75,7 @@ index dbc1e1ea689..6a71da1a5d9 100644 if ((vkey & 0xff) && vkey_used[(vkey & 0xff)]) WARN("vkey %04X is being used by more than one keycode\n", vkey); vkey_used[(vkey & 0xff)] = 1; -@@ -1848,7 +1888,7 @@ void X11DRV_InitKeyboard( Display *display ) +@@ -1828,7 +1868,7 @@ void X11DRV_InitKeyboard( Display *display ) #undef VKEY_IF_NOT_USED /* If some keys still lack scancodes, assign some arbitrary ones to them now */ @@ -85,19 +85,19 @@ index dbc1e1ea689..6a71da1a5d9 100644 const char *ksname; keysym = XkbKeycodeToKeysym( display, keyc, 0, 0 ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h -index f6baca922ef..e11c48dd3e2 100644 +index 85012bf4bfc..7980980b9b8 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h -@@ -448,6 +448,7 @@ extern BOOL use_primary_selection; +@@ -430,6 +430,7 @@ extern BOOL use_primary_selection; extern BOOL use_system_cursors; extern BOOL grab_fullscreen; extern int keyboard_layout; +extern BOOL keyboard_scancode_detect; extern BOOL usexcomposite; extern BOOL managed_mode; - extern BOOL decorated_mode; + extern BOOL private_color_map; diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c -index 842f03be998..782989dab4b 100644 +index 909de5e46eb..3842aa4b3ea 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -76,6 +76,7 @@ BOOL use_primary_selection = FALSE; @@ -106,9 +106,9 @@ index 842f03be998..782989dab4b 100644 int keyboard_layout = -1; +BOOL keyboard_scancode_detect = TRUE; BOOL managed_mode = TRUE; - BOOL decorated_mode = TRUE; BOOL private_color_map = FALSE; -@@ -579,6 +580,9 @@ static void setup_options(void) + int primary_monitor = 0; +@@ -553,6 +554,9 @@ static void setup_options(void) if (p) set_reg_string_value( hkey, "KeyboardLayoutList", p, len * sizeof(WCHAR) ); free( p ); @@ -119,5 +119,5 @@ index 842f03be998..782989dab4b 100644 default_visual.depth = wcstol( buffer, NULL, 0 ); -- -2.42.0 +2.45.2 diff --git a/patches/winex11-Fixed-scancodes/0009-winex11-Disable-keyboard-scancode-auto-detection-by-.patch b/patches/winex11-Fixed-scancodes/0009-winex11-Disable-keyboard-scancode-auto-detection-by-.patch index 46cf0ebb..b0fac05f 100644 --- a/patches/winex11-Fixed-scancodes/0009-winex11-Disable-keyboard-scancode-auto-detection-by-.patch +++ b/patches/winex11-Fixed-scancodes/0009-winex11-Disable-keyboard-scancode-auto-detection-by-.patch @@ -1,4 +1,4 @@ -From cdb9c20dfeede2240d102ac2f407f58591b3ec2d Mon Sep 17 00:00:00 2001 +From 609658c175d92bc3202744ed32ce6ee4de2bf648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 6 Jan 2023 11:31:36 +0100 Subject: [PATCH] winex11: Disable keyboard scancode auto-detection by default. @@ -11,7 +11,7 @@ Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45605 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c -index 782989dab4b..3bee214e09b 100644 +index 3842aa4b3ea..9bc12c2b5f5 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -76,7 +76,7 @@ BOOL use_primary_selection = FALSE; @@ -21,8 +21,8 @@ index 782989dab4b..3bee214e09b 100644 -BOOL keyboard_scancode_detect = TRUE; +BOOL keyboard_scancode_detect = FALSE; BOOL managed_mode = TRUE; - BOOL decorated_mode = TRUE; BOOL private_color_map = FALSE; + int primary_monitor = 0; diff --git a/programs/winecfg/input.c b/programs/winecfg/input.c index a9d83b45f00..3ee20d49874 100644 --- a/programs/winecfg/input.c @@ -37,5 +37,5 @@ index a9d83b45f00..3ee20d49874 100644 else CheckDlgButton( dialog, IDC_KEYBOARD_SCANCODE_DETECT, BST_UNCHECKED ); free( buffer ); -- -2.42.0 +2.45.2 diff --git a/patches/winex11-Window_Style/0001-winex11-Fix-handling-of-window-attributes-for-WS_EX_.patch b/patches/winex11-Window_Style/0001-winex11-Fix-handling-of-window-attributes-for-WS_EX_.patch index 5bf806a7..1c25b1e3 100644 --- a/patches/winex11-Window_Style/0001-winex11-Fix-handling-of-window-attributes-for-WS_EX_.patch +++ b/patches/winex11-Window_Style/0001-winex11-Fix-handling-of-window-attributes-for-WS_EX_.patch @@ -1,4 +1,4 @@ -From 0c5b3442fb0cef821b43009cc827d0a340319bce Mon Sep 17 00:00:00 2001 +From 170ea84514f98820468b139967f0321105524770 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Sat, 24 Jan 2015 05:12:49 +0100 Subject: [PATCH] winex11: Fix handling of window attributes for WS_EX_LAYERED @@ -9,11 +9,11 @@ Subject: [PATCH] winex11: Fix handling of window attributes for WS_EX_LAYERED 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c -index 6a2c6663b0f..1e5d7dcbf0a 100644 +index 0e06939f67d..5f68addc204 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c -@@ -317,7 +317,7 @@ static unsigned long get_mwm_decorations( struct x11drv_win_data *data, - if (data->shaped) return 0; +@@ -308,7 +308,7 @@ static unsigned long get_mwm_decorations_for_style( DWORD style, DWORD ex_style + unsigned long ret = 0; if (ex_style & WS_EX_TOOLWINDOW) return 0; - if (ex_style & WS_EX_LAYERED) return 0; @@ -21,7 +21,7 @@ index 6a2c6663b0f..1e5d7dcbf0a 100644 if ((style & WS_CAPTION) == WS_CAPTION) { -@@ -2785,8 +2785,9 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, cons +@@ -2669,8 +2669,9 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, cons BOOL needs_map = TRUE; /* layered windows are mapped only once their attributes are set */ @@ -33,5 +33,5 @@ index 6a2c6663b0f..1e5d7dcbf0a 100644 if (needs_icon) fetch_icon_data( hwnd, 0, 0 ); if (needs_map) map_window( hwnd, new_style ); -- -2.43.0 +2.45.2 diff --git a/patches/winex11.drv-Query_server_position/0001-winex11.drv-window-Query-the-X-server-for-the-actual.patch b/patches/winex11.drv-Query_server_position/0001-winex11.drv-window-Query-the-X-server-for-the-actual.patch index 2e39be97..e536d339 100644 --- a/patches/winex11.drv-Query_server_position/0001-winex11.drv-window-Query-the-X-server-for-the-actual.patch +++ b/patches/winex11.drv-Query_server_position/0001-winex11.drv-window-Query-the-X-server-for-the-actual.patch @@ -1,4 +1,4 @@ -From 65e44ef0e0b049ccd98f6d4c9c9e4676090dd1b5 Mon Sep 17 00:00:00 2001 +From 35f112456d2095d17e59974ca7538c67bad110c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Mon, 24 Dec 2018 14:26:57 +0200 Subject: [PATCH] winex11.drv/window: Query the X server for the actual rect of @@ -22,7 +22,7 @@ Signed-off-by: Gabriel Ivăncescu 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c -index 1e5d7dcbf0a..3362446bc4c 100644 +index 0e06939f67d..cc5d0db870c 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -222,6 +222,25 @@ static BOOL has_owned_popups( HWND hwnd ) @@ -51,16 +51,16 @@ index 1e5d7dcbf0a..3362446bc4c 100644 /*********************************************************************** * alloc_win_data -@@ -2761,7 +2780,8 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, cons +@@ -2629,7 +2648,8 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, cons { if (((swp_flags & SWP_HIDEWINDOW) && !(new_style & WS_VISIBLE)) || (!event_type && !(new_style & WS_MINIMIZE) && -- !is_window_rect_mapped( &new_rects->window ) && is_window_rect_mapped( &old_window_rect ))) -+ !is_window_rect_mapped( &new_rects->window ) && is_window_rect_mapped( &old_window_rect ) && +- !is_window_rect_mapped( &new_rects->window ) && is_window_rect_mapped( &old_rects.window ))) ++ !is_window_rect_mapped( &new_rects->window ) && is_window_rect_mapped( &old_rects.window ) && + !is_actual_window_rect_mapped( data ))) { release_win_data( data ); unmap_window( hwnd ); -- -2.43.0 +2.45.2 diff --git a/staging/upstream-commit b/staging/upstream-commit index 87123729..e72c35a5 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -6e15604c48acd63dd8095a4ce2fd011cb3be96db +6a7bfbab10d653f6724e2917e0552515520e4fb3