Skip to content
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

WindowClone: block close window action on touchpad devices #2210

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/gala.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<issue url="https://github.com/elementary/gala/issues/2170">Don’t show app icons in app window spread</issue>
<issue url="https://github.com/elementary/gala/issues/2171">PiP dragging doesn't start until after mouse is released</issue>
<issue url="https://github.com/elementary/gala/issues/2175">Gala crashes when receiving a notification while switching workspaces</issue>
<issue url="https://github.com/elementary/gala/issues/2199">Swiping in the multitasking view can close applications</issue>
</issues>
</release>

Expand Down
7 changes: 5 additions & 2 deletions lib/DragDropAction.vala
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace Gala {
*
* @param button The button which was pressed
*/
public signal void actor_clicked (uint32 button);
public signal void actor_clicked (uint32 button, Clutter.InputDeviceType device_type);

/**
* The type of the action
Expand Down Expand Up @@ -290,7 +290,10 @@ namespace Gala {

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

if (clicked) {
Expand Down
13 changes: 5 additions & 8 deletions src/Widgets/WindowClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -469,14 +469,11 @@ public class Gala.WindowClone : Clutter.Actor {
destroy ();
}

private void actor_clicked (uint32 button) {
switch (button) {
case Clutter.Button.PRIMARY:
selected ();
break;
case Clutter.Button.MIDDLE:
close_window (display.get_current_time ());
break;
private void actor_clicked (uint32 button, Clutter.InputDeviceType device_type = POINTER_DEVICE) {
if (button == Clutter.Button.PRIMARY) {
selected ();
} else if (button == Clutter.Button.MIDDLE && device_type != TOUCHPAD_DEVICE) {
close_window (display.get_current_time ());
}
}

Expand Down
Loading