Commit Graph

147 Commits

Author SHA1 Message Date
Rémi Bernon cfcc280905 winex11.drv: Send HTMENU instead of HTCAPTION to query window activation.
Commit 71d35d8940 broke the way
WM_TAKE_FOCUS protocol is implemented: WM_MOUSEACTIVATE now replies
MA_NOACTIVATE by default when using HTCAPTION.

We use the WM_MOUSEACTIVATE -although Windows does not- regardless of
the way focus is changed to check whether a window wants focus, and
Windows sometimes changes focus regardless of the message reply.

Steam and the Wine system tray are affected for instance.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-26 21:56:04 +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 ae8f605ede winex11.drv: Handle FocusIn/NotifyGrab and FocusOut/NotifyUngrab events.
These events are received on mutter, when moving undecorated managed
windows, although Wine never grabs the keyboard itself.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-23 19:44:18 +02:00
Rémi Bernon 6f9e788fc0 winex11.drv: Do not set clipping_cursor when clip window map state changes.
This flag should only indicate a successful call to XGrabPointer. If not
then we could assume we have ownership of the pointer when we don't.

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:25 +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
Rémi Bernon 4b81771b00 winex11.drv: Do not react to keyboard grab focus events.
Several window managers are sending FocusOut with NotifyGrab mode
then FocusOut with NotifyWhileGrabbed mode when a window focus is lost,
as a consequence of grabbing the keyboard input before changing window
focus.

This is the case during alt-tab, but keyboard can also be grabbed when
bringing activity view or clicking on the title bar. In this cases
NotifyWhileGrabbed events aren't sent until the window really loses
foreground.

In the same manner, when focus is restored, they usually send FocusIn
with NotifyWhileGrabbed mode followed by FocusIn with NotifyUngrab mode
when the keyboard grab is released.

When bringing activity view back and forth, or clicking on the title
bar, only NotifyUngrab event will be sent.

In order to be consistent across WM and to help simplifying focus
handling, just ignore focus events related to keyboard grabs.

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:00:17 +02:00
Rémi Bernon de6450135d winex11.drv: Print the FocusIn/FocusOut mode in trace message.
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-08-13 12:49:09 +02:00
Zhiyi Zhang 82c6ec3a32 winex11.drv: Activate window when restoring from iconic state.
Some games, e.g., Project CARS waits for WM_ACTIVATE
when restoring from iconic state.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-10 19:42:38 +02: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 d7cd441373 winex11: Use the stored coordinates to convert back from X11 to window rectangle.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-23 10:54:00 +02:00
Andrew Eikum 18564c76fc winex11.drv: Fix indentation for focus_out.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-08-22 22:59:54 +02:00
Andrey Gusev d09c4d9116 winex11.drv: Move condition to the proper place.
Signed-off-by: Andrey Gusev <andrey.goosev@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-06-22 12:44:48 +02:00
Akihiro Sagawa 876d5de0b4 winex11: Use proper return type for process_events().
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-29 16:39:33 +09:00
Akihiro Sagawa 030e1f4f5f winex11: Fix log message in process_events().
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-29 16:39:29 +09:00
Akihiro Sagawa ce7a98e95c winex11: Return more reliable value from X11DRV_MsgWaitForMultipleObjects.
After processing several X events, X11DRV_MsgWaitForMultipleObjects always
tells us that a new message is available. This is not true for some cases.

For instance, when we call DestroyWindow, the X queues DestroyEvent. Then,
X11DRV_MsgWaitForMultipleObjects handles the event only; none is posted or
sent as hwnd for destroyed window is unavailable. However, the function
states "new message is available" by returning count - 1 value.

