[Xquartz-changes] xserver: Branch 'master' - 13 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Wed Apr 18 01:11:10 PDT 2012


 Xi/exevents.c                         |   86 +++
 Xi/xiquerydevice.c                    |    2 
 dix/events.c                          |    3 
 dix/getevents.c                       |    2 
 hw/xfree86/common/xf86Events.c        |    8 
 hw/xfree86/common/xf86Xinput.h        |    3 
 hw/xfree86/dixmods/extmod/xf86vmode.c |  826 +++++++++++++++++++---------------
 hw/xfree86/modes/xf86Rotate.c         |    3 
 hw/xquartz/xpr/xprFrame.c             |    2 
 test/Makefile.am                      |    5 
 10 files changed, 581 insertions(+), 359 deletions(-)

New commits:
commit cf059966fcba7eb3c2cc5e298887e4802f0a0126
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Apr 18 01:01:44 2012 -0700

    XQuartz: Fix a deadlock in pre-dispatch code
    
    The fact that this has been in place so long makes me really wonder if
    anybody cares about this running in Tiger or Leopard.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 4c7aac4..01f1def 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -212,7 +212,7 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
 #else
     pthread_rwlock_wrlock(&window_hash_rwlock);
     x_hash_table_insert(window_hash, pFrame->wid, pFrame);
-    pthread_rwlock_wrlock(&window_hash_rwlock);
+    pthread_rwlock_unlock(&window_hash_rwlock);
 #endif
 
     xprSetNativeProperty(pFrame);
commit 38016e8761976839a12a84f43347012cf9fac193
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 7 15:26:53 2012 -0700

    test: Fix make dist
    
    It seems like make dist should be doing te right thing without this commit,
    but it's not in some cases.  Don't ask me to explain why.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/test/Makefile.am b/test/Makefile.am
index eb61470..32be00d 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -53,8 +53,6 @@ libxservertest_la_LIBADD += \
             $(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la \
             @XORG_LIBS@
 
-EXTRA_DIST = ddxstubs.c
-
 else
 nodist_libxservertest_la_SOURCES = \
             ddxstubs.c \
@@ -110,3 +108,6 @@ endif
 
 libxservertest_la_DEPENDENCIES = $(libxservertest_la_LIBADD)
 endif
+
+EXTRA_DIST = ddxstubs.c
+
commit 80fefc42f5e67e6b4a4b440d8991bee7e5f38359
Merge: 9779b90 12188c8
Author: Keith Packard <keithp at keithp.com>
Date:   Sun Apr 15 21:05:30 2012 -0700

    Merge remote-tracking branch 'whot/for-keith'

commit 12188c8a8a537b38b1ca4cf8c0de5447e19c886a
Author: Chase Douglas <chase.douglas at canonical.com>
Date:   Tue Apr 3 17:31:01 2012 -0700

    Use touch state when querying pointer through core protocol
    
    QueryPointer is part of the core protocol. As such, it knows nothing
    about touch devices. Touches are converted to button 1 press, pointer
    motion, and button 1 release for core clients, so we should ensure the
    pointer state mask has button 1 set when XQueryPointer is used.
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/events.c b/dix/events.c
index 4470947..b9f9cfa 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -5098,8 +5098,7 @@ ProcQueryPointer(ClientPtr client)
     memset(&rep, 0, sizeof(xQueryPointerReply));
     rep.type = X_Reply;
     rep.sequenceNumber = client->sequence;
-    rep.mask = mouse->button ? (mouse->button->state) : 0;
-    rep.mask |= XkbStateFieldFromRec(&keyboard->key->xkbInfo->state);
+    rep.mask = event_get_corestate(mouse, keyboard);
     rep.length = 0;
     rep.root = (GetCurrentRootWindow(mouse))->drawable.id;
     rep.rootX = pSprite->hot.x;
commit 32ece7c09bf0ebc3d99b4078aacebbd44314776a
Author: Chase Douglas <chase.douglas at canonical.com>
Date:   Tue Apr 10 17:12:42 2012 -0700

    Ensure sequential touches are pointer emulated sequentially
    
    Issue:
    * Two sequential touches (i.e. down, up, down, up)
    * Both are grabbed by a touch grab
    * Both have a second listener in the form of a pointer grab or selection
    * The second and first touches are rejected in that order
    
    The first touch must be pointer emulated before the second touch, so the
    second touch must be paused until the first touch is rejected or
    accepted and all events are delivered to pointer clients.
    
    This change ensures all pointer emulated events are emitted
    sequentially. It necessarily imposes a delay on further touch events
    when pointer grabs and selections are used, but there is no way around
    it.
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index a843e03..c05c226 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1111,6 +1111,48 @@ EmitTouchEnd(DeviceIntPtr dev, TouchPointInfoPtr ti, int flags, XID resource)
 }
 
 /**
+ * Find the oldest touch that still has a pointer emulation client.
+ *
+ * Pointer emulation can only be performed for the oldest touch. Otherwise, the
+ * order of events seen by the client will be wrong. This function helps us find
+ * the next touch to be emulated.
+ *
+ * @param dev The device to find touches for.
+ */
+static TouchPointInfoPtr
+FindOldestPointerEmulatedTouch(DeviceIntPtr dev)
+{
+    TouchPointInfoPtr oldest = NULL;
+    int i;
+
+    for (i = 0; i < dev->touch->num_touches; i++) {
+        TouchPointInfoPtr ti = dev->touch->touches + i;
+        int j;
+
+        if (!ti->active || !ti->emulate_pointer)
+            continue;
+
+        for (j = 0; j < ti->num_listeners; j++) {
+            if (ti->listeners[j].type == LISTENER_POINTER_GRAB ||
+                ti->listeners[j].type == LISTENER_POINTER_REGULAR)
+                break;
+        }
+        if (j == ti->num_listeners)
+            continue;
+
+        if (!oldest) {
+            oldest = ti;
+            continue;
+        }
+
+        if (oldest->client_id - ti->client_id < UINT_MAX / 2)
+            oldest = ti;
+    }
+
+    return oldest;
+}
+
+/**
  * If the current owner has rejected the event, deliver the
  * TouchOwnership/TouchBegin to the next item in the sprite stack.
  */
@@ -1123,8 +1165,16 @@ TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
         ti->listeners[0].state == LISTENER_EARLY_ACCEPT)
         DeliverTouchEvents(dev, ti, (InternalEvent *) ev,
                            ti->listeners[0].listener);
-    else if (ti->listeners[0].state == LISTENER_AWAITING_BEGIN)
+    else if (ti->listeners[0].state == LISTENER_AWAITING_BEGIN) {
+        /* We can't punt to a pointer listener unless all older pointer
+         * emulated touches have been seen already. */
+        if ((ti->listeners[0].type == LISTENER_POINTER_GRAB ||
+             ti->listeners[0].type == LISTENER_POINTER_REGULAR) &&
+            ti != FindOldestPointerEmulatedTouch(dev))
+            return;
+
         TouchEventHistoryReplay(ti, dev, ti->listeners[0].listener);
+    }
 
     /* If we've just removed the last grab and the touch has physically
      * ended, send a TouchEnd event too and finalise the touch. */
@@ -1139,6 +1189,25 @@ TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
 }
 
 /**
+ * Check the oldest touch to see if it needs to be replayed to its pointer
+ * owner.
+ *
+ * Touch event propagation is paused if it hits a pointer listener while an
+ * older touch with a pointer listener is waiting on accept or reject. This
+ * function will restart propagation of a paused touch if needed.
+ *
+ * @param dev The device to check touches for.
+ */
+static void
+CheckOldestTouch(DeviceIntPtr dev)
+{
+    TouchPointInfoPtr oldest = FindOldestPointerEmulatedTouch(dev);
+
+    if (oldest && oldest->listeners[0].state == LISTENER_AWAITING_BEGIN)
+        TouchPuntToNextOwner(dev, oldest, NULL);
+}
+
+/**
  * Process a touch rejection.
  *
  * @param sourcedev The source device of the touch sequence.
@@ -1169,6 +1238,7 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
      * finish, then we can just kill it now. */
     if (ti->num_listeners == 1 && ti->pending_finish) {
         TouchEndTouch(sourcedev, ti);
+        CheckOldestTouch(sourcedev);
         return;
     }
 
@@ -1184,6 +1254,8 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
      * the TouchOwnership or TouchBegin event to the new owner. */
     if (ev && ti->num_listeners > 0 && was_owner)
         TouchPuntToNextOwner(sourcedev, ti, ev);
