xserver: Branch 'orib-soc-2006' - 4 commits

Ori Bernstein orib at kemper.freedesktop.org
Fri Jun 9 19:47:44 EEST 2006


 hw/xnest/Events.c             |  232 +++++++++++++++++++++++-------------------
 hw/xnest/GCOps.c              |    8 -
 hw/xwin/winclipboardwndproc.c |   43 +++----
 hw/xwin/wincreatewnd.c        |    6 -
 4 files changed, 153 insertions(+), 136 deletions(-)

New commits:
diff-tree c15aa3a0cf772622e3271015dc53f6822cd9dce9 (from 3aaa4f5bdf27d9e6b1318a01561c0b36831cc1a8)
Author: Ori Bernstein <ori at localhost.(none)>
Date:   Fri Jun 9 12:52:21 2006 -0500

    Removed XCBPeekNextEvent()

diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c
index 804ae47..9c30a18 100644
--- a/hw/xnest/Events.c
+++ b/hw/xnest/Events.c
@@ -72,7 +72,7 @@ static Bool xnestNotExposurePredicate(Di
     return !xnestExposurePredicate(display, event, args);
 }
 
-void xnestCollectExposures()
+/*void xnestCollectExposures()
 {
     XCBGenericEvent *e;
     XCBExposeEvent *evt;
@@ -97,7 +97,7 @@ void xnestCollectExposures()
         }
         e = XCBPeekNextEvent(xnestConnection);
     }
-}
+}*/
 
 void xnestQueueKeyEvent(int type, unsigned int keycode)
 {
@@ -108,122 +108,146 @@ void xnestQueueKeyEvent(int type, unsign
     mieqEnqueue(&x);
 }
 
-void xnestCollectEvents()
+void xnestHandleEvent(XCBGenericEvent *e)
 {
-    XCBGenericEvent *e;
     XCBMotionNotifyEvent *pev;
     XCBEnterNotifyEvent  *eev;
     XCBLeaveNotifyEvent  *lev;    
+    XCBExposeEvent       *xev;
     XCBGenericEvent ev;
     ScreenPtr pScreen;
+    WindowPtr pWin;
+    RegionRec Rgn;
+    BoxRec Box;
 
-    e = XCBPeekNextEvent(xnestConnection);
-    while ((e->response_type & ~0x80) != XCBExpose) {
-        e = XCBWaitForEvent(xnestConnection);
-        switch (e->response_type) {
-            case XCBKeyPress:
-                xnestUpdateModifierState(((XCBKeyPressEvent *)e)->state);
-                xnestQueueKeyEvent(XCBKeyPress, ((XCBKeyPressEvent *)e)->detail.id);
-                break;
-
-            case XCBKeyRelease:
-                xnestUpdateModifierState(((XCBKeyReleaseEvent *)e)->state);
-                xnestQueueKeyEvent(KeyRelease, ((XCBKeyReleaseEvent *)e)->detail.id);
-                break;
-
-            case XCBButtonPress:
-                xnestUpdateModifierState(((XCBButtonPressEvent *)e)->state);
-                ((XCBButtonPressEvent *)e)->time.id = lastEventTime = GetTimeInMillis();
-                memcpy(&ev, e, sizeof(XCBGenericEvent));
-                mieqEnqueue((xEventPtr) &ev);
-                break;
-
-            case XCBButtonRelease:
-                xnestUpdateModifierState(((XCBButtonReleaseEvent *)e)->state);
-                ((XCBButtonReleaseEvent *)e)->time.id = lastEventTime = GetTimeInMillis();
-                memcpy(&ev, e, sizeof(XCBGenericEvent));
-                mieqEnqueue((xEventPtr) &ev);
-                break;
 
-            case XCBMotionNotify:
+    switch (e->response_type & ~0x80) {
+        case XCBKeyPress:
+            xnestUpdateModifierState(((XCBKeyPressEvent *)e)->state);
+            xnestQueueKeyEvent(XCBKeyPress, ((XCBKeyPressEvent *)e)->detail.id);
+            break;
+
+        case XCBKeyRelease:
+            xnestUpdateModifierState(((XCBKeyReleaseEvent *)e)->state);
+            xnestQueueKeyEvent(KeyRelease, ((XCBKeyReleaseEvent *)e)->detail.id);
+            break;
+
+        case XCBButtonPress:
+            xnestUpdateModifierState(((XCBButtonPressEvent *)e)->state);
+            ((XCBButtonPressEvent *)e)->time.id = lastEventTime = GetTimeInMillis();
+            memcpy(&ev, e, sizeof(XCBGenericEvent));
+            mieqEnqueue((xEventPtr) &ev);
+            break;
+
+        case XCBButtonRelease:
+            xnestUpdateModifierState(((XCBButtonReleaseEvent *)e)->state);
+            ((XCBButtonReleaseEvent *)e)->time.id = lastEventTime = GetTimeInMillis();
+            memcpy(&ev, e, sizeof(XCBGenericEvent));
+            mieqEnqueue((xEventPtr) &ev);
+            break;
+
+        case XCBMotionNotify:
 #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);
+            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 
-                pev = (XCBMotionNotifyEvent *)e;
-                miPointerAbsoluteCursor (pev->event_x, pev->event_y,
-                                         lastEventTime = GetTimeInMillis());
-                break;
-
-            case XCBFocusIn:
-                if (((XFocusInEvent *)e)->detail != XCBNotifyDetailInferior) {
-                    pScreen = xnestScreen(((XCBFocusInEvent *)e)->event);
-                    if (pScreen)
-                        xnestDirectInstallColormaps(pScreen);
-                }
-                break;
-
-            case XCBFocusOut:
-                if (((XFocusOutEvent *)e)->detail != XCBNotifyDetailInferior) {
-                    pScreen = xnestScreen(((XCBFocusOutEvent *)e)->event);
-                    if (pScreen)
-                        xnestDirectInstallColormaps(pScreen);
-                }
-                break;
-
-            case XCBKeymapNotify:
-                break;
-
-            case XCBEnterNotify:
-                eev = (XCBEnterNotifyEvent *)e;
-                if (eev->detail != XCBNotifyDetailInferior) {
-                    pScreen = xnestScreen(eev->event);
-                    if (pScreen) {
-                        NewCurrentScreen(pScreen, eev->event_x, eev->event_y);
+            pev = (XCBMotionNotifyEvent *)e;
+            miPointerAbsoluteCursor (pev->event_x, pev->event_y,
+                    lastEventTime = GetTimeInMillis());
+            break;
+
+        case XCBFocusIn:
+            if (((XFocusInEvent *)e)->detail != XCBNotifyDetailInferior) {
+                pScreen = xnestScreen(((XCBFocusInEvent *)e)->event);
+                if (pScreen)
+                    xnestDirectInstallColormaps(pScreen);
+            }
+            break;
+
+        case XCBFocusOut:
+            if (((XFocusOutEvent *)e)->detail != XCBNotifyDetailInferior) {
+                pScreen = xnestScreen(((XCBFocusOutEvent *)e)->event);
+                if (pScreen)
+                    xnestDirectInstallColormaps(pScreen);
+            }
+            break;
+
+        case XCBKeymapNotify:
+            break;
+
+        case XCBEnterNotify:
+            eev = (XCBEnterNotifyEvent *)e;
+            if (eev->detail != XCBNotifyDetailInferior) {
+                pScreen = xnestScreen(eev->event);
+                if (pScreen) {
+                    NewCurrentScreen(pScreen, eev->event_x, eev->event_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);
+                    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 (eev->event_x, eev->event_y, 
-                                                 lastEventTime = GetTimeInMillis());
-                        xnestDirectInstallColormaps(pScreen);
-                    }
+                    miPointerAbsoluteCursor (eev->event_x, eev->event_y, 
+                            lastEventTime = GetTimeInMillis());
+                    xnestDirectInstallColormaps(pScreen);
                 }
-                break;
+            }
+            break;
 
-            case XCBLeaveNotify:
-                lev = (XCBLeaveNotifyEvent *)e;                
-                if (lev->detail != XCBNotifyDetailInferior) {
-                    pScreen = xnestScreen(lev->event);
-                    if (pScreen) {
-                        xnestDirectUninstallColormaps(pScreen);
-                    }	
-                }
-                break;
+        case XCBLeaveNotify:
+            lev = (XCBLeaveNotifyEvent *)e;                
+            if (lev->detail != XCBNotifyDetailInferior) {
+                pScreen = xnestScreen(lev->event);
+                if (pScreen) {
+                    xnestDirectUninstallColormaps(pScreen);
+                }	
+            }
+            break;
+
+        case XCBDestroyNotify:
+            if (xnestParentWindow.xid != (CARD32) 0 &&
+                    ((XCBDestroyNotifyEvent *)e)->event.xid == xnestParentWindow.xid)
+                exit (0);
+            break;
+        case XCBExpose:
+            xev = (XCBExposeEvent *)e;
+            pWin = xnestWindowPtr(xev->window);
+            if (pWin) {
+                Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + xev->x;
+                Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + xev->y;
+                Box.x2 = Box.x1 + xev->width;
+                Box.y2 = Box.y1 + xev->height;
+
+                REGION_INIT(pWin->drawable.pScreen, &Rgn, &Box, 1);
+
+                miWindowExposures(pWin, &Rgn, NullRegion); 
+            }
+            break;
+        case XCBNoExposure:
+        case XCBGraphicsExposure:
+        case XCBCirculateNotify:
+        case XCBConfigureNotify:
+        case XCBGravityNotify:
+        case XCBMapNotify:
+        case XCBReparentNotify:
+        case XCBUnmapNotify:
+            break;
+
+        default:
+            ErrorF("xnest warning: unhandled event %d\n", e->response_type & ~0x80);
+            break;
+    }
+}
 
-            case XCBDestroyNotify:
-                if (xnestParentWindow.xid != (CARD32) 0 &&
-                        ((XCBDestroyNotifyEvent *)e)->event.xid == xnestParentWindow.xid)
-                    exit (0);
-                break;
-
-            case XCBCirculateNotify:
-            case XCBConfigureNotify:
-            case XCBGravityNotify:
-            case XCBMapNotify:
-            case XCBReparentNotify:
-            case XCBUnmapNotify:
-                break;
-
-            default:
-                ErrorF("xnest warning: unhandled event\n");
-                break;
-        }
+void xnestCollectEvents()
+{
+    XCBGenericEvent *e;
+
+    while ((e = XCBPollForEvent(xnestConnection, NULL)) != NULL) {
+        xnestHandleEvent(e);
     }
 }
diff --git a/hw/xnest/GCOps.c b/hw/xnest/GCOps.c
index a49e1da..6dac0c5 100644
--- a/hw/xnest/GCOps.c
+++ b/hw/xnest/GCOps.c
@@ -142,10 +142,7 @@ static RegionPtr xnestBitBlitHelper(GCPt
 
         pending = True;
         while (pending) {
-            event = XCBPeekNextEvent(xnestConnection);
-            if (xnestBitBlitPredicate(event))
-                event = XCBWaitForEvent(xnestConnection);
-
+            event = XCBWaitForEvent(xnestConnection);
             switch (event->response_type) {
                 case XCBNoExposure:
                     pending = False;
@@ -161,6 +158,9 @@ static RegionPtr xnestBitBlitHelper(GCPt
                     REGION_APPEND(pGC->pScreen, pReg, pTmpReg);
                     pending = exp->count;
                     break;
+                default:
+                    xnestHandleEvent(event);
+
             }
         }
 
diff-tree 3aaa4f5bdf27d9e6b1318a01561c0b36831cc1a8 (from parents)
Merge: 2dee7c5fa8c41ac89d437d52502d906c2fb260b0 576e6fb1124a47493371210adf99d6f2076e72c5
Author: Ori Bernstein <ori at localhost.(none)>
Date:   Thu Jun 8 18:44:29 2006 -0500

    Merge branch 'master' of git+ssh://orib@git.freedesktop.org/git/xorg/xserver into orib-soc-2006

diff-tree 576e6fb1124a47493371210adf99d6f2076e72c5 (from d42cf4a2a4980fdd29fb15c4fd8fddda67b36256)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Jun 8 17:49:02 2006 -0400

    Bug #7120: Multimonitor (non-Xinerama) support for xwin servers.
    (Tom Whittock)

diff --git a/hw/xwin/wincreatewnd.c b/hw/xwin/wincreatewnd.c
index 7c93e40..796a085 100644
--- a/hw/xwin/wincreatewnd.c
+++ b/hw/xwin/wincreatewnd.c
@@ -58,6 +58,8 @@ winCreateBoundingWindowFullScreen (Scree
 {
   winScreenPriv(pScreen);
   winScreenInfo		*pScreenInfo = pScreenPriv->pScreenInfo;
+  int			iX = pScreenInfo->dwInitialX;
+  int			iY = pScreenInfo->dwInitialY;
   int			iWidth = pScreenInfo->dwWidth;
   int			iHeight = pScreenInfo->dwHeight;
   HWND			*phwnd = &pScreenPriv->hwndScreen;
@@ -99,8 +101,8 @@ winCreateBoundingWindowFullScreen (Scree
 			    WINDOW_CLASS,	/* Class name */
 			    szTitle,		/* Window name */
 			    WS_POPUP,
-			    0,			/* Horizontal position */
-			    0,			/* Vertical position */
+			    iX,			/* Horizontal position */
+			    iY,			/* Vertical position */
 			    iWidth,		/* Right edge */ 
 			    iHeight,		/* Bottom edge */
 			    (HWND) NULL,	/* No parent or owner window */
diff-tree d42cf4a2a4980fdd29fb15c4fd8fddda67b36256 (from 3930da3f6209312dd0f10aba0b16ef45996a07fe)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Jun 8 17:46:53 2006 -0400

    Bug #7121: fix clipboard handling in Xming (Colin Harrison)

diff --git a/hw/xwin/winclipboardwndproc.c b/hw/xwin/winclipboardwndproc.c
index a006b46..369aac5 100644
--- a/hw/xwin/winclipboardwndproc.c
+++ b/hw/xwin/winclipboardwndproc.c
@@ -35,6 +35,8 @@
 #include <sys/time.h>
 #include "winclipboard.h"
 
+extern void		winFixClipboardChain();
+
 
 /*
  * Constants
@@ -181,28 +183,10 @@ winClipboardWindowProc (HWND hwnd, UINT 
 
     case WM_CHANGECBCHAIN:
       {
-	static Bool s_fProcessingChangeCBChain = FALSE;
 	winDebug ("winClipboardWindowProc - WM_CHANGECBCHAIN: wParam(%x) "
 		  "lParam(%x) s_hwndNextViewer(%x)\n", 
 		  wParam, lParam, s_hwndNextViewer);
 
-
-	/*
-	 * We've occasionally seen a loop in the clipboard chain.  Break
-	 * it on the first hint of recursion.
-	 */
-	if (! s_fProcessingChangeCBChain) 
-	  {
-	    s_fProcessingChangeCBChain = TRUE;
-	  }
-	else
-	  {
-	    winErrorFVerb (1, "winClipboardWindowProc - WM_CHANGECBCHAIN - "
-			   "Nested calls detected.  Bailing.\n");
-	    winDebug ("winClipboardWindowProc - WM_CHANGECBCHAIN: Exit\n");
-	    return 0;
-	  }
-	
 	if ((HWND) wParam == s_hwndNextViewer)
 	  {
 	    s_hwndNextViewer = (HWND) lParam;
@@ -217,7 +201,6 @@ winClipboardWindowProc (HWND hwnd, UINT 
 	  SendMessage (s_hwndNextViewer, message,
 		       wParam, lParam);
 
-	s_fProcessingChangeCBChain = FALSE;
       }
       winDebug ("winClipboardWindowProc - WM_CHANGECBCHAIN: Exit\n");
       return 0;
@@ -274,8 +257,8 @@ winClipboardWindowProc (HWND hwnd, UINT 
 	winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Enter\n");
 
 	/*
-	 * We've occasionally seen a loop in the clipboard chain.  Break
-	 * it on the first hint of recursion.
+	 * We've occasionally seen a loop in the clipboard chain.
+	 * Try and fix it on the first hint of recursion.
 	 */
 	if (! s_fProcessingDrawClipboard) 
 	  {
@@ -283,16 +266,17 @@ winClipboardWindowProc (HWND hwnd, UINT 
 	  }
 	else
 	  {
+	    /* Attempt to break the nesting by getting out of the chain, twice?, and then fix and bail */
+	    s_fCBCInitialized = FALSE;
+	    ChangeClipboardChain (hwnd, s_hwndNextViewer);
+	    winFixClipboardChain();
 	    winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
-			   "Nested calls detected.  Bailing.\n");
+			   "Nested calls detected.  Re-initing.\n");
 	    winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
+	    s_fProcessingDrawClipboard = FALSE;
 	    return 0;
 	  }
 
-	/* Pass the message on the next window in the clipboard viewer chain */
-	if (s_hwndNextViewer)
-	  SendMessage (s_hwndNextViewer, message, 0, 0);
-	
 	/* Bail on first message */
 	if (!s_fCBCInitialized)
 	  {
@@ -318,6 +302,8 @@ winClipboardWindowProc (HWND hwnd, UINT 
 		    "We own the clipboard, returning.\n");
 	    winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
 	    s_fProcessingDrawClipboard = FALSE;
+	    if (s_hwndNextViewer)
+		SendMessage (s_hwndNextViewer, message, wParam, lParam);
 	    return 0;
 	  }
 
@@ -379,6 +365,8 @@ winClipboardWindowProc (HWND hwnd, UINT 
 
 	    winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
 	    s_fProcessingDrawClipboard = FALSE;
+	    if (s_hwndNextViewer)
+		SendMessage (s_hwndNextViewer, message, wParam, lParam);
 	    return 0;
 	  }
 
@@ -422,6 +410,9 @@ winClipboardWindowProc (HWND hwnd, UINT 
 	s_fProcessingDrawClipboard = FALSE;
       }
       winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
+      /* Pass the message on the next window in the clipboard viewer chain */
+      if (s_hwndNextViewer)
+	SendMessage (s_hwndNextViewer, message, wParam, lParam);
       return 0;
 
 



More information about the xorg-commit mailing list