]> git.saurik.com Git - wxWidgets.git/commitdiff
Added updated patch, clarified the docs
authorJulian Smart <julian@anthemion.co.uk>
Fri, 21 Dec 2001 14:30:01 +0000 (14:30 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 21 Dec 2001 14:30:01 +0000 (14:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13140 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/microwin/microwindows.patches
docs/microwin/readme.txt

index 34209c58ef2da474093dfcc2bfeb86ff9082078c..ddd99a826c3bec7d5c616665c2463e4bfa000aa4 100644 (file)
@@ -1,16 +1,45 @@
-diff -rbu2 microwin.orig/src/mwin/winevent.c microwin/src/mwin/winevent.c
---- microwin.orig/src/mwin/winevent.c  Sun Nov 26 04:57:52 2000
-+++ microwin/src/mwin/winevent.c       Thu Jul  5 17:08:35 2001
-@@ -166,5 +166,5 @@
+diff -rbu2 ../microwindows-0.89pre8.orig/src/config ./src/config
+--- ../microwindows-0.89pre8.orig/src/config   Fri Dec 21 14:07:18 2001
++++ ./src/config       Fri Dec 21 14:14:37 2001
+@@ -47,7 +47,7 @@
+ #
+ ####################################################################
+-OPTIMIZE                 = Y
+-DEBUG                    = N
+-VERBOSE                  = N
++OPTIMIZE                 = N
++DEBUG                    = Y
++VERBOSE                  = Y
+ ####################################################################
+@@ -191,5 +191,5 @@
+ #
+ ####################################################################
+-ERASEMOVE                = Y
++ERASEMOVE                = N
+ UPDATEREGIONS            = Y
+@@ -216,5 +216,5 @@
+ # X Window screen, mouse and kbd drivers
+-X11                      = N
++X11                      = Y
+ ifeq ($(X11), Y)
+diff -rbu2 ../microwindows-0.89pre8.orig/src/mwin/winevent.c ./src/mwin/winevent.c
+--- ../microwindows-0.89pre8.orig/src/mwin/winevent.c  Fri Dec 21 14:07:21 2001
++++ ./src/mwin/winevent.c      Fri Dec 21 14:10:59 2001
+@@ -167,5 +167,5 @@
  
        /* then possibly send user mouse message*/
 -      if(hittest == HTCLIENT) {
 +      if(hittest == HTCLIENT || hwnd == GetCapture()) {
                pt.x = cursorx;
                pt.y = cursory;
-diff -rbu2 microwin.orig/src/mwin/winuser.c microwin/src/mwin/winuser.c
---- microwin.orig/src/mwin/winuser.c   Wed Jul  5 01:36:42 2000
-+++ microwin/src/mwin/winuser.c        Mon Jul  2 13:11:51 2001
+Only in ./src/mwin: winevent.c~
+diff -rbu2 ../microwindows-0.89pre8.orig/src/mwin/winuser.c ./src/mwin/winuser.c
+--- ../microwindows-0.89pre8.orig/src/mwin/winuser.c   Fri Dec 21 14:07:21 2001
++++ ./src/mwin/winuser.c       Fri Dec 21 14:10:59 2001
 @@ -137,7 +137,11 @@
  }
  
index 457c73ed585774ce2764826a973cddde1d3648a4..8cd81015a8b20825be82fbe775b52aa3613ee708 100644 (file)
@@ -37,10 +37,18 @@ MicroWindows:
   DEBUG=Y
   VERBOSE=Y
 
+  Note: these are already applied by the patch below.
+
 - apply microwindows.patches (from wxWindows:
   docs/microwin/microwindows.patches) to fix PeekMessage
   and other issues. If the patch doesn't apply automatically,
-  you may need to apply it by hand
+  you may need to apply it by hand, and the relevant changed
+  functions are given at the end of this file for convenience.
+
+  Example patch command:
+
+  % cd microwindows-0.89pre8.orig
+  % patch -p0 < ~/wx2/docs/microwin/microwindows.patches
 
 - compile by typing 'make' from within the MicroWindows src directory
 
@@ -114,3 +122,139 @@ No ::GetObject so we can't get LOGFONT from an HFONT
 in wxSystemSettings (worked around by passing HFONT to
 the wxFont constructor).
 
+
+Applying patches by hand
+========================
+
+The full altered functions are given below in case you have
+to apply them by hand.
+
+src/mwin/winevent.c
+-------------------
+
+A second test has been added to this line:
+
+       if(hittest == HTCLIENT || hwnd == GetCapture()) {
+
+in MwTranslateMouseMessage below. This corrects a mouse message
+bug.
+
+/*
+ * Translate and deliver hardware mouse message to proper window.
+ */
+void
+MwTranslateMouseMessage(HWND hwnd,UINT msg,int hittest)
+{
+       POINT           pt;
+       DWORD           tick;
+       static UINT     lastmsg = 0;
+       static HWND     lasthwnd;
+       static DWORD    lasttick;
+       static int      lastx, lasty;
+
+       /* determine double click eligibility*/
+       if(msg == WM_LBUTTONDOWN || msg == WM_RBUTTONDOWN) {
+               tick = GetTickCount();
+               if((hwnd->pClass->style & CS_DBLCLKS) &&
+                   msg == lastmsg && hwnd == lasthwnd &&
+                   tick - lasttick < DBLCLICKSPEED &&
+                   abs(cursorx-lastx) < mwSYSMETRICS_CXDOUBLECLK &&
+                   abs(cursory-lasty) < mwSYSMETRICS_CYDOUBLECLK)
+                       msg += (WM_LBUTTONDBLCLK - WM_LBUTTONDOWN);
+               lastmsg = msg;
+               lasthwnd = hwnd;
+               lasttick = tick;
+               lastx = cursorx;
+               lasty = cursory;
+       }
+
+       /*
+        * We always send nc mouse message
+        * unlike Windows, for HTCLIENT default processing
+        */
+       PostMessage(hwnd, msg + (WM_NCMOUSEMOVE-WM_MOUSEMOVE), hittest,
+               MAKELONG(cursorx, cursory));
+
+       /* then possibly send user mouse message*/
+       if(hittest == HTCLIENT || hwnd == GetCapture()) {
+               pt.x = cursorx;
+               pt.y = cursory;
+               ScreenToClient(hwnd, &pt);
+               PostMessage(hwnd, msg, 0, MAKELONG(pt.x, pt.y));
+       }
+}
+
+winuser.c
+---------
+
+Part of PeekMessage has been factored out into PeekMessageHelper,
+and used in PeekMessage and GetMessage. The three relevant functions
+are:
+
+/*
+ * A helper function for sharing code between PeekMessage and GetMessage
+ */
+
+BOOL WINAPI
+PeekMessageHelper(LPMSG lpMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
+       UINT wRemoveMsg, BOOL returnIfEmptyQueue)
+{
+       HWND    wp;
+       PMSG    pNxtMsg;
+
+       /* check if no messages in queue*/
+       if(mwMsgHead.head == NULL) {
+                /* Added by JACS so it doesn't reach MwSelect */
+                if (returnIfEmptyQueue)
+                    return FALSE;
+
+#if PAINTONCE
+               /* check all windows for pending paint messages*/
+               for(wp=listwp; wp; wp=wp->next) {
+                       if(!(wp->style & WS_CHILD)) {
+                               if(chkPaintMsg(wp, lpMsg))
+                                       return TRUE;
+                       }
+               }
+               for(wp=listwp; wp; wp=wp->next) {
+                       if(wp->style & WS_CHILD) {
+                               if(chkPaintMsg(wp, lpMsg))
+                                       return TRUE;
+                       }
+               }
+#endif
+               MwSelect();
+       }
+
+       if(mwMsgHead.head == NULL)
+               return FALSE;
+
+       pNxtMsg = (PMSG)mwMsgHead.head;
+       if(wRemoveMsg & PM_REMOVE)
+               GdListRemove(&mwMsgHead, &pNxtMsg->link);
+       *lpMsg = *pNxtMsg;
+       if(wRemoveMsg & PM_REMOVE)
+               GdItemFree(pNxtMsg);
+       return TRUE;
+}
+
+BOOL WINAPI
+PeekMessage(LPMSG lpMsg, HWND hwnd, UINT uMsgFilterMin, UINT uMsgFilterMax,
+       UINT wRemoveMsg)
+{
+        /* Never wait in MwSelect: pass TRUE */
+        return PeekMessageHelper(lpMsg, hwnd, uMsgFilterMin, uMsgFilterMax, wRemoveMsg, TRUE);
+}
+
+BOOL WINAPI
+GetMessage(LPMSG lpMsg,HWND hwnd,UINT wMsgFilterMin,UINT wMsgFilterMax)
+{
+       /*
+        * currently MwSelect() must poll for VT switch reasons,
+        * so this code will work
+        */
+        /* Always wait in MwSelect if there are messages: pass FALSE */
+       while(!PeekMessageHelper(lpMsg, hwnd, wMsgFilterMin, wMsgFilterMax,PM_REMOVE, FALSE))
+               continue;
+       return lpMsg->message != WM_QUIT;
+}