Merge remote-tracking branch 'jturney/master'

This commit is contained in:
Keith Packard 2011-04-27 12:08:51 -07:00
commit f6d4e75ec5
15 changed files with 104 additions and 53 deletions

View File

@ -49,7 +49,7 @@ from The Open Group.
#endif
#ifdef RELOCATE_PROJECTROOT
#include <shlobj.h>
typedef HRESULT (*SHGETFOLDERPATHPROC)(
typedef WINAPI HRESULT (*SHGETFOLDERPATHPROC)(
HWND hwndOwner,
int nFolder,
HANDLE hToken,

View File

@ -67,7 +67,7 @@ The default behaviour is to create a single screen 0 that is roughly the
size of useful area of the primary monitor (allowing for any window
decorations and the task-bar).
Screen specific parameters, such as \fB\-fullscreen\fP, can be applied as a
Screen specific parameters can be applied as a
default to all screens by placing those screen specific parameters
before any \fB\-screen\fP parameter. Screen specific parameters placed after
the first \fB\-screen\fP parameter will apply only to the immediately
@ -108,6 +108,7 @@ in \fB-multiwindow\fP or \fB-rootless\fP mode.
.B "\-fullscreen"
The X server window takes the full screen, covering completely the
\fIWindows\fP desktop.
Currently \fB\-fullscreen\fP may only be applied to one X screen.
.TP 8
.B \-nodecoration
Do not give the Cygwin/X window a \fIWindows\fP window border, title bar,

View File

@ -636,11 +636,14 @@ winClipboardFlushXEvents (HWND hwnd,
case XNoMemory:
ErrorF ("XNoMemory\n");
break;
case XLocaleNotSupported:
ErrorF ("XLocaleNotSupported\n");
break;
case XConverterNotFound:
ErrorF ("XConverterNotFound\n");
break;
default:
ErrorF ("%d", iReturn);
ErrorF ("%d\n", iReturn);
break;
}
pszReturnData = malloc (1);

View File

@ -53,7 +53,7 @@ wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _d
return TRUE;
}
typedef wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
typedef WINAPI wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors;
wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data);

View File

