aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-07-12 18:20:04 +0000
committermarha <marha@users.sourceforge.net>2009-07-12 18:20:04 +0000
commitda8fe31a7ba4acf109097d5696ad0145b991cdfd (patch)
tree1c74d6f075702a73e557872f2a6f020ea4eb5432 /xorg-server/hw/xwin
parent6590f805a12779909cb8504c230fa367148fe38c (diff)
parent529dcfd0858d75cb3c87c73cb0f81dd20bbb9230 (diff)
downloadvcxsrv-da8fe31a7ba4acf109097d5696ad0145b991cdfd.tar.gz
vcxsrv-da8fe31a7ba4acf109097d5696ad0145b991cdfd.tar.bz2
vcxsrv-da8fe31a7ba4acf109097d5696ad0145b991cdfd.zip
Changes for VC compilation
Diffstat (limited to 'xorg-server/hw/xwin')
-rw-r--r--xorg-server/hw/xwin/InitInput.c15
-rw-r--r--xorg-server/hw/xwin/InitOutput.c86
-rw-r--r--xorg-server/hw/xwin/X.icobin20870 -> 25214 bytes
-rw-r--r--xorg-server/hw/xwin/XWin.exe.manifest16
-rw-r--r--xorg-server/hw/xwin/XWin.rc59
-rw-r--r--xorg-server/hw/xwin/makefile101
-rw-r--r--xorg-server/hw/xwin/win.h15
-rw-r--r--xorg-server/hw/xwin/winclipboard.h9
-rw-r--r--xorg-server/hw/xwin/winclipboardthread.c38
-rw-r--r--xorg-server/hw/xwin/winclipboardunicode.c34
-rw-r--r--xorg-server/hw/xwin/winclipboardwndproc.c34
-rw-r--r--xorg-server/hw/xwin/winclipboardwrappers.c27
-rw-r--r--xorg-server/hw/xwin/winclipboardxevents.c76
-rw-r--r--xorg-server/hw/xwin/wincreatewnd.c8
-rw-r--r--xorg-server/hw/xwin/wincursor.c16
-rw-r--r--xorg-server/hw/xwin/windialogs.c141
-rw-r--r--xorg-server/hw/xwin/winerror.c38
-rw-r--r--xorg-server/hw/xwin/winglobals.c5
-rw-r--r--xorg-server/hw/xwin/winkeybd.c47
-rw-r--r--xorg-server/hw/xwin/winkeybd.h33
-rw-r--r--xorg-server/hw/xwin/winlayouts.h23
-rw-r--r--xorg-server/hw/xwin/winmouse.c42
-rw-r--r--xorg-server/hw/xwin/winmultiwindowclass.c4
-rw-r--r--xorg-server/hw/xwin/winmultiwindowicons.c316
-rw-r--r--xorg-server/hw/xwin/winmultiwindowshape.c15
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwindow.c53
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwm.c333
-rw-r--r--xorg-server/hw/xwin/winmultiwindowwndproc.c234
-rw-r--r--xorg-server/hw/xwin/winpolyline.c2
-rw-r--r--xorg-server/hw/xwin/winprefs.c52
-rw-r--r--xorg-server/hw/xwin/winprefs.h24
-rw-r--r--xorg-server/hw/xwin/winprefslex.l10
-rw-r--r--xorg-server/hw/xwin/winprefsyacc.c7
-rw-r--r--xorg-server/hw/xwin/winprefsyacc.h4
-rw-r--r--xorg-server/hw/xwin/winprefsyacc.y78
-rw-r--r--xorg-server/hw/xwin/winprocarg.c35
-rw-r--r--xorg-server/hw/xwin/winresource.h1
-rw-r--r--xorg-server/hw/xwin/winscrinit.c55
-rw-r--r--xorg-server/hw/xwin/winshaddd.c32
-rw-r--r--xorg-server/hw/xwin/winshadddnl.c23
-rw-r--r--xorg-server/hw/xwin/winshadgdi.c2
-rw-r--r--xorg-server/hw/xwin/winwin32rootless.c5
-rw-r--r--xorg-server/hw/xwin/winwin32rootlesswndproc.c9
-rw-r--r--xorg-server/hw/xwin/winwindow.c5
-rw-r--r--xorg-server/hw/xwin/winwindow.h23
-rw-r--r--xorg-server/hw/xwin/winwindowswm.c2
-rw-r--r--xorg-server/hw/xwin/winwndproc.c13
-rw-r--r--xorg-server/hw/xwin/xlaunch/config.h76
-rw-r--r--xorg-server/hw/xwin/xlaunch/main.cc20
-rw-r--r--xorg-server/hw/xwin/xlaunch/makefile32
-rw-r--r--xorg-server/hw/xwin/xlaunch/window/makefile4
-rw-r--r--xorg-server/hw/xwin/xlaunch/window/util.h2
-rw-r--r--xorg-server/hw/xwin/xlaunch/window/wizard.h1
53 files changed, 1730 insertions, 605 deletions
diff --git a/xorg-server/hw/xwin/InitInput.c b/xorg-server/hw/xwin/InitInput.c
index 6a850cd44..bce7ac54e 100644
--- a/xorg-server/hw/xwin/InitInput.c
+++ b/xorg-server/hw/xwin/InitInput.c
@@ -30,10 +30,8 @@
#include <xwin-config.h>
#endif
#include "win.h"
-#ifdef XWIN_CLIPBOARD
-# include "../../Xext/xf86miscproc.h"
-#endif
#include "dixstruct.h"
+#include "inputstr.h"
/*
@@ -104,6 +102,11 @@ ProcessInputEvents (void)
#endif
}
+void DDXRingBell(int volume, int pitch, int duration)
+{
+ /* winKeybdBell is used instead */
+ return;
+}
int
TimeSinceLastInputEvent ()
@@ -147,8 +150,10 @@ InitInput (int argc, char *argv[])
RegisterPointerDevice (pMouse);
RegisterKeyboardDevice (pKeyboard);
- miRegisterPointerDevice (screenInfo.screens[0], pMouse);
- mieqInit ((DevicePtr)pKeyboard, (DevicePtr)pMouse);
+ pMouse->name = strdup("Windows mouse");
+ pKeyboard->name = strdup("Windows keyboard");
+
+ mieqInit ();
/* Initialize the mode key states */
winInitializeModeKeyStates ();
diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c
index d2159813c..545437437 100644
--- a/xorg-server/hw/xwin/InitOutput.c
+++ b/xorg-server/hw/xwin/InitOutput.c
@@ -1,6 +1,7 @@
/*
Copyright 1993, 1998 The Open Group
+Copyright (C) Colin Harrison 2005-2008
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
@@ -45,14 +46,16 @@ from The Open Group.
#if defined(XKB) && defined(WIN32)
#include <xkbsrv.h>
#endif
+
#ifdef RELOCATE_PROJECTROOT
+#undef Status
#include <shlobj.h>
-typedef HRESULT (*SHGETFOLDERPATHPROC)(
+typedef HRESULT (__stdcall * SHGETFOLDERPATHPROC)(
HWND hwndOwner,
int nFolder,
HANDLE hToken,
DWORD dwFlags,
- LPTSTR pszPath
+ LPSTR pszPath
);
#endif
@@ -73,6 +76,7 @@ extern int g_iLogVerbose;
Bool g_fLogInited;
extern Bool g_fXdmcpEnabled;
+extern Bool g_fAuthEnabled;
#ifdef HAS_DEVWINDOWS
extern int g_fdMessageQueue;
#endif
@@ -132,6 +136,9 @@ const char *
winGetBaseDir(void);
#endif
+static
+void glx_debugging(void);
+
/*
* For the depth 24 pixmap we default to 32 bits per pixel, but
* we change this pixmap format later if we detect that the display
@@ -241,7 +248,7 @@ ddxGiveUp (void)
#endif
if (!g_fLogInited) {
- LogInit (g_pszLogFile, NULL);
+ g_pszLogFile = LogInit (g_pszLogFile, NULL);
g_fLogInited = TRUE;
}
LogClose ();
@@ -424,7 +431,17 @@ winFixupPaths (void)
#ifdef READ_FONTDIRS
{
/* Open fontpath configuration file */
+#if defined WIN32 && defined __MINGW32__
+ static Bool once = False;
+ char buffer[MAX_PATH];
+ snprintf(buffer, sizeof(buffer), "%s\\font-dirs", basedir);
+ buffer[sizeof(buffer)-1] = 0;
+ FILE *fontdirs = fopen(buffer, "rt");
+ if (once) fontdirs = NULL;
+ else once = True;
+#else
FILE *fontdirs = fopen(ETCX11DIR "/font-dirs", "rt");
+#endif
if (fontdirs != NULL)
{
char buffer[256];
@@ -624,6 +641,14 @@ winFixupPaths (void)
buffer[sizeof(buffer)-1] = 0;
putenv(buffer);
}
+ if (getenv("XHOSTPREFIX") == NULL)
+ {
+ char buffer[MAX_PATH];
+ snprintf(buffer, sizeof(buffer), "XHOSTPREFIX=%s\\X",
+ basedir);
+ buffer[sizeof(buffer)-1] = 0;
+ putenv(buffer);
+ }
if (getenv("HOME") == NULL)
{
HMODULE shfolder;
@@ -661,9 +686,10 @@ winFixupPaths (void)
if (size && size < sizeof(buffer))
{
snprintf(buffer + size, sizeof(buffer) - size,
- "XWin.%s.log", display);
+ "VCXSrv.%s.log", display);
buffer[sizeof(buffer)-1] = 0;
g_pszLogFile = buffer;
+ GetLongPathName(buffer, buffer, MAX_PATH);
winMsg (X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile);
}
}
@@ -671,7 +697,7 @@ winFixupPaths (void)
{
static char xkbbasedir[MAX_PATH];
- snprintf(xkbbasedir, sizeof(xkbbasedir), "%s\\xkb", basedir);
+ snprintf(xkbbasedir, sizeof(xkbbasedir), "%s\\xkbdata", basedir);
if (sizeof(xkbbasedir) > 0)
xkbbasedir[sizeof(xkbbasedir)-1] = 0;
XkbBaseDirectory = xkbbasedir;
@@ -687,9 +713,6 @@ OsVendorInit (void)
/* Re-initialize global variables on server reset */
winInitializeGlobals ();
- LogInit (NULL, NULL);
- LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose);
-
winFixupPaths();
#ifdef DDXOSVERRORF
@@ -704,7 +727,7 @@ OsVendorInit (void)
* avoid the second call
*/
g_fLogInited = TRUE;
- LogInit (g_pszLogFile, NULL);
+ g_pszLogFile = LogInit (g_pszLogFile, NULL);
}
LogSetParameter (XLOG_FLUSH, 1);
LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose);
@@ -877,7 +900,7 @@ winUseMsg (void)
#endif
ErrorF ("-logfile filename\n"
- "\tWrite logmessages to <filename> instead of /tmp/Xwin.log.\n");
+ "\tWrite logmessages to <filename>.\n");
ErrorF ("-logverbose verbosity\n"
"\tSet the verbosity of logmessages. [NOTE: Only a few messages\n"
@@ -907,7 +930,7 @@ ddxUseMsg(void)
/* Log file will not be opened for UseMsg unless we open it now */
if (!g_fLogInited) {
- LogInit (g_pszLogFile, NULL);
+ g_pszLogFile = LogInit (g_pszLogFile, NULL);
g_fLogInited = TRUE;
}
LogClose ();
@@ -915,9 +938,9 @@ ddxUseMsg(void)
/* Notify user where UseMsg text can be found.*/
if (!g_fNoHelpMessageBox)
winMessageBoxF ("The " PROJECT_NAME " help text has been printed to "
- "/tmp/XWin.log.\n"
- "Please open /tmp/XWin.log to read the help text.\n",
- MB_ICONINFORMATION);
+ "%s.\n"
+ "Please open %s to read the help text.\n",
+ MB_ICONINFORMATION, g_pszLogFile, g_pszLogFile);
}
/* ddxInitGlobals - called by |InitGlobals| from os/util.c */
@@ -965,9 +988,6 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[])
if (!winReadConfigfile ())
winErrorFVerb (1, "InitOutput - Error reading config file\n");
#else
- winMsg(X_INFO, "XF86Config is not supported\n");
- winMsg(X_INFO, "See http://x.cygwin.com/docs/faq/cygwin-x-faq.html "
- "for more information\n");
winConfigFiles ();
#endif
@@ -1031,7 +1051,7 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[])
#if defined(XCSECURITY)
/* Generate a cookie used by internal clients for authorization */
- if (g_fXdmcpEnabled)
+ if (g_fXdmcpEnabled || g_fAuthEnabled)
winGenerateAuthorization ();
#endif
@@ -1043,6 +1063,8 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[])
* Apply locale specified in LANG environment variable.
*/
setlocale (LC_ALL, "");
+
+ glx_debugging();
}
#endif
@@ -1071,7 +1093,7 @@ winCheckDisplayNumber ()
/* Check display range */
nDisp = atoi (display);
- if (nDisp < 0 || nDisp > 65535)
+ if (nDisp < 0 || nDisp > 59535)
{
ErrorF ("winCheckDisplayNumber - Bad display number: %d\n", nDisp);
return FALSE;
@@ -1118,7 +1140,7 @@ winCheckDisplayNumber ()
if (GetLastError () == ERROR_ALREADY_EXISTS)
{
ErrorF ("winCheckDisplayNumber - "
- PROJECT_NAME " is already running on display %d\n",
+ "VCXsrv, Xming or Cygwin/X is already running on display %d\n",
nDisp);
return FALSE;
}
@@ -1126,19 +1148,21 @@ winCheckDisplayNumber ()
return TRUE;
}
-#ifdef DPMSExtension
-Bool DPMSSupported(void)
-{
- return FALSE;
-}
+/* GLX debugging helpers */
+#include <../glx/glapi.h>
-void DPMSSet(int level)
-{
- return;
+static
+void warn_func(void * p1, const char *format, ...) {
+ va_list v;
+ va_start(v, format);
+ vfprintf(stderr, format, v);
+ va_end(v);
+ fprintf(stderr,"\n");
}
-int DPMSGet(int *plevel)
+static
+void glx_debugging(void)
{
- return 0;
+ _glapi_set_warning_func(warn_func);
+ _glapi_noop_enable_warnings(TRUE);
}
-#endif
diff --git a/xorg-server/hw/xwin/X.ico b/xorg-server/hw/xwin/X.ico
index d47168fca..5d69818b5 100644
--- a/xorg-server/hw/xwin/X.ico
+++ b/xorg-server/hw/xwin/X.ico
Binary files differ
diff --git a/xorg-server/hw/xwin/XWin.exe.manifest b/xorg-server/hw/xwin/XWin.exe.manifest
new file mode 100644
index 000000000..221150d52
--- /dev/null
+++ b/xorg-server/hw/xwin/XWin.exe.manifest
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <description>The XWin X Windows server for Cygwin.</description>
+ <dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="X86"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+ </dependency>
+</assembly>
diff --git a/xorg-server/hw/xwin/XWin.rc b/xorg-server/hw/xwin/XWin.rc
index 749c0f5f5..cbe5244e9 100644
--- a/xorg-server/hw/xwin/XWin.rc
+++ b/xorg-server/hw/xwin/XWin.rc
@@ -1,5 +1,6 @@
/*
*Copyright (C) 2002-2004 Harold L Hunt II All Rights Reserved.
+ *Copyright (C) 2008 Yaakov Selkowitz All Rights Reserved
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -20,62 +21,58 @@
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
- *Except as contained in this notice, the name of Harold L Hunt II
+ *Except as contained in this notice, the names of the authors
*shall not be used in advertising or otherwise to promote the sale, use
*or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
+ *from the authors.
*
- * Authors: Harold L Hunt II
+ * Authors: Harold L Hunt II, Yaakov Selkowitz
*/
-#include "windows.h"
+#include <windows.h>
#include "winresource.h"
+#include "xwin-config.h"
/*
* Dialogs
*/
/* About */
-ABOUT_BOX DIALOG DISCARDABLE 32, 32, 240, 105
+ABOUT_BOX DIALOGEX 32, 32, 260, 95
STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTERMOUSE
-CAPTION "About " PROJECT_NAME
-FONT 8, "MS Sans Serif"
+CAPTION "About XSrv"
+FONT 8, "MS Shell Dlg 2"
BEGIN
- CONTROL PROJECT_NAME " Website", ID_ABOUT_WEBSITE, "Button",
- BS_OWNERDRAW | WS_TABSTOP, 30, 45, 75, 15
- CONTROL "Change Log", ID_ABOUT_CHANGELOG, "Button",
- BS_OWNERDRAW | WS_TABSTOP, 135, 45, 75, 15
- CONTROL "User's Guide", ID_ABOUT_UG, "Button",
- BS_OWNERDRAW | WS_TABSTOP, 30, 65, 75, 15
- CONTROL "FAQ", ID_ABOUT_FAQ, "Button",
- BS_OWNERDRAW | WS_TABSTOP, 135, 65, 75, 15
-
- DEFPUSHBUTTON "Dismiss", IDOK, 95, 85, 50, 15
-
- CTEXT "Welcome to the preliminary About box for the " PROJECT_NAME " X Server. This dialog was created on 2004/03/25 and will eventually be filled with more useful information. For now, use the links below to learn more about the " PROJECT_NAME " project.", IDC_STATIC, 5, 5, 230, 35
+ CONTROL IDI_XWIN, IDC_STATIC, "Static", SS_ICON, 8, 8, 32, 32
+ LTEXT "XSrv X Server ", IDC_STATIC, 36, 8, 220, 8
+ LTEXT "Version 0.0 (1 Jan 2009)", IDC_STATIC, 36, 18, 220, 8
+ LTEXT "This product is licensed under the terms of the MIT/X11 License.", IDC_STATIC, 36, 38, 220, 20
+ CONTROL __VENDORDWEBSUPPORT__, ID_ABOUT_WEBSITE, "Button",
+ BS_OWNERDRAW | WS_TABSTOP, 36, 58, 68, 8
+ DEFPUSHBUTTON "OK", IDOK, 105, 75, 50, 15
END
/* Depth change */
-DEPTH_CHANGE_BOX DIALOG DISCARDABLE 32, 32, 180, 100
+DEPTH_CHANGE_BOX DIALOGEX 32, 32, 180, 100
STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | DS_CENTERMOUSE
-FONT 8, "MS Sans Serif"
-CAPTION PROJECT_NAME
+FONT 8, "MS Shell Dlg 2"
+CAPTION "XSrv"
BEGIN
DEFPUSHBUTTON "Dismiss", IDOK, 66, 80, 50, 14
- CTEXT PROJECT_NAME, IDC_STATIC, 40, 12, 100, 8
+ CTEXT "VCXSrv", IDC_STATIC, 40, 12, 100, 8
CTEXT "Disruptive screen configuration change.", IDC_STATIC, 7, 40, 166, 8
- CTEXT "Restore previous resolution to use " PROJECT_NAME ".", IDC_STATIC, 7, 52, 166, 8
+ CTEXT "Restore previous resolution to use VCXSrv.", IDC_STATIC, 7, 52, 166, 8
END
/* Exit */
-EXIT_DIALOG DIALOG DISCARDABLE 32, 32, 180, 78
+EXIT_DIALOG DIALOGEX 32, 32, 180, 78
STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTERMOUSE
-FONT 8, "MS Sans Serif"
-CAPTION PROJECT_NAME " - Exit?"
+FONT 8, "MS Shell Dlg 2"
+CAPTION "Exit VCXSrv?"
BEGIN
PUSHBUTTON "E&xit", IDOK, 55, 56, 30, 14
DEFPUSHBUTTON "&Cancel", IDCANCEL, 95, 56, 30, 14
@@ -89,14 +86,14 @@ END
* Menus
*/
-IDM_TRAYICON_MENU MENU DISCARDABLE
+IDM_TRAYICON_MENU MENU
BEGIN
POPUP "TRAYICON_MENU"
BEGIN
MENUITEM "&Hide Root Window", ID_APP_HIDE_ROOT
MENUITEM "&About...", ID_APP_ABOUT
MENUITEM SEPARATOR
- MENUITEM "E&xit", ID_APP_EXIT
+ MENUITEM "E&xit...", ID_APP_EXIT
END
END
@@ -105,5 +102,5 @@ END
* Icons
*/
-IDI_XWIN ICON DISCARDABLE "X.ico"
-IDI_XWIN_BOXED ICON DISCARDABLE "X-boxed.ico"
+IDI_XWIN ICON "X.ico"
+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "XWin.exe.manifest"
diff --git a/xorg-server/hw/xwin/makefile b/xorg-server/hw/xwin/makefile
new file mode 100644
index 000000000..5b409759d
--- /dev/null
+++ b/xorg-server/hw/xwin/makefile
@@ -0,0 +1,101 @@
+LIBRARY = libXWin
+
+SRCS_CLIPBOARD = \
+ winclipboardinit.c \
+ winclipboardtextconv.c \
+ winclipboardthread.c \
+ winclipboardunicode.c \
+ winclipboardwndproc.c \
+ winclipboardwrappers.c \
+ winclipboardxevents.c
+
+DEFINES += XWIN_CLIPBOARD
+
+SRCS_MULTIWINDOW = \
+ winmultiwindowshape.c \
+ winmultiwindowwindow.c \
+ winmultiwindowwm.c \
+ winmultiwindowwndproc.c
+
+DEFINES += XWIN_MULTIWINDOW
+
+SRCS_RANDR = \
+ winrandr.c
+DEFINES += XWIN_RANDR RELOCATE_PROJECTROOT
+
+CSRCS = InitInput.c \
+ InitOutput.c \
+ winallpriv.c \
+ winauth.c \
+ winblock.c \
+ wincmap.c \
+ winconfig.c \
+ wincreatewnd.c \
+ wincursor.c \
+ windialogs.c \
+ winengine.c \
+ winerror.c \
+ winglobals.c \
+ winkeybd.c \
+ winkeyhook.c \
+ winmisc.c \
+ winmouse.c \
+ winmsg.c \
+ winmultiwindowclass.c \
+ winmultiwindowicons.c \
+ winprefs.c \
+ winprocarg.c \
+ winregistry.c \
+ winscrinit.c \
+ winshaddd.c \
+ winshadddnl.c \
+ winshadgdi.c \
+ wintrayicon.c \
+ winvalargs.c \
+ winwakeup.c \
+ winwindow.c \
+ winprefslex.c \
+ winprefsyacc.c \
+ winwndproc.c $(SRCS_RANDR) $(SRCS_MULTIWINDOW) $(SRCS_CLIPBOARD)
+
+DEFINES += YY_NO_UNISTD_H
+
+# XWin.rc \
+# $(top_srcdir)/Xext/dpmsstubs.c \
+# $(top_srcdir)/Xi/stubs.c \
+# $(top_srcdir)/mi/miinitext.c \
+# $(top_srcdir)/fb/fbcmap_mi.c \
+# $(SRCS_CLIPBOARD) \
+# $(SRCS_GLX_WINDOWS) \
+# $(SRCS_MULTIWINDOW) \
+# $(SRCS_MULTIWINDOWEXTWM) \
+# $(SRCS_NATIVEGDI) \
+# $(SRCS_PRIMARYFB) \
+# $(SRCS_RANDR) \
+# $(SRCS_XV)
+
+INCLUDES += ..\..\miext\rootless
+
+SRCS_NATIVEGDI = \
+ winclip.c \
+ winfillsp.c \
+ winfont.c \
+ wingc.c \
+ wingetsp.c \
+ winnativegdi.c \
+ winpixmap.c \
+ winpolyline.c \
+ winpushpxl.c \
+ winrop.c \
+ winsetsp.c
+CSRCS += $(SRCS_NATIVEGDI)
+DEFINES += XWIN_NATIVEGDI
+
+#.rc.o:
+
+# $(WINDRES) --use-temp-file -i $< --input-format=rc -o $@ -O coff -I $(top_builddir)/include -DPROJECT_NAME=\"$(VENDOR_NAME_SHORT)\" -DPROJECT_VERSION=\"$(PACKAGE_VERSION)\" -DBUILD_DATE=\"$(BUILD_DATE)\"
+
+DEFINES += HAVE_XWIN_CONFIG_H BUILD_DATE=0-0-0000 PTW32_STATIC_LIB
+
+#CSRCS=winkeybd.c
+
diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h
index 3ab324931..62fcd83b8 100644
--- a/xorg-server/hw/xwin/win.h
+++ b/xorg-server/hw/xwin/win.h
@@ -103,6 +103,7 @@
#define WIN_E3B_TIMER_ID 1
#define WIN_POLLING_MOUSE_TIMER_ID 2
+#define MOUSE_POLLING_INTERVAL 50
#define WIN_E3B_OFF -1
#define WIN_FD_INVALID -1
@@ -142,6 +143,9 @@
#include <errno.h>
#if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW)
#define HANDLE void *
+#ifdef _MSC_VER
+typedef int pid_t;
+#endif
#include <pthread.h>
#undef HANDLE
#endif
@@ -314,6 +318,7 @@ typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr);
typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin);
+typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr);
/* Typedef for DIX wrapper functions */
typedef int (*winDispatchProcPtr) (ClientPtr);
@@ -564,6 +569,8 @@ typedef struct _winPrivScreenRec
winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface;
winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface;
+ winCreateScreenResourcesProc pwinCreateScreenResources;
+
#ifdef XWIN_MULTIWINDOW
/* Window Procedures for MultiWindow mode */
winFinishCreateWindowsWindowProcPtr pwinFinishCreateWindowsWindow;
@@ -590,6 +597,11 @@ typedef struct _winPrivScreenRec
SetShapeProcPtr SetShape;
#endif
+#ifdef XWIN_NATIVEGDI
+ RealizeFontProcPtr RealizeFont;
+ UnrealizeFontProcPtr UnrealizeFont;
+#endif
+
winCursorRec cursor;
} winPrivScreenRec;
@@ -1006,6 +1018,9 @@ winMouseButtonsHandle (ScreenPtr pScreen,
int iEventType, int iButton,
WPARAM wParam);
+void
+winEnqueueMotion(int x, int y);
+
#ifdef XWIN_NATIVEGDI
/*
* winnativegdi.c
diff --git a/xorg-server/hw/xwin/winclipboard.h b/xorg-server/hw/xwin/winclipboard.h
index 445c01b27..9603b92fe 100644
--- a/xorg-server/hw/xwin/winclipboard.h
+++ b/xorg-server/hw/xwin/winclipboard.h
@@ -34,15 +34,20 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#ifdef __CYGWIN__
#include <sys/select.h>
#else
-#include "Xwinsock.h"
+#include "X11/Xwinsock.h"
#define HAS_WINSOCK
#endif
#include <fcntl.h>
#include <setjmp.h>
+#ifdef _MSC_VER
+typedef int pid_t;
+#endif
#include <pthread.h>
/* X headers */
@@ -60,8 +65,10 @@
#define ATOM DWORD
#ifndef __CYGWIN__
+#ifndef sleep
#define sleep(x) Sleep (1000 * (x))
#endif
+#endif
/* Windows headers */
#ifndef XFree86Server
diff --git a/xorg-server/hw/xwin/winclipboardthread.c b/xorg-server/hw/xwin/winclipboardthread.c
index 081abd5e7..0e654d267 100644
--- a/xorg-server/hw/xwin/winclipboardthread.c
+++ b/xorg-server/hw/xwin/winclipboardthread.c
@@ -1,5 +1,6 @@
/*
*Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *Copyright (C) Colin Harrison 2005-2008
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -20,12 +21,13 @@
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
- *Except as contained in this notice, the name of Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
+ *Except as contained in this notice, the name of the copyright holder(s)
+ *and author(s) shall not be used in advertising or otherwise to promote
+ *the sale, use or other dealings in this Software without prior written
+ *authorization from the copyright holder(s) and author(s).
*
* Authors: Harold L Hunt II
+ * Colin Harrison
*/
#ifdef HAVE_XWIN_CONFIG_H
@@ -38,6 +40,10 @@
#endif
#include "X11/Xauth.h"
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#define max __max
+#endif
/*
* Constants
@@ -218,7 +224,7 @@ winClipboardProc (void *pvNotUsed)
#ifdef HAS_DEVWINDOWS
/* Open a file descriptor for the windows message queue */
- fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, O_RDONLY);
+ fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, _O_RDONLY);
if (fdMessageQueue == -1)
{
ErrorF ("winClipboardProc - Failed opening %s\n", WIN_MSG_QUEUE_FNAME);
@@ -231,15 +237,6 @@ winClipboardProc (void *pvNotUsed)
iMaxDescriptor = iConnectionNumber + 1;
#endif
- /* Select event types to watch */
- if (XSelectInput (pDisplay,
- DefaultRootWindow (pDisplay),
- SubstructureNotifyMask |
- StructureNotifyMask |
- PropertyChangeMask) == BadWindow)
- ErrorF ("winClipboardProc - XSelectInput generated BadWindow "
- "on RootWindow\n\n");
-
/* Create atoms */
atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False);
atomClipboardManager = XInternAtom (pDisplay, "CLIPBOARD_MANAGER", False);
@@ -258,6 +255,13 @@ winClipboardProc (void *pvNotUsed)
pthread_exit (NULL);
}
+ /* Select event types to watch */
+ if (XSelectInput (pDisplay,
+ iWindow,
+ PropertyChangeMask) == BadWindow)
+ ErrorF ("winClipboardProc - XSelectInput generated BadWindow "
+ "on messaging window\n");
+
/* Save the window in the screen privates */
g_iClipboardWindow = iWindow;
@@ -273,7 +277,8 @@ winClipboardProc (void *pvNotUsed)
/* PRIMARY */
iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY,
iWindow, CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow)
+ if (iReturn == BadAtom || iReturn == BadWindow ||
+ XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow)
{
ErrorF ("winClipboardProc - Could not set PRIMARY owner\n");
pthread_exit (NULL);
@@ -282,7 +287,8 @@ winClipboardProc (void *pvNotUsed)
/* CLIPBOARD */
iReturn = XSetSelectionOwner (pDisplay, atomClipboard,
iWindow, CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow)
+ if (iReturn == BadAtom || iReturn == BadWindow ||
+ XGetSelectionOwner (pDisplay, atomClipboard) != iWindow)
{
ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n");
pthread_exit (NULL);
diff --git a/xorg-server/hw/xwin/winclipboardunicode.c b/xorg-server/hw/xwin/winclipboardunicode.c
index ba86915a4..531f5703a 100644
--- a/xorg-server/hw/xwin/winclipboardunicode.c
+++ b/xorg-server/hw/xwin/winclipboardunicode.c
@@ -43,25 +43,43 @@ Bool
winClipboardDetectUnicodeSupport (void)
{
Bool fReturn = FALSE;
- OSVERSIONINFO osvi = {0};
+ OSVERSIONINFOEX osvi = {0};
/* Get operating system version information */
osvi.dwOSVersionInfoSize = sizeof (osvi);
- GetVersionEx (&osvi);
+ GetVersionEx ((LPOSVERSIONINFO)&osvi);
/* Branch on platform ID */
switch (osvi.dwPlatformId)
{
case VER_PLATFORM_WIN32_NT:
- /* Unicode supported on NT only */
- ErrorF ("DetectUnicodeSupport - Windows NT/2000/XP\n");
- fReturn = TRUE;
+ if (osvi.dwMajorVersion >= 6)
+ {
+ if (osvi.wProductType == VER_NT_WORKSTATION)
+ ErrorF ("OS: Windows Vista\n");
+ else
+ ErrorF ("OS: Windows Server 2008\n");
+ fReturn = TRUE;
+ }
+ else if (osvi.dwMajorVersion == 5)
+ {
+ if (osvi.dwMinorVersion == 2)
+ {
+ ErrorF ("OS: Windows 2003\n");
+ fReturn = TRUE;
+ }
+ else if (osvi.dwMinorVersion == 1)
+ {
+ ErrorF ("OS: Windows XP\n");
+ fReturn = TRUE;
+ }
+ else if (osvi.dwMinorVersion == 0) ErrorF ("OS: Windows 2000\n");
+ }
+ else if (osvi.dwMajorVersion <= 4) ErrorF ("OS: Windows NT\n");
break;
case VER_PLATFORM_WIN32_WINDOWS:
- /* Unicode is not supported on non-NT */
- ErrorF ("DetectUnicodeSupport - Windows 95/98/Me\n");
- fReturn = FALSE;
+ ErrorF ("OS: Windows 95/98/Me\n");
break;
}
diff --git a/xorg-server/hw/xwin/winclipboardwndproc.c b/xorg-server/hw/xwin/winclipboardwndproc.c
index 802a74035..a69edaeca 100644
--- a/xorg-server/hw/xwin/winclipboardwndproc.c
+++ b/xorg-server/hw/xwin/winclipboardwndproc.c
@@ -1,5 +1,6 @@
/*
*Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *Copyright (C) Colin Harrison 2005-2008
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -20,12 +21,13 @@
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
- *Except as contained in this notice, the name of Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
+ *Except as contained in this notice, the name of the copyright holder(s)
+ *and author(s) shall not be used in advertising or otherwise to promote
+ *the sale, use or other dealings in this Software without prior written
+ *authorization from the copyright holder(s) and author(s).
*
* Authors: Harold L Hunt II
+ * Colin Harrison
*/
#ifdef HAVE_XWIN_CONFIG_H
@@ -63,7 +65,7 @@ extern HWND g_hwndClipboard;
* Local function prototypes
*/
-static Bool
+static int
winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay,
Bool fUseUnicode, int iTimeoutSec);
@@ -260,12 +262,15 @@ winClipboardWindowProc (HWND hwnd, UINT message,
case WM_DRAWCLIPBOARD:
{
static Bool s_fProcessingDrawClipboard = FALSE;
+ static Atom atomClipboard;
Display *pDisplay = g_pClipboardDisplay;
Window iWindow = g_iClipboardWindow;
int iReturn;
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Enter\n");
+ if (atomClipboard == None) atomClipboard = XInternAtom (pDisplay, "CLIPBOARD", False);
+
/*
* We've occasionally seen a loop in the clipboard chain.
* Try and fix it on the first hint of recursion.
@@ -353,17 +358,13 @@ winClipboardWindowProc (HWND hwnd, UINT message,
/* Release CLIPBOARD selection if owned */
iReturn = XGetSelectionOwner (pDisplay,
- XInternAtom (pDisplay,
- "CLIPBOARD",
- False));
+ atomClipboard);
if (iReturn == g_iClipboardWindow)
{
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
"CLIPBOARD selection is owned by us.\n");
XSetSelectionOwner (pDisplay,
- XInternAtom (pDisplay,
- "CLIPBOARD",
- False),
+ atomClipboard,
None,
CurrentTime);
}
@@ -383,7 +384,8 @@ winClipboardWindowProc (HWND hwnd, UINT message,
XA_PRIMARY,
iWindow,
CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow)
+ if (iReturn == BadAtom || iReturn == BadWindow ||
+ XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow)
{
winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
"Could not reassert ownership of PRIMARY\n");
@@ -396,12 +398,12 @@ winClipboardWindowProc (HWND hwnd, UINT message,
/* Reassert ownership of the CLIPBOARD */
iReturn = XSetSelectionOwner (pDisplay,
- XInternAtom (pDisplay,
- "CLIPBOARD",
- False),
+ atomClipboard,
iWindow,
CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow)
+
+ if (iReturn == BadAtom || iReturn == BadWindow ||
+ XGetSelectionOwner (pDisplay, atomClipboard) != iWindow)
{
winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
"Could not reassert ownership of CLIPBOARD\n");
diff --git a/xorg-server/hw/xwin/winclipboardwrappers.c b/xorg-server/hw/xwin/winclipboardwrappers.c
index 2cfe0ffce..5578182c1 100644
--- a/xorg-server/hw/xwin/winclipboardwrappers.c
+++ b/xorg-server/hw/xwin/winclipboardwrappers.c
@@ -1,5 +1,6 @@
/*
*Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *Copyright (C) Colin Harrison 2005-2008
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -20,12 +21,13 @@
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
- *Except as contained in this notice, the name of Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
+ *Except as contained in this notice, the name of the copyright holder(s)
+ *and author(s) shall not be used in advertising or otherwise to promote
+ *the sale, use or other dealings in this Software without prior written
+ *authorization from the copyright holder(s) and author(s).
*
* Authors: Harold L Hunt II
+ * Colin Harrison
*/
#ifdef HAVE_XWIN_CONFIG_H
@@ -40,6 +42,7 @@
* Constants
*/
+#define CLIP_NUM_CALLS 4
#define CLIP_NUM_SELECTIONS 2
#define CLIP_OWN_PRIMARY 0
#define CLIP_OWN_CLIPBOARD 1
@@ -85,6 +88,8 @@ winProcQueryTree (ClientPtr client)
{
int iReturn;
+ ErrorF ("winProcQueryTree - Hello\n");
+
/*
* This procedure is only used for initialization.
* We can unwrap the original procedure at this point
@@ -184,7 +189,7 @@ winProcEstablishConnection (ClientPtr client)
static int s_iCallCount = 0;
static unsigned long s_ulServerGeneration = 0;
- ErrorF ("winProcEstablishConnection - Hello\n");
+ if (s_iCallCount == 0 || s_iCallCount == CLIP_NUM_CALLS) ErrorF ("winProcEstablishConnection - Hello\n");
/* Do nothing if clipboard is not enabled */
if (!g_fClipboard)
@@ -212,13 +217,15 @@ winProcEstablishConnection (ClientPtr client)
/* Increment call count */
++s_iCallCount;
- /* Wait for second call when Xdmcp is enabled */
+ /* Wait for CLIP_NUM_CALLS when Xdmcp is enabled */
if (g_fXdmcpEnabled
&& !g_fClipboardLaunched
- && s_iCallCount < 4)
+ && s_iCallCount < CLIP_NUM_CALLS)
{
- ErrorF ("winProcEstablishConnection - Xdmcp enabled, waiting to "
- "start clipboard client until fourth call.\n");
+ if (s_iCallCount == 1) ErrorF ("winProcEstablishConnection - Xdmcp, waiting to "
+ "start clipboard client until %dth call", CLIP_NUM_CALLS);
+ if (s_iCallCount == CLIP_NUM_CALLS - 1) ErrorF (".\n");
+ else ErrorF (".");
return (*winProcEstablishConnectionOrig) (client);
}
@@ -275,7 +282,7 @@ winProcEstablishConnection (ClientPtr client)
* 8) Unfortunately, there is another problem.
* 9) XDM walks the list of windows with XQueryTree,
* killing any client it finds with a window.
- * 10)Thus, when using XDMCP we wait until the second call
+ * 10)Thus, when using XDMCP we wait until CLIP_NUM_CALLS
* to ProcEstablishCeonnection before we startup the clipboard
* client. This should prevent XDM from finding the clipboard
* client, since it has not yet created a window.
diff --git a/xorg-server/hw/xwin/winclipboardxevents.c b/xorg-server/hw/xwin/winclipboardxevents.c
index d4c617bec..09bdb7396 100644
--- a/xorg-server/hw/xwin/winclipboardxevents.c
+++ b/xorg-server/hw/xwin/winclipboardxevents.c
@@ -1,5 +1,6 @@
/*
*Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *Copyright (C) Colin Harrison 2005-2008
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -20,12 +21,13 @@
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
- *Except as contained in this notice, the name of Harold L Hunt II
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from Harold L Hunt II.
+ *Except as contained in this notice, the name of the copyright holder(s)
+ *and author(s) shall not be used in advertising or otherwise to promote
+ *the sale, use or other dealings in this Software without prior written
+ *authorization from the copyright holder(s) and author(s).
*
* Authors: Harold L Hunt II
+ * Colin Harrison
*/
#ifdef HAVE_XWIN_CONFIG_H
@@ -51,18 +53,25 @@ winClipboardFlushXEvents (HWND hwnd,
Display *pDisplay,
Bool fUseUnicode)
{
- Atom atomLocalProperty = XInternAtom (pDisplay,
- WIN_LOCAL_PROPERTY,
- False);
- Atom atomUTF8String = XInternAtom (pDisplay,
- "UTF8_STRING",
- False);
- Atom atomCompoundText = XInternAtom (pDisplay,
- "COMPOUND_TEXT",
- False);
- Atom atomTargets = XInternAtom (pDisplay,
- "TARGETS",
- False);
+ static Atom atomLocalProperty, atomCompoundText;
+ static Atom atomUTF8String, atomTargets;
+
+ if (atomLocalProperty == None)
+ atomLocalProperty = XInternAtom (pDisplay,
+ WIN_LOCAL_PROPERTY,
+ False);
+ if (atomUTF8String == None)
+ atomUTF8String = XInternAtom (pDisplay,
+ "UTF8_STRING",
+ False);
+ if (atomCompoundText == None)
+ atomCompoundText = XInternAtom (pDisplay,
+ "COMPOUND_TEXT",
+ False);
+ if (atomTargets == None)
+ atomTargets = XInternAtom (pDisplay,
+ "TARGETS",
+ False);
/* Process all pending events */
while (XPending (pDisplay))
@@ -183,6 +192,7 @@ winClipboardFlushXEvents (HWND hwnd,
}
/* Check that clipboard format is available */
+ XLockDisplay (pDisplay);
if (fUseUnicode
&& !IsClipboardFormatAvailable (CF_UNICODETEXT))
{
@@ -190,6 +200,7 @@ winClipboardFlushXEvents (HWND hwnd,
"available from Win32 clipboard. Aborting.\n");
/* Abort */
+ XUnlockDisplay (pDisplay);
fAbort = TRUE;
goto winClipboardFlushXEvents_SelectionRequest_Done;
}
@@ -200,6 +211,7 @@ winClipboardFlushXEvents (HWND hwnd,
"available from Win32 clipboard. Aborting.\n");
/* Abort */
+ XUnlockDisplay (pDisplay);
fAbort = TRUE;
goto winClipboardFlushXEvents_SelectionRequest_Done;
}
@@ -218,6 +230,7 @@ winClipboardFlushXEvents (HWND hwnd,
GetLastError ());
/* Abort */
+ XUnlockDisplay (pDisplay);
fAbort = TRUE;
goto winClipboardFlushXEvents_SelectionRequest_Done;
}
@@ -259,6 +272,7 @@ winClipboardFlushXEvents (HWND hwnd,
GetLastError ());
/* Abort */
+ XUnlockDisplay (pDisplay);
fAbort = TRUE;
goto winClipboardFlushXEvents_SelectionRequest_Done;
}
@@ -294,6 +308,7 @@ winClipboardFlushXEvents (HWND hwnd,
/* Convert DOS string to UNIX string */
winClipboardDOStoUNIX (pszConvertData, strlen (pszConvertData));
+ XUnlockDisplay (pDisplay);
/* Setup our text list */
pszTextList[0] = pszConvertData;
@@ -301,6 +316,7 @@ winClipboardFlushXEvents (HWND hwnd,
/* Initialize the text property */
xtpText.value = NULL;
+ xtpText.nitems = 0;
/* Create the text property from the text list */
if (fUseUnicode)
@@ -361,10 +377,13 @@ winClipboardFlushXEvents (HWND hwnd,
/* Release the clipboard data */
GlobalUnlock (hGlobal);
pszGlobalData = NULL;
+ fCloseClipboard = FALSE;
+ CloseClipboard ();
/* Clean up */
XFree (xtpText.value);
xtpText.value = NULL;
+ xtpText.nitems = 0;
/* Setup selection notify event */
eventSelection.type = SelectionNotify;
@@ -395,7 +414,11 @@ winClipboardFlushXEvents (HWND hwnd,
winClipboardFlushXEvents_SelectionRequest_Done:
/* Free allocated resources */
if (xtpText.value)
+ {
XFree (xtpText.value);
+ xtpText.value = NULL;
+ xtpText.nitems = 0;
+ }
if (pszConvertData)
free (pszConvertData);
if (hGlobal && pszGlobalData)
@@ -436,7 +459,10 @@ winClipboardFlushXEvents (HWND hwnd,
/* Close clipboard if it was opened */
if (fCloseClipboard)
+ {
+ fCloseClipboard = FALSE;
CloseClipboard ();
+ }
break;
@@ -618,11 +644,12 @@ winClipboardFlushXEvents (HWND hwnd,
/* Conversion succeeded or some unconvertible characters */
if (ppszTextList != NULL)
{
+ iReturnDataLen = 0;
for (i = 0; i < iCount; i++)
{
iReturnDataLen += strlen(ppszTextList[i]);
}
- pszReturnData = malloc (iReturnDataLen + 1);
+ pszReturnData = (char *) malloc (iReturnDataLen + 1);
pszReturnData[0] = '\0';
for (i = 0; i < iCount; i++)
{
@@ -633,7 +660,7 @@ winClipboardFlushXEvents (HWND hwnd,
{
ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
"X*TextPropertyToTextList list_return is NULL.\n");
- pszReturnData = malloc (1);
+ pszReturnData = (char *) malloc (1);
pszReturnData[0] = '\0';
}
}
@@ -653,7 +680,7 @@ winClipboardFlushXEvents (HWND hwnd,
ErrorF ("%d", iReturn);
break;
}
- pszReturnData = malloc (1);
+ pszReturnData = (char *) malloc (1);
pszReturnData[0] = '\0';
}
@@ -663,9 +690,11 @@ winClipboardFlushXEvents (HWND hwnd,
ppszTextList = NULL;
XFree (xtpText.value);
xtpText.value = NULL;
+ xtpText.nitems = 0;
/* Convert the X clipboard string to DOS format */
- winClipboardUNIXtoDOS (&pszReturnData, strlen (pszReturnData));
+ XLockDisplay (pDisplay);
+ winClipboardUNIXtoDOS ((unsigned char **)&pszReturnData, strlen (pszReturnData));
if (fUseUnicode)
{
@@ -711,6 +740,8 @@ winClipboardFlushXEvents (HWND hwnd,
hGlobal = GlobalAlloc (GMEM_MOVEABLE, iConvertDataLen);
}
+ free (pszReturnData);
+
/* Check that global memory was allocated */
if (!hGlobal)
{
@@ -770,11 +801,16 @@ winClipboardFlushXEvents (HWND hwnd,
*/
winClipboardFlushXEvents_SelectionNotify_Done:
+ XUnlockDisplay (pDisplay);
/* Free allocated resources */
if (ppszTextList)
XFreeStringList (ppszTextList);
if (xtpText.value)
+ {
XFree (xtpText.value);
+ xtpText.value = NULL;
+ xtpText.nitems = 0;
+ }
if (pszConvertData)
free (pszConvertData);
if (pwszUnicodeStr)
diff --git a/xorg-server/hw/xwin/wincreatewnd.c b/xorg-server/hw/xwin/wincreatewnd.c
index 796a08593..85b6cf8a9 100644
--- a/xorg-server/hw/xwin/wincreatewnd.c
+++ b/xorg-server/hw/xwin/wincreatewnd.c
@@ -88,7 +88,9 @@ winCreateBoundingWindowFullScreen (ScreenPtr pScreen)
snprintf (szTitle,
sizeof (szTitle),
WINDOW_TITLE_XDMCP,
- g_pszQueryHost);
+ g_pszQueryHost,
+ display,
+ (int) pScreenInfo->dwScreen);
else
snprintf (szTitle,
sizeof (szTitle),
@@ -331,7 +333,9 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
snprintf (szTitle,
sizeof (szTitle),
WINDOW_TITLE_XDMCP,
- g_pszQueryHost);
+ g_pszQueryHost,
+ display,
+ (int) pScreenInfo->dwScreen);
else
snprintf (szTitle,
sizeof (szTitle),
diff --git a/xorg-server/hw/xwin/wincursor.c b/xorg-server/hw/xwin/wincursor.c
index 021b8b82c..0b8f7e7b2 100644
--- a/xorg-server/hw/xwin/wincursor.c
+++ b/xorg-server/hw/xwin/wincursor.c
@@ -99,8 +99,16 @@ winPointerWarpCursor (ScreenPtr pScreen, int x, int y)
return;
}
- /* Only update the Windows cursor position if we are active */
- if (pScreenPriv->hwndScreen == GetForegroundWindow ())
+ /*
+ Only update the Windows cursor position if root window is active,
+ or we are in a rootless mode
+ */
+ if ((pScreenPriv->hwndScreen == GetForegroundWindow ())
+ || pScreenPriv->pScreenInfo->fRootless
+#ifdef XWIN_MULTIWINDOW
+ || pScreenPriv->pScreenInfo->fMultiWindow
+#endif
+ )
{
/* Get the client area coordinates */
GetClientRect (pScreenPriv->hwndScreen, &rcClient);
@@ -601,9 +609,11 @@ winInitCursor (ScreenPtr pScreen)
pPointPriv = (miPointerScreenPtr)
dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
+ if (pPointPriv)
+ {
pScreenPriv->cursor.spriteFuncs = pPointPriv->spriteFuncs;
pPointPriv->spriteFuncs = &winSpriteFuncsRec;
-
+ }
pScreenPriv->cursor.handle = NULL;
pScreenPriv->cursor.visible = FALSE;
diff --git a/xorg-server/hw/xwin/windialogs.c b/xorg-server/hw/xwin/windialogs.c
index ab06b0d00..822941e83 100644
--- a/xorg-server/hw/xwin/windialogs.c
+++ b/xorg-server/hw/xwin/windialogs.c
@@ -54,6 +54,10 @@ extern Bool g_fClipboardStarted;
#endif
extern Bool g_fSoftwareCursor;
+#if defined(XWIN_MULTIWINDOW)
+extern HICON g_hIconX;
+extern HICON g_hSmallIconX;
+#endif
/*
* Local function prototypes
@@ -112,8 +116,8 @@ winDrawURLWindow (LPARAM lParam)
crText = RGB(0,0,128+64);
SetTextColor (draw->hDC, crText);
- /* Create underlined font 14 high, standard dialog font */
- font = CreateFont (-14, 0, 0, 0, FW_NORMAL, FALSE, TRUE, FALSE,
+ /* Create font 8 high, standard dialog font */
+ font = CreateFont (-8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
0, 0, 0, 0, 0, "MS Sans Serif");
if (!font)
{
@@ -181,34 +185,73 @@ winUnoverrideURLButton (HWND hwnd, int id)
/*
* Center a dialog window in the desktop window
+ * and set small and large icons to X icons.
*/
static void
-winCenterDialog (HWND hwndDlg)
+winInitDialog (HWND hwndDlg)
{
HWND hwndDesk;
- RECT rc, rcDlg, rcDesk;
-
+ RECT rc, rcDlg, rcDesk;
+ HICON hIcon, hIconSmall;
+
hwndDesk = GetParent (hwndDlg);
if (!hwndDesk || IsIconic (hwndDesk))
hwndDesk = GetDesktopWindow ();
- GetWindowRect (hwndDesk, &rcDesk);
- GetWindowRect (hwndDlg, &rcDlg);
- CopyRect (&rc, &rcDesk);
-
- OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top);
- OffsetRect (&rc, -rc.left, -rc.top);
- OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom);
-
- SetWindowPos (hwndDlg,
- HWND_TOP,
- rcDesk.left + (rc.right / 2),
- rcDesk.top + (rc.bottom / 2),
- 0, 0,
- SWP_NOSIZE | SWP_NOZORDER);
-}
+ /* Remove minimize and maximize buttons */
+ SetWindowLongPtr (hwndDlg, GWL_STYLE,
+ GetWindowLongPtr (hwndDlg, GWL_STYLE)
+ & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX));
+
+ /* Set Window not to show in the task bar */
+ SetWindowLongPtr (hwndDlg, GWL_EXSTYLE,
+ GetWindowLongPtr (hwndDlg, GWL_EXSTYLE) & ~WS_EX_APPWINDOW );
+
+ /* Center dialog window in the screen. Not done for multi-monitor systems, where
+ * it is likely to end up split across the screens. In that case, it appears
+ * near the Tray icon.
+ */
+ if (GetSystemMetrics(SM_CMONITORS)>1) {
+ /* Still need to refresh the frame change. */
+ SetWindowPos (hwndDlg, HWND_TOP, 0,0,0,0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
+ } else {
+ GetWindowRect (hwndDesk, &rcDesk);
+ GetWindowRect (hwndDlg, &rcDlg);
+ CopyRect (&rc, &rcDesk);
+
+ OffsetRect (&rcDlg, -rcDlg.left, -rcDlg.top);
+ OffsetRect (&rc, -rc.left, -rc.top);
+ OffsetRect (&rc, -rcDlg.right, -rcDlg.bottom);
+
+ SetWindowPos (hwndDlg,
+ HWND_TOPMOST,
+ rcDesk.left + (rc.right / 2),
+ rcDesk.top + (rc.bottom / 2),
+ 0, 0,
+ SWP_NOSIZE | SWP_FRAMECHANGED);
+ }
+#ifdef XWIN_MULTIWINDOW
+ if (g_hIconX) hIcon=g_hIconX;
+ else
+#endif
+ hIcon = LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN));
+
+#ifdef XWIN_MULTIWINDOW
+ if (g_hSmallIconX) hIconSmall=g_hSmallIconX;
+ else
+#endif
+ hIconSmall = LoadImage (g_hInstance,
+ MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON,
+ GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON),
+ LR_SHARED);
+
+ PostMessage (hwndDlg, WM_SETICON, ICON_BIG, (LPARAM) hIcon);
+ PostMessage (hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSmall);
+}
/*
* Display the Exit dialog box
@@ -220,7 +263,7 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv)
int i;
int liveClients = 0;
- /* Count up running clinets (clients[0] is serverClient) */
+ /* Count up running clients (clients[0] is serverClient) */
for (i = 1; i < currentMaxClients; i++)
if (clients[i] != NullClient)
liveClients++;
@@ -271,15 +314,6 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv)
winExitDlgProc,
(int) pScreenPriv);
- /* Drop minimize and maximize buttons */
- SetWindowLong (g_hDlgExit, GWL_STYLE,
- GetWindowLong (g_hDlgExit, GWL_STYLE)
- & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX));
- SetWindowLong (g_hDlgExit, GWL_EXSTYLE,
- GetWindowLong (g_hDlgExit, GWL_EXSTYLE) & ~WS_EX_APPWINDOW );
- SetWindowPos (g_hDlgExit, HWND_TOPMOST, 0, 0, 0, 0,
- SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
-
/* Show the dialog box */
ShowWindow (g_hDlgExit, SW_SHOW);
@@ -314,14 +348,7 @@ winExitDlgProc (HWND hDialog, UINT message,
/* Store pointers to private structures for future use */
s_pScreenPriv = (winPrivScreenPtr) lParam;
- winCenterDialog (hDialog);
-
- /* Set icon to standard app icon */
- PostMessage (hDialog,
- WM_SETICON,
- ICON_SMALL,
- (LPARAM) LoadIcon (g_hInstance,
- MAKEINTRESOURCE(IDI_XWIN)));
+ winInitDialog (hDialog);
/* Format the connected clients string */
pszConnectedClients = Xprintf (CONNECTED_CLIENTS_FORMAT,
@@ -413,17 +440,6 @@ winDisplayDepthChangeDialog (winPrivScreenPtr pScreenPriv)
pScreenPriv->hwndScreen,
winChangeDepthDlgProc,
(int) pScreenPriv);
-
- /* Drop minimize and maximize buttons */
- SetWindowLong (g_hDlgDepthChange, GWL_STYLE,
- GetWindowLong (g_hDlgDepthChange, GWL_STYLE)
- & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX));
- SetWindowLong (g_hDlgDepthChange, GWL_EXSTYLE,
- GetWindowLong (g_hDlgDepthChange, GWL_EXSTYLE)
- & ~WS_EX_APPWINDOW );
- SetWindowPos (g_hDlgDepthChange, 0, 0, 0, 0, 0,
- SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSIZE);
-
/* Show the dialog box */
ShowWindow (g_hDlgDepthChange, SW_SHOW);
@@ -480,13 +496,7 @@ winChangeDepthDlgProc (HWND hwndDialog, UINT message,
s_pScreenPriv->dwLastWindowsBitsPixel);
#endif
- winCenterDialog( hwndDialog );
-
- /* Set icon to standard app icon */
- PostMessage (hwndDialog,
- WM_SETICON,
- ICON_SMALL,
- (LPARAM) LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)));
+ winInitDialog( hwndDialog );
return TRUE;
@@ -572,15 +582,6 @@ winDisplayAboutDialog (winPrivScreenPtr pScreenPriv)
winAboutDlgProc,
(int) pScreenPriv);
- /* Drop minimize and maximize buttons */
- SetWindowLong (g_hDlgAbout, GWL_STYLE,
- GetWindowLong (g_hDlgAbout, GWL_STYLE)
- & ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX));
- SetWindowLong (g_hDlgAbout, GWL_EXSTYLE,
- GetWindowLong (g_hDlgAbout, GWL_EXSTYLE) & ~WS_EX_APPWINDOW);
- SetWindowPos (g_hDlgAbout, 0, 0, 0, 0, 0,
- SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
-
/* Show the dialog box */
ShowWindow (g_hDlgAbout, SW_SHOW);
@@ -622,13 +623,7 @@ winAboutDlgProc (HWND hwndDialog, UINT message,
s_pScreenInfo = s_pScreenPriv->pScreenInfo;
s_pScreen = s_pScreenInfo->pScreen;
- winCenterDialog (hwndDialog);
-
- /* Set icon to standard app icon */
- PostMessage (hwndDialog,
- WM_SETICON,
- ICON_SMALL,
- (LPARAM) LoadIcon (g_hInstance, MAKEINTRESOURCE(IDI_XWIN)));
+ winInitDialog (hwndDialog);
/* Override the URL buttons */
winOverrideURLButton (hwndDialog, ID_ABOUT_CHANGELOG);
@@ -706,7 +701,7 @@ winAboutDlgProc (HWND hwndDialog, UINT message,
case ID_ABOUT_WEBSITE:
{
- const char * pszPath = "http://x.cygwin.com/";
+ const char * pszPath = __VENDORDWEBSUPPORT__;
int iReturn;
iReturn = (int) ShellExecute (NULL,
diff --git a/xorg-server/hw/xwin/winerror.c b/xorg-server/hw/xwin/winerror.c
index 7d292134f..9c5c92ccf 100644
--- a/xorg-server/hw/xwin/winerror.c
+++ b/xorg-server/hw/xwin/winerror.c
@@ -33,17 +33,17 @@
#endif
#ifdef XVENDORNAME
#define VENDOR_STRING XVENDORNAME
-#define VERSION_STRING XORG_RELEASE
#define VENDOR_CONTACT BUILDERADDR
#endif
-
+#include <../xfree86/common/xorgVersion.h>
#include "win.h"
/* References to external symbols */
extern char * g_pszCommandLine;
extern char * g_pszLogFile;
extern Bool g_fSilentFatalError;
-
+extern Bool g_fSilentDupError;
+extern Bool g_fLogInited;
#ifdef DDXOSVERRORF
/* Prototype */
@@ -62,6 +62,24 @@ OsVendorVErrorF (const char *pszFormat, va_list va_args)
pthread_mutex_lock (&s_pmPrinting);
#endif
+ /*
+ If we want to silence it,
+ detect if we are going to abort due to duplication error
+ */
+ if (g_fSilentDupError)
+ {
+ if ((strcmp(pszFormat,
+ "InitOutput - Duplicate invocation on display "
+ "number: %s. Exiting.\n") == 0)
+ || (strcmp(pszFormat,
+ "Server is already active for display %s\n%s %s\n%s\n") == 0)
+ || (strcmp(pszFormat,
+ "MakeAllCOTSServerListeners: server already running\n") == 0))
+ {
+ g_fSilentFatalError = TRUE;
+ }
+ }
+
/* Print the error message to a log file, could be stderr */
LogVWrite (0, pszFormat, va_args);
@@ -80,7 +98,6 @@ OsVendorVErrorF (const char *pszFormat, va_list va_args)
*
* Attempt to do last-ditch, safe, important cleanup here.
*/
-#ifdef DDXOSFATALERROR
void
OsVendorFatalError (void)
{
@@ -88,12 +105,17 @@ OsVendorFatalError (void)
if (g_fSilentFatalError)
return;
+ if (!g_fLogInited) {
+ g_fLogInited = TRUE;
+ g_pszLogFile = LogInit (g_pszLogFile, NULL);
+ }
+ LogClose ();
+
winMessageBoxF (
"A fatal error has occurred and " PROJECT_NAME " will now exit.\n" \
"Please open %s for more information.\n",
MB_ICONERROR, (g_pszLogFile?g_pszLogFile:"the logfile"));
}
-#endif
/*
@@ -117,13 +139,15 @@ winMessageBoxF (const char *pszError, UINT uType, ...)
#define MESSAGEBOXF \
"%s\n" \
"Vendor: %s\n" \
- "Release: %s\n" \
+ "Release: %d.%d.%d.%d (%d)\n" \
"Contact: %s\n" \
"XWin was started with the following command-line:\n\n" \
"%s\n"
pszMsgBox = Xprintf (MESSAGEBOXF,
- pszErrorF, VENDOR_STRING, VERSION_STRING, VENDOR_CONTACT,
+ pszErrorF, VENDOR_STRING,
+ XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, BUILD_DATE,
+ VENDOR_CONTACT,
g_pszCommandLine);
if (!pszMsgBox)
goto winMessageBoxF_Cleanup;
diff --git a/xorg-server/hw/xwin/winglobals.c b/xorg-server/hw/xwin/winglobals.c
index fddada39e..01604a8c4 100644
--- a/xorg-server/hw/xwin/winglobals.c
+++ b/xorg-server/hw/xwin/winglobals.c
@@ -1,5 +1,6 @@
/*
*Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
+ *Copyright (C) Colin Harrison 2005-2008
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -26,6 +27,7 @@
*from Harold L Hunt II.
*
* Authors: Harold L Hunt II
+ * Colin Harrison
*/
#ifdef HAVE_XWIN_CONFIG_H
@@ -58,10 +60,11 @@ HWND g_hDlgExit = NULL;
HWND g_hDlgAbout = NULL;
const char * g_pszQueryHost = NULL;
Bool g_fXdmcpEnabled = FALSE;
+Bool g_fAuthEnabled = FALSE;
HICON g_hIconX = NULL;
HICON g_hSmallIconX = NULL;
#ifndef RELOCATE_PROJECTROOT
-char * g_pszLogFile = "/tmp/XWin.log";
+char * g_pszLogFile = DEFAULT_LOGDIR "/XWin.%s.log";
#else
char * g_pszLogFile = "XWin.log";
Bool g_fLogFileChanged = FALSE;
diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c
index d574f2053..1cd3e4cb3 100644
--- a/xorg-server/hw/xwin/winkeybd.c
+++ b/xorg-server/hw/xwin/winkeybd.c
@@ -49,10 +49,6 @@
static Bool g_winKeyState[NUM_KEYCODES];
-/* Stored to get internal mode key states. Must be read-only. */
-static unsigned short const *g_winInternalModeKeyStatesPtr = NULL;
-
-
/*
* Local prototypes
*/
@@ -84,6 +80,20 @@ winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode)
int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2];
int iParamScanCode = LOBYTE (HIWORD (lParam));
+/* WM_ key messages faked by Vista speech recognition (WSR) don't have a
+ * scan code.
+ *
+ * Vocola 3 (Rick Mohr's supplement to WSR) uses
+ * System.Windows.Forms.SendKeys.SendWait(), which appears always to give a
+ * scan code of 1
+ */
+ if (iParamScanCode <= 1)
+ {
+ iParamScanCode = MapVirtualKeyEx(wParam,
+ /*MAPVK_VK_TO_VSC*/0,
+ GetKeyboardLayout(0));
+ }
+
/* Branch on special extended, special non-extended, or normal key */
if ((HIWORD (lParam) & KF_EXTENDED) && iKeyFixupEx)
*piScanCode = iKeyFixupEx;
@@ -209,7 +219,6 @@ winKeybdBell (int iPercent, DeviceIntPtr pDeviceInt,
static void
winKeybdCtrl (DeviceIntPtr pDevice, KeybdCtrl *pCtrl)
{
- g_winInternalModeKeyStatesPtr = &(pDevice->key->state);
}
@@ -293,21 +302,23 @@ winKeybdProc (DeviceIntPtr pDeviceInt, int iState)
{
winErrorFVerb (1, "winKeybdProc - Error initializing keyboard AutoRepeat (No XKB)\n");
}
+
+ XkbSetExtension(pDeviceInt, ProcessKeyboardEvent);
}
#endif
-
- g_winInternalModeKeyStatesPtr = &(pDeviceInt->key->state);
break;
case DEVICE_ON:
pDevice->on = TRUE;
- g_winInternalModeKeyStatesPtr = &(pDeviceInt->key->state);
+
+ // immediately copy the state of this keyboard device to the VCK
+ // (which otherwise happens lazily after the first keypress)
+ SwitchCoreKeyboard(pDeviceInt);
break;
case DEVICE_CLOSE:
case DEVICE_OFF:
pDevice->on = FALSE;
- g_winInternalModeKeyStatesPtr = NULL;
break;
}
@@ -369,7 +380,7 @@ winRestoreModeKeyStates ()
unsigned short internalKeyStates;
/* X server is being initialized */
- if (!g_winInternalModeKeyStatesPtr)
+ if (!inputInfo.keyboard)
return;
/* Only process events if the rootwindow is mapped. The keyboard events
@@ -382,7 +393,9 @@ winRestoreModeKeyStates ()
mieqProcessInputEvents ();
/* Read the mode key states of our X server */
- internalKeyStates = *g_winInternalModeKeyStatesPtr;
+ /* (stored in the virtual core keyboard) */
+ internalKeyStates = inputInfo.keyboard->key->state;
+ winDebug("winRestoreModeKeyStates: state %d\n", internalKeyStates);
/*
* NOTE: The C XOR operator, ^, will not work here because it is
@@ -580,6 +593,7 @@ winKeybdReleaseKeys ()
void
winSendKeyEvent (DWORD dwKey, Bool fDown)
{
+ DeviceIntPtr pDev;
xEvent xCurrentEvent;
/*
@@ -597,7 +611,16 @@ winSendKeyEvent (DWORD dwKey, Bool fDown)
xCurrentEvent.u.keyButtonPointer.time =
g_c32LastInputEventTime = GetTickCount ();
xCurrentEvent.u.u.detail = dwKey + MIN_KEYCODE;
- mieqEnqueue (&xCurrentEvent);
+
+#if CYGDEBUG
+ ErrorF("winSendKeyEvent: xCurrentEvent.u.u.type: %d, xCurrentEvent.u.u.detail: %d\n",
+ xCurrentEvent.u.u.type, xCurrentEvent.u.u.detail);
+#endif
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
+ if ((pDev->coreEvents && pDev != inputInfo.keyboard) && pDev->key)
+ {
+ mieqEnqueue (pDev, &xCurrentEvent);
+ }
}
BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam)
diff --git a/xorg-server/hw/xwin/winkeybd.h b/xorg-server/hw/xwin/winkeybd.h
index 09eed1491..d5b115736 100644
--- a/xorg-server/hw/xwin/winkeybd.h
+++ b/xorg-server/hw/xwin/winkeybd.h
@@ -45,6 +45,11 @@
#define WIN_KEYMAP_COLS 3
+/* ASCII column, rows 33 through 40 are for Speech Recognition with
+ * num-lock asserted.
+ * Rows 160 through 165 correspond to software-generated codes, which
+ * may not be associated with the appropriate scan code/extended bit
+ */
const int
g_iKeyMap [] = {
/* count Windows VK, ASCII, ASCII when extended VK */
@@ -81,14 +86,14 @@ g_iKeyMap [] = {
/* 30 */ 0, 0, 0,
/* 31 */ 0, 0, 0,
/* 32 */ 0, 0, 0,
- /* 33 */ VK_PRIOR, 0, KEY_PgUp,
- /* 34 */ VK_NEXT, 0, KEY_PgDown,
- /* 35 */ VK_END, 0, KEY_End,
- /* 36 */ VK_HOME, 0, KEY_Home,
- /* 37 */ VK_LEFT, 0, KEY_Left,
- /* 38 */ VK_UP, 0, KEY_Up,
- /* 39 */ VK_RIGHT, 0, KEY_Right,
- /* 40 */ VK_DOWN, 0, KEY_Down,
+ /* 33 */ VK_PRIOR, KEY_PgUp, KEY_PgUp,
+ /* 34 */ VK_NEXT, KEY_PgDown, KEY_PgDown,
+ /* 35 */ VK_END, KEY_End, KEY_End,
+ /* 36 */ VK_HOME, KEY_Home, KEY_Home,
+ /* 37 */ VK_LEFT, KEY_Left, KEY_Left,
+ /* 38 */ VK_UP, KEY_Up, KEY_Up,
+ /* 39 */ VK_RIGHT, KEY_Right, KEY_Right,
+ /* 40 */ VK_DOWN, KEY_Down, KEY_Down,
/* 41 */ 0, 0, 0,
/* 42 */ 0, 0, 0,
/* 43 */ 0, 0, 0,
@@ -208,12 +213,12 @@ g_iKeyMap [] = {
/* 157 */ 0, 0, 0,
/* 158 */ 0, 0, 0,
/* 159 */ 0, 0, 0,
- /* 160 */ 0, 0, 0,
- /* 161 */ 0, 0, 0,
- /* 162 */ 0, 0, 0,
- /* 163 */ 0, 0, 0,
- /* 164 */ 0, 0, 0,
- /* 165 */ 0, 0, 0,
+ /* 160 */ VK_LSHIFT, KEY_ShiftL, KEY_ShiftL,
+ /* 161 */ VK_RSHIFT, KEY_ShiftR, KEY_ShiftR,
+ /* 162 */ VK_LCONTROL, KEY_LCtrl, KEY_LCtrl,
+ /* 163 */ VK_RCONTROL, KEY_RCtrl, KEY_RCtrl,
+ /* 164 */ VK_LMENU, KEY_Alt, KEY_Alt,
+ /* 165 */ VK_RMENU, KEY_AltLang, KEY_AltLang,
/* 166 */ 0, 0, 0,
/* 167 */ 0, 0, 0,
/* 168 */ 0, 0, 0,
diff --git a/xorg-server/hw/xwin/winlayouts.h b/xorg-server/hw/xwin/winlayouts.h
index cc0752430..336839453 100644
--- a/xorg-server/hw/xwin/winlayouts.h
+++ b/xorg-server/hw/xwin/winlayouts.h
@@ -38,34 +38,50 @@ typedef struct
char *layoutname;
} WinKBLayoutRec, *WinKBLayoutPtr;
+/*
+ This table is sorted by low byte of winlayout, then by next byte, etc.
+*/
+
WinKBLayoutRec winKBLayouts[] =
{
+ { 0x404, -1, "pc105", "zh_TW", NULL, NULL, "Chinese (Taiwan)"},
{ 0x405, -1, "pc105", "cz", NULL, NULL, "Czech"},
{0x10405, -1, "pc105", "cz_qwerty", NULL, NULL, "Czech (QWERTY)"},
{ 0x406, -1, "pc105", "dk", NULL, NULL, "Danish"},
{ 0x407, -1, "pc105", "de", NULL, NULL, "German (Germany)"},
{0x10407, -1, "pc105", "de", NULL, NULL, "German (Germany, IBM)"},
- { 0x807, -1, "pc105", "de_CH", NULL, NULL, "German (Switzerland)"},
+ { 0x807, -1, "pc105", "ch", "de", NULL, "German (Switzerland)"},
{ 0x409, -1, "pc105", "us", NULL, NULL, "English (USA)"},
{0x10409, -1, "pc105", "dvorak", NULL, NULL, "English (USA, Dvorak)"},
{0x20409, -1, "pc105", "us_intl", NULL, NULL, "English (USA, International)"},
{ 0x809, -1, "pc105", "gb", NULL, NULL, "English (United Kingdom)"},
{ 0x1809, -1, "pc105", "ie", NULL, NULL, "Irish"},
{ 0x40a, -1, "pc105", "es", NULL, NULL, "Spanish (Spain, Traditional Sort)"},
+ { 0x80a, -1, "pc105", "la", NULL, NULL, "Latin American"},
{ 0x40b, -1, "pc105", "fi", NULL, NULL, "Finnish"},
{ 0x40c, -1, "pc105", "fr", NULL, NULL, "French (Standard)"},
{ 0x80c, -1, "pc105", "be", NULL, NULL, "French (Belgian)"},
- { 0xc0c, -1, "pc105", "ca_enhanced", NULL, NULL, "French (Canada)"},
- { 0x100c, -1, "pc105", "fr_CH", NULL, NULL, "French (Switzerland)"},
+ {0x1080c, -1, "pc105", "be", NULL, NULL, "Belgian (Comma)"},
+ { 0xc0c, -1, "pc105", "ca", "fr", NULL, "French (Canada)"},
+ { 0x100c, -1, "pc105", "ch", "fr", NULL, "French (Switzerland)"},
{ 0x40e, -1, "pc105", "hu", NULL, NULL, "Hungarian"},
+ { 0x40f, -1, "pc105", "is", NULL, NULL, "Icelandic"},
{ 0x410, -1, "pc105", "it", NULL, NULL, "Italian"},
+ {0x10410, -1, "pc105", "it", NULL, NULL, "Italian (142)"},
+ {0xa0000410,-1, "macbook79","it", "mac",NULL, "Italiano (Apple)"},
{ 0x411, 7, "jp106", "jp", NULL, NULL, "Japanese"},
+ { 0x413, -1, "pc105", "nl", NULL, NULL, "Dutch"},
{ 0x813, -1, "pc105", "be", NULL, NULL, "Dutch (Belgian)"},
{ 0x414, -1, "pc105", "no", NULL, NULL, "Norwegian"},
+ { 0x415, -1, "pc105", "pl", NULL, NULL, "Polish (Programmers)"},
{ 0x416, -1, "pc105", "br", NULL, NULL, "Portuguese (Brazil, ABNT)"},
{0x10416, -1, "abnt2", "br", NULL, NULL, "Portuguese (Brazil, ABNT2)"},
{ 0x816, -1, "pc105", "pt", NULL, NULL, "Portuguese (Portugal)"},
+ { 0x41a, -1, "pc105", "hr", NULL, NULL, "Croatian"},
{ 0x41d, -1, "pc105", "se", NULL, NULL, "Swedish (Sweden)"},
+ { 0x424, -1, "pc105", "si", NULL, NULL, "Slovenian"},
+ { 0x425, -1, "pc105", "ee", NULL, NULL, "Estonian"},
+ { 0x452, -1, "pc105", "gb", "intl", NULL, "United Kingdom (Extended)"},
{ -1, -1, NULL, NULL, NULL, NULL, NULL}
};
@@ -147,6 +163,7 @@ Support ID XKB Language
Finnish (with Sami)
X 0x040c fr French (Standard)
X 0x080c be French (Belgian)
+ X 0x1080c be Belgian (Comma)
. 0x0c0c French (Canadian)
French (Canadian, Legacy)
Canadian (Multilingual)
diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c
index 1507dd34f..d25a66524 100644
--- a/xorg-server/hw/xwin/winmouse.c
+++ b/xorg-server/hw/xwin/winmouse.c
@@ -36,7 +36,7 @@
#endif
#include "win.h"
-#if defined(XFree86Server) && defined(XINPUT)
+#ifdef XINPUT
#include "inputstr.h"
/* Peek the internal button mapping */
@@ -106,7 +106,7 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState)
2);
free(map);
-#if defined(XFree86Server) && defined(XINPUT)
+#ifdef XINPUT
g_winMouseButtonMap = pDeviceInt->button->map;
#endif
break;
@@ -116,7 +116,7 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState)
break;
case DEVICE_CLOSE:
-#if defined(XFree86Server) && defined(XINPUT)
+#ifdef XINPUT
g_winMouseButtonMap = NULL;
#endif
case DEVICE_OFF:
@@ -221,11 +221,12 @@ winMouseWheel (ScreenPtr pScreen, int iDeltaZ)
void
winMouseButtonsSendEvent (int iEventType, int iButton)
{
+ DeviceIntPtr pDev;
xEvent xCurrentEvent;
/* Load an xEvent and enqueue the event */
xCurrentEvent.u.u.type = iEventType;
-#if defined(XFree86Server) && defined(XINPUT)
+#ifdef XINPUT
if (g_winMouseButtonMap)
xCurrentEvent.u.u.detail = g_winMouseButtonMap[iButton];
else
@@ -233,7 +234,16 @@ winMouseButtonsSendEvent (int iEventType, int iButton)
xCurrentEvent.u.u.detail = iButton;
xCurrentEvent.u.keyButtonPointer.time
= g_c32LastInputEventTime = GetTickCount ();
- mieqEnqueue (&xCurrentEvent);
+
+#if CYGDEBUG
+ ErrorF("winMouseButtonsSendEvent: xCurrentEvent.u.u.type: %d, xCurrentEvent.u.u.detail: %d\n",
+ xCurrentEvent.u.u.type, xCurrentEvent.u.u.detail);
+#endif
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
+ if ((pDev->coreEvents && pDev != inputInfo.pointer) && pDev->button)
+ {
+ mieqEnqueue (pDev, &xCurrentEvent);
+ }
}
@@ -339,3 +349,25 @@ winMouseButtonsHandle (ScreenPtr pScreen,
return 0;
}
+
+/**
+ * Enqueue a motion event.
+ */
+void winEnqueueMotion(int x, int y)
+{
+ int i, nevents;
+ int valuators[2];
+
+ xEvent *events = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum());
+
+ valuators[0] = x;
+ valuators[1] = y;
+ nevents = GetPointerEvents(events, inputInfo.pointer, MotionNotify, 0,
+ POINTER_ABSOLUTE, 0, 2, valuators);
+
+ for (i = 0; i < nevents; i++)
+ mieqEnqueue(inputInfo.pointer, events + i);
+
+ xfree(events);
+}
+// XXX: miPointerMove does exactly this, but is static :-( (and uses a static buffer)
diff --git a/xorg-server/hw/xwin/winmultiwindowclass.c b/xorg-server/hw/xwin/winmultiwindowclass.c
index 5b47c3976..fe81f2bd0 100644
--- a/xorg-server/hw/xwin/winmultiwindowclass.c
+++ b/xorg-server/hw/xwin/winmultiwindowclass.c
@@ -1,5 +1,6 @@
/*
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *Copyright (C) Colin Harrison 2005-2008
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -26,6 +27,7 @@
*from the XFree86 Project.
*
* Authors: Earle F. Philhower, III
+ * Colin Harrison
*/
#ifdef HAVE_XWIN_CONFIG_H
@@ -263,7 +265,7 @@ winMultiWindowGetTransientFor (WindowPtr pWin, WindowPtr *ppDaddy)
if (prop->propertyName == XA_WM_TRANSIENT_FOR)
{
if (ppDaddy)
- memcpy (*ppDaddy, prop->data, sizeof (WindowPtr));
+ memcpy (ppDaddy, prop->data, sizeof (WindowPtr));
return 1;
}
else
diff --git a/xorg-server/hw/xwin/winmultiwindowicons.c b/xorg-server/hw/xwin/winmultiwindowicons.c
index 45ed093ec..0d9d87ed2 100644
--- a/xorg-server/hw/xwin/winmultiwindowicons.c
+++ b/xorg-server/hw/xwin/winmultiwindowicons.c
@@ -36,6 +36,9 @@
#include "winmultiwindowclass.h"
#include "winprefs.h"
+#include "propertyst.h"
+#include "windowstr.h"
+
/*
* External global variables
@@ -50,9 +53,15 @@ extern HICON g_hSmallIconX;
*/
static void
-winScaleXBitmapToWindows (int iconSize, int effBPP,
- PixmapPtr pixmap, unsigned char *image);
-
+winScaleIconToWindows (int iconSize,
+ int effBPP,
+ unsigned char *iconData,
+ unsigned short width,
+ unsigned short height,
+ int xStride,
+ int effXBPP,
+ int effXDepth,
+ unsigned char *image);
/*
* Scale an X icon bitmap into a Windoze icon bitmap
@@ -64,15 +73,9 @@ winScaleXBitmapToWindows (int iconSize,
PixmapPtr pixmap,
unsigned char *image)
{
- int row, column, effXBPP, effXDepth;
- unsigned char *outPtr;
- unsigned char *iconData = 0;
- int stride, xStride;
- float factX, factY;
- int posX, posY;
- unsigned char *ptr;
- unsigned int zero;
- unsigned int color;
+ int effXBPP, effXDepth;
+ int xStride;
+ unsigned char *iconData = 0;
effXBPP = BitsPerPixel(pixmap->drawable.depth);
effXDepth = pixmap->drawable.depth;
@@ -83,12 +86,10 @@ winScaleXBitmapToWindows (int iconSize,
if (pixmap->drawable.depth == 15)
effXDepth = 16;
- /* Need 32-bit aligned rows */
- stride = ((iconSize * effBPP + 31) & (~31)) / 8;
xStride = PixmapBytePad (pixmap->drawable.width, pixmap->drawable.depth);
- if (stride == 0 || xStride == 0)
+ if (xStride == 0)
{
- ErrorF ("winScaleXBitmapToWindows - stride or xStride is zero. "
+ ErrorF ("winScaleXBitmapToWindows - xStride is zero. "
"Bailing.\n");
return;
}
@@ -107,9 +108,54 @@ winScaleXBitmapToWindows (int iconSize,
pixmap->drawable.width, pixmap->drawable.height,
ZPixmap, 0xffffffff, iconData);
+ winScaleIconToWindows(iconSize, effBPP,
+ iconData,
+ pixmap->drawable.width, pixmap->drawable.height,
+ xStride, effXBPP, effXDepth,
+ image);
+
+ free (iconData);
+}
+
+/*
+ * Scale a drawable into a Windoze icon bitmap
+ */
+
+static void
+winScaleIconToWindows (int iconSize,
+ int effBPP,
+ unsigned char *iconData,
+ unsigned short width,
+ unsigned short height,
+ int xStride,
+ int effXBPP,
+ int effXDepth,
+ unsigned char *image)
+{
+ int row, column;
+ unsigned char *outPtr;
+ int stride;
+ float factX, factY;
+ int posX, posY;
+ unsigned char *ptr;
+ unsigned int zero;
+ unsigned int color;
+
+ winDebug("winScaleIconToWindows: scaling from %d x %d @ %d bpp (depth %d) to %d x %d @ %d bpp\n",
+ width, height, effXBPP, effXDepth, iconSize, iconSize, effBPP);
+
+ /* Need 16-bit aligned rows for DDBitmaps */
+ stride = ((iconSize * effBPP + 15) & (~15)) / 8;
+ if (stride == 0)
+ {
+ ErrorF ("winScaleXBitmapToWindows - stride is zero. "
+ "Bailing.\n");
+ return;
+ }
+
/* Keep aspect ratio */
- factX = ((float)pixmap->drawable.width) / ((float)iconSize);
- factY = ((float)pixmap->drawable.height) / ((float)iconSize);
+ factX = ((float)width) / ((float)iconSize);
+ factY = ((float)height) / ((float)iconSize);
if (factX > factY)
factY = factX;
else
@@ -132,8 +178,8 @@ winScaleXBitmapToWindows (int iconSize,
ptr += posX / 8;
/* Out of X icon bounds, leave space blank */
- if (posX >= pixmap->drawable.width
- || posY >= pixmap->drawable.height)
+ if (posX >= width
+ || posY >= height)
ptr = (unsigned char *) &zero;
if ((*ptr) & (1 << (posX & 7)))
@@ -178,8 +224,8 @@ winScaleXBitmapToWindows (int iconSize,
ptr += posX * (effXBPP / 8);
/* Out of X icon bounds, leave space blank */
- if (posX >= pixmap->drawable.width
- || posY >= pixmap->drawable.height)
+ if (posX >= width
+ || posY >= height)
ptr = (unsigned char *) &zero;
color = (((*ptr) << 16)
+ ((*(ptr + 1)) << 8)
@@ -190,7 +236,7 @@ winScaleXBitmapToWindows (int iconSize,
*(outPtr++) = *(ptr++); // b
*(outPtr++) = *(ptr++); // g
*(outPtr++) = *(ptr++); // r
- *(outPtr++) = 0; // resvd
+ *(outPtr++) = (effXDepth == 32) ? *(ptr++) : 0x0; // alpha
break;
case 24:
*(outPtr++) = *(ptr++);
@@ -221,8 +267,8 @@ winScaleXBitmapToWindows (int iconSize,
ptr += posX * (effXBPP / 8);
/* Out of X icon bounds, leave space blank */
- if (posX >= pixmap->drawable.width
- || posY >= pixmap->drawable.height)
+ if (posX >= width
+ || posY >= height)
ptr = (unsigned char *) &zero;
color = ((*ptr) << 8) + (*(ptr + 1));
switch (effBPP)
@@ -257,9 +303,50 @@ winScaleXBitmapToWindows (int iconSize,
} /* end if effxbpp==16) */
} /* end for column */
} /* end for row */
- free (iconData);
}
+static pointer
+GetWindowProp(WindowPtr pWin, Atom name, long int *size_return)
+{
+ struct _Window *pwin;
+ struct _Property *prop;
+
+ if (!pWin || !name) {
+ winDebug("GetWindowProp - pWin or name was NULL\n");
+ return 0;
+ }
+ pwin = (struct _Window*) pWin;
+ if (!pwin->optional) return NULL;
+ for (prop = (struct _Property *) pwin->optional->userProps;
+ prop;
+ prop=prop->next){
+ if (prop->propertyName == name) {
+ *size_return=prop->size;
+ return prop->data;
+ }
+ }
+ return NULL;
+}
+
+static void
+winScaleNetWMIconToWindows (int iconSize,
+ int effBPP,
+ uint32_t *icondata,
+ unsigned char *image)
+{
+ int height, width;
+ uint32_t *pixels;
+
+ width = icondata[0];
+ height = icondata[1];
+ pixels = &icondata[2];
+
+ winScaleIconToWindows(iconSize, effBPP,
+ (unsigned char *)pixels,
+ width, height,
+ width*4, 32, 32,
+ image);
+}
/*
* Attempt to create a custom icon from the WM_HINTS bitmaps
@@ -268,7 +355,7 @@ winScaleXBitmapToWindows (int iconSize,
HICON
winXIconToHICON (WindowPtr pWin, int iconSize)
{
- unsigned char *mask, *image, *imageMask;
+ unsigned char *mask, *image;
unsigned char *dst, *src;
PixmapPtr iconPtr;
PixmapPtr maskPtr;
@@ -276,14 +363,12 @@ winXIconToHICON (WindowPtr pWin, int iconSize)
HDC hDC;
ICONINFO ii;
WinXWMHints hints;
- HICON hIcon;
+ HICON hIcon = NULL;
+ Bool net_wm_icon_found = FALSE;
- winMultiWindowGetWMHints (pWin, &hints);
- if (!hints.icon_pixmap) return NULL;
-
- iconPtr = (PixmapPtr) LookupIDByType (hints.icon_pixmap, RT_PIXMAP);
-
- if (!iconPtr) return NULL;
+ static Atom _XA_NET_WM_ICON = 0;
+ uint32_t *icon, *icon_data;
+ long int size=0;
hDC = GetDC (GetDesktopWindow ());
planes = GetDeviceCaps (hDC, PLANES);
@@ -296,38 +381,99 @@ winXIconToHICON (WindowPtr pWin, int iconSize)
else
effBPP = bpp;
- /* Need 32-bit aligned rows */
- stride = ((iconSize * effBPP + 31) & (~31)) / 8;
+ /* Need 16-bit aligned rows for DDBitmaps */
+ stride = ((iconSize * effBPP + 15) & (~15)) / 8;
/* Mask is 1-bit deep */
- maskStride = ((iconSize * 1 + 31) & (~31)) / 8;
+ maskStride = ((iconSize * 1 + 15) & (~15)) / 8;
- image = (unsigned char * ) malloc (stride * iconSize);
- imageMask = (unsigned char *) malloc (stride * iconSize);
- mask = (unsigned char *) malloc (maskStride * iconSize);
-
- /* Default to a completely black mask */
- memset (mask, 0, maskStride * iconSize);
+ if (!_XA_NET_WM_ICON) _XA_NET_WM_ICON = MakeAtom("_NET_WM_ICON", 12, FALSE);
- winScaleXBitmapToWindows (iconSize, effBPP, iconPtr, image);
- maskPtr = (PixmapPtr) LookupIDByType (hints.icon_mask, RT_PIXMAP);
+ /* Always prefer _NET_WM_ICON icons */
+ icon_data = GetWindowProp(pWin, _XA_NET_WM_ICON, &size);
+ if (icon_data)
+ {
+ uint32_t *best_icon = 0;
+ unsigned int best_size = 0;
+
+ /*
+ For scaling to the required size, choose the smallest icon which is
+ bigger than or equal to the required size, failing that, the biggest
+ icon which is smaller than the required size
+ */
+ for(icon = icon_data;
+ icon < &icon_data[size] && *icon;
+ icon = &icon[icon[0]*icon[1]+2])
+ {
+ unsigned int candidateSize = (icon[0] + icon[1])/2;
+ winDebug("winXIconToHICON: pWin%x found %lu x %lu NetIcon\n",(int)pWin,icon[0],icon[1]);
+
+ if (((best_size < iconSize) && ((candidateSize > best_size) || (candidateSize >= iconSize)))
+ || ((best_size > iconSize) && (candidateSize >= iconSize) && (candidateSize < best_size)))
+ {
+ best_icon = icon;
+ best_size = candidateSize;
+ }
+ }
+
+ if (best_icon)
+ {
+ winDebug("winXIconToHICON: pWin%x selected %lu x %lu NetIcon for scaling to %u x %u\n",
+ (int)pWin, best_icon[0], best_icon[1], iconSize, iconSize );
+
+ image = malloc (stride * iconSize);
+
+ /* Use a completely black mask, image has alpha */
+ mask = calloc (maskStride, iconSize);
+
+ winScaleNetWMIconToWindows(iconSize, effBPP, best_icon, image);
+ net_wm_icon_found = TRUE;
+ }
+ else
+ {
+ winDebug("winXIconToHICON: pWin %x no %d x %d NetIcon\n",(int)pWin,iconSize,iconSize);
+ }
+ }
- if (maskPtr)
+ if (!net_wm_icon_found)
{
- winScaleXBitmapToWindows (iconSize, 1, maskPtr, mask);
-
- winScaleXBitmapToWindows (iconSize, effBPP, maskPtr, imageMask);
-
- /* Now we need to set all bits of the icon which are not masked */
- /* on to 0 because Color is really an XOR, not an OR function */
- dst = image;
- src = imageMask;
-
- for (i = 0; i < (stride * iconSize); i++)
- if ((*(src++)))
- *(dst++) = 0;
- else
- dst++;
+ unsigned char *imageMask;
+
+ winMultiWindowGetWMHints (pWin, &hints);
+ winDebug("winXIconToHICON: pWin 0x%x icon_pixmap hint %x\n", pWin, hints.icon_pixmap);
+ if (!hints.icon_pixmap) return NULL;
+
+ iconPtr = (PixmapPtr) LookupIDByType (hints.icon_pixmap, RT_PIXMAP);
+ winDebug("winXIconToHICON: pWin 0x%x iconPtr 0x%x\n", pWin, iconPtr);
+
+ if (!iconPtr) return NULL;
+
+ image = malloc (stride * iconSize);
+ imageMask = malloc (stride * iconSize);
+ /* Default to a completely black mask */
+ mask = calloc (maskStride, iconSize);
+
+ winScaleXBitmapToWindows (iconSize, effBPP, iconPtr, image);
+ maskPtr = (PixmapPtr) LookupIDByType (hints.icon_mask, RT_PIXMAP);
+
+ if (maskPtr)
+ {
+ winScaleXBitmapToWindows (iconSize, 1, maskPtr, mask);
+
+ winScaleXBitmapToWindows (iconSize, effBPP, maskPtr, imageMask);
+
+ /* Now we need to set all bits of the icon which are not masked */
+ /* on to 0 because Color is really an XOR, not an OR function */
+ dst = image;
+ src = imageMask;
+
+ for (i = 0; i < (stride * iconSize); i++)
+ if ((*(src++)))
+ *(dst++) = 0;
+ else
+ dst++;
+ }
+ free (imageMask);
}
ii.fIcon = TRUE;
@@ -350,15 +496,13 @@ winXIconToHICON (WindowPtr pWin, int iconSize)
/* Free X mask and bitmap */
free (mask);
free (image);
- free (imageMask);
return hIcon;
}
-
/*
- * Change the Windows window icon
+ * Change the Windows window icon
*/
#ifdef XWIN_MULTIWINDOW
@@ -366,10 +510,14 @@ void
winUpdateIcon (Window id)
{
WindowPtr pWin;
- HICON hIcon, hiconOld;
+ HICON hIcon, hIconSmall, hiconOld;
pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW);
if (!pWin) return;
+{
+ winWindowPriv(pWin);
+ if (!pWinPriv->hWnd) return;
+
hIcon = (HICON)winOverrideIcon ((unsigned long)pWin);
if (!hIcon)
@@ -377,32 +525,30 @@ winUpdateIcon (Window id)
if (hIcon)
{
- winWindowPriv(pWin);
+ hiconOld = (HICON) SetClassLong (pWinPriv->hWnd,
+ GCL_HICON,
+ (int) hIcon);
- if (pWinPriv->hWnd)
- {
- hiconOld = (HICON) SetClassLong (pWinPriv->hWnd,
- GCL_HICON,
- (int) hIcon);
-
- /* Delete the icon if its not the default */
- winDestroyIcon(hiconOld);
- }
+ /* Delete the icon if its not the default */
+ if (hiconOld != g_hIconX)
+ winDestroyIcon(hiconOld);
}
- hIcon = winXIconToHICON (pWin, GetSystemMetrics(SM_CXSMICON));
- if (hIcon)
- {
- winWindowPriv(pWin);
+ hIconSmall = (HICON)winOverrideIcon ((unsigned long)pWin);
+
+ if (!hIconSmall)
+ hIconSmall = winXIconToHICON (pWin, GetSystemMetrics(SM_CXSMICON));
+
+ if (hIconSmall)
+ {
+ hiconOld = (HICON) SetClassLong (pWinPriv->hWnd,
+ GCL_HICONSM,
+ (int) hIconSmall);
+ if (hiconOld != g_hSmallIconX)
+ winDestroyIcon (hiconOld);
- if (pWinPriv->hWnd)
- {
- hiconOld = (HICON) SetClassLong (pWinPriv->hWnd,
- GCL_HICONSM,
- (int) hIcon);
- winDestroyIcon (hiconOld);
- }
}
+ }
}
void winInitGlobalIcons (void)
diff --git a/xorg-server/hw/xwin/winmultiwindowshape.c b/xorg-server/hw/xwin/winmultiwindowshape.c
index 33deae337..46e392ec3 100644
--- a/xorg-server/hw/xwin/winmultiwindowshape.c
+++ b/xorg-server/hw/xwin/winmultiwindowshape.c
@@ -45,7 +45,6 @@ void
winSetShapeMultiWindow (WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
winScreenPriv(pScreen);
#if CYGMULTIWINDOW_DEBUG
@@ -73,6 +72,9 @@ winUpdateRgnMultiWindow (WindowPtr pWin)
{
SetWindowRgn (winGetWindowPriv(pWin)->hWnd,
winGetWindowPriv(pWin)->hRgn, TRUE);
+
+ /* The system now owns the region specified by the region handle and delete it when it is no longer needed. */
+ winGetWindowPriv(pWin)->hRgn = NULL;
}
@@ -209,3 +211,14 @@ winReshapeMultiWindow (WindowPtr pWin)
return;
}
#endif
+
+void
+winShapeRgnUpdateMultiwindow(HWND hwnd)
+{
+ WindowPtr pWin = GetProp (hwnd, WIN_WINDOW_PROP);
+ if (pWin)
+ {
+ winReshapeMultiWindow(pWin);
+ winUpdateRgnMultiWindow(pWin);
+ }
+}
diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c
index 037c881b4..c3972013c 100644
--- a/xorg-server/hw/xwin/winmultiwindowwindow.c
+++ b/xorg-server/hw/xwin/winmultiwindowwindow.c
@@ -1,5 +1,6 @@
/*
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *Copyright (C) Colin Harrison 2005-2008
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -28,6 +29,7 @@
* Authors: Kensuke Matsuzaki
* Earle F. Philhower, III
* Harold L Hunt II
+ * Colin Harrison
*/
#ifdef HAVE_XWIN_CONFIG_H
@@ -63,13 +65,6 @@ static void
winFindWindow (pointer value, XID id, pointer cdata);
/*
- * Constant defines
- */
-
-#define MOUSE_POLLING_INTERVAL 500
-
-
-/*
* Macros
*/
@@ -486,6 +481,7 @@ winCreateWindowsWindow (WindowPtr pWin)
int iWidth;
int iHeight;
HWND hWnd;
+ HWND hFore = NULL;
WNDCLASSEX wc;
winWindowPriv(pWin);
HICON hIcon;
@@ -496,6 +492,7 @@ winCreateWindowsWindow (WindowPtr pWin)
static int s_iWindowID = 0;
winPrivScreenPtr pScreenPriv = pWinPriv->pScreenPriv;
WinXSizeHints hints;
+ WindowPtr pDaddy;
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winCreateWindowsWindow - pWin: %08x\n", pWin);
@@ -504,20 +501,16 @@ winCreateWindowsWindow (WindowPtr pWin)
iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
- /* Default positions if none specified */
- if (!winMultiWindowGetWMNormalHints(pWin, &hints))
- hints.flags = 0;
- if ( !(hints.flags & (USPosition|PPosition)) &&
- !winMultiWindowGetTransientFor (pWin, NULL) &&
- !pWin->overrideRedirect )
- {
- iX = CW_USEDEFAULT;
- iY = CW_USEDEFAULT;
- }
-
iWidth = pWin->drawable.width;
iHeight = pWin->drawable.height;
+ /* ensure window actually ends up somewhere visible */
+ if (iX > GetSystemMetrics (SM_CXVIRTUALSCREEN))
+ iX = CW_USEDEFAULT;
+
+ if (iY > GetSystemMetrics (SM_CYVIRTUALSCREEN))
+ iY = CW_USEDEFAULT;
+
winSelectIcons(pWin, &hIcon, &hIconSmall);
/* Set standard class name prefix so we can identify window easily */
@@ -570,6 +563,28 @@ winCreateWindowsWindow (WindowPtr pWin)
wc.lpszClassName = pszClass;
RegisterClassEx (&wc);
+ if (!pWin->overrideRedirect)
+ {
+ if (winMultiWindowGetTransientFor (pWin, &pDaddy))
+ {
+ if (pDaddy)
+ {
+ hFore = GetForegroundWindow();
+ if (hFore && (pDaddy != (WindowPtr)GetProp(hFore, WIN_WID_PROP))) hFore = NULL;
+ }
+ }
+ else
+ {
+ /* Default positions if none specified */
+ if (!winMultiWindowGetWMNormalHints(pWin, &hints)) hints.flags = 0;
+ if (!(hints.flags & (USPosition|PPosition)))
+ {
+ iX = CW_USEDEFAULT;
+ iY = CW_USEDEFAULT;
+ }
+ }
+ }
+
/* Create the window */
/* Make it OVERLAPPED in create call since WS_POPUP doesn't support */
/* CW_USEDEFAULT, change back to popup after creation */
@@ -581,7 +596,7 @@ winCreateWindowsWindow (WindowPtr pWin)
iY, /* Vertical position */
iWidth, /* Right edge */
iHeight, /* Bottom edge */
- (HWND) NULL, /* No parent or owner window */
+ hFore, /* Null or Parent window if transient*/
(HMENU) NULL, /* No menu */
GetModuleHandle (NULL), /* Instance handle */
pWin); /* ScreenPrivates */
diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c
index 5401ecdee..e766c42dc 100644
--- a/xorg-server/hw/xwin/winmultiwindowwm.c
+++ b/xorg-server/hw/xwin/winmultiwindowwm.c
@@ -1,5 +1,6 @@
/*
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *Copyright (C) Colin Harrison 2005-2008
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -26,6 +27,7 @@
*from the XFree86 Project.
*
* Authors: Kensuke Matsuzaki
+ * Colin Harrison
*/
/* X headers */
@@ -34,13 +36,18 @@
#endif
#include <stdio.h>
#include <stdlib.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#ifdef __CYGWIN__
#include <sys/select.h>
#endif
#include <fcntl.h>
#include <setjmp.h>
#define HANDLE void *
+#ifdef _MSC_VER
+typedef int pid_t;
+#endif
#include <pthread.h>
#undef HANDLE
#include <X11/X.h>
@@ -52,24 +59,22 @@
#include <X11/cursorfont.h>
/* Windows headers */
-#ifdef __CYGWIN__
-/* Fixups to prevent collisions between Windows and X headers */
-#define ATOM DWORD
-
-#include <windows.h>
-#else
-#include <Xwindows.h>
-#endif
+#include <X11/Xwindows.h>
/* Local headers */
#include "objbase.h"
#include "ddraw.h"
#include "winwindow.h"
+#include "winprefs.h"
+#include "window.h"
+#include "windowstr.h"
#ifdef XWIN_MULTIWINDOWEXTWM
-#include "windowswmstr.h"
+#include <X11/extensions/windowswmstr.h>
#endif
extern void winDebug(const char *format, ...);
+extern void winReshapeMultiWindow(WindowPtr pWin);
+extern void winUpdateRgnMultiWindow(WindowPtr pWin);
#ifndef CYGDEBUG
#define CYGDEBUG NO
@@ -86,6 +91,7 @@ extern void winDebug(const char *format, ...);
#endif
#define WIN_JMP_OKAY 0
#define WIN_JMP_ERROR_IO 2
+#define AUTH_NAME "MIT-MAGIC-COOKIE-1"
/*
@@ -135,6 +141,10 @@ typedef struct _XMsgProcArgRec {
extern char *display;
extern void ErrorF (const char* /*f*/, ...);
+#if defined(XCSECURITY)
+extern unsigned int g_uiAuthDataLen;
+extern char *g_pAuthData;
+#endif
/*
@@ -151,7 +161,7 @@ static Bool
InitQueue (WMMsgQueuePtr pQueue);
static void
-GetWindowName (Display * pDpy, Window iWin, char **ppName);
+GetWindowName (Display * pDpy, Window iWin, wchar_t **ppName);
static int
SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData);
@@ -191,6 +201,11 @@ PreserveWin32Stack(WMInfoPtr pWMInfo, Window iWindow, UINT direction);
static Bool
CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen);
+static void
+winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle);
+
+void
+winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle);
/*
* Local globals
@@ -403,10 +418,12 @@ InitQueue (WMMsgQueuePtr pQueue)
*/
static void
-GetWindowName (Display *pDisplay, Window iWin, char **ppName)
+GetWindowName (Display *pDisplay, Window iWin, wchar_t **ppName)
{
int nResult, nNum;
char **ppList;
+ char *pszReturnData;
+ int iLen, i;
XTextProperty xtpName;
#if CYGMULTIWINDOW_DEBUG
@@ -425,38 +442,26 @@ GetWindowName (Display *pDisplay, Window iWin, char **ppName)
#endif
return;
}
-
- /* */
- if (xtpName.encoding == XA_STRING)
- {
- /* */
- if (xtpName.value)
- {
- int size = xtpName.nitems * (xtpName.format >> 3);
- *ppName = malloc(size + 1);
- strncpy(*ppName, xtpName.value, size);
- (*ppName)[size] = 0;
- XFree (xtpName.value);
- }
-#if CYGMULTIWINDOW_DEBUG
- ErrorF ("GetWindowName - XA_STRING %s\n", *ppName);
-#endif
- }
- else
- {
- if (XmbTextPropertyToTextList (pDisplay, &xtpName, &ppList, &nNum) >= Success && nNum > 0 && *ppList)
- {
- *ppName = strdup (*ppList);
- XFreeStringList (ppList);
- }
- XFree (xtpName.value);
-
-#if CYGMULTIWINDOW_DEBUG
- ErrorF ("GetWindowName - %s %s\n",
- XGetAtomName (pDisplay, xtpName.encoding), *ppName);
-#endif
- }
+ if (Xutf8TextPropertyToTextList (pDisplay, &xtpName, &ppList, &nNum) >= Success && nNum > 0 && *ppList)
+ {
+ iLen = 0;
+ for (i = 0; i < nNum; i++) iLen += strlen(ppList[i]);
+ pszReturnData = (char *) malloc (iLen + 1);
+ pszReturnData[0] = '\0';
+ for (i = 0; i < nNum; i++) strcat (pszReturnData, ppList[i]);
+ }
+ else
+ {
+ pszReturnData = (char *) malloc (1);
+ pszReturnData[0] = '\0';
+ }
+ iLen = MultiByteToWideChar (CP_UTF8, 0, pszReturnData, -1, NULL, 0);
+ *ppName = (wchar_t*)malloc(sizeof(wchar_t)*(iLen + 1));
+ MultiByteToWideChar (CP_UTF8, 0, pszReturnData, -1, *ppName, iLen);
+ XFree (xtpName.value);
+ if (ppList) XFreeStringList (ppList);
+ free (pszReturnData);
#if CYGMULTIWINDOW_DEBUG
ErrorF ("GetWindowName - Returning\n");
@@ -493,7 +498,7 @@ SendXMessage (Display *pDisplay, Window iWin, Atom atmType, long nData)
static void
UpdateName (WMInfoPtr pWMInfo, Window iWindow)
{
- char *pszName;
+ wchar_t *pszName;
Atom atmType;
int fmtRet;
unsigned long items, remain;
@@ -537,7 +542,7 @@ UpdateName (WMInfoPtr pWMInfo, Window iWindow)
&attr);
if (!attr.override_redirect)
{
- SetWindowText (hWnd, pszName);
+ SetWindowTextW (hWnd, pszName);
winUpdateIcon (iWindow);
}
@@ -705,10 +710,25 @@ winMultiWindowWMProc (void *pArg)
1);
UpdateName (pWMInfo, pNode->msg.iWindow);
winUpdateIcon (pNode->msg.iWindow);
-#if 0
- /* Handles the case where there are AOT windows above it in W32 */
- PreserveWin32Stack (pWMInfo, pNode->msg.iWindow, GW_HWNDPREV);
+ {
+ HWND zstyle = HWND_NOTOPMOST;
+ winApplyHints (pWMInfo->pDisplay, pNode->msg.iWindow, pNode->msg.hwndWindow, &zstyle);
+ winUpdateWindowPosition (pNode->msg.hwndWindow, TRUE, &zstyle);
+ }
+ break;
+
+ case WM_WM_MAP2:
+#if CYGMULTIWINDOW_DEBUG
+ ErrorF ("\tWM_WM_MAP2\n");
#endif
+ XChangeProperty (pWMInfo->pDisplay,
+ pNode->msg.iWindow,
+ pWMInfo->atmPrivMap,
+ XA_INTEGER,//pWMInfo->atmPrivMap,
+ 32,
+ PropModeReplace,
+ (unsigned char *) &(pNode->msg.hwndWindow),
+ 1);
break;
case WM_WM_UNMAP:
@@ -803,6 +823,7 @@ winMultiWindowWMProc (void *pArg)
#if CYGMULTIWINDOW_DEBUG
ErrorF("-winMultiWindowWMProc ()\n");
#endif
+ return NULL;
}
@@ -1063,6 +1084,7 @@ winMultiWindowXMsgProc (void *pArg)
XCloseDisplay (pProcArg->pDisplay);
pthread_exit (NULL);
+ return NULL;
}
@@ -1226,6 +1248,14 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
/* Print the display connection string */
ErrorF ("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay);
+
+#if defined(XCSECURITY)
+ /* Use our generated cookie for authentication */
+ XSetAuthorization (AUTH_NAME,
+ strlen (AUTH_NAME),
+ g_pAuthData,
+ g_uiAuthDataLen);
+#endif
/* Open the X display */
do
@@ -1265,11 +1295,10 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
pWMInfo->atmWmDelete = XInternAtom (pWMInfo->pDisplay,
"WM_DELETE_WINDOW",
False);
-#ifdef XWIN_MULTIWINDOWEXTWM
+
pWMInfo->atmPrivMap = XInternAtom (pWMInfo->pDisplay,
- WINDOWSWM_NATIVE_HWND,
+ "_WINDOWSWM_NATIVE_HWND",
False);
-#endif
if (1) {
@@ -1364,7 +1393,9 @@ winMultiWindowXMsgProcErrorHandler (Display *pDisplay, XErrorEvent *pErr)
pErr->error_code,
pszErrorMsg,
sizeof (pszErrorMsg));
+#if CYGMULTIWINDOW_DEBUG
ErrorF ("winMultiWindowXMsgProcErrorHandler - ERROR: %s\n", pszErrorMsg);
+#endif
return 0;
}
@@ -1438,3 +1469,205 @@ winDeinitMultiWindowWM ()
ErrorF ("winDeinitMultiWindowWM - Noting shutdown in progress\n");
g_shutdown = TRUE;
}
+
+/* Windows window styles */
+#define HINT_NOFRAME (1L<<0)
+#define HINT_BORDER (1L<<1)
+#define HINT_SIZEBOX (1L<<2)
+#define HINT_CAPTION (1L<<3)
+#define HINT_NOMAXIMIZE (1L<<4)
+/* These two are used on their own */
+#define HINT_MAX (1L<<0)
+#define HINT_MIN (1L<<1)
+
+static void
+winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
+{
+ static Atom windowState, motif_wm_hints, windowType;
+ Atom type, *pAtom = NULL;
+ int format;
+ unsigned long hint = 0, maxmin = 0, rcStyle, nitems = 0 , left = 0;
+ WindowPtr pWin = GetProp (hWnd, WIN_WINDOW_PROP);
+ MwmHints *mwm_hint = NULL;
+ XSizeHints *normal_hint;
+ long supplied;
+
+ if (!hWnd) return;
+ if (!IsWindow (hWnd)) return;
+
+ if (windowState == None) windowState = XInternAtom(pDisplay, "_NET_WM_STATE", False);
+ if (motif_wm_hints == None) motif_wm_hints = XInternAtom(pDisplay, "_MOTIF_WM_HINTS", False);
+ if (windowType == None) windowType = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE", False);
+
+ if (XGetWindowProperty(pDisplay, iWindow, windowState, 0L,
+ 1L, False, XA_ATOM, &type, &format,
+ &nitems, &left, (unsigned char **)&pAtom) == Success)
+ {
+ if (pAtom && nitems == 1)
+ {
+ static Atom hiddenState, fullscreenState, belowState, aboveState;
+ if (hiddenState == None) hiddenState = XInternAtom(pDisplay, "_NET_WM_STATE_HIDDEN", False);
+ if (fullscreenState == None) fullscreenState = XInternAtom(pDisplay, "_NET_WM_STATE_FULLSCREEN", False);
+ if (belowState == None) belowState = XInternAtom(pDisplay, "_NET_WM_STATE_BELOW", False);
+ if (aboveState == None) aboveState = XInternAtom(pDisplay, "_NET_WM_STATE_ABOVE", False);
+ if (*pAtom == hiddenState) maxmin |= HINT_MIN;
+ else if (*pAtom == fullscreenState) maxmin |= HINT_MAX;
+ if (*pAtom == belowState) *zstyle = HWND_BOTTOM;
+ else if (*pAtom == aboveState) *zstyle = HWND_TOPMOST;
+ }
+ if (pAtom) XFree(pAtom);
+ }
+
+ nitems = left = 0;
+ if (XGetWindowProperty(pDisplay, iWindow, motif_wm_hints, 0L,
+ PropMwmHintsElements, False, motif_wm_hints, &type, &format,
+ &nitems, &left, (unsigned char **)&mwm_hint) == Success)
+ {
+ if (mwm_hint && nitems == PropMwmHintsElements && (mwm_hint->flags & MwmHintsDecorations))
+ {
+ if (!mwm_hint->decorations) hint |= HINT_NOFRAME;
+ else if (!(mwm_hint->decorations & MwmDecorAll))
+ {
+ if (mwm_hint->decorations & MwmDecorBorder) hint |= HINT_BORDER;
+ if (mwm_hint->decorations & MwmDecorHandle) hint |= HINT_SIZEBOX;
+ if (mwm_hint->decorations & MwmDecorTitle) hint |= HINT_CAPTION;
+ }
+ }
+ if (mwm_hint) XFree(mwm_hint);
+ }
+
+ nitems = left = 0;
+ pAtom = NULL;
+ if (XGetWindowProperty(pDisplay, iWindow, windowType, 0L,
+ 1L, False, XA_ATOM, &type, &format,
+ &nitems, &left, (unsigned char **)&pAtom) == Success)
+ {
+ if (pAtom && nitems == 1)
+ {
+ static Atom dockWindow;
+ if (dockWindow == None) dockWindow = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE_DOCK", False);
+ if (*pAtom == dockWindow)
+ {
+ hint = (hint & ~HINT_NOFRAME) | HINT_SIZEBOX; /* Xming puts a sizebox on dock windows */
+ *zstyle = HWND_TOPMOST;
+ }
+ }
+ if (pAtom) XFree(pAtom);
+ }
+
+ normal_hint = XAllocSizeHints();
+ if (normal_hint && (XGetWMNormalHints(pDisplay, iWindow, normal_hint, &supplied) == Success))
+ {
+ if (normal_hint->flags & PMaxSize)
+ {
+ /* Not maximizable if a maximum size is specified */
+ hint |= HINT_NOMAXIMIZE;
+
+ if (normal_hint->flags & PMinSize)
+ {
+ /*
+ If both minimum size and maximum size are specified and are the same,
+ don't bother with a resizing frame
+ */
+ if ((normal_hint->min_width == normal_hint->max_width)
+ && (normal_hint->min_height == normal_hint->max_height))
+ hint = (hint & ~HINT_SIZEBOX);
+ }
+ }
+ }
+ XFree(normal_hint);
+
+ /* Apply Styles, overriding hint settings from above */
+ rcStyle = winOverrideStyle((unsigned long)pWin);
+ if (rcStyle & STYLE_TOPMOST) *zstyle = HWND_TOPMOST;
+ else if (rcStyle & STYLE_MAXIMIZE) maxmin = (hint & ~HINT_MIN) | HINT_MAX;
+ else if (rcStyle & STYLE_MINIMIZE) maxmin = (hint & ~HINT_MAX) | HINT_MIN;
+ else if (rcStyle & STYLE_BOTTOM) *zstyle = HWND_BOTTOM;
+
+ if (maxmin & HINT_MAX) SendMessage(hWnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
+ else if (maxmin & HINT_MIN) SendMessage(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
+
+ if (rcStyle & STYLE_NOTITLE)
+ hint = (hint & ~HINT_NOFRAME & ~HINT_BORDER & ~HINT_CAPTION) | HINT_SIZEBOX;
+ else if (rcStyle & STYLE_OUTLINE)
+ hint = (hint & ~HINT_NOFRAME & ~HINT_SIZEBOX & ~HINT_CAPTION) | HINT_BORDER;
+ else if (rcStyle & STYLE_NOFRAME)
+ hint = (hint & ~HINT_BORDER & ~HINT_CAPTION & ~HINT_SIZEBOX) | HINT_NOFRAME;
+
+ SetWindowLongPtr (hWnd, GWL_STYLE, GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION & ~WS_SIZEBOX); /* Just in case */
+ if (!hint) /* All on */
+ SetWindowLongPtr (hWnd, GWL_STYLE, GetWindowLongPtr(hWnd, GWL_STYLE) | WS_CAPTION | WS_SIZEBOX);
+ else if (hint & HINT_NOFRAME); /* All off, so do nothing */
+ else SetWindowLongPtr (hWnd, GWL_STYLE, GetWindowLongPtr(hWnd, GWL_STYLE) |
+ ((hint & HINT_BORDER) ? WS_BORDER : 0) |
+ ((hint & HINT_SIZEBOX) ? WS_SIZEBOX : 0) |
+ ((hint & HINT_CAPTION) ? WS_CAPTION : 0));
+
+ if (hint & HINT_NOMAXIMIZE)
+ SetWindowLongPtr(hWnd, GWL_STYLE, GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_MAXIMIZEBOX);
+}
+
+void
+winUpdateWindowPosition (HWND hWnd, Bool reshape, 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);
+
+#if 0
+ ErrorF ("winUpdateWindowPosition - (%d, %d)-(%d, %d)\n",
+ rcNew.left, rcNew.top,
+ rcNew.right, rcNew.bottom);
+#endif
+
+ AdjustWindowRectEx (&rcNew, GetWindowLongPtr (hWnd, GWL_STYLE), FALSE, WS_EX_APPWINDOW);
+
+ /* 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;
+ }
+
+#if 0
+ ErrorF ("winUpdateWindowPosition - (%d, %d)-(%d, %d)\n",
+ rcNew.left, rcNew.top,
+ rcNew.right, rcNew.bottom);
+#endif
+
+ /* Position the Windows window */
+ SetWindowPos (hWnd, *zstyle, rcNew.left, rcNew.top,
+ rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
+ 0);
+
+ if (reshape)
+ {
+ winReshapeMultiWindow(pWin);
+ winUpdateRgnMultiWindow(pWin);
+ }
+}
diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c
index 20ff9f7db..bfb74a092 100644
--- a/xorg-server/hw/xwin/winmultiwindowwndproc.c
+++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c
@@ -1,5 +1,6 @@
/*
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *Copyright (C) Colin Harrison 2005-2008
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -28,6 +29,7 @@
* Authors: Kensuke Matsuzaki
* Earle F. Philhower, III
* Harold L Hunt II
+ * Colin Harrison
*/
#ifdef HAVE_XWIN_CONFIG_H
@@ -49,6 +51,8 @@ extern Bool g_fKeyboardHookLL;
extern Bool g_fSoftwareCursor;
extern Bool g_fButton[3];
+extern void winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle);
+
/*
* Local globals
@@ -61,7 +65,6 @@ static UINT_PTR g_uipMousePollingTimerID = 0;
* Constant defines
*/
-#define MOUSE_POLLING_INTERVAL 500
#define WIN_MULTIWINDOW_SHAPE YES
@@ -206,6 +209,7 @@ ValidateSizing (HWND hwnd, WindowPtr pWin,
WinXSizeHints sizeHints;
RECT *rect;
int iWidth, iHeight;
+ unsigned long rcStyle;
/* Invalid input checking */
if (pWin==NULL || lParam==0)
@@ -227,19 +231,31 @@ ValidateSizing (HWND hwnd, WindowPtr pWin,
iWidth = rect->right - rect->left;
iHeight = rect->bottom - rect->top;
- /* Now remove size of any borders */
- iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME);
- iHeight -= (GetSystemMetrics(SM_CYCAPTION)
- + 2 * GetSystemMetrics(SM_CYSIZEFRAME));
-
+ /* Now remove size of any borders and title bar */
+ rcStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
+ if (rcStyle & WS_CAPTION)
+ {
+ iHeight -= GetSystemMetrics(SM_CYCAPTION);
+ }
+ if (rcStyle & WS_SIZEBOX)
+ {
+ iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME);
+ iHeight -= 2 * GetSystemMetrics(SM_CYSIZEFRAME);
+ }
/* Constrain the size to legal values */
ConstrainSize (sizeHints, &iWidth, &iHeight);
- /* Add back the borders */
- iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME);
- iHeight += (GetSystemMetrics(SM_CYCAPTION)
- + 2 * GetSystemMetrics(SM_CYSIZEFRAME));
+ /* Add back the size of borders and title bar */
+ if (rcStyle & WS_CAPTION)
+ {
+ iHeight += GetSystemMetrics(SM_CYCAPTION);
+ }
+ if (rcStyle & WS_SIZEBOX)
+ {
+ iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME);
+ iHeight += 2 * GetSystemMetrics(SM_CYSIZEFRAME);
+ }
/* Adjust size according to where we're dragging from */
switch(wParam) {
@@ -276,16 +292,30 @@ static void winRaiseWindow(WindowPtr pWin)
if (!winInDestroyWindowsWindow && !winInRaiseWindow)
{
BOOL oldstate = winInRaiseWindow;
+ XID vlist[1] = { 0 };
winInRaiseWindow = TRUE;
/* Call configure window directly to make sure it gets processed
* in time
*/
- XID vlist[1] = { 0 };
ConfigureWindow(pWin, CWStackMode, vlist, serverClient);
winInRaiseWindow = oldstate;
}
}
+static
+void winStartMousePolling(winPrivScreenPtr s_pScreenPriv)
+{
+ /*
+ * Timer to poll mouse position. This is needed to make
+ * programs like xeyes follow the mouse properly when the
+ * mouse pointer is outside of any X window.
+ */
+ if (g_uipMousePollingTimerID == 0)
+ g_uipMousePollingTimerID = SetTimer (s_pScreenPriv->hwndScreen,
+ WIN_POLLING_MOUSE_TIMER_ID,
+ MOUSE_POLLING_INTERVAL,
+ NULL);
+}
/*
* winTopLevelWindowProc - Window procedure for all top-level Windows windows.
@@ -377,7 +407,9 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
switch (message)
{
case WM_CREATE:
-
+{
+ RECT rWindow;
+ HRGN hRgnWindow;
/* */
SetProp (hwnd,
WIN_WINDOW_PROP,
@@ -396,13 +428,13 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
winReorderWindowsMultiWindow ();
/* Fix a 'round title bar corner background should be transparent not black' problem when first painted */
- RECT rWindow;
- HRGN hRgnWindow;
GetWindowRect(hwnd, &rWindow);
hRgnWindow = CreateRectRgnIndirect(&rWindow);
SetWindowRgn (hwnd, hRgnWindow, TRUE);
DeleteObject(hRgnWindow);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)XMING_SIGNATURE);
+}
return 0;
case WM_INIT_SYS_MENU:
@@ -535,9 +567,9 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
}
/* Deliver absolute cursor position to X Server */
- miPointerAbsoluteCursor (ptMouse.x - s_pScreenInfo->dwXOffset,
- ptMouse.y - s_pScreenInfo->dwYOffset,
- g_c32LastInputEventTime = GetTickCount ());
+ winEnqueueMotion(ptMouse.x - s_pScreenInfo->dwXOffset,
+ ptMouse.y - s_pScreenInfo->dwYOffset);
+
return 0;
case WM_NCMOUSEMOVE:
@@ -561,15 +593,8 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
ShowCursor (TRUE);
}
- /*
- * Timer to poll mouse events. This is needed to make
- * programs like xeyes follow the mouse properly.
- */
- if (g_uipMousePollingTimerID == 0)
- g_uipMousePollingTimerID = SetTimer (s_pScreenPriv->hwndScreen,
- WIN_POLLING_MOUSE_TIMER_ID,
- MOUSE_POLLING_INTERVAL,
- NULL);
+ winStartMousePolling(s_pScreenPriv);
+
break;
case WM_MOUSELEAVE:
@@ -585,15 +610,8 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
ShowCursor (TRUE);
}
- /*
- * Timer to poll mouse events. This is needed to make
- * programs like xeyes follow the mouse properly.
- */
- if (g_uipMousePollingTimerID == 0)
- g_uipMousePollingTimerID = SetTimer (s_pScreenPriv->hwndScreen,
- WIN_POLLING_MOUSE_TIMER_ID,
- MOUSE_POLLING_INTERVAL,
- NULL);
+ winStartMousePolling(s_pScreenPriv);
+
return 0;
case WM_LBUTTONDBLCLK:
@@ -601,12 +619,15 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
g_fButton[0] = TRUE;
+ SetCapture(hwnd);
return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam);
-
+
case WM_LBUTTONUP:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
g_fButton[0] = FALSE;
+ ReleaseCapture();
+ winStartMousePolling(s_pScreenPriv);
return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam);
case WM_MBUTTONDBLCLK:
@@ -614,47 +635,66 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
g_fButton[1] = TRUE;
+ SetCapture(hwnd);
return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam);
-
+
case WM_MBUTTONUP:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
g_fButton[1] = FALSE;
+ ReleaseCapture();
+ winStartMousePolling(s_pScreenPriv);
return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam);
-
+
case WM_RBUTTONDBLCLK:
case WM_RBUTTONDOWN:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
g_fButton[2] = TRUE;
+ SetCapture(hwnd);
return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam);
-
+
case WM_RBUTTONUP:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
g_fButton[2] = FALSE;
+ ReleaseCapture();
+ winStartMousePolling(s_pScreenPriv);
return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam);
case WM_XBUTTONDBLCLK:
case WM_XBUTTONDOWN:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
+ SetCapture(hwnd);
return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam);
+
case WM_XBUTTONUP:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
+ ReleaseCapture();
+ winStartMousePolling(s_pScreenPriv);
return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam);
case WM_MOUSEWHEEL:
-
- /* Pass the message to the root window */
- SendMessage (hwndScreen, message, wParam, lParam);
- return 0;
+ if (SendMessage(hwnd, WM_NCHITTEST, 0, MAKELONG(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) == HTCLIENT)
+ {
+ /* Pass the message to the root window */
+ SendMessage (hwndScreen, message, wParam, lParam);
+ return 0;
+ }
+ else break;
case WM_SETFOCUS:
if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
break;
+ {
+ /* Get the parent window for transient handling */
+ HWND hParent = GetParent(hwnd);
+ if (hParent && IsIconic(hParent)) ShowWindow (hParent, SW_RESTORE);
+ }
+
winRestoreModeKeyStates ();
/* Add the keyboard hook if possible */
@@ -668,6 +708,9 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
/* Remove our keyboard hook if it is installed */
winRemoveKeyboardHookLL ();
+ if (!wParam)
+ /* Revert the X focus as well, but only if the Windows focus is going to another thread */
+ DeleteWindowFromAnyEvents(pWin, FALSE);
return 0;
case WM_SYSDEADCHAR:
@@ -770,6 +813,10 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
if (!pWin || !pWin->overrideRedirect) /* for OOo menus */
winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
}
+ /* Prevent the mouse wheel from stalling when another window is minimized */
+ if (HIWORD(wParam) == 0 && LOWORD(wParam) == WA_ACTIVE &&
+ (HWND)lParam != NULL && (HWND)lParam != (HWND)GetParent(hwnd))
+ SetFocus(hwnd);
return 0;
case WM_ACTIVATEAPP:
@@ -824,98 +871,57 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
if (!wParam)
return 0;
- /* Tell X to map the window */
- MapWindow (pWin, wClient(pWin));
-
/* */
if (!pWin->overrideRedirect)
{
- DWORD dwExStyle;
- DWORD dwStyle;
- RECT rcNew;
- int iDx, iDy;
-
/* Flag that this window needs to be made active when clicked */
SetProp (hwnd, WIN_NEEDMANAGE_PROP, (HANDLE) 1);
- /* Get the standard and extended window style information */
- dwExStyle = GetWindowLongPtr (hwnd, GWL_EXSTYLE);
- dwStyle = GetWindowLongPtr (hwnd, GWL_STYLE);
-
- /* */
- if (dwExStyle != WS_EX_APPWINDOW)
+ if (!(GetWindowLongPtr (hwnd, GWL_EXSTYLE) & WS_EX_APPWINDOW))
{
- /* Setup a rectangle with the X window position and size */
- SetRect (&rcNew,
- pDraw->x,
- pDraw->y,
- pDraw->x + pDraw->width,
- pDraw->y + pDraw->height);
-
-#if 0
- ErrorF ("winTopLevelWindowProc - (%d, %d)-(%d, %d)\n",
- rcNew.left, rcNew.top,
- rcNew.right, rcNew.bottom);
-#endif
-
- /* */
- AdjustWindowRectEx (&rcNew,
- WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW,
- FALSE,
- WS_EX_APPWINDOW);
-
- /* Calculate position deltas */
- iDx = pDraw->x - rcNew.left;
- iDy = pDraw->y - rcNew.top;
-
- /* Calculate new rectangle */
- rcNew.left += iDx;
- rcNew.right += iDx;
- rcNew.top += iDy;
- rcNew.bottom += iDy;
-
-#if 0
- ErrorF ("winTopLevelWindowProc - (%d, %d)-(%d, %d)\n",
- rcNew.left, rcNew.top,
- rcNew.right, rcNew.bottom);
-#endif
+ HWND zstyle = HWND_NOTOPMOST;
/* Set the window extended style flags */
SetWindowLongPtr (hwnd, GWL_EXSTYLE, WS_EX_APPWINDOW);
+ /* Set the transient style flags */
+ if (GetParent(hwnd)) SetWindowLongPtr (hwnd, GWL_STYLE,
+ WS_POPUP | WS_OVERLAPPED | WS_SYSMENU | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
/* Set the window standard style flags */
- SetWindowLongPtr (hwnd, GWL_STYLE,
- WS_POPUP | WS_SIZEBOX | WS_OVERLAPPEDWINDOW);
-
- /* Position the Windows window */
- SetWindowPos (hwnd, HWND_TOP,
- rcNew.left, rcNew.top,
- rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
- SWP_NOMOVE | SWP_FRAMECHANGED
- | SWP_SHOWWINDOW | SWP_NOACTIVATE);
+ else SetWindowLongPtr (hwnd, GWL_STYLE,
+ (WS_POPUP | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS)
+ & ~WS_CAPTION & ~WS_SIZEBOX);
- /* Bring the Windows window to the foreground */
+ winUpdateWindowPosition (hwnd, FALSE, &zstyle);
SetForegroundWindow (hwnd);
}
+ wmMsg.msg = WM_WM_MAP;
}
else /* It is an overridden window so make it top of Z stack */
{
+ HWND forHwnd = GetForegroundWindow();
#if CYGWINDOWING_DEBUG
ErrorF ("overridden window is shown\n");
#endif
- SetWindowPos (hwnd, HWND_TOPMOST, 0, 0, 0, 0,
- SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ if (forHwnd != NULL)
+ {
+ if (GetWindowLongPtr(forHwnd, GWLP_USERDATA) & (LONG_PTR)XMING_SIGNATURE)
+ {
+ if (GetWindowLongPtr(forHwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
+ SetWindowPos (hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ else
+ SetWindowPos (hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ }
+ }
+ wmMsg.msg = WM_WM_MAP2;
}
- /* Setup the Window Manager message */
- wmMsg.msg = WM_WM_MAP;
- wmMsg.iWidth = pDraw->width;
- wmMsg.iHeight = pDraw->height;
-
/* Tell our Window Manager thread to map the window */
if (fWMMsgInitialized)
winSendMessageToWM (s_pScreenPriv->pWMInfo, &wmMsg);
+ winStartMousePolling(s_pScreenPriv);
+
return 0;
case WM_SIZING:
@@ -1009,8 +1015,20 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
#endif
/* Adjust the X Window to the moved Windows window */
winAdjustXWindow (pWin, hwnd);
+ if (wParam == SIZE_MINIMIZED) winReorderWindowsMultiWindow();
return 0; /* end of WM_SIZE handler */
+ case WM_STYLECHANGED:
+ /* when the style changes, adjust the window size so the client area remains the same */
+ {
+ LONG x,y;
+ DrawablePtr pDraw = &pWin->drawable;
+ x = pDraw->x - wBorderWidth(pWin);
+ y = pDraw->y - wBorderWidth(pWin);
+ winPositionWindowMultiWindow(pWin, x, y);
+ }
+ return 0;
+
case WM_MOUSEACTIVATE:
/* Check if this window needs to be made active when clicked */
diff --git a/xorg-server/hw/xwin/winpolyline.c b/xorg-server/hw/xwin/winpolyline.c
index db9dd345b..bf98d73ec 100644
--- a/xorg-server/hw/xwin/winpolyline.c
+++ b/xorg-server/hw/xwin/winpolyline.c
@@ -45,7 +45,7 @@ winPolyLineNativeGDI (DrawablePtr pDrawable,
{
case LineSolid:
if (pGC->lineWidth == 0)
- return miZeroLine (pDrawable, pGC, mode, npt, ppt);
+ miZeroLine (pDrawable, pGC, mode, npt, ppt);
else
miWideLine (pDrawable, pGC, mode, npt, ppt);
break;
diff --git a/xorg-server/hw/xwin/winprefs.c b/xorg-server/hw/xwin/winprefs.c
index 30e587d4a..c5fd7eb08 100644
--- a/xorg-server/hw/xwin/winprefs.c
+++ b/xorg-server/hw/xwin/winprefs.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ * Copyright (C) Colin Harrison 2005-2008
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -26,6 +27,7 @@
* from the XFree86 Project.
*
* Authors: Earle F. Philhower, III
+ * Colin Harrison
*/
#ifdef HAVE_XWIN_CONFIG_H
@@ -724,7 +726,7 @@ winIconIsOverride(unsigned hiconIn)
/*
- * Try and open ~/.XWinrc and /usr/X11R6/lib/X11/system.XWinrc
+ * Try and open ~/.XWinrc and system.XWinrc
* Load it into prefs structure for use by other functions
*/
void
@@ -764,7 +766,7 @@ LoadPreferences ()
#ifdef RELOCATE_PROJECTROOT
snprintf(buffer, sizeof(buffer), "%s\\system.XWinrc", winGetBaseDir());
#else
- strncpy(buffer, PROJECTROOT"/lib/X11/system.XWinrc", sizeof(buffer));
+ strncpy(buffer, SYSCONFDIR"/X11/system.XWinrc", sizeof(buffer));
#endif
buffer[sizeof(buffer)-1] = 0;
prefFile = fopen (buffer, "r");
@@ -820,3 +822,49 @@ LoadPreferences ()
} /* for all menus */
}
+
+
+/*
+ * Check for a match of the window class to one specified in the
+ * STYLES{} section in the prefs file, and return the style type
+ */
+unsigned long
+winOverrideStyle (unsigned long longpWin)
+{
+ WindowPtr pWin = (WindowPtr) longpWin;
+ char *res_name, *res_class;
+ int i;
+ char *wmName;
+
+ if (pWin==NULL)
+ return STYLE_NONE;
+
+ /* If we can't find the class, we can't override from default! */
+ if (!winMultiWindowGetClassHint (pWin, &res_name, &res_class))
+ return STYLE_NONE;
+
+ winMultiWindowGetWMName (pWin, &wmName);
+
+ for (i=0; i<pref.styleItems; i++) {
+ if (!strcmp(pref.style[i].match, res_name) ||
+ !strcmp(pref.style[i].match, res_class) ||
+ (wmName && strstr(wmName, pref.style[i].match)))
+ {
+ free (res_name);
+ free (res_class);
+ if (wmName)
+ free (wmName);
+
+ if (pref.style[i].type)
+ return pref.style[i].type;
+ }
+ }
+
+ /* Didn't find the style, fail gracefully */
+ free (res_name);
+ free (res_class);
+ if (wmName)
+ free (wmName);
+
+ return STYLE_NONE;
+}
diff --git a/xorg-server/hw/xwin/winprefs.h b/xorg-server/hw/xwin/winprefs.h
index d9e09deea..996b02ade 100644
--- a/xorg-server/hw/xwin/winprefs.h
+++ b/xorg-server/hw/xwin/winprefs.h
@@ -2,6 +2,7 @@
#define WINPREFS_H
/*
* Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ * Copyright (C) Colin Harrison 2005-2008
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -28,6 +29,7 @@
* from the XFree86 Project.
*
* Authors: Earle F. Philhower, III
+ * Colin Harrison
*/
/* Need Bool */
@@ -57,6 +59,15 @@ typedef enum MENUCOMMANDTYPE
CMD_RELOAD /* Reparse the .XWINRC file */
} MENUCOMMANDTYPE;
+#define STYLE_NONE (0L) /* Dummy the first entry */
+#define STYLE_NOTITLE (1L) /* Force window style no titlebar */
+#define STYLE_OUTLINE (1L<<1) /* Force window style just thin-line border */
+#define STYLE_NOFRAME (1L<<2) /* Force window style no frame */
+#define STYLE_TOPMOST (1L<<3) /* Open a window always-on-top */
+#define STYLE_MAXIMIZE (1L<<4) /* Open a window maximized */
+#define STYLE_MINIMIZE (1L<<5) /* Open a window minimized */
+#define STYLE_BOTTOM (1L<<6) /* Open a window at the bottom of the Z order */
+
/* Where to place a system menu */
typedef enum MENUPOSITION
{
@@ -97,6 +108,13 @@ typedef struct ICONITEM
unsigned long hicon; /* LoadImage() result */
} ICONITEM;
+/* To redefine styles for certain window types */
+typedef struct STYLEITEM
+{
+ char match[MENU_MAX+1]; /* What string to search for? */
+ unsigned long type; /* What should it do? */
+} STYLEITEM;
+
typedef struct WINPREFS
{
/* Menu information */
@@ -122,6 +140,9 @@ typedef struct WINPREFS
ICONITEM *icon;
int iconItems;
+ STYLEITEM *style;
+ int styleItems;
+
/* Silent exit flag */
Bool fSilentExit;
@@ -155,6 +176,9 @@ unsigned long
winOverrideIcon (unsigned long longpWin);
unsigned long
+winOverrideStyle (unsigned long longpWin);
+
+unsigned long
winTaskbarIcon(void);
unsigned long
diff --git a/xorg-server/hw/xwin/winprefslex.l b/xorg-server/hw/xwin/winprefslex.l
index a4c1abc3d..ee2478bcc 100644
--- a/xorg-server/hw/xwin/winprefslex.l
+++ b/xorg-server/hw/xwin/winprefslex.l
@@ -1,6 +1,7 @@
%{ # -*- C -*-
/*
* Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ * Copyright (C) Colin Harrison 2005-2008
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -27,6 +28,7 @@
* from the XFree86 Project.
*
* Authors: Earle F. Philhower, III
+ * Colin Harrison
*/
/* $XFree86: $ */
@@ -70,6 +72,14 @@ MENU { return MENU; }
ICONDIRECTORY { return ICONDIRECTORY; }
DEFAULTICON { return DEFAULTICON; }
ICONS { return ICONS; }
+STYLES { return STYLES; }
+TOPMOST { return TOPMOST; }
+MAXIMIZE { return MAXIMIZE; }
+MINIMIZE { return MINIMIZE; }
+BOTTOM { return BOTTOM; }
+NOTITLE { return NOTITLE; }
+OUTLINE { return OUTLINE; }
+NOFRAME { return NOFRAME; }
ROOTMENU { return ROOTMENU; }
DEFAULTSYSMENU { return DEFAULTSYSMENU; }
SYSMENU { return SYSMENU; }
diff --git a/xorg-server/hw/xwin/winprefsyacc.c b/xorg-server/hw/xwin/winprefsyacc.c
index abdc681b6..131379f48 100644
--- a/xorg-server/hw/xwin/winprefsyacc.c
+++ b/xorg-server/hw/xwin/winprefsyacc.c
@@ -62,6 +62,9 @@
/* Tokens. */
#ifndef YYTOKENTYPE
+#ifdef DEBUG
+#undef DEBUG
+#endif
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
@@ -373,14 +376,14 @@ YYID (i)
# ifndef YYMALLOC
# define YYMALLOC malloc
# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+ || defined __cplusplus)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+ || defined __cplusplus)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
diff --git a/xorg-server/hw/xwin/winprefsyacc.h b/xorg-server/hw/xwin/winprefsyacc.h
index 60a879a4d..de075f50a 100644
--- a/xorg-server/hw/xwin/winprefsyacc.h
+++ b/xorg-server/hw/xwin/winprefsyacc.h
@@ -35,6 +35,10 @@
/* Tokens. */
#ifndef YYTOKENTYPE
+#ifdef DEBUG
+#undef DEBUG
+#endif
+
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
diff --git a/xorg-server/hw/xwin/winprefsyacc.y b/xorg-server/hw/xwin/winprefsyacc.y
index 2a54ff28f..c917d04ff 100644
--- a/xorg-server/hw/xwin/winprefsyacc.y
+++ b/xorg-server/hw/xwin/winprefsyacc.y
@@ -1,6 +1,7 @@
%{
/*
* Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ * Copyright (C) Colin Harrison 2005-2008
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -27,6 +28,7 @@
* from the XFree86 Project.
*
* Authors: Earle F. Philhower, III
+ * Colin Harrison
*/
/* $XFree86: $ */
@@ -41,6 +43,10 @@
/* The following give better error messages in bison at the cost of a few KB */
#define YYERROR_VERBOSE 1
+/* YYLTYPE_IS_TRIVIAL and YYENABLE_NLS defined to suppress warnings */
+#define YYLTYPE_IS_TRIVIAL 1
+#define YYENABLE_NLS 0
+
/* The global pref settings */
WINPREFS pref;
@@ -64,6 +70,10 @@ static void OpenIcons(void);
static void AddIconLine(char *matchstr, char *iconfile);
static void CloseIcons(void);
+static void OpenStyles(void);
+static void AddStyleLine(char *matchstr, unsigned long style);
+static void CloseStyles(void);
+
static void OpenSysMenu(void);
static void AddSysMenuLine(char *matchstr, char *menuname, int pos);
static void CloseSysMenu(void);
@@ -78,14 +88,19 @@ extern int yylex(void);
%union {
char *sVal;
+ unsigned long uVal;
int iVal;
}
-%token NEWLINE MENU LB RB ICONDIRECTORY DEFAULTICON ICONS DEFAULTSYSMENU
+%token NEWLINE MENU LB RB ICONDIRECTORY DEFAULTICON ICONS STYLES
+%token TOPMOST MAXIMIZE MINIMIZE BOTTOM NOTITLE OUTLINE NOFRAME DEFAULTSYSMENU
%token SYSMENU ROOTMENU SEPARATOR ATSTART ATEND EXEC ALWAYSONTOP DEBUG
%token RELOAD TRAYICON SILENTEXIT
%token <sVal> STRING
+%type <uVal> group1
+%type <uVal> group2
+%type <uVal> stylecombo
%type <iVal> atspot
%%
@@ -107,6 +122,7 @@ command: defaulticon
| icondirectory
| menu
| icons
+ | styles
| sysmenu
| rootmenu
| defaultsysmenu
@@ -154,6 +170,33 @@ iconlist: iconline
icons: ICONS LB {OpenIcons();} newline_or_nada iconlist RB {CloseIcons();}
;
+group1: TOPMOST { $$=STYLE_TOPMOST; }
+ | MAXIMIZE { $$=STYLE_MAXIMIZE; }
+ | MINIMIZE { $$=STYLE_MINIMIZE; }
+ | BOTTOM { $$=STYLE_BOTTOM; }
+ ;
+
+group2: NOTITLE { $$=STYLE_NOTITLE; }
+ | OUTLINE { $$=STYLE_OUTLINE; }
+ | NOFRAME { $$=STYLE_NOFRAME; }
+ ;
+
+stylecombo: group1 { $$=$1; }
+ | group2 { $$=$1; }
+ | group1 group2 { $$=$1+$2; }
+ | group2 group1 { $$=$1+$2; }
+ ;
+
+styleline: STRING stylecombo NEWLINE newline_or_nada { AddStyleLine($1, $2); free($1); }
+ ;
+
+stylelist: styleline
+ | styleline stylelist
+ ;
+
+styles: STYLES LB {OpenStyles();} newline_or_nada stylelist RB {CloseStyles();}
+ ;
+
atspot: { $$=AT_END; }
| ATSTART { $$=AT_START; }
| ATEND { $$=AT_END; }
@@ -316,6 +359,39 @@ CloseIcons (void)
}
static void
+OpenStyles (void)
+{
+ if (pref.style != NULL) {
+ ErrorF("LoadPreferences: Redefining window style\n");
+ free(pref.style);
+ pref.style = NULL;
+ }
+ pref.styleItems = 0;
+}
+
+static void
+AddStyleLine (char *matchstr, unsigned long style)
+{
+ if (pref.style==NULL)
+ pref.style = (STYLEITEM*)malloc(sizeof(STYLEITEM));
+ else
+ pref.style = (STYLEITEM*)
+ realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1));
+
+ strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX);
+ pref.style[pref.styleItems].match[MENU_MAX] = 0;
+
+ pref.style[pref.styleItems].type = style;
+
+ pref.styleItems++;
+}
+
+static void
+CloseStyles (void)
+{
+}
+
+static void
OpenSysMenu (void)
{
if (pref.sysMenu != NULL) {
diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c
index 7139cbaab..9271da02b 100644
--- a/xorg-server/hw/xwin/winprocarg.c
+++ b/xorg-server/hw/xwin/winprocarg.c
@@ -1,6 +1,7 @@
/*
Copyright 1993, 1998 The Open Group
+Copyright (C) Colin Harrison 2005-2008
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
@@ -31,9 +32,9 @@ from The Open Group.
#endif
#ifdef XVENDORNAME
#define VENDOR_STRING XVENDORNAME
-#define VERSION_STRING XORG_RELEASE
#define VENDOR_CONTACT BUILDERADDR
#endif
+#include <../xfree86/common/xorgVersion.h>
#include "win.h"
#include "winconfig.h"
#include "winprefs.h"
@@ -57,6 +58,7 @@ extern char * g_pszLogFile;
extern Bool g_fLogFileChanged;
#endif
extern Bool g_fXdmcpEnabled;
+extern Bool g_fAuthEnabled;
extern char * g_pszCommandLine;
extern Bool g_fKeyboardHookLL;
extern Bool g_fNoHelpMessageBox;
@@ -1289,6 +1291,29 @@ ddxProcessArgument (int argc, char *argv[], int i)
}
/*
+ * Look for the '-auth' argument
+ */
+ if (IS_OPTION ("-auth"))
+ {
+#ifdef __MINGW32__
+ HANDLE hFile;
+ char * pszFile;
+ CHECK_ARGS (1);
+ pszFile = argv[++i];
+ hFile = CreateFile(pszFile,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+ if (hFile == INVALID_HANDLE_VALUE)
+ winMessageBoxF ("This authorization file for the -auth option could not be opened...\n"
+ "\"%s\"\n"
+ "You should use an \"Xauthority\" file in your HOME directory.\n"
+ "\nIgnoring and continuing.\n",
+ MB_ICONINFORMATION,
+ pszFile);
+#endif
+ g_fAuthEnabled = TRUE;
+ return 0; /* Let DIX parse this again */
+ }
+
+ /*
* Look for the '-indirect' or '-broadcast' arguments
*/
if (IS_OPTION ("-indirect")
@@ -1459,13 +1484,13 @@ winLogCommandLine (int argc, char *argv[])
for (i = 0, iCurrLen = 0; i < argc; ++i)
if (argv[i])
{
- /* Add a character for lines that overflow */
+ /* Adds two characters for lines that overflow */
if ((strlen (argv[i]) < CHARS_PER_LINE
&& iCurrLen + strlen (argv[i]) > CHARS_PER_LINE)
|| strlen (argv[i]) > CHARS_PER_LINE)
{
iCurrLen = 0;
- ++iSize;
+ iSize += 2;
}
/* Add space for item and trailing space */
@@ -1525,8 +1550,8 @@ winLogVersionInfo (void)
ErrorF ("Welcome to the XWin X Server\n");
ErrorF ("Vendor: %s\n", VENDOR_STRING);
- ErrorF ("Release: %s\n\n", VERSION_STRING);
- ErrorF ("Contact: %s\n\n", VENDOR_CONTACT);
+ ErrorF ("Release: %d.%d.%d.%d (%d)\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, BUILD_DATE);
+ ErrorF ("Contact: %s\n", VENDOR_CONTACT);
}
/*
diff --git a/xorg-server/hw/xwin/winresource.h b/xorg-server/hw/xwin/winresource.h
index 5aa884030..7085117e6 100644
--- a/xorg-server/hw/xwin/winresource.h
+++ b/xorg-server/hw/xwin/winresource.h
@@ -37,7 +37,6 @@
#define IDC_STATIC -1
#define IDI_XWIN 101
-#define IDI_XWIN_BOXED 102
#define IDM_TRAYICON_MENU 103
#define IDC_CLIENTS_CONNECTED 104
diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c
index 9dc4c3da5..5cc3925c7 100644
--- a/xorg-server/hw/xwin/winscrinit.c
+++ b/xorg-server/hw/xwin/winscrinit.c
@@ -37,7 +37,6 @@
#endif
#include "win.h"
#include "winmsg.h"
-#include "safeAlpha.h"
#ifdef XWIN_MULTIWINDOWEXTWM
@@ -142,7 +141,7 @@ winScreenInit (int index,
}
/* Adjust the video mode for our engine type */
- if (!(*pScreenPriv->pwinAdjustVideoMode) (pScreen))
+ if (pScreenPriv->pwinAdjustVideoMode && !(*pScreenPriv->pwinAdjustVideoMode) (pScreen))
{
ErrorF ("winScreenInit - winAdjustVideoMode () failed\n");
return FALSE;
@@ -176,7 +175,7 @@ winScreenInit (int index,
}
/* Create display window */
- if (!(*pScreenPriv->pwinCreateBoundingWindow) (pScreen))
+ if (pScreenPriv->pwinCreateBoundingWindow && !(*pScreenPriv->pwinCreateBoundingWindow) (pScreen))
{
ErrorF ("winScreenInit - pwinCreateBoundingWindow () "
"failed\n");
@@ -227,7 +226,7 @@ winScreenInit (int index,
pScreenInfo->dwBPP);
/* Call the engine dependent screen initialization procedure */
- if (!((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv)))
+ if (pScreenPriv->pwinFinishScreenInit && !((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv)))
{
ErrorF ("winScreenInit - winFinishScreenInit () failed\n");
return FALSE;
@@ -245,6 +244,25 @@ winScreenInit (int index,
return TRUE;
}
+static Bool
+winCreateScreenResources(ScreenPtr pScreen)
+{
+ winScreenPriv(pScreen);
+ Bool result;
+
+ result = pScreenPriv->pwinCreateScreenResources(pScreen);
+
+ /* Now the screen bitmap has been wrapped in a pixmap,
+ add that to the Shadow framebuffer */
+ if (!shadowAdd(pScreen, pScreen->devPrivate,
+ pScreenPriv->pwinShadowUpdate, NULL, 0, 0))
+ {
+ ErrorF ("winCreateScreenResources - shadowAdd () failed\n");
+ return FALSE;
+ }
+
+ return result;
+}
/* See Porting Layer Definition - p. 20 */
Bool
@@ -360,22 +378,6 @@ winFinishScreenInitFB (int index,
pScreen->blockData = pScreen;
pScreen->wakeupData = pScreen;
-#ifdef XWIN_MULTIWINDOWEXTWM
- /*
- * Setup acceleration for multi-window external window manager mode.
- * To be compatible with the Damage extension, this must be done
- * before calling miDCInitialize, which calls DamageSetup.
- */
- if (pScreenInfo->fMWExtWM)
- {
- if (!RootlessAccelInit (pScreen))
- {
- ErrorF ("winFinishScreenInitFB - RootlessAccelInit () failed\n");
- return FALSE;
- }
- }
-#endif
-
#ifdef RENDER
/* Render extension initialization, calls miPictureInit */
if (!fbPictureInit (pScreen, NULL, 0))
@@ -428,15 +430,18 @@ winFinishScreenInitFB (int index,
)
{
#if CYGDEBUG
- winDebug ("winFinishScreenInitFB - Calling shadowInit ()\n");
+ winDebug ("winFinishScreenInitFB - Calling shadowSetup ()\n");
#endif
- if (!shadowInit (pScreen,
- pScreenPriv->pwinShadowUpdate,
- NULL))
+ if (!shadowSetup(pScreen))
{
- ErrorF ("winFinishScreenInitFB - shadowInit () failed\n");
+ ErrorF ("winFinishScreenInitFB - shadowSetup () failed\n");
return FALSE;
}
+
+ /* Wrap CreateScreenResources so we can add the screen pixmap
+ to the Shadow framebuffer after it's been created */
+ pScreenPriv->pwinCreateScreenResources = pScreen->CreateScreenResources;
+ pScreen->CreateScreenResources = winCreateScreenResources;
}
#ifdef XWIN_MULTIWINDOWEXTWM
diff --git a/xorg-server/hw/xwin/winshaddd.c b/xorg-server/hw/xwin/winshaddd.c
index a2c1dc9b0..96acfcbc7 100644
--- a/xorg-server/hw/xwin/winshaddd.c
+++ b/xorg-server/hw/xwin/winshaddd.c
@@ -48,10 +48,12 @@ extern HWND g_hDlgExit;
* FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,
* so we have to redefine it here.
*/
+#ifndef _MSC_VER
#ifdef DEFINE_GUID
#undef DEFINE_GUID
#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
#endif /* DEFINE_GUID */
+#endif
/*
@@ -361,7 +363,7 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
{
ErrorF ("winAllocateFBShadowDD - Changing video mode\n");
- /* Change the video mode to the mode requested */
+ /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */
ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2,
pScreenInfo->dwWidth,
pScreenInfo->dwHeight,
@@ -373,7 +375,20 @@ winAllocateFBShadowDD (ScreenPtr pScreen)
ErrorF ("winAllocateFBShadowDD - Could not set "\
"full screen display mode: %08x\n",
(unsigned int) ddrval);
- return FALSE;
+ ErrorF ("winAllocateFBShadowDD - Using default driver refresh rate\n");
+ ddrval = IDirectDraw2_SetDisplayMode (pScreenPriv->pdd2,
+ pScreenInfo->dwWidth,
+ pScreenInfo->dwHeight,
+ pScreenInfo->dwBPP,
+ 0,
+ 0);
+ if (FAILED(ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDD - Could not set default refresh rate "
+ "full screen display mode: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
}
}
else
@@ -508,7 +523,7 @@ winShadowUpdateDD (ScreenPtr pScreen,
{
winScreenPriv(pScreen);
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- RegionPtr damage = &pBuf->damage;
+ RegionPtr damage = shadowDamage(pBuf);
HRESULT ddrval = DD_OK;
RECT rcDest, rcSrc;
POINT ptOrigin;
@@ -534,7 +549,7 @@ winShadowUpdateDD (ScreenPtr pScreen,
ddrval = IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL);
if (FAILED (ddrval))
{
- ErrorF ("winShadowUpdateProcDD - Unlock failed\n");
+ ErrorF ("winShadowUpdateDD - Unlock failed\n");
return;
}
@@ -626,19 +641,20 @@ winShadowUpdateDD (ScreenPtr pScreen,
NULL);
if (FAILED (ddrval))
{
- ErrorF ("winShadowUpdateProcDD - Lock failed\n");
+ ErrorF ("winShadowUpdateDD - Lock failed\n");
return;
}
/* Has our memory pointer changed? */
if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface)
{
- ErrorF ("winShadowUpdateProcDD - Memory location of the shadow "
+ extern char *g_pszLogFile;
+ ErrorF ("winShadowUpdateDD - Memory location of the shadow "
"surface has changed, trying to update the root window "
"pixmap header to point to the new address. If you get "
"this message and "PROJECT_NAME" freezes or crashes "
"after this message then send a problem report and your "
- "/tmp/XWin.log file to cygwin-xfree@cygwin.com\n");
+ "%s file to " BUILDERADDR, g_pszLogFile);
/* Location of shadow framebuffer has changed */
pScreenInfo->pfb = pScreenPriv->pddsdShadow->lpSurface;
@@ -653,7 +669,7 @@ winShadowUpdateDD (ScreenPtr pScreen,
pScreenInfo->dwBPP),
pScreenInfo->pfb))
{
- ErrorF ("winShadowUpdateProcDD - Bits changed, could not "
+ ErrorF ("winShadowUpdateDD - Bits changed, could not "
"notify fb.\n");
return;
}
diff --git a/xorg-server/hw/xwin/winshadddnl.c b/xorg-server/hw/xwin/winshadddnl.c
index 47cc382e9..e029154ed 100644
--- a/xorg-server/hw/xwin/winshadddnl.c
+++ b/xorg-server/hw/xwin/winshadddnl.c
@@ -48,10 +48,12 @@ extern HWND g_hDlgExit;
* FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,
* so we have to redefine it here.
*/
+#ifndef _MSC_VER
#ifdef DEFINE_GUID
#undef DEFINE_GUID
#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
#endif /* DEFINE_GUID */
+#endif
/*
* FIXME: Headers are broken, IID_IDirectDraw4 has to be defined
@@ -391,7 +393,7 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
{
winDebug ("winAllocateFBShadowDDNL - Changing video mode\n");
- /* Change the video mode to the mode requested */
+ /* Change the video mode to the mode requested, and use the driver default refresh rate on failure */
ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4,
pScreenInfo->dwWidth,
pScreenInfo->dwHeight,
@@ -403,7 +405,20 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen)
ErrorF ("winAllocateFBShadowDDNL - Could not set "
"full screen display mode: %08x\n",
(unsigned int) ddrval);
- return FALSE;
+ ErrorF ("winAllocateFBShadowDDNL - Using default driver refresh rate\n");
+ ddrval = IDirectDraw4_SetDisplayMode (pScreenPriv->pdd4,
+ pScreenInfo->dwWidth,
+ pScreenInfo->dwHeight,
+ pScreenInfo->dwBPP,
+ 0,
+ 0);
+ if (FAILED(ddrval))
+ {
+ ErrorF ("winAllocateFBShadowDDNL - Could not set default refresh rate "
+ "full screen display mode: %08x\n",
+ (unsigned int) ddrval);
+ return FALSE;
+ }
}
}
else
@@ -584,7 +599,7 @@ winShadowUpdateDDNL (ScreenPtr pScreen,
{
winScreenPriv(pScreen);
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- RegionPtr damage = &pBuf->damage;
+ RegionPtr damage = shadowDamage(pBuf);
HRESULT ddrval = DD_OK;
RECT rcDest, rcSrc;
POINT ptOrigin;
@@ -1310,7 +1325,7 @@ winStoreColorsShadowDDNL (ColormapPtr pColormap,
+ pdefs[0].pixel);
if (FAILED (ddrval))
{
- ErrorF ("winStoreColorsShadowDDNL - SetEntries () failed: %08x\n", ddrval);
+ ErrorF ("winStoreColorsShadowDDNL - SetEntries () failed: %08x\n", (int) ddrval);
return FALSE;
}
diff --git a/xorg-server/hw/xwin/winshadgdi.c b/xorg-server/hw/xwin/winshadgdi.c
index 04cc2f716..d38e4f76b 100644
--- a/xorg-server/hw/xwin/winshadgdi.c
+++ b/xorg-server/hw/xwin/winshadgdi.c
@@ -498,7 +498,7 @@ winShadowUpdateGDI (ScreenPtr pScreen,
{
winScreenPriv(pScreen);
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
- RegionPtr damage = &pBuf->damage;
+ RegionPtr damage = shadowDamage(pBuf);
DWORD dwBox = REGION_NUM_RECTS (damage);
BoxPtr pBox = REGION_RECTS (damage);
int x, y, w, h;
diff --git a/xorg-server/hw/xwin/winwin32rootless.c b/xorg-server/hw/xwin/winwin32rootless.c
index 6f4e2c97e..2c80c0885 100644
--- a/xorg-server/hw/xwin/winwin32rootless.c
+++ b/xorg-server/hw/xwin/winwin32rootless.c
@@ -38,7 +38,7 @@
#include "win.h"
#include <winuser.h>
#define _WINDOWSWM_SERVER_
-#include "windowswmstr.h"
+#include <X11/extensions/windowswmstr.h>
#include "dixevents.h"
#include "winmultiwindowclass.h"
#include "winprefs.h"
@@ -48,9 +48,6 @@
/*
* Constant defines
*/
-
-#define MOUSE_POLLING_INTERVAL 500
-
#define ULW_COLORKEY 0x00000001
#define ULW_ALPHA 0x00000002
#define ULW_OPAQUE 0x00000004
diff --git a/xorg-server/hw/xwin/winwin32rootlesswndproc.c b/xorg-server/hw/xwin/winwin32rootlesswndproc.c
index 859aafd29..3d16ae5c9 100644
--- a/xorg-server/hw/xwin/winwin32rootlesswndproc.c
+++ b/xorg-server/hw/xwin/winwin32rootlesswndproc.c
@@ -35,7 +35,7 @@
#include "win.h"
#include <winuser.h>
#define _WINDOWSWM_SERVER_
-#include "windowswmstr.h"
+#include <X11/extensions/windowswmstr.h>
#include "dixevents.h"
#include "propertyst.h"
#include <X11/Xatom.h>
@@ -48,7 +48,6 @@
* Constant defines
*/
-#define MOUSE_POLLING_INTERVAL 500
#define MOUSE_ACTIVATE_DEFAULT TRUE
#define RAISE_ON_CLICK_DEFAULT FALSE
@@ -567,9 +566,9 @@ winMWExtWMWindowProc (HWND hwnd, UINT message,
}
/* Deliver absolute cursor position to X Server */
- miPointerAbsoluteCursor (ptMouse.x - pScreenInfo->dwXOffset,
- ptMouse.y - pScreenInfo->dwYOffset,
- g_c32LastInputEventTime = GetTickCount ());
+ winEnqueueMotion(ptMouse.x - pScreenInfo->dwXOffset,
+ ptMouse.y - pScreenInfo->dwYOffset);
+
return 0;
case WM_NCMOUSEMOVE:
diff --git a/xorg-server/hw/xwin/winwindow.c b/xorg-server/hw/xwin/winwindow.c
index 1600996df..54afe9f7e 100644
--- a/xorg-server/hw/xwin/winwindow.c
+++ b/xorg-server/hw/xwin/winwindow.c
@@ -60,6 +60,7 @@ winReshapeRootless (WindowPtr pWin);
Bool
winCreateWindowNativeGDI (WindowPtr pWin)
{
+ Bool fResult;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin);
winScreenPriv(pScreen);
@@ -352,7 +353,6 @@ winPositionWindowRootless (WindowPtr pWin, int x, int y)
{
Bool fResult = FALSE;
ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
winScreenPriv(pScreen);
@@ -378,7 +378,6 @@ winChangeWindowAttributesRootless (WindowPtr pWin, unsigned long mask)
{
Bool fResult = FALSE;
ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
winScreenPriv(pScreen);
#if CYGDEBUG
@@ -436,7 +435,6 @@ winMapWindowRootless (WindowPtr pWin)
{
Bool fResult = FALSE;
ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
winScreenPriv(pScreen);
#if CYGDEBUG
@@ -462,7 +460,6 @@ void
winSetShapeRootless (WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
- winWindowPriv(pWin);
winScreenPriv(pScreen);
#if CYGDEBUG
diff --git a/xorg-server/hw/xwin/winwindow.h b/xorg-server/hw/xwin/winwindow.h
index 9c49d6482..71c5b015e 100644
--- a/xorg-server/hw/xwin/winwindow.h
+++ b/xorg-server/hw/xwin/winwindow.h
@@ -2,6 +2,7 @@
#define _WINWINDOW_H_
/*
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
+ *Copyright (C) Colin Harrison 2005-2008
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -28,6 +29,7 @@
*from the XFree86 Project.
*
* Authors: Kensuke Matsuzaki
+ * Colin Harrison
*/
#ifndef NO
@@ -42,8 +44,8 @@
# define PROJECT_NAME "Cygwin/X"
#endif
#define WINDOW_CLASS "cygwin/x"
-#define WINDOW_TITLE PROJECT_NAME " - %s:%d"
-#define WINDOW_TITLE_XDMCP PROJECT_NAME " - %s"
+#define WINDOW_TITLE PROJECT_NAME ":%s.%d"
+#define WINDOW_TITLE_XDMCP "%s:%s.%d"
#define WIN_SCR_PROP "cyg_screen_prop rl"
#define WINDOW_CLASS_X "cygwin/x X rl"
#define WINDOW_TITLE_X PROJECT_NAME " X"
@@ -60,6 +62,8 @@
#define CYGWINDOWING_DEBUG NO
#endif
+#define XMING_SIGNATURE 0x12345678L
+
typedef struct _winPrivScreenRec *winPrivScreenPtr;
@@ -111,9 +115,24 @@ typedef struct _winWMMessageRec{
#define WM_WM_NAME_EVENT (WM_USER + 9)
#define WM_WM_HINTS_EVENT (WM_USER + 10)
#define WM_WM_CHANGE_STATE (WM_USER + 11)
+#define WM_WM_MAP2 (WM_USER + 12)
#define WM_MANAGE (WM_USER + 100)
#define WM_UNMANAGE (WM_USER + 102)
+#define MwmHintsDecorations (1L << 1)
+
+#define MwmDecorAll (1l << 0)
+#define MwmDecorBorder (1l << 1)
+#define MwmDecorHandle (1l << 2)
+#define MwmDecorTitle (1l << 3)
+
+/* This structure only contains 3 elements... the Motif 2.0 structure
+contains 5... we only need the first 3... so that is all we will define */
+typedef struct MwmHints {
+ unsigned long flags, functions, decorations;
+} MwmHints;
+#define PropMwmHintsElements 3
+
void
winSendMessageToWM (void *pWMInfo, winWMMessagePtr msg);
diff --git a/xorg-server/hw/xwin/winwindowswm.c b/xorg-server/hw/xwin/winwindowswm.c
index e1994de84..6a0b81232 100644
--- a/xorg-server/hw/xwin/winwindowswm.c
+++ b/xorg-server/hw/xwin/winwindowswm.c
@@ -42,7 +42,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "servermd.h"
#include "swaprep.h"
#define _WINDOWSWM_SERVER_
-#include "windowswmstr.h"
+#include <X11/extensions/windowswmstr.h>
static int WMErrorBase;
diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c
index 29ea81fc1..c553634f9 100644
--- a/xorg-server/hw/xwin/winwndproc.c
+++ b/xorg-server/hw/xwin/winwndproc.c
@@ -762,11 +762,11 @@ winWindowProc (HWND hwnd, UINT message,
g_fCursor = TRUE;
ShowCursor (TRUE);
}
-
+
/* Deliver absolute cursor position to X Server */
- miPointerAbsoluteCursor (GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset,
- GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset,
- g_c32LastInputEventTime = GetTickCount ());
+ winEnqueueMotion(GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset,
+ GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset);
+
return 0;
case WM_NCMOUSEMOVE:
@@ -927,10 +927,9 @@ winWindowProc (HWND hwnd, UINT message,
/* Map from screen (-X, -Y) to root (0, 0) */
point.x -= GetSystemMetrics (SM_XVIRTUALSCREEN);
point.y -= GetSystemMetrics (SM_YVIRTUALSCREEN);
-
+
/* Deliver absolute cursor position to X Server */
- miPointerAbsoluteCursor (point.x, point.y,
- g_c32LastInputEventTime = GetTickCount());
+ winEnqueueMotion(point.x , point.y);
/* Check if a button was released but we didn't see it */
GetCursorPos (&point);
diff --git a/xorg-server/hw/xwin/xlaunch/config.h b/xorg-server/hw/xwin/xlaunch/config.h
new file mode 100644
index 000000000..e2774e894
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/config.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ *
+ * Authors: Alexander Gottwald, Colin Harrison
+ */
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+#define UNICODE
+#define _UNICODE
+
+#define PROG_NUMBER 10
+#define HOST_NUMBER 10
+#define MAX_MESSAGE 256
+#define MAX_CAPTION 128
+
+#include <windows.h>
+#include <string>
+#include <vector>
+struct CConfig
+{
+ enum {MultiWindow, Fullscreen, Windowed, Nodecoration} window;
+ enum {NoClient, StartProgram, XDMCP} client;
+ enum {NoXClient, Local, PuTTY, OpenSSH} clientstart;
+ std::string display;
+ std::string protocol_path;
+ std::string program;
+ std::vector<std::string> progs;
+ bool compress;
+ bool local;
+ std::string protocol;
+ std::string host;
+ std::string user;
+ std::string password;
+ bool password_save;
+ bool password_start;
+ bool broadcast;
+ bool indirect;
+ std::string xdmcp_host;
+ std::vector<std::string> xhosts;
+ bool clipboard;
+ bool no_access_control;
+ std::string font_server;
+ std::string extra_params;
+ std::string extra_ssh;
+ CConfig() : window(MultiWindow), client(NoClient), clientstart(NoXClient), display(""),
+ protocol_path(""), program("xeyes"), progs(PROG_NUMBER), compress(false), host(""), user(""),
+ password(""), password_save(false), password_start(false), broadcast(false),
+ indirect(false), xdmcp_host(""), xhosts(HOST_NUMBER), clipboard(true), no_access_control(false),
+ font_server(), extra_params(), extra_ssh() {};
+ void Load(const char * filename);
+ void Save(const char * filename);
+};
+
+#endif
diff --git a/xorg-server/hw/xwin/xlaunch/main.cc b/xorg-server/hw/xwin/xlaunch/main.cc
index 2247d3aaf..e4be475ee 100644
--- a/xorg-server/hw/xwin/xlaunch/main.cc
+++ b/xorg-server/hw/xwin/xlaunch/main.cc
@@ -34,6 +34,10 @@
#include <X11/Xlib.h>
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#endif
+
/// @brief Send WM_ENDSESSION to all program windows.
/// This will shutdown the started xserver
BOOL CALLBACK KillWindowsProc(HWND hwnd, LPARAM lParam)
@@ -489,7 +493,7 @@ class CMyWizard : public CWizard
return NULL;
}
- /// @brief Do the actual start of Xming and clients
+ /// @brief Do the actual start of VCXsrv and clients
void StartUp()
{
std::string buffer;
@@ -500,12 +504,12 @@ class CMyWizard : public CWizard
std::string display = "localhost" + display_id + ":0";
#ifdef _DEBUG
- // Debug only: Switch to Xming installation directory
- SetCurrentDirectory("C:\\Programme\\Xming");
+ // Debug only: Switch to VCXsrv installation directory
+ SetCurrentDirectory("C:\\Programme\\vcxsrv");
#endif
- // Build Xming commandline
- buffer = "Xming " + display_id + " ";
+ // Build Xsrv commandline
+ buffer = "vcxsrv " + display_id + " ";
switch (config.window)
{
case CConfig::MultiWindow:
@@ -577,7 +581,7 @@ class CMyWizard : public CWizard
sic.cb = sizeof(sic);
ZeroMemory( &pic, sizeof(pic) );
- // Start Xming process.
+ // Start VCXsrv process.
#ifdef _DEBUG
printf("%s\n", buffer.c_str());
#endif
@@ -627,7 +631,7 @@ class CMyWizard : public CWizard
#ifdef _DEBUG
printf("killing process!\n");
#endif
- // Check if Xming is still running
+ // Check if Xsrv is still running
DWORD exitcode;
GetExitCodeProcess(pi.hProcess, &exitcode);
unsigned counter = 0;
@@ -636,7 +640,7 @@ class CMyWizard : public CWizard
if (++counter > 10)
TerminateProcess(pi.hProcess, (DWORD)-1);
else
- // Shutdown Xming (the soft way!)
+ // Shutdown Xsrv (the soft way!)
EnumThreadWindows(pi.dwThreadId, KillWindowsProc, 0);
Sleep(500);
GetExitCodeProcess(pi.hProcess, &exitcode);
diff --git a/xorg-server/hw/xwin/xlaunch/makefile b/xorg-server/hw/xwin/xlaunch/makefile
new file mode 100644
index 000000000..345357d92
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/makefile
@@ -0,0 +1,32 @@
+INCLUDELIBFILES = window\$(OBJDIR)\window.lib \
+ $(MHMAKECONF)\libx11\src\$(OBJDIR)\libx11.lib \
+ $(MHMAKECONF)\libxcb\src\$(OBJDIR)\libxcb.lib \
+ $(MHMAKECONF)\libxau\$(OBJDIR)\libxau.lib \
+ $(MHMAKECONF)\libx11\src\xlibi18n\$(OBJDIR)\libi18n.lib \
+ $(MHMAKECONF)\libx11\modules\lc\xlocale\$(OBJDIR)\libxlocale.lib \
+ $(MHMAKECONF)\libx11\modules\lc\utf8\$(OBJDIR)\libxlcUTF8Load.lib \
+ $(MHMAKECONF)\libx11\modules\lc\gen\$(OBJDIR)\liblcGenConvLoad.lib \
+ $(MHMAKECONF)\libx11\modules\lc\def\$(OBJDIR)\libxlcDef.lib \
+ $(MHMAKECONF)\libx11\src\xkb\$(OBJDIR)\libxkb.lib \
+ $(MHMAKECONF)\libx11\modules\im\ximcp\$(OBJDIR)\libximcp.lib \
+ $(MHMAKECONF)\libx11\modules\om\generic\$(OBJDIR)\libxomGeneric.lib
+
+CSRCS=config.cc main.cc
+
+WINAPP = xlaunch
+
+RESOURCES = resources.rc
+
+$(OBJDIR)\%.res : resources\%.rc
+ $(RC) $(RCFLAGS) $(RCDEFINES:%=-d "%") $(RCINCLUDES:%=-i "%") -Fo"$(relpath $@)" "$<"
+
+LIBDIRS=$(dir $(INCLUDELIBFILES))
+
+load_makefile $(LIBDIRS:%$(OBJDIR)\=%makefile MAKESERVER=$(MAKESERVER) DEBUG=$(DEBUG);)
+
+ifeq ($(DEBUG),1)
+LINKLIBS += $(MHMAKECONF)\pthreads\pthreadVC2d.lib
+else
+LINKLIBS += $(MHMAKECONF)\pthreads\pthreadVC2.lib
+endif
+
diff --git a/xorg-server/hw/xwin/xlaunch/window/makefile b/xorg-server/hw/xwin/xlaunch/window/makefile
new file mode 100644
index 000000000..18a33e728
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/window/makefile
@@ -0,0 +1,4 @@
+CSRCS=dialog.cc util.cc window.cc wizard.cc
+
+LIBRARY = window
+
diff --git a/xorg-server/hw/xwin/xlaunch/window/util.h b/xorg-server/hw/xwin/xlaunch/window/util.h
index cd21da657..2e8dab263 100644
--- a/xorg-server/hw/xwin/xlaunch/window/util.h
+++ b/xorg-server/hw/xwin/xlaunch/window/util.h
@@ -28,7 +28,7 @@
#include <windows.h>
#include <stdexcept>
-
+#include <string>
class win32_error : public std::runtime_error
{
diff --git a/xorg-server/hw/xwin/xlaunch/window/wizard.h b/xorg-server/hw/xwin/xlaunch/window/wizard.h
index a2361c51c..c576cc093 100644
--- a/xorg-server/hw/xwin/xlaunch/window/wizard.h
+++ b/xorg-server/hw/xwin/xlaunch/window/wizard.h
@@ -29,7 +29,6 @@
#include "dialog.h"
#include <vector>
-#define _WIN32_IE 0x0500
#include <prsht.h>
class CWizard : public CBaseDialog