[Xorg-commit] xc/programs/Xserver/hw/xwin winmultiwindowwndproc.c,1.1.6.2,1.1.6.3 winprefs.c,1.1.6.1,1.1.6.2 winprefs.h,1.1.6.1,1.1.6.2 winwndproc.c,1.1.4.1.2.7,1.1.4.1.2.8

Takuma Murakami xorg-commit at pdx.freedesktop.org
Wed May 9 17:30:30 EEST 2007


Committed by: takuma

Update of /cvs/xorg/xc/programs/Xserver/hw/xwin
In directory pdx:/tmp/cvs-serv24495

Modified Files:
      Tag: CYGWIN
	winmultiwindowwndproc.c winprefs.c winprefs.h winwndproc.c 
Log Message:
Stop passing customized menus to DefWindowProc.  Although it does not cause visible problems so far, it should be inhibited.
Apply a mask, which is described in MSDN, for wParam in winTopLevelWindowProc/WM_SYSCOMMAND handler.


Index: winmultiwindowwndproc.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winmultiwindowwndproc.c,v
retrieving revision 1.1.6.2
retrieving revision 1.1.6.3
diff -u -d -r1.1.6.2 -r1.1.6.3
--- winmultiwindowwndproc.c	27 Jan 2004 05:39:29 -0000	1.1.6.2
+++ winmultiwindowwndproc.c	17 Feb 2004 06:26:16 -0000	1.1.6.3
@@ -387,23 +387,30 @@
       /*
        * Any window menu items go through here
        */
-      /* If minimizing then remove always-on-top, and store the setting */
-      if (wParam == SC_MINIMIZE)
+      switch (wParam & 0xFFF0) /* See MSDN for the magic number 0xFFF0 */
 	{
+	case SC_MINIMIZE:
+	  /* If minimizing then remove always-on-top, and store the setting */
 	  if (GetWindowLong (hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
 	    pWinPriv->fAlwaysOnTop = TRUE;
 	  else
 	    pWinPriv->fAlwaysOnTop = FALSE;
 	  SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 0, 0,
 		       SWP_NOMOVE|SWP_NOSIZE);
-	}
-      else if (wParam == SC_RESTORE)
-	{
+	  break;
+
+	case SC_RESTORE:
 	  if (pWinPriv->fAlwaysOnTop)
 	    SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
 			 SWP_NOMOVE|SWP_NOSIZE);
+	  break;
+
+	default:
+	  if (HandleCustomWM_COMMAND ((unsigned long)hwnd, LOWORD(wParam)))
+	    /* Don't pass customized menus to DefWindowProc */
+	    return 0;
+	  break;
 	}
-      HandleCustomWM_COMMAND ((unsigned long)hwnd, LOWORD(wParam));
       break;
 
     case WM_INITMENU:

Index: winprefs.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winprefs.c,v
retrieving revision 1.1.6.1
retrieving revision 1.1.6.2
diff -u -d -r1.1.6.1 -r1.1.6.2
--- winprefs.c	9 Dec 2003 01:37:16 -0000	1.1.6.1
+++ winprefs.c	17 Feb 2004 06:26:17 -0000	1.1.6.2
@@ -284,9 +284,10 @@
 }
     
 /*
- * Searches for the custom WM_COMMAND command ID and performs action
+ * Searches for the custom WM_COMMAND command ID and performs action.
+ * Return TRUE if command is proccessed, FALSE otherwise.
  */
-int
+Bool
 HandleCustomWM_COMMAND (unsigned long hwndIn,
 			int           command)
 {
@@ -298,7 +299,7 @@
   hwnd = (HWND)hwndIn;
 
   if (!command)
-    return 0;
+    return FALSE;
 
   for (i=0; i<pref.menuItems; i++)
     {
@@ -332,12 +333,12 @@
 		      exit (0);
 		    }
 		  else
-		    return 0;
+		    return TRUE;
 		  break;
 		  
 		case CMD_ALWAYSONTOP:
 		  if (!hwnd)
-		    return 0;
+		    return FALSE;
 
 		  /* Get extended window style */
 		  dwExStyle = GetWindowLong (hwnd, GWL_EXSTYLE);
@@ -355,20 +356,20 @@
 				  0, 0,
 				  0, 0,
 				  SWP_NOSIZE | SWP_NOMOVE);
-		  return 0;
+		  return TRUE;
 		  
 		case CMD_RELOAD:
 		  ReloadPrefs();
-		  return 0;
+		  return TRUE;
 
 		default:
-		  return 0;
+		  return FALSE;
 	      }
 	    } /* match */
 	} /* for j */
     } /* for i */
 
-  return 0;
+  return FALSE;
 }
 
 

Index: winprefs.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winprefs.h,v
retrieving revision 1.1.6.1
retrieving revision 1.1.6.2
diff -u -d -r1.1.6.1 -r1.1.6.2
--- winprefs.h	9 Dec 2003 01:37:16 -0000	1.1.6.1
+++ winprefs.h	17 Feb 2004 06:26:17 -0000	1.1.6.2
@@ -132,7 +132,7 @@
 HandleCustomWM_INITMENU(unsigned long hwndIn,
 			unsigned long hmenuIn);
 
-int
+Bool
 HandleCustomWM_COMMAND (unsigned long hwndIn,
 			int           command);
 

Index: winwndproc.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winwndproc.c,v
retrieving revision 1.1.4.1.2.7
retrieving revision 1.1.4.1.2.8
diff -u -d -r1.1.4.1.2.7 -r1.1.4.1.2.8
--- winwndproc.c	11 Jan 2004 07:39:03 -0000	1.1.4.1.2.7
+++ winwndproc.c	17 Feb 2004 06:26:17 -0000	1.1.4.1.2.8
@@ -1069,7 +1069,8 @@
 
 	default:
 	  /* It's probably one of the custom menus... */
-	  return HandleCustomWM_COMMAND (0, LOWORD (wParam));
+	  if (HandleCustomWM_COMMAND (0, LOWORD (wParam)))
+	    return 0;
 	}
       break;
 





More information about the xorg-commit mailing list