Commit graph

5001 commits

Author SHA1 Message Date
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
95ff898512
Merge pull request #1532 from emersion/deprecate-old-protocols
Mark old protocols as obsolete
2019-02-09 22:43:12 +01:00
emersion
6c8eaaef2d
Deprecate old protocols 2019-02-09 19:57:10 +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
Drew DeVault
8cf7aa3bbe
Merge pull request #1530 from emersion/unmap-destroy-popups
xdg-shell: destroy child popups on unmap
2019-02-05 20:24:12 +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
Scott Anderson
b2f56ad4a8
Merge pull request #1526 from VincentVanlaer/cursor-dmabuf
Allow cursor render surface to be used as fb
2019-02-04 21:34:40 +00:00
Vincent Vanlaer
7bc43413ed Allow cursor render surface to be used as fb
In order for a surface to be used as a cursor plane framebuffer, it
appears that requiring the buffer to be linear is sufficient.

GBM_BO_USE_SCANOUT is added in case GBM_BO_USE_LINEAR isn't sufficient
on untested hardware.

Fixes #1323

Removed wlr_drm_plane.cursor_bo as it does not serve any purpose
anymore.

Relevant analysis (taken from the PR description):

While trying to implement a fix for #1323, I found that when exporting
the rendered surface into a DMA-BUF and reimporting it with
`GBM_BO_USE_CURSOR`, the resulting object does not appear to be valid.
After some digging (turning on drm-kms debugging and switching to legacy
mode), I managed to extract the following error: ```
[drm:__setplane_check.isra.1 [drm]] Invalid pixel format AR24
little-endian (0x34325241), modifier 0x100000000000001 ``` The format
itself refers to ARGB8888 which is the same format as
`renderer->gbm_format` used in master to create the cursor bo. However,
using `gbm_bo_create` with `GBM_BO_USE_CURSOR` results in a modifier of
0. A modifier of zero represents a linear buffer while the modifier of
the surface that is rendered to is  `I915_FORMAT_MOD_X_TILED` (see
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/include/uapi/drm/drm_fourcc.h?h=v4.20.6#n263).
In order to fix this mismatch in modifier, I added the
`GBM_BO_USE_LINEAR` to the render surface and everything started to work
just fine. I wondered however, whether the export and import is really
necessary. I then decided to test if the back buffer of the render
surface works as well, and at least on my hardware (Intel HD 530 and
Intel UHD 620) it does. This is the patch in this PR and this requires
no exporting and importing.

I have to note that I cheated in order to import DMA_BUFs into a cursor
bo when doing the first tests, since on import the Intel drivers check
that the cursor is 64x64. This is strange since cursor sizes other than
64x64 have been around for quite some time now
(https://lists.freedesktop.org/archives/mesa-commit/2014-June/050268.html).
Removing this check made everything work fine. I later (while writing
this PR) found out that `__DRI_IMAGE_USE_CURSOR` (to which
`GBM_BO_USE_CURSOR` translates) has been deprecated in mesa
(https://gitlab.freedesktop.org/mesa/mesa/blob/master/include/GL/internal/dri_interface.h#L1296),
which makes me wonder what the usecase of `GBM_BO_USE_CURSOR` is. The
reason we never encountered this is that when specifying
`GBM_BO_USE_WRITE`, a dumb buffer is created trough DRM and the usage
flag never reaches the Intel driver directly. The relevant code is in
https://gitlab.freedesktop.org/mesa/mesa/blob/master/src/gbm/backends/dri/gbm_dri.c#L1011-1089
. From this it seems that as long as the size, format and modifiers are
right, any surface can be used as a cursor.
2019-02-04 20:47:07 +01:00
Connor E
721a810f72 Add build-*/ to gitignore. 2019-02-04 14:37:16 +01:00
Connor E
c1d0729d9a Make popup inert when destroyed. 2019-02-04 10:43:51 +01:00
Scott Anderson
841b4fd918
Merge pull request #1524 from mnussbaum/user-unit-wip
Allow compositors to run as systemd user units
2019-02-04 03:15:15 +00:00
mnussbaum
c138da233b Allow compositors to run as systemd user units
When a wlroots compositor runs as a systemd user unit there is no
session associated with the compositor process. Instead we need to
attach to an active and graphical user session.

This change first looks for an available session for the process, and if
there isn't one falls back to display in the oldest available graphical
session.

This work was modeled after a similar change to mutter -
https://gitlab.gnome.org/GNOME/mutter/merge_requests/150.
2019-02-03 18:45:32 -08:00
emersion
59d1b6790d
Bump project version to 0.3 2019-02-03 15:46:02 +01:00
Drew DeVault
04c9ca4198
Merge pull request #1527 from johnchen902/fix-sway-3545-2
Fix another instance of swaywm/sway#3545.
2019-02-03 09:56:59 +01:00
John Chen
819bd3e344 Fix another instance of swaywm/sway#3545. 2019-02-03 15:11:21 +08: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
Drew DeVault
d2f0efd3f5
Merge pull request #1522 from emersion/logind-no-dup-leak
backend/session/logind: dup FD with CLOEXEC
2019-02-01 09:28:36 +01:00
Drew DeVault
2d65d49c5c
Merge pull request #1518 from emersion/relative-pointer-usec
relative-pointer-v1: time is in usec, not msec
2019-02-01 09:27:20 +01:00
emersion
f1d3aeff9a
data-device: fix crash when setting the same selection twice 2019-01-31 20:33:48 +01:00
emersion
22faddde9e
backend/session/logind: dup FD with CLOEXEC 2019-01-31 16:11:45 +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
Drew DeVault
41af8d8459
Merge pull request #1513 from emersion/fix-dnd
data-device: fix drag-and-drop
2019-01-30 09:36:42 -05:00
emersion
29952dee19
data-device: only allow one drag at a time 2019-01-30 15:24:18 +01:00
emersion
faa00a4a33
rootston: only allow one drag icon per seat 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
Drew DeVault
a37dfb380b
Merge pull request #1515 from emersion/shell-grab-frame
Add missing frame events to shell pointer grabs
2019-01-30 08:58:28 -05:00
emersion
2624f667bf
Add missing frame events to shell pointer grabs 2019-01-30 10:31:53 +01:00
emersion
77c25c1526 meson: remove b_lundef=false on FreeBSD 2019-01-29 21:12:31 +01:00
Drew DeVault
3c243ac208
Merge pull request #1511 from emersion/scan-build-fixes
Fix two issues found with Clang's static analyzer
2019-01-29 14:01:55 -05:00
emersion
7309d8c9ac
Fix two issues found with Clang's static analyzer 2019-01-29 19:56:43 +01:00
Drew DeVault
c6b4153748
Merge pull request #1510 from emersion/libdrm-version
Require libdrm >= 2.4.95
2019-01-29 13:38:51 -05:00
emersion
75371d2c88
Require libdrm >= 2.4.95 2019-01-29 19:33:38 +01:00
Drew DeVault
feb1b9b1cb
Merge pull request #1509 from emersion/gbm-fmt-mismatch
backend/drm: fix GBM format mismatch
2019-01-29 10:39:54 -05:00
emersion
ee293fab58
backend/drm: fix GBM format mismatch
We create the EGL config with GBM_FORMAT_ARGB8888, but then initialize GBM BOs
with GBM_FORMAT_XRGB8888. This mismatch confuses Mesa.

Instead, we can always use GBM_FORMAT_ARGB8888, and use DRM_FORMAT_XRGB8888
when calling drmModeAddFB2.

Fixes https://github.com/swaywm/wlroots/issues/1438
2019-01-29 12:04:12 +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
Drew DeVault
89eacf556a
Merge pull request #1505 from emersion/data-control-unset
data-control-v1: handle NULL sources in set_selection
2019-01-27 10:20:02 -05:00
Yong Joseph Bakos
0772c20c7f tinywl/README: Fix misspelling. 2019-01-27 11:10:34 +01:00
emersion
5fdf22b5d3
data-control-v1: handle NULL sources in set_selection 2019-01-26 11:25:39 +01:00
emersion
b45fc24b18
backend/wayland: handle wl_pointer.axis_stop 2019-01-26 11:18:47 +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
Drew DeVault
209210d307
Merge pull request #1498 from emersion/editorconfig-indent-size
Set .editorconfig ident_size
2019-01-25 08:22:27 -05:00
emersion
42b19dcf91
Set .editorconfig ident_size 2019-01-25 11:37:46 +01:00
Drew DeVault
460a630a43
Merge pull request #1427 from emersion/refactor-data-device
Refactor data-device
2019-01-24 09:48:26 -05:00
Drew DeVault
b1731134e2
Merge pull request #1494 from emersion/wayland-protocols-text-input
text-input-v3: use protocol from wayland-protocols
2019-01-24 09:38:11 -05:00