summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wold <[email protected]>2020-09-14 02:14:34 -0700
committerraveit65 <[email protected]>2020-10-24 16:49:14 +0200
commit550f2a11921b48bc1c876b5e7fcc42cc2a4da07f (patch)
treebb439e4a94589ca117531e4fd65d5c6d17f0b7df
parenta2e79313345fbe8950d6ba123cbc56113dac93b9 (diff)
downloadmate-notification-daemon-550f2a11921b48bc1c876b5e7fcc42cc2a4da07f.tar.bz2
mate-notification-daemon-550f2a11921b48bc1c876b5e7fcc42cc2a4da07f.tar.xz
Add initial Wayland backend
-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 <[email protected]>
+ *
+ * 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 <[email protected]>
+ *
+ * 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 */