Commit Graph

8410 Commits

Author SHA1 Message Date
Olivier Fourdan
a8581795ed xwayland: Fix LeaveNotify for relative pointer
Since commit 20c78f38, we use the relative pointer for enter/leave
events.

However, sprite_check_lost_focus() which verifies whether the pointer has
left an Xwayland surface still explicitly check for the absolute
pointer.

As a result, no LeaveNotify event is emitted anymore now when the
pointer crosses from an Xwayland surface to a Wayland native one.

Make sure to check the last slave device against get_pointer_event() as
well, not just the absolute pointer.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Martin Peres <martin.peres@mupuf.org>
Acked-by: Roman Gilg <subdiff@gmail.com>
Tested-by: Roman Gilg <subdiff@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Fixes: 20c78f38 - xwayland: use get_pointer_device() for enter/leave
                  handling too
(cherry picked from commit d7391f383d)
2021-03-05 09:25:24 +01:00
Olivier Fourdan
15f8b78904 xwayland: Delay cursor visibility update
Xwayland won't emulate XWarpPointer requests if the cursor is visible,
this is to avoid having the cursor jumping on screen and preventing
random X11 clients from controlling the pointer in Wayland, while
allowing games which use that mechanism with a hidden cursor to work in
Xwayland.

There are, however, games which tend to do it in the wrong order, i.e.
show the cursor before moving the pointer, and because Xwayland will not
allow an X11 client to move the pointer while the cursor is visible, the
requests will fail.

Add a workaround for such X11 clients, when the cursor is being shown,
keep it invisible until the cursor is actually moved. This way, X11
clients which show their cursor just before moving it would still have a
chance to succeed.

v2: Add a timeout to show the cursor for well behaved clients.
v3: Some cleanup (Michel)
v4: Do not cancel cursor delay when updating the cursor to avoid
    delaying cursor visibility indefinitely if the client keeps
    settings different cursors (Michel)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Tested-by: Jaap Buurman jaapbuurman@gmail.com
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/734
(cherry picked from commit 97ed0048e4)
2021-03-03 17:56:55 +01:00
Olivier Fourdan
b16dbd878d xwayland: Add PtrFeedback to the touch device
Trying to change the acceleration/threshold on Xwayland cannot work, and
the corresponding handler xwl_pointer_control() is a no-op.

Yet, an X11 client trying to change those on the touch device may
possibly cause a crash because the touch device in Xwayland doesn't set
that.

Initialize the touch device's PtrFeedback to make sure that just cannot
happen.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1137
(cherry picked from commit ab76272a7d)
2021-02-17 11:55:19 +00:00
Olivier Fourdan
4d2128fd1d xwayland: Use relative device for buttons/axis/enter/leave
We are using the relative pointer for motion events, but buttons and
axis events still go through the absolute pointer device.

That means additional DeviceChanged events that could be avoided if the
buttons and axis events were coming from the same device as motion
events.

However, routing just the buttons and axis events is not sufficient. In
Weston, clicking the window decoration of an Xwayland client gives us a
wl_pointer.button event immediately followed by a wl_pointer.leave event.
The leave event does not contain any button state information, so the button
remains logically down in the DIX.

Once the pointer button is released, a wl_pointer.enter event is sent with
the current button state (zero). This needs to trigger a ButtonRelease event
but for that we need to ensure that the device is the same as the one we send
ButtonPress events through.

Route those events along with enter/leave events to the relative pointer
if available so that motion, buttons and axis events come from the same
device (most of the time).

Suggested-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Related: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1130
(cherry picked from commit a4095162ca)
(cherry picked from commit 20c78f38a0)
2021-02-17 10:16:43 +01:00
Olivier Fourdan
49c479a7c3 xwayland: Add wheel axis to relative pointer
The relative pointer only has 2 axis, if we want to route the mouse
wheel events to that device, we need to add the axis definition, similar
to what is done for the absolute pointer.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Related: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1130
(cherry picked from commit 1abab61dc2)
2021-02-17 10:16:43 +01:00
Olivier Fourdan
c3f86d2868 xwayland: Split dispatch_pointer_motion_event
This is a cleanup patch, no functional change.

Split the function dispatch_pointer_motion_event() into three separate
simpler functions, relative motion with a warp emulator, relative motion
and absolute motion.

This makes the code a lot easier to read for me, rather than having
everything in a single function with nested if/else conditions.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 7181792824)
2021-02-17 10:16:43 +01:00
Olivier Fourdan
2e212551d6 xwayland: Use relative values for raw events
Xwayland supports relative motion events from the Wayland compositor via
the relative-pointer protocol, and converts those to the absolute range
in device units for raw events.

