aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2013-04-02 18:16:41 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2013-04-02 18:16:41 +0200
commite90191e4416e2dc2d96da25f1b5dfe4a494570e7 (patch)
treea5ec786c36a40ba8526e871bfe72ecf26fcb6f27 /src
parentba80753bb0a79f052f007c6e614732afac88e3ad (diff)
downloadayatana-indicator-sound-e90191e4416e2dc2d96da25f1b5dfe4a494570e7.tar.gz
ayatana-indicator-sound-e90191e4416e2dc2d96da25f1b5dfe4a494570e7.tar.bz2
ayatana-indicator-sound-e90191e4416e2dc2d96da25f1b5dfe4a494570e7.zip
PlayerActivator: fix crash and activation with WebApplications
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/player-activator.vala (renamed from src/player-windows-activator.vala)27
2 files changed, 22 insertions, 7 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 9807477..55df0f6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -68,7 +68,7 @@ music_bridge_VALASOURCES = \
playlists-menu-item.vala \
freedesktop-interfaces.vala \
fetch-file.vala \
- player-windows-activator.vala
+ player-activator.vala
music_bridge_VALAFLAGS = \
--ccode \
diff --git a/src/player-windows-activator.vala b/src/player-activator.vala
index e8cd616..abad81b 100644
--- a/src/player-windows-activator.vala
+++ b/src/player-activator.vala
@@ -69,7 +69,7 @@ public class PlayerActivator : GLib.Object
data["desktop-startup-id"] = context.get_startup_notify_id(this.owner.app_info, new GLib.List<GLib.File>());
try {
- this.gtk_application.Activate(data);
+ this.gtk_application.Activate(data);
}
catch (IOError e) {
return false;
@@ -172,12 +172,27 @@ public class PlayerActivator : GLib.Object
var dpy = Gdk.Display.get_default();
foreach (var win in this.bamf_application.get_windows()) {
- if (win.get_window_type() != Bamf.WindowType.NORMAL)
- continue;
+ X.Window xid = 0;
- var xwin = Gdk.X11Window.foreign_new_for_display(dpy, win.get_xid());
- xwin.focus(timestamp);
- focused = true;
+ if (win is Bamf.Window) {
+ if (win.get_window_type() != Bamf.WindowType.NORMAL)
+ continue;
+
+ xid = win.get_xid();
+ }
+ else if (win is Bamf.Tab)
+ {
+ xid = (X.Window) (win as Bamf.Tab).get_xid();
+ }
+
+ if (xid > 0) {
+ var xwin = Gdk.X11Window.foreign_new_for_display(dpy, xid);
+
+ if (xwin != null) {
+ xwin.focus(timestamp);
+ focused = true;
+ }
+ }
}
return focused;