diff options
Diffstat (limited to 'xc/programs/Xserver/hw')
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/common/xf86.h | 148 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/common/xf86Events.c | 665 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c | 23 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c | 2 | ||||
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c | 29 |
5 files changed, 400 insertions, 467 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86.h b/xc/programs/Xserver/hw/xfree86/common/xf86.h index bf818fef8..276ff8b91 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.116 1999/08/21 13:48:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.144 2000/11/18 19:37:08 tsi Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -17,14 +17,25 @@ #include "xf86str.h" #include "xf86Opt.h" #include <X11/Xfuncproto.h> +#ifndef IN_MODULE #include <stdarg.h> +#else +#include "xf86_ansic.h" +#endif + +#include "propertyst.h" /* General parameters */ +extern int xf86DoConfigure; +extern Bool xf86DoConfigurePass1; extern int xf86ScreenIndex; /* Index into pScreen.devPrivates */ +extern int xf86CreateRootWindowIndex; /* Index into pScreen.devPrivates */ extern int xf86PixmapIndex; extern Bool xf86ResAccessEnter; extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */ extern const unsigned char byte_reversed[256]; +extern PropertyPtr *xf86RegisteredPropertiesTable; +extern ScrnInfoPtr xf86CurrentScreen; #define XF86SCRNINFO(p) ((ScrnInfoPtr)((p)->devPrivates[xf86ScreenIndex].ptr)) @@ -41,6 +52,11 @@ extern const unsigned char byte_reversed[256]; #define PIX24TOBPP(p) (((p) == Pix24Use24) ? 24 : \ (((p) == Pix24Use32) ? 32 : 0)) +/* variables for debugging */ +extern CARD32 xf86DummyVar1; +extern CARD32 xf86DummyVar2; +extern CARD32 xf86DummyVar3; + /* Function Prototypes */ #ifndef _NO_XF86_PROTOTYPES @@ -58,27 +74,38 @@ pciConfigPtr *xf86GetPciConfigInfo(void); #endif void xf86SetPciVideo(pciVideoPtr, resType); void xf86PrintResList(int verb, resPtr list); +resPtr xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex); int xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); int xf86GetIsaInfoForScreen(int scrnIndex); Bool xf86ParseIsaBusString(const char *busID); void xf86EnableAccess(ScrnInfoPtr pScrn); +void xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn); Bool xf86IsPrimaryPci(pciVideoPtr pPci); Bool xf86IsPrimaryIsa(void); int xf86CheckPciGAType(pciVideoPtr pPci); /* new RAC */ +resPtr xf86AddResToList(resPtr rlist, resRange *Range, int entityIndex); +resPtr xf86JoinResLists(resPtr rlist1, resPtr rlist2); +resPtr xf86DupResList(const resPtr rlist); +void xf86FreeResList(resPtr rlist); void xf86ClaimFixedResources(resList list, int entityIndex); +Bool xf86DriverHasEntities(DriverPtr drvp); void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex); +void xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex, + int instance); +int xf86GetNumEntityInstances(int entityIndex); +GDevPtr xf86GetDevFromEntity(int entityIndex, int instance); void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex); EntityInfoPtr xf86GetEntityInfo(int entityIndex); pciVideoPtr xf86GetPciInfoForEntity(int entityIndex); +int xf86GetPciEntity(int bus, int dev, int func); Bool xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter, EntityProc leave, pointer); void xf86DeallocateResourcesForEntity(int entityIndex, long type); -resPtr xf86RegisterResources(int entityIndex, resList list, int access); +resPtr xf86RegisterResources(int entityIndex, resList list, int Access); Bool xf86CheckPciMemBase(pciVideoPtr pPci, memType base); -void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86AccessPtr p_io, - xf86AccessPtr p_mem, xf86AccessPtr p_io_mem, - xf86AccessPtr *ppAccessOld); +void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs, + xf86SetAccessFuncPtr oldFuncs); Bool xf86IsEntityPrimary(int entityIndex); Bool xf86FixPciResource(int entityIndex, int prt, memType alignment, long type); @@ -92,17 +119,47 @@ resRange xf86GetSparse(long type, memType fixed_bits, memType decode_mask, memType address_mask, resPtr avoid); memType xf86ChkConflict(resRange *rgp, int entityIndex); - +Bool xf86IsPciDevPresent(int bus, int dev, int func); +ScrnInfoPtr xf86FindScreenForEntity(int entityIndex); +Bool xf86NoSharedResources(int screenIndex, resType res); +resPtr xf86FindIntersectOfLists(resPtr l1, resPtr l2); +pciVideoPtr xf86FindPciDeviceVendor(CARD16 vendorID, CARD16 deviceID, + char n, pciVideoPtr pvp_exclude); +pciVideoPtr xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class, + char n, pciVideoPtr pvp_exclude); +void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg); +Bool xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func); +#ifdef async +Bool xf86QueueAsyncEvent(void (*func)(pointer),pointer arg); +#endif + +int xf86GetLastScrnFlag(int entityIndex); +void xf86SetLastScrnFlag(int entityIndex, int scrnIndex); +Bool xf86IsEntityShared(int entityIndex); +void xf86SetEntityShared(int entityIndex); +Bool xf86IsEntitySharable(int entityIndex); +void xf86SetEntitySharable(int entityIndex); +Bool xf86IsPrimInitDone(int entityIndex); +void xf86SetPrimInitDone(int entityIndex); +void xf86ClearPrimInitDone(int entityIndex); +int xf86AllocateEntityPrivateIndex(void); +DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex); + +/* xf86Configure.c */ +GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus, + void *busData, int chipset); +GDevPtr xf86AddDeviceToConfigure(const char *driver, pciVideoPtr pVideo, + int chipset); /* xf86Cursor.c */ void xf86LockZoom(ScreenPtr pScreen, int lock); void xf86InitViewport(ScrnInfoPtr pScr); -void xf86SetScreenLayout(int scrnIndex, int left, int right, int up, int down); void xf86SetViewport(ScreenPtr pScreen, int x, int y); Bool xf86ZoomLocked(ScreenPtr pScreen); void xf86ZoomViewport(ScreenPtr pScreen, int zoom); void *xf86GetPointerScreenFuncs(void); +void xf86InitOrigins(void); /* xf86DPMS.c */ @@ -117,9 +174,11 @@ Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, void SetTimeSinceLastInputEvent(void); pointer xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data); -void xf86RemoveInputHandler(pointer handler); +int xf86RemoveInputHandler(pointer handler); void xf86DisableInputHandler(pointer handler); void xf86EnableInputHandler(pointer handler); +void xf86InterceptSignals(int *signo); +Bool xf86EnableVTSwitch(Bool new); /* xf86Helper.c */ @@ -134,10 +193,10 @@ Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp, int fbbpp, void xf86PrintDepthBpp(ScrnInfoPtr scrp); Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask); Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual); -Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma); +Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma); void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y); void xf86SetBlackWhitePixels(ScreenPtr pScreen); -Bool xf86SaveRestoreImage(int scrnIndex, SaveRestoreFlags what); +void xf86EnableDisableFBAccess(int scrnIndex, Bool enable); void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, va_list args); void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, @@ -166,6 +225,7 @@ void xf86GetClocks(ScrnInfoPtr pScrn, int num, void (*ProtectRegs)(ScrnInfoPtr, Bool), void (*BlankScreen)(ScrnInfoPtr, Bool), int vertsyncreg, int maskval, int knownclkindex, int knownclkvalue); +void xf86SetPriority(Bool up); const char *xf86GetVisualName(int visual); int xf86GetVerbosity(void); Pix24Flags xf86GetPix24(void); @@ -177,6 +237,7 @@ const char *xf86GetServerName(void); Bool xf86ServerIsExiting(void); Bool xf86ServerIsResetting(void); Bool xf86ServerIsInitialising(void); +Bool xf86ServerIsOnlyDetecting(void); Bool xf86ServerIsOnlyProbing(void); Bool xf86CaughtSignal(void); Bool xf86GetVidModeAllowNonLocal(void); @@ -185,25 +246,41 @@ Bool xf86GetModInDevAllowNonLocal(void); Bool xf86GetModInDevEnabled(void); Bool xf86GetAllowMouseOpenFail(void); Bool xf86IsPc98(void); +pointer xf86LoadDrvSubModule(DriverPtr drv, const char *name); pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name); +pointer xf86LoadOneModule(char *name, pointer optlist); +void xf86UnloadSubModule(pointer mod); +Bool xf86LoaderCheckSymbol(const char *name); void xf86LoaderReqSymLists(const char **, ...); void xf86LoaderReqSymbols(const char *, ...); -void xf86Break1(void); -void xf86Break2(void); -void xf86Break3(void); void xf86SetBackingStore(ScreenPtr pScreen); +void xf86SetSilkenMouse(ScreenPtr pScreen); int xf86NewSerialNumber(WindowPtr p, pointer unused); pointer xf86FindXvOptions(int scrnIndex, int adapt_index, char *port_name, char **adaptor_name, pointer *adaptor_options); void xf86GetOS(const char **name, int *major, int *minor, int *teeny); -Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, int entityIndex, - PciChipsets *p_chip, resList res, - EntityProc init, EntityProc enter, - EntityProc leave, pointer private); -Bool xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, int entityIndex, - IsaChipsets *i_chip, resList res, - EntityProc init, EntityProc enter, - EntityProc leave, pointer private); +ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, + int entityIndex,PciChipsets *p_chip, + resList res, EntityProc init, + EntityProc enter, EntityProc leave, + pointer private); +ScrnInfoPtr xf86ConfigIsaEntity(ScrnInfoPtr pScrn, int scrnFlag, + int entityIndex, IsaChipsets *i_chip, + resList res, EntityProc init, + EntityProc enter, EntityProc leave, + pointer private); +/* Obsolete! don't use */ +Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, + int entityIndex,PciChipsets *p_chip, + resList res, EntityProc init, + EntityProc enter, EntityProc leave, + pointer private); +/* Obsolete! don't use */ +Bool xf86ConfigActiveIsaEntity(ScrnInfoPtr pScrn, + int entityIndex, IsaChipsets *i_chip, + resList res, EntityProc init, + EntityProc enter, EntityProc leave, + pointer private); void xf86ConfigPciEntityInactive(EntityInfoPtr pEnt, PciChipsets *p_chip, resList res, EntityProc init, EntityProc enter, EntityProc leave, @@ -213,8 +290,32 @@ void xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip, EntityProc enter, EntityProc leave, pointer private); Bool xf86IsScreenPrimary(int scrnIndex); +int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, + int format, unsigned long len, + pointer value); +Bool xf86IsUnblank(int mode); - +/* xf86Debug.c */ +#ifdef BUILDDEBUG + void xf86Break1(void); +void xf86Break2(void); +void xf86Break3(void); +CARD8 xf86PeekFb8(CARD8 *p); +CARD16 xf86PeekFb16(CARD16 *p); +CARD32 xf86PeekFb32(CARD32 *p); +void xf86PokeFb8(CARD8 *p, CARD8 v); +void xf86PokeFb16(CARD16 *p, CARD16 v); +void xf86PokeFb32(CARD16 *p, CARD32 v); +CARD8 xf86PeekMmio8(pointer Base, unsigned long Offset); +CARD16 xf86PeekMmio16(pointer Base, unsigned long Offset); +CARD32 xf86PeekMmio32(pointer Base, unsigned long Offset); +void xf86PokeMmio8(pointer Base, unsigned long Offset, CARD8 v); +void xf86PokeMmio16(pointer Base, unsigned long Offset, CARD16 v); +void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v); +extern void xf86SPTimestamp(xf86TsPtr* timestamp, char* string); +extern void xf86STimestamp(xf86TsPtr* timestamp); +#endif + /* xf86Init.c */ PixmapFormatPtr xf86GetPixFormat(ScrnInfoPtr pScrn, int depth); @@ -229,6 +330,8 @@ ModeStatus xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep, ClockRangePtr clockRanges, LookupModeFlags strategy); ModeStatus xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor); ModeStatus xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, + ClockRangePtr clockRanges, + LookupModeFlags strategy, int maxPitch, int virtualX, int virtualY); ModeStatus xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, @@ -241,7 +344,6 @@ int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, LookupModeFlags strategy); void xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode); void xf86PruneDriverModes(ScrnInfoPtr scrp); -void xf86PruneMonitorModes(MonPtr monp); void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags); void xf86PrintModes(ScrnInfoPtr scrp); void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges); diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c index baecd9b5d..2dab5232c 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.75 1999/06/27 09:20:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.101 2000/11/18 19:37:09 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -31,12 +31,12 @@ #include "compiler.h" -#include "Xpoll.h" #include "xf86.h" #include "xf86Priv.h" #define XF86_OS_PRIVS #include "xf86_OSlib.h" #include "atKeynames.h" +#include "Xpoll.h" #ifdef XFreeXDGA @@ -60,6 +60,18 @@ extern Bool noXkbExtension; #define XE_POINTER 1 #define XE_KEYBOARD 2 +#ifdef XINPUT +#define __EqEnqueue(ev) xf86eqEnqueue(ev) +#else +#define __EqEnqueue(ev) mieqEnqueue(ev) +#endif + +#define EqEnqueue(ev) { \ + int __sigstate = xf86BlockSIGIO (); \ + __EqEnqueue (ev); \ + xf86UnblockSIGIO(__sigstate); \ +} + #ifdef XTESTEXT1 #define XTestSERVER_SIDE @@ -69,45 +81,19 @@ extern short xtest_mousey; extern int on_steal_input; extern Bool XTestStealKeyData(); extern void XTestStealMotionData(); - -#ifdef XINPUT -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - if (!on_steal_input || \ - XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \ - xtest_mousex, xtest_mousey)) \ - xf86eqEnqueue((ev)) -#else #define ENQUEUE(ev, code, direction, dev_type) \ (ev)->u.u.detail = (code); \ (ev)->u.u.type = (direction); \ if (!on_steal_input || \ XTestStealKeyData((ev)->u.u.detail, (ev)->u.u.type, dev_type, \ xtest_mousex, xtest_mousey)) \ - mieqEnqueue((ev)) -#endif - -#define MOVEPOINTER(dx, dy, time) \ - if (on_steal_input) \ - XTestStealMotionData(dx, dy, XE_POINTER, xtest_mousex, xtest_mousey); \ - miPointerDeltaCursor (dx, dy, time) - + EqEnqueue((ev)) #else /* ! XTESTEXT1 */ -#ifdef XINPUT #define ENQUEUE(ev, code, direction, dev_type) \ (ev)->u.u.detail = (code); \ (ev)->u.u.type = (direction); \ - xf86eqEnqueue((ev)) -#else -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - mieqEnqueue((ev)) -#endif -#define MOVEPOINTER(dx, dy, time) \ - miPointerDeltaCursor (dx, dy, time) + EqEnqueue((ev)) #endif @@ -129,13 +115,17 @@ extern void XTestStealMotionData(); #ifdef USE_VT_SYSREQ static Bool VTSysreqToggle = FALSE; #endif /* !USE_VT_SYSREQ */ -static Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for *BSD */ +static Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for + *BSD and for avoiding VT + switches when using the DRI + automatic full screen mode.*/ extern fd_set EnabledDevices; #if defined(XQUEUE) extern void xf86XqueRequest(void); #endif +extern void (*xf86OSPMClose)(void); static void xf86VTSwitch(void); @@ -153,114 +143,6 @@ typedef struct x_IHRec { static IHPtr InputHandlers = NULL; -#ifndef NEW_INPUT -static CARD32 buttonTimer(OsTimerPtr timer, CARD32 now, pointer arg); - -/* - * Lets create a simple finite-state machine: - * - * state[?][0]: action1 - * state[?][1]: action2 - * state[?][2]: next state - * - * action > 0: ButtonPress - * action = 0: nothing - * action < 0: ButtonRelease - * - * Why this stuff ??? Normally you cannot press both mousebuttons together, so - * the mouse reports both pressed at the same time ... - */ - -static signed char stateTab[48][3] = { - -/* nothing pressed */ - { 0, 0, 0 }, - { 0, 0, 8 }, /* 1 right -> delayed right */ - { 0, 0, 0 }, /* 2 nothing */ - { 0, 0, 8 }, /* 3 right -> delayed right */ - { 0, 0, 16 }, /* 4 left -> delayed left */ - { 2, 0, 24 }, /* 5 left & right (middle press) -> middle pressed */ - { 0, 0, 16 }, /* 6 left -> delayed left */ - { 2, 0, 24 }, /* 7 left & right (middle press) -> middle pressed */ - -/* delayed right */ - { 1, -1, 0 }, /* 8 nothing (right event) -> init */ - { 1, 0, 32 }, /* 9 right (right press) -> right pressed */ - { 1, -1, 0 }, /* 10 nothing (right event) -> init */ - { 1, 0, 32 }, /* 11 right (right press) -> right pressed */ - { 1, -1, 16 }, /* 12 left (right event) -> delayed left */ - { 2, 0, 24 }, /* 13 left & right (middle press) -> middle pressed */ - { 1, -1, 16 }, /* 14 left (right event) -> delayed left */ - { 2, 0, 24 }, /* 15 left & right (middle press) -> middle pressed */ - -/* delayed left */ - { 3, -3, 0 }, /* 16 nothing (left event) -> init */ - { 3, -3, 8 }, /* 17 right (left event) -> delayed right */ - { 3, -3, 0 }, /* 18 nothing (left event) -> init */ - { 3, -3, 8 }, /* 19 right (left event) -> delayed right */ - { 3, 0, 40 }, /* 20 left (left press) -> pressed left */ - { 2, 0, 24 }, /* 21 left & right (middle press) -> pressed middle */ - { 3, 0, 40 }, /* 22 left (left press) -> pressed left */ - { 2, 0, 24 }, /* 23 left & right (middle press) -> pressed middle */ - -/* pressed middle */ - { -2, 0, 0 }, /* 24 nothing (middle release) -> init */ - { -2, 0, 0 }, /* 25 right (middle release) -> init */ - { -2, 0, 0 }, /* 26 nothing (middle release) -> init */ - { -2, 0, 0 }, /* 27 right (middle release) -> init */ - { -2, 0, 0 }, /* 28 left (middle release) -> init */ - { 0, 0, 24 }, /* 29 left & right -> pressed middle */ - { -2, 0, 0 }, /* 30 left (middle release) -> init */ - { 0, 0, 24 }, /* 31 left & right -> pressed middle */ - -/* pressed right */ - { -1, 0, 0 }, /* 32 nothing (right release) -> init */ - { 0, 0, 32 }, /* 33 right -> pressed right */ - { -1, 0, 0 }, /* 34 nothing (right release) -> init */ - { 0, 0, 32 }, /* 35 right -> pressed right */ - { -1, 0, 16 }, /* 36 left (right release) -> delayed left */ - { -1, 2, 24 }, /* 37 left & right (r rel, m prs) -> middle pressed */ - { -1, 0, 16 }, /* 38 left (right release) -> delayed left */ - { -1, 2, 24 }, /* 39 left & right (r rel, m prs) -> middle pressed */ - -/* pressed left */ - { -3, 0, 0 }, /* 40 nothing (left release) -> init */ - { -3, 0, 8 }, /* 41 right (left release) -> delayed right */ - { -3, 0, 0 }, /* 42 nothing (left release) -> init */ - { -3, 0, 8 }, /* 43 right (left release) -> delayed right */ - { 0, 0, 40 }, /* 44 left -> left pressed */ - { -3, 2, 24 }, /* 45 left & right (l rel, mprs) -> middle pressed */ - { 0, 0, 40 }, /* 46 left -> left pressed */ - { -3, 2, 24 }, /* 47 left & right (l rel, mprs) -> middle pressed */ -}; - - -/* - * Table to allow quick reversal of natural button mapping to correct mapping - */ - -/* - * [JCH-96/01/21] The ALPS GlidePoint pad extends the MS protocol - * with a fourth button activated by tapping the PAD. - * The 2nd line corresponds to 4th button on; the drv sends - * the buttons in the following map (MSBit described first) : - * 0 | 4th | 1st | 2nd | 3rd - * And we remap them (MSBit described first) : - * 0 | 4th | 3rd | 2nd | 1st - */ -static char reverseMap[32] = { 0, 4, 2, 6, 1, 5, 3, 7, - 8, 12, 10, 14, 9, 13, 11, 15, - 16, 20, 18, 22, 17, 21, 19, 23, - 24, 28, 26, 30, 25, 29, 27, 31}; - - -static char hitachMap[16] = { 0, 2, 1, 3, - 8, 10, 9, 11, - 4, 6, 5, 7, - 12, 14, 13, 15 }; - -#define reverseBits(map, b) (((b) & ~0x0f) | map[(b) & 0x0f]) -#endif /* * TimeSinceLastInputEvent -- @@ -417,12 +299,12 @@ ProcessInputEvents () extern u_char SpecialServerMap[]; #endif /* ASSUME_CUSTOM_KEYCODES */ -#if !defined(__EMX__) +#if !defined(__EMX__) && !defined(__SOL8__) && !defined(__CYGWIN__) void xf86PostKbdEvent(unsigned key) { int scanCode = (key & 0x7f); - int specialkey; + int specialkey = 0; Bool down = (key & 0x80 ? FALSE : TRUE); KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key; Bool updateLeds = FALSE; @@ -450,7 +332,8 @@ xf86PostKbdEvent(unsigned key) #if defined (__sparc__) if (kbdSun == -1) { - if (xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) + if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) + || (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun"))) kbdSun = 1; else kbdSun = 0; @@ -459,7 +342,7 @@ xf86PostKbdEvent(unsigned key) goto special; #endif /* __sparc__ */ -#if defined (i386) && defined (SVR4) && !defined (PC98) +#if defined (i386) && defined (SVR4) /* * PANIX returns DICOP standards based keycodes in using 106jp * keyboard. We need to remap some keys. @@ -494,8 +377,6 @@ xf86PostKbdEvent(unsigned key) if (xf86Info.scanPrefix == 0) { switch (scanCode) { - -#ifndef PC98 case KEY_Prefix0: case KEY_Prefix1: #if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) @@ -508,11 +389,9 @@ xf86PostKbdEvent(unsigned key) } break; #endif -#endif /* not PC98 */ } } -#ifndef PC98 else if ( #ifdef CSRG_BASED (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS @@ -551,8 +430,18 @@ xf86PostKbdEvent(unsigned key) /* * Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6) */ + case 0x2A: + case 0x36: + return; default: - return; /* skip illegal */ + xf86MsgVerb(X_INFO, 2, "Unreported Prefix0 scancode: 0x%02x\n", + scanCode); + /* + * "Internet" keyboards are generating lots of new codes. Let them + * pass. There is little consistency between them, so don't bother + * with symbolic names at this level. + */ + scanCode += 0x78; } } @@ -568,7 +457,6 @@ xf86PostKbdEvent(unsigned key) if (scanCode != KEY_NumLock) return; scanCode = KEY_Pause; /* pause */ } -#endif /* not PC98 */ #endif /* !ASSUME_CUSTOM_KEYCODES */ /* @@ -581,6 +469,27 @@ xf86PostKbdEvent(unsigned key) specialkey = scanCode; #endif /* ASSUME_CUSTOM_KEYCODES */ + if (xf86IsPc98()) { + switch (scanCode) { + case 0x0e: specialkey = 0x0e; break; /* KEY_BackSpace */ + case 0x40: specialkey = 0x4a; break; /* KEY_KP_Minus */ + case 0x49: specialkey = 0x4e; break; /* KEY_KP_Plus */ + case 0x62: specialkey = 0x3b; break; /* KEY_F1 */ + case 0x63: specialkey = 0x3c; break; /* KEY_F2 */ + case 0x64: specialkey = 0x3d; break; /* KEY_F3 */ + case 0x65: specialkey = 0x3e; break; /* KEY_F4 */ + case 0x66: specialkey = 0x3f; break; /* KEY_F5 */ + case 0x67: specialkey = 0x40; break; /* KEY_F6 */ + case 0x68: specialkey = 0x41; break; /* KEY_F7 */ + case 0x69: specialkey = 0x42; break; /* KEY_F8 */ + case 0x6a: specialkey = 0x43; break; /* KEY_F9 */ + case 0x6b: specialkey = 0x44; break; /* KEY_F10 */ + /* case 0x73: specialkey = 0x38; break; KEY_Alt */ + /* case 0x74: specialkey = 0x1d; break; KEY_LCtrl */ + default: specialkey = 0x00; break; + } + } + #if defined (__sparc__) special: if (kbdSun) { @@ -648,6 +557,28 @@ special: } break; + /* Under QNX4, we set the vtPending flag for VT switching and + * let the VT switch function do the rest... + * This is a little different from the other OS'es. + */ +#if defined(QNX4) + case KEY_1: + case KEY_2: + case KEY_3: + case KEY_4: + case KEY_5: + case KEY_6: + case KEY_7: + case KEY_8: + case KEY_9: + if (down){ + xf86Info.vtRequestsPending = + specialkey - KEY_1 + 1; + return; + } + break; +#endif + #if defined(linux) || (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT))) || defined(SCO) /* * Under Linux, the raw keycodes are consumed before the kernel @@ -792,17 +723,13 @@ special: /* Ignore these keys -- ie don't let them cancel an alt-sysreq */ case KEY_Alt: -#ifndef PC98 case KEY_AltLang: -#endif /* not PC98 */ break; -#ifndef PC98 case KEY_SysReqest: if (down && (ModifierDown(AltMask) || ModifierDown(AltLangMask))) VTSysreqToggle = TRUE; break; -#endif /* not PC98 */ default: if (VTSysreqToggle) @@ -910,7 +837,6 @@ special: * ignore releases, toggle on & off on presses. * Don't deal with the Caps_Lock keysym directly, but check the lock modifier */ -#ifndef PC98 if (keyc->modifierMap[keycode] & LockMask || keysym[0] == XK_Scroll_Lock || keysym[1] == XF86XK_ModeLock || @@ -932,14 +858,13 @@ special: if (keysym[1] == XF86XK_ModeLock) xf86Info.modeSwitchLock = flag; updateLeds = TRUE; } -#endif /* not PC98 */ #ifndef ASSUME_CUSTOM_KEYCODES /* * normal, non-keypad keys */ if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) { -#if !defined(CSRG_BASED) && !defined(MACH386) && !defined(MINIX) && !defined(__OSF__) && !defined(__GNU__) +#if !defined(CSRG_BASED) && !defined(MACH386) && !defined(MINIX) && !defined(__OSF__) && !defined(__GNU__) && !defined(__CYGWIN__) /* * magic ALT_L key on AT84 keyboards for multilingual support */ @@ -961,9 +886,14 @@ special: /* * check for an autorepeat-event */ - if ((down && KeyPressed(keycode)) && - (xf86Info.autoRepeat != AutoRepeatModeOn || keyc->modifierMap[keycode])) - return; + if (down && KeyPressed(keycode)) { + KbdFeedbackClassRec *kbdfeed = ((DeviceIntPtr)xf86Info.pKeyboard)->kbdfeed; + if ((xf86Info.autoRepeat != AutoRepeatModeOn) || + keyc->modifierMap[keycode] || + (kbdfeed && !(kbdfeed->ctrl.autoRepeats[keycode>>3] & ( 1<<(keycode&7) )))) + return; + } + xf86Info.lastEventTime = kevent.u.keyButtonPointer.time = GetTimeInMillis(); /* @@ -990,208 +920,6 @@ special: #endif /* !__EMX__ */ -#ifndef NEW_INPUT -static CARD32 -buttonTimer(OsTimerPtr timer, CARD32 now, pointer arg) -{ -#ifndef NEW_INPUT - MouseDevPtr priv = MOUSE_DEV((DeviceIntPtr) arg); - - xf86PostMseEvent(((DeviceIntPtr) arg), priv->truebuttons, 0, 0); -#endif - return(0); -} -#endif - - -/* - * xf86PostMseEvent -- - * Translate the raw hardware MseEvent into an XEvent(s), and tell DIX - * about it. Perform a 3Button emulation if required. - */ - -#ifndef NEW_INPUT -void -xf86PostMseEvent(DeviceIntPtr device, int buttons, int dx, int dy) -{ - static OsTimerPtr timer = NULL; - MouseDevPtr private = MOUSE_DEV(device); - int id, change; - int truebuttons; - xEvent mevent[2]; - -#ifdef AMOEBA - int pressed; - - pressed = ((buttons & BUTTON_PRESS) != 0); - buttons &= ~BUTTON_PRESS; -#endif - - xf86Info.lastEventTime = mevent->u.keyButtonPointer.time = GetTimeInMillis(); - - truebuttons = buttons; - if (private->mseType == PROT_MMHIT) - buttons = reverseBits(hitachMap, buttons); - else - buttons = reverseBits(reverseMap, buttons); - - if (dx || dy) { - /* - * The accelaration stuff is now done in xf86Xinput.c when XInput - * support is enabled. - */ -#ifndef XINPUT - - /* - * accelerate the baby now if sqrt(dx*dx + dy*dy) > threshold ! - * but do some simpler arithmetic here... - */ - if ((abs(dx) + abs(dy)) >= private->threshold) { - dx = (dx * private->num) / private->den; - dy = (dy * private->num)/ private->den; - } - - MOVEPOINTER(dx, dy, mevent->u.keyButtonPointer.time); -#else - xf86PostMotionEvent(device, 0, 0, 2, dx, dy); -#endif - } - - if (private->emulate3Buttons) - { - - /* - * Hack to operate the middle button even with Emulate3Buttons set. - * Modifying the state table to keep track of the middle button state - * would nearly double its size, so I'll stick with this fix. - TJW - */ - if (private->mseType == PROT_MMHIT) - change = buttons ^ reverseBits(hitachMap, private->lastButtons); - else - change = buttons ^ reverseBits(reverseMap, private->lastButtons); - if (change & 02) - { -#ifndef XINPUT - ENQUEUE(mevent, - 2, (buttons & 02) ? ButtonPress : ButtonRelease, - XE_POINTER); -#else - xf86PostButtonEvent(device, 0, 2, (buttons & 02), 0, 0); -#endif - } - - /* - * emulate the third button by the other two - */ - if ((id = stateTab[(buttons & 0x07) + private->emulateState][0]) != 0) - { -#ifndef XINPUT - ENQUEUE(mevent, - abs(id), (id < 0 ? ButtonRelease : ButtonPress), - XE_POINTER); -#else - xf86PostButtonEvent(device, 0, abs(id), (id >= 0), 0, 0); -#endif - } - - if ((id = stateTab[(buttons & 0x07) + private->emulateState][1]) != 0) - { -#ifndef XINPUT - ENQUEUE(mevent, - abs(id), (id < 0 ? ButtonRelease : ButtonPress), - XE_POINTER); -#else - xf86PostButtonEvent(device, 0, abs(id), (id >= 0), 0, 0); -#endif - } - - private->emulateState = stateTab[(buttons & 0x07) + private->emulateState][2]; - if (stateTab[(buttons & 0x07) + private->emulateState][0] || - stateTab[(buttons & 0x07) + private->emulateState][1]) - { - private->truebuttons = truebuttons; - timer = TimerSet(timer, 0, private->emulate3Timeout, buttonTimer, - (pointer)device); - } - else - { - if (timer) - { - TimerFree(timer); - timer = NULL; - } - } - } - else - { -#ifdef AMOEBA - if (truebuttons != 0) { -# ifndef XINPUT - ENQUEUE(mevent, - truebuttons, (pressed ? ButtonPress : ButtonRelease), - XE_POINTER); -# else - xf86PostButtonEvent(device, 0, truebuttons, pressed, 0, 0); -# endif - } -#else - /* - * real three button event - * Note that xf86Info.lastButtons has the hardware button mapping which - * is the reverse of the button mapping reported to the server. - */ - if (private->mseType == PROT_MMHIT) - change = buttons ^ reverseBits(hitachMap, private->lastButtons); - else - change = buttons ^ reverseBits(reverseMap, private->lastButtons); - while (change) - { - id = ffs(change); - change &= ~(1 << (id-1)); -# ifndef XINPUT - ENQUEUE(mevent, - id, (buttons&(1<<(id-1)))? ButtonPress : ButtonRelease, - XE_POINTER); -# else - xf86PostButtonEvent(device, 0, id, (buttons&(1<<(id-1))), 0, 0); -# endif - } -#endif - } - private->lastButtons = truebuttons; -} -#endif - - - -#ifndef NEW_INPUT -/* - * xf86Block -- - * Os block handler. - */ - -/* ARGSUSED */ -void -xf86Block(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) -{ -#if defined(XQUEUE) - /* - * On MP SVR4 boxes, a race condition exists because the XQUEUE does - * not have anyway to lock it for exclusive access. This results in one - * processor putting something on the queue at the same time the other - * processor is taking it something off. The count of items in the queue - * can get off by 1. This just goes and checks to see if an extra event - * was put in the queue a during this period. The signal for this event - * was ignored while processing the previous event. - */ - - if (xf86Screens[0]->vtSema) - xf86XqueRequest(); -#endif -} -#endif - - #ifndef AMOEBA /* @@ -1203,17 +931,14 @@ xf86Block(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) void xf86Wakeup(pointer blockData, int err, pointer pReadmask) { - -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__QNX__) && !defined(__CYGWIN__) #ifdef __OSF__ fd_set kbdDevices; fd_set mseDevices; #endif /* __OSF__ */ fd_set* LastSelectMask = (fd_set*)pReadmask; fd_set devicesWithInput; -#ifdef NEW_INPUT InputInfoPtr pInfo; -#endif if (err >= 0) { @@ -1221,14 +946,14 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) #ifndef __OSF__ if (XFD_ANYSET(&devicesWithInput)) { (xf86Info.kbdEvents)(); -#ifndef NEW_INPUT - (xf86Info.mouseDev->mseEvents)(xf86Info.mouseDev); -#else pInfo = xf86InputDevs; while (pInfo) { if (pInfo->read_input && pInfo->fd >= 0 && (FD_ISSET(pInfo->fd, ((fd_set *)pReadmask)) != 0)) { + int sigstate = xf86BlockSIGIO(); + pInfo->read_input(pInfo); + xf86UnblockSIGIO(sigstate); /* * Must break here because more than one device may share * the same file descriptor. @@ -1237,7 +962,6 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) } pInfo = pInfo->next; } -#endif /* NEW_INPUT */ } #else /* __OSF__ */ /* @@ -1259,16 +983,33 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) (xf86Info.mouseDev->mseEvents)(1); #endif /* __OSF__ */ } -#else /* __EMX__ */ +#else /* __EMX__ and __QNX__ */ + + InputInfoPtr pInfo; - (xf86Info.kbdEvents)(); /* Under OS/2, always call */ - (xf86Info.mouseDev->mseEvents)(xf86Info.mouseDev); + (xf86Info.kbdEvents)(); /* Under OS/2 and QNX, always call */ -#endif /* __EMX__ */ + pInfo = xf86InputDevs; + while (pInfo) { + if (pInfo->read_input && pInfo->fd >= 0) { + int sigstate = xf86BlockSIGIO(); + + pInfo->read_input(pInfo); + xf86UnblockSIGIO(sigstate); + /* + * Must break here because more than one device may share + * the same file descriptor. + */ + break; + } + pInfo = pInfo->next; + } - { - IHPtr ih; +#endif /* __EMX__ and __QNX__ */ + if (err >= 0) { /* we don't want the handlers called if select() */ + IHPtr ih; /* returned with an error condition, do we? */ + for (ih = InputHandlers; ih; ih = ih->next) { if (ih->enabled && ih->fd >= 0 && ih->ihproc && (FD_ISSET(ih->fd, ((fd_set *)pReadmask)) != 0)) { @@ -1276,15 +1017,7 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) } } } - -#ifndef NEW_INPUT -#if defined(XQUEUE) && !defined(XQUEUE_ASYNC) - /* This could be done more cleanly */ - if (xf86Info.mouseDev->xqueSema && xf86Info.mouseDev->xquePending) - xf86XqueRequest(); -#endif -#endif - + if (xf86VTSwitchPending()) xf86VTSwitch(); if (xf86Info.inputPending) ProcessInputEvents(); @@ -1292,16 +1025,74 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) #endif /* AMOEBA */ +/* + * xf86SigioReadInput -- + * signal handler for the SIGIO signal. + */ +static void +xf86SigioReadInput(int fd, + void *closure) +{ + int sigstate = xf86BlockSIGIO(); + InputInfoPtr pInfo = (InputInfoPtr) closure; + + pInfo->read_input(pInfo); + + xf86UnblockSIGIO(sigstate); +} + +/* + * xf86AddEnabledDevice -- + * + */ +void +xf86AddEnabledDevice(InputInfoPtr pInfo) +{ + if (!xf86InstallSIGIOHandler (pInfo->fd, xf86SigioReadInput, pInfo)) { + AddEnabledDevice(pInfo->fd); + } +} + +/* + * xf86RemoveEnabledDevice -- + * + */ +void +xf86RemoveEnabledDevice(InputInfoPtr pInfo) +{ + if (!xf86RemoveSIGIOHandler (pInfo->fd)) { + RemoveEnabledDevice(pInfo->fd); + } +} + +static int *xf86SignalIntercept = NULL; + +void +xf86InterceptSignals(int *signo) +{ + if ((xf86SignalIntercept = signo)) + *signo = -1; +} /* * xf86SigHandler -- - * Catch unexpected signals and exit cleanly. + * Catch unexpected signals and exit or continue cleanly. */ void xf86SigHandler(int signo) { + if (xf86SignalIntercept && (*xf86SignalIntercept < 0)) { + /* Re-arm handler just in case */ + (void) signal(signo, xf86SigHandler); + *xf86SignalIntercept = signo; + return; + } + signal(signo,SIG_IGN); xf86Info.caughtSignal = TRUE; +#ifdef XF86BIGFONT + XF86BigfontCleanup(); +#endif #if defined(DEBUG) && defined(XFree86LOADER) if (signo == SIGSEGV) LoaderDumpSymbols(); @@ -1317,9 +1108,7 @@ static void xf86VTSwitch() { int i; -#ifdef NEW_INPUT InputInfoPtr pInfo; -#endif IHPtr ih; #ifdef DEBUG @@ -1339,33 +1128,29 @@ xf86VTSwitch() #ifdef DEBUG ErrorF("xf86VTSwitch: Leaving, xf86Exiting is %s\n", - BOOLTOSTRING(xf86Exiting)); + BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE)); #endif for (i = 0; i < xf86NumScreens; i++) { - if (!xf86Exiting) - if (xf86Screens[i]->SaveRestoreImage) - xf86Screens[i]->SaveRestoreImage(i, SaveImage); + if (!(dispatchException & DE_TERMINATE)) + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); } xf86EnterServerState(SETUP); for (i = 0; i < xf86NumScreens; i++) { xf86Screens[i]->LeaveVT(i, 0); } -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__CYGWIN__) DisableDevice((DeviceIntPtr)xf86Info.pKeyboard); -#ifndef NEW_INPUT - DisableDevice((DeviceIntPtr)xf86Info.pMouse); -#else pInfo = xf86InputDevs; while (pInfo) { DisableDevice(pInfo->dev); pInfo = pInfo->next; } -#endif /* NEW_INPUT */ #endif /* !__EMX__ */ for (ih = InputHandlers; ih; ih = ih->next) xf86DisableInputHandler(ih); - xf86AccessLeaveState(); /* We need this here, otherwise */ - xf86AccessLeave(); /* console won't be restored */ + xf86AccessLeave(); /* We need this here, otherwise */ + xf86AccessLeaveState(); /* console won't be restored */ if (!xf86VTSwitchAway()) { /* @@ -1382,30 +1167,30 @@ xf86VTSwitch() FatalError("EnterVT failed for screen %d\n", i); } xf86EnterServerState(OPERATING); - if (!xf86Exiting) { + if (!(dispatchException & DE_TERMINATE)) { for (i = 0; i < xf86NumScreens; i++) { - if (xf86Screens[i]->SaveRestoreImage) - xf86Screens[i]->SaveRestoreImage(i, RestoreImage); + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); } } SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__CYGWIN__) EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); -#ifndef NEW_INPUT - EnableDevice((DeviceIntPtr)xf86Info.pMouse); -#else pInfo = xf86InputDevs; while (pInfo) { EnableDevice(pInfo->dev); pInfo = pInfo->next; } -#endif /* NEW_INPUT */ #endif /* !__EMX__ */ for (ih = InputHandlers; ih; ih = ih->next) xf86EnableInputHandler(ih); } else { + if (xf86OSPMClose) + xf86OSPMClose(); + xf86OSPMClose = NULL; + for (i = 0; i < xf86NumScreens; i++) { /* * zero all access functions to @@ -1422,7 +1207,8 @@ xf86VTSwitch() ErrorF("xf86VTSwitch: Entering\n"); #endif if (!xf86VTSwitchTo()) return; - + xf86OSPMClose = xf86OSPMOpen(); + xf86EnableIO(); xf86AccessEnter(); xf86EnterServerState(SETUP); @@ -1433,24 +1219,20 @@ xf86VTSwitch() } xf86EnterServerState(OPERATING); for (i = 0; i < xf86NumScreens; i++) { - if (xf86Screens[i]->SaveRestoreImage) - xf86Screens[i]->SaveRestoreImage(i, RestoreImage); + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess)(i, TRUE); } /* Turn screen saver off when switching back */ SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset); -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__CYGWIN__) EnableDevice((DeviceIntPtr)xf86Info.pKeyboard); -#ifndef NEW_INPUT - EnableDevice((DeviceIntPtr)xf86Info.pMouse); -#else pInfo = xf86InputDevs; while (pInfo) { EnableDevice(pInfo->dev); pInfo = pInfo->next; } -#endif /* NEW_INPUT */ #endif /* !__EMX__ */ for (ih = InputHandlers; ih; ih = ih->next) xf86EnableInputHandler(ih); @@ -1485,15 +1267,18 @@ xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data) return ih; } -void +int xf86RemoveInputHandler(pointer handler) { IHPtr ih, p; - + int fd; + if (!handler) - return; + return -1; ih = handler; + fd = ih->fd; + if (ih->fd >= 0) RemoveEnabledDevice(ih->fd); @@ -1507,6 +1292,7 @@ xf86RemoveInputHandler(pointer handler) p->next = ih->next; } xfree(ih); + return fd; } void @@ -1537,6 +1323,14 @@ xf86EnableInputHandler(pointer handler) AddEnabledDevice(ih->fd); } +Bool +xf86EnableVTSwitch(Bool new) +{ + Bool old = VTSwitchEnabled; + VTSwitchEnabled = new; + return old; +} + #ifdef XTESTEXT1 void @@ -1557,8 +1351,6 @@ XTestJumpPointer(int jx, int jy, int dev_type) miPointerAbsoluteCursor(jx, jy, GetTimeInMillis() ); } - - void XTestGenerateEvent(int dev_type, int keycode, int keystate, int mousex, int mousey) @@ -1582,3 +1374,38 @@ XTestGenerateEvent(int dev_type, int keycode, int keystate, int mousex, #endif /* XTESTEXT1 */ +#ifdef WSCONS_SUPPORT + +/* XXX Currently XKB is mandatory. */ + +void +xf86PostWSKbdEvent(struct wscons_event *event) +{ + int type = event->type; + int value = event->value; + Bool down = (type == WSCONS_EVENT_KEY_DOWN ? TRUE : FALSE); + KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key; + xEvent kevent; + KeySym *keysym; + int keycode; + + /* + * Now map the scancodes to real X-keycodes ... + */ + keycode = value + MIN_KEYCODE; + keysym = keyc->curKeySyms.map + + keyc->curKeySyms.mapWidth * (keycode - keyc->curKeySyms.minKeyCode); + + /* + * check for an autorepeat-event + */ + if ((down && KeyPressed(keycode)) && + (xf86Info.autoRepeat != AutoRepeatModeOn || keyc->modifierMap[keycode])) + return; + + xf86Info.lastEventTime = kevent.u.keyButtonPointer.time + = event->time.tv_sec * 1000 + event->time.tv_nsec / 1000000; + + ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD); +} +#endif /* WSCONS_SUPPORT */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c index 5cfefa728..f6c346438 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c @@ -352,6 +352,9 @@ static const char *driSymbols[] = { "DRIGetSAREAPrivate", "DRIGetContext", "DRIQueryVersion", + "DRIAdjustFrame", + "DRIOpenFullScreen", + "DRICloseFullScreen", "GlxSetVisualConfigs", NULL }; @@ -3029,6 +3032,16 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86DPMSInit(pScreen, MGADisplayPowerManagementSet, 0); #endif + pScrn->memPhysBase = pMga->FbAddress; + pScrn->fbOffset = pMga->YDstOrg * (pScrn->bitsPerPixel / 8); + + if(pMga->SecondCrtc == TRUE) { + pScreen->SaveScreen = MGASaveScreenCrtc2; + } else { + pScreen->SaveScreen = MGASaveScreen; + } + MGAInitVideo(pScreen); + #ifdef XF86DRI /* Initialize the Warp engine */ if (pMga->directRenderingEnabled) { @@ -3050,16 +3063,6 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pMga->have_quiescense = 1; #endif - pScrn->memPhysBase = pMga->FbAddress; - pScrn->fbOffset = pMga->YDstOrg * (pScrn->bitsPerPixel / 8); - - if(pMga->SecondCrtc == TRUE) { - pScreen->SaveScreen = MGASaveScreenCrtc2; - } else { - pScreen->SaveScreen = MGASaveScreen; - } - MGAInitVideo(pScreen); - /* Wrap the current CloseScreen function */ pMga->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = MGACloseScreen; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c index c64e0d049..39bedb922 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c @@ -373,6 +373,8 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) pDRIInfo->SwapContext = TDFXDRISwapContext; pDRIInfo->InitBuffers = TDFXDRIInitBuffers; pDRIInfo->MoveBuffers = TDFXDRIMoveBuffers; + pDRIInfo->OpenFullScreen = TDFXDRIOpenFullScreen; + pDRIInfo->CloseFullScreen = TDFXDRICloseFullScreen; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; if (!DRIScreenInit(pScreen, pDRIInfo, &pTDFX->drmSubFD)) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c index 201a2ff6f..5c2c355f5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c @@ -206,6 +206,20 @@ static const char *vgahwSymbols[] = { 0 }; +static const char *ramdacSymbols[] = { + "xf86InitCursor", + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", + NULL +}; + +static const char *ddcSymbols[] = { + "xf86PrintEDID", + "xf86DoEDID_DDC1", + NULL +}; + +#ifdef XFree86LOADER static const char *fbSymbols[] = { "fbScreenInit", #ifdef RENDER @@ -231,19 +245,6 @@ static const char *xaaSymbols[] = { NULL }; -static const char *ramdacSymbols[] = { - "xf86InitCursor", - "xf86CreateCursorInfoRec", - "xf86DestroyCursorInfoRec", - NULL -}; - -static const char *ddcSymbols[] = { - "xf86PrintEDID", - "xf86DoEDID_DDC1", - NULL -}; - static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", @@ -289,8 +290,6 @@ static const char *driSymbols[] = { #endif -#ifdef XFree86LOADER - static MODULESETUPPROTO(tdfxSetup); static XF86ModuleVersionInfo tdfxVersRec = |