diff options
Diffstat (limited to 'xorg-server/hw/xwin')
28 files changed, 550 insertions, 255 deletions
diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c index 9aff336e1..8fd82d087 100644 --- a/xorg-server/hw/xwin/InitOutput.c +++ b/xorg-server/hw/xwin/InitOutput.c @@ -1,6 +1,7 @@ /* Copyright 1993, 1998 The Open Group +Copyright (C) Colin Harrison 2005-2008 Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that @@ -73,6 +74,7 @@ extern int g_iLogVerbose; Bool g_fLogInited; extern Bool g_fXdmcpEnabled; +extern Bool g_fAuthEnabled; #ifdef HAS_DEVWINDOWS extern int g_fdMessageQueue; #endif @@ -332,7 +334,7 @@ winCheckMount(void) while ((ent = getmntent(mnt)) != NULL) { - BOOL system = (strcmp(ent->mnt_type, "system") == 0); + BOOL system = (winCheckMntOpt(ent, "user") != NULL); BOOL root = (strcmp(ent->mnt_dir, "/") == 0); BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0); @@ -359,7 +361,8 @@ winCheckMount(void) continue; level = curlevel; - if (winCheckMntOpt(ent, "binmode") == NULL) + if ((winCheckMntOpt(ent, "binary") == NULL) || + (winCheckMntOpt(ent, "binmode") == NULL)) binary = 0; else binary = 1; @@ -372,7 +375,7 @@ winCheckMount(void) } if (!binary) - winMsg(X_WARNING, "/tmp mounted int textmode\n"); + winMsg(X_WARNING, "/tmp mounted in textmode\n"); } #else static void @@ -808,9 +811,8 @@ winUseMsg (void) "\tmonitors are present.\n"); #ifdef XWIN_CLIPBOARD - ErrorF ("-clipboard\n" - "\tRun the clipboard integration module.\n" - "\tDo not use at the same time as 'xwinclip'.\n"); + ErrorF ("-[no]clipboard\n" + "\tEnable [disable] the clipboard integration. Default is enabled.\n"); ErrorF ("-nounicodeclipboard\n" "\tDo not use Unicode clipboard even if NT-based platform.\n"); @@ -1020,11 +1022,9 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) -#if defined(XCSECURITY) /* Generate a cookie used by internal clients for authorization */ - if (g_fXdmcpEnabled) + if (g_fXdmcpEnabled || g_fAuthEnabled) winGenerateAuthorization (); -#endif /* Perform some one time initialization */ if (1 == serverGeneration) diff --git a/xorg-server/hw/xwin/XWin.man.pre b/xorg-server/hw/xwin/XWin.man.pre index 9649e2e60..0bad65c60 100644 --- a/xorg-server/hw/xwin/XWin.man.pre +++ b/xorg-server/hw/xwin/XWin.man.pre @@ -80,10 +80,9 @@ In addition to the normal server options described in the \fIXserver(1)\fP manual page, \fIXWin\fP accepts the following command line switches, \fIall\fP of which are optional: .TP 8 -.B \-clipboard -Enables the integration -between the Cygwin/X clipboard and Windows clipboard. Do not use in -conjunction with the \fIxwinclip\fP program. +.B \-[no]clipboard +Enables [disables] the integration between the Cygwin/X clipboard and +Windows clipboard. The default is enabled. .TP 8 .B "\-clipupdates \fInum_boxes\fP" Specify an optional threshold, above which the boxes in a shadow diff --git a/xorg-server/hw/xwin/XWinrc.man.pre b/xorg-server/hw/xwin/XWinrc.man.pre index 4fb436ddd..5c1fb979b 100644 --- a/xorg-server/hw/xwin/XWinrc.man.pre +++ b/xorg-server/hw/xwin/XWinrc.man.pre @@ -65,8 +65,13 @@ system tray area. .TP 8 .B SILENTEXIT The \fBSILENTEXIT\fP keyword, which takes no parameters, disables the -exit confirmation dialog. +exit confirmation dialog if no clients are connected. +.TP 8 +.B FORCEEXIT +The \fBFORCEEXIT\fP keyword, which takes no parameters, disables the +exit confirmation dialog always. Unsaved client work may be lost but +this may be useful if you want no dialogs. .SH Menu instructions .TP 8 diff --git a/xorg-server/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc b/xorg-server/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc index d9c2d4210..1de6e2ab0 100644 --- a/xorg-server/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc +++ b/xorg-server/hw/xwin/_usr_X11R6_lib_X11_system.XWinrc @@ -119,7 +119,7 @@ SysMenu { # "xterm" "uninstall.ico" # } -# SilentExit +SilentExit DEBUG "Done parsing the configuration file..." diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h index 9009df29b..9ab8ed976 100644 --- a/xorg-server/hw/xwin/win.h +++ b/xorg-server/hw/xwin/win.h @@ -766,10 +766,9 @@ winAllocateCmapPrivates (ColormapPtr pCmap); */ #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) -# if defined(XCSECURITY) Bool winGenerateAuthorization (void); -# endif +void winSetAuthorization(void); #endif diff --git a/xorg-server/hw/xwin/winauth.c b/xorg-server/hw/xwin/winauth.c index b57a35abf..fcd1872da 100644 --- a/xorg-server/hw/xwin/winauth.c +++ b/xorg-server/hw/xwin/winauth.c @@ -1,7 +1,3 @@ -#ifdef HAVE_XWIN_CONFIG_H -#include <xwin-config.h> -#endif -#if defined(XCSECURITY) /* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. * @@ -32,12 +28,14 @@ * Authors: Harold L Hunt II */ +#ifdef HAVE_XWIN_CONFIG_H +#include <xwin-config.h> +#endif + #include "win.h" /* Includes for authorization */ -#include <X11/Xauth.h> #include "securitysrv.h" -#include <X11/extensions/securstr.h> /* @@ -48,13 +46,76 @@ /* - * Globals + * Locals + */ + +static XID g_authId = 0; +static unsigned int g_uiAuthDataLen = 0; +static char *g_pAuthData = NULL; + +/* + * Code to generate a MIT-MAGIC-COOKIE-1, copied from under XCSECURITY */ -XID g_authId = 0; -unsigned int g_uiAuthDataLen = 0; -char *g_pAuthData = NULL; +#ifndef XCSECURITY +static +void +GenerateRandomData (int len, char *buf) +{ + int fd; + + fd = open("/dev/urandom", O_RDONLY); + read(fd, buf, len); + close(fd); +} + + +static char cookie[16]; /* 128 bits */ + +XID +static MitGenerateCookie ( + unsigned data_length, + char *data, + XID id, + unsigned *data_length_return, + char **data_return) +{ + int i = 0; + int status; + + while (data_length--) + { + cookie[i++] += *data++; + if (i >= sizeof (cookie)) i = 0; + } + GenerateRandomData(sizeof (cookie), cookie); + status = MitAddCookie(sizeof (cookie), cookie, id); + if (!status) + { + id = -1; + } + else + { + *data_return = cookie; + *data_length_return = sizeof (cookie); + } + return id; +} +static +XID +GenerateAuthorization( + unsigned name_length, + char *name, + unsigned data_length, + char *data, + unsigned *data_length_return, + char **data_return) +{ + return MitGenerateCookie(data_length, data, + FakeClientID(0), data_length_return, data_return); +} +#endif /* * Generate authorization cookie for internal server clients @@ -78,15 +139,15 @@ winGenerateAuthorization () ErrorF ("winGenerateAuthorization - GenerateAuthorization failed\n"); goto auth_bailout; } -#if 0 + else { - ErrorF ("winGenerateAuthorization - GenerateAuthorization success!\n" + winDebug("winGenerateAuthorization - GenerateAuthorization success!\n" "AuthDataLen: %d AuthData: %s\n", g_uiAuthDataLen, g_pAuthData); } -#endif - + +#ifdef XCSECURITY /* Allocate structure for additional auth information */ pAuth = (SecurityAuthorizationPtr) xalloc (sizeof (SecurityAuthorizationRec)); @@ -119,7 +180,8 @@ winGenerateAuthorization () /* Don't free the auth data, since it is still used internally */ pAuth = NULL; - +#endif + return TRUE; auth_bailout: @@ -128,4 +190,13 @@ winGenerateAuthorization () return FALSE; } -#endif + +/* Use our generated cookie for authentication */ +void +winSetAuthorization(void) +{ + XSetAuthorization (AUTH_NAME, + strlen (AUTH_NAME), + g_pAuthData, + g_uiAuthDataLen); +} diff --git a/xorg-server/hw/xwin/winclipboardtextconv.c b/xorg-server/hw/xwin/winclipboardtextconv.c index fd2e696c3..400f560fa 100644 --- a/xorg-server/hw/xwin/winclipboardtextconv.c +++ b/xorg-server/hw/xwin/winclipboardtextconv.c @@ -84,9 +84,7 @@ winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength) unsigned char *pszEnd = pszSrc + iLength; unsigned char *pszDest = NULL, *pszDestBegin = NULL; -#if 0 - ErrorF ("UNIXtoDOS () - Original data:\n%s\n", *ppszData); -#endif + winDebug("UNIXtoDOS () - Original data:'%s'\n", *ppszData); /* Count \n characters without leading \r */ while (pszSrc < pszEnd) @@ -153,7 +151,5 @@ winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength) free (*ppszData); *ppszData = pszDestBegin; -#if 0 - ErrorF ("UNIXtoDOS () - Final string:\n%s\n", pszDestBegin); -#endif + winDebug("UNIXtoDOS () - Final string:'%s'\n", pszDestBegin); } diff --git a/xorg-server/hw/xwin/winclipboardthread.c b/xorg-server/hw/xwin/winclipboardthread.c index 8eb825fa8..e5b2dc1e0 100644 --- a/xorg-server/hw/xwin/winclipboardthread.c +++ b/xorg-server/hw/xwin/winclipboardthread.c @@ -38,27 +38,15 @@ #ifdef __CYGWIN__ #include <errno.h> #endif -#include "X11/Xauth.h" #include "misc.h" /* - * Constants - */ - -#define AUTH_NAME "MIT-MAGIC-COOKIE-1" - - -/* * References to external symbols */ extern Bool g_fUnicodeClipboard; extern unsigned long serverGeneration; -#if defined(XCSECURITY) -extern unsigned int g_uiAuthDataLen; -extern char *g_pAuthData; -#endif extern Bool g_fClipboardStarted; extern HWND g_hwndClipboard; extern void *g_pClipboardDisplay; @@ -154,13 +142,8 @@ winClipboardProc (void *pvNotUsed) pthread_exit (NULL); } -#if defined(XCSECURITY) /* Use our generated cookie for authentication */ - XSetAuthorization (AUTH_NAME, - strlen (AUTH_NAME), - g_pAuthData, - g_uiAuthDataLen); -#endif + winSetAuthorization(); /* Set error handler */ XSetErrorHandler (winClipboardErrorHandler); diff --git a/xorg-server/hw/xwin/winclipboardwndproc.c b/xorg-server/hw/xwin/winclipboardwndproc.c index 292ca872b..9394b04db 100644 --- a/xorg-server/hw/xwin/winclipboardwndproc.c +++ b/xorg-server/hw/xwin/winclipboardwndproc.c @@ -104,13 +104,13 @@ winProcessXEventsTimeout (HWND hwnd, int iWindow, Display *pDisplay, if (tv.tv_sec < 0) return WIN_XEVENTS_SUCCESS; - /* Wait for a Windows event or an X event */ + /* Wait for an X event */ iReturn = select (iConnNumber + 1,/* Highest fds number */ &fdsRead, /* Read mask */ NULL, /* No write mask */ NULL, /* No exception mask */ &tv); /* No timeout */ - if (iReturn <= 0) + if (iReturn < 0) { ErrorF ("winProcessXEventsTimeout - Call to select () failed: %d. " "Bailing.\n", iReturn); @@ -440,9 +440,9 @@ winClipboardWindowProc (HWND hwnd, UINT message, * follow this message and reassert ownership of the X11 * selections, handling the issue for us. */ + winDebug ("winClipboardWindowProc - WM_DESTROYCLIPBOARD - Ignored.\n"); return 0; - case WM_RENDERFORMAT: case WM_RENDERALLFORMATS: { @@ -536,6 +536,8 @@ winClipboardWindowProc (HWND hwnd, UINT message, if (g_fUnicodeSupport) SetClipboardData (CF_UNICODETEXT, NULL); SetClipboardData (CF_TEXT, NULL); + + ErrorF("winClipboardWindowProc - timed out waiting for WIN_XEVENTS_NOTIFY\n"); } /* BPS - Post ourselves a user message whose handler will reset the diff --git a/xorg-server/hw/xwin/winclipboardwrappers.c b/xorg-server/hw/xwin/winclipboardwrappers.c index c68d78aa3..658d050d2 100644 --- a/xorg-server/hw/xwin/winclipboardwrappers.c +++ b/xorg-server/hw/xwin/winclipboardwrappers.c @@ -324,9 +324,7 @@ winProcSetSelectionOwner (ClientPtr client) REQUEST_SIZE_MATCH(xSetSelectionOwnerReq); -#if 0 - ErrorF ("winProcSetSelectionOwner - Hello.\n"); -#endif + winDebug("winProcSetSelectionOwner - Hello.\n"); /* Watch for server reset */ if (s_ulServerGeneration != serverGeneration) @@ -369,10 +367,8 @@ winProcSetSelectionOwner (ClientPtr client) { fOwnedToNotOwned = TRUE; -#if 0 - ErrorF ("winProcSetSelectionOwner - PRIMARY - Going from " + winDebug("winProcSetSelectionOwner - PRIMARY - Going from " "owned to not owned.\n"); -#endif /* Adjust last owned selection */ if (None != s_iOwners[CLIP_OWN_CLIPBOARD]) @@ -384,10 +380,8 @@ winProcSetSelectionOwner (ClientPtr client) /* Save new selection owner or None */ s_iOwners[CLIP_OWN_PRIMARY] = stuff->window; -#if 0 - ErrorF ("winProcSetSelectionOwner - PRIMARY - Now owned by: %d\n", + winDebug("winProcSetSelectionOwner - PRIMARY - Now owned by: %d\n", stuff->window); -#endif } else if (MakeAtom ("CLIPBOARD", 9, TRUE) == stuff->selection) { @@ -396,11 +390,9 @@ winProcSetSelectionOwner (ClientPtr client) && None != s_iOwners[CLIP_OWN_CLIPBOARD]) { fOwnedToNotOwned = TRUE; - -#if 0 - ErrorF ("winProcSetSelectionOwner - CLIPBOARD - Going from " - "owned to not owned.\n"); -#endif + + winDebug("winProcSetSelectionOwner - CLIPBOARD - Going from " + "owned to not owned.\n"); /* Adjust last owned selection */ if (None != s_iOwners[CLIP_OWN_PRIMARY]) @@ -412,10 +404,9 @@ winProcSetSelectionOwner (ClientPtr client) /* Save new selection owner or None */ s_iOwners[CLIP_OWN_CLIPBOARD] = stuff->window; -#if 0 - ErrorF ("winProcSetSelectionOwner - CLIPBOARD - Now owned by: %d\n", - stuff->window); -#endif + winDebug("winProcSetSelectionOwner - CLIPBOARD - Now owned by: %d\n", + stuff->window); + } else goto winProcSetSelectionOwner_Done; @@ -444,13 +435,11 @@ winProcSetSelectionOwner (ClientPtr client) && g_hwndClipboard != NULL && g_hwndClipboard == GetClipboardOwner ()) { -#if 0 - ErrorF ("winProcSetSelectionOwner - We currently own the " - "clipboard and neither the PRIMARY nor the CLIPBOARD " - "selections are owned, releasing ownership of Win32 " - "clipboard.\n"); -#endif - + 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 (); @@ -462,9 +451,7 @@ winProcSetSelectionOwner (ClientPtr client) /* Abort if no window at this point */ if (None == stuff->window) { -#if 0 - ErrorF ("winProcSetSelectionOwner - No window, returning.\n"); -#endif + winDebug("winProcSetSelectionOwner - No window, returning.\n"); goto winProcSetSelectionOwner_Done; } @@ -481,10 +468,8 @@ winProcSetSelectionOwner (ClientPtr client) /* Abort if clipboard manager is owning the selection */ if (pDrawable->id == g_iClipboardWindow) { -#if 0 - ErrorF ("winProcSetSelectionOwner - We changed ownership, " - "aborting.\n"); -#endif + winDebug("winProcSetSelectionOwner - We changed ownership, " + "aborting.\n"); goto winProcSetSelectionOwner_Done; } diff --git a/xorg-server/hw/xwin/winclipboardxevents.c b/xorg-server/hw/xwin/winclipboardxevents.c index ec40814db..ae8262ebf 100644 --- a/xorg-server/hw/xwin/winclipboardxevents.c +++ b/xorg-server/hw/xwin/winclipboardxevents.c @@ -105,20 +105,17 @@ winClipboardFlushXEvents (HWND hwnd, */ case SelectionRequest: -#if 0 { char *pszAtomName = NULL; - - ErrorF ("SelectionRequest - target %d\n", - event.xselectionrequest.target); - + winDebug("SelectionRequest - target %d\n", + event.xselectionrequest.target); + pszAtomName = XGetAtomName (pDisplay, event.xselectionrequest.target); - ErrorF ("SelectionRequest - Target atom name %s\n", pszAtomName); + winDebug("SelectionRequest - Target atom name %s\n", pszAtomName); XFree (pszAtomName); pszAtomName = NULL; } -#endif /* Abort if invalid target type */ if (event.xselectionrequest.target != XA_STRING @@ -466,21 +463,17 @@ winClipboardFlushXEvents (HWND hwnd, */ case SelectionNotify: -#if 0 - ErrorF ("winClipboardFlushXEvents - SelectionNotify\n"); + + winDebug ("winClipboardFlushXEvents - SelectionNotify\n"); { char *pszAtomName; - pszAtomName = XGetAtomName (pDisplay, event.xselection.selection); - ErrorF ("winClipboardFlushXEvents - SelectionNotify - ATOM: %s\n", - pszAtomName); - + winDebug("winClipboardFlushXEvents - SelectionNotify - ATOM: %s\n", + pszAtomName); XFree (pszAtomName); } -#endif - /* * Request conversion of UTF8 and CompoundText targets. @@ -489,32 +482,22 @@ winClipboardFlushXEvents (HWND hwnd, { if (event.xselection.target == XA_STRING) { -#if 0 - ErrorF ("winClipboardFlushXEvents - SelectionNotify - " - "XA_STRING\n"); -#endif + winDebug ("winClipboardFlushXEvents - SelectionNotify - " + "XA_STRING\n"); + return WIN_XEVENTS_CONVERT; } else if (event.xselection.target == atomUTF8String) { -#if 0 - ErrorF ("winClipboardFlushXEvents - SelectionNotify - " - "Requesting conversion of UTF8 target.\n"); -#endif - iReturn = XConvertSelection (pDisplay, - event.xselection.selection, - XA_STRING, - atomLocalProperty, - iWindow, - CurrentTime); - if (iReturn != Success) - { - ErrorF ("winClipboardFlushXEvents - SelectionNotify - " - "XConvertSelection () failed for UTF8String, " - "aborting: %d\n", - iReturn); - break; - } + winDebug("winClipboardFlushXEvents - SelectionNotify - " + "Requesting conversion of UTF8 target.\n"); + + XConvertSelection (pDisplay, + event.xselection.selection, + XA_STRING, + atomLocalProperty, + iWindow, + CurrentTime); /* Process the ConvertSelection event */ XFlush (pDisplay); @@ -523,24 +506,15 @@ winClipboardFlushXEvents (HWND hwnd, #ifdef X_HAVE_UTF8_STRING else if (event.xselection.target == atomCompoundText) { -#if 0 - ErrorF ("winClipboardFlushXEvents - SelectionNotify - " - "Requesting conversion of CompoundText target.\n"); -#endif - iReturn = XConvertSelection (pDisplay, - event.xselection.selection, - atomUTF8String, - atomLocalProperty, - iWindow, - CurrentTime); - if (iReturn != Success) - { - ErrorF ("winClipboardFlushXEvents - SelectionNotify - " - "XConvertSelection () failed for CompoundText, " - "aborting: %d\n", - iReturn); - break; - } + winDebug("winClipboardFlushXEvents - SelectionNotify - " + "Requesting conversion of CompoundText target.\n"); + + XConvertSelection (pDisplay, + event.xselection.selection, + atomUTF8String, + atomLocalProperty, + iWindow, + CurrentTime); /* Process the ConvertSelection event */ XFlush (pDisplay); @@ -577,10 +551,8 @@ winClipboardFlushXEvents (HWND hwnd, break; } -#if 0 - ErrorF ("SelectionNotify - returned data %d left %d\n", - xtpText.nitems, ulReturnBytesLeft); -#endif + winDebug("SelectionNotify - returned data %d left %d\n", + xtpText.nitems, ulReturnBytesLeft); /* Request the selection data */ iReturn = XGetWindowProperty (pDisplay, @@ -603,19 +575,16 @@ winClipboardFlushXEvents (HWND hwnd, break; } -#if 0 { char *pszAtomName = NULL; - ErrorF ("SelectionNotify - returned data %d left %d\n", - xtpText.nitems, ulReturnBytesLeft); - + winDebug("SelectionNotify - returned data %d left %d\n", + xtpText.nitems, ulReturnBytesLeft); pszAtomName = XGetAtomName(pDisplay, xtpText.encoding); - ErrorF ("Notify atom name %s\n", pszAtomName); + winDebug("Notify atom name %s\n", pszAtomName); XFree (pszAtomName); pszAtomName = NULL; } -#endif if (fUseUnicode) { @@ -816,7 +785,15 @@ winClipboardFlushXEvents (HWND hwnd, SetClipboardData (CF_TEXT, NULL); return WIN_XEVENTS_NOTIFY; + case SelectionClear: + winDebug("SelectionClear - doing nothing\n"); + break; + + case PropertyNotify: + break; + default: + ErrorF ("winClipboardFlushXEvents - unexpected event type %d\n", event.type); break; } } diff --git a/xorg-server/hw/xwin/wincmap.c b/xorg-server/hw/xwin/wincmap.c index 7ebe00244..9da03888d 100644 --- a/xorg-server/hw/xwin/wincmap.c +++ b/xorg-server/hw/xwin/wincmap.c @@ -185,8 +185,8 @@ winUninstallColormap (ColormapPtr pmap) /* Install the default cmap in place of the cmap to be uninstalled */ if (pmap->mid != pmap->pScreen->defColormap) { - curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, - RT_COLORMAP); + dixLookupResourceByType((pointer) &curpmap, pmap->pScreen->defColormap, + RT_COLORMAP, NullClient, DixUnknownAccess); (*pmap->pScreen->InstallColormap) (curpmap); } } diff --git a/xorg-server/hw/xwin/windialogs.c b/xorg-server/hw/xwin/windialogs.c index 31a3766a6..582b865f5 100644 --- a/xorg-server/hw/xwin/windialogs.c +++ b/xorg-server/hw/xwin/windialogs.c @@ -282,8 +282,9 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv) if (liveClients < 0) liveClients = 0; - /* Don't show the exit confirmation dialog if SilentExit is enabled */ - if (pref.fSilentExit && liveClients <= 0) + /* Don't show the exit confirmation dialog if SilentExit & no clients, + or ForceExit, is enabled */ + if ((pref.fSilentExit && liveClients <= 0) || pref.fForceExit) { if (g_hDlgExit != NULL) { @@ -326,7 +327,7 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv) GetDlgItem (g_hDlgExit, IDCANCEL), TRUE); } -#define CONNECTED_CLIENTS_FORMAT "There are currently %d clients connected." +#define CONNECTED_CLIENTS_FORMAT "There %s currently %d client%s connected." /* @@ -353,7 +354,9 @@ winExitDlgProc (HWND hDialog, UINT message, /* Format the connected clients string */ pszConnectedClients = Xprintf (CONNECTED_CLIENTS_FORMAT, - s_pScreenPriv->iConnectedClients); + (s_pScreenPriv->iConnectedClients == 1) ? "is" : "are", + s_pScreenPriv->iConnectedClients, + (s_pScreenPriv->iConnectedClients == 1) ? "" : "s"); if (!pszConnectedClients) return TRUE; diff --git a/xorg-server/hw/xwin/winglobals.c b/xorg-server/hw/xwin/winglobals.c index 3eb6091e6..7bb4a602d 100644 --- a/xorg-server/hw/xwin/winglobals.c +++ b/xorg-server/hw/xwin/winglobals.c @@ -1,5 +1,6 @@ /* *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved. + *Copyright (C) Colin Harrison 2005-2008 * *Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -26,6 +27,7 @@ *from Harold L Hunt II. * * Authors: Harold L Hunt II + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -63,6 +65,7 @@ HWND g_hDlgExit = NULL; HWND g_hDlgAbout = NULL; const char * g_pszQueryHost = NULL; Bool g_fXdmcpEnabled = FALSE; +Bool g_fAuthEnabled = FALSE; HICON g_hIconX = NULL; HICON g_hSmallIconX = NULL; #ifndef RELOCATE_PROJECTROOT @@ -111,7 +114,7 @@ winDispatchProcPtr winProcSetSelectionOwnerOrig = NULL; */ Bool g_fUnicodeClipboard = TRUE; -Bool g_fClipboard = FALSE; +Bool g_fClipboard = TRUE; Bool g_fClipboardLaunched = FALSE; Bool g_fClipboardStarted = FALSE; pthread_t g_ptClipboardProc; diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c index 611ea5d55..317f14dff 100644 --- a/xorg-server/hw/xwin/winkeybd.c +++ b/xorg-server/hw/xwin/winkeybd.c @@ -73,10 +73,31 @@ winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode) { int iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1]; int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2]; - int iParamScanCode = LOBYTE (HIWORD (lParam)); + int iParam = HIWORD (lParam); + int iParamScanCode = LOBYTE (iParam); + +/* WM_ key messages faked by Vista speech recognition (WSR) don't have a + * scan code. + * + * Vocola 3 (Rick Mohr's supplement to WSR) uses + * System.Windows.Forms.SendKeys.SendWait(), which appears always to give a + * scan code of 1 + */ + if (iParamScanCode <= 1) + { + if (VK_PRIOR <= wParam && wParam <= VK_DOWN) + /* Trigger special case table to translate to extended + * keycode, otherwise if num_lock is on, we can get keypad + * numbers instead of navigation keys. */ + iParam |= KF_EXTENDED; + else + iParamScanCode = MapVirtualKeyEx(wParam, + /*MAPVK_VK_TO_VSC*/0, + GetKeyboardLayout(0)); + } /* Branch on special extended, special non-extended, or normal key */ - if ((HIWORD (lParam) & KF_EXTENDED) && iKeyFixupEx) + if ((iParam & KF_EXTENDED) && iKeyFixupEx) *piScanCode = iKeyFixupEx; else if (iKeyFixup) *piScanCode = iKeyFixup; diff --git a/xorg-server/hw/xwin/winkeybd.h b/xorg-server/hw/xwin/winkeybd.h index 09eed1491..d0d6b9cad 100644 --- a/xorg-server/hw/xwin/winkeybd.h +++ b/xorg-server/hw/xwin/winkeybd.h @@ -45,6 +45,9 @@ #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 */ @@ -208,12 +211,12 @@ g_iKeyMap [] = { /* 157 */ 0, 0, 0, /* 158 */ 0, 0, 0, /* 159 */ 0, 0, 0, - /* 160 */ 0, 0, 0, - /* 161 */ 0, 0, 0, - /* 162 */ 0, 0, 0, - /* 163 */ 0, 0, 0, - /* 164 */ 0, 0, 0, - /* 165 */ 0, 0, 0, + /* 160 */ VK_LSHIFT, KEY_ShiftL, 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, diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c index 99eb6b8d2..342f20d56 100644 --- a/xorg-server/hw/xwin/winmouse.c +++ b/xorg-server/hw/xwin/winmouse.c @@ -381,7 +381,7 @@ void winEnqueueMotion(int x, int y) GetEventList(&events); nevents = GetPointerEvents(events, g_pwinPointer, MotionNotify, 0, - POINTER_ABSOLUTE, 0, 2, valuators); + POINTER_ABSOLUTE | POINTER_SCREEN, 0, 2, valuators); for (i = 0; i < nevents; i++) mieqEnqueue(g_pwinPointer, events[i].event); diff --git a/xorg-server/hw/xwin/winmultiwindowicons.c b/xorg-server/hw/xwin/winmultiwindowicons.c index 9f46a64d9..cb27d2fe3 100644 --- a/xorg-server/hw/xwin/winmultiwindowicons.c +++ b/xorg-server/hw/xwin/winmultiwindowicons.c @@ -462,7 +462,8 @@ winXIconToHICON (WindowPtr pWin, int iconSize) winMultiWindowGetWMHints (pWin, &hints); if (!hints.icon_pixmap) return NULL; - iconPtr = (PixmapPtr) LookupIDByType (hints.icon_pixmap, RT_PIXMAP); + dixLookupResourceByType((pointer) &iconPtr, hints.icon_pixmap, RT_PIXMAP, + NullClient, DixUnknownAccess); if (!iconPtr) return NULL; @@ -484,7 +485,8 @@ winXIconToHICON (WindowPtr pWin, int iconSize) mask = calloc (maskStride, iconSize); winScaleXBitmapToWindows (iconSize, effBPP, iconPtr, image); - maskPtr = (PixmapPtr) LookupIDByType (hints.icon_mask, RT_PIXMAP); + dixLookupResourceByType((pointer) &maskPtr, hints.icon_mask, RT_PIXMAP, + NullClient, DixUnknownAccess); if (maskPtr) { @@ -542,7 +544,7 @@ winUpdateIcon (Window id) WindowPtr pWin; HICON hIcon, hIconSmall=NULL, hIconOld; - pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW); + dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess); if (pWin) { winWindowPriv(pWin); diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c index e2b5ed291..8b91296f7 100644 --- a/xorg-server/hw/xwin/winmultiwindowwindow.c +++ b/xorg-server/hw/xwin/winmultiwindowwindow.c @@ -64,18 +64,6 @@ winUpdateWindowsWindow (WindowPtr pWin); static void winFindWindow (pointer value, XID id, pointer cdata); -/* - * Macros - */ - -#define SubSend(pWin) \ - ((pWin->eventMask|wOtherEventMasks(pWin)) & SubstructureNotifyMask) - -#define StrSend(pWin) \ - ((pWin->eventMask|wOtherEventMasks(pWin)) & StructureNotifyMask) - -#define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent)) - static void winInitMultiWindowClass(void) { @@ -524,21 +512,10 @@ winCreateWindowsWindow (WindowPtr pWin) iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN); iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN); - /* Default positions if none specified */ - if (!winMultiWindowGetWMNormalHints(pWin, &hints)) - hints.flags = 0; - if ( !(hints.flags & (USPosition|PPosition)) && - !winMultiWindowGetTransientFor (pWin, NULL) && - !pWin->overrideRedirect ) - { - iX = CW_USEDEFAULT; - iY = CW_USEDEFAULT; - } - iWidth = pWin->drawable.width; iHeight = pWin->drawable.height; - if (winMultiWindowGetTransientFor (pWin, &pDaddy)) + if (winMultiWindowGetTransientFor (pWin, &pDaddy)) { if (pDaddy) { @@ -546,6 +523,18 @@ winCreateWindowsWindow (WindowPtr pWin) if (hFore && (pDaddy != (WindowPtr)GetProp(hFore, WIN_WID_PROP))) hFore = NULL; } } + else + { + /* Default positions if none specified */ + if (!winMultiWindowGetWMNormalHints(pWin, &hints)) + hints.flags = 0; + if (!(hints.flags & (USPosition|PPosition)) && + !pWin->overrideRedirect) + { + iX = CW_USEDEFAULT; + iY = CW_USEDEFAULT; + } + } /* Create the window */ /* Make it OVERLAPPED in create call since WS_POPUP doesn't support */ @@ -810,7 +799,7 @@ winMinimizeWindow (Window id) ErrorF ("winMinimizeWindow\n"); #endif - pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW); + dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess); if (!pWin) { ErrorF("%s: NULL pWin. Leaving\n", __FUNCTION__); diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c index 18d9aedc2..880ca6a1c 100644 --- a/xorg-server/hw/xwin/winmultiwindowwm.c +++ b/xorg-server/hw/xwin/winmultiwindowwm.c @@ -91,7 +91,6 @@ extern void winUpdateRgnMultiWindow(WindowPtr pWin); #define WIN_JMP_OKAY 0 #define WIN_JMP_ERROR_IO 2 - /* * Local structures */ @@ -140,7 +139,6 @@ typedef struct _XMsgProcArgRec { extern char *display; extern void ErrorF (const char* /*f*/, ...); - /* * Prototypes for local functions */ @@ -209,7 +207,7 @@ static jmp_buf g_jmpWMEntry; static jmp_buf g_jmpXMsgProcEntry; static Bool g_shutdown = FALSE; static Bool redirectError = FALSE; -static Bool g_fAnotherWMRunnig = FALSE; +static Bool g_fAnotherWMRunning = FALSE; /* * PushMessage - Push a message onto the queue @@ -651,7 +649,7 @@ winMultiWindowWMProc (void *pArg) { WMMsgNodePtr pNode; - if(g_fAnotherWMRunnig)/* Another Window manager exists. */ + if(g_fAnotherWMRunning)/* Another Window manager exists. */ { Sleep (1000); continue; @@ -943,6 +941,9 @@ winMultiWindowXMsgProc (void *pArg) /* Print the display connection string */ ErrorF ("winMultiWindowXMsgProc - DISPLAY=%s\n", pszDisplay); + + /* Use our generated cookie for authentication */ + winSetAuthorization(); /* Initialize retry count */ iRetries = 0; @@ -978,26 +979,15 @@ winMultiWindowXMsgProc (void *pArg) "successfully opened the display.\n"); /* Check if another window manager is already running */ - if (pProcArg->pWMInfo->fAllowOtherWM) - { - g_fAnotherWMRunnig = CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen); - } else { - redirectError = FALSE; - XSetErrorHandler (winRedirectErrorHandler); - XSelectInput(pProcArg->pDisplay, - RootWindow (pProcArg->pDisplay, pProcArg->dwScreen), - SubstructureNotifyMask | ButtonPressMask); - XSync (pProcArg->pDisplay, 0); - XSetErrorHandler (winMultiWindowXMsgProcErrorHandler); - if (redirectError) - { - ErrorF ("winMultiWindowXMsgProc - " - "another window manager is running. Exiting.\n"); - pthread_exit (NULL); + g_fAnotherWMRunning = CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen); + + if (g_fAnotherWMRunning && !pProcArg->pWMInfo->fAllowOtherWM) + { + ErrorF ("winMultiWindowXMsgProc - " + "another window manager is running. Exiting.\n"); + pthread_exit (NULL); } - g_fAnotherWMRunnig = FALSE; - } - + /* Set up the supported icon sizes */ xis = XAllocIconSize (); if (xis) @@ -1022,6 +1012,16 @@ winMultiWindowXMsgProc (void *pArg) "WM_CHANGE_STATE", False); + /* + iiimxcf had a bug until 2009-04-27, assuming that the + WM_STATE atom exists, causing clients to fail with + a BadAtom X error if it doesn't. + + Since this is on in the default Solaris 10 install, + workaround this by making sure it does exist... + */ + XInternAtom(pProcArg->pDisplay, "WM_STATE", 0); + /* Loop until we explicitly break out */ while (1) { @@ -1032,17 +1032,17 @@ winMultiWindowXMsgProc (void *pArg) { if (CheckAnotherWindowManager (pProcArg->pDisplay, pProcArg->dwScreen)) { - if (!g_fAnotherWMRunnig) + if (!g_fAnotherWMRunning) { - g_fAnotherWMRunnig = TRUE; + g_fAnotherWMRunning = TRUE; SendMessage(*(HWND*)pProcArg->hwndScreen, WM_UNMANAGE, 0, 0); } } else { - if (g_fAnotherWMRunnig) + if (g_fAnotherWMRunning) { - g_fAnotherWMRunnig = FALSE; + g_fAnotherWMRunning = FALSE; SendMessage(*(HWND*)pProcArg->hwndScreen, WM_MANAGE, 0, 0); } } @@ -1072,6 +1072,60 @@ winMultiWindowXMsgProc (void *pArg) event.xcreatewindow.window, 0); } + else if (event.type == MapNotify) + { + /* Fake a reparentNotify event as SWT/Motif expects a + Window Manager to reparent a top-level window when + it is mapped and waits until they do. + + We don't actually need to reparent, as the frame is + a native window, not an X window + + We do this on MapNotify, not MapRequest like a real + Window Manager would, so we don't have do get involved + in actually mapping the window via it's (non-existent) + parent... + + See sourceware bugzilla #9848 + */ + + XWindowAttributes attr; + Window root; + Window parent; + Window *children; + unsigned int nchildren; + + if (XGetWindowAttributes(event.xmap.display, + event.xmap.window, + &attr) && + XQueryTree(event.xmap.display, + event.xmap.window, + &root, &parent, &children, &nchildren)) + { + if (children) XFree(children); + + /* + It's a top-level window if the parent window is a root window + Only non-override_redirect windows can get reparented + */ + if ((attr.root == parent) && !event.xmap.override_redirect) + { + XEvent event_send; + + event_send.type = ReparentNotify; + event_send.xreparent.event = event.xmap.window; + event_send.xreparent.window = event.xmap.window; + event_send.xreparent.parent = parent; + event_send.xreparent.x = attr.x; + event_send.xreparent.y = attr.y; + + XSendEvent(event.xmap.display, + event.xmap.window, + True, StructureNotifyMask, + &event_send); + } + } + } else if (event.type == PropertyNotify && event.xproperty.atom == atmWmName) { @@ -1274,7 +1328,10 @@ winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg) /* Print the display connection string */ ErrorF ("winInitMultiWindowWM - DISPLAY=%s\n", pszDisplay); - + + /* Use our generated cookie for authentication */ + winSetAuthorization(); + /* Open the X display */ do { @@ -1454,27 +1511,23 @@ winRedirectErrorHandler (Display *pDisplay, XErrorEvent *pErr) static Bool CheckAnotherWindowManager (Display *pDisplay, DWORD dwScreen) { + /* + Try to select the events which only one client at a time is allowed to select. + If this causes an error, another window manager is already running... + */ redirectError = FALSE; XSetErrorHandler (winRedirectErrorHandler); XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen), - // SubstructureNotifyMask | ButtonPressMask - ColormapChangeMask | EnterWindowMask | PropertyChangeMask | - SubstructureRedirectMask | KeyPressMask | - ButtonPressMask | ButtonReleaseMask); + ResizeRedirectMask | SubstructureRedirectMask | ButtonPressMask); XSync (pDisplay, 0); XSetErrorHandler (winMultiWindowXMsgProcErrorHandler); - XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen), - SubstructureNotifyMask); + + /* + Side effect: select the events we are actually interested in... + */ + XSelectInput(pDisplay, RootWindow (pDisplay, dwScreen), SubstructureNotifyMask); XSync (pDisplay, 0); - if (redirectError) - { - //ErrorF ("CheckAnotherWindowManager() - another window manager is running. Exiting.\n"); - return TRUE; - } - else - { - return FALSE; - } + return redirectError; } /* diff --git a/xorg-server/hw/xwin/winprefs.h b/xorg-server/hw/xwin/winprefs.h index 6d641da6a..4daf47401 100644 --- a/xorg-server/hw/xwin/winprefs.h +++ b/xorg-server/hw/xwin/winprefs.h @@ -143,6 +143,9 @@ typedef struct WINPREFS STYLEITEM *style; int styleItems; + /* Force exit flag */ + Bool fForceExit; + /* Silent exit flag */ Bool fSilentExit; diff --git a/xorg-server/hw/xwin/winprefsyacc.y b/xorg-server/hw/xwin/winprefsyacc.y index 0c2775192..73f165915 100644 --- a/xorg-server/hw/xwin/winprefsyacc.y +++ b/xorg-server/hw/xwin/winprefsyacc.y @@ -92,10 +92,34 @@ extern int yylex(void); int iVal; } -%token NEWLINE MENU LB RB ICONDIRECTORY DEFAULTICON ICONS STYLES -%token TOPMOST MAXIMIZE MINIMIZE BOTTOM NOTITLE OUTLINE NOFRAME DEFAULTSYSMENU -%token SYSMENU ROOTMENU SEPARATOR ATSTART ATEND EXEC ALWAYSONTOP DEBUG -%token RELOAD TRAYICON SILENTEXIT +%token NEWLINE +%token MENU +%token LB +%token RB +%token ICONDIRECTORY +%token DEFAULTICON +%token ICONS +%token STYLES +%token TOPMOST +%token MAXIMIZE +%token MINIMIZE +%token BOTTOM +%token NOTITLE +%token OUTLINE +%token NOFRAME +%token DEFAULTSYSMENU +%token SYSMENU +%token ROOTMENU +%token SEPARATOR +%token ATSTART +%token ATEND +%token EXEC +%token ALWAYSONTOP +%token DEBUG +%token RELOAD +%token TRAYICON +%token FORCEEXIT +%token SILENTEXIT %token <sVal> STRING %type <uVal> group1 @@ -128,6 +152,7 @@ command: defaulticon | defaultsysmenu | debug | trayicon + | forceexit | silentexit ; @@ -212,6 +237,9 @@ sysmenulist: sysmenuline sysmenu: SYSMENU LB NEWLINE {OpenSysMenu();} newline_or_nada sysmenulist RB {CloseSysMenu();} ; +forceexit: FORCEEXIT NEWLINE { pref.fForceExit = TRUE; } + ; + silentexit: SILENTEXIT NEWLINE { pref.fSilentExit = TRUE; } ; diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c index f20598db9..31e505e8d 100644 --- a/xorg-server/hw/xwin/winprocarg.c +++ b/xorg-server/hw/xwin/winprocarg.c @@ -1,6 +1,7 @@ /* Copyright 1993, 1998 The Open Group +Copyright (C) Colin Harrison 2005-2008 Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that @@ -57,6 +58,7 @@ extern char * g_pszLogFile; extern Bool g_fLogFileChanged; #endif extern Bool g_fXdmcpEnabled; +extern Bool g_fAuthEnabled; extern char * g_pszCommandLine; extern Bool g_fKeyboardHookLL; extern Bool g_fNoHelpMessageBox; @@ -887,11 +889,23 @@ ddxProcessArgument (int argc, char *argv[], int i) */ if (IS_OPTION ("-clipboard")) { + /* Now the default, we still accept the arg for backwards compatibility */ g_fClipboard = TRUE; /* Indicate that we have processed this argument */ return 1; } + + /* + * Look for the '-noclipboard' argument + */ + if (IS_OPTION ("-noclipboard")) + { + g_fClipboard = FALSE; + + /* Indicate that we have processed this argument */ + return 1; + } #endif @@ -1289,6 +1303,15 @@ ddxProcessArgument (int argc, char *argv[], int i) } /* + * Look for the '-auth' argument + */ + if (IS_OPTION ("-auth")) + { + g_fAuthEnabled = TRUE; + return 0; /* Let DIX parse this again */ + } + + /* * Look for the '-indirect' or '-broadcast' arguments */ if (IS_OPTION ("-indirect") @@ -1514,8 +1537,8 @@ winLogVersionInfo (void) ErrorF ("Welcome to the XWin X Server\n"); ErrorF ("Vendor: %s\n", VENDOR_STRING); - ErrorF ("Release: %d.%d.%d.%d (%d)\n\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT); - ErrorF ("Contact: %s\n\n", VENDOR_CONTACT); + ErrorF ("Release: %d.%d.%d.%d (%d)\n", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH, XORG_VERSION_SNAP, XORG_VERSION_CURRENT); + ErrorF ("Contact: %s\n", VENDOR_CONTACT); } /* diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c index 99d5a464e..37ec27e08 100644 --- a/xorg-server/hw/xwin/winscrinit.c +++ b/xorg-server/hw/xwin/winscrinit.c @@ -239,6 +239,16 @@ winScreenInit (int index, else winErrorFVerb(2, "winScreenInit - Using software cursor\n"); + /* + Note the screen origin in a normalized coordinate space where (0,0) is at the top left + of the native virtual desktop area + */ + dixScreenOrigins[index].x = pScreenInfo->dwInitialX - GetSystemMetrics(SM_XVIRTUALSCREEN); + dixScreenOrigins[index].y = pScreenInfo->dwInitialY - GetSystemMetrics(SM_YVIRTUALSCREEN); + + ErrorF("Screen %d added at XINERAMA coordinate (%d,%d).\n", + index, dixScreenOrigins[index].x, dixScreenOrigins[index].y); + #if CYGDEBUG || YES winDebug ("winScreenInit - returning\n"); #endif diff --git a/xorg-server/hw/xwin/winwin32rootlesswindow.c b/xorg-server/hw/xwin/winwin32rootlesswindow.c index 2b2f63010..3a49ead69 100644 --- a/xorg-server/hw/xwin/winwin32rootlesswindow.c +++ b/xorg-server/hw/xwin/winwin32rootlesswindow.c @@ -164,7 +164,7 @@ winMWExtWMUpdateIcon (Window id) WindowPtr pWin; HICON hIcon, hiconOld; - pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW); + dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess); hIcon = winOverrideIcon ((unsigned long)pWin); if (!hIcon) diff --git a/xorg-server/hw/xwin/winwindowswm.c b/xorg-server/hw/xwin/winwindowswm.c index 5b164ea96..3d4d8c208 100644 --- a/xorg-server/hw/xwin/winwindowswm.c +++ b/xorg-server/hw/xwin/winwindowswm.c @@ -148,7 +148,8 @@ WMFreeClient (pointer data, XID id) WMEventPtr *pHead, pCur, pPrev; pEvent = (WMEventPtr) data; - pHead = (WMEventPtr *) LookupIDByType(eventResource, eventResourceType); + dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType, + NullClient, DixUnknownAccess); if (pHead) { pPrev = 0; @@ -193,8 +194,7 @@ ProcWindowsWMSelectInput (register ClientPtr client) XID clientResource; REQUEST_SIZE_MATCH (xWindowsWMSelectInputReq); - pHead = (WMEventPtr *)SecurityLookupIDByType(client, eventResource, - eventResourceType, DixWriteAccess); + dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType, client, DixWriteAccess); if (stuff->mask != 0) { if (pHead) @@ -294,7 +294,8 @@ winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg, ErrorF ("winWindowsWMSendEvent %d %d %d %d, %d %d - %d %d\n", type, mask, which, arg, x, y, w, h); #endif - pHead = (WMEventPtr *) LookupIDByType(eventResource, eventResourceType); + dixLookupResourceByType((pointer) &pHead, eventResource, eventResourceType, + NullClient, DixUnknownAccess); if (!pHead) return; for (pEvent = *pHead; pEvent; pEvent = pEvent->next) diff --git a/xorg-server/hw/xwin/xlaunch/config.h b/xorg-server/hw/xwin/xlaunch/config.h new file mode 100644 index 000000000..f0aed3cf1 --- /dev/null +++ b/xorg-server/hw/xwin/xlaunch/config.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2005 Alexander Gottwald + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the sale, + * use or other dealings in this Software without prior written authorization. + */ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +#include <string> +struct CConfig +{ + enum {MultiWindow, Fullscreen, Windowed, Nodecoration} window; + enum {NoClient, StartProgram, XDMCP} client; + bool local; + std::string display; + std::string protocol; + std::string program; + std::string host; + std::string user; + bool broadcast; + bool indirect; + std::string xdmcp_host; + bool clipboard; + std::string extra_params; +#ifdef _DEBUG + CConfig() : window(MultiWindow), client(StartProgram), local(false), display("1"), + protocol("Putty"), program("xterm"), host("lupus"), user("ago"), + broadcast(false), indirect(false), xdmcp_host("lupus"), + clipboard(true), extra_params() {}; +#else + CConfig() : window(MultiWindow), client(StartProgram), local(false), display("0"), + protocol("Putty"), program("xterm"), host(""), user(""), + broadcast(true), indirect(false), xdmcp_host(""), + clipboard(true), extra_params() {}; +#endif + void Load(const char* filename); + void Save(const char* filename); +}; + +#endif diff --git a/xorg-server/hw/xwin/xlaunch/makefile b/xorg-server/hw/xwin/xlaunch/makefile new file mode 100644 index 000000000..f7cf923df --- /dev/null +++ b/xorg-server/hw/xwin/xlaunch/makefile @@ -0,0 +1,79 @@ +# +# Copyright (c) 2005 Alexander Gottwald +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the sale, +# use or other dealings in this Software without prior written authorization. +# +WINDRES=windres + +TARGET=mingw +#DEBUG_FLAGS=-D_DEBUG + +OS_FLAGS_mingw=-mno-cygwin +OS_FLAGS=$(OS_FLAGS_$(TARGET)) $(DEBUG_FLAGS) + +X11_DIR_$(TARGET)=/usr/X11R6 +X11_DIR_mingw=../../../../../exports +X11_DIR=$(X11_DIR_$(TARGET)) +X11_INCLUDE=-I$(X11_DIR)/include +X11_LIBDIR=-L$(X11_DIR)/lib +X11_LIBS_$(TARGET)=-lX11 +X11_LIBS_mingw=-lX11 -lwsock32 +X11_LIBS=$(X11_LIBS_$(TARGET)) + +PROGRAMFILES:=$(shell cygpath -u $(PROGRAMFILES)) +#MSXML_DIR=$(PROGRAMFILES)/MSXML 4.0 +MSXML_DIR=$(PROGRAMFILES)/Microsoft XML Parser SDK +MSXML_INCLUDE="-I$(MSXML_DIR)/inc" +MSXML_LIBDIR="-L$(MSXML_DIR)/lib" +MSXML_LIBS= + + +CXXFLAGS=-g $(OS_FLAGS) $(X11_INCLUDE) $(MSXML_INCLUDE) +LDFLAGS=-mwindows $(X11_LIBDIR) $(MSXML_LIBDIR) +LIBS=-lcomctl32 -lole32 -loleaut32 $(X11_LIBS) $(MSXML_LIBS) +all:xlaunch.exe +%.res: %.rc + $(WINDRES) -O coff -o $@ $< + +WINDOW_PARTS=window util dialog wizard +WINDOW_OBJECTS=$(foreach file,$(WINDOW_PARTS),window/$(file).o) + +RESOURCES_IMAGES=resources/multiwindow.bmp resources/fullscreen.bmp \ + resources/windowed.bmp resources/nodecoration.bmp + +resources/resources.res: resources/resources.rc resources/resources.h \ + resources/images.rc resources/dialog.rc resources/strings.rc \ + $(RESOURCES_IMAGES) +xlaunch.exe: $(WINDOW_OBJECTS) main.o config.o resources/resources.res + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + + +window/dialog.o: window/dialog.cc window/dialog.h window/window.h window/util.h +window/frame.o: window/frame.cc window/frame.h window/window.h +window/util.o: window/util.cc window/util.h +window/window.o: window/window.cc window/window.h window/util.h +window/wizard.o: window/wizard.cc window/wizard.h window/dialog.h \ + window/window.h window/util.h +main.o: main.cc window/util.h window/wizard.h window/dialog.h \ + window/window.h resources/resources.h config.h +config.o: config.cc config.h |