summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2024-04-03 23:03:25 -0400
committerlukefromdc <[email protected]>2024-04-04 01:32:05 -0400
commit1192002dd454bfa546d0f1373de4b3f59a4bb170 (patch)
tree6b26d2a53ef87f831eed8837064945b810f52117
parent95edc464496af666567a604378640155d6c33732 (diff)
downloadmate-desktop-wayland-bg-thumbnail.tar.bz2
mate-desktop-wayland-bg-thumbnail.tar.xz
Background thumbnail under wayland: only use gdk_x11 when in x11wayland-bg-thumbnail
*Avoid segfault on thumbnailing backgrounds under wayland by only using gdk_x11_screen_get_xscreen () when running under Xorg *Use gdk_monitor_get_geometry to get screen dimensions when running under wayland
-rw-r--r--libmate-desktop/mate-bg.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/libmate-desktop/mate-bg.c b/libmate-desktop/mate-bg.c
index 2c44b9e..8587dd4 100644
--- a/libmate-desktop/mate-bg.c
+++ b/libmate-desktop/mate-bg.c
@@ -2135,9 +2135,27 @@ scale_thumbnail (MateBGPlacement placement,
if (get_thumb_annotations (thumb, &o_width, &o_height) ||
(filename && get_original_size (filename, &o_width, &o_height))) {
+ GdkDisplay *display;
+ int scr_height;
+ int scr_width;
- int scr_height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen));
- int scr_width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen));
+ display = gdk_screen_get_display (screen);
+
+ /*Since we can use this in wayland, only use x11 specific code when in x11*/
+ if (GDK_IS_X11_DISPLAY (gdk_screen_get_display (screen)))
+ {
+ scr_height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen));
+ scr_width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen));
+ }
+ else
+ {
+ GdkRectangle geometry = {0};
+ GdkMonitor *monitor;
+ monitor = gdk_display_get_monitor (display, 0);
+ gdk_monitor_get_geometry (monitor, &geometry);
+ scr_height = geometry.width;
+ scr_width = geometry.height;
+ }
int thumb_width = gdk_pixbuf_get_width (thumb);
int thumb_height = gdk_pixbuf_get_height (thumb);
double screen_to_dest = fit_factor (scr_width, scr_height,