Commit graph

1096 commits

Author SHA1 Message Date
emersion
2d0c5ec78e
Use _POSIX_C_SOURCE, use shm_open 2018-11-06 08:29:23 +01:00
Drew DeVault
d7b010024a
Merge pull request #1261 from arandomhuman/damage-control
Fix damage tracking for surfaces with transforms
2018-11-04 14:31:17 +01:00
emersion
dec303bea6
surface: fix wlr_surface_get_effective_damage to give surface coords
Transforms were applied, but scale wasn't.
2018-11-04 11:13:10 +01:00
emersion
62d646f2b8
render/gles2: remove assumptions about supported formats
We were assuming GL_BGRA_EXT was always supported.

We now check that it's supported for rendering. We fail if it isn't because
this format is specified as "always supported" by the Wayland protocol.

We also check if it's supported for reading pixels. A new preferred_read_format
function returns the preferred format that can be used to read pixels. This is
used by the screencopy protocol.
2018-11-04 09:00:51 +01:00
emersion
68362b37a8
backend/drm: fix frame scheduling on secondary GPUs
There was a missing copy_drm_surface_mgpu call in drm_connector_schedule_frame
so we asked for a pageflip with an unknown BO, resulting in ENOENT.

Additionally, this commit makes schedule_frame return a bool indicating
failures. This allows schedule_frame_handle_idle_timer to only set
frame_pending to true if a frame has been successfully scheduled. Thus, if a
pageflip fails, rendering won't be blocked forever anymore.

In case a pageflip is already pending, true is returned because a frame has
already been scheduled and will be sent sometime soon.
2018-10-29 20:38:57 +01:00
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
random human
3e0a0f3c3a
wlr_surface: add wlr_surface_get_effective_damage
This calculates and returns the effective damage of the surface in
surface coordinates, including the client damage (in buffer
coordinates), and damage induced by resize or move events.
2018-10-04 02:19:09 +05:30
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
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