{"thread":{"id":"63435","subject":"[PATCH] gitk: use makedroplist, not ::combobox","startedAt":"2025-05-10T17:17:28Z","lastAt":"2025-05-10T17:52:25Z","messageCount":2,"participants":["Mark Levedahl","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"517741","messageId":"20250510171723.32163-1-mlevedahl@gmail.com","threadId":"63435","inReplyTo":null,"subject":"[PATCH] gitk: use makedroplist, not ::combobox","fromName":"Mark Levedahl","fromEmail":"mlevedahl@gmail.com","sentAt":"2025-05-10T17:17:23Z","receivedAt":"2025-05-10T17:17:28Z","isPatch":true,"sender":{"key":"mdl123@verizon.net","avatar":"https://avatars.githubusercontent.com/u/5302462?v=4"},"body":"gitk offers to not use themed tk (ttk), and cannot use such on Tcl/Tk\nearlier than 8.5 where ttk was introduced. To facilitate this, widgets\nare switched from themed to not by use of the global ${NS}: ${NS} == ttk\nto select themed widgets, \"\" for non-themed. The combobox widget exists\nonly in ttk, and proc makedroplist exists to create a combobox like\nwidget using only base tk widgets.\n\nHowever, 904b36b815 (\"gitk: add text wrapping preferences\", 2024-12-05),\nintroduced two instances of ${NS}::combobox, and since that commit,\ngitk effectively requires Tk >= 8.5 and themed widgets enabled.\n\nFix this by using makedropbox instead.\n\nSigned-off-by: Mark Levedahl <mlevedahl@gmail.com>\n---\n gitk | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 11ad639..d48982f 100755\n--- a/gitk\n+++ b/gitk\n@@ -11736,12 +11736,12 @@ proc prefspage_general {notebook} {\n     grid x $page.tabstopl $page.tabstop -sticky w\n \n     ${NS}::label $page.wrapcommentl -text [mc \"Wrap comment text\"]\n-    ${NS}::combobox $page.wrapcomment -values {none char word} -state readonly \\\n+    makedroplist $page.wrapcomment -values {none char word} -state readonly \\\n         -textvariable wrapcomment\n     grid x $page.wrapcommentl $page.wrapcomment -sticky w\n \n     ${NS}::label $page.wrapdefaultl -text [mc \"Wrap other text\"]\n-    ${NS}::combobox $page.wrapdefault -values {none char word} -state readonly \\\n+    makedroplist $page.wrapdefault -values {none char word} -state readonly \\\n         -textvariable wrapdefault\n     grid x $page.wrapdefaultl $page.wrapdefault -sticky w\n \n-- \n2.49.0.99.610\n\n"},{"id":"517744","messageId":"f75dec28-ec1f-4f94-be09-6b86a2421ac5@kdbg.org","threadId":"63435","inReplyTo":"20250510171723.32163-1-mlevedahl@gmail.com","subject":"Re: [PATCH] gitk: use makedroplist, not ::combobox","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2025-05-10T17:52:17Z","receivedAt":"2025-05-10T17:52:25Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 10.05.25 um 19:17 schrieb Mark Levedahl:\n> gitk offers to not use themed tk (ttk), and cannot use such on Tcl/Tk\n> earlier than 8.5 where ttk was introduced. To facilitate this, widgets\n> are switched from themed to not by use of the global ${NS}: ${NS} == ttk\n> to select themed widgets, \"\" for non-themed. The combobox widget exists\n> only in ttk, and proc makedroplist exists to create a combobox like\n> widget using only base tk widgets.\n> \n> However, 904b36b815 (\"gitk: add text wrapping preferences\", 2024-12-05),\n> introduced two instances of ${NS}::combobox, and since that commit,\n> gitk effectively requires Tk >= 8.5 and themed widgets enabled.\n> \n> Fix this by using makedropbox instead.\n> \n> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>\n> ---\n>  gitk | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/gitk b/gitk\n> index 11ad639..d48982f 100755\n> --- a/gitk\n> +++ b/gitk\n> @@ -11736,12 +11736,12 @@ proc prefspage_general {notebook} {\n>      grid x $page.tabstopl $page.tabstop -sticky w\n>  \n>      ${NS}::label $page.wrapcommentl -text [mc \"Wrap comment text\"]\n> -    ${NS}::combobox $page.wrapcomment -values {none char word} -state readonly \\\n> +    makedroplist $page.wrapcomment -values {none char word} -state readonly \\\n>          -textvariable wrapcomment\n>      grid x $page.wrapcommentl $page.wrapcomment -sticky w\n>  \n>      ${NS}::label $page.wrapdefaultl -text [mc \"Wrap other text\"]\n> -    ${NS}::combobox $page.wrapdefault -values {none char word} -state readonly \\\n> +    makedroplist $page.wrapdefault -values {none char word} -state readonly \\\n>          -textvariable wrapdefault\n>      grid x $page.wrapdefaultl $page.wrapdefault -sticky w\n>  \n\nUnfortunately, the fix is not that simple. `makedroplist` isn't just a\ndrop-in replacement for `${NS}::combobox`.\n\nAllow me to prefer https://github.com/j6t/gitk/commit/c259b2ede8a74809005f81eeb6bb827b1d9692e0,\nreproduced below, over this patch.\n\n-- Hannes\n\nFrom: YOKOTA Hiroshi <yokota.hgml@gmail.com>\nSubject: [PATCH] gitk: Legacy widgets doesn't have combobox\n\nUse \"proc makedroplist\" function to support combobox on legacy widgets mode.\n\"proc makedroplist\" uses \"ttk::combobox\" for themed mode, and uses\n\"tk_optionMenu\" for legacy mode to get rid of the probrem.\n\nSigned-off-by: YOKOTA Hiroshi <yokota.hgml@gmail.com>\n---\n gitk | 6 ++----\n 1 file changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 0d96597..fc1dd61 100755\n--- a/gitk\n+++ b/gitk\n@@ -11782,13 +11782,11 @@ proc prefspage_general {notebook} {\n     grid x $page.tabstopl $page.tabstop -sticky w\n \n     ${NS}::label $page.wrapcommentl -text [mc \"Wrap comment text\"]\n-    ${NS}::combobox $page.wrapcomment -values {none char word} -state readonly \\\n-        -textvariable wrapcomment\n+    makedroplist $page.wrapcomment wrapcomment none char word\n     grid x $page.wrapcommentl $page.wrapcomment -sticky w\n \n     ${NS}::label $page.wrapdefaultl -text [mc \"Wrap other text\"]\n-    ${NS}::combobox $page.wrapdefault -values {none char word} -state readonly \\\n-        -textvariable wrapdefault\n+    makedroplist $page.wrapdefault wrapdefault none char word\n     grid x $page.wrapdefaultl $page.wrapdefault -sticky w\n \n     ${NS}::checkbutton $page.ntag -text [mc \"Display nearby tags/heads\"] \\\n-- \n2.49.0.212.gc22db56b11.dirty\n\n"}]}