Commit Graph

1212 Commits

Author SHA1 Message Date
Drew DeVault ea28887a23
Merge pull request #1493 from emersion/primary-selection-v1
primary-selection-v1: copy from gtk-primary-selection
2019-02-19 08:59:20 -05:00
Markus Ongyerth fc9838b15e Prevent NULL dereference in tablet_tool handler
In case a tool was removed, but not yet destroyed by the client, the
tool_client's tool can be NULL. We have to check that as well in the
set_cursor handler to prevent using inert resources
2019-02-19 08:51:10 +01:00
Drew DeVault b455df3b91
Merge pull request #1557 from emersion/inert-offers
data-device: make old offers inert before sending selection
2019-02-18 15:27:09 -05:00
emersion 07e1bedb08
data-device: make old offers inert before sending selection
Fixes https://github.com/swaywm/wlroots/issues/1383
2019-02-18 16:36:23 +01:00
emersion 81ed1efe4f
xwayland, data-device: fix surface state on unmap
This commit makes sure surface->mapped is true when the unmapped event is
emitted. This is necessary because listeners can only damage surfaces that are
mapped. This is similar to the fact that the destroy event is emitted before
any destruction is actually made.

Fixes https://github.com/swaywm/sway/issues/3568
2019-02-18 13:14:35 +01:00
emersion 943e918a96
subsurface: add map/unmap events
Fixes https://github.com/swaywm/wlroots/issues/1414
2019-02-17 12:01:15 +01:00
Brian Ashworth 3c9f791d0e wlr_output: do not modeset to current mode
There is no point in modesetting an output to a mode that it is already
set to. Modesetting will cause the output to briefly flicker which is
undesirable for a noop. This prevents modesetting any wlr_output,
regardless of the backend, to it's currently set mode.
2019-02-17 00:12:59 +01:00
Drew DeVault 8b203c28f8
Merge pull request #1548 from emersion/error-invalid-transform
surface: error out on invalid transform
2019-02-15 15:28:00 +01:00
Ivan Molodetskikh b59370088e Update data-control 2019-02-15 11:58:33 +01:00
emersion d238cc9f56
surface: error out on invalid transform 2019-02-15 00:50:18 +01:00
Sebastian Krzyszkowiak 69b9e2ae8f Post protocol error on invalid wl_surface scale
Letting the scale be set to 0 causes division by zero errors.
2019-02-15 00:45:12 +01:00
emersion 8163f7e1e2
primary-selection-v1: copy from gtk-primary-selection 2019-02-13 19:28:25 +01:00
Geoff Greer 5c8d2da0a1 Add a wlr_output_set_subpixel()
drmModeConnector.subpixel doesn't seem to detect subpixel order on many displays (especially laptops). Allow subpixel order to be manually set.

The corresponding PR for sway adds a subpixel output option: https://github.com/swaywm/sway/pull/3645

Once both are merged, https://github.com/swaywm/sway/issues/3163 will be fixed.
2019-02-13 19:20:29 +01:00
Ivan Molodetskikh 9e49ceb129 data-control: add primary selection support
data-control: separate out a data_offer struct

This is a prerequisite to adding primary selection support.

data-control: separate out data_control_source

This is a prerequisite to adding primary selection support, since that
doesn't use wlr_data_source, but rather wlr_primary_selection_source.

Update the data-control protocol

data-control: add primary selection support

Merge create_offer and create_primary_offer

Extract code into data_control_source_destroy()

Fix pointer style

Move resource neutralization to destructor

Store wl_resource in the data_offer

Extract data_offer destruction into a function
2019-02-10 17:12:05 +01:00
Drew DeVault 20d404a091
Merge pull request #1529 from emersion/better-dnd-fix
data-device: destroy previous source when starting drag
2019-02-06 14:39:55 +01:00
emersion 7f5967234c
xdg-shell: destroy child popups on unmap
It doesn't make sense to keep popups opened when unmapped. We also need to do
so in wlr_xdg_popup_destroy so that popups are destroyed in the correct order.
2019-02-05 19:29:00 +01:00
emersion 556bf3ac31
data-device: destroy previous source when starting drag
This supersedes f24e17259e and
04c9ca4198. These commits were manually removing
wlr_data_source destroy handlers when starting a new drag. This is error-prone.

