From 3f73ae1e3a081bf316ab729afc5ddbb62247982e Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Sat, 22 Jun 2019 12:37:27 +0100 Subject: Only convert WM_DESTROY into a WM_DELETE_WINDOW for unowned windows winDestroyWindowsWindow() traverses the tree of child Windows windows, marking them as destroyed, but in the Windows world there is another class of windows which will get destroyed when another windows is: owned windows. We make top-level TRANSIENT_FOR windows owned (so they are minimized at the same time at their owner). There's no easy way to enumerate the owned windows of a Windows window. Instead, we avoid translating a WM_DESTROY into a WM_DELETE_WINDOW unless the window is unowned. I'm uncertain under what circumstances the kill here actually gets used. See https://cygwin.com/ml/cygwin/2019-06/msg00168.html In that case, we have a submenu which is TRANSIENT_FOR a menu, which is TRANSIENT_FOR the applications main window. When focus moves away, the menu is unmapped, destroying it's window, which causes the submenu to be also destroyed. --- hw/xwin/winmultiwindowwndproc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index ee3d1637e..c79792984 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -981,12 +981,16 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) /* Branch on if the window was killed in X already */ if (pWinPriv && !pWinPriv->fXKilled) { - ErrorF("winTopLevelWindowProc - WM_DESTROY - WM_WM_KILL\n"); - - /* Tell our Window Manager thread to kill the window */ - wmMsg.msg = WM_WM_KILL; - if (fWMMsgInitialized) - winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg); + /* Unowned i.e. at the top of a TRANSIENT_FOR hierarchy */ + HWND owner = GetWindow(hwnd, GW_OWNER); + if (!owner) { + ErrorF("winTopLevelWindowProc - WM_DESTROY - WM_WM_KILL\n"); + + /* Tell our Window Manager thread to kill the window */ + wmMsg.msg = WM_WM_KILL; + if (fWMMsgInitialized) + winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg); + } } RemoveProp(hwnd, WIN_WINDOW_PROP); -- cgit v1.2.3 From 210c90b328cf8f1810999e1e70752ff81ab6308e Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Sun, 23 Jun 2019 18:11:34 +0100 Subject: hw/xwin: Fix length of text property set by SelectionRequest Fix the length of text property set by a SelectionRequest The length of the text property is not neccessarily the same as the length of the clipboard text before it is d2u converted (specifically, if that contains any '\r\n' sequences, it will be shorter as they are now just '\n') --- hw/xwin/winclipboard/xevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xwin/winclipboard/xevents.c b/hw/xwin/winclipboard/xevents.c index af956679b..a94359ce3 100644 --- a/hw/xwin/winclipboard/xevents.c +++ b/hw/xwin/winclipboard/xevents.c @@ -560,7 +560,7 @@ winClipboardFlushXEvents(HWND hwnd, winClipboardDOStoUNIX(pszConvertData, strlen(pszConvertData)); xtpText_value = strdup(pszConvertData); - xtpText_nitems = iConvertDataLen - 1; + xtpText_nitems = strlen(pszConvertData); /* data will fit into a single X request? (INCR not yet supported) */ { -- cgit v1.2.3 From d8fdd725303dfbc5558204944b3ecab96c1664f2 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Sun, 23 Jun 2019 21:48:53 +0100 Subject: Fix places where 'Cygwin/X' name is used in man pages and comments --- hw/xwin/man/XWin.man | 10 +++++----- hw/xwin/man/XWinrc.man | 2 +- hw/xwin/winmultiwindowwindow.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man index 3e10db3e5..217e82c18 100644 --- a/hw/xwin/man/XWin.man +++ b/hw/xwin/man/XWin.man @@ -104,7 +104,7 @@ These parameters only apply to windowed mode screens i.e. not in \fB-multiwindow\fP or \fB-rootless\fP mode. .TP 8 .B "\-fullscreen" -The X server window takes the full screen, covering completely the +The X screen window takes the full screen, covering completely the \fIWindows\fP desktop. Currently \fB\-fullscreen\fP may only be applied to one X screen. .TP 8 @@ -113,7 +113,7 @@ Override the window icon for the screen window from the default. The \fIicon-specifier\fP is as defined in \fIXWinrc(@filemansuffix@)\fP. .TP 8 .B \-nodecoration -Do not give the Cygwin/X window a \fIWindows\fP window border, title bar, +Do not give the X screen window a \fIWindows\fP window border, title bar, etc. This parameter is ignored when the \fB\-fullscreen\fP parameter is specified. .TP 8 @@ -213,8 +213,8 @@ Server instead of letting \fIWindows\fP handle them. .TP 8 .B \-lesspointer Normally the \fIWindows\fP mouse cursor is hidden when the mouse is -over an active Cygwin/X window. This option causes the mouse cursor -also to be hidden when it is over an inactive Cygwin/X window. This +over an active X window. This option causes the mouse cursor +also to be hidden when it is over an inactive X window. This prevents the \fIWindows\fP mouse cursor from being drawn on top of the X cursor. This parameter has no effect unless \fB-swcursor\fP is also specified. @@ -263,7 +263,7 @@ This option probably has limited effect on current \fIWindows\fP versions as they already perform GDI batching. .TP 8 .B "\-engine \fIengine_type_id\fP" -This option, which is intended for Cygwin/X developers, +This option, which is intended for developers, overrides the server's automatically selected drawing engine type. This parameter will be ignored if the specified drawing engine type is not supported on the current system. diff --git a/hw/xwin/man/XWinrc.man b/hw/xwin/man/XWinrc.man index 005d41126..c5457c5bc 100644 --- a/hw/xwin/man/XWinrc.man +++ b/hw/xwin/man/XWinrc.man @@ -6,7 +6,7 @@ XWinrc\- XWin Server Resource Configuration File. .SH DESCRIPTION -The X Server for the X Window System on the Cygwin/X environment +The X Server for the X Window System on the Cygwin environment running on Microsoft Windows, \fIXWin\fP can be optionally configured with the \fIXWinrc\fP file. A system-wide configuration file should be placed in \fI diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index c2d144447..6371423ce 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -976,7 +976,7 @@ winReorderWindowsMultiWindow(void) /* Loop through top level Window windows, descending in Z order */ for (hwnd = GetTopWindow(NULL); hwnd; hwnd = GetNextWindow(hwnd, GW_HWNDNEXT)) { - /* Don't take care of other Cygwin/X process's windows */ + /* Don't touch other process's windows */ GetWindowThreadProcessId(hwnd, &dwWindowProcessID); if (GetProp(hwnd, WIN_WINDOW_PROP) -- cgit v1.2.3 From ff469e09b9ad904848c401db1396c0a40c89df5d Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Sun, 23 Jun 2019 21:55:40 +0100 Subject: Give unnamed X windows a more explicit title I'd like generalize some more places where PROJECT_NAME and/or XVENDORNAMESHORT is used, but https://xkcd.com/1172/ ... --- hw/xwin/winwindow.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h index 10a10205d..8e95c484f 100644 --- a/hw/xwin/winwindow.h +++ b/hw/xwin/winwindow.h @@ -47,13 +47,13 @@ #endif #define EXECUTABLE_NAME "XWin" #define WINDOW_CLASS "cygwin/x" -#define WINDOW_TITLE PROJECT_NAME ":%s.%d" -#define WINDOW_TITLE_XDMCP "%s:%s.%d" +#define WINDOW_TITLE PROJECT_NAME ":%s.%d" /* X screen window title */ +#define WINDOW_TITLE_XDMCP "%s:%s.%d" /* X screen window title with XDMCP */ #define WIN_SCR_PROP "cyg_screen_prop rl" #define WINDOW_CLASS_X "cygwin/x X rl" #define WINDOW_CLASS_X_MSG "cygwin/x X msg" #define WINDOW_CLASS_X_CHILD "cygwin/x X child" -#define WINDOW_TITLE_X PROJECT_NAME " X" +#define WINDOW_TITLE_X "Unnamed X Window" /* default multiwindow window title */ #define WIN_WINDOW_PROP "cyg_window_prop_rl" #ifdef HAS_DEVWINDOWS #define WIN_MSG_QUEUE_FNAME "/dev/windows" -- cgit v1.2.3