diff options
author | fiaxh <git@mx.ax.lt> | 2017-04-11 00:04:27 +0200 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-04-11 00:04:27 +0200 |
commit | 71fab50c8eb80db29d656fc12ce167ec70d71748 (patch) | |
tree | 2595a94ec327d79e5ca32d15f8141d6d5ce172cc /main | |
parent | 9bc83539d124f9645dc92e9e39001cb0192dae61 (diff) | |
download | dino-71fab50c8eb80db29d656fc12ce167ec70d71748.tar.gz dino-71fab50c8eb80db29d656fc12ce167ec70d71748.zip |
Fix alt-tab behaviour when notification is active
Diffstat (limited to 'main')
-rw-r--r-- | main/CMakeLists.txt | 1 | ||||
-rw-r--r-- | main/src/ui/application.vala | 4 | ||||
-rw-r--r-- | main/src/ui/notifications.vala | 15 |
3 files changed, 13 insertions, 7 deletions
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index bada486c..010ff221 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -107,6 +107,7 @@ CUSTOM_VAPIS ${CMAKE_BINARY_DIR}/exports/dino_internal.vapi PACKAGES ${MAIN_PACKAGES} + gdk-x11-3.0 GRESOURCES ${MAIN_GRESOURCES_XML} ) diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index c71124c1..35791b07 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -9,8 +9,6 @@ public class Dino.Ui.Application : Dino.Application { public Application() throws Error { Notify.init("dino"); - notifications = new Notifications(stream_interaction); - notifications.start(); Environment.set_application_name("Dino"); Gtk.Window.set_default_icon_name("dino"); IconTheme.get_default().add_resource_path("/org/dino-im/icons"); @@ -18,6 +16,8 @@ public class Dino.Ui.Application : Dino.Application { activate.connect(() => { create_set_app_menu(); window = new UnifiedWindow(this, stream_interaction); + notifications = new Notifications(stream_interaction, window); + notifications.start(); notifications.conversation_selected.connect(window.on_conversation_selected); window.show(); }); diff --git a/main/src/ui/notifications.vala b/main/src/ui/notifications.vala index 029a4b33..af2c80fe 100644 --- a/main/src/ui/notifications.vala +++ b/main/src/ui/notifications.vala @@ -10,6 +10,7 @@ public class Notifications : Object { public signal void conversation_selected(Conversation conversation); private StreamInteractor stream_interactor; + private Gtk.Window window; private HashMap<Conversation, Notify.Notification> notifications = new HashMap<Conversation, Notify.Notification>(Conversation.hash_func, Conversation.equals_func); private enum ClosedReason { // org.freedesktop.Notifications.NotificationClosed @@ -19,8 +20,9 @@ public class Notifications : Object { UNDEFINED = 4 } - public Notifications(StreamInteractor stream_interactor) { + public Notifications(StreamInteractor stream_interactor, Gtk.Window window) { this.stream_interactor = stream_interactor; + this.window = window; } public void start() { @@ -32,10 +34,13 @@ public class Notifications : Object { if (!notifications.has_key(conversation)) { notifications[conversation] = new Notify.Notification("", null, null); notifications[conversation].set_hint("transient", true); - notifications[conversation].closed.connect(() => { - if (notifications[conversation].closed_reason == ClosedReason.USER_DISMISSED) { - // USER_DISMISSED + transient = very probably clicked on - conversation_selected(conversation); + notifications[conversation].add_action("default", "Open", () => { + conversation_selected(conversation); + Gdk.X11.Window x11window = window.get_window() as Gdk.X11.Window; + if (x11window != null) { + window.present_with_time(Gdk.X11.get_server_time(x11window)); + } else { + window.present(); } }); } |