diff options
author | marha <marha@users.sourceforge.net> | 2012-11-29 09:05:13 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-11-29 09:05:49 +0100 |
commit | 0831039c0d449a3b5874c12ee365a8d5d2be7b8c (patch) | |
tree | 4edb707b79145f619fefc18c2359659ca660612f /xorg-server/hw | |
parent | 6bc629065956c81d836bbdb12f5f580d8a3db8e5 (diff) | |
parent | d2d73da59e64acdc4718e4e6790a69d967bee875 (diff) | |
download | vcxsrv-0831039c0d449a3b5874c12ee365a8d5d2be7b8c.tar.gz vcxsrv-0831039c0d449a3b5874c12ee365a8d5d2be7b8c.tar.bz2 vcxsrv-0831039c0d449a3b5874c12ee365a8d5d2be7b8c.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
fontconfig xserver mesa git update 29 nov 2012
Conflicts:
xorg-server/dix/dispatch.c
xorg-server/hw/xwin/InitOutput.c
xorg-server/hw/xwin/ddraw.h
xorg-server/hw/xwin/glx/indirect.c
xorg-server/hw/xwin/winclipboardthread.c
xorg-server/hw/xwin/winclipboardxevents.c
xorg-server/hw/xwin/winengine.c
xorg-server/hw/xwin/winerror.c
xorg-server/hw/xwin/winglobals.c
xorg-server/hw/xwin/winkeybd.c
xorg-server/hw/xwin/winmultiwindowwm.c
xorg-server/hw/xwin/winmultiwindowwndproc.c
xorg-server/hw/xwin/winprocarg.c
xorg-server/hw/xwin/winwin32rootless.c
xorg-server/hw/xwin/winwindow.h
xorg-server/os/osinit.c
xorg-server/os/utils.c
Diffstat (limited to 'xorg-server/hw')
35 files changed, 573 insertions, 160 deletions
diff --git a/xorg-server/hw/dmx/dmx.h b/xorg-server/hw/dmx/dmx.h index d7c620467..f0cb04459 100644 --- a/xorg-server/hw/dmx/dmx.h +++ b/xorg-server/hw/dmx/dmx.h @@ -407,4 +407,6 @@ extern DevPrivateKeyRec dmxGlyphSetPrivateKeyRec; #define dmxGlyphSetPrivateKey (&dmxGlyphSetPrivateKeyRec) /**< Private index for GlyphSets */ +void DMXExtensionInit(void); + #endif /* DMX_H */ diff --git a/xorg-server/hw/dmx/dmxinit.c b/xorg-server/hw/dmx/dmxinit.c index 5e3f1103c..94dbdd230 100644 --- a/xorg-server/hw/dmx/dmxinit.c +++ b/xorg-server/hw/dmx/dmxinit.c @@ -68,10 +68,13 @@ #include <GL/glx.h> #include <GL/glxint.h> #include "dmx_glxvisuals.h" +#include "glx_extinit.h" #include <X11/extensions/Xext.h> #include <X11/extensions/extutil.h> #endif /* GLXEXT */ +#include <X11/extensions/dmxproto.h> + /* Global variables available to all Xserver/hw/dmx routines. */ int dmxNumScreens; DMXScreenInfo *dmxScreens; @@ -586,6 +589,20 @@ dmxExecHost(void) return buffer; } +static void dmxAddExtensions(Bool glxSupported) +{ + const ExtensionModule dmxExtensions[] = { + { DMXExtensionInit, DMX_EXTENSION_NAME, NULL }, +#ifdef GLXEXT + { GlxExtensionInit, "GLX", &glxSupported }, +#endif + }; + int i; + + for (i = 0; i < ARRAY_SIZE(dmxExtensions); i++) + LoadExtension(&dmxExtensions[i], TRUE); +} + /** This routine is called in Xserver/dix/main.c from \a main(). */ void InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[]) @@ -594,7 +611,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[]) static unsigned long dmxGeneration = 0; #ifdef GLXEXT - Bool glxSupported = TRUE; + static Bool glxSupported = TRUE; #endif if (dmxGeneration != serverGeneration) { @@ -725,6 +742,9 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[]) glxSupported &= (dmxScreens[i].glxMajorOpcode > 0); #endif + if (serverGeneration == 1) + dmxAddExtensions(glxSupported); + /* Tell dix layer about the backend displays */ for (i = 0; i < dmxNumScreens; i++) { diff --git a/xorg-server/hw/kdrive/ephyr/hostx.c b/xorg-server/hw/kdrive/ephyr/hostx.c index b13e8c796..be5ac6bd5 100644 --- a/xorg-server/hw/kdrive/ephyr/hostx.c +++ b/xorg-server/hw/kdrive/ephyr/hostx.c @@ -908,7 +908,9 @@ host_screen_from_window(Window w) struct EphyrHostScreen *result = NULL; for (index = 0; index < HostX.n_screens; index++) { - if (HostX.screens[index].win == w || HostX.screens[index].peer_win == w) { + if (HostX.screens[index].win == w + || HostX.screens[index].peer_win == w + || HostX.screens[index].win_pre_existing == w) { result = &HostX.screens[index]; goto out; } diff --git a/xorg-server/hw/vfb/InitOutput.c b/xorg-server/hw/vfb/InitOutput.c index 07ea8ea93..97eccfd4e 100644 --- a/xorg-server/hw/vfb/InitOutput.c +++ b/xorg-server/hw/vfb/InitOutput.c @@ -65,6 +65,7 @@ from The Open Group. #endif /* HAS_SHM */ #include "dix.h" #include "miline.h" +#include "glx_extinit.h" #define VFB_DEFAULT_WIDTH 1280 #define VFB_DEFAULT_HEIGHT 1024 @@ -884,12 +885,30 @@ vfbScreenInit(ScreenPtr pScreen, int argc, char **argv) } /* end vfbScreenInit */ +static const ExtensionModule vfbExtensions[] = { +#ifdef GLXEXT + { GlxExtensionInit, "GLX", &noGlxExtension }, +#endif +}; + +static +void vfbExtensionInit(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(vfbExtensions); i++) + LoadExtension(&vfbExtensions[i], TRUE); +} + void InitOutput(ScreenInfo * screenInfo, int argc, char **argv) { int i; int NumFormats = 0; + if (serverGeneration == 1) + vfbExtensionInit(); + /* initialize pixmap formats */ /* must have a pixmap depth to match every screen depth */ diff --git a/xorg-server/hw/xfree86/common/xf86Extensions.c b/xorg-server/hw/xfree86/common/xf86Extensions.c index d5309d558..f9e791607 100644 --- a/xorg-server/hw/xfree86/common/xf86Extensions.c +++ b/xorg-server/hw/xfree86/common/xf86Extensions.c @@ -53,7 +53,7 @@ /* * DDX-specific extensions. */ -static ExtensionModule extensionModules[] = { +static const ExtensionModule extensionModules[] = { #ifdef XF86VIDMODE { XFree86VidModeExtensionInit, diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.c b/xorg-server/hw/xfree86/common/xf86platformBus.c index 0525e39bc..599d84ac2 100644 --- a/xorg-server/hw/xfree86/common/xf86platformBus.c +++ b/xorg-server/hw/xfree86/common/xf86platformBus.c @@ -377,6 +377,14 @@ xf86platformProbeDev(DriverPtr drvp) continue; } + /* + * If all of the above fails, which can happen if X was started without + * configuration or if BusID wasn't set for non-PCI devices, use the first + * device by default. + */ + if (!foundScreen && xf86_num_platform_devices > 0 && numDevs > 0) + foundScreen = probeSingleDevice(&xf86_platform_devices[0], drvp, devList[0], 0); + /* if autoaddgpu devices is enabled then go find a few more and add them as GPU screens */ if (xf86Info.autoAddGPU && numDevs) { for (j = 0; j < xf86_num_platform_devices; j++) { diff --git a/xorg-server/hw/xfree86/dixmods/glxmodule.c b/xorg-server/hw/xfree86/dixmods/glxmodule.c index c0c611401..e6bb73673 100644 --- a/xorg-server/hw/xfree86/dixmods/glxmodule.c +++ b/xorg-server/hw/xfree86/dixmods/glxmodule.c @@ -47,7 +47,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. static MODULESETUPPROTO(glxSetup); -static ExtensionModule GLXExt = { +static const ExtensionModule GLXExt = { GlxExtensionInit, "GLX", &noGlxExtension diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c index 177f7ac11..13251cff4 100644 --- a/xorg-server/hw/xfree86/modes/xf86Crtc.c +++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c @@ -1847,6 +1847,10 @@ SetCompatOutput(xf86CrtcConfigPtr config) output = config->output[config->compat_output]; } + /* All outputs are disconnected, select one to fake */ + if (!output && config->num_output) + output = config->output[0]; + return output; } diff --git a/xorg-server/hw/xquartz/quartz.c b/xorg-server/hw/xquartz/quartz.c index 31b0e619a..5b977c7f9 100644 --- a/xorg-server/hw/xquartz/quartz.c +++ b/xorg-server/hw/xquartz/quartz.c @@ -145,7 +145,7 @@ QuartzSetupScreen(int index, return TRUE; } -static ExtensionModule quartzExtensions[] = { +static const ExtensionModule quartzExtensions[] = { /* PseudoramiX needs to be done before RandR, so * it is in miinitext.c until it can be reordered. * { PseudoramiXExtensionInit, "PseudoramiX", &noPseudoramiXExtension }, diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c index eb6165e38..0c638df1d 100644..100755 --- a/xorg-server/hw/xwin/InitOutput.c +++ b/xorg-server/hw/xwin/InitOutput.c @@ -199,8 +199,8 @@ ddxGiveUp(enum ExitCode error) } #ifdef XWIN_MULTIWINDOW - /* Unload libraries for taskbar grouping */ - winTaskbarDestroy (); + /* Unload libraries for taskbar grouping */ + winPropertyStoreDestroy(); /* Notify the worker threads we're exiting */ winDeinitMultiWindowWM(); @@ -830,7 +830,7 @@ winUseMsg(void) ErrorF("-resize=none|scrollbars|randr" "\tIn windowed mode, [don't] allow resizing of the window. 'scrollbars'\n" "\tmode gives the window scrollbars as needed, 'randr' mode uses the RANR\n" - "\textension to resize the X screen. 'randr' is the default.\n"); + "\textension to resize the X screen. 'randr' is the default.\n"); ErrorF("-rootless\n" "\tRun the server in rootless mode.\n"); @@ -862,10 +862,10 @@ winUseMsg(void) ErrorF("-[no]unixkill\n" "\tCtrl+Alt+Backspace exits the X Server.\n"); ErrorF("-[no]wgl\n" - "\tEnable the GLX extension to use the native Windows WGL interface for accelerated OpenGL\n"); + "\tEnable the GLX extension to use the native Windows WGL interface for hardware-accelerated OpenGL\n"); - ErrorF ("-swrastwgl\n" - "\tEnable the GLX extension to use the native Windows WGL interface based on the swrast interface for accelerated OpenGL\n"); + ErrorF("-swrastwgl\n" + "\tEnable the GLX extension to use the native Windows WGL interface based on the swrast interface for accelerated OpenGL\n"); ErrorF("-[no]winkill\n" "\tAlt+F4 exits the X Server.\n"); @@ -970,6 +970,10 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[]) /* Detect supported engines */ winDetectSupportedEngines(); +#ifdef XWIN_MULTIWINDOW + /* Load libraries for taskbar grouping */ + winPropertyStoreInit(); +#endif #ifdef XWIN_MULTIWINDOW /* Load libraries for taskbar grouping */ diff --git a/xorg-server/hw/xwin/Makefile.am b/xorg-server/hw/xwin/Makefile.am index af5bb9961..1a8006456 100644 --- a/xorg-server/hw/xwin/Makefile.am +++ b/xorg-server/hw/xwin/Makefile.am @@ -23,8 +23,11 @@ SRCS_MULTIWINDOW = \ winmultiwindowshape.c \ winmultiwindowwindow.c \ winmultiwindowwm.c \ - winmultiwindowwndproc.c + winmultiwindowwndproc.c \ + propertystore.h \ + winSetAppUserModelID.c DEFS_MULTIWINDOW = -DXWIN_MULTIWINDOW +MULTIWINDOW_LIBS = -lshlwapi -lole32 endif if XWIN_MULTIWINDOWEXTWM @@ -99,6 +102,7 @@ SRCS = InitInput.c \ winshaddd.c \ winshadddnl.c \ winshadgdi.c \ + wintaskbar.c \ wintrayicon.c \ winvalargs.c \ winwakeup.c \ @@ -151,7 +155,7 @@ INCLUDES = -I$(top_srcdir)/miext/rootless XWIN_SYS_LIBS += -ldxguid XWin_DEPENDENCIES = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) -XWin_LDADD = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS) +XWin_LDADD = $(MULTIWINDOW_LIBS) $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS) XWin_LDFLAGS = -mwindows -static .rc.o: diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c index f4eb595bb..10da5b515 100644..100755 --- a/xorg-server/hw/xwin/glx/indirect.c +++ b/xorg-server/hw/xwin/glx/indirect.c @@ -91,9 +91,7 @@ #include <wgl_ext_api.h> #include "win.h" #include <winmsg.h> - -extern Bool g_fXdmcpEnabled; -extern Bool g_fNativeGl; +#include <winglobals.h> #define NUM_ELEMENTS(x) (sizeof(x)/ sizeof(x[1])) @@ -378,6 +376,10 @@ swap_method_name(int mthd) static void fbConfigsDump(unsigned int n, __GLXconfig * c) { + LogMessage(X_INFO, "%d fbConfigs\n", n); + + if (g_iLogVerbose < 3) + return; ErrorF("%d fbConfigs\n", n); ErrorF ("pxf vis fb render Ste aux accum MS drawable Group/\n"); @@ -650,11 +652,14 @@ glxWinScreenProbe(ScreenPtr pScreen) gl_renderer = (const char *) glGetStringWrapperNonstatic(GL_RENDERER); winDebug("GL_RENDERER: %s\n", gl_renderer); gl_extensions = (const char *) glGetStringWrapperNonstatic(GL_EXTENSIONS); - glxLogExtensions("GL_EXTENSIONS: ", gl_extensions); wgl_extensions = wglGetExtensionsStringARBWrapper(hdc); if (!wgl_extensions) wgl_extensions = ""; - glxLogExtensions("WGL_EXTENSIONS: ", wgl_extensions); + + if (g_iLogVerbose >= 3) { + glxLogExtensions("GL_EXTENSIONS: ", gl_extensions); + glxLogExtensions("WGL_EXTENSIONS: ", wgl_extensions); + } if (strcasecmp(gl_renderer, "GDI Generic") == 0) { free(screen); @@ -2019,8 +2024,8 @@ glxWinCreateConfigs(HDC hdc, glxWinScreen * screen) // get the number of pixelformats numConfigs = DescribePixelFormat(hdc, 1, sizeof(PIXELFORMATDESCRIPTOR), NULL); - GLWIN_DEBUG_MSG("DescribePixelFormat says %d possible pixel formats", - numConfigs); + LogMessage(X_INFO, "%d pixel formats reported by DescribePixelFormat\n", + numConfigs); /* alloc */ result = malloc(sizeof(GLXWinConfig) * numConfigs); @@ -2269,9 +2274,9 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen) return; } - GLWIN_DEBUG_MSG - ("wglGetPixelFormatAttribivARB says %d possible pixel formats", - numConfigs); + LogMessage(X_INFO, + "%d pixel formats reported by wglGetPixelFormatAttribivARB\n", + numConfigs); /* alloc */ result = malloc(sizeof(GLXWinConfig) * numConfigs); diff --git a/xorg-server/hw/xwin/makefile b/xorg-server/hw/xwin/makefile index 82585a025..6ed7d7f54 100644 --- a/xorg-server/hw/xwin/makefile +++ b/xorg-server/hw/xwin/makefile @@ -32,7 +32,8 @@ SRCS_MULTIWINDOW = \ winmultiwindowshape.c \ winmultiwindowwindow.c \ winmultiwindowwm.c \ - winmultiwindowwndproc.c + winmultiwindowwndproc.c \ + winSetAppUserModelID.c DEFS_MULTIWINDOW = -DXWIN_MULTIWINDOW endif @@ -108,6 +109,7 @@ SRCS = InitInput.c \ winshaddd.c \ winshadddnl.c \ winshadgdi.c \ + wintaskbar.c \ wintrayicon.c \ winvalargs.c \ winwakeup.c \ diff --git a/xorg-server/hw/xwin/man/XWin.man b/xorg-server/hw/xwin/man/XWin.man index dbadad6f5..18ee667d4 100644 --- a/xorg-server/hw/xwin/man/XWin.man +++ b/xorg-server/hw/xwin/man/XWin.man @@ -121,14 +121,16 @@ Alternative name for \fB\-resize=scrollbars\fP. .SH OPTIONS CONTROLLING RESIZE BEHAVIOUR .TP 8 .B \-resize[=none|scrollbars|randr] -Select the resize mode of an X screen. +Select the resize mode of an X screen. The default is randr. .RS .IP \fB\-resize=none\fP 8 -(default). The screen is not resizable. +The screen is not resizable. In windowed mode, if the window has decorations, a fixed frame is used. +Alternative name is \fB\-noresize\fP. + .IP \fB\-resize=scrollbars\fP 8 The screen window is resizeable, but the screen is not resizable. @@ -159,8 +161,8 @@ of the X screen using the RANDR extension is not permitted. The maximum dimensions of the screen are the dimensions of the \fIWindows\fP virtual desktop. -.IP \fB\--resize\fP 8 -on its own is equivalent to \fB\--resize=randr\fP +.IP \fB\-resize\fP 8 +on its own is equivalent to \fB\-resize=randr\fP .RE .SH OPTIONS CONTROLLING WINDOWS INTEGRATION @@ -211,7 +213,7 @@ is disabled by default. .TP 8 .B \-[no]wgl Enable [disable] the GLX extension to use the native Windows WGL interface -for hardware accelerated OpenGL (AIGLX). (Experimental) +for hardware accelerated OpenGL (AIGLX). The default is enabled. .TP 8 .B \-[no]winkill Enable or disable the \fIAlt-F4\fP key combination as a signal to exit the diff --git a/xorg-server/hw/xwin/propertystore.h b/xorg-server/hw/xwin/propertystore.h new file mode 100644 index 000000000..6afc6c954 --- /dev/null +++ b/xorg-server/hw/xwin/propertystore.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2011 Tobias Häußler + * + * 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 (including the next + * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +#ifndef PROPERTYSTORE_H +#define PROPERTYSTORE_H + +#include <windows.h> + +#ifdef __MINGW64_VERSION_MAJOR +/* If we are using headers from mingw-w64 project, it provides the PSDK headers this needs ... */ +#include <propkey.h> +#include <propsys.h> +#else /* !__MINGW64_VERSION_MAJOR */ +/* ... otherwise, we need to define all this stuff ourselves */ + +typedef struct _tagpropertykey { + GUID fmtid; + DWORD pid; +} PROPERTYKEY; + +#define REFPROPERTYKEY const PROPERTYKEY * +#define REFPROPVARIANT const PROPVARIANT * + +WINOLEAPI PropVariantClear(PROPVARIANT *pvar); + +#ifdef INTERFACE +#undef INTERFACE +#endif + +#define INTERFACE IPropertyStore +DECLARE_INTERFACE_(IPropertyStore, IUnknown) +{ + STDMETHOD(QueryInterface) (THIS_ REFIID, PVOID *) PURE; + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + STDMETHOD_(ULONG, Release) (THIS) PURE; + STDMETHOD(GetCount) (THIS_ DWORD) PURE; + STDMETHOD(GetAt) (THIS_ DWORD, PROPERTYKEY) PURE; + STDMETHOD(GetValue) (THIS_ REFPROPERTYKEY, PROPVARIANT) PURE; + STDMETHOD(SetValue) (THIS_ REFPROPERTYKEY, REFPROPVARIANT) PURE; + STDMETHOD(Commit) (THIS) PURE; +}; + +#undef INTERFACE +typedef IPropertyStore *LPPROPERTYSTORE; + +DEFINE_GUID(IID_IPropertyStore, 0x886d8eeb, 0x8cf2, 0x4446, 0x8d, 0x02, 0xcd, + 0xba, 0x1d, 0xbd, 0xcf, 0x99); + +#ifdef INITGUID +#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) GUID_EXT const PROPERTYKEY DECLSPEC_SELECTANY name = { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }, pid } +#else +#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) GUID_EXT const PROPERTYKEY name +#endif + +DEFINE_PROPERTYKEY(PKEY_AppUserModel_ID, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, + 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, 5); + +#endif /* !__MINGW64_VERSION_MAJOR */ + +typedef HRESULT(__stdcall * SHGETPROPERTYSTOREFORWINDOWPROC) (HWND, REFIID, + void **); + +#endif diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h index 9c474cba3..875605241 100644 --- a/xorg-server/hw/xwin/win.h +++ b/xorg-server/hw/xwin/win.h @@ -128,6 +128,8 @@ #define WIN_MAX_KEYS_PER_KEY 4 +#define NONAMELESSUNION + #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> @@ -209,9 +211,6 @@ if (++PROFPT##point % thresh == 0)\ ErrorF (#point ": PROFILEPOINT hit %u times\n", PROFPT##point);\ } -/* We use xor this macro for detecting toggle key state changes */ -#define WIN_XOR(a,b) ((!(a) && (b)) || ((a) && !(b))) - #define DEFINE_ATOM_HELPER(func,atom_name) \ static Atom func (void) { \ static int generation; \ diff --git a/xorg-server/hw/xwin/winSetAppUserModelID.c b/xorg-server/hw/xwin/winSetAppUserModelID.c new file mode 100644 index 000000000..ce9da5e7d --- /dev/null +++ b/xorg-server/hw/xwin/winSetAppUserModelID.c @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2011 Tobias Häußler + * + * 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 (including the next + * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +#ifdef HAVE_XWIN_CONFIG_H +#include <xwin-config.h> +#endif + +#include <X11/Xlib.h> +#include <X11/Xproto.h> +#include <X11/Xwindows.h> +#include "winwindow.h" +#include "os.h" +#include "winmsg.h" + +#include <shlwapi.h> + +#define INITGUID +#include "initguid.h" +#include "propertystore.h" +#undef INITGUID + +static HMODULE g_hmodShell32Dll = NULL; +static SHGETPROPERTYSTOREFORWINDOWPROC g_pSHGetPropertyStoreForWindow = NULL; + +void +winPropertyStoreInit(void) +{ + /* + Load library and get function pointer to SHGetPropertyStoreForWindow() + + SHGetPropertyStoreForWindow is only supported since Windows 7. On previous + versions the pointer will be NULL and taskbar grouping is not supported. + winSetAppUserModelID() will do nothing in this case. + */ + g_hmodShell32Dll = LoadLibrary("shell32.dll"); + if (g_hmodShell32Dll == NULL) { + ErrorF("winPropertyStoreInit - Could not load shell32.dll\n"); + return; + } + + g_pSHGetPropertyStoreForWindow = + (SHGETPROPERTYSTOREFORWINDOWPROC) GetProcAddress(g_hmodShell32Dll, + "SHGetPropertyStoreForWindow"); + if (g_pSHGetPropertyStoreForWindow == NULL) { + ErrorF + ("winPropertyStoreInit - Could not get SHGetPropertyStoreForWindow address\n"); + return; + } +} + +void +winPropertyStoreDestroy(void) +{ + if (g_hmodShell32Dll != NULL) { + FreeLibrary(g_hmodShell32Dll); + g_hmodShell32Dll = NULL; + g_pSHGetPropertyStoreForWindow = NULL; + } +} + +void +winSetAppUserModelID(HWND hWnd, const char *AppID) +{ + PROPVARIANT pv; + IPropertyStore *pps = NULL; + HRESULT hr; + + if (g_pSHGetPropertyStoreForWindow == NULL) { + return; + } + + winDebug("winSetAppUserMOdelID - hwnd 0x%08x appid '%s'\n", hWnd, AppID); + + hr = g_pSHGetPropertyStoreForWindow(hWnd, &IID_IPropertyStore, + (void **) &pps); + if (SUCCEEDED(hr) && pps) { + memset(&pv, 0, sizeof(PROPVARIANT)); + if (AppID) { + pv.vt = VT_LPWSTR; + hr = SHStrDupA(AppID, &pv.pwszVal); + } + + if (SUCCEEDED(hr)) { + pps->lpVtbl->SetValue(pps, &PKEY_AppUserModel_ID, &pv); + PropVariantClear(&pv); + } + pps->lpVtbl->Release(pps); + } +} diff --git a/xorg-server/hw/xwin/winblock.c b/xorg-server/hw/xwin/winblock.c index 480e3bd48..a4ae8669f 100644 --- a/xorg-server/hw/xwin/winblock.c +++ b/xorg-server/hw/xwin/winblock.c @@ -86,4 +86,13 @@ winBlockHandler(ScreenPtr pScreen, DispatchMessage(&msg); } } + + /* + At least one X client has asked to suspend the screensaver, so + reset Windows' display idle timer + */ +#ifdef SCREENSAVER + if (screenSaverSuspended) + SetThreadExecutionState(ES_DISPLAY_REQUIRED); +#endif } diff --git a/xorg-server/hw/xwin/winclipboardthread.c b/xorg-server/hw/xwin/winclipboardthread.c index c0069e329..5a6328c8f 100644..100755 --- a/xorg-server/hw/xwin/winclipboardthread.c +++ b/xorg-server/hw/xwin/winclipboardthread.c @@ -36,6 +36,7 @@ #define HAS_WINSOCK 1 #endif #include <sys/types.h> +#include <signal.h> #include "winclipboard.h" #ifdef __CYGWIN__ #include <errno.h> diff --git a/xorg-server/hw/xwin/winclipboardxevents.c b/xorg-server/hw/xwin/winclipboardxevents.c index 7473e6de1..4bb6c12fa 100644..100755 --- a/xorg-server/hw/xwin/winclipboardxevents.c +++ b/xorg-server/hw/xwin/winclipboardxevents.c @@ -175,6 +175,24 @@ winClipboardFlushXEvents(HWND hwnd, break; } + /* Access the clipboard */ + if (!ClipboardOpened) + { + if (!OpenClipboard (hwnd)) + { + ErrorF ("winClipboardFlushXEvents - SelectionRequest - " + "OpenClipboard () failed: %08lx\n", + GetLastError ()); + + /* Abort */ + fAbort = TRUE; + goto winClipboardFlushXEvents_SelectionRequest_Done; + } + + /* Indicate that clipboard was opened */ + fCloseClipboard = TRUE; + } + /* Check that clipboard format is available */ if (fUseUnicode && !IsClipboardFormatAvailable(CF_UNICODETEXT)) { static int count; /* Hack to stop acroread spamming the log */ @@ -202,23 +220,6 @@ winClipboardFlushXEvents(HWND hwnd, goto winClipboardFlushXEvents_SelectionRequest_Done; } - /* Access the clipboard */ - if (!ClipboardOpened) - { - if (!OpenClipboard (hwnd)) - { - ErrorF ("winClipboardFlushXEvents - SelectionRequest - " - "OpenClipboard () failed: %08lx\n", - GetLastError ()); - - /* Abort */ - fAbort = TRUE; - goto winClipboardFlushXEvents_SelectionRequest_Done; - } - - /* Indicate that clipboard was opened */ - fCloseClipboard = TRUE; - } /* Setup the string style */ if (event.xselectionrequest.target == XA_STRING) xiccesStyle = XStringStyle; diff --git a/xorg-server/hw/xwin/winengine.c b/xorg-server/hw/xwin/winengine.c index b118864bb..cf8a526a5 100644..100755 --- a/xorg-server/hw/xwin/winengine.c +++ b/xorg-server/hw/xwin/winengine.c @@ -92,7 +92,7 @@ winDetectSupportedEngines(void) else { /* We have DirectDraw */ winDebug ( - "winDetectSupportedEngines - DirectDraw installed\n"); + "winDetectSupportedEngines - DirectDraw installed, allowing ShadowDD\n"); g_dwEnginesSupported |= WIN_SERVER_SHADOW_DD; #ifdef XWIN_PRIMARYFB @@ -100,7 +100,7 @@ winDetectSupportedEngines(void) if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) { g_dwEnginesSupported |= WIN_SERVER_PRIMARY_DD; winDebug ( - "winDetectSupportedEngines - Allowing PrimaryDD\n"); + "winDetectSupportedEngines - Windows NT, allowing PrimaryDD\n"); } #endif } @@ -112,7 +112,7 @@ winDetectSupportedEngines(void) if (SUCCEEDED(ddrval)) { /* We have DirectDraw4 */ winDebug ( - "winDetectSupportedEngines - DirectDraw4 installed\n"); + "winDetectSupportedEngines - DirectDraw4 installed, allowing ShadowDDNL\n"); g_dwEnginesSupported |= WIN_SERVER_SHADOW_DDNL; } diff --git a/xorg-server/hw/xwin/winerror.c b/xorg-server/hw/xwin/winerror.c index ed9ee296e..859a66834 100644..100755 --- a/xorg-server/hw/xwin/winerror.c +++ b/xorg-server/hw/xwin/winerror.c @@ -78,9 +78,8 @@ OsVendorVErrorF(const char *pszFormat, va_list va_args) #endif /* - * os/util.c/FatalError () calls our vendor ErrorF, so the message - * from a FatalError will be logged. Thus, the message for the - * fatal error is not passed to this function. + * os/log.c:FatalError () calls our vendor ErrorF, so the message + * from a FatalError will be logged. * * Attempt to do last-ditch, safe, important cleanup here. */ @@ -98,11 +97,25 @@ OsVendorFatalError(const char *f, va_list args) } LogClose(EXIT_ERR_ABORT); - winMessageBoxF ( - "Error: %s\n\n"\ - PROJECT_NAME " will now exit.\n\n" \ - "Please open %s for more information.\n", - MB_ICONERROR, g_FatalErrorMessage, (g_pszLogFile?g_pszLogFile:"the logfile")); + /* + Sometimes the error message needs a bit of cosmetic cleaning + up for use in a dialog box... + */ + { + char *s; + + while ((s = strstr(g_FatalErrorMessage, "\n\t")) != NULL) { + s[0] = ' '; + s[1] = '\n'; + } + } + + winMessageBoxF("A fatal error has occurred and " PROJECT_NAME " will now exit.\n\n" + "%s\n\n" + "Please open %s for more information.\n", + MB_ICONERROR, + g_FatalErrorMessage, + (g_pszLogFile ? g_pszLogFile : "the logfile")); } /* diff --git a/xorg-server/hw/xwin/winglobals.c b/xorg-server/hw/xwin/winglobals.c index c1f30dad4..58dec7833 100644..100755 --- a/xorg-server/hw/xwin/winglobals.c +++ b/xorg-server/hw/xwin/winglobals.c @@ -77,7 +77,7 @@ Bool g_fKeyboardHookLL = FALSE; Bool g_fNoHelpMessageBox = FALSE; Bool g_fSoftwareCursor = FALSE; Bool g_fSilentDupError = FALSE; -Bool g_fNativeGl = FALSE; +Bool g_fNativeGl = TRUE; Bool g_fswrastwgl = FALSE; #ifdef XWIN_CLIPBOARD diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c index 5da959cae..8e035956d 100644..100755 --- a/xorg-server/hw/xwin/winkeybd.c +++ b/xorg-server/hw/xwin/winkeybd.c @@ -41,6 +41,9 @@ #include "xkbsrv.h" +/* C does not have a logical XOR operator, so we use a macro instead */ +#define LOGICAL_XOR(a,b) ((!(a) && (b)) || ((a) && !(b))) + static Bool g_winKeyState[NUM_KEYCODES]; /* @@ -258,74 +261,69 @@ winRestoreModeKeyStates(void) XkbStateFieldFromRec(&inputInfo.keyboard->key->xkbInfo->state); winDebug("winRestoreModeKeyStates: state %d\n", internalKeyStates); - { - /* Make sure the message queue is empty, otherwise the GetKeyState will not always - return the correct state of the numlock key, capslock key, ... - This is mainly because this function is called from the WM_SETFOCUS handler. - From MSDN GetKeyState: The key status returned from this function changes as a thread - reads key messages from its message queue.*/ - MSG msg; - - /* Process all messages on our queue */ - while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) { - DispatchMessage (&msg); + /* Make sure the message queue is empty, otherwise the GetKeyState will not always + return the correct state of the numlock key, capslock key, ... + This is mainly because this function is called from the WM_SETFOCUS handler. + From MSDN GetKeyState: The key status returned from this function changes as a thread + reads key messages from its message queue.*/ + MSG msg; + + /* Process all messages on our queue */ + while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) + { + DispatchMessage (&msg); + } } - } - - /* - * NOTE: The C XOR operator, ^, will not work here because it is - * a bitwise operator, not a logical operator. C does not - * have a logical XOR operator, so we use a macro instead. - */ - { - /* consider modifer keys */ - - BOOL ctrl = (GetAsyncKeyState (VK_CONTROL) < 0); - BOOL shift = (GetAsyncKeyState (VK_SHIFT) < 0); - BOOL alt = (GetAsyncKeyState (VK_LMENU) < 0); - BOOL altgr = (GetAsyncKeyState (VK_RMENU) < 0); + /* Check if modifier keys are pressed, and if so, fake a press */ + { + BOOL ctrl = (GetAsyncKeyState(VK_CONTROL) < 0); + BOOL shift = (GetAsyncKeyState(VK_SHIFT) < 0); + BOOL alt = (GetAsyncKeyState(VK_LMENU) < 0); + BOOL altgr = (GetAsyncKeyState(VK_RMENU) < 0); - if (ctrl && altgr) ctrl = FALSE; + if (ctrl && altgr) + ctrl = FALSE; - if (WIN_XOR (internalKeyStates & ControlMask, ctrl)) - winSendKeyEvent (KEY_LCtrl, ctrl); + if (LOGICAL_XOR(internalKeyStates & ControlMask, ctrl)) + winSendKeyEvent(KEY_LCtrl, ctrl); - if (WIN_XOR (internalKeyStates & ShiftMask, shift)) - winSendKeyEvent (KEY_ShiftL, shift); + if (LOGICAL_XOR(internalKeyStates & ShiftMask, shift)) + winSendKeyEvent(KEY_ShiftL, shift); - if (WIN_XOR (internalKeyStates & Mod1Mask, alt)) - winSendKeyEvent (KEY_Alt, alt); + if (LOGICAL_XOR(internalKeyStates & Mod1Mask, alt)) + winSendKeyEvent(KEY_Alt, alt); - if (WIN_XOR (internalKeyStates & Mod5Mask, altgr)) - winSendKeyEvent (KEY_AltLang, altgr); - } + if (LOGICAL_XOR(internalKeyStates & Mod5Mask, altgr)) + winSendKeyEvent(KEY_AltLang, altgr); + } - /* Has the key state changed? */ + /* + Check if latching modifier key states have changed, and if so, + fake a press and a release to toggle the modifier to the correct + state + */ dwKeyState = GetKeyState(VK_NUMLOCK) & 0x0001; - if (WIN_XOR(internalKeyStates & NumLockMask, dwKeyState)) { + if (LOGICAL_XOR(internalKeyStates & NumLockMask, dwKeyState)) { winSendKeyEvent(KEY_NumLock, TRUE); winSendKeyEvent(KEY_NumLock, FALSE); } - /* Has the key state changed? */ dwKeyState = GetKeyState(VK_CAPITAL) & 0x0001; - if (WIN_XOR(internalKeyStates & LockMask, dwKeyState)) { + if (LOGICAL_XOR(internalKeyStates & LockMask, dwKeyState)) { winSendKeyEvent(KEY_CapsLock, TRUE); winSendKeyEvent(KEY_CapsLock, FALSE); } - /* Has the key state changed? */ dwKeyState = GetKeyState(VK_SCROLL) & 0x0001; - if (WIN_XOR(internalKeyStates & ScrollLockMask, dwKeyState)) { + if (LOGICAL_XOR(internalKeyStates & ScrollLockMask, dwKeyState)) { winSendKeyEvent(KEY_ScrollLock, TRUE); winSendKeyEvent(KEY_ScrollLock, FALSE); } - /* Has the key state changed? */ dwKeyState = GetKeyState(VK_KANA) & 0x0001; - if (WIN_XOR(internalKeyStates & KanaMask, dwKeyState)) { + if (LOGICAL_XOR(internalKeyStates & KanaMask, dwKeyState)) { winSendKeyEvent(KEY_HKTG, TRUE); winSendKeyEvent(KEY_HKTG, FALSE); } diff --git a/xorg-server/hw/xwin/winms.h b/xorg-server/hw/xwin/winms.h index 5282fc982..32923e503 100644 --- a/xorg-server/hw/xwin/winms.h +++ b/xorg-server/hw/xwin/winms.h @@ -30,7 +30,6 @@ * Authors: Harold L Hunt II */ -#define NONAMELESSUNION #define DIRECTDRAW_VERSION 0x0300 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c index 961f2fd8d..424da2bfa 100644..100755 --- a/xorg-server/hw/xwin/winmultiwindowwm.c +++ b/xorg-server/hw/xwin/winmultiwindowwm.c @@ -1473,6 +1473,7 @@ winDeinitMultiWindowWM(void) #define HINT_NOMAXIMIZE (1L<<4) #define HINT_NOMINIMIZE (1L<<5) #define HINT_NOSYSMENU (1L<<6) +#define HINT_SKIPTASKBAR (1L<<7) /* These two are used on their own */ #define HINT_MAX (1L<<0) #define HINT_MIN (1L<<1) @@ -1481,12 +1482,14 @@ static void winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) { static Atom windowState, motif_wm_hints, windowType; - static Atom hiddenState, fullscreenState, belowState, aboveState; + static Atom hiddenState, fullscreenState, belowState, aboveState, + skiptaskbarState; static Atom dockWindow; static int generation; Atom type, *pAtom = NULL; int format; - unsigned long hint = 0, maxmin = 0, style, nitems = 0, left = 0; + unsigned long hint = 0, maxmin = 0, nitems = 0, left = 0; + unsigned long style, exStyle; WindowPtr pWin = GetProp (hWnd, WIN_WINDOW_PROP); MwmHints *mwm_hint = NULL; WinXSizeHints SizeHints; @@ -1507,6 +1510,8 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) belowState = XInternAtom(pDisplay, "_NET_WM_STATE_BELOW", False); aboveState = XInternAtom(pDisplay, "_NET_WM_STATE_ABOVE", False); dockWindow = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE_DOCK", False); + skiptaskbarState = + XInternAtom(pDisplay, "_NET_WM_STATE_SKIP_TASKBAR", False); } if (XGetWindowProperty(pDisplay, iWindow, windowState, 0L, @@ -1514,6 +1519,8 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) &nitems, &left, (unsigned char **) &pAtom) == Success) { if (pAtom && nitems == 1) { + if (*pAtom == skiptaskbarState) + hint |= HINT_SKIPTASKBAR; if (*pAtom == hiddenState) maxmin |= HINT_MIN; else if (*pAtom == fullscreenState) @@ -1602,9 +1609,13 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) XFree(normal_hint); } - /* Override hint settings from above with settings from config file */ + /* + Override hint settings from above with settings from config file and set + application id for grouping. + */ { XClassHint class_hint = { 0, 0 }; + char *application_id = 0; if (XGetClassHint(pDisplay, iWindow, &class_hint)) { char *window_name = 0; @@ -1618,17 +1629,23 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) #define APPLICATION_ID_FORMAT "%s.vcxsrv.%s" #define APPLICATION_ID_UNKNOWN "unknown" if (class_hint.res_class) { - asprintf (&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, class_hint.res_class); + asprintf(&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, + class_hint.res_class); } else { - asprintf (&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, APPLICATION_ID_UNKNOWN); + asprintf(&application_id, APPLICATION_ID_FORMAT, XVENDORNAME, + APPLICATION_ID_UNKNOWN); } - winSetAppID (hWnd, application_id); + winSetAppUserModelID(hWnd, application_id); - if (class_hint.res_name) XFree(class_hint.res_name); - if (class_hint.res_class) XFree(class_hint.res_class); - if (application_id) free(application_id); - if (window_name) XFree(window_name); + if (class_hint.res_name) + XFree(class_hint.res_name); + if (class_hint.res_class) + XFree(class_hint.res_class); + if (application_id) + free(application_id); + if (window_name) + XFree(window_name); } else { style = STYLE_NONE; @@ -1661,10 +1678,15 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) (hint & ~HINT_BORDER & ~HINT_CAPTION) | HINT_NOFRAME; /* Now apply styles to window */ - style = GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION & ~WS_SIZEBOX; /* Just in case */ - if (!hint) /* All on, but no resize of children is allowed */ + style = GetWindowLongPtr(hWnd, GWL_STYLE); + if (!style) + return; /* GetWindowLongPointer returns 0 on failure, we hope this isn't a valid style */ + + style &= ~WS_CAPTION & ~WS_SIZEBOX; /* Just in case */ + + if (!(hint & ~HINT_SKIPTASKBAR)) /* No hints, default */ style = style | WS_CAPTION; - else if (hint & HINT_NOFRAME) /* All off */ + else if (hint & HINT_NOFRAME) /* No frame, no decorations */ style = style & ~WS_CAPTION & ~WS_SIZEBOX; else style = style | ((hint & HINT_BORDER) ? WS_BORDER : 0) | @@ -1680,6 +1702,9 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) if (hint & HINT_NOSYSMENU) style = style & ~WS_SYSMENU; + if (hint & HINT_SKIPTASKBAR) + style = style & ~WS_MINIMIZEBOX; /* window will become lost if minimized */ + if (!IsWindow (hWnd)) { ErrorF("Windows window 0x%x has become invalid, so returning without applying hints\n",hWnd); @@ -1694,6 +1719,17 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle) else style|=WS_SIZEBOX; SetWindowLongPtr(hWnd, GWL_STYLE, style); + + exStyle = GetWindowLongPtr(hWnd, GWL_EXSTYLE); + if (hint & HINT_SKIPTASKBAR) + exStyle = (exStyle & ~WS_EX_APPWINDOW) | WS_EX_TOOLWINDOW; + else + exStyle = (exStyle & ~WS_EX_TOOLWINDOW) | WS_EX_APPWINDOW; + SetWindowLongPtr(hWnd, GWL_EXSTYLE, exStyle); + + winDebug + ("winApplyHints: iWindow 0x%08x hints 0x%08x style 0x%08x exstyle 0x%08x\n", + iWindow, hint, style, exStyle); } void diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c index c124f86ba..44da5041f 100644..100755 --- a/xorg-server/hw/xwin/winmultiwindowwndproc.c +++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c @@ -817,9 +817,8 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case WM_CLOSE: - /* Remove property AppUserModelID */ - winSetAppID (hwnd, NULL); - + /* Removep AppUserModelID property */ + winSetAppUserModelID(hwnd, NULL); /* Branch on if the window was killed in X already */ if (pWinPriv->fXKilled) { /* Window was killed, go ahead and destroy the window */ diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c index 7ada2de73..292d45fb1 100644..100755 --- a/xorg-server/hw/xwin/winprocarg.c +++ b/xorg-server/hw/xwin/winprocarg.c @@ -1201,10 +1201,12 @@ winLogVersionInfo(void) return; s_fBeenHere = TRUE; - ErrorF ("Welcome to the VcXsrv X Server\n"); - ErrorF ("Vendor: %s\n", XVENDORNAME); - ErrorF ("Release: %d.%d.%d.%d\n\n", XORG_VERSION_MAJOR, - XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP); - ErrorF ("%s\n\n", BUILDERSTRING); - ErrorF ("Contact: %s\n\n", BUILDERADDR); + ErrorF("Welcome to the VcXsrv X Server\n"); + ErrorF("Vendor: %s\n", XVENDORNAME); + ErrorF("Release: %d.%d.%d.%d\n\n", XORG_VERSION_MAJOR, + XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP); + if (strlen(BUILDERSTRING)) + ErrorF("%s\n", BUILDERSTRING); + ErrorF("Contact: %s\n", BUILDERADDR); + ErrorF("\n"); } diff --git a/xorg-server/hw/xwin/winshaddd.c b/xorg-server/hw/xwin/winshaddd.c index 709d07527..e35fe394c 100644 --- a/xorg-server/hw/xwin/winshaddd.c +++ b/xorg-server/hw/xwin/winshaddd.c @@ -469,7 +469,7 @@ winShadowUpdateDD(ScreenPtr pScreen, shadowBufPtr pBuf) POINT ptOrigin; DWORD dwBox = RegionNumRects(damage); BoxPtr pBox = RegionRects(damage); - HRGN hrgnTemp = NULL, hrgnCombined = NULL; + HRGN hrgnCombined = NULL; /* * Return immediately if the app is not active @@ -531,15 +531,9 @@ winShadowUpdateDD(ScreenPtr pScreen, shadowBufPtr pBuf) BoxPtr pBoxExtents = RegionExtents(damage); /* Compute a GDI region from the damaged region */ - hrgnCombined = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2); - dwBox--; - pBox++; - while (dwBox--) { - hrgnTemp = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2); - CombineRgn(hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR); - DeleteObject(hrgnTemp); - pBox++; - } + hrgnCombined = + CreateRectRgn(pBoxExtents->x1, pBoxExtents->y1, pBoxExtents->x2, + pBoxExtents->y2); /* Install the GDI region as a clipping region */ SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined); diff --git a/xorg-server/hw/xwin/winshadddnl.c b/xorg-server/hw/xwin/winshadddnl.c index 2c80a6bf0..a50128668 100644 --- a/xorg-server/hw/xwin/winshadddnl.c +++ b/xorg-server/hw/xwin/winshadddnl.c @@ -590,7 +590,7 @@ winShadowUpdateDDNL(ScreenPtr pScreen, shadowBufPtr pBuf) POINT ptOrigin; DWORD dwBox = RegionNumRects(damage); BoxPtr pBox = RegionRects(damage); - HRGN hrgnTemp = NULL, hrgnCombined = NULL; + HRGN hrgnCombined = NULL; /* * Return immediately if the app is not active @@ -645,15 +645,9 @@ winShadowUpdateDDNL(ScreenPtr pScreen, shadowBufPtr pBuf) BoxPtr pBoxExtents = RegionExtents(damage); /* Compute a GDI region from the damaged region */ - hrgnCombined = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2); - dwBox--; - pBox++; - while (dwBox--) { - hrgnTemp = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2); - CombineRgn(hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR); - DeleteObject(hrgnTemp); - pBox++; - } + hrgnCombined = + CreateRectRgn(pBoxExtents->x1, pBoxExtents->y1, pBoxExtents->x2, + pBoxExtents->y2); /* Install the GDI region as a clipping region */ SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined); diff --git a/xorg-server/hw/xwin/winshadgdi.c b/xorg-server/hw/xwin/winshadgdi.c index 2e5714bf0..6bfe41179 100644 --- a/xorg-server/hw/xwin/winshadgdi.c +++ b/xorg-server/hw/xwin/winshadgdi.c @@ -424,7 +424,7 @@ winShadowUpdateGDI(ScreenPtr pScreen, shadowBufPtr pBuf) DWORD dwBox = RegionNumRects(damage); BoxPtr pBox = RegionRects(damage); int x, y, w, h; - HRGN hrgnTemp = NULL, hrgnCombined = NULL; + HRGN hrgnCombined = NULL; #ifdef XWIN_UPDATESTATS static DWORD s_dwNonUnitRegions = 0; @@ -486,16 +486,11 @@ winShadowUpdateGDI(ScreenPtr pScreen, shadowBufPtr pBuf) } } else if (!pScreenInfo->fMultiWindow) { + /* Compute a GDI region from the damaged region */ - hrgnCombined = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2); - dwBox--; - pBox++; - while (dwBox--) { - hrgnTemp = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2); - CombineRgn(hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR); - DeleteObject(hrgnTemp); - pBox++; - } + hrgnCombined = + CreateRectRgn(pBoxExtents->x1, pBoxExtents->y1, pBoxExtents->x2, + pBoxExtents->y2); /* Install the GDI region as a clipping region */ SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined); diff --git a/xorg-server/hw/xwin/wintaskbar.c b/xorg-server/hw/xwin/wintaskbar.c new file mode 100644 index 000000000..7dd4ec30b --- /dev/null +++ b/xorg-server/hw/xwin/wintaskbar.c @@ -0,0 +1,92 @@ +/* + 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 (including the next + paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. +*/ + +#ifdef HAVE_XWIN_CONFIG_H +#include <xwin-config.h> +#endif + +#include "win.h" +#include "winwindow.h" + +const GUID CLSID_TaskbarList = {0x56fdf344,0xfd6d,0x11d0,{0x95,0x8a,0x0,0x60,0x97,0xc9,0xa0,0x90}}; +const GUID IID_ITaskbarList = {0x56fdf342,0xfd6d,0x11d0,{0x95,0x8a,0x0,0x60,0x97,0xc9,0xa0,0x90}}; + +#ifdef INTERFACE +#undef INTERFACE +#endif + +#define INTERFACE ITaskbarList +DECLARE_INTERFACE_(ITaskbarList, IUnknown) +{ + /* IUnknown methods */ + STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE; + STDMETHOD_(ULONG, AddRef) (THIS) PURE; + STDMETHOD_(ULONG, Release) (THIS) PURE; + + /* ITaskbarList methods */ + STDMETHOD(HrInit) (THIS) PURE; + STDMETHOD(AddTab) (THIS_ HWND hWnd) PURE; + STDMETHOD(DeleteTab) (THIS_ HWND hWnd) PURE; + STDMETHOD(ActivateTab) (THIS_ HWND hWnd) PURE; + STDMETHOD(SetActiveAlt) (THIS_ HWND hWnd) PURE; +}; +#undef INTERFACE + +/* + The stuff above needs to be in win32api headers, not defined here, + or at least generated from the MIDL :-) +*/ + +/* + This is unnecessarily heavyweight, we could just call CoInitialize() once at + startup and CoUninitialize() once at shutdown +*/ + +/* + The documentation for ITaskbarList::AddTab says that we are responsible for + deleting the tab ourselves when the window is deleted, but that doesn't actually + seem to be the case +*/ + +void winShowWindowOnTaskbar(HWND hWnd, BOOL show) +{ + ITaskbarList* pTaskbarList = NULL; + + if (SUCCEEDED(CoInitialize(NULL))) + { + if (SUCCEEDED(CoCreateInstance((const CLSID *)&CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, (const IID *)&IID_ITaskbarList, (void**)&pTaskbarList))) + { + if (SUCCEEDED(pTaskbarList->lpVtbl->HrInit(pTaskbarList))) + { + if (show) + { + pTaskbarList->lpVtbl->AddTab(pTaskbarList,hWnd); + } + else + { + pTaskbarList->lpVtbl->DeleteTab(pTaskbarList,hWnd); + } + } + pTaskbarList->lpVtbl->Release(pTaskbarList); + } + CoUninitialize(); + } +} diff --git a/xorg-server/hw/xwin/winwin32rootless.c b/xorg-server/hw/xwin/winwin32rootless.c index a3afec186..55039bccd 100644..100755 --- a/xorg-server/hw/xwin/winwin32rootless.c +++ b/xorg-server/hw/xwin/winwin32rootless.c @@ -259,7 +259,7 @@ winMWExtWMCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen, pszWindowID[sizeof(pszWindowID) - 1] = 0; strcat(pszClass, pszWindowID); - winDebug("winCreateWindowsWindow - Creating class: %s\n", pszClass); + winDebug("winMWExtWMCreateFrame - Creating class: %s\n", pszClass); /* Setup our window class */ wc.cbSize = sizeof(wc); diff --git a/xorg-server/hw/xwin/winwindow.h b/xorg-server/hw/xwin/winwindow.h index 7d5a88a55..f80e5752d 100644..100755 --- a/xorg-server/hw/xwin/winwindow.h +++ b/xorg-server/hw/xwin/winwindow.h @@ -154,5 +154,17 @@ winTaskbarDestroy (void); void winSetAppID (HWND hWnd, const char* AppID); +void + winPropertyStoreInit(void); + +void + winPropertyStoreDestroy(void); + +void + winSetAppUserModelID(HWND hWnd, const char *AppID); + +void + winShowWindowOnTaskbar(HWND hWnd, BOOL show); + #endif /* XWIN_MULTIWINDOW */ #endif diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c index 278611caf..bd93fbbd3 100644 --- a/xorg-server/hw/xwin/winwndproc.c +++ b/xorg-server/hw/xwin/winwndproc.c @@ -925,6 +925,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WIN_POLLING_MOUSE_TIMER_ID: { + static POINT last_point; POINT point; WPARAM wL, wM, wR, wShift, wCtrl; LPARAM lPos; @@ -936,8 +937,12 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) point.x -= GetSystemMetrics(SM_XVIRTUALSCREEN); point.y -= GetSystemMetrics(SM_YVIRTUALSCREEN); - /* Deliver absolute cursor position to X Server */ - winEnqueueMotion(point.x, point.y); + /* If the mouse pointer has moved, deliver absolute cursor position to X Server */ + if (last_point.x != point.x || last_point.y != point.y) { + winEnqueueMotion(point.x, point.y); + last_point.x = point.x; + last_point.y = point.y; + } /* Check if a button was released but we didn't see it */ GetCursorPos(&point); |