Commit Graph

272 Commits

Author SHA1 Message Date
emersion f001f98cef
gtk-primary-selection: refactor everything, untie from seat
This commits completely refactors wlr_gtk_primary_selection. The goal is to
remove gtk-primary-selection state from the seat and better handle inert
resources where it makes sense.

wlr_seat_client.primary_selection_devices has been removed and replaced by
wlr_gtk_primary_selection_device. This allows us to make offers inert when the
current selection is replaced.

wlr_seat_set_primary_selection has been removed because it relied on wlr_seat
instead of wlr_gtk_primary_selection_device_manager. A new function,
wlr_gtk_primary_selection_device_manager_set_selection (candidate for the
longest function name in wlroots) has been added. It doesn't take a serial
anymore as serial checking only makes sense for set_selection requests coming
from Wayland clients (serial checking is now done in the Wayland interface
implementation).

Since wlr_gtk_primary_selection_device_manager is now required to set the
selection, a new function wlr_xwayland_set_gtk_primary_selection_device_manager
(candidate number two for longest function name) has been added.

Devices are now made inert when the seat goes away.

Future work includes removing the last primary selection bits from the seat,
mainly wlr_seat.primary_selection_source and wlr_seat.events.primary_selection,
replacing those with new fields in wlr_gtk_primary_selection_device. Or maybe
we could keep those in the seat and replace them with a re-usable interface
(for future zwp_primary_selection_v1 support). We need to think how we'll sync
these three protocols (GTK, X11 and wayland-protocols).

See https://github.com/swaywm/wlroots/issues/1388
2018-11-27 18:57:26 +01:00
emersion 811a4d997b
Rename wlr_primary_selection to wlr_gtk_primary_selection 2018-11-23 11:58:56 +01:00
emersion 51bfdd620e
Use #if instead of #ifdef for wlroots config data
This prevents some annoying issues when e.g. not including wlr/config.h or
making a typo in the guard name.
2018-11-12 10:12:46 +01:00
emersion 2d0c5ec78e
Use _POSIX_C_SOURCE, use shm_open 2018-11-06 08:29:23 +01:00
emersion 54e78e9e26
xwayland: don't fail if XDG_RUNTIME_DIR is not set
We don't require it, Xwayland doesn't require it, and all X11 apps I tried
don't need it.
2018-10-28 22:39:57 +01:00
emersion f745befc06
xwayland: fix typo to enable transparency
We spent literally hours trying to debug this. Turns out it's a typo.

Kill me.
2018-10-27 11:59:27 +02:00
Ryan Dwyer bc52de031e xwm: Unset min/max size hints if they're not used 2018-10-22 21:49:17 +10:00
Ryan Dwyer 5c5296c912 xwm: Remove child->parent pointer when parent destroys 2018-10-19 23:03:58 +10:00
emersion 9a2fb6f568
xwayland: handle configure event mask 2018-10-18 14:31:08 +02:00
Wolf480pl 3512db3ded xwayland/xwm: make hints->input default to true
An X11 client can leave the hints->input WM hint unspecified,
by not setting the XCB_ICCCM_WM_HINT_INPUT flag in hints->flags.
In that case, we should assume a sane default.

Make the hint default to true, so that clients which do not specify
the hint, like mupdf, still get keyboard focus.

This should fix swaywm/sway#2231
2018-10-13 00:20:22 +02:00
Arkadiusz Hiler ae7c3f3d1c xwayland/xwm: Stop including xcb_image.h
It's not used (XCB_IMAGE_FORMAT_Z_PIXMAP comes from xproto.h) and we
don't even have a pkg-config dependency on xcb-image, making the build
to fail on that inclusion on systems without the package.
2018-09-28 11:47:50 +03:00
Ryan Dwyer 44613c0fa6 xwayland: Introduce set_decorations event 2018-09-24 20:14:02 +10:00
nyorain 195103700c Fix wlr_xwayland_destroy 2018-09-08 13:00:56 +02:00
Drew DeVault 73423c988c
Merge pull request #1213 from arandomhuman/wlr_log_get_verbosity
Add wlr_log_get_verbosity method
2018-09-03 11:15:12 -04:00
random human 93382dc445
Close stdout/stderr for Xwayland
Depending on the log verbosity, close the stdout/stderr streams.
2018-09-03 17:33:48 +05:30
Ryan Dwyer b8cc4a4152 xwayland: Introduce set_role event 2018-09-03 17:07:14 +10:00
Ryan Dwyer 60a174eb11 xwayland: Introduce request_activate event 2018-09-02 08:50:17 +02:00
Ryan Dwyer 69a5279f79 xwayland: Add WM_STATE modal property
Adds a modal property to indicate whether the surface wants to be a
modal.
2018-09-02 08:50:04 +02:00
Scott Anderson fd3fa760d3 Revert "Revert "Merge pull request #1194 from ascent12/meson_feature""
This reverts commit 9c886f20b9.
2018-08-24 19:35:02 +12:00
Drew DeVault 9c886f20b9 Revert "Merge pull request #1194 from ascent12/meson_feature"
This breaks wlroots when used as a meson subproject.

