compiz/restart.patch

94 lines
2.0 KiB
Diff
Raw Normal View History

2006-09-26 18:08:46 +00:00
--- compiz-3173a142efe5e7af83ebb534a074d9d2a0c67a86/src/session.c.restart 2006-08-17 17:36:07.000000000 -0400
+++ compiz-3173a142efe5e7af83ebb534a074d9d2a0c67a86/src/session.c 2006-09-26 13:57:18.000000000 -0400
@@ -49,6 +49,71 @@
static void iceInit (void);
static void
+set_string_list_property (SmcConn connection,
+ const char *name,
+ const char **values)
+{
+ SmProp prop, *pProp;
+ int i;
+
+ prop.name = (char *)name;
+ prop.type = SmLISTofARRAY8;
+
+ i = 0;
+ while (values[i] != NULL)
+ i++;
+
+ prop.vals = malloc (i * sizeof (SmPropValue));
+ if (!prop.vals)
+ return;
+
+ i = 0;
+ while (values[i] != NULL)
+ {
+ prop.vals[i].value = (char *)values[i];
+ prop.vals[i].length = strlen (values[i]);
+
+ i++;
+ }
+
+ prop.num_vals = i;
+
+ pProp = ∝
+ SmcSetProperties (connection, 1, &pProp);
+
+ free (prop.vals);
+}
+
+static void
+set_clone_restart_commands (SmcConn connection)
+{
+ const char *clone[] = { "compiz", NULL };
+ const char *restart[] = { "compiz", "gconf", NULL };
+
+ set_string_list_property (connection, SmCloneCommand, clone);
+ set_string_list_property (connection, SmRestartCommand, restart);
+}
+
+static void
+set_restart_style (SmcConn connection)
+{
+ SmProp prop, *pProp;
+ SmPropValue propVal;
+ char hint = SmRestartImmediately;
+
+ prop.name = SmRestartStyleHint;
+ prop.type = SmCARD8;
+ prop.num_vals = 1;
+ prop.vals = &propVal;
+ propVal.value = &hint;
+ propVal.length = 1;
+
+ pProp = ∝
+
+ SmcSetProperties (connection, 1, &pProp);
+}
+
+static void
saveYourselfGotProps (SmcConn connection,
SmPointer client_data,
int num_props,
@@ -69,13 +134,16 @@
SmcSetProperties (connection, 1, &props[p]);
props[p]->vals[i + 1] = oldVal;
- SmcSaveYourselfDone (connection, 1);
- return;
+ goto out;
}
}
}
}
+out:
+ set_restart_style (connection);
+ set_clone_restart_commands (connection);
+
SmcSaveYourselfDone (connection, 1);
}