mirror of
https://github.com/elementary/gala.git
synced 2024-11-24 04:21:04 +03:00
make sure close button on icon groups is hidden when the cursor leaves the actor during a click
This commit is contained in:
parent
87204bfd8e
commit
9bc51fc694
@ -275,6 +275,12 @@ namespace Gala
|
||||
|
||||
var click = new ClickAction ();
|
||||
click.clicked.connect (() => selected ());
|
||||
// when the actor is pressed, the ClickAction grabs all events, so we won't be
|
||||
// notified when the cursor leaves the actor, which makes our close button stay
|
||||
// forever. To fix this we hide the button for as long as the actor is pressed.
|
||||
click.notify["pressed"].connect (() => {
|
||||
toggle_close_button (!click.pressed && get_has_pointer ());
|
||||
});
|
||||
add_action (click);
|
||||
|
||||
icon_container = new Actor ();
|
||||
@ -318,14 +324,25 @@ namespace Gala
|
||||
if (!Prefs.get_dynamic_workspaces () || icon_container.get_n_children () < 1)
|
||||
return false;
|
||||
|
||||
close_button.visible = true;
|
||||
close_button.opacity = 255;
|
||||
toggle_close_button (true);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool leave_event (CrossingEvent event)
|
||||
{
|
||||
toggle_close_button (false);
|
||||
return false;
|
||||
}
|
||||
|
||||
void toggle_close_button (bool show)
|
||||
{
|
||||
if (show) {
|
||||
close_button.visible = true;
|
||||
close_button.opacity = 255;
|
||||
return;
|
||||
}
|
||||
|
||||
close_button.opacity = 0;
|
||||
var transition = get_transition ("opacity");
|
||||
if (transition != null)
|
||||
@ -334,8 +351,6 @@ namespace Gala
|
||||
});
|
||||
else
|
||||
close_button.visible = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user