aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-03-25 17:56:10 +0100
committermarha <marha@users.sourceforge.net>2014-03-25 17:56:10 +0100
commitba6115f56f066621a20fa545ddd67721afd35523 (patch)
tree418b724d4f318d24dc8e5183e6b252922f85f149 /xorg-server/hw/xwin
parenteb71c0f23999d1cc156e1821d73634ec79621fc2 (diff)
parente0927d908a12c9c140458c355b29b884a7705f2d (diff)
downloadvcxsrv-ba6115f56f066621a20fa545ddd67721afd35523.tar.gz
vcxsrv-ba6115f56f066621a20fa545ddd67721afd35523.tar.bz2
vcxsrv-ba6115f56f066621a20fa545ddd67721afd35523.zip
Merge remote-tracking branch 'origin/released'
Conflicts: xorg-server/hw/xwin/InitInput.c xorg-server/hw/xwin/InitOutput.c xorg-server/hw/xwin/winglobals.c xorg-server/hw/xwin/winglobals.h xorg-server/hw/xwin/winmsgwindow.c xorg-server/hw/xwin/winmultiwindowwm.c xorg-server/hw/xwin/winmultiwindowwndproc.c
Diffstat (limited to 'xorg-server/hw/xwin')
-rw-r--r--xorg-server/hw/xwin/InitInput.c14
-rw-r--r--xorg-server/hw/xwin/InitOutput.c11
-rw-r--r--xorg-server/hw/xwin/man/XWin.man6
-rw-r--r--xorg-server/hw/xwin/winauth.c4
-rw-r--r--xorg-server/hw/xwin/windialogs.c56
-rw-r--r--xorg-server/hw/xwin/winglobals.c1
-rw-r--r--xorg-server/hw/xwin/winglobals.h3
-rw-r--r--xorg-server/hw/xwin/winmultiwindowicons.c26
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwm.c49
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwndproc.c19
-rw-r--r--xorg-server/hw/xwin/winprocarg.c5
-rw-r--r--xorg-server/hw/xwin/winresource.h3
-rw-r--r--xorg-server/hw/xwin/winwin32rootless.c1
13 files changed, 102 insertions, 96 deletions
diff --git a/xorg-server/hw/xwin/InitInput.c b/xorg-server/hw/xwin/InitInput.c
index e7f402f80..40f4b9b9d 100644
--- a/xorg-server/hw/xwin/InitInput.c
+++ b/xorg-server/hw/xwin/InitInput.c
@@ -99,15 +99,11 @@ InitInput(int argc, char *argv[])
}
#endif
- rc = AllocDevicePair(serverClient, "Windows",
- &g_pwinPointer,
- &g_pwinKeyboard,
- winMouseProc,
- winKeybdProc,
- FALSE);
-
- if (rc != Success)
- FatalError("Failed to init vcxsrv default devices.\n");
+ if (AllocDevicePair(serverClient, "Windows",
+ &g_pwinPointer, &g_pwinKeyboard,
+ winMouseProc, winKeybdProc,
+ FALSE) != Success)
+ FatalError("InitInput - Failed to allocate slave devices.\n");
mieqInit();
diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c
index 7a4f8446d..df670ff0e 100644
--- a/xorg-server/hw/xwin/InitOutput.c
+++ b/xorg-server/hw/xwin/InitOutput.c
@@ -262,12 +262,10 @@ ddxGiveUp(enum ExitCode error)
PostQuitMessage(0);
{
- int iReturn;
+ int iReturn = pthread_mutex_unlock(&g_pmTerminating);
winDebug("ddxGiveUp - Releasing termination mutex\n");
- iReturn = pthread_mutex_unlock(&g_pmTerminating);
-
if (iReturn != 0) {
ErrorF("winMsgWindowProc - pthread_mutex_unlock () failed: %d\n",
iReturn);
@@ -420,8 +418,7 @@ winFixupPaths(void)
{
/* Open fontpath configuration file */
#if defined WIN32 && defined __MINGW32__
-qsdf qsdf qsdf qsdf
- static Bool once = False;
+ static Bool once = False;
char buffer[MAX_PATH];
snprintf(buffer, sizeof(buffer), "%s\\font-dirs", basedir);
buffer[sizeof(buffer)-1] = 0;
@@ -429,7 +426,6 @@ qsdf qsdf qsdf qsdf
if (once) fontdirs = NULL;
else once = True;
#else
-qsdfqsdf qsdf qsdf
FILE *fontdirs = fopen(ETCX11DIR "/font-dirs", "rt");
#endif
if (fontdirs != NULL) {
@@ -809,6 +805,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_MULTIWINDOWINTWM
diff --git a/xorg-server/hw/xwin/man/XWin.man b/xorg-server/hw/xwin/man/XWin.man
index 18ee667d4..c71f6a154 100644
--- a/xorg-server/hw/xwin/man/XWin.man
+++ b/xorg-server/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/xorg-server/hw/xwin/winauth.c b/xorg-server/hw/xwin/winauth.c
index 5c46c7022..4e6c3814f 100644
--- a/xorg-server/hw/xwin/winauth.c
+++ b/xorg-server/hw/xwin/winauth.c
@@ -114,9 +114,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,
diff --git a/xorg-server/hw/xwin/windialogs.c b/xorg-server/hw/xwin/windialogs.c
index 3e3bd401c..bb48af0ab 100644
--- a/xorg-server/hw/xwin/windialogs.c
+++ b/xorg-server/hw/xwin/windialogs.c
@@ -568,10 +568,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;
@@ -602,30 +599,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__;
@@ -641,36 +618,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;
@@ -684,10 +631,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/xorg-server/hw/xwin/winglobals.c b/xorg-server/hw/xwin/winglobals.c
index 59287cadb..54e5e0ba2 100644
--- a/xorg-server/hw/xwin/winglobals.c
+++ b/xorg-server/hw/xwin/winglobals.c
@@ -79,6 +79,7 @@ Bool g_fSoftwareCursor = FALSE;
Bool g_fSilentDupError = FALSE;
Bool g_fNativeGl = TRUE;
Bool g_fswrastwgl = FALSE;
+Bool g_fHostInTitle = FALSE;
pthread_mutex_t g_pmTerminating = PTHREAD_MUTEX_INITIALIZER;
#ifdef XWIN_CLIPBOARD
diff --git a/xorg-server/hw/xwin/winglobals.h b/xorg-server/hw/xwin/winglobals.h
index 75707b460..722569bf9 100644
--- a/xorg-server/hw/xwin/winglobals.h
+++ b/xorg-server/hw/xwin/winglobals.h
@@ -54,7 +54,8 @@ extern Bool g_fXdmcpEnabled;
extern Bool g_fNoHelpMessageBox;
extern Bool g_fSilentDupError;
extern Bool g_fNativeGl;
-extern Bool g_fswrastwgl;
+extern Bool g_fswrastwgl;
+extern Bool g_fHostInTitle;
extern HWND g_hDlgDepthChange;
extern HWND g_hDlgExit;
diff --git a/xorg-server/hw/xwin/winmultiwindowicons.c b/xorg-server/hw/xwin/winmultiwindowicons.c
index 74d0af1ba..5ffc24278 100644
--- a/xorg-server/hw/xwin/winmultiwindowicons.c
+++ b/xorg-server/hw/xwin/winmultiwindowicons.c
@@ -374,13 +374,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;
@@ -407,10 +406,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;
}
@@ -423,7 +437,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);
diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c
index 8518147a6..0fd63312e 100644
--- a/xorg-server/hw/xwin/winmultiwindowwm.c
+++ b/xorg-server/hw/xwin/winmultiwindowwm.c
@@ -64,6 +64,7 @@ typedef int pid_t;
#include "winmsg.h"
#include "windowstr.h"
#include "winmultiwindowclass.h"
+#include "winglobals.h"
#ifdef XWIN_MULTIWINDOWEXTWM
#define _WINDOWSWM_SERVER_
@@ -74,6 +75,10 @@ typedef int pid_t;
#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);
@@ -397,7 +402,10 @@ GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName)
{
int nResult;
XTextProperty xtpWindowName;
+ XTextProperty xtpClientMachine;
char *pszWindowName;
+ char *pszClientMachine;
+ char hostname[HOST_NAME_MAX + 1];
winDebug ("GetWindowName\n");
@@ -413,6 +421,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 '@<clientmachine>' 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;
}
@@ -1576,10 +1619,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)
diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c
index 9ca27e5ff..624c96fca 100644
--- a/xorg-server/hw/xwin/winmultiwindowwndproc.c
+++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c
@@ -830,7 +830,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) {
@@ -865,8 +865,9 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_MOVE:
/* Adjust the X Window to the moved Windows window */
- if (!hasEnteredSizeMove) winAdjustXWindow (pWin, hwnd);
- /* else: Wait for WM_EXITSIZEMOVE */
+ if (!hasEnteredSizeMove)
+ winAdjustXWindow(pWin, hwnd);
+ /* else: Wait for WM_EXITSIZEMOVE */
return 0;
case WM_SHOWWINDOW:
@@ -1017,14 +1018,14 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_ENTERSIZEMOVE:
- hasEnteredSizeMove = TRUE;
- return 0;
+ hasEnteredSizeMove = TRUE;
+ return 0;
case WM_EXITSIZEMOVE:
- /* Adjust the X Window to the moved Windows window */
- hasEnteredSizeMove = FALSE;
- winAdjustXWindow (pWin, hwnd);
- return 0;
+ /* Adjust the X Window to the moved Windows window */
+ hasEnteredSizeMove = FALSE;
+ winAdjustXWindow(pWin, hwnd);
+ return 0;
case WM_SIZE:
/* see dix/window.c */
diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c
index 570b91721..ad0b5bbe9 100644
--- a/xorg-server/hw/xwin/winprocarg.c
+++ b/xorg-server/hw/xwin/winprocarg.c
@@ -1119,6 +1119,11 @@ ddxProcessArgument(int argc, char *argv[], int i)
return 2;
}
+ if (IS_OPTION("-hostintitle")) {
+ g_fHostInTitle = TRUE;
+ return 1;
+ }
+
return 0;
}
diff --git a/xorg-server/hw/xwin/winresource.h b/xorg-server/hw/xwin/winresource.h
index bb419188a..39b890c7c 100644
--- a/xorg-server/hw/xwin/winresource.h
+++ b/xorg-server/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
#define IDC_HOSTLIST 100
diff --git a/xorg-server/hw/xwin/winwin32rootless.c b/xorg-server/hw/xwin/winwin32rootless.c
index 024458063..aeec0eee2 100644
--- a/xorg-server/hw/xwin/winwin32rootless.c
+++ b/xorg-server/hw/xwin/winwin32rootless.c
@@ -39,7 +39,6 @@
#include <winuser.h>
#define _WINDOWSWM_SERVER_
#include <X11/extensions/windowswmstr.h>
-#include "dixevents.h"
#include "winmultiwindowclass.h"
#include <X11/Xatom.h>