This is an issue for CoWaitForMultipleHandles because it expects a new
message in the queue and consumes the message.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-25 22:27:40 +09:00
Alexandre Julliard 197f708be4 winex11: Include raw motion events in the QS_MOUSEMOVE event filter.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-12-02 15:31:34 +09:00
Vincent Povirk 3d8353fe18 winex11.drv: Track external changes to _NET_WM_STATE in net_wm_state.
In some cases, WM's will modify the _NET_WM_STATE of our own windows.
Most notably, this can happen when the WM maximizes our window, but
mutter has been known to alter the fullscreen state as well. If we
want to reconfigure our window later, we'll probably have to remove
these states, which means we need to remember that they were set.
2015-07-02 20:38:54 +09:00
Francois Gouget 3adc91f3fc winex11.drv: Remove unneeded NONAMELESSXXX directives. 2015-04-01 14:13:09 +09:00
Piotr Caban e7cba8f0dc winex11.drv: Don't resize hidden windows on ConfigureNotify event. 2015-01-08 13:58:29 +01:00
Sebastian Lackner f3568a5e12 winex11: Catch invalid values from broken QX11EmbedContainer implementations. 2014-01-27 14:13:29 +01:00
Frédéric Delanoy 323bec99b3 winex11.drv: Use BOOL type where appropriate. 2013-11-29 13:32:46 +01:00
Sebastian Lackner 2e0ca3e746 winex11: Send XEMBED_REQUEST_FOCUS request for embedded windows. 2013-11-19 19:03:40 +01:00
Sebastian Lackner df6dc091e6 winex11: Implement additional XEMBED events. 2013-11-11 20:06:56 +01:00
Alexandre Julliard 0b71e0bf12 winex11: Add helper functions for converting between root and virtual screen coords. 2013-10-14 17:26:13 +02:00
Alexandre Julliard 8373f8b6f6 winex11: Handle Expose events on top-level client windows. 2013-01-23 19:09:29 +01:00
Alexandre Julliard 8e65485732 winex11: Fall back to normal expose processing for areas outside of the surface region. 2012-12-03 18:24:44 +01:00
Henri Verbeet 32125fe65e winex11: Don't send SC_RESTORE when a maximized window switches to fullscreen. 2012-10-04 14:11:29 +02:00
Alexandre Julliard f12c1c6630 winex11: Switch to an ARGB visual for layered windows with per-pixel alpha. 2012-10-02 14:08:37 +02:00
Henri Verbeet 47c54c4ae7 winex11: Fullscreen windows are never maximized.
Some window managers incorrectly set maximized state on fullscreen windows.
2012-09-28 11:26:22 +02:00
Ken Thomases 5844105223 winex11: Avoid a redundant TRACE. 2012-09-24 22:27:27 +02:00
Alexandre Julliard a6c543d0e6 winex11: Add window data structure locking to the map/unmap functions. 2012-09-21 16:54:40 +02:00
Alexandre Julliard ba926faf91 winex11: Store the window display connection in the window structure. 2012-09-21 16:29:24 +02:00
Alexandre Julliard 5f8e41233b winex11: Add window data structure locking to the XEmbed event handler. 2012-09-19 13:14:00 +02:00
Alexandre Julliard 220f1af064 winex11: Add window data structure locking to the GravityNotify event handler. 2012-09-19 13:13:51 +02:00
Alexandre Julliard 89a60562a7 winex11: Add window data structure locking to the ReparentNotify event handler. 2012-09-19 13:13:40 +02:00
Alexandre Julliard 24c0abfd40 winex11: Add window data structure locking to the ConfigureNotify event handler. 2012-09-19 13:13:23 +02:00
Alexandre Julliard 6a4490d8ab winex11: Add window data structure locking to the Expose event handler. 2012-09-19 13:13:04 +02:00
Alexandre Julliard 2c9ce4968a winex11: Add window data locking to the focus event handlers. 2012-09-18 14:47:02 +02:00
Alexandre Julliard b8edf184ee winex11: Add a helper function to set input focus for non-managed windows. 2012-09-18 14:47:02 +02:00
Alexandre Julliard 731e497a87 winex11: Add window data locking to the drag and drop functions. 2012-09-18 14:47:01 +02:00
Alexandre Julliard c8ea1e50dc winex11: Avoid passing a window data structure to functions that can send messages. 2012-09-17 12:42:21 +02:00
Alexandre Julliard 6f1d43b16e winex11: Check for changes in min/maximize state even when the window rectangle didn't change. 2012-09-06 14:09:06 +02:00
Alexandre Julliard 2eebedf38e winex11: Handle Expose events by refreshing from the window surface. 2012-09-06 14:08:37 +02:00
Alexandre Julliard cf1be58706 winex11: Remove the remaining X11 locking calls. 2012-08-16 16:48:00 +02:00
Alexandre Julliard 6bfcb347bf winex11: Remove X11 locking around simple X calls. 2012-08-14 15:13:08 +02:00
Alexandre Julliard 29c1b8fa08 winex11: Ignore FocusOut event on destroyed windows. 2012-03-09 11:37:15 +01:00
Alexandre Julliard 002f85a275 winex11: Don't give focus to zero-size windows. 2012-02-01 16:42:47 +01:00
Alexandre Julliard 9716d1c861 winex11: Still process all MotionNotify events when using XInput2. 2011-11-09 15:45:13 +01:00