Commit graph

1200 commits

Author SHA1 Message Date
emersion
31cc2fa4f9 pointer-constraints: make region not a pointer, add committed bitfield 2018-09-26 23:08:52 +02:00
emersion
c89cd4945b pointer-constraints: rename wl_{global,resources} 2018-09-26 17:38:41 +02:00
random human
84ecfb546b
wlr_surface: more consistent argument naming in surface_update_damage 2018-09-25 02:06:02 +05:30
random human
5eca5d8946
wlr_surface: remove duplicated damage calculation
The damage is already calculated and stored in surface->buffer_damage
by surface_update_damage().
2018-09-25 01:38:09 +05:30
random human
3fd5da58a0
wlr_surface: fix surface damage on resize
Instead of damaging the buffer, damage only the surface on surface (not
buffer) resize.
2018-09-25 01:25:30 +05:30
random human
971cbeaa19
wlr_surface: fix surface damage transformation
Damage tracking on transformed surfaces now work (see
"weston-simple-damage --rotation=90"), using either of buffer or surface
damage.
2018-09-24 22:03:41 +05:30
Drew DeVault
33a3d8a555
Merge pull request #1252 from emersion/fatal-unknown-buffer
buffer: disconnect clients that commit an unknown buffer type
2018-09-19 08:02:31 -04:00
emersion
ac28d701c0 buffer: disconnect clients that commit an unknown buffer type
If this happens, something went really wrong and we should do more
than just logging an error. See [1].

