File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -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 )
Original file line number Diff line number Diff line change @@ -100,6 +100,14 @@ typedef enum dt_gui_color_t
100100 DT_GUI_COLOR_LAST
101101} dt_gui_color_t ;
102102
103+ typedef enum dt_gui_session_type_t
104+ {
105+ DT_GUI_SESSION_UNKNOWN,
106+ DT_GUI_SESSION_X11,
107+ DT_GUI_SESSION_QUARTZ,
108+ DT_GUI_SESSION_WAYLAND,
109+ } dt_gui_session_type_t ;
110+
103111typedef struct dt_gui_gtk_t
104112{
105113 struct dt_ui_t *ui;
@@ -627,6 +635,9 @@ void dt_gui_commit_on_focus_loss(GtkCellRenderer *renderer, GtkCellEditable **ac
627635// restore dialog size from config file
628636void dt_gui_dialog_restore_size (GtkDialog *dialog, const char *conf);
629637
638+ // returns the session type at runtime
639+ dt_gui_session_type_t dt_gui_get_session_type (void );
640+
630641G_END_DECLS
631642
632643// clang-format off
You can’t perform that action at this time.
0 commit comments