Commit Graph

1140 Commits

Author SHA1 Message Date
Alex Maese a803a007fb Address @emersion's comments 2018-12-21 12:20:48 -06:00
Alex Maese f5ea393bca Remove pointer resource from relative pointer 2018-12-21 12:20:48 -06:00
Alex Maese 09bdbf24f4 Removed relative pointers from wlr_seat 2018-12-21 12:20:48 -06:00
Alex Maese f4cf3c0886 Remove wl_client from wlr_relative_pointer_v1 2018-12-21 12:20:48 -06:00
random human 68137dca3f relative_pointer: implementation and code fixes
In particular, modified public creator and destructor function names,
added a display destroy listener, safely extract user data from
resources, send correct time (in usecs) in rootston, etc.
2018-12-21 12:20:48 -06:00
random human fb44ce9fa8 relative_pointer: send frame event to pointer for Xwayland 2018-12-21 12:20:48 -06:00
random human 6fa1777f94 relative_pointer: code formatting fixes 2018-12-21 12:20:48 -06:00
random human d020344675 relative_pointer: implement protocol events
Implement zwp_relative_pointer_v1.relative_motion event, along with some
glue code in wlr_seat_pointer and rootston.
2018-12-21 12:20:48 -06:00
random human ba5b1676df relative_pointer: implement protocol requests
Flesh out the details of the structs, signals, callback functions, and
so on. weston-resizer silently works at this point (no events sent).
2018-12-21 12:20:48 -06:00
random human 3a3d1b6617 relative_pointer: create skeleton and build
Add protocol, header and type files to build. Create skeleton structs,
creator and destroyer, and define implementations.
2018-12-21 12:20:47 -06:00
Ryan Walklin 2a3c62b4d2 [WIP][DONTMERGE]Add support for libinput_switch input devices
These are used primarily by laptops to signal
the state of the lid (open/closed) and tablet
mode if supported, based on ACPI events.
2018-12-15 14:42:35 +11:00
Drew DeVault ef9506b0bc
Merge pull request #1433 from ammen99/fix-layer-shell-unconstrain
xdg-popup: fix wlr_xdg_popup_get_toplevel_coords()
2018-12-12 07:48:21 -05:00
Ilia Bozhinov 07865104e1 xdg-popup: fix wlr_xdg_popup_get_toplevel_coords()
The previous code resulted in a crash when we try to unconstrain a popup
which is part of a layer-shell surface popup tree.

Fixes #1425
2018-12-12 08:51:13 +01:00
emersion c2113decb3
gtk-primary-selection: warn when offering MIME type after set_selection 2018-12-09 12:42:27 +01:00
emersion 8c573bc7c6
gtk-primary-selection: basic serial validation 2018-12-09 12:38:35 +01:00
Ilia Bozhinov 5b1b9657bf types: implement wlr_foreign_toplevel_management_v1 2018-12-08 14:09:30 +01:00
emersion 1256314afe
export-dmabuf-v1: add missing destroy request handler
Also document lists in the header file.
2018-12-06 19:08:28 +01:00
Drew DeVault fdb67ff63b
Merge pull request #1415 from emersion/tablet-seat-leak
tablet-v2: fix wlr_tablet_seat_v2 leak
2018-12-04 18:20:46 -05:00
emersion 3ca7ca5306
tablet-v2: fix wlr_tablet_seat_v2 leak 2018-12-04 20:06:38 +01:00
emersion 5515faa197
xdg-shell: emit xdg_surface destroy when role object is destroyed
Fixes https://github.com/swaywm/wlroots/issues/1407
2018-12-04 13:42:29 +01:00
Drew DeVault 273e110b74
Merge pull request #1403 from emersion/swap-buffers-damage-coords
output: switch swap_buffers damage to output-buffer-local coords
2018-12-02 13:17:24 -05:00
emersion 6aaefad40d
output: switch swap_buffers damage to output-buffer-local coords
This is one more step towards [1]. This gives more freedom to the compositor
wrt. how it handles damage.

[1]: https://github.com/swaywm/wlroots/issues/1363
2018-12-01 10:56:35 +01:00
emersion 9f0720c03a
primary-selection: introduce wlr_primary_selection_source
This is a common interface that can be used for all primary selection
protocols, as discussed in [1]. A new function wlr_seat_set_primary_selection
is added to set the primary selection for all protocols.

The seat now owns again the source, and resets the selection to NULL when
destroyed.

