Commit Graph

17684 Commits

Author SHA1 Message Date
Jeremy Huddleston Sequoia fba421f700 xquartz: Minor code modernization -- @autoreleasepool adoption
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-18 22:32:14 -08:00
Jeremy Huddleston Sequoia 318f8a4a8a xquartz: Remove some dead code for compatibility with older nibs
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-18 22:32:14 -08:00
Jeremy Huddleston Sequoia 72a39dccf9 xquartz: Remove a workaround for AppKit versions older than Lion
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-18 22:32:14 -08:00
Jeremy Huddleston Sequoia 7e28750358 xquartz: Fix applications menu table background color for dark mode
Fixes: https://github.com/XQuartz/XQuartz/issues/32
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-17 16:24:08 -08:00
Jeremy Huddleston Sequoia 85beee9885 xquartz: Apply Xcode 12.4 automatic updates to nibs
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-17 16:24:06 -08:00
Jeremy Huddleston Sequoia 4e892aa6e1 xquartz: Update the about box copyright to 2021
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-17 13:38:31 -08:00
Jeremy Huddleston Sequoia c9a3b14c14 xquartz: Ensure we call into TIS on the main thread
There is a place where this code was called on the main thread.

We're using a rather nasty anti-pattern to just call a block inline rather
than synchonously calling it on the main thread if we're already on the main
thread.  This code could use a good overhaul, but I don't have time to rip
it apart right now.  This will address the immediate issue.

Fixes: https://github.com/XQuartz/XQuartz/issues/40
Fixes: https://github.com/XQuartz/XQuartz/issues/48
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2021-02-17 09:53:33 -08:00
Povilas Kanapickas af17b5c499 dix: Use correct listener to deliver touch end events
This fixes an problem left in f682e0563f
due to an incorrect cherry-pick.

We must use old listener->listener to deliver the touch event. Otherwise
grab won't let the event through and the abovementioned commit has no
effect.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-02-17 04:29:48 +00:00
Peter Hutterer 20c78f38a0 xwayland: use get_pointer_device() for enter/leave handling too
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.

Fixes a regression introduced in a4095162ca.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
2021-02-17 14:18:02 +10:00
Olivier Fourdan dee2bb033e dix: Guard against non-existing PtrFeedbackPtr
Trying to change the pointer control settings on a device without
PtrFeedbackPtr would be a bug and a crash in the Xserver.

Guard against that case by returning early with a BadImplementation
error, that might kill the X11 client but the Xserver would survive.

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/1137
2021-02-16 09:37:46 +01:00
Olivier Fourdan ab76272a7d 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
2021-02-16 09:37:46 +01:00
Olivier Fourdan a4095162ca xwayland: Use relative device for buttons/axis
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.

Route those 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>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Related: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1130
2021-02-15 09:42:00 +01:00
Olivier Fourdan 1abab61dc2 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
2021-02-15 09:42:00 +01:00
Olivier Fourdan 7181792824 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>
2021-02-15 09:42:00 +01:00
Olivier Fourdan c5c5322ad6 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
2021-02-15 09:42:00 +01:00
Olivier Fourdan ebdb2e2646 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
2021-02-15 09:42:00 +01:00
Olivier Fourdan b5e1f13681 dix: Add POINTER_RAWONLY flag
This add a new flag POINTER_RAWONLY for GetPointerEvents() which does
pretty much the opposite of POINTER_NORAW.

Basically, this tells GetPointerEvents() that we only want the
DeviceChanged events and any raw events for this motion but no actual
motion events.

This is preliminary work for Xwayland to be able to use relative motion
events for raw events. Xwayland would use absolute events for raw
events, but some X11 clients (wrongly) assume raw events to be always
relative.

To allow such clients to work with Xwayland, it needs to switch to
relative raw events (if those are available from the Wayland
compositor).

However, Xwayland cannot use relative motion events for actual pointer
location because that would cause a drift over time, the pointer being
actually controlled by the Wayland compositor.

So Xwayland needs to be able to send only relative raw events, hence
this API.

Bump the ABI_XINPUT_VERSION minor version to reflect that API addition.

