Skip to content

Commit 6102754

Browse files
authored
WindowClone: allow close window action on mice only (#2210)
1 parent 540ef8c commit 6102754

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

data/gala.metainfo.xml.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<issue url="https://github.com/elementary/gala/issues/2170">Don’t show app icons in app window spread</issue>
5656
<issue url="https://github.com/elementary/gala/issues/2171">PiP dragging doesn't start until after mouse is released</issue>
5757
<issue url="https://github.com/elementary/gala/issues/2175">Gala crashes when receiving a notification while switching workspaces</issue>
58+
<issue url="https://github.com/elementary/gala/issues/2199">Swiping in the multitasking view can close applications</issue>
5859
</issues>
5960
</release>
6061

lib/DragDropAction.vala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace Gala {
7474
*
7575
* @param button The button which was pressed
7676
*/
77-
public signal void actor_clicked (uint32 button);
77+
public signal void actor_clicked (uint32 button, Clutter.InputDeviceType device_type);
7878

7979
/**
8080
* The type of the action
@@ -290,7 +290,10 @@ namespace Gala {
290290

291291
// release has happened within bounds of actor
292292
if (clicked && x < ex && x + actor.width > ex && y < ey && y + actor.height > ey) {
293-
actor_clicked (event.get_type () == BUTTON_RELEASE ? event.get_button () : Clutter.Button.PRIMARY);
293+
actor_clicked (
294+
event.get_type () == BUTTON_RELEASE ? event.get_button () : Clutter.Button.PRIMARY,
295+
event.get_source_device ().get_device_type ()
296+
);
294297
}
295298

296299
if (clicked) {

src/Widgets/MultitaskingView/WindowClone.vala

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -413,14 +413,11 @@ public class Gala.WindowClone : ActorTarget {
413413
destroy ();
414414
}
415415

416-
private void actor_clicked (uint32 button) {
417-
switch (button) {
418-
case Clutter.Button.PRIMARY:
419-
selected ();
420-
break;
421-
case Clutter.Button.MIDDLE:
422-
close_window (display.get_current_time ());
423-
break;
416+
private void actor_clicked (uint32 button, Clutter.InputDeviceType device_type = POINTER_DEVICE) {
417+
if (button == Clutter.Button.PRIMARY) {
418+
selected ();
419+
} else if (button == Clutter.Button.MIDDLE && device_type == POINTER_DEVICE) {
420+
close_window (display.get_current_time ());
424421
}
425422
}
426423

0 commit comments

Comments
 (0)