diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xfree86/os-support/shared/posix_tty.c | 1 | ||||
-rw-r--r-- | hw/xfree86/os-support/shared/sigio.c | 1 | ||||
-rw-r--r-- | hw/xwin/InitOutput.c | 5 | ||||
-rw-r--r-- | hw/xwin/layout_mapping_check.c | 51 | ||||
-rw-r--r-- | hw/xwin/winclipboard/thread.c | 1 | ||||
-rw-r--r-- | hw/xwin/winclipboard/wndproc.c | 1 | ||||
-rw-r--r-- | hw/xwin/winconfig.c | 74 | ||||
-rw-r--r-- | hw/xwin/winlayouts.h | 4 | ||||
-rw-r--r-- | hw/xwin/winmultiwindowwm.c | 35 | ||||
-rw-r--r-- | hw/xwin/winprefs.c | 1 |
10 files changed, 128 insertions, 46 deletions
diff --git a/hw/xfree86/os-support/shared/posix_tty.c b/hw/xfree86/os-support/shared/posix_tty.c index 6e2af001a..8e561430b 100644 --- a/hw/xfree86/os-support/shared/posix_tty.c +++ b/hw/xfree86/os-support/shared/posix_tty.c @@ -56,6 +56,7 @@ #include <xorg-config.h> #endif +#include <sys/select.h> #include <X11/X.h> #include "xf86.h" #include "xf86Priv.h" diff --git a/hw/xfree86/os-support/shared/sigio.c b/hw/xfree86/os-support/shared/sigio.c index 45949f7a3..de4244bdf 100644 --- a/hw/xfree86/os-support/shared/sigio.c +++ b/hw/xfree86/os-support/shared/sigio.c @@ -56,6 +56,7 @@ #include <xorg-config.h> #endif +#include <sys/select.h> #include <X11/X.h> #include "xf86.h" #include "xf86Priv.h" diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 47a32eae5..30b4e86c8 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -166,6 +166,8 @@ main(int argc, char *argv[], char *envp[]) { int iReturn; + xorg_crashreport_init(NULL); + /* Create & acquire the termination mutex */ iReturn = pthread_mutex_init(&g_pmTerminating, NULL); if (iReturn != 0) { @@ -663,6 +665,9 @@ OsVendorInit(void) */ g_fLogInited = TRUE; g_pszLogFile = LogInit(g_pszLogFile, ".old"); + + /* Tell crashreporter logfile name */ + xorg_crashreport_init(g_pszLogFile); } LogSetParameter(XLOG_FLUSH, 1); LogSetParameter(XLOG_VERBOSITY, g_iLogVerbose); diff --git a/hw/xwin/layout_mapping_check.c b/hw/xwin/layout_mapping_check.c new file mode 100644 index 000000000..429be9821 --- /dev/null +++ b/hw/xwin/layout_mapping_check.c @@ -0,0 +1,51 @@ +/* + * Copyright © 2015 Jon TURNEY + * + * 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 (including the next + * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include "winlayouts.h" + +int main() +{ + WinKBLayoutPtr pLayout; + for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++) { + char cmd[1024]; + strcpy(cmd, "setxkbmap "); + strcat(cmd, "-layout "); + strcat(cmd, pLayout->xkblayout); + strcat(cmd, " -model "); + strcat(cmd, pLayout->xkbmodel); + if (pLayout->xkbvariant) { + strcat(cmd, " -variant "); + strcat(cmd, pLayout->xkbvariant); + } + if (pLayout->xkboptions) { + strcat(cmd, " -options "); + strcat(cmd, pLayout->xkboptions); + } + if (system(cmd)) { + printf("'%s' failed\n", cmd); + } + } +} diff --git a/hw/xwin/winclipboard/thread.c b/hw/xwin/winclipboard/thread.c index 27d929c10..aa0a98b91 100644 --- a/hw/xwin/winclipboard/thread.c +++ b/hw/xwin/winclipboard/thread.c @@ -55,6 +55,7 @@ #ifdef HAS_WINSOCK #include <X11/Xwinsock.h> #else +#include <sys/select.h> #include <errno.h> #endif diff --git a/hw/xwin/winclipboard/wndproc.c b/hw/xwin/winclipboard/wndproc.c index 5f1886f65..a3a512ff7 100644 --- a/hw/xwin/winclipboard/wndproc.c +++ b/hw/xwin/winclipboard/wndproc.c @@ -45,6 +45,7 @@ #include <sys/types.h> #include <sys/time.h> +#include <sys/select.h> #include <limits.h> #include <X11/Xatom.h> diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c index 28629a849..d401a1f70 100644 --- a/hw/xwin/winconfig.c +++ b/hw/xwin/winconfig.c @@ -225,7 +225,8 @@ winConfigKeyboard(DeviceIntPtr pDevice) { char layoutName[KL_NAMELENGTH]; unsigned char layoutFriendlyName[256]; - static unsigned int layoutNum = 0; + unsigned int layoutNum = 0; + unsigned int deviceIdentifier = 0; int keyboardType; #ifdef XWIN_XF86CONFIG @@ -273,15 +274,10 @@ winConfigKeyboard(DeviceIntPtr pDevice) if (keyboardType > 0 && GetKeyboardLayoutName(layoutName)) { WinKBLayoutPtr pLayout; Bool bfound = FALSE; + int pass; - if (!layoutNum) - layoutNum = strtoul(layoutName, (char **) NULL, 16); + layoutNum = strtoul(layoutName, (char **) NULL, 16); if ((layoutNum & 0xffff) == 0x411) { - /* The japanese layouts know a lot of different IMEs which all have - different layout numbers set. Map them to a single entry. - Same might apply for chinese, korean and other symbol languages - too */ - layoutNum = (layoutNum & 0xffff); if (keyboardType == 7) { /* Japanese layouts have problems with key event messages such as the lack of WM_KEYUP for Caps Lock key. @@ -319,31 +315,47 @@ winConfigKeyboard(DeviceIntPtr pDevice) "Windows keyboard layout: \"%s\" (%08x) \"%s\", type %d\n", layoutName, layoutNum, layoutFriendlyName, keyboardType); - for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++) { - if (pLayout->winlayout != layoutNum) - continue; - if (pLayout->winkbtype > 0 && pLayout->winkbtype != keyboardType) - continue; - - bfound = TRUE; - winMsg(X_PROBED, - "Found matching XKB configuration \"%s\"\n", - pLayout->layoutname); - - winMsg(X_PROBED, - "Model = \"%s\" Layout = \"%s\"" - " Variant = \"%s\" Options = \"%s\"\n", - pLayout->xkbmodel ? pLayout->xkbmodel : "none", - pLayout->xkblayout ? pLayout->xkblayout : "none", - pLayout->xkbvariant ? pLayout->xkbvariant : "none", - pLayout->xkboptions ? pLayout->xkboptions : "none"); + deviceIdentifier = layoutNum >> 16; + for (pass = 0; pass < 2; pass++) { + /* If we didn't find an exact match for the input locale identifer, + try to find an match on the language identifier part only */ + if (pass == 1) + layoutNum = (layoutNum & 0xffff); + + for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++) { + if (pLayout->winlayout != layoutNum) + continue; + if (pLayout->winkbtype > 0 && pLayout->winkbtype != keyboardType) + continue; + + bfound = TRUE; + winMsg(X_PROBED, + "Found matching XKB configuration \"%s\"\n", + pLayout->layoutname); + + winMsg(X_PROBED, + "Model = \"%s\" Layout = \"%s\"" + " Variant = \"%s\" Options = \"%s\"\n", + pLayout->xkbmodel ? pLayout->xkbmodel : "none", + pLayout->xkblayout ? pLayout->xkblayout : "none", + pLayout->xkbvariant ? pLayout->xkbvariant : "none", + pLayout->xkboptions ? pLayout->xkboptions : "none"); + + g_winInfo.xkb.model = pLayout->xkbmodel; + g_winInfo.xkb.layout = pLayout->xkblayout; + g_winInfo.xkb.variant = pLayout->xkbvariant; + g_winInfo.xkb.options = pLayout->xkboptions; + + if (deviceIdentifier == 0xa0000) { + winMsg(X_PROBED, "Windows keyboard layout device identifier indicates Macintosh, setting Model = \"macintosh\""); + g_winInfo.xkb.model = "macintosh"; + } - g_winInfo.xkb.model = pLayout->xkbmodel; - g_winInfo.xkb.layout = pLayout->xkblayout; - g_winInfo.xkb.variant = pLayout->xkbvariant; - g_winInfo.xkb.options = pLayout->xkboptions; + break; + } - break; + if (bfound) + break; } if (!bfound) { diff --git a/hw/xwin/winlayouts.h b/hw/xwin/winlayouts.h index d3d5c6df3..c7905e3c2 100644 --- a/hw/xwin/winlayouts.h +++ b/hw/xwin/winlayouts.h @@ -42,7 +42,8 @@ typedef struct { */ WinKBLayoutRec winKBLayouts[] = { - {0x00000404, -1, "pc105", "zh_TW", NULL, NULL, "Chinese (Taiwan)"}, + {0x00000404, -1, "pc105", "cn", NULL, NULL, "Chinese (Traditional)"}, + {0x00000804, -1, "pc105", "cn", NULL, NULL, "Chinese (Simplified)"}, {0x00000405, -1, "pc105", "cz", NULL, NULL, "Czech"}, {0x00010405, -1, "pc105", "cz_qwerty", NULL, NULL, "Czech (QWERTY)"}, {0x00000406, -1, "pc105", "dk", NULL, NULL, "Danish"}, @@ -72,7 +73,6 @@ WinKBLayoutRec winKBLayouts[] = { {0x0000040f, -1, "pc105", "is", NULL, NULL, "Icelandic"}, {0x00000410, -1, "pc105", "it", NULL, NULL, "Italian"}, {0x00010410, -1, "pc105", "it", NULL, NULL, "Italian (142)"}, - {0xa0000410, -1, "macbook79", "it", "mac", NULL, "Italiano (Apple)"}, {0x00000411, 7, "jp106", "jp", NULL, NULL, "Japanese"}, {0x00000412, -1, "kr106", "kr", NULL, NULL, "Korean"}, {0x00000413, -1, "pc105", "nl", NULL, NULL, "Dutch"}, diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index 589b6e06d..e2bd7e127 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -503,27 +503,39 @@ GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName, Atom atmNetW XFree(xtpWindowName.value); } + /* return the window name, unless... */ + *ppWindowName = pszWindowName; + 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) { + char *pszClientMachine; + char *pszClientHostname; + char *dot; + char hostname[HOST_NAME_MAX + 1]; + pszClientMachine = Xutf8TextPropertyToString(pDisplay, &xtpClientMachine); XFree(xtpClientMachine.value); + /* If client machine name looks like a FQDN, find the hostname */ + pszClientHostname = strdup(pszClientMachine); + dot = strchr(pszClientHostname, '.'); + if (dot) + *dot = '\0'; + /* - If we have a client machine name - and it's not the local host name + If we have a client machine hostname + and it's not the local hostname and it's not already in the window title... */ - if (strlen(pszClientMachine) && + if (strlen(pszClientHostname) && !gethostname(hostname, HOST_NAME_MAX + 1) && - strcmp(hostname, pszClientMachine) && - (strstr(pszWindowName, pszClientMachine) == 0)) { + strcmp(hostname, pszClientHostname) && + (strstr(pszWindowName, pszClientHostname) == 0)) { /* ... add '@<clientmachine>' to end of window name */ *ppWindowName = malloc(strlen(pszWindowName) + @@ -533,15 +545,12 @@ GetWindowName(Display * pDisplay, Window iWin, char **ppWindowName, Atom atmNetW strcat(*ppWindowName, pszClientMachine); free(pszWindowName); - free(pszClientMachine); - - return; } + + free(pszClientMachine); + free(pszClientHostname); } } - - /* otherwise just return the window name */ - *ppWindowName = pszWindowName; } /* diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c index 4d53f8a79..9f1e9b1b7 100644 --- a/hw/xwin/winprefs.c +++ b/hw/xwin/winprefs.c @@ -37,6 +37,7 @@ #include <stdlib.h> #ifdef __CYGWIN__ #include <sys/resource.h> +#include <sys/select.h> #include <sys/wait.h> #include <pthread.h> #endif |