Commit Graph

2046 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
Damjan Jovanovic 523fb9496c winex11.drv: Ignore .dwAspect in FORMATETC during XDnD.
Some applications pass FORMATETC.dwAspect=0 to
IDataObject_[Query]GetData() during drag and drop, which
is not a valid DVASPECT_* value. Tests show that Windows
Explorer completely ignores .dwAspect for CF_HDROP when
it is the drag source, treating all values as
DVASPECT_CONTENT instead. Do the same.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43368
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-26 21:11:59 +01:00
Alexandre Julliard 458e0ad513 winex11: Use the default color table for window surfaces on 8bpp displays.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48088
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-19 18:38:22 +01:00
Francois Gouget aee91dc4ac winex11.drv: Fix the spelling of a WARN() message.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-11 09:28:55 +01:00
Derek Lesho bc02e8551f winex11: Set the scan code prefix when necessary.
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-12-02 22:02:56 +01:00
John Chadwick 578d26f826 winex11/wintab: Fix values for lcSys* and lcOut*.
Testing using the Wacom wintab32 (from driver version 6.3.37-3) on
Windows 10, it appears that the values for lcOut* were likely
accidentally mixed up with the values for lcSys*. The lcSys* values are,
according to the documentation, supposed to specify the extent of the
screen mapping area for the cursor, wheras lcOut* simply specifies the
output coordinate space for the given context. There is no logical
reason I'm aware of for why lcOut* would have different default values
from lcIn*, and in testing Wacom wintab32 defaults lcOut* to match
lcIn*.

In addition, lcSysExt* should use SM_C*VIRTUALSCREEN instead of
SM_C*SCREEN, to handle multi-monitor setups properly. Setting lcSysExt*
to these values works even if the tablet is mapped to a subset of this
area.

After this change, PaintTool SAI 2 appears to work out of the box. Other
wintab clients I tested appear to be unaffected (such as the Wintab SDK
demos and Adobe Photoshop CS2.)

Signed-off-by: John Chadwick <john@jchw.io>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-25 20:47:43 +01:00
Alex Henrie 1ff4a8fa41 winex11: Fix off-by-one error in color value scaling.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-22 09:09:15 +01:00
John Chadwick 4506b468d4 winex11.drv: Handle button events without axes.
Not all XInput events contain axes information. In particular, libinput
does not seem to provide axes information on button_event.

Signed-off-by: John Chadwick <john@jchw.io>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-21 21:00:39 +01:00
Zhiyi Zhang 427152ec7b winex11.drv: Fix NoRes mode handler having an empty mode.
After 25167fb286 get_primary_monitor_rect()
returns an empty rectangle before X11DRV_DisplayDevices_Init() is called.
So use get_host_primary_monitor_rect() to get the current X desktop size.
It's also more intuitive this way.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-05 17:31:05 +01:00
Zhiyi Zhang b7b4bacaf9 winex11.drv: Move the desktop fullscreen check after desktop init.
After 25167fb286, get_primary_monitor_rect(),
which is used in is_window_rect_fullscreen(), may return the primary
screen size set by the last explorer instance if wineserver didn't
fully shuts down. Also get_primary_monitor_rect() no longer reports the
host primary monitor rect before virtual desktop initialization now.
So move the desktop fullscreen check after desktop initialization
so that primary screen size is updated and valid.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-05 17:30:58 +01:00
Zhiyi Zhang acf03ed9da winex11.drv: Get virtual desktop size limit from the host primary display.
After 25167fb286, get_primary_monitor_rect()
maybe invalid before display device initialization or returns the desktop
rectangle after desktop initialization in virtual desktop mode, which is
wrong. The desktop size limit should come from host system.

