Commit Graph

211 Commits

Author SHA1 Message Date
Jacek Caban 10f38c0600 winex11: Move user driver to unixlib.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-06 19:18:22 +02:00
Jacek Caban 2f4a338da3 winex11: Use unixlib interface for x11drv_is_system_module.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-06 19:18:18 +02:00
Jacek Caban 0dcd1eaae5 winex11: Directly use NtUserCreateWindowEx.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-06 19:18:18 +02:00
Jacek Caban 4af9ac6733 winex11: Directly use win32u in more places.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-05 18:35:12 +02:00
Jacek Caban 7769c8e9df winex11: Directly use NtUserGetIconInfo.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-05 18:35:12 +02:00
Jacek Caban 30d5a04f6d winex11: Avoid using sprintfW.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-04 21:27:25 +02:00
Jacek Caban c736411fb8 winex11: Directly use ntdll in more places.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-03 19:01:13 +02:00
Jacek Caban c0a8b2dbd5 winex11: Use ntdll_umbstowcs and ntdll_wcstoumbs for Unicode conversion.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-03 19:01:13 +02:00
Jacek Caban ef8e4b7e3e winex11: Use libc for driver memory allocation.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-25 20:34:55 +02:00
Jacek Caban ee405dd8b8 win32u: Move is_window_rect_full_screen implementation from winex11.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-20 17:31:18 +02:00
Jacek Caban 3e94864540 winex11: Use NtUserGetThreadInfo to access thread data.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-19 17:36:41 +02:00
Jacek Caban 5ee6fcb30c winex11: Directly use win32u for user functions in mouse.c.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-14 17:53:34 +02:00
Jacek Caban 523a6eba02 winex11: Remove no longer needed helpers.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-13 18:13:34 +02:00
Jacek Caban 3a11be1d48 winex11: Directly use win32u for GDI functions in more places.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-12 21:39:42 +02:00
Jacek Caban 824e9bddd5 winex11: Directly use ntdll for registry access in create_xcursor_system_cursor.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-11 17:34:48 +02:00
Jacek Caban f6524f7a3a win32u: Don't use CDECL for user driver functions.
They are no longer used from PE code.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-07 22:44:39 +02:00
Zebediah Figura 6ef7cd4e3a winex11: Fix the build when XInput2 headers are not present.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-22 10:23:32 +01:00
Alexandre Julliard 8d6c33c3bf include: Remove wine/port.h.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-01 18:13:54 +01:00
Rémi Bernon f7ac9f309f winex11.drv: Accumulate mouse movement to avoid rounding losses.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=38420
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-25 20:55:00 +02:00
Rémi Bernon dfa11dc040 winex11.drv: Rename (x|y)_rel_valuator to (x|y)_valuator.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-25 20:55:00 +02:00
Rémi Bernon da11387857 winex11.drv: Use XIValuatorClassInfo instead of a custom struct.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-25 20:55:00 +02:00
Rémi Bernon 7bc5b6800e winex11.drv: Introduce new map_raw_event_coords helper.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-25 20:55:00 +02:00
Rémi Bernon 123c17aa92 user32: Add RAWINPUT parameter to __wine_send_input.
And send_hardware_message.

This makes it possible to use __wine_send_input to send extended input
data, such as HID device notifications and WM_INPUT messages carrying
HID reports.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-15 10:37:52 +02:00
Rémi Bernon 5a8bc554ef winex11.drv: Use X11 root-relative coordinates when possible.
Since whole_rect / client_rect are updated asynchronously, there may be
a small lag between X11 and Wine regarding the expected window position.

Then, as events' x and y fields are reported relative to the X11 window
position, this lag can cause inconsistencies when we compute absolute
mouse positions.

Also, applications that control their own position while being moved
cause additional whole_rect / client_rect updates, before X11 knows
about it.

This can make applications like Winamp go nuts when they are being moved
and move all over the place "randomly".

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46309
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-06 22:46:12 +02:00
Rémi Bernon a358a25eda winex11.drv: Map coordinates before calling send_mouse_input.
Based on a patch from Gabriel Ivăncescu <gabrielopcode@gmail.com>.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46309
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-06 22:46:12 +02:00
Rémi Bernon 9b6b09053a winex11.drv: Don't remap root_window relative coordinates.
We already converted coordinates from root to virtual screen, we
shouldn't need to remap them.