[1]: https://gitlab.freedesktop.org/wayland/weston/issues/148
2018-09-19 11:29:48 +02:00
Las
afa2e399aa Fix implicit conversion of floats to ints in calls to pixman_region32_contains_point
I do not think the conversion is specifically defined, but on my system and SirCmpwn's
the floats are rounded instead of floored, which is incorrect in this case, since
for a range from 0 to 256, any value greater or equal to 0 and less than 256 is valid.
I.e. [0;256[, or 0 <= x < 256, but if x is e.g. -0.1, then it will be rounded to 0, which
is invalid. The correct behavior would be to floor to -1.
2018-09-18 13:05:44 +02:00
emersion
3df602a62d export-dmabuf: disable hardware cursors if desired
Also make the frame resource inert when sending "ready".
2018-09-18 11:48:04 +02:00
emersion
928572c14d output: add wlr_output_set_hardware_cursors_enabled
And use it in screencopy.
2018-09-18 11:37:37 +02:00
random human
40a43003a1
Send unique keymap file descriptors
To prevent wl_keyboard keymap being written to by clients, use a unique
file descriptor for each wl_keyboard resource.

Reference: weston, commit 76829fc4eaea329d2a525c3978271e13bd76c078
2018-09-18 13:58:36 +05:30
Las
fa2e6e7d9d Implement pointer-constraints protocol in wlroots and rootston 2018-09-18 10:14:33 +02:00
Las
6367e0bc93 Add wlr_surface::input_region member
This is analogous to the opaque_region member.

In addition the code for setting the opaque region is cleaned up.
2018-09-18 10:14:33 +02:00
Las
d446c53fe1 Make (wlr_)seat_client_from_pointer_resource public 2018-09-18 10:14:33 +02:00
Las
252bcce2f3 Add focus change event for seats 2018-09-18 10:14:33 +02:00
emersion
9f76263404 output-layout: don't expose outputs without a mode 2018-09-17 15:22:33 +02:00
Drew DeVault
df991a55ab
Merge pull request #1241 from emersion/output-enable-error-checking
output: make wlr_output_enable return a bool
2018-09-14 21:14:18 -04:00
Drew DeVault
0210905eef
Merge pull request #1243 from emersion/layer-shell-suffix
layer-shell: add _v1 suffix
2018-09-14 20:47:42 -04:00
Drew DeVault
a088000983
Merge pull request #1244 from emersion/xdg-output-suffix
xdg-output: add _v1 suffix
2018-09-14 20:47:14 -04:00
emersion
fc960e5d06 layer-shell: add _v1 suffix 2018-09-14 19:32:33 +02:00
emersion
b3cb22c003 xdg-output: add _v1 suffix 2018-09-14 19:29:08 +02:00
emersion
cb293f09e7 output: make wlr_output_enable return a bool 2018-09-14 18:18:07 +02:00
emersion
524702eb16 output: introduce WLR_NO_HARDWARE_CURSORS 2018-09-14 18:07:21 +02:00
emersion
769a8e9917
Merge pull request #1160 from Ongy/tablet-grabs
Tablet grabs
2018-09-12 19:01:50 +02:00
Markus Ongyerth
21e1cc9ab4 Implement feedback 2018-09-08 19:17:44 +02:00
nyorain
f6168c2afe Fix #1129 and remove sx, sy from wlr_drag_icon
sx, sy used to store the buffer offset of the drag surface which was
then be added (by rootston) to the drag icon position.
Buffer offsets are handled already in surface_intersect_output
(output.c) so they were added twice for dnd surfaces.
2018-09-07 14:48:28 +02:00
emersion
017cfb0b86 backend/drm: log when de-allocating CRTC 2018-09-04 19:44:44 +02:00
emersion
d22431d969
Merge pull request #1228 from arandomhuman/misc-mem
Miscellaneous memory leak fixes
2018-09-03 08:26:59 +02:00
random human
9f511ae942
Remove listener link after tablet_manager destroy 2018-09-03 05:05:18 +05:30
random human
568b0ffe2c
Call wl_global_create first in case of failure 2018-09-03 02:43:55 +05:30
cnt0
6946134883 fix incorrect NULL check 2018-09-02 20:48:18 +02:00
Aidan Epstein
e334b46b39
Fix uninitialized value in wlr_cursor. 2018-08-31 23:36:38 +00:00
random human
8589ae19de Fix bugs listed by clang's static analyzer
A few pedantic changes and unused variables (1-4), and genuine bugs (5,
6).

The reports with the corresponding files and lines numbers are as
follows.

1. backend/libinput/tablet_pad.c@31,44,57
"Allocator sizeof operand mismatch"
"Result of 'calloc' is converted to a pointer of type 'unsigned int',
which is incompatible with sizeof operand type 'int'"

2. types/tablet_v2/wlr_tablet_v2_pad.c@371
"Allocator sizeof operand mismatch"
"Result of 'calloc' is converted to a pointer of type 'uint32_t', which
is incompatible with sizeof operand type 'int'"

3. types/wlr_cursor.c@335
"Dead initialization"
"Value stored to 'dx'/'dy' during its initialization is never read"

4. rootston/xdg_shell.c@510
"Dead initialization"
"Value stored to 'desktop' during its initialization is never read"

5. types/tablet_v2/wlr_tablet_v2_pad.c@475
"Dereference of null pointer"
"Access to field 'strips' results in a dereference of a null pointer
(loaded from field 'current_client')"

The boolean logic was incorrect (c.f. the check in the following
function).

6. examples/idle.c@163,174,182
"Uninitialized argument value"
"1st function call argument is an uninitialized value"

If close_timeout != 0, but simulate_activity_timeout >= close_timeout,
the program would segfault at pthread_cancel(t1).
2018-08-31 19:41:18 +02:00
Alexander Bakker
221d412824 Init the new destroy signals added by #1200 2018-08-27 18:21:36 +02:00
Alexander Bakker
20db29779e Add destroy signals to types that are destroyed by wl_display_destroy 2018-08-26 23:23:12 +02:00
Brian Ashworth
c6955fa89c
Merge pull request #1199 from apreiml/farthest_output
introduce wlr_output_layout_farthest_output
2018-08-25 11:00:25 -04:00
Armin Preiml
5617d2bd60 introduce wlr_output_layout_farthest_output
Similar to wlr_output_layout_adjacent_output but will return the
one that is the farthest away from the reference in given direction.
2018-08-25 09:14:55 +02:00
Dorota Czaplejewicz
6db9c4b746 wlr_virtual_keyboard: use wlr_input_device_destroy 2018-08-22 14:43:29 +01:00
Dorota Czaplejewicz
2929f0f8dd wlr_input_device: fix keyboard destruction
After destroying a keyboard input device, seat's listeners could still be pointing to destroyed wlr_input_device signals. This patch makes sure the references are removed while the input device is being destroyed.
2018-08-22 14:43:29 +01:00
emersion
f86f1daf9a Fix build on FreeBSD 2018-08-16 10:54:45 +01:00
Markus Ongyerth
3ad7b146eb Fix typos/order in tablet-v2 2018-08-06 08:45:44 +02:00
Markus Ongyerth
f64962ace8 tablet-v2 tool: Implement implicit grab
Implement the tablet-v2 tablet tool's implicit grab semantics for
buttons and tip.

This avoids losing focus (to other [sub]surfaces) when a button is held,
or the tip is down.
This should help when the device is used close to a surface's border and
would otherwise have to be very precise.
2018-08-06 08:45:41 +02:00
emersion
c4522062f6 xdg-output: fix segfault in handle_layout_destroy 2018-08-03 14:03:53 +01:00
Scott Anderson
eb9c9d8852
Merge pull request #1173 from sdilts/add-missing-libinput
Add missing dependency libinput to types/meson.build
2018-08-03 14:58:22 +12:00
sdilts
c95078320c Add missing dependency libinput to types/meson.build
The file `types/tablet_v2/wlr_tablet_v2.c` includes <libinput.h>.
Without this change, libinput.h  may not be found on
some systems.
2018-08-02 20:13:48 -06:00
emersion
c3afe4f42e gamma-control-v1: improve error handling 2018-08-02 23:33:59 +01:00
emersion
bbd0fbe573 gamma-control-v1: fix fds not closed 2018-08-02 23:33:59 +01:00
emersion
1705316fa7 gamma-control-v1: set O_NONBLOCK, improve error handling style 2018-08-02 23:33:59 +01:00
emersion
73b7111846 gamma-control-v1: reset gamma table when control is destroyed 2018-08-02 23:33:59 +01:00
emersion
6e8892d4d7 gamma-control-v1: don't insert control in the list before checking unicity 2018-08-02 23:33:59 +01:00
emersion
a149c2370a Implement wlr-gamma-control-unstable-v1 2018-08-02 23:33:04 +01:00
Drew DeVault
5642c5cc8f
Merge pull request #1053 from emersion/xdg-decoration
Add xdg-decoration-unstable-v1 support
2018-08-02 09:33:10 -04:00
emersion
555721f714 Add xdg-decoration-unstable-v1 support 2018-07-28 22:48:07 +01: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
Markus Ongyerth
d5950255de tablet-v2 tablet_tool grab implementation
Implement the basic logic for tablet-v2 tablet_tool's grabs. And plug in
the default grab.
2018-07-23 10:08:10 +02:00
Ilia Bozhinov
8b7c85d765 xdg-shell(-v6): add set_title and set_app_id toplevel signals
This is useful for example when rendering decorations
2018-07-22 22:42:37 +03: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
emersion
5dbf0fe7f2 linux-dmabuf: add v1 suffix
This prevents some future conflicts with the stable version.

Fixes #1133
2018-07-19 21:50:05 +01:00
Markus Ongyerth
454f2a84a8 tablet-v2 tablet_pad grab implementation
Implement the basic logic for tablet-v2 tablet_pad's grabs. And plug in
the default grab.
Features like "holding" the focus should be implemented via grabs, like
they are for pointer and keyboard.
2018-07-19 11:35:00 +02:00
emersion
4afd69bbe7 Remove unused types/wlr_tablet_v2.c 2018-07-17 11:14:43 +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
Markus Ongyerth
9a6f77fc2c tablet-v2: fix merge commits and test again
There were a few issues after rebase, that the merge algorithm didn't
throw at my face:

wlr_output did a check on the actual role, not a string anymore, so that
had to go to allow tablet-v2 to set cursor surfaces.
A few L_DEBUG/L_ERRORs were still around
There was a user-after-free in tablet-group free()ing, probably after
insufficient testing from a previous feedback pass
2018-07-14 10:29:22 +02:00
Markus Ongyerth
74ca2f8fcf Another round of feedback from acrisci 2018-07-14 09:52:34 +02:00
Markus Ongyerth
43b20bfea2 First feedback pass from acrisci 2018-07-14 09:52:05 +02:00
Markus Ongyerth
d9e978e1b3 rename wlr_tablet_tool to wlr_tablet
The previous naming was based on the input-device capability names from
libinput.
With code that uses the libinput_tablet_tool and mapping into tablet-v2,
this is confusing, so the name is changed to follow the names used in
the protocol.
2018-07-14 09:49:58 +02:00
Markus Ongyerth
101080a382 Another feedback pass 2018-07-14 09:48:57 +02:00
Markus Ongyerth
6b51f3b57a use previous resource versions and destroy pads 2018-07-14 09:48:57 +02:00
Markus Ongyerth
503f9d6e52 emersion feedback
Introduce TABLET_MANAGER_VERSION and remove the wlr_tablet_tool_tool.c
2018-07-14 09:48:57 +02:00
Markus Ongyerth
2bc09d91c3 Silent conversion from double to int should be illegal 2018-07-14 09:48:57 +02:00
Markus Ongyerth
dc525a9c5f Clean up serial handling and automate proximity acompaning events 2018-07-14 09:48:57 +02:00
Markus Ongyerth
25c2808153 Clean up serial handling 2018-07-14 09:48:57 +02:00
Markus Ongyerth
88a4b908d1 Hide pad auxiliary data in .c file 2018-07-14 09:48:57 +02:00
Markus Ongyerth
fa39fd178d Split tablet_v2 implementation for easier maintainance 2018-07-14 09:48:57 +02:00
Markus Ongyerth
2c12011472 Send all tablet tool axis events 2018-07-14 09:47:16 +02:00
Markus Ongyerth
6a40561e4c Fix clang build errors 2018-07-14 09:47:16 +02:00
Markus Ongyerth
2155c976f6 Improve inert resource handling 2018-07-14 09:47:16 +02:00
Markus Ongyerth
b79d11395c Hook up set_cursor in rootston 2018-07-14 09:47:16 +02:00
Markus Ongyerth
0c9a26828a Use wlr_list for paths, and improve inert resource handling 2018-07-14 09:43:17 +02:00
Markus Ongyerth
31cec36b74 1st feedback pass
Rename make_ functions to _create
Implement set_cursor and set_feedback
2018-07-14 09:43:16 +02:00
Markus Ongyerth
5c7a37f309 Add tool buttons 2018-07-14 09:40:39 +02:00
Markus Ongyerth
391eef6ea9 Propagate most axis events to clients 2018-07-14 09:40:39 +02:00
Markus Ongyerth
f375246657 Implement basic tablet_pad handling (bound to keyboard focus) 2018-07-14 09:40:39 +02:00
Markus Ongyerth
f696e980f1 stabilise tablet_v2 code (prevent bunch of crashes) 2018-07-14 09:40:39 +02:00
Markus Ongyerth
e235f7d336 Basic tablet_v2 object lifetime 2018-07-14 09:40:39 +02:00
Markus Ongyerth
77bac448cc storage commit #2 2018-07-14 09:40:39 +02:00
Markus Ongyerth
4947295c8f convoluted tablet code 2018-07-14 09:40:39 +02:00
Markus Ongyerth
bf8751d632 Start tablet protocol 2018-07-14 09:40:39 +02:00
emersion
935a3f2ebb screencopy: fix segfault when client supplies invalid buffer 2018-07-13 19:27:04 +01:00
emersion
5bb272d7f3 surface: add wlr_surface.opaque_region 2018-07-13 10:54:51 +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
Drew DeVault
2518de655c
Merge pull request #1126 from emersion/wlr-log-prefix
util: add wlr_ prefix to log symbols
2018-07-09 16:12:20 -07:00
emersion
7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
Arvin Ignaci
fad62a3e1c fix: handle 32 bit time_t (or smaller) 2018-07-09 14:45:19 +00:00
emersion
deeca53e33
Rename wl_resources to resource, wl_global to global 2018-07-08 19:21:31 +01:00
vilhalmer
0260f042d2
Bail from setting gamma on destroyed resource 2018-07-08 12:35:41 -04:00
emersion
c19d475753
xdg-output: don't send no-op updates
To begin with, no-op updates are unnecessary, so this patch is an
improvement on its own.

Then, this fixes hotplugging issues with xwayland. xwayland waits
for both wl_output and xdg_output to send a "done" event. However,
it doesn't handle well desynchronized "done" updates: if xdg-output
sends "done" twice, the second one will wait for the next wl_output
"done" event. This is an issue when the first is a no-op and the
second is a real update: the second isn't applied. I've considered
patching xwayland instead, but it seems pretty complicated.
2018-07-08 14:12:18 +01:00
emersion
5fe50b9a28
output: make wl_output resources inert 2018-07-07 23:02:08 +01:00
emersion
33db4263a0
surface: replace wlr_surface_set_role_committed with wlr_surface_role 2018-07-07 22:45:16 +01:00
emersion
515d682312
surface: fix damage when moving subsurfaces with scale > 1 2018-07-04 19:16:16 +01:00
emersion
e665a74122
surface: don't clip input and opaque regions
These can be set to e.g. regions larger than the surface. If the
surface resizes itself, it doesn't need to set again these regions.
2018-07-04 19:12:18 +01:00
emersion
226306ed45
surface: rename wlr_surface_state.buffer to buffer_resource 2018-07-04 19:12:18 +01:00
emersion
68c133da2f
surface: fix crash on NULL commit 2018-07-04 19:12:18 +01:00
emersion
6f0eb11024
surface: fix previous state eating current state resources 2018-07-04 19:12:18 +01:00
emersion
f440708274
output: fix cursor attach coords handling 2018-07-04 19:12:18 +01:00
emersion
012e38fbe5
surface: add wlr_surface.previous 2018-07-04 19:12:18 +01:00
emersion
78555abba3
surface: move position and scale out of wlr_surface_state 2018-07-04 19:12:17 +01:00
emersion
233bfe2f4f
surface: do not monkey-patch state damage 2018-07-04 19:12:17 +01:00
emersion
adf0423f7c
surface: better buffer position handling 2018-07-04 19:12:17 +01:00
emersion
3c0d672ebd
surface: make pending and current embedded structs 2018-07-04 19:12:17 +01:00
emersion
64836ddfe7
surface: remove wlr_surface_state.subsurface_position 2018-07-04 19:12:17 +01:00
emersion
3ee86b6105
surface: rename invalid state 2018-07-04 19:12:16 +01:00
Dominique Martinet
48e8da851d wlr_seat destroy: fix use-after-free when destroying clients
wl_resource_for_each_safe isn't safe to use here because it accesses
the list's head memory one last time at the end of the loop. Work
around this by breaking out early.

==19880==ERROR: AddressSanitizer: heap-use-after-free on address 0x60d0000e6368 at pc 0x7fab68619de2 bp 0x7ffd5c91cee0 sp 0x7ffd5c91ced0
READ of size 8 at 0x60d0000e6368 thread T0
    #0 0x7fab68619de1 in wlr_seat_destroy ../types/seat/wlr_seat.c:179
    #1 0x7fab68619fb9 in handle_display_destroy ../types/seat/wlr_seat.c:196
    #2 0x7fab688e4f8f in wl_priv_signal_emit src/wayland-server.c:2024
    #3 0x7fab688e56ca in wl_display_destroy src/wayland-server.c:1092
    #4 0x40c11e in server_fini ../sway/server.c:138
    #5 0x40b1a8 in main ../sway/main.c:438
    #6 0x7fab67b5e18a in __libc_start_main ../csu/libc-start.c:308
    #7 0x409359 in _start (/opt/wayland/bin/sway+0x409359)

0x60d0000e6368 is located 24 bytes inside of 144-byte region [0x60d0000e6350,0x60d0000e63e0)
freed by thread T0 here:
    #0 0x7fab6a7d6880 in __interceptor_free (/lib64/libasan.so.5+0xee880)
    #1 0x7fab68619805 in seat_client_handle_resource_destroy ../types/seat/wlr_seat.c:97
    #2 0x7fab688e5025 in destroy_resource src/wayland-server.c:688

previously allocated by thread T0 here:
    #0 0x7fab6a7d6e50 in calloc (/lib64/libasan.so.5+0xeee50)
    #1 0x7fab686198df in seat_handle_bind ../types/seat/wlr_seat.c:127
    #2 0x7fab6530503d in ffi_call_unix64 (/lib64/libffi.so.6+0x603d)
2018-07-04 14:50:14 +09:00
Ilia Bozhinov
00ccf5c3ae properly check if the point is inside the surface in wlr_surface_point_accepts_input 2018-07-03 10:29:02 +03:00
Drew DeVault
27cab67b96
Merge pull request #1105 from RyanDwyer/xdg-surface-for-each-popup
Introduce wlr_xdg_surface_for_each_popup
2018-07-01 06:39:06 -07:00
Ryan Dwyer
86f401e827 Introduce wlr_xdg_surface_for_each_popup
It is common to want to iterate an xdg-surface's popups separately from
the toplevel and subsurfaces. For example, popups are typically rendered
on top of most other surfaces.

wlr_xdg_surface_for_each_surface continues to iterate both surfaces and
popups to maintain backwards compatibility.
2018-07-01 23:24:39 +10:00
Dominique Martinet
9ddc2f39d0 wlr_seat destroy: fix use-after-free after primary selection source cancel
the primary_selection_source_destroy list points to memory freed by
that cancel callback, so remove from list before freeing
2018-07-01 21:04:43 +09:00
emersion
dbb01cbcd0
screencopy: listen to buffer destroy 2018-06-30 22:18:04 +01:00
emersion
9aaa9ba477
screencopy: make frame resource inert after copy 2018-06-30 22:18:04 +01:00
emersion
c421700f3d
screncopy: update protocol 2018-06-30 22:18:04 +01:00
emersion
bf7560b7cd
screencopy: add capture_output_region support 2018-06-30 22:18:04 +01:00
emersion
2b9cbaddf3
screencopy: add support for frame flags 2018-06-30 22:18:03 +01:00
emersion
bd8be19b79
screencopy: add presentation timestamp 2018-06-30 22:18:03 +01:00
emersion
73755ad348
screencopy-v1: add basic implementation 2018-06-30 22:17:59 +01:00
Dominique Martinet
c263f7ca29 s/wlr_subsurface_from_surface/wlr_subsurface_from_wlr_surface/
This was the only x_from_wlr_surface function that lacked the wlr_ prefix,
let's have an API as uniform as possible.
2018-06-30 21:21:13 +09:00
Dominique Martinet
1fef1f88b2 export dmabuf manager_handle_capture_output: fix leak on error
Found through static analysis
2018-06-30 11:47:25 +09:00
Dominique Martinet
b3313b7f39 wlr_output: fix scope for 'now'
'when' points to now that was defined in the if, so compiler could reuse
that memory area by the time 'when' is called

Found through static analysis.
2018-06-30 11:38:21 +09:00
Dominique Martinet
efef54ccf5 wlr_keyboard: fix mmap leak + logic on close for keymap_fd
mmap leak found through static analysis
2018-06-30 11:38:21 +09:00
emersion
ec7d4a0971
Merge pull request #1092 from martinetd/idle_inhibit
Idle inhibit cleanup
2018-06-28 14:33:07 +01:00
Dominique Martinet
93a75769f0 wlr_idle_inhibit_v1: cleanup destroy handlers
- Rename handlers to <type>_handle_resource_destroy and
<type>_handle_destroy to be coherent
 - Make sure we never destroy wl_resources when we shouldn't

Updates #999
2018-06-28 22:04:28 +09:00
Dominique Martinet
a3e2a77734 xdg_popup: fix call to to handle_grab for inert popup 2018-06-28 20:28:15 +09:00
Dominique Martinet
970687a01c xdg_shell popup: fix potential segv in handle_destroy
surface could be NULL there if the popup had been made
inert before
2018-06-28 13:54:35 +09:00
Dominique Martinet
d0b902b962 wlr_idle: add helper to enable/disable all timers
There was no way to tell wlr_idle to stop processing input events
and rearm timers all the time, such an API is required to have
some form of idle inhibitor.
2018-06-27 22:47:05 +09:00
Dominique Martinet
ffd37b664f xdg_shell: destroy children popups with parent surface
popups have a link in parent's surface->popups list and needs
to be freed before:

==6902==ERROR: AddressSanitizer: heap-use-after-free on address 0x6120001a0300 at pc 0x7fc1447acb50 bp 0x7fffd396e680 sp 0x7fffd396e670
WRITE of size 8 at 0x6120001a0300 thread T0
    #0 0x7fc1447acb4f in wl_list_remove ../util/signal.c:55
    #1 0x7fc14477d206 in destroy_xdg_popup_v6 ../types/xdg_shell_v6/wlr_xdg_popup_v6.c:162
    #2 0x7fc1447816e0 in destroy_xdg_surface_v6 ../types/xdg_shell_v6/wlr_xdg_surface_v6.c:108
    #3 0x7fc144a1c025 in destroy_resource src/wayland-server.c:688
    #4 0x7fc144a1c091 in wl_resource_destroy src/wayland-server.c:705
    #5 0x7fc14477fd6f in xdg_client_v6_handle_resource_destroy ../types/xdg_shell_v6/wlr_xdg_shell_v6.c:72
    #6 0x7fc144a1c025 in destroy_resource src/wayland-server.c:688
    #7 0x7fc144a20851  (/lib64/libwayland-server.so.0+0xc851)
    #8 0x7fc144a20d92  (/lib64/libwayland-server.so.0+0xcd92)
    #9 0x7fc144a1c140 in wl_client_destroy src/wayland-server.c:847
    #10 0x7fc144a1c21c in destroy_client_with_error src/wayland-server.c:307
    #11 0x7fc144a1c21c in wl_client_connection_data src/wayland-server.c:330
    #12 0x7fc144a1df01 in wl_event_loop_dispatch src/event-loop.c:641
    #13 0x7fc144a1c601 in wl_display_run src/wayland-server.c:1260
    #14 0x40a2f4 in main ../sway/main.c:433
    #15 0x7fc143ef718a in __libc_start_main ../csu/libc-start.c:308
    #16 0x40b749 in _start (/opt/wayland/bin/sway+0x40b749)

0x6120001a0300 is located 64 bytes inside of 264-byte region [0x6120001a02c0,0x6120001a03c8)
freed by thread T0 here:
    #0 0x7fc14690d880 in __interceptor_free (/lib64/libasan.so.5+0xee880)
    #1 0x7fc1447acce8 in wlr_signal_emit_safe ../util/signal.c:29
    #2 0x7fc1447a3cac in surface_handle_resource_destroy ../types/wlr_surface.c:576
    #3 0x7fc144a1c025 in destroy_resource src/wayland-server.c:688

previously allocated by thread T0 here:
    #0 0x7fc14690de50 in calloc (/lib64/libasan.so.5+0xeee50)
    #1 0x7fc144781d38 in create_xdg_surface_v6 ../types/xdg_shell_v6/wlr_xdg_surface_v6.c:415
    #2 0x7fc14147503d in ffi_call_unix64 (/lib64/libffi.so.6+0x603d)

Alternative would be to have popups listen to the parent's surface
destroy event and remove themselves from the list at this point OR on
their own destroy, whichever happens first, but that seems more
complicated for little benefit.
2018-06-25 17:54:25 +09:00
Dominique Martinet
954969698a wlr_primary_selection: fix use-after-free when cancelling source
seat->primary_election_source_destroy points to the source that just got
freed by the cancel.

==7843==ERROR: AddressSanitizer: heap-use-after-free on address 0x60b0004269b0 at pc 0x7fb95bf4ccd0 bp 0x7ffd75013940 s
p 0x7ffd75013930
WRITE of size 8 at 0x60b0004269b0 thread T0
    #0 0x7fb95bf4cccf in wl_list_remove ../util/signal.c:55
    #1 0x7fb95bf3f4c6 in wlr_seat_set_primary_selection ../types/wlr_primary_selection.c:238
    #2 0x7fb95becb1a7 in xwm_handle_selection_event ../xwayland/selection/selection.c:124
    #3 0x7fb95bed2e5d in x11_event_handler ../xwayland/xwm.c:1139
    #4 0x7fb95c1bdf01 in wl_event_loop_dispatch src/event-loop.c:641
    #5 0x7fb95c1bc601 in wl_display_run src/wayland-server.c:1260
    #6 0x40a2f4 in main ../sway/main.c:433
    #7 0x7fb95b69718a in __libc_start_main (/lib64/libc.so.6+0x2318a)
    #8 0x40b749 in _start (/opt/wayland/bin/sway+0x40b749)

0x60b0004269b0 is located 64 bytes inside of 112-byte region [0x60b000426970,0x60b0004269e0)
freed by thread T0 here:
    #0 0x7fb95e0ad880 in __interceptor_free (/lib64/libasan.so.5+0xee880)
    #1 0x7fb95bf3f49e in wlr_seat_set_primary_selection ../types/wlr_primary_selection.c:236
    #2 0x7fb95becb1a7 in xwm_handle_selection_event ../xwayland/selection/selection.c:124
    #3 0x7fb95bed2e5d in x11_event_handler ../xwayland/xwm.c:1139
    #4 0x7fb95c1bdf01 in wl_event_loop_dispatch src/event-loop.c:641

previously allocated by thread T0 here:
    #0 0x7fb95e0ade50 in calloc (/lib64/libasan.so.5+0xeee50)
    #1 0x7fb95bec7ad6 in xwm_selection_get_targets ../xwayland/selection/incoming.c:355
    #2 0x7fb95bec7ad6 in xwm_handle_selection_notify ../xwayland/selection/incoming.c:402
    #3 0x7fb95becb1a7 in xwm_handle_selection_event ../xwayland/selection/selection.c:124
    #4 0x7fb95bed2e5d in x11_event_handler ../xwayland/xwm.c:1139
    #5 0x7fb95c1bdf01 in wl_event_loop_dispatch src/event-loop.c:641

SUMMARY: AddressSanitizer: heap-use-after-free ../util/signal.c:55 in wl_list_remove
Shadow bytes around the buggy address:
  0x0c168007cce0: fd fd fd fa fa fa fa fa fa fa fa fa fd fd fd fd
  0x0c168007ccf0: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa
  0x0c168007cd00: fa fa fd fd fd fd fd fd fd fd fd fd fd fd fd fa
  0x0c168007cd10: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c168007cd20: fd fd fd fd fd fa fa fa fa fa fa fa fa fa fd fd
=>0x0c168007cd30: fd fd fd fd fd fd[fd]fd fd fd fd fd fa fa fa fa
  0x0c168007cd40: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c168007cd50: fd fa fa fa fa fa fa fa fa fa fd fd fd fd fd fd
  0x0c168007cd60: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa
  0x0c168007cd70: fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa
  0x0c168007cd80: fa fa fa fa fa fa fd fd fd fd fd fd fd fd fd fd
2018-06-25 17:28:44 +09:00
Tony Crisci
a2ff144429 input-inhibit: use wlr_signal_emit_safe 2018-06-24 19:33:15 -04:00
Tony Crisci
006edc9dcb xdg-shell: end pointer and keyboard grab at the same time 2018-06-24 18:50:04 -04:00
Drew DeVault
e459fe0ec7
Merge pull request #992 from emersion/screencontent
Implement wlr_export_dmabuf_unstable_v1 protocol
2018-06-22 05:37:07 -07:00
Drew DeVault
47c7674a68
Merge pull request #1075 from emersion/fix-xdg-toplevel-compare
xdg-shell{,-v6}: fix compare_xdg_surface_toplevel_state
2018-06-20 18:54:01 -07:00
emersion
a59774f364
xdg-shell{,-v6}: fix compare_xdg_surface_toplevel_state 2018-06-20 21:25:01 +01:00
emersion
a6c0e25d36
surface: remove wlr_frame_callback
This removes the need to allocate a structure for frame callbacks.
wl_resource_get_link is used instead.
2018-06-20 20:00:23 +01:00
emersion
57548b557a
Merge branch 'master' into screencontent 2018-06-17 14:49:18 +01:00
emersion
bd0c1b7949
export-dmabuf: update protocol 2018-06-17 14:19:45 +01:00
emersion
843621714f
surface: fix double wl_buffer.release events
Prior to this commit, we re-uploaded the buffer even if a new one
wasn't attached. After uploading, we send wl_buffer.release. So,
this sequence of requests resulted in a double release:

    surface.attach(buffer, 0, 0)
    surface.commit()
    <- buffer.release()
    surface.commit()
    <- buffer.release()
2018-06-17 12:49:34 +01:00
Drew DeVault
fb118ac996
Merge pull request #1062 from emersion/wlr-buffer-comeback
Add back wlr_buffer
2018-06-16 13:43:14 -07:00
emersion
225aa815b0
buffer: fix wlr_texture leak on failed alloc 2018-06-16 19:01:13 +01:00
Ilia Bozhinov
23707f6504 layer-shell: check whether the surface is mapped in layer_surface_destroy()
If the layer surface has been closed by the compositor, using
layer_surface_close(), then the unmap event is emitted. However, when
the layer surface is later destroyed by the client, the compositor used
to get a second unmap, which is fixed with this commit.
2018-06-16 17:29:53 +03:00
emersion
da114d5013
buffer: don't destroy DMA-BUF textures with wl_buffer
After some discussions on #wayland, it seems that as soon as you
hold a reference to a DMA-BUF (via EGLImage for instance), the
underlying memory won't get free'd. The client is allowed to
re-use the DMA-BUF and upload something else to it though.
2018-06-14 10:15:14 +01:00
Drew DeVault
d27eeaa14c Revert "Merge pull request #1050 from emersion/wlr-buffer"
This reverts commit 5e4af4862e, reversing
changes made to 9a1f0e2d5f.
2018-06-13 19:57:42 -04:00
emersion
0378d143d9
surface: remove wlr_surface.texture
The texture is managed by the surface's wlr_buffer now. In
particular, the buffer can destroy the texture early if it becomes
invalid.
2018-06-13 19:38:10 +01:00
emersion
38d415dd20
buffer: make wlr_buffer_ref return the buffer 2018-06-11 08:13:35 +01:00
emersion
e4933ab445
Introduce wlr_buffer 2018-06-08 20:06:13 +01:00
emersion
6f895081e1
Merge pull request #1043 from acrisci/drag-icon-unmap
drag-icon map and unmap fixes
2018-06-07 11:18:58 +01:00
emersion
211463ba87
Merge pull request #1045 from ammen99/master
xdg-shells: add a set_parent signal to toplevel surfaces
2018-06-06 21:38:32 +01:00
Tony Crisci
1a07bf95ae
Merge pull request #1044 from emersion/fix-box-intersection
box: fix wlr_box_intersection
2018-06-06 11:59:40 -04:00
Ilia Bozhinov
a989104a6b xdg-shells: add a set_parent signal to toplevel surfaces 2018-06-06 17:08:06 +03:00
emersion
ed89a24328
box: fix wlr_box_intersection 2018-06-06 08:47:04 +01:00
Tony Crisci
7c888a39c6 update drag position at the right times 2018-06-05 23:45:03 -04:00
Tony Crisci
319ebdf476 add back map event 2018-06-05 22:50:29 -04:00
Tony Crisci
1c75d4e54a rename drag-icon map to unmap 2018-06-05 18:17:42 -04:00
Dominique Martinet
c6821f3dd3 wlr_surface: insert subsurfaces in revert order
sibling surfaces were drawn in incorrect order (e.g. latest below).
This attempts to fix that by reverting the order of the list.
2018-06-05 21:02:42 +09:00
Tony Crisci
7206997e95 fix wlr_box_intersection and closest_point 2018-06-04 18:56:57 -04:00
Tony Crisci
a57d1baf57
Merge pull request #1033 from RyanDwyer/fix-xdg-popups
Fix mistakes in xdg_popup and xdg_popup_v6
2018-06-04 18:46:58 -04:00
emersion
344374fa14
Merge pull request #1039 from acrisci/positioner-invert-x-fix
add missing anchor case in positioner invert-x for xdg-shell
2018-06-04 22:27:26 +01:00
Tony Crisci
bcb660cb1d add missing anchor case in positioner invert-x 2018-06-04 17:16:17 -04:00
emersion
78966417f4
Merge pull request #1031 from martinetd/multibind-seat
seat: allow clients to bind to seat multiple times
2018-06-04 16:44:22 +01:00
Dominique Martinet
cf9b8c0a8c wlr_surface_get_root_surface: walk up parent
This would dead-loop and never walk up if called on a subsurface
2018-06-05 00:17:58 +09:00
Dominique Martinet
51b9883ea0 seat: allow clients to bind to seat multiple times
This lets clients bind to a seat multiple times by re-using the existing
wlr_seat_client whenever a duplicate request happens.
Previously, an independant wlr_seat_client would be created and only
events from one would be processed.

Fixes #1023.
2018-06-04 22:31:36 +09:00
Bob Ham
eb8b8acca6 wlr_linux_dmabuf: Fix printf conversion specifiers on armhf
The printf conversion specifiers in a call to wl_resource_post_error
do not specify the type correctly on armhf:

../types/wlr_linux_dmabuf.c: In function 'params_add':
../types/wlr_linux_dmabuf.c:104:21: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
    "sent modifier %lu for plane %u, expected modifier %lu like other planes",
                   ~~^
                   %llu

To fix this, we use standard printf conversion specifier macros from
inttypes.h.
2018-06-04 13:20:09 +00:00
Ryan Dwyer
516c864d46 Fix mistakes in xdg_popup and xdg_popup_v6 2018-06-04 22:00:40 +10:00
Markus Ongyerth
7b07b3f95d Fix type in wlr_surface_get_extends 2018-06-01 16:36:04 +02:00
Markus Ongyerth
3994762ae0 Add wlr_surface_get_geometry
This function defaults and clips the xdg-surface geometry to the
bounding box of the surface + its subsurfaces, as specified by the
protocol spec.
2018-06-01 15:21:18 +02:00
emersion
6b7a55aa3d
Merge pull request #1020 from emersion/remove-check-dmabuf
render: remove wlr_renderer_check_import_dmabuf
2018-05-31 21:49:57 +01:00
emersion
21928cbe61
Merge branch 'master' into screencontent 2018-05-31 12:33:27 +01:00
Genki Sky
d1cf9acbd5 cleanup: Use void for zero-parameter functions
Signed-off-by: Genki Sky <sky@genki.is>
2018-05-30 20:19:16 -04:00
emersion
f90b024ad0
linux-dmabuf: fix bound checks for stride and height
- Fix bound checking for offset + stride * height
- Make offset bound checking more consistent
- Reject zero strides
2018-05-30 19:46:24 +01:00
emersion
135721118a
render: remove wlr_renderer_check_import_dmabuf
It's possible to implement it outside the renderer, by creating a
texture and destroying it right away. This reduces the API surface
of the renderer.
2018-05-30 17:08:15 +01:00
emersion
41e53d1499
Merge pull request #1019 from emersion/virtual-keyboard-destroy
virtual-keyboard: fix wlr_virtual_keyboard_manager_v1_destroy
2018-05-30 13:51:34 +01:00
emersion
28020ff577
Only allow one modifier per DMA-BUF, split attributes struct in render/ 2018-05-30 09:29:12 +01:00
emersion
f580112dca
virtual-keyboard: fix wlr_virtual_keyboard_manager_v1_destroy 2018-05-30 09:25:46 +01:00
emersion
87fe9f3466
Merge pull request #1014 from RyanDwyer/fix-wlr-box-contains-point
Fix wlr_box_contains_point comparison
2018-05-29 19:03:29 +01:00
emersion
2681352e04
export-dmabuf: permanently fail if backend doesn't implement export_dmabuf 2018-05-29 18:47:19 +01:00
emersion
a16ad4327a
Update protocol 2018-05-29 18:47:19 +01:00
emersion
65198b0aab
export-dmabuf: assert number of planes 2018-05-29 18:47:19 +01:00
emersion
2432c41a49
export-dmabuf: correctly send the number of planes per layer 2018-05-29 18:47:18 +01:00
emersion
3f9796112e
export-dmabuf: fix tv_sec_hi 2018-05-29 18:47:18 +01:00
emersion
00e108f2fc
export-dmabuf: correctly finish wlr_linux_dmabuf_attribs 2018-05-29 18:47:18 +01:00
emersion
1377e551ef
Update wlr-export-dmabuf protocol 2018-05-29 18:47:18 +01:00
emersion
e26f4dff98
export-dmabuf: wait for the frame to be ready, send timestamp 2018-05-29 18:47:17 +01:00
emersion
36bd4795d4
export-dmabuf: add basic and incomplete implementation 2018-05-29 18:47:17 +01:00
emersion
9e26808c28
output, backend/drm: add wlr_output_export_dmabuf 2018-05-29 18:45:45 +01:00
emersion
e1f56538a8
Merge pull request #999 from dcz-purism/virtual-keyboard
Support virtual keyboard protocol
2018-05-29 18:22:44 +01:00
Ryan Dwyer
f8a831859f Fix wlr_box_contains_point comparison 2018-05-29 23:05:01 +10:00
Dorota Czaplejewicz
5334ee8bfd virtual-keyboard: add support for the virtual-keyboard-v1 protocol 2018-05-28 10:05:55 +02:00
emersion
47f097e09b
xdg-shell: add wlr_xdg_toplevel_set_tiled 2018-05-27 13:38:06 +01:00
emersion
da504f9253
surface: remove wl_resource_post_event 2018-05-26 19:43:55 +01:00
emersion
e849a68e6e
output: correctly clear screen when fullscreened 2018-05-20 13:44:18 +01:00
Drew DeVault
98088e78df
Merge pull request #977 from emersion/split-xdg-shell
Split xdg-shell into multiple files
2018-05-17 08:14:34 -04:00