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 #endif
#ifdef RELOCATE_PROJECTROOT #ifdef RELOCATE_PROJECTROOT
#include <shlobj.h> #include <shlobj.h>
typedef HRESULT (*SHGETFOLDERPATHPROC)( typedef WINAPI HRESULT (*SHGETFOLDERPATHPROC)(
HWND hwndOwner, HWND hwndOwner,
int nFolder, int nFolder,
HANDLE hToken, 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 size of useful area of the primary monitor (allowing for any window
decorations and the task-bar). 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 default to all screens by placing those screen specific parameters
before any \fB\-screen\fP parameter. Screen specific parameters placed after before any \fB\-screen\fP parameter. Screen specific parameters placed after
the first \fB\-screen\fP parameter will apply only to the immediately 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" .B "\-fullscreen"
The X server window takes the full screen, covering completely the The X server window takes the full screen, covering completely the
\fIWindows\fP desktop. \fIWindows\fP desktop.
Currently \fB\-fullscreen\fP may only be applied to one X screen.
.TP 8 .TP 8
.B \-nodecoration .B \-nodecoration
Do not give the Cygwin/X window a \fIWindows\fP window border, title bar, 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: case XNoMemory:
ErrorF ("XNoMemory\n"); ErrorF ("XNoMemory\n");
break; break;
case XLocaleNotSupported:
ErrorF ("XLocaleNotSupported\n");
break;
case XConverterNotFound: case XConverterNotFound:
ErrorF ("XConverterNotFound\n"); ErrorF ("XConverterNotFound\n");
break; break;
default: default:
ErrorF ("%d", iReturn); ErrorF ("%d\n", iReturn);
break; break;
} }
pszReturnData = malloc (1); pszReturnData = malloc (1);

View File

@ -53,7 +53,7 @@ wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _d
return TRUE; return TRUE;
} }
typedef wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM); typedef WINAPI wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM);
ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors; ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors;
wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data); 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; *pIcon = hIcon;
else else
winDestroyIcon(hIcon); winDestroyIcon(hIcon);
if (pSmallIcon) if (pSmallIcon)
*pSmallIcon = hSmallIcon; *pSmallIcon = hSmallIcon;
else else
@ -630,7 +631,7 @@ void winSelectIcons(WindowPtr pWin, HICON *pIcon, HICON *pSmallIcon)
void winDestroyIcon(HICON hIcon) 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 && if (hIcon &&
hIcon != g_hIconX && hIcon != g_hIconX &&
hIcon != g_hSmallIconX && hIcon != g_hSmallIconX &&

View File

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

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 else if (event.type == PropertyNotify
&& event.xproperty.atom == atmWmName) && event.xproperty.atom == atmWmName)
{ {
@ -1552,7 +1576,6 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
Atom type, *pAtom = NULL; Atom type, *pAtom = NULL;
int format; int format;
unsigned long hint = 0, maxmin = 0, style, nitems = 0 , left = 0; unsigned long hint = 0, maxmin = 0, style, nitems = 0 , left = 0;
WindowPtr pWin = GetProp (hWnd, WIN_WINDOW_PROP);
MwmHints *mwm_hint = NULL; MwmHints *mwm_hint = NULL;
if (!hWnd) return; 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 */ /* 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; if (style & STYLE_TOPMOST) *zstyle = HWND_TOPMOST;
else if (style & STYLE_MAXIMIZE) maxmin = (hint & ~HINT_MIN) | HINT_MAX; else if (style & STYLE_MAXIMIZE) maxmin = (hint & ~HINT_MIN) | HINT_MAX;
else if (style & STYLE_MINIMIZE) maxmin = (hint & ~HINT_MAX) | HINT_MIN; else if (style & STYLE_MINIMIZE) maxmin = (hint & ~HINT_MAX) | HINT_MIN;

View File

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

View File

@ -813,40 +813,20 @@ LoadPreferences (void)
* STYLES{} section in the prefs file, and return the style type * STYLES{} section in the prefs file, and return the style type
*/ */
unsigned long 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; 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++) { for (i=0; i<pref.styleItems; i++) {
if (!strcmp(pref.style[i].match, res_name) || if ((res_name && !strcmp(pref.style[i].match, res_name)) ||
!strcmp(pref.style[i].match, res_class) || (res_class && !strcmp(pref.style[i].match, res_class)) ||
(wmName && strstr(wmName, pref.style[i].match))) (wmName && strstr(wmName, pref.style[i].match)))
{ {
free (res_name);
free (res_class);
free(wmName);
if (pref.style[i].type) if (pref.style[i].type)
return pref.style[i].type; return pref.style[i].type;
} }
} }
/* Didn't find the style, fail gracefully */ /* Didn't find the style, fail gracefully */
free (res_name);
free (res_class);
free(wmName);
return STYLE_NONE; return STYLE_NONE;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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