Rebase against e8f4909ac3cc58e67ad73b9d4a0cbe6fe7b3bf90.

This commit is contained in:
Zebediah Figura 2024-02-12 17:29:03 -06:00
parent dc3b4e6589
commit eedc72d581
5 changed files with 15 additions and 352 deletions

View File

@ -1,4 +1,4 @@
From 8b435d44bcbeb2e6fd1ef37c8a23405dea88b685 Mon Sep 17 00:00:00 2001
From 2b6ee689166a59bf023b59cd9c1dd8b0b661a89e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 26 Feb 2015 06:41:26 +0100
Subject: [PATCH] kernelbase: Add support for progress callback in CopyFileEx.
@ -9,10 +9,10 @@ Subject: [PATCH] kernelbase: Add support for progress callback in CopyFileEx.
2 files changed, 66 insertions(+), 12 deletions(-)
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 1c4cdfea1b4..0d0e6a893c9 100644
index 02625140702..251010eb5d8 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -1169,23 +1169,17 @@ static void test_CopyFileEx(void)
@@ -1211,23 +1211,17 @@ static void test_CopyFileEx(void)
ok(hfile != INVALID_HANDLE_VALUE, "failed to open destination file, error %ld\n", GetLastError());
SetLastError(0xdeadbeef);
retok = CopyFileExA(source, dest, copy_progress_cb, hfile, NULL, 0);
@ -37,10 +37,10 @@ index 1c4cdfea1b4..0d0e6a893c9 100644
retok = CopyFileExA(source, NULL, copy_progress_cb, hfile, NULL, 0);
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
index 7b1858de424..a98a54ae9b1 100644
index cef861492e0..6f6343f6eaf 100644
--- a/dlls/kernelbase/file.c
+++ b/dlls/kernelbase/file.c
@@ -500,11 +500,16 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
@@ -496,11 +496,16 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
{
static const int buffer_size = 65536;
HANDLE h1, h2;
@ -58,7 +58,7 @@ index 7b1858de424..a98a54ae9b1 100644
if (!source || !dest)
{
@@ -526,7 +531,10 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
@@ -522,7 +527,10 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
if (flags & COPY_FILE_OPEN_SOURCE_FOR_WRITE)
FIXME("COPY_FILE_OPEN_SOURCE_FOR_WRITE is not supported\n");
@ -70,7 +70,7 @@ index 7b1858de424..a98a54ae9b1 100644
NULL, OPEN_EXISTING, 0, 0 )) == INVALID_HANDLE_VALUE)
{
WARN("Unable to open source %s\n", debugstr_w(source));
@@ -534,7 +542,7 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
@@ -530,7 +538,7 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
return FALSE;
}
@ -79,7 +79,7 @@ index 7b1858de424..a98a54ae9b1 100644
{
WARN("GetFileInformationByHandle returned error for %s\n", debugstr_w(source));
HeapFree( GetProcessHeap(), 0, buffer );
@@ -560,7 +568,11 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
@@ -556,7 +564,11 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
}
}
@ -92,7 +92,7 @@ index 7b1858de424..a98a54ae9b1 100644
(flags & COPY_FILE_FAIL_IF_EXISTS) ? CREATE_NEW : CREATE_ALWAYS,
info.FileAttributes, h1 )) == INVALID_HANDLE_VALUE)
{
@@ -570,6 +582,29 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
@@ -566,6 +578,29 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
return FALSE;
}
@ -122,7 +122,7 @@ index 7b1858de424..a98a54ae9b1 100644
while (ReadFile( h1, buffer, buffer_size, &count, NULL ) && count)
{
char *p = buffer;
@@ -579,13 +614,38 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
@@ -575,13 +610,38 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
if (!WriteFile( h2, p, count, &res, NULL ) || !res) goto done;
p += res;
count -= res;
@ -151,18 +151,18 @@ index 7b1858de424..a98a54ae9b1 100644
}
ret = TRUE;
done:
/* Maintain the timestamp of source file to destination file */
- info.FileAttributes = 0;
/* Maintain the timestamp of source file to destination file and read-only attribute */
- info.FileAttributes &= FILE_ATTRIBUTE_READONLY;
- NtSetInformationFile( h2, &io, &info, sizeof(info), FileBasicInformation );
+ basic_info.CreationTime = info.CreationTime;
+ basic_info.LastAccessTime = info.LastAccessTime;
+ basic_info.LastWriteTime = info.LastWriteTime;
+ basic_info.ChangeTime = info.ChangeTime;
+ basic_info.FileAttributes = 0;
+ basic_info.FileAttributes &= FILE_ATTRIBUTE_READONLY;
+ NtSetInformationFile( h2, &io, &basic_info, sizeof(basic_info), FileBasicInformation );
HeapFree( GetProcessHeap(), 0, buffer );
CloseHandle( h1 );
CloseHandle( h2 );
--
2.35.1
2.43.0

