Commit Graph

46 Commits

Author SHA1 Message Date
Louis-Francis Ratté-Boulianne
cef12efc15 glamor: Implement GetSupportedModifiers
Implement function added in DRI3 v1.1.

A newest version of libepoxy (>= 1.4.4) is required as earlier
versions use a problematic version of Khronos
EXT_image_dma_buf_import_modifiers spec.

v4: Only send scanout-supported modifiers if flipping is possible
v5: Fix memory corruption in XWayland (uninitialized pointer)

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-05 13:27:55 -05:00
Louis-Francis Ratté-Boulianne
c8c276c956 glamor: Implement PixmapFromBuffers and BuffersFromPixmap
It relies on GBM >= 17.1.0 where we can import BO with multiple
planes and a format modifier (GBM_BO_IMPORT_FD_MODIFIER).

v2: Properly free fds in Xwayland

[Also add glamor_egl_ext.h to Makefile.am for distcheck's sake - ajax]

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-05 13:27:49 -05:00
Olivier Fourdan
da8de2a7f6 xwayland: Add optional xdg-output support
The xdg-output protocol aims at describing outputs in way which is
more in line with the concept of an output on desktop oriented systems.

For now it just features the position and logical size which describe
the output position and size in the global compositor space.

This is however much useful for Xwayland to advertise the output size
and position to X11 clients which need this to configure their surfaces
in the global compositor space as the compositor may apply a different
scale from what is advertised by the output scaling property (to achieve
fractional scaling, for example).

This was added in wayland-protocols 1.10.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2018-01-24 11:34:59 -05:00
Carlos Garnacho
60f4646ae1 xwayland: Keep separate variables for pointer and tablet foci
The tablet/stylus interfaces reused xwl_seat->focus_window, which
would leave a somewhat inconsistent state of that variable for
wl_pointer purposes (basically, everything) if the pointer happened
to lay on the same surface than the stylus while proximity_out
happens.

We just want the stylus xwl_window to correctly determine we have
stylus focus, and to correctly translate surface-local coordinates
to root coordinates, this can be done using a different variable.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
2017-12-06 11:00:50 -05:00
Roman Gilg
82df2ce38c xwayland: Avoid repeatedly looping through window ancestor chain
Calling xwl_window_from_window means looping through the window ancestor
chain whenever it is called on a child window or on an automatically
redirected window.

Since these properties and the potential ancestor's xwl_window are constant
between window realization and unrealization, we can omit the looping by
always putting the respective xwl_window in the Window's private field on
its realization. If the Window doesn't feature an xwl_window on its own,
it's the xwl_window of its first ancestor with one.

Signed-off-by: Roman Gilg <subdiff@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-09-13 11:51:10 -04:00
Olivier Fourdan
0a448d133f xwayland: Add grab protocol support
The keyboard grabbing protocol for Xwayland is included in
wayland-protocol 1.9.

Update the wayland-protocol required version in both configure and meson
builds and add support for this new protocol in Xwayland.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-01 10:56:42 +01:00
Jason Gerecke
7c7a540f1e xwayland: Implement tablet_tool_wheel for scrolling
The 'tablet_tool_wheel' function for tablet scrolling was added back in
8a1defcc63 but left unimplemented. This commit fills in the necessary
details, using the "clicks" count as the number of discrete scroll up/down
events to send.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-12 11:46:23 +10:00
Carlos Garnacho
d5e2f271ad xwayland: Remove two unused proc pointers.
Xwayland doesn't override these, so we don't need defining those
in the xwl_screen struct.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-07 14:49:17 +10:00
Peter Hutterer
8475e6360c xwayland: add tablet pad support
Hooked up a bit differently to the other tools. Those tools can be static for
all and be re-used. The wacom driver initializes the pad with the correct
number of buttons though and we can't do this until we have the pad done event.

If the tablet is removed and we plug a different one in, we should initialize
that correctly, so unlike the other tools the pad is properly removed and
re-initialized on plug.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Ping Cheng <ping.cheng@wacom.com>
2017-04-28 11:21:25 +10:00
Carlos Garnacho
f471b5b8eb xwayland: update cursor on tablet tools in proximity
Each xwl_tablet_tool gets a xwl_cursor, as on wayland each of those
will get an independent cursor that can be set through
zwp_tablet_tool.set_cursor.

However, all tools (and the pointer) share conceptually the same VCP
on Xwayland, so have cursor changes trigger a xwl_cursor update on
every tool (and the pointer, again). Maybe Xwayland could keep track
of the most recent device and only update that cursor to get better
visual results, but this is simpler, and it's going to be odd
anyway...

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Ping Cheng <ping.cheng@wacom.com>
2017-04-28 11:21:25 +10:00
Carlos Garnacho
6d1ad39fe6 xwayland: Refactor cursor management into xwl_cursor
This struct takes away the cursor info in xwl_seat, and has
an update function so we can share the frame handling code
across several xwl_cursors.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Ping Cheng <ping.cheng@wacom.com>
2017-04-28 11:21:25 +10:00
Peter Hutterer
773b04748d xwayland: handle button events after motion events
Make sure the button events are sent after the motion events into the new
position.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Ping Cheng <ping.cheng@wacom.com>
2017-04-28 11:21:25 +10:00
Jason Gerecke
8a1defcc63 xwayland: Handle tablet_tool events
Translates Wayland tablet events into corresponding X11 tablet events. As
with the prior commit, these events are modeled after those created by the
xf86-input-wacom driver to maximize compatibility with existing applications.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Ping Cheng <ping.cheng@wacom.com>
2017-04-28 11:21:25 +10:00
Jason Gerecke
5812d1c28f xwayland: Handle wp_tablet events
Creates and maintains the canonical trio of X devices (stylus, eraser,
and cursor) to be shared by all connected tablets. A per-tablet trio
could be created instead, but there are very few benefits to such a
configuration since all tablets still ultimately share control of a
single master pointer.

The three X devices are modeled after those created by xf86-input-wacom
but use a generic maximum X and Y that should be large enough to
accurately represent values from even the largest currently-available
tablets.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Ping Cheng <ping.cheng@wacom.com>
2017-04-28 11:21:24 +10:00
Jason Gerecke
47c4415912 xwayland: Listen for wp_tablet_seat events
The wp_tablet_seat interface provides us with notifications as tablets,
tools, and pads are connected to the system. Add listener functions and
store references to the obtained devices.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Ping Cheng <ping.cheng@wacom.com>
2017-04-28 11:21:24 +10:00
Jason Gerecke
7d48b758a6 xwayland: Bind to wp_tablet_manager if available and get its seats
If we're notified about the existence of the wp_tablet_manager interface,
we bind to it so that we can make use of any tablets that are (or later
become) available. For each seat that exists or comes into existance at
a later point, obtain the associated tablet_seat.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Ping Cheng <ping.cheng@wacom.com>
2017-04-28 11:21:24 +10:00
Pekka Paalanen
9f4d308cda xwayland: use _XWAYLAND_ALLOW_COMMITS property
The X11 window manager (XWM) of a Wayland compositor can use the
_XWAYLAND_ALLOW_COMMITS property to control when Xwayland sends
wl_surface.commit requests. If the property is not set, the behaviour
remains what it was.

XWM uses the property to inhibit commits until the window is ready to be
shown. This gives XWM time to set up the window decorations and internal
state before Xwayland does the first commit. XWM can use this to ensure
the first commit carries fully drawn decorations and the window
management state is correct when the window becomes visible.

Setting the property to zero inhibits further commits, and setting it to
non-zero allows commits. Deleting the property allows commits.

When the property is changed from zero to non-zero, there will be a
commit on next block_handler() call provided that some damage has been
recorded.

Without this patch (i.e. with the old behaviour) Xwayland can and will
commit the surface very soon as the application window has been realized
and drawn into.  This races with XWM and may cause visible glitches.

v3:
- introduced a simple setter for xwl_window::allow_commits
- split xwl_window_property_allow_commits() out of
  xwl_property_callback()
- check MakeAtom(_XWAYLAND_ALLOW_COMMITS)

v2:
- use PropertyStateCallback instead of XACE, based on the patch
  "xwayland: Track per-window support for netwm frame sync" by
  Adam Jackson
- check property type is XA_CARDINAL
- drop a useless memcpy()

Weston Bug: https://phabricator.freedesktop.org/T7622
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-02-23 13:30:30 -05:00
Jonas Ådahl
a6e85e6330 xwayland: Add pointer warp emulator
Emulate pointer warps by locking the pointer and sending relative
motion events instead of absolute. X will keep track of the "fake"
pointer cursor position given the relative motion events, and the
client warping the cursor will warp the faked cursor position.

Various requirements need to be met for the pointer warp emulator to
enable:

The cursor must be invisible: since it would not be acceptable that a
fake cursor position would be different from the visual representation
of the cursor, emulation can only be done when there is no visual
representation done by the Wayland compositor. Thus, for the emulator
to enable, the cursor must be hidden, and would the cursor be displayed
while the emulator is active, the emulator would be destroyed.

The window that is warped within must be likely to have pointer focus.
For example, warping outside of the window region will be ignored.

The pointer warp emulator will disable itself once the fake cursor
position leaves the window region, or the cursor is made visible.

This makes various games depending on pointer warping (such as 3D
first-person shooters and stategy games using click-to-drag-map like
things) work.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2016-10-05 13:51:02 -04:00
Jonas Ådahl
467ab142ff xwayland: Translate a pointer grab with confineTo to pointer confinement
Translate grabbing a pointer device with confineTo set to a window into
confining the Wayland pointer using the pointer constraints protocol.
This makes clients that depend on the pointer not going outside of the
window region, such as certain games and virtual machines viewers, to
function more properly.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-10-05 13:50:54 -04:00
Jonas Ådahl
ca7b593fbe xwayland: Bind pointer constraints global
Will be used by the pointer warp emulator.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-10-05 13:50:46 -04:00
Jonas Ådahl
b4644ce8d3 xwayland: Set unaccelerated pointer motion delta if available
If there was an relative pointer motion within the same frame as an
absolute pointer motion, provide both the absolute coordinate and the
unaccelerated delta when setting the valuator mask.

If a frame contained only a relative motion, queue an absolute motion
with an unchanged position, but still pass the unaccelerated motion
event.

If the wl_seat advertised by the compositor is not new enough, assume
each relative and absolute pointer motion arrives within their own
separate frames.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-10-05 13:46:30 -04:00
Jonas Ådahl
aa9634d03b xwayland: Dispatch pointer motion events on wl_pointer.frame if possible
Wait until wl_pointer.frame with dispatching the pointer motion event,
if wl_pointer.frame is supported by the compositor. This will later be
used to combine unaccelerated motion deltas with the absolute motion
delta.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-10-05 13:46:30 -04:00
Krzysztof Sobiecki
42e8902395 xwayland: Add a new input device used for pointer warping/locking
Generating relative and absolute movement events from the same input
device is problematic, because an absolute pointer device doesn't
expect to see any relative motion events. To be able to generate
relative pointer motion events including unaccelerated deltas, create a
secondary pointer device 'xwayland-relative-pointer', and use that for
emitting relative motion events.

Signed-off-by: Krzysztof Sobiecki <sobkas@gmail.com>
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2016-10-05 13:46:30 -04:00
Jonas Ådahl
9037ba736a xwayland: Bind the relative pointer manager
Will be used for getting unaccelerated motion events and later for
relative motions used by a pointer warp emulator.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-10-05 13:46:29 -04:00
Olivier Fourdan
b79eaf1184 xwayland: handle EAGAIN on Wayland fd
wl_display_flush() can fail with EAGAIN and Xwayland would make this a
fatal error.

When this happens, it means that Xwayland has flooded the Wayland file
descriptor, either because the Wayland compositor cannot cope or more
likely because of a deadlock situation where the Wayland compositor is
blocking, waiting for an X reply while Xwayland tries to write data to
the Wayland file descriptor.

The general consensus to avoid the deadlock is for the Wayland
compositor to never issue blocking X11 roundtrips, but in practice
blocking rountrips can occur in various places, including Xlib calls
themselves so this is not always achievable without major surgery in the
Wayland compositor/Window manager.

What this patch does is to avoid dispatching to the Wayland file
descriptor until it becomes available for writing again, while at the
same time continue processing X11 requests to release the deadlock.

This is not perfect, as there is still the possibility of another X
client hammering the connection and we'll still fail writing to the
Wayland connection eventually, but this improves things enough to avoid
a 100% repeatable crash with vlc and gtkperf.

Also, it is worth considering that window managers and Wayland
compositors such as mutter already have a higher priority than other
regular X clients thanks to XSyncSetPriority(), mitigating the risk.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1278159
Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=763400
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-09-28 14:23:59 -04:00
Olivier Fourdan
6e5bec261c wayland: Emulate crossing for native window
Emitting a LeaveNotify event every time the pointer leaves an X11 window
may confuse focus follow mouse mode in window managers such as
mutter/gnome-shell.

Keep the previously found X window and compare against the new one, and
if they match then it means the pointer has left an Xwayland window for
a native Wayland surface, only in this case fake the crossing to the
root window.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-19 11:04:25 +10:00
Olivier Fourdan
4cbf1fb1f9 xwayland: Avoid double free of RRCrtc and RROutput
At shutdown, the Xserver will free all its resources which includes the
RRCrtc and RROutput created.

Xwayland would do the same in its xwl_output_destroy() called from
xwl_close_screen(), leading to a double free of existing RRCrtc
RROutput:

 Invalid read of size 4
    at 0x4CDA10: RRCrtcDestroy (rrcrtc.c:689)
    by 0x426E75: xwl_output_destroy (xwayland-output.c:301)
    by 0x424144: xwl_close_screen (xwayland.c:117)
    by 0x460E17: CursorCloseScreen (cursor.c:187)
    by 0x4EB5A3: AnimCurCloseScreen (animcur.c:106)
    by 0x4EF431: present_close_screen (present_screen.c:64)
    by 0x556D40: dix_main (main.c:354)
    by 0x6F0D290: (below main) (in /usr/lib/libc-2.24.so)
  Address 0xbb1fc30 is 0 bytes inside a block of size 728 free'd
    at 0x4C2BDB0: free (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x4CCE5F: RRCrtcDestroyResource (rrcrtc.c:719)
    by 0x577541: doFreeResource (resource.c:895)
    by 0x5787B5: FreeClientResources (resource.c:1161)
    by 0x578862: FreeAllResources (resource.c:1176)
    by 0x556C54: dix_main (main.c:323)
    by 0x6F0D290: (below main) (in /usr/lib/libc-2.24.so)
  Block was alloc'd at
    at 0x4C2CA6A: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x4CC6DB: RRCrtcCreate (rrcrtc.c:76)
    by 0x426D1C: xwl_output_create (xwayland-output.c:264)
    by 0x4232EC: registry_global (xwayland.c:431)
    by 0x76CB1C7: ffi_call_unix64 (in /usr/lib/libffi.so.6.0.4)
    by 0x76CAC29: ffi_call (in /usr/lib/libffi.so.6.0.4)
    by 0x556CEFD: wl_closure_invoke (connection.c:935)
    by 0x5569CBF: dispatch_event.isra.4 (wayland-client.c:1310)
    by 0x556AF13: dispatch_queue (wayland-client.c:1456)
    by 0x556AF13: wl_display_dispatch_queue_pending
(wayland-client.c:1698)
    by 0x556B33A: wl_display_roundtrip_queue (wayland-client.c:1121)
    by 0x42371C: xwl_screen_init (xwayland.c:631)
    by 0x552F60: AddScreen (dispatch.c:3864)

And:

 Invalid read of size 4
    at 0x522890: RROutputDestroy (rroutput.c:348)
    by 0x42684E: xwl_output_destroy (xwayland-output.c:302)
    by 0x423CF4: xwl_close_screen (xwayland.c:118)
    by 0x4B6377: CursorCloseScreen (cursor.c:187)
    by 0x539503: AnimCurCloseScreen (animcur.c:106)
    by 0x53D081: present_close_screen (present_screen.c:64)
    by 0x43DBF0: dix_main (main.c:354)
    by 0x7068730: (below main) (libc-start.c:289)
  Address 0xc403190 is 0 bytes inside a block of size 154 free'd
    at 0x4C2CD5A: free (vg_replace_malloc.c:530)
    by 0x521DF3: RROutputDestroyResource (rroutput.c:389)
    by 0x45DA61: doFreeResource (resource.c:895)
    by 0x45ECFD: FreeClientResources (resource.c:1161)
    by 0x45EDC2: FreeAllResources (resource.c:1176)
    by 0x43DB04: dix_main (main.c:323)
    by 0x7068730: (below main) (libc-start.c:289)
  Block was alloc'd at
    at 0x4C2BBAD: malloc (vg_replace_malloc.c:299)
    by 0x52206B: RROutputCreate (rroutput.c:84)
    by 0x426763: xwl_output_create (xwayland-output.c:270)
    by 0x422EDC: registry_global (xwayland.c:432)
    by 0x740FC57: ffi_call_unix64 (unix64.S:76)
    by 0x740F6B9: ffi_call (ffi64.c:525)
    by 0x5495A9D: wl_closure_invoke (connection.c:949)
    by 0x549283F: dispatch_event.isra.4 (wayland-client.c:1274)
    by 0x5493A13: dispatch_queue (wayland-client.c:1420)
    by 0x5493A13: wl_display_dispatch_queue_pending
(wayland-client.c:1662)
    by 0x5493D2E: wl_display_roundtrip_queue (wayland-client.c:1085)
    by 0x4232EC: xwl_screen_init (xwayland.c:632)
    by 0x439F50: AddScreen (dispatch.c:3864)

Split xwl_output_destroy() into xwl_output_destroy() which frees the
wl_output and the xwl_output structure, and xwl_output_remove() which
does the RRCrtcDestroy() and RROutputDestroy() and call the latter only
when an output is effectively removed.

An additional benefit, on top of avoiding a double free, is to avoid
updating the screen size at shutdown.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-08-15 14:20:54 -04:00
Rui Matos
cf6730c503 xwayland: Update RR state on wl_output.done instead of wl_output.mode
Otherwise if the geometry changes but the mode doesn't we end up with
the previous geometry from RR's point of view.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=768710

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Rui Matos <tiagomatos@gmail.com>
2016-07-15 10:03:16 -04:00
Olivier Fourdan
7397a2191f xwayland-input: Fake crossing to rootwin
This partially reverts commit c1565f3.

When the pointer moves from an X11 window to a Wayland native window,
no LeaveNotify event is emitted which can lead to various unexpected
behaviors like tooltips remaining visible after the pointer has left the
window.

Yet the pointer_handle_leave() is called and so is the DIX CheckMotion()
but since the pointer enters a Wayland native window with no other
Xwayland window matching, DoEnterLeaveEvents() does not get invoked and
therefore no LeaveNotify event is sent to the X11 client at the time the
pointer leaves the window for a Wayland native surface.

Restore the XYToWindow() handler in xwayland-input that was previously
removed with commit c1565f3 and use that handler to pretend that the
pointer entered the root window in this case so that the LeaveNotify
event is emitted.

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

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-06-23 16:00:30 +10:00
Olivier Fourdan
4653793de3 wayland: Remove unused field in xwl_screen
Can't find any reference of pointer_limbo_window in the code, let's
remove it.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-06-08 13:11:45 -04:00
Olivier Fourdan
88e981e708 xwayland: sync event queue to check compositor reply
Read and dispatch pending Wayland events to make sure we do not miss a
possible reply from the compositor prior to discard a key repeat.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-06-03 09:44:09 +02:00
Olivier Fourdan
239705a6fe xwayland: add a server sync before repeating keys
Key repeat is handled by the X server, but input events need to be
processed and forwarded by the Wayland compositor first.

Make sure the Wayland compositor is actually processing events, to
avoid repeating keys in Xwayland while the Wayland compositor cannot
deal with input events for whatever reason, thus not dispatching key
release events, leading to repeated keys while the user has already
released the key.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=762618
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-06-03 09:42:56 +02:00
Olivier Fourdan
da7724d3d2 xwayland: add glamor Xv adaptor
This adds an Xv adaptor using glamor.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-03-09 14:03:03 -05:00
Olivier Fourdan
6070a749d9 xwayland: add partial xvidmode extension support
Older games (mostly those based on SDL 1.x) rely on the XVidMode
extension and would refuse to run without.

Add a simple, limited and read-only xvidmode support that reports the
current mode used so that games that rely on xvidmode extension can run
on XWayland.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87806
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-02-29 16:29:17 -05:00
Daniel Stone
e957a2e5dd dix: Add hybrid full-size/empty-clip mode to SetRootClip
216bdbc735 removed the SetRootClip call in the XWayland output-hotplug
handler when running rootless (e.g. as a part of Weston/Mutter), since
the root window has no storage, so generating exposures will result in
writes to invalid memory.

Unfortunately, preventing the segfault also breaks sprite confinement.
SetRootClip updates winSize and borderSize for the root window, which
when combined with RRScreenSizeChanged calling ScreenRestructured,
generates a new sprite-confinment area to update it to the whole screen.

Removing this call results in the window geometry being reported
correctly, but winSize/borderSize never changing from their values at
startup, i.e. out of sync with the root window geometry / screen
information in the connection info / XRandR.

This patch introduces a hybrid mode, where we update winSize and
borderSize for the root window, enabling sprite confinement to work
correctly, but keep the clip emptied so exposures are never generated.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-02-22 13:26:31 -05:00
Dima Ryazanov
550984c95e xwayland: Destroy xwl_output when wl_output gets removed
This makes Xwayland correctly handle a monitor getting unplugged.

[Marek]: use xorg_list_for_each_entry_safe

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
2015-09-25 15:22:18 +02:00
Carlos Garnacho
44f250a7e8 xwayland: Remove related touchpoints when unrealizing windows
These sequences are forgotten to all purposes.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
2015-09-18 14:55:00 +02:00
Carlos Garnacho
b7cd48f71d xwayland: Implement the wl_touch interface
A DeviceIntPtr with touch valuators is also created in order to deliver
the translated touch events. The lifetime of xwl_touch structs is tied
to the wayland ones, finishing in either wl_touch.up() or wl_touch.cancel()

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
2015-09-18 14:55:00 +02:00
Carlos Garnacho
d96eccc057 xwayland: Add xwl_touch struct
This struct holds information about each individual, ongoing touchpoint.
A list of these is held by the xwl_seat.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
2015-09-18 14:55:00 +02:00
Jasper St. Pierre
c1565f3ca6 xwayland-input: Remove our XYToWindow handler
This was built as a hack for simple Wayland compositors like Weston
which were lazy and didn't want to configure windows server-side when
moved.

Since comboboxes and menus are separate toplevel O-R windows, this hack
breaks input as it needs to be traced normally, not simply sent to the
focused window.

X11 toolkits really do need their windows to be configured correctly
for their O-R windows comboboxes or menus other things, so let's fix
the lazy compositors and remove this.

I have tested this patch with both Weston and Mutter and neither of
them require any changes, and it fixes comboboxes and menus.

If somebody then wants to revert 73698d4, that's fine by me, so we
reduce the amount of API that DDXen have.

Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-09-18 14:55:00 +02:00
Rui Matos
cbb7eb73b5 xwayland: Throttle our cursor surface updates with a frame callback
In some extreme cases with animated cursors at a high frame rate we
could end up filling the wl_display outgoing buffer and end up with
wl_display_flush() failing.

In any case, using the frame callback to throttle ourselves is the
right thing to do.

Signed-off-by: Rui Matos <tiagomatos@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-05-27 08:21:00 -07:00
Dima Ryazanov
81a51a6cac xwayland: Implement smooth scrolling
We don't even need to simulate button clicks; it's done automatically.
This also fixes scrolling in Qt5 apps.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-05-11 15:45:26 -07:00
Jasper St. Pierre
5ecc0315a2 xwayland: Implement throttling for surfaces based on the frame event
This implements simple throttling that keeps us to one attach per
frame. There isn't really an active performance benefit, since the
buffers will be redrawn only once per frame anyway, but it does cut down
on the chatty network traffic. Since the Wayland sockets might fill
up as well, the cut down on the volume of data we send out also provides
us with a big stability benefit.

Namely, mutter is a lot more stable running gtkperf, a fairly intensive
X11 application, after this change.

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net>
2014-09-11 23:40:27 -06:00
Keith Packard
90803042bc Fix files including xorg-server.h by mistake
A few files in the server are including xorg-server.h, which is only
for use by Xorg server drivers. This fixes those errors and then adds
a check to make sure it doesn't happen again.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-07-30 12:17:27 -07:00
Kristian Høgsberg
2f113d68f6 xwayland: Add glamor and DRI3 support
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-06-24 15:09:55 -07:00
Kristian Høgsberg
6e539d8817 Xwayland DDX
Started out as an Xorg module to be used from Xorg drivers to let
Xorg run under a wayland server.  The idea was to be able to reuse the
2D acceleration from the Xorg driver.  Now with glamor being credible,
a better plan is to just make Xwayland its own DDX, similar to Xwin
and Xquartz.  This is a much better fit, as much of the code in the
original approach had to hack around Xorg doing Xorg things like take
over the VT, probe input devices and read config files.  Another big win
is that Xwayland dosn't need to be setuid root.

The Xwayland support for DRI3, Glamor and render nodes was done by
Axel Davy <axel.davy@ens.fr>, who also did a lot of work on the rebase
to the Xwayland DDX.

Contributions from:

  Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
  Corentin Chary <corentin.chary@gmail.com>
  Daniel Stone <daniel@fooishbar.org>
  Kristian Høgsberg <krh@bitplanet.net>
  Robert Bragg <robert@linux.intel.com>
  Scott Moreau <oreaus@gmail.com>
  Tiago Vignatti <tiago.vignatti@intel.com>
  Giovanni Campagna <gcampagn@redhat.com>
  Jonas Ådahl <jadahl@gmail.com>
  Ray Strode <rstrode@redhat.com>
  Trevor McCort <tjmccort@gmail.com>
  Rui Matos <tiagomatos@gmail.com>
  Axel Davy <axel.davy@ens.fr>
  Jasper St. Pierre <jstpierre@mecheye.net>

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
2014-04-03 15:19:22 -07:00