-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass gesture events to clients #4794
Conversation
Some wayland clients (mostly GTK3 apps) like eog or evince support gestures like pinch-to-zoom. These gestures are given to clients via the pointer_gestures_v1 protocol. This is already supported in wlroots, so we just need to hook up the events here in sway. Fixes swaywm#4724
Thanks! This doesn't effect touch gestures, which are a different animal entirely. |
@@ -825,6 +879,20 @@ struct sway_cursor *sway_cursor_create(struct sway_seat *seat) { | |||
cursor->hide_source = wl_event_loop_add_timer(server.wl_event_loop, | |||
hide_notify, cursor); | |||
|
|||
cursor->pointer_gestures = wlr_pointer_gestures_v1_create(server.wl_display); | |||
cursor->pinch_begin.notify = handle_pointer_pinch_begin; | |||
wl_signal_add(&wlr_cursor->events.pinch_begin, &cursor->pinch_begin); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These listeners are not removed when the cursor is destroyed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry about that. I made a change to correct this, although since the pull request was merged already I'm not sure what the best path to fixing this is.
Also on a sidenote, wlr_pointer_gestures_v1
doesn't have a destroy or free function. It seems it handles destroying itself when the display is destroyed. Is this something worth worrying about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry about that. I made a change to correct this, although since the pull request was merged already I'm not sure what the best path to fixing this is.
If you could submit a new PR to fix this, that would be great.
Also on a sidenote, wlr_pointer_gestures_v1 doesn't have a destroy or free function. It seems it handles destroying itself when the display is destroyed. Is this something worth worrying about?
Yeah, wlr_pointer_gestures_v1 is destroyed when the display is. It should be fine.
Part of swaywm#4794. Forgot to remove gesture listeners when the cursor is destroyed.
Part of #4794. Forgot to remove gesture listeners when the cursor is destroyed.
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Still we opt to export the event to the user because it simplifies processing and may be of actual benefit to some unforeseen usecase. Test plan: - add workspace switching to config like so: bindsym --whole-window --release SWIPE_LEFT workspace prev_on_output bindsym --whole-window --release SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Still we opt to export the event to the user because it simplifies processing and may be of actual benefit to some unforeseen usecase. Test plan: - add workspace switching to config like so: bindsym --whole-window --release SWIPE_LEFT workspace prev_on_output bindsym --whole-window --release SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Still we opt to export the event to the user because it simplifies processing and may be of actual benefit to some unforeseen usecase. Test plan: - add workspace switching to config like so: bindsym --whole-window --release SWIPE_LEFT workspace prev_on_output bindsym --whole-window --release SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Still we opt to export the event to the user because it simplifies processing and may be of actual benefit to some unforeseen usecase. Test plan: - add workspace switching to config like so: bindsym --whole-window --release SWIPE_LEFT workspace prev_on_output bindsym --whole-window --release SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Still we opt to export the event to the user because it simplifies processing and may be of actual benefit to some unforeseen usecase. Test plan: - add workspace switching to config like so: bindsym --whole-window --release SWIPE_LEFT workspace prev_on_output bindsym --whole-window --release SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Still we opt to export the event to the user because it simplifies processing and may be of actual benefit to some unforeseen usecase. Test plan: - add workspace switching to config like so: bindsym --whole-window --release SWIPE_LEFT workspace prev_on_output bindsym --whole-window --release SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Still we opt to export the event to the user because it simplifies processing and may be of actual benefit to some unforeseen usecase. Test plan: - add workspace switching to config like so: bindsym --whole-window --release SWIPE_LEFT workspace prev_on_output bindsym --whole-window --release SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Still we opt to export the event to the user because it simplifies processing and may be of actual benefit to some unforeseen usecase. Test plan: - add workspace switching to config like so: bindsym --whole-window --release SWIPE_LEFT workspace prev_on_output bindsym --whole-window --release SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Still we opt to export the event to the user because it simplifies processing and may be of actual benefit to some unforeseen usecase. Test plan: - add workspace switching to config like so: bindsym --whole-window --release SWIPE_LEFT workspace prev_on_output bindsym --whole-window --release SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Therefore we can only execute bindings on release. Test plan: - add workspace switching to config like so: bindsym --whole-window SWIPE_LEFT workspace prev_on_output bindsym --whole-window SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Therefore we can only execute bindings on release. Test plan: - add workspace switching to config like so: bindsym --whole-window SWIPE_LEFT workspace prev_on_output bindsym --whole-window SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Therefore we can only execute bindings on release. Test plan: - add workspace switching to config like so: bindsym --whole-window SWIPE_LEFT workspace prev_on_output bindsym --whole-window SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Therefore we can only execute bindings on release. Test plan: - add workspace switching to config like so: bindsym --whole-window SWIPE_LEFT workspace prev_on_output bindsym --whole-window SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Therefore we can only execute bindings on release. Test plan: - add workspace switching to config like so: bindsym --whole-window SWIPE_LEFT workspace prev_on_output bindsym --whole-window SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Therefore we can only execute bindings on release. Test plan: - add workspace switching to config like so: bindsym --whole-window SWIPE_LEFT workspace prev_on_output bindsym --whole-window SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Therefore we can only execute bindings on release. Test plan: - add workspace switching to config like so: bindsym --whole-window SWIPE_LEFT workspace prev_on_output bindsym --whole-window SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Therefore we can only execute bindings on release. Test plan: - add workspace switching to config like so: bindsym --whole-window SWIPE_LEFT workspace prev_on_output bindsym --whole-window SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Therefore we can only execute bindings on release. Test plan: - add workspace switching to config like so: bindsym --whole-window SWIPE_LEFT workspace prev_on_output bindsym --whole-window SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Passing of gesture events added in swaywm#4794 allows to use them in clients but not in sway itself, for example to switch workspaces using three-finger swipes. Add support for binding four basic directional swipes to arbitrary sway commands. Add the necessary handling to default seatops to execute them at the beginning or end of a swipe gesture. This for now responds to all swipes, ignoring the number of fingers used. The former throws up the intrinsic conundrum that we can not know the kind of swipe that's going to happen because it can change all through its lifecylce. Therefore we can only execute bindings on release. Test plan: - add workspace switching to config like so: bindsym --whole-window SWIPE_LEFT workspace prev_on_output bindsym --whole-window SWIPE_RIGHT workspace next_on_output - start sway and open two workspaces - switch back and forth using horizontal three-finger swipes, observing that vertical swipes won't Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Fixes #4724.
This change can be tested quite easily if you use a backend which supports gestures (i.e. libinput). Open evince and your favourite pdf and you shall now see that pinch-to-zoom works properly. Prior to this, pinch-to-zoom would not do anything since the pinch and swipe events generated by the libinput backend are not handled anywhere (i.e. passed to the active client).
I'm not too sure how this will affect #1904 but I think there shouldn't be a huge change, as this change is solely passing pointer gestures to clients, rather than detecting a configurable gesture and executing a sway routine.