On 17 March 2014 12:49, Michael Thayer <michael.tha...@oracle.com> wrote: > Signed-off-by: Michael Thayer <michael.tha...@oracle.com> > --- > hw/xfree86/common/xf86Events.c | 36 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 36 insertions(+) > > diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c > index 06af739..a1b43bb 100644 > --- a/hw/xfree86/common/xf86Events.c > +++ b/hw/xfree86/common/xf86Events.c > @@ -56,6 +56,7 @@ > #include <X11/X.h> > #include <X11/Xpoll.h> > #include <X11/Xproto.h> > +#include <X11/Xatom.h> > #include "misc.h" > #include "compiler.h" > #include "xf86.h" > @@ -103,6 +104,9 @@ Bool VTSwitchEnabled = TRUE; /* Allows run-time > disabling for > > extern fd_set EnabledDevices; > > +/* Name chosen to match the "XFree86_VT" atom. */ > +#define NO_VT_ATOM_NAME "XFree86_NO_VT"
Personally, I don't like negated boolean options. I would prefer a positive property like "XFree86_VT_active". > #ifdef XF86PM > extern void (*xf86OSPMClose) (void); > #endif > @@ -431,6 +435,34 @@ xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo) > pInfo->flags &= ~XI86_DEVICE_DISABLED; > } > > +/* > + * xf86CreateRemoveNoVTProperty -- > + * Set a flag property on the root window when the server VT is not active > + * as some clients need to know this. > + */ > +static void > +xf86CreateRemoveNoVTProperty(Bool create) > +{ > + Atom property_name; > + int32_t value = 1; > + int i; > + > + property_name = MakeAtom(NO_VT_ATOM_NAME, sizeof(NO_VT_ATOM_NAME) - 1, > + TRUE); > + if (property_name == BAD_RESOURCE) > + FatalError("Failed to create or retrieve \"NO_VT\" atom\n"); > + for (i = 0; i < xf86NumScreens; i++) { > + if (create) > + ChangeWindowProperty(xf86ScrnToScreen(xf86Screens[i])->root, > + property_name, XA_INTEGER, 32, > + PropModeReplace, 1, &value, TRUE); > + else > + DeleteProperty(serverClient, > + xf86ScrnToScreen(xf86Screens[i])->root, > + property_name); > + } I think it would be better not to delete the property. Then a client knows for sure if the server supports it or not, regardless of when the client gets started. > +} > + > void > xf86VTLeave(void) > { > @@ -490,6 +522,8 @@ xf86VTLeave(void) > if (xorgHWAccess) > xf86DisableIO(); > > + xf86CreateRemoveNoVTProperty(TRUE); > + > return; > > switch_failed: > @@ -574,6 +608,8 @@ xf86VTEnter(void) > xf86platformVTProbe(); > #endif > > + xf86CreateRemoveNoVTProperty(FALSE); > + > OsReleaseSIGIO(); > } > > -- > ORACLE Deutschland B.V. & Co. KG Michael Thayer > Werkstrasse 24 VirtualBox engineering > 71384 Weinstadt, Germany mailto:michael.tha...@oracle.com > > Hauptverwaltung: Riesstr. 25, D-80992 München > Registergericht: Amtsgericht München, HRA 95603 > Geschäftsführer: Jürgen Kunz > > Komplementärin: ORACLE Deutschland Verwaltung B.V. > Hertogswetering 163/167, 3543 AS Utrecht, Niederlande > Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697 > Geschäftsführer: Alexander van der Ven, Astrid Kepper, Val Maher > _______________________________________________ > xorg-devel@lists.x.org: X.Org development > Archives: http://lists.x.org/archives/xorg-devel > Info: http://lists.x.org/mailman/listinfo/xorg-devel _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel