[Xorg-commit] xc/programs/Xserver/hw/xwin windialogs.c,1.1.6.1,1.1.6.2 winmultiwindowwindow.c,1.1.4.1.2.4,1.1.4.1.2.5 winmultiwindowwndproc.c,1.1.6.1,1.1.6.2 winwindow.h,1.1.4.1.2.3,1.1.4.1.2.4

Harold L Hunt II xorg-commit at pdx.freedesktop.org
Tue Jan 27 07:39:31 EET 2004


Committed by: harold

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

Modified Files:
      Tag: CYGWIN
	windialogs.c winmultiwindowwindow.c winmultiwindowwndproc.c 
	winwindow.h 
Log Message:
Two patches from Earle F. Philhower III: Centering of dialog boxes and fix for Always On Top in Multi-Window Mode.

Index: windialogs.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/windialogs.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
--- windialogs.c	2 Dec 2003 02:46:18 -0000	1.1.6.1
+++ windialogs.c	27 Jan 2004 05:39:29 -0000	1.1.6.2
@@ -43,6 +43,36 @@
 
 
 /*
+ * Center a dialog window in the desktop window
+ */
+static void
+winCenterDialog (HWND hwndDlg)
+{
+  HWND hwndDesk; 
+  RECT rc, rcDlg, rcDesk; 
+ 
+  hwndDesk = GetParent (hwndDlg);
+  if (!hwndDesk)
+    hwndDesk = GetDesktopWindow (); 
+  
+  GetWindowRect (hwndDesk, &rcDesk); 
+  GetWindowRect (hwndDlg, &rcDlg); 
+  CopyRect (&rc, &rcDesk); 
+  
+  OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top); 
+  OffsetRect (&rc, -rc.left, -rc.top); 
+  OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom); 
+  
+  SetWindowPos (hwndDlg, 
+		HWND_TOP, 
+		rcDesk.left + (rc.right / 2), 
+		rcDesk.top + (rc.bottom / 2), 
+		0, 0,
+		SWP_NOSIZE | SWP_NOZORDER); 
+}
+
+
+/*
  * Display the Exit dialog box
  */
 
@@ -110,6 +140,8 @@
       s_pScreenInfo = s_pScreenPriv->pScreenInfo;
       s_pScreen = s_pScreenInfo->pScreen;
 
+      winCenterDialog( hDialog );
+
       /* Set icon to standard app icon */
       PostMessage (hDialog,
 		   WM_SETICON,
@@ -258,6 +290,8 @@
 	      s_pScreenInfo->dwBPP,
 	      s_pScreenPriv->dwLastWindowsBitsPixel);
 #endif
+      
+      winCenterDialog( hwndDialog );
 
       /* Set icon to standard app icon */
       PostMessage (hwndDialog,

Index: winmultiwindowwindow.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winmultiwindowwindow.c,v
retrieving revision 1.1.4.1.2.4
retrieving revision 1.1.4.1.2.5
diff -u -d -r1.1.4.1.2.4 -r1.1.4.1.2.5
--- winmultiwindowwindow.c	13 Jan 2004 01:08:37 -0000	1.1.4.1.2.4
+++ winmultiwindowwindow.c	27 Jan 2004 05:39:29 -0000	1.1.4.1.2.5
@@ -105,7 +105,8 @@
   pWinPriv->pScreenPriv = winGetScreenPriv(pWin->drawable.pScreen);
   pWinPriv->fXKilled = FALSE;
   pWinPriv->fNeedRestore = FALSE;
-  
+  pWinPriv->fAlwaysOnTop = FALSE;
+ 
   return fResult;
 }
 

Index: winmultiwindowwndproc.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winmultiwindowwndproc.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
--- winmultiwindowwndproc.c	9 Dec 2003 01:37:16 -0000	1.1.6.1
+++ winmultiwindowwndproc.c	27 Jan 2004 05:39:29 -0000	1.1.6.2
@@ -387,6 +387,22 @@
       /*
        * Any window menu items go through here
        */
+      /* If minimizing then remove always-on-top, and store the setting */
+      if (wParam == SC_MINIMIZE)
+	{
+	  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)
+	{
+	  if (pWinPriv->fAlwaysOnTop)
+	    SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
+			 SWP_NOMOVE|SWP_NOSIZE);
+	}
       HandleCustomWM_COMMAND ((unsigned long)hwnd, LOWORD(wParam));
       break;
 
@@ -893,7 +909,7 @@
 	if (s_pScreenPriv != NULL)
 	  s_pScreenPriv->fWindowOrderChanged = TRUE;
       }
-      return 0;
+      break;
 
     case WM_SIZE:
       /* see dix/window.c */

Index: winwindow.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winwindow.h,v
retrieving revision 1.1.4.1.2.3
retrieving revision 1.1.4.1.2.4
diff -u -d -r1.1.4.1.2.3 -r1.1.4.1.2.4
--- winwindow.h	15 Jan 2004 21:20:30 -0000	1.1.4.1.2.3
+++ winwindow.h	27 Jan 2004 05:39:29 -0000	1.1.4.1.2.4
@@ -75,6 +75,7 @@
   Bool			fXKilled;
   Bool                  fNeedRestore;
   POINT                 ptRestore;
+  Bool                  fAlwaysOnTop;
 
   /* Privates used by primary fb DirectDraw server */
   LPDDSURFACEDESC	pddsdPrimary;





More information about the xorg-commit mailing list