[connections/wip/fullscreen: 5/5] display-view: Add top hotspot for escaping fullscreen
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [connections/wip/fullscreen: 5/5] display-view: Add top hotspot for escaping fullscreen
- Date: Wed, 12 May 2021 08:40:39 +0000 (UTC)
commit 78ea65ac9d6878db25e6fd6558b8e47011ed7975
Author: Felipe Borges <felipeborges gnome org>
Date: Wed May 12 10:36:11 2021 +0200
display-view: Add top hotspot for escaping fullscreen
When hovering the cursor at the top of a fullscreened display, one
will see the "escape fullscreen button".
Fixes #5
src/display-view.vala | 17 +++++++++++++++++
src/ui/display-view.ui | 18 ++++++++++++++++++
2 files changed, 35 insertions(+)
---
diff --git a/src/display-view.vala b/src/display-view.vala
index 23fe9a9..ab8c986 100644
--- a/src/display-view.vala
+++ b/src/display-view.vala
@@ -36,6 +36,8 @@ namespace Connections {
[GtkChild]
private unowned Label size_label;
+ [GtkChild]
+ private unowned Button escape_fullscreen_button;
private Widget? display;
@@ -153,5 +155,20 @@ namespace Connections {
return false;
});
}
+
+ [GtkCallback]
+ private void on_escape_fullscreen_button_clicked () {
+ Application.application.main_window.fullscreened = false;
+ escape_fullscreen_button.visible = false;
+ }
+
+ public override bool motion_notify_event (Gdk.EventMotion event) {
+ if (!Application.application.main_window.fullscreened)
+ return false;
+
+ escape_fullscreen_button.visible = (event.y < 40);
+
+ return base.motion_notify_event (event);
+ }
}
}
diff --git a/src/ui/display-view.ui b/src/ui/display-view.ui
index 7bd6f2e..7085faa 100644
--- a/src/ui/display-view.ui
+++ b/src/ui/display-view.ui
@@ -39,6 +39,24 @@
</object>
</child>
+ <child type="overlay">
+ <object class="GtkButton" id="escape_fullscreen_button">
+ <property name="halign">center</property>
+ <property name="valign">start</property>
+ <signal name="clicked" handler="on_escape_fullscreen_button_clicked"/>
+ <style>
+ <class name="app-notification"/>
+ </style>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">view-fullscreen-symbolic</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ </child>
+
<child>
<object class="GtkEventBox" id="event_box">
<property name="visible">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]