Tk Source Code

Check-in [5c57b37c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove tclWinProcs, as it is no longer being used
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5c57b37c2086a666aa102a6f5f387084eb24ef35
User & Date: jan.nijtmans 2011-10-05 14:02:34
Context
2011-10-05
14:04
wrong copy/paste in ChangeLog check-in: 7131b4c5 user: jan.nijtmans tags: trunk
14:02
Remove tclWinProcs, as it is no longer being used check-in: 5c57b37c user: jan.nijtmans tags: trunk
2011-09-27
10:38
* generic/tkImgPNG.c (WriteExtraChunks): [Bug 3405839]: Write the sDAT chunk with the correct length. check-in: abb98802 user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.







1
2
3
4
5
6
7






2011-09-27  Donal K. Fellows  <[email protected]>

	* generic/tkImgPNG.c (WriteExtraChunks): [Bug 3405839]: Write the sDAT
	chunk with the correct length.

2011-09-08  Jan Nijtmans  <[email protected]>

>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
2011-10-05  Jan Nijtmans  <[email protected]>

	* generic/tkWinInt.h:   Remove tclWinProcs, as it is no longer
	* generic/tkWinX.c:     being used.
	* generic/tkWinTest.c:

2011-09-27  Donal K. Fellows  <[email protected]>

	* generic/tkImgPNG.c (WriteExtraChunks): [Bug 3405839]: Write the sDAT
	chunk with the correct length.

2011-09-08  Jan Nijtmans  <[email protected]>

Changes to win/tkWinInt.h.

166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/*
 * Used by tkWinWm.c for embedded menu handling. May become public.
 */

MODULE_SCOPE HWND Tk_GetMenuHWND(Tk_Window tkwin);
MODULE_SCOPE HWND Tk_GetEmbeddedMenuHWND(Tk_Window tkwin);

/*
 * The following structure keeps track of whether we are using the multi-byte
 * or the wide-character interfaces to the operating system. System calls
 * should be made through the following function table.
 *
 * While some system calls need to use this A/W jump-table, it is not
 * necessary for all calls to do it, which is why you won't see this used
 * throughout the Tk code, but only in key areas. -- hobbs
 */

typedef struct TkWinProcs {
    int useWide;
    LRESULT (WINAPI *callWindowProc)(WNDPROC, HWND, UINT, WPARAM, LPARAM);
    LRESULT (WINAPI *defWindowProc)(HWND, UINT, WPARAM, LPARAM);
    ATOM (WINAPI *registerClass)(const WNDCLASS *);
    BOOL (WINAPI *setWindowText)(HWND, LPCTSTR);
    HWND (WINAPI *createWindowEx)(DWORD, LPCTSTR, LPCTSTR, DWORD, int, int,
	    int, int, HWND, HMENU, HINSTANCE, LPVOID);
    BOOL (WINAPI *insertMenu)(HMENU, UINT, UINT, UINT, LPCTSTR);
    int (WINAPI *getWindowText)(HWND, LPCTSTR, int);
    HWND (WINAPI *findWindow)(LPCTSTR, LPCTSTR);
    int (WINAPI *getClassName)(HWND, LPTSTR, int);
} TkWinProcs;

MODULE_SCOPE const TkWinProcs *const tkWinProcs;

/*
 * The following allows us to cache these encoding for multiple functions.
 */


MODULE_SCOPE Tcl_Encoding	TkWinGetKeyInputEncoding(void);
MODULE_SCOPE Tcl_Encoding	TkWinGetUnicodeEncoding(void);







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







166
167
168
169
170
171
172


























173
174
175
176
177
178
179
/*
 * Used by tkWinWm.c for embedded menu handling. May become public.
 */

MODULE_SCOPE HWND Tk_GetMenuHWND(Tk_Window tkwin);
MODULE_SCOPE HWND Tk_GetEmbeddedMenuHWND(Tk_Window tkwin);



























/*
 * The following allows us to cache these encoding for multiple functions.
 */


MODULE_SCOPE Tcl_Encoding	TkWinGetKeyInputEncoding(void);
MODULE_SCOPE Tcl_Encoding	TkWinGetUnicodeEncoding(void);

Changes to win/tkWinTest.c.

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
			    Tcl_Interp *interp, int objc,
			    Tcl_Obj *const objv[]);
static int		TestwinlocaleObjCmd(ClientData clientData,
			    Tcl_Interp *interp, int objc,
			    Tcl_Obj *const objv[]);
static Tk_GetSelProc		SetSelectionResult;