+
+    CheckOldestTouch(sourcedev);
 }
 
 /**
@@ -1391,6 +1463,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
                 !dev->button->buttonsDown &&
                 dev->deviceGrab.fromPassiveGrab && GrabIsPointerGrab(grab)) {
                 (*dev->deviceGrab.DeactivateGrab) (dev);
+                CheckOldestTouch(dev);
                 return Success;
             }
         }
commit 163b0f375d73c05873fb341652de3ed347337828
Author: Chase Douglas <chase.douglas at canonical.com>
Date:   Tue Apr 10 17:12:41 2012 -0700

    Update event type when delivering end event to a pointer listener
    
    Just like when we deliver to a touch listener, we must convert a touch
    end event to an update event for further clients. This also ensures that
    the touch record is not deleted at the end of ProcessTouchEvent().
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 3117123..a843e03 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1757,6 +1757,13 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
         listener->type == LISTENER_POINTER_GRAB) {
         rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
                                        grab, xi2mask);
+
+        if (ti->num_listeners > 1) {
+            ev->any.type = ET_TouchUpdate;
+            ev->device_event.flags |= TOUCH_PENDING_END;
+            ti->pending_finish = TRUE;
+        }
+
         goto out;
     }
 
commit 210cd12c47d063f97915ff23292b61d09abfd73a
Author: Chase Douglas <chase.douglas at canonical.com>
Date:   Tue Apr 10 17:12:40 2012 -0700

    Don't update listener after deactivating implicit pointer grab
    
    After the pointer grab is deactivated, the touch listener record is
    updated at the end of DeliverTouchEmulatedEvent. However, the touch
    record is ended when the grab is deactivated, so the update to the
    listener record is in an array of memory that has been freed.
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index ff22240..3117123 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1389,8 +1389,10 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
 
             if (ev->any.type == ET_TouchEnd &&
                 !dev->button->buttonsDown &&
-                dev->deviceGrab.fromPassiveGrab && GrabIsPointerGrab(grab))
+                dev->deviceGrab.fromPassiveGrab && GrabIsPointerGrab(grab)) {
                 (*dev->deviceGrab.DeactivateGrab) (dev);
+                return Success;
+            }
         }
     }
     else {
commit 82a1ae0af3b136371638659c3e909880a99f721c
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Apr 12 15:54:00 2012 +1000

    xfree86: after VT switching back, only enable previously enabled devices
    
    If a device was enabled before the VT switch, re-enabled it. Otherwise leave
    it as is, there was probably a reason why it was disabled.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 058057e..5896f22 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -449,6 +449,8 @@ xf86VTSwitch(void)
             xf86DisableInputHandler(ih);
         for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
             if (pInfo->dev) {
+                if (!pInfo->dev->enabled)
+                    pInfo->flags |= XI86_DEVICE_DISABLED;
                 xf86ReleaseKeys(pInfo->dev);
                 ProcessInputEvents();
                 DisableDevice(pInfo->dev, TRUE);
@@ -482,8 +484,9 @@ xf86VTSwitch(void)
 
             pInfo = xf86InputDevs;
             while (pInfo) {
-                if (pInfo->dev)
+                if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
                     EnableDevice(pInfo->dev, TRUE);
+                pInfo->flags &= ~XI86_DEVICE_DISABLED;
                 pInfo = pInfo->next;
             }
             for (ih = InputHandlers; ih; ih = ih->next)
@@ -537,8 +540,9 @@ xf86VTSwitch(void)
 
         pInfo = xf86InputDevs;
         while (pInfo) {
-            if (pInfo->dev)
+            if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
                 EnableDevice(pInfo->dev, TRUE);
+            pInfo->flags &= ~XI86_DEVICE_DISABLED;
             pInfo = pInfo->next;
         }
 
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index 3731a34..1d4363a 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -61,6 +61,9 @@
 #define XI86_ALWAYS_CORE	0x04    /* device always controls the pointer */
 /* the device sends Xinput and core pointer events */
 #define XI86_SEND_CORE_EVENTS	XI86_ALWAYS_CORE
+/* 0x08 is reserved for legacy XI86_SEND_DRAG_EVENTS, do not use for now */
+/* server-internal only */
+#define XI86_DEVICE_DISABLED    0x10    /* device was disabled before vt switch */
 
 /* This holds the input driver entry and module information. */
 typedef struct _InputDriverRec {
commit c5a45b0f7658c77725adce2b64a0fbd62f208328
Author: Daniel Kurtz <djkurtz at chromium.org>
Date:   Thu Apr 12 10:11:10 2012 +1000

    dix: don't BUG_WARN for button events from button-only device
    
    Events from button-only devices still need coordinates, and they get them
    from scale_to_desktop().  Therefore, a dev without valuators is not a bug.
    However, a dev with valuators, but less than two of them still is a bug.
    
    This was noticed when unplugging a "Creative Technology SB Arena Headset",
    which has some BTNs and some KEYs, but no REL or ABS valuators.
    It emits [BTN_3] = 0 on unplug, which would trigger the BUG_WARN.
    
    Signed-off-by: Daniel Kurtz <djkurtz at chromium.org>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/getevents.c b/dix/getevents.c
index 3093786..23bbe06 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -848,7 +848,7 @@ scale_to_desktop(DeviceIntPtr dev, ValuatorMask *mask,
     ScreenPtr scr = miPointerGetScreen(dev);
     double x, y;
 
-    BUG_WARN(!dev->valuator || dev->valuator->numAxes < 2);
+    BUG_WARN(dev->valuator && dev->valuator->numAxes < 2);
     if (!dev->valuator || dev->valuator->numAxes < 2) {
         /* if we have no axes, last.valuators must be in screen coords
          * anyway */
commit 9779b904c7c0b49c74054c22c420012c40595cdc
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Apr 11 09:33:54 2012 -0700

    hw/xfree86: Re-indent xf86vmode.c
    
    This is the result of re-running the 'x-indent.sh' script over
    xf86vmode.c to clean up the disaster caused by broken syntax in the
    file.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 9f64f8e..68c4b58 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -75,8 +75,7 @@ static unsigned char XF86VidModeReqCode = 0;
 #ifdef XF86VIDMODE_EVENTS
 static int XF86VidModeEventBase = 0;
 
-static void SXF86VidModeNotifyEvent(
-xXF86VidModeNotifyEvent * /* from */ , xXF86VidModeNotifyEvent *        /* to */
+static void SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent * /* from */ , xXF86VidModeNotifyEvent *    /* to */
     );
 
 static RESTYPE EventType;       /* resource type for event masks */
@@ -117,20 +116,22 @@ static DevPrivateKeyRec ScreenPrivateKeyRec;
 #define DEBUG_P(x) /**/
 #endif
     static int
- ClientMajorVersion(ClientPtr client) {
+ClientMajorVersion(ClientPtr client)
+{
     VidModePrivPtr pPriv;
 
-     pPriv = VM_GETPRIV(client);
+    pPriv = VM_GETPRIV(client);
     if (!pPriv)
-         return 0;
+        return 0;
     else
-         return pPriv->major;
+        return pPriv->major;
 }
+
 #ifdef XF86VIDMODE_EVENTS
 static void
- CheckScreenPrivate(pScreen)
+CheckScreenPrivate(pScreen)
 ScreenPtr
-    pScreen;
+ pScreen;
 {
     SetupScreen(pScreen);
 
@@ -142,9 +143,10 @@ ScreenPtr
     }
 }
 
-static XF86VidModeScreenPrivatePtr MakeScreenPrivate(pScreen)
+static XF86VidModeScreenPrivatePtr
+MakeScreenPrivate(pScreen)
 ScreenPtr
-    pScreen;
+ pScreen;
 {
     SetupScreen(pScreen);
 
@@ -160,18 +162,22 @@ ScreenPtr
 }
 
 static unsigned long
- getEventMask(ScreenPtr pScreen, ClientPtr client) {
+getEventMask(ScreenPtr pScreen, ClientPtr client)
+{
     SetupScreen(pScreen);
     XF86VidModeEventPtr pEv;
 
     if (!pPriv)
-         return 0;
+        return 0;
     for (pEv = pPriv->events; pEv; pEv = pEv->next)
         if (pEv->client == client)
             return pEv->mask;
-     return 0;
-} static Bool
- setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask) {
+    return 0;
+}
+
+static Bool
+setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask)
+{
     SetupScreen(pScreen);
     XF86VidModeEventPtr pEv, *pPrev;
 
@@ -181,7 +187,8 @@ static unsigned long
         pPriv = MakeScreenPrivate(pScreen);
         if (!pPriv)
             return FALSE;
-    } for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
+    }
+    for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
         if (pEv->client == client)
             break;
     if (mask == 0) {
@@ -208,38 +215,43 @@ static unsigned long
 }
 
 static int
- XF86VidModeFreeEvents(pointer value, XID id) {
+XF86VidModeFreeEvents(pointer value, XID id)
+{
     XF86VidModeEventPtr pOld = (XF86VidModeEventPtr) value;
     ScreenPtr pScreen = pOld->screen;
-     SetupScreen(pScreen);
+
+    SetupScreen(pScreen);
     XF86VidModeEventPtr pEv, *pPrev;
 
     if (!pPriv)
-         return TRUE;
+        return TRUE;
     for (pPrev = &pPriv->events; pEv = *pPrev; pPrev = &pEv->next)
         if (pEv == pOld)
             break;
     if (!pEv)
-         return TRUE;
+        return TRUE;
     *pPrev = pEv->next;
-     free(pEv);
-     CheckScreenPrivate(pScreen);
-     return TRUE;
-} static void
- SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced) {
+    free(pEv);
+    CheckScreenPrivate(pScreen);
+    return TRUE;
+}
+
+static void
+SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced)
+{
     XF86VidModeScreenPrivatePtr pPriv;
     XF86VidModeEventPtr pEv;
     unsigned long mask;
     xXF86VidModeNotifyEvent ev;
     int kind;
 
-     UpdateCurrentTimeIf();
-     mask = XF86VidModeNotifyMask;
-     pScreen = screenInfo.screens[pScreen->myNum];
-     pPriv = GetScreenPrivate(pScreen);
+    UpdateCurrentTimeIf();
+    mask = XF86VidModeNotifyMask;
+    pScreen = screenInfo.screens[pScreen->myNum];
+    pPriv = GetScreenPrivate(pScreen);
     if (!pPriv)
-         return;
-     kind = XF86VidModeModeChange;
+        return;
+    kind = XF86VidModeModeChange;
     for (pEv = pPriv->events; pEv; pEv = pEv->next) {
         if (!(pEv->mask & mask))
             continue;
@@ -251,8 +263,10 @@ static int
         ev.forced = forced;
         WriteEventsToClient(pEv->client, 1, (xEvent *) &ev);
 }} static void
- SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent * from,
-                         xXF86VidModeNotifyEvent * to) {
+
+SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent * from,
+                        xXF86VidModeNotifyEvent * to)
+{
     to->type = from->type;
     to->state = from->state;
     cpswaps(from->sequenceNumber, to->sequenceNumber);
@@ -264,29 +278,31 @@ static int
 #endif
 
 static int
- ProcXF86VidModeQueryVersion(ClientPtr client) {
+ProcXF86VidModeQueryVersion(ClientPtr client)
+{
     xXF86VidModeQueryVersionReply rep;
 
-     DEBUG_P("XF86VidModeQueryVersion");
+    DEBUG_P("XF86VidModeQueryVersion");
 
-     REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
-     rep.type = X_Reply;
-     rep.length = 0;
-     rep.sequenceNumber = client->sequence;
-     rep.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION;
-     rep.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION;
+    REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
+    rep.type = X_Reply;
+    rep.length = 0;
+    rep.sequenceNumber = client->sequence;
+    rep.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION;
+    rep.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
         swaps(&rep.majorVersion);
         swaps(&rep.minorVersion);
-    } WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply),
-                    (char *) &rep);
+    }
+    WriteToClient(client, sizeof(xXF86VidModeQueryVersionReply), (char *) &rep);
     return Success;
 }
 
 static int
- ProcXF86VidModeGetModeLine(ClientPtr client) {
+ProcXF86VidModeGetModeLine(ClientPtr client)
+{
     REQUEST(xXF86VidModeGetModeLineReq);
     xXF86VidModeGetModeLineReply rep;
     xXF86OldVidModeGetModeLineReply oldrep;
@@ -294,11 +310,11 @@ static int
     int dotClock;
     int ver;
 
-     DEBUG_P("XF86VidModeGetModeline");
+    DEBUG_P("XF86VidModeGetModeline");
 
-     ver = ClientMajorVersion(client);
-     REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
-     rep.type = X_Reply;
+    ver = ClientMajorVersion(client);
+    REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
+    rep.type = X_Reply;
     if (ver < 2) {
         rep.length = bytes_to_int32(SIZEOF(xXF86OldVidModeGetModeLineReply) -
                                     SIZEOF(xGenericReply));
@@ -386,7 +402,8 @@ static int
 }
 
 static int
- ProcXF86VidModeGetAllModeLines(ClientPtr client) {
+ProcXF86VidModeGetAllModeLines(ClientPtr client)
+{
     REQUEST(xXF86VidModeGetAllModeLinesReq);
     xXF86VidModeGetAllModeLinesReply rep;
     xXF86VidModeModeInfo mdinf;
@@ -395,38 +412,39 @@ static int
     int modecount, dotClock;
     int ver;
 
-     DEBUG_P("XF86VidModeGetAllModelines");
+    DEBUG_P("XF86VidModeGetAllModelines");
 
-     REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
+    REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
 
     if (stuff->screen >= screenInfo.numScreens)
-         return BadValue;
+        return BadValue;
 
-     ver = ClientMajorVersion(client);
+    ver = ClientMajorVersion(client);
 
-     modecount = VidModeGetNumOfModes(stuff->screen);
+    modecount = VidModeGetNumOfModes(stuff->screen);
     if (modecount < 1)
-         return VidModeErrorBase + XF86VidModeExtensionDisabled;
+        return VidModeErrorBase + XF86VidModeExtensionDisabled;
 
     if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
-         return BadValue;
+        return BadValue;
 
-     rep.type = X_Reply;
-     rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
+    rep.type = X_Reply;
+    rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
         SIZEOF(xGenericReply);
     if (ver < 2)
-         rep.length += modecount * sizeof(xXF86OldVidModeModeInfo);
+        rep.length += modecount * sizeof(xXF86OldVidModeModeInfo);
     else
-         rep.length += modecount * sizeof(xXF86VidModeModeInfo);
-     rep.length >>= 2;
-     rep.sequenceNumber = client->sequence;
-     rep.modecount = modecount;
+        rep.length += modecount * sizeof(xXF86VidModeModeInfo);
+    rep.length >>= 2;
+    rep.sequenceNumber = client->sequence;
+    rep.modecount = modecount;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
         swapl(&rep.modecount);
-    } WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply),
-                    (char *) &rep);
+    }
+    WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply),
+                  (char *) &rep);
 
     do {
         mdinf.dotclock = dotClock;
@@ -492,7 +510,8 @@ static int
      && VidModeGetModeValue(mode, VIDMODE_FLAGS)  == stuff->flags )
 
 static int
