summaryrefslogtreecommitdiff
path: root/applets/wncklet/wncklet.c
diff options
context:
space:
mode:
authorWilliam Wold <[email protected]>2020-09-30 13:01:32 -0700
committerraveit65 <[email protected]>2020-10-21 20:35:15 +0200
commiteda5735ce6b52e8cf738077027581bfe2257c3cb (patch)
tree98f8c47aadb650ca2cf74421356753ebf1917445 /applets/wncklet/wncklet.c
parentbd27321bd83f25ce504267e2098b1bed9e55bf16 (diff)
downloadmate-panel-eda5735ce6b52e8cf738077027581bfe2257c3cb.tar.bz2
mate-panel-eda5735ce6b52e8cf738077027581bfe2257c3cb.tar.xz
Wncklet applets: don't crash on Wayland
Diffstat (limited to 'applets/wncklet/wncklet.c')
-rw-r--r--applets/wncklet/wncklet.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/applets/wncklet/wncklet.c b/applets/wncklet/wncklet.c
index c24b41f0..ed141b1f 100644
--- a/applets/wncklet/wncklet.c
+++ b/applets/wncklet/wncklet.c
@@ -25,18 +25,17 @@
#include <config.h>
#endif
-#ifndef HAVE_X11
-#error file should only be built when HAVE_X11 is enabled
-#endif
-
#include <string.h>
#include <mate-panel-applet.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+
+#ifdef HAVE_X11
#include <gdk/gdkx.h>
#define WNCK_I_KNOW_THIS_IS_UNSTABLE
#include <libwnck/libwnck.h>
+#endif
#include "wncklet.h"
#include "window-menu.h"
@@ -96,8 +95,11 @@ void wncklet_display_help(GtkWidget* widget, const char* doc_id, const char* lin
}
}
+#ifdef HAVE_X11
WnckScreen* wncklet_get_screen(GtkWidget* applet)
{
+ g_return_val_if_fail (GDK_IS_X11_DISPLAY (gdk_display_get_default ()), NULL);
+
int screen_num;
if (!gtk_widget_has_screen(applet))
@@ -107,6 +109,7 @@ WnckScreen* wncklet_get_screen(GtkWidget* applet)
return wnck_screen_get(screen_num);
}
+#endif // HAVE_X11
void wncklet_connect_while_alive(gpointer object, const char* signal, GCallback func, gpointer func_data, gpointer alive_object)
{
@@ -120,13 +123,18 @@ void wncklet_connect_while_alive(gpointer object, const char* signal, GCallback
static gboolean wncklet_factory(MatePanelApplet* applet, const char* iid, gpointer data)
{
gboolean retval = FALSE;
- static gboolean type_registered = FALSE;
- if (!type_registered)
+#ifdef HAVE_X11
+ if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
{
- wnck_set_client_type(WNCK_CLIENT_TYPE_PAGER);
- type_registered = TRUE;
+ static gboolean type_registered = FALSE;
+ if (!type_registered)
+ {
+ wnck_set_client_type(WNCK_CLIENT_TYPE_PAGER);
+ type_registered = TRUE;
+ }
}
+#endif // HAVE_X11
if (!strcmp(iid, "WindowMenuApplet"))
retval = window_menu_applet_fill(applet);