summaryrefslogtreecommitdiff
path: root/src/daemon
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon')
-rw-r--r--src/daemon/Makefile.am5
-rw-r--r--src/daemon/daemon.c13
-rw-r--r--src/daemon/wayland.c39
-rw-r--r--src/daemon/wayland.h34
4 files changed, 91 insertions, 0 deletions
diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am
index 179e964..1cd972e 100644
--- a/src/daemon/Makefile.am
+++ b/src/daemon/Makefile.am
@@ -12,6 +12,11 @@ mate_notification_daemon_SOURCES = \
sound.h \
mnd-daemon.c
+if ENABLE_WAYLAND
+mate_notification_daemon_SOURCES += \
+ wayland.c
+endif
+
mate_notification_daemon_LDADD = $(NOTIFICATION_DAEMON_LIBS)
mate_notification_daemon_CFLAGS = $(WARN_CFLAGS)
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index c42b2e6..7981bb0 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -45,6 +45,11 @@
#include <libwnck/libwnck.h>
#endif // HAVE_X11
+#ifdef HAVE_WAYLAND
+#include <gdk/gdkwayland.h>
+#include "wayland.h"
+#endif // HAVE_WAYLAND
+
#include "daemon.h"
#include "engines.h"
#include "stack.h"
@@ -1369,6 +1374,14 @@ static gboolean notify_daemon_notify_handler(NotifyDaemonNotifications *object,
{
nw = theme_create_notification (url_clicked_cb);
g_object_set_data (G_OBJECT (nw), "_notify_daemon", daemon);
+
+#if HAVE_WAYLAND
+ if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()))
+ {
+ wayland_init_notification (nw);
+ }
+#endif // HAVE_WAYLAND
+
gtk_widget_realize (GTK_WIDGET (nw));
new_notification = TRUE;
diff --git a/src/daemon/wayland.c b/src/daemon/wayland.c
new file mode 100644
index 0000000..837e8a2
--- /dev/null
+++ b/src/daemon/wayland.c
@@ -0,0 +1,39 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * Copyright (C) 2020 William Wold <wm@wmww.sh>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#ifndef HAVE_WAYLAND
+#error file should only be built when HAVE_WAYLAND is enabled
+#endif
+
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <gtk-layer-shell/gtk-layer-shell.h>
+
+#include "wayland.h"
+
+void wayland_init_notification (GtkWindow* nw)
+{
+ gtk_layer_init_for_window (nw);
+}
diff --git a/src/daemon/wayland.h b/src/daemon/wayland.h
new file mode 100644
index 0000000..816eb74
--- /dev/null
+++ b/src/daemon/wayland.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * Copyright (C) 2020 William Wold <wm@wmww.sh>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef _WAYLAND_H
+#define _WAYLAND_H
+
+#ifdef PACKAGE_NAME // only check HAVE_WAYLAND if config.h has been included
+#ifndef HAVE_WAYLAND
+#error file should only be included when HAVE_WAYLAND is enabled
+#endif
+#endif
+
+#include <gtk/gtk.h>
+
+void wayland_init_notification (GtkWindow* nw);
+
+#endif /* _WAYLAND_H */