diff options
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Events.c')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Events.c | 121 |
1 files changed, 43 insertions, 78 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index c04481c92..5ad81f781 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -1834,9 +1834,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was { #ifdef DEBUG fprintf(stderr, "nxagentDispatchEvents: Going to handle new Expose event.\n"); - #endif - #ifdef DEBUG fprintf(stderr, "nxagentDispatchEvents: WARNING! Received Expose event " "for drawable [%lx] geometry [%d, %d, %d, %d] count [%d].\n", X.xexpose.window, X.xexpose.x, X.xexpose.y, X.xexpose.width, @@ -1851,9 +1849,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was { #ifdef DEBUG fprintf(stderr, "nxagentDispatchEvents: Going to handle new GraphicsExpose event.\n"); - #endif - #ifdef DEBUG fprintf(stderr, "nxagentDispatchEvents: WARNING! Received GraphicsExpose event " "for drawable [%lx] geometry [%d, %d, %d, %d] count [%d].\n", X.xgraphicsexpose.drawable, X.xgraphicsexpose.x, X.xgraphicsexpose.y, @@ -1869,9 +1865,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was { #ifdef DEBUG fprintf(stderr, "nxagentDispatchEvents: Going to handle new NoExpose event.\n"); - #endif - #ifdef DEBUG fprintf(stderr, "nxagentDispatchEvents: WARNING! Received NoExpose event for " "drawable [%lx].\n", X.xnoexpose.drawable); #endif @@ -2401,9 +2395,7 @@ int nxagentHandleExposeEvent(XEvent *X) #ifdef DEBUG fprintf(stderr, "nxagentHandleExposeEvent: Checking remote expose events.\n"); - #endif - #ifdef DEBUG fprintf(stderr, "nxagentHandleExposeEvent: Looking for window id [%ld].\n", X -> xexpose.window); #endif @@ -2414,7 +2406,7 @@ int nxagentHandleExposeEvent(XEvent *X) if (pWin != NULL) { - REGION_INIT(pWin -> drawable.pScreen, &sum, (BoxRec *) NULL, 1); + RegionInit(&sum, (BoxRec *) NULL, 1); /* FIXME: This can be maybe optimized by consuming the events that do not match the predicate. @@ -2445,11 +2437,11 @@ FIXME: This can be maybe optimized by consuming the box.x2 = box.x1 + X -> xexpose.width; box.y2 = box.y1 + X -> xexpose.height; - REGION_INIT(pWin -> drawable.pScreen, &add, &box, 1); + RegionInit(&add, &box, 1); - REGION_APPEND(pWin -> drawable.pScreen, &sum, &add); + RegionAppend(&sum, &add); - REGION_UNINIT(pWin -> drawable.pScreen, &add); + RegionUninit(&add); if (X -> xexpose.count == 0) { @@ -2459,9 +2451,9 @@ FIXME: This can be maybe optimized by consuming the while (nxagentCheckEvents(nxagentDisplay, X, nxagentExposurePredicate, (XPointer) &window) == 1); - REGION_VALIDATE(pWin -> drawable.pScreen, &sum, &overlap); + RegionValidate(&sum, &overlap); - REGION_INTERSECT(pWin->drawable.pScreen, &sum, &sum, + RegionIntersect(&sum, &sum, &WindowTable[pWin->drawable.pScreen->myNum]->winSize); #ifdef DEBUG @@ -2482,14 +2474,14 @@ FIXME: This can be maybe optimized by consuming the } else { - REGION_TRANSLATE(pWin -> drawable.pScreen, &sum, -pWin -> drawable.x, -pWin -> drawable.y); + RegionTranslate(&sum, -pWin -> drawable.x, -pWin -> drawable.y); if (nxagentExposeQueue.exposures[index].remoteRegion == NullRegion) { - nxagentExposeQueue.exposures[index].remoteRegion = REGION_CREATE(pwin -> drawable.pScreen, NULL, 1); + nxagentExposeQueue.exposures[index].remoteRegion = RegionCreate(NULL, 1); } - REGION_UNION(pWin -> drawable.pScreen, nxagentExposeQueue.exposures[index].remoteRegion, + RegionUnion(nxagentExposeQueue.exposures[index].remoteRegion, nxagentExposeQueue.exposures[index].remoteRegion, &sum); #ifdef TEST @@ -2521,7 +2513,7 @@ FIXME: This can be maybe optimized by consuming the } } - REGION_UNINIT(pWin -> drawable.pScreen, &sum); + RegionUninit(&sum); } return 1; @@ -2538,7 +2530,6 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) RegionPtr exposeRegion; BoxRec rect; WindowPtr pWin; - ScreenPtr pScreen; StoringPixmapPtr pStoringPixmapRec = NULL; miBSWindowPtr pBSwindow = NULL; int drawableType; @@ -2581,8 +2572,6 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) pWin = pStoringPixmapRec -> pSavedWindow; } - pScreen = pWin -> drawable.pScreen; - /* * Rectangle affected by GraphicsExpose * event. @@ -2593,7 +2582,7 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) rect.x2 = rect.x1 + X -> xgraphicsexpose.width; rect.y2 = rect.y1 + X -> xgraphicsexpose.height; - exposeRegion = REGION_CREATE(pScreen, &rect, 0); + exposeRegion = RegionCreate(&rect, 0); if (drawableType == DRAWABLE_PIXMAP) { @@ -2610,7 +2599,7 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) * window. */ - REGION_TRANSLATE(pScreen, exposeRegion, pStoringPixmapRec -> backingStoreX, + RegionTranslate(exposeRegion, pStoringPixmapRec -> backingStoreX, pStoringPixmapRec -> backingStoreY); /* @@ -2618,7 +2607,7 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) * affected by the GraphicsExpose event. */ - REGION_SUBTRACT(pScreen, &(pBSwindow -> SavedRegion), &(pBSwindow -> SavedRegion), + RegionSubtract(&(pBSwindow -> SavedRegion), &(pBSwindow -> SavedRegion), exposeRegion); } @@ -2628,18 +2617,17 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) * must be relative to the screen. */ - REGION_TRANSLATE(pScreen, exposeRegion, pWin -> drawable.x, pWin -> drawable.y); + RegionTranslate(exposeRegion, pWin -> drawable.x, pWin -> drawable.y); - REGION_UNION(pScreen, nxagentRemoteExposeRegion, nxagentRemoteExposeRegion, exposeRegion); + RegionUnion(nxagentRemoteExposeRegion, nxagentRemoteExposeRegion, exposeRegion); - REGION_DESTROY(pScreen, exposeRegion); + RegionDestroy(exposeRegion); return 1; } int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) { - ScreenPtr pScreen; WindowPtr pWin; xEvent x; @@ -2691,7 +2679,9 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) if (message_type == MakeAtom("WM_PROTOCOLS", strlen("WM_PROTOCOLS"), False)) { + #ifdef TEST char *message_data; + #endif x.u.u.type = ClientMessage; x.u.u.detail = X -> xclient.format; @@ -2710,12 +2700,12 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) return 0; } + #ifdef TEST else { message_data = validateString(NameForAtom(x.u.clientMessage.u.l.longs0)); } - #ifdef TEST fprintf(stderr, "nxagentHandleClientMessageEvent: Sent client message of type WM_PROTOCOLS " "and value [%s].\n", message_data); #endif @@ -2757,8 +2747,6 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) if (X -> xclient.window == nxagentIconWindow) { - pScreen = nxagentScreen(X -> xmap.window); - XMapRaised(nxagentDisplay, nxagentFullscreenWindow); XIconifyWindow(nxagentDisplay, nxagentIconWindow, @@ -3125,28 +3113,6 @@ int nxagentCheckWindowConfiguration(XConfigureEvent* X) unsigned int nchildren_return = 0; Status result; - WindowPtr pWin; - - pWin = nxagentWindowPtr(X -> window); - - /* - * This optimization has some problems to - * work in rootless mode inside NXWin. To - * verify this you can launch xterm and - * another application, f.e. firefox. By - * raising xterm above firefox, the stack - * order seems to become incoherent showing - * the underneath window content in the - * overlapping area when the mouse botton is - * pressed with the pointer inside of such area. - * - * if ((pWin != NULL) && X -> override_redirect == 0) - * { - * return 1; - * } - * - */ - if (win == X -> window) { if (x != X -> x || @@ -4091,30 +4057,30 @@ void nxagentSynchronizeExpose(void) { if ((nxagentExposeQueueHead.localRegion) != NullRegion) { - REGION_TRANSLATE(pWin -> drawable.pScreen, (nxagentExposeQueueHead.localRegion), + RegionTranslate((nxagentExposeQueueHead.localRegion), pWin -> drawable.x, pWin -> drawable.y); } if ((nxagentExposeQueueHead.remoteRegion) != NullRegion) { - REGION_TRANSLATE(pWin -> drawable.pScreen, (nxagentExposeQueueHead.remoteRegion), + RegionTranslate((nxagentExposeQueueHead.remoteRegion), pWin -> drawable.x, pWin -> drawable.y); } if ((nxagentExposeQueueHead.localRegion) != NullRegion && (nxagentExposeQueueHead.remoteRegion) != NullRegion) { - REGION_SUBTRACT(pWin -> drawable.pScreen, (nxagentExposeQueueHead.remoteRegion), + RegionSubtract((nxagentExposeQueueHead.remoteRegion), (nxagentExposeQueueHead.remoteRegion), (nxagentExposeQueueHead.localRegion)); - if (REGION_NIL(nxagentExposeQueueHead.remoteRegion) == 0 && + if (RegionNil(nxagentExposeQueueHead.remoteRegion) == 0 && ((pWin -> eventMask|wOtherEventMasks(pWin)) & ExposureMask)) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeExpose: Going to call miWindowExposures" " for window [%ld] - rects [%ld].\n", nxagentWindow(pWin), - REGION_NUM_RECTS(nxagentExposeQueueHead.remoteRegion)); + RegionNumRects(nxagentExposeQueueHead.remoteRegion)); #endif miWindowExposures(pWin, nxagentExposeQueueHead.remoteRegion, NullRegion); @@ -4126,14 +4092,14 @@ void nxagentSynchronizeExpose(void) if (nxagentExposeQueueHead.localRegion != NullRegion) { - REGION_DESTROY(nxagentDefaultScreen, nxagentExposeQueueHead.localRegion); + RegionDestroy(nxagentExposeQueueHead.localRegion); } nxagentExposeQueueHead.localRegion = NullRegion; if (nxagentExposeQueueHead.remoteRegion != NullRegion) { - REGION_DESTROY(nxagentDefaultScreen, nxagentExposeQueueHead.remoteRegion); + RegionDestroy(nxagentExposeQueueHead.remoteRegion); } nxagentExposeQueueHead.remoteRegion = NullRegion; @@ -4260,7 +4226,7 @@ void nxagentInitRemoteExposeRegion(void) { if (nxagentRemoteExposeRegion == NULL) { - nxagentRemoteExposeRegion = REGION_CREATE(pWin -> drawable.pScreen, NULL, 1); + nxagentRemoteExposeRegion = RegionCreate(NULL, 1); if (nxagentRemoteExposeRegion == NULL) { @@ -4273,7 +4239,7 @@ void nxagentInitRemoteExposeRegion(void) void nxagentForwardRemoteExpose(void) { - if (REGION_NOTEMPTY(WindowTable[0] -> drawable.pScreen, nxagentRemoteExposeRegion)) + if (RegionNotEmpty(nxagentRemoteExposeRegion)) { #ifdef DEBUG fprintf(stderr, "nxagentForwardRemoteExpose: Going to forward events.\n"); @@ -4285,7 +4251,7 @@ void nxagentForwardRemoteExpose(void) * Now this region should be empty. */ - REGION_EMPTY(WindowTable[0] -> drawable.pScreen, nxagentRemoteExposeRegion); + RegionEmpty(nxagentRemoteExposeRegion); } } @@ -4298,21 +4264,22 @@ void nxagentAddRectToRemoteExposeRegion(BoxPtr rect) return; } - REGION_INIT(nxagentDefaultScreen, &exposeRegion, rect, 1); + RegionInit(&exposeRegion, rect, 1); - REGION_UNION(nxagentDefaultScreen, nxagentRemoteExposeRegion, + RegionUnion(nxagentRemoteExposeRegion, nxagentRemoteExposeRegion, &exposeRegion); - REGION_UNINIT(nxagentDefaultScreen, &exposeRegion); + RegionUninit(&exposeRegion); } int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr) { RegionPtr exposeRgn; RegionPtr remoteExposeRgn; - BoxRec box; #ifdef DEBUG + BoxRec box; + fprintf(stderr, "nxagentClipAndSendExpose: Called.\n"); #endif @@ -4320,25 +4287,23 @@ int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr) if (pWin -> drawable.class != InputOnly) { - exposeRgn = REGION_CREATE(pWin -> drawable.pScreen, NULL, 1); - - box = *REGION_EXTENTS(pWin->drawable.pScreen, remoteExposeRgn); + exposeRgn = RegionCreate(NULL, 1); #ifdef DEBUG + box = *RegionExtents(remoteExposeRgn); + fprintf(stderr, "nxagentClipAndSendExpose: Root expose extents: [%d] [%d] [%d] [%d].\n", box.x1, box.y1, box.x2, box.y2); - #endif - box = *REGION_EXTENTS(pWin->drawable.pScreen, &pWin -> clipList); + box = *RegionExtents(&pWin -> clipList); - #ifdef DEBUG fprintf(stderr, "nxagentClipAndSendExpose: Clip list extents for window at [%p]: [%d] [%d] [%d] [%d].\n", pWin, box.x1, box.y1, box.x2, box.y2); #endif - REGION_INTERSECT(pWin -> drawable.pScreen, exposeRgn, remoteExposeRgn, &pWin -> clipList); + RegionIntersect(exposeRgn, remoteExposeRgn, &pWin -> clipList); - if (REGION_NOTEMPTY(pWin -> drawable.pScreen, exposeRgn)) + if (RegionNotEmpty(exposeRgn)) { #ifdef DEBUG fprintf(stderr, "nxagentClipAndSendExpose: Forwarding expose to window at [%p] pWin.\n", @@ -4351,15 +4316,15 @@ int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr) * ration must be done before calling it. */ - REGION_SUBTRACT(pWin -> drawable.pScreen, remoteExposeRgn, remoteExposeRgn, exposeRgn); + RegionSubtract(remoteExposeRgn, remoteExposeRgn, exposeRgn); miWindowExposures(pWin, exposeRgn, NullRegion); } - REGION_DESTROY(pWin -> drawable.pScreen, exposeRgn); + RegionDestroy(exposeRgn); } - if (REGION_NOTEMPTY(pWin -> drawable.pScreen, remoteExposeRgn)) + if (RegionNotEmpty(remoteExposeRgn)) { #ifdef DEBUG fprintf(stderr, "nxagentClipAndSendExpose: Region not empty. Walk children.\n"); |