Add restart.patch (200280)

This commit is contained in:
sandmann 2006-09-26 18:08:46 +00:00
parent 5049cbe121
commit 15824cf8f4
2 changed files with 99 additions and 0 deletions

View File

@ -52,6 +52,7 @@ Patch110: thumbnail-sorting.patch
Patch111: button-clicks.patch
Patch112: positioning.patch
Patch113: resize-offset.patch
Patch114: restart.patch
%description
Compiz is one of the first OpenGL-accelerated compositing window
@ -94,6 +95,7 @@ windows and compositing manager.
%patch111 -p1 -b .button-clicks
%patch112 -p1 -b .positioning
%patch113 -p1 -b .resize-offset
%patch114 -p1 -b .restart
%build
rm -rf $RPM_BUILD_ROOT
@ -173,6 +175,10 @@ rm -rf $RPM_BUILD_ROOT
%{_includedir}/compiz
%changelog
* Tue Sep 26 2006 Soren Sandmann <sandmann@redhat.com> - 0.0.13-0.29.20060817git.fc6
- Add restart.patch to make compiz ask the session manager to restart it
if it crashes (bug 200280).
* Mon Sep 25 2006 Soren Sandmann <sandmann@redhat.com> - 0.0.13-0.28.20060817git.fc6
- Change plane.patch to not do cyclical window movement in dimensions
where the desktop has size 1 (bug 207263).

93
restart.patch Normal file
View File

@ -0,0 +1,93 @@
--- 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 = &prop;
+ 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 = &prop;
+
+ 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);
}