updated on Mon Jan 23 12:00:23 UTC 2012
[aur-mirror.git] / kdebase-workspace-plymouth / kdebase-workspace-4.4.92-kdm_plymouth081.patch
blob2c49ccd48098717885a09c1829997b6728a162ce
1 diff -up kdebase-workspace-4.4.92/kdm/backend/dm.c.kdm_plymouth kdebase-workspace-4.4.92/kdm/backend/dm.c
2 --- kdebase-workspace-4.4.92/kdm/backend/dm.c.kdm_plymouth 2010-07-06 01:54:30.000000000 -0500
3 +++ kdebase-workspace-4.4.92/kdm/backend/dm.c 2010-07-07 13:55:48.425171749 -0500
4 @@ -1329,6 +1329,81 @@ getBusyVTs(void)
5 return activeVTs;
8 +static int
9 +get_active_vt (void)
11 + int console_fd;
12 + struct vt_stat console_state = { 0 };
13 + console_fd = open ("/dev/tty0", O_RDONLY | O_NOCTTY);
14 + if (console_fd < 0) {
15 + goto out;
16 + }
17 + if (ioctl (console_fd, VT_GETSTATE, &console_state) < 0) {
18 + goto out;
19 + }
20 +out:
21 + if (console_fd >= 0) {
22 + close (console_fd);
23 + }
24 + return console_state.v_active;
27 +static int
28 +plymouth_is_running (void)
30 + int status;
31 + status = system ("/bin/plymouth --ping");
33 + return WIFEXITED (status) && WEXITSTATUS (status) == 0;
36 +static int
37 +plymouth_has_active_vt (void)
39 + int status;
40 + status = system ("/bin/plymouth --has-active-vt");
42 + return WIFEXITED (status) && WEXITSTATUS (status) == 0;
45 +static int
46 +plymouth_prepare_for_transition (void)
48 + int status;
49 + status = system ("/bin/plymouth deactivate");
51 + return WIFEXITED (status) && WEXITSTATUS (status) == 0;
54 +int
55 +plymouth_quit_with_transition (void)
57 + int status;
58 + status = system ("/bin/plymouth quit --retain-splash");
60 + return WIFEXITED (status) && WEXITSTATUS (status) == 0;
63 +static int
64 +plymouth_quit_without_transition (void)
66 + int status;
67 + status = system ("/bin/plymouth quit");
69 + return WIFEXITED (status) && WEXITSTATUS (status) == 0;
72 +static int
73 +triggered_to_force_display_on_active_vt (void)
75 + int should_force_display_on_active_vt;
76 + should_force_display_on_active_vt=open("/var/spool/gdm/force-display-on-active-vt", O_RDONLY);
77 + if ( should_force_display_on_active_vt >= 0 )
78 + close(should_force_display_on_active_vt);
79 + unlink("/var/spool/gdm/force-display-on-active-vt");
80 + return should_force_display_on_active_vt;
83 static void
84 allocateVT(struct display *d)
86 @@ -1338,6 +1413,43 @@ allocateVT(struct display *d)
87 if ((d->displayType & d_location) == dLocal &&
88 d->status == notRunning && !d->serverVT && d->reqSrvVT >= 0)
90 + /* check for plymouth using newer methods */
91 + d->plymouth_is_running = plymouth_is_running ();
92 + if (d->plymouth_is_running) {
93 + /* call plymouth deactivate */
94 + plymouth_prepare_for_transition ();
95 + if (plymouth_has_active_vt ()) {
96 + /* plymouth was displaying a splash screen and has
97 + * terminated leaving it on screen
98 + */
99 + int vt;
100 + vt = get_active_vt ();
101 + if (vt > 0) {
102 + /* start the X server on the active vt */
103 + d->serverVT = vt;
104 + return;
107 + else {
108 + /* plymouth might have been running but did not display
109 + * a splash screen.
110 + */
112 + /* call plymouth quit and start the X server as usual */
113 + d->plymouth_is_running = !plymouth_quit_without_transition ();
116 + /* fallback to old/deprecated method */
117 + } else if ( triggered_to_force_display_on_active_vt() >= 0 ) {
118 + int vt;
119 + vt = get_active_vt();
120 + if (vt > 0) {
121 + d->serverVT = vt;
122 + return;
127 if (d->reqSrvVT && d->reqSrvVT < 16) {
128 d->serverVT = d->reqSrvVT;
129 } else {
130 diff -up kdebase-workspace-4.4.92/kdm/backend/dm.h.kdm_plymouth kdebase-workspace-4.4.92/kdm/backend/dm.h
131 --- kdebase-workspace-4.4.92/kdm/backend/dm.h.kdm_plymouth 2010-07-06 01:54:30.000000000 -0500
132 +++ kdebase-workspace-4.4.92/kdm/backend/dm.h 2010-07-07 13:48:11.874921158 -0500
133 @@ -292,6 +292,8 @@ struct display {
134 int authNum; /* number of authorizations */
135 char *authFile; /* file to store authorization in */
136 char *greeterAuthFile; /* file to store authorization for greeter in */
138 + int plymouth_is_running; /* Plymouth's status */
141 #define d_location 1
142 @@ -404,6 +406,8 @@ int anyDisplaysLeft(void);
143 void forEachDisplay(void (*f)(struct display *));
144 #ifdef HAVE_VTS
145 void forEachDisplayRev(void (*f)(struct display *));
146 +/* function for plymouth */
147 +int plymouth_quit_with_transition (void);
148 #endif
149 void removeDisplay(struct display *old);
150 struct display
151 diff -up kdebase-workspace-4.4.92/kdm/backend/server.c.kdm_plymouth kdebase-workspace-4.4.92/kdm/backend/server.c
152 --- kdebase-workspace-4.4.92/kdm/backend/server.c.kdm_plymouth 2010-07-06 01:54:30.000000000 -0500
153 +++ kdebase-workspace-4.4.92/kdm/backend/server.c 2010-07-07 13:56:46.960921366 -0500
154 @@ -137,6 +137,11 @@ startServerSuccess()
155 struct display *d = startingServer;
156 d->serverStatus = ignore;
157 serverTimeout = TO_INF;
158 + if (d->plymouth_is_running) {
159 + debug( "Quitting Plymouth with transition\n" );
160 + d->plymouth_is_running = !plymouth_quit_with_transition ();
161 + debug ("Is Plymouth still running? %s\n", d->plymouth_is_running ? "yes" : "no");
163 debug("X server ready, starting session\n");
164 startDisplayP2(d);