diff options
author | marha <marha@users.sourceforge.net> | 2012-01-28 13:55:41 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-01-28 13:55:41 +0100 |
commit | 1aee8dafb5391e093f3a111f906ab0d8b6775510 (patch) | |
tree | 3fd4cc1783510fb6ce17c4c42b4d012014008e5b /xorg-server/hw | |
parent | c6a1477b0092762299491d79b3a8cb094c6456da (diff) | |
download | vcxsrv-1aee8dafb5391e093f3a111f906ab0d8b6775510.tar.gz vcxsrv-1aee8dafb5391e093f3a111f906ab0d8b6775510.tar.bz2 vcxsrv-1aee8dafb5391e093f3a111f906ab0d8b6775510.zip |
mesa xserver git update 28 jan 2012
Diffstat (limited to 'xorg-server/hw')
25 files changed, 1280 insertions, 1199 deletions
diff --git a/xorg-server/hw/xquartz/bundle/Info.plist.cpp b/xorg-server/hw/xquartz/bundle/Info.plist.cpp index a4b8e1926..4b6d9d182 100644 --- a/xorg-server/hw/xquartz/bundle/Info.plist.cpp +++ b/xorg-server/hw/xquartz/bundle/Info.plist.cpp @@ -19,9 +19,9 @@ <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>2.7.0</string> + <string>2.7.2</string> <key>CFBundleVersion</key> - <string>2.7.0</string> + <string>2.7.2</string> <key>CFBundleSignature</key> <string>x11a</string> <key>CSResourcesFileMapped</key> @@ -37,9 +37,9 @@ <key>LSApplicationCategoryType</key> <string>public.app-category.utilities</string> <key>NSHumanReadableCopyright</key> - <string>© 2003-2011 Apple Inc. + <string>© 2003-2012 Apple Inc. © 2003 XFree86 Project, Inc. -© 2003-2011 X.org Foundation, Inc. +© 2003-2012 X.org Foundation, Inc. </string> <key>NSMainNibFile</key> <string>main</string> diff --git a/xorg-server/hw/xwin/InitInput.c b/xorg-server/hw/xwin/InitInput.c index bc48a9360..9cf573536 100644 --- a/xorg-server/hw/xwin/InitInput.c +++ b/xorg-server/hw/xwin/InitInput.c @@ -112,12 +112,6 @@ InitInput (int argc, char *argv[]) winProcEstablishConnectionOrig = InitialVector[2]; InitialVector[2] = winProcEstablishConnection; } - if (g_fXdmcpEnabled - && ProcVector[X_QueryTree] != winProcQueryTree) - { - winProcQueryTreeOrig = ProcVector[X_QueryTree]; - ProcVector[X_QueryTree] = winProcQueryTree; - } #endif g_pwinPointer = AddInputDevice (serverClient, winMouseProc, TRUE); diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c index 770439258..4a601b222 100644 --- a/xorg-server/hw/xwin/InitOutput.c +++ b/xorg-server/hw/xwin/InitOutput.c @@ -673,8 +673,35 @@ OsVendorInit (void) /* We have to flag this as an explicit screen, even though it isn't */ g_ScreenInfo[0].fExplicitScreen = TRUE; } -} + /* Work out what the default emulate3buttons setting should be, and apply + it if nothing was explicitly specified */ + { + int mouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS); + int j; + + for (j = 0; j < g_iNumScreens; j++) + { + if (g_ScreenInfo[j].iE3BTimeout == WIN_E3B_DEFAULT) + { + if (mouseButtons < 3) + { + static Bool reportOnce = TRUE; + g_ScreenInfo[j].iE3BTimeout = WIN_DEFAULT_E3B_TIME; + if (reportOnce) + { + reportOnce = FALSE; + winMsg(X_PROBED, "Windows reports only %d mouse buttons, defaulting to -emulate3buttons\n", mouseButtons); + } + } + else + { + g_ScreenInfo[j].iE3BTimeout = WIN_E3B_OFF; + } + } + } + } +} static void winUseMsg (void) @@ -706,7 +733,7 @@ winUseMsg (void) "\tSpecify an optional bitdepth to use in fullscreen mode\n" "\twith a DirectDraw engine.\n"); - ErrorF ("-emulate3buttons [timeout]\n" + ErrorF ("-[no]emulate3buttons [timeout]\n" "\tEmulate 3 button mouse with an optional timeout in\n" "\tmilliseconds.\n"); diff --git a/xorg-server/hw/xwin/man/XWin.man b/xorg-server/hw/xwin/man/XWin.man index 6e69a185d..d03a36521 100644 --- a/xorg-server/hw/xwin/man/XWin.man +++ b/xorg-server/hw/xwin/man/XWin.man @@ -176,7 +176,8 @@ milliseconds causes an emulated middle button press. The default .I timeout is 50 milliseconds. Note that most mice with scroll wheel have middle button functionality, usually you will need this option only if you have -a two button mouse without scroll wheel. +a two button mouse without scroll wheel. Default is to enable this +option if \fIWindows\fP reports a two button mouse, disabled otherwise. .TP 8 .B \-[no]keyhook Enable [disable] a low-level keyboard hook for catching diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h index ac26d0181..583906442 100644 --- a/xorg-server/hw/xwin/win.h +++ b/xorg-server/hw/xwin/win.h @@ -102,6 +102,8 @@ #define MOUSE_POLLING_INTERVAL 50 #define WIN_E3B_OFF -1 +#define WIN_E3B_DEFAULT 0 + #define WIN_FD_INVALID -1 #define WIN_SERVER_NONE 0x0L /* 0 */ diff --git a/xorg-server/hw/xwin/winclipboard.h b/xorg-server/hw/xwin/winclipboard.h index 6b5249fd1..b655f1623 100644 --- a/xorg-server/hw/xwin/winclipboard.h +++ b/xorg-server/hw/xwin/winclipboard.h @@ -70,6 +70,8 @@ #define WIN_XEVENTS_SHUTDOWN 1 #define WIN_XEVENTS_CONVERT 2 #define WIN_XEVENTS_NOTIFY 3 +#define WIN_CLIPBOARD_RETRIES 40 +#define WIN_CLIPBOARD_DELAY 1 #define WM_WM_REINIT (WM_USER + 1) diff --git a/xorg-server/hw/xwin/winclipboardthread.c b/xorg-server/hw/xwin/winclipboardthread.c index 908dfcea2..bc4bc3059 100644 --- a/xorg-server/hw/xwin/winclipboardthread.c +++ b/xorg-server/hw/xwin/winclipboardthread.c @@ -50,6 +50,8 @@ extern Bool g_fUnicodeClipboard; extern unsigned long serverGeneration; extern Bool g_fClipboardStarted; +extern Bool g_fClipboardLaunched; +extern Bool g_fClipboard; extern HWND g_hwndClipboard; extern void *g_pClipboardDisplay; extern Window g_iClipboardWindow; @@ -60,6 +62,10 @@ extern Window g_iClipboardWindow; */ static jmp_buf g_jmpEntry; +static int clipboardRestarts = 0; +static XIOErrorHandler g_winClipboardOldIOErrorHandler; +static pthread_t g_winClipboardProcThread; + Bool g_fUnicodeSupport = FALSE; Bool g_fUseUnicode = FALSE; @@ -74,7 +80,6 @@ winClipboardErrorHandler (Display *pDisplay, XErrorEvent *pErr); static int winClipboardIOErrorHandler (Display *pDisplay); - /* * Main thread function */ @@ -101,6 +106,7 @@ winClipboardProc (void *pvNotUsed) int iSelectError; ErrorF ("winClipboardProc - Hello\n"); + ++clipboardRestarts; /* Do we have Unicode support? */ g_fUnicodeSupport = winClipboardDetectUnicodeSupport (); @@ -115,7 +121,7 @@ winClipboardProc (void *pvNotUsed) if (XInitThreads () == 0) { ErrorF ("winClipboardProc - XInitThreads failed.\n"); - pthread_exit (NULL); + goto winClipboardProc_Exit; } /* See if X supports the current locale */ @@ -124,6 +130,11 @@ winClipboardProc (void *pvNotUsed) ErrorF ("winClipboardProc - Warning: Locale not supported by X.\n"); } + /* Set error handler */ + XSetErrorHandler (winClipboardErrorHandler); + g_winClipboardProcThread = pthread_self(); + g_winClipboardOldIOErrorHandler = XSetIOErrorHandler (winClipboardIOErrorHandler); + /* Set jump point for Error exits */ iReturn = setjmp (g_jmpEntry); @@ -134,7 +145,7 @@ winClipboardProc (void *pvNotUsed) /* setjmp returned an unknown value, exit */ ErrorF ("winClipboardProc - setjmp returned: %d exiting\n", iReturn); - pthread_exit (NULL); + goto winClipboardProc_Exit; } else if (iReturn == WIN_JMP_ERROR_IO) { @@ -146,10 +157,6 @@ winClipboardProc (void *pvNotUsed) /* Use our generated cookie for authentication */ winSetAuthorization(); - /* Set error handler */ - XSetErrorHandler (winClipboardErrorHandler); - XSetIOErrorHandler (winClipboardIOErrorHandler); - /* Initialize retry count */ iRetries = 0; @@ -191,7 +198,7 @@ winClipboardProc (void *pvNotUsed) if (pDisplay == NULL) { ErrorF ("winClipboardProc - Failed opening the display, giving up\n"); - pthread_exit (NULL); + goto winClipboardProc_Done; } /* Save the display in the screen privates */ @@ -209,7 +216,7 @@ winClipboardProc (void *pvNotUsed) if (fdMessageQueue == -1) { ErrorF ("winClipboardProc - Failed opening %s\n", WIN_MSG_QUEUE_FNAME); - pthread_exit (NULL); + goto winClipboardProc_Done; } /* Find max of our file descriptors */ @@ -233,9 +240,11 @@ winClipboardProc (void *pvNotUsed) if (iWindow == 0) { ErrorF ("winClipboardProc - Could not create an X window.\n"); - pthread_exit (NULL); + goto winClipboardProc_Done; } + XStoreName(pDisplay, iWindow, "xwinclip"); + /* Select event types to watch */ if (XSelectInput (pDisplay, iWindow, @@ -262,7 +271,7 @@ winClipboardProc (void *pvNotUsed) XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow) { ErrorF ("winClipboardProc - Could not set PRIMARY owner\n"); - pthread_exit (NULL); + goto winClipboardProc_Done; } /* CLIPBOARD */ @@ -272,7 +281,7 @@ winClipboardProc (void *pvNotUsed) XGetSelectionOwner (pDisplay, atomClipboard) != iWindow) { ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n"); - pthread_exit (NULL); + goto winClipboardProc_Done; } } @@ -379,6 +388,20 @@ winClipboardProc (void *pvNotUsed) } } +winClipboardProc_Exit: + /* disable the clipboard, which means the thread will die */ + g_fClipboard = FALSE; + +winClipboardProc_Done: + /* Close our Windows window */ + if (g_hwndClipboard ) + { + /* Destroy the Window window (hwnd) */ + winDebug("winClipboardProc - Destroy Windows window\n"); + PostMessage(g_hwndClipboard, WM_DESTROY, 0, 0); + winClipboardFlushWindowsMessageQueue(g_hwndClipboard); + } + /* Close our X window */ if (pDisplay && iWindow) { @@ -417,10 +440,44 @@ winClipboardProc (void *pvNotUsed) } #endif + /* global clipboard variable reset */ + g_fClipboardLaunched = FALSE; + g_fClipboardStarted = FALSE; g_iClipboardWindow = None; g_pClipboardDisplay = NULL; g_hwndClipboard = NULL; + /* checking if we need to restart */ + if (clipboardRestarts >= WIN_CLIPBOARD_RETRIES) + { + /* terminates clipboard thread but the main server still lives */ + ErrorF("winClipboardProc - the clipboard thread has restarted %d times and seems to be unstable, disabling clipboard integration\n", clipboardRestarts); + g_fClipboard = FALSE; + return; + } + + if (g_fClipboard) + { + sleep(WIN_CLIPBOARD_DELAY); + ErrorF("winClipboardProc - trying to restart clipboard thread \n"); + /* Create the clipboard client thread */ + if (!winInitClipboard ()) + { + ErrorF ("winClipboardProc - winClipboardInit failed.\n"); + return; + } + + winDebug ("winClipboardProc - winInitClipboard returned.\n"); + /* Flag that clipboard client has been launched */ + g_fClipboardLaunched = TRUE; + } + else + { + ErrorF ("winClipboardProc - Clipboard disabled - Exit from server \n"); + /* clipboard thread has exited, stop server as well */ + kill(getpid(), SIGTERM); + } + return NULL; } @@ -457,8 +514,14 @@ winClipboardIOErrorHandler (Display *pDisplay) { ErrorF ("winClipboardIOErrorHandler!\n\n"); - /* Restart at the main entry point */ - longjmp (g_jmpEntry, WIN_JMP_ERROR_IO); - + if (pthread_equal(pthread_self(),g_winClipboardProcThread)) + { + /* Restart at the main entry point */ + longjmp (g_jmpEntry, WIN_JMP_ERROR_IO); + } + + if (g_winClipboardOldIOErrorHandler) + g_winClipboardOldIOErrorHandler(pDisplay); + return 0; } diff --git a/xorg-server/hw/xwin/winclipboardunicode.c b/xorg-server/hw/xwin/winclipboardunicode.c index ba86915a4..a297bf2e9 100644 --- a/xorg-server/hw/xwin/winclipboardunicode.c +++ b/xorg-server/hw/xwin/winclipboardunicode.c @@ -44,7 +44,7 @@ winClipboardDetectUnicodeSupport (void) { Bool fReturn = FALSE; OSVERSIONINFO osvi = {0}; - + /* Get operating system version information */ osvi.dwOSVersionInfoSize = sizeof (osvi); GetVersionEx (&osvi); @@ -54,13 +54,11 @@ winClipboardDetectUnicodeSupport (void) { case VER_PLATFORM_WIN32_NT: /* Unicode supported on NT only */ - ErrorF ("DetectUnicodeSupport - Windows NT/2000/XP\n"); fReturn = TRUE; break; case VER_PLATFORM_WIN32_WINDOWS: /* Unicode is not supported on non-NT */ - ErrorF ("DetectUnicodeSupport - Windows 95/98/Me\n"); fReturn = FALSE; break; } diff --git a/xorg-server/hw/xwin/winclipboardwndproc.c b/xorg-server/hw/xwin/winclipboardwndproc.c index 03da7f41c..02347ff43 100644 --- a/xorg-server/hw/xwin/winclipboardwndproc.c +++ b/xorg-server/hw/xwin/winclipboardwndproc.c @@ -42,7 +42,6 @@ * Constants */ -#define WIN_CLIPBOARD_PROP "cyg_clipboard_prop" #define WIN_POLL_TIMEOUT 1 @@ -124,10 +123,9 @@ winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay, iWindow, pDisplay, fUseUnicode); - if (WIN_XEVENTS_NOTIFY == iReturn - || WIN_XEVENTS_CONVERT == iReturn) + if (WIN_XEVENTS_NOTIFY == iReturn) { - /* Bail out if convert or notify processed */ + /* Bail out if notify processed */ return iReturn; } } @@ -503,22 +501,9 @@ winClipboardWindowProc (HWND hwnd, UINT message, pDisplay, fConvertToUnicode, WIN_POLL_TIMEOUT); - if (WIN_XEVENTS_CONVERT == iReturn) - { - /* - * The selection was offered for conversion first, so we have - * to process a second SelectionNotify event to get the actual - * data in the selection. - */ - iReturn = winProcessXEventsTimeout (hwnd, - iWindow, - pDisplay, - fConvertToUnicode, - WIN_POLL_TIMEOUT); - } - + /* - * The last of the up-to two calls to winProcessXEventsTimeout + * The last call to winProcessXEventsTimeout * from above had better have seen a notify event, or else we * are dealing with a buggy or old X11 app. In these cases we * have to paste some fake data to the Win32 clipboard to diff --git a/xorg-server/hw/xwin/winclipboardwrappers.c b/xorg-server/hw/xwin/winclipboardwrappers.c index ddc7814d7..ec6e95a8a 100644 --- a/xorg-server/hw/xwin/winclipboardwrappers.c +++ b/xorg-server/hw/xwin/winclipboardwrappers.c @@ -1,527 +1,411 @@ -/*
- *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
- *Copyright (C) Colin Harrison 2005-2008
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the copyright holder(s)
- *and author(s) shall not be used in advertising or otherwise to promote
- *the sale, use or other dealings in this Software without prior written
- *authorization from the copyright holder(s) and author(s).
- *
- * Authors: Harold L Hunt II
- * Colin Harrison
- */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include "win.h"
-#include "dixstruct.h"
-#include <X11/Xatom.h>
-
-
-/*
- * Constants
- */
-
-#define CLIP_NUM_CALLS 4
-#define CLIP_NUM_SELECTIONS 2
-#define CLIP_OWN_PRIMARY 0
-#define CLIP_OWN_CLIPBOARD 1
-
-
-/*
- * Local function prototypes
- */
-
-int winProcEstablishConnection(ClientPtr /* client */);
-int winProcQueryTree(ClientPtr /* client */);
-int winProcSetSelectionOwner(ClientPtr /* client */);
-
-
-/*
- * References to external symbols
- */
-
-extern Bool g_fUnicodeSupport;
-extern int g_iNumScreens;
-extern unsigned int g_uiAuthDataLen;
-extern char *g_pAuthData;
-extern Bool g_fXdmcpEnabled;
-extern Bool g_fClipboardLaunched;
-extern Bool g_fClipboardStarted;
-extern Bool g_fClipboard;
-extern Window g_iClipboardWindow;
-extern Atom g_atomLastOwnedSelection;
-extern HWND g_hwndClipboard;
-
-extern winDispatchProcPtr winProcEstablishConnectionOrig;
-extern winDispatchProcPtr winProcQueryTreeOrig;
-extern winDispatchProcPtr winProcSetSelectionOwnerOrig;
-
-
-/*
- * Wrapper for internal QueryTree function.
- * Hides the clipboard client when it is the only client remaining.
- */
-
-int
-winProcQueryTree (ClientPtr client)
-{
- int iReturn;
-
- ErrorF ("winProcQueryTree - Hello\n");
-
- /*
- * This procedure is only used for initialization.
- * We can unwrap the original procedure at this point
- * so that this function is no longer called until the
- * server resets and the function is wrapped again.
- */
- ProcVector[X_QueryTree] = winProcQueryTreeOrig;
-
- /*
- * Call original function and bail if it fails.
- * NOTE: We must do this first, since we need XdmcpOpenDisplay
- * to be called before we initialize our clipboard client.
- */
- iReturn = (*winProcQueryTreeOrig) (client);
- if (iReturn != 0)
- {
- ErrorF ("winProcQueryTree - ProcQueryTree failed, bailing.\n");
- return iReturn;
- }
-
- /* Make errors more obvious */
- winProcQueryTreeOrig = NULL;
-
- /* Do nothing if clipboard is not enabled */
- if (!g_fClipboard)
- {
- ErrorF ("winProcQueryTree - Clipboard is not enabled, "
- "returning.\n");
- return iReturn;
- }
-
- /* If the clipboard client has already been started, abort */
- if (g_fClipboardLaunched)
- {
- ErrorF ("winProcQueryTree - Clipboard client already "
- "launched, returning.\n");
- return iReturn;
- }
-
- /* Startup the clipboard client if clipboard mode is being used */
- if (g_fXdmcpEnabled && g_fClipboard)
- {
- /*
- * NOTE: The clipboard client is started here for a reason:
- * 1) Assume you are using XDMCP (e.g. XWin -query %hostname%)
- * 2) If the clipboard client attaches during X Server startup,
- * then it becomes the "magic client" that causes the X Server
- * to reset if it exits.
- * 3) XDMCP calls KillAllClients when it starts up.
- * 4) The clipboard client is a client, so it is killed.
- * 5) The clipboard client is the "magic client", so the X Server
- * resets itself.
- * 6) This repeats ad infinitum.
- * 7) We avoid this by waiting until at least one client (could
- * be XDM, could be another client) connects, which makes it
- * almost certain that the clipboard client will not connect
- * until after XDM when using XDMCP.
- * 8) Unfortunately, there is another problem.
- * 9) XDM walks the list of windows with XQueryTree,
- * killing any client it finds with a window.
- * 10)Thus, when using XDMCP we wait until the first call
- * to ProcQueryTree before we startup the clipboard client.
- * This should prevent XDM from finding the clipboard client,
- * since it has not yet created a window.
- * 11)Startup when not using XDMCP is handled in
- * winProcEstablishConnection.
- */
-
- /* Create the clipboard client thread */
- if (!winInitClipboard ())
- {
- ErrorF ("winProcQueryTree - winClipboardInit "
- "failed.\n");
- return iReturn;
- }
-
- ErrorF ("winProcQueryTree - winInitClipboard returned.\n");
- }
-
- /* Flag that clipboard client has been launched */
- g_fClipboardLaunched = TRUE;
-
- return iReturn;
-}
-
-
-/*
- * Wrapper for internal EstablishConnection function.
- * Initializes internal clients that must not be started until
- * an external client has connected.
- */
-
-int
-winProcEstablishConnection (ClientPtr client)
-{
- int iReturn;
- static int s_iCallCount = 0;
- static unsigned long s_ulServerGeneration = 0;
-
- if (s_iCallCount == 0 || s_iCallCount == CLIP_NUM_CALLS) ErrorF ("winProcEstablishConnection - Hello\n");
-
- /* Do nothing if clipboard is not enabled */
- if (!g_fClipboard)
- {
- ErrorF ("winProcEstablishConnection - Clipboard is not enabled, "
- "returning.\n");
-
- /* Unwrap the original function, call it, and return */
- InitialVector[2] = winProcEstablishConnectionOrig;
- iReturn = (*winProcEstablishConnectionOrig) (client);
- winProcEstablishConnectionOrig = NULL;
- return iReturn;
- }
-
- /* Watch for server reset */
- if (s_ulServerGeneration != serverGeneration)
- {
- /* Save new generation number */
- s_ulServerGeneration = serverGeneration;
-
- /* Reset call count */
- s_iCallCount = 0;
- }
-
- /* Increment call count */
- ++s_iCallCount;
-
- /* Wait for CLIP_NUM_CALLS when Xdmcp is enabled */
- if (g_fXdmcpEnabled
- && !g_fClipboardLaunched
- && s_iCallCount < CLIP_NUM_CALLS)
- {
- if (s_iCallCount == 1) ErrorF ("winProcEstablishConnection - Xdmcp, waiting to "
- "start clipboard client until %dth call", CLIP_NUM_CALLS);
- if (s_iCallCount == CLIP_NUM_CALLS - 1) ErrorF (".\n");
- else ErrorF (".");
- return (*winProcEstablishConnectionOrig) (client);
- }
-
- /*
- * This procedure is only used for initialization.
- * We can unwrap the original procedure at this point
- * so that this function is no longer called until the
- * server resets and the function is wrapped again.
- */
- InitialVector[2] = winProcEstablishConnectionOrig;
-
- /*
- * Call original function and bail if it fails.
- * NOTE: We must do this first, since we need XdmcpOpenDisplay
- * to be called before we initialize our clipboard client.
- */
- iReturn = (*winProcEstablishConnectionOrig) (client);
- if (iReturn != 0)
- {
- ErrorF ("winProcEstablishConnection - ProcEstablishConnection "
- "failed, bailing.\n");
- return iReturn;
- }
-
- /* Clear original function pointer */
- winProcEstablishConnectionOrig = NULL;
-
- /* If the clipboard client has already been started, abort */
- if (g_fClipboardLaunched)
- {
- ErrorF ("winProcEstablishConnection - Clipboard client already "
- "launched, returning.\n");
- return iReturn;
- }
-
- /* Startup the clipboard client if clipboard mode is being used */
- if (g_fClipboard)
- {
- /*
- * NOTE: The clipboard client is started here for a reason:
- * 1) Assume you are using XDMCP (e.g. XWin -query %hostname%)
- * 2) If the clipboard client attaches during X Server startup,
- * then it becomes the "magic client" that causes the X Server
- * to reset if it exits.
- * 3) XDMCP calls KillAllClients when it starts up.
- * 4) The clipboard client is a client, so it is killed.
- * 5) The clipboard client is the "magic client", so the X Server
- * resets itself.
- * 6) This repeats ad infinitum.
- * 7) We avoid this by waiting until at least one client (could
- * be XDM, could be another client) connects, which makes it
- * almost certain that the clipboard client will not connect
- * until after XDM when using XDMCP.
- * 8) Unfortunately, there is another problem.
- * 9) XDM walks the list of windows with XQueryTree,
- * killing any client it finds with a window.
- * 10)Thus, when using XDMCP we wait until CLIP_NUM_CALLS
- * to ProcEstablishCeonnection before we startup the clipboard
- * client. This should prevent XDM from finding the clipboard
- * client, since it has not yet created a window.
- */
-
- /* Create the clipboard client thread */
- if (!winInitClipboard ())
- {
- ErrorF ("winProcEstablishConnection - winClipboardInit "
- "failed.\n");
- return iReturn;
- }
-
- ErrorF ("winProcEstablishConnection - winInitClipboard returned.\n");
- }
-
- /* Flag that clipboard client has been launched */
- g_fClipboardLaunched = TRUE;
-
- return iReturn;
-}
-
-
-/*
- * Wrapper for internal SetSelectionOwner function.
- * Grabs ownership of Windows clipboard when X11 clipboard owner changes.
- */
-
-int
-winProcSetSelectionOwner (ClientPtr client)
-{
- int i;
- DrawablePtr pDrawable;
- WindowPtr pWindow = None;
- Bool fOwnedToNotOwned = FALSE;
- static Window s_iOwners[CLIP_NUM_SELECTIONS] = {None};
- static unsigned long s_ulServerGeneration = 0;
- REQUEST(xSetSelectionOwnerReq);
-
- REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
-
- winDebug("winProcSetSelectionOwner - Hello.\n");
-
- /* Watch for server reset */
- if (s_ulServerGeneration != serverGeneration)
- {
- /* Save new generation number */
- s_ulServerGeneration = serverGeneration;
-
- /* Initialize static variables */
- for (i = 0; i < CLIP_NUM_SELECTIONS; ++i)
- s_iOwners[i] = None;
- }
-
- /* Abort if clipboard not completely initialized yet */
- if (!g_fClipboardStarted)
- {
- /* ErrorF ("winProcSetSelectionOwner - Clipboard not yet started, "
- "aborting.\n"); */
- goto winProcSetSelectionOwner_Done;
- }
-
- /* Grab window if we have one */
- if (None != stuff->window)
- {
- /* Grab the Window from the request */
- int rc = dixLookupWindow(&pWindow, stuff->window, client, DixReadAccess);
- if (rc != Success) {
- ErrorF ("winProcSetSelectionOwner - Found BadWindow, aborting.\n");
- goto winProcSetSelectionOwner_Done;
- }
- }
-
- /* Now we either have a valid window or None */
-
- /* Save selection owners for monitored selections, ignore other selections */
- if (XA_PRIMARY == stuff->selection)
- {
- /* Look for owned -> not owned transition */
- if (None == stuff->window
- && None != s_iOwners[CLIP_OWN_PRIMARY])
- {
- fOwnedToNotOwned = TRUE;
-
- winDebug("winProcSetSelectionOwner - PRIMARY - Going from "
- "owned to not owned.\n");
-
- /* Adjust last owned selection */
- if (None != s_iOwners[CLIP_OWN_CLIPBOARD])
- g_atomLastOwnedSelection = MakeAtom ("CLIPBOARD", 9, TRUE);
- else
- g_atomLastOwnedSelection = None;
- }
-
- /* Save new selection owner or None */
- s_iOwners[CLIP_OWN_PRIMARY] = stuff->window;
-
- winDebug("winProcSetSelectionOwner - PRIMARY - Now owned by: %d\n",
- stuff->window);
- }
- else if (MakeAtom ("CLIPBOARD", 9, TRUE) == stuff->selection)
- {
- /* Look for owned -> not owned transition */
- if (None == stuff->window
- && None != s_iOwners[CLIP_OWN_CLIPBOARD])
- {
- fOwnedToNotOwned = TRUE;
-
- winDebug("winProcSetSelectionOwner - CLIPBOARD - Going from "
- "owned to not owned.\n");
-
- /* Adjust last owned selection */
- if (None != s_iOwners[CLIP_OWN_PRIMARY])
- g_atomLastOwnedSelection = XA_PRIMARY;
- else
- g_atomLastOwnedSelection = None;
- }
-
- /* Save new selection owner or None */
- s_iOwners[CLIP_OWN_CLIPBOARD] = stuff->window;
-
- winDebug("winProcSetSelectionOwner - CLIPBOARD - Now owned by: %d\n",
- stuff->window);
-
- }
- else
- goto winProcSetSelectionOwner_Done;
-
- /*
- * At this point, if one of the selections is still owned by the
- * clipboard manager then it should be marked as unowned since
- * we will be taking ownership of the Win32 clipboard.
- */
- if (g_iClipboardWindow == s_iOwners[CLIP_OWN_PRIMARY])
- s_iOwners[CLIP_OWN_PRIMARY] = None;
- if (g_iClipboardWindow == s_iOwners[CLIP_OWN_CLIPBOARD])
- s_iOwners[CLIP_OWN_CLIPBOARD] = None;
-
- /*
- * Handle case when selection is being disowned,
- * WM_DRAWCLIPBOARD did not do the disowning,
- * both monitored selections are no longer owned,
- * an owned to not owned transition was detected,
- * and we currently own the Win32 clipboard.
- */
- if (stuff->window == None
- && s_iOwners[CLIP_OWN_PRIMARY] == None
- && s_iOwners[CLIP_OWN_CLIPBOARD] == None
- && fOwnedToNotOwned
- && g_hwndClipboard != NULL
- && g_hwndClipboard == GetClipboardOwner ())
- {
- winDebug("winProcSetSelectionOwner - We currently own the "
- "clipboard and neither the PRIMARY nor the CLIPBOARD "
- "selections are owned, releasing ownership of Win32 "
- "clipboard.\n");
-
- /* Release ownership of the Windows clipboard */
- OpenClipboard (NULL);
- EmptyClipboard ();
- CloseClipboard ();
-
- goto winProcSetSelectionOwner_Done;
- }
-
- /* Abort if no window at this point */
- if (None == stuff->window)
- {
- winDebug("winProcSetSelectionOwner - No window, returning.\n");
- goto winProcSetSelectionOwner_Done;
- }
-
- /* Abort if invalid selection */
- if (!ValidAtom (stuff->selection))
- {
- ErrorF ("winProcSetSelectionOwner - Found BadAtom, aborting.\n");
- goto winProcSetSelectionOwner_Done;
- }
-
- /* Cast Window to Drawable */
- pDrawable = (DrawablePtr) pWindow;
-
- /* Abort if clipboard manager is owning the selection */
- if (pDrawable->id == g_iClipboardWindow)
- {
- winDebug("winProcSetSelectionOwner - We changed ownership, "
- "aborting.\n");
- goto winProcSetSelectionOwner_Done;
- }
-
- /* Abort if root window is taking ownership */
- if (pDrawable->id == 0)
- {
- ErrorF ("winProcSetSelectionOwner - Root window taking ownership, "
- "aborting\n");
- goto winProcSetSelectionOwner_Done;
- }
-
- /* Close clipboard if we have it open already */
- if (GetOpenClipboardWindow () == g_hwndClipboard)
- {
- CloseClipboard ();
- }
-
- /* Access the Windows clipboard */
- if (!OpenClipboard (g_hwndClipboard))
- {
- ErrorF ("winProcSetSelectionOwner - OpenClipboard () failed: %08x\n",
- (int) GetLastError ());
- goto winProcSetSelectionOwner_Done;
- }
-
- /* Take ownership of the Windows clipboard */
- if (!EmptyClipboard ())
- {
- ErrorF ("winProcSetSelectionOwner - EmptyClipboard () failed: %08x\n",
- (int) GetLastError ());
- goto winProcSetSelectionOwner_Done;
- }
-
- /* Advertise Unicode if we support it */
- if (g_fUnicodeSupport)
- SetClipboardData (CF_UNICODETEXT, NULL);
-
- /* Always advertise regular text */
- SetClipboardData (CF_TEXT, NULL);
-
- /* Save handle to last owned selection */
- g_atomLastOwnedSelection = stuff->selection;
-
- /* Release the clipboard */
- if (!CloseClipboard ())
- {
- ErrorF ("winProcSetSelectionOwner - CloseClipboard () failed: "
- "%08x\n",
- (int) GetLastError ());
- goto winProcSetSelectionOwner_Done;
- }
-
- winProcSetSelectionOwner_Done:
- return (*winProcSetSelectionOwnerOrig) (client);
-}
+/* + *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the copyright holder(s) + *and author(s) shall not be used in advertising or otherwise to promote + *the sale, use or other dealings in this Software without prior written + *authorization from the copyright holder(s) and author(s). + * + * Authors: Harold L Hunt II + * Colin Harrison + */ + +#ifdef HAVE_XWIN_CONFIG_H +#include <xwin-config.h> +#endif +#include "win.h" +#include "dixstruct.h" +#include <X11/Xatom.h> + + +/* + * Constants + */ + +#define CLIP_NUM_SELECTIONS 2 +#define CLIP_OWN_PRIMARY 0 +#define CLIP_OWN_CLIPBOARD 1 + + +/* + * Local function prototypes + */ + +int winProcEstablishConnection(ClientPtr /* client */); +int winProcQueryTree(ClientPtr /* client */); +int winProcSetSelectionOwner(ClientPtr /* client */); +DISPATCH_PROC(winProcEstablishConnection); +DISPATCH_PROC(winProcSetSelectionOwner); + + +/* + * References to external symbols + */ + +extern Bool g_fUnicodeSupport; +extern int g_iNumScreens; +extern unsigned int g_uiAuthDataLen; +extern char *g_pAuthData; +extern Bool g_fXdmcpEnabled; +extern Bool g_fClipboardLaunched; +extern Bool g_fClipboardStarted; +extern Bool g_fClipboard; +extern Window g_iClipboardWindow; +extern Atom g_atomLastOwnedSelection; +extern HWND g_hwndClipboard; + +extern winDispatchProcPtr winProcEstablishConnectionOrig; +extern winDispatchProcPtr winProcQueryTreeOrig; +extern winDispatchProcPtr winProcSetSelectionOwnerOrig; + + +/* + * Wrapper for internal EstablishConnection function. + * Initializes internal clients that must not be started until + * an external client has connected. + */ + +int +winProcEstablishConnection (ClientPtr client) +{ + int iReturn; + static int s_iCallCount = 0; + static unsigned long s_ulServerGeneration = 0; + + if (s_iCallCount == 0) ErrorF ("winProcEstablishConnection - Hello\n"); + + /* Do nothing if clipboard is not enabled */ + if (!g_fClipboard) + { + ErrorF ("winProcEstablishConnection - Clipboard is not enabled, " + "returning.\n"); + + /* Unwrap the original function, call it, and return */ + InitialVector[2] = winProcEstablishConnectionOrig; + iReturn = (*winProcEstablishConnectionOrig) (client); + winProcEstablishConnectionOrig = NULL; + return iReturn; + } + + /* Watch for server reset */ + if (s_ulServerGeneration != serverGeneration) + { + /* Save new generation number */ + s_ulServerGeneration = serverGeneration; + + /* Reset call count */ + s_iCallCount = 0; + } + + /* Increment call count */ + ++s_iCallCount; + + /* + * This procedure is only used for initialization. + * We can unwrap the original procedure at this point + * so that this function is no longer called until the + * server resets and the function is wrapped again. + */ + InitialVector[2] = winProcEstablishConnectionOrig; + + /* + * Call original function and bail if it fails. + * NOTE: We must do this first, since we need XdmcpOpenDisplay + * to be called before we initialize our clipboard client. + */ + iReturn = (*winProcEstablishConnectionOrig) (client); + if (iReturn != 0) + { + ErrorF ("winProcEstablishConnection - ProcEstablishConnection " + "failed, bailing.\n"); + return iReturn; + } + + /* Clear original function pointer */ + winProcEstablishConnectionOrig = NULL; + + /* If the clipboard client has already been started, abort */ + if (g_fClipboardLaunched) + { + ErrorF ("winProcEstablishConnection - Clipboard client already " + "launched, returning.\n"); + return iReturn; + } + + /* Startup the clipboard client if clipboard mode is being used */ + if (g_fClipboard) + { + /* + * NOTE: The clipboard client is started here for a reason: + * 1) Assume you are using XDMCP (e.g. XWin -query %hostname%) + * 2) If the clipboard client attaches during X Server startup, + * then it becomes the "magic client" that causes the X Server + * to reset if it exits. + * 3) XDMCP calls KillAllClients when it starts up. + * 4) The clipboard client is a client, so it is killed. + * 5) The clipboard client is the "magic client", so the X Server + * resets itself. + * 6) This repeats ad infinitum. + * 7) We avoid this by waiting until at least one client (could + * be XDM, could be another client) connects, which makes it + * almost certain that the clipboard client will not connect + * until after XDM when using XDMCP. + */ + + /* Create the clipboard client thread */ + if (!winInitClipboard ()) + { + ErrorF ("winProcEstablishConnection - winClipboardInit " + "failed.\n"); + return iReturn; + } + + ErrorF ("winProcEstablishConnection - winInitClipboard returned.\n"); + } + + /* Flag that clipboard client has been launched */ + g_fClipboardLaunched = TRUE; + + return iReturn; +} + + +/* + * Wrapper for internal SetSelectionOwner function. + * Grabs ownership of Windows clipboard when X11 clipboard owner changes. + */ + +int +winProcSetSelectionOwner (ClientPtr client) +{ + int i; + DrawablePtr pDrawable; + WindowPtr pWindow = None; + Bool fOwnedToNotOwned = FALSE; + static Window s_iOwners[CLIP_NUM_SELECTIONS] = {None}; + static unsigned long s_ulServerGeneration = 0; + REQUEST(xSetSelectionOwnerReq); + + REQUEST_SIZE_MATCH(xSetSelectionOwnerReq); + + winDebug("winProcSetSelectionOwner - Hello.\n"); + + /* Watch for server reset */ + if (s_ulServerGeneration != serverGeneration) + { + /* Save new generation number */ + s_ulServerGeneration = serverGeneration; + + /* Initialize static variables */ + for (i = 0; i < CLIP_NUM_SELECTIONS; ++i) + s_iOwners[i] = None; + } + + /* Abort if clipboard not completely initialized yet */ + if (!g_fClipboardStarted) + { + /* ErrorF ("winProcSetSelectionOwner - Clipboard not yet started, " + "aborting.\n"); */ + goto winProcSetSelectionOwner_Done; + } + + /* Grab window if we have one */ + if (None != stuff->window) + { + /* Grab the Window from the request */ + int rc = dixLookupWindow(&pWindow, stuff->window, client, DixReadAccess); + if (rc != Success) { + ErrorF ("winProcSetSelectionOwner - Found BadWindow, aborting.\n"); + goto winProcSetSelectionOwner_Done; + } + } + + /* Now we either have a valid window or None */ + + /* Save selection owners for monitored selections, ignore other selections */ + if (XA_PRIMARY == stuff->selection) + { + /* Look for owned -> not owned transition */ + if (None == stuff->window + && None != s_iOwners[CLIP_OWN_PRIMARY]) + { + fOwnedToNotOwned = TRUE; + + winDebug("winProcSetSelectionOwner - PRIMARY - Going from " + "owned to not owned.\n"); + + /* Adjust last owned selection */ + if (None != s_iOwners[CLIP_OWN_CLIPBOARD]) + g_atomLastOwnedSelection = MakeAtom ("CLIPBOARD", 9, TRUE); + else + g_atomLastOwnedSelection = None; + } + + /* Save new selection owner or None */ + s_iOwners[CLIP_OWN_PRIMARY] = stuff->window; + + winDebug("winProcSetSelectionOwner - PRIMARY - Now owned by: %d\n", + stuff->window); + } + else if (MakeAtom ("CLIPBOARD", 9, TRUE) == stuff->selection) + { + /* Look for owned -> not owned transition */ + if (None == stuff->window + && None != s_iOwners[CLIP_OWN_CLIPBOARD]) + { + fOwnedToNotOwned = TRUE; + + winDebug("winProcSetSelectionOwner - CLIPBOARD - Going from " + "owned to not owned.\n"); + + /* Adjust last owned selection */ + if (None != s_iOwners[CLIP_OWN_PRIMARY]) + g_atomLastOwnedSelection = XA_PRIMARY; + else + g_atomLastOwnedSelection = None; + } + + /* Save new selection owner or None */ + s_iOwners[CLIP_OWN_CLIPBOARD] = stuff->window; + + winDebug("winProcSetSelectionOwner - CLIPBOARD - Now owned by: %d\n", + stuff->window); + + } + else + goto winProcSetSelectionOwner_Done; + + /* + * At this point, if one of the selections is still owned by the + * clipboard manager then it should be marked as unowned since + * we will be taking ownership of the Win32 clipboard. + */ + if (g_iClipboardWindow == s_iOwners[CLIP_OWN_PRIMARY]) + s_iOwners[CLIP_OWN_PRIMARY] = None; + if (g_iClipboardWindow == s_iOwners[CLIP_OWN_CLIPBOARD]) + s_iOwners[CLIP_OWN_CLIPBOARD] = None; + + /* + * Handle case when selection is being disowned, + * WM_DRAWCLIPBOARD did not do the disowning, + * both monitored selections are no longer owned, + * an owned to not owned transition was detected, + * and we currently own the Win32 clipboard. + */ + if (stuff->window == None + && s_iOwners[CLIP_OWN_PRIMARY] == None + && s_iOwners[CLIP_OWN_CLIPBOARD] == None + && fOwnedToNotOwned + && g_hwndClipboard != NULL + && g_hwndClipboard == GetClipboardOwner ()) + { + winDebug("winProcSetSelectionOwner - We currently own the " + "clipboard and neither the PRIMARY nor the CLIPBOARD " + "selections are owned, releasing ownership of Win32 " + "clipboard.\n"); + + /* Release ownership of the Windows clipboard */ + OpenClipboard (NULL); + EmptyClipboard (); + CloseClipboard (); + + goto winProcSetSelectionOwner_Done; + } + + /* Abort if no window at this point */ + if (None == stuff->window) + { + winDebug("winProcSetSelectionOwner - No window, returning.\n"); + goto winProcSetSelectionOwner_Done; + } + + /* Abort if invalid selection */ + if (!ValidAtom (stuff->selection)) + { + ErrorF ("winProcSetSelectionOwner - Found BadAtom, aborting.\n"); + goto winProcSetSelectionOwner_Done; + } + + /* Cast Window to Drawable */ + pDrawable = (DrawablePtr) pWindow; + + /* Abort if clipboard manager is owning the selection */ + if (pDrawable->id == g_iClipboardWindow) + { + winDebug("winProcSetSelectionOwner - We changed ownership, " + "aborting.\n"); + goto winProcSetSelectionOwner_Done; + } + + /* Abort if root window is taking ownership */ + if (pDrawable->id == 0) + { + ErrorF ("winProcSetSelectionOwner - Root window taking ownership, " + "aborting\n"); + goto winProcSetSelectionOwner_Done; + } + + /* Close clipboard if we have it open already */ + if (GetOpenClipboardWindow () == g_hwndClipboard) + { + CloseClipboard (); + } + + /* Access the Windows clipboard */ + if (!OpenClipboard (g_hwndClipboard)) + { + ErrorF ("winProcSetSelectionOwner - OpenClipboard () failed: %08x\n", + (int) GetLastError ()); + goto winProcSetSelectionOwner_Done; + } + + /* Take ownership of the Windows clipboard */ + if (!EmptyClipboard ()) + { + ErrorF ("winProcSetSelectionOwner - EmptyClipboard () failed: %08x\n", + (int) GetLastError ()); + goto winProcSetSelectionOwner_Done; + } + + /* Advertise Unicode if we support it */ + if (g_fUnicodeSupport) + SetClipboardData (CF_UNICODETEXT, NULL); + + /* Always advertise regular text */ + SetClipboardData (CF_TEXT, NULL); + + /* Save handle to last owned selection */ + g_atomLastOwnedSelection = stuff->selection; + + /* Release the clipboard */ + if (!CloseClipboard ()) + { + ErrorF ("winProcSetSelectionOwner - CloseClipboard () failed: " + "%08x\n", + (int) GetLastError ()); + goto winProcSetSelectionOwner_Done; + } + + winProcSetSelectionOwner_Done: + return (*winProcSetSelectionOwnerOrig) (client); +} diff --git a/xorg-server/hw/xwin/winengine.c b/xorg-server/hw/xwin/winengine.c index 752c4fe68..bf5187bcd 100644 --- a/xorg-server/hw/xwin/winengine.c +++ b/xorg-server/hw/xwin/winengine.c @@ -68,20 +68,6 @@ winDetectSupportedEngines (void) osvi.dwOSVersionInfoSize = sizeof (osvi); GetVersionEx (&osvi); - /* Branch on platform ID */ - switch (osvi.dwPlatformId) - { - case VER_PLATFORM_WIN32_NT: - /* Engine 4 is supported on NT only */ - winErrorFVerb (2, "winDetectSupportedEngines - Windows NT/2000/XP\n"); - break; - - case VER_PLATFORM_WIN32_WINDOWS: - /* Engine 4 is supported on NT only */ - winErrorFVerb (2, "winDetectSupportedEngines - Windows 95/98/Me\n"); - break; - } - /* Do we have DirectDraw? */ if (g_hmodDirectDraw != NULL) { diff --git a/xorg-server/hw/xwin/winglobals.c b/xorg-server/hw/xwin/winglobals.c index 631f12e21..655cdb131 100644 --- a/xorg-server/hw/xwin/winglobals.c +++ b/xorg-server/hw/xwin/winglobals.c @@ -114,8 +114,6 @@ winInitializeGlobals (void) { g_dwCurrentThreadID = GetCurrentThreadId (); #ifdef XWIN_CLIPBOARD - g_fClipboardLaunched = FALSE; - g_fClipboardStarted = FALSE; g_iClipboardWindow = None; g_pClipboardDisplay = NULL; g_atomLastOwnedSelection = None; diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c index a3112fffe..0496c40ab 100644 --- a/xorg-server/hw/xwin/winkeybd.c +++ b/xorg-server/hw/xwin/winkeybd.c @@ -328,8 +328,12 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam) LONG lTime; Bool fReturn; + static Bool lastWasControlL = FALSE; + static UINT lastMessage; + static LONG lastTime; + /* - * Fake Ctrl_L presses will be followed by an Alt_R keypress + * Fake Ctrl_L presses will be followed by an Alt_R press * with the same timestamp as the Ctrl_L press. */ if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN) @@ -341,34 +345,31 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam) /* Get time of current message */ lTime = GetMessageTime (); - /* Look for fake Ctrl_L preceeding an Alt_R press. */ + /* Look for next press message */ fReturn = PeekMessage (&msgNext, NULL, WM_KEYDOWN, WM_SYSKEYDOWN, PM_NOREMOVE); - /* - * Try again if the first call fails. - * NOTE: This usually happens when TweakUI is enabled. - */ - if (!fReturn) - { - /* Voodoo to make sure that the Alt_R message has posted */ - Sleep (0); - - /* Look for fake Ctrl_L preceeding an Alt_R press. */ - fReturn = PeekMessage (&msgNext, NULL, - WM_KEYDOWN, WM_SYSKEYDOWN, - PM_NOREMOVE); - } - if (msgNext.message != WM_KEYDOWN && msgNext.message != WM_SYSKEYDOWN) + if (fReturn && msgNext.message != WM_KEYDOWN && msgNext.message != WM_SYSKEYDOWN) fReturn = 0; + if (!fReturn) + { + lastWasControlL = TRUE; + lastMessage = message; + lastTime = lTime; + } + else + { + lastWasControlL = FALSE; + } + /* Is next press an Alt_R with the same timestamp? */ if (fReturn && msgNext.wParam == VK_MENU && msgNext.time == lTime && (HIWORD (msgNext.lParam) & KF_EXTENDED)) { - /* + /* * Next key press is Alt_R with same timestamp as current * Ctrl_L message. Therefore, this Ctrl_L press is a fake * event, so discard it. @@ -376,12 +377,35 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam) return TRUE; } } + /* + * Sometimes, the Alt_R press message is not yet posted when the + * fake Ctrl_L press message arrives (even though it has the + * same timestamp), so check for an Alt_R press message that has + * arrived since the last Ctrl_L message. + */ + else if ((message == WM_KEYDOWN || message == WM_SYSKEYDOWN) + && wParam == VK_MENU + && (HIWORD (lParam) & KF_EXTENDED)) + { + /* Got a Alt_R press */ - /* + if (lastWasControlL) + { + lTime = GetMessageTime (); + + if (lastTime == lTime) + { + /* Undo the fake Ctrl_L press by sending a fake Ctrl_L release */ + winSendKeyEvent (KEY_LCtrl, FALSE); + } + lastWasControlL = FALSE; + } + } + /* * Fake Ctrl_L releases will be followed by an Alt_R release * with the same timestamp as the Ctrl_L release. */ - if ((message == WM_KEYUP || message == WM_SYSKEYUP) + else if ((message == WM_KEYUP || message == WM_SYSKEYUP) && wParam == VK_CONTROL && (HIWORD (lParam) & KF_EXTENDED) == 0) { @@ -390,29 +414,16 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam) /* Get time of current message */ lTime = GetMessageTime (); - /* Look for fake Ctrl_L release preceeding an Alt_R release. */ + /* Look for next release message */ fReturn = PeekMessage (&msgNext, NULL, - WM_KEYUP, WM_SYSKEYUP, + WM_KEYUP, WM_SYSKEYUP, PM_NOREMOVE); - /* - * Try again if the first call fails. - * NOTE: This usually happens when TweakUI is enabled. - */ - if (!fReturn) - { - /* Voodoo to make sure that the Alt_R message has posted */ - Sleep (0); + if (fReturn && msgNext.message != WM_KEYUP && msgNext.message != WM_SYSKEYUP) + fReturn = 0; - /* Look for fake Ctrl_L release preceeding an Alt_R release. */ - fReturn = PeekMessage (&msgNext, NULL, - WM_KEYUP, WM_SYSKEYUP, - PM_NOREMOVE); - } + lastWasControlL = FALSE; - if (msgNext.message != WM_KEYUP && msgNext.message != WM_SYSKEYUP) - fReturn = 0; - /* Is next press an Alt_R with the same timestamp? */ if (fReturn && (msgNext.message == WM_KEYUP @@ -429,7 +440,13 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam) return TRUE; } } - + else + { + /* On any other press or release message, we don't have a + potentially fake Ctrl_L to worry about anymore... */ + lastWasControlL = FALSE; + } + /* Not a fake control left press/release */ return FALSE; } diff --git a/xorg-server/hw/xwin/winkeybd.h b/xorg-server/hw/xwin/winkeybd.h index 40fbc179f..e4df26066 100644 --- a/xorg-server/hw/xwin/winkeybd.h +++ b/xorg-server/hw/xwin/winkeybd.h @@ -1,304 +1,306 @@ -#if !defined(WINKEYBD_H)
-#define WINKEYBD_H
-/*
- *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- *
- *Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- *"Software"), to deal in the Software without restriction, including
- *without limitation the rights to use, copy, modify, merge, publish,
- *distribute, sublicense, and/or sell copies of the Software, and to
- *permit persons to whom the Software is furnished to do so, subject to
- *the following conditions:
- *
- *The above copyright notice and this permission notice shall be
- *included in all copies or substantial portions of the Software.
- *
- *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
- *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *Except as contained in this notice, the name of the XFree86 Project
- *shall not be used in advertising or otherwise to promote the sale, use
- *or other dealings in this Software without prior written authorization
- *from the XFree86 Project.
- *
- * Authors: Harold L Hunt II
- */
-
-/*
- * We need symbols for the scan codes of keys.
- */
-#include "winkeynames.h"
-
-#define WIN_KEYMAP_COLS 3
-
-/* Rows 160 through 165 correspond to software-generated codes, which
- * may not be associated with the appropriate scan code.
- */
-const int
-g_iKeyMap [] = {
- /* count Windows VK, ASCII, ASCII when extended VK */
- /* 0 */ 0, 0, 0,
- /* 1 */ 0, 0, 0,
- /* 2 */ 0, 0, 0,
- /* 3 */ VK_CANCEL, 0, KEY_Break,
- /* 4 */ 0, 0, 0,
- /* 5 */ 0, 0, 0,
- /* 6 */ 0, 0, 0,
- /* 7 */ 0, 0, 0,
- /* 8 */ 0, 0, 0,
- /* 9 */ 0, 0, 0,
- /* 10 */ 0, 0, 0,
- /* 11 */ 0, 0, 0,
- /* 12 */ 0, 0, 0,
- /* 13 */ VK_RETURN, 0, KEY_KP_Enter,
- /* 14 */ 0, 0, 0,
- /* 15 */ 0, 0, 0,
- /* 16 */ VK_SHIFT, 0, 0,
- /* 17 */ VK_CONTROL, 0, KEY_RCtrl,
- /* 18 */ VK_MENU, 0, KEY_AltLang,
- /* 19 */ VK_PAUSE, KEY_Pause, 0,
- /* 20 */ 0, 0, 0,
- /* 21 */ 0, 0, 0,
- /* 22 */ 0, 0, 0,
- /* 23 */ 0, 0, 0,
- /* 24 */ 0, 0, 0,
- /* 25 */ 0, 0, 0,
- /* 26 */ 0, 0, 0,
- /* 27 */ 0, 0, 0,
- /* 28 */ 0, 0, 0,
- /* 29 */ 0, 0, 0,
- /* 30 */ 0, 0, 0,
- /* 31 */ 0, 0, 0,
- /* 32 */ 0, 0, 0,
- /* 33 */ VK_PRIOR, 0, KEY_PgUp,
- /* 34 */ VK_NEXT, 0, KEY_PgDown,
- /* 35 */ VK_END, 0, KEY_End,
- /* 36 */ VK_HOME, 0, KEY_Home,
- /* 37 */ VK_LEFT, 0, KEY_Left,
- /* 38 */ VK_UP, 0, KEY_Up,
- /* 39 */ VK_RIGHT, 0, KEY_Right,
- /* 40 */ VK_DOWN, 0, KEY_Down,
- /* 41 */ 0, 0, 0,
- /* 42 */ 0, 0, 0,
- /* 43 */ 0, 0, 0,
- /* 44 */ VK_SNAPSHOT, 0, KEY_Print,
- /* 45 */ VK_INSERT, 0, KEY_Insert,
- /* 46 */ VK_DELETE, 0, KEY_Delete,
- /* 47 */ 0, 0, 0,
- /* 48 */ 0, 0, 0,
- /* 49 */ 0, 0, 0,
- /* 50 */ 0, 0, 0,
- /* 51 */ 0, 0, 0,
- /* 52 */ 0, 0, 0,
- /* 53 */ 0, 0, 0,
- /* 54 */ 0, 0, 0,
- /* 55 */ 0, 0, 0,
- /* 56 */ 0, 0, 0,
- /* 57 */ 0, 0, 0,
- /* 58 */ 0, 0, 0,
- /* 59 */ 0, 0, 0,
- /* 60 */ 0, 0, 0,
- /* 61 */ 0, 0, 0,
- /* 62 */ 0, 0, 0,
- /* 63 */ 0, 0, 0,
- /* 64 */ 0, 0, 0,
- /* 65 */ 0, 0, 0,
- /* 66 */ 0, 0, 0,
- /* 67 */ 0, 0, 0,
- /* 68 */ 0, 0, 0,
- /* 69 */ 0, 0, 0,
- /* 70 */ 0, 0, 0,
- /* 71 */ 0, 0, 0,
- /* 72 */ 0, 0, 0,
- /* 73 */ 0, 0, 0,
- /* 74 */ 0, 0, 0,
- /* 75 */ 0, 0, 0,
- /* 76 */ 0, 0, 0,
- /* 77 */ 0, 0, 0,
- /* 78 */ 0, 0, 0,
- /* 79 */ 0, 0, 0,
- /* 80 */ 0, 0, 0,
- /* 81 */ 0, 0, 0,
- /* 82 */ 0, 0, 0,
- /* 83 */ 0, 0, 0,
- /* 84 */ 0, 0, 0,
- /* 85 */ 0, 0, 0,
- /* 86 */ 0, 0, 0,
- /* 87 */ 0, 0, 0,
- /* 88 */ 0, 0, 0,
- /* 89 */ 0, 0, 0,
- /* 90 */ 0, 0, 0,
- /* 91 */ VK_LWIN, KEY_LMeta, 0,
- /* 92 */ VK_RWIN, KEY_RMeta, 0,
- /* 93 */ VK_APPS, KEY_Menu, 0,
- /* 94 */ 0, 0, 0,
- /* 95 */ 0, 0, 0,
- /* 96 */ 0, 0, 0,
- /* 97 */ 0, 0, 0,
- /* 98 */ 0, 0, 0,
- /* 99 */ 0, 0, 0,
- /* 100 */ 0, 0, 0,
- /* 101 */ 0, 0, 0,
- /* 102 */ 0, 0, 0,
- /* 103 */ 0, 0, 0,
- /* 104 */ 0, 0, 0,
- /* 105 */ 0, 0, 0,
- /* 106 */ 0, 0, 0,
- /* 107 */ 0, 0, 0,
- /* 108 */ 0, 0, 0,
- /* 109 */ 0, 0, 0,
- /* 110 */ 0, 0, 0,
- /* 111 */ VK_DIVIDE, 0, KEY_KP_Divide,
- /* 112 */ 0, 0, 0,
- /* 113 */ 0, 0, 0,
- /* 114 */ 0, 0, 0,
- /* 115 */ 0, 0, 0,
- /* 116 */ 0, 0, 0,
- /* 117 */ 0, 0, 0,
- /* 118 */ 0, 0, 0,
- /* 119 */ 0, 0, 0,
- /* 120 */ 0, 0, 0,
- /* 121 */ 0, 0, 0,
- /* 122 */ 0, 0, 0,
- /* 123 */ 0, 0, 0,
- /* 124 */ 0, 0, 0,
- /* 125 */ 0, 0, 0,
- /* 126 */ 0, 0, 0,
- /* 127 */ 0, 0, 0,
- /* 128 */ 0, 0, 0,
- /* 129 */ 0, 0, 0,
- /* 130 */ 0, 0, 0,
- /* 131 */ 0, 0, 0,
- /* 132 */ 0, 0, 0,
- /* 133 */ 0, 0, 0,
- /* 134 */ 0, 0, 0,
- /* 135 */ 0, 0, 0,
- /* 136 */ 0, 0, 0,
- /* 137 */ 0, 0, 0,
- /* 138 */ 0, 0, 0,
- /* 139 */ 0, 0, 0,
- /* 140 */ 0, 0, 0,
- /* 141 */ 0, 0, 0,
- /* 142 */ 0, 0, 0,
- /* 143 */ 0, 0, 0,
- /* 144 */ 0, 0, 0,
- /* 145 */ 0, 0, 0,
- /* 146 */ 0, 0, 0,
- /* 147 */ 0, 0, 0,
- /* 148 */ 0, 0, 0,
- /* 149 */ 0, 0, 0,
- /* 150 */ 0, 0, 0,
- /* 151 */ 0, 0, 0,
- /* 152 */ 0, 0, 0,
- /* 153 */ 0, 0, 0,
- /* 154 */ 0, 0, 0,
- /* 155 */ 0, 0, 0,
- /* 156 */ 0, 0, 0,
- /* 157 */ 0, 0, 0,
- /* 158 */ 0, 0, 0,
- /* 159 */ 0, 0, 0,
- /* 160 */ VK_LSHIFT, KEY_ShiftL, 0,
- /* 161 */ VK_RSHIFT, KEY_ShiftR, 0,
- /* 162 */ VK_LCONTROL, KEY_LCtrl, 0,
- /* 163 */ VK_RCONTROL, KEY_RCtrl, 0,
- /* 164 */ VK_LMENU, KEY_Alt, 0,
- /* 165 */ VK_RMENU, KEY_AltLang, 0,
- /* 166 */ 0, 0, 0,
- /* 167 */ 0, 0, 0,
- /* 168 */ 0, 0, 0,
- /* 169 */ 0, 0, 0,
- /* 170 */ 0, 0, 0,
- /* 171 */ 0, 0, 0,
- /* 172 */ 0, 0, 0,
- /* 173 */ VK_VOLUME_MUTE, 0, KEY_Mute,
- /* 174 */ VK_VOLUME_DOWN, 0, KEY_AudioLower,
- /* 175 */ VK_VOLUME_UP, 0, KEY_AudioRaise,
- /* 176 */ VK_MEDIA_NEXT_TRACK, 0, KEY_NEXTSONG,
- /* 177 */ VK_MEDIA_PREV_TRACK, 0, KEY_PREVIOUSSONG,
- /* 178 */ VK_MEDIA_STOP, 0, KEY_STOPCD,
- /* 179 */ VK_MEDIA_PLAY_PAUSE, 0, KEY_PLAYPAUSE,
- /* 180 */ 0, 0, 0,
- /* 181 */ 0, 0, 0,
- /* 182 */ 0, 0, 0,
- /* 183 */ 0, 0, 0,
- /* 184 */ 0, 0, 0,
- /* 185 */ 0, 0, 0,
- /* 186 */ 0, 0, 0,
- /* 187 */ 0, 0, 0,
- /* 188 */ 0, 0, 0,
- /* 189 */ 0, 0, 0,
- /* 190 */ 0, 0, 0,
- /* 191 */ 0, 0, 0,
- /* 192 */ 0, 0, 0,
- /* 193 */ 0, 0, 0,
- /* 194 */ 0, 0, 0,
- /* 195 */ 0, 0, 0,
- /* 196 */ 0, 0, 0,
- /* 197 */ 0, 0, 0,
- /* 198 */ 0, 0, 0,
- /* 199 */ 0, 0, 0,
- /* 200 */ 0, 0, 0,
- /* 201 */ 0, 0, 0,
- /* 202 */ 0, 0, 0,
- /* 203 */ 0, 0, 0,
- /* 204 */ 0, 0, 0,
- /* 205 */ 0, 0, 0,
- /* 206 */ 0, 0, 0,
- /* 207 */ 0, 0, 0,
- /* 208 */ 0, 0, 0,
- /* 209 */ 0, 0, 0,
- /* 210 */ 0, 0, 0,
- /* 211 */ 0, 0, 0,
- /* 212 */ 0, 0, 0,
- /* 213 */ 0, 0, 0,
- /* 214 */ 0, 0, 0,
- /* 215 */ 0, 0, 0,
- /* 216 */ 0, 0, 0,
- /* 217 */ 0, 0, 0,
- /* 218 */ 0, 0, 0,
- /* 219 */ 0, 0, 0,
- /* 220 */ 0, 0, 0,
- /* 221 */ 0, 0, 0,
- /* 222 */ 0, 0, 0,
- /* 223 */ VK_OEM_8, 0, KEY_RCtrl, /* at least on Candian Multilingual Standard layout */
- /* 224 */ 0, 0, 0,
- /* 225 */ 0, 0, 0,
- /* 226 */ 0, 0, 0,
- /* 227 */ 0, 0, 0,
- /* 228 */ 0, 0, 0,
- /* 229 */ 0, 0, 0,
- /* 230 */ 0, 0, 0,
- /* 231 */ 0, 0, 0,
- /* 232 */ 0, 0, 0,
- /* 233 */ 0, 0, 0,
- /* 234 */ 0, 0, 0,
- /* 235 */ 0, 0, 0,
- /* 236 */ 0, 0, 0,
- /* 237 */ 0, 0, 0,
- /* 238 */ 0, 0, 0,
- /* 239 */ 0, 0, 0,
- /* 240 */ 0, 0, 0,
- /* 241 */ 0, 0, 0,
- /* 242 */ 0, 0, 0,
- /* 243 */ 0, 0, 0,
- /* 244 */ 0, 0, 0,
- /* 245 */ 0, 0, 0,
- /* 246 */ 0, 0, 0,
- /* 247 */ 0, 0, 0,
- /* 248 */ 0, 0, 0,
- /* 249 */ 0, 0, 0,
- /* 250 */ 0, 0, 0,
- /* 251 */ 0, 0, 0,
- /* 252 */ 0, 0, 0,
- /* 253 */ 0, 0, 0,
- /* 254 */ 0, 0, 0,
- /* 255 */ 0, 0, 0
-};
-
-#endif /* WINKEYBD_H */
+#if !defined(WINKEYBD_H) +#define WINKEYBD_H +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ + +/* + * We need symbols for the scan codes of keys. + */ +#include "winkeynames.h" + +#define VK_FN 0xFF + +#define WIN_KEYMAP_COLS 3 + +/* Rows 160 through 165 correspond to software-generated codes, which + * may not be associated with the appropriate scan code. + */ +const int +g_iKeyMap [] = { + /* count Windows VK, ASCII, ASCII when extended VK */ + /* 0 */ 0, 0, 0, + /* 1 */ 0, 0, 0, + /* 2 */ 0, 0, 0, + /* 3 */ VK_CANCEL, 0, KEY_Break, + /* 4 */ 0, 0, 0, + /* 5 */ 0, 0, 0, + /* 6 */ 0, 0, 0, + /* 7 */ 0, 0, 0, + /* 8 */ 0, 0, 0, + /* 9 */ 0, 0, 0, + /* 10 */ 0, 0, 0, + /* 11 */ 0, 0, 0, + /* 12 */ 0, 0, 0, + /* 13 */ VK_RETURN, 0, KEY_KP_Enter, + /* 14 */ 0, 0, 0, + /* 15 */ 0, 0, 0, + /* 16 */ VK_SHIFT, 0, 0, + /* 17 */ VK_CONTROL, 0, KEY_RCtrl, + /* 18 */ VK_MENU, 0, KEY_AltLang, + /* 19 */ VK_PAUSE, KEY_Pause, 0, + /* 20 */ 0, 0, 0, + /* 21 */ 0, 0, 0, + /* 22 */ 0, 0, 0, + /* 23 */ 0, 0, 0, + /* 24 */ 0, 0, 0, + /* 25 */ 0, 0, 0, + /* 26 */ 0, 0, 0, + /* 27 */ 0, 0, 0, + /* 28 */ 0, 0, 0, + /* 29 */ 0, 0, 0, + /* 30 */ 0, 0, 0, + /* 31 */ 0, 0, 0, + /* 32 */ 0, 0, 0, + /* 33 */ VK_PRIOR, 0, KEY_PgUp, + /* 34 */ VK_NEXT, 0, KEY_PgDown, + /* 35 */ VK_END, 0, KEY_End, + /* 36 */ VK_HOME, 0, KEY_Home, + /* 37 */ VK_LEFT, 0, KEY_Left, + /* 38 */ VK_UP, 0, KEY_Up, + /* 39 */ VK_RIGHT, 0, KEY_Right, + /* 40 */ VK_DOWN, 0, KEY_Down, + /* 41 */ 0, 0, 0, + /* 42 */ 0, 0, 0, + /* 43 */ 0, 0, 0, + /* 44 */ VK_SNAPSHOT, 0, KEY_Print, + /* 45 */ VK_INSERT, 0, KEY_Insert, + /* 46 */ VK_DELETE, 0, KEY_Delete, + /* 47 */ 0, 0, 0, + /* 48 */ 0, 0, 0, + /* 49 */ 0, 0, 0, + /* 50 */ 0, 0, 0, + /* 51 */ 0, 0, 0, + /* 52 */ 0, 0, 0, + /* 53 */ 0, 0, 0, + /* 54 */ 0, 0, 0, + /* 55 */ 0, 0, 0, + /* 56 */ 0, 0, 0, + /* 57 */ 0, 0, 0, + /* 58 */ 0, 0, 0, + /* 59 */ 0, 0, 0, + /* 60 */ 0, 0, 0, + /* 61 */ 0, 0, 0, + /* 62 */ 0, 0, 0, + /* 63 */ 0, 0, 0, + /* 64 */ 0, 0, 0, + /* 65 */ 0, 0, 0, + /* 66 */ 0, 0, 0, + /* 67 */ 0, 0, 0, + /* 68 */ 0, 0, 0, + /* 69 */ 0, 0, 0, + /* 70 */ 0, 0, 0, + /* 71 */ 0, 0, 0, + /* 72 */ 0, 0, 0, + /* 73 */ 0, 0, 0, + /* 74 */ 0, 0, 0, + /* 75 */ 0, 0, 0, + /* 76 */ 0, 0, 0, + /* 77 */ 0, 0, 0, + /* 78 */ 0, 0, 0, + /* 79 */ 0, 0, 0, + /* 80 */ 0, 0, 0, + /* 81 */ 0, 0, 0, + /* 82 */ 0, 0, 0, + /* 83 */ 0, 0, 0, + /* 84 */ 0, 0, 0, + /* 85 */ 0, 0, 0, + /* 86 */ 0, 0, 0, + /* 87 */ 0, 0, 0, + /* 88 */ 0, 0, 0, + /* 89 */ 0, 0, 0, + /* 90 */ 0, 0, 0, + /* 91 */ VK_LWIN, KEY_LMeta, 0, + /* 92 */ VK_RWIN, KEY_RMeta, 0, + /* 93 */ VK_APPS, KEY_Menu, 0, + /* 94 */ 0, 0, 0, + /* 95 */ 0, 0, 0, + /* 96 */ 0, 0, 0, + /* 97 */ 0, 0, 0, + /* 98 */ 0, 0, 0, + /* 99 */ 0, 0, 0, + /* 100 */ 0, 0, 0, + /* 101 */ 0, 0, 0, + /* 102 */ 0, 0, 0, + /* 103 */ 0, 0, 0, + /* 104 */ 0, 0, 0, + /* 105 */ 0, 0, 0, + /* 106 */ 0, 0, 0, + /* 107 */ 0, 0, 0, + /* 108 */ 0, 0, 0, + /* 109 */ 0, 0, 0, + /* 110 */ 0, 0, 0, + /* 111 */ VK_DIVIDE, 0, KEY_KP_Divide, + /* 112 */ 0, 0, 0, + /* 113 */ 0, 0, 0, + /* 114 */ 0, 0, 0, + /* 115 */ 0, 0, 0, + /* 116 */ 0, 0, 0, + /* 117 */ 0, 0, 0, + /* 118 */ 0, 0, 0, + /* 119 */ 0, 0, 0, + /* 120 */ 0, 0, 0, + /* 121 */ 0, 0, 0, + /* 122 */ 0, 0, 0, + /* 123 */ 0, 0, 0, + /* 124 */ 0, 0, 0, + /* 125 */ 0, 0, 0, + /* 126 */ 0, 0, 0, + /* 127 */ 0, 0, 0, + /* 128 */ 0, 0, 0, + /* 129 */ 0, 0, 0, + /* 130 */ 0, 0, 0, + /* 131 */ 0, 0, 0, + /* 132 */ 0, 0, 0, + /* 133 */ 0, 0, 0, + /* 134 */ 0, 0, 0, + /* 135 */ 0, 0, 0, + /* 136 */ 0, 0, 0, + /* 137 */ 0, 0, 0, + /* 138 */ 0, 0, 0, + /* 139 */ 0, 0, 0, + /* 140 */ 0, 0, 0, + /* 141 */ 0, 0, 0, + /* 142 */ 0, 0, 0, + /* 143 */ 0, 0, 0, + /* 144 */ 0, 0, 0, + /* 145 */ 0, 0, 0, + /* 146 */ 0, 0, 0, + /* 147 */ 0, 0, 0, + /* 148 */ 0, 0, 0, + /* 149 */ 0, 0, 0, + /* 150 */ 0, 0, 0, + /* 151 */ 0, 0, 0, + /* 152 */ 0, 0, 0, + /* 153 */ 0, 0, 0, + /* 154 */ 0, 0, 0, + /* 155 */ 0, 0, 0, + /* 156 */ 0, 0, 0, + /* 157 */ 0, 0, 0, + /* 158 */ 0, 0, 0, + /* 159 */ 0, 0, 0, + /* 160 */ VK_LSHIFT, KEY_ShiftL, 0, + /* 161 */ VK_RSHIFT, KEY_ShiftR, 0, + /* 162 */ VK_LCONTROL, KEY_LCtrl, 0, + /* 163 */ VK_RCONTROL, KEY_RCtrl, 0, + /* 164 */ VK_LMENU, KEY_Alt, 0, + /* 165 */ VK_RMENU, KEY_AltLang, 0, + /* 166 */ 0, 0, 0, + /* 167 */ 0, 0, 0, + /* 168 */ 0, 0, 0, + /* 169 */ 0, 0, 0, + /* 170 */ 0, 0, 0, + /* 171 */ 0, 0, 0, + /* 172 */ 0, 0, 0, + /* 173 */ VK_VOLUME_MUTE, 0, KEY_Mute, + /* 174 */ VK_VOLUME_DOWN, 0, KEY_AudioLower, + /* 175 */ VK_VOLUME_UP, 0, KEY_AudioRaise, + /* 176 */ VK_MEDIA_NEXT_TRACK, 0, KEY_NEXTSONG, + /* 177 */ VK_MEDIA_PREV_TRACK, 0, KEY_PREVIOUSSONG, + /* 178 */ VK_MEDIA_STOP, 0, KEY_STOPCD, + /* 179 */ VK_MEDIA_PLAY_PAUSE, 0, KEY_PLAYPAUSE, + /* 180 */ 0, 0, 0, + /* 181 */ 0, 0, 0, + /* 182 */ 0, 0, 0, + /* 183 */ 0, 0, 0, + /* 184 */ 0, 0, 0, + /* 185 */ 0, 0, 0, + /* 186 */ 0, 0, 0, + /* 187 */ 0, 0, 0, + /* 188 */ 0, 0, 0, + /* 189 */ 0, 0, 0, + /* 190 */ 0, 0, 0, + /* 191 */ 0, 0, 0, + /* 192 */ 0, 0, 0, + /* 193 */ 0, 0, 0, + /* 194 */ 0, 0, 0, + /* 195 */ 0, 0, 0, + /* 196 */ 0, 0, 0, + /* 197 */ 0, 0, 0, + /* 198 */ 0, 0, 0, + /* 199 */ 0, 0, 0, + /* 200 */ 0, 0, 0, + /* 201 */ 0, 0, 0, + /* 202 */ 0, 0, 0, + /* 203 */ 0, 0, 0, + /* 204 */ 0, 0, 0, + /* 205 */ 0, 0, 0, + /* 206 */ 0, 0, 0, + /* 207 */ 0, 0, 0, + /* 208 */ 0, 0, 0, + /* 209 */ 0, 0, 0, + /* 210 */ 0, 0, 0, + /* 211 */ 0, 0, 0, + /* 212 */ 0, 0, 0, + /* 213 */ 0, 0, 0, + /* 214 */ 0, 0, 0, + /* 215 */ 0, 0, 0, + /* 216 */ 0, 0, 0, + /* 217 */ 0, 0, 0, + /* 218 */ 0, 0, 0, + /* 219 */ 0, 0, 0, + /* 220 */ 0, 0, 0, + /* 221 */ 0, 0, 0, + /* 222 */ 0, 0, 0, + /* 223 */ VK_OEM_8, 0, KEY_RCtrl, /* at least on Canadian Multilingual Standard layout */ + /* 224 */ 0, 0, 0, + /* 225 */ 0, 0, 0, + /* 226 */ 0, 0, 0, + /* 227 */ 0, 0, 0, + /* 228 */ 0, 0, 0, + /* 229 */ 0, 0, 0, + /* 230 */ 0, 0, 0, + /* 231 */ 0, 0, 0, + /* 232 */ 0, 0, 0, + /* 233 */ 0, 0, 0, + /* 234 */ 0, 0, 0, + /* 235 */ 0, 0, 0, + /* 236 */ 0, 0, 0, + /* 237 */ 0, 0, 0, + /* 238 */ 0, 0, 0, + /* 239 */ 0, 0, 0, + /* 240 */ 0, 0, 0, + /* 241 */ 0, 0, 0, + /* 242 */ 0, 0, 0, + /* 243 */ 0, 0, 0, + /* 244 */ 0, 0, 0, + /* 245 */ 0, 0, 0, + /* 246 */ 0, 0, 0, + /* 247 */ 0, 0, 0, + /* 248 */ 0, 0, 0, + /* 249 */ 0, 0, 0, + /* 250 */ 0, 0, 0, + /* 251 */ 0, 0, 0, + /* 252 */ 0, 0, 0, + /* 253 */ 0, 0, 0, + /* 254 */ 0, 0, 0, + /* 255 */ VK_FN, 0, KEY_Fn /* Most keyboards don't generate a scancode for Fn, but a few do... */ +}; + +#endif /* WINKEYBD_H */ diff --git a/xorg-server/hw/xwin/winkeynames.h b/xorg-server/hw/xwin/winkeynames.h index a6738330e..75e172e1f 100644 --- a/xorg-server/hw/xwin/winkeynames.h +++ b/xorg-server/hw/xwin/winkeynames.h @@ -1,206 +1,206 @@ -#ifndef _WINKEYNAMES_H
-#define _WINKEYNAMES_H
-/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-#define GLYPHS_PER_KEY 4
-#define NUM_KEYCODES 248
-#define MIN_KEYCODE 8
-#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
-
-#define AltMask Mod1Mask
-#define NumLockMask Mod2Mask
-#define AltLangMask Mod3Mask
-#define KanaMask Mod4Mask
-#define ScrollLockMask Mod5Mask
-
-#define ModifierDown(k) ((keyc->state & (k)) == (k))
-
-/*
- * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three)
- * sets of scancodes. Set3 can only be generated by a MF keyboard.
- * Set2 sends a makecode for keypress, and the same code prefixed by a
- * F0 for keyrelease. This is a little bit ugly to handle. Thus we use
- * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes.
- * Bit 7 ist set if the key is released. The code E0 switches to a
- * different meaning to add the new MF cursorkeys, while not breaking old
- * applications. E1 is another special prefix. Since I assume that there
- * will be further versions of PC/XT scancode compatible keyboards, we
- * may be in trouble one day.
- *
- * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3.
- * 2) Use the keyboards native set and translate it to common keysyms.
- */
-
-/*
- * definition of the AT84/MF101/MF102 Keyboard:
- * ============================================================
- * Defined Key Cap Glyphs Pressed value
- * Key Name Main Also (hex) (dec)
- * ---------------- ---------- ------- ------ ------
- */
-
-#define KEY_Escape /* Escape 0x01 */ 1
-#define KEY_1 /* 1 ! 0x02 */ 2
-#define KEY_2 /* 2 @ 0x03 */ 3
-#define KEY_3 /* 3 # 0x04 */ 4
-#define KEY_4 /* 4 $ 0x05 */ 5
-#define KEY_5 /* 5 % 0x06 */ 6
-#define KEY_6 /* 6 ^ 0x07 */ 7
-#define KEY_7 /* 7 & 0x08 */ 8
-#define KEY_8 /* 8 * 0x09 */ 9
-#define KEY_9 /* 9 ( 0x0a */ 10
-#define KEY_0 /* 0 ) 0x0b */ 11
-#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12
-#define KEY_Equal /* = (Equal) + 0x0d */ 13
-#define KEY_BackSpace /* Back Space 0x0e */ 14
-#define KEY_Tab /* Tab 0x0f */ 15
-#define KEY_Q /* Q 0x10 */ 16
-#define KEY_W /* W 0x11 */ 17
-#define KEY_E /* E 0x12 */ 18
-#define KEY_R /* R 0x13 */ 19
-#define KEY_T /* T 0x14 */ 20
-#define KEY_Y /* Y 0x15 */ 21
-#define KEY_U /* U 0x16 */ 22
-#define KEY_I /* I 0x17 */ 23
-#define KEY_O /* O 0x18 */ 24
-#define KEY_P /* P 0x19 */ 25
-#define KEY_LBrace /* [ { 0x1a */ 26
-#define KEY_RBrace /* ] } 0x1b */ 27
-#define KEY_Enter /* Enter 0x1c */ 28
-#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29
-#define KEY_A /* A 0x1e */ 30
-#define KEY_S /* S 0x1f */ 31
-#define KEY_D /* D 0x20 */ 32
-#define KEY_F /* F 0x21 */ 33
-#define KEY_G /* G 0x22 */ 34
-#define KEY_H /* H 0x23 */ 35
-#define KEY_J /* J 0x24 */ 36
-#define KEY_K /* K 0x25 */ 37
-#define KEY_L /* L 0x26 */ 38
-#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39
-#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40
-#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41
-#define KEY_ShiftL /* Shift(left) 0x2a */ 42
-#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43
-#define KEY_Z /* Z 0x2c */ 44
-#define KEY_X /* X 0x2d */ 45
-#define KEY_C /* C 0x2e */ 46
-#define KEY_V /* V 0x2f */ 47
-#define KEY_B /* B 0x30 */ 48
-#define KEY_N /* N 0x31 */ 49
-#define KEY_M /* M 0x32 */ 50
-#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51
-#define KEY_Period /* . (Period) >(Greater)0x34 */ 52
-#define KEY_Slash /* / (Slash) ? 0x35 */ 53
-#define KEY_ShiftR /* Shift(right) 0x36 */ 54
-#define KEY_KP_Multiply /* * 0x37 */ 55
-#define KEY_Alt /* Alt(left) 0x38 */ 56
-#define KEY_Space /* (SpaceBar) 0x39 */ 57
-#define KEY_CapsLock /* CapsLock 0x3a */ 58
-#define KEY_F1 /* F1 0x3b */ 59
-#define KEY_F2 /* F2 0x3c */ 60
-#define KEY_F3 /* F3 0x3d */ 61
-#define KEY_F4 /* F4 0x3e */ 62
-#define KEY_F5 /* F5 0x3f */ 63
-#define KEY_F6 /* F6 0x40 */ 64
-#define KEY_F7 /* F7 0x41 */ 65
-#define KEY_F8 /* F8 0x42 */ 66
-#define KEY_F9 /* F9 0x43 */ 67
-#define KEY_F10 /* F10 0x44 */ 68
-#define KEY_NumLock /* NumLock 0x45 */ 69
-#define KEY_ScrollLock /* ScrollLock 0x46 */ 70
-#define KEY_KP_7 /* 7 Home 0x47 */ 71
-#define KEY_KP_8 /* 8 Up 0x48 */ 72
-#define KEY_KP_9 /* 9 PgUp 0x49 */ 73
-#define KEY_KP_Minus /* - (Minus) 0x4a */ 74
-#define KEY_KP_4 /* 4 Left 0x4b */ 75
-#define KEY_KP_5 /* 5 0x4c */ 76
-#define KEY_KP_6 /* 6 Right 0x4d */ 77
-#define KEY_KP_Plus /* + (Plus) 0x4e */ 78
-#define KEY_KP_1 /* 1 End 0x4f */ 79
-#define KEY_KP_2 /* 2 Down 0x50 */ 80
-#define KEY_KP_3 /* 3 PgDown 0x51 */ 81
-#define KEY_KP_0 /* 0 Insert 0x52 */ 82
-#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83
-#define KEY_SysReqest /* SysReqest 0x54 */ 84
- /* NOTUSED 0x55 */
-#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86
-#define KEY_F11 /* F11 0x57 */ 87
-#define KEY_F12 /* F12 0x58 */ 88
-
-#define KEY_Prefix0 /* special 0x60 */ 96
-#define KEY_Prefix1 /* specail 0x61 */ 97
-
-/*
- * The 'scancodes' below are generated by the server, because the MF101/102
- * keyboard sends them as sequence of other scancodes
- */
-#define KEY_Home /* Home 0x59 */ 89
-#define KEY_Up /* Up 0x5a */ 90
-#define KEY_PgUp /* PgUp 0x5b */ 91
-#define KEY_Left /* Left 0x5c */ 92
-#define KEY_Begin /* Begin 0x5d */ 93
-#define KEY_Right /* Right 0x5e */ 94
-#define KEY_End /* End 0x5f */ 95
-#define KEY_Down /* Down 0x60 */ 96
-#define KEY_PgDown /* PgDown 0x61 */ 97
-#define KEY_Insert /* Insert 0x62 */ 98
-#define KEY_Delete /* Delete 0x63 */ 99
-#define KEY_KP_Enter /* Enter 0x64 */ 100
-#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101
-#define KEY_Pause /* Pause 0x66 */ 102
-#define KEY_Print /* Print 0x67 */ 103
-#define KEY_KP_Divide /* Divide 0x68 */ 104
-#define KEY_AltLang /* AtlLang(right) 0x69 */ 105
-#define KEY_Break /* Break 0x6a */ 106
-#define KEY_LMeta /* Left Meta 0x6b */ 107
-#define KEY_RMeta /* Right Meta 0x6c */ 108
-#define KEY_Menu /* Menu 0x6d */ 109
-#define KEY_F13 /* F13 0x6e */ 110
-#define KEY_F14 /* F14 0x6f */ 111
-#define KEY_F15 /* F15 0x70 */ 112
-#define KEY_F16 /* F16 0x71 */ 113
-#define KEY_F17 /* F17 0x72 */ 114
-#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
-#define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118
-#define KEY_XFER /* Kanji Transfer 0x79 */ 121
-#define KEY_NFER /* No Kanji Transfer 0x7b */ 123
-#define KEY_Yen /* Yen 0x7d */ 125
-#define KEY_HKTG /* Hirugana/Katakana tog 0xc8 */ 200
-#define KEY_BSlash2 /* \ _ 0xcb */ 203
-
-#define KEY_Mute /* Audio Mute */ 152
-#define KEY_AudioLower /* Audio Lower */ 168
-#define KEY_AudioRaise /* Audio Raise */ 166
-
-#define KEY_NEXTSONG /* Media next */ 145
-#define KEY_PLAYPAUSE /* Media play/pause toggle */ 154
-#define KEY_PREVIOUSSONG /* Media previous */ 136
-#define KEY_STOPCD /* Media stop */ 156
-
-/* These are for "notused" and "unknown" entries in translation maps. */
-#define KEY_NOTUSED 0
-#define KEY_UNKNOWN 255
-
-#endif /* _WINKEYNAMES_H */
+#ifndef _WINKEYNAMES_H +#define _WINKEYNAMES_H +/* + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Thomas Roell not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Thomas Roell makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + */ + +#define GLYPHS_PER_KEY 4 +#define NUM_KEYCODES 248 +#define MIN_KEYCODE 8 +#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1) + +#define AltMask Mod1Mask +#define NumLockMask Mod2Mask +#define AltLangMask Mod3Mask +#define KanaMask Mod4Mask +#define ScrollLockMask Mod5Mask + +#define ModifierDown(k) ((keyc->state & (k)) == (k)) + +/* + * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three) + * sets of scancodes. Set3 can only be generated by a MF keyboard. + * Set2 sends a makecode for keypress, and the same code prefixed by a + * F0 for keyrelease. This is a little bit ugly to handle. Thus we use + * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes. + * Bit 7 ist set if the key is released. The code E0 switches to a + * different meaning to add the new MF cursorkeys, while not breaking old + * applications. E1 is another special prefix. Since I assume that there + * will be further versions of PC/XT scancode compatible keyboards, we + * may be in trouble one day. + * + * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3. + * 2) Use the keyboards native set and translate it to common keysyms. + */ + +/* + * definition of the AT84/MF101/MF102 Keyboard: + * ============================================================ + * Defined Key Cap Glyphs Pressed value + * Key Name Main Also (hex) (dec) + * ---------------- ---------- ------- ------ ------ + */ + +#define KEY_Escape /* Escape 0x01 */ 1 +#define KEY_1 /* 1 ! 0x02 */ 2 +#define KEY_2 /* 2 @ 0x03 */ 3 +#define KEY_3 /* 3 # 0x04 */ 4 +#define KEY_4 /* 4 $ 0x05 */ 5 +#define KEY_5 /* 5 % 0x06 */ 6 +#define KEY_6 /* 6 ^ 0x07 */ 7 +#define KEY_7 /* 7 & 0x08 */ 8 +#define KEY_8 /* 8 * 0x09 */ 9 +#define KEY_9 /* 9 ( 0x0a */ 10 +#define KEY_0 /* 0 ) 0x0b */ 11 +#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12 +#define KEY_Equal /* = (Equal) + 0x0d */ 13 +#define KEY_BackSpace /* Back Space 0x0e */ 14 +#define KEY_Tab /* Tab 0x0f */ 15 +#define KEY_Q /* Q 0x10 */ 16 +#define KEY_W /* W 0x11 */ 17 +#define KEY_E /* E 0x12 */ 18 +#define KEY_R /* R 0x13 */ 19 +#define KEY_T /* T 0x14 */ 20 +#define KEY_Y /* Y 0x15 */ 21 +#define KEY_U /* U 0x16 */ 22 +#define KEY_I /* I 0x17 */ 23 +#define KEY_O /* O 0x18 */ 24 +#define KEY_P /* P 0x19 */ 25 +#define KEY_LBrace /* [ { 0x1a */ 26 +#define KEY_RBrace /* ] } 0x1b */ 27 +#define KEY_Enter /* Enter 0x1c */ 28 +#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29 +#define KEY_A /* A 0x1e */ 30 +#define KEY_S /* S 0x1f */ 31 +#define KEY_D /* D 0x20 */ 32 +#define KEY_F /* F 0x21 */ 33 +#define KEY_G /* G 0x22 */ 34 +#define KEY_H /* H 0x23 */ 35 +#define KEY_J /* J 0x24 */ 36 +#define KEY_K /* K 0x25 */ 37 +#define KEY_L /* L 0x26 */ 38 +#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39 +#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40 +#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41 +#define KEY_ShiftL /* Shift(left) 0x2a */ 42 +#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43 +#define KEY_Z /* Z 0x2c */ 44 +#define KEY_X /* X 0x2d */ 45 +#define KEY_C /* C 0x2e */ 46 +#define KEY_V /* V 0x2f */ 47 +#define KEY_B /* B 0x30 */ 48 +#define KEY_N /* N 0x31 */ 49 +#define KEY_M /* M 0x32 */ 50 +#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51 +#define KEY_Period /* . (Period) >(Greater)0x34 */ 52 +#define KEY_Slash /* / (Slash) ? 0x35 */ 53 +#define KEY_ShiftR /* Shift(right) 0x36 */ 54 +#define KEY_KP_Multiply /* * 0x37 */ 55 +#define KEY_Alt /* Alt(left) 0x38 */ 56 +#define KEY_Space /* (SpaceBar) 0x39 */ 57 +#define KEY_CapsLock /* CapsLock 0x3a */ 58 +#define KEY_F1 /* F1 0x3b */ 59 +#define KEY_F2 /* F2 0x3c */ 60 +#define KEY_F3 /* F3 0x3d */ 61 +#define KEY_F4 /* F4 0x3e */ 62 +#define KEY_F5 /* F5 0x3f */ 63 +#define KEY_F6 /* F6 0x40 */ 64 +#define KEY_F7 /* F7 0x41 */ 65 +#define KEY_F8 /* F8 0x42 */ 66 +#define KEY_F9 /* F9 0x43 */ 67 +#define KEY_F10 /* F10 0x44 */ 68 +#define KEY_NumLock /* NumLock 0x45 */ 69 +#define KEY_ScrollLock /* ScrollLock 0x46 */ 70 +#define KEY_KP_7 /* 7 Home 0x47 */ 71 +#define KEY_KP_8 /* 8 Up 0x48 */ 72 +#define KEY_KP_9 /* 9 PgUp 0x49 */ 73 +#define KEY_KP_Minus /* - (Minus) 0x4a */ 74 +#define KEY_KP_4 /* 4 Left 0x4b */ 75 +#define KEY_KP_5 /* 5 0x4c */ 76 +#define KEY_KP_6 /* 6 Right 0x4d */ 77 +#define KEY_KP_Plus /* + (Plus) 0x4e */ 78 +#define KEY_KP_1 /* 1 End 0x4f */ 79 +#define KEY_KP_2 /* 2 Down 0x50 */ 80 +#define KEY_KP_3 /* 3 PgDown 0x51 */ 81 +#define KEY_KP_0 /* 0 Insert 0x52 */ 82 +#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83 +#define KEY_SysReqest /* SysReqest 0x54 */ 84 +#define KEY_Fn /* Fn 0x55 */ 85 +#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86 +#define KEY_F11 /* F11 0x57 */ 87 +#define KEY_F12 /* F12 0x58 */ 88 + +#define KEY_Prefix0 /* special 0x60 */ 96 +#define KEY_Prefix1 /* specail 0x61 */ 97 + +/* + * The 'scancodes' below are generated by the server, because the MF101/102 + * keyboard sends them as sequence of other scancodes + */ +#define KEY_Home /* Home 0x59 */ 89 +#define KEY_Up /* Up 0x5a */ 90 +#define KEY_PgUp /* PgUp 0x5b */ 91 +#define KEY_Left /* Left 0x5c */ 92 +#define KEY_Begin /* Begin 0x5d */ 93 +#define KEY_Right /* Right 0x5e */ 94 +#define KEY_End /* End 0x5f */ 95 +#define KEY_Down /* Down 0x60 */ 96 +#define KEY_PgDown /* PgDown 0x61 */ 97 +#define KEY_Insert /* Insert 0x62 */ 98 +#define KEY_Delete /* Delete 0x63 */ 99 +#define KEY_KP_Enter /* Enter 0x64 */ 100 +#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101 +#define KEY_Pause /* Pause 0x66 */ 102 +#define KEY_Print /* Print 0x67 */ 103 +#define KEY_KP_Divide /* Divide 0x68 */ 104 +#define KEY_AltLang /* AtlLang(right) 0x69 */ 105 +#define KEY_Break /* Break 0x6a */ 106 +#define KEY_LMeta /* Left Meta 0x6b */ 107 +#define KEY_RMeta /* Right Meta 0x6c */ 108 +#define KEY_Menu /* Menu 0x6d */ 109 +#define KEY_F13 /* F13 0x6e */ 110 +#define KEY_F14 /* F14 0x6f */ 111 +#define KEY_F15 /* F15 0x70 */ 112 +#define KEY_F16 /* F16 0x71 */ 113 +#define KEY_F17 /* F17 0x72 */ 114 +#define KEY_KP_DEC /* KP_DEC 0x73 */ 115 +#define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118 +#define KEY_XFER /* Kanji Transfer 0x79 */ 121 +#define KEY_NFER /* No Kanji Transfer 0x7b */ 123 +#define KEY_Yen /* Yen 0x7d */ 125 +#define KEY_HKTG /* Hirugana/Katakana tog 0xc8 */ 200 +#define KEY_BSlash2 /* \ _ 0xcb */ 203 + +#define KEY_Mute /* Audio Mute */ 152 +#define KEY_AudioLower /* Audio Lower */ 168 +#define KEY_AudioRaise /* Audio Raise */ 166 + +#define KEY_NEXTSONG /* Media next */ 145 +#define KEY_PLAYPAUSE /* Media play/pause toggle */ 154 +#define KEY_PREVIOUSSONG /* Media previous */ 136 +#define KEY_STOPCD /* Media stop */ 156 + +/* These are for "notused" and "unknown" entries in translation maps. */ +#define KEY_NOTUSED 0 +#define KEY_UNKNOWN 255 + +#endif /* _WINKEYNAMES_H */ diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c index 752334a31..99509f28e 100644 --- a/xorg-server/hw/xwin/winmouse.c +++ b/xorg-server/hw/xwin/winmouse.c @@ -79,6 +79,7 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState) case DEVICE_INIT: /* Get number of mouse buttons */ lngMouseButtons = GetSystemMetrics(SM_CMOUSEBUTTONS); + winMsg(X_PROBED, "%d mouse buttons found\n", lngMouseButtons); /* Mapping of windows events to X events: * LEFT:1 MIDDLE:2 RIGHT:3 @@ -89,7 +90,6 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState) */ 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) @@ -356,15 +356,12 @@ winMouseButtonsHandle (ScreenPtr pScreen, /** * Enqueue a motion event. * - * XXX: miPointerMove does exactly this, but is static :-( (and uses a static buffer) - * */ void winEnqueueMotion(int x, int y) { int valuators[2]; ValuatorMask mask; - miPointerSetPosition(g_pwinPointer, POINTER_RELATIVE, &x, &y); valuators[0] = x; valuators[1] = y; diff --git a/xorg-server/hw/xwin/winmultiwindowclass.h b/xorg-server/hw/xwin/winmultiwindowclass.h index c635ab20b..1c9a5e52d 100644 --- a/xorg-server/hw/xwin/winmultiwindowclass.h +++ b/xorg-server/hw/xwin/winmultiwindowclass.h @@ -47,6 +47,16 @@ typedef struct { /* this structure may be extended in the future */ } WinXWMHints; +/* Window manager hints mask bits */ +#define InputHint (1L << 0) +#define StateHint (1L << 1) +#define IconPixmapHint (1L << 2) +#define IconWindowHint (1L << 3) +#define IconPositionHint (1L << 4) +#define IconMaskHint (1L << 5) +#define WindowGroupHint (1L << 6) +#define UrgencyHint (1L << 8) +#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint|IconPositionHint|IconMaskHint|WindowGroupHint) /* * new version containing base_width, base_height, and win_gravity fields; diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c index 2329d163e..aabde6b4a 100644 --- a/xorg-server/hw/xwin/winmultiwindowwindow.c +++ b/xorg-server/hw/xwin/winmultiwindowwindow.c @@ -638,8 +638,6 @@ winDestroyWindowsWindow (WindowPtr pWin) hIcon = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_BIG, 0); hIconSm = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0); - SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, NULL); - /* Destroy the Windows window */ DestroyWindow (pWinPriv->hWnd); diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c index 7c4056388..70f53854c 100644 --- a/xorg-server/hw/xwin/winmultiwindowwm.c +++ b/xorg-server/hw/xwin/winmultiwindowwm.c @@ -204,7 +204,11 @@ winUpdateWindowPosition (HWND hWnd, Bool reshape, HWND *zstyle); */ static jmp_buf g_jmpWMEntry; +static XIOErrorHandler g_winMultiWindowWMOldIOErrorHandler; +static pthread_t g_winMultiWindowWMThread; static jmp_buf g_jmpXMsgProcEntry; +static XIOErrorHandler g_winMultiWindowXMsgProcOldIOErrorHandler; +static pthread_t g_winMultiWindowXMsgProcThread; static Bool g_shutdown = FALSE; static Bool redirectError = FALSE; static Bool g_fAnotherWMRunning = FALSE; @@ -901,9 +905,14 @@ winMultiWindowXMsgProc (void *pArg) ErrorF ("winMultiWindowXMsgProc - pthread_mutex_unlock () returned.\n"); + /* Install our error handler */ + XSetErrorHandler (winMultiWindowXMsgProcErrorHandler); + g_winMultiWindowXMsgProcThread = pthread_self(); + g_winMultiWindowXMsgProcOldIOErrorHandler = XSetIOErrorHandler (winMultiWindowXMsgProcIOErrorHandler); + /* Set jump point for IO Error exits */ iReturn = setjmp (g_jmpXMsgProcEntry); - + /* Check if we should continue operations */ if (iReturn != WIN_JMP_ERROR_IO && iReturn != WIN_JMP_OKAY) @@ -919,10 +928,6 @@ winMultiWindowXMsgProc (void *pArg) pthread_exit (NULL); } - /* Install our error handler */ - XSetErrorHandler (winMultiWindowXMsgProcErrorHandler); - XSetIOErrorHandler (winMultiWindowXMsgProcIOErrorHandler); - /* Setup the display connection string x */ snprintf (pszDisplay, 512, "127.0.0.1:%s.%d", display, (int)pProcArg->dwScreen); @@ -1310,9 +1315,14 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg) ErrorF ("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n"); + /* Install our error handler */ + XSetErrorHandler (winMultiWindowWMErrorHandler); + g_winMultiWindowWMThread = pthread_self(); + g_winMultiWindowWMOldIOErrorHandler = XSetIOErrorHandler (winMultiWindowWMIOErrorHandler); + /* Set jump point for IO Error exits */ iReturn = setjmp (g_jmpWMEntry); - + /* Check if we should continue operations */ if (iReturn != WIN_JMP_ERROR_IO && iReturn != WIN_JMP_OKAY) @@ -1328,10 +1338,6 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg) pthread_exit (NULL); } - /* Install our error handler */ - XSetErrorHandler (winMultiWindowWMErrorHandler); - XSetIOErrorHandler (winMultiWindowWMIOErrorHandler); - /* Setup the display connection string x */ snprintf (pszDisplay, 512, @@ -1458,12 +1464,18 @@ winMultiWindowWMIOErrorHandler (Display *pDisplay) { ErrorF ("winMultiWindowWMIOErrorHandler!\n\n"); - if (g_shutdown) - pthread_exit(NULL); + if (pthread_equal(pthread_self(),g_winMultiWindowWMThread)) + { + if (g_shutdown) + pthread_exit(NULL); + + /* Restart at the main entry point */ + longjmp (g_jmpWMEntry, WIN_JMP_ERROR_IO); + } + + if (g_winMultiWindowWMOldIOErrorHandler) + g_winMultiWindowWMOldIOErrorHandler(pDisplay); - /* Restart at the main entry point */ - longjmp (g_jmpWMEntry, WIN_JMP_ERROR_IO); - return 0; } @@ -1498,9 +1510,15 @@ winMultiWindowXMsgProcIOErrorHandler (Display *pDisplay) { ErrorF ("winMultiWindowXMsgProcIOErrorHandler!\n\n"); - /* Restart at the main entry point */ - longjmp (g_jmpXMsgProcEntry, WIN_JMP_ERROR_IO); - + if (pthread_equal(pthread_self(),g_winMultiWindowXMsgProcThread)) + { + /* Restart at the main entry point */ + longjmp (g_jmpXMsgProcEntry, WIN_JMP_ERROR_IO); + } + + if (g_winMultiWindowXMsgProcOldIOErrorHandler) + g_winMultiWindowXMsgProcOldIOErrorHandler(pDisplay); + return 0; } @@ -1564,6 +1582,8 @@ winDeinitMultiWindowWM (void) #define HINT_SIZEBOX (1l<<2) #define HINT_CAPTION (1l<<3) #define HINT_NOMAXIMIZE (1L<<4) +#define HINT_NOMINIMIZE (1L<<5) +#define HINT_NOSYSMENU (1L<<6) /* These two are used on their own */ #define HINT_MAX (1L<<0) #define HINT_MIN (1L<<1) @@ -1622,6 +1642,16 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle) if (mwm_hint->decorations & MwmDecorBorder) hint |= HINT_BORDER; if (mwm_hint->decorations & MwmDecorHandle) hint |= HINT_SIZEBOX; if (mwm_hint->decorations & MwmDecorTitle) hint |= HINT_CAPTION; + if (!(mwm_hint->decorations & MwmDecorMenu)) hint |= HINT_NOSYSMENU; + if (!(mwm_hint->decorations & MwmDecorMinimize)) hint |= HINT_NOMINIMIZE; + if (!(mwm_hint->decorations & MwmDecorMaximize)) hint |= HINT_NOMAXIMIZE; + } + else + { + /* + MwmDecorAll means all decorations *except* those specified by other flag + bits that are set. Not yet implemented. + */ } } if (mwm_hint) XFree(mwm_hint); @@ -1720,6 +1750,12 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle) if (hint & HINT_NOMAXIMIZE) style = style & ~WS_MAXIMIZEBOX; + if (hint & HINT_NOMINIMIZE) + style = style & ~WS_MINIMIZEBOX; + + if (hint & HINT_NOSYSMENU) + style = style & ~WS_SYSMENU; + SetWindowLongPtr (hWnd, GWL_STYLE, style); } diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c index 3d23e9746..19dad579c 100644 --- a/xorg-server/hw/xwin/winmultiwindowwndproc.c +++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c @@ -713,9 +713,11 @@ winTopLevelWindowProc (HWND hwnd, UINT message, /* Remove our keyboard hook if it is installed */ winRemoveKeyboardHookLL (); - if (!wParam) - /* Revert the X focus as well, but only if the Windows focus is going to another window */ - DeleteWindowFromAnyEvents(pWin, FALSE); + + /* Revert the X focus as well, but only if the Windows focus is going to another window */ + if (!wParam && pWin) + DeleteWindowFromAnyEvents(pWin, FALSE); + return 0; case WM_SYSDEADCHAR: @@ -898,7 +900,22 @@ winTopLevelWindowProc (HWND hwnd, UINT message, & ~WS_CAPTION & ~WS_SIZEBOX); winUpdateWindowPosition (hwnd, FALSE, &zstyle); - SetForegroundWindow (hwnd); + + { + WinXWMHints hints; + if (winMultiWindowGetWMHints(pWin, &hints)) + { + /* + Give the window focus, unless it has an InputHint + which is FALSE (this is used by e.g. glean to + avoid every test window grabbing the focus) + */ + if (!((hints.flags & InputHint) && (!hints.input))) + { + SetForegroundWindow (hwnd); + } + } + } } wmMsg.msg = WM_WM_MAP3; } diff --git a/xorg-server/hw/xwin/winprefs.c b/xorg-server/hw/xwin/winprefs.c index d941c5169..76c30e9e3 100644 --- a/xorg-server/hw/xwin/winprefs.c +++ b/xorg-server/hw/xwin/winprefs.c @@ -51,8 +51,8 @@ extern const char *winGetBaseDir(void); -/* From winmultiwindowflex.l, the real parser */ -extern void parse_file (FILE *fp); +/* From winprefslex.l, the real parser */ +extern int parse_file (FILE *fp); /* Currently in use command ID, incremented each new menu item created */ @@ -710,6 +710,54 @@ winIconIsOverride(unsigned hiconIn) /* + * Open and parse the XWinrc config file @path. + * If @path is NULL, use the built-in default. + */ +static int +winPrefsLoadPreferences (char *path) +{ + FILE *prefFile = NULL; + + if (path) + prefFile = fopen (path, "r"); + else + { + char defaultPrefs[] = + "MENU rmenu {\n" + " \"How to customize this menu\" EXEC \"xterm +tb -e man XWinrc\"\n" + " \"Launch xterm\" EXEC xterm\n" + " \"Load .XWinrc\" RELOAD\n" + " SEPARATOR\n" + "}\n" + "\n" + "ROOTMENU rmenu\n"; + + path = "built-in default"; + prefFile = fmemopen(defaultPrefs, strlen(defaultPrefs), "r"); + } + + if (!prefFile) + { + ErrorF ("LoadPreferences: %s not found\n", path); + return FALSE; + } + + ErrorF ("LoadPreferences: Loading %s\n", path); + + if((parse_file (prefFile)) != 0) + { + ErrorF ("LoadPreferences: %s is badly formed!\n", path); + fclose (prefFile); + return FALSE; + } + + fclose (prefFile); + return TRUE; +} + + + +/* * Try and open ~/.XWinrc and system.XWinrc * Load it into prefs structure for use by other functions */ @@ -718,16 +766,15 @@ LoadPreferences (void) { char *home; char fname[PATH_MAX+NAME_MAX+2]; - FILE *prefFile; char szDisplay[512]; char *szEnvDisplay; int i, j; char param[PARAM_MAX+1]; char *srcParam, *dstParam; + int parsed = FALSE; /* First, clear all preference settings */ memset (&pref, 0, sizeof(pref)); - prefFile = NULL; /* Now try and find a ~/.xwinrc file */ home = getenv ("HOME"); @@ -737,14 +784,11 @@ LoadPreferences (void) if (fname[strlen(fname)-1]!='/') strcat (fname, "/"); strcat (fname, ".XWinrc"); - - prefFile = fopen (fname, "r"); - if (prefFile) - ErrorF ("winPrefsLoadPreferences: %s\n", fname); + parsed = winPrefsLoadPreferences(fname); } /* No home file found, check system default */ - if (!prefFile) + if (!parsed) { char buffer[MAX_PATH]; #ifdef RELOCATE_PROJECTROOT @@ -753,16 +797,14 @@ LoadPreferences (void) strncpy(buffer, SYSCONFDIR"/X11/system.XWinrc", sizeof(buffer)); #endif buffer[sizeof(buffer)-1] = 0; - prefFile = fopen (buffer, "r"); - if (prefFile) - ErrorF ("winPrefsLoadPreferences: %s\n", buffer); + parsed = winPrefsLoadPreferences(buffer); } - /* If we could open it, then read the settings and close it */ - if (prefFile) + /* Neither user nor system configuration found, or were badly formed */ + if (!parsed) { - parse_file (prefFile); - fclose (prefFile); + ErrorF ("LoadPreferences: See \"man XWinrc\" to customize the XWin menu.\n"); + parsed = winPrefsLoadPreferences(NULL); } /* Setup a DISPLAY environment variable, need to allocate on heap */ diff --git a/xorg-server/hw/xwin/winprefslex.l b/xorg-server/hw/xwin/winprefslex.l index 463dff4ca..ba8aea696 100644 --- a/xorg-server/hw/xwin/winprefslex.l +++ b/xorg-server/hw/xwin/winprefslex.l @@ -113,14 +113,18 @@ yywrap (void) /* * Run a file through the yacc parser */ -void +int parse_file (FILE *file) { + int ret; + if (!file) - return; + return 1; yylineno = 1; yyin = file; - yyparse (); + ret = yyparse (); + yylex_destroy (); + return ret; } diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c index 2b6949ed1..9bec84141 100644 --- a/xorg-server/hw/xwin/winprocarg.c +++ b/xorg-server/hw/xwin/winprocarg.c @@ -141,7 +141,7 @@ winInitializeScreenDefaults(void) defaultScreenInfo.fLessPointer = FALSE; defaultScreenInfo.iResizeMode = notAllowed; defaultScreenInfo.fNoTrayIcon = FALSE; - defaultScreenInfo.iE3BTimeout = WIN_E3B_OFF; + defaultScreenInfo.iE3BTimeout = WIN_E3B_DEFAULT; defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL; defaultScreenInfo.fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL; defaultScreenInfo.fIgnoreInput = FALSE; @@ -789,6 +789,17 @@ ddxProcessArgument (int argc, char *argv[], int i) } /* + * Look for the '-noemulate3buttons' argument + */ + if (IS_OPTION ("-noemulate3buttons")) + { + screenInfoPtr->iE3BTimeout = WIN_E3B_OFF; + + /* Indicate that we have processed this argument */ + return 1; + } + + /* * Look for the '-depth n' argument */ if (IS_OPTION ("-depth")) @@ -1209,7 +1220,7 @@ winLogCommandLine (int argc, char *argv[]) /* - * winLogVersionInfo - Log Cygwin/X version information + * winLogVersionInfo - Log version information */ void diff --git a/xorg-server/hw/xwin/winwindow.h b/xorg-server/hw/xwin/winwindow.h index a6c8e05dd..229696ae4 100644 --- a/xorg-server/hw/xwin/winwindow.h +++ b/xorg-server/hw/xwin/winwindow.h @@ -127,10 +127,13 @@ typedef struct _winWMMessageRec{ #define MwmHintsDecorations (1L << 1) -#define MwmDecorAll (1l << 0) -#define MwmDecorBorder (1l << 1) -#define MwmDecorHandle (1l << 2) -#define MwmDecorTitle (1l << 3) +#define MwmDecorAll (1L << 0) +#define MwmDecorBorder (1L << 1) +#define MwmDecorHandle (1L << 2) +#define MwmDecorTitle (1L << 3) +#define MwmDecorMenu (1L << 4) +#define MwmDecorMinimize (1L << 5) +#define MwmDecorMaximize (1L << 6) /* This structure only contains 3 elements... the Motif 2.0 structure contains 5... we only need the first 3... so that is all we will define */ diff --git a/xorg-server/hw/xwin/winwndproc.c b/xorg-server/hw/xwin/winwndproc.c index a89857a14..88b506891 100644 --- a/xorg-server/hw/xwin/winwndproc.c +++ b/xorg-server/hw/xwin/winwndproc.c @@ -182,6 +182,10 @@ winWindowProc (HWND hwnd, UINT message, "new height: %d new bpp: %d\n", LOWORD (lParam), HIWORD (lParam), wParam); + /* 0 bpp has no defined meaning, ignore this message */ + if (wParam == 0) + break; + /* * Check for a disruptive change in depth. * We can only display a message for a disruptive depth change, @@ -1060,6 +1064,10 @@ winWindowProc (HWND hwnd, UINT message, if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL) break; + /* Discard fake Ctrl_L events that precede AltGR on non-US keyboards */ + if (winIsFakeCtrl_L (message, wParam, lParam)) + return 0; + /* * Discard presses generated from Windows auto-repeat */ @@ -1080,10 +1088,6 @@ winWindowProc (HWND hwnd, UINT message, } } - /* Discard fake Ctrl_L presses that precede AltGR on non-US keyboards */ - if (winIsFakeCtrl_L (message, wParam, lParam)) - return 0; - /* Translate Windows key code to X scan code */ winTranslateKey (wParam, lParam, &iScanCode); |