This fixes a regression from efbbe66669.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47815
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-05 17:30:53 +01:00
Zhiyi Zhang 914b5519b1 winex11.drv: Use a separate virtual desktop display device handler.
If we want to query host monitor dimensions, we need to use XRandR
or Xinerama handler. However when in virtual desktop mode, its display
device handler overrides other handlers. So we need to separate them.
Then we can implement features that require host monitor dimensions like
checking whether the virtual desktop window is fullscreen.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-05 17:30:50 +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
Zhiyi Zhang 413aad3913 winex11.drv: Handle display device events in the desktop thread.
This fixes a regression from 22795243b2,
which calls thread_init_display() and eventually XOpenIM() before
X11DRV_InitXIM() is called.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47821
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-01 17:13:40 +01:00
Zhiyi Zhang 9ae8da6bb4 winex11.drv: Retrieve virtual and primary monitor rectangles from SetupAPI.
So that a process can still get the correct virtual and primary monitor
rectangles if display devices are reinitialized in another process.
Note that we can't use EnumDisplayMonitor() and GetMonitorInfo() here
because they are not loaded when loading winex11.drv.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-01 17:13:34 +01:00
Zhiyi Zhang de94cfa775 winex11.drv: Use underscore style for struct x11drv_display_device_handler.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-31 19:30:10 +01:00
Zhiyi Zhang 6dbb153ede winex11.drv: Call XFlush() right after XUngrabServer().
XGrabServer() stops the processing of other display connections
until a XUngrabServer() call is actually processed by the X server.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-31 19:30:00 +01:00
Alexandre Julliard 81f8b6e8c2 winex11: Also catch X errors from XF86VidModeSetGammaRamp().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-29 10:49:20 +01:00
Zhiyi Zhang 644d00d540 winex11.drv: Implement X11DRV_D3DKMTCheckVidPnExclusiveOwnership.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-22 23:04:27 +02:00
Zhiyi Zhang e08dd25f32 winex11.drv: Implement X11DRV_D3DKMTSetVidPnSourceOwner.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-22 23:04:27 +02:00
Zhiyi Zhang 354359197b gdi32: Add D3DKMTSetVidPnSourceOwner and D3DKMTCheckVidPnExclusiveOwnership stubs.
D3DKMTSetVidPnSourceOwner needs to be implemented in the graphics drivers
because we need to maintain the VidPN source ownership information list
in the graphics drivers. For example, the graphics drivers need to release the
exclusive ownership when a new window is moved to a monitor which has been taken
exclusive ownership.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-22 23:04:27 +02:00
Alex Henrie 7dd3abe69f winex11: Copy icon color table in 256-color mode (Valgrind).
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-17 21:11:18 +02:00
Zhiyi Zhang ffd4caa5f0 winex11.drv: Handle XRandR not reporting any providers.
Some XRandR implementations, e.g., the QXL driver used on Debian 10
TestBots, don't report any providers. In this case, we can still
search in XRandR screen resources to get adapters.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-25 16:28:44 +02:00
Zhiyi Zhang 10b2a996ba winex11.drv: Trace display device counts.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-25 16:28:36 +02: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
Zhiyi Zhang 22795243b2 winex11.drv: Handle XRandR display device changes.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-23 19:44:18 +02:00
Zhiyi Zhang be54adcffc winex11.drv: Support XRandR display device handler.
XRandR supports multiple GPUs and runtime device change
compared to Xinerama.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-23 19:44:18 +02:00
Zhiyi Zhang ec09dcf895 winex11.drv: Add virtual desktop display device handler.
The virtual desktop display device handler is actually the
Xinerama handler, but with a much higher priority. So that
it will be preferred in virtual desktop mode when other display
device handlers are introduced, e.g., the XRandR handler.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-23 19:44:18 +02:00
Zhiyi Zhang efbbe66669 winex11.drv: Initialize display devices before getting primary desktop rectangle.
Otherwise, the retrieved primary desktop might be from the last explorer instance
if we launch new explorer instances before wine server fully shuts down.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-23 19:44:18 +02:00
Zebediah Figura 22993aff94 winex11: Track the client colormap separately.
If a window with an OpenGL surface attached is reparented as a child window,
and then reparented as a top-level window, so that its whole window is
destroyed and then recreated, it will be recreated with the colormap of its
child window, which more than likely has a different visual. This violates
the X11 specification, which states that a window's colormap must have the
same visual as the window itself, and causes the X server to return BadMatch
to the CreateWindow request.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-19 12:56:59 +02: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
Andrew Eikum cb703739e5 winex11.drv: Throttle calls to XResetScreenSaver.
Frequent calls to XResetScreenSaver cause performance problems on some
GPU drivers, see https://bugs.freedesktop.org/show_bug.cgi?id=110659

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-17 18:50:03 +02:00
Alex Henrie 359eb9e557 winex11: Avoid dead assignment (scan-build).
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-16 10:15:46 +02:00
Alex Henrie a28980da5a winex11: Factor out array access in ConvertAttribWGLtoGLX (scan-build).
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-12 22:47:45 +02:00
Sven Baars 6033b3a7fb winex11.drv: Fix a memory leak (Coverity).
Signed-off-by: Sven Baars <sven.wine@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-09-11 22:37:22 +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 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
Zhiyi Zhang 25167fb286 winex11.drv: Make screen helpers independent of Xinerama.
So that other display device handlers such as XRandR can be introduced
because they might report a virtual screen size with different top-left
corner and the primary screen may be different as well.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-21 14:18:49 +02:00
Zhiyi Zhang 95a0a5c755 winex11.drv: Add xrandr_get_screen_resources() helper.
Getting screen resources will be used in multiple places.
So put it in a function.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-21 14:18:49 +02:00
Akihiro Sagawa aaac4e25ab winex11.drv: Indicate whether the drop point is non-client area.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-19 20:27:03 +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
Francois Gouget 66873d5fec winex11.drv: A spelling fix and slight rewording in a comment.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-08 17:53:36 +02:00
Zhiyi Zhang 7d70d45984 winex11.drv: Add DriverDateData registry property to display adapters.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35345.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-07-31 09:34:40 +02:00
Alexandre Julliard 4a902de213 gdi32: Make GDI driver functions cdecl.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-07-06 21:47:58 +02:00
Zhiyi Zhang cb350fc979 winex11.drv: Specify enumerator when calling SetupDiGetClassDevsW.
This reduces some search time.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-07-01 20:42:42 +02:00
Zhiyi Zhang 23b28323cb winex11.drv: Use generic GetMonitorInfo.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-25 13:22:17 +02:00