static const TkWinProcs unicodeProcs = {
    1,
    (LRESULT (WINAPI *)(WNDPROC, HWND, UINT, WPARAM, LPARAM)) CallWindowProcW,
    (LRESULT (WINAPI *)(HWND, UINT, WPARAM, LPARAM)) DefWindowProcW,
    (ATOM (WINAPI *)(const WNDCLASS *)) RegisterClassW,
    (BOOL (WINAPI *)(HWND, LPCTSTR)) SetWindowTextW,
    (HWND (WINAPI *)(DWORD, LPCTSTR, LPCTSTR, DWORD, int, int, int, int,
	    HWND, HMENU, HINSTANCE, LPVOID)) CreateWindowExW,
    (BOOL (WINAPI *)(HMENU, UINT, UINT, UINT, LPCTSTR)) InsertMenuW,
    (int (WINAPI *)(HWND, LPCTSTR, int)) GetWindowTextW,
    (HWND (WINAPI *)(LPCTSTR, LPCTSTR)) FindWindowW,
    (int (WINAPI *)(HWND, LPTSTR, int)) GetClassNameW,
};

static const TkWinProcs *const tkTestWinProcs = &unicodeProcs;


/*
 *----------------------------------------------------------------------
 *
 * TkplatformtestInit --
 *
 *	Defines commands that test platform specific functionality for Windows
 *	platforms.







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







36
37
38
39
40
41
42


















43
44
45
46
47
48
49
			    Tcl_Interp *interp, int objc,
			    Tcl_Obj *const objv[]);
static int		TestwinlocaleObjCmd(ClientData clientData,
			    Tcl_Interp *interp, int objc,
			    Tcl_Obj *const objv[]);
static Tk_GetSelProc		SetSelectionResult;



















/*
 *----------------------------------------------------------------------
 *
 * TkplatformtestInit --
 *
 *	Defines commands that test platform specific functionality for Windows
 *	platforms.
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
    char id[TCL_INTEGER_SPACE], msgBuf[24 + TCL_INTEGER_SPACE];
    Tcl_DString ds;
    Tcl_Obj *resultPtr = Tcl_GetObjResult(interp);

    if (Tcl_IsShared(resultPtr)) {
	resultPtr = Tcl_DuplicateObj(resultPtr);
    }
    length = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM
	    | FORMAT_MESSAGE_IGNORE_INSERTS
	    | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, error,
	    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *) wMsgPtrPtr,
	    0, NULL);
    if (length == 0) {
	char *msgPtr;








|







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
    char id[TCL_INTEGER_SPACE], msgBuf[24 + TCL_INTEGER_SPACE];
    Tcl_DString ds;
    Tcl_Obj *resultPtr = Tcl_GetObjResult(interp);

    if (Tcl_IsShared(resultPtr)) {
	resultPtr = Tcl_DuplicateObj(resultPtr);
    }
    length = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
	    | FORMAT_MESSAGE_IGNORE_INSERTS
	    | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, error,
	    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *) wMsgPtrPtr,
	    0, NULL);
    if (length == 0) {
	char *msgPtr;

413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
    }

    title = Tcl_WinUtfToTChar(Tcl_GetString(objv[1]), -1, &titleString);
    if (objc == 3) {
        class = Tcl_WinUtfToTChar(Tcl_GetString(objv[2]), -1, &classString);
    }

    hwnd  = tkTestWinProcs->findWindow(class, title);

    if (hwnd == NULL) {
	Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to find window: ", -1));
	AppendSystemError(interp, GetLastError());
	r = TCL_ERROR;
    } else {
        Tcl_SetObjResult(interp, Tcl_NewLongObj(PTR2INT(hwnd)));







|







395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
    }

    title = Tcl_WinUtfToTChar(Tcl_GetString(objv[1]), -1, &titleString);
    if (objc == 3) {
        class = Tcl_WinUtfToTChar(Tcl_GetString(objv[2]), -1, &classString);
    }

    hwnd  = FindWindow(class, title);

    if (hwnd == NULL) {
	Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to find window: ", -1));
	AppendSystemError(interp, GetLastError());
	r = TCL_ERROR;
    } else {
        Tcl_SetObjResult(interp, Tcl_NewLongObj(PTR2INT(hwnd)));
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
	Tcl_WrongNumArgs(interp, 1, objv, "hwnd");
	return TCL_ERROR;
    }

    if (Tcl_GetLongFromObj(interp, objv[1], &hwnd) != TCL_OK)
	return TCL_ERROR;

    cch = tkTestWinProcs->getClassName(INT2PTR(hwnd), buf, cchBuf);
    if (cch == 0) {
    	Tcl_SetResult(interp, "failed to get class name: ", TCL_STATIC);
    	AppendSystemError(interp, GetLastError());
    	return TCL_ERROR;
    } else {
	Tcl_DString ds;
	Tcl_WinTCharToUtf(buf, -1, &ds);
	classObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
	Tcl_DStringFree(&ds);
    }

    dictObj = Tcl_NewDictObj();
    Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("class", 5), classObj);
    Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2),
	Tcl_NewLongObj(GetWindowLongA(INT2PTR(hwnd), GWL_ID)));

    cch = tkTestWinProcs->getWindowText(INT2PTR(hwnd), (LPTSTR)buf, cchBuf);
    textObj = Tcl_NewUnicodeObj((LPCWSTR)buf, cch);

    Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("text", 4), textObj);
    Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("parent", 6),
	Tcl_NewLongObj(PTR2INT(GetParent((INT2PTR(hwnd))))));

    childrenObj = Tcl_NewListObj(0, NULL);







|
















|







443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
	Tcl_WrongNumArgs(interp, 1, objv, "hwnd");
	return TCL_ERROR;
    }

    if (Tcl_GetLongFromObj(interp, objv[1], &hwnd) != TCL_OK)
	return TCL_ERROR;

    cch = GetClassName(INT2PTR(hwnd), buf, cchBuf);
    if (cch == 0) {
    	Tcl_SetResult(interp, "failed to get class name: ", TCL_STATIC);
    	AppendSystemError(interp, GetLastError());
    	return TCL_ERROR;
    } else {
	Tcl_DString ds;
	Tcl_WinTCharToUtf(buf, -1, &ds);
	classObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
	Tcl_DStringFree(&ds);
    }

    dictObj = Tcl_NewDictObj();
    Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("class", 5), classObj);
    Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2),
	Tcl_NewLongObj(GetWindowLongA(INT2PTR(hwnd), GWL_ID)));

    cch = GetWindowText(INT2PTR(hwnd), (LPTSTR)buf, cchBuf);
    textObj = Tcl_NewUnicodeObj((LPCWSTR)buf, cch);

    Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("text", 4), textObj);
    Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("parent", 6),
	Tcl_NewLongObj(PTR2INT(GetParent((INT2PTR(hwnd))))));

    childrenObj = Tcl_NewListObj(0, NULL);

Changes to win/tkWinX.c.

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
 * Perhaps this definition should be moved in another file.
 */
