From a8f506259b72037607985955e353f55a3c23e01b Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Mon, 27 Jun 2016 19:06:13 +0100 Subject: Ignore -swcursor if -compositewm -swcursor is not compatible with -compositewm (because the window contents are drawn from an off-screen pixmap, not from the screen pixmap, where the software cursor will be drawn). --- hw/xwin/man/XWin.man | 1 + hw/xwin/winvalargs.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man index 6b6fbe7e3..3544c7c83 100644 --- a/hw/xwin/man/XWin.man +++ b/hw/xwin/man/XWin.man @@ -212,6 +212,7 @@ The default is enabled. .TP 8 .B \-swcursor Disable the usage of the \fIWindows\fP cursor and use the X11 software cursor instead. +This option is ignored if \fB-compositewm\fP is also enabled. .TP 8 .B \-[no]trayicon Do not create a tray icon. Default is to create one diff --git a/hw/xwin/winvalargs.c b/hw/xwin/winvalargs.c index c3359f45a..7e896ba9f 100644 --- a/hw/xwin/winvalargs.c +++ b/hw/xwin/winvalargs.c @@ -175,6 +175,16 @@ winValidateArgs(void) "-scrollbars, -resize, -nodecoration, or -lesspointer.\n"); return FALSE; } + +#ifdef XWIN_MULTIWINDOW + /* Ignore -swcursor if -multiwindow -compositewm is requested */ + if (g_ScreenInfo[i].fMultiWindow && g_ScreenInfo[i].fCompositeWM) { + if (g_fSoftwareCursor) { + g_fSoftwareCursor = FALSE; + winMsg(X_WARNING, "Ignoring -swcursor due to -compositewm\n"); + } + } +#endif } winDebug("winValidateArgs - Returning.\n"); -- cgit v1.2.3 From 3007be78c0d72dc7e56d4e9e2a68f4b2cf1b5dfb Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Tue, 12 Jul 2016 14:58:37 +0100 Subject: Fix non-toplevel window resizing/repositioning Fix regressions in non-toplevel window resizing/repositioning introduced in "Avoid potential re-entrancy of xserver code in winPositionWindowMultiwindow" Avoid erroneous fall-through to top-level case in winAdjustWindowsWindow(). Implement WM_ASYNCMOVE for non-toplevel windows. These omissions caused non-toplevel WGL windows to not be resized correctly. --- hw/xwin/winmultiwindowwindow.c | 2 ++ hw/xwin/winmultiwindowwndproc.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index 7ff598743..0f65bd93a 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -282,6 +282,8 @@ winAdjustWindowsWindow(WindowPtr pWin, HWND hWnd) MoveWindow(hWnd, iX - parentOrigin.x, iY - parentOrigin.y, iWidth, iHeight, TRUE); + + return; } /* Get the Windows window style and extended style */ diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index 66b37aefd..c58de0ef3 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -1173,10 +1173,29 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK winChildWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { + WindowPtr pWin = NULL; + #if CYGDEBUG winDebugWin32Message("winChildWindowProc", hwnd, message, wParam, lParam); #endif + /* + If this is WM_CREATE, set up the Windows window properties which point to + X window information + */ + if (message == WM_CREATE) { + SetProp(hwnd, + WIN_WINDOW_PROP, + (HANDLE) ((LPCREATESTRUCT) lParam)->lpCreateParams); + SetProp(hwnd, + WIN_WID_PROP, + (HANDLE) (INT_PTR)winGetWindowID(((LPCREATESTRUCT) lParam)-> + lpCreateParams)); + } + + /* Retrieve the Windows window property for our X window pointer */ + pWin = GetProp(hwnd, WIN_WINDOW_PROP); + switch (message) { case WM_ERASEBKGND: return TRUE; @@ -1197,6 +1216,10 @@ winChildWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) return 0; } /* XXX: this is exactly what DefWindowProc does? */ + + case WM_ASYNCMOVE: + winAdjustWindowsWindow(pWin, hwnd); + break; } return DefWindowProc(hwnd, message, wParam, lParam); -- cgit v1.2.3 From 4d18eab69186592de2bd75e9c076a9345ec9e9d0 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 21 Jan 2016 12:47:57 -0500 Subject: glx: Implement GLX_EXT_fbconfig_packed_float The tokens for this are already defined by GLX_ARB_fbconfig_float, which we already support, so just add the extension to the list and let the driver provide those configs if it wants. Reviewed-by: Eric Anholt Signed-off-by: Adam Jackson --- glx/extension_string.c | 1 + glx/extension_string.h | 1 + glx/glxdri2.c | 6 ++++++ glx/glxdriswrast.c | 1 + 4 files changed, 9 insertions(+) diff --git a/glx/extension_string.c b/glx/extension_string.c index e881d2109..de5e16e09 100644 --- a/glx/extension_string.c +++ b/glx/extension_string.c @@ -81,6 +81,7 @@ static const struct extension_info known_glx_extensions[] = { { GLX(ARB_multisample), VER(1,4), Y, }, { GLX(EXT_create_context_es2_profile), VER(0,0), N, }, + { GLX(EXT_fbconfig_packed_float), VER(0,0), N, }, { GLX(EXT_framebuffer_sRGB), VER(0,0), N, }, { GLX(EXT_import_context), VER(0,0), Y, }, { GLX(EXT_texture_from_pixmap), VER(0,0), Y, }, diff --git a/glx/extension_string.h b/glx/extension_string.h index bac7b0624..3c1fd3060 100644 --- a/glx/extension_string.h +++ b/glx/extension_string.h @@ -44,6 +44,7 @@ enum { ARB_framebuffer_sRGB_bit, ARB_multisample_bit, EXT_create_context_es2_profile_bit, + EXT_fbconfig_packed_float_bit, EXT_import_context_bit, EXT_texture_from_pixmap_bit, EXT_visual_info_bit, diff --git a/glx/glxdri2.c b/glx/glxdri2.c index 6fb3d9278..76bd41fdb 100644 --- a/glx/glxdri2.c +++ b/glx/glxdri2.c @@ -893,6 +893,12 @@ initializeExtensions(__GLXDRIscreen * screen) LogMessage(X_INFO, "AIGLX: enabled GLX_ARB_fbconfig_float\n"); } + /* enable EXT_fbconfig_packed_float (even if there are no packed float fbconfigs) */ + { + __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_fbconfig_packed_float"); + LogMessage(X_INFO, "AIGLX: enabled GLX_EXT_fbconfig_packed_float\n"); + } + for (i = 0; extensions[i]; i++) { if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) { __glXEnableExtension(screen->glx_enable_bits, diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c index e8e53bfdb..cd835c779 100644 --- a/glx/glxdriswrast.c +++ b/glx/glxdriswrast.c @@ -411,6 +411,7 @@ initializeExtensions(__GLXDRIscreen * screen) /* these are harmless to enable unconditionally */ __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_framebuffer_sRGB"); __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_fbconfig_float"); + __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_fbconfig_packed_float"); __glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_make_current_read"); extensions = screen->core->getExtensions(screen->driScreen); -- cgit v1.2.3 From 39013cee90433ec6a0ba7e454df4a99c5719653e Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Fri, 15 Jul 2016 12:57:34 +0100 Subject: Move some uninteresting windows-dri output to debug log level --- hw/xwin/glx/indirect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c index c86fcf191..99af303c5 100644 --- a/hw/xwin/glx/indirect.c +++ b/hw/xwin/glx/indirect.c @@ -1146,14 +1146,14 @@ glxWinDeferredCreateDrawable(__GLXWinDrawable *draw, __GLXconfig *config) #define RASTERWIDTHBYTES(bmi) (((((bmi)->biWidth*(bmi)->biBitCount)+31)&~31)>>3) size = bmpHeader.biHeight * RASTERWIDTHBYTES(&bmpHeader); - ErrorF("shared memory region size %zu + %u\n", sizeof(BITMAPINFOHEADER), (unsigned int)size); + GLWIN_DEBUG_MSG("shared memory region size %zu + %u\n", sizeof(BITMAPINFOHEADER), (unsigned int)size); // Create unique name for mapping based on XID // // XXX: not quite unique as potentially this name could be used in // another server instance. Not sure how to deal with that. snprintf(name, sizeof(name), "Local\\CYGWINX_WINDOWSDRI_%08x", (unsigned int)draw->base.pDraw->id); - ErrorF("shared memory region name %s\n", name); + GLWIN_DEBUG_MSG("shared memory region name %s\n", name); // Create a file mapping backed by the pagefile draw->hSection = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, -- cgit v1.2.3 From 6198711a4ec783f3c98f23a11e61a8b831459b5c Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Fri, 15 Jul 2016 14:02:10 +0100 Subject: hw/xwin/glx: Make WGL -> GLX extension mapping table-driven --- hw/xwin/glx/indirect.c | 58 +++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c index 99af303c5..97e115ed8 100644 --- a/hw/xwin/glx/indirect.c +++ b/hw/xwin/glx/indirect.c @@ -689,11 +689,27 @@ glxWinScreenProbe(ScreenPtr pScreen) } { + int i; Bool glx_sgi_make_current_read = FALSE; + const struct + { + const char *wglext; + const char *glxext; + Bool mandatory; + } extensionMap[] = { + { "WGL_ARB_make_current_read", "GLX_SGI_make_current_read", 0 }, + { "WGL_EXT_swap_control", "GLX_SGI_swap_control", 0 }, + { "WGL_EXT_swap_control", "GLX_MESA_swap_control", 0 }, + // { "WGL_ARB_render_texture", "GLX_EXT_texture_from_pixmap", 0 }, + // Sufficiently different that it's not obvious if this can be done... + { "WGL_ARB_pbuffer", "GLX_SGIX_pbuffer", 0 }, + { "WGL_ARB_multisample", "GLX_ARB_multisample", 0 }, + { "WGL_ARB_multisample", "GLX_SGIS_multisample", 0 }, + }; + // // Based on the WGL extensions available, enable various GLX extensions - // XXX: make this table-driven ? // memset(screen->glx_enable_bits, 0, __GLX_EXT_BYTES); @@ -703,49 +719,33 @@ glxWinScreenProbe(ScreenPtr pScreen) __glXEnableExtension(screen->glx_enable_bits, "GLX_OML_swap_method"); __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_fbconfig"); + for (i = 0; i < sizeof(extensionMap)/sizeof(extensionMap[0]); i++) { + if (strstr(wgl_extensions, extensionMap[i].wglext)) { + __glXEnableExtension(screen->glx_enable_bits, extensionMap[i].glxext); + LogMessage(X_INFO, "GLX: enabled %s\n", extensionMap[i].glxext); + } + else if (extensionMap[i].mandatory) { + LogMessage(X_ERROR, "required WGL extension %s is missing\n", extensionMap[i].wglext); + } + } + if (strstr(wgl_extensions, "WGL_ARB_make_current_read")) { - __glXEnableExtension(screen->glx_enable_bits, - "GLX_SGI_make_current_read"); - LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_make_current_read\n"); glx_sgi_make_current_read = TRUE; } + // Because it pre-dates WGL_EXT_extensions_string, GL_WIN_swap_hint might + // only be in GL_EXTENSIONS if (strstr(gl_extensions, "GL_WIN_swap_hint")) { __glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer"); LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n"); } - if (strstr(wgl_extensions, "WGL_EXT_swap_control")) { - __glXEnableExtension(screen->glx_enable_bits, - "GLX_SGI_swap_control"); - __glXEnableExtension(screen->glx_enable_bits, - "GLX_MESA_swap_control"); - LogMessage(X_INFO, - "AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n"); - } - -/* // Hmm? screen->texOffset */ -/* if (strstr(wgl_extensions, "WGL_ARB_render_texture")) */ -/* { */ -/* __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_texture_from_pixmap"); */ -/* LogMessage(X_INFO, "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n"); */ -/* screen->has_WGL_ARB_render_texture = TRUE; */ -/* } */ - if (strstr(wgl_extensions, "WGL_ARB_pbuffer")) { - __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_pbuffer"); - LogMessage(X_INFO, "AIGLX: enabled GLX_SGIX_pbuffer\n"); screen->has_WGL_ARB_pbuffer = TRUE; } if (strstr(wgl_extensions, "WGL_ARB_multisample")) { - __glXEnableExtension(screen->glx_enable_bits, - "GLX_ARB_multisample"); - __glXEnableExtension(screen->glx_enable_bits, - "GLX_SGIS_multisample"); - LogMessage(X_INFO, - "AIGLX: enabled GLX_ARB_multisample and GLX_SGIS_multisample\n"); screen->has_WGL_ARB_multisample = TRUE; } -- cgit v1.2.3 From 2215cde3821ad94bf5391ed6259bacd437846ddd Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Fri, 15 Jul 2016 14:06:32 +0100 Subject: hw/xwin/glx: Add support for float format fbconfig GLX extensions --- hw/xwin/glx/indirect.c | 105 ++++++++++++++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 40 deletions(-) diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c index 97e115ed8..165d02410 100644 --- a/hw/xwin/glx/indirect.c +++ b/hw/xwin/glx/indirect.c @@ -104,8 +104,6 @@ typedef struct { int notOpenGL; - int rgbaFloat; - int unsignedRgbaFloat; int unknownPixelType; int unaccelerated; } PixelFormatRejectStats; @@ -298,9 +296,8 @@ static void fbConfigsDump(unsigned int n, __GLXconfig * c, PixelFormatRejectStats *rejects) { LogMessage(X_INFO, "%d fbConfigs\n", n); - LogMessage(X_INFO, "ignored pixel formats: %d not OpenGL, %d RBGA float, %d RGBA unsigned float, %d unknown pixel type, %d unaccelerated\n", - rejects->notOpenGL, rejects->rgbaFloat, rejects->unsignedRgbaFloat, - rejects->unknownPixelType, rejects->unaccelerated); + LogMessage(X_INFO, "ignored pixel formats: %d not OpenGL, %d unknown pixel type, %d unaccelerated\n", + rejects->notOpenGL, rejects->unknownPixelType, rejects->unaccelerated); if (g_iLogVerbose < 3) return; @@ -315,6 +312,10 @@ fbConfigsDump(unsigned int n, __GLXconfig * c, PixelFormatRejectStats *rejects) while (c != NULL) { unsigned int i = ((GLXWinConfig *) c)->pixelFormatIndex; + const char *float_col = "."; + if (c->renderType & GLX_RGBA_FLOAT_BIT_ARB) float_col = "s"; + if (c->renderType & GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT) float_col = "u"; + ErrorF("%3d %3x %3x " "%-11s" " %3d %3d %s %s %s %s %s " @@ -345,8 +346,7 @@ fbConfigsDump(unsigned int n, __GLXconfig * c, PixelFormatRejectStats *rejects) (c->drawableType & GLX_WINDOW_BIT) ? "y" : ".", (c->drawableType & GLX_PIXMAP_BIT) ? "y" : ".", (c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".", - (c->renderType & (GLX_RGBA_FLOAT_BIT_ARB | - GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) ? "y" : ".", + float_col, (c->transparentPixel != GLX_NONE_EXT) ? "y" : ".", c->visualSelectGroup, (c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " "); @@ -706,6 +706,8 @@ glxWinScreenProbe(ScreenPtr pScreen) { "WGL_ARB_pbuffer", "GLX_SGIX_pbuffer", 0 }, { "WGL_ARB_multisample", "GLX_ARB_multisample", 0 }, { "WGL_ARB_multisample", "GLX_SGIS_multisample", 0 }, + { "WGL_ARB_pixel_format_float", "GLX_ARB_fbconfig_float", 0 }, + { "WGL_EXT_pixel_format_packed_float", "GLX_EXT_fbconfig_packed_float", 0 }, }; // @@ -1827,13 +1829,34 @@ fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode, int attribList[60]; SET_ATTR_VALUE(WGL_SUPPORT_OPENGL_ARB, TRUE); - SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB, - (mode->visualType == - GLX_TRUE_COLOR) ? WGL_TYPE_RGBA_ARB : - WGL_TYPE_COLORINDEX_ARB); - SET_ATTR_VALUE(WGL_COLOR_BITS_ARB, - (mode->visualType == - GLX_TRUE_COLOR) ? mode->rgbBits : mode->indexBits); + + switch (mode->renderType) + { + case GLX_COLOR_INDEX_BIT: + case GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT: + SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB, WGL_TYPE_COLORINDEX_ARB); + SET_ATTR_VALUE(WGL_COLOR_BITS_ARB, mode->indexBits); + break; + + default: + ErrorF("unexpected renderType %x\n", mode->renderType); + /* fall-through */ + case GLX_RGBA_BIT: + SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB); + SET_ATTR_VALUE(WGL_COLOR_BITS_ARB, mode->rgbBits); + break; + + case GLX_RGBA_FLOAT_BIT_ARB: + SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_FLOAT_ARB); + SET_ATTR_VALUE(WGL_COLOR_BITS_ARB, mode->rgbBits); + break; + + case GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT: + SET_ATTR_VALUE(WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT); + SET_ATTR_VALUE(WGL_COLOR_BITS_ARB, mode->rgbBits); + break; + } + SET_ATTR_VALUE(WGL_RED_BITS_ARB, mode->redBits); SET_ATTR_VALUE(WGL_GREEN_BITS_ARB, mode->greenBits); SET_ATTR_VALUE(WGL_BLUE_BITS_ARB, mode->blueBits); @@ -2304,25 +2327,42 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen, PixelFormatRejectStats * c->base.indexBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0); c->base.rgbBits = 0; c->base.visualType = GLX_STATIC_COLOR; + c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT; + + /* + Assume RGBA rendering is available on all single-channel visuals + (it is specified to render to red component in single-channel + visuals, if supported, but there doesn't seem to be any mechanism + to check if it is supported) + + Color index rendering is only supported on single-channel visuals + */ + + break; + + case WGL_TYPE_RGBA_ARB: + c->base.indexBits = 0; + c->base.rgbBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0); + c->base.visualType = GLX_TRUE_COLOR; + c->base.renderType = GLX_RGBA_BIT; break; case WGL_TYPE_RGBA_FLOAT_ARB: - rejects->rgbaFloat++; - GLWIN_DEBUG_MSG - ("pixelFormat %d is WGL_TYPE_RGBA_FLOAT_ARB, skipping", i + 1); - continue; + c->base.indexBits = 0; + c->base.rgbBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0); + c->base.visualType = GLX_TRUE_COLOR; + c->base.renderType = GLX_RGBA_FLOAT_BIT_ARB; + // assert pbuffer drawable + // assert WGL_ARB_pixel_format_float + break; case WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT: - rejects->unsignedRgbaFloat++; - GLWIN_DEBUG_MSG - ("pixelFormat %d is WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT, skipping", - i + 1); - continue; - - case WGL_TYPE_RGBA_ARB: c->base.indexBits = 0; c->base.rgbBits = ATTR_VALUE(WGL_COLOR_BITS_ARB, 0); c->base.visualType = GLX_TRUE_COLOR; + c->base.renderType = GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT; + // assert pbuffer drawable + // assert WGL_EXT_pixel_format_packed_float break; default: @@ -2422,21 +2462,6 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen, PixelFormatRejectStats * | (ATTR_VALUE(WGL_DRAW_TO_BITMAP_ARB, 0) ? GLX_PIXMAP_BIT : 0) | (ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, 0) ? GLX_PBUFFER_BIT : 0)); - /* - Assume OpenGL RGBA rendering is available on all visuals - (it is specified to render to red component in single-channel visuals, - if supported, but there doesn't seem to be any mechanism to check if it - is supported) - - Color index rendering is only supported on single-channel visuals - */ - if (c->base.visualType == GLX_STATIC_COLOR) { - c->base.renderType = GLX_RGBA_BIT | GLX_COLOR_INDEX_BIT; - } - else { - c->base.renderType = GLX_RGBA_BIT; - } - c->base.xRenderable = GL_TRUE; c->base.fbconfigID = -1; // will be set by __glXScreenInit() -- cgit v1.2.3 From 401cf54fedd2af0170b14af02ccbdb9b685104a2 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Fri, 15 Jul 2016 13:46:45 +0100 Subject: hw/xwin/glx: publish GLX create_context extensions XXX: To properly support GLX_ARB_create_context in indirect mode, we need to use wglCreateContextAttribsARB() rather than wglCreateContext(), when attribs are provided, rather than just dropping attribs on the floor, as we currently do. That probably entails removing the deferred context creation and instead using a temporary window, as direct WGL does. --- hw/xwin/glx/indirect.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c index 165d02410..3c8c8dcb2 100644 --- a/hw/xwin/glx/indirect.c +++ b/hw/xwin/glx/indirect.c @@ -708,6 +708,10 @@ glxWinScreenProbe(ScreenPtr pScreen) { "WGL_ARB_multisample", "GLX_SGIS_multisample", 0 }, { "WGL_ARB_pixel_format_float", "GLX_ARB_fbconfig_float", 0 }, { "WGL_EXT_pixel_format_packed_float", "GLX_EXT_fbconfig_packed_float", 0 }, + { "WGL_ARB_create_context", "GLX_ARB_create_context", 0 }, + { "WGL_ARB_create_context_profile", "GLX_ARB_create_context_profile", 0 }, + { "WGL_ARB_create_context_robustness", "GLX_ARB_create_context_robustness", 0 }, + { "WGL_EXT_create_context_es2_profile", "GLX_EXT_create_context_es2_profile", 0 }, }; // -- cgit v1.2.3 From 68a5604376f03452fe4f76042edc5003d9f037af Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Fri, 15 Jul 2016 15:15:18 +0100 Subject: hw/xwin/glx: Add GLX_ARB_framebuffer_sRGB extension --- hw/xwin/glx/indirect.c | 29 +++++++++++++++++++++++------ hw/xwin/glx/indirect.h | 1 + 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c index 3c8c8dcb2..529ae4687 100644 --- a/hw/xwin/glx/indirect.c +++ b/hw/xwin/glx/indirect.c @@ -303,11 +303,11 @@ fbConfigsDump(unsigned int n, __GLXconfig * c, PixelFormatRejectStats *rejects) return; ErrorF - ("pxf vis fb render Ste aux accum MS drawable Group/\n"); + ("pxf vis fb render Ste aux accum MS drawable Group/ sRGB\n"); ErrorF - ("idx ID ID VisualType Depth Lvl RGB CI DB Swap reo R G B A Z S buf AR AG AB AA bufs num W P Pb Float Trans Caveat\n"); + ("idx ID ID VisualType Depth Lvl RGB CI DB Swap reo R G B A Z S buf AR AG AB AA bufs num W P Pb Float Trans Caveat cap \n"); ErrorF - ("-----------------------------------------------------------------------------------------------------------------------------\n"); + ("----------------------------------------------------------------------------------------------------------------------------------\n"); while (c != NULL) { unsigned int i = ((GLXWinConfig *) c)->pixelFormatIndex; @@ -327,7 +327,8 @@ fbConfigsDump(unsigned int n, __GLXconfig * c, PixelFormatRejectStats *rejects) " %s %s %s " " %s " " %s " - " %d %s" + " %d %s " + " %s" "\n", i, c->visualID, c->fbconfigID, visual_class_name(c->visualType), @@ -349,7 +350,8 @@ fbConfigsDump(unsigned int n, __GLXconfig * c, PixelFormatRejectStats *rejects) float_col, (c->transparentPixel != GLX_NONE_EXT) ? "y" : ".", c->visualSelectGroup, - (c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " "); + (c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " ", + c->sRGBCapable ? "y" : "."); c = c->next; } @@ -712,6 +714,7 @@ glxWinScreenProbe(ScreenPtr pScreen) { "WGL_ARB_create_context_profile", "GLX_ARB_create_context_profile", 0 }, { "WGL_ARB_create_context_robustness", "GLX_ARB_create_context_robustness", 0 }, { "WGL_EXT_create_context_es2_profile", "GLX_EXT_create_context_es2_profile", 0 }, + { "WGL_ARB_framebuffer_sRGB", "GLX_ARB_framebuffer_sRGB", 0 }, }; // @@ -755,6 +758,10 @@ glxWinScreenProbe(ScreenPtr pScreen) screen->has_WGL_ARB_multisample = TRUE; } + if (strstr(wgl_extensions, "WGL_ARB_framebuffer_sRGB")) { + screen->has_WGL_ARB_framebuffer_sRGB = TRUE; + } + screen->base.destroy = glxWinScreenDestroy; screen->base.createContext = glxWinCreateContext; screen->base.createDrawable = glxWinCreateDrawable; @@ -1913,6 +1920,9 @@ fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode, SET_ATTR_VALUE(WGL_DRAW_TO_PBUFFER_ARB, TRUE); } + if (winScreen->has_WGL_ARB_framebuffer_sRGB) + SET_ATTR_VALUE(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, TRUE); + SET_ATTR_VALUE(0, 0); // terminator /* choose the first match */ @@ -2278,6 +2288,11 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen, PixelFormatRejectStats * ADD_ATTR(WGL_MAX_PBUFFER_HEIGHT_ARB); } + if (screen->has_WGL_ARB_framebuffer_sRGB) { + // we may not query these attrs if WGL_ARB_framebuffer_sRGB is not offered + ADD_ATTR(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB); + } + /* fill in configs */ for (i = 0; i < numConfigs; i++) { int values[num_attrs]; @@ -2547,7 +2562,9 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen, PixelFormatRejectStats * GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT | GLX_TEXTURE_RECTANGLE_BIT_EXT; c->base.yInverted = -1; - c->base.sRGBCapable = 0; + + /* WGL_ARB_framebuffer_sRGB */ + c->base.sRGBCapable = ATTR_VALUE(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, 0); n++; diff --git a/hw/xwin/glx/indirect.h b/hw/xwin/glx/indirect.h index 163375556..a63477bfd 100644 --- a/hw/xwin/glx/indirect.h +++ b/hw/xwin/glx/indirect.h @@ -71,6 +71,7 @@ struct __GLXWinScreen { Bool has_WGL_ARB_pixel_format; Bool has_WGL_ARB_pbuffer; Bool has_WGL_ARB_render_texture; + Bool has_WGL_ARB_framebuffer_sRGB; /* wrapped screen functions */ RealizeWindowProcPtr RealizeWindow; -- cgit v1.2.3 From 858dd297e7dcd5bca3ab167c2896bd05247ea20d Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Fri, 15 Jul 2016 15:18:36 +0100 Subject: Use multisample attributes with wglChoosePixelFormatARB() Seems like this was omitted in error --- hw/xwin/glx/indirect.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c index 529ae4687..46622e99e 100644 --- a/hw/xwin/glx/indirect.c +++ b/hw/xwin/glx/indirect.c @@ -1897,6 +1897,11 @@ fbConfigToPixelFormatIndex(HDC hdc, __GLXconfig * mode, if (mode->visualRating == GLX_SLOW_VISUAL_EXT) SET_ATTR_VALUE(WGL_ACCELERATION_ARB, WGL_NO_ACCELERATION_ARB); + if (winScreen->has_WGL_ARB_multisample) { + SET_ATTR_VALUE(WGL_SAMPLE_BUFFERS_ARB, mode->sampleBuffers); + SET_ATTR_VALUE(WGL_SAMPLES_ARB, mode->samples); + } + // must support all the drawable types the mode supports if ((mode->drawableType | drawableTypeOverride) & GLX_WINDOW_BIT) SET_ATTR_VALUE(WGL_DRAW_TO_WINDOW_ARB, TRUE); -- cgit v1.2.3 From eb3597a699e49130fa63121b2c3ef24b6fcb4d8c Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Fri, 19 Feb 2016 21:53:00 +0000 Subject: Add -icon option to set the screen window icon in windowed mode Add an -icon option to set the screen window icon in windowed mode Allow cygwin paths in an icon-specification Update man pages and system.XWinrc appropriately Also, log an error if the icon specified for TRAYICON cannot be loaded Also, fix a bug in appending a '\' to IconDirectory only if it doesn't already end with one, which was fortunately benign. Also, if we are exiting in ddxProcessArgument() due to an error in options, use a non-zero exit status. XXX: LoadImageComma would be simpler if we just said that XWinrc paths are Cygwin paths on Cygwin, Windows paths on MinGW, but that could break existing .XWinrc files XXX: Given that we can specify paths, I'm not sure what IconDirectory wins us. --- hw/xwin/InitOutput.c | 2 ++ hw/xwin/man/XWin.man | 5 ++++ hw/xwin/man/XWinrc.man | 29 +++++++++++--------- hw/xwin/system.XWinrc | 12 +++----- hw/xwin/win.h | 4 +++ hw/xwin/wincreatewnd.c | 20 +++----------- hw/xwin/winprefs.c | 74 ++++++++++++++++++++++++++++++++++++++------------ hw/xwin/winprefs.h | 4 +++ hw/xwin/winprocarg.c | 38 ++++++++++++++++++++++++-- 9 files changed, 130 insertions(+), 58 deletions(-) diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index d8c8e8655..3d7ab8e9e 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -783,6 +783,8 @@ winUseMsg(void) ErrorF("-[no]hostintitle\n" "\tIn multiwindow mode, add remote host names to window titles.\n"); + ErrorF("-icon icon_specifier\n" "\tSet screen window icon in windowed mode.\n"); + ErrorF("-ignoreinput\n" "\tIgnore keyboard and mouse input.\n"); #ifdef XWIN_XF86CONFIG diff --git a/hw/xwin/man/XWin.man b/hw/xwin/man/XWin.man index 3544c7c83..2695d9aa8 100644 --- a/hw/xwin/man/XWin.man +++ b/hw/xwin/man/XWin.man @@ -1,3 +1,4 @@ + .TH XWIN 1 __vendorversion__ .SH NAME XWin \- X Server for the Cygwin environment on Microsoft Windows @@ -108,6 +109,10 @@ The X server window takes the full screen, covering completely the \fIWindows\fP desktop. Currently \fB\-fullscreen\fP may only be applied to one X screen. .TP 8 +.B "\-icon" \fIicon-specifier\fB +Override the window icon for the screen window from the default. +The \fIicon-specifier\fB is as defined in XWinrc(__filemansuffix__). +.TP 8 .B \-nodecoration Do not give the Cygwin/X window a \fIWindows\fP window border, title bar, etc. diff --git a/hw/xwin/man/XWinrc.man b/hw/xwin/man/XWinrc.man index 60b8ce1ec..29edc55be 100644 --- a/hw/xwin/man/XWinrc.man +++ b/hw/xwin/man/XWinrc.man @@ -163,31 +163,34 @@ such items should be included at the start or at the end of the menu. .SH Icon Instructions -When specifying an \fIicon-file\fP in the following commands several different formats are allowed: -.br -\fB"NAME.ICO"\fP\fI of an .ico format file\fP -.br -\t \t ("cygwin.ico", "apple.ico") -.br -\fB"NAME.DLL,nn"\fP\fI of a .DLL and icon index\fP +When specifying an \fIicon-specifier\fP in the following commands several different formats are allowed: +.PP +.IP \fI"NAME.ICO"\fP 16 +filename of an .ico format file .br -\t \t ("c:\\windows\\system32\\shell32.dll,4" is the default folder icon) +(e.g. "cygwin.ico", "apple.ico", "C:\\icons\\cheese.ico", "/usr/share/icons/moon.ico") +.IP \fI"NAME.DLL,nnn"\fP 16 +filename of a DLL with an index into it's ICON resources .br -\fB",nnn"\fP\fI index into XWin.EXE internal ICON resources\fP +(e.g. "c:\\windows\\system32\\shell32.dll,4", the default folder icon, + "/usr/bin/cygicons-0.dll,10", the hippo icon) +.IP \fI",nnn"\fP 16 +index into the XWin executable's internal ICON resources .br -\t \t (",101" is the 1st icon inside \fIXWin.EXE\fP) +(e.g. ",101" is the 1st icon in \fIXWin\fP) .TP 8 .B ICONDIRECTORY \fIWindows-path-to-icon-directory\fP -Defines the default directory to search for \ficon-file\fP files. +Defines the default directory for the file when an \fIicon-specifier\fP doesn't +contain an absolute path. It should be a \fIWindows\fP style path (e.g. C:\\cygwin\\usr\\local\\icons). .TP 8 -.B DEFAULTICON \fIicon-file\fP +.B DEFAULTICON \fIicon-specifier\fP Defines a replacement for the standard X icon for applications without specified icons. .TP 8 .B ICONS { .br - \fIclass-or-name-of-window\fP \fIicon-file\fP + \fIclass-or-name-of-window\fP \fIicon-specifier\fP .br \fI...\fP .br diff --git a/hw/xwin/system.XWinrc b/hw/xwin/system.XWinrc index 87d714a68..c2e9ceb9a 100644 --- a/hw/xwin/system.XWinrc +++ b/hw/xwin/system.XWinrc @@ -8,10 +8,6 @@ # Comments begin with "#" or "//" and go to the end-of-line -# Paths to commands are **cygwin** based (i.e. /usr/local/bin/xcalc) - -# Paths to icons are **WINDOWS** based (i.e. c:\windows\icons) - # Menus are defined as... # MENU { # EXEC @@ -55,15 +51,15 @@ # To define where ICO files live (** Windows path**) # ICONDIRECTORY -# NOTE: If you specify a fully qualified path to an ICON below -# (i.e. "c:\xxx" or "d:\xxxx") +# NOTE: If you specify an absolute path in Windows or Cygwin format to an ICON below +# (i.e. "c:\icons\xxx.ico" or "/usr/share/icons/xxx.ico") # this ICONDIRECTORY will not be prepended # To change the taskbar icon use... -# TRAYICON +# TRAYICON # To define a replacement for the standard X icon for apps w/o specified icons -# DEFAULTICON +# DEFAULTICON # To define substitute icons on a per-window basis use... # ICONS { diff --git a/hw/xwin/win.h b/hw/xwin/win.h index 7c29037ce..774c3ae63 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -404,6 +404,10 @@ typedef struct { /* Did the user explicitly set this screen? */ Bool fExplicitScreen; + + /* Icons for screen window */ + HICON hIcon; + HICON hIconSm; } winScreenInfo, *winScreenInfoPtr; /* diff --git a/hw/xwin/wincreatewnd.c b/hw/xwin/wincreatewnd.c index e6e587f9f..ac663b9f4 100644 --- a/hw/xwin/wincreatewnd.c +++ b/hw/xwin/wincreatewnd.c @@ -72,18 +72,12 @@ winCreateBoundingWindowFullScreen(ScreenPtr pScreen) wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = g_hInstance; - wc.hIcon = - (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, - GetSystemMetrics(SM_CXICON), - GetSystemMetrics(SM_CYICON), 0); + wc.hIcon = pScreenInfo->hIcon; wc.hCursor = 0; wc.hbrBackground = 0; wc.lpszMenuName = NULL; wc.lpszClassName = WINDOW_CLASS; - wc.hIconSm = - (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, - GetSystemMetrics(SM_CXSMICON), - GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE); + wc.hIconSm = pScreenInfo->hIconSm; RegisterClassEx(&wc); /* Set display and screen-specific tooltip text */ @@ -184,18 +178,12 @@ winCreateBoundingWindowWindowed(ScreenPtr pScreen) wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = g_hInstance; - wc.hIcon = - (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, - GetSystemMetrics(SM_CXICON), - GetSystemMetrics(SM_CYICON), 0); + wc.hIcon = pScreenInfo->hIcon; wc.hCursor = 0; wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = WINDOW_CLASS; - wc.hIconSm = - (HICON) LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, - GetSystemMetrics(SM_CXSMICON), - GetSystemMetrics(SM_CYSMICON), LR_DEFAULTSIZE); + wc.hIconSm = pScreenInfo->hIconSm; RegisterClassEx(&wc); /* Get size of work area */ diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c index ed1154b90..5e4c6ae22 100644 --- a/hw/xwin/winprefs.c +++ b/hw/xwin/winprefs.c @@ -39,6 +39,7 @@ #include #include #include +#include #endif #include "win.h" @@ -61,9 +62,6 @@ extern int parse_file(FILE * fp); /* Currently in use command ID, incremented each new menu item created */ static int g_cmdid = STARTMENUID; -/* Local function to handle comma-ified icon names */ -static HICON LoadImageComma(char *fname, int sx, int sy, int flags); - /* * Creates or appends a menu from a MENUPARSED structure */ @@ -585,7 +583,7 @@ winOverrideDefaultIcon(int size) HICON hicon; if (pref.defaultIconName[0]) { - hicon = LoadImageComma(pref.defaultIconName, size, size, 0); + hicon = LoadImageComma(pref.defaultIconName, pref.iconDirectory, size, size, 0); if (hicon == NULL) ErrorF("winOverrideDefaultIcon: LoadImageComma(%s) failed\n", pref.defaultIconName); @@ -607,9 +605,12 @@ winTaskbarIcon(void) hicon = 0; /* First try and load an overridden, if success then return it */ if (pref.trayIconName[0]) { - hicon = LoadImageComma(pref.trayIconName, + hicon = LoadImageComma(pref.trayIconName, pref.iconDirectory, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0); + if (hicon == NULL) + ErrorF("winTaskbarIcon: LoadImageComma(%s) failed\n", + pref.trayIconName); } /* Otherwise return the default */ @@ -624,17 +625,18 @@ winTaskbarIcon(void) } /* + * Handle comma-ified icon names + * * Parse a filename to extract an icon: * If fname is exactly ",nnn" then extract icon from our resource * else if it is "file,nnn" then extract icon nnn from that file * else try to load it as an .ico file and if that fails return NULL */ -static HICON -LoadImageComma(char *fname, int sx, int sy, int flags) +HICON +LoadImageComma(char *fname, char *iconDirectory, int sx, int sy, int flags) { HICON hicon; int i; - char file[PATH_MAX + NAME_MAX + 2]; /* Some input error checking */ if (!fname || !fname[0]) @@ -650,31 +652,67 @@ LoadImageComma(char *fname, int sx, int sy, int flags) MAKEINTRESOURCE(i), IMAGE_ICON, sx, sy, flags); } else { + char *file = malloc(PATH_MAX + NAME_MAX + 2); + Bool convert = FALSE; + + if (!file) + return NULL; + file[0] = 0; - /* Prepend path if not given a "X:\" filename */ + + /* If fname starts 'X:\', it's an absolute Windows path, do nothing */ if (!(fname[0] && fname[1] == ':' && fname[2] == '\\')) { - strcpy(file, pref.iconDirectory); - if (pref.iconDirectory[0]) - if (fname[strlen(fname) - 1] != '\\') - strcat(file, "\\"); +#ifdef __CYGWIN__ + /* If fname starts with '/', it's an absolute cygwin path, we'll + need to convert it */ + if (fname[0] == '/') { + convert = TRUE; + } + else +#endif + if (iconDirectory) { + /* Otherwise, prepend the default icon directory, which + currently must be in absolute Windows path form */ + strcpy(file, iconDirectory); + if (iconDirectory[0]) + if (iconDirectory[strlen(iconDirectory) - 1] != '\\') + strcat(file, "\\"); + } } strcat(file, fname); + /* Trim off any ',index' */ if (strrchr(file, ',')) { - /* Specified as , */ - *(strrchr(file, ',')) = 0; /* End string at comma */ i = atoi(strrchr(fname, ',') + 1); - hicon = ExtractIcon(g_hInstance, file, i); } else { - /* Just an .ico file... */ + i = -1; + } +#ifdef __CYGWIN__ + /* Convert from Cygwin path to Windows path */ + if (convert) { + char *converted_file = cygwin_create_path(CCP_POSIX_TO_WIN_A | CCP_ABSOLUTE, file); + if (converted_file) { + free(file); + file = converted_file; + } + } +#endif + + if (i >= 0) { + /* Specified as , */ + hicon = ExtractIcon(g_hInstance, file, i); + } + else { + /* Specified as just an .ico file */ hicon = (HICON) LoadImage(NULL, file, IMAGE_ICON, sx, sy, LR_LOADFROMFILE | flags); } + free(file); } return hicon; } @@ -696,7 +734,7 @@ winOverrideIcon(char *res_name, char *res_class, char *wmName) if (pref.icon[i].hicon) return pref.icon[i].hicon; - hicon = LoadImageComma(pref.icon[i].iconFile, 0, 0, LR_DEFAULTSIZE); + hicon = LoadImageComma(pref.icon[i].iconFile, pref.iconDirectory, 0, 0, LR_DEFAULTSIZE); if (hicon == NULL) ErrorF("winOverrideIcon: LoadImageComma(%s) failed\n", pref.icon[i].iconFile); diff --git a/hw/xwin/winprefs.h b/hw/xwin/winprefs.h index 36f3f4152..d1fef2ed9 100644 --- a/hw/xwin/winprefs.h +++ b/hw/xwin/winprefs.h @@ -173,4 +173,8 @@ unsigned long HICON winTaskbarIcon(void); HICON winOverrideDefaultIcon(int size); + +HICON +LoadImageComma(char *fname, char *iconDirectory, int sx, int sy, int flags); + #endif diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c index 0f3a89610..3e03c16f4 100644 --- a/hw/xwin/winprocarg.c +++ b/hw/xwin/winprocarg.c @@ -40,6 +40,7 @@ from The Open Group. #include "winconfig.h" #include "winmsg.h" #include "winmonitors.h" +#include "winprefs.h" #ifdef XWIN_CLIPBOARD #include "winclipboard/winclipboard.h" @@ -148,6 +149,13 @@ winInitializeScreenDefaults(void) defaultScreenInfo.fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL; defaultScreenInfo.fIgnoreInput = FALSE; defaultScreenInfo.fExplicitScreen = FALSE; + defaultScreenInfo.hIcon = (HICON) + LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, + GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0); + defaultScreenInfo.hIconSm = (HICON) + LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_XWIN), IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), + LR_DEFAULTSIZE); /* Note that the default screen has been initialized */ fInitializedScreenDefaults = TRUE; @@ -347,7 +355,7 @@ ddxProcessArgument(int argc, char *argv[], int i) ("ddxProcessArgument - screen - Invalid monitor number %d\n", iMonitor); UseMsg(); - exit(0); + exit(1); return 0; } } @@ -396,7 +404,7 @@ ddxProcessArgument(int argc, char *argv[], int i) ("ddxProcessArgument - screen - Invalid monitor number %d\n", iMonitor); UseMsg(); - exit(0); + exit(1); return 0; } @@ -427,7 +435,7 @@ ddxProcessArgument(int argc, char *argv[], int i) ("ddxProcessArgument - screen - Invalid monitor number %d\n", iMonitor); UseMsg(); - exit(0); + exit(1); return 0; } @@ -1104,6 +1112,30 @@ ddxProcessArgument(int argc, char *argv[], int i) return 1; } + if (IS_OPTION("-icon")) { + char *iconspec; + CHECK_ARGS(1); + iconspec = argv[++i]; + screenInfoPtr->hIcon = LoadImageComma(iconspec, NULL, + GetSystemMetrics(SM_CXICON), + GetSystemMetrics(SM_CYICON), + 0); + screenInfoPtr->hIconSm = LoadImageComma(iconspec, NULL, + GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON), + LR_DEFAULTSIZE); + if ((screenInfoPtr->hIcon == NULL) || + (screenInfoPtr->hIconSm == NULL)) { + ErrorF("ddxProcessArgument - icon - Invalid icon specification %s\n", + iconspec); + exit(1); + return 0; + } + + /* Indicate that we have processed the argument */ + return 2; + } + return 0; } -- cgit v1.2.3