talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit b1f29de94828a155f76d1996fcc7aff269ac88f4
parent aa0633904307becbb1096bbe2438a82293aa5627
Author: Oliver Lowe <o@olowe.co>
Date:   Wed,  6 Aug 2025 17:56:17 +0700

Drop X11 session manager support

Not enabled by default on OpenBSD and on Linux, well, it's wayland
that is the future (tm)

Diffstat:
Mclaws-features.h.in | 1-
Mconfigure.ac | 26--------------------------
Mdoc/man/claws-mail.1 | 4----
Msrc/crash.c | 3---
Msrc/gtk/about.c | 10----------
Msrc/main.c | 207++-----------------------------------------------------------------------------
Msrc/mainwindow.h | 14+++++---------
7 files changed, 8 insertions(+), 257 deletions(-)

diff --git a/claws-features.h.in b/claws-features.h.in @@ -1,7 +1,6 @@ #undef HAVE_DBUS_GLIB #undef HAVE_DIRENT_D_TYPE #undef HAVE_LIBETPAN -#undef HAVE_LIBSM #undef HAVE_NETWORKMANAGER_SUPPORT #undef HAVE_STARTUP_NOTIFICATION #undef HAVE_VALGRIND diff --git a/configure.ac b/configure.ac @@ -238,10 +238,6 @@ AC_ARG_ENABLE(manual, [ --disable-manual Do not build user manual], [enable_manual=$enableval], [enable_manual=yes]) -AC_ARG_ENABLE(libsm, - [ --disable-libsm Do not build libSM support for session management], - [enable_libsm=$enableval], [enable_libsm=yes]) - AC_ARG_ENABLE(ipv6, [ --disable-ipv6 Do not build IPv6 support], [enable_ipv6=$enableval], [enable_ipv6=yes]) @@ -351,26 +347,6 @@ fi AC_CHECK_LIB(xpg4, setlocale) -SM_LIBS="" -dnl Check for LibSM -AC_MSG_CHECKING([whether to use LibSM]) -if test x"$enable_libsm" = xyes; then - AC_MSG_RESULT(yes) - AC_CHECK_LIB(SM, SmcSaveYourselfDone, - [SM_LIBS="$X_LIBS -lSM -lICE"],enable_libsm=no, - $X_LIBS -lICE) - AC_CHECK_HEADERS(X11/SM/SMlib.h,,enable_libsm=no) - if test x"$enable_libsm" = xyes; then - AC_DEFINE(HAVE_LIBSM, 1, [Define to 1 if you have libSM installed]) - else - AC_MSG_RESULT(not found) - AC_MSG_WARN([*** LibSM will not be supported ***]) - fi -else - AC_MSG_RESULT(no) -fi -AC_SUBST(SM_LIBS) - dnl Check for __VA_OPT__ macro AC_CACHE_CHECK([for __VA_OPT__], [ac_cv_va_opt], @@ -1043,13 +1019,11 @@ echo "enchant : $enable_enchant" echo "IMAP4 (libetpan) : $enable_libetpan" echo "NNTP (libetpan) : $enable_libetpan" echo "Crash dialog : $enable_crash_dialog" -echo "LibSM : $enable_libsm" echo "DBUS : $enable_dbus" echo "NetworkManager : $enable_networkmanager" echo "Manual : $enable_manual" echo "Generic UMPC code : $enable_generic_umpc" echo "SVG support : $enable_svg" -echo "Password crypto : $pwd_crypto" echo "Unit tests : $enable_tests" echo "pthread : $enable_pthread" echo "Startup notification : $enable_startup_notification" diff --git a/doc/man/claws-mail.1 b/doc/man/claws-mail.1 @@ -434,10 +434,6 @@ If defined overrides default J\-Pilot charset (CP1252). \fBPOSIXLY_CORRECT\fR If defined regular expressions matching follows POSIX standards. .TP -\fBSESSION_MANAGER\fR -If defined tries to use the Session Manager (only if Claws Mail has been -built with libSM feature enabled). -.TP \fBSHELL\fR If defined overrides default shell "sh" used by Spamassassin plugin to launch spamc wrappers. diff --git a/src/crash.c b/src/crash.c @@ -430,9 +430,6 @@ static gchar *get_compiled_in_features(void) #if HAVE_LIBETPAN " libetpan" #endif -#if HAVE_LIBSM - " libSM" -#endif ""); } diff --git a/src/gtk/about.c b/src/gtk/about.c @@ -482,16 +482,6 @@ static GtkWidget *about_create_child_page_features(void) gtk_text_buffer_insert(buffer, &iter, (gchar *)C_("librSVG", "adds support for SVG themes\n"), -1); -#if HAVE_LIBSM - gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf); -#else - gtk_text_buffer_insert_pixbuf(buffer, &iter, inactive_pixbuf); -#endif - gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, (" libSM "), -1, - "bold", NULL); - gtk_text_buffer_insert(buffer, &iter, - (gchar *)C_("libSM", "adds support for session handling\n"), -1); - #if HAVE_NETWORKMANAGER_SUPPORT gtk_text_buffer_insert_pixbuf(buffer, &iter, active_pixbuf); #else diff --git a/src/main.c b/src/main.c @@ -40,9 +40,6 @@ # include <errno.h> # include <fcntl.h> #endif -#ifdef HAVE_LIBSM -#include <X11/SM/SMlib.h> -#endif #if HAVE_FLOCK #include <sys/file.h> @@ -159,7 +156,7 @@ static gboolean went_offline_nm; #endif gchar *prog_version; -#if (defined HAVE_LIBSM || defined CRASH_DIALOG) +#ifdef CRASH_DIALOG gchar *argv0; #endif @@ -448,190 +445,6 @@ backup_mode: return (r == 0); } -#ifdef HAVE_LIBSM -static void -sc_client_set_value (MainWindow *mainwin, - gchar *name, - char *type, - int num_vals, - SmPropValue *vals) -{ - SmProp *proplist[1]; - SmProp prop; - - prop.name = name; - prop.type = type; - prop.num_vals = num_vals; - prop.vals = vals; - - proplist[0]= &prop; - if (mainwin->smc_conn) - SmcSetProperties ((SmcConn) mainwin->smc_conn, 1, proplist); -} - -static void sc_die_callback (SmcConn smc_conn, SmPointer client_data) -{ - clean_quit(NULL); -} - -static void sc_save_complete_callback(SmcConn smc_conn, SmPointer client_data) -{ -} - -static void sc_shutdown_cancelled_callback (SmcConn smc_conn, SmPointer client_data) -{ - MainWindow *mainwin = (MainWindow *)client_data; - if (mainwin->smc_conn) - SmcSaveYourselfDone ((SmcConn) mainwin->smc_conn, TRUE); -} - -static void sc_save_yourself_callback (SmcConn smc_conn, - SmPointer client_data, - int save_style, - gboolean shutdown, - int interact_style, - gboolean fast) { - - MainWindow *mainwin = (MainWindow *)client_data; - if (mainwin->smc_conn) - SmcSaveYourselfDone ((SmcConn) mainwin->smc_conn, TRUE); -} - -static IceIOErrorHandler sc_ice_installed_handler; - -static void sc_ice_io_error_handler (IceConn connection) -{ - if (sc_ice_installed_handler) - (*sc_ice_installed_handler) (connection); -} -static gboolean sc_process_ice_messages (GIOChannel *source, - GIOCondition condition, - gpointer data) -{ - IceConn connection = (IceConn) data; - IceProcessMessagesStatus status; - - status = IceProcessMessages (connection, NULL, NULL); - - if (status == IceProcessMessagesIOError) { - IcePointer context = IceGetConnectionContext (connection); - - if (context && G_IS_OBJECT(context)) { - guint disconnect_id = g_signal_lookup ("disconnect", G_OBJECT_TYPE (context)); - - if (disconnect_id > 0) - g_signal_emit (context, disconnect_id, 0); - } else { - IceSetShutdownNegotiation (connection, False); - IceCloseConnection (connection); - } - } - - return TRUE; -} - -static void new_ice_connection (IceConn connection, IcePointer client_data, Bool opening, - IcePointer *watch_data) -{ - guint input_id; - - if (opening) { - GIOChannel *channel; - /* Make sure we don't pass on these file descriptors to any - exec'ed children */ - fcntl(IceConnectionNumber(connection),F_SETFD, - fcntl(IceConnectionNumber(connection),F_GETFD,0) | FD_CLOEXEC); - - channel = g_io_channel_unix_new (IceConnectionNumber (connection)); - input_id = g_io_add_watch (channel, - G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI, - sc_process_ice_messages, - connection); - g_io_channel_unref (channel); - - *watch_data = (IcePointer) GUINT_TO_POINTER (input_id); - } else { - input_id = GPOINTER_TO_UINT ((gpointer) *watch_data); - g_source_remove (input_id); - } -} - -static void sc_session_manager_connect(MainWindow *mainwin) -{ - static gboolean connected = FALSE; - SmcCallbacks callbacks; - gchar *client_id; - IceIOErrorHandler default_handler; - - if (connected) - return; - connected = TRUE; - - - sc_ice_installed_handler = IceSetIOErrorHandler (NULL); - default_handler = IceSetIOErrorHandler (sc_ice_io_error_handler); - - if (sc_ice_installed_handler == default_handler) - sc_ice_installed_handler = NULL; - - IceAddConnectionWatch (new_ice_connection, NULL); - - - callbacks.save_yourself.callback = sc_save_yourself_callback; - callbacks.die.callback = sc_die_callback; - callbacks.save_complete.callback = sc_save_complete_callback; - callbacks.shutdown_cancelled.callback = sc_shutdown_cancelled_callback; - - callbacks.save_yourself.client_data = - callbacks.die.client_data = - callbacks.save_complete.client_data = - callbacks.shutdown_cancelled.client_data = (SmPointer) mainwin; - if (g_getenv ("SESSION_MANAGER")) { - gchar error_string_ret[256] = ""; - - mainwin->smc_conn = (gpointer) - SmcOpenConnection (NULL, mainwin, - SmProtoMajor, SmProtoMinor, - SmcSaveYourselfProcMask | SmcDieProcMask | - SmcSaveCompleteProcMask | - SmcShutdownCancelledProcMask, - &callbacks, - NULL, &client_id, - 256, error_string_ret); - - /* From https://www.x.org/releases/X11R7.7/doc/libSM/SMlib.txt: - * If SmcOpenConnection succeeds, it returns an opaque connection - * pointer of type SmcConn and the client_id_ret argument contains - * the client ID to be used for this session. The client_id_ret - * should be freed with a call to free when no longer needed. On - * failure, SmcOpenConnection returns NULL, and the reason for - * failure is returned in error_string_ret. */ - if (mainwin->smc_conn != NULL) - g_free(client_id); - - if (error_string_ret[0] || mainwin->smc_conn == NULL) - g_warning("while connecting to session manager: %s", - error_string_ret); - else { - SmPropValue *vals; - vals = g_new (SmPropValue, 1); - vals[0].length = strlen(argv0); - vals[0].value = argv0; - sc_client_set_value (mainwin, SmCloneCommand, SmLISTofARRAY8, 1, vals); - sc_client_set_value (mainwin, SmRestartCommand, SmLISTofARRAY8, 1, vals); - sc_client_set_value (mainwin, SmProgram, SmARRAY8, 1, vals); - - vals[0].length = strlen(g_get_user_name()?g_get_user_name():""); - vals[0].value = g_strdup(g_get_user_name()?g_get_user_name():""); - sc_client_set_value (mainwin, SmUserID, SmARRAY8, 1, vals); - - g_free(vals[0].value); - g_free(vals); - } - } -} -#endif - static gboolean sc_exiting = FALSE; static gboolean show_at_startup = TRUE; static gboolean claws_crashed_bool = FALSE; @@ -845,12 +658,7 @@ static void main_dump_features_list(gboolean show_debug_only) else g_print(" libetpan %d.%d\n", LIBETPAN_VERSION_MAJOR, LIBETPAN_VERSION_MINOR); #endif -#if HAVE_LIBSM - if (show_debug_only) - debug_print(" libSM\n"); - else - g_print(" libSM\n"); -#endif + #if HAVE_NETWORKMANAGER_SUPPORT if (show_debug_only) debug_print(" NetworkManager\n"); @@ -913,7 +721,7 @@ int main(int argc, char *argv[]) } prog_version = PROG_VERSION; -#if (defined HAVE_LIBSM || defined CRASH_DIALOG) +#ifdef CRASH_DIALOG argv0 = g_strdup(argv[0]); #endif @@ -1383,9 +1191,6 @@ int main(int argc, char *argv[]) startup_notification_complete(FALSE); #endif #endif -#ifdef HAVE_LIBSM - sc_session_manager_connect(mainwin); -#endif folder_item_update_thaw(); folderview_thaw(mainwin->folderview); @@ -1548,12 +1353,6 @@ static void exit_claws(MainWindow *mainwin) lock_socket_remove(); -#ifdef HAVE_LIBSM - if (mainwin->smc_conn) - SmcCloseConnection ((SmcConn)mainwin->smc_conn, 0, NULL); - mainwin->smc_conn = NULL; -#endif - main_window_destroy_all(); matcher_done(); diff --git a/src/mainwindow.h b/src/mainwindow.h @@ -87,7 +87,7 @@ typedef enum } LayoutType; typedef enum -{ +{ TOOLBAR_NONE = 0, TOOLBAR_ICON = 1, TOOLBAR_TEXT = 2, @@ -141,18 +141,14 @@ struct _MainWindow LogWindow *filtering_debugwin; gint progressindicator_hook; - + GtkWidget *colorlabel_menu; GtkWidget *warning_btn; GtkWidget *tags_menu; - + gboolean in_folder; GtkActionGroup *action_group; GtkUIManager *ui_manager; - -#ifdef HAVE_LIBSM - gpointer smc_conn; -#endif }; MainWindow *main_window_create (void); @@ -201,11 +197,11 @@ void main_window_popup (MainWindow *mainwin); SensitiveCondMask main_window_get_current_state (MainWindow *mainwin); -void toolbar_set_compose_button (Toolbar *toolbar, +void toolbar_set_compose_button (Toolbar *toolbar, ComposeButtonType compose_btn_type); void main_window_destroy_all (void); -void main_window_toggle_work_offline (MainWindow *mainwin, +void main_window_toggle_work_offline (MainWindow *mainwin, gboolean offline, gboolean ask_sync);