{"thread":{"id":"63364","subject":"[PATCH 0/3] gitk: small quality of life improvements for themed Tk","startedAt":"2025-04-28T15:56:16Z","lastAt":"2025-04-28T15:56:18Z","messageCount":4,"participants":["Christoph Sommer via GitGitGadget"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"516893","messageId":"pull.1909.git.1745855773.gitgitgadget@gmail.com","threadId":"63364","inReplyTo":null,"subject":"[PATCH 0/3] gitk: small quality of life improvements for themed Tk","fromName":"Christoph Sommer via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-04-28T15:56:10Z","receivedAt":"2025-04-28T15:56:16Z","isPatch":true,"sender":{"key":"name:Christoph Sommer","avatar":null},"body":"These three closely related patches build on\nhttps://lore.kernel.org/git/pull.1835.git.1733767737.gitgitgadget@gmail.com\nto:\n\n 1. also allow changing text wrapping preferences for users that do not use\n    themed Tk (that is, users that have turned the \"use themed widgets\"\n    preference off);\n 2. no longer change the background color when using themed Tk (the default)\n    as - at least on the platforms I tried - most widgets and the main\n    window do not change their background color anyhow, whereas some widgets\n    do, leading to a messy looking UI where different widgets seemingly\n    assume different background colors; and\n 3. use the now-available uicolor preference to draw a \"sash\" (grab handle)\n    between the many panes of the main window when using themed Tk; on the\n    platforms I tried, themed Tk was both the default and it was not\n    rendering any sash, thus requiring users to guess where to click to\n    resize window panes. Manually setting uicolor to a platform-dependent\n    color (see https://www.tcl-lang.org/man/tcl/TkCmd/colors.htm#M4) in the\n    config file works to get sashes that automatically adapt to light mode\n    and dark mode.\n\nChristoph Sommer (3):\n  gitk: fix text wrapping preferences for unthemed tk\n  gitk: do not set fg/bg color scheme for themed Tk\n  gitk: on themed tk, use uicolor to draw a sash between panes\n\n gitk-git/gitk | 60 +++++++++++++++++++++++++++++++++++++++++++++------\n 1 file changed, 53 insertions(+), 7 deletions(-)\n\n\nbase-commit: f65182a99e545d2f2bc22e6c1c2da192133b16a3\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1909%2Fsommer%2Fmaster-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1909/sommer/master-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1909\n-- \ngitgitgadget\n"},{"id":"516894","messageId":"59a6d8831a75f793aae087bbffa9325f09af246a.1745855773.git.gitgitgadget@gmail.com","threadId":"63364","inReplyTo":"pull.1909.git.1745855773.gitgitgadget@gmail.com","subject":"[PATCH 1/3] gitk: fix text wrapping preferences for unthemed tk","fromName":"Christoph Sommer via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-04-28T15:56:11Z","receivedAt":"2025-04-28T15:56:17Z","isPatch":true,"sender":{"key":"name:Christoph Sommer","avatar":null},"body":"From: Christoph Sommer <sommer@cms-labs.org>\n\nUse a widget factory that works for both plain Tk and themed Tk.\n\nSigned-off-by: Christoph Sommer <sommer@cms-labs.org>\n---\n gitk-git/gitk | 6 ++----\n 1 file changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex bc9efa18566..8cb17f39d41 100755\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -11767,13 +11767,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-- \ngitgitgadget\n\n"},{"id":"516895","messageId":"78d87c0ecc87df6c89130a6cbb417b534db8395d.1745855773.git.gitgitgadget@gmail.com","threadId":"63364","inReplyTo":"pull.1909.git.1745855773.gitgitgadget@gmail.com","subject":"[PATCH 3/3] gitk: on themed tk, use uicolor to draw a sash between panes","fromName":"Christoph Sommer via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-04-28T15:56:13Z","receivedAt":"2025-04-28T15:56:18Z","isPatch":true,"sender":{"key":"name:Christoph Sommer","avatar":null},"body":"From: Christoph Sommer <sommer@cms-labs.org>\n\nAdd a custom sash (grab/resize handle) where the window is split into\npanes when using themed Tk as. Other than native Tk which draws sashes\nby default, themed Tk does not, by default, render such handles leaving\nusers to guess where to click to start resizing window panes. The color\nused for drawing these is uicolor, which is not needed on themed Tk,\nallowing the user to make these elements as pronounced or as invisible\nas desired.\n\nSigned-off-by: Christoph Sommer <sommer@cms-labs.org>\n---\n gitk-git/gitk | 48 +++++++++++++++++++++++++++++++++++++++++++++---\n 1 file changed, 45 insertions(+), 3 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex da7507af360..d19f29bbf18 100755\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -2133,7 +2133,31 @@ proc setoptions {} {\n     option add *Listbox.font mainfont startupFile\n }\n \n+proc createttkimages {} {\n+    global uicolor\n+\n+    image create bitmap img:myVerticalSash -foreground $uicolor -data {\n+        #define xbm_width 5\n+        #define xbm_height 47\n+        static unsigned char xbm_bits[] = {\n+        0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,\n+        0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x0e,\n+        0x00, 0x00, 0x0e, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,\n+        0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04 };\n+    }\n+\n+    image create bitmap img:myHorizontalSash -foreground $uicolor -data {\n+        #define xbm_width 47\n+        #define xbm_height 5\n+        static unsigned char xbm_bits[] = {\n+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x04, 0x00, 0x00,\n+        0xff, 0xff, 0x93, 0xe4, 0xff, 0x7f, 0x00, 0x00, 0x90, 0x04, 0x00, 0x00,\n+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };\n+    }\n+}\n+\n proc setttkstyle {} {\n+\n     eval font configure TkDefaultFont [fontflags mainfont]\n     eval font configure TkTextFont [fontflags textfont]\n     eval font configure TkHeadingFont [fontflags mainfont]\n@@ -2143,6 +2167,16 @@ proc setttkstyle {} {\n     eval font configure TkIconFont    [fontflags uifont]\n     eval font configure TkMenuFont    [fontflags uifont]\n     eval font configure TkSmallCaptionFont [fontflags uifont]\n+\n+    createttkimages\n+\n+    ttk::style element create myVerticalSash image img:myVerticalSash -sticky ew\n+\n+    ttk::style element create myHorizontalSash image img:myHorizontalSash -sticky ns\n+\n+    ttk::style layout Vertical.Sash { myVerticalSash }\n+\n+    ttk::style layout Horizontal.Sash { myHorizontalSash }\n }\n \n # Make a menu and submenus.\n@@ -11825,7 +11859,7 @@ proc prefspage_colors {notebook} {\n     grid $page.cdisp - -sticky w -pady 10\n     label $page.ui -padx 40 -relief sunk -background $uicolor\n     ${NS}::button $page.uibut -text [mc \"Interface\"] \\\n-       -command [list choosecolor uicolor {} $page.ui [mc \"interface\"] setui]\n+       -command [list choosecolor uicolor {} $page.ui [mc \"interface\"] setui_dialog]\n     grid x $page.uibut $page.ui -sticky w\n     label $page.bg -padx 40 -relief sunk -background $bgcolor\n     ${NS}::button $page.bgbut -text [mc \"Background\"] \\\n@@ -12006,6 +12040,14 @@ proc setui {c} {\n     tk_setPalette background $c selectColor $selc\n }\n \n+proc setui_dialog {c} {\n+    global uicolor\n+\n+    setui $c\n+\n+    createttkimages\n+}\n+\n proc setbg {c} {\n     global bglist\n \n@@ -12706,8 +12748,6 @@ eval font create textfontbold [fontflags textfont 1]\n parsefont uifont $uifont\n eval font create uifont [fontflags uifont]\n \n-setui $uicolor\n-\n setoptions\n \n # check that we can find a .git directory somewhere...\n@@ -12788,6 +12828,8 @@ if {![info exists have_ttk]} {\n set use_ttk [expr {$have_ttk && $want_ttk}]\n set NS [expr {$use_ttk ? \"ttk\" : \"\"}]\n \n+setui $uicolor\n+\n if {$use_ttk} {\n     setttkstyle\n }\n-- \ngitgitgadget\n"},{"id":"516896","messageId":"abe92305dcca8ebece332454004b6611ce2efd5a.1745855773.git.gitgitgadget@gmail.com","threadId":"63364","inReplyTo":"pull.1909.git.1745855773.gitgitgadget@gmail.com","subject":"[PATCH 2/3] gitk: do not set fg/bg color scheme for themed Tk","fromName":"Christoph Sommer via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2025-04-28T15:56:12Z","receivedAt":"2025-04-28T15:56:18Z","isPatch":true,"sender":{"key":"name:Christoph Sommer","avatar":null},"body":"From: Christoph Sommer <sommer@cms-labs.org>\n\nIgnore the uicolor preference not just for win32, but also whenever\nthemed Tk is used. On themed Tk it was frequently only changing the\nbackground of only a few select widgets rather than everything -\nand the default uicolor was frequently not the background color that\nthemed Tk used for its widgets, resulting in a messy looking UI\n(mostly light gray, with random widgets surrounded by darker gray borders)\n\nSigned-off-by: Christoph Sommer <sommer@cms-labs.org>\n---\n gitk-git/gitk | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex 8cb17f39d41..da7507af360 100755\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -11991,6 +11991,12 @@ proc setselbg {c} {\n # radiobuttons look bad.  This chooses white for selectColor if the\n # background color is light, or black if it is dark.\n proc setui {c} {\n+    global use_ttk\n+\n+    if {$use_ttk} {\n+        return\n+    }\n+\n     if {[tk windowingsystem] eq \"win32\"} { return }\n     set bg [winfo rgb . $c]\n     set selc black\n-- \ngitgitgadget\n\n"}]}