Use ClickAction for FramedBackground and close buttons (#1579)

This commit is contained in:
Leo 2023-03-22 22:02:11 +09:00 committed by GitHub
parent 97b33173e2
commit 79453b324d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 9 deletions

View File

@ -111,7 +111,7 @@ namespace Gala {
// block propagation of button presses on the close button, otherwise
// the click action on the icon group will act weirdly
close_button.button_press_event.connect (() => { return Gdk.EVENT_STOP; });
close_button.button_release_event.connect (() => { return Gdk.EVENT_STOP; });
add_child (close_button);

View File

@ -119,12 +119,15 @@ public class Gala.WindowClone : Clutter.Actor {
add_action (drag_action);
}
var close_button_action = new Clutter.ClickAction ();
close_button_action.clicked.connect (() => {
close_window ();
});
close_button = Utils.create_close_button ();
close_button.opacity = 0;
close_button.button_press_event.connect (() => {
close_window ();
return Gdk.EVENT_STOP;
});
// block propagation of button release event to window clone
close_button.button_release_event.connect (() => { return Gdk.EVENT_STOP; });
close_button.add_action (close_button_action);
var scale_factor = InternalUtils.get_ui_scaling_factor ();

View File

@ -40,6 +40,8 @@ namespace Gala {
css_class = "workspace"
};
add_effect (effect);
reactive = true;
}
public override void paint (Clutter.PaintContext context) {
@ -170,12 +172,12 @@ namespace Gala {
unowned Meta.Display display = workspace.get_display ();
var monitor_geometry = display.get_monitor_geometry (display.get_primary_monitor ());
background = new FramedBackground (display);
background.reactive = true;
background.button_release_event.connect (() => {
var background_click_action = new Clutter.ClickAction ();
background_click_action.clicked.connect (() => {
selected (true);
return Gdk.EVENT_PROPAGATE;
});
background = new FramedBackground (display);
background.add_action (background_click_action);
window_container = new WindowCloneContainer (wm, gesture_tracker);
window_container.window_selected.connect ((w) => { window_selected (w); });