summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2016-01-05 16:27:41 -0500
committerAdam Jackson <ajax@redhat.com>2016-04-18 11:22:58 -0400
commite70ee11a39b957141fbc565d79d128a46fac5f34 (patch)
treeeb6314920b53ffbca3c6fcf359857eeec19e6c7f /hw
parentda9ee1eddd65d00788cef8a3becfad948c0a2168 (diff)
xfree86: Create VT atoms from the root window callback (v2)
v2: Fix swapped callback args Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/xfree86/common/xf86Init.c67
1 files changed, 25 insertions, 42 deletions
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index f5f407e2b..744af7c14 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -381,10 +381,28 @@ AddSeatId(CallbackListPtr *pcbl, void *data, void *screen)
"Failed to register seat property\n");
}
-/* The memory storing the initial value of the XFree86_has_VT root window
- * property. This has to remain available until server start-up, so we just
- * use a global. */
-static CARD32 HasVTValue = 1;
+static void
+AddVTAtoms(CallbackListPtr *pcbl, void *data, void *screen)
+{
+#define VT_ATOM_NAME "XFree86_VT"
+ int err, HasVT = 1;
+ ScreenPtr pScreen = screen;
+ Atom VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE);
+ Atom HasVTAtom = MakeAtom(HAS_VT_ATOM_NAME, sizeof(HAS_VT_ATOM_NAME) - 1,
+ TRUE);
+
+ err = dixChangeWindowProperty(serverClient, pScreen->root, VTAtom,
+ XA_INTEGER, 32, PropModeReplace, 1,
+ &xf86Info.vtno, FALSE);
+
+ err |= dixChangeWindowProperty(serverClient, pScreen->root, HasVTAtom,
+ XA_INTEGER, 32, PropModeReplace, 1,
+ &HasVT, FALSE);
+
+ if (err != Success)
+ xf86DrvMsg(pScreen->myNum, X_WARNING,
+ "Failed to register VT properties\n");
+}
/*
* InitOutput --
@@ -727,44 +745,6 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
}
formatsDone = TRUE;
- if (xf86Info.vtno >= 0) {
-#define VT_ATOM_NAME "XFree86_VT"
- Atom VTAtom = -1;
- Atom HasVTAtom = -1;
- CARD32 *VT = NULL;
- CARD32 *HasVT = &HasVTValue;
- int ret;
-
- /* This memory needs to stay available until the screen has been
- initialized, and we can create the property for real.
- */
- if ((VT = malloc(sizeof(CARD32))) == NULL) {
- FatalError
- ("Unable to make VT property - out of memory. Exiting...\n");
- }
- *VT = xf86Info.vtno;
-
- VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE);
- HasVTAtom = MakeAtom(HAS_VT_ATOM_NAME,
- sizeof(HAS_VT_ATOM_NAME) - 1, TRUE);
-
- for (i = 0, ret = Success; i < xf86NumScreens && ret == Success;
- i++) {
- ret =
- xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
- VTAtom, XA_INTEGER, 32, 1,
- VT);
- if (ret == Success)
- ret = xf86RegisterRootWindowProperty(xf86Screens[i]
- ->scrnIndex,
- HasVTAtom, XA_INTEGER,
- 32, 1, HasVT);
- if (ret != Success)
- xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
- "Failed to register VT properties\n");
- }
- }
-
/* If a screen uses depth 24, show what the pixmap format is */
for (i = 0; i < xf86NumScreens; i++) {
if (xf86Screens[i]->depth == 24) {
@@ -798,6 +778,9 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
xf86EnableIO();
}
+ if (xf86Info.vtno >= 0)
+ AddCallback(&RootWindowFinalizeCallback, AddVTAtoms, NULL);
+
if (SeatId)
AddCallback(&RootWindowFinalizeCallback, AddSeatId, SeatId);