From 561bca469d3ade1ff14faddaf70bf12dcdc6aa74 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Thu, 13 Mar 2014 22:38:43 +0000 Subject: [PATCH 01/13] hw/xwin: Fix const discarded warning in winGenerateAuthorization() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix const discarded warning in winGenerateAuthorization() in !XCSECURITY case In function ‘winGenerateAuthorization’: hw/xwin/winauth.c:123:38: warning: passing argument 2 of ‘GenerateAuthorization’ discards ‘const’ qualifier from pointer target type [enabled by default] hw/xwin/winauth.c:99:1: note: expected ‘char *’ but argument is of type ‘const char *’ Signed-off-by: Jon TURNEY Reviewed-by: Colin Harrison --- hw/xwin/winauth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xwin/winauth.c b/hw/xwin/winauth.c index a6a7366a4..7efa1c00f 100644 --- a/hw/xwin/winauth.c +++ b/hw/xwin/winauth.c @@ -97,9 +97,9 @@ MitGenerateCookie(unsigned data_length, static XID GenerateAuthorization(unsigned name_length, - char *name, + const char *name, unsigned data_length, - char *data, + const char *data, unsigned *data_length_return, char **data_return) { return MitGenerateCookie(data_length, data, From cf59f4888e202c6a68176bd3de1f837ca8480370 Mon Sep 17 00:00:00 2001 From: Colin Harrison Date: Fri, 14 Mar 2014 15:09:24 +0000 Subject: [PATCH 02/13] hw/xwin: Fix typo in comment Signed-off-by: Colin Harrison Reviewed-by: Jon TURNEY --- hw/xwin/winmultiwindowwndproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index abb87ee4b..2d57014c8 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -837,7 +837,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case WM_CLOSE: - /* Removep AppUserModelID property */ + /* Remove AppUserModelID property */ winSetAppUserModelID(hwnd, NULL); /* Branch on if the window was killed in X already */ if (pWinPriv->fXKilled) { From 80ac4a85d56130d09bbc72ed071759a361ded689 Mon Sep 17 00:00:00 2001 From: Colin Harrison Date: Fri, 14 Mar 2014 15:23:16 +0000 Subject: [PATCH 03/13] hw/xwin: Fix declaration after statement warning in ddxGiveUp() Signed-off-by: Colin Harrison Reviewed-by: Jon TURNEY --- hw/xwin/InitOutput.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 9413350e6..04015cd3e 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -271,10 +271,10 @@ ddxGiveUp(enum ExitCode error) PostQuitMessage(0); { - winDebug("ddxGiveUp - Releasing termination mutex\n"); - int iReturn = pthread_mutex_unlock(&g_pmTerminating); + winDebug("ddxGiveUp - Releasing termination mutex\n"); + if (iReturn != 0) { ErrorF("winMsgWindowProc - pthread_mutex_unlock () failed: %d\n", iReturn); From d48749492dc492fd7430ffdfd29842153618f778 Mon Sep 17 00:00:00 2001 From: Colin Harrison Date: Fri, 14 Mar 2014 15:34:04 +0000 Subject: [PATCH 04/13] hw/xwin: Use boolean AND rather than bitwise AND in WIN_POLLING_MOUSE_TIMER_ID For clarity, use boolean AND rather than bitwise AND in WIN_POLLING_MOUSE_TIMER_ID processing. Signed-off-by: Colin Harrison Reviewed-by: Jon TURNEY --- hw/xwin/winwndproc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c index c73a75c6f..bee223de7 100644 --- a/hw/xwin/winwndproc.c +++ b/hw/xwin/winwndproc.c @@ -955,11 +955,11 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) wShift = (GetKeyState(VK_SHIFT) & 0x8000) ? MK_SHIFT : 0; wCtrl = (GetKeyState(VK_CONTROL) & 0x8000) ? MK_CONTROL : 0; lPos = MAKELPARAM(point.x, point.y); - if (g_fButton[0] & !wL) + if (g_fButton[0] && !wL) PostMessage(hwnd, WM_LBUTTONUP, wCtrl | wM | wR | wShift, lPos); - if (g_fButton[1] & !wM) + if (g_fButton[1] && !wM) PostMessage(hwnd, WM_MBUTTONUP, wCtrl | wL | wR | wShift, lPos); - if (g_fButton[2] & !wR) + if (g_fButton[2] && !wR) PostMessage(hwnd, WM_RBUTTONUP, wCtrl | wL | wM | wShift, lPos); } } From 46df614784cbbffcf6368859285e949010f1ceb8 Mon Sep 17 00:00:00 2001 From: Colin Harrison Date: Fri, 14 Mar 2014 15:36:24 +0000 Subject: [PATCH 05/13] hw/xwin: Remove an unneeded include Signed-off-by: Colin Harrison Reviewed-by: Jon TURNEY --- hw/xwin/winwin32rootless.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/xwin/winwin32rootless.c b/hw/xwin/winwin32rootless.c index 0b62696f3..660a78f2d 100644 --- a/hw/xwin/winwin32rootless.c +++ b/hw/xwin/winwin32rootless.c @@ -39,7 +39,6 @@ #include #define _WINDOWSWM_SERVER_ #include -#include "dixevents.h" #include "winmultiwindowclass.h" #include From 061e5eba00a9a0dc27ff76946dc5f77004fc6a56 Mon Sep 17 00:00:00 2001 From: Colin Harrison Date: Fri, 14 Mar 2014 15:36:59 +0000 Subject: [PATCH 06/13] hw/xwin: Consistently use 'L' for long int constants Signed-off-by: Colin Harrison Reviewed-by: Jon TURNEY --- hw/xwin/winmultiwindowwm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index 9f12521bc..ec577a711 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -1618,10 +1618,10 @@ winDeinitMultiWindowWM(void) } /* Windows window styles */ -#define HINT_NOFRAME (1l<<0) +#define HINT_NOFRAME (1L<<0) #define HINT_BORDER (1L<<1) -#define HINT_SIZEBOX (1l<<2) -#define HINT_CAPTION (1l<<3) +#define HINT_SIZEBOX (1L<<2) +#define HINT_CAPTION (1L<<3) #define HINT_NOMAXIMIZE (1L<<4) #define HINT_NOMINIMIZE (1L<<5) #define HINT_NOSYSMENU (1L<<6) From 7fb5d765ba1e28eb775b847cef3d6079eba3bac1 Mon Sep 17 00:00:00 2001 From: Colin Harrison Date: Fri, 14 Mar 2014 15:40:43 +0000 Subject: [PATCH 07/13] hw/xwin: Use AllocDevicePair() Use AllocDevicePair() rather than allocating Windows keyboard and pointer devices individually. Signed-off-by: Colin Harrison Reviewed-by: Jon TURNEY --- hw/xwin/InitInput.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/xwin/InitInput.c b/hw/xwin/InitInput.c index 36346b7e1..38203c906 100644 --- a/hw/xwin/InitInput.c +++ b/hw/xwin/InitInput.c @@ -108,10 +108,11 @@ InitInput(int argc, char *argv[]) } #endif - g_pwinPointer = AddInputDevice(serverClient, winMouseProc, TRUE); - g_pwinKeyboard = AddInputDevice(serverClient, winKeybdProc, TRUE); - g_pwinPointer->name = strdup("Windows mouse"); - g_pwinKeyboard->name = strdup("Windows keyboard"); + if (AllocDevicePair(serverClient, "Windows", + &g_pwinPointer, &g_pwinKeyboard, + winMouseProc, winKeybdProc, + FALSE) != Success) + FatalError("InitInput - Failed to allocate slave devices.\n"); mieqInit(); From 6804acfe4fabc8ff8491bbc7edb6260440d3d4d3 Mon Sep 17 00:00:00 2001 From: Colin Harrison Date: Fri, 14 Mar 2014 15:44:54 +0000 Subject: [PATCH 08/13] hw/xwin: Remove prototype for non-existent winMWExtWMUpdateIcon() winMWExtWMUpdateIcon() was removed in commit 527cf13135cfd279733060e0028bbfbe02be5167 Signed-off-by: Colin Harrison Reviewed-by: Jon TURNEY --- hw/xwin/win.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/hw/xwin/win.h b/hw/xwin/win.h index 80fc504f6..a738a5940 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -1335,9 +1335,6 @@ void void winMWExtWMMoveResizeXWindow(WindowPtr pWin, int x, int y, int w, int h); -void - winMWExtWMUpdateIcon(Window id); - void winMWExtWMUpdateWindowDecoration(win32RootlessWindowPtr pRLWinPriv, From 03e1cc6f250a3f5cf17b34639adbbc9850c681cd Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Mon, 7 Nov 2011 20:54:10 +0000 Subject: [PATCH 09/13] hw/xwin: Add '@' to window name when it's useful to do so Enhance GetWindowName() so it appends the result of XGetWMClientMachine() when it is available and useful to do so Add -hostintitle option to control this behaviour. Add documentation for this option to man page and -help text. Also, fix warning in UpdateName() v2: Provide a HOST_NAME_MAX definition for MinGW v3: Use '@host' rather than ' (on host)'. Don't add host if it's already in the title. Signed-off-by: Jon TURNEY Reviewed-by: Yaakov Selkowitz Reviewed-by: Colin Harrison --- hw/xwin/InitOutput.c | 3 +++ hw/xwin/man/XWin.man | 6 ++++++ hw/xwin/winglobals.c | 1 + hw/xwin/winglobals.h | 1 + hw/xwin/winmultiwindowwm.c | 43 ++++++++++++++++++++++++++++++++++++++ hw/xwin/winprocarg.c | 5 +++++ 6 files changed, 59 insertions(+) diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 04015cd3e..b3ff7c041 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -786,6 +786,9 @@ winUseMsg(void) ErrorF("-fullscreen\n" "\tRun the server in fullscreen mode.\n"); + ErrorF("-hostintitle\n" + "\tIn multiwindow mode, add remote host names to window titles.\n"); + ErrorF("-ignoreinput\n" "\tIgnore keyboard and mouse input.\n"); #ifdef XWIN_MULTIWINDOWEXTWM diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man index 18ee667d4..c71f6a154 100644 --- a/hw/xwin/man/XWin.man +++ b/hw/xwin/man/XWin.man @@ -165,6 +165,12 @@ The maximum dimensions of the screen are the dimensions of the \fIWindows\fP vir on its own is equivalent to \fB\-resize=randr\fP .RE +.SH OPTIONS FOR MULTIWINDOW MODE +.TP 8 +.B \-hostintitle +Add the host name to the window title for X applications which are running +on remote hosts, when that information is available and it's useful to do so. + .SH OPTIONS CONTROLLING WINDOWS INTEGRATION .TP 8 .B \-[no]clipboard diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c index d28132247..b9ad294d5 100644 --- a/hw/xwin/winglobals.c +++ b/hw/xwin/winglobals.c @@ -78,6 +78,7 @@ Bool g_fNoHelpMessageBox = FALSE; Bool g_fSoftwareCursor = FALSE; Bool g_fSilentDupError = FALSE; Bool g_fNativeGl = TRUE; +Bool g_fHostInTitle = FALSE; pthread_mutex_t g_pmTerminating = PTHREAD_MUTEX_INITIALIZER; #ifdef XWIN_CLIPBOARD diff --git a/hw/xwin/winglobals.h b/hw/xwin/winglobals.h index 58a919c65..60c00da42 100644 --- a/hw/xwin/winglobals.h +++ b/hw/xwin/winglobals.h @@ -54,6 +54,7 @@ extern Bool g_fXdmcpEnabled; extern Bool g_fNoHelpMessageBox; extern Bool g_fSilentDupError; extern Bool g_fNativeGl; +extern Bool g_fHostInTitle; extern HWND g_hDlgDepthChange; extern HWND g_hDlgExit; diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index ec577a711..618e38121 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -60,6 +60,7 @@ #include "window.h" #include "pixmapstr.h" #include "windowstr.h" +#include "winglobals.h" #ifdef XWIN_MULTIWINDOWEXTWM #include @@ -69,6 +70,10 @@ #define WINDOWSWM_NATIVE_HWND "_WINDOWSWM_NATIVE_HWND" #endif +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 255 +#endif + extern void winDebug(const char *format, ...); extern void winReshapeMultiWindow(WindowPtr pWin); extern void winUpdateRgnMultiWindow(WindowPtr pWin); @@ -430,7 +435,10 @@ GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName) { int nResult; XTextProperty xtpWindowName; + XTextProperty xtpClientMachine; char *pszWindowName; + char *pszClientMachine; + char hostname[HOST_NAME_MAX + 1]; #if CYGMULTIWINDOW_DEBUG ErrorF("GetWindowName\n"); @@ -450,6 +458,41 @@ GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName) pszWindowName = Xutf8TextPropertyToString(pDisplay, &xtpWindowName); XFree(xtpWindowName.value); + + if (g_fHostInTitle) { + /* Try to get client machine name */ + nResult = XGetWMClientMachine(pDisplay, iWin, &xtpClientMachine); + if (nResult && xtpClientMachine.value && xtpClientMachine.nitems) { + pszClientMachine = + Xutf8TextPropertyToString(pDisplay, &xtpClientMachine); + XFree(xtpClientMachine.value); + + /* + If we have a client machine name + and it's not the local host name + and it's not already in the window title... + */ + if (strlen(pszClientMachine) && + !gethostname(hostname, HOST_NAME_MAX + 1) && + strcmp(hostname, pszClientMachine) && + (strstr(pszWindowName, pszClientMachine) == 0)) { + /* ... add '@' to end of window name */ + *ppWindowName = + malloc(strlen(pszWindowName) + + strlen(pszClientMachine) + 2); + strcpy(*ppWindowName, pszWindowName); + strcat(*ppWindowName, "@"); + strcat(*ppWindowName, pszClientMachine); + + free(pszWindowName); + free(pszClientMachine); + + return; + } + } + } + + /* otherwise just return the window name */ *ppWindowName = pszWindowName; } diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c index 858be4a56..f2bf05bad 100644 --- a/hw/xwin/winprocarg.c +++ b/hw/xwin/winprocarg.c @@ -1074,6 +1074,11 @@ ddxProcessArgument(int argc, char *argv[], int i) return 1; } + if (IS_OPTION("-hostintitle")) { + g_fHostInTitle = TRUE; + return 1; + } + return 0; } From 3b4d472b72601922bac264283eb6b611d8d524fc Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Wed, 7 Sep 2011 14:00:56 +0100 Subject: [PATCH 10/13] hw/xwin: Minimize redraw events after resizing/moving windows in multiwindow mode In multiwindow mode the modal moving/resizing of windows causes a lot of redraw events to be sent to the X clients after the user releases the mouse button. During the moving/resizing client windows are not redrawn as long as the mouse button is pressed, but all redraw/resizing events are queued and executed step after step after the moving/resizing ends. Some clients collect and combine multiple redraw or resizing events, other clients (e.g. xterm) simply execute each redraw or sizing event. The enclosed patch minimizes the events for clients to only one event after the user releases the mouse button to end the moving/resizing. This improves the user experience and reduces strange screen flickerings, especially on slow platforms. The enclosed patch modifies winmultiwindowwndproc.c such that the windows events WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE that are sent by Windows when the modal window resizing/moving begins or ends are considered. Only after WM_EXITSIZEMOVE is the redraw/resizing executed. Signed-off-by: Oliver Schmidt Reviewed-by: Jon TURNEY Reviewed-by: Colin Harrison --- hw/xwin/winmultiwindowwndproc.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index 2d57014c8..17823baf2 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -316,6 +316,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) static Bool s_fTracking = FALSE; Bool needRestack = FALSE; LRESULT ret; + static Bool hasEnteredSizeMove = FALSE; #if CYGDEBUG winDebugWin32Message("winTopLevelWindowProc", hwnd, message, wParam, @@ -872,7 +873,9 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_MOVE: /* Adjust the X Window to the moved Windows window */ - winAdjustXWindow(pWin, hwnd); + if (!hasEnteredSizeMove) + winAdjustXWindow(pWin, hwnd); + /* else: Wait for WM_EXITSIZEMOVE */ return 0; case WM_SHOWWINDOW: @@ -1005,6 +1008,16 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) */ break; + case WM_ENTERSIZEMOVE: + hasEnteredSizeMove = TRUE; + return 0; + + case WM_EXITSIZEMOVE: + /* Adjust the X Window to the moved Windows window */ + hasEnteredSizeMove = FALSE; + winAdjustXWindow(pWin, hwnd); + return 0; + case WM_SIZE: /* see dix/window.c */ #if CYGWINDOWING_DEBUG @@ -1029,8 +1042,11 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) (int) (GetTickCount())); } #endif - /* Adjust the X Window to the moved Windows window */ - winAdjustXWindow(pWin, hwnd); + if (!hasEnteredSizeMove) { + /* Adjust the X Window to the moved Windows window */ + winAdjustXWindow(pWin, hwnd); + } + /* else: wait for WM_EXITSIZEMOVE */ return 0; /* end of WM_SIZE handler */ case WM_STYLECHANGING: From ab61d070024a4776f011e71d762d4c6c0cf58b12 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Sun, 31 Mar 2013 18:29:07 +0100 Subject: [PATCH 11/13] hw/xwin: Remove obsolete control handling for About dialog Remove the unused, cygwin-specific handling for ChangeLog, UG and CG buttons in the About... Dialog. The buttons themselves were removed in commmit 34269a90ea2087f883f5dc8805894fc4998e4b81. Also remove those window control IDs which are now obsolete. Signed-off-by: Jon TURNEY Reviewed-by: Colin Harrison --- hw/xwin/windialogs.c | 56 ------------------------------------------- hw/xwin/winresource.h | 3 --- 2 files changed, 59 deletions(-) diff --git a/hw/xwin/windialogs.c b/hw/xwin/windialogs.c index 054ee95b5..c9af0e203 100644 --- a/hw/xwin/windialogs.c +++ b/hw/xwin/windialogs.c @@ -574,10 +574,7 @@ winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam) winInitDialog(hwndDialog); /* Override the URL buttons */ - winOverrideURLButton(hwndDialog, ID_ABOUT_CHANGELOG); winOverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE); - winOverrideURLButton(hwndDialog, ID_ABOUT_UG); - winOverrideURLButton(hwndDialog, ID_ABOUT_FAQ); return TRUE; @@ -608,30 +605,10 @@ winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam) PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); /* Restore window procedures for URL buttons */ - winUnoverrideURLButton(hwndDialog, ID_ABOUT_CHANGELOG); winUnoverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE); - winUnoverrideURLButton(hwndDialog, ID_ABOUT_UG); - winUnoverrideURLButton(hwndDialog, ID_ABOUT_FAQ); return TRUE; - case ID_ABOUT_CHANGELOG: - { - INT_PTR iReturn; - - const char *pszWinPath = "http://x.cygwin.com/" - "devel/server/changelog.html"; - - iReturn = (INT_PTR) ShellExecute(NULL, - "open", - pszWinPath, NULL, NULL, SW_MAXIMIZE); - if (iReturn < 32) { - ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_CHANGELOG - " - "ShellExecute failed: %d\n", (int)iReturn); - } - } - return TRUE; - case ID_ABOUT_WEBSITE: { const char *pszPath = __VENDORDWEBSUPPORT__; @@ -647,36 +624,6 @@ winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam) } } return TRUE; - - case ID_ABOUT_UG: - { - const char *pszPath = "http://x.cygwin.com/docs/ug/"; - INT_PTR iReturn; - - iReturn = (INT_PTR) ShellExecute(NULL, - "open", - pszPath, NULL, NULL, SW_MAXIMIZE); - if (iReturn < 32) { - ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_UG - " - "ShellExecute failed: %d\n", (int)iReturn); - } - } - return TRUE; - - case ID_ABOUT_FAQ: - { - const char *pszPath = "http://x.cygwin.com/docs/faq/"; - INT_PTR iReturn; - - iReturn = (INT_PTR) ShellExecute(NULL, - "open", - pszPath, NULL, NULL, SW_MAXIMIZE); - if (iReturn < 32) { - ErrorF("winAboutDlgProc - WM_COMMAND - ID_ABOUT_FAQ - " - "ShellExecute failed: %d\n", (int)iReturn); - } - } - return TRUE; } break; @@ -690,10 +637,7 @@ winAboutDlgProc(HWND hwndDialog, UINT message, WPARAM wParam, LPARAM lParam) PostMessage(s_pScreenPriv->hwndScreen, WM_NULL, 0, 0); /* Restore window procedures for URL buttons */ - winUnoverrideURLButton(hwndDialog, ID_ABOUT_CHANGELOG); winUnoverrideURLButton(hwndDialog, ID_ABOUT_WEBSITE); - winUnoverrideURLButton(hwndDialog, ID_ABOUT_UG); - winUnoverrideURLButton(hwndDialog, ID_ABOUT_FAQ); return TRUE; } diff --git a/hw/xwin/winresource.h b/hw/xwin/winresource.h index a14d402e1..afbf9f28d 100644 --- a/hw/xwin/winresource.h +++ b/hw/xwin/winresource.h @@ -44,9 +44,6 @@ #define ID_APP_ALWAYS_ON_TOP 202 #define ID_APP_ABOUT 203 -#define ID_ABOUT_UG 300 -#define ID_ABOUT_FAQ 301 -#define ID_ABOUT_CHANGELOG 302 #define ID_ABOUT_WEBSITE 303 #endif From 896b53ffa72d91d7d604967028291525562b60dd Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Sun, 16 Jun 2013 13:55:51 +0100 Subject: [PATCH 12/13] hw/xwin: Improve NET_WM_ICON validation Check that we don't overrun the end of the property data while converting icons See http://cygwin.com/ml/cygwin-xfree/2013-06/msg00040.html for testcase. Also, some warning fixes in winXIconToHICON() Signed-off-by: Jon TURNEY Reviewed-by: Colin Harrison --- hw/xwin/winmultiwindowicons.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/hw/xwin/winmultiwindowicons.c b/hw/xwin/winmultiwindowicons.c index 0531ad6c7..93d389d46 100644 --- a/hw/xwin/winmultiwindowicons.c +++ b/hw/xwin/winmultiwindowicons.c @@ -372,13 +372,12 @@ winXIconToHICON(Display * pDisplay, Window id, int iconSize) unsigned char *mask, *image = NULL, *imageMask; unsigned char *dst, *src; int planes, bpp, i; - int biggest_size = 0; + unsigned int biggest_size = 0; HDC hDC; ICONINFO ii; XWMHints *hints; HICON hIcon = NULL; uint32_t *biggest_icon = NULL; - static Atom _XA_NET_WM_ICON; static int generation; uint32_t *icon, *icon_data = NULL; @@ -405,10 +404,25 @@ winXIconToHICON(Display * pDisplay, Window id, int iconSize) (icon_data != NULL)) { for (icon = icon_data; icon < &icon_data[size] && *icon; icon = &icon[icon[0] * icon[1] + 2]) { - /* Find an exact match to the size we require... */ + winDebug("winXIconToHICON: %u x %u NetIcon\n", icon[0], icon[1]); + + /* Icon data size will overflow an int and thus is bigger than the + property can possibly be */ + if ((INT_MAX/icon[0]) < icon[1]) { + winDebug("winXIconToHICON: _NET_WM_ICON icon data size overflow\n"); + break; + } + + /* Icon data size is bigger than amount of data remaining */ + if (&icon[icon[0] * icon[1] + 2] > &icon_data[size]) { + winDebug("winXIconToHICON: _NET_WM_ICON data is malformed\n"); + break; + } + + /* Found an exact match to the size we require... */ if (icon[0] == iconSize && icon[1] == iconSize) { - winDebug("winXIconToHICON: found %lu x %lu NetIcon\n", icon[0], - icon[1]); + winDebug("winXIconToHICON: selected %d x %d NetIcon\n", + iconSize, iconSize); hIcon = NetWMToWinIcon(bpp, icon); break; } @@ -421,7 +435,7 @@ winXIconToHICON(Display * pDisplay, Window id, int iconSize) if (!hIcon && biggest_icon) { winDebug - ("winXIconToHICON: selected %lu x %lu NetIcon for scaling to %u x %u\n", + ("winXIconToHICON: selected %u x %u NetIcon for scaling to %d x %d\n", biggest_icon[0], biggest_icon[1], iconSize, iconSize); hIcon = NetWMToWinIcon(bpp, biggest_icon); From 0e5d2996ac872aca5995897fc518bdf9116bd246 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Wed, 11 Sep 2013 13:36:18 +0100 Subject: [PATCH 13/13] hw/xwin: Fix WM_ENDSESSION crash on x86_64 We need to include xwin-config.h into winmsgwindow.c, so that _XSERVER64 is defined, so that the layout of ScreenRec type is correct, so that it's privates can be accessed correctly, so that the WM_GIVEUP message can be sent to the screen window. Signed-off-by: Jon TURNEY Reviewed-by: Colin Harrison --- hw/xwin/winmsgwindow.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/xwin/winmsgwindow.c b/hw/xwin/winmsgwindow.c index 8067c693c..59f1da503 100644 --- a/hw/xwin/winmsgwindow.c +++ b/hw/xwin/winmsgwindow.c @@ -22,6 +22,10 @@ * */ +#ifdef HAVE_XWIN_CONFIG_H +#include +#endif + #include "win.h" /*