View File

@ -1,57 +0,0 @@
From 075b66ed9d322209d48cc607f70c831ac5c9bdab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Sun, 24 Oct 2021 16:27:40 +0200
Subject: [PATCH] winex11.drv: Simplify XInput2 valuator lookup.
Valuator names aren't well specified, and although they usually are
Rel X/Y or Abs X/Y, there are cases where the X/Y names are something
else. Just assume that the first two valuators are the X/Y axes, as it
seems to be generally the case.
---
dlls/winex11.drv/mouse.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 0eaae753f87..0a48be26bd0 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -328,26 +328,25 @@ void X11DRV_InitMouse( Display *display )
/***********************************************************************
* update_relative_valuators
*/
-static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuators)
+static void update_relative_valuators( XIAnyClassInfo **classes, int num_classes )
{
struct x11drv_thread_data *thread_data = x11drv_thread_data();
- int i;
+ XIValuatorClassInfo *valuator;
thread_data->x_valuator.number = -1;
thread_data->y_valuator.number = -1;
- for (i = 0; i < n_valuators; i++)
+ while (num_classes--)
{
- XIValuatorClassInfo *class = (XIValuatorClassInfo *)valuators[i];
- if (valuators[i]->type != XIValuatorClass) continue;
- if (class->label == x11drv_atom( Rel_X ) ||
- (!class->label && class->number == 0 && class->mode == XIModeRelative))
- thread_data->x_valuator = *class;
- else if (class->label == x11drv_atom( Rel_Y ) ||
- (!class->label && class->number == 1 && class->mode == XIModeRelative))
- thread_data->y_valuator = *class;
+ valuator = (XIValuatorClassInfo *)classes[num_classes];
+ if (classes[num_classes]->type != XIValuatorClass) continue;
+ if (valuator->number == 0 && valuator->mode == XIModeRelative) thread_data->x_valuator = *valuator;
+ if (valuator->number == 1 && valuator->mode == XIModeRelative) thread_data->y_valuator = *valuator;
}
+ if (thread_data->x_valuator.number < 0 || thread_data->y_valuator.number < 0)
+ WARN( "X/Y axis valuators not found, ignoring RawMotion events\n" );
+
thread_data->x_valuator.value = 0;
thread_data->y_valuator.value = 0;
}
--
2.33.0

View File

