diff options
author | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-12-15 19:22:53 +0000 |
---|---|---|
committer | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-12-15 19:22:53 +0000 |
commit | 4347dddf4d8f0b71e9197ecfc3dd5a63d457c03a (patch) | |
tree | dd39181980007ff30d6212beb7d3afbdf920e176 | |
parent | 0e3985b588f99abbb6e96d56999860b143a7e342 (diff) |
xc/programs/Xserver/Imakefile
xc/programs/Xserver/hw/xwin/ChangeLog
xc/programs/Xserver/hw/xwin/Imakefile
xc/programs/Xserver/hw/xwin/InitOutput.c
xc/programs/Xserver/hw/xwin/XWin.rc
xc/programs/Xserver/hw/xwin/win.h
xc/programs/Xserver/hw/xwin/winclipboardthread.c
xc/programs/Xserver/hw/xwin/winclipboardwndproc.c
xc/programs/Xserver/hw/xwin/winclipboardxevents.c
xc/programs/Xserver/hw/xwin/winconfig.c
xc/programs/Xserver/hw/xwin/wincreatewnd.c
xc/programs/Xserver/hw/xwin/winmessages.h
xc/programs/Xserver/hw/xwin/winmouse.c
xc/programs/Xserver/hw/xwin/winmultiwindowwm.c
xc/programs/Xserver/hw/xwin/winmultiwindowwndproc.c
xc/programs/Xserver/hw/xwin/winprocarg.c
xc/programs/Xserver/hw/xwin/winresource.h
xc/programs/Xserver/hw/xwin/winshadddnl.c
xc/programs/Xserver/hw/xwin/winwin32rootlesswndproc.c
//bugs.freedesktop.org/show_bug.cgi?id=1831) attachment #1547
(https://bugs.freedesktop.org/attachment.cgi?id=1547) attachment #1548
(https://bugs.freedesktop.org/attachment.cgi?id=1548): Cygwin/X patches
since 6.8.1, including:
- Support for placing the mainwindow by coordinates and monitor
- Setting default cursor in multiwindow mode
- Added keyboardlayout "French (Switzerland)"
- Fixed crashes after switching videomodes
- Added support for reading the fontpath from /etc/X11/font-dirs
- Make -multiplemonitors for multiwindow modes
- Added support for mice with more than 3 buttons
- Fixed another clipboard bug with Unicode applications
-rw-r--r-- | hw/xwin/ChangeLog | 135 | ||||
-rw-r--r-- | hw/xwin/InitOutput.c | 13 | ||||
-rw-r--r-- | hw/xwin/XWin.rc | 7 | ||||
-rw-r--r-- | hw/xwin/win.h | 20 | ||||
-rw-r--r-- | hw/xwin/winclipboardthread.c | 8 | ||||
-rw-r--r-- | hw/xwin/winclipboardwndproc.c | 8 | ||||
-rw-r--r-- | hw/xwin/winclipboardxevents.c | 4 | ||||
-rw-r--r-- | hw/xwin/winconfig.c | 122 | ||||
-rw-r--r-- | hw/xwin/wincreatewnd.c | 66 | ||||
-rwxr-xr-x | hw/xwin/winmessages.h | 6 | ||||
-rw-r--r-- | hw/xwin/winmouse.c | 35 | ||||
-rw-r--r-- | hw/xwin/winmultiwindowwm.c | 12 | ||||
-rwxr-xr-x | hw/xwin/winmultiwindowwndproc.c | 10 | ||||
-rwxr-xr-x | hw/xwin/winprocarg.c | 241 | ||||
-rw-r--r-- | hw/xwin/winresource.h | 1 | ||||
-rw-r--r-- | hw/xwin/winshadddnl.c | 27 | ||||
-rwxr-xr-x | hw/xwin/winwin32rootlesswndproc.c | 12 | ||||
-rw-r--r-- | hw/xwin/winwndproc.c | 25 |
18 files changed, 678 insertions, 74 deletions
diff --git a/hw/xwin/ChangeLog b/hw/xwin/ChangeLog index 2f5584cc0..5cdbb70e4 100644 --- a/hw/xwin/ChangeLog +++ b/hw/xwin/ChangeLog @@ -1,3 +1,114 @@ +2004-12-14 Alexander Gottwald <ago at freedesktop dot org> + + * InitOutput.c: + * winprocarg.c: + EnumDisplayMonitors is not available on Window NT4 and 95. Resolve + the function dynamicly + +2004-12-08 Alexander Gottwald <ago at freedesktop dot org> + + * InitOutput.c: + * winprocarg.c: + Added support for placing the main window with the @<monitor#>. + Patch by Mark Fisher, small changes by Alexander Gottwald + +2004-12-04 Earle Philhower + + * InitOutput.c: + * win.h: + * wincreatewnd.c: + * winprocarg.c: + Optional position -screen parameter (-screen n WxH+X+Y or + -screen n W H X Y) + +2004-11-24 Alexander Gottwald <ago at freedesktop dot org> + + * winmultiwindowwm.c: + Finally the multiwindow mode defines a default cursor + +2004-11-11 Alexander Gottwald <ago at freedesktop dot org> + + * winconfig.c: + added keyboard layout "French (Switzerland)" + +2004-10-28 Alexander Gottwald <ago at freedesktop dot org> + + * win.h: + add fRetryCreateSurface + * winshaddnl.c (winBltExposedRegionsShadowDDNL): + try to recreate the primary surface if it was lost + * winshaddnl.c (winCreatePrimarySurfaceShadowDDNL): + mark screen to retry creating the primary surface if it failed + +2004-10-23 Alexander Gottwald <ago at freedesktop dot org> + + * winconfig (winConfigFiles): + Simplify /etc/X11/font-dirs parsing + +2004-10-20 Alexander Gottwald <ago at freedesktop dot org> + + * XWin.rc, winresource.h, winwndproc.c: + Add ShowCursor entry to tray menu + +2004-10-20 Alexander Gottwald <ago at freedesktop dot org> + + * Imakefile: + Add ETCX11DIR to DEFINES + * InitOutput.c (InitOutput): + * winconfig.c (winConfigFiles) : + Add entries from /etc/X11/font-dirs to default fontpath + +2004-10-16 Alexander Gottwald <ago at freedesktop dot org> + + * winprocarg.c (winInitializeDefaultScreens, ddxProcessArgument): + * win.h: + Make multiple monitors default for -multiwindow and -mwextwm. + Added a flag to indicate if the user has overridden the multimonitor + settings. (Øyvind Harboe, Alexander Gottwald) + +2004-10-05 Alexander Gottwald <ago at freedesktop dot org> + + * XWin.rc: + Set the dialogstyle to DS_CENTERMOUSE. Dialogs will now popup on the + monitor where the mouse is and not on the center of the whole desktop. + +2004-10-02 Alexander Gottwald <ago at freedesktop dot org> + + * winmouse.c (winMouseProc): + Make sure buttons 1-3 are mouse buttons and wheel events are 4-5 + Document code + Replace ErrorF with appropriate winMsg + use a symbolic name for the wheel event offset + +2004-10-01 Alexander Gottwald <ago at freedesktop dot org> + + * wincreatewnd.c (winCreateBoundingWindowWindowed): + Do not adjust workarea if native windowmanager is used + +2004-09-22 Kensuke Matsuzaki + + * winclipboardthread.c (winClipboardErrorHandler): + * winclipboardwndproc.c (winClipboardWindowProc): + * winclipboardxevents.c (winClipboardFlushXEvents): + Fix clipboard bug with unicode applications. + +2004-09-16 Alexander Gottwald <ago at freedesktop dot org> + + * wincreatewnd.c (winCreateBoundingWindowWindowed): + Remove code which prevented the use from specifying the window + size in nodecoration mode. + +2004-08-26 Chris B <news at sempermax dot com> + + * win.h, winmessages.h: + Add defines for WM_XBUTTON + * winmouse.c (winMouseProc): + Query number of mouse buttons from windows. + * winmultiwindowwndproc.c (winTopLevelWindowProc): + * winwin32rootlesswndproc.c (winMWExtWMWindowProc): + * winwndproc.c (winWindowProc): + Handle WM_XBUTTON messages. + 2004-08-02 Kensuke Matsuzaki * winclipboardthread.c winclipboardwndproc.c: @@ -7,18 +118,18 @@ fUseUnicode, because it don't mean wheather Windows support Unicode or not. -2004-07-31 Alexander Gottwald <ago@freedesktop.org> +2004-07-31 Alexander Gottwald <ago at freedesktop dot org> * win.h: adjust prototype for winInitCmapPrivates to match Egberts change. -2004-07-30 Egbert Eich <eich@freedesktop.org> +2004-07-30 Egbert Eich <eich at freedesktop dot org> * winallpriv.c: (winInitCmapPrivates): test if colormap with index really exists in the list of installed maps before using it. -2004-07-09 Alexander Gottwald <ago@freedesktop.org> +2004-07-09 Alexander Gottwald <ago at freedesktop dot org> * winconfig.c: Add entry for irish layout (ie) * InitOutput.c, winerror.c, winglobals.c: rename g_fUseMsg to @@ -27,38 +138,38 @@ -silent-dup-error to allow silent termination if another instance of XWin was found running -2004-06-27 Alexander Gottwald <ago@freedesktop.org> +2004-06-27 Alexander Gottwald <ago at freedesktop dot org> * winconfig.c: Add entry for us layout. This changes not much but removes a strange error message about the unknown us layout. -2004-06-24 Alexander Gottwald <ago@freedesktop.org> +2004-06-24 Alexander Gottwald <ago at freedesktop dot org> * InitOutput.c: Check for textmode mounted /tmp and print a warning -2004-06-15 Harold Hunt <huntharo@msu.edu> +2004-06-15 Harold Hunt <huntharo at msu dot edu> * windialogs.c: Fix path to locally installed changelog for the About dialog box. -2004-05-27 Alexander Gottwald <ago@freedesktop.org> +2004-05-27 Alexander Gottwald <ago at freedesktop dot org> * winpriv.c: Create win32 window if not already created * winmultiwindowwindow.c: Export winCreateWindowWindow -2004-05-27 Alexander Gottwald <ago@freedesktop.org> +2004-05-27 Alexander Gottwald <ago at freedesktop dot org> * win.h: Allow CYGDEBUG to defined in the Makefile * winwindow.h: Allow CYGWINDOWING_DEBUG to defined in the Makefile -2004-05-19 Alexander Gottwald <ago@freedesktop.org> +2004-05-19 Alexander Gottwald <ago at freedesktop dot org> * winmultiwindowicons.c (winInitGlobalIcons): Load the small default icon too * winprefs.h, winprefs.c (winOverrideDefaultIcon): Takes the iconsize as parameter -2004-05-19 Alexander Gottwald <ago@freedesktop.org> +2004-05-19 Alexander Gottwald <ago at freedesktop dot org> * win.h, winmultiwindowicons.c (winXIconToHICON): Takes iconsize as parameter @@ -83,14 +194,14 @@ winwin32rootless.c (winMWExtWMDestroyFrame): Use winDestroyIcon to free the icon without destroying the global icon. -2004-05-17 Alexander Gottwald <ago@freedesktop.org> +2004-05-17 Alexander Gottwald <ago at freedesktop dot org> * windialogs.c (winExitDlgProc, winAboutDlgProc), winmultiwindowwndproc.c (winTopLevelWindowProc), winwndproc.c (winWindowProc): Check if g_fSoftwareCursor is set before calling ShowCursor. -2004-05-09 Dan Wilks <Dan_Wilks@intuit.com> +2004-05-09 Dan Wilks <Dan_Wilks at intuit dot com> * winclipboard.h: Add extern prototypes for winDebug, winErrorFVerb copied from winmsg.h. diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 673a0aa98..266dbdb16 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -30,9 +30,7 @@ from The Open Group. #include "win.h" #include "winmsg.h" -#ifdef XWIN_XF86CONFIG #include "winconfig.h" -#endif #include "winprefs.h" #include "X11/Xlocale.h" #include <mntent.h> @@ -437,9 +435,15 @@ winUseMsg (void) "\tSpecify an optional refresh rate to use in fullscreen mode\n" "\twith a DirectDraw engine.\n"); - ErrorF ("-screen scr_num [width height]\n" + ErrorF ("-screen scr_num [width height [x y] | [[WxH[+X+Y]][@m]] ]\n" "\tEnable screen scr_num and optionally specify a width and\n" - "\theight for that screen.\n"); + "\theight and initial position for that screen. Additionally\n" + "\ta monitor number can be specified to start the server on,\n" + "\tat which point, all coordinates become relative to that\n" + "\tmonitor (Not for Windows NT4 and 95). Examples:\n" + "\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\n" + "\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n" + "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n"); ErrorF ("-lesspointer\n" "\tHide the windows mouse pointer when it is over an inactive\n" @@ -635,6 +639,7 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) 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 /* Load preferences from XWinrc file */ diff --git a/hw/xwin/XWin.rc b/hw/xwin/XWin.rc index 446174f64..dcde0b52d 100644 --- a/hw/xwin/XWin.rc +++ b/hw/xwin/XWin.rc @@ -37,7 +37,7 @@ /* About */ ABOUT_BOX DIALOG DISCARDABLE 32, 32, 240, 105 -STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTER +STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTERMOUSE CAPTION "About Cygwin/X" FONT 8, "MS Sans Serif" BEGIN @@ -59,7 +59,7 @@ END /* Depth change */ DEPTH_CHANGE_BOX DIALOG DISCARDABLE 32, 32, 180, 100 -STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | DS_CENTER +STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | DS_CENTERMOUSE FONT 8, "MS Sans Serif" CAPTION "Cygwin/X" BEGIN @@ -73,7 +73,7 @@ END /* Exit */ EXIT_DIALOG DIALOG DISCARDABLE 32, 32, 180, 78 -STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTER +STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_TABSTOP | DS_CENTERMOUSE FONT 8, "MS Sans Serif" CAPTION "Cygwin/X - Exit?" BEGIN @@ -94,6 +94,7 @@ BEGIN POPUP "TRAYICON_MENU" BEGIN MENUITEM "&Hide Root Window", ID_APP_HIDE_ROOT + MENUITEM "Show Cursor", ID_APP_SHOWCURSOR MENUITEM "&About...", ID_APP_ABOUT MENUITEM SEPARATOR MENUITEM "E&xit", ID_APP_EXIT diff --git a/hw/xwin/win.h b/hw/xwin/win.h index 3660b9623..f1d85af3e 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -48,6 +48,17 @@ #define CYGDEBUG NO #endif +/* WM_XBUTTON Messages. They should go into w32api. */ +#ifndef WM_XBUTTONDOWN +# define WM_XBUTTONDOWN 523 +#endif +#ifndef WM_XBUTTONUP +# define WM_XBUTTONUP 524 +#endif +#ifndef WM_XBUTTONDBLCLK +# define WM_XBUTTONDBLCLK 525 +#endif + #define NEED_EVENTS #define WIN_DEFAULT_BPP 0 @@ -384,6 +395,11 @@ typedef struct DWORD dwHeight_mm; DWORD dwPaddedWidth; + /* Did the user specify a screen position? */ + Bool fUserGavePosition; + DWORD dwInitialX; + DWORD dwInitialY; + /* * dwStride is the number of whole pixels that occupy a scanline, * including those pixels that are not displayed. This is basically @@ -414,6 +430,9 @@ typedef struct #ifdef XWIN_MULTIWINDOW Bool fMultiWindow; #endif +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) + Bool fMultiMonitorOverride; +#endif Bool fMultipleMonitors; Bool fLessPointer; Bool fScrollbars; @@ -497,6 +516,7 @@ typedef struct _winPrivScreenRec LPDIRECTDRAW4 pdd4; LPDIRECTDRAWSURFACE4 pddsShadow4; LPDIRECTDRAWSURFACE4 pddsPrimary4; + BOOL fRetryCreateSurface; /* Privates used by both shadow fb DirectDraw servers */ LPDIRECTDRAWCLIPPER pddcPrimary; diff --git a/hw/xwin/winclipboardthread.c b/hw/xwin/winclipboardthread.c index 0996b43f5..4778d2a3b 100644 --- a/hw/xwin/winclipboardthread.c +++ b/hw/xwin/winclipboardthread.c @@ -429,8 +429,12 @@ winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr) pErr->error_code, pszErrorMsg, sizeof (pszErrorMsg)); - ErrorF ("winClipboardErrorHandler - ERROR: \n\t%s\n", pszErrorMsg); - + ErrorF ("winClipboardErrorHandler - ERROR: \n\t%s\n" + "\tSerial: %d, Request Code: %d, Minor Code: %d\n", + pszErrorMsg, + pErr->serial, + pErr->request_code, + pErr->minor_code); return 0; } diff --git a/hw/xwin/winclipboardwndproc.c b/hw/xwin/winclipboardwndproc.c index 722141924..cfc97a51b 100644 --- a/hw/xwin/winclipboardwndproc.c +++ b/hw/xwin/winclipboardwndproc.c @@ -44,6 +44,7 @@ */ extern Bool g_fUseUnicode; +extern Bool g_fUnicodeSupport; extern void *g_pClipboardDisplay; extern Window g_iClipboardWindow; extern Atom g_atomLastOwnedSelection; @@ -445,7 +446,7 @@ winClipboardWindowProc (HWND hwnd, UINT message, if (message == WM_RENDERALLFORMATS) fConvertToUnicode = FALSE; else - fConvertToUnicode = g_fUseUnicode && (CF_UNICODETEXT == wParam); + fConvertToUnicode = g_fUnicodeSupport && (CF_UNICODETEXT == wParam); /* Request the selection contents */ iReturn = XConvertSelection (pDisplay, @@ -521,10 +522,9 @@ winClipboardWindowProc (HWND hwnd, UINT message, if (WIN_XEVENTS_NOTIFY != iReturn) { /* Paste no data, to satisfy required call to SetClipboardData */ - if (fConvertToUnicode) + if (g_fUnicodeSupport) SetClipboardData (CF_UNICODETEXT, NULL); - else - SetClipboardData (CF_TEXT, NULL); + SetClipboardData (CF_TEXT, NULL); } /* Special handling for WM_RENDERALLFORMATS */ diff --git a/hw/xwin/winclipboardxevents.c b/hw/xwin/winclipboardxevents.c index 3d4444168..6a6d8ad2e 100644 --- a/hw/xwin/winclipboardxevents.c +++ b/hw/xwin/winclipboardxevents.c @@ -135,8 +135,8 @@ winClipboardFlushXEvents (HWND hwnd, iReturn = XChangeProperty (pDisplay, event.xselectionrequest.requestor, event.xselectionrequest.property, - event.xselectionrequest.target, - sizeof (atomTargetArr[0]), + XA_ATOM, + 32, PropModeReplace, (unsigned char *) atomTargetArr, (sizeof (atomTargetArr) diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c index 8660c5ab9..c598ae855 100644 --- a/hw/xwin/winconfig.c +++ b/hw/xwin/winconfig.c @@ -247,6 +247,7 @@ WinKBLayoutRec winKBLayouts[] = { { 0x40b, -1, "pc105", "fi", NULL, NULL, "Finnish"}, { 0x40c, -1, "pc105", "fr", NULL, NULL, "French (Standard)"}, { 0x80c, -1, "pc105", "be", NULL, NULL, "French (Belgian)"}, + { 0x100c, -1, "pc105", "fr_CH", NULL, NULL, "French (Switzerland)"}, { 0x410, -1, "pc105", "it", NULL, NULL, "Italian"}, { 0x411, 7, "jp106", "jp", NULL, NULL, "Japanese"}, { 0x813, -1, "pc105", "be", NULL, NULL, "Dutch (Belgian)"}, @@ -730,6 +731,127 @@ winConfigFiles () return TRUE; } +#else +Bool +winConfigFiles () +{ + MessageType from; + + /* Fontpath */ + from = X_DEFAULT; + + if (g_cmdline.fontPath) + { + from = X_CMDLINE; + defaultFontPath = g_cmdline.fontPath; + } + else + { + /* Open fontpath configuration file */ + FILE *fontdirs = fopen(ETCX11DIR "/font-dirs", "rt"); + if (fontdirs != NULL) + { + char buffer[256]; + int needs_sep = TRUE; + int comment_block = FALSE; + + /* get defautl fontpath */ + char *fontpath = xstrdup(defaultFontPath); + size_t size = strlen(fontpath); + + /* read all lines */ + while (!feof(fontdirs)) + { + size_t blen; + char *hashchar; + char *str; + int has_eol = FALSE; + + /* read one line */ + str = fgets(buffer, sizeof(buffer), fontdirs); + if (str == NULL) /* stop on error or eof */ + break; + + if (strchr(str, '\n') != NULL) + has_eol = TRUE; + + /* check if block is continued comment */ + if (comment_block) + { + /* ignore all input */ + *str = 0; + blen = 0; + if (has_eol) /* check if line ended in this block */ + comment_block = FALSE; + } + else + { + /* find comment character. ignore all trailing input */ + hashchar = strchr(str, '#'); + if (hashchar != NULL) + { + *hashchar = 0; + if (!has_eol) /* mark next block as continued comment */ + comment_block = TRUE; + } + } + + /* strip whitespaces from beginning */ + while (*str == ' ' || *str == '\t') + str++; + + /* get size, strip whitespaces from end */ + blen = strlen(str); + while (blen > 0 && (str[blen-1] == ' ' || + str[blen-1] == '\t' || str[blen-1] == '\n')) + { + str[--blen] = 0; + } + + /* still something left to add? */ + if (blen > 0) + { + size_t newsize = size + blen; + /* reserve one character more for ',' */ + if (needs_sep) + newsize++; + + /* allocate memory */ + if (fontpath == NULL) + fontpath = malloc(newsize+1); + else + fontpath = realloc(fontpath, newsize+1); + + /* add separator */ + if (needs_sep) + { + fontpath[size] = ','; + size++; + needs_sep = FALSE; + } + + /* mark next line as new entry */ + if (has_eol) + needs_sep = TRUE; + + /* add block */ + strncpy(fontpath + size, str, blen); + fontpath[newsize] = 0; + size = newsize; + } + } + + /* cleanup */ + fclose(fontdirs); + from = X_CONFIG; + defaultFontPath = xstrdup(fontpath); + free(fontpath); + } + } + winMsg (from, "FontPath set to \"%s\"\n", defaultFontPath); + + return TRUE; +} #endif diff --git a/hw/xwin/wincreatewnd.c b/hw/xwin/wincreatewnd.c index 7a1c6f352..7b3fe21d0 100644 --- a/hw/xwin/wincreatewnd.c +++ b/hw/xwin/wincreatewnd.c @@ -142,6 +142,8 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; int iWidth = pScreenInfo->dwUserWidth; int iHeight = pScreenInfo->dwUserHeight; + int iPosX; + int iPosY; HWND *phwnd = &pScreenPriv->hwndScreen; WNDCLASS wc; RECT rcClient, rcWorkArea; @@ -193,6 +195,18 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) /* Adjust for auto-hide taskbars */ winAdjustForAutoHide (&rcWorkArea); + /* Did the user specify a position? */ + if (pScreenInfo->fUserGavePosition) + { + iPosX = pScreenInfo->dwInitialX; + iPosY = pScreenInfo->dwInitialY; + } + else + { + iPosX = rcWorkArea.left; + iPosY = rcWorkArea.top; + } + /* Did the user specify a height and width? */ if (pScreenInfo->fUserGaveHeightAndWidth) { @@ -240,24 +254,6 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) + GetSystemMetrics (SM_CYCAPTION); } } - else - { - /* - * User gave a width and height but also said no decoration. - * In this case we have to ignore the requested width and height - * and instead use the largest possible window that we can. - */ - if (pScreenInfo->fMultipleMonitors) - { - iWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN); - iHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN); - } - else - { - iWidth = GetSystemMetrics (SM_CXSCREEN); - iHeight = GetSystemMetrics (SM_CYSCREEN); - } - } } else { @@ -289,20 +285,30 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) /* We cannot have scrollbars if we do not have a window border */ pScreenInfo->fScrollbars = FALSE; } + + if (TRUE +#ifdef XWIN_MULTIWINDOWEXTWM + && !pScreenInfo->fMWExtWM +#endif +#ifdef XWIN_MULTIWINDOW + && !pScreenInfo->fMultiWindow +#endif + ) + { + /* Trim window width to fit work area */ + if (iWidth > (rcWorkArea.right - rcWorkArea.left)) + iWidth = rcWorkArea.right - rcWorkArea.left; - /* Trim window width to fit work area */ - if (iWidth > (rcWorkArea.right - rcWorkArea.left)) - iWidth = rcWorkArea.right - rcWorkArea.left; - - /* Trim window height to fit work area */ - if (iHeight >= (rcWorkArea.bottom - rcWorkArea.top)) - iHeight = rcWorkArea.bottom - rcWorkArea.top; + /* Trim window height to fit work area */ + if (iHeight >= (rcWorkArea.bottom - rcWorkArea.top)) + iHeight = rcWorkArea.bottom - rcWorkArea.top; #if CYGDEBUG - winDebug ("winCreateBoundingWindowWindowed - Adjusted width: %d "\ - "height: %d\n", - iWidth, iHeight); + winDebug ("winCreateBoundingWindowWindowed - Adjusted width: %d "\ + "height: %d\n", + iWidth, iHeight); #endif + } /* Set display and screen-specific tooltip text */ if (g_pszQueryHost != NULL) @@ -322,8 +328,8 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) WINDOW_CLASS, /* Class name */ szTitle, /* Window name */ dwWindowStyle, - rcWorkArea.left, /* Horizontal position */ - rcWorkArea.top, /* Vertical position */ + iPosX, /* Horizontal position */ + iPosY, /* Vertical position */ iWidth, /* Right edge */ iHeight, /* Bottom edge */ (HWND) NULL, /* No parent or owner window */ diff --git a/hw/xwin/winmessages.h b/hw/xwin/winmessages.h index 8fb8fe4cd..3896fb48c 100755 --- a/hw/xwin/winmessages.h +++ b/hw/xwin/winmessages.h @@ -523,9 +523,9 @@ static const char *MESSAGE_NAMES[1024] = { "WM_MBUTTONUP", "WM_MBUTTONDBLCLK", "WM_MOUSEWHEEL", - "523", - "524", - "525", + "WM_XBUTTONDOWN", + "WM_XBUTTONUP", + "WM_XBUTTONDBLCLK", "526", "527", "WM_PARENTNOTIFY", diff --git a/hw/xwin/winmouse.c b/hw/xwin/winmouse.c index 46850652b..93b38acd4 100644 --- a/hw/xwin/winmouse.c +++ b/hw/xwin/winmouse.c @@ -64,23 +64,44 @@ winMouseCtrl (DeviceIntPtr pDevice, PtrCtrl *pCtrl) int winMouseProc (DeviceIntPtr pDeviceInt, int iState) { - CARD8 map[6]; + int lngMouseButtons, i; + int lngWheelEvents = 2; + CARD8 *map; DevicePtr pDevice = (DevicePtr) pDeviceInt; switch (iState) { case DEVICE_INIT: - map[1] = 1; - map[2] = 2; - map[3] = 3; - map[4] = 4; - map[5] = 5; + /* Get number of mouse buttons */ + lngMouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS); + + /* Mapping of windows events to X events: + * LEFT:1 MIDDLE:2 RIGHT:3 + * SCROLL_UP:4 SCROLL_DOWN:5 + * XBUTTON 1:6 XBUTTON 2:7 ... + * + * To map scroll wheel correctly we need at least the 3 normal buttons + */ + if (lngMouseButtons < 3) + lngMouseButtons = 3; + winMsg(X_PROBED, "%d mouse buttons found\n", lngMouseButtons); + + /* allocate memory: + * number of buttons + 2x mouse wheel event + 1 extra (offset for map) + */ + map = malloc(sizeof(CARD8) * (lngMouseButtons + lngWheelEvents + 1)); + + /* initalize button map */ + map[0] = 0; + for (i=1; i <= lngMouseButtons + lngWheelEvents; i++) + map[i] = i; InitPointerDeviceStruct (pDevice, map, - 5, /* Buttons 4 and 5 are mouse wheel events */ + lngMouseButtons + lngWheelEvents, miPointerGetMotionEvents, winMouseCtrl, miPointerGetMotionBufferSize ()); + free(map); #if defined(XFree86Server) && defined(XINPUT) g_winMouseButtonMap = pDeviceInt->button->map; diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index 786b4e001..3c82aee90 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -43,6 +43,7 @@ #include <X11/Xlocale.h> #include <X11/Xproto.h> #include <X11/Xutil.h> +#include <X11/cursorfont.h> /* Fixups to prevent collisions between Windows and X headers */ #define ATOM DWORD @@ -180,7 +181,6 @@ static jmp_buf g_jmpXMsgProcEntry; static Bool g_shutdown = FALSE; static Bool redirectError = FALSE; - /* * PushMessage - Push a message onto the queue */ @@ -1184,6 +1184,16 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg) pWMInfo->atmPrivMap = XInternAtom (pWMInfo->pDisplay, WIN_HWND_CACHE, False); + + + if (1) { + Cursor cursor = XCreateFontCursor (pWMInfo->pDisplay, XC_left_ptr); + if (cursor) + { + XDefineCursor (pWMInfo->pDisplay, DefaultRootWindow(pWMInfo->pDisplay), cursor); + XFreeCursor (pWMInfo->pDisplay, cursor); + } + } } diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index ff18f2e42..3ebd0be7d 100755 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -628,6 +628,16 @@ winTopLevelWindowProc (HWND hwnd, UINT message, break; return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam); + case WM_XBUTTONDBLCLK: + case WM_XBUTTONDOWN: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam); + case WM_XBUTTONUP: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam); + case WM_MOUSEWHEEL: #if CYGMULTIWINDOW_DEBUG ErrorF ("winTopLevelWindowProc - WM_MOUSEWHEEL\n"); diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c index 0032a9152..dabb606a3 100755 --- a/hw/xwin/winprocarg.c +++ b/hw/xwin/winprocarg.c @@ -52,6 +52,55 @@ extern Bool g_fNoHelpMessageBox; extern Bool g_fSoftwareCursor; extern Bool g_fSilentDupError; +/* globals required by callback function for monitor information */ +struct GetMonitorInfoData { + int requestedMonitor; + int monitorNum; + Bool bUserSpecifiedMonitor; + Bool bMonitorSpecifiedExists; + int monitorOffsetX; + int monitorOffsetY; + int monitorHeight; + int monitorWidth; +}; + +typedef BOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM); +ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors; + +BOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data); + +Bool QueryMonitor(int index, struct GetMonitorInfoData *data) +{ + /* Load EnumDisplayMonitors from DLL */ + HMODULE user32; + FARPROC func; + user32 = LoadLibrary("user32.dll"); + if (user32 == NULL) + { + winW32Error(2, "Could not open user32.dll"); + return FALSE; + } + func = GetProcAddress(user32, "EnumDisplayMonitors"); + if (func == NULL) + { + winW32Error(2, "Could not resolve EnumDisplayMonitors: "); + return FALSE; + } + _EnumDisplayMonitors = (ENUMDISPLAYMONITORSPROC)func; + + /* prepare data */ + if (data == NULL) + return FALSE; + memset(data, 0, sizeof(*data)); + data->requestedMonitor = index; + + /* query information */ + _EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data); + + /* cleanup */ + FreeLibrary(user32); + return TRUE; +} /* * Function prototypes @@ -70,7 +119,6 @@ void OsVendorVErrorF (const char *pszFormat, va_list va_args); void winInitializeDefaultScreens (void); - /* * Process arguments on the command line */ @@ -112,6 +160,7 @@ winInitializeDefaultScreens (void) g_ScreenInfo[i].dwUserHeight = dwHeight; g_ScreenInfo[i].fUserGaveHeightAndWidth = WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH; + g_ScreenInfo[i].fUserGavePosition = FALSE; g_ScreenInfo[i].dwBPP = WIN_DEFAULT_BPP; g_ScreenInfo[i].dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES; #ifdef XWIN_EMULATEPSEUDO @@ -128,6 +177,9 @@ winInitializeDefaultScreens (void) #ifdef XWIN_MULTIWINDOW g_ScreenInfo[i].fMultiWindow = FALSE; #endif +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) + g_ScreenInfo[i].fMultiMonitorOverride = FALSE; +#endif g_ScreenInfo[i].fMultipleMonitors = FALSE; g_ScreenInfo[i].fLessPointer = FALSE; g_ScreenInfo[i].fScrollbars = FALSE; @@ -247,7 +299,8 @@ ddxProcessArgument (int argc, char *argv[], int i) { int iArgsProcessed = 1; int nScreenNum; - int iWidth, iHeight; + int iWidth, iHeight, iX, iY; + int iMonitor; #if CYGDEBUG winDebug ("ddxProcessArgument - screen - argc: %d i: %d\n", @@ -272,8 +325,41 @@ ddxProcessArgument (int argc, char *argv[], int i) return 0; } + /* look for @m where m is monitor number */ + if (i + 2 < argc + && 1 == sscanf(argv[i + 2], "@%d", (int *) &iMonitor)) + { + struct GetMonitorInfoData data; + if (!QueryMonitor(iMonitor, &data)) + { + ErrorF ("ddxProcessArgument - screen - " + "Querying monitors is not supported on NT4 and Win95\n"); + } else if (data.bMonitorSpecifiedExists == TRUE) + { + winErrorFVerb(2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); + iArgsProcessed = 3; + g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE; + g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; + g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth; + g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight; + g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth; + g_ScreenInfo[nScreenNum].dwUserHeight = data.monitorHeight; + g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX; + g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY; + } + else + { + /* monitor does not exist, error out */ + ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n", + iMonitor); + UseMsg (); + exit (0); + return 0; + } + } + /* Look for 'WxD' or 'W D' */ - if (i + 2 < argc + else if (i + 2 < argc && 2 == sscanf (argv[i + 2], "%dx%d", (int *) &iWidth, (int *) &iHeight)) @@ -285,6 +371,70 @@ ddxProcessArgument (int argc, char *argv[], int i) g_ScreenInfo[nScreenNum].dwHeight = iHeight; g_ScreenInfo[nScreenNum].dwUserWidth = iWidth; g_ScreenInfo[nScreenNum].dwUserHeight = iHeight; + /* Look for WxD+X+Y */ + if (2 == sscanf (argv[i + 2], "%*dx%*d+%d+%d", + (int *) &iX, + (int *) &iY)) + { + winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X+Y'' arg\n"); + g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; + g_ScreenInfo[nScreenNum].dwInitialX = iX; + g_ScreenInfo[nScreenNum].dwInitialY = iY; + + /* look for WxD+X+Y@m where m is monitor number. take X,Y to be offsets from monitor's root position */ + if (1 == sscanf (argv[i + 2], "%*dx%*d+%*d+%*d@%d", + (int *) &iMonitor)) + { + struct GetMonitorInfoData data; + if (!QueryMonitor(iMonitor, &data)) + { + ErrorF ("ddxProcessArgument - screen - " + "Querying monitors is not supported on NT4 and Win95\n"); + } else if (data.bMonitorSpecifiedExists == TRUE) + { + g_ScreenInfo[nScreenNum].dwInitialX += data.monitorOffsetX; + g_ScreenInfo[nScreenNum].dwInitialY += data.monitorOffsetY; + } + else + { + /* monitor does not exist, error out */ + ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n", + iMonitor); + UseMsg (); + exit (0); + return 0; + } + + } + } + + /* look for WxD@m where m is monitor number */ + else if (1 == sscanf(argv[i + 2], "%*dx%*d@%d", + (int *) &iMonitor)) + { + struct GetMonitorInfoData data; + if (!QueryMonitor(iMonitor, &data)) + { + ErrorF ("ddxProcessArgument - screen - " + "Querying monitors is not supported on NT4 and Win95\n"); + } else if (data.bMonitorSpecifiedExists == TRUE) + { + winErrorFVerb (2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); + g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; + g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX; + g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY; + } + else + { + /* monitor does not exist, error out */ + ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n", + iMonitor); + UseMsg (); + exit (0); + return 0; + } + + } } else if (i + 3 < argc && 1 == sscanf (argv[i + 2], "%d", @@ -299,6 +449,18 @@ ddxProcessArgument (int argc, char *argv[], int i) g_ScreenInfo[nScreenNum].dwHeight = iHeight; g_ScreenInfo[nScreenNum].dwUserWidth = iWidth; g_ScreenInfo[nScreenNum].dwUserHeight = iHeight; + if (i + 5 < argc + && 1 == sscanf (argv[i + 4], "%d", + (int *) &iX) + && 1 == sscanf (argv[i + 5], "%d", + (int *) &iY)) + { + winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X Y'' arg\n"); + iArgsProcessed = 6; + g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; + g_ScreenInfo[nScreenNum].dwInitialX = iX; + g_ScreenInfo[nScreenNum].dwInitialY = iY; + } } else { @@ -399,12 +561,16 @@ ddxProcessArgument (int argc, char *argv[], int i) /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { + if (!g_ScreenInfo[j].fMultiMonitorOverride) + g_ScreenInfo[j].fMultipleMonitors = FALSE; g_ScreenInfo[j].fFullScreen = TRUE; } } else { /* Parameter is for a single screen */ + if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride) + g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE; g_ScreenInfo[g_iLastScreen].fFullScreen = TRUE; } @@ -451,12 +617,16 @@ ddxProcessArgument (int argc, char *argv[], int i) /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { + if (!g_ScreenInfo[j].fMultiMonitorOverride) + g_ScreenInfo[j].fMultipleMonitors = FALSE; g_ScreenInfo[j].fDecoration = FALSE; } } else { /* Parameter is for a single screen */ + if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride) + g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE; g_ScreenInfo[g_iLastScreen].fDecoration = FALSE; } @@ -478,12 +648,16 @@ ddxProcessArgument (int argc, char *argv[], int i) /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { + if (!g_ScreenInfo[j].fMultiMonitorOverride) + g_ScreenInfo[j].fMultipleMonitors = TRUE; g_ScreenInfo[j].fMWExtWM = TRUE; } } else { /* Parameter is for a single screen */ + if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride) + g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE; g_ScreenInfo[g_iLastScreen].fMWExtWM = TRUE; } @@ -505,12 +679,16 @@ ddxProcessArgument (int argc, char *argv[], int i) /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { + if (!g_ScreenInfo[j].fMultiMonitorOverride) + g_ScreenInfo[j].fMultipleMonitors = FALSE; g_ScreenInfo[j].fRootless = TRUE; } } else { /* Parameter is for a single screen */ + if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride) + g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE; g_ScreenInfo[g_iLastScreen].fRootless = TRUE; } @@ -532,12 +710,16 @@ ddxProcessArgument (int argc, char *argv[], int i) /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { + if (!g_ScreenInfo[j].fMultiMonitorOverride) + g_ScreenInfo[j].fMultipleMonitors = TRUE; g_ScreenInfo[j].fMultiWindow = TRUE; } } else { /* Parameter is for a single screen */ + if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride) + g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE; g_ScreenInfo[g_iLastScreen].fMultiWindow = TRUE; } @@ -560,12 +742,14 @@ ddxProcessArgument (int argc, char *argv[], int i) /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { + g_ScreenInfo[j].fMultiMonitorOverride = TRUE; g_ScreenInfo[j].fMultipleMonitors = TRUE; } } else { /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride = TRUE; g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE; } @@ -574,6 +758,36 @@ ddxProcessArgument (int argc, char *argv[], int i) } /* + * Look for the '-nomultiplemonitors' argument + */ + if (IS_OPTION ("-nomultiplemonitors") + || IS_OPTION ("-nomultimonitors")) + { + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; + + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_ScreenInfo[j].fMultiMonitorOverride = TRUE; + g_ScreenInfo[j].fMultipleMonitors = FALSE; + } + } + else + { + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride = TRUE; + g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE; + } + + /* Indicate that we have processed this argument */ + return 1; + } + + + /* * Look for the '-scrollbars' argument */ if (IS_OPTION ("-scrollbars")) @@ -1254,3 +1468,24 @@ winLogVersionInfo (void) ErrorF ("Release: %s\n\n", VERSION_STRING); ErrorF ("Contact: %s\n\n", VENDOR_CONTACT); } + +/* + * getMonitorInfo - callback function used to return information from the enumeration of monitors attached + */ + +BOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data) +{ + struct GetMonitorInfoData* data = (struct GetMonitorInfoData*)_data; + // only get data for monitor number specified in <data> + data->monitorNum++; + if (data->monitorNum == data->requestedMonitor) + { + data->bMonitorSpecifiedExists = TRUE; + data->monitorOffsetX = rect->left; + data->monitorOffsetY = rect->top; + data->monitorHeight = rect->bottom - rect->top; + data->monitorWidth = rect->right - rect->left; + return FALSE; + } + return TRUE; +} diff --git a/hw/xwin/winresource.h b/hw/xwin/winresource.h index 300fcd198..ca69521a1 100644 --- a/hw/xwin/winresource.h +++ b/hw/xwin/winresource.h @@ -48,6 +48,7 @@ #define ID_APP_HIDE_ROOT 201 #define ID_APP_ALWAYS_ON_TOP 202 #define ID_APP_ABOUT 203 +#define ID_APP_SHOWCURSOR 204 #define ID_ABOUT_UG 300 #define ID_ABOUT_FAQ 301 diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c index c9e629298..2ec28c957 100644 --- a/hw/xwin/winshadddnl.c +++ b/hw/xwin/winshadddnl.c @@ -141,11 +141,21 @@ winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen) &ddsd, &pScreenPriv->pddsPrimary4, NULL); + pScreenPriv->fRetryCreateSurface = FALSE; if (FAILED (ddrval)) { - ErrorF ("winCreatePrimarySurfaceShadowDDNL - Could not create primary " - "surface: %08x\n", - (unsigned int) ddrval); + if (ddrval == DDERR_NOEXCLUSIVEMODE) + { + /* Recreating the surface failed. Mark screen to retry later */ + pScreenPriv->fRetryCreateSurface = TRUE; + winDebug ("winCreatePrimarySurfaceShadowDDNL - Could not create " + "primary surface: DDERR_NOEXCLUSIVEMODE\n"); + } + else + { + ErrorF ("winCreatePrimarySurfaceShadowDDNL - Could not create " + "primary surface: %08x\n", (unsigned int) ddrval); + } return FALSE; } @@ -1055,6 +1065,17 @@ winBltExposedRegionsShadowDDNL (ScreenPtr pScreen) Bool fReturn = TRUE; int i; + /* Quite common case. The primary surface was lost (maybe because of depth + * change). Try to create a new primary surface. Bail out if this fails */ + if (pScreenPriv->pddsPrimary4 == NULL && pScreenPriv->fRetryCreateSurface && + !winCreatePrimarySurfaceShadowDDNL(pScreen)) + { + Sleep(100); + return FALSE; + } + if (pScreenPriv->pddsPrimary4 == NULL) + return FALSE; + /* BeginPaint gives us an hdc that clips to the invalidated region */ hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps); if (hdcUpdate == NULL) diff --git a/hw/xwin/winwin32rootlesswndproc.c b/hw/xwin/winwin32rootlesswndproc.c index 00d41d101..0c1ae555c 100755 --- a/hw/xwin/winwin32rootlesswndproc.c +++ b/hw/xwin/winwin32rootlesswndproc.c @@ -652,6 +652,18 @@ winMWExtWMWindowProc (HWND hwnd, UINT message, ReleaseCapture (); return winMouseButtonsHandle (pScreen, ButtonRelease, Button3, wParam); + case WM_XBUTTONDBLCLK: + case WM_XBUTTONDOWN: + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; + SetCapture (hwnd); + return winMouseButtonsHandle (pScreen, ButtonPress, HIWORD(wParam) + 5, wParam); + case WM_XBUTTONUP: + if (pScreenPriv == NULL || pScreenInfo->fIgnoreInput) + break; + ReleaseCapture (); + return winMouseButtonsHandle (pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam); + case WM_MOUSEWHEEL: #if CYGMULTIWINDOW_DEBUG winDebug ("winMWExtWMWindowProc - WM_MOUSEWHEEL\n"); diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c index e9a644e40..6188425dd 100644 --- a/hw/xwin/winwndproc.c +++ b/hw/xwin/winwndproc.c @@ -873,6 +873,28 @@ winWindowProc (HWND hwnd, UINT message, ReleaseCapture (); return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam); + case WM_XBUTTONDBLCLK: + case WM_XBUTTONDOWN: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + if (s_pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fMWExtWM +#endif + ) + SetCapture (hwnd); + return winMouseButtonsHandle (s_pScreen, ButtonPress, HIWORD(wParam) + 5, wParam); + case WM_XBUTTONUP: + if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) + break; + if (s_pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fMWExtWM +#endif + ) + ReleaseCapture (); + return winMouseButtonsHandle (s_pScreen, ButtonRelease, HIWORD(wParam) + 5, wParam); + case WM_TIMER: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; @@ -1139,6 +1161,9 @@ winWindowProc (HWND hwnd, UINT message, /* Display Exit dialog */ winDisplayExitDialog (s_pScreenPriv); return 0; + case ID_APP_SHOWCURSOR: + winDebug("ShowCursor: %d\n", ShowCursor(TRUE)); + return 0; #ifdef XWIN_MULTIWINDOW case ID_APP_HIDE_ROOT: |