Created
April 18, 2015 22:51
-
-
Save tsutsui/f2661d3550c6323a13f1 to your computer and use it in GitHub Desktop.
simplified diff on migrating NetBSD/x68k server from xfree to xorg to check Xserver API changes between X11R6 and X11R7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /usr/xsrc/xfree/xc/programs/Xserver/hw/netbsd/x68k/x68k.h 2011-05-20 14:12:42.000000000 +0900 | |
+++ /usr/xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68k.h 2014-02-23 14:00:26.000000000 +0900 | |
@@ -124,11 +124,13 @@ | |
#define X68K_KB_ASCII 1 /* ascii map keyboard */ | |
#define MAXEVENTS 32 | |
-#define TVTOMILLI(tv) (((tv).tv_usec/1000)+((tv).tv_sec*1000)) | |
-#define GetScreenPrivate(s) ((X68kScreenRec *) \ | |
- ((s)->devPrivates[x68kScreenIndex].ptr)) | |
-#define SetupScreen(s) X68kScreenRec *pPriv = GetScreenPrivate(s) | |
+extern DevPrivateKeyRec x68kScreenPrivateKeyRec; | |
+#define x68kScreenPrivateKey (&x68kScreenPrivateKeyRec) | |
+#define x68kSetScreenPrivate(pScreen, v) \ | |
+ dixSetPrivate(&(pScreen)->devPrivates, x68kScreenPrivateKey, (v)) | |
+#define x68kGetScreenPrivate(pScreen) ((X68kScreenRec *) \ | |
+ dixLookupPrivate(&(pScreen)->devPrivates, x68kScreenPrivateKey)) | |
/* in x68kConfig.c */ | |
X68kScreenRec *x68kGetScreenRec(int); | |
@@ -136,20 +138,21 @@ | |
X68kFbProcRec *x68kGetFbProcRec(int index); | |
void x68kRegisterPixmapFormats(ScreenInfo *); | |
int x68kConfig(void); | |
-extern char *configFilename; | |
+extern const char *configFilename; | |
/* x68kFB.c */ | |
-Bool x68kFbCommonOpen(X68kScreenRec *, char *); | |
+Bool x68kFbCommonOpen(X68kScreenRec *, const char *); | |
void x68kFbCommonClose(X68kScreenRec *); | |
-Bool x68kSaveScreen(ScreenPtr, Bool); | |
+Bool x68kSaveScreen(ScreenPtr, int); | |
-extern int x68kScreenIndex; | |
-extern int x68kGeneration; | |
/* x68kGraph.c */ | |
Bool x68kGraphOpen(X68kScreenRec *); | |
Bool x68kGraphInit(int, ScreenPtr, int, char *[]); | |
void x68kGraphClose(X68kScreenRec *); | |
/* in x68kInit.c */ | |
extern EventList *x68kEvents; | |
/* in x68kIo.c */ | |
void x68kSigIOHandler(int); | |
@@ -158,12 +161,14 @@ | |
Firm_event *x68kMouseGetEvents(int, int *, Bool *); | |
void x68kMouseEnqueueEvent(DeviceIntPtr, Firm_event *); | |
extern miPointerScreenFuncRec x68kPointerScreenFuncs; | |
+extern DeviceIntPtr x68kPointerDevice; | |
/* in x68kKbd.c */ | |
int x68kKbdProc(DeviceIntPtr, int); | |
Firm_event *x68kKbdGetEvents(int, int *, Bool *); | |
void x68kKbdEnqueueEvent(DeviceIntPtr, Firm_event *); | |
extern X68kKbdPriv x68kKbdPriv; | |
+extern DeviceIntPtr x68kKeyboardDevice; | |
/* in x68kKeyMap.c */ | |
extern KeySymsRec jisKeySyms, asciiKeySyms, *x68kKeySyms; | |
--- /usr/xsrc/xfree/xc/programs/Xserver/hw/netbsd/x68k/x68kFb.c 2011-05-20 14:12:42.000000000 +0900 | |
+++ /usr/xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kFb.c 2014-02-23 14:00:44.000000000 +0900 | |
@@ -33,8 +33,7 @@ | |
static void x68kRegSetup(X68kScreenRec *pPriv); | |
-int x68kScreenIndex; | |
-int x68kGeneration; | |
+DevPrivateKeyRec x68kScreenPrivateKeyRec; | |
/*------------------------------------------------------------------------- | |
* function "x68kFbCommonOpen" | |
@@ -154,13 +156,14 @@ | |
* function "x68kSaveScreen" [ screen function ] | |
* | |
* purpose: activate/deactivate screen saver | |
- * argument: (ScreenPtr)pScreen : target screen to save | |
- * (Bool)on : on/off | |
+ * argument: (ScreenPtr)ipScreen : target screen to save | |
+ * (int)mode : on/off | |
* returns: nothing | |
*-----------------------------------------------------------------------*/ | |
Bool | |
-x68kSaveScreen(ScreenPtr pScreen, Bool on) | |
+x68kSaveScreen(ScreenPtr pScreen, int on) | |
{ | |
- SetupScreen(pScreen); | |
+ X68kScreenRec *pPriv = x68kGetScreenPrivate(pScreen); | |
static int status = FALSE; | |
static u_short r2; | |
--- /usr/xsrc/xfree/xc/programs/Xserver/hw/netbsd/x68k/x68kGraph.c 2011-05-20 14:12:42.000000000 +0900 | |
+++ /usr/xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kGraph.c 2014-02-23 17:44:25.000000000 +0900 | |
@@ -115,16 +115,10 @@ | |
*/ | |
#include "x68k.h" | |
-/* cfb */ | |
-#define PSZ 16 | |
-#include "cfb.h" | |
#include "mi.h" | |
+#include "micmap.h" | |
-/* in x68kConfig.c */ | |
-X68kScreenRec *x68kGetScreenRecByType(int type); | |
- | |
-/* in x68kFb.c */ | |
-Bool x68kSaveScreen(ScreenPtr pScreen, Bool on); | |
+#include "fb.h" | |
/* local functions */ | |
static Bool x68kCfbFinishScreenInit(ScreenPtr pScreen, pointer pbits, | |
@@ -203,19 +200,17 @@ | |
pPriv = x68kGetScreenRecByType(X68K_FB_GRAPHIC); | |
/* store private record into screen */ | |
- if ( x68kGeneration != serverGeneration ) { | |
- if ( (x68kScreenIndex = AllocateScreenPrivateIndex()) < 0 ) { | |
- Error("AllocateScreenPrivateIndex failed" ); | |
- return FALSE; | |
- } | |
- x68kGeneration = serverGeneration; | |
+ if (!dixRegisterPrivateKey(&x68kScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) { | |
+ Error("dixRegisterPrivateKey failed"); | |
+ return FALSE; | |
} | |
- pScreen->devPrivates[x68kScreenIndex].ptr = (pointer)pPriv; | |
+ x68kSetScreenPrivate(pScreen, pPriv); | |
/* register normal cfb screen functions */ | |
- if (!cfbSetupScreen(pScreen, pPriv->fb, | |
- pPriv->scr_width, pPriv->scr_height, | |
- pPriv->dpi, pPriv->dpi, pPriv->fb_width)) | |
+ if (!fbSetupScreen(pScreen, pPriv->fb, | |
+ pPriv->scr_width, pPriv->scr_height, | |
+ pPriv->dpi, pPriv->dpi, pPriv->fb_width, | |
+ pPriv->depth)) | |
return FALSE; | |
/* register colormap functions */ | |
@@ -235,7 +230,7 @@ | |
pScreen->whitePixel = 1; | |
pScreen->blackPixel = 0; | |
- if ( !cfbCreateDefColormap(pScreen) ) | |
+ if ( !miCreateDefColormap(pScreen) ) | |
return FALSE; | |
return TRUE; | |
@@ -253,15 +248,15 @@ | |
* returns: (Bool) : TRUE if succeeded | |
* FALSE otherwise | |
*-----------------------------------------------------------------------*/ | |
static Bool | |
x68kCfbFinishScreenInit( | |
ScreenPtr pScreen, | |
pointer pbits, | |
int xsize, int ysize, | |
int dpix, int dpiy, | |
int width) | |
{ | |
- SetupScreen(pScreen); | |
- pointer oldDevPrivate; | |
+ X68kScreenRec *pPriv = x68kGetScreenPrivate(pScreen); | |
VisualPtr visuals; | |
int nvisuals; | |
DepthPtr depths; | |
@@ -334,25 +329,19 @@ | |
defaultVisual = *vid; | |
} | |
/* for other modes ( supports all visuals ) */ | |
- else if (!cfbInitVisuals(&visuals, &depths, &nvisuals, &ndepths, | |
- &rootdepth, &defaultVisual, 1 << (16 - 1), 5)) | |
+ else if (!miInitVisuals(&visuals, &depths, &nvisuals, &ndepths, | |
+ &rootdepth, &defaultVisual, 1 << (16 - 1), | |
+ 5, PseudoColor)) | |
return FALSE; | |
- oldDevPrivate = pScreen->devPrivate; | |
if (!miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width, | |
rootdepth, ndepths, depths, | |
defaultVisual, nvisuals, visuals)) | |
return FALSE; | |
- pScreen->CloseScreen = cfb16CloseScreen; | |
+ pScreen->CloseScreen = fbCloseScreen; | |
pScreen->SaveScreen = x68kSaveScreen; | |
miInitializeBackingStore (pScreen); | |
-#if 0 /* XXX FORCE_SEPARATE_PRIVATE */ | |
- pScreen->CreateScreenResources = cfb16CreateScreenResources; | |
- pScreen->devPrivates[cfb16ScreenPrivateIndex].ptr = | |
- pScreen->devPrivate; | |
- pScreen->devPrivate = oldDevPrivate; | |
-#endif | |
return TRUE; | |
} | |
@@ -364,9 +353,10 @@ | |
* argument: (ColormapPtr)cmap : colormap to install | |
* returns: nothing | |
*-----------------------------------------------------------------------*/ | |
static void | |
x68kInstallColormap(ColormapPtr cmap) | |
{ | |
- SetupScreen(cmap->pScreen); | |
+ X68kScreenRec *pPriv = x68kGetScreenPrivate(cmap->pScreen); | |
register int i; | |
register Entry *pent; | |
register VisualPtr pVisual = cmap->pVisual; | |
@@ -422,9 +412,10 @@ | |
* argument: (ColormapPtr)cmap : colormap to uninstall | |
* returns: nothing | |
*-----------------------------------------------------------------------*/ | |
static void | |
x68kUninstallColormap(ColormapPtr cmap) | |
{ | |
- SetupScreen(cmap->pScreen); | |
+ X68kScreenRec *pPriv = x68kGetScreenPrivate(cmap->pScreen); | |
if (cmap == pPriv->installedMap) { | |
Colormap defMapID = cmap->pScreen->defColormap; | |
@@ -446,9 +437,10 @@ | |
* (Colormap *)pCmapList : colormap list got | |
* returns: (int) | |
*-----------------------------------------------------------------------*/ | |
static int | |
x68kListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapList) | |
{ | |
- SetupScreen(pScreen); | |
+ X68kScreenRec *pPriv = x68kGetScreenPrivate(pScreen); | |
*pCmapList = pPriv->installedMap->mid; | |
return 1; | |
} | |
@@ -462,9 +454,10 @@ | |
* (xColorItem *)pdefs : items | |
* returns: nothing | |
*-----------------------------------------------------------------------*/ | |
static void | |
x68kStoreColors(ColormapPtr pmap, int ndef, xColorItem *pdefs) | |
{ | |
- SetupScreen(pmap->pScreen); | |
+ X68kScreenRec *pPriv = x68kGetScreenPrivate(pmap->pScreen); | |
u_char rmap[256], gmap[256], bmap[256]; | |
xColorItem expanddefs[256]; | |
register int i; | |
@@ -472,7 +465,7 @@ | |
if (pPriv->installedMap != NULL && pPriv->installedMap != pmap) | |
return; | |
if ((pmap->pVisual->class | DynamicClass) == DirectColor) { | |
- ndef = cfbExpandDirectColors(pmap, ndef, pdefs, expanddefs); | |
+ ndef = fbExpandDirectColors(pmap, ndef, pdefs, expanddefs); | |
pdefs = expanddefs; | |
} | |
while (ndef--) { | |
@@ -495,10 +488,11 @@ | |
* (u_char *)[rgb]map: each map | |
* returns: nothing | |
*-----------------------------------------------------------------------*/ | |
static void | |
x68kUpdateColormap(ScreenPtr pScreen, int dex, int count, | |
u_char *rmap, u_char *gmap, u_char *bmap) | |
{ | |
- SetupScreen(pScreen); | |
+ X68kScreenRec *pPriv = x68kGetScreenPrivate(pScreen); | |
volatile u_short *pal = pPriv->reg->gpal; | |
for( ; count > 0; count--,dex++ ) { | |
--- /usr/xsrc/xfree/xc/programs/Xserver/hw/netbsd/x68k/x68kInit.c 2011-05-20 14:12:42.000000000 +0900 | |
+++ /usr/xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kInit.c 2014-02-23 13:27:03.000000000 +0900 | |
@@ -77,21 +77,12 @@ | |
#include "x68k.h" | |
#include "mi.h" | |
-static int nscreens; | |
+EventList *x68kEvents = NULL; | |
+ | |
+static int nscreens; | |
-void OsVendorInit ( | |
-#if NeedFunctionPrototypes | |
- void | |
-#endif | |
-) | |
-{ | |
-} | |
- | |
-void OsVendorPreInit( | |
-#if NeedFunctionPrototypes | |
- void | |
-#endif | |
-) | |
+void | |
+OsVendorInit(void) | |
{ | |
} | |
@@ -140,24 +130,25 @@ | |
* argument: (int)argc, (char *)argv : standard arguments | |
* returns: nothing | |
*-----------------------------------------------------------------------*/ | |
void | |
InitInput(int argc, char *argv[]) | |
{ | |
- DeviceIntPtr p, k; | |
+ x68kPointerDevice = AddInputDevice(serverClient, x68kMouseProc, TRUE); | |
+ x68kKeyboardDevice = AddInputDevice(serverClient, x68kKbdProc, TRUE); | |
+ GetEventList(&x68kEvents); | |
- p = AddInputDevice(x68kMouseProc, TRUE); | |
- k = AddInputDevice(x68kKbdProc, TRUE); | |
- if (!p || !k) | |
- FatalError("AddInputDevice failed\n"); | |
- RegisterPointerDevice(p); | |
- RegisterKeyboardDevice(k); | |
- miRegisterPointerDevice(screenInfo.screens[0], p); | |
- if ( !mieqInit((DevicePtr)k, (DevicePtr)p) ) | |
+ if ( !mieqInit() ) | |
FatalError("mieqInit failed\n"); | |
/* setup SIGIO handler for asynchronous event handling */ | |
(void)OsSignal(SIGIO, x68kSigIOHandler); | |
} | |
+void | |
+CloseInput(void) | |
+{ | |
+} | |
+ | |
/*------------------------------------------------------------------------- | |
* function "AbortDDX" [ called by OS ] | |
* | |
@@ -222,40 +216,16 @@ | |
{ | |
ErrorF("\nX68k dependent options\n"); | |
ErrorF("-x68kconfig filename specify configuration file\n"); | |
} | |
- | |
-#ifdef DPMSExtension | |
-/************************************************************** | |
- * DPMSSet(), DPMSGet(), DPMSSupported() | |
- * | |
- * stubs | |
- * | |
- ***************************************************************/ | |
-#include <Xext/dpmsproc.h> | |
- | |
-void DPMSSet (level) | |
- int level; | |
-{ | |
-} | |
- | |
-int DPMSGet (level) | |
- int* level; | |
-{ | |
- return -1; | |
-} | |
- | |
-Bool DPMSSupported () | |
-{ | |
- return FALSE; | |
-#endif | |
-} | |
- | |
void | |
OsVendorFatalError(void) | |
{ | |
} | |
/* EOF x68kInit.c */ | |
--- /usr/xsrc/xfree/xc/programs/Xserver/hw/netbsd/x68k/x68kIo.c 2011-05-20 14:12:42.000000000 +0900 | |
+++ /usr/xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kIo.c 2014-02-23 13:29:45.000000000 +0900 | |
@@ -108,10 +108,10 @@ | |
* Events are passed to the DIX layer. | |
* | |
*-----------------------------------------------------------------*/ | |
void | |
ProcessInputEvents(void) | |
{ | |
(void) mieqProcessInputEvents (); | |
- miPointerUpdate (); | |
} | |
/*-------------------------------------------------------------------- | |
@@ -135,8 +136,8 @@ | |
X68kKbdPrivPtr kbdPriv; | |
X68kMousePrivPtr ptrPriv; | |
- pPointer = (DeviceIntPtr)LookupPointerDevice(); | |
- pKeyboard = (DeviceIntPtr)LookupKeyboardDevice(); | |
+ pPointer = x68kPointerDevice; | |
+ pKeyboard = x68kKeyboardDevice; | |
ptrPriv = (X68kMousePrivPtr) pPointer->public.devicePrivate; | |
kbdPriv = (X68kKbdPrivPtr) pKeyboard->public.devicePrivate; | |
if (!pPointer->public.on || !pKeyboard->public.on) | |
--- /usr/xsrc/xfree/xc/programs/Xserver/hw/netbsd/x68k/x68kKbd.c 2011-05-20 14:12:42.000000000 +0900 | |
+++ /usr/xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kKbd.c 2014-02-23 17:45:48.000000000 +0900 | |
@@ -73,21 +73,29 @@ | |
#include "x68k.h" | |
#include "mi.h" | |
-#ifdef XKB | |
+#include <X11/X.h> | |
+#include <X11/Xproto.h> | |
+#include <X11/keysym.h> | |
+#include "screenint.h" | |
+#include "inputstr.h" | |
+#include "misc.h" | |
+#include "scrnintstr.h" | |
+#include "servermd.h" | |
+ | |
#include <X11/extensions/XKB.h> | |
-#include <X11/extensions/XKBstr.h> | |
-#include <X11/extensions/XKBsrv.h> | |
-#endif | |
+#include "xkbsrv.h" | |
#define MIN_KEYCODE 7 /* necessary to avoid the mouse buttons */ | |
#define MAX_KEYCODE 255 /* limited by the protocol */ | |
X68kKbdPriv x68kKbdPriv; | |
+DeviceIntPtr x68kKeyboardDevice = NULL; | |
static void x68kInitModMap(KeySymsRec *, CARD8 *); | |
-#ifdef XKB | |
-static void x68kInitKbdNames(XkbComponentNamesRec *, X68kKbdPrivPtr); | |
+static void x68kInitKbdNames(XkbRMLVOSet *, X68kKbdPrivPtr); | |
-#endif | |
+static void x68kKbdRingBell(DeviceIntPtr, int, int); | |
static void x68kKbdBell(int, DeviceIntPtr, pointer, int); | |
static void x68kKbdCtrl(DeviceIntPtr, KeybdCtrl *); | |
static void x68kSetLeds(X68kKbdPrivPtr, u_char); | |
@@ -100,12 +108,16 @@ | |
* None. | |
* | |
*----------------------------------------------------------------------*/ | |
int | |
x68kKbdProc(DeviceIntPtr pDev, /* Keyboard to manipulate */ | |
int what) /* What to do to it */ | |
{ | |
DevicePtr pKeyboard = &pDev->public; | |
CARD8 x68kModMap[MAP_LENGTH]; | |
int mode; | |
+ XkbRMLVOSet rmlvo; | |
switch (what) { | |
case DEVICE_INIT: | |
@@ -116,20 +128,16 @@ | |
} | |
pKeyboard->on = FALSE; | |
x68kInitModMap(x68kKeySyms, x68kModMap); | |
-#ifdef XKB | |
- if (noXkbExtension) { | |
-#endif | |
- InitKeyboardDeviceStruct(pKeyboard, x68kKeySyms, x68kModMap, | |
- x68kKbdBell, x68kKbdCtrl); | |
-#ifdef XKB | |
- } else { | |
- XkbComponentNamesRec names; | |
- x68kInitKbdNames(&names, pKeyboard->devicePrivate); | |
- XkbInitKeyboardDeviceStruct((DeviceIntPtr)pKeyboard, &names, | |
- x68kKeySyms, x68kModMap, | |
- x68kKbdBell, x68kKbdCtrl); | |
- } | |
-#endif | |
+ x68kInitKbdNames(&rmlvo, pKeyboard->devicePrivate); | |
+#if 0 /* XXX needs more work for Xorg xkb */ | |
+ InitKeyboardDeviceStruct(pDev, rmlvo, | |
+ x68kKbdBell, x68kKbdCtrl); | |
+#else | |
+ InitKeyboardDeviceStruct(pDev, NULL, | |
+ x68kKbdBell, x68kKbdCtrl); | |
+ XkbApplyMappingChange(pDev, x68kKeySyms, | |
+ x68kKeySyms->minKeyCode, | |
+ x68kKeySyms->maxKeyCode - x68kKeySyms->minKeyCode + 1, | |
+ x68kModMap, serverClient); | |
+#endif | |
break; | |
case DEVICE_ON: | |
@@ -204,7 +213,7 @@ | |
} | |
} | |
+#if 0 /* XXX needs more work for Xorg xkb */ | |
/*------------------------------------------------------------------------- | |
* function "x68kInitKbdNames" | |
* | |
@@ -273,16 +284,19 @@ | |
* | |
*----------------------------------------------------------------------- | |
*/ | |
void | |
x68kKbdEnqueueEvent(DeviceIntPtr pDev, Firm_event *fe) | |
{ | |
- xEvent xE; | |
BYTE keycode; | |
+ int type; | |
+ int i, nevents; | |
+ GetEventList(&x68kEvents); | |
+ type = ((fe->value == VKEY_UP) ? KeyRelease : KeyPress); | |
keycode = (fe->id & 0x7f) + MIN_KEYCODE; | |
- xE.u.keyButtonPointer.time = TVTOMILLI(fe->time); | |
- xE.u.u.type = ((fe->value == VKEY_UP) ? KeyRelease : KeyPress); | |
- xE.u.u.detail = keycode; | |
- mieqEnqueue (&xE); | |
+ nevents = GetKeyboardEvents(x68kEvents, pDev, type, keycode); | |
+ for (i = 0; i < nevents; i++) | |
+ mieqEnqueue(pDev, (InternalEvent*)(x68kEvents + i)->event); | |
} | |
/*- | |
@@ -300,14 +314,13 @@ | |
*----------------------------------------------------------------------- | |
*/ | |
-static void x68kKbdBell(int percent, DeviceIntPtr device, | |
- pointer ctrl, int unused ) | |
+static void | |
+x68kKbdRingBell(DeviceIntPtr pDev, int volume, int duration) | |
{ | |
int kbdCmd; /* Command to give keyboard */ | |
- KeybdCtrl* kctrl = (KeybdCtrl*) ctrl; | |
- X68kKbdPrivPtr pPriv = (X68kKbdPrivPtr)device->public.devicePrivate; | |
+ X68kKbdPrivPtr pPriv = (X68kKbdPrivPtr)pDev->public.devicePrivate; | |
- if (percent == 0 || kctrl->bell == 0) | |
+ if (volume == 0) | |
return; | |
kbdCmd = KBD_CMD_BELL; | |
@@ -315,12 +328,33 @@ | |
Error("Failed to activate bell"); | |
return; | |
} | |
- usleep (kctrl->bell_duration * 1000); | |
+ usleep (duration * 1000); | |
kbdCmd = KBD_CMD_NOBELL; | |
if (ioctl (pPriv->fd, KIOCCMD, &kbdCmd) == -1) | |
Error ("Failed to deactivate bell"); | |
} | |
+static void | |
+x68kKbdBell(int volume, DeviceIntPtr pDev, pointer ctrl, int unused) | |
+{ | |
+ KeybdCtrl* kctrl = (KeybdCtrl*) ctrl; | |
+ | |
+ if (kctrl->bell == 0) | |
+ return; | |
+ | |
+ x68kKbdRingBell(pDev, volume, kctrl->bell_duration); | |
+} | |
+ | |
+void | |
+DDXRingBell(int volume, int pitch, int duration) | |
+{ | |
+ DeviceIntPtr pKeyboard; | |
+ | |
+ pKeyboard = x68kKeyboardDevice; | |
+ if (pKeyboard != NULL) | |
+ x68kKbdRingBell(pKeyboard, volume, duration); | |
+} | |
+ | |
/*- | |
*----------------------------------------------------------------------- | |
* x68kKbdCtrl -- | |
--- /usr/xsrc/xfree/xc/programs/Xserver/hw/netbsd/x68k/x68kMouse.c 2011-05-20 14:12:42.000000000 +0900 | |
+++ /usr/xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c 2014-02-23 17:48:45.000000000 +0900 | |
@@ -83,18 +83,28 @@ | |
#include "x68k.h" | |
#include "mi.h" | |
+#include "input.h" | |
+#include "inpututils.h" | |
+ | |
+#include "exevents.h" | |
+#include <X11/Xatom.h> | |
+#include "xserver-properties.h" | |
static Bool x68kCursorOffScreen(ScreenPtr *, int *, int *); | |
-static void x68kCrossScreen(ScreenPtr, Bool); | |
-static void x68kWarpCursor(ScreenPtr, int, int); | |
+static void x68kCrossScreen(ScreenPtr, int); | |
+static void x68kWarpCursor(DeviceIntPtr, ScreenPtr, int, int); | |
static void x68kMouseCtrl(DeviceIntPtr, PtrCtrl*); | |
miPointerScreenFuncRec x68kPointerScreenFuncs = { | |
x68kCursorOffScreen, | |
x68kCrossScreen, | |
x68kWarpCursor, | |
+ NULL, | |
+ NULL | |
}; | |
+DeviceIntPtr x68kPointerDevice = NULL; | |
+ | |
static X68kMousePriv x68kMousePriv; | |
/*- | |
@@ -108,27 +118,36 @@ | |
* Side Effects: | |
*----------------------------------------------------------------------- | |
*/ | |
int | |
x68kMouseProc(DeviceIntPtr device, int what) | |
{ | |
DevicePtr pMouse = &device->public; | |
int format; | |
static int oformat; | |
BYTE map[4]; | |
+ Atom btn_labels[3] = {0}; | |
+ Atom axes_labels[2] = { 0, 0 }; | |
switch (what) { | |
case DEVICE_INIT: | |
pMouse->devicePrivate = (pointer) &x68kMousePriv; | |
if( (x68kMousePriv.fd = open("/dev/mouse", O_RDONLY)) == -1 ) { | |
Error("Can't open mouse device"); | |
return !Success; | |
} | |
pMouse->on = FALSE; | |
map[1] = 1; | |
map[2] = 2; | |
map[3] = 3; | |
- InitPointerDeviceStruct( | |
- pMouse, map, 3, miPointerGetMotionEvents, | |
- x68kMouseCtrl, miPointerGetMotionBufferSize()); | |
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); | |
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); | |
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); | |
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); | |
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); | |
+ | |
+ InitPointerDeviceStruct(pMouse, map, 3, btn_labels, | |
+ x68kMouseCtrl, GetMotionHistorySize(), | |
+ 2, axes_labels); | |
break; | |
case DEVICE_ON: | |
@@ -221,38 +242,6 @@ | |
return evBuf; | |
} | |
- | |
-/*- | |
- *----------------------------------------------------------------------- | |
- * MouseAccelerate -- | |
- * Given a delta and a mouse, return the acceleration of the delta. | |
- * | |
- * Results: | |
- * The corrected delta | |
- * | |
- * Side Effects: | |
- * None. | |
- * | |
- *----------------------------------------------------------------------- | |
- */ | |
-static short MouseAccelerate (DeviceIntPtr device, int delta) | |
-{ | |
- int sgn = sign(delta); | |
- PtrCtrl *pCtrl; | |
- short ret; | |
- | |
- delta = abs(delta); | |
- pCtrl = &device->ptrfeed->ctrl; | |
- if (delta > pCtrl->threshold) { | |
- ret = (short) sgn * | |
- (pCtrl->threshold + ((delta - pCtrl->threshold) * pCtrl->num) | |
- / pCtrl->den); | |
- } else { | |
- ret = (short) sgn * delta; | |
- } | |
- return ret; | |
-} | |
- | |
/*- | |
*----------------------------------------------------------------------- | |
* x68kMouseEnqueueEvent -- | |
@@ -268,18 +257,19 @@ | |
*----------------------------------------------------------------------- | |
*/ | |
void | |
x68kMouseEnqueueEvent(DeviceIntPtr device, Firm_event *fe) | |
{ | |
- xEvent xE; | |
X68kMousePrivPtr pPriv; /* Private data for pointer */ | |
int bmask; /* Temporary button mask */ | |
- time_t etime; | |
- int x, y; | |
+ int type, buttons, flag; | |
+ int i, nevents, valuators[2]; | |
+ ValuatorMask mask; | |
+ | |
+ GetEventList(&x68kEvents); | |
pPriv = (X68kMousePrivPtr)device->public.devicePrivate; | |
- etime = xE.u.keyButtonPointer.time = TVTOMILLI(fe->time); | |
- | |
switch (fe->id) { | |
case MS_LEFT: | |
case MS_MIDDLE: | |
@@ -291,27 +281,39 @@ | |
* | |
* Mouse buttons start at 1. | |
*/ | |
- xE.u.u.detail = (fe->id - MS_LEFT) + 1; | |
- bmask = 1 << xE.u.u.detail; | |
+ buttons = (fe->id - MS_LEFT) + 1; | |
+ bmask = 1 << buttons; | |
if (fe->value == VKEY_UP) { | |
if (pPriv->bmask & bmask) { | |
- xE.u.u.type = ButtonRelease; | |
+ type = ButtonRelease; | |
pPriv->bmask &= ~bmask; | |
} else { | |
return; | |
} | |
} else { | |
if ((pPriv->bmask & bmask) == 0) { | |
- xE.u.u.type = ButtonPress; | |
+ type = ButtonPress; | |
pPriv->bmask |= bmask; | |
} else { | |
return; | |
} | |
} | |
- mieqEnqueue (&xE); | |
+ flag = POINTER_RELATIVE; | |
+ valuator_mask_set_range(&mask, 0, 0, NULL); | |
+ nevents = GetPointerEvents(x68kEvents, device, | |
+ type, buttons, flag, &mask); | |
+ for (i = 0; i < nevents; i++) | |
+ mieqEnqueue(device, (InternalEvent*)(x68kEvents + i)->event); | |
break; | |
case LOC_X_DELTA: | |
- miPointerDeltaCursor (MouseAccelerate(device,fe->value),0,etime); | |
+ valuators[0] = fe->value; | |
+ valuators[1] = 0; | |
+ valuator_mask_set_range(&mask, 0, 2, valuators); | |
+ flag = POINTER_RELATIVE | POINTER_ACCELERATE; | |
+ nevents = GetPointerEvents(x68kEvents, device, | |
+ MotionNotify, 0, flag, &mask); | |
+ for (i = 0; i < nevents; i++) | |
+ mieqEnqueue(device, (InternalEvent*)(x68kEvents + i)->event); | |
break; | |
case LOC_Y_DELTA: | |
/* | |
@@ -319,40 +321,45 @@ | |
* and motion down a negative delta, so we must subtract | |
* here instead of add... | |
*/ | |
- miPointerDeltaCursor (0,-MouseAccelerate(device,fe->value),etime); | |
+ valuators[0] = 0; | |
+ valuators[1] = -fe->value; | |
+ valuator_mask_set_range(&mask, 0, 2, valuators); | |
+ flag = POINTER_RELATIVE | POINTER_ACCELERATE; | |
+ nevents = GetPointerEvents(x68kEvents, device, | |
+ MotionNotify, 0, flag, &mask); | |
+ for (i = 0; i < nevents; i++) | |
+ mieqEnqueue(device, (InternalEvent*)(x68kEvents + i)->event); | |
break; | |
case LOC_X_ABSOLUTE: | |
- miPointerPosition (&x, &y); | |
- miPointerAbsoluteCursor (fe->value, y, etime); | |
- break; | |
case LOC_Y_ABSOLUTE: | |
- miPointerPosition (&x, &y); | |
- miPointerAbsoluteCursor (x, fe->value, etime); | |
- break; | |
+ /* XXX not sure how to get current X and Y position */ | |
default: | |
- FatalError ("sunMouseEnqueueEvent: unrecognized id\n"); | |
+ FatalError ("%s: unrecognized id\n", __func__); | |
break; | |
} | |
} | |
/*ARGSUSED*/ | |
static Bool | |
x68kCursorOffScreen(ScreenPtr *pScreen, int *x, int *y) | |
{ | |
return FALSE; | |
} | |
static void | |
x68kCrossScreen(ScreenPtr pScreen, int entering) | |
{ | |
} | |
static void | |
x68kWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) | |
{ | |
sigset_t newsigmask; | |
(void) sigemptyset (&newsigmask); | |
(void) sigaddset (&newsigmask, SIGIO); | |
(void) sigprocmask (SIG_BLOCK, &newsigmask, (sigset_t *)NULL); | |
- miPointerWarpCursor (pScreen, x, y); | |
+ miPointerWarpCursor (pDev, pScreen, x, y); | |
(void) sigprocmask (SIG_UNBLOCK, &newsigmask, (sigset_t *)NULL); | |
} | |
--- /usr/xsrc/xfree/xc/programs/Xserver/hw/netbsd/x68k/x68kText.c 2011-05-20 14:12:42.000000000 +0900 | |
+++ /usr/xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kText.c 2014-02-23 13:29:06.000000000 +0900 | |
@@ -30,13 +30,9 @@ | |
*-----------------------------------------------------------------------*/ | |
#include "x68k.h" | |
-#include <mfb.h> | |
+#include "mi.h" | |
+#include "micmap.h" | |
+#include "fb.h" | |
/*------------------------------------------------------------------------- | |
* function "x68kTextOpen" [ X68kFBProc function ] | |
@@ -97,31 +95,29 @@ | |
* returns: (Bool) TRUE if succeeded | |
* FALSE otherwise | |
*-----------------------------------------------------------------------*/ | |
Bool | |
x68kTextInit(int screen, ScreenPtr pScreen, int argc, char *argv[]) | |
{ | |
X68kScreenRec *pPriv; | |
/* get private screen record set by X68KConfig */ | |
pPriv = x68kGetScreenRecByType(X68K_FB_TEXT); | |
- if ( x68kGeneration != serverGeneration ) { | |
- if ( (x68kScreenIndex = AllocateScreenPrivateIndex()) < 0 ) { | |
- Error("AllocateScreenPrivateIndex failed" ); | |
+ if ( !dixRegisterPrivateKey(&x68kScreenPrivateKeyRec, PRIVATE_SCREEN, 0) ) { | |
+ Error("dixRegisterPrivateKey failed"); | |
return FALSE; | |
- } | |
- x68kGeneration = serverGeneration; | |
} | |
- pScreen->devPrivates[x68kScreenIndex].ptr = (pointer)pPriv; | |
+ x68kSetScreenPrivate(pScreen, pPriv); | |
- if ( !mfbScreenInit(pScreen, pPriv->fb, | |
+ if ( !fbScreenInit(pScreen, pPriv->fb, | |
pPriv->scr_width, pPriv->scr_height, | |
- pPriv->dpi, pPriv->dpi, pPriv->fb_width) ) | |
+ pPriv->dpi, pPriv->dpi, pPriv->fb_width, 1) ) | |
return FALSE; | |
pScreen->whitePixel = 1; | |
pScreen->blackPixel = 0; | |
if ( !miDCInitialize(pScreen, &x68kPointerScreenFuncs) ) | |
return FALSE; | |
- if ( !mfbCreateDefColormap(pScreen) ) | |
+ if ( !miCreateDefColormap(pScreen) ) | |
return FALSE; | |
pScreen->SaveScreen = x68kSaveScreen; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment