xc/programs/Xserver/hw/xwin/ChangeLog

xc/programs/Xserver/hw/xwin/winkeybd.h
xc/programs/Xserver/hw/xwin/winkeyhook.c
xc/programs/Xserver/hw/xwin/winmultiwindowclass.c
xc/programs/Xserver/hw/xwin/winmultiwindowwindow.c
xc/programs/Xserver/hw/xwin/winmultiwindowwm.c
//bugs.freedesktop.org/show_bug.cgi?id=1831) attachment #1656
    (https://bugs.freedesktop.org/attachment.cgi?id=1656): CGYWIN update,
    including the following fixes:
- Make keyhook feature work in multiwindowmode too
- Hook windows keys
- Fix crash with non-nullterminated strings (reported by yvind Harboe)
- From Bug #1945: Stop unnecessary reordering. Patch by Alexander Gottwald
    and Kensuke Matsuzaki.
This commit is contained in:
Roland Mainz 2005-01-13 03:56:07 +00:00
parent fe7216c087
commit 02205c87b8
7 changed files with 38 additions and 15 deletions

View file

@ -1,3 +1,22 @@
2005-01-10 Alexander Gottwald <ago at freedesktop dot org>
* winkeybd.h
* winkeyhook.c
* winwndproc.c:
Make keyhook feature work in multiwindowmode too
Hook windows keys
2005-01-06 Alexander Gottwald <ago at freedesktop dot org>
* winmultiwindowclass.c:
* winmultiwindowwm.c:
Fix crash with non-nullterminated strings (reported by Øyvind Harboe)
2004-12-27 Alexander Gottwald <ago at freedesktop dot org>
* winmultiwindowwindow.c:
Bug #1945: Stop unnecessary reordering. (Kensuke Matsuzaki)
2004-12-14 Alexander Gottwald <ago at freedesktop dot org> 2004-12-14 Alexander Gottwald <ago at freedesktop dot org>
* InitOutput.c: * InitOutput.c:

View file

@ -140,9 +140,9 @@ g_iKeyMap [] = {
/* 88 */ 0, 0, 0, /* 88 */ 0, 0, 0,
/* 89 */ 0, 0, 0, /* 89 */ 0, 0, 0,
/* 90 */ 0, 0, 0, /* 90 */ 0, 0, 0,
/* 91 */ 0, 0, 0, /* 91 */ VK_LWIN, KEY_LMeta, 0,
/* 92 */ 0, 0, 0, /* 92 */ VK_RWIN, KEY_RMeta, 0,
/* 93 */ 0, 0, 0, /* 93 */ VK_APPS, KEY_Menu, 0,
/* 94 */ 0, 0, 0, /* 94 */ 0, 0, 0,
/* 95 */ 0, 0, 0, /* 95 */ 0, 0, 0,
/* 96 */ 0, 0, 0, /* 96 */ 0, 0, 0,

View file

@ -65,6 +65,7 @@ winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam)
{ {
BOOL fPassKeystroke = FALSE; BOOL fPassKeystroke = FALSE;
PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam; PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT) lParam;
HWND hwnd = GetActiveWindow();
/* Pass keystrokes on to our main message loop */ /* Pass keystrokes on to our main message loop */
if (iCode == HC_ACTION) if (iCode == HC_ACTION)
@ -79,9 +80,7 @@ winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam)
case WM_KEYUP: case WM_SYSKEYUP: case WM_KEYUP: case WM_SYSKEYUP:
fPassKeystroke = fPassKeystroke =
((p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0)) ((p->vkCode == VK_TAB) && ((p->flags & LLKHF_ALTDOWN) != 0))
#if 0
|| (p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN) || (p->vkCode == VK_LWIN) || (p->vkCode == VK_RWIN)
#endif
; ;
break; break;
} }
@ -107,7 +106,7 @@ winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam)
lParamKey = lParamKey | (0x80000000 & ((p->flags & LLKHF_UP) << 24)); lParamKey = lParamKey | (0x80000000 & ((p->flags & LLKHF_UP) << 24));
/* Send message to our main window that has the keyboard focus */ /* Send message to our main window that has the keyboard focus */
PostMessage (g_hwndKeyboardFocus, PostMessage (hwnd,
(UINT) wParam, (UINT) wParam,
(WPARAM) p->vkCode, (WPARAM) p->vkCode,
lParamKey); lParamKey);