#ifndef WM_UNICHAR
#define WM_UNICHAR     0x0109
#define UNICODE_NOCHAR 0xFFFF
#endif

static const TkWinProcs unicodeProcs = {
    1,
    (LRESULT (WINAPI *)(WNDPROC, HWND, UINT, WPARAM, LPARAM)) CallWindowProcW,
    (LRESULT (WINAPI *)(HWND, UINT, WPARAM, LPARAM)) DefWindowProcW,
    (ATOM (WINAPI *)(const WNDCLASS *)) RegisterClassW,
    (BOOL (WINAPI *)(HWND, LPCTSTR)) SetWindowTextW,
    (HWND (WINAPI *)(DWORD, LPCTSTR, LPCTSTR, DWORD, int, int,
	    int, int, HWND, HMENU, HINSTANCE, LPVOID)) CreateWindowExW,
    (BOOL (WINAPI *)(HMENU, UINT, UINT, UINT, LPCTSTR)) InsertMenuW,
    (int (WINAPI *)(HWND, LPCTSTR, int)) GetWindowTextW,
    (HWND (WINAPI *)(LPCTSTR, LPCTSTR)) FindWindowW,
    (int (WINAPI *)(HWND, LPTSTR, int)) GetClassNameW,
};

const TkWinProcs *const tkWinProcs = &unicodeProcs;

/*
 * Declarations of static variables used in this file.
 */

static const char winScreenName[] = ":0"; /* Default name of windows display. */
static HINSTANCE tkInstance = NULL;	/* Application instance handle. */
static int childClassInitialized;	/* Registered child class? */







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







49
50
51
52
53
54
55
















56
57
58
59
60
61
62
 * Perhaps this definition should be moved in another file.
 */
#ifndef WM_UNICHAR
#define WM_UNICHAR     0x0109
#define UNICODE_NOCHAR 0xFFFF
#endif

















/*
 * Declarations of static variables used in this file.
 */

static const char winScreenName[] = ":0"; /* Default name of windows display. */
static HINSTANCE tkInstance = NULL;	/* Application instance handle. */
static int childClassInitialized;	/* Registered child class? */
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
    }

    hIMC = ImmGetContext(hwnd);
    if (!hIMC) {
	return 0;
    }

    n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);

    if (n > 0) {
	char *buff = ckalloc(n);
	TkWindow *winPtr;
	XEvent event;
	int i;

	n = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, buff, (unsigned) n);

	/*
	 * Set up the fields pertinent to key event.
	 *
	 * We set send_event to the special value of -2, so that TkpGetString
	 * in tkWinKey.c knows that trans_chars[] already contains a UNICODE
	 * char and there's no need to do encoding conversion.







|







|







1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
    }

    hIMC = ImmGetContext(hwnd);
    if (!hIMC) {
	return 0;
    }

    n = ImmGetCompositionString(hIMC, GCS_RESULTSTR, NULL, 0);

    if (n > 0) {
	char *buff = ckalloc(n);
	TkWindow *winPtr;
	XEvent event;
	int i;

	n = ImmGetCompositionString(hIMC, GCS_RESULTSTR, buff, (unsigned) n);

	/*
	 * Set up the fields pertinent to key event.
	 *
	 * We set send_event to the special value of -2, so that TkpGetString
	 * in tkWinKey.c knows that trans_chars[] already contains a UNICODE
	 * char and there's no need to do encoding conversion.