aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winmultiwindowwindow.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-07-12 18:20:04 +0000
committermarha <marha@users.sourceforge.net>2009-07-12 18:20:04 +0000
commitda8fe31a7ba4acf109097d5696ad0145b991cdfd (patch)
tree1c74d6f075702a73e557872f2a6f020ea4eb5432 /xorg-server/hw/xwin/winmultiwindowwindow.c
parent6590f805a12779909cb8504c230fa367148fe38c (diff)
parent529dcfd0858d75cb3c87c73cb0f81dd20bbb9230 (diff)
downloadvcxsrv-da8fe31a7ba4acf109097d5696ad0145b991cdfd.tar.gz
vcxsrv-da8fe31a7ba4acf109097d5696ad0145b991cdfd.tar.bz2
vcxsrv-da8fe31a7ba4acf109097d5696ad0145b991cdfd.zip
Changes for VC compilation
Diffstat (limited to 'xorg-server/hw/xwin/winmultiwindowwindow.c')
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwindow.c53
1 files changed, 34 insertions, 19 deletions
diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c
index 037c881b4..c3972013c 100644
--- a/xorg-server/hw/xwin/winmultiwindowwindow.c
+++ b/xorg-server/hw/xwin/winmultiwindowwindow.c
@@ -1,5 +1,6 @@
/*
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *Copyright (C) Colin Harrison 2005-2008
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -28,6 +29,7 @@
* Authors: Kensuke Matsuzaki
* Earle F. Philhower, III
* Harold L Hunt II
+ * Colin Harrison
*/
#ifdef HAVE_XWIN_CONFIG_H
@@ -63,13 +65,6 @@ static void
winFindWindow (pointer value, XID id, pointer cdata);
/*
- * Constant defines
- */
-
-#define MOUSE_POLLING_INTERVAL 500
-
-
-/*
* Macros
*/
@@ -486,6 +481,7 @@ winCreateWindowsWindow (WindowPtr pWin)
int iWidth;
int iHeight;
HWND hWnd;
+ HWND hFore = NULL;
WNDCLASSEX wc;
winWindowPriv(pWin);
HICON hIcon;
@@ -496,6 +492,7 @@ winCreateWindowsWindow (WindowPtr pWin)
static int s_iWindowID = 0;
winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
WinXSizeHints hints;
+ WindowPtr pDaddy;
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winCreateWindowsWindow - pWin: %08x\n", pWin);
@@ -504,20 +501,16 @@ winCreateWindowsWindow (WindowPtr pWin)
iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
- /* Default positions if none specified */
- if (!winMultiWindowGetWMNormalHints(pWin, &hints))
- hints.flags = 0;
- if ( !(hints.flags & (USPosition|PPosition)) &&
- !winMultiWindowGetTransientFor (pWin, NULL) &&
- !pWin->overrideRedirect )
- {
- iX = CW_USEDEFAULT;
- iY = CW_USEDEFAULT;
- }
-
iWidth = pWin->drawable.width;
iHeight = pWin->drawable.height;
+ /* ensure window actually ends up somewhere visible */
+ if (iX > GetSystemMetrics (SM_CXVIRTUALSCREEN))
+ iX = CW_USEDEFAULT;
+
+ if (iY > GetSystemMetrics (SM_CYVIRTUALSCREEN))
+ iY = CW_USEDEFAULT;
+
winSelectIcons(pWin, &hIcon, &hIconSmall);
/* Set standard class name prefix so we can identify window easily */
@@ -570,6 +563,28 @@ winCreateWindowsWindow (WindowPtr pWin)
wc.lpszClassName = pszClass;
RegisterClassEx (&wc);
+ if (!pWin->overrideRedirect)
+ {
+ if (winMultiWindowGetTransientFor (pWin, &pDaddy))
+ {
+ if (pDaddy)
+ {
+ hFore = GetForegroundWindow();
+ if (hFore && (pDaddy != (WindowPtr)GetProp(hFore, WIN_WID_PROP))) hFore = NULL;
+ }
+ }
+ else
+ {
+ /* Default positions if none specified */
+ if (!winMultiWindowGetWMNormalHints(pWin, &hints)) hints.flags = 0;
+ if (!(hints.flags & (USPosition|PPosition)))
+ {
+ iX = CW_USEDEFAULT;
+ iY = CW_USEDEFAULT;
+ }
+ }
+ }
+
/* Create the window */
/* Make it OVERLAPPED in create call since WS_POPUP doesn't support */
/* CW_USEDEFAULT, change back to popup after creation */
@@ -581,7 +596,7 @@ winCreateWindowsWindow (WindowPtr pWin)
iY, /* Vertical position */
iWidth, /* Right edge */
iHeight, /* Bottom edge */
- (HWND) NULL, /* No parent or owner window */
+ hFore, /* Null or Parent window if transient*/
(HMENU) NULL, /* No menu */
GetModuleHandle (NULL), /* Instance handle */
pWin); /* ScreenPrivates */