mirror of
https://github.com/elementary/gala.git
synced 2024-12-18 06:41:36 +03:00
Hide workspace view when clicked outside it
This commit is contained in:
parent
c2d119c544
commit
ca2f2eb07d
@ -29,6 +29,7 @@ namespace Gala
|
||||
Clutter.Actor thumbnails;
|
||||
Clutter.CairoTexture background;
|
||||
Clutter.CairoTexture scroll;
|
||||
Clutter.Actor click_catcher; //invisible plane that catches clicks outside the view
|
||||
|
||||
bool animating; // delay closing the popup
|
||||
|
||||
@ -61,6 +62,14 @@ namespace Gala
|
||||
scroll.auto_resize = true;
|
||||
scroll.draw.connect (draw_scroll);
|
||||
|
||||
click_catcher = new Clutter.Actor ();
|
||||
click_catcher.reactive = true;
|
||||
click_catcher.button_release_event.connect ((e) => {
|
||||
hide ();
|
||||
return true;
|
||||
});
|
||||
Compositor.get_stage_for_screen (screen).add_child (click_catcher);
|
||||
|
||||
add_child (background);
|
||||
add_child (thumbnails);
|
||||
add_child (scroll);
|
||||
@ -297,6 +306,11 @@ namespace Gala
|
||||
thumbnails.x = 4.0f;
|
||||
}
|
||||
|
||||
click_catcher.width = width;
|
||||
click_catcher.height = area.height - height;
|
||||
click_catcher.x = 0;
|
||||
click_catcher.y = 0;
|
||||
|
||||
animating = true;
|
||||
Timeout.add (50, () => {
|
||||
animating = false;
|
||||
|
Loading…
Reference in New Issue
Block a user