Commit d6e151ce authored by Keith Packard's avatar Keith Packard
Browse files

Tiny-X: Add mouse matrix to rotate mouse, allow enable to fail, add render

    by default
parent f7421d83
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))
......
......@@ -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
}
/*
......
/*
* $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;
......
......@@ -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);
......
......@@ -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
......@@ -492,6 +497,9 @@ KdReleaseAllKeys (void);
void
KdSetLed (int led, Bool on);
void
KdSetMouseMatrix (KdMouseMatrix *matrix);
void
KdBlockHandler (int screen,
pointer blockData,
......@@ -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);
......
......@@ -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;
......
......@@ -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;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment