Commit 5fa4ce83 authored by Erik Reider's avatar Erik Reider

Set floating notification layer keyboard mode to ON_DEMAND after map. Fixes #455

parent e38e4742
...@@ -42,9 +42,13 @@ namespace SwayNotificationCenter { ...@@ -42,9 +42,13 @@ namespace SwayNotificationCenter {
surface.disconnect (id); surface.disconnect (id);
debug ("NotificationWindow mapped on monitor: %s", debug ("NotificationWindow mapped on monitor: %s",
Functions.monitor_to_string (monitor)); Functions.monitor_to_string (monitor));
// Only set ON_DEMAND after the surface has been mapped
set_keyboard_mode ();
}); });
}); });
this.unmap.connect (() => { this.unmap.connect (() => {
set_keyboard_mode ();
debug ("NotificationWindow un-mapped"); debug ("NotificationWindow un-mapped");
}); });
...@@ -85,6 +89,16 @@ namespace SwayNotificationCenter { ...@@ -85,6 +89,16 @@ namespace SwayNotificationCenter {
base.snapshot (snapshot); base.snapshot (snapshot);
} }
private inline void set_keyboard_mode () {
if (app.use_layer_shell) {
if (app.has_layer_on_demand && get_mapped ()) {
GtkLayerShell.set_keyboard_mode (this, GtkLayerShell.KeyboardMode.ON_DEMAND);
} else {
GtkLayerShell.set_keyboard_mode (this, GtkLayerShell.KeyboardMode.NONE);
}
}
}
private void set_anchor () { private void set_anchor () {
debug ("NotificationWindow set_anchor"); debug ("NotificationWindow set_anchor");
if (app.use_layer_shell) { if (app.use_layer_shell) {
...@@ -261,14 +275,8 @@ namespace SwayNotificationCenter { ...@@ -261,14 +275,8 @@ namespace SwayNotificationCenter {
if (notification.has_inline_reply) { if (notification.has_inline_reply) {
inline_reply_notifications.remove (param.applied_id); inline_reply_notifications.remove (param.applied_id);
if (inline_reply_notifications.is_empty
&& app.use_layer_shell
&& GtkLayerShell.get_keyboard_mode (this)
!= GtkLayerShell.KeyboardMode.NONE) {
GtkLayerShell.set_keyboard_mode (
this, GtkLayerShell.KeyboardMode.NONE);
}
} }
// Remove notification and its destruction timeout // Remove notification and its destruction timeout
notification.remove_noti_timeout (); notification.remove_noti_timeout ();
list.remove.begin (notification, transition, (obj, res) => { list.remove.begin (notification, transition, (obj, res) => {
...@@ -286,18 +294,6 @@ namespace SwayNotificationCenter { ...@@ -286,18 +294,6 @@ namespace SwayNotificationCenter {
ConfigModel.instance.timeout, ConfigModel.instance.timeout,
ConfigModel.instance.timeout_low, ConfigModel.instance.timeout_low,
ConfigModel.instance.timeout_critical); ConfigModel.instance.timeout_critical);
if (noti.has_inline_reply) {
inline_reply_notifications.add (param.applied_id);
if (app.use_layer_shell &&
GtkLayerShell.get_keyboard_mode (this)
!= GtkLayerShell.KeyboardMode.ON_DEMAND
&& app.has_layer_on_demand) {
GtkLayerShell.set_keyboard_mode (
this, GtkLayerShell.KeyboardMode.ON_DEMAND);
}
}
if (!visible) { if (!visible) {
// Destroy the wl_surface to get a new "enter-monitor" signal and // Destroy the wl_surface to get a new "enter-monitor" signal and
// fixes issues where keyboard shortcuts stop working after clearing // fixes issues where keyboard shortcuts stop working after clearing
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment