summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2013-08-02 19:22:41 +0100
committerJon TURNEY <jon.turney@dronecode.org.uk>2013-08-02 19:22:41 +0100
commit7a15097ca990ea73fb5d79f7133694f73539b747 (patch)
treec10ecb4df96057d2c65fa0affe464b3fdab60533
parent2c461ca50c4acfca78acedbbae7dfdbc87612c30 (diff)
parent8d9ffa6d6a2354993500110bb8500f7ef219cb28 (diff)
Merge branch 'cygwin-patches-for-1.14' into cygwin-release-1.14xserver-cygwin-1.14.2-2
-rw-r--r--hw/xwin/winmultiwindowwm.c90
-rw-r--r--hw/xwin/winmultiwindowwndproc.c54
-rw-r--r--hw/xwin/winprefs.h3
-rw-r--r--hw/xwin/wmutil/cursor_convert.c11
4 files changed, 70 insertions, 88 deletions
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 7b44a7384..ab096c8fa 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -38,6 +38,16 @@
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
+
+/*
+ * Including any server header might define the macro _XSERVER64 on 64 bit machines.
+ * That macro must _NOT_ be defined for Xlib client code, otherwise bad things happen.
+ * So let's undef that macro if necessary.
+ */
+#ifdef _XSERVER64
+#undef _XSERVER64
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -61,8 +71,6 @@
#include "winwindow.h"
#include "winprefs.h"
#include "window.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
#include "winglobals.h"
#include "winmultiwindowicons.h"
@@ -84,6 +92,7 @@ extern void winUpdateRgnMultiWindow(WindowPtr pWin);
extern void winUpdateIcon(HWND hWnd, Display * pDisplay, Window id, HICON hIconNew);
extern void winSetAuthorization(void);
extern void winGetDisplayName(char *szDisplay, unsigned int screen);
+extern void winUpdateWindowPosition(HWND hWnd, HWND * zstyle);
#ifndef CYGDEBUG
#define CYGDEBUG NO
@@ -204,9 +213,6 @@ static void
static void
winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle);
-void
- winUpdateWindowPosition(HWND hWnd, HWND * zstyle);
-
/*
* Local globals
*/
@@ -536,27 +542,7 @@ IsWmProtocolAvailable(Display * pDisplay, Window iWindow, Atom atmProtocol)
static int
SendXMessage(Display * pDisplay, Window iWin, Atom atmType, long nData)
{
-#ifdef __x86_64__
- union {
- int type;
- struct {
- int type;
- unsigned long serial;
- Bool send_event;
- Display *display;
- unsigned long window;
- unsigned long message_type;
- int format;
- union {
- char b[20];
- short s[10];
- long l[5];
- } data;
- } xclient;
- } e;
-#else
XEvent e;
-#endif
/* Prepare the X event structure */
memset(&e, 0, sizeof(e));
@@ -1986,57 +1972,3 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
("winApplyHints: iWindow 0x%08x hints 0x%08x style 0x%08x exstyle 0x%08x\n",
iWindow, hint, style, exStyle);
}
-
-void
-winUpdateWindowPosition(HWND hWnd, HWND * zstyle)
-{
- int iX, iY, iWidth, iHeight;
- int iDx, iDy;
- RECT rcNew;
- WindowPtr pWin = GetProp(hWnd, WIN_WINDOW_PROP);
- DrawablePtr pDraw = NULL;
-
- if (!pWin)
- return;
- pDraw = &pWin->drawable;
- if (!pDraw)
- return;
-
- /* Get the X and Y location of the X window */
- iX = pWin->drawable.x + GetSystemMetrics(SM_XVIRTUALSCREEN);
- iY = pWin->drawable.y + GetSystemMetrics(SM_YVIRTUALSCREEN);
-
- /* Get the height and width of the X window */
- iWidth = pWin->drawable.width;
- iHeight = pWin->drawable.height;
-
- /* Setup a rectangle with the X window position and size */
- SetRect(&rcNew, iX, iY, iX + iWidth, iY + iHeight);
-
- winDebug("winUpdateWindowPosition - drawable extent (%d, %d)-(%d, %d)\n",
- rcNew.left, rcNew.top, rcNew.right, rcNew.bottom);
-
- AdjustWindowRectEx(&rcNew, GetWindowLongPtr(hWnd, GWL_STYLE), FALSE,
- GetWindowLongPtr(hWnd, GWL_EXSTYLE));
-
- /* Don't allow window decoration to disappear off to top-left as a result of this adjustment */
- if (rcNew.left < GetSystemMetrics(SM_XVIRTUALSCREEN)) {
- iDx = GetSystemMetrics(SM_XVIRTUALSCREEN) - rcNew.left;
- rcNew.left += iDx;
- rcNew.right += iDx;
- }
-
- if (rcNew.top < GetSystemMetrics(SM_YVIRTUALSCREEN)) {
- iDy = GetSystemMetrics(SM_YVIRTUALSCREEN) - rcNew.top;
- rcNew.top += iDy;
- rcNew.bottom += iDy;
- }
-
- winDebug("winUpdateWindowPosition - Window extent (%d, %d)-(%d, %d)\n",
- rcNew.left, rcNew.top, rcNew.right, rcNew.bottom);
-
- /* Position the Windows window */
- SetWindowPos(hWnd, *zstyle, rcNew.left, rcNew.top,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, 0);
-
-}
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index 502292d10..3a0076a7b 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -1197,3 +1197,57 @@ winChildWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
return DefWindowProc(hwnd, message, wParam, lParam);
}
+
+void
+winUpdateWindowPosition(HWND hWnd, HWND * zstyle)
+{
+ int iX, iY, iWidth, iHeight;
+ int iDx, iDy;
+ RECT rcNew;
+ WindowPtr pWin = GetProp(hWnd, WIN_WINDOW_PROP);
+ DrawablePtr pDraw = NULL;
+
+ if (!pWin)
+ return;
+ pDraw = &pWin->drawable;
+ if (!pDraw)
+ return;
+
+ /* Get the X and Y location of the X window */
+ iX = pWin->drawable.x + GetSystemMetrics(SM_XVIRTUALSCREEN);
+ iY = pWin->drawable.y + GetSystemMetrics(SM_YVIRTUALSCREEN);
+
+ /* Get the height and width of the X window */
+ iWidth = pWin->drawable.width;
+ iHeight = pWin->drawable.height;
+
+ /* Setup a rectangle with the X window position and size */
+ SetRect(&rcNew, iX, iY, iX + iWidth, iY + iHeight);
+
+ winDebug("winUpdateWindowPosition - drawable extent (%d, %d)-(%d, %d)\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom);
+
+ AdjustWindowRectEx(&rcNew, GetWindowLongPtr(hWnd, GWL_STYLE), FALSE,
+ GetWindowLongPtr(hWnd, GWL_EXSTYLE));
+
+ /* Don't allow window decoration to disappear off to top-left as a result of this adjustment */
+ if (rcNew.left < GetSystemMetrics(SM_XVIRTUALSCREEN)) {
+ iDx = GetSystemMetrics(SM_XVIRTUALSCREEN) - rcNew.left;
+ rcNew.left += iDx;
+ rcNew.right += iDx;
+ }
+
+ if (rcNew.top < GetSystemMetrics(SM_YVIRTUALSCREEN)) {
+ iDy = GetSystemMetrics(SM_YVIRTUALSCREEN) - rcNew.top;
+ rcNew.top += iDy;
+ rcNew.bottom += iDy;
+ }
+
+ winDebug("winUpdateWindowPosition - Window extent (%d, %d)-(%d, %d)\n",
+ rcNew.left, rcNew.top, rcNew.right, rcNew.bottom);
+
+ /* Position the Windows window */
+ SetWindowPos(hWnd, *zstyle, rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top, 0);
+
+}
diff --git a/hw/xwin/winprefs.h b/hw/xwin/winprefs.h
index a4a6e7eec..352ae3a88 100644
--- a/hw/xwin/winprefs.h
+++ b/hw/xwin/winprefs.h
@@ -34,9 +34,6 @@
/* Need Bool */
#include <X11/Xdefs.h>
-/* Need TRUE */
-#include "misc.h"
-
/* Need to know how long paths can be... */
#include <limits.h>
/* Xwindows redefines PATH_MAX to at least 1024 */
diff --git a/hw/xwin/wmutil/cursor_convert.c b/hw/xwin/wmutil/cursor_convert.c
index 727d83813..157e3a4ea 100644
--- a/hw/xwin/wmutil/cursor_convert.c
+++ b/hw/xwin/wmutil/cursor_convert.c
@@ -84,7 +84,7 @@ winXCursorToHCURSOR(WMUTIL_CURSOR *pCursor)
HDC hDC;
BITMAPV4HEADER bi;
BITMAPINFO *pbmi;
- unsigned long *lpBits;
+ uint32_t *lpBits;
int sm_cx = GetSystemMetrics(SM_CXCURSOR);
int sm_cy = GetSystemMetrics(SM_CYCURSOR);
@@ -144,15 +144,14 @@ winXCursorToHCURSOR(WMUTIL_CURSOR *pCursor)
bi.bV4AlphaMask = 0xFF000000;
lpBits =
- (unsigned long *) calloc(sm_cx *
+ (uint32_t *) calloc(sm_cx *
sm_cy,
- sizeof(unsigned long));
+ sizeof(uint32_t));
if (lpBits) {
int y;
for (y = 0; y < nCY; y++) {
- unsigned long *src, *dst;
-
+ void *src, *dst;
src = &(pCursor->argb[y * pCursor->width]);
dst = &(lpBits[y * sm_cx]);
memcpy(dst, src, 4 * nCX);
@@ -231,7 +230,7 @@ winXCursorToHCURSOR(WMUTIL_CURSOR *pCursor)
pbmiColors[2].rgbReserved = 0;
lpBits =
- (unsigned long *) calloc(sm_cx *
+ (uint32_t *) calloc(sm_cx *
sm_cy, sizeof(char));
pCur = (unsigned char *) lpBits;