mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-14 08:22:25 -04:00
Merge branch 'github/fork/Geo25rey/cursor_is_attached' into 'master'
wlr_cursor: add wlr_cursor_is_input_device_attached to wlr_cursor See merge request wlroots/wlroots!2403
This commit is contained in:
commit
7836e0d069
2 changed files with 23 additions and 5 deletions
|
|
@ -1088,6 +1088,20 @@ static struct wlr_cursor_device *cursor_device_create(
|
|||
return c_device;
|
||||
}
|
||||
|
||||
bool wlr_cursor_is_input_device_attached(struct wlr_cursor *cur,
|
||||
struct wlr_input_device *dev) {
|
||||
if (!cur || !dev) {
|
||||
return false;
|
||||
}
|
||||
struct wlr_cursor_device *_dev;
|
||||
wl_list_for_each(_dev, &cur->state->devices, link) {
|
||||
if (_dev->device == dev) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void wlr_cursor_attach_input_device(struct wlr_cursor *cur,
|
||||
struct wlr_input_device *dev) {
|
||||
switch (dev->type) {
|
||||
|
|
@ -1102,11 +1116,8 @@ void wlr_cursor_attach_input_device(struct wlr_cursor *cur,
|
|||
}
|
||||
|
||||
// make sure it is not already attached
|
||||
struct wlr_cursor_device *_dev;
|
||||
wl_list_for_each(_dev, &cur->state->devices, link) {
|
||||
if (_dev->device == dev) {
|
||||
return;
|
||||
}
|
||||
if (wlr_cursor_is_input_device_attached(cur, dev)) {
|
||||
return;
|
||||
}
|
||||
|
||||
cursor_device_create(cur, dev);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue