Skip to content

Commit 9b24475

Browse files
committed
X11: Avoid using present
1 parent c03fd64 commit 9b24475

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/AbstractBubble.vala

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public class Notifications.AbstractBubble : Gtk.Window {
101101
add_css_class ("notification");
102102
// Prevent stealing focus when an app window is closed
103103
can_focus = false;
104+
focusable = false;
104105
set_titlebar (new Gtk.Grid ());
105106

106107
carousel.page_changed.connect (on_page_changed);
@@ -162,7 +163,12 @@ public class Notifications.AbstractBubble : Gtk.Window {
162163
timeout_id = 0;
163164
}
164165

165-
base.present ();
166+
if (Gdk.Display.get_default () is Gdk.X11.Display) {
167+
// Avoid present on X11 because it focuses the window
168+
base.show ();
169+
} else {
170+
base.present ();
171+
}
166172

167173
if (timeout != 0) {
168174
timeout_id = Timeout.add (timeout, timeout_expired);
@@ -218,10 +224,12 @@ public class Notifications.AbstractBubble : Gtk.Window {
218224
private void x11_make_notification () {
219225
unowned var display = Gdk.Display.get_default ();
220226
if (display is Gdk.X11.Display) {
221-
unowned var xdisplay = ((Gdk.X11.Display) display).get_xdisplay ();
222-
223-
var window = ((Gdk.X11.Surface) get_surface ()).get_xid ();
227+
unowned var x11_surface = (Gdk.X11.Surface) get_surface ();
228+
var window = (x11_surface).get_xid ();
229+
x11_surface.set_skip_pager_hint (true);
230+
x11_surface.set_skip_taskbar_hint (true);
224231

232+
unowned var xdisplay = ((Gdk.X11.Display) display).get_xdisplay ();
225233
var atom = xdisplay.intern_atom ("_NET_WM_WINDOW_TYPE", false);
226234
var notification_atom = xdisplay.intern_atom ("_NET_WM_WINDOW_TYPE_NOTIFICATION", false);
227235

0 commit comments

Comments
 (0)