This reverts commit dea311992e, reversing
changes made to 6db9c4b746.
2018-08-23 21:00:58 -04:00
Scott Anderson 51892e0d74 Install headers explicitly 2018-08-22 21:16:16 +12:00
Scott Anderson 784c20c82f Use new options for X11 backend and Xwayland 2018-08-22 20:27:37 +12:00
Markus Ongyerth 81cc842f8f reintroduce xwayland is_unmanaged
153f37bdf5 (#1145) removed the
wlr_xwayland_is_unamanged function while fixing OR, because it was
belieived that it's supposed to work around the broken OR handling.

This was a misunderstanding. is_unmanaged is (while sort of a hack)
intended to work around inherent differences between "real" X sessions
and our Xwayland/wayland situation.

The main reason it exists is to support applications like rofi and dzen,
while not handing focus to other OR windows (which should *not* be
required).
Traditionally, these applications just grabbed input from X and didn't
need to be focused by any logic in the WM. Which of course doesn't work
in wayland compositors. So we have to give them focus in some way.
Giving *every* OR window focus, breaks other applications that don't
expect focus to change.

A testcase that was pointed out to me where wlr_xwayland_is_unamanged was
breaking things is https://github.com/swaywm/sway/issues/2128 (syncplay,
gitk, gitgui)
Supposedly it broke using keyboard to navigate the menus.
I can't reproduce this with this patch. The popups can be navigated as
long as the parent has focus.
2018-07-29 14:43:17 +02:00
Drew DeVault f1b65b34a6
Merge pull request #1127 from emersion/surface-precommit
surface: add wlr_surface_role.precommit
2018-07-27 13:21:03 -04:00
Drew DeVault 4b096fc114 Revert "Merge pull request #1153 from emersion/include-config"
This reverts commit ef0a6ea4d2, reversing
changes made to 8d03bc9178.
2018-07-21 09:44:20 -04:00
emersion 41094a7df5 Always include config.h 2018-07-21 13:08:23 +01:00
Ryan Dwyer dc58c1356d Introduce set_hints event for xwayland 2018-07-19 21:07:11 +10:00
emersion 5dca4741df xwayland: make xwm_surface_activate static 2018-07-18 19:59:58 +01:00
emersion 153f37bdf5 xwayland: handle override_redirect flag changes
The override_redirect flag can change on configure notify and
on map notify. This adds an event to know when it changes.

This removes wlr_xwayland_surface_is_unmanaged which was wrongly
using the window type to decide whether the view should be
unmanaged.

A similar patch was proposed to Weston, but has never been
merged upstream [1].

[1]: https://patchwork.freedesktop.org/patch/211161/
2018-07-18 18:51:03 +01:00
emersion 16d7e09d99 surface: add wlr_surface_role.precommit
This allows to emit the unmap event before the surface becomes
actually unmapped for most shells.
2018-07-15 19:30:19 +01:00
Drew DeVault e226e2c011 Missed some old wlr_log calls 2018-07-11 18:36:31 -04:00
Drew DeVault c0b4217fce
Merge pull request #1116 from emersion/surface-role
surface: replace wlr_surface_set_role_committed with wlr_surface_role
2018-07-11 15:27:42 -07:00
emersion 7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
emersion 33db4263a0
surface: replace wlr_surface_set_role_committed with wlr_surface_role 2018-07-07 22:45:16 +01:00
Armin Preiml 26b2012b5e fix style issue 2018-07-03 15:11:02 +02:00
Armin Preiml e6d613ca2e fix: add stack update on focus change
Enable the stack update again for focus changes on non-focusable views.
2018-07-03 15:03:00 +02:00
Armin Preiml f93234d6f5 fix: tabs instead of spaces 2018-06-29 19:25:20 +02:00
Armin Preiml d0b3aed584 do not send focus request to a window that doesn't allow this 2018-06-29 17:58:47 +02:00
Dominique Martinet 4a1c9a1925 xwm: fix use-after-free involving parents/children
Happens when e.g. closing gimp.

