summaryrefslogtreecommitdiff
path: root/xserver/hw/xfree86
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2021-01-10 09:14:49 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2021-01-10 09:14:49 +0000
commit94f1d85d799752ed01d2962b0cb51d2cdac29f76 (patch)
tree8a5b756754e0451f931ee590d97611cdbd97eb92 /xserver/hw/xfree86
parentcae058d3c3d681416b09b9ed79daa0ac034cbd5a (diff)
Add a root window property with the console device.
Diffstat (limited to 'xserver/hw/xfree86')
-rw-r--r--xserver/hw/xfree86/common/xf86Init.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/xserver/hw/xfree86/common/xf86Init.c b/xserver/hw/xfree86/common/xf86Init.c
index 92d75bbc2..67700e8aa 100644
--- a/xserver/hw/xfree86/common/xf86Init.c
+++ b/xserver/hw/xfree86/common/xf86Init.c
@@ -276,6 +276,27 @@ AddSeatId(CallbackListPtr *pcbl, void *data, void *screen)
}
static void
+AddConsole(CallbackListPtr *pcbl, void *data, void *screen)
+{
+#define VT_ATOM_CONSOLE "Xorg_Console"
+ int err;
+ ScreenPtr pScreen = screen;
+ Atom ConsoleAtom = MakeAtom(VT_ATOM_CONSOLE, sizeof(VT_ATOM_CONSOLE) - 1,
+ TRUE);
+ char *device = ttyname(xf86Info.consoleFd);
+
+ if (device == NULL)
+ return;
+
+ err = dixChangeWindowProperty(serverClient, pScreen->root, ConsoleAtom,
+ XA_STRING, 8, PropModeReplace,
+ strlen(device) + 1, device, FALSE);
+ if (err != Success)
+ xf86DrvMsg(pScreen->myNum, X_WARNING,
+ "Failed to register Console property\n");
+}
+
+static void
AddVTAtoms(CallbackListPtr *pcbl, void *data, void *screen)
{
#define VT_ATOM_NAME "XFree86_VT"
@@ -647,6 +668,9 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
xf86EnableIO();
}
+ if (xf86Info.consoleFd >= 0)
+ AddCallback(&RootWindowFinalizeCallback, AddConsole, NULL);
+
if (xf86Info.vtno >= 0)
AddCallback(&RootWindowFinalizeCallback, AddVTAtoms, NULL);