diff options
author | Keith Packard <keithp@keithp.com> | 2000-09-15 15:19:00 +0000 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2000-09-15 15:19:00 +0000 |
commit | d6e151ce4deaff506c580da7e3baf055db1c3ae3 (patch) | |
tree | 690e651bb53557252ad393f09855a06d11e211fb | |
parent | f7421d836186cd6dfb919c5a48d556a68d6c5a5d (diff) |
Tiny-X: Add mouse matrix to rotate mouse, allow enable to fail, add render
by default
-rw-r--r-- | hw/kdrive/Imakefile | 18 | ||||
-rw-r--r-- | hw/kdrive/src/kasync.c | 5 | ||||
-rw-r--r-- | hw/kdrive/src/kcurscol.c | 4 | ||||
-rw-r--r-- | hw/kdrive/src/kdrive.c | 19 | ||||
-rw-r--r-- | hw/kdrive/src/kdrive.h | 25 | ||||
-rw-r--r-- | hw/kdrive/src/kinput.c | 22 | ||||
-rw-r--r-- | hw/kdrive/src/kpict.c | 6 |
7 files changed, 73 insertions, 26 deletions
diff --git a/hw/kdrive/Imakefile b/hw/kdrive/Imakefile index 89334b101..f2604f26e 100644 --- a/hw/kdrive/Imakefile +++ b/hw/kdrive/Imakefile @@ -1,16 +1,20 @@ XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $ -XCOMM $XFree86: xc/programs/Xserver/hw/kdrive/Imakefile,v 1.1 1999/11/19 13:53:47 hohndel Exp $ -#include <Server.tmpl> +XCOMM $XFree86: xc/programs/Xserver/hw/kdrive/Imakefile,v 1.3 2000/08/26 00:24:37 keithp Exp $ +KDRIVE=. +#include "Kdrive.tmpl" + +#if BuildRender +RENDERSRCS=kpict.c +RENDEROBJS=kpict.o +#endif SRCS = kcmap.c kcolor.c kdrive.c kinfo.c kinput.c kmap.c knoop.c ktest.c \ - vga.c kasync.c kmode.c kcurscol.c kpict.c + vga.c kasync.c kmode.c kcurscol.c kshadow.c $(RENDERSRCS) OBJS = kcmap.o kcolor.o kdrive.o kinfo.o kinput.o kmap.o knoop.o ktest.o \ - vga.o kasync.o kmode.o kcurscol.o kpict.o + vga.o kasync.o kmode.o kcurscol.o kshadow.o $(RENDEROBJS) -INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ - -I../../fb -I../../mi -I../../render -I../../include -I../../os \ - -I$(EXTINCSRC) -I$(XINCLUDESRC) +INCLUDES = $(KDINCS) NormalLibraryObjectRule() NormalLibraryTarget(kdrive,$(OBJS)) diff --git a/hw/kdrive/src/kasync.c b/hw/kdrive/src/kasync.c index cb848ba4b..660d58247 100644 --- a/hw/kdrive/src/kasync.c +++ b/hw/kdrive/src/kasync.c @@ -21,7 +21,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/kasync.c,v 1.3 2000/01/21 18:41:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/kasync.c,v 1.5 2000/08/26 00:24:37 keithp Exp $ */ #include "kdrive.h" @@ -252,6 +252,9 @@ KdScreenInitAsync (ScreenPtr pScreen) pScreenPriv->BackingStoreFuncs.SaveAreas = KdCheckSaveAreas; pScreenPriv->BackingStoreFuncs.RestoreAreas = KdCheckRestoreAreas; #endif +#ifdef RENDER + KdPictureInitAsync (pScreen); +#endif } /* diff --git a/hw/kdrive/src/kcurscol.c b/hw/kdrive/src/kcurscol.c index 99e330724..54cbc549a 100644 --- a/hw/kdrive/src/kcurscol.c +++ b/hw/kdrive/src/kcurscol.c @@ -1,5 +1,5 @@ /* - * $XFree86$ + * $XFree86: xc/programs/Xserver/hw/kdrive/kcurscol.c,v 1.4 2000/05/11 18:14:13 tsi Exp $ * * Copyright © 1999 Keith Packard * @@ -25,7 +25,7 @@ #include "kdrive.h" #include "cursorstr.h" -static int +int KdComputeCmapShift (unsigned long mask) { int shift; diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index cf99c3863..3b69e4704 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -21,7 +21,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.c,v 1.4 2000/05/06 22:17:39 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.c,v 1.6 2000/08/26 00:24:37 keithp Exp $ */ #include "kdrive.h" #ifdef PSEUDO8 @@ -224,14 +224,15 @@ KdDisableScreens (void) } } -void +Bool KdEnableScreen (ScreenPtr pScreen) { KdScreenPriv (pScreen); if (pScreenPriv->enabled) - return; - (*pScreenPriv->card->cfuncs->enable) (pScreen); + return TRUE; + if (!(*pScreenPriv->card->cfuncs->enable) (pScreen)) + return FALSE; pScreenPriv->enabled = TRUE; pScreenPriv->card->selected = pScreenPriv->screen->mynum; if (!pScreenPriv->screen->softCursor) @@ -632,6 +633,11 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) pScreen->SaveScreen = KdSaveScreen; pScreen->CreateWindow = KdCreateWindow; +#ifdef RENDER + if (!fbPictureInit (pScreen, 0, 0)) + return FALSE; +#endif + #ifdef FB_OLD_SCREEN pScreenPriv->BackingStoreFuncs.SaveAreas = fbSaveAreas; pScreenPriv->BackingStoreFuncs.RestoreAreas = fbSaveAreas; @@ -719,8 +725,6 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) miDCInitialize(pScreen, &kdPointerScreenFuncs); } - if (!KdPictureInit (pScreen, 0, 0)) - return FALSE; if (!fbCreateDefColormap (pScreen)) { @@ -739,7 +743,8 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) if (screen->mynum == card->selected) { (*card->cfuncs->preserve) (card); - (*card->cfuncs->enable) (pScreen); + if (!(*card->cfuncs->enable) (pScreen)) + return FALSE; pScreenPriv->enabled = TRUE; if (!screen->softCursor) (*card->cfuncs->enableCursor) (pScreen); diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h index eca68d819..5c709a2bc 100644 --- a/hw/kdrive/src/kdrive.h +++ b/hw/kdrive/src/kdrive.h @@ -21,7 +21,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.h,v 1.4 2000/02/23 20:29:53 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/kdrive.h,v 1.6 2000/08/26 00:24:38 keithp Exp $ */ #include <stdio.h> #include "X.h" @@ -41,6 +41,7 @@ #include "dix.h" #include "fb.h" #include "fboverlay.h" +#include "shadow.h" extern WindowPtr *WindowTable; @@ -115,7 +116,7 @@ typedef struct _KdCardFuncs { Bool (*scrinit) (KdScreenInfo *);/* initialize screen information */ Bool (*initScreen) (ScreenPtr); /* initialize ScreenRec */ void (*preserve) (KdCardInfo *); /* save graphics card state */ - void (*enable) (ScreenPtr); /* set up for rendering */ + Bool (*enable) (ScreenPtr); /* set up for rendering */ Bool (*dpms) (ScreenPtr, int); /* set DPMS screen saver */ void (*disable) (ScreenPtr); /* turn off rendering */ void (*restore) (KdCardInfo *); /* restore graphics card state */ @@ -210,6 +211,10 @@ typedef struct _KdMonitorTiming { extern const KdMonitorTiming kdMonitorTimings[]; extern const int kdNumMonitorTimings; +typedef struct _KdMouseMatrix { + int matrix[2][3]; +} KdMouseMatrix; + /* * This is the only completely portable way to * compute this info. @@ -397,7 +402,7 @@ KdDisableScreen (ScreenPtr pScreen); void KdDisableScreens (void); -void +Bool KdEnableScreen (ScreenPtr pScreen); void @@ -493,6 +498,9 @@ void KdSetLed (int led, Bool on); void +KdSetMouseMatrix (KdMouseMatrix *matrix); + +void KdBlockHandler (int screen, pointer blockData, pointer timeout, @@ -540,6 +548,17 @@ KdTuneMode (KdScreenInfo *screen, Bool (*supported) (KdScreenInfo *, const KdMonitorTiming *)); +/* kpict.c */ +void +KdPictureInitAsync (ScreenPtr pScreen); + +/* kshadow.c */ +Bool +KdShadowScreenInit (KdScreenInfo *screen); + +Bool +KdShadowInitScreen (ScreenPtr pScreen, ShadowUpdateProc update, ShadowWindowProc window); + /* ktest.c */ Bool KdFrameBufferValid (CARD8 *base, int size); diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 278f3cff4..82bcc747c 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -21,7 +21,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/kdrive/kinput.c,v 1.3 2000/02/23 20:29:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/kinput.c,v 1.5 2000/08/26 00:24:38 keithp Exp $ */ #include "kdrive.h" #include "inputstr.h" @@ -43,6 +43,10 @@ static int kdBellPitch; static int kdBellDuration; static int kdLeds; static Bool kdInputEnabled; +static KdMouseMatrix kdMouseMatrix = { + 1, 0, 0, + 0, 1, 0 +}; int kdMinScanCode; int kdMaxScanCode; @@ -270,6 +274,12 @@ KdSetLed (int led, Bool on) KdSetLeds (); } +void +KdSetMouseMatrix (KdMouseMatrix *matrix) +{ + kdMouseMatrix = *matrix; +} + static void KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl) { @@ -1142,11 +1152,13 @@ KdMouseAccelerate (DeviceIntPtr device, int delta) } void -KdEnqueueMouseEvent(unsigned long flags, int x, int y) +KdEnqueueMouseEvent(unsigned long flags, int rx, int ry) { CARD32 ms; xEvent xE; unsigned char buttons; + int x, y; + int (*matrix)[3] = kdMouseMatrix.matrix; if (!pKdPointer) return; @@ -1155,12 +1167,18 @@ KdEnqueueMouseEvent(unsigned long flags, int x, int y) if (flags & KD_MOUSE_DELTA) { + x = matrix[0][0] * rx + matrix[0][1] * ry; + y = matrix[1][0] * rx + matrix[1][1] * ry; x = KdMouseAccelerate (pKdPointer, x); y = KdMouseAccelerate (pKdPointer, y); xE.u.keyButtonPointer.pad1 = 1; } else + { + x = matrix[0][0] * rx + matrix[0][1] * ry + matrix[0][2]; + y = matrix[1][0] * rx + matrix[1][1] * ry + matrix[1][2]; xE.u.keyButtonPointer.pad1 = 0; + } xE.u.keyButtonPointer.time = ms; xE.u.keyButtonPointer.rootX = x; xE.u.keyButtonPointer.rootY = y; diff --git a/hw/kdrive/src/kpict.c b/hw/kdrive/src/kpict.c index 2c5483efe..c65929cb4 100644 --- a/hw/kdrive/src/kpict.c +++ b/hw/kdrive/src/kpict.c @@ -54,13 +54,11 @@ KdCheckComposite (CARD8 op, height); } -KdPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) +void +KdPictureInitAsync (ScreenPtr pScreen) { PictureScreenPtr ps; - if (!fbPictureInit (pScreen, formats, nformats)) - return FALSE; ps = GetPictureScreen(pScreen); ps->Composite = KdCheckComposite; - return TRUE; } |