==24039==ERROR: AddressSanitizer: heap-use-after-free on address 0x6150001a7a78 at pc 0x7f09b09f1bb2 bp 0x7ffcf0237bf0 sp 0x7ffcf0237be0
WRITE of size 8 at 0x6150001a7a78 thread T0
    #0 0x7f09b09f1bb1 in wl_list_remove ../util/signal.c:55
    #1 0x7f09b094cf03 in xwayland_surface_destroy ../xwayland/xwm.c:295
    #2 0x7f09b0950245 in xwm_handle_destroy_notify ../xwayland/xwm.c:717
    #3 0x7f09b095304a in x11_event_handler ../xwayland/xwm.c:1149
    #4 0x7f09b0c68f01 in wl_event_loop_dispatch src/event-loop.c:641
    #5 0x7f09b0c67601 in wl_display_run src/wayland-server.c:1260
    #6 0x40a2f4 in main ../sway/main.c:433
    #7 0x7f09b011018a in __libc_start_main (/lib64/libc.so.6+0x2318a)
    #8 0x40b749 in _start (/opt/wayland/bin/sway+0x40b749)

0x6150001a7a78 is located 120 bytes inside of 496-byte region [0x6150001a7a00,0x6150001a7bf0)
freed by thread T0 here:
    #0 0x7f09b2b58880 in __interceptor_free (/lib64/libasan.so.5+0xee880)
    #1 0x7f09b094d1a1 in xwayland_surface_destroy ../xwayland/xwm.c:315
    #2 0x7f09b0950245 in xwm_handle_destroy_notify ../xwayland/xwm.c:717
    #3 0x7f09b095304a in x11_event_handler ../xwayland/xwm.c:1149
    #4 0x7f09b0c68f01 in wl_event_loop_dispatch src/event-loop.c:641
    #5 0x7f09b0c67601 in wl_display_run src/wayland-server.c:1260
    #6 0x40a2f4 in main ../sway/main.c:433
    #7 0x7f09b011018a in __libc_start_main (/lib64/libc.so.6+0x2318a)
    #8 0x40b749 in _start (/opt/wayland/bin/sway+0x40b749)

previously allocated by thread T0 here:
    #0 0x7f09b2b58e50 in calloc (/lib64/libasan.so.5+0xeee50)
    #1 0x7f09b094b585 in xwayland_surface_create ../xwayland/xwm.c:119
    #2 0x7f09b0950151 in xwm_handle_create_notify ../xwayland/xwm.c:706
    #3 0x7f09b0953032 in x11_event_handler ../xwayland/xwm.c:1146
    #4 0x7f09b0c68f01 in wl_event_loop_dispatch src/event-loop.c:641
    #5 0x7f09b0c67601 in wl_display_run src/wayland-server.c:1260
    #6 0x40a2f4 in main ../sway/main.c:433
    #7 0x7f09b011018a in __libc_start_main (/lib64/libc.so.6+0x2318a)
    #8 0x40b749 in _start (/opt/wayland/bin/sway+0x40b749)
2018-06-25 17:28:44 +09:00
Ilia Bozhinov 5dd1a838f3 xwm: set the proper event mask in client messages
Fixes #927
2018-05-26 10:08:20 +03:00
Scott Anderson 1a3921d4d4 Remove unused argument 2018-05-19 23:39:51 +12:00
Vincent Vanlaer 72a75b3a72 Fix Xwayland cleanup
Fixes #964
2018-05-10 01:44:17 +02:00
emersion 8e831cd416
Merge pull request #959 from VincentVanlaer/xwayland-lazy
Add the option to start Xwayland only when a client connects
2018-05-08 23:04:26 +01:00
Vincent Vanlaer 119a6cf35c Make xwayland_finish* clean up wlr_xwayland 2018-05-08 22:22:35 +02:00
Vincent Vanlaer 80586b8f6b Clean up events 2018-05-07 00:48:02 +02:00
Vincent Vanlaer 446ea3a340 Add beter handling for Xwayland failing at startup 2018-05-07 00:43:26 +02:00
Vincent Vanlaer c80bf1591e Allow xwayland to start lazily
Makes the xwayland startup process two phased.
The first phase just initialises the X11 sockets.
The second phase starts the Xwayland server itself.
When starting xwayland lazily the second phase will be postponed until
a client has connected to the X11 socket.

Changes in behaviour:
The DISPLAY environment is now set immediately after the X11 sockets
are created.
When the Xwayland server is killed or crashes, the sockets will not be
recreated, but reused.

Fixes #849: Start up Xwayland lazily
2018-05-06 23:41:25 +02:00
emersion cf10cbc00c
Use UTF-8 xwayland window title if available 2018-05-04 20:44:00 +01:00
emersion 001045e47a
xwayland: make utility windows unmanaged again
7f70d244a9 made utility windows
managed, because it made sense according to the spec. Turns out
Firefox uses them for popups.
2018-04-27 10:44:20 +01:00
Drew DeVault 04af09862a
Merge pull request #918 from emersion/xwayland-unmapped-request-configure
xwayland: forward configure events to compositor when unmapped
2018-04-27 10:49:31 +02:00