Some X11 clients however wrongly assume relative values in the axis
values even for devices explicitly labeled as absolute. While this is a
bug in the client, such applications would work fine in plain Xorg but
not with Xwayland.

To avoid that issue, use the relative values for raw events without
conversion, so that such application continue to work in Xwayland.

Thanks Peter for figuring out the root cause.

v2: Don't duplicate relative and absolute events (Peter)
v3: Use POINTER_RAWONLY (Peter)

Suggested-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1130
(cherry picked from commit c5c5322ad6)
2021-02-17 10:16:43 +01:00
Olivier Fourdan
7531d71663 xwayland: Use a resolution of 0 for relative motion
That's what evdev/libinput drivers do.

Suggested-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Related: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1130
(cherry picked from commit ebdb2e2646)
2021-02-17 10:16:43 +01:00
Michel Dänzer
0408fcb329 Don't install Xvfb
We're keeping it for unit tests, but we don't want to ship it from this
branch.

Also disable Xvfb in CI for ninja test. It's still built and used for
unit tests as part of ninja dist, but we don't want to run XTS on Xvfb.
2021-02-03 18:22:18 +01:00
Michel Dänzer
9335ee7994 Drop Xephyr / kdrive DDX 2021-02-03 18:13:15 +01:00
Michel Dänzer
4f4b8e00fc Drop Xorg DDX 2021-02-03 18:10:48 +01:00
Michel Dänzer
8f480147f6 Drop Xwin DDX 2021-02-03 18:08:58 +01:00
Michel Dänzer
69cc6a6caa Drop Xnest DDX 2021-02-03 18:01:50 +01:00
Michel Dänzer
6cae4b397d Drop Xquartz DDX 2021-02-03 18:00:43 +01:00
Michel Dänzer
f8a6a7b265 Drop DMX DDX 2021-02-03 18:00:04 +01:00
Michel Dänzer
9de9c31273 Drop autotools build system
Only meson is supported for Xwayland-only releases.
2021-02-03 17:59:31 +01:00
Olivier Fourdan
c7730cfe55 xwayland: Translate keyboard grabs on the root window
When an X11 client issues an active grab on the keyboard, Xwayland
forward this to the Wayland compositor using the Xwayland specific
protocol "xwayland-keyboard-grab" if it can find the corresponding
Xwayland window.

Some X11 clients (typically older games) however try to issue the
keyboard grab on the X11 root window, which has obviously no matching
Xwayland window. In such a case, the grab is simply ignored and the game
will not work as expected.

To workaround that issue, if an X11 client issues a keyboard grab on the
root window, Xwayland will search for a toplevel window belonging to the
same X11 client that it can use as the grab window instead.

This way, the grab can be forwarded to the Wayland compositor that can
either grant or deny the request based on the window and its internal
policies.

The heuristic picks the first realized toplevel window belonging to the
client so that the Wayland compositor will send it the keyboard events,
and the Xserver grab mechanism will then take care of routing the events
to the expected X11 window by itself.

v2: Make the test more clear (Dor Askayo <dor.askayo@gmail.com>)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
See-also: https://gitlab.gnome.org/GNOME/mutter/-/issues/1249
2021-02-02 09:49:35 +00:00
Jeremy Huddleston Sequoia
520e7a1310 xquartz: Ensure that NSRunAlertPanel() is run on the main thread
Fixes: https://github.com/XQuartz/XQuartz/issues/30
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-02 00:46:26 +00:00
Jeremy Huddleston Sequoia
7d0bb7ed06 xquartz: Remove support for older versions of libXplugin
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-01 16:21:39 -08:00
Jeremy Huddleston Sequoia
5e7c0762e6 xquartz: Remove unused include of AvailabilityMacros.h from various sources
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-01 16:21:39 -08:00
Jeremy Huddleston Sequoia
59f22341a8 xquartz: Remove support for building for i386
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-01 16:21:39 -08:00
Jeremy Huddleston Sequoia
aea15a7659 xquartz: Remove support for Mountain Lion and earlier versions of macOS
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-01 16:21:39 -08:00
Jeremy Huddleston Sequoia
c0b2d3e099 xquartz: Remove support for Lion and earlier versions of macOS
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-01 16:21:39 -08:00
Jeremy Huddleston Sequoia
cc9cf6f085 xquartz: Remove support for SnowLeopard and earlier versions of macOS
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-01 16:21:39 -08:00
Jeremy Huddleston Sequoia
f699aac2ea xquartz: Remove check for libdispatch now that we don't support pre-SnowLeopard
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-01 16:21:39 -08:00
Jeremy Huddleston Sequoia
5ad4910272 xquartz: Remove support for Leopard and earlier versions of macOS
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-01 16:21:39 -08:00
Jeremy Huddleston Sequoia
6e6db055f8 xquartz: Remove support for Tiger and earlier versions of macOS
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-01 16:21:39 -08:00
Jeremy Huddleston Sequoia
74aef85bd8 xquartz: Remove support for Panther and earlier versions of macOS
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-01 16:21:39 -08:00
Jim DeLaHunt
0e272ac458 Fix typo "XQaurtz" in Xquartz.man 2021-02-01 16:21:39 -08:00
Olivier Fourdan
3cdac5ba07 mi: List extensions in usage message
Not all extensions can be enabled or disabled at runtime, list the
extensions which can from the help message rather than on error only.

