Skip to content

Commit

Permalink
wayland: ensure windows can be moved if compositor is using CSD
Browse files Browse the repository at this point in the history
  • Loading branch information
lukefromdc committed Aug 14, 2024
1 parent d5a6638 commit 572f4fe
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/caja-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
#include "caja-navigation-window-pane.h"
#include "caja-src-marshal.h"

#ifdef HAVE_WAYLAND
#include <gdk/gdkwayland.h>
#endif

#define MAX_HISTORY_ITEMS 50

#define EXTRA_VIEW_WIDGETS_BACKGROUND "#a7c6e1"
Expand Down Expand Up @@ -743,6 +747,17 @@ caja_window_constructor (GType type,
slot = caja_window_open_slot (window->details->active_pane, 0);
caja_window_set_active_slot (window, slot);

#ifdef HAVE_WAYLAND
/*We have to do this here under wayland
*as we cannot use the constructed function on CSD compositors
*/
GdkDisplay *display = gdk_display_get_default();
if (GDK_IS_WAYLAND_DISPLAY (display))
{
caja_window_initialize_bookmarks_menu (window);
caja_window_set_initial_window_geometry (window);
}
#endif
return object;
}

Expand Down Expand Up @@ -2170,7 +2185,18 @@ caja_window_class_init (CajaWindowClass *class)
GtkBindingSet *binding_set;

G_OBJECT_CLASS (class)->constructor = caja_window_constructor;
G_OBJECT_CLASS (class)->constructed = caja_window_constructed;
#ifdef HAVE_WAYLAND
/*For some reason if we use the constructed() class method
*in wayland with the compositor set to or forcing CSD
*we lose the ability to drag the window by the titlebar
*/
GdkDisplay *display = gdk_display_get_default();
if (GDK_IS_X11_DISPLAY (display))
#endif
{
G_OBJECT_CLASS (class)->constructed = caja_window_constructed;
}

G_OBJECT_CLASS (class)->get_property = caja_window_get_property;
G_OBJECT_CLASS (class)->set_property = caja_window_set_property;
G_OBJECT_CLASS (class)->finalize = caja_window_finalize;
Expand Down

0 comments on commit 572f4fe

Please sign in to comment.