- ProcXF86VidModeAddModeLine(ClientPtr client) {
+ProcXF86VidModeAddModeLine(ClientPtr client)
+{
     REQUEST(xXF86VidModeAddModeLineReq);
     xXF86OldVidModeAddModeLineReq *oldstuff =
         (xXF86OldVidModeAddModeLineReq *) client->requestBuffer;
@@ -502,9 +521,9 @@ static int
     int dotClock;
     int ver;
 
-     DEBUG_P("XF86VidModeAddModeline");
+    DEBUG_P("XF86VidModeAddModeline");
 
-     ver = ClientMajorVersion(client);
+    ver = ClientMajorVersion(client);
     if (ver < 2) {
         /* convert from old format */
         stuff = &newstuff;
@@ -533,7 +552,8 @@ static int
         stuff->after_vsyncend = oldstuff->after_vsyncend;
         stuff->after_vtotal = oldstuff->after_vtotal;
         stuff->after_flags = oldstuff->after_flags;
-    } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+    }
+    if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
         ErrorF("AddModeLine - scrn: %d clock: %ld\n",
                (int) stuff->screen, (unsigned long) stuff->dotclock);
         ErrorF("AddModeLine - hdsp: %d hbeg: %d hend: %d httl: %d\n",
@@ -654,7 +674,8 @@ static int
 }
 
 static int
- ProcXF86VidModeDeleteModeLine(ClientPtr client) {
+ProcXF86VidModeDeleteModeLine(ClientPtr client)
+{
     REQUEST(xXF86VidModeDeleteModeLineReq);
     xXF86OldVidModeDeleteModeLineReq *oldstuff =
         (xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer;
@@ -663,9 +684,9 @@ static int
     int len, dotClock;
     int ver;
 
-     DEBUG_P("XF86VidModeDeleteModeline");
+    DEBUG_P("XF86VidModeDeleteModeline");
 
-     ver = ClientMajorVersion(client);
+    ver = ClientMajorVersion(client);
     if (ver < 2) {
         /* convert from old format */
         stuff = &newstuff;
@@ -683,7 +704,8 @@ static int
         stuff->vtotal = oldstuff->vtotal;
         stuff->flags = oldstuff->flags;
         stuff->privsize = oldstuff->privsize;
-    } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+    }
+    if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
         ErrorF("DeleteModeLine - scrn: %d clock: %ld\n",
                (int) stuff->screen, (unsigned long) stuff->dotclock);
         ErrorF("                 hdsp: %d hbeg: %d hend: %d httl: %d\n",
@@ -777,7 +799,8 @@ static int
 }
 
 static int
- ProcXF86VidModeModModeLine(ClientPtr client) {
+ProcXF86VidModeModModeLine(ClientPtr client)
+{
     REQUEST(xXF86VidModeModModeLineReq);
     xXF86OldVidModeModModeLineReq *oldstuff =
         (xXF86OldVidModeModModeLineReq *) client->requestBuffer;
@@ -786,9 +809,9 @@ static int
     int len, dotClock;
     int ver;
 
-     DEBUG_P("XF86VidModeModModeline");
+    DEBUG_P("XF86VidModeModModeline");
 
-     ver = ClientMajorVersion(client);
+    ver = ClientMajorVersion(client);
     if (ver < 2) {
         /* convert from old format */
         stuff = &newstuff;
@@ -805,7 +828,8 @@ static int
         stuff->vtotal = oldstuff->vtotal;
         stuff->flags = oldstuff->flags;
         stuff->privsize = oldstuff->privsize;
-    } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+    }
+    if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
         ErrorF("ModModeLine - scrn: %d hdsp: %d hbeg: %d hend: %d httl: %d\n",
                (int) stuff->screen, stuff->hdisplay, stuff->hsyncstart,
                stuff->hsyncend, stuff->htotal);
@@ -903,7 +927,8 @@ static int
 }
 
 static int
- ProcXF86VidModeValidateModeLine(ClientPtr client) {
+ProcXF86VidModeValidateModeLine(ClientPtr client)
+{
     REQUEST(xXF86VidModeValidateModeLineReq);
     xXF86OldVidModeValidateModeLineReq *oldstuff =
         (xXF86OldVidModeValidateModeLineReq *) client->requestBuffer;
@@ -913,9 +938,9 @@ static int
     int len, status, dotClock;
     int ver;
 
-     DEBUG_P("XF86VidModeValidateModeline");
+    DEBUG_P("XF86VidModeValidateModeline");
 
-     ver = ClientMajorVersion(client);
+    ver = ClientMajorVersion(client);
     if (ver < 2) {
         /* convert from old format */
         stuff = &newstuff;
@@ -933,7 +958,8 @@ static int
         stuff->vtotal = oldstuff->vtotal;
         stuff->flags = oldstuff->flags;
         stuff->privsize = oldstuff->privsize;
-    } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+    }
+    if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
         ErrorF("ValidateModeLine - scrn: %d clock: %ld\n",
                (int) stuff->screen, (unsigned long) stuff->dotclock);
         ErrorF("                   hdsp: %d hbeg: %d hend: %d httl: %d\n",
@@ -1022,7 +1048,8 @@ static int
 }
 
 static int
- ProcXF86VidModeSwitchMode(ClientPtr client) {
+ProcXF86VidModeSwitchMode(ClientPtr client)
+{
     REQUEST(xXF86VidModeSwitchModeReq);
 
     DEBUG_P("XF86VidModeSwitchMode");
@@ -1035,8 +1062,11 @@ static int
     VidModeZoomViewport(stuff->screen, (short) stuff->zoom);
 
     return Success;
-} static int
- ProcXF86VidModeSwitchToMode(ClientPtr client) {
+}
+
+static int
+ProcXF86VidModeSwitchToMode(ClientPtr client)
+{
     REQUEST(xXF86VidModeSwitchToModeReq);
     xXF86OldVidModeSwitchToModeReq *oldstuff =
         (xXF86OldVidModeSwitchToModeReq *) client->requestBuffer;
@@ -1045,9 +1075,9 @@ static int
     int len, dotClock;
     int ver;
 
-     DEBUG_P("XF86VidModeSwitchToMode");
+    DEBUG_P("XF86VidModeSwitchToMode");
 
-     ver = ClientMajorVersion(client);
+    ver = ClientMajorVersion(client);
     if (ver < 2) {
         /* convert from old format */
         stuff = &newstuff;
@@ -1065,7 +1095,8 @@ static int
         stuff->vtotal = oldstuff->vtotal;
         stuff->flags = oldstuff->flags;
         stuff->privsize = oldstuff->privsize;
-    } if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
+    }
+    if (xf86GetVerbosity() > DEFAULT_XF86VIDMODE_VERBOSITY) {
         ErrorF("SwitchToMode - scrn: %d clock: %ld\n",
                (int) stuff->screen, (unsigned long) stuff->dotclock);
         ErrorF("               hdsp: %d hbeg: %d hend: %d httl: %d\n",
@@ -1138,7 +1169,8 @@ static int
 }
 
 static int
- ProcXF86VidModeLockModeSwitch(ClientPtr client) {
+ProcXF86VidModeLockModeSwitch(ClientPtr client)
+{
     REQUEST(xXF86VidModeLockModeSwitchReq);
 
     REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
@@ -1152,53 +1184,57 @@ static int
         return VidModeErrorBase + XF86VidModeZoomLocked;
 
     return Success;
-} static int
- ProcXF86VidModeGetMonitor(ClientPtr client) {
+}
+
+static int
+ProcXF86VidModeGetMonitor(ClientPtr client)
+{
     REQUEST(xXF86VidModeGetMonitorReq);
     xXF86VidModeGetMonitorReply rep;
     CARD32 *hsyncdata, *vsyncdata;
     int i, nHsync, nVrefresh;
     pointer monitor;
 
-     DEBUG_P("XF86VidModeGetMonitor");
+    DEBUG_P("XF86VidModeGetMonitor");
 
-     REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
+    REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
 
     if (stuff->screen >= screenInfo.numScreens)
-         return BadValue;
+        return BadValue;
 
     if (!VidModeGetMonitor(stuff->screen, &monitor))
-         return BadValue;
+        return BadValue;
 
-     nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i;
-     nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i;
+    nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i;
+    nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i;
 
-     rep.type = X_Reply;
+    rep.type = X_Reply;
     if ((char *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr)
-         rep.vendorLength = strlen((char *) (VidModeGetMonitorValue(monitor,
-                                                                    VIDMODE_MON_VENDOR,
-                                                                    0)).ptr);
+        rep.vendorLength = strlen((char *) (VidModeGetMonitorValue(monitor,
+                                                                   VIDMODE_MON_VENDOR,
+                                                                   0)).ptr);
     else
-         rep.vendorLength = 0;
+        rep.vendorLength = 0;
     if ((char *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_MODEL, 0)).ptr)
-         rep.modelLength = strlen((char *) (VidModeGetMonitorValue(monitor,
-                                                                   VIDMODE_MON_MODEL,
-                                                                   0)).ptr);
+        rep.modelLength = strlen((char *) (VidModeGetMonitorValue(monitor,
+                                                                  VIDMODE_MON_MODEL,
+                                                                  0)).ptr);
     else
-         rep.modelLength = 0;
-     rep.length =
+        rep.modelLength = 0;
+    rep.length =
         bytes_to_int32(SIZEOF(xXF86VidModeGetMonitorReply) -
                        SIZEOF(xGenericReply) + (nHsync +
                                                 nVrefresh) * sizeof(CARD32) +
                        pad_to_int32(rep.vendorLength) +
                        pad_to_int32(rep.modelLength));
-     rep.sequenceNumber = client->sequence;
-     rep.nhsync = nHsync;
-     rep.nvsync = nVrefresh;
-     hsyncdata = malloc(nHsync * sizeof(CARD32));
+    rep.sequenceNumber = client->sequence;
+    rep.nhsync = nHsync;
+    rep.nvsync = nVrefresh;
+    hsyncdata = malloc(nHsync * sizeof(CARD32));
     if (!hsyncdata) {
         return BadAlloc;
-    } vsyncdata = malloc(nVrefresh * sizeof(CARD32));
+    }
+    vsyncdata = malloc(nVrefresh * sizeof(CARD32));
 
     if (!vsyncdata) {
         free(hsyncdata);
@@ -1208,19 +1244,18 @@ static int
     for (i = 0; i < nHsync; i++) {
         hsyncdata[i] = (unsigned short) (VidModeGetMonitorValue(monitor,
                                                                 VIDMODE_MON_HSYNC_LO,
-                                                                i)).
-            f | (unsigned
-                 short) (VidModeGetMonitorValue(monitor, VIDMODE_MON_HSYNC_HI,
-                                                i)).f << 16;
+                                                                i)).f |
+            (unsigned
+             short) (VidModeGetMonitorValue(monitor, VIDMODE_MON_HSYNC_HI,
+                                            i)).f << 16;
     }
     for (i = 0; i < nVrefresh; i++) {
         vsyncdata[i] = (unsigned short) (VidModeGetMonitorValue(monitor,
                                                                 VIDMODE_MON_VREFRESH_LO,
-                                                                i)).
-            f | (unsigned
-                 short) (VidModeGetMonitorValue(monitor,
-                                                VIDMODE_MON_VREFRESH_HI,
-                                                i)).f << 16;
+                                                                i)).f |
+            (unsigned
+             short) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VREFRESH_HI,
+                                            i)).f << 16;
     }
 
     if (client->swapped) {
@@ -1249,38 +1284,40 @@ static int
 }
 
 static int
- ProcXF86VidModeGetViewPort(ClientPtr client) {
+ProcXF86VidModeGetViewPort(ClientPtr client)
+{
     REQUEST(xXF86VidModeGetViewPortReq);
     xXF86VidModeGetViewPortReply rep;
     int x, y;
 
-     DEBUG_P("XF86VidModeGetViewPort");
+    DEBUG_P("XF86VidModeGetViewPort");
 
-     REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
+    REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
 
     if (stuff->screen >= screenInfo.numScreens)
-         return BadValue;
+        return BadValue;
 
-     rep.type = X_Reply;
-     rep.length = 0;
-     rep.sequenceNumber = client->sequence;
+    rep.type = X_Reply;
+    rep.length = 0;
+    rep.sequenceNumber = client->sequence;
 
-     VidModeGetViewPort(stuff->screen, &x, &y);
-     rep.x = x;
-     rep.y = y;
+    VidModeGetViewPort(stuff->screen, &x, &y);
+    rep.x = x;
+    rep.y = y;
 
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
         swapl(&rep.x);
         swapl(&rep.y);
-    } WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply),
-                    (char *) &rep);
+    }
+    WriteToClient(client, SIZEOF(xXF86VidModeGetViewPortReply), (char *) &rep);
     return Success;
 }
 
 static int
