SHA256
1
0
forked from pool/gdm
gdm/gdm-look-at-runlevel.patch

58 lines
1.6 KiB
Diff
Raw Normal View History

Index: gdm-2.28.0/daemon/gdm-static-display.c
===================================================================
--- gdm-2.28.0.orig/daemon/gdm-static-display.c
+++ gdm-2.28.0/daemon/gdm-static-display.c
@@ -26,6 +26,7 @@
#include <fcntl.h>
#include <pwd.h>
#include <unistd.h>
+#include <utmp.h>
#include <string.h>
#include <signal.h>
#include <sys/stat.h>
@@ -96,6 +97,29 @@ gdm_static_display_manage (GdmDisplay *d
}
static gboolean
+gdm_static_display_should_manage_again (void)
+{
+ struct utmp *ut;
+
+ setutent();
+ while ((ut = getutent()) != NULL) {
+ if (ut->ut_type == RUN_LVL) {
+ char current;
+ current = ut->ut_pid % 256;
+ endutent();
+
+ if (current == '0' || current == '6')
+ return FALSE;
+ return TRUE;
+ }
+ }
+
+ endutent();
+
+ return TRUE;
+}
+
+static gboolean
gdm_static_display_finish (GdmDisplay *display)
{
int status;
@@ -108,9 +132,11 @@ gdm_static_display_finish (GdmDisplay *d
/* restart static displays */
gdm_display_unmanage (display);
- status = gdm_display_get_status (display);
- if (status != GDM_DISPLAY_FAILED) {
- gdm_display_manage (display);
+ if (gdm_static_display_should_manage_again ()) {
+ status = gdm_display_get_status (display);
+ if (status != GDM_DISPLAY_FAILED) {
+ gdm_display_manage (display);
+ }
}
return TRUE;