@@ -770,11 +770,11 @@ static gboolean _scrollbar_changed(GtkWidget *widget,
770770 return TRUE;
771771}
772772
773- gboolean _valid_window_placement ( const gint saved_x ,
774- const gint saved_y ,
775- const gint window_width ,
776- const gint window_height ,
777- const gint border )
773+ gboolean _valid_window_placement (const gint saved_x ,
774+ const gint saved_y ,
775+ const gint window_width ,
776+ const gint window_height ,
777+ const gint border )
778778{
779779 GdkDisplay * display = gdk_display_get_default ();
780780 const gint n_monitors = gdk_display_get_n_monitors (display );
@@ -975,6 +975,25 @@ static gboolean _osx_openfile_callback(GtkosxApplication *OSXapp,
975975}
976976#endif
977977
978+ dt_gui_session_type_t dt_gui_get_session_type (void )
979+ {
980+ #ifdef GDK_WINDOWING_QUARTZ
981+ return DT_GUI_SESSION_QUARTZ ;
982+ #elif defined(GDK_WINDOWING_WAYLAND )
983+ GdkDisplay * disp = gdk_display_get_default ();
984+ return G_TYPE_CHECK_INSTANCE_TYPE (disp , GDK_TYPE_WAYLAND_DISPLAY )
985+ ? DT_GUI_SESSION_WAYLAND
986+ : DT_GUI_SESSION_X11 ;
987+ #elif defined(GDK_WINDOWING_X11 )
988+ GdkDisplay * disp = gdk_display_get_default ();
989+ retun G_TYPE_CHECK_INSTANCE_TYPE (disp , GDK_TYPE_X11_DISPLAY )
990+ ? DT_GUI_SESSION_X11
991+ : DT_GUI_SESSION_WAYLAND ;
992+ #else
993+ return DT_GUI_SESSION_UNKNOWN ;
994+ #endif
995+ }
996+
978997static gboolean _configure (GtkWidget * da ,
979998 GdkEventConfigure * event ,
980999 const gpointer user_data )
@@ -992,13 +1011,19 @@ static gboolean _window_configure(GtkWidget *da,
9921011{
9931012 static int oldx = 0 ;
9941013 static int oldy = 0 ;
995- if (oldx != event -> configure .x || oldy != event -> configure .y )
1014+
1015+ // FIXME: On Wayland we always configure as the even->configure x, y
1016+ // are always 0.
1017+ if (oldx != event -> configure .x
1018+ || oldy != event -> configure .y
1019+ || dt_gui_get_session_type () == DT_GUI_SESSION_WAYLAND )
9961020 {
997- dt_colorspaces_set_display_profile (
998- DT_COLORSPACE_DISPLAY ); // maybe we are on another screen now with > 50% of the area
1021+ // maybe we are on another screen now with > 50% of the area
1022+ dt_colorspaces_set_display_profile ( DT_COLORSPACE_DISPLAY );
9991023 oldx = event -> configure .x ;
10001024 oldy = event -> configure .y ;
10011025 }
1026+
10021027 return FALSE;
10031028}
10041029
@@ -1154,7 +1179,7 @@ static void _osx_add_view_menu_item(GtkWidget* menu,
11541179 gpointer mode )
11551180{
11561181 GtkWidget * mi = gtk_menu_item_new_with_label (label );
1157- gtk_menu_shell_append (GTK_MENU_SHELL (menu ), mi );
1182+ gtk_menu_shell_append (GTK_MENU_SHELL (menu ), mi );
11581183 gtk_widget_show (mi );
11591184 g_signal_connect (G_OBJECT (mi ), "activate" ,
11601185 G_CALLBACK (_osx_ctl_switch_mode_to ), mode );
@@ -1490,8 +1515,8 @@ int dt_gui_gtk_init(dt_gui_gtk_t *gui)
14901515 dt_init_styles_actions ();
14911516
14921517 // register ctrl-q to quit:
1493- dt_action_register (& darktable .control -> actions_global , N_ ("quit" ), _quit_callback
1494- , GDK_KEY_q , GDK_CONTROL_MASK );
1518+ dt_action_register (& darktable .control -> actions_global , N_ ("quit" ),
1519+ _quit_callback , GDK_KEY_q , GDK_CONTROL_MASK );
14951520
14961521 // Full-screen accelerator (no ESC handler here to enable quit-slideshow using ESC)
14971522 dt_action_register (& darktable .control -> actions_global , N_ ("fullscreen" ),
0 commit comments