- ProcXF86VidModeSetViewPort(ClientPtr client) {
+ProcXF86VidModeSetViewPort(ClientPtr client)
+{
     REQUEST(xXF86VidModeSetViewPortReq);
 
     DEBUG_P("XF86VidModeSetViewPort");
@@ -1294,8 +1331,11 @@ static int
         return BadValue;
 
     return Success;
-} static int
- ProcXF86VidModeGetDotClocks(ClientPtr client) {
+}
+
+static int
+ProcXF86VidModeGetDotClocks(ClientPtr client)
+{
     REQUEST(xXF86VidModeGetDotClocksReq);
     xXF86VidModeGetDotClocksReply rep;
     int n;
@@ -1304,31 +1344,33 @@ static int
     int *Clocks = NULL;
     Bool ClockProg;
 
-     DEBUG_P("XF86VidModeGetDotClocks");
+    DEBUG_P("XF86VidModeGetDotClocks");
 
-     REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
+    REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
 
     if (stuff->screen >= screenInfo.numScreens)
-         return BadValue;
+        return BadValue;
 
-     numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg);
+    numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg);
 
-     rep.type = X_Reply;
-     rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply)
-                                 - SIZEOF(xGenericReply) + numClocks);
-     rep.sequenceNumber = client->sequence;
-     rep.clocks = numClocks;
-     rep.maxclocks = MAXCLOCKS;
-     rep.flags = 0;
+    rep.type = X_Reply;
+    rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply)
+                                - SIZEOF(xGenericReply) + numClocks);
+    rep.sequenceNumber = client->sequence;
+    rep.clocks = numClocks;
+    rep.maxclocks = MAXCLOCKS;
+    rep.flags = 0;
 
     if (!ClockProg) {
         Clocks = malloc(numClocks * sizeof(int));
         if (!Clocks)
-             return BadValue;
+            return BadValue;
         if (!VidModeGetClocks(stuff->screen, Clocks)) {
             free(Clocks);
             return BadValue;
-    }} if (ClockProg) {
+        }
+    }
+    if (ClockProg) {
         rep.flags |= CLKFLAG_PROGRAMABLE;
     }
     if (client->swapped) {
@@ -1356,7 +1398,8 @@ static int
 }
 
 static int
- ProcXF86VidModeSetGamma(ClientPtr client) {
+ProcXF86VidModeSetGamma(ClientPtr client)
+{
     REQUEST(xXF86VidModeSetGammaReq);
 
     DEBUG_P("XF86VidModeSetGamma");
@@ -1372,79 +1415,89 @@ static int
         return BadValue;
 
     return Success;
-} static int
- ProcXF86VidModeGetGamma(ClientPtr client) {
+}
+
+static int
+ProcXF86VidModeGetGamma(ClientPtr client)
+{
     REQUEST(xXF86VidModeGetGammaReq);
     xXF86VidModeGetGammaReply rep;
     float red, green, blue;
 
-     DEBUG_P("XF86VidModeGetGamma");
+    DEBUG_P("XF86VidModeGetGamma");
 
-     REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
+    REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
 
     if (stuff->screen >= screenInfo.numScreens)
-         return BadValue;
+        return BadValue;
 
-     rep.type = X_Reply;
-     rep.length = 0;
-     rep.sequenceNumber = client->sequence;
+    rep.type = X_Reply;
+    rep.length = 0;
+    rep.sequenceNumber = client->sequence;
     if (!VidModeGetGamma(stuff->screen, &red, &green, &blue))
-         return BadValue;
-     rep.red = (CARD32) (red * 10000.);
-     rep.green = (CARD32) (green * 10000.);
-     rep.blue = (CARD32) (blue * 10000.);
+        return BadValue;
+    rep.red = (CARD32) (red * 10000.);
+    rep.green = (CARD32) (green * 10000.);
+    rep.blue = (CARD32) (blue * 10000.);
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
         swapl(&rep.red);
         swapl(&rep.green);
         swapl(&rep.blue);
-    } WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), (char *) &rep);
+    }
+    WriteToClient(client, sizeof(xXF86VidModeGetGammaReply), (char *) &rep);
 
     return Success;
 }
 
 static int
- ProcXF86VidModeSetGammaRamp(ClientPtr client) {
+ProcXF86VidModeSetGammaRamp(ClientPtr client)
+{
     CARD16 *r, *g, *b;
     int length;
-     REQUEST(xXF86VidModeSetGammaRampReq);
+
+    REQUEST(xXF86VidModeSetGammaRampReq);
 
     if (stuff->screen >= screenInfo.numScreens)
-         return BadValue;
+        return BadValue;
 
     if (stuff->size != VidModeGetGammaRampSize(stuff->screen))
-         return BadValue;
+        return BadValue;
 
-     length = (stuff->size + 1) & ~1;
+    length = (stuff->size + 1) & ~1;
 
-     REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length * 6);
+    REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length * 6);
 
-     r = (CARD16 *) &stuff[1];
-     g = r + length;
-     b = g + length;
+    r = (CARD16 *) &stuff[1];
+    g = r + length;
+    b = g + length;
 
     if (!VidModeSetGammaRamp(stuff->screen, stuff->size, r, g, b))
-         return BadValue;
+        return BadValue;
 
-     return Success;
-} static int
- ProcXF86VidModeGetGammaRamp(ClientPtr client) {
+    return Success;
+}
+
+static int
+ProcXF86VidModeGetGammaRamp(ClientPtr client)
+{
     CARD16 *ramp = NULL;
     int length;
     size_t ramplen = 0;
     xXF86VidModeGetGammaRampReply rep;
-     REQUEST(xXF86VidModeGetGammaRampReq);
+
+    REQUEST(xXF86VidModeGetGammaRampReq);
 
     if (stuff->screen >= screenInfo.numScreens)
-         return BadValue;
+        return BadValue;
 
     if (stuff->size != VidModeGetGammaRampSize(stuff->screen))
-         return BadValue;
+        return BadValue;
 
-     REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
+    REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
 
-     length = (stuff->size + 1) & ~1;
+    length = (stuff->size + 1) & ~1;
 
     if (stuff->size) {
         ramplen = length * 3 * sizeof(CARD16);
@@ -1455,7 +1508,9 @@ static int
                                  ramp, ramp + length, ramp + (length * 2))) {
             free(ramp);
             return BadValue;
-    }} rep.type = X_Reply;
+        }
+    }
+    rep.type = X_Reply;
     rep.length = (length >> 1) * 3;
     rep.sequenceNumber = client->sequence;
     rep.size = stuff->size;
@@ -1476,47 +1531,53 @@ static int
 }
 
 static int
- ProcXF86VidModeGetGammaRampSize(ClientPtr client) {
+ProcXF86VidModeGetGammaRampSize(ClientPtr client)
+{
     xXF86VidModeGetGammaRampSizeReply rep;
-     REQUEST(xXF86VidModeGetGammaRampSizeReq);
+
+    REQUEST(xXF86VidModeGetGammaRampSizeReq);
 
     if (stuff->screen >= screenInfo.numScreens)
-         return BadValue;
+        return BadValue;
 
-     REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
+    REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
 
-     rep.type = X_Reply;
-     rep.length = 0;
-     rep.sequenceNumber = client->sequence;
-     rep.size = VidModeGetGammaRampSize(stuff->screen);
+    rep.type = X_Reply;
+    rep.length = 0;
+    rep.sequenceNumber = client->sequence;
+    rep.size = VidModeGetGammaRampSize(stuff->screen);
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
         swaps(&rep.size);
-    } WriteToClient(client, sizeof(xXF86VidModeGetGammaRampSizeReply),
-                    (char *) &rep);
+    }
+    WriteToClient(client, sizeof(xXF86VidModeGetGammaRampSizeReply),
+                  (char *) &rep);
 
     return Success;
 }
 
 static int
