Commit graph

1086 commits

Author SHA1 Message Date
emersion
346ec21c4c
util: use shm_open for in-memory files
shm_open is a POSIX function creating an in-memory file. Using it simplifies
the code and removes the dependency on XDG_RUNTIME_DIR. The only downside is
that we need to generate a random name for the shm file.
2018-10-28 22:39:54 +01:00
Drew DeVault
f668e49fae
Merge pull request #1340 from emersion/fix-input-method-destroy
input-method-v2: initialize destroy signal
2018-10-28 12:56:53 +01:00
emersion
de8d87f5ae
input-method-v2: initialize destroy signal 2018-10-28 12:23:47 +01:00
emersion
3cb4ff3ff1
idle: allow zero timeout
Prior to this commit, setting up a zero timeout resulted in a timer that never
expires, which isn't particularly useful.

This commit allows setting up timers that expire immediately, which is useful
to immediately enter idle state.
2018-10-28 09:22:12 +01:00
Drew DeVault
6c7e0e48b1
Merge pull request #1289 from ixru/fix-cursor-visibility
Fix cursor visibility on surface commit
2018-10-21 19:19:02 +02:00
Drew DeVault
e0cf97da69
Merge pull request #1307 from emersion/static-analysis
Fix a few bugs found by the static analyzer
2018-10-21 19:18:39 +02:00
emersion
dfdbc1f870
output-layout, cursor: fix duplicate cursors
wlr_cursor: make sure the output doesn't have a cursor before
creating a new one

wlr_output_layout: don't emit the "add" event when the output is
already in the layout
2018-10-19 14:50:35 +02:00
Drew DeVault
ac26d23711
Merge pull request #1287 from emersion/source-seat-client
data-device: remove wlr_data_source.seat_client
2018-10-19 14:18:05 +02:00
emersion
6730f5ba93
Merge pull request #1314 from nyorain/write_pixels_format
Remove fmt parameter from wlr_texture_write_pixels
2018-10-19 14:04:27 +02:00
Dorota Czaplejewicz
14c6ee894e text-input: Don't reject enable requests when unfocused
The prevoius implementation would always raise an error in the following sequence:

-> enter
-> leave
<- enable

The text-input type is not equipped to manage the validity of clents' requests, which should be handled in the compositor, as rootston does.
2018-10-17 15:34:41 +00:00
nyorain
cd28637187 Remove fmt parameter from wlr_texture_write_pixels
It's not allowed to change the format of a texture so remove
the confusing parameter.
2018-10-15 23:56:56 +02:00
Drew DeVault
e4a1560433
Merge pull request #1304 from nyorain/dmabuf_v1
Support older wlr_linux_dmabuf_v1 clients
2018-10-13 15:12:40 +02:00
emersion
a9e02a9ea6 tablet-v2: fix memory leak on OOM, fix resource version 2018-10-13 11:01:38 +02:00
nyorain
affbfb6a28 Support older wlr_linux_dmabuf_v1 clients
If a client uses an older version of the dmabuf protocol, use the
`formats` event instead of `modifiers` (since that didn't exist in older
versions).
With a bit of necessary guessing, support dmabuf importing even when
EGL_EXT_image_dma_buf_import_modifiers isn't present instead of
failing up front.
2018-10-12 23:07:45 +02:00
Dorota Czaplejewicz
226eedfa2b text-input: fix releasing destroy handlers 2018-10-12 20:09:11 +00:00
Drew DeVault
66e8908e9a
Merge pull request #1203 from dcz-purism/input
Support input method and text input
2018-10-12 13:44:46 +02:00
Dorota Czaplejewicz
cec7471119 wlroots: add basic support for zwp_input_method_v2
Implemented basic input method functionality. Not included: popups, grabbing.
2018-10-09 09:56:46 +00:00
Dorota Czaplejewicz
427735fcd9 wlroots: add support for zwp_text_input_unstable_v3 2018-10-09 09:56:11 +00:00
emersion
46b1ba386f output: remove idle_frame event source when destroying output
This prevents the idle event to be activated on a destroyed
output.