This is actually no-op because when window == root_window, hwnd is
the desktop window. In which case it isn't RTL, and MapWindowPoints is
no-op too.

It makes things less confusing and it will help later cases when we get
root-relative coordinates for other windows.

Based on a patch from Gabriel Ivăncescu <gabrielopcode@gmail.com>.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46309
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-06 22:46:12 +02:00
Rémi Bernon 29d56fcb8b winex11.drv: Update INPUT mouse coordinates directly.
Based on a patch from Gabriel Ivăncescu <gabrielopcode@gmail.com>.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46309
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-31 22:16:25 +02:00
Rémi Bernon 40f101e288 winex11.drv: Introduce new map_event_coords helper.
Based on a patch from Gabriel Ivăncescu <gabrielopcode@gmail.com>.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46309
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-31 22:16:25 +02:00
Rémi Bernon 16984895f0 winex11.drv: Forward clip_fullscreen_window to foreground thread.
If the current thread isn't the foreground thread. Otherwise we may
clip the cursor in the wrong thread, that isn't expecting mouse messages
or may not be checking its messages.

Red Faction has some race condition where this can happen for instance,
with clip_fullscreen_window called from X11DRV_DisplayDevices_Update
callback in a background thread. This thread starts clipping the cursor,
and the foreground thread isn't receiving MotionNotify events anymore.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-05 22:00:56 +02:00
Rémi Bernon 0120a1aa40 winex11.drv: Split clip cursor message in notify/request.
The message was sent to two different types of windows, with a different
semantic. We can now add parameters to the request without changing the
notify parameters semantics.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-05 22:00:53 +02:00
Rémi Bernon 432858b285 winex11.drv: Don't wait for the desktop thread to store clipping window.
The messages are in flight, the state will be updated eventually in
the order they are received by the desktop thread, we shouldn't have
to wait. If the clipping window gets overwritten, it will also receive
a message from the desktop thread, which is sent asynchronously already.

Call of Duty: WWII calls ClipCursor in a loop on startup while the
foreground thread is stalled and the messages sometimes pile up. The
recursive message processing that SendMessageW induces can then cause
stack overflows.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49643
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-04 21:16:49 +02:00
Zhiyi Zhang d9625e5a01 winex11.drv: Support clipping full screen windows on non-primary monitors.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-26 11:09:13 +02:00
Murray Colpman 893080e4df winex11.drv: Interpret mouse 6/7 as horiz scroll.
X11 Mouse buttons 6 and 7 were set to translate into browser
back/forward button events. However, this is based on an old convention
where buttons 6 and 7 could either mean horizontal scroll or browser
back/forward. Nowadays, 6 and 7 solely mean horizontal scroll, 8 and 9
being used for back/forward. In addition, the wide adoption of
two-finger two-dimensional scrolling on laptop trackpads since this code
was written has meant that back/forward events may be generated
unintentionally, which can be very disruptive when using tools such as
web browsers.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49142
Signed-off-by: Murray Colpman <muzer@tim32.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-14 23:12:31 +02:00
Alexandre Julliard 7afa53c0f2 winex11: Use standard dlopen() instead of the libwine wrappers.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-07 14:26:20 +02:00
Gabriel Ivăncescu dd38e4576b winex11.drv: Don't confine the pointer to any window when just checking for active grab.
Fixes a regression introduced by 74efb3e872,
which caused some random pointer warping on a setup with multiple "workspaces"
when switching between them and a full screen game that warped the mouse.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-15 22:03:30 +01:00
Zhiyi Zhang 99d047724e winex11.drv: Introduce is_virtual_desktop().
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-05 17:30:48 +01:00
Rémi Bernon 12c09051b4 winex11.drv: Destroy old clipping message window if it has been replaced.
When the same thread repeatedly calls ClipCursor, a message window is
created for every call, then stored in x11drv_thread_data->clip_hwnd.