- ProcXF86VidModeGetPermissions(ClientPtr client) {
+ProcXF86VidModeGetPermissions(ClientPtr client)
+{
     xXF86VidModeGetPermissionsReply rep;
-     REQUEST(xXF86VidModeGetPermissionsReq);
+
+    REQUEST(xXF86VidModeGetPermissionsReq);
 
     if (stuff->screen >= screenInfo.numScreens)
-         return BadValue;
+        return BadValue;
 
-     REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
+    REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
 
-     rep.type = X_Reply;
-     rep.length = 0;
-     rep.sequenceNumber = client->sequence;
-     rep.permissions = XF86VM_READ_PERMISSION;
+    rep.type = X_Reply;
+    rep.length = 0;
+    rep.sequenceNumber = client->sequence;
+    rep.permissions = XF86VM_READ_PERMISSION;
     if (xf86GetVidModeEnabled() &&
         (xf86GetVidModeAllowNonLocal() || LocalClient(client))) {
         rep.permissions |= XF86VM_WRITE_PERMISSION;
-    } if (client->swapped) {
+    }
+    if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
         swapl(&rep.permissions);
@@ -1528,21 +1589,23 @@ static int
 }
 
 static int
- ProcXF86VidModeSetClientVersion(ClientPtr client) {
+ProcXF86VidModeSetClientVersion(ClientPtr client)
+{
     REQUEST(xXF86VidModeSetClientVersionReq);
 
     VidModePrivPtr pPriv;
 
-     DEBUG_P("XF86VidModeSetClientVersion");
+    DEBUG_P("XF86VidModeSetClientVersion");
 
-     REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
+    REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
 
     if ((pPriv = VM_GETPRIV(client)) == NULL) {
         pPriv = malloc(sizeof(VidModePrivRec));
         if (!pPriv)
             return BadAlloc;
         VM_SETPRIV(client, pPriv);
-    } pPriv->major = stuff->major;
+    }
+    pPriv->major = stuff->major;
 
     pPriv->minor = stuff->minor;
 
@@ -1550,85 +1613,103 @@ static int
 }
 
 static int
- ProcXF86VidModeDispatch(ClientPtr client) {
+ProcXF86VidModeDispatch(ClientPtr client)
+{
     REQUEST(xReq);
     switch (stuff->data) {
     case X_XF86VidModeQueryVersion:
         return ProcXF86VidModeQueryVersion(client);
-        case X_XF86VidModeGetModeLine:return ProcXF86VidModeGetModeLine(client);
-        case X_XF86VidModeGetMonitor:return ProcXF86VidModeGetMonitor(client);
-        case X_XF86VidModeGetAllModeLines:return
-            ProcXF86VidModeGetAllModeLines(client);
-        case X_XF86VidModeValidateModeLine:return
-            ProcXF86VidModeValidateModeLine(client);
-        case X_XF86VidModeGetViewPort:return ProcXF86VidModeGetViewPort(client);
-        case X_XF86VidModeGetDotClocks:return
-            ProcXF86VidModeGetDotClocks(client);
-        case X_XF86VidModeSetClientVersion:return
-            ProcXF86VidModeSetClientVersion(client);
-        case X_XF86VidModeGetGamma:return ProcXF86VidModeGetGamma(client);
-        case X_XF86VidModeGetGammaRamp:return
-            ProcXF86VidModeGetGammaRamp(client);
-        case X_XF86VidModeGetGammaRampSize:return
-            ProcXF86VidModeGetGammaRampSize(client);
-        case X_XF86VidModeGetPermissions:return
-            ProcXF86VidModeGetPermissions(client);
-        default:if (!xf86GetVidModeEnabled())
+    case X_XF86VidModeGetModeLine:
+        return ProcXF86VidModeGetModeLine(client);
+    case X_XF86VidModeGetMonitor:
+        return ProcXF86VidModeGetMonitor(client);
+    case X_XF86VidModeGetAllModeLines:
+        return ProcXF86VidModeGetAllModeLines(client);
+    case X_XF86VidModeValidateModeLine:
+        return ProcXF86VidModeValidateModeLine(client);
+    case X_XF86VidModeGetViewPort:
+        return ProcXF86VidModeGetViewPort(client);
+    case X_XF86VidModeGetDotClocks:
+        return ProcXF86VidModeGetDotClocks(client);
+    case X_XF86VidModeSetClientVersion:
+        return ProcXF86VidModeSetClientVersion(client);
+    case X_XF86VidModeGetGamma:
+        return ProcXF86VidModeGetGamma(client);
+    case X_XF86VidModeGetGammaRamp:
+        return ProcXF86VidModeGetGammaRamp(client);
+    case X_XF86VidModeGetGammaRampSize:
+        return ProcXF86VidModeGetGammaRampSize(client);
+    case X_XF86VidModeGetPermissions:
+        return ProcXF86VidModeGetPermissions(client);
+    default:
+        if (!xf86GetVidModeEnabled())
             return VidModeErrorBase + XF86VidModeExtensionDisabled;
         if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
             switch (stuff->data) {
             case X_XF86VidModeAddModeLine:
                 return ProcXF86VidModeAddModeLine(client);
-                case X_XF86VidModeDeleteModeLine:return
-                    ProcXF86VidModeDeleteModeLine(client);
-                case X_XF86VidModeModModeLine:return
-                    ProcXF86VidModeModModeLine(client);
-                case X_XF86VidModeSwitchMode:return
-                    ProcXF86VidModeSwitchMode(client);
-                case X_XF86VidModeSwitchToMode:return
-                    ProcXF86VidModeSwitchToMode(client);
-                case X_XF86VidModeLockModeSwitch:return
-                    ProcXF86VidModeLockModeSwitch(client);
-                case X_XF86VidModeSetViewPort:return
-                    ProcXF86VidModeSetViewPort(client);
-                case X_XF86VidModeSetGamma:return
-                    ProcXF86VidModeSetGamma(client);
-                case X_XF86VidModeSetGammaRamp:return
-                    ProcXF86VidModeSetGammaRamp(client);
-                default:return BadRequest;
-        }}
+            case X_XF86VidModeDeleteModeLine:
+                return ProcXF86VidModeDeleteModeLine(client);
+            case X_XF86VidModeModModeLine:
+                return ProcXF86VidModeModModeLine(client);
+            case X_XF86VidModeSwitchMode:
+                return ProcXF86VidModeSwitchMode(client);
+            case X_XF86VidModeSwitchToMode:
+                return ProcXF86VidModeSwitchToMode(client);
+            case X_XF86VidModeLockModeSwitch:
+                return ProcXF86VidModeLockModeSwitch(client);
+            case X_XF86VidModeSetViewPort:
+                return ProcXF86VidModeSetViewPort(client);
+            case X_XF86VidModeSetGamma:
+                return ProcXF86VidModeSetGamma(client);
+            case X_XF86VidModeSetGammaRamp:
+                return ProcXF86VidModeSetGammaRamp(client);
+            default:
+                return BadRequest;
+            }
+        }
         else
-             return VidModeErrorBase + XF86VidModeClientNotLocal;
+            return VidModeErrorBase + XF86VidModeClientNotLocal;
     }
 }
 
 static int