@ -622,6 +622,7 @@ void winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon)
*pIcon = hIcon;
else
winDestroyIcon(hIcon);
if (pSmallIcon)
*pSmallIcon = hSmallIcon;
else
@ -630,7 +631,7 @@ void winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon)
void winDestroyIcon(HICON hIcon)
{
/* Delete the icon if its not the default */
/* Delete the icon if its not one of the application defaults or an override */
if (hIcon &&
hIcon != g_hIconX &&
hIcon != g_hSmallIconX &&

View File

@ -506,12 +506,16 @@ winCreateWindowsWindow (WindowPtr pWin)
iWidth = pWin->drawable.width;
iHeight = pWin->drawable.height;
/* ensure window actually ends up somewhere visible */
if (iX > GetSystemMetrics (SM_CXVIRTUALSCREEN))
iX = CW_USEDEFAULT;
/* If it's an InputOutput window, and so is going to end up being made visible,
make sure the window actually ends up somewhere where it will be visible */
if (pWin->drawable.class != InputOnly)
{
if ((iX < GetSystemMetrics (SM_XVIRTUALSCREEN)) || (iX > GetSystemMetrics (SM_CXVIRTUALSCREEN)))
iX = CW_USEDEFAULT;
if (iY > GetSystemMetrics (SM_CYVIRTUALSCREEN))
iY = CW_USEDEFAULT;
if ((iY < GetSystemMetrics (SM_YVIRTUALSCREEN)) || (iY > GetSystemMetrics (SM_CYVIRTUALSCREEN)))
iY = CW_USEDEFAULT;
}
if (winMultiWindowGetTransientFor (pWin, &pDaddy))
{
@ -592,7 +596,9 @@ winDestroyWindowsWindow (WindowPtr pWin)
MSG msg;
winWindowPriv(pWin);
BOOL oldstate = winInDestroyWindowsWindow;
HICON hIcon;
HICON hIconSm;
#if CYGMULTIWINDOW_DEBUG
ErrorF ("winDestroyWindowsWindow\n");
#endif
@ -603,13 +609,22 @@ winDestroyWindowsWindow (WindowPtr pWin)
winInDestroyWindowsWindow = TRUE;
/* Store the info we need to destroy after this window is gone */
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);
/* Null our handle to the Window so referencing it will cause an error */
pWinPriv->hWnd = NULL;
/* Destroy any icons we created for this window */
winDestroyIcon(hIcon);
winDestroyIcon(hIconSm);
/* Process all messages on our queue */
while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
{
@ -655,7 +670,8 @@ winUpdateWindowsWindow (WindowPtr pWin)
}
/* Display the window without activating it */
ShowWindow (pWinPriv->hWnd, SW_SHOWNOACTIVATE);
if (pWin->drawable.class != InputOnly)
ShowWindow (pWinPriv->hWnd, SW_SHOWNOACTIVATE);
/* Send first paint message */
UpdateWindow (pWinPriv->hWnd);

View File

@ -1114,6 +1114,30 @@ winMultiWindowXMsgProc (void *pArg)
}
}
}
else if (event.type == ConfigureNotify)
{
if (!event.xconfigure.send_event)
{
/*
Java applications using AWT on JRE 1.6.0 break with non-reparenting WMs AWT
doesn't explicitly know about (See sun bug #6434227)
XDecoratedPeer.handleConfigureNotifyEvent() only processes non-synthetic
ConfigureNotify events to update window location if it's identified the
WM as a non-reparenting WM it knows about (compiz or lookingglass)
Rather than tell all sorts of lies to get XWM to recognize us as one of
those, simply send a synthetic ConfigureNotify for every non-synthetic one
*/
XEvent event_send = event;
event_send.xconfigure.send_event = TRUE;
event_send.xconfigure.event = event.xconfigure.window;
XSendEvent(event.xconfigure.display,
event.xconfigure.window,
True, StructureNotifyMask,
&event_send);
}
}
else if (event.type == PropertyNotify
&& event.xproperty.atom == atmWmName)
{
@ -1552,7 +1576,6 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
Atom type, *pAtom = NULL;
int format;
unsigned long hint = 0, maxmin = 0, style, nitems = 0 , left = 0;
WindowPtr pWin = GetProp (hWnd, WIN_WINDOW_PROP);
MwmHints *mwm_hint = NULL;
if (!hWnd) return;
@ -1645,7 +1668,26 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
}
/* Override hint settings from above with settings from config file */
style = winOverrideStyle((unsigned long)pWin);
{
XClassHint class_hint = {0,0};
char *window_name = 0;
if (XGetClassHint(pDisplay, iWindow, &class_hint))
{
XFetchName(pDisplay, iWindow, &window_name);
style = winOverrideStyle(class_hint.res_name, class_hint.res_class, window_name);
if (class_hint.res_name) XFree(class_hint.res_name);
if (class_hint.res_class) XFree(class_hint.res_class);
if (window_name) XFree(window_name);
}
else
{
style = STYLE_NONE;
}
}
if (style & STYLE_TOPMOST) *zstyle = HWND_TOPMOST;
else if (style & STYLE_MAXIMIZE) maxmin = (hint & ~HINT_MIN) | HINT_MAX;
else if (style & STYLE_MINIMIZE) maxmin = (hint & ~HINT_MAX) | HINT_MIN;

View File

@ -294,7 +294,8 @@ winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen)
/* Call the wrapped CloseScreen procedure */
WIN_UNWRAP(CloseScreen);
fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
if (pScreen->CloseScreen)
fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
/* Delete the window property */
RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);

View File

