WinWorkstation.st
changeset 5997 5b46d454a2cb
parent 5988 cb0ef88684f9
child 6003 2a2de0c8e157
--- a/WinWorkstation.st	Wed Jan 30 11:44:48 2013 +0100
+++ b/WinWorkstation.st	Wed Jan 30 16:52:29 2013 +0100
@@ -927,6 +927,8 @@
 static wchar_t wapp_namePopup[] = { 'S','T','/','X',':','P','o','p','u','p',0 };
 static wchar_t wapp_nameDialog[] = { 'S','T','/','X',':','D','i','a','l','o','g',0 };
 static int __debug__ = 0;
+
+static int __debug_WM_ALL__ = 0;
 static int __debug_WM_MOUSEENTER__ = 0;
 static int __debug_WM_MOUSELEAVE__ = 0;
 static int __debug_WM_MOUSEMOVE__ = 0;
@@ -6160,11 +6162,22 @@
 !
 
 debug2
+%{  /* NOCONTEXT */
+
+    RETURN ((__debug__ & 2) != 0 ? true : false);
+%}
+!
+
+debug2:aBoolean
     "enable more debug prints - this will vanish"
 
 %{  /* NOCONTEXT */
 
-    __debug__ = 2;
+    if (aBoolean == true) {
+	__debug__ |= 2;
+    } else {
+	__debug__ &= ~2;
+    }
 %}
 !
 
@@ -6182,6 +6195,14 @@
 !
 
 debug:aBoolean message:msg