- SProcXF86VidModeQueryVersion(ClientPtr client) {
+SProcXF86VidModeQueryVersion(ClientPtr client)
+{
     REQUEST(xXF86VidModeQueryVersionReq);
     swaps(&stuff->length);
     return ProcXF86VidModeQueryVersion(client);
-} static int
- SProcXF86VidModeGetModeLine(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeGetModeLine(ClientPtr client)
+{
     REQUEST(xXF86VidModeGetModeLineReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
     swaps(&stuff->screen);
     return ProcXF86VidModeGetModeLine(client);
-} static int
- SProcXF86VidModeGetAllModeLines(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeGetAllModeLines(ClientPtr client)
+{
     REQUEST(xXF86VidModeGetAllModeLinesReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86VidModeGetAllModeLinesReq);
     swaps(&stuff->screen);
     return ProcXF86VidModeGetAllModeLines(client);
-} static int
- SProcXF86VidModeAddModeLine(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeAddModeLine(ClientPtr client)
+{
     xXF86OldVidModeAddModeLineReq *oldstuff =
         (xXF86OldVidModeAddModeLineReq *) client->requestBuffer;
     int ver;
 
-     REQUEST(xXF86VidModeAddModeLineReq);
-     ver = ClientMajorVersion(client);
+    REQUEST(xXF86VidModeAddModeLineReq);
+    ver = ClientMajorVersion(client);
     if (ver < 2) {
         swaps(&oldstuff->length);
         REQUEST_AT_LEAST_SIZE(xXF86OldVidModeAddModeLineReq);
@@ -1666,13 +1747,14 @@ static int
 }
 
 static int
- SProcXF86VidModeDeleteModeLine(ClientPtr client) {
+SProcXF86VidModeDeleteModeLine(ClientPtr client)
+{
     xXF86OldVidModeDeleteModeLineReq *oldstuff =
         (xXF86OldVidModeDeleteModeLineReq *) client->requestBuffer;
     int ver;
 
-     REQUEST(xXF86VidModeDeleteModeLineReq);
-     ver = ClientMajorVersion(client);
+    REQUEST(xXF86VidModeDeleteModeLineReq);
+    ver = ClientMajorVersion(client);
     if (ver < 2) {
         swaps(&oldstuff->length);
         REQUEST_AT_LEAST_SIZE(xXF86OldVidModeDeleteModeLineReq);
@@ -1710,13 +1792,14 @@ static int
 }
 
 static int
- SProcXF86VidModeModModeLine(ClientPtr client) {
+SProcXF86VidModeModModeLine(ClientPtr client)
+{
     xXF86OldVidModeModModeLineReq *oldstuff =
         (xXF86OldVidModeModModeLineReq *) client->requestBuffer;
     int ver;
 
-     REQUEST(xXF86VidModeModModeLineReq);
-     ver = ClientMajorVersion(client);
+    REQUEST(xXF86VidModeModModeLineReq);
+    ver = ClientMajorVersion(client);
     if (ver < 2) {
         swaps(&oldstuff->length);
         REQUEST_AT_LEAST_SIZE(xXF86OldVidModeModModeLineReq);
@@ -1754,13 +1837,14 @@ static int
 }
 
 static int
- SProcXF86VidModeValidateModeLine(ClientPtr client) {
+SProcXF86VidModeValidateModeLine(ClientPtr client)
+{
     xXF86OldVidModeValidateModeLineReq *oldstuff =
         (xXF86OldVidModeValidateModeLineReq *) client->requestBuffer;
     int ver;
 
-     REQUEST(xXF86VidModeValidateModeLineReq);
-     ver = ClientMajorVersion(client);
+    REQUEST(xXF86VidModeValidateModeLineReq);
+    ver = ClientMajorVersion(client);
     if (ver < 2) {
         swaps(&oldstuff->length);
         REQUEST_AT_LEAST_SIZE(xXF86OldVidModeValidateModeLineReq);
@@ -1798,44 +1882,60 @@ static int
 }
 
 static int
- SProcXF86VidModeSwitchMode(ClientPtr client) {
+SProcXF86VidModeSwitchMode(ClientPtr client)
+{
     REQUEST(xXF86VidModeSwitchModeReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86VidModeSwitchModeReq);
     swaps(&stuff->screen);
     swaps(&stuff->zoom);
     return ProcXF86VidModeSwitchMode(client);
-} static int
- SProcXF86VidModeSwitchToMode(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeSwitchToMode(ClientPtr client)
+{
     REQUEST(xXF86VidModeSwitchToModeReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
     swapl(&stuff->screen);
     return ProcXF86VidModeSwitchToMode(client);
-} static int
- SProcXF86VidModeLockModeSwitch(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeLockModeSwitch(ClientPtr client)
+{
     REQUEST(xXF86VidModeLockModeSwitchReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86VidModeLockModeSwitchReq);
     swaps(&stuff->screen);
     swaps(&stuff->lock);
     return ProcXF86VidModeLockModeSwitch(client);
-} static int
- SProcXF86VidModeGetMonitor(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeGetMonitor(ClientPtr client)
+{
     REQUEST(xXF86VidModeGetMonitorReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86VidModeGetMonitorReq);
     swaps(&stuff->screen);
     return ProcXF86VidModeGetMonitor(client);
-} static int
- SProcXF86VidModeGetViewPort(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeGetViewPort(ClientPtr client)
+{
     REQUEST(xXF86VidModeGetViewPortReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86VidModeGetViewPortReq);
     swaps(&stuff->screen);
     return ProcXF86VidModeGetViewPort(client);
-} static int
- SProcXF86VidModeSetViewPort(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeSetViewPort(ClientPtr client)
+{
     REQUEST(xXF86VidModeSetViewPortReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86VidModeSetViewPortReq);
@@ -1843,23 +1943,32 @@ static int
     swapl(&stuff->x);
     swapl(&stuff->y);
     return ProcXF86VidModeSetViewPort(client);
-} static int
- SProcXF86VidModeGetDotClocks(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeGetDotClocks(ClientPtr client)
+{
     REQUEST(xXF86VidModeGetDotClocksReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86VidModeGetDotClocksReq);
     swaps(&stuff->screen);
     return ProcXF86VidModeGetDotClocks(client);
-} static int
- SProcXF86VidModeSetClientVersion(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeSetClientVersion(ClientPtr client)
+{
     REQUEST(xXF86VidModeSetClientVersionReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86VidModeSetClientVersionReq);
     swaps(&stuff->major);
     swaps(&stuff->minor);
     return ProcXF86VidModeSetClientVersion(client);
-} static int
- SProcXF86VidModeSetGamma(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeSetGamma(ClientPtr client)
+{
     REQUEST(xXF86VidModeSetGammaReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86VidModeSetGammaReq);
@@ -1868,120 +1977,145 @@ static int
     swapl(&stuff->green);
     swapl(&stuff->blue);
     return ProcXF86VidModeSetGamma(client);
-} static int
- SProcXF86VidModeGetGamma(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeGetGamma(ClientPtr client)
+{
     REQUEST(xXF86VidModeGetGammaReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86VidModeGetGammaReq);
     swaps(&stuff->screen);
     return ProcXF86VidModeGetGamma(client);
-} static int
- SProcXF86VidModeSetGammaRamp(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeSetGammaRamp(ClientPtr client)
+{
     int length;
-     REQUEST(xXF86VidModeSetGammaRampReq);
-     swaps(&stuff->length);
-     REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
-     swaps(&stuff->size);
-     swaps(&stuff->screen);
-     length = ((stuff->size + 1) & ~1) * 6;
-     REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length);
-     SwapRestS(stuff);
-     return ProcXF86VidModeSetGammaRamp(client);
-} static int
- SProcXF86VidModeGetGammaRamp(ClientPtr client) {
+
+    REQUEST(xXF86VidModeSetGammaRampReq);
+    swaps(&stuff->length);
+    REQUEST_AT_LEAST_SIZE(xXF86VidModeSetGammaRampReq);
+    swaps(&stuff->size);
+    swaps(&stuff->screen);
+    length = ((stuff->size + 1) & ~1) * 6;
+    REQUEST_FIXED_SIZE(xXF86VidModeSetGammaRampReq, length);
+    SwapRestS(stuff);
+    return ProcXF86VidModeSetGammaRamp(client);
+}
+
+static int
+SProcXF86VidModeGetGammaRamp(ClientPtr client)
+{
     REQUEST(xXF86VidModeGetGammaRampReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
     swaps(&stuff->size);
     swaps(&stuff->screen);
     return ProcXF86VidModeGetGammaRamp(client);
-} static int
- SProcXF86VidModeGetGammaRampSize(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeGetGammaRampSize(ClientPtr client)
+{
     REQUEST(xXF86VidModeGetGammaRampSizeReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
     swaps(&stuff->screen);
     return ProcXF86VidModeGetGammaRampSize(client);
-} static int
- SProcXF86VidModeGetPermissions(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeGetPermissions(ClientPtr client)
+{
     REQUEST(xXF86VidModeGetPermissionsReq);
     swaps(&stuff->length);
     REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
     swaps(&stuff->screen);
     return ProcXF86VidModeGetPermissions(client);
-} static int
- SProcXF86VidModeDispatch(ClientPtr client) {
+}
+
+static int
+SProcXF86VidModeDispatch(ClientPtr client)
+{
     REQUEST(xReq);
     switch (stuff->data) {
     case X_XF86VidModeQueryVersion:
         return SProcXF86VidModeQueryVersion(client);
-        case X_XF86VidModeGetModeLine:return
-            SProcXF86VidModeGetModeLine(client);
-        case X_XF86VidModeGetMonitor:return SProcXF86VidModeGetMonitor(client);
-        case X_XF86VidModeGetAllModeLines:return
-            SProcXF86VidModeGetAllModeLines(client);
-        case X_XF86VidModeGetViewPort:return
-            SProcXF86VidModeGetViewPort(client);
-        case X_XF86VidModeValidateModeLine:return
-            SProcXF86VidModeValidateModeLine(client);
-        case X_XF86VidModeGetDotClocks:return
-            SProcXF86VidModeGetDotClocks(client);
-        case X_XF86VidModeSetClientVersion:return
-            SProcXF86VidModeSetClientVersion(client);
-        case X_XF86VidModeGetGamma:return SProcXF86VidModeGetGamma(client);
-        case X_XF86VidModeGetGammaRamp:return
-            SProcXF86VidModeGetGammaRamp(client);
-        case X_XF86VidModeGetGammaRampSize:return
-            SProcXF86VidModeGetGammaRampSize(client);
-        case X_XF86VidModeGetPermissions:return
-            SProcXF86VidModeGetPermissions(client);
-        default:if (!xf86GetVidModeEnabled())
+    case X_XF86VidModeGetModeLine:
+        return SProcXF86VidModeGetModeLine(client);
+    case X_XF86VidModeGetMonitor:
+        return SProcXF86VidModeGetMonitor(client);
+    case X_XF86VidModeGetAllModeLines:
+        return SProcXF86VidModeGetAllModeLines(client);
+    case X_XF86VidModeGetViewPort:
+        return SProcXF86VidModeGetViewPort(client);
+    case X_XF86VidModeValidateModeLine:
+        return SProcXF86VidModeValidateModeLine(client);
+    case X_XF86VidModeGetDotClocks:
+        return SProcXF86VidModeGetDotClocks(client);
+    case X_XF86VidModeSetClientVersion:
+        return SProcXF86VidModeSetClientVersion(client);
+    case X_XF86VidModeGetGamma:
+        return SProcXF86VidModeGetGamma(client);
+    case X_XF86VidModeGetGammaRamp:
+        return SProcXF86VidModeGetGammaRamp(client);
+    case X_XF86VidModeGetGammaRampSize:
+        return SProcXF86VidModeGetGammaRampSize(client);
+    case X_XF86VidModeGetPermissions:
+        return SProcXF86VidModeGetPermissions(client);
+    default:
+        if (!xf86GetVidModeEnabled())
             return VidModeErrorBase + XF86VidModeExtensionDisabled;
         if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) {
             switch (stuff->data) {
             case X_XF86VidModeAddModeLine:
                 return SProcXF86VidModeAddModeLine(client);
-                case X_XF86VidModeDeleteModeLine:return
-                    SProcXF86VidModeDeleteModeLine(client);
-                case X_XF86VidModeModModeLine:return
-                    SProcXF86VidModeModModeLine(client);
-                case X_XF86VidModeSwitchMode:return
-                    SProcXF86VidModeSwitchMode(client);
-                case X_XF86VidModeSwitchToMode:return
-                    SProcXF86VidModeSwitchToMode(client);
-                case X_XF86VidModeLockModeSwitch:return
-                    SProcXF86VidModeLockModeSwitch(client);
-                case X_XF86VidModeSetViewPort:return
-                    SProcXF86VidModeSetViewPort(client);
-                case X_XF86VidModeSetGamma:return
-                    SProcXF86VidModeSetGamma(client);
-                case X_XF86VidModeSetGammaRamp:return
-                    SProcXF86VidModeSetGammaRamp(client);
-                default:return BadRequest;
-        }}
+            case X_XF86VidModeDeleteModeLine:
+                return SProcXF86VidModeDeleteModeLine(client);
+            case X_XF86VidModeModModeLine:
+                return SProcXF86VidModeModModeLine(client);
+            case X_XF86VidModeSwitchMode:
+                return SProcXF86VidModeSwitchMode(client);
+            case X_XF86VidModeSwitchToMode:
+                return SProcXF86VidModeSwitchToMode(client);
+            case X_XF86VidModeLockModeSwitch:
+                return SProcXF86VidModeLockModeSwitch(client);
+            case X_XF86VidModeSetViewPort:
+                return SProcXF86VidModeSetViewPort(client);
+            case X_XF86VidModeSetGamma:
+                return SProcXF86VidModeSetGamma(client);
+            case X_XF86VidModeSetGammaRamp:
+                return SProcXF86VidModeSetGammaRamp(client);
+            default:
+                return BadRequest;
+            }
+        }
         else
-             return VidModeErrorBase + XF86VidModeClientNotLocal;
+            return VidModeErrorBase + XF86VidModeClientNotLocal;
     }
 }
 
 void
- XFree86VidModeExtensionInit(void) {
+XFree86VidModeExtensionInit(void)
+{
     ExtensionEntry *extEntry;
     ScreenPtr pScreen;
     int i;
     Bool enabled = FALSE;
 
-     DEBUG_P("XFree86VidModeExtensionInit");
+    DEBUG_P("XFree86VidModeExtensionInit");
 
     if (!dixRegisterPrivateKey(&VidModeClientPrivateKeyRec, PRIVATE_CLIENT, 0))
-         return;
+        return;
 #ifdef XF86VIDMODE_EVENTS
     if (!dixRegisterPrivateKey(&ScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
-         return;
+        return;
 #endif
 
 #ifdef XF86VIDMODE_EVENTS
-     EventType = CreateNewResourceType(XF86VidModeFreeEvents, "VidModeEvent");
+    EventType = CreateNewResourceType(XF86VidModeFreeEvents, "VidModeEvent");
 #endif
 
     for (i = 0; i < screenInfo.numScreens; i++) {
@@ -1990,8 +2124,8 @@ void
             enabled = TRUE;
     }
     /* This means that the DDX doesn't want the vidmode extension enabled */
-        if (!enabled)
-         return;
+    if (!enabled)
+        return;
 
     if (
 #ifdef XF86VIDMODE_EVENTS
commit 592bd0ae2b60cd6f6afd3efc40f5f659b12900b4
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Apr 11 09:28:21 2012 -0700

    hw/xfree86: Spurious ');' in xf86vmode.c messed up indentation badly
    
    Inside the unfinished XF86VIDMODE_EVENTS #ifdef block the
    function definition for xf86VidModeNotifyEvent had an extra ');'
    before the prototype argument declarations. This was harmless for the
    compiler as the code never gets used, but completely messed up the
    file re-indentation. This patch removes the spurious characters in
    preparation for re-indenting the file.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 6e2a8e9..9f64f8e 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -75,7 +75,7 @@ static unsigned char XF86VidModeReqCode = 0;
 #ifdef XF86VIDMODE_EVENTS
 static int XF86VidModeEventBase = 0;
 
-static void SXF86VidModeNotifyEvent();
+static void SXF86VidModeNotifyEvent(
 xXF86VidModeNotifyEvent * /* from */ , xXF86VidModeNotifyEvent *        /* to */
     );
 
commit 72cfc1a097dc1e09d2cd9415ef7855a2cef92351
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Apr 11 09:43:23 2012 +1000

    Xi: fix XITouchClass sourceid assignment
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c
index 749bc24..15c8b2a 100644
--- a/Xi/xiquerydevice.c
+++ b/Xi/xiquerydevice.c
@@ -430,7 +430,7 @@ ListTouchInfo(DeviceIntPtr dev, xXITouchInfo * touch)
 {
     touch->type = XITouchClass;
     touch->length = sizeof(xXITouchInfo) >> 2;
-    touch->sourceid = touch->sourceid;
+    touch->sourceid = dev->touch->sourceid;
     touch->mode = dev->touch->mode;
     touch->num_touches = dev->touch->num_touches;
 
commit 10cd6fdc431d2d0835c313b2f5bdda6dcea281fd
Author: Keith Packard <keithp at keithp.com>
Date:   Sun Apr 8 00:16:54 2012 -0700

    Revert "xfree86: workaround crash on close"
    
    This reverts commit 55f552adb651715d2620db7248cd5b9b8187654a.
    
    This appears to cause a crash at init time instead of close.
    
    Reported-by: Knut Petersen <Knut_Petersen at t-online.de>
    Acked-by: Jeremy Huddleston <jeremyhu at apple.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index f9602fa..85d7557 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -272,7 +272,6 @@ xf86RotateDestroy(xf86CrtcPtr crtc)
     ScrnInfoPtr pScrn = crtc->scrn;
     ScreenPtr pScreen = pScrn->pScreen;
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-    DrawablePtr screenDrawable = &pScreen->root->drawable;
     int c;
 
     /* Free memory from rotation */
@@ -290,7 +289,7 @@ xf86RotateDestroy(xf86CrtcPtr crtc)
     /*
      * Clean up damage structures when no crtcs are rotated
      */
-    if (screenDrawable && xf86_config->rotation_damage) {
+    if (xf86_config->rotation_damage) {
         /* Free damage structure */
         if (xf86_config->rotation_damage_registered) {
             DamageUnregister(&pScreen->root->drawable,


More information about the Xquartz-changes mailing list