@ -813,40 +813,20 @@ LoadPreferences (void)
* STYLES{} section in the prefs file, and return the style type
*/
unsigned long
winOverrideStyle (unsigned long longpWin)
winOverrideStyle (char *res_name, char *res_class, char *wmName)
{
WindowPtr pWin = (WindowPtr) longpWin;
char *res_name, *res_class;
int i;
char *wmName;
if (pWin==NULL)
return STYLE_NONE;
/* If we can't find the class, we can't override from default! */
if (!winMultiWindowGetClassHint (pWin, &res_name, &res_class))
return STYLE_NONE;
winMultiWindowGetWMName (pWin, &wmName);
for (i=0; i<pref.styleItems; i++) {
if (!strcmp(pref.style[i].match, res_name) ||
!strcmp(pref.style[i].match, res_class) ||
if ((res_name && !strcmp(pref.style[i].match, res_name)) ||
(res_class && !strcmp(pref.style[i].match, res_class)) ||
(wmName && strstr(wmName, pref.style[i].match)))
{
free (res_name);
free (res_class);
free(wmName);
if (pref.style[i].type)
return pref.style[i].type;
}
}
/* Didn't find the style, fail gracefully */
free (res_name);
free (res_class);
free(wmName);
return STYLE_NONE;
}

View File

@ -180,7 +180,7 @@ HICON
winOverrideIcon (unsigned long longpWin);
unsigned long
winOverrideStyle (unsigned long longpWin);
winOverrideStyle (char *res_name, char *res_class, char *wmName);
HICON
winTaskbarIcon(void);

View File

@ -220,6 +220,10 @@ winScreenInit (int index,
if (!((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv)))
{
ErrorF ("winScreenInit - winFinishScreenInit () failed\n");
/* call the engine dependent screen close procedure to clean up from a failure */
pScreenPriv->pwinCloseScreen(index, pScreen);
return FALSE;
}

View File

@ -728,7 +728,8 @@ winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen)
/* Call the wrapped CloseScreen procedure */
WIN_UNWRAP(CloseScreen);
fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
if (pScreen->CloseScreen)
fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
winFreeFBShadowDD(pScreen);

View File

@ -802,7 +802,8 @@ winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen)
/* Call the wrapped CloseScreen procedure */
WIN_UNWRAP(CloseScreen);
fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
if (pScreen->CloseScreen)
fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
winFreeFBShadowDDNL(pScreen);

View File

@ -636,7 +636,8 @@ winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen)
/* Call the wrapped CloseScreen procedure */
WIN_UNWRAP(CloseScreen);
fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
if (pScreen->CloseScreen)
fReturn = (*pScreen->CloseScreen) (nIndex, pScreen);
/* Delete the window property */
RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP);

View File

@ -366,8 +366,8 @@ void
winMWExtWMDestroyFrame (RootlessFrameID wid)
{
win32RootlessWindowPtr pRLWinPriv = (win32RootlessWindowPtr) wid;
HICON hiconClass;
HICON hiconSmClass;
HICON hIcon;
HICON hIconSm;
HMODULE hInstance;
int iReturn;
char pszClass[CLASS_NAME_LENGTH];
@ -398,8 +398,8 @@ winMWExtWMDestroyFrame (RootlessFrameID wid)
/* Store the info we need to destroy after this window is gone */
hInstance = (HINSTANCE) GetClassLongPtr (pRLWinPriv->hWnd, GCLP_HMODULE);
hiconClass = (HICON) GetClassLongPtr (pRLWinPriv->hWnd, GCLP_HICON);
hiconSmClass = (HICON) GetClassLongPtr (pRLWinPriv->hWnd, GCLP_HICONSM);
hIcon = (HICON)SendMessage(pRLWinPriv->hWnd, WM_GETICON, ICON_BIG, 0);
hIconSm = (HICON)SendMessage(pRLWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0);
iReturn = GetClassName (pRLWinPriv->hWnd, pszClass, CLASS_NAME_LENGTH);
pRLWinPriv->fClose = TRUE;
@ -415,15 +415,15 @@ winMWExtWMDestroyFrame (RootlessFrameID wid)
winDebug ("winMWExtWMDestroyFrame - Unregistering %s: ", pszClass);
#endif
iReturn = UnregisterClass (pszClass, hInstance);
#if CYGMULTIWINDOW_DEBUG
winDebug ("winMWExtWMDestroyFramew - %d Deleting Icon: ", iReturn);
#endif
winDestroyIcon(hiconClass);
winDestroyIcon(hiconSmClass);
}
#if CYGMULTIWINDOW_DEBUG
winDebug ("winMWExtWMDestroyFramew - Deleting Icon\n");
#endif
winDestroyIcon(hIcon);
winDestroyIcon(hIconSm);
#if CYGMULTIWINDOW_DEBUG
winDebug ("winMWExtWMDestroyFrame - done\n");
#endif