Instead, this commit destroys the previous source whenever we start a new drag.
2019-02-05 18:43:06 +01:00
Connor E c1d0729d9a Make popup inert when destroyed. 2019-02-04 10:43:51 +01:00
John Chen f24e17259e Fix swaywm/sway#3545. 2019-02-02 14:05:31 +01:00
Drew DeVault 28f11aec31
Merge pull request #1523 from emersion/set-same-selection-crash
data-device: fix crash when setting the same selection twice
2019-02-01 09:41:02 +01:00
Drew DeVault 16a93eddfb
Merge pull request #1519 from emersion/dedup-source-mime-type
De-duplicate data source MIME types
2019-02-01 09:40:47 +01:00
emersion f1d3aeff9a
data-device: fix crash when setting the same selection twice 2019-01-31 20:33:48 +01:00
emersion 790f0c52a1
De-duplicate data source MIME types 2019-01-30 22:10:52 +01:00
emersion 7defb30781
relative-pointer-v1: time is in usec, not msec 2019-01-30 21:25:42 +01:00
emersion 29952dee19
data-device: only allow one drag at a time 2019-01-30 15:24:18 +01:00
emersion d6de329d98
seat: don't send motion if pointer hasn't moved 2019-01-30 15:24:17 +01:00
emersion c505ce3019
data-device: fix use-after-free on drop 2019-01-30 15:24:14 +01:00
emersion 2624f667bf
Add missing frame events to shell pointer grabs 2019-01-30 10:31:53 +01:00
emersion 75371d2c88
Require libdrm >= 2.4.95 2019-01-29 19:33:38 +01:00
Greg V 9fe8e37961 Implement the pointer-gestures-unstable-v1 protocol
This protocol relays touchpad gesture events produced by libinput to
supporting clients (e.g. Evince, Eye of GNOME).
2019-01-28 22:06:36 +01:00
Drew DeVault 018727b1fc
Merge pull request #1503 from emersion/pointer-frame
pointer: add a frame event
2019-01-27 10:22:06 -05:00
emersion 5fdf22b5d3
data-control-v1: handle NULL sources in set_selection 2019-01-26 11:25:39 +01:00
emersion 5de26ad8ed
pointer: add a frame event
Frame events group logically connected pointer events. It makes sense to make
the backend responsible for sending frame events, since once the events are
split (ie. once the frame events are stripped) it's not easy to figure out
which events belongs to which frame again.

This is also how Weston handles frame events.

Fixes https://github.com/swaywm/wlroots/issues/1468
2019-01-26 11:04:05 +01:00
emersion a1f9d7ad9e
data-device: keep track of wlr_data_offer in wlr_seat lists 2019-01-24 12:18:41 +01:00
emersion 909b3b16f3
data-device: add wlr_data_offer.type 2019-01-24 12:18:40 +01:00
emersion 3f82eb1853
data-device: make device inert when seat is destroyed 2019-01-24 12:18:39 +01:00
emersion 9d6cb85b2d
seat: simplify data source destroy 2019-01-24 12:18:00 +01:00
emersion c20d413f8a
data-device: fix missing listener removal 2019-01-24 12:18:00 +01:00
emersion 703a160078
data-control-v1: use new wlr_data_source API 2019-01-24 12:15:18 +01:00
emersion 0040f7089f
data-device: unexport wlr_seat_client_send_selection 2019-01-24 12:15:18 +01:00
emersion 1a2727cc38
data-device: send offer on get_data_device 2019-01-24 12:12:55 +01:00
emersion 84f278eca1
data-device: remove data_source_send_offer 2019-01-24 12:12:55 +01:00
emersion 1150ff13ce
data-device: make sources inert, rename cancel to destroy 2019-01-24 12:12:55 +01:00
emersion 4cb0697e57 data-device, primary-selection: add request_set_selection
This makes compositors able to block and/or customize set_selection requests
coming from clients. For instance, it's possible for a compositor to disable
rich selection content (by removing all MIME types except text/plain). This
commit implements the design proposed in [1].

Two new events are added to wlr_seat: request_set_selection and
request_set_primary_selection. Compositors need to listen to these events and
either destroy the source or effectively set the selection.

Fixes https://github.com/swaywm/wlroots/issues/1138

[1]: https://github.com/swaywm/wlroots/issues/1367#issuecomment-442403454
2019-01-24 11:38:23 +01:00
Ian Fan c41d01306d wlr_xdg_output_v1: move where name & description are sent 2019-01-22 22:58:52 +01:00
Brian Ashworth f3ff40a0eb wlr_xdg_output_v1: only send name/description once
The xdg-output protocol states that name and description should only be
sent once per output since they do not change.
2019-01-22 21:53:33 +01:00
emersion 365a75139c
Merge pull request #1485 from emersion/data-device-serial
primary-selection: add a serial argument
2019-01-22 20:13:01 +01:00
Ilya Trukhanov c4ce3d0a49 Check if client understands wl_pointer::frame
Fixes a crash in SDL2 applications when using locked pointer.

SDL2 expects a wl_pointer v1 interface and doesn't provide a handler for
the wl_pointer::frame event. This results in a "listener function for
opcode 5 of wl_pointer is NULL" abort in wayland-client.

Tested on Xonotic v0.8.2 with libSDL2 v2.0.9. Xonotic needs to be ran
with "SDL_VIDEODRIVER=wayland xonotic-sdl" for SDL2 to use the wayland
backend.
2019-01-22 19:50:01 +02:00
emersion 06467d2e12
primary-selection: add a serial argument
The serial needs to be bumped when X11 clients set the selection, otherwise
some Wayland clients (e.g. GTK) will overwrite it when they gain focus.
2019-01-21 19:23:40 +01:00
emersion a4eb90315e
Fix indentation in various files 2019-01-21 17:56:19 +01:00