diff options
author | Keith Packard <keithp@keithp.com> | 2004-08-11 22:40:14 +0000 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2004-08-11 22:40:14 +0000 |
commit | fd439afdfe7ba451aff19b62d1764e4dfd0b782f (patch) | |
tree | ef70f8b2e726f132b3fe089f6fc02f5770149517 /hw/xnest | |
parent | f95293e5253904883d3b40f9e68e6175247754a3 (diff) |
Add COMPOSITE change to fbCopyWindow (not needed yet)
Xnest was half-using midispcur and doing a bad job of it. Replace all of
that code with mipointer which does a lot of the work.
Support DDXen which don't provide GetWindowPixmap, or which return NULL for
the root pixmap.
Diffstat (limited to 'hw/xnest')
-rw-r--r-- | hw/xnest/Cursor.c | 73 | ||||
-rw-r--r-- | hw/xnest/Events.c | 10 | ||||
-rw-r--r-- | hw/xnest/GCOps.c | 13 | ||||
-rw-r--r-- | hw/xnest/Screen.c | 65 | ||||
-rw-r--r-- | hw/xnest/XNCursor.h | 9 |
5 files changed, 68 insertions, 102 deletions
diff --git a/hw/xnest/Cursor.c b/hw/xnest/Cursor.c index 146e7ebd0..aaab62c23 100644 --- a/hw/xnest/Cursor.c +++ b/hw/xnest/Cursor.c @@ -33,59 +33,6 @@ is" without express or implied warranty. #include "Keyboard.h" #include "Args.h" -void -xnestConstrainCursor(ScreenPtr pScreen, BoxPtr pBox) -{ -#ifdef _XSERVER64 - Window64 wroot; -#else - Window wroot; -#endif - - int wx, wy; - unsigned int wwidth, wheight; - unsigned int wborderwidth; - unsigned int wdepth; - - XGetGeometry(xnestDisplay, xnestDefaultWindows[pScreen->myNum], &wroot, - &wx, &wy, &wwidth, &wheight, &wborderwidth, &wdepth); - - if (pBox->x1 <= 0 && pBox->y1 <= 0 && - pBox->x2 >= wwidth && pBox->y2 >= wheight) - XUngrabPointer(xnestDisplay, CurrentTime); - else { - XReparentWindow(xnestDisplay, xnestConfineWindow, - xnestDefaultWindows[pScreen->myNum], - pBox->x1, pBox->y1); - XResizeWindow(xnestDisplay, xnestConfineWindow, - pBox->x2 - pBox->x1, pBox->y2 - pBox->y1); - - XGrabPointer(xnestDisplay, - xnestDefaultWindows[pScreen->myNum], - True, - xnestEventMask & (~XNEST_KEYBOARD_EVENT_MASK|KeymapStateMask), - GrabModeAsync, GrabModeAsync, - xnestConfineWindow, - None, CurrentTime); - } -} - -void -xnestCursorLimits(ScreenPtr pScreen, CursorPtr pCursor, BoxPtr pHotBox, - BoxPtr pTopLeftBox) -{ - *pTopLeftBox = *pHotBox; -} - -Bool -xnestDisplayCursor(ScreenPtr pScreen, CursorPtr pCursor) -{ - XDefineCursor(xnestDisplay, - xnestDefaultWindows[pScreen->myNum], - xnestCursor(pCursor, pScreen)); - return True; -} - Bool xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) { @@ -192,15 +139,17 @@ xnestRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed) &fg_color, &bg_color); } -Bool -xnestSetCursorPosition(ScreenPtr pScreen, int x, int y, Bool generateEvent) +void xnestSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y) { - int i; + if (pCursor) + { + XDefineCursor(xnestDisplay, + xnestDefaultWindows[pScreen->myNum], + xnestCursor(pCursor, pScreen)); + } +} - for (i = 0; i < xnestNumScreens; i++) - XWarpPointer(xnestDisplay, xnestDefaultWindows[i], - xnestDefaultWindows[pScreen->myNum], - 0, 0, 0, 0, x, y); - - return True; +void +xnestMoveCursor (ScreenPtr pScreen, int x, int y) +{ } diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c index a36e0d8e8..69a3c208f 100644 --- a/hw/xnest/Events.c +++ b/hw/xnest/Events.c @@ -34,6 +34,7 @@ is" without express or implied warranty. #include "Screen.h" #include "XNWindow.h" #include "Events.h" +#include "mipointer.h" CARD32 lastEventTime = 0; @@ -41,6 +42,7 @@ void ProcessInputEvents() { mieqProcessInputEvents(); + miPointerUpdate(); } int @@ -131,11 +133,15 @@ xnestCollectEvents() break; case MotionNotify: +#if 0 x.u.u.type = MotionNotify; x.u.keyButtonPointer.rootX = X.xmotion.x; x.u.keyButtonPointer.rootY = X.xmotion.y; x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis(); mieqEnqueue(&x); +#endif + miPointerAbsoluteCursor (X.xmotion.x, X.xmotion.y, + lastEventTime = GetTimeInMillis()); break; case FocusIn: @@ -162,11 +168,15 @@ xnestCollectEvents() pScreen = xnestScreen(X.xcrossing.window); if (pScreen) { NewCurrentScreen(pScreen, X.xcrossing.x, X.xcrossing.y); +#if 0 x.u.u.type = MotionNotify; x.u.keyButtonPointer.rootX = X.xcrossing.x; x.u.keyButtonPointer.rootY = X.xcrossing.y; x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis(); mieqEnqueue(&x); +#endif + miPointerAbsoluteCursor (X.xcrossing.x, X.xcrossing.y, + lastEventTime = GetTimeInMillis()); xnestDirectInstallColormaps(pScreen); } } diff --git a/hw/xnest/GCOps.c b/hw/xnest/GCOps.c index 042a29f6e..4ccc0b916 100644 --- a/hw/xnest/GCOps.c +++ b/hw/xnest/GCOps.c @@ -310,5 +310,16 @@ void xnestPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDst, int width, int height, int x, int y) { - ErrorF("xnest warning: function xnestPushPixels not implemented\n"); + /* only works for solid bitmaps */ + if (pGC->fillStyle == FillSolid) + { + XSetStipple (xnestDisplay, xnestGC(pGC), xnestPixmap(pBitmap)); + XSetTSOrigin (xnestDisplay, xnestGC(pGC), x, y); + XSetFillStyle (xnestDisplay, xnestGC(pGC), FillStippled); + XFillRectangle (xnestDisplay, xnestDrawable(pDst), + xnestGC(pGC), x, y, width, height); + XSetFillStyle (xnestDisplay, xnestGC(pGC), FillSolid); + } + else + ErrorF("xnest warning: function xnestPushPixels not implemented\n"); } diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c index 3412edfb8..8490a7995 100644 --- a/hw/xnest/Screen.c +++ b/hw/xnest/Screen.c @@ -124,6 +124,14 @@ static miPointerScreenFuncRec xnestPointerCursorFuncs = miPointerWarpCursor }; +static miPointerSpriteFuncRec xnestPointerSpriteFuncs = +{ + xnestRealizeCursor, + xnestUnrealizeCursor, + xnestSetCursor, + xnestMoveCursor, +}; + Bool xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]) { @@ -241,27 +249,6 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]) xnestHeight = gattributes.height; } - /* myNum */ - /* id */ - miScreenInit(pScreen, NULL, xnestWidth, xnestHeight, 1, 1, xnestWidth, - rootDepth, - numDepths, depths, - defaultVisual, /* root visual */ - numVisuals, visuals); - - miInitializeBackingStore(pScreen); - - miDCInitialize(pScreen, &xnestPointerCursorFuncs); - - pScreen->mmWidth = xnestWidth * DisplayWidthMM(xnestDisplay, - DefaultScreen(xnestDisplay)) / - DisplayWidth(xnestDisplay, - DefaultScreen(xnestDisplay)); - pScreen->mmHeight = xnestHeight * DisplayHeightMM(xnestDisplay, - DefaultScreen(xnestDisplay)) / - DisplayHeight(xnestDisplay, - DefaultScreen(xnestDisplay)); - pScreen->defColormap = (Colormap) FakeClientID(0); pScreen->minInstalledCmaps = MINCMAPS; pScreen->maxInstalledCmaps = MAXCMAPS; @@ -282,7 +269,6 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]) /* Random screen procedures */ - pScreen->CloseScreen = xnestCloseScreen; pScreen->QueryBestSize = xnestQueryBestSize; pScreen->SaveScreen = xnestSaveScreen; pScreen->GetImage = xnestGetImage; @@ -324,16 +310,6 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]) pScreen->RealizeFont = xnestRealizeFont; pScreen->UnrealizeFont = xnestUnrealizeFont; - /* Cursor Procedures */ - - pScreen->ConstrainCursor = xnestConstrainCursor; - pScreen->CursorLimits = xnestCursorLimits; - pScreen->DisplayCursor = xnestDisplayCursor; - pScreen->RealizeCursor = xnestRealizeCursor; - pScreen->UnrealizeCursor = xnestUnrealizeCursor; - pScreen->RecolorCursor = xnestRecolorCursor; - pScreen->SetCursorPosition = xnestSetCursorPosition; - /* GC procedures */ pScreen->CreateGC = xnestCreateGC; @@ -356,6 +332,31 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]) pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr)NoopDDA; pScreen->blockData = NULL; pScreen->wakeupData = NULL; + /* myNum */ + /* id */ + miScreenInit(pScreen, NULL, xnestWidth, xnestHeight, 1, 1, xnestWidth, + rootDepth, + numDepths, depths, + defaultVisual, /* root visual */ + numVisuals, visuals); + +/* miInitializeBackingStore(pScreen); */ + + miPointerInitialize (pScreen, &xnestPointerSpriteFuncs, + &xnestPointerCursorFuncs, True); + + pScreen->mmWidth = xnestWidth * DisplayWidthMM(xnestDisplay, + DefaultScreen(xnestDisplay)) / + DisplayWidth(xnestDisplay, + DefaultScreen(xnestDisplay)); + pScreen->mmHeight = xnestHeight * DisplayHeightMM(xnestDisplay, + DefaultScreen(xnestDisplay)) / + DisplayHeight(xnestDisplay, + DefaultScreen(xnestDisplay)); + + /* overwrite miCloseScreen with our own */ + pScreen->CloseScreen = xnestCloseScreen; + if (!miScreenDevPrivateInit(pScreen, xnestWidth, NULL)) return FALSE; diff --git a/hw/xnest/XNCursor.h b/hw/xnest/XNCursor.h index b396c80b5..8684a5e7f 100644 --- a/hw/xnest/XNCursor.h +++ b/hw/xnest/XNCursor.h @@ -27,14 +27,9 @@ typedef struct { #define xnestCursor(pCursor, pScreen) \ (xnestCursorPriv(pCursor, pScreen)->cursor) -void xnestConstrainCursor(ScreenPtr pScreen, BoxPtr pBox); -void xnestCursorLimits(ScreenPtr pScreen, CursorPtr pCursor, BoxPtr pHotBox, - BoxPtr pTopLeftBox); -Bool xnestDisplayCursor(ScreenPtr pScreen, CursorPtr pCursor); Bool xnestRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); Bool xnestUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); -void xnestRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor, Bool displayed); -Bool xnestSetCursorPosition(ScreenPtr pScreen, int x, int y, - Bool generateEvent); +void xnestSetCursor (ScreenPtr pScreen, CursorPtr pCursor, int x, int y); +void xnestMoveCursor (ScreenPtr pScreen, int x, int y); #endif /* XNESTCURSOR_H */ |