@ -1,133 +0,0 @@
From 1d5433cc0d7cd37af7c79fb2468c02b1c5a9a9ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 17 Jan 2020 16:33:11 +0100
Subject: [PATCH] winex11.drv: Split XInput2 thread initialization.
And rename the library and function loader to x11drv_xinput_load.
---
dlls/winex11.drv/mouse.c | 46 +++++++++++++++++++++++-----------
dlls/winex11.drv/x11drv.h | 3 ++-
dlls/winex11.drv/x11drv_main.c | 4 ++-
3 files changed, 36 insertions(+), 17 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index 612fff9995c..911e93d8de1 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -253,6 +253,32 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator
}
+/***********************************************************************
+ * x11drv_xinput_init
+ */
+void x11drv_xinput_init(void)
+{
+#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
+ struct x11drv_thread_data *data = x11drv_thread_data();
+ int major = 2, minor = 0;
+
+ if (data->xi2_state != xi_unknown) return;
+
+ if (xinput2_available &&
+ !pXIQueryVersion( data->display, &major, &minor ))
+ {
+ TRACE( "XInput2 %d.%d available\n", major, minor );
+ data->xi2_state = xi_disabled;
+ }
+ else
+ {
+ data->xi2_state = xi_unavailable;
+ WARN( "XInput 2.0 not available\n" );
+ }
+#endif
+}
+
+
/***********************************************************************
* enable_xinput2
*/
@@ -264,19 +290,9 @@ static void enable_xinput2(void)
unsigned char mask_bits[XIMaskLen(XI_LASTEVENT)];
int count;
- if (!xinput2_available) return;
+ TRACE( "state:%d\n", data->xi2_state );
+ if (data->xi2_state != xi_disabled) return;
- if (data->xi2_state == xi_unknown)
- {
- int major = 2, minor = 0;
- if (!pXIQueryVersion( data->display, &major, &minor )) data->xi2_state = xi_disabled;
- else
- {
- data->xi2_state = xi_unavailable;
- WARN( "X Input 2 not available\n" );
- }
- }
- if (data->xi2_state == xi_unavailable) return;
if (!pXIGetClientPointer( data->display, None, &data->xi2_core_pointer )) return;
mask.mask = mask_bits;
@@ -317,9 +333,9 @@ static void disable_xinput2(void)
struct x11drv_thread_data *data = x11drv_thread_data();
XIEventMask mask;
+ TRACE( "state:%d\n", data->xi2_state );
if (data->xi2_state != xi_enabled) return;
- TRACE( "disabling\n" );
data->xi2_state = xi_disabled;
mask.mask = NULL;
@@ -1755,9 +1771,9 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
/***********************************************************************
- * X11DRV_XInput2_Init
+ * x11drv_xinput_load
*/
-void X11DRV_XInput2_Init(void)
+void x11drv_xinput_load(void)
{
#if defined(SONAME_LIBXI) && defined(HAVE_X11_EXTENSIONS_XINPUT2_H)
int event, error;
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 2917579927c..fd69e55054c 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -261,7 +261,8 @@ extern void X11DRV_ThreadDetach(void);
/* X11 driver internal functions */
extern void X11DRV_Xcursor_Init(void);
-extern void X11DRV_XInput2_Init(void);
+extern void x11drv_xinput_load(void);
+extern void x11drv_xinput_init(void);
extern DWORD copy_image_bits( BITMAPINFO *info, BOOL is_r8g8b8, XImage *image,
const struct gdi_image_bits *src_bits, struct gdi_image_bits *dst_bits,
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index 32a20e0e4f2..573a41bbe96 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -700,7 +700,7 @@ static NTSTATUS x11drv_init( void *arg )
#ifdef SONAME_LIBXCOMPOSITE
X11DRV_XComposite_Init();
#endif
- X11DRV_XInput2_Init();
+ x11drv_xinput_load();
XkbUseExtension( gdi_display, NULL, NULL );
X11DRV_InitKeyboard( gdi_display );
@@ -790,6 +790,8 @@ struct x11drv_thread_data *x11drv_init_thread_data(void)
if (use_xim) xim_thread_attach( data );
+ x11drv_xinput_init();
+
return data;
}
--
2.42.0

View File

@ -1,147 +0,0 @@
From 9e5a2e10d466cbd51338a46d0385457bcb612b97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Sun, 24 Oct 2021 22:30:56 +0200
Subject: [PATCH] winex11.drv: Advertise XInput2 version 2.1 support.
Under XInput2 protocol version < 2.1, RawEvents are not supposed to be
sent if a pointer grab is active. However slave device events are still
received regardless of this specification and Wine implemented a
workaround to receive RawEvents during pointer grabs by listening to
these slave device events. Then, as soon as a mouse button is pressed
only the grabbing client will receive the raw motion events.
By advertising the support of XInput2 version >= 2.1, where RawEvents
are sent even during pointer grabs, we ensure to receive the RawMotion
events from the desktop window thread, even if a mouse grab is active.
It is now also possible to simplify the code by listening to master
device events only and get rid of slave device id tracking.
---
dlls/winex11.drv/mouse.c | 42 +++++----------------------------------
dlls/winex11.drv/x11drv.h | 3 ---
2 files changed, 5 insertions(+), 40 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index f11e73f436b..ff91aecb67f 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -260,7 +260,7 @@ void x11drv_xinput_init(void)
{
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
struct x11drv_thread_data *data = x11drv_thread_data();
- int major = 2, minor = 0;
+ int major = 2, minor = 1;
if (data->xi2_state != xi_unknown) return;
@@ -273,7 +273,7 @@ void x11drv_xinput_init(void)
else
{
data->xi2_state = xi_unavailable;
- WARN( "XInput 2.0 not available\n" );
+ WARN( "XInput 2.1 not available\n" );
}
#endif
}
@@ -309,7 +309,7 @@ void x11drv_xinput_enable( Display *display, Window window, long event_mask )
mask.mask = mask_bits;
mask.mask_len = sizeof(mask_bits);
- mask.deviceid = XIAllDevices;
+ mask.deviceid = XIAllMasterDevices;
memset( mask_bits, 0, sizeof(mask_bits) );
XISetMask( mask_bits, XI_DeviceChanged );
XISetMask( mask_bits, XI_RawMotion );
@@ -322,16 +322,6 @@ void x11drv_xinput_enable( Display *display, Window window, long event_mask )
update_relative_valuators( pointer_info->classes, pointer_info->num_classes );
pXIFreeDeviceInfo( pointer_info );
- /* This device info list is only used to find the initial current slave if
- * no XI_DeviceChanged events happened. If any hierarchy change occurred that
- * might be relevant here (eg. user switching mice after (un)plugging), a
- * XI_DeviceChanged event will point us to the right slave. So this list is
- * safe to be obtained statically at x11drv_xinput_enable() time.
- */
- if (data->xi2_devices) pXIFreeDeviceInfo( data->xi2_devices );
- data->xi2_devices = pXIQueryDevice( data->display, XIAllDevices, &data->xi2_device_count );
- data->xi2_current_slave = 0;
-
data->xi2_state = xi_enabled;
}
@@ -364,19 +354,16 @@ void x11drv_xinput_disable( Display *display, Window window, long event_mask )
mask.mask = NULL;
mask.mask_len = 0;
- mask.deviceid = XIAllDevices;
+ mask.deviceid = XIAllMasterDevices;
pXISelectEvents( display, DefaultRootWindow( display ), &mask, 1 );
if (!data) return;
- pXIFreeDeviceInfo( data->xi2_devices );
data->x_valuator.number = -1;
data->y_valuator.number = -1;
data->x_valuator.value = 0;
data->y_valuator.value = 0;
- data->xi2_devices = NULL;
data->xi2_core_pointer = 0;
- data->xi2_current_slave = 0;
data->xi2_state = xi_disabled;
#endif
}
@@ -1688,7 +1675,6 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev )
if (event->reason != XISlaveSwitch) return FALSE;
update_relative_valuators( event->classes, event->num_classes );
- data->xi2_current_slave = event->sourceid;
return TRUE;
}
@@ -1704,25 +1690,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
if (x->number < 0 || y->number < 0) return FALSE;
if (!event->valuators.mask_len) return FALSE;
if (thread_data->xi2_state != xi_enabled) return FALSE;
-
- /* If there is no slave currently detected, no previous motion nor device
- * change events were received. Look it up now on the device list in this
- * case.
- */
- if (!thread_data->xi2_current_slave)
- {
- XIDeviceInfo *devices = thread_data->xi2_devices;
-
- for (i = 0; i < thread_data->xi2_device_count; i++)
- {
- if (devices[i].use != XISlavePointer) continue;
- if (devices[i].deviceid != event->deviceid) continue;
- if (devices[i].attachment != thread_data->xi2_core_pointer) continue;
- thread_data->xi2_current_slave = event->deviceid;
- break;
- }
- }
- if (event->deviceid != thread_data->xi2_current_slave) return FALSE;
+ if (event->deviceid != thread_data->xi2_core_pointer) return FALSE;
virtual_rect = NtUserGetVirtualScreenRect();
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index e8cc85a15bd..fc3231ed40d 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -402,12 +402,9 @@ struct x11drv_thread_data
BOOL clipping_cursor; /* whether thread is currently clipping the cursor */
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
enum xi2_state xi2_state; /* XInput2 state */
- void *xi2_devices; /* list of XInput2 devices (valid when state is enabled) */
- int xi2_device_count;
XIValuatorClassInfo x_valuator;
XIValuatorClassInfo y_valuator;
int xi2_core_pointer; /* XInput2 core pointer id */
- int xi2_current_slave; /* Current slave driving the Core pointer */
#endif /* HAVE_X11_EXTENSIONS_XINPUT2_H */
};
--
2.40.1

View File

@ -1 +1 @@
39d8b25938dd2620c6e1b6ae37e70bcc4ff5922a
e8f4909ac3cc58e67ad73b9d4a0cbe6fe7b3bf90