v2: Actually avoid sending motion events (Peter)
v3: Keep sending raw emulated events with 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>
Related: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1130
2021-02-15 09:42:00 +01:00
Povilas Kanapickas 213129012b Xi: Deliver pointer emulated touch events to grabbing client
Delivery of emulated events usually happens only to the owning client.
If there are grabs, only the grabbing client may receive these events.

This logic does not work during the touch event replay in
DeactivatePointerGrab(), as the previous grab is no longer in the
listener queue of the touch, so the next owner gets whole emulated event
sequence. This may trigger implicit grabs. After replay,
DeactivatePointerGrab() will update the global grab without regard to
this new implicit grab, which leads to issues down the line.

This change is effectively the same as 35e5a76cc1 except that the change
is limited to only emulated pointer events. Otherwise, in the case of a
device grab we end up not sending any touch events to clients that
selected XI_TouchOwnership event and should get touch events before they
get ownership of touch sequence.

Fixes #7

https://bugs.freedesktop.org/show_bug.cgi?id=96536
2021-02-15 04:40:16 +00:00
Povilas Kanapickas 30e11535af Revert "Xi: Use current device active grab to deliver touch events if any"
This reverts commit 98e3db2ac4.
2021-02-15 04:40:16 +00:00
Povilas Kanapickas f682e0563f dix: Send touch end to clients that do async grab without touch events
If a XI2 client started listening to touches due to a selection and then
creates an active async grab that does not include touch events, then it
currently won't get the touch end event which will produce inconsistent
view of the pending touches.

Note that we only need to consider touch listeners and can ignore
pointer emulation. Under XI2 if a active grab replaces a passive
implicit grab and the active grab does not include the button release
event, the client won't get it either.
2021-02-08 05:21:29 +02: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 20b86c4060 os: 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 5429791b1c Revert "mi: Shortcut miDoCopy/miCopyArea based on clipList"
This reverts commit f665a9c9e6.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Martin Peres <martin.peres@mupuf.org>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1108
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1128
2021-01-29 13:51:06 +00: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
Olivier Fourdan a81c98e42a mi: Don't log the full extension list on disable
When enabling or disabling an extension which is not known to the
Xserver, it will log an error message and list the extensions it knows
about.

That clutters the logs when the Xserver is Xwayland spawned by the
Wayland compositor who doesn't actually know the list of extensions
enabled at build time in the Xserver.

Considering that disabling a non-existing extension is a no-op anyway,
list all the extensions available only when attempting to enable an
extension which the Xserver doesn't know about.

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
Michel Dänzer f08ab719df ci: Test ninja dist in meson jobs
While this isn't critical yet, it might become so at some point, so
let's make sure it keeps working.

Don't set the PIGLIT/XTEST_DIR variables for ninja dist, testing XTS
once against each DDX is enough (as part of ninja test).

Requires git in the docker image.

v2:
* Drop /usr/local/bin/xkbcomp symlink, no longer needed with xkbcomp
  1.4.1 (Peter Hutterer)
2021-01-22 17:03:16 +00:00
Michel Dänzer 099eb6261c ci: Build xkbcomp 1.4.1 for the docker image
This is a requirement for testing meson dist in CI.
2021-01-22 17:03:16 +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 3ab3083cc2 xi: Don't deliver emulated motion when there's no owner for touch end
Pointer-emulated touch events should only be delivered to the client
that owns the sequence even if it's a core client that became the
effective owner of the sequency by selecting for pointer press and
movement.

Currently the emulated events are delivered like this already (see
TouchResourceIsOwner() check in DeliverEmulatedMotionEvent()), except in
the case of TouchEnd, in which case the generated motion event is still
delivered to some client that's not necessarily the owner of the touch
sequence.

We already know whether a touch sequence that is about to emulate a
pointer event has an owner, we just need to check that. This further
allows to simplify DeliverEmulatedMotionEvent() as it won't ever be
called for non-owned touch events.

https://bugs.freedesktop.org/show_bug.cgi?id=60394

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-01-05 02:40:52 +00:00
Adam Jackson 365cbbfc4b os, shm: fcntl()'s third argument is integer, not pointer
All of these uses were attempting to set FD_CLOEXEC, which happens to be
(1<<0). Since flags is going to be aligned in memory, its address is
never going to have the low bit set, so we were never actually setting
what we meant to.

Fixes: xorg/xserver#1114
2020-12-18 09:36:30 -05: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