summaryrefslogtreecommitdiff
path: root/eel
diff options
context:
space:
mode:
authorLuke from DC <[email protected]>2023-07-08 17:10:25 +0000
committerGitHub <[email protected]>2023-07-08 19:10:25 +0200
commitc1b2e7798670cc795979090023d1b9dcb2a0b330 (patch)
tree632a206d3501fd48f0e1d1af709b0c4054c49c84 /eel
parentdf25aef7d386d3bf8da08ec5d8dd9e44c9b09e50 (diff)
downloadcaja-c1b2e7798670cc795979090023d1b9dcb2a0b330.tar.bz2
caja-c1b2e7798670cc795979090023d1b9dcb2a0b330.tar.xz
wayland: initial support for showing the desktop
* Wayland: Support rendering the desktop *Wayland support is optional via the --enable-wayland option * eel-editable-label-c: remove unused variable This was leftover from earlier code compatable only with x11 * Fix gtk-layer-shell-0 version check, improve error message when Wayland requested but not found
Diffstat (limited to 'eel')
-rw-r--r--eel/eel-background.c22
-rw-r--r--eel/eel-editable-label.c2
-rw-r--r--eel/eel-gtk-extensions.c36
3 files changed, 35 insertions, 25 deletions
diff --git a/eel/eel-background.c b/eel/eel-background.c
index 5b00f849..2b50d450 100644
--- a/eel/eel-background.c
+++ b/eel/eel-background.c
@@ -105,7 +105,7 @@ free_background_surface (EelBackground *self)
it will live forever, so we need to kill it manually.
If set as root background it will be killed next time the
background is changed. */
- if (self->details->unset_root_surface)
+ if (GDK_IS_X11_DISPLAY (gdk_display_get_default()) && (self->details->unset_root_surface))
{
XKillClient (cairo_xlib_surface_get_display (surface),
cairo_xlib_surface_get_drawable (surface));
@@ -312,7 +312,7 @@ drawable_get_adjusted_size (EelBackground *self,
{
GdkScreen *screen = gtk_widget_get_screen (self->details->widget);
GdkDisplay *display = gdk_screen_get_display (screen);
- if (GDK_IS_X11_DISPLAY (display))
+ if (GDK_IS_X11_DISPLAY (display))
{
gint scale = gtk_widget_get_scale_factor (self->details->widget);
*width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale;
@@ -433,8 +433,8 @@ set_root_surface (EelBackground *self,
self->details->bg_surface = mate_bg_create_surface (self->details->bg, window,
width, height, TRUE);
}
-
- if (self->details->bg_surface != NULL)
+ GdkDisplay *display = gdk_screen_get_display (screen);
+ if ((GDK_IS_X11_DISPLAY (display)) && (self->details->bg_surface != NULL))
mate_bg_set_surface_as_root (screen, self->details->bg_surface);
}
@@ -649,7 +649,7 @@ widget_realized_setup (GtkWidget *widget,
}
GdkScreen *screen = gtk_widget_get_screen (widget);
- GdkWindow *window = gdk_screen_get_root_window (screen);
+ GdkDisplay *display = gdk_screen_get_display (screen);
if (self->details->screen_size_handler > 0)
{
@@ -665,8 +665,16 @@ widget_realized_setup (GtkWidget *widget,
self->details->screen_monitors_handler =
g_signal_connect (screen, "monitors-changed", G_CALLBACK (screen_size_changed), self);
- self->details->use_common_surface =
- (gdk_window_get_visual (window) == gtk_widget_get_visual (widget)) ? TRUE : FALSE;
+ if (GDK_IS_X11_DISPLAY (display))
+ {
+ GdkWindow *window = gdk_screen_get_root_window (screen);
+ self->details->use_common_surface =
+ (gdk_window_get_visual (window) == gtk_widget_get_visual (widget)) ? TRUE : FALSE;
+ }
+ else /*Wayland is always composited*/
+ {
+ self->details->use_common_surface = TRUE;
+ }
init_fade (self);
}
diff --git a/eel/eel-editable-label.c b/eel/eel-editable-label.c
index 92ce7015..7c4bcb38 100644
--- a/eel/eel-editable-label.c
+++ b/eel/eel-editable-label.c
@@ -1028,7 +1028,6 @@ eel_editable_label_ensure_layout (EelEditableLabel *label,
else
{
gint wrap_width;
- gint scale;
pango_layout_set_width (label->layout, -1);
pango_layout_get_extents (label->layout, NULL, &logical_rect);
@@ -1039,7 +1038,6 @@ eel_editable_label_ensure_layout (EelEditableLabel *label,
longest_paragraph = width;
wrap_width = get_label_wrap_width (label);
- scale = gtk_widget_get_scale_factor (widget);
width = MIN (width, wrap_width);
width = MIN (width,
PANGO_SCALE * (gdk_screen_width () + 1) / 2);
diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c
index 21c3c358..a36c579e 100644
--- a/eel/eel-gtk-extensions.c
+++ b/eel/eel-gtk-extensions.c
@@ -93,23 +93,27 @@ sanity_check_window_position (int *left, int *top)
* that it might be obscured by the panel.
*
*/
- root_window = gdk_screen_get_root_window (gdk_screen_get_default());
display = gdk_display_get_default ();
- gdk_monitor_get_workarea(gdk_display_get_monitor_at_window (display, root_window), &workarea);
- *top = CLAMP (*top, 0, workarea.height - MINIMUM_ON_SCREEN_HEIGHT);
-
- /* FIXME bugzilla.eazel.com 669:
- * If window has negative left coordinate, set_uposition sends it
- * somewhere else entirely. Not sure what level contains this bug (XWindows?).
- * Hacked around by pinning the left edge to zero, which just means you
- * can't set a window to be partly off the left of the screen using
- * this routine.
- */
- /* Make sure the left edge of the window isn't off the right edge of
- * the screen, or so close to the right edge that it might be
- * obscured by the panel.
- */
- *left = CLAMP (*left, 0, workarea.width - MINIMUM_ON_SCREEN_WIDTH);
+ /*This is x11 only, there is no root window in wayland*/
+ if (GDK_IS_X11_DISPLAY (display))
+ {
+ root_window = gdk_screen_get_root_window (gdk_screen_get_default());
+ gdk_monitor_get_workarea(gdk_display_get_monitor_at_window (display, root_window), &workarea);
+ *top = CLAMP (*top, 0, workarea.height - MINIMUM_ON_SCREEN_HEIGHT);
+
+ /* FIXME bugzilla.eazel.com 669:
+ * If window has negative left coordinate, set_uposition sends it
+ * somewhere else entirely. Not sure what level contains this bug (XWindows?).
+ * Hacked around by pinning the left edge to zero, which just means you
+ * can't set a window to be partly off the left of the screen using
+ * this routine.
+ */
+ /* Make sure the left edge of the window isn't off the right edge of
+ * the screen, or so close to the right edge that it might be
+ * obscured by the panel.
+ */
+ *left = CLAMP (*left, 0, workarea.width - MINIMUM_ON_SCREEN_WIDTH);
+ }
}
static void