diff -up kdebase-workspace-4.4.2/kdm/backend/dm.c.kdm_plymouth kdebase-workspace-4.4.2/kdm/backend/dm.c
--- kdebase-workspace-4.4.2/kdm/backend/dm.c.kdm_plymouth 2009-10-26 04:14:47.000000000 -0500
+++ kdebase-workspace-4.4.2/kdm/backend/dm.c 2010-04-13 09:04:27.722245637 -0500
@@ -1330,6 +1330,36 @@ getBusyVTs( void )
return activeVTs;
}
+static int
+get_active_vt (void)
+{
+ int console_fd;
+ struct vt_stat console_state = { 0 };
+ console_fd = open ("/dev/tty0", O_RDONLY | O_NOCTTY);
+ if (console_fd < 0) {
+ goto out;
+ }
+ if (ioctl (console_fd, VT_GETSTATE, &console_state) < 0) {
+ goto out;
+ }
+out:
+ if (console_fd >= 0) {
+ close (console_fd);
+ }
+ return console_state.v_active;
+}
+
+static int
+triggered_to_force_display_on_active_vt (void)
+{
+ int should_force_display_on_active_vt;
+ should_force_display_on_active_vt=open("/var/spool/gdm/force-display-on-active-vt", O_RDONLY);
+ if ( should_force_display_on_active_vt >= 0 )
+ close(should_force_display_on_active_vt);
+ unlink("/var/spool/gdm/force-display-on-active-vt");
+ return should_force_display_on_active_vt;
+}
+
static void
allocateVT( struct display *d )
{
@@ -1339,6 +1369,14 @@ allocateVT( struct display *d )
if ((d->displayType & d_location) == dLocal &&
d->status == notRunning && !d->serverVT && d->reqSrvVT >= 0)
{
+ if ( triggered_to_force_display_on_active_vt() >= 0 ) {
+ int vt;
+ vt = get_active_vt();
+ if (vt > 0) {
+ d->serverVT = vt;
+ return;
+ }
+ }
if (d->reqSrvVT && d->reqSrvVT < 16)
d->serverVT = d->reqSrvVT;
else {