aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/kdrive
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/kdrive')
-rw-r--r--xorg-server/hw/kdrive/Xkdrive.man57
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr.c6
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr.h407
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrdriext.c21
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrglxext.c28
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c94
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h51
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c6
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrproxyext.c119
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrproxyext.h34
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrvideo.c19
-rw-r--r--xorg-server/hw/kdrive/fake/fake.c5
-rw-r--r--xorg-server/hw/kdrive/fake/fake.h1
-rw-r--r--xorg-server/hw/kdrive/fbdev/Xfbdev.man28
-rw-r--r--xorg-server/hw/kdrive/fbdev/fbdev.h7
-rw-r--r--xorg-server/hw/kdrive/linux/bus.c3
-rw-r--r--xorg-server/hw/kdrive/linux/keyboard.c14
-rw-r--r--xorg-server/hw/kdrive/linux/tslib.c14
-rw-r--r--xorg-server/hw/kdrive/src/kinfo.c36
-rw-r--r--xorg-server/hw/kdrive/src/kinput.c85
-rw-r--r--xorg-server/hw/kdrive/src/kxv.c303
21 files changed, 843 insertions, 495 deletions
diff --git a/xorg-server/hw/kdrive/Xkdrive.man b/xorg-server/hw/kdrive/Xkdrive.man
new file mode 100644
index 000000000..b37f9f10a
--- /dev/null
+++ b/xorg-server/hw/kdrive/Xkdrive.man
@@ -0,0 +1,57 @@
+.\" $RCSId: xc/programs/Xserver/hw/kdrive/Xkdrive.man,v 1.3 2001/01/24 00:06:10 dawes Exp $
+.\"
+.TH Xkdrive 1 __vendorversion__
+.SH NAME
+Xkdrive \- tiny X server
+.SH SYNOPSIS
+.B Xvesa
+.RI [ :display ]
+.RI [ option ...]
+
+.B Xfbdev
+.RI [ :display ]
+.RI [ option ...]
+.SH DESCRIPTION
+.B Xkdrive
+is a family of X servers designed to be particularly small. This
+manual page describes the common functionality of the
+.B Xkdrive
+servers; for information on a specific X server, please refer to the
+relevant manual page.
+.SH OPTIONS
+In addition to the standard options accepted by all X servers (see
+Xserver(1)), all the
+.B Xkdrive
+servers accept the following options:
+.TP 8
+.B -card \fIpcmcia\fP
+use pcmcia card as additional screen.
+.TP 8
+.B -dumb
+disable hardware acceleration.
+.TP 8
+.B -origin \fIX\fP,\fIY\fP
+Locates the next screen in the Xinerama virtual screen.
+.TP 8
+.B -screen \fIwidth\fBx\fIheight\fR[\fBx\fIdepth\fR[\fBx\fIfreq\fR]]\fR[\fB@\fIrotation\fR]\fB
+use a screen of the specified \fIwidth\fP, \fIheight\fP, screen \fIdepth\fP, \fIfrequency\fP, and \fIrotation\fP (0, 90, 180 and 270 are legal values).
+.TP 8
+.B -softCursor
+disable the hardware cursor.
+.TP 8
+.B -videoTest
+start the server, pause momentarily, and exit.
+.TP 8
+.B -zaphod
+disable switching screens by moving the pointer across a screen boundary.
+.TP 8
+.B -2button
+enable emulation of a middle mouse button by chording.
+.TP 8
+.B -3button
+disable emulation of a middle mouse button by chording.
+.SH SEE ALSO
+X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), Xvesa(1), Xfbdev(1).
+.SH AUTHORS
+The Xkdrive common core was written by Keith Packard,
+and is based on the Sample Implementation of X.
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c
index 87e48afaf..c3b3aeff5 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyr.c
@@ -1085,8 +1085,7 @@ MouseInit (KdPointerInfo *pi)
((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
pi->nAxes = 3;
pi->nButtons = 32;
- if (pi->name)
- xfree(pi->name);
+ xfree(pi->name);
pi->name = strdup("Xephyr virtual mouse");
ephyrMouse = pi;
return Success;
@@ -1136,8 +1135,7 @@ EphyrKeyboardInit (KdKeyboardInfo *ki)
}
ki->minScanCode = ephyrKeySyms.minKeyCode;
ki->maxScanCode = ephyrKeySyms.maxKeyCode;
- if (ki->name)
- xfree(ki->name);
+ xfree(ki->name);
ki->name = strdup("Xephyr virtual keyboard");
ephyrKbd = ki;
return Success;
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.h b/xorg-server/hw/kdrive/ephyr/ephyr.h
index dd22bd150..5479736e3 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr.h
+++ b/xorg-server/hw/kdrive/ephyr/ephyr.h
@@ -1,204 +1,203 @@
-/*
- * Xephyr - A kdrive X server thats runs in a host X window.
- * Authored by Matthew Allum <mallum@o-hand.com>
- *
- * Copyright © 2004 Nokia
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Nokia not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Nokia makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _EPHYR_H_
-#define _EPHYR_H_
-#include <stdio.h>
-#ifndef _MSC_VER
-#include <unistd.h>
-#include <libgen.h>
-#endif
-#include <signal.h>
-
-#include "os.h" /* for OsSignal() */
-#include "kdrive.h"
-#include "hostx.h"
-#include "exa.h"
-
-#ifdef RANDR
-#include "randrstr.h"
-#endif
-
-#include "damage.h"
-
-typedef struct _ephyrPriv {
- CARD8 *base;
- int bytes_per_line;
-} EphyrPriv;
-
-typedef struct _ephyrFakexaPriv {
- ExaDriverPtr exa;
- Bool is_synced;
-
- /* The following are arguments and other information from Prepare* calls
- * which are stored for use in the inner calls.
- */
- int op;
- PicturePtr pSrcPicture, pMaskPicture, pDstPicture;
- void *saved_ptrs[3];
- PixmapPtr pDst, pSrc, pMask;
- GCPtr pGC;
-} EphyrFakexaPriv;
-
-typedef struct _ephyrScrPriv {
- Rotation randr;
- Bool shadow;
- PixmapPtr pShadow;
- DamagePtr pDamage;
- EphyrFakexaPriv *fakexa;
-} EphyrScrPriv;
-
-extern KdCardFuncs ephyrFuncs;
-extern KdKeyboardInfo *ephyrKbd;
-extern KdPointerInfo *ephyrMouse;
-
-extern miPointerScreenFuncRec ephyrPointerScreenFuncs;
-
-Bool
-ephyrInitialize (KdCardInfo *card, EphyrPriv *priv);
-
-Bool
-ephyrCardInit (KdCardInfo *card);
-
-Bool
-ephyrScreenInit (KdScreenInfo *screen);
-
-Bool
-ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv);
-
-Bool
-ephyrInitScreen (ScreenPtr pScreen);
-
-Bool
-ephyrFinishInitScreen (ScreenPtr pScreen);
-
-Bool
-ephyrCreateResources (ScreenPtr pScreen);
-
-void
-ephyrPreserve (KdCardInfo *card);
-
-Bool
-ephyrEnable (ScreenPtr pScreen);
-
-Bool
-ephyrDPMS (ScreenPtr pScreen, int mode);
-
-void
-ephyrDisable (ScreenPtr pScreen);
-
-void
-ephyrRestore (KdCardInfo *card);
-
-void
-ephyrScreenFini (KdScreenInfo *screen);
-
-void
-ephyrCardFini (KdCardInfo *card);
-
-void
-ephyrGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
-
-void
-ephyrPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
-
-Bool
-ephyrMapFramebuffer (KdScreenInfo *screen);
-
-void *
-ephyrWindowLinear (ScreenPtr pScreen,
- CARD32 row,
- CARD32 offset,
- int mode,
- CARD32 *size,
- void *closure);
-
-void
-ephyrSetScreenSizes (ScreenPtr pScreen);
-
-Bool
-ephyrUnmapFramebuffer (KdScreenInfo *screen);
-
-void
-ephyrUnsetInternalDamage (ScreenPtr pScreen);
-
-Bool
-ephyrSetInternalDamage (ScreenPtr pScreen);
-
-Bool
-ephyrCreateColormap (ColormapPtr pmap);
-
-void
-ephyrPoll(void);
-
-#ifdef RANDR
-Bool
-ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
-
-Bool
-ephyrRandRSetConfig (ScreenPtr pScreen,
- Rotation randr,
- int rate,
- RRScreenSizePtr pSize);
-Bool
-ephyrRandRInit (ScreenPtr pScreen);
-
-void
-ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf);
-
-#endif
-
-void
-ephyrUpdateModifierState(unsigned int state);
-
-extern KdPointerDriver EphyrMouseDriver;
-
-extern KdKeyboardDriver EphyrKeyboardDriver;
-
-extern KdOsFuncs EphyrOsFuncs;
-
-extern Bool ephyrCursorInit(ScreenPtr pScreen);
-
-extern void ephyrCursorEnable(ScreenPtr pScreen);
-
-/* ephyr_draw.c */
-
-Bool
-ephyrDrawInit(ScreenPtr pScreen);
-
-void
-ephyrDrawEnable(ScreenPtr pScreen);
-
-void
-ephyrDrawDisable(ScreenPtr pScreen);
-
-void
-ephyrDrawFini(ScreenPtr pScreen);
-
-/*ephyvideo.c*/
-
-Bool ephyrInitVideo(ScreenPtr pScreen) ;
-
-#endif
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@o-hand.com>
+ *
+ * Copyright © 2004 Nokia
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Nokia not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Nokia makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _EPHYR_H_
+#define _EPHYR_H_
+#include <stdio.h>
+#ifndef _MSC_VER
+#include <unistd.h>
+#include <libgen.h>
+#endif
+#include <signal.h>
+
+#include "os.h" /* for OsSignal() */
+#include "kdrive.h"
+#include "hostx.h"
+#include "exa.h"
+
+#ifdef RANDR
+#include "randrstr.h"
+#endif
+
+#include "damage.h"
+
+typedef struct _ephyrPriv {
+ CARD8 *base;
+ int bytes_per_line;
+} EphyrPriv;
+
+typedef struct _ephyrFakexaPriv {
+ ExaDriverPtr exa;
+ Bool is_synced;
+
+ /* The following are arguments and other information from Prepare* calls
+ * which are stored for use in the inner calls.
+ */
+ int op;
+ PicturePtr pSrcPicture, pMaskPicture, pDstPicture;
+ void *saved_ptrs[3];
+ PixmapPtr pDst, pSrc, pMask;
+ GCPtr pGC;
+} EphyrFakexaPriv;
+
+typedef struct _ephyrScrPriv {
+ Rotation randr;
+ Bool shadow;
+ DamagePtr pDamage;
+ EphyrFakexaPriv *fakexa;
+} EphyrScrPriv;
+
+extern KdCardFuncs ephyrFuncs;
+extern KdKeyboardInfo *ephyrKbd;
+extern KdPointerInfo *ephyrMouse;
+
+extern miPointerScreenFuncRec ephyrPointerScreenFuncs;
+
+Bool
+ephyrInitialize (KdCardInfo *card, EphyrPriv *priv);
+
+Bool
+ephyrCardInit (KdCardInfo *card);
+
+Bool
+ephyrScreenInit (KdScreenInfo *screen);
+
+Bool
+ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv);
+
+Bool
+ephyrInitScreen (ScreenPtr pScreen);
+
+Bool
+ephyrFinishInitScreen (ScreenPtr pScreen);
+
+Bool
+ephyrCreateResources (ScreenPtr pScreen);
+
+void
+ephyrPreserve (KdCardInfo *card);
+
+Bool
+ephyrEnable (ScreenPtr pScreen);
+
+Bool
+ephyrDPMS (ScreenPtr pScreen, int mode);
+
+void
+ephyrDisable (ScreenPtr pScreen);
+
+void
+ephyrRestore (KdCardInfo *card);
+
+void
+ephyrScreenFini (KdScreenInfo *screen);
+
+void
+ephyrCardFini (KdCardInfo *card);
+
+void
+ephyrGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+
+void
+ephyrPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
+
+Bool
+ephyrMapFramebuffer (KdScreenInfo *screen);
+
+void *
+ephyrWindowLinear (ScreenPtr pScreen,
+ CARD32 row,
+ CARD32 offset,
+ int mode,
+ CARD32 *size,
+ void *closure);
+
+void
+ephyrSetScreenSizes (ScreenPtr pScreen);
+
+Bool
+ephyrUnmapFramebuffer (KdScreenInfo *screen);
+
+void
+ephyrUnsetInternalDamage (ScreenPtr pScreen);
+
+Bool
+ephyrSetInternalDamage (ScreenPtr pScreen);
+
+Bool
+ephyrCreateColormap (ColormapPtr pmap);
+
+void
+ephyrPoll(void);
+
+#ifdef RANDR
+Bool
+ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
+
+Bool
+ephyrRandRSetConfig (ScreenPtr pScreen,
+ Rotation randr,
+ int rate,
+ RRScreenSizePtr pSize);
+Bool
+ephyrRandRInit (ScreenPtr pScreen);
+
+void
+ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf);
+
+#endif
+
+void
+ephyrUpdateModifierState(unsigned int state);
+
+extern KdPointerDriver EphyrMouseDriver;
+
+extern KdKeyboardDriver EphyrKeyboardDriver;
+
+extern KdOsFuncs EphyrOsFuncs;
+
+extern Bool ephyrCursorInit(ScreenPtr pScreen);
+
+extern void ephyrCursorEnable(ScreenPtr pScreen);
+
+/* ephyr_draw.c */
+
+Bool
+ephyrDrawInit(ScreenPtr pScreen);
+
+void
+ephyrDrawEnable(ScreenPtr pScreen);
+
+void
+ephyrDrawDisable(ScreenPtr pScreen);
+
+void
+ephyrDrawFini(ScreenPtr pScreen);
+
+/*ephyvideo.c*/
+
+Bool ephyrInitVideo(ScreenPtr pScreen) ;
+
+#endif
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
index f741d7420..5f5fd3bff 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c
@@ -440,10 +440,9 @@ ephyrDRIClipNotify (WindowPtr a_win,
is_ok = TRUE ;
out:
- if (rects) {
- xfree (rects) ;
- rects = NULL ;
- }
+ xfree (rects) ;
+ rects = NULL ;
+
EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ;
/*do cleanup here*/
}
@@ -566,10 +565,9 @@ EphyrDuplicateVisual (unsigned int a_screen,
is_ok = TRUE ;
out:
- if (new_visuals) {
- xfree (new_visuals) ;
- new_visuals = NULL ;
- }
+ xfree (new_visuals) ;
+ new_visuals = NULL ;
+
EPHYR_LOG ("leave\n") ;
return is_ok ;
}
@@ -1254,10 +1252,9 @@ ProcXF86DRIGetDrawableInfo (register ClientPtr client)
sizeof(drm_clip_rect_t) * rep.numBackClipRects,
(char *)backClipRects);
}
- if (clipRects) {
- xfree(clipRects);
- clipRects = NULL ;
- }
+ xfree(clipRects);
+ clipRects = NULL ;
+
EPHYR_LOG ("leave\n") ;
return (client->noClientException);
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrglxext.c b/xorg-server/hw/kdrive/ephyr/ephyrglxext.c
index 63c4ceda4..a0278cc2b 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrglxext.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrglxext.c
@@ -243,10 +243,9 @@ ephyrGLXGetVisualConfigsReal (__GLXclientState *a_cl,
out:
EPHYR_LOG ("leave\n") ;
- if (props_buf) {
- xfree (props_buf) ;
- props_buf = NULL ;
- }
+ xfree (props_buf) ;
+ props_buf = NULL ;
+
return res ;
}
@@ -301,10 +300,9 @@ ephyrGLXGetFBConfigsSGIXReal (__GLXclientState *a_cl,
out:
EPHYR_LOG ("leave\n") ;
- if (props_buf) {
- xfree (props_buf) ;
- props_buf = NULL ;
- }
+ xfree (props_buf) ;
+ props_buf = NULL ;
+
return res ;
}
@@ -391,14 +389,12 @@ ephyrGLXQueryServerString(__GLXclientState *a_cl, GLbyte *a_pc)
out:
EPHYR_LOG ("leave\n") ;
- if (server_string) {
- xfree (server_string) ;
- server_string = NULL;
- }
- if (buf) {
- xfree (buf);
- buf = NULL;
- }
+ xfree (server_string) ;
+ server_string = NULL;
+
+ xfree (buf);
+ buf = NULL;
+
return res ;
}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c
new file mode 100644
index 000000000..ce3f01852
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c
@@ -0,0 +1,94 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+
+#include <X11/Xlibint.h>
+#define _HAVE_XALLOC_DECLS
+#include "ephyrlog.h"
+#include "ephyrhostproxy.h"
+#include "hostx.h"
+
+/* byte swap a short */
+#define swaps(x, n) { \
+ n = ((char *) (x))[0];\
+ ((char *) (x))[0] = ((char *) (x))[1];\
+ ((char *) (x))[1] = n; }
+
+#define GetXReq(req) \
+ WORD64ALIGN ;\
+ if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
+ _XFlush(dpy);\
+ req = (xReq *)(dpy->last_req = dpy->bufptr);\
+ dpy->bufptr += SIZEOF(xReq);\
+ dpy->request++
+
+
+Bool
+ephyrHostProxyDoForward (pointer a_request_buffer,
+ struct XReply *a_reply,
+ Bool a_do_swap)
+{
+ Bool is_ok = FALSE ;
+ int n=0 ;
+ Display *dpy=hostx_get_display () ;
+ xReq *in_req = (xReq*) a_request_buffer ;
+ xReq *forward_req=NULL ;
+ struct XReply reply ;
+
+ EPHYR_RETURN_VAL_IF_FAIL (in_req && dpy, FALSE) ;
+
+ EPHYR_LOG ("enter\n") ;
+
+ if (a_do_swap) {
+ swaps (&in_req->length, n) ;
+ }
+ EPHYR_LOG ("Req {type:%d, data:%d, length:%d}\n",
+ in_req->reqType, in_req->data, in_req->length) ;
+ GetXReq (forward_req) ;
+ memmove (forward_req, in_req, 4) ;
+
+ if (!_XReply (dpy, (xReply*) &reply, 0, FALSE)) {
+ EPHYR_LOG_ERROR ("failed to get reply\n") ;
+ goto out;
+ }
+ EPHYR_LOG ("XReply{type:%d, foo:%d, seqnum:%d, length:%d}\n",
+ reply.type, reply.foo, reply.sequence_number, reply.length) ;
+
+ if (a_reply) {
+ memmove (a_reply, &reply, sizeof (reply)) ;
+ }
+ is_ok = TRUE ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h
new file mode 100644
index 000000000..720c986ff
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h
@@ -0,0 +1,51 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+
+#ifndef __EPHYRHOSTPROXY_H__
+#define __EPHYRHOSTPROXY_H__
+
+struct XReply {
+ int8_t type ;/*X_Reply*/
+ int8_t foo;
+ int16_t sequence_number ;
+ int32_t length ;
+ /*following is some data up to 32 bytes lenght*/
+ int32_t pad0 ;
+ int32_t pad1 ;
+ int32_t pad2 ;
+ int32_t pad3 ;
+ int32_t pad4 ;
+ int32_t pad5 ;
+};
+
+Bool
+ephyrHostProxyDoForward (pointer a_request_buffer,
+ struct XReply *a_reply,
+ Bool a_do_swap) ;
+
+#endif /*__EPHYRHOSTPROXY_H__*/
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c
index 41c0b755b..f4a1b9d17 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c
@@ -485,10 +485,8 @@ ephyrHostEncodingsDelete (EphyrHostEncoding *a_encodings,
if (!a_encodings)
return ;
for (i=0; i < a_num_encodings; i++) {
- if (a_encodings[i].name) {
- xfree (a_encodings[i].name) ;
- a_encodings[i].name = NULL ;
- }
+ xfree (a_encodings[i].name) ;
+ a_encodings[i].name = NULL ;
}
xfree (a_encodings) ;
}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrproxyext.c b/xorg-server/hw/kdrive/ephyr/ephyrproxyext.c
new file mode 100644
index 000000000..0c070f4c7
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrproxyext.c
@@ -0,0 +1,119 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+
+/*
+ * \file
+ * This file defines a proxy extension that forwards requests.
+ * When a request to extension FOO is sent to Xephyr, that request is forwared
+ * to the host X, without even trying to know what the request means.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <kdrive-config.h>
+#endif
+
+#include "misc.h"
+#include "dixstruct.h"
+#include "extnsionst.h"
+#include "ephyrproxyext.h"
+#define _HAVE_XALLOC_DECLS
+#include "ephyrlog.h"
+#include "ephyrhostproxy.h"
+#include "hostx.h"
+
+static Bool ephyrProxyGetHostExtensionInfo (const char *a_ext_name,
+ int *a_major_opcode,
+ int *a_first_event,
+ int *a_first_error) ;
+
+static int ephyrProxyProcDispatch (ClientPtr client) ;
+
+static Bool
+ephyrProxyGetHostExtensionInfo (const char *a_ext_name,
+ int *a_major_opcode,
+ int *a_first_event,
+ int *a_first_error)
+{
+ return hostx_get_extension_info (a_ext_name, a_major_opcode,
+ a_first_event, a_first_error) ;
+}
+
+static int
+ephyrProxyProcDispatch (ClientPtr a_client)
+{
+ int res=BadImplementation ;
+ struct XReply reply ;
+
+ if (!ephyrHostProxyDoForward (a_client->requestBuffer, &reply, FALSE)) {
+ EPHYR_LOG_ERROR ("forwarding failed\n") ;
+ goto out ;
+ }
+ reply.sequence_number = a_client->sequence;
+ res = Success ;
+
+ WriteToClient(a_client, 32, (char *)&reply);
+
+out:
+ return res ;
+}
+
+static void
+ephyrProxyProcReset (ExtensionEntry *a_entry)
+{
+}
+
+Bool
+ephyrProxyExtensionInit (const char *a_extension_name)
+{
+ Bool is_ok = FALSE ;
+ int major_opcode=0, first_event=0, first_error=0;
+ ExtensionEntry *ext=NULL ;
+
+ if (!ephyrProxyGetHostExtensionInfo (a_extension_name,
+ &major_opcode,
+ &first_event,
+ &first_error)) {
+ EPHYR_LOG ("failed to query extension %s from host\n", a_extension_name) ;
+ goto out;
+ }
+ ext = AddExtension ((char*)a_extension_name, 0, 0,
+ ephyrProxyProcDispatch,
+ ephyrProxyProcDispatch,
+ ephyrProxyProcReset,
+ StandardMinorOpcode) ;
+ if (!ext) {
+ EPHYR_LOG_ERROR ("failed to add the extension\n") ;
+ goto out ;
+ }
+ is_ok = TRUE ;
+
+out:
+ EPHYR_LOG ("leave\n") ;
+ return is_ok ;
+}
+
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrproxyext.h b/xorg-server/hw/kdrive/ephyr/ephyrproxyext.h
new file mode 100644
index 000000000..e52f8d887
--- /dev/null
+++ b/xorg-server/hw/kdrive/ephyr/ephyrproxyext.h
@@ -0,0 +1,34 @@
+/*
+ * Xephyr - A kdrive X server thats runs in a host X window.
+ * Authored by Matthew Allum <mallum@openedhand.com>
+ *
+ * Copyright © 2007 OpenedHand Ltd
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of OpenedHand Ltd not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. OpenedHand Ltd makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Dodji Seketeli <dodji@openedhand.com>
+ */
+#ifndef __EPHYRPROXYEXT_H__
+#define __EPHYRPROXYEXT_H__
+
+Bool ephyrProxyExtensionInit (const char *a_extension_name) ;
+
+#endif /*__EPHYRPROXYEXT_H__*/
+
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrvideo.c b/xorg-server/hw/kdrive/ephyr/ephyrvideo.c
index 5058ebe03..bb2ee1032 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrvideo.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrvideo.c
@@ -371,10 +371,8 @@ ephyrXVPrivDelete (EphyrXVPriv *a_this)
ephyrHostXVAdaptorArrayDelete (a_this->host_adaptors) ;
a_this->host_adaptors = NULL ;
}
- if (a_this->adaptors) {
- xfree (a_this->adaptors) ;
- a_this->adaptors = NULL ;
- }
+ xfree (a_this->adaptors) ;
+ a_this->adaptors = NULL ;
xfree (a_this) ;
EPHYR_LOG ("leave\n") ;
}
@@ -675,14 +673,11 @@ ephyrXVPrivRegisterAdaptors (EphyrXVPriv *a_this,
is_ok = TRUE ;
out:
- if (registered_adaptors) {
- xfree (registered_adaptors) ;
- registered_adaptors = NULL ;
- }
- if (adaptors) {
- xfree (adaptors) ;
- adaptors=NULL ;
- }
+ xfree (registered_adaptors) ;
+ registered_adaptors = NULL ;
+ xfree (adaptors) ;
+ adaptors = NULL ;
+
EPHYR_LOG ("leave\n") ;
return is_ok ;
}
diff --git a/xorg-server/hw/kdrive/fake/fake.c b/xorg-server/hw/kdrive/fake/fake.c
index ff597981d..ea88f0edb 100644
--- a/xorg-server/hw/kdrive/fake/fake.c
+++ b/xorg-server/hw/kdrive/fake/fake.c
@@ -457,9 +457,8 @@ void
fakeCardFini (KdCardInfo *card)
{
FakePriv *priv = card->driver;
-
- if (priv->base)
- free (priv->base);
+
+ free (priv->base);
xfree (priv);
}
diff --git a/xorg-server/hw/kdrive/fake/fake.h b/xorg-server/hw/kdrive/fake/fake.h
index 88d209674..3c4a51bbc 100644
--- a/xorg-server/hw/kdrive/fake/fake.h
+++ b/xorg-server/hw/kdrive/fake/fake.h
@@ -38,7 +38,6 @@ typedef struct _fakePriv {
typedef struct _fakeScrPriv {
Rotation randr;
Bool shadow;
- PixmapPtr pShadow;
} FakeScrPriv;
extern KdCardFuncs fakeFuncs;
diff --git a/xorg-server/hw/kdrive/fbdev/Xfbdev.man b/xorg-server/hw/kdrive/fbdev/Xfbdev.man
new file mode 100644
index 000000000..bfdae168f
--- /dev/null
+++ b/xorg-server/hw/kdrive/fbdev/Xfbdev.man
@@ -0,0 +1,28 @@
+.\" $RCSId: xc/programs/Xserver/hw/kdrive/fbdev/Xfbdev.man,v 1.4 2001/01/27 18:20:40 dawes Exp $
+.\"
+.TH Xfbdev 1 __vendorversion__
+.SH NAME
+Xfbdev \- Linux framebuffer device tiny X server
+.SH SYNOPSIS
+.B Xfbdev
+.RI [ :display ]
+.RI [ option ...]
+.SH DESCRIPTION
+.B Xfbdev
+is a generic X server for Linux.
+.B Xfbdev
+doesn't know about any particular hardware, and uses the framebuffer
+provided by the Linux framebuffer device.
+.SH OPTIONS
+.B Xfbdev
+accepts the common options of the Xkdrive family of servers. Please
+see Xkdrive(1).
+.SH KEYBOARD
+To be written.
+.SH SEE ALSO
+X(__miscmansuffix__), Xserver(1), Xkdrive(1), xdm(1), xinit(1).
+.SH AUTHORS
+The
+.B Xfbdev
+server was written by Keith Packard.
+
diff --git a/xorg-server/hw/kdrive/fbdev/fbdev.h b/xorg-server/hw/kdrive/fbdev/fbdev.h
index 9e322dacb..3da8e4753 100644
--- a/xorg-server/hw/kdrive/fbdev/fbdev.h
+++ b/xorg-server/hw/kdrive/fbdev/fbdev.h
@@ -42,11 +42,10 @@ typedef struct _fbdevPriv {
char *fb;
char *fb_base;
} FbdevPriv;
-
+
typedef struct _fbdevScrPriv {
Rotation randr;
Bool shadow;
- PixmapPtr pShadow;
} FbdevScrPriv;
extern KdCardFuncs fbdevFuncs;
@@ -63,7 +62,7 @@ fbdevScreenInit (KdScreenInfo *screen);
Bool
fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv);
-
+
Bool
fbdevInitScreen (ScreenPtr pScreen);
@@ -122,7 +121,7 @@ fbdevSetShadow (ScreenPtr pScreen);
Bool
fbdevCreateColormap (ColormapPtr pmap);
-
+
#ifdef RANDR
Bool
fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations);
diff --git a/xorg-server/hw/kdrive/linux/bus.c b/xorg-server/hw/kdrive/linux/bus.c
index 93c3ea5f3..de9b90f5a 100644
--- a/xorg-server/hw/kdrive/linux/bus.c
+++ b/xorg-server/hw/kdrive/linux/bus.c
@@ -75,8 +75,7 @@ BusInit (KdPointerInfo *pi)
if ((fd = open (BusNames[i], 0)) >= 0)
{
close(fd);
- if (pi->path)
- xfree(pi->path);
+ xfree(pi->path);
pi->path = strdup(BusNames[i]);
return Success;
}
diff --git a/xorg-server/hw/kdrive/linux/keyboard.c b/xorg-server/hw/kdrive/linux/keyboard.c
index 79cf59898..6eed7aed3 100644
--- a/xorg-server/hw/kdrive/linux/keyboard.c
+++ b/xorg-server/hw/kdrive/linux/keyboard.c
@@ -231,7 +231,7 @@ readKernelMapping(KdKeyboardInfo *ki)
return;
fd = LinuxConsoleFd;
-
+
minKeyCode = NR_KEYS;
maxKeyCode = 0;
row = 0;
@@ -241,7 +241,7 @@ readKernelMapping(KdKeyboardInfo *ki)
kbe.kb_index = LNX_KEY_INDEX(i);
k = ki->keySyms.map + row * ki->keySyms.mapWidth;
-
+
for (j = 0; j < ki->keySyms.mapWidth; ++j)
{
unsigned short kval;
@@ -463,7 +463,7 @@ readKernelMapping(KdKeyboardInfo *ki)
k[j] = (kbe.kb_value & 0xFF) + 0x1008FF00;
break;
#endif
-
+
default:
break;
}
@@ -720,7 +720,7 @@ static void
LinuxKeyboardDisable (KdKeyboardInfo *ki)
{
int fd;
-
+
if (!ki)
return;
@@ -737,11 +737,9 @@ LinuxKeyboardInit (KdKeyboardInfo *ki)
if (!ki)
return !Success;
- if (ki->path)
- xfree(ki->path);
+ xfree(ki->path);
ki->path = strdup("console");
- if (ki->name)
- xfree(ki->name);
+ xfree(ki->name);
ki->name = strdup("Linux console keyboard");
readKernelMapping (ki);
diff --git a/xorg-server/hw/kdrive/linux/tslib.c b/xorg-server/hw/kdrive/linux/tslib.c
index 7cc23e637..322ccc7d5 100644
--- a/xorg-server/hw/kdrive/linux/tslib.c
+++ b/xorg-server/hw/kdrive/linux/tslib.c
@@ -9,7 +9,7 @@
* Copyright © 2002 MontaVista Software Inc.
* Copyright © 2005 OpenedHand Ltd.
* Copyright © 2006 Nokia Corporation
- *
+ *
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
@@ -76,7 +76,7 @@ TsRead (int fd, void *closure)
if (event.pressure) {
flags = KD_BUTTON_1;
- /*
+ /*
* Here we test for the touch screen driver actually being on the
* touch screen, if it is we send absolute coordinates. If not,
* then we send delta's so that we can track the entire vga screen.
@@ -127,7 +127,7 @@ TslibEnable (KdPointerInfo *pi)
}
KdRegisterFd(private->fd, TsRead, pi);
-
+
return Success;
}
@@ -155,7 +155,7 @@ TslibInit (KdPointerInfo *pi)
if (!pi || !pi->dixdev)
return !Success;
-
+
pi->driverPrivate = (struct TslibPrivate *)
xcalloc(sizeof(struct TslibPrivate), 1);
if (!pi->driverPrivate)
@@ -175,10 +175,8 @@ TslibInit (KdPointerInfo *pi)
static void
TslibFini (KdPointerInfo *pi)
{
- if (pi->driverPrivate) {
- xfree(pi->driverPrivate);
- pi->driverPrivate = NULL;
- }
+ xfree(pi->driverPrivate);
+ pi->driverPrivate = NULL;
}
diff --git a/xorg-server/hw/kdrive/src/kinfo.c b/xorg-server/hw/kdrive/src/kinfo.c
index 4551fd76b..95afc7963 100644
--- a/xorg-server/hw/kdrive/src/kinfo.c
+++ b/xorg-server/hw/kdrive/src/kinfo.c
@@ -138,40 +138,28 @@ KdFreePointer(KdPointerInfo *pi)
{
InputOption *option, *prev = NULL;
- if (pi->name)
- xfree(pi->name);
- if (pi->path)
- xfree(pi->path);
+ xfree(pi->name);
+ xfree(pi->path);
for (option = pi->options; option; option = option->next) {
- if (prev)
- xfree(prev);
- if (option->key)
- xfree(option->key);
- if (option->value)
- xfree(option->value);
+ xfree(prev);
+ xfree(option->key);
+ xfree(option->value);
prev = option;
}
- if (prev)
- xfree(prev);
-
+ xfree(prev);
xfree(pi);
}
-
+
void
KdFreeKeyboard(KdKeyboardInfo *ki)
{
- if (ki->name)
- xfree(ki->name);
- if (ki->path)
- xfree(ki->path);
- if (ki->xkbRules)
- xfree(ki->xkbRules);
- if (ki->xkbModel)
- xfree(ki->xkbModel);
- if (ki->xkbLayout)
- xfree(ki->xkbLayout);
+ xfree(ki->name);
+ xfree(ki->path);
+ xfree(ki->xkbRules);
+ xfree(ki->xkbModel);
+ xfree(ki->xkbLayout);
ki->next = NULL;
xfree(ki);
}
diff --git a/xorg-server/hw/kdrive/src/kinput.c b/xorg-server/hw/kdrive/src/kinput.c
index 5222e9509..9ba90e63f 100644
--- a/xorg-server/hw/kdrive/src/kinput.c
+++ b/xorg-server/hw/kdrive/src/kinput.c
@@ -76,7 +76,7 @@ static KdPointerMatrix kdPointerMatrix = {
};
void KdResetInputMachine (void);
-
+
#define KD_MAX_INPUT_FDS 8
typedef struct _kdInputFd {
@@ -108,7 +108,7 @@ KdBlockSigio (void)
__asm int 3;
#else
sigset_t set;
-
+
sigemptyset (&set);
sigaddset (&set, SIGIO);
sigprocmask (SIG_BLOCK, &set, 0);
@@ -122,7 +122,7 @@ KdUnblockSigio (void)
__asm int 3;
#else
sigset_t set;
-
+
sigemptyset (&set);
sigaddset (&set, SIGIO);
sigprocmask (SIG_UNBLOCK, &set, 0);
@@ -190,7 +190,7 @@ KdAddFd (int fd)
#else
struct sigaction act;
sigset_t set;
-
+
kdnFds++;
fcntl (fd, F_SETOWN, getpid());
KdNonBlockFd (fd);
@@ -215,7 +215,7 @@ KdRemoveFd (int fd)
#else
struct sigaction act;
int flags;
-
+
kdnFds--;
RemoveEnabledDevice (fd);
flags = fcntl (fd, F_GETFL);
@@ -344,7 +344,7 @@ KdEnableInput (void)
InternalEvent ev;
KdKeyboardInfo *ki;
KdPointerInfo *pi;
-
+
kdInputEnabled = TRUE;
for (ki = kdKeyboards; ki; ki = ki->next) {
@@ -372,7 +372,7 @@ KdFindKeyboardDriver (char *name)
/* ask a stupid question ... */
if (!name)
return NULL;
-
+
for (ret = kdKeyboardDrivers; ret; ret = ret->next) {
if (strcmp(ret->name, name) == 0)
return ret;
@@ -507,11 +507,11 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
pi->name ? pi->name : "Generic KDrive Pointer");
return Success;
-
+
case DEVICE_ON:
if (pDev->on == TRUE)
return Success;
-
+
if (!pi->driver->Enable) {
ErrorF("no enable function\n");
return BadImplementation;
@@ -558,7 +558,7 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff)
(*pi->driver->Fini) (pi);
KdRemovePointer(pi);
-
+
return Success;
}
@@ -579,7 +579,7 @@ KdBell (int volume, DeviceIntPtr pDev, pointer arg, int something)
{
KeybdCtrl *ctrl = arg;
KdKeyboardInfo *ki = NULL;
-
+
for (ki = kdKeyboards; ki; ki = ki->next) {
if (ki->dixdev && ki->dixdev->id == pDev->id)
break;
@@ -587,7 +587,7 @@ KdBell (int volume, DeviceIntPtr pDev, pointer arg, int something)
if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver)
return;
-
+
KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration);
}
@@ -613,7 +613,7 @@ KdRingBell(KdKeyboardInfo *ki, int volume, int pitch, int duration)
{
if (!ki || !ki->driver || !ki->driver->Bell)
return;
-
+
if (kdInputEnabled)
(*ki->driver->Bell) (ki, volume, pitch, duration);
}
@@ -714,7 +714,7 @@ KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
KdSetLeds(ki, ctrl->leds);
ki->bellPitch = ctrl->bell_pitch;
- ki->bellDuration = ctrl->bell_duration;
+ ki->bellDuration = ctrl->bell_duration;
}
extern KeybdCtrl defaultKeyboardControl;
@@ -817,7 +817,7 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
pDev->on = FALSE;
return Success;
-
+
break;
case DEVICE_CLOSE:
@@ -958,7 +958,7 @@ KdAddKeyboard (KdKeyboardInfo *ki)
if (!ki)
return !Success;
-
+
ki->dixdev = AddInputDevice(serverClient, KdKeyboardProc, TRUE);
if (!ki->dixdev) {
ErrorF("Couldn't register keyboard device %s\n",
@@ -1065,12 +1065,12 @@ KdRemovePointer (KdPointerInfo *pi)
KdFreePointer(pi);
}
-/*
+/*
* You can call your kdriver server with something like:
* $ ./hw/kdrive/yourserver/X :1 -mouse evdev,,device=/dev/input/event4 -keybd
- * evdev,,device=/dev/input/event1,xkbmodel=abnt2,xkblayout=br
+ * evdev,,device=/dev/input/event1,xkbmodel=abnt2,xkblayout=br
*/
-static Bool
+static Bool
KdGetOptions (InputOption **options, char *string)
{
InputOption *newopt = NULL, **tmpo = NULL;
@@ -1081,7 +1081,7 @@ KdGetOptions (InputOption **options, char *string)
return FALSE;
for (tmpo = options; *tmpo; tmpo = &(*tmpo)->next)
- ; /* Hello, I'm here */
+ ; /* Hello, I'm here */
*tmpo = newopt;
if (strchr(string, '='))
@@ -1122,7 +1122,7 @@ KdParseKbdOptions (KdKeyboardInfo *ki)
else if (!strcasecmp (option->key, "device"))
ki->path = strdup(option->value);
else
- ErrorF("Kbd option key (%s) of value (%s) not assigned!\n",
+ ErrorF("Kbd option key (%s) of value (%s) not assigned!\n",
option->key, option->value);
}
}
@@ -1183,11 +1183,11 @@ KdParseKeyboard (char *arg)
{
arg = KdParseFindNext (arg, ",", save, &delim);
- if (!KdGetOptions(&options, save))
+ if (!KdGetOptions(&options, save))
{
KdFreeKeyboard(ki);
return NULL;
- }
+ }
}
if (options)
@@ -1219,7 +1219,7 @@ KdParsePointerOptions (KdPointerInfo *pi)
else if (!strcasecmp (option->key, "protocol"))
pi->protocol = strdup(option->value);
else
- ErrorF("Pointer option key (%s) of value (%s) not assigned!\n",
+ ErrorF("Pointer option key (%s) of value (%s) not assigned!\n",
option->key, option->value);
}
}
@@ -1471,7 +1471,7 @@ KdInitInput (void)
* <> -> (deliver) synthetic_2_down_1
* k -> (deliver) synthetic_2_down_1
*/
-
+
typedef enum _inputClass {
down_1, up_1,
down_2, up_2,
@@ -1651,7 +1651,7 @@ KdInsideEmulationWindow (KdPointerInfo *pi, int x, int y, int z)
return (abs (pi->emulationDx) < EMULATION_WINDOW &&
abs (pi->emulationDy) < EMULATION_WINDOW);
}
-
+
static KdInputClass
KdClassifyInput (KdPointerInfo *pi, int type, int x, int y, int z, int b)
{
@@ -1929,7 +1929,7 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
if (!pi)
return;
-
+
ms = GetTimeInMillis();
/* we don't need to transform z, so we don't. */
@@ -2024,7 +2024,7 @@ KdBlockHandler (int screen,
if (pi->timeoutPending)
{
int ms;
-
+
ms = pi->emulationTimeout - GetTimeInMillis ();
if (ms < 1)
ms = 1;
@@ -2043,7 +2043,7 @@ KdBlockHandler (int screen,
}
void
-KdWakeupHandler (int screen,
+KdWakeupHandler (int screen,
pointer data,
unsigned long lresult,
pointer readmask)
@@ -2052,7 +2052,7 @@ KdWakeupHandler (int screen,
fd_set *pReadmask = (fd_set *) readmask;
int i;
KdPointerInfo *pi;
-
+
if (kdInputEnabled && result > 0)
{
for (i = 0; i < kdNumInputFds; i++)
@@ -2092,13 +2092,13 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
int best_x, best_y;
int n_best_x, n_best_y;
CARD32 ms;
-
+
if (kdDisableZaphod || screenInfo.numScreens <= 1)
return FALSE;
if (0 <= *x && *x < pScreen->width && 0 <= *y && *y < pScreen->height)
return FALSE;
-
+
ms = GetTimeInMillis ();
if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000)
return FALSE;
@@ -2111,7 +2111,7 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
for (n = 0; n < screenInfo.numScreens; n++)
{
pNewScreen = screenInfo.screens[n];
- if (pNewScreen == pScreen)
+ if (pNewScreen == pScreen)
continue;
dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x;
dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y;
@@ -2153,17 +2153,17 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
if (n_best_x == -1)
return FALSE;
pNewScreen = screenInfo.screens[n_best_x];
-
+
if (*x < 0)
*x += pNewScreen->width;
if (*y < 0)
*y += pNewScreen->height;
-
+
if (*x >= pScreen->width)
*x -= pScreen->width;
if (*y >= pScreen->height)
*y -= pScreen->height;
-
+
*ppScreen = pNewScreen;
return TRUE;
}
@@ -2190,7 +2190,7 @@ KdWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
KdUnblockSigio ();
}
-miPointerScreenFuncRec kdPointerScreenFuncs =
+miPointerScreenFuncRec kdPointerScreenFuncs =
{
KdCursorOffScreen,
KdCrossScreen,
@@ -2274,7 +2274,8 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev,
}
int
-NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
+NewInputDeviceRequest(InputOption *options, InputAttributes *attrs,
+ DeviceIntPtr *pdev)
{
InputOption *option = NULL;
KdPointerInfo *pi = NULL;
@@ -2305,6 +2306,14 @@ NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
return BadValue;
}
#endif
+#ifdef CONFIG_UDEV
+ else if (strcmp(option->key, "_source") == 0 &&
+ strcmp(option->value, "server/udev") == 0)
+ {
+ ErrorF("Ignoring device from udev.\n");
+ return BadValue;
+ }
+#endif
}
if (!ki && !pi) {
diff --git a/xorg-server/hw/kdrive/src/kxv.c b/xorg-server/hw/kdrive/src/kxv.c
index 9a74654af..27ecc5d6c 100644
--- a/xorg-server/hw/kdrive/src/kxv.c
+++ b/xorg-server/hw/kdrive/src/kxv.c
@@ -1,6 +1,6 @@
-/*
+/*
- XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com)
+ XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com)
Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com>
Copyright (C) 2000, 2001 - Nokia Home Communications
@@ -67,29 +67,29 @@ static int KdXVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *);
static int KdXVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*);
static int KdXVFreePort(XvPortPtr);
static int KdXVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
static int KdXVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
static int KdXVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
static int KdXVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16);
static int KdXVStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
static int KdXVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
static int KdXVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
static int KdXVQueryBestSize(ClientPtr, XvPortPtr, CARD8,
- CARD16, CARD16,CARD16, CARD16,
+ CARD16, CARD16,CARD16, CARD16,
unsigned int*, unsigned int*);
static int KdXVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
- INT16, INT16, CARD16, CARD16,
+ INT16, INT16, CARD16, CARD16,
INT16, INT16, CARD16, CARD16,
XvImagePtr, unsigned char*, Bool,
CARD16, CARD16);
-static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
+static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
CARD16*, CARD16*, int*, int*);
@@ -134,12 +134,12 @@ KdXVRegisterGenericAdaptorDriver(
/* fprintf(stderr,"KdXVRegisterGenericAdaptorDriver\n"); */
- newdrivers = xrealloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) *
+ newdrivers = xrealloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) *
(1 + NumGenDrivers));
if (!newdrivers)
return 0;
GenDrivers = newdrivers;
-
+
GenDrivers[NumGenDrivers++] = InitFunc;
return 1;
@@ -184,7 +184,7 @@ KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr)
Bool
KdXVScreenInit(
- ScreenPtr pScreen,
+ ScreenPtr pScreen,
KdVideoAdaptorPtr *adaptors,
int num
){
@@ -197,7 +197,7 @@ KdXVScreenInit(
KdXVGeneration = serverGeneration;
if(!XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
- return FALSE;
+ return FALSE;
if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
@@ -247,20 +247,18 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
{
int i;
- if(pAdaptor->name)
- xfree(pAdaptor->name);
+ xfree(pAdaptor->name);
if(pAdaptor->pEncodings) {
XvEncodingPtr pEncode = pAdaptor->pEncodings;
for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++) {
- if(pEncode->name) xfree(pEncode->name);
+ xfree(pEncode->name);
}
xfree(pAdaptor->pEncodings);
}
- if(pAdaptor->pFormats)
- xfree(pAdaptor->pFormats);
+ xfree(pAdaptor->pFormats);
if(pAdaptor->pPorts) {
XvPortPtr pPort = pAdaptor->pPorts;
@@ -269,9 +267,9 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
for(i = 0; i < pAdaptor->nPorts; i++, pPort++) {
pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
if(pPriv) {
- if(pPriv->clientClip)
+ if(pPriv->clientClip)
REGION_DESTROY(pAdaptor->pScreen, pPriv->clientClip);
- if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
+ if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
REGION_DESTROY(pAdaptor->pScreen, pPriv->pCompositeClip);
xfree(pPriv);
}
@@ -283,22 +281,20 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
XvAttributePtr pAttribute = pAdaptor->pAttributes;
for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++) {
- if(pAttribute->name) xfree(pAttribute->name);
+ xfree(pAttribute->name);
}
xfree(pAdaptor->pAttributes);
}
- if(pAdaptor->nImages)
- xfree(pAdaptor->pImages);
-
- if(pAdaptor->devPriv.ptr)
- xfree(pAdaptor->devPriv.ptr);
+ xfree(pAdaptor->pImages);
+
+ xfree(pAdaptor->devPriv.ptr);
}
static Bool
KdXVInitAdaptors(
- ScreenPtr pScreen,
+ ScreenPtr pScreen,
KdVideoAdaptorPtr *infoPtr,
int number
) {
@@ -329,7 +325,7 @@ KdXVInitAdaptors(
pxvs->nAdaptors = 0;
pxvs->pAdaptors = NULL;
- if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec))))
+ if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec))))
return FALSE;
for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
@@ -343,7 +339,7 @@ KdXVInitAdaptors(
if(!adaptorPtr->nEncodings || !adaptorPtr->pEncodings)
continue;
- pa->type = adaptorPtr->type;
+ pa->type = adaptorPtr->type;
if(!adaptorPtr->PutVideo && !adaptorPtr->GetVideo)
pa->type &= ~XvVideoMask;
@@ -354,19 +350,19 @@ KdXVInitAdaptors(
if(!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes)
pa->type &= ~XvImageMask;
- if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage &&
+ if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage &&
!adaptorPtr->PutStill)
pa->type &= ~XvInputMask;
if(!adaptorPtr->GetVideo && !adaptorPtr->GetStill)
pa->type &= ~XvOutputMask;
-
- if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask)))
+
+ if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask)))
continue;
- if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask)))
+ if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask)))
continue;
- pa->pScreen = pScreen;
+ pa->pScreen = pScreen;
pa->ddAllocatePort = KdXVAllocatePort;
pa->ddFreePort = KdXVFreePort;
pa->ddPutVideo = KdXVPutVideo;
@@ -385,8 +381,8 @@ KdXVInitAdaptors(
if(adaptorPtr->nEncodings &&
(pEncode = xcalloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
- for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
- i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++)
+ for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
+ i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++)
{
pe->id = encodingPtr->id;
pe->pScreen = pScreen;
@@ -398,14 +394,14 @@ KdXVInitAdaptors(
pe->rate.denominator = encodingPtr->rate.denominator;
}
pa->nEncodings = adaptorPtr->nEncodings;
- pa->pEncodings = pEncode;
- }
+ pa->pEncodings = pEncode;
+ }
if(adaptorPtr->nImages &&
(pImage = xcalloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
- i < adaptorPtr->nImages; i++, pi++, imagePtr++)
+ i < adaptorPtr->nImages; i++, pi++, imagePtr++)
{
pi->id = imagePtr->id;
pi->type = imagePtr->type;
@@ -437,8 +433,8 @@ KdXVInitAdaptors(
if(adaptorPtr->nAttributes &&
(pAttribute = xcalloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec))))
{
- for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0;
- i < adaptorPtr->nAttributes; pat++, i++, attributePtr++)
+ for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0;
+ i < adaptorPtr->nAttributes; pat++, i++, attributePtr++)
{
pat->flags = attributePtr->flags;
pat->min_value = attributePtr->min_value;
@@ -447,8 +443,8 @@ KdXVInitAdaptors(
strcpy(pat->name, attributePtr->name);
}
pa->nAttributes = adaptorPtr->nAttributes;
- pa->pAttributes = pAttribute;
- }
+ pa->pAttributes = pAttribute;
+ }
totFormat = adaptorPtr->nFormats;
@@ -457,8 +453,8 @@ KdXVInitAdaptors(
KdXVFreeAdaptor(pa);
continue;
}
- for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats;
- i < adaptorPtr->nFormats; i++, formatPtr++)
+ for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats;
+ i < adaptorPtr->nFormats; i++, formatPtr++)
{
numVisuals = pScreen->numVisuals;
pVisual = pScreen->visuals;
@@ -468,26 +464,26 @@ KdXVInitAdaptors(
(pVisual->nplanes == formatPtr->depth)) {
if(numFormat >= totFormat) {
- void *moreSpace;
+ void *moreSpace;
totFormat *= 2;
- moreSpace = xrealloc(pFormat,
+ moreSpace = xrealloc(pFormat,
totFormat * sizeof(XvFormatRec));
if(!moreSpace) break;
pFormat = moreSpace;
pf = pFormat + numFormat;
}
- pf->visual = pVisual->vid;
+ pf->visual = pVisual->vid;
pf->depth = formatPtr->depth;
pf++;
numFormat++;
}
pVisual++;
- }
+ }
}
pa->nFormats = numFormat;
- pa->pFormats = pFormat;
+ pa->pFormats = pFormat;
if(!numFormat) {
KdXVFreeAdaptor(pa);
continue;
@@ -517,15 +513,15 @@ KdXVInitAdaptors(
KdXVFreeAdaptor(pa);
continue;
}
- for(pp = pPort, i = 0, numPort = 0;
+ for(pp = pPort, i = 0, numPort = 0;
i < adaptorPtr->nPorts; i++) {
- if(!(pp->id = FakeClientID(0)))
+ if(!(pp->id = FakeClientID(0)))
continue;
- if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate))))
+ if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate))))
continue;
-
+
if(!AddResource(pp->id, PortResource, pp)) {
xfree(portPriv);
continue;
@@ -542,7 +538,7 @@ KdXVInitAdaptors(
portPriv->screen = screen;
portPriv->AdaptorRec = adaptorPriv;
portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr;
-
+
pp++;
numPort++;
}
@@ -554,7 +550,7 @@ KdXVInitAdaptors(
}
pa->base_id = pPort->id;
-
+
pa++;
numAdaptor++;
}
@@ -580,13 +576,13 @@ KdXVInitAdaptors(
the GC and used it's clip list when they needed to reclip the window,
even if the client clip was different from the one the video was
initialized with. If the original GC was destroyed, they had to stop
- the video. I like the new method better (MArk).
+ the video. I like the new method better (MArk).
This function only works for windows. Will need to rewrite when
(if) we support pixmap rendering.
*/
-static void
+static void
KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
{
RegionPtr pregWin, pCompositeClip;
@@ -623,7 +619,7 @@ KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
if(freeCompClip) {
REGION_DESTROY(pWin->pScreen, pregWin);
- }
+ }
}
/* Save the current clientClip and update the CompositeClip whenever
@@ -631,7 +627,7 @@ KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
static void
KdXVCopyClip(
- XvPortRecPrivatePtr portPriv,
+ XvPortRecPrivatePtr portPriv,
GCPtr pGC
){
/* copy the new clip if it exists */
@@ -672,12 +668,12 @@ KdXVRegetVideo(XvPortRecPrivatePtr portPriv)
WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
WinBox.x2 = WinBox.x1 + portPriv->drw_w;
WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-
+
/* clip to the window composite clip */
REGION_INIT(portPriv->pDraw->pScreen, &WinRegion, &WinBox, 1);
REGION_INIT(portPriv->pDraw->pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
-
+ REGION_INTERSECT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
+
/* that's all if it's totally obscured */
if(!REGION_NOTEMPTY(portPriv->pDraw->pScreen, &ClipRegion)) {
clippedAway = TRUE;
@@ -689,10 +685,10 @@ KdXVRegetVideo(XvPortRecPrivatePtr portPriv)
}
ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->screen, portPriv->pDraw,
- portPriv->vid_x, portPriv->vid_y,
- WinBox.x1, WinBox.y1,
- portPriv->vid_w, portPriv->vid_h,
- portPriv->drw_w, portPriv->drw_h,
+ portPriv->vid_x, portPriv->vid_y,
+ WinBox.x1, WinBox.y1,
+ portPriv->vid_w, portPriv->vid_h,
+ portPriv->drw_w, portPriv->drw_h,
&ClipRegion, portPriv->DevPriv.ptr);
if(ret == Success)
@@ -736,11 +732,11 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv)
WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
WinBox.x2 = WinBox.x1 + portPriv->drw_w;
WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-
+
/* clip to the window composite clip */
REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
+ REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
/* clip and translate to the viewport */
if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
@@ -753,10 +749,10 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv)
VPBox.y2 = screen->height;
REGION_INIT(pScreen, &VPReg, &VPBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
+ REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
REGION_UNINIT(pScreen, &VPReg);
}
-
+
/* that's all if it's totally obscured */
if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
clippedAway = TRUE;
@@ -767,8 +763,8 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv)
if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
BoxPtr clipBox = REGION_RECTS(&ClipRegion);
if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
{
clippedAway = TRUE;
goto CLIP_VIDEO_BAILOUT;
@@ -780,10 +776,10 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv)
}
ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->screen, portPriv->pDraw,
- portPriv->vid_x, portPriv->vid_y,
+ portPriv->vid_x, portPriv->vid_y,
WinBox.x1, WinBox.y1,
- portPriv->vid_w, portPriv->vid_h,
- portPriv->drw_w, portPriv->drw_h,
+ portPriv->vid_w, portPriv->vid_h,
+ portPriv->drw_w, portPriv->drw_h,
&ClipRegion, portPriv->DevPriv.ptr);
if(ret == Success) portPriv->isOn = XV_ON;
@@ -825,11 +821,11 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv)
WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
WinBox.x2 = WinBox.x1 + portPriv->drw_w;
WinBox.y2 = WinBox.y1 + portPriv->drw_h;
-
+
/* clip to the window composite clip */
REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
+ REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip);
/* clip and translate to the viewport */
if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
@@ -842,10 +838,10 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv)
VPBox.y2 = screen->height;
REGION_INIT(pScreen, &VPReg, &VPBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
+ REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
REGION_UNINIT(pScreen, &VPReg);
}
-
+
/* that's all if it's totally obscured */
if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
clippedAway = TRUE;
@@ -856,8 +852,8 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv)
if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
BoxPtr clipBox = REGION_RECTS(&ClipRegion);
if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
- (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
{
clippedAway = TRUE;
goto CLIP_VIDEO_BAILOUT;
@@ -897,10 +893,10 @@ static int
KdXVReputAllVideo(WindowPtr pWin, pointer data)
{
KdXVWindowPtr WinPriv;
-
+
if (pWin->drawable.type != DRAWABLE_WINDOW)
return WT_DONTWALKCHILDREN;
-
+
WinPriv = GET_KDXV_WINDOW(pWin);
while(WinPriv) {
@@ -917,7 +913,7 @@ KdXVReputAllVideo(WindowPtr pWin, pointer data)
static int
KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
{
- KdXVWindowPtr winPriv, PrivRoot;
+ KdXVWindowPtr winPriv, PrivRoot;
winPriv = PrivRoot = GET_KDXV_WINDOW(pWin);
@@ -934,7 +930,7 @@ KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
winPriv->PortRec = portPriv;
winPriv->next = PrivRoot;
dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv);
- }
+ }
return Success;
}
@@ -948,14 +944,14 @@ KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
while(winPriv) {
if(winPriv->PortRec == portPriv) {
- if(prevPriv)
+ if(prevPriv)
prevPriv->next = winPriv->next;
- else
+ else
dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv->next);
xfree(winPriv);
break;
}
- prevPriv = winPriv;
+ prevPriv = winPriv;
winPriv = winPriv->next;
}
portPriv->pDraw = NULL;
@@ -1033,7 +1029,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
/* filter out XClearWindow/Area */
if (!pWin->valdata) return;
-
+
pPrev = NULL;
while(WinPriv) {
@@ -1044,10 +1040,10 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
switch(pPriv->type) {
case XvInputMask:
KdXVReputVideo(pPriv);
- break;
+ break;
case XvOutputMask:
- KdXVRegetVideo(pPriv);
- break;
+ KdXVRegetVideo(pPriv);
+ break;
default: /* overlaid still/image*/
if (pPriv->AdaptorRec->ReputImage)
KdXVReputImage(pPriv);
@@ -1061,7 +1057,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
}
pPriv->pDraw = NULL;
- if(!pPrev)
+ if(!pPrev)
dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next);
else
pPrev->next = WinPriv->next;
@@ -1078,7 +1074,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
}
-static void
+static void
KdXVClipNotify(WindowPtr pWin, int dx, int dy)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
@@ -1097,7 +1093,7 @@ KdXVClipNotify(WindowPtr pWin, int dx, int dy)
pPriv->pCompositeClip = NULL;
- /* Stop everything except images, but stop them too if the
+ /* Stop everything except images, but stop them too if the
window isn't visible. But we only remove the images. */
if(pPriv->type || !visible) {
@@ -1110,7 +1106,7 @@ KdXVClipNotify(WindowPtr pWin, int dx, int dy)
if(!pPriv->type) { /* overlaid still/image */
pPriv->pDraw = NULL;
- if(!pPrev)
+ if(!pPrev)
dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next);
else
pPrev->next = WinPriv->next;
@@ -1153,16 +1149,13 @@ KdXVCloseScreen(int i, ScreenPtr pScreen)
/* fprintf(stderr,"XV: Unwrapping screen funcs\n"); */
- for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
+ for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
KdXVFreeAdaptor(pa);
}
- if(pxvs->pAdaptors)
- xfree(pxvs->pAdaptors);
-
+ xfree(pxvs->pAdaptors);
xfree(ScreenPriv);
-
return TRUE;
}
@@ -1193,9 +1186,9 @@ KdXVEnable(ScreenPtr pScreen)
{
if (!KdXVRunning (pScreen))
return TRUE;
-
- WalkTree(pScreen, KdXVReputAllVideo, 0);
-
+
+ WalkTree(pScreen, KdXVReputAllVideo, 0);
+
return TRUE;
}
@@ -1214,7 +1207,7 @@ KdXVDisable(ScreenPtr pScreen)
pxvs = GET_XV_SCREEN(pScreen);
ScreenPriv = GET_KDXV_SCREEN(pScreen);
-
+
for(i = 0; i < pxvs->nAdaptors; i++) {
pAdaptor = &pxvs->pAdaptors[i];
for(j = 0; j < pAdaptor->nPorts; j++) {
@@ -1263,8 +1256,8 @@ KdXVPutVideo(
DrawablePtr pDraw,
XvPortPtr pPort,
GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
INT16 drw_x, INT16 drw_y,
CARD16 drw_w, CARD16 drw_h
){
@@ -1277,7 +1270,7 @@ KdXVPutVideo(
pPort->pDraw = (DrawablePtr)NULL;
return BadAlloc;
}
-
+
/* If we are changing windows, unregister our port in the old window */
if(portPriv->pDraw && (portPriv->pDraw != pDraw))
KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
@@ -1302,7 +1295,7 @@ KdXVPutVideo(
pPort->pDraw = pDraw;
if (!pScreenPriv->enabled) return Success;
-
+
return(KdXVReputVideo(portPriv));
}
@@ -1312,13 +1305,13 @@ KdXVPutStill(
DrawablePtr pDraw,
XvPortPtr pPort,
GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
INT16 drw_x, INT16 drw_y,
CARD16 drw_w, CARD16 drw_h
){
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- ScreenPtr pScreen = pDraw->pScreen;
+ ScreenPtr pScreen = pDraw->pScreen;
KdScreenPriv(pScreen);
KdScreenInfo *screen=pScreenPriv->screen;
RegionRec WinRegion;
@@ -1336,10 +1329,10 @@ KdXVPutStill(
WinBox.y1 = pDraw->y + drw_y;
WinBox.x2 = WinBox.x1 + drw_w;
WinBox.y2 = WinBox.y1 + drw_h;
-
+
REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
+ REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
RegionRec VPReg;
@@ -1351,7 +1344,7 @@ KdXVPutStill(
VPBox.y2 = screen->height;
REGION_INIT(pScreen, &VPReg, &VPBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
+ REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
REGION_UNINIT(pScreen, &VPReg);
}
@@ -1367,7 +1360,7 @@ KdXVPutStill(
if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
BoxPtr clipBox = REGION_RECTS(&ClipRegion);
if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
(clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
{
clippedAway = TRUE;
@@ -1417,8 +1410,8 @@ KdXVGetVideo(
DrawablePtr pDraw,
XvPortPtr pPort,
GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
INT16 drw_x, INT16 drw_y,
CARD16 drw_w, CARD16 drw_h
){
@@ -1431,7 +1424,7 @@ KdXVGetVideo(
pPort->pDraw = (DrawablePtr)NULL;
return BadAlloc;
}
-
+
/* If we are changing windows, unregister our port in the old window */
if(portPriv->pDraw && (portPriv->pDraw != pDraw))
KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
@@ -1454,7 +1447,7 @@ KdXVGetVideo(
/* To indicate to the DI layer that we were successful */
pPort->pDraw = pDraw;
-
+
if(!pScreenPriv->enabled) return Success;
return(KdXVRegetVideo(portPriv));
@@ -1466,8 +1459,8 @@ KdXVGetStill(
DrawablePtr pDraw,
XvPortPtr pPort,
GCPtr pGC,
- INT16 vid_x, INT16 vid_y,
- CARD16 vid_w, CARD16 vid_h,
+ INT16 vid_x, INT16 vid_y,
+ CARD16 vid_w, CARD16 vid_h,
INT16 drw_x, INT16 drw_y,
CARD16 drw_w, CARD16 drw_h
){
@@ -1489,10 +1482,10 @@ KdXVGetStill(
WinBox.y1 = pDraw->y + drw_y;
WinBox.x2 = WinBox.x1 + drw_w;
WinBox.y2 = WinBox.y1 + drw_h;
-
+
REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
+ REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
if(portPriv->pDraw) {
KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
@@ -1526,7 +1519,7 @@ GET_STILL_BAILOUT:
return ret;
}
-
+
static int
KdXVStopVideo(
@@ -1539,7 +1532,7 @@ KdXVStopVideo(
if(pDraw->type != DRAWABLE_WINDOW)
return BadAlloc;
-
+
KdXVRemovePortFromWindow((WindowPtr)pDraw, portPriv);
if(!pScreenPriv->enabled) return Success;
@@ -1563,8 +1556,8 @@ KdXVSetPortAttribute(
INT32 value
){
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->screen,
+
+ return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->screen,
attribute, value, portPriv->DevPriv.ptr));
}
@@ -1577,8 +1570,8 @@ KdXVGetPortAttribute(
INT32 *p_value
){
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->screen,
+
+ return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->screen,
attribute, (int *) p_value, portPriv->DevPriv.ptr));
}
@@ -1594,8 +1587,8 @@ KdXVQueryBestSize(
unsigned int *p_w, unsigned int *p_h
){
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
-
- (*portPriv->AdaptorRec->QueryBestSize)(portPriv->screen,
+
+ (*portPriv->AdaptorRec->QueryBestSize)(portPriv->screen,
(Bool)motion, vid_w, vid_h, drw_w, drw_h,
p_w, p_h, portPriv->DevPriv.ptr);
@@ -1603,14 +1596,14 @@ KdXVQueryBestSize(
}
-static int
+static int
KdXVPutImage(
- ClientPtr client,
- DrawablePtr pDraw,
- XvPortPtr pPort,
+ ClientPtr client,
+ DrawablePtr pDraw,
+ XvPortPtr pPort,
GCPtr pGC,
- INT16 src_x, INT16 src_y,
- CARD16 src_w, CARD16 src_h,
+ INT16 src_x, INT16 src_y,
+ CARD16 src_w, CARD16 src_h,
INT16 drw_x, INT16 drw_y,
CARD16 drw_w, CARD16 drw_h,
XvImagePtr format,
@@ -1636,10 +1629,10 @@ KdXVPutImage(
WinBox.y1 = pDraw->y + drw_y;
WinBox.x2 = WinBox.x1 + drw_w;
WinBox.y2 = WinBox.y1 + drw_h;
-
+
REGION_INIT(pScreen, &WinRegion, &WinBox, 1);
REGION_INIT(pScreen, &ClipRegion, NullBox, 1);
- REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
+ REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip);
if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
RegionRec VPReg;
@@ -1651,7 +1644,7 @@ KdXVPutImage(
VPBox.y2 = pScreen->height;
REGION_INIT(pScreen, &VPReg, &VPBox, 1);
- REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
+ REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg);
REGION_UNINIT(pScreen, &VPReg);
}
@@ -1667,7 +1660,7 @@ KdXVPutImage(
if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
BoxPtr clipBox = REGION_RECTS(&ClipRegion);
if( (REGION_NUM_RECTS(&ClipRegion) != 1) ||
- (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
+ (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
(clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
{
clippedAway = TRUE;
@@ -1712,19 +1705,19 @@ PUT_IMAGE_BAILOUT:
}
-static int
+static int
KdXVQueryImageAttributes(
- ClientPtr client,
+ ClientPtr client,
XvPortPtr pPort,
- XvImagePtr format,
- CARD16 *width,
- CARD16 *height,
+ XvImagePtr format,
+ CARD16 *width,
+ CARD16 *height,
int *pitches,
int *offsets
){
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
- return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->screen,
+ return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->screen,
format->id, width, height, pitches, offsets);
}
@@ -1878,7 +1871,7 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
xRectangle *rects, *r;
BoxPtr pBox = REGION_RECTS (pRgn);
int nBox = REGION_NUM_RECTS (pRgn);
-
+
rects = xalloc (nBox * sizeof (xRectangle));
if (!rects)
goto bail0;
@@ -1892,18 +1885,18 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
r++;
pBox++;
}
-
+
pGC = GetScratchGC (pDraw->depth, pDraw->pScreen);
if (!pGC)
goto bail1;
-
+
val[0] = fg;
val[1] = IncludeInferiors;
ChangeGC (pGC, GCForeground|GCSubwindowMode, val);
-
+
ValidateGC (pDraw, pGC);
-
- (*pGC->ops->PolyFillRect) (pDraw, pGC,
+
+ (*pGC->ops->PolyFillRect) (pDraw, pGC,
REGION_NUM_RECTS (pRgn), rects);
FreeScratchGC (pGC);