Skip to content

Commit d20e601

Browse files
committed
tests/testutils.tcl, win/tkWinDialog.c: move variable ::tk_dialog into namespace ::tk::test::dialog
1 parent 824e60d commit d20e601

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

tests/testutils.tcl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,13 @@ namespace eval ::tk::test::dialog {
458458
variable testDialogResult
459459
variable testDialogFont
460460
variable iter_after
461+
variable tk_dialog; # On MS Windows, this variable is set at the C level
462+
# by SetTkDialog() in tkWinDialog.c
461463

462464
switch -- $stage {
463465
launch {
464466
set iter_after 0
465-
set ::tk_dialog {}
467+
set tk_dialog {}
466468
if {$::tcl_platform(platform) eq "windows"} {
467469
variable testDialogClass "#32770"
468470
}
@@ -491,10 +493,10 @@ namespace eval ::tk::test::dialog {
491493
# On Vista and later, using the new file dialogs we have to find
492494
# the window using its title as tk_dialog will not be set at the C level
493495
variable testDialogClass
494-
if {[catch {testfindwindow "" $testDialogClass} ::tk_dialog]} {
496+
if {[catch {testfindwindow "" $testDialogClass} tk_dialog]} {
495497
set doRepeat 1
496498
}
497-
} elseif {$::tk_dialog eq ""} {
499+
} elseif {$tk_dialog eq ""} {
498500
set doRepeat 1
499501
}
500502

win/tkWinDialog.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ typedef struct {
153153

154154
typedef struct OFNData {
155155
Tcl_Interp *interp; /* Interp, used only if debug is turned on,
156-
* for setting the "tk_dialog" variable. */
156+
* for setting the variable
157+
* "::tk::test::dialog::tk_dialog". */
157158
int dynFileBufferSize; /* Dynamic filename buffer size, stored to
158159
* avoid shrinking and expanding the buffer
159160
* when selection changes */
@@ -646,9 +647,9 @@ EatSpuriousMessageBugFix(void)
646647
* TkWinDialogDebug --
647648
*
648649
* Function to turn on/off debugging support for common dialogs under
649-
* windows. The variable "tk_debug" is set to the identifier of the
650-
* dialog window when the modal dialog window pops up and it is safe to
651-
* send messages to the dialog.
650+
* windows. The variable "::tk::test::dialog::tk_dialog" is set to the
651+
* identifier of the dialog window when the modal dialog window pops up
652+
* and it is safe to send messages to the dialog.
652653
*
653654
* Results:
654655
* None.
@@ -1839,10 +1840,10 @@ GetFileName(
18391840
*
18401841
* OFNHookProc --
18411842
*
1842-
* Dialog box hook function. This is used to set the "tk_dialog"
1843-
* variable for test/debugging when the dialog is ready to receive
1844-
* messages. When multiple file selection is enabled this function
1845-
* is used to process the list of names.
1843+
* Dialog box hook function. This is used to set the variable
1844+
* "::tk::test::dialog::tk_dialog" for test/debugging when the dialog
1845+
* is ready to receive messages. When multiple file selection is enabled
1846+
* this function is used to process the list of names.
18461847
*
18471848
* Results:
18481849
* Returns 0 to allow default processing of messages to occur.
@@ -2949,10 +2950,11 @@ MsgBoxCBTProc(
29492950
*
29502951
* SetTkDialog --
29512952
*
2952-
* Records the HWND for a native dialog in the 'tk_dialog' variable so
2953-
* that the test-suite can operate on the correct dialog window. Use of
2954-
* this is enabled when a test program calls TkWinDialogDebug by calling
2955-
* the test command 'tkwinevent debug 1'.
2953+
* Records the HWND for a native dialog in the variable
2954+
* ":tk::test::dialog::tk_dialog" so that the test-suite can operate
2955+
* on the correct dialog window. Use of this is enabled when a test
2956+
* program calls TkWinDialogDebug by calling the test command
2957+
* 'testwinevent debug 1'.
29562958
*
29572959
* ----------------------------------------------------------------------
29582960
*/
@@ -2966,7 +2968,8 @@ SetTkDialog(
29662968
char buf[32];
29672969

29682970
snprintf(buf, sizeof(buf), "0x%" TCL_Z_MODIFIER "x", (size_t)clientData);
2969-
Tcl_SetVar2(tsdPtr->debugInterp, "tk_dialog", NULL, buf, TCL_GLOBAL_ONLY);
2971+
Tcl_SetVar2(tsdPtr->debugInterp, "::tk::test::dialog::tk_dialog", NULL,
2972+
buf, TCL_GLOBAL_ONLY);
29702973
}
29712974

29722975
/*

0 commit comments

Comments
 (0)