This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository e16.

View the commit online.

commit 7a6a475b20a241acaf5001253550a0de7ac97deb
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Sun Mar 10 21:55:18 2024 +0100

    session: Eliminate SetSMID()
---
 src/E.h       |  7 ++++++-
 src/main.c    |  6 ++++--
 src/session.c | 28 ++++++++--------------------
 src/session.h |  3 +--
 4 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/src/E.h b/src/E.h
index 1c7a0061..1f507eaa 100644
--- a/src/E.h
+++ b/src/E.h
@@ -3,7 +3,7 @@
 /*****************************************************************************/
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
- * Copyright (C) 2004-2023 Kim Woelders
+ * Copyright (C) 2004-2024 Kim Woelders
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -400,6 +400,11 @@ typedef struct {
         EX_Pixmap       ext_pmap;
         char            ext_pmap_valid;
     } root;
+#if USE_SM
+    struct {
+        char           *sm_client_id;
+    } session;
+#endif
     struct {
         bool            cache_rebuild;
         char           *paths;
diff --git a/src/main.c b/src/main.c
index 6b271d18..63230f36 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
- * Copyright (C) 2004-2022 Kim Woelders
+ * Copyright (C) 2004-2024 Kim Woelders
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -195,7 +195,9 @@ main(int argc, char **argv)
             Dpy.screen = Strtoi(eoptarg, 10);
             break;
         case 'S':
-            SetSMID(eoptarg);
+#if USE_SM
+            Mode.session.sm_client_id = Estrdup(eoptarg);
+#endif
             break;
         case 't':
             theme = Estrdup(eoptarg);
diff --git a/src/session.c b/src/session.c
index e765a8a1..57102081 100644
--- a/src/session.c
+++ b/src/session.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
- * Copyright (C) 2004-2023 Kim Woelders
+ * Copyright (C) 2004-2024 Kim Woelders
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -49,7 +49,6 @@ static char     restarting = 0;
  */
 #define USE_DISCARD_PROPERTY 0
 
-static char    *sm_client_id = NULL;
 static SmcConn  sm_conn = NULL;
 
 static int      sm_efd = 0;
@@ -204,7 +203,7 @@ set_save_props(SmcConn smc_conn, int master_flag)
         restartVal[n++].value = (char *)"-Q";
         restartVal[n++].value = (char *)s;
     }
-    s = sm_client_id;
+    s = Mode.session.sm_client_id;
     restartVal[n++].value = (char *)"-S";
     restartVal[n++].value = (char *)s;
 
@@ -362,9 +361,10 @@ ice_init(void)
                           SmcSaveYourselfProcMask | SmcDieProcMask |
                           SmcSaveCompleteProcMask |
                           SmcShutdownCancelledProcMask, &callbacks,
-                          sm_client_id, &client_id, 4096, error_string_ret);
+                          Mode.session.sm_client_id, &client_id,
+                          4096, error_string_ret);
 
-    EFREE_SET(sm_client_id, client_id);
+    EFREE_SET(Mode.session.sm_client_id, client_id);
 
     if (error_string_ret[0])
         Eprintf("While connecting to session manager: %s.", error_string_ret);
@@ -414,19 +414,6 @@ SessionInit(void)
 #endif
 }
 
-#if USE_SM
-void
-SetSMID(const char *smid)
-{
-    sm_client_id = Estrdup(smid);
-}
-#else
-void
-SetSMID(const char *smid __UNUSED__)
-{
-}
-#endif                          /* USE_SM */
-
 static void
 SessionSave(int shutdown)
 {
@@ -518,8 +505,9 @@ doSMExit(int mode, const char *params)
             l += Esnprintf(s + l, sizeof(s) - l, " -w %dx%d",
                            WinGetW(VROOT), WinGetH(VROOT));
 #if USE_SM
-        if (sm_client_id)
-            l += Esnprintf(s + l, sizeof(s) - l, " -S %s", sm_client_id);
+        if (Mode.session.sm_client_id)
+            l += Esnprintf(s + l, sizeof(s) - l, " -S %s",
+                           Mode.session.sm_client_id);
 #endif
 #ifdef USE_EXT_INIT_WIN
         if (new_init_win_ext != NoXID)
diff --git a/src/session.h b/src/session.h
index 53cf8069..7f145428 100644
--- a/src/session.h
+++ b/src/session.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
- * Copyright (C) 2004-2007 Kim Woelders
+ * Copyright (C) 2004-2024 Kim Woelders
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -40,6 +40,5 @@
 void            SessionInit(void);
 void            SessionExit(int mode, const char *params);
 void            SessionHelper(int when);
-void            SetSMID(const char *smid);
 
 #endif                          /* _SESSION_H_ */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to