summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/xwin/InitOutput.c3
-rw-r--r--hw/xwin/winblock.c2
-rw-r--r--hw/xwin/winclipboard/wndproc.c2
-rw-r--r--hw/xwin/winclipboard/xevents.c35
-rw-r--r--hw/xwin/winmultiwindowwm.c77
-rw-r--r--hw/xwin/winprocarg.c2
-rw-r--r--os/utils.c15
-rw-r--r--xkb/ddxLoad.c2
8 files changed, 84 insertions, 54 deletions
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 6ca2b3fa3..d26ebb0bf 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -343,7 +343,8 @@ winCheckMount(void)
else
binary = TRUE;
- if (strcmp(ent->mnt_type, "vfat") == 0)
+ if ((strcmp(ent->mnt_type, "vfat") == 0) ||
+ (strcmp(ent->mnt_type, "exfat") == 0))
fat = TRUE;
else
fat = FALSE;
diff --git a/hw/xwin/winblock.c b/hw/xwin/winblock.c
index 07e907828..8b846520c 100644
--- a/hw/xwin/winblock.c
+++ b/hw/xwin/winblock.c
@@ -70,7 +70,7 @@ winBlockHandler(ScreenPtr pScreen,
if (pScreenPriv != NULL && !pScreenPriv->fServerStarted) {
int iReturn;
- ErrorF("winBlockHandler - pthread_mutex_unlock()\n");
+ winDebug("winBlockHandler - pthread_mutex_unlock()\n");
/* Flag that modules are to be started */
pScreenPriv->fServerStarted = TRUE;
diff --git a/hw/xwin/winclipboard/wndproc.c b/hw/xwin/winclipboard/wndproc.c
index f0867f91d..dd30b8c99 100644
--- a/hw/xwin/winclipboard/wndproc.c
+++ b/hw/xwin/winclipboard/wndproc.c
@@ -501,7 +501,7 @@ winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
if (WIN_XEVENTS_NOTIFY_TARGETS != iReturn) {
ErrorF
- ("winClipboardWindowProc - timed out waiting for WIN_XEVENTS_NOTIFY_TARGETS\n");
+ ("winClipboardWindowProc - failed waiting for WIN_XEVENTS_NOTIFY_TARGETS\n");
goto fake_paste;
}
diff --git a/hw/xwin/winclipboard/xevents.c b/hw/xwin/winclipboard/xevents.c
index 59bf5bd8c..061b87cbf 100644
--- a/hw/xwin/winclipboard/xevents.c
+++ b/hw/xwin/winclipboard/xevents.c
@@ -44,6 +44,7 @@
#endif
#include <limits.h>
+#include <wchar.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/extensions/Xfixes.h>
@@ -209,14 +210,11 @@ winClipboardFlushXEvents(HWND hwnd,
int iReturn;
HGLOBAL hGlobal = NULL;
XICCEncodingStyle xiccesStyle;
- int iConvertDataLen = 0;
char *pszConvertData = NULL;
char *pszTextList[2] = { NULL };
int iCount;
char **ppszTextList = NULL;
wchar_t *pwszUnicodeStr = NULL;
- int iUnicodeLen = 0;
- int iReturnDataLen = 0;
Bool fAbort = FALSE;
Bool fCloseClipboard = FALSE;
Bool fSetClipboardData = TRUE;
@@ -315,7 +313,7 @@ winClipboardFlushXEvents(HWND hwnd,
/* Access the clipboard */
if (!OpenClipboard(hwnd)) {
ErrorF("winClipboardFlushXEvents - SelectionRequest - "
- "OpenClipboard () failed: %08lx\n", GetLastError());
+ "OpenClipboard () failed: %08lx owner %08x\n", GetLastError(), GetClipboardOwner());
/* Abort */
fAbort = TRUE;
@@ -385,7 +383,7 @@ winClipboardFlushXEvents(HWND hwnd,
/* Convert the Unicode string to UTF8 (MBCS) */
if (data->fUseUnicode) {
- iConvertDataLen = WideCharToMultiByte(CP_UTF8,
+ int iConvertDataLen = WideCharToMultiByte(CP_UTF8,
0,
(LPCWSTR) pszGlobalData,
-1, NULL, 0, NULL, NULL);
@@ -400,7 +398,6 @@ winClipboardFlushXEvents(HWND hwnd,
}
else {
pszConvertData = strdup(pszGlobalData);
- iConvertDataLen = strlen(pszConvertData) + 1;
}
/* Convert DOS string to UNIX string */
@@ -546,7 +543,6 @@ winClipboardFlushXEvents(HWND hwnd,
*/
case SelectionNotify:
-
winDebug("winClipboardFlushXEvents - SelectionNotify\n");
{
char *pszAtomName;
@@ -569,9 +565,11 @@ winClipboardFlushXEvents(HWND hwnd,
not be performed or server errors prevented the conversion data being returned
*/
if (event.xselection.property == None) {
+ char *pszAtomName = XGetAtomName(pDisplay, event.xselection.target);
ErrorF("winClipboardFlushXEvents - SelectionNotify - "
- "Conversion to format %d refused.\n",
- event.xselection.target);
+ "Conversion to format %d %s refused.\n",
+ pszAtomName, event.xselection.target);
+ XFree(pszAtomName);
return WIN_XEVENTS_FAILED;
}
@@ -626,8 +624,7 @@ winClipboardFlushXEvents(HWND hwnd,
/* Conversion succeeded or some unconvertible characters */
if (ppszTextList != NULL) {
int i;
-
- iReturnDataLen = 0;
+ int iReturnDataLen = 0;
for (i = 0; i < iCount; i++) {
iReturnDataLen += strlen(ppszTextList[i]);
}
@@ -678,12 +675,12 @@ winClipboardFlushXEvents(HWND hwnd,
if (data->fUseUnicode) {
/* Find out how much space needed to convert MBCS to Unicode */
- iUnicodeLen = MultiByteToWideChar(CP_UTF8,
+ int iUnicodeLen = MultiByteToWideChar(CP_UTF8,
0,
pszReturnData, -1, NULL, 0);
- /* Allocate memory for the Unicode string */
- pwszUnicodeStr = malloc(sizeof(wchar_t) * (iUnicodeLen + 1));
+ /* NOTE: iUnicodeLen includes space for null terminator */
+ pwszUnicodeStr = malloc(sizeof(wchar_t) * iUnicodeLen);
if (!pwszUnicodeStr) {
ErrorF("winClipboardFlushXEvents - SelectionNotify "
"malloc failed for pwszUnicodeStr, aborting.\n");
@@ -701,9 +698,10 @@ winClipboardFlushXEvents(HWND hwnd,
/* Allocate global memory for the X clipboard data */
hGlobal = GlobalAlloc(GMEM_MOVEABLE,
- sizeof(wchar_t) * (iUnicodeLen + 1));
+ sizeof(wchar_t) * iUnicodeLen);
}
else {
+ int iConvertDataLen = 0;
pszConvertData = strdup(pszReturnData);
iConvertDataLen = strlen(pszConvertData) + 1;
@@ -736,8 +734,7 @@ winClipboardFlushXEvents(HWND hwnd,
/* Copy the returned string into the global memory */
if (data->fUseUnicode) {
- memcpy(pszGlobalData,
- pwszUnicodeStr, sizeof(wchar_t) * (iUnicodeLen + 1));
+ wcscpy((wchar_t *)pszGlobalData, pwszUnicodeStr);
free(pwszUnicodeStr);
pwszUnicodeStr = NULL;
}
@@ -847,8 +844,8 @@ winClipboardFlushXEvents(HWND hwnd,
/* Access the Windows clipboard */
if (!OpenClipboard(hwnd)) {
- ErrorF("winClipboardFlushXEvents - OpenClipboard () failed: %08x\n",
- (int) GetLastError());
+ ErrorF("winClipboardFlushXEvents - OpenClipboard () failed: %08x Owner %08x\n",
+ (int) GetLastError(), GetClipboardOwner());
break;
}
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 615786af9..62edb7fa9 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -134,6 +134,7 @@ typedef struct _WMInfo {
Atom atmWmDelete;
Atom atmWmTakeFocus;
Atom atmPrivMap;
+ Atom atmNetWmName;
Bool fAllowOtherWM;
} WMInfoRec, *WMInfoPtr;
@@ -164,7 +165,7 @@ static Bool
InitQueue(WMMsgQueuePtr pQueue);
static void
- GetWindowName(Display * pDpy, Window iWin, char **ppWindowName);
+ GetWindowName(Display * pDpy, Window iWin, char **ppWindowName, Atom atmNetWmName);
static int
SendXMessage(Display * pDisplay, Window iWin, Atom atmType, long nData);
@@ -450,14 +451,10 @@ Xutf8TextPropertyToString(Display * pDisplay, XTextProperty * xtp)
*/
static void
-GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName)
+GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName, Atom atmNetWmName)
{
int nResult;
- XTextProperty xtpWindowName;
- XTextProperty xtpClientMachine;
- char *pszWindowName;
- char *pszClientMachine;
- char hostname[HOST_NAME_MAX + 1];
+ char *pszWindowName = NULL;
#if CYGMULTIWINDOW_DEBUG
ErrorF("GetWindowName\n");
@@ -466,19 +463,47 @@ GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName)
/* Intialize ppWindowName to NULL */
*ppWindowName = NULL;
- /* Try to get window name */
- nResult = XGetWMName(pDisplay, iWin, &xtpWindowName);
- if (!nResult || !xtpWindowName.value || !xtpWindowName.nitems) {
+ /* Try to get window name from _NET_WM_NAME */
+ {
+ char *utf8WindowName;
+ Atom type;
+ int format;
+ unsigned long nitems, after;
+
+ nResult = XGetWindowProperty(pDisplay, iWin, atmNetWmName,
+ 0, INT_MAX, False,
+ AnyPropertyType, &type, &format,
+ &nitems, &after,
+ (unsigned char **)&utf8WindowName);
+ if ((nResult == Success) && (type != None))
+ {
+ pszWindowName = strdup(utf8WindowName);
+ XFree(utf8WindowName);
+ }
+ }
+
+ /* Otherwise, try to get window name from WM_NAME */
+ if (!pszWindowName)
+ {
+ XTextProperty xtpWindowName;
+
+ nResult = XGetWMName(pDisplay, iWin, &xtpWindowName);
+ if (!nResult || !xtpWindowName.value || !xtpWindowName.nitems) {
#if CYGMULTIWINDOW_DEBUG
- ErrorF("GetWindowName - XGetWMName failed. No name.\n");
+ ErrorF("GetWindowName - XGetWMName failed. No name.\n");
#endif
- return;
- }
+ return;
+ }
- pszWindowName = Xutf8TextPropertyToString(pDisplay, &xtpWindowName);
- XFree(xtpWindowName.value);
+ pszWindowName = Xutf8TextPropertyToString(pDisplay, &xtpWindowName);
+ XFree(xtpWindowName.value);
+ }
if (g_fHostInTitle) {
+ XTextProperty xtpClientMachine;
+ char *pszClientMachine;
+ char hostname[HOST_NAME_MAX + 1];
+
/* Try to get client machine name */
nResult = XGetWMClientMachine(pDisplay, iWin, &xtpClientMachine);
if (nResult && xtpClientMachine.value && xtpClientMachine.nitems) {
@@ -615,7 +640,7 @@ UpdateName(WMInfoPtr pWMInfo, Window iWindow)
char *pszWindowName;
/* Get the X windows window name */
- GetWindowName(pWMInfo->pDisplay, iWindow, &pszWindowName);
+ GetWindowName(pWMInfo->pDisplay, iWindow, &pszWindowName, pWMInfo->atmNetWmName);
if (pszWindowName) {
/* Convert from UTF-8 to wide char */
@@ -1016,6 +1041,7 @@ winMultiWindowXMsgProc(void *pArg)
int iRetries;
XEvent event;
Atom atmWmName;
+ Atom atmNetWmName;
Atom atmWmHints;
Atom atmWmChange;
Atom atmNetWmIcon;
@@ -1033,7 +1059,7 @@ winMultiWindowXMsgProc(void *pArg)
pthread_exit(NULL);
}
- ErrorF("winMultiWindowXMsgProc - Calling pthread_mutex_lock ()\n");
+ winDebug("winMultiWindowXMsgProc - Calling pthread_mutex_lock ()\n");
/* Grab the server started mutex - pause until we get it */
iReturn = pthread_mutex_lock(pProcArg->ppmServerStarted);
@@ -1043,12 +1069,12 @@ winMultiWindowXMsgProc(void *pArg)
pthread_exit(NULL);
}
- ErrorF("winMultiWindowXMsgProc - pthread_mutex_lock () returned.\n");
+ winDebug("winMultiWindowXMsgProc - pthread_mutex_lock () returned.\n");
/* Release the server started mutex */
pthread_mutex_unlock(pProcArg->ppmServerStarted);
- ErrorF("winMultiWindowXMsgProc - pthread_mutex_unlock () returned.\n");
+ winDebug("winMultiWindowXMsgProc - pthread_mutex_unlock () returned.\n");
/* Install our error handler */
XSetErrorHandler(winMultiWindowXMsgProcErrorHandler);
@@ -1133,6 +1159,7 @@ winMultiWindowXMsgProc(void *pArg)
}
atmWmName = XInternAtom(pProcArg->pDisplay, "WM_NAME", False);
+ atmNetWmName = XInternAtom(pProcArg->pDisplay, "_NET_WM_NAME", False);
atmWmHints = XInternAtom(pProcArg->pDisplay, "WM_HINTS", False);
atmWmChange = XInternAtom(pProcArg->pDisplay, "WM_CHANGE_STATE", False);
atmNetWmIcon = XInternAtom(pProcArg->pDisplay, "_NET_WM_ICON", False);
@@ -1270,7 +1297,8 @@ winMultiWindowXMsgProc(void *pArg)
XGetAtomName(pProcArg->pDisplay, event.xproperty.atom);
winDebug("winMultiWindowXMsgProc: PropertyNotify %s\n", atomName);
XFree(atomName);
- if (event.xproperty.atom == atmWmName) {
+ if ((event.xproperty.atom == atmWmName) ||
+ (event.xproperty.atom == atmNetWmName)) {
memset(&msg, 0, sizeof(msg));
msg.msg = WM_WM_NAME_EVENT;
@@ -1418,7 +1446,7 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
pthread_exit(NULL);
}
- ErrorF("winInitMultiWindowWM - Calling pthread_mutex_lock ()\n");
+ winDebug("winInitMultiWindowWM - Calling pthread_mutex_lock ()\n");
/* Grab our garbage mutex to satisfy pthread_cond_wait */
iReturn = pthread_mutex_lock(pProcArg->ppmServerStarted);
@@ -1428,12 +1456,12 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
pthread_exit(NULL);
}
- ErrorF("winInitMultiWindowWM - pthread_mutex_lock () returned.\n");
+ winDebug("winInitMultiWindowWM - pthread_mutex_lock () returned.\n");
/* Release the server started mutex */
pthread_mutex_unlock(pProcArg->ppmServerStarted);
- ErrorF("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n");
+ winDebug("winInitMultiWindowWM - pthread_mutex_unlock () returned.\n");
/* Install our error handler */
XSetErrorHandler(winMultiWindowWMErrorHandler);
@@ -1498,9 +1526,10 @@ winInitMultiWindowWM(WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
"WM_DELETE_WINDOW", False);
pWMInfo->atmWmTakeFocus = XInternAtom(pWMInfo->pDisplay,
"WM_TAKE_FOCUS", False);
-
pWMInfo->atmPrivMap = XInternAtom(pWMInfo->pDisplay,
WINDOWSWM_NATIVE_HWND, False);
+ pWMInfo->atmNetWmName = XInternAtom(pWMInfo->pDisplay,
+ "_NET_WM_NAME", False);
if (1) {
Cursor cursor = XCreateFontCursor(pWMInfo->pDisplay, XC_left_ptr);
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index 04b2f49fd..f678f6188 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -253,7 +253,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
* OsVendorInit () gets called, otherwise we will overwrite
* settings changed by parameters such as -fullscreen, etc.
*/
- winErrorFVerb(2, "ddxProcessArgument - Initializing default "
+ winErrorFVerb(3, "ddxProcessArgument - Initializing default "
"screens\n");
winInitializeScreenDefaults();
}
diff --git a/os/utils.c b/os/utils.c
index 62a3cbc50..74e405863 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1757,12 +1757,15 @@ System(const char *cmdline)
const char*
Win32TempDir(void)
{
- if (getenv("TEMP") != NULL)
- return getenv("TEMP");
- else if (getenv("TMP") != NULL)
- return getenv("TMP");
- else
- return "/tmp";
+ const char *temp = getenv("TEMP");
+ if ((temp != NULL) && (access(temp, W_OK | X_OK) == 0))
+ return temp;
+
+ temp = getenv("TMP");
+ if ((temp != NULL) && (access(temp, W_OK | X_OK) == 0))
+ return temp;
+
+ return "/tmp";
}
#endif
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 78b28c0fc..58f523249 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -200,7 +200,7 @@ RunXkbComp(xkbcomp_buffer_callback callback, void *userdata)
#endif
}
else {
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__CYGWIN__)
LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp\n");
#else
LogMessage(X_ERROR, "Could not open file %s\n", tmpname);