29
29
#include <sys/stat.h>
30
30
#include <sys/types.h>
33
#include <X11/Xatom.h>
36
40
#include "gdm-common.h"
37
41
#include "gdm-daemon-config.h"
45
* Get the VT number associated with the display via the XFree86_VT
49
gdm_get_current_vtnum (Display *display)
55
unsigned long bytes_after;
59
prop = XInternAtom (display, "XFree86_VT", False);
61
gdm_debug ("no XFree86_VT atom\n");
64
if (XGetWindowProperty (display, DefaultRootWindow (display), prop, 0, 1,
65
False, AnyPropertyType, &actualtype, &actualformat,
66
&nitems, &bytes_after, &buf)) {
67
gdm_debug ("no XFree86_VT property\n");
71
gdm_debug ("%lu items in XFree86_VT property!\n", nitems);
80
switch (actualformat) {
82
num = (*(uint8_t *)(void *)buf);
85
num = (*(uint16_t *)(void *)buf);
88
num = (*(uint32_t *)(void *)buf);
91
gdm_debug ("format %d in XFree86_VT property!\n", actualformat);
97
gdm_debug ("type %lx in XFree86_VT property!\n", actualtype);
106
gdm_get_vt_device (int vtno)
108
gchar *vtname = NULL;
110
#if defined (GDM_USE_SYS_VT)
112
vtname = g_strdup_printf ("/dev/vt/%d", vtno);
114
vtname = g_strdup_printf ("/dev/tty%d", vtno);
116
#elif defined (GDM_USE_CONSIO_VT)
117
vtname = g_strdup_printf ("/dev/ttyv%s", __itovty (vtno - 1));
39
123
#if defined (GDM_USE_SYS_VT) || defined (GDM_USE_CONSIO_VT)
70
154
char *vtname = NULL;
73
#if defined (GDM_USE_SYS_VT)
75
vtname = g_strdup_printf ("/dev/vt/%d", vtno);
77
vtname = g_strdup_printf ("/dev/tty%d", vtno);
79
#elif defined (GDM_USE_CONSIO_VT)
80
vtname = g_strdup_printf ("/dev/ttyv%s", __itovty (vtno - 1));
157
vtname = gdm_get_vt_device (vtno);
84
161
fd = open (vtname, O_RDWR