summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2024-11-22 01:06:52 -0500
committerLuke from DC <[email protected]>2024-11-27 03:49:44 +0000
commitb6c248aad24637a75e50d56280860d3a8a308dc1 (patch)
tree8a6fc48d5922b33e036caa59b7302e7bfd509377
parentc0cb20ed7a38d2a1461ee16f5ec0979c32ca6273 (diff)
downloadmate-applets-b6c248aad24637a75e50d56280860d3a8a308dc1.tar.bz2
mate-applets-b6c248aad24637a75e50d56280860d3a8a308dc1.tar.xz
Do not call x11 functions when not in x11
*Otherwise we get segfaults
-rw-r--r--stickynotes/stickynotes.c15
-rw-r--r--stickynotes/stickynotes_applet_callbacks.c14
-rw-r--r--stickynotes/util.c3
3 files changed, 30 insertions, 2 deletions
diff --git a/stickynotes/stickynotes.c b/stickynotes/stickynotes.c
index 85afdc3d..b2ebb85c 100644
--- a/stickynotes/stickynotes.c
+++ b/stickynotes/stickynotes.c
@@ -48,6 +48,11 @@ set_icon_geometry (GdkWindow *window,
int width,
int height)
{
+ /*This is x11-only, so return in wayland or anything else*/
+ GdkScreen *screen = gdk_screen_get_default();
+ if (!(GDK_IS_X11_DISPLAY (gdk_screen_get_display (screen))))
+ return;
+
gulong data[4];
Display *dpy;
@@ -731,7 +736,15 @@ stickynote_set_visible (StickyNote *note,
gtk_window_move (GTK_WINDOW (note->w_window),
note->x, note->y);
- /* Put the note on all workspaces if necessary. */
+
+
+ /*On x11, Put the note on all workspaces or move it if necessary.
+ *We can't yet change workspace on wayland
+ */
+ GdkScreen *screen = gdk_screen_get_default();
+ if (!(GDK_IS_X11_DISPLAY (gdk_screen_get_display (screen))))
+ return;
+
if (g_settings_get_boolean (stickynotes->settings, "sticky"))
gtk_window_stick (GTK_WINDOW (note->w_window));
diff --git a/stickynotes/stickynotes_applet_callbacks.c b/stickynotes/stickynotes_applet_callbacks.c
index 80024e4a..69869a26 100644
--- a/stickynotes/stickynotes_applet_callbacks.c
+++ b/stickynotes/stickynotes_applet_callbacks.c
@@ -126,6 +126,10 @@ static gboolean get_desktop_window (GdkScreen *screen, Window *window)
int format_returned;
int length_returned;
+ /*This is x11-only, so return FALSE in wayland or anything else*/
+ if (!(GDK_IS_X11_DISPLAY (gdk_screen_get_display (screen))))
+ return FALSE;
+
root_window = gdk_screen_get_root_window (screen);
if (gdk_property_get (root_window,
@@ -151,7 +155,15 @@ desktop_window_event_filter (GdkXEvent *xevent,
GdkEvent *event,
gpointer data)
{
- gboolean desktop_hide = g_settings_get_boolean (stickynotes->settings,
+ gboolean desktop_hide;
+
+ GdkScreen *screen = gdk_screen_get_default();
+ if (!(GDK_IS_X11_DISPLAY (gdk_screen_get_display (screen))))
+ {
+ desktop_hide = FALSE;
+ return GDK_FILTER_CONTINUE;
+ }
+ desktop_hide = g_settings_get_boolean (stickynotes->settings,
"desktop-hide");
if (desktop_hide &&
(((XEvent*)xevent)->xany.type == PropertyNotify) &&
diff --git a/stickynotes/util.c b/stickynotes/util.c
index d13f9f41..9b6a5180 100644
--- a/stickynotes/util.c
+++ b/stickynotes/util.c
@@ -110,6 +110,9 @@ xstuff_change_workspace (GtkWindow *window,
Display *gdk_display;
Screen *screen;
+ if (!GDK_IS_X11_DISPLAY (gdk_display_get_default()))
+ return;
+
gdk_display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
xwindow = GDK_WINDOW_XID (GDK_WINDOW (gtk_widget_get_window (GTK_WIDGET (window))));
screen = GDK_SCREEN_XSCREEN (gtk_widget_get_screen (GTK_WIDGET (window)));