+    "enable/disable debugging of individual WM messages"
+
+    msg = 'WM_ALL' ifTrue:[
+%{
+	__debug_WM_ALL__ = (aBoolean == true) ? 1 : 0;
+	RETURN (self);
+%}
+    ].
     msg = 'WM_MOUSEENTER' ifTrue:[
 %{
 	__debug_WM_MOUSEENTER__ = (aBoolean == true) ? 1 : 0;
@@ -8685,7 +8706,7 @@
     pendingCREATEWINDOWInfo = &cwi;
     pendingSequenceNr = cwi.sequenceNr;
 
-    if (PostThreadMessage(_dispatchThreadId, WM_THREAD_CREATEWINDOW, cwi.sequenceNr, (INT)(&cwi)) == FALSE) {
+    if (PostThreadMessage(_dispatchThreadId, WM_THREAD_CREATEWINDOW, (INT)(cwi.sequenceNr), (INT)(&cwi)) == FALSE) {
 	console_fprintf(stderr, "WinWorkstation [error]: oops - PostThreadMessage(%x) failed in CreateWindow: err=%d\n",
 					_dispatchThreadId, GetLastError() );
 	free(lI);
@@ -8783,8 +8804,8 @@
 
 #ifndef TOPWINDOWCLASS
     if (xIcon) {
-	SendMessage(newWindowHandle, WM_SETICON, ICON_SMALL, (LPARAM)xIcon);
-	SendMessage(newWindowHandle, WM_SETICON, ICON_BIG, (LPARAM)xIcon);
+	SendMessage(newWindowHandle, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)xIcon);
+	SendMessage(newWindowHandle, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)xIcon);
     }
 #endif
 
@@ -11618,6 +11639,8 @@
     }
 
     switch (ev->ev_message) {
+	    DPRINTFIF((__debug_WM_ALL__) , ("message=%d 0x%x wparam=%"_lx_" hwnd=%"_lx_" arg1=%"_lx_")\n",
+			ev->ev_message, ev->ev_message, (INT)(ev->ev_wParam), (INT)(ev->ev_hWnd), (INT)(ev->ev_arg1)));
 	    case WM_WINDOWPOSCHANGED:
 		{
 		    RECT rct;
@@ -11645,7 +11668,7 @@
 		    HDROP hDrop = (HDROP) ev->ev_wParam;
 		    int   count = DragQueryFile( hDrop,0xffffffff,0,0 );
 
-		    DPRINTFIF(__debug_WM_DROPFILES__ , ("count=%d hDrop=%x\n", count, hDrop));
+		    DPRINTFIF((__debug_WM_DROPFILES__ | __debug_WM_ALL__) , ("count=%d hDrop=%x\n", count, hDrop));
 		    if (count > 0) {
 			OBJ  dropHandle, files, position;
 			char buf[MAXPATH];
@@ -11778,7 +11801,7 @@
 		break;
 
 	    case WM_MOUSEACTIVATE:
-		if (__debug_WM_MOUSEACTIVATE__) {
+		if (__debug_WM_MOUSEACTIVATE__ | __debug_WM_ALL__) {
 		    PRINTF((">>> WM_MOUSEACTIVATE h=%x -> focusInView:\n", ev->ev_hWnd));
 		}
 
@@ -11824,7 +11847,7 @@
 		break;
 
 	    case __WM_NOGEXPOSE:
-		DPRINTFIF(__debug_WM_EXPOSE__, (">>> __WM_NOGEXPOSE -> noExpose\n"));
+		DPRINTFIF((__debug_WM_EXPOSE__ | __debug_WM_ALL__), (">>> __WM_NOGEXPOSE -> noExpose\n"));
 #if 0
 		if (GetWindow_unmapping(hWnd)) {
 		    console_fprintf(stderr, "oops - __WM_NOGEXPOSE for unmapping\n");
@@ -11892,7 +11915,7 @@
 		    ReleaseDC(hWnd, hDC);
 		}
 #endif
-		if (__debug_WM_PAINT__) {
+		if (__debug_WM_PAINT__ | __debug_WM_ALL__) {
 		    PRINTF((">>> WM_PAINT -> expose %d/%d -> %d/%d\n", x, y, w, h));
 		}
 		(*exp.ilc_func)(self,
@@ -12003,7 +12026,7 @@
 		    lastButton = butt;
 		}
 
-		if (__debug_WM_BUTTONUP__ | __debug_WM_BUTTONDOWN__) {
+		if (__debug_WM_BUTTONUP__ | __debug_WM_BUTTONDOWN__ | __debug_WM_ALL__) {
 		    if (__isSymbol(arg)) {
 			PRINTF(("buttonPress/buttonRelease: %s %d/%d\n",
 				    __stringVal(arg), x, y));
@@ -12025,7 +12048,7 @@
 		y = ev->ev_y;
 		state = ev->ev_modifiers;
 
-		if (__debug_WM_MOUSEENTER__) {
+		if (__debug_WM_MOUSEENTER__ | __debug_WM_ALL__) {
 		    PRINTF((">>> WM_MOUSEENTER: %x %d/%d state:%x\n", ev->ev_hWnd, x, y, state));
 		}
 #if 0
@@ -12043,7 +12066,7 @@
 
 	    case __WM_MOUSELEAVE:
 		state = ev->ev_modifiers;
-		if (__debug_WM_MOUSELEAVE__) {
+		if (__debug_WM_MOUSELEAVE__ | __debug_WM_ALL__) {
 		    PRINTF((">>> WM_MOUSELEAVE: %x state:%x\n", ev->ev_hWnd, state));
 		}
 #if 0
@@ -12061,7 +12084,7 @@
 		x = ev->ev_x;
 		y = ev->ev_y;
 		state = ev->ev_modifiers;
-		if (__debug_WM_MOUSEMOVE__) {
+		if (__debug_WM_MOUSEMOVE__ | __debug_WM_ALL__) {
 		    PRINTF((">>> WM_MOUSEMOVE: %d/%d %x\n", x, y, state));
 		}
 		(*mot.ilc_func)(self, @symbol(buttonMotion:x:y:view:),
@@ -12098,7 +12121,7 @@
 #endif
 
 	    case WM_CHAR:
-		DPRINTFIF(__debug_WM_CHAR__  , ("WM_CHAR %x %d/%d\n", ev->ev_keyCode, ev->ev_x, ev->ev_y));
+		DPRINTFIF((__debug_WM_CHAR__ | __debug_WM_ALL__)  , ("WM_CHAR %x %d/%d\n", ev->ev_keyCode, ev->ev_x, ev->ev_y));
 		DPRINTF((">>> WM_CHAR: %d/%d\n", x, y));
 		symS = @symbol(keyPress:x:y:view:);
 		ipS = &skp;
@@ -12117,7 +12140,7 @@
 
 	    case WM_SYSKEYUP:
 	    case WM_KEYUP:
-		DPRINTFIF(__debug_WM_KEYUP__  , (">>> WM_KEYUP / SYSKEYUP: %x %d/%d\n", ev->ev_keyCode, ev->ev_x, ev->ev_y));
+		DPRINTFIF((__debug_WM_KEYUP__ | __debug_WM_ALL__)  , (">>> WM_KEYUP / SYSKEYUP: %x %d/%d\n", ev->ev_keyCode, ev->ev_x, ev->ev_y));
 		symS = @symbol(keyRelease:x:y:view:);
 		ipS = &skr;
 		upDown = false;
@@ -12125,7 +12148,7 @@
 
 	    case WM_SYSKEYDOWN:
 	    case WM_KEYDOWN:
-		DPRINTFIF(__debug_WM_KEYUP__  , (">>> WM_KEYDOWN / SYSKEYDOWN: %x %d/%d\n", ev->ev_keyCode, ev->ev_x, ev->ev_y));
+		DPRINTFIF((__debug_WM_KEYUP__ | __debug_WM_ALL__)  , (">>> WM_KEYDOWN / SYSKEYDOWN: %x %d/%d\n", ev->ev_keyCode, ev->ev_x, ev->ev_y));
 		symS = @symbol(keyPress:x:y:view:);
 		ipS = &skp;
 		upDown = true;
@@ -12345,7 +12368,7 @@
 #if 0
 			    nameBuffer[0] = 0;
 			    GetKeyNameText(ev->ev_scanCode, nameBuffer, sizeof(nameBuffer));
-			    if (__debug_WM_KEYUP__ | __debug_WM_KEYDOWN__ | __debug_WM_CHAR__) {
+			    if (__debug_WM_KEYUP__ | __debug_WM_KEYDOWN__ | __debug_WM_CHAR__ | __debug_WM_ALL__) {
 				PRINTF(("char is <%d>\n", keyCode));
 			    }
 #endif
@@ -12358,7 +12381,7 @@
 		__INST(shiftDown) = (modifiers & ShiftMask) ? true : false;
 		__INST(ctrlDown) = (modifiers & ControlMask) ? true : false;
 
-		if (__debug_WM_CHAR__ | __debug_WM_KEYUP__ | __debug_WM_KEYDOWN__) {
+		if (__debug_WM_CHAR__ | __debug_WM_KEYUP__ | __debug_WM_KEYDOWN__ | __debug_WM_ALL__) {
 		    PRINTF(("%s: code=%x mod=%x ", __stringVal(symS), keyCode, modifiers));
 		    PRINTF((" alt=%d meta=%d ", __INST(altDown) == true , __INST(metaDown) == true));
 		    PRINTF((" sh=%d ctrl=%d", __INST(shiftDown) == true , __INST(ctrlDown) == true));
@@ -17595,7 +17618,7 @@
      Especially useful, if the passed windowID is
      an alien (external) windows id."
 
-%{
+%{  /* NOCONTEXT */
     if (__isExternalAddress(aWindowId)) {
 	HWND win = _HWNDVal(aWindowId);
 	DWORD threadID, processID = 0;
@@ -18082,8 +18105,8 @@
 		}
 	    }
 #else
-	    SendMessage(win, WM_SETICON,ICON_SMALL, (LPARAM)xIcon);
-	    SendMessage(win, WM_SETICON,ICON_BIG, (LPARAM)xIcon);
+	    SendMessage(win, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)xIcon);
+	    SendMessage(win, WM_SETICON, (WPARAM)ICON_BIG, (LPARAM)xIcon);
 #endif
 	}
 	RETURN (self);
@@ -18151,7 +18174,7 @@
 reparentWindow:windowId to:newParentWindowId
     "change a windows parent (an optional interface)"
 
-%{
+%{  /* NOCONTEXT */
     if (__isExternalAddress(windowId)
      && __isExternalAddress(newParentWindowId)) {
 	HWND hWnd = _HWNDVal(windowId);
@@ -18379,7 +18402,7 @@
 
 	if (win == __currentPointerView) {
 #if defined(SET_CURSOR_IN_WINTHREAD)
-	    PostMessage(win, WM_THREAD_SETCURSOR, 0, (INT)_HCURSORVal(aCursorId));
+	    PostMessage(win, WM_THREAD_SETCURSOR, (WPARAM)0, (INT)_HCURSORVal(aCursorId));
 #else
 	    SetCursor(_HCURSORVal(aCursorId));
 #endif
@@ -18608,7 +18631,7 @@
 !
 
 setWindowBorderWidth:aNumber in:aWindowId
-    "set the windows border width.
+    "set a window's border width.
      NOTICE: borderWidths other than 1 are not supported by the win32 version."
 
 %{  /* NOCONTEXT */
@@ -19209,11 +19232,11 @@
 !WinWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.468 2013-01-11 14:33:06 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.469 2013-01-30 15:52:29 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.468 2013-01-11 14:33:06 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.469 2013-01-30 15:52:29 cg Exp $'
 ! !
 
 WinWorkstation initialize!