diff options
author | Kevin Walzer <kw@codebykevin.com> | 2019-08-10 16:52:37 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2019-08-10 16:52:37 (GMT) |
commit | dba94e780143122a611e39861db5ced7c8d0f0cd (patch) | |
tree | 4c33602e51d8c6ad6100570b897b1a75e840a0b8 /win | |
parent | 1be07b1ba37ee220da5cf2ae5c63267b2e77e9c6 (diff) | |
parent | ad45c00441bc4f99294ea11c71f6440dd3978ee9 (diff) | |
download | tk-dba94e780143122a611e39861db5ced7c8d0f0cd.zip tk-dba94e780143122a611e39861db5ced7c8d0f0cd.tar.gz tk-dba94e780143122a611e39861db5ced7c8d0f0cd.tar.bz2 |
Merge in core-8-6-branch
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinDialog.c | 80 | ||||
-rw-r--r-- | win/tkWinPointer.c | 6 | ||||
-rw-r--r-- | win/tkWinX.c | 19 |
3 files changed, 65 insertions, 40 deletions
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 743720d..2701b82 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -2295,54 +2295,56 @@ static int MakeFilterVista( for (i = 0, filterPtr = flist.filters; filterPtr; filterPtr = filterPtr->next, ++i) { - const char *sep; - FileFilterClause *clausePtr; - int nbytes; + const char *sep; + FileFilterClause *clausePtr; + int nbytes; - /* Check if this entry should be shown as the default */ - if (initial && strcmp(initial, filterPtr->name) == 0) + /* Check if this entry should be shown as the default */ + if (initial && strcmp(initial, filterPtr->name) == 0) initialIndex = i+1; /* Windows filter indices are 1-based */ - /* First stash away the text description of the pattern */ + /* First stash away the text description of the pattern */ Tcl_WinUtfToTChar(filterPtr->name, -1, &ds); - nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */ - nbytes += sizeof(WCHAR); /* Terminating \0 */ - dlgFilterPtr[i].pszName = ckalloc(nbytes); - memmove((void *) dlgFilterPtr[i].pszName, Tcl_DStringValue(&ds), nbytes); - Tcl_DStringFree(&ds); + nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */ + nbytes += sizeof(WCHAR); /* Terminating \0 */ + dlgFilterPtr[i].pszName = ckalloc(nbytes); + memmove((void *) dlgFilterPtr[i].pszName, Tcl_DStringValue(&ds), nbytes); + Tcl_DStringFree(&ds); - /* - * Loop through and join patterns with a ";" Each "clause" - * corresponds to a single textual description (called typename) - * in the tk_getOpenFile docs. Each such typename may occur - * multiple times and all these form a single filter entry - * with one clause per occurence. Further each clause may specify - * multiple patterns. Hence the nested loop here. - */ - sep = ""; - for (clausePtr=filterPtr->clauses ; clausePtr; - clausePtr=clausePtr->next) { - GlobPattern *globPtr; - for (globPtr = clausePtr->patterns; globPtr; - globPtr = globPtr->next) { - Tcl_DStringAppend(&patterns, sep, -1); - Tcl_DStringAppend(&patterns, globPtr->pattern, -1); - sep = ";"; - } - } + /* + * Loop through and join patterns with a ";" Each "clause" + * corresponds to a single textual description (called typename) + * in the tk_getOpenFile docs. Each such typename may occur + * multiple times and all these form a single filter entry + * with one clause per occurence. Further each clause may specify + * multiple patterns. Hence the nested loop here. + */ + sep = ""; + for (clausePtr=filterPtr->clauses ; clausePtr; + clausePtr=clausePtr->next) { + GlobPattern *globPtr; + for (globPtr = clausePtr->patterns; globPtr; + globPtr = globPtr->next) { + Tcl_DStringAppend(&patterns, sep, -1); + Tcl_DStringAppend(&patterns, globPtr->pattern, -1); + sep = ";"; + } + } - /* Again we need a Unicode form of the string */ + /* Again we need a Unicode form of the string */ Tcl_WinUtfToTChar(Tcl_DStringValue(&patterns), -1, &ds); - nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */ - nbytes += sizeof(WCHAR); /* Terminating \0 */ - dlgFilterPtr[i].pszSpec = ckalloc(nbytes); - memmove((void *)dlgFilterPtr[i].pszSpec, Tcl_DStringValue(&ds), nbytes); - Tcl_DStringFree(&ds); - Tcl_DStringFree(&patterns); + nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */ + nbytes += sizeof(WCHAR); /* Terminating \0 */ + dlgFilterPtr[i].pszSpec = ckalloc(nbytes); + memmove((void *)dlgFilterPtr[i].pszSpec, Tcl_DStringValue(&ds), nbytes); + Tcl_DStringFree(&ds); + Tcl_DStringSetLength(&patterns, 0); } + Tcl_DStringFree(&patterns); - if (initialIndex == 0) - initialIndex = 1; /* If no default, show first entry */ + if (initialIndex == 0) { + initialIndex = 1; /* If no default, show first entry */ + } *initialIndexPtr = initialIndex; *dlgFilterPtrPtr = dlgFilterPtr; *countPtr = flist.numFilters; diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c index 6f1f840..251b5b9 100644 --- a/win/tkWinPointer.c +++ b/win/tkWinPointer.c @@ -81,6 +81,12 @@ TkWinGetModifierState(void) if (GetKeyState(VK_RBUTTON) & 0x8000) { state |= Button3Mask; } + if (GetKeyState(VK_XBUTTON1) & 0x8000) { + state |= Button4Mask; + } + if (GetKeyState(VK_XBUTTON2) & 0x8000) { + state |= Button5Mask; + } return state; } diff --git a/win/tkWinX.c b/win/tkWinX.c index fd576a4..7aa49ab 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -930,9 +930,12 @@ Tk_TranslateWinEvent( case WM_MBUTTONDBLCLK: case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK: + case WM_XBUTTONDOWN: + case WM_XBUTTONDBLCLK: case WM_LBUTTONUP: case WM_MBUTTONUP: case WM_RBUTTONUP: + case WM_XBUTTONUP: case WM_MOUSEMOVE: Tk_PointerEvent(hwnd, (short) LOWORD(lParam), (short) HIWORD(lParam)); return 1; @@ -1745,7 +1748,7 @@ Tk_FreeXId( * TkWinResendEvent -- * * This function converts an X event into a Windows event and invokes the - * specified windo function. + * specified window function. * * Results: * A standard Windows result. @@ -1783,6 +1786,14 @@ TkWinResendEvent( msg = WM_RBUTTONDOWN; wparam = MK_RBUTTON; break; + case Button4: + msg = WM_XBUTTONDOWN; + wparam = MAKEWPARAM(MK_XBUTTON1, XBUTTON1); + break; + case Button5: + msg = WM_XBUTTONDOWN; + wparam = MAKEWPARAM(MK_XBUTTON2, XBUTTON2); + break; default: return 0; } @@ -1796,6 +1807,12 @@ TkWinResendEvent( if (eventPtr->xbutton.state & Button3Mask) { wparam |= MK_RBUTTON; } + if (eventPtr->xbutton.state & Button4Mask) { + wparam |= MK_XBUTTON1; + } + if (eventPtr->xbutton.state & Button5Mask) { + wparam |= MK_XBUTTON2; + } if (eventPtr->xbutton.state & ShiftMask) { wparam |= MK_SHIFT; } |