The WM_X11DRV_CLIP_CURSOR notification is then sent to the desktop
window, then to the previous clipping thread in order for it to destroy
its clip_hwnd. But as the clipping thread is the same, and because
x11drv_thread_data->clip_hwnd has been overwritten, it does not satisfy
the "hwnd == data->clip_hwnd" condition and the window leaked.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-17 18:53:36 +02:00
Rémi Bernon 74efb3e872 winex11.drv: Only call XWarpPointer if we can get exclusive pointer grab.
XWarpPointer will always succeed, regardless of grabs, so if the pointer
is already grabbed, by some other application, we should not ask to warp
it.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-06 19:04:31 +02:00
Rémi Bernon ae4651b7ff winex11.drv: Explicitly call XUngrabPointer when clipping is released.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-06 19:04:29 +02:00
Rémi Bernon 92177b0b16 winex11.drv: Retry last ClipCursor when grab is released.
As we ignore these NotifyGrab / NotifyUngrab w.r.t focus decisions,
some applications are unaware of mouse grabs being lost and sometimes
cursor clipping is lost. We have to keep the last clip rectangle and
restore it when grab is released.

This has been squashed with the foreground window check from
Zhiyi Zhang <zzhang@codeweavers.com> to fix an issue that happens when
switching from a fullscreen window - because there's some additional
focus events involved - but in general, if the window that is getting
focus cannot be activated:

When FocusIn/NotifyWhileGrabbed is received, SetForegroundWindow is not
called if the window cannot be activated. When the FocusIn/NotifyUngrab
event arrives for the same window, we have to check the foreground
window before restoring cursor clipping rectangle.

For reference, the event sequence when pressing Alt-Tab - for WMs that
grab the keyboard - is the following:

1. FocusOut/NotifyGrab, when WM grabs the keyboard.
2. FocusOut/NotifyWhileGrabbed, while WM switches windows, this calls
   SetForegroundWindow(GetDesktopWindow()).

The event sequence for normal windows ends here, but for fullscreen
windows, there may be these additional events:

3. FocusIn/NotifyWhileGrabbed, which may not change Wine foreground
   window if it cannot be activated.
4. FocusIn/NotifyUnGrab, when WM releases the keyboard while switching
   windows, this is ignored but it should not retry to grab the cursor,
   because window is not foreground.
5. FocusOut/NotifyNormal, when WM finishes switching the windows.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-06 19:03:59 +02:00
Rémi Bernon 54f8077c41 winex11.drv: Only grab or warp the cursor when keyboard isn't grabbed.
When the window manager has taken a keyboard grab, it may be going to
move the window itself, so the application should not move the cursor
at the same time.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-06 19:03:44 +02:00
Sebastian Lackner e2389c015c winex11: Forward all clipping requests to the right thread.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=38087
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-18 16:53:30 +01:00
Michael Stefaniuc 8e1d40b966 winex11.drv: Use the ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-19 23:17:49 +02:00
Alexandre Julliard dc6f39ac29 server: Use screen coordinates in the update_window_zorder request.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-27 15:16:45 +02:00
Alexandre Julliard c102efbc35 winex11: Avoid left_side/top_side cursor names.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-04-27 11:22:00 +02:00
Alexandre Julliard 508ad84bbe winex11: Support multiple fallbacks for cursor names.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-04-23 12:01:40 +02:00
Alexandre Julliard 9b2b9d9cb3 winex11: Use more common names for resizing cursors.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-03-28 20:11:07 +02:00
Alexandre Julliard 2e0a1cfd83 winex11: Load a monochrome cursor instead of converting a color one when possible.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-10 20:51:09 +02:00
Chris Morgan 9c83e5ccf2 winex11: Wrap XInput2 dependent functions with appropriate #ifdef.
Signed-off-by: Chris Morgan <chmorgan@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-27 14:32:17 +01:00
Carlos Garnacho 448433ae03 winex11: Use XIAllDevices to select for XI_RawMotion.
Instead of selecting for XI2 events for every slave device individually,
do it for XIAllDevices, and store the current device's relative X/Y
valuators so they can be quickly looked up in the XI_RawMotion events
received.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-09 13:16:29 +01:00