]> Dogcows Code - chaz/openbox/blobdiff - openbox/session.c
export if the keyboard and pointer are currently grabbed or not
[chaz/openbox] / openbox / session.c
index 181dfe8d7411a75660683140e37e1a6fdf1a86a6..e671a3194fe06490f632f18fc209b9f319a20958 100644 (file)
@@ -1,3 +1,21 @@
+/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
+
+   session.c for the Openbox window manager
+   Copyright (c) 2003        Ben Jansens
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   See the COPYING file for a copy of the GNU General Public License.
+*/
+
 /* This session code is largely inspired by metacity code. */
 
 #ifndef USE_SM
@@ -42,6 +60,7 @@ static gchar      *save_file;
 static gchar      *sm_id;
 static gint        sm_argc;
 static gchar     **sm_argv;
+static gchar      *sm_sessions_path;
 
 static void session_load(char *path);
 static gboolean session_save();
@@ -141,6 +160,10 @@ void session_startup(int *argc, char ***argv)
     if (sm_disable)
         return;
 
+    sm_sessions_path = g_build_filename(parse_xdg_data_home_path(),
+                                        "openbox", "sessions", NULL);
+    parse_mkdir_path(sm_sessions_path, 0700);
+
     if (save_file)
         session_load(save_file);
 
@@ -167,7 +190,7 @@ void session_startup(int *argc, char ***argv)
                                 &cb, sm_id, &sm_id,
                                 SM_ERR_LEN, sm_err);
     if (sm_conn == NULL)
-        g_warning("Failed to connect to session manager: %s", sm_err);
+        ob_debug("Failed to connect to session manager: %s", sm_err);
     else {
         SmPropValue val_prog;
         SmPropValue val_uid;
@@ -224,6 +247,7 @@ void session_startup(int *argc, char ***argv)
 
 void session_shutdown()
 {
+    g_free(sm_sessions_path);
     g_free(save_file);
     g_free(sm_id);
 
@@ -275,7 +299,7 @@ static void sm_save_yourself(SmcConn conn, SmPointer data, int save_type,
 
 static void sm_die(SmcConn conn, SmPointer data)
 {
-    ob_exit();
+    ob_exit(0);
 }
 
 static void sm_save_complete(SmcConn conn, SmPointer data)
@@ -298,8 +322,7 @@ static gboolean session_save()
                                (int) time(NULL),
                                (int) getpid(),
                                g_random_int());
-    save_file = g_build_filename(g_get_home_dir(), ".openbox", "sessions",
-                                 filename, NULL);
+    save_file = g_build_filename(sm_sessions_path, filename, NULL);
     g_free(filename);
 
     f = fopen(save_file, "w");
This page took 0.022325 seconds and 4 git commands to generate.