Magellan Linux

Contents of /trunk/kdebase-workspace/patches/kdebase-workspace-4.9.4-kdm-plymouth.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1994 - (show annotations) (download)
Wed Dec 19 09:48:16 2012 UTC (11 years, 4 months ago) by niro
File size: 5610 byte(s)
-added serveral patches
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;
6 }
7
8 +static int
9 +get_active_vt (void)
10 +{
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;
25 +}
26 +
27 +static int
28 +plymouth_is_running (void)
29 +{
30 + int status;
31 + status = system ("/bin/plymouth --ping");
32 +
33 + return WIFEXITED (status) && WEXITSTATUS (status) == 0;
34 +}
35 +
36 +static int
37 +plymouth_has_active_vt (void)
38 +{
39 + int status;
40 + status = system ("/bin/plymouth --has-active-vt");
41 +
42 + return WIFEXITED (status) && WEXITSTATUS (status) == 0;
43 +}
44 +
45 +static int
46 +plymouth_prepare_for_transition (void)
47 +{
48 + int status;
49 + status = system ("/bin/plymouth deactivate");
50 +
51 + return WIFEXITED (status) && WEXITSTATUS (status) == 0;
52 +}
53 +
54 +int
55 +plymouth_quit_with_transition (void)
56 +{
57 + int status;
58 + status = system ("/bin/plymouth quit --retain-splash");
59 +
60 + return WIFEXITED (status) && WEXITSTATUS (status) == 0;
61 +}
62 +
63 +static int
64 +plymouth_quit_without_transition (void)
65 +{
66 + int status;
67 + status = system ("/bin/plymouth quit");
68 +
69 + return WIFEXITED (status) && WEXITSTATUS (status) == 0;
70 +}
71 +
72 +static int
73 +triggered_to_force_display_on_active_vt (void)
74 +{
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;
81 +}
82 +
83 static void
84 allocateVT(struct display *d)
85 {
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)
89 {
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;
105 + }
106 + }
107 + else {
108 + /* plymouth might have been running but did not display
109 + * a splash screen.
110 + */
111 +
112 + /* call plymouth quit and start the X server as usual */
113 + d->plymouth_is_running = !plymouth_quit_without_transition ();
114 + }
115 +
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;
123 + }
124 + }
125 +
126 +
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 */
137 +
138 + int plymouth_is_running; /* Plymouth's status */
139 };
140
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");
162 + }
163 debug("X server ready, starting session\n");
164 startDisplayP2(d);
165 }