View file

@ -175,7 +175,7 @@ winMultiWindowGetWindowRole (WindowPtr pWin, char **res_role)
&& prop->format == 8 && prop->format == 8
&& prop->data) && prop->data)
{ {
len_role= strlen ((char *) prop->data); len_role= prop->size;
(*res_role) = malloc (len_role + 1); (*res_role) = malloc (len_role + 1);
@ -185,7 +185,8 @@ winMultiWindowGetWindowRole (WindowPtr pWin, char **res_role)
return 0; return 0;
} }
strcpy ((*res_role), prop->data); strncpy ((*res_role), prop->data, len_role);
(*res_role)[len_role] = 0;
return 1; return 1;
} }
@ -299,7 +300,7 @@ winMultiWindowGetWMName (WindowPtr pWin, char **wmName)
&& prop->type == XA_STRING && prop->type == XA_STRING
&& prop->data) && prop->data)
{ {
len_name = strlen ((char *) prop->data); len_name = prop->size;
(*wmName) = malloc (len_name + 1); (*wmName) = malloc (len_name + 1);
@ -309,8 +310,8 @@ winMultiWindowGetWMName (WindowPtr pWin, char **wmName)
return 0; return 0;
} }
/* Add one to len_name to allow copying of trailing 0 */ strncpy ((*wmName), prop->data, len_name);
strncpy ((*wmName), prop->data, len_name+1); (*wmName)[len_name] = 0;
return 1; return 1;
} }

View file

@ -394,7 +394,8 @@ winRestackWindowMultiWindow (WindowPtr pWin, WindowPtr pOldNextSib)
* Calling winReorderWindowsMultiWindow here means our window manager * Calling winReorderWindowsMultiWindow here means our window manager
* (i.e. Windows Explorer) has initiative to determine Z order. * (i.e. Windows Explorer) has initiative to determine Z order.
*/ */
winReorderWindowsMultiWindow (); if (pWin->nextSib != pOldNextSib)
winReorderWindowsMultiWindow ();
#else #else
/* Bail out if no window privates or window handle is invalid */ /* Bail out if no window privates or window handle is invalid */
if (!pWinPriv || !pWinPriv->hWnd) if (!pWinPriv || !pWinPriv->hWnd)

View file

@ -405,7 +405,10 @@ GetWindowName (Display *pDisplay, Window iWin, char **ppName)
/* */ /* */
if (xtpName.value) if (xtpName.value)
{ {
*ppName = strdup ((char*)xtpName.value); int size = xtpName.nitems * (xtpName.format >> 3);
*ppName = malloc(size + 1);
strncpy(*ppName, xtpName.value, size);
(*ppName)[size] = 0;
XFree (xtpName.value); XFree (xtpName.value);
} }

View file

@ -1012,7 +1012,7 @@ winWindowProc (HWND hwnd, UINT message,
* be returned to Windows. We may be able to trap the Windows keys, * be returned to Windows. We may be able to trap the Windows keys,
* but we should determine if that is desirable before doing so. * but we should determine if that is desirable before doing so.
*/ */
if (wParam == VK_LWIN || wParam == VK_RWIN) if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
break; break;
#ifdef XKB #ifdef XKB
@ -1053,7 +1053,7 @@ winWindowProc (HWND hwnd, UINT message,
* be returned to Windows. We may be able to trap the Windows keys, * be returned to Windows. We may be able to trap the Windows keys,
* but we should determine if that is desirable before doing so. * but we should determine if that is desirable before doing so.
*/ */
if (wParam == VK_LWIN || wParam == VK_RWIN) if ((wParam == VK_LWIN || wParam == VK_RWIN) && !g_fKeyboardHookLL)
break; break;
/* Ignore the fake Ctrl_L that follows an AltGr release */ /* Ignore the fake Ctrl_L that follows an AltGr release */