[1]: https://github.com/swaywm/wlroots/issues/1367#issuecomment-442403454
2018-11-29 19:40:28 +01:00
emersion 658b590567
gtk-primary-selection: fix segfault when no focus 2018-11-27 21:09:41 +01:00
emersion bfa7f4ee0d
gtk-primary-selection: use impl pattern for sources 2018-11-27 20:16:55 +01:00
emersion cbe42d1006
gtk-primary-selection: remove offer struct
We don't need it, we can use the device instead.
2018-11-27 19:45:39 +01:00
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
Drew DeVault 05bb440786
Merge pull request #1387 from emersion/rename-gtk-primary-selection
Rename wlr_primary_selection to wlr_gtk_primary_selection
2018-11-26 18:36:23 -05:00
Drew DeVault a2b8d47ff2
Merge pull request #1384 from emersion/data-multiple-devices
data-device: allow multiple devices for the same seat
2018-11-26 18:25:59 -05:00
emersion a5b8ea90d2
surface: fix destroyed subsurfaces handling
wlr_subsurface_from_wlr_surface can return NULL if the wl_surface is still
alive and if the wl_subsurface has been destroyed. Make sure we check for NULL.

Fixes https://github.com/swaywm/sway/issues/3195
2018-11-26 23:17:52 +01:00
emersion 4423f88fac
data-device: never cancel the source when offer is destroyed
The source could be used in another offer.
2018-11-26 12:35:49 +01:00
emersion 5d26da9d15
data-device: allow multiple devices for the same seat
This commit makes it possible for a single client to have multiple data devices
for the same seat. This fixes issues with Firefox.

This mainly removes wlr_data_source.offer. We make sure we create one data
offer per device. We now make the offer inert when the source is destroyed.

Fixes the second half of https://github.com/swaywm/wlroots/issues/1041
2018-11-26 12:35:48 +01:00
emersion 27d1910bec
text-input-v3: remove newline in log message 2018-11-26 12:15:34 +01:00
Drew DeVault 90f1a34d2c
Merge pull request #1375 from emersion/tablet-segfault
tablet-v2: fix segfault on display destroy
2018-11-25 17:30:31 -05:00
Ilia Bozhinov fb5691b6cc output: add wlr_output_preferred_read_format()
The read format is dependent on the output, so we first need to make it
current. This fixes a race condition in wlr-screencopy-v1 where a dmabuf
client would cause EGL_NO_SURFACE to be bound at the time when
screencopy needs to query for the preferred format, causing GL errors.
2018-11-24 10:54:25 +01:00
emersion 811a4d997b
Rename wlr_primary_selection to wlr_gtk_primary_selection 2018-11-23 11:58:56 +01:00
emersion eaafd65a12
gtk-primary-selection: track resources 2018-11-21 11:16:31 +01:00
emersion b9a2e4ba4c
gtk-primary-selection: support multiple devices
When a client was creating multiple data devices for the same seat, we were
only creating one resource. This is a protocol error.

Instead, create one offer per data device.

This commit also makes offers inert when their source is destroyed.

Fixes part of https://github.com/swaywm/wlroots/issues/1041
Supersedes https://github.com/swaywm/wlroots/pull/1113
2018-11-21 11:16:25 +01:00
emersion 1b9ebcf645
output: make wlr_egl flip the damage 2018-11-13 16:55:33 +01:00
emersion ca770995cc
output: add wlr_output_render_software_cursors
Rendering in wlr_output_swap_buffers has unfortunate side-effects.
2018-11-13 16:55:33 +01:00
emersion 57307b7aa7
output: remove wlr_output_set_fullscreen_surface
This wasn't using direct scan-out. Direct scan-out will probably
work differently with @ascent12's work anyway.
2018-11-13 16:55:33 +01:00
emersion 89ec624f81
tablet-v2: fix segfault on display destroy 2018-11-12 20:05:13 +01:00
emersion 95dfbe2962
xdg-shell: don't destroy xdg role state on role destroy
ie. don't destroy surface->toplevel on xdg_toplevel destroy. Instead do this on
xdg_surface destroy.

This allows compositors to add toplevel listeners when the surface appears and
remove them when the surface is destroyed.
2018-11-12 19:37:22 +01:00
Julio Galvan a31fa678e5
Fix compilation error on musl
_XOPEN_SOURCE is needed for the strings.h ffs function on the musl libc implementation
2018-11-09 04:27:06 +00:00
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