aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike DePaulo <mikedep333@gmail.com>2015-06-26 18:42:05 -0400
committerMike DePaulo <mikedep333@gmail.com>2015-06-26 18:42:05 -0400
commit32429ba985b889094019f23cf92bacb085594dcf (patch)
treee6be5f24e66b0ad4533740108212794f3f0f5e51
parentc444d863af5375fb247944886b6970175d0e4665 (diff)
downloadvcxsrv-32429ba985b889094019f23cf92bacb085594dcf.tar.gz
vcxsrv-32429ba985b889094019f23cf92bacb085594dcf.tar.bz2
vcxsrv-32429ba985b889094019f23cf92bacb085594dcf.zip
A new version of winmultiwindow.patch from Ionic.
I forget the test results, but we are thinking that the patch is an entirely bad idea and should be be completely dropped.
-rwxr-xr-xxorg-server/hw/xwin/winmultiwindowwindow.c88
1 files changed, 87 insertions, 1 deletions
diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c
index 850edc149..10fdd54f0 100755
--- a/xorg-server/hw/xwin/winmultiwindowwindow.c
+++ b/xorg-server/hw/xwin/winmultiwindowwindow.c
@@ -107,6 +107,7 @@ winCreateWindowMultiWindow(WindowPtr pWin)
winDebug ("winCreateWindowMultiWindow - pWin: %p\n", pWin);
#endif
+
WIN_UNWRAP(CreateWindow);
fResult = (*pScreen->CreateWindow) (pWin);
WIN_WRAP(CreateWindow, winCreateWindowMultiWindow);
@@ -319,6 +320,7 @@ winUnmapWindowMultiWindow(WindowPtr pWin)
winDebug ("winUnmapWindowMultiWindow - pWin: %p\n", pWin);
#endif
+
WIN_UNWRAP(UnrealizeWindow);
fResult = (*pScreen->UnrealizeWindow) (pWin);
WIN_WRAP(UnrealizeWindow, winUnmapWindowMultiWindow);
@@ -364,6 +366,7 @@ winMapWindowMultiWindow(WindowPtr pWin)
winReshapeMultiWindow(pWin);
winUpdateRgnMultiWindow(pWin);
+
return fResult;
}
@@ -908,16 +911,25 @@ winAdjustXWindow(WindowPtr pWin, HWND hwnd)
{
RECT rcDraw; /* Rect made from pWin->drawable to be adjusted */
RECT rcWin; /* The source: WindowRect from hwnd */
+ RECT new_size; /* Structure holding a new window size, in case
+ * the window exceeds visible limits. */
DrawablePtr pDraw;
XID vlist[4];
LONG dX, dY, dW, dH, x, y;
DWORD dwStyle, dwExStyle;
+ int ret, need_resize;
+ HMONITOR currentMonitor;
+ MONITORINFO monitorInfo;
+ LONG_PTR old_style, old_ex_style;
+
#define WIDTH(rc) (rc.right - rc.left)
#define HEIGHT(rc) (rc.bottom - rc.top)
winDebug("winAdjustXWindow\n");
+
+
if (IsIconic(hwnd)) {
winDebug("\timmediately return because the window is iconized\n");
/*
@@ -941,13 +953,17 @@ winAdjustXWindow(WindowPtr pWin, HWND hwnd)
dwExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
winDebug("\tWindowStyle: %08x %08x\n", dwStyle, dwExStyle);
+
AdjustWindowRectEx(&rcDraw, dwStyle, FALSE, dwExStyle);
/* The source of adjust */
GetWindowRect(hwnd, &rcWin);
+
winDebug("\tWindow extend {%d, %d, %d, %d}, {%d, %d}\n",
rcWin.left, rcWin.top, rcWin.right, rcWin.bottom,
rcWin.right - rcWin.left, rcWin.bottom - rcWin.top);
+
+
winDebug("\tDraw extend {%d, %d, %d, %d}, {%d, %d}\n",
rcDraw.left, rcDraw.top, rcDraw.right, rcDraw.bottom,
rcDraw.right - rcDraw.left, rcDraw.bottom - rcDraw.top);
@@ -976,9 +992,79 @@ winAdjustXWindow(WindowPtr pWin, HWND hwnd)
vlist[3] = pDraw->height + dH;
winDebug("\tConfigureWindow to (%ld, %ld) - %ldx%ld\n", vlist[0], vlist[1],
vlist[2], vlist[3]);
- return ConfigureWindow(pWin, CWX | CWY | CWWidth | CWHeight,
+
+ ret=ConfigureWindow(pWin, CWX | CWY | CWWidth | CWHeight,
vlist, wClient(pWin));
+
+ currentMonitor=MonitorFromWindow(hwnd,MONITOR_DEFAULTTONULL);
+ if(!currentMonitor)
+ {
+ return ret;
+ }
+ monitorInfo.cbSize=sizeof ( MONITORINFO );
+ if(!GetMonitorInfo(currentMonitor, &monitorInfo))
+ {
+ return ret;
+ }
+
+ need_resize = 0;
+ if (rcWin.left <= monitorInfo.rcWork.left) {
+ new_size.left = monitorInfo.rcWork.left;
+ need_resize = 1;
+ }
+ else {
+ new_size.left = rcWin.left;
+ }
+
+ if (rcWin.top <= monitorInfo.rcWork.top) {
+ new_size.top = monitorInfo.rcWork.top;
+ need_resize = 1;
+ }
+ else {
+ new_size.top = rcWin.top;
+ }
+
+ if (rcWin.right > monitorInfo.rcWork.right) {
+ new_size.right = monitorInfo.rcWork.right;
+ need_resize = 1;
+ }
+ else {
+ new_size.right = rcWin.right;
+ }
+
+ if (rcWin.bottom > monitorInfo.rcWork.bottom) {
+ new_size.bottom = monitorInfo.rcWork.bottom;
+ need_resize = 1;
+ }
+ else {
+ new_size.bottom = rcWin.bottom;
+ }
+
+ if (need_resize)
+ {
+ old_style = GetWindowLongPtr (hwnd, GWL_STYLE);
+ old_ex_style = GetWindowLongPtr (hwnd, GWL_EXSTYLE);
+
+ if (!old_style || !old_ex_style) {
+ return ret;
+ }
+
+ SetWindowLongPtr(hwnd, GWL_STYLE,
+ WS_VISIBLE | old_style);
+
+ SetWindowLongPtr(hwnd, GWL_EXSTYLE,
+ old_ex_style);
+
+ SetWindowPos ( hwnd, HWND_TOPMOST, new_size.left,
+ new_size.top,
+ new_size.right - new_size.left,
+ new_size.bottom - new_size.top,
+ SWP_DRAWFRAME | SWP_SHOWWINDOW);
+ }
+
+ return ret;
+
#undef WIDTH
#undef HEIGHT
}