v2:
 * Print the header message in the ListStaticExtensions() (Peter
   Hutterer)
 * Do not export ListStaticExtensions() as Xserver API

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2021-01-29 12:52:09 +00:00
Misha Gusarov
4341f1da72 xwayland: Add -verbose option as in xfree86
Makes it easier to debug Xwayland problems.

Signed-off-by: Misha Gusarov <dottedmag@dottedmag.net>
2021-01-29 10:02:14 +00:00
Julien Cristau
0148a15da1 compiler.h: don't define inb/outb and friends on mips
The definition relies on IOPortBase, which is only ever set in
hw/xfree86/os-support/bsd/arm_video.c

This caused build failures on linux/mips with GCC 10, due to this
change (from https://gcc.gnu.org/gcc-10/changes.html#c):

"GCC now defaults to -fno-common. As a result, global variable accesses
are more efficient on various targets. In C, global variables with
multiple tentative definitions now result in linker errors. With
-fcommon such definitions are silently merged during linking."

As a result anything including compiler.h would get its own definition
of IOPortBase and the linker would error out.
2021-01-27 19:29:35 +00:00
Olivier Fourdan
9716c4193f xwayland: Add new pkg-config variable for listenfd
Since commit b3f3d65e, xwayland now supports the command line option
"-listenfd" for passing file descriptors and marked "-listen" as
deprecated for this specific purpose.

Add a new pkg-config variable "have_listenfd" to the xwayland.pc so that
compositors can know this is available and use listenfd in place of the
deprecated option.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2021-01-22 11:23:29 +01:00
Erik Kurzinger
a9269808f3 xwayland: remove unused parameter of xwl_glamor_pixmap_get_wl_buffer
There are currently no callers that make use of the "created" output parameter
of xwl_glamor_pixmap_get_wl_buffer. Remove it, along with the corresponding
argument of the associated EGL backend entrypoint.
2021-01-08 06:17:51 -08:00
Povilas Kanapickas
5322457980 xfree86/inputtest: Drop extraneous linux-specific include
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-01-06 01:48:02 +00:00
Povilas Kanapickas
5e3900904d xfree86: Use different scroll increment than libinput in inputtest drv
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2020-12-18 04:39:07 +02:00
Povilas Kanapickas
58465a3dd9 xfree86: Add scroll axes to touch devices in inputtest driver
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2020-12-17 03:11:16 +02:00
Povilas Kanapickas
91a8013990 xfree86: Add support for pressure valuator axis in inputtest driver
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2020-12-17 03:11:08 +02:00
Povilas Kanapickas
742b87f7ee xfree86: Fix axis labels for PointerAbsolute input of inputtest driver
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2020-12-17 03:10:58 +02:00
Olivier Fourdan
e4a9f0bb4e xwayland: Remove unneeded variable
Just a small code cleanup, there is no need to allocate a variable only
to check the return value of eglInitialize().

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-by: Tony Lindgren <tony@atomide.com>
2020-12-15 15:03:47 +01:00
Olivier Fourdan
95be87db98 xwayland: Refactor glamor EGL init
Glamor requires at least big GL 2.1 or GLES2, therefore Xwayland tries
to initialize first GL and then GLES2 if that fails.

It does that all in one single function which makes the code slightly
complicated, move the initialization of big-GL and GLES2 to separate
functions to help with readability of the code.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-by: Tony Lindgren <tony@atomide.com>
2020-12-15 15:03:47 +01:00
Tony Lindgren
65673b02ef xwayland: fix GL version check for GLES only devices
We currently bail out early for GLES only devices, and call
epoxy_gl_version() too early for GLES only that will make GLES only
devices return NULL for glGetString(GL_RENDERER).

Let's also add a check to see if we need to recreate the context to
avoid pointless warnings for GLES only devices as suggested by
Olivier Fourdan <ofourdan@redhat.com>.

Fixes: a506b4ec - xwayland: make context current to check GL version
Signed-off-by: Tony Lindgren <tony@atomide.com>
2020-12-14 15:57:35 +01:00
Povilas Kanapickas
8c0afc9eb2 xfree86: Implement a test input driver
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2020-12-14 01:12:10 +00:00
Olivier Fourdan
f95d81e88b xwayland: Hold window buffer until released
The window buffer mechanism would free the pixmap and its corresponding
Wayland buffer as soon as window buffers are disposed.

Typically when the X11 window is unrealized, the current window buffer
is still used by the Wayland compositor and yet Xwayland will destroy
the buffer.

As a matter of fact, Xwayland should not destroy the Wayland buffer
before the wl_buffer.release event is received.

Add a reference counter to the window buffer similar to the to pixmap
reference counter to keep the buffer around until the release callback
is received.

Increase that reference counter on the buffer which will be attached to
the surface, and drop that reference when receiving the release callback
notification.

v2: Use a specific reference counter on the buffer rather than relying
    on the pixmap refcnt (Michel Dänzer <mdaenzer@redhat.com>)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Acked-by: Martin Peres <martin.peres@mupuf.org>
2020-12-10 13:49:42 +01:00
Olivier Fourdan
85d8eac4bc xwayland: Hold cursor buffer until released
The cursor code would destroy the buffer as soon as the cursor is
unrealized on X11 side.

Yet, the Wayland compositor may still be using the buffer as long as a
released callback has not been received.

Increase the reference counter on the pixmap to hold a reference on the
pixmap when attaching it to the surface and use the new pixmap release
callback mechanism to release that reference when the buffer is
released.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Martin Peres <martin.peres@mupuf.org>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2020-12-10 13:49:42 +01:00
Olivier Fourdan
79afbd608b xwayland: Factorize common cursor code
The seat and tablet cursor functions are very similar, factorize the
commonalities to simplify the code and reduce the copy/paste.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2020-12-10 13:49:42 +01:00
Prabhu Sundararaj
36e353bcf4 Remove check for useSIGIO option
Commit 6a5a4e6037 removed the option to
configure useSIGIO option. Indeed, the xfree86 SIGIO support was
reworked to use internal versions of OsBlockSIGIO and OsReleaseSIGIO.

As a result, useSIGIO is no longer needed and can dropped

Fixes: 6a5a4e60 - Remove SIGIO support for input [v5]
Closes: xorg/xserver#1107
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@nxp.com>
Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-12-08 11:23:31 -05:00
Mariusz Ceier
95539ab37b xwayland: Replace LogMessage with LogMessageVerb
LogMessage logs only when the XLOG_VERBOSITY is >= 1, but by default
XLOG_VERBOSITY is 0, so for example warning about deprected -listen
parameter is never shown when running "Xwayland -listen 32 -help".

Signed-off-by: Mariusz Ceier <mceier+freedesktop@gmail.com>
2020-12-08 09:16:52 +00:00
Olivier Fourdan
3ce05a44f3 modesetting: Fix build with DebugPresent() enabled
By default, the macro DebugPresent() is a no-op but it can be enabled
at build time for debugging purpose.

However, doing so prevents the code to build because one debug statement
tries to make use of a non-existent variable:

  present.c: In function ‘ms_present_queue_vblank’:
  present.c:147:18: error: ‘vbl’ undeclared (first use in this function)
    147 |                  vbl.request.sequence));
        |                  ^~~
  present.c:49:32: note: in definition of macro ‘DebugPresent’
    49 | #define DebugPresent(x) ErrorF x
       |                                ^

Fix the build with DebugPresent() by removing the vbl variable from the
debug message.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2020-11-26 22:06:56 +00:00
Böszörményi Zoltán
682167475c Introduce and use BUS_USB
With !155, the device bus ID received via udev is constructed
properly with the "usb:" prefix. But, it is not enough to
make the following line to work in Section "Device":

    BusID  "usb:0:1.2:1.0"

Introduce BUS_USB, so the prefix can be distinguished from BUS_PCI
and check the supplied BusID value against device->attribs->busid
in xf86PlatformDeviceCheckBusID().

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2020-11-25 04:39:14 +00:00