This also makes the backend responsible for free-ing modes, as it
is the one allocating them and adding them to the list. Note that
the DRM backend (the only one using modes) already frees them.
2018-10-09 10:55:03 +02:00
ixru
8d0997a5e7 Better placement of visibility check 2018-10-08 15:58:24 +02:00
ixru
6a9995d18c Fix cursor visibility on surface commit 2018-10-07 21:26:38 +02:00
emersion
f44003f04b data-device: remove wlr_data_source.seat_client
Since the source doesn't always come from a client, this field
doesn't make sense. It is replaced by a new "finalized" field in
wlr_client_data_source. This is used to make sure set_actions is
not sent after start_drag has been sent.

A check in data_offer_choose_action has been removed: if an offer
has been sent then start_drag has been called, no need to check.

I also wanted to add a check for wl_data_source.offer, but it
turns out (1) this isn't in the spec (2) it breaks GTK+.

This is some preliminary work for Firefox on Wayland compatibility.
2018-10-07 16:01:57 +02:00
emersion
5afaccedfc output: fix busy loop when backend doesn't implement schedule_frame 2018-10-05 16:26:40 +02:00
emersion
ba91422747 output: don't trigger a frame immediately in schedule_frame
This desynchronizes our rendering loop with the vblank cycle.

In case a compositor doesn't swap buffers but schedules a frame,
emitting a frame event immediately enters a busy-loop.

Instead, ask the backend to send a frame when appropriate. On
Wayland we can just register a frame callback on our surface. On
DRM we can do a no-op pageflip.

Fixes #617
Fixes swaywm/sway#2748
2018-10-05 16:18:37 +02:00
Drew DeVault
1e70b4cea2
Revert "Prevent excessive frame events when compositor doesn't swap buffers" 2018-10-05 07:37:41 -04:00
Ryan Dwyer
b7b781ff44 Prevent excessive frame events when compositor doesn't swap buffers
When we send an output frame event, we should not assume that the
compositor is going to call wlr_output_swap_buffers in response to it.
If the compositor does not swap the buffers, the idle event source still
exists and is executed every time the Wayland event loop becomes idle,
which means we send frame events repeatedly until the buffers are
swapped.

This moves the removal of the idle event source out of
wlr_output_swap_buffers and into wlr_output_send_frame, where it is
guaranteed to be removed.
2018-10-05 20:14:34 +10:00
emersion
eac7c2ad2f output: add presentation refresh prediction 2018-10-04 22:00:24 +02:00
emersion
b0635bf3e7 Rename get_present_clock to get_presentation clock, use it 2018-10-04 22:00:22 +02:00
emersion
abddfc99f2 output: fix clock_gettime return value handling 2018-10-04 21:58:17 +02:00
emersion
54e1287f30 backend: add get_present_clock 2018-10-04 21:58:17 +02:00
emersion
26b9d6dbb1 output: send present event from all backends 2018-10-04 21:56:38 +02:00
emersion
78389fe722 output: add present event 2018-10-04 21:56:38 +02:00
emersion
3aad9fd6a9 presentation-time: add protocol implementation 2018-10-04 21:55:31 +02:00
emersion
2beb68007e output: make gamma size a size_t and gamma table const 2018-10-03 10:36:33 +02:00
Emmanuel Gil Peyrot
130bf15cfa Fix a crash on zxdg_decoration_manager_v1 destroy
When this request was called from a client, the unimplemented callback
was NULL and thus was crashing rootston.
2018-10-01 14:45:17 +02:00
emersion
f5ff702a69 gamma-control-v1: add missing destroy handler 2018-09-29 14:30:41 +02:00
Drew DeVault
5e9959daaa
Merge pull request #852 from Laaas/master
Implement pointer-constraints-unstable-v1 protocol
2018-09-27 05:57:43 -05:00
emersion
fadbdcd13c seat: remove unused keyboard focus_change event 2018-09-27 12:21:30 +02:00
emersion
d98181dab8 pointer-constraints: use proper wayland-scanner functions 2018-09-27 10:53:11 +02:00
emersion
dac4f8e19f pointer-constraints: refactoring
* Rename the constraint_create signal to new_constraint for
  consistency
* Move the constraint_destroy signal to the constraint itself
* Use rotate_child_position instead of duplicating logic
* Fix inert constraint resource handling
* Style fixes
2018-09-27 10:25:59 +02:00
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
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