{"thread":{"id":"59967","subject":"[PATCH 0/2] fix resize issues on large screens","startedAt":"2023-07-08T10:56:25Z","lastAt":"2023-07-10T21:04:10Z","messageCount":5,"participants":["Georg Müller","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"479325","messageId":"20230708105546.2945446-2-georgmueller@gmx.net","threadId":"59967","inReplyTo":null,"subject":"[PATCH 0/2] fix resize issues on large screens","fromName":"Georg Müller","fromEmail":"georgmueller@gmx.net","sentAt":"2023-07-08T10:55:42Z","receivedAt":"2023-07-08T10:56:25Z","isPatch":true,"sender":{"key":"georgmueller@gmx.net","avatar":null},"body":"When opening gitk in a multi-monitor setup with different resolutions,\nthe resize factor causes the first columns of the layout get bigger and\nbigger while the other columns (author, date in upper pane, file list in\nlower pane) shrink to a minimum size.\n\nThe following setup triggers the problem on Fedora 38/Gnome 44:\n* primary screen 1 has a FHD resolution (1920x1080)\n* secondary screen 2 has a QHD resolution (2560x1440)\n\nEvery time gitk opens at screen 2, the resize is triggered and the columns\nare shifted 1.33x to the right (2560/1920 = 1.33).\nAfter multiple rounds of closing/opening gitk, the columns are at their\nminimum size and the contents are not visible or only a minimum is\nvisible.\n\nThe following patches are two approaches to fix the problem. Maybe the\nhard-coded values could be variables, this is a first shot to solve the\nproblem.\n\nGeorg Müller (2):\n  gitk: limit factor scaling on resize to widths below 1900px\n  gitk: keep author and date colums to a minimal width on resize\n\n gitk-git/gitk | 24 ++++++++++++++++++++++--\n 1 file changed, 22 insertions(+), 2 deletions(-)\n\n--\n2.41.0\n\n"},{"id":"479326","messageId":"20230708105546.2945446-3-georgmueller@gmx.net","threadId":"59967","inReplyTo":"20230708105546.2945446-2-georgmueller@gmx.net","subject":"[PATCH 1/2] gitk: limit factor scaling on resize to widths below 1900px","fromName":"Georg Müller","fromEmail":"georgmueller@gmx.net","sentAt":"2023-07-08T10:55:43Z","receivedAt":"2023-07-08T10:56:34Z","isPatch":true,"sender":{"key":"georgmueller@gmx.net","avatar":null},"body":"If old and new width is above 1900, the scaling would result in widening\nthe author and date column unnecessarily.\n\nSigned-off-by: Georg Müller <georgmueller@gmx.net>\n---\n gitk-git/gitk | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex df3ba2ea99..0f229aadd7 100755\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -2985,6 +2985,9 @@ proc resizeclistpanes {win w} {\n             set s0 [$win sash coord 0]\n             set s1 [$win sash coord 1]\n         }\n+        if {$oldwidth($win) > 1900 && $w > 1900} {\n+            return\n+        }\n         if {$w < 60} {\n             set sash0 [expr {int($w/2 - 2)}]\n             set sash1 [expr {int($w*5/6 - 2)}]\n@@ -3029,6 +3032,9 @@ proc resizecdetpanes {win w} {\n         } else {\n             set s0 [$win sash coord 0]\n         }\n+        if {$oldwidth($win) > 1900 && $w > 1900} {\n+            return\n+        }\n         if {$w < 60} {\n             set sash0 [expr {int($w*3/4 - 2)}]\n         } else {\n--\n2.41.0\n\n"},{"id":"479327","messageId":"20230708105546.2945446-4-georgmueller@gmx.net","threadId":"59967","inReplyTo":"20230708105546.2945446-2-georgmueller@gmx.net","subject":"[PATCH 2/2] gitk: keep author and date colums to a minimal width on resize","fromName":"Georg Müller","fromEmail":"georgmueller@gmx.net","sentAt":"2023-07-08T10:55:44Z","receivedAt":"2023-07-08T10:56:34Z","isPatch":true,"sender":{"key":"georgmueller@gmx.net","avatar":null},"body":"Signed-off-by: Georg Müller <georgmueller@gmx.net>\n---\n gitk-git/gitk | 18 ++++++++++++++++--\n 1 file changed, 16 insertions(+), 2 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex 0f229aadd7..819e059599 100755\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -2973,7 +2973,7 @@ proc savestuff {w} {\n }\n\n proc resizeclistpanes {win w} {\n-    global oldwidth oldsash use_ttk\n+    global oldwidth oldsash use_ttk charspc\n     if {[info exists oldwidth($win)]} {\n         if {[info exists oldsash($win)]} {\n             set s0 [lindex $oldsash($win) 0]\n@@ -3007,7 +3007,16 @@ proc resizeclistpanes {win w} {\n                     set sash0 [expr {$sash1 - 20}]\n                 }\n             }\n+            if {$w > 150 * $charspc} {\n+                if {$sash1 + (20 * $charspc) > $w} {\n+                    set sash1 [expr {$w - (20 * $charspc)}]\n+                }\n+                if {$sash0 + (30 * $charspc) > $sash1} {\n+                    set sash0 [expr {$sash1 - (30 * $charspc)}]\n+                }\n+            }\n         }\n+\n         if {$use_ttk} {\n             $win sashpos 0 $sash0\n             $win sashpos 1 $sash1\n@@ -3023,7 +3032,7 @@ proc resizeclistpanes {win w} {\n }\n\n proc resizecdetpanes {win w} {\n-    global oldwidth oldsash use_ttk\n+    global oldwidth oldsash use_ttk charspc\n     if {[info exists oldwidth($win)]} {\n         if {[info exists oldsash($win)]} {\n             set s0 $oldsash($win)\n@@ -3046,6 +3055,11 @@ proc resizecdetpanes {win w} {\n             if {$sash0 > $w - 15} {\n                 set sash0 [expr {$w - 15}]\n             }\n+            if {$w > 150 * $charspc} {\n+                if {$sash0 + (30 * $charspc) > $w} {\n+                    set sash0 [expr {$w - (30 * $charspc)}]\n+                }\n+            }\n         }\n         if {$use_ttk} {\n             $win sashpos 0 $sash0\n--\n2.41.0\n\n"},{"id":"479343","messageId":"9a498c81-82b4-d441-6b5d-78ba3043b5a9@kdbg.org","threadId":"59967","inReplyTo":"20230708105546.2945446-2-georgmueller@gmx.net","subject":"Re: [PATCH 0/2] fix resize issues on large screens","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2023-07-10T16:37:44Z","receivedAt":"2023-07-10T16:37:51Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 08.07.23 um 12:55 schrieb Georg Müller:\n> When opening gitk in a multi-monitor setup with different resolutions,\n> the resize factor causes the first columns of the layout get bigger and\n> bigger while the other columns (author, date in upper pane, file list in\n> lower pane) shrink to a minimum size.\n> \n> The following setup triggers the problem on Fedora 38/Gnome 44:\n> * primary screen 1 has a FHD resolution (1920x1080)\n> * secondary screen 2 has a QHD resolution (2560x1440)\n> \n> Every time gitk opens at screen 2, the resize is triggered and the columns\n> are shifted 1.33x to the right (2560/1920 = 1.33).\n> After multiple rounds of closing/opening gitk, the columns are at their\n> minimum size and the contents are not visible or only a minimum is\n> visible.\n> \n> The following patches are two approaches to fix the problem. Maybe the\n> hard-coded values could be variables, this is a first shot to solve the\n> problem.\n\nSince you haven't stated it explicitly, I assume that with \"the problem\nsolved\" the resizing does not happen anymore. That's fine, but could be\nstated explicitly.\n\nWhen you say \"two approaches\", do you mean that the patches are\nindependent and either one solves the problem? And only one of them\nshould be taken?\n\nI've not read the code changes (because I don't know a lot of Tcl/Tk).\nBut I've seen the commit messages of the patches. They are mostly empty.\nThis cover letter has a pretty good explanation of the problem. Please\ncopy everything that is relevant for each commit to the commit message,\nbecause the cover letter won't be available in the commit history.\n\nThanks,\n-- Hannes\n\n> \n> Georg Müller (2):\n>   gitk: limit factor scaling on resize to widths below 1900px\n>   gitk: keep author and date colums to a minimal width on resize\n> \n>  gitk-git/gitk | 24 ++++++++++++++++++++++--\n>  1 file changed, 22 insertions(+), 2 deletions(-)\n> \n> --\n> 2.41.0\n> \n> \n\n"},{"id":"479350","messageId":"2621e32f-128b-2254-3215-7a6fc69c9064@gmx.net","threadId":"59967","inReplyTo":"9a498c81-82b4-d441-6b5d-78ba3043b5a9@kdbg.org","subject":"Re: [PATCH 0/2] fix resize issues on large screens","fromName":"Georg Müller","fromEmail":"georgmueller@gmx.net","sentAt":"2023-07-10T21:04:04Z","receivedAt":"2023-07-10T21:04:10Z","isPatch":true,"sender":{"key":"georgmueller@gmx.net","avatar":null},"body":"\nAm 10.07.23 um 18:37 schrieb Johannes Sixt:\n> Am 08.07.23 um 12:55 schrieb Georg Müller:\n>> When opening gitk in a multi-monitor setup with different resolutions,\n>> the resize factor causes the first columns of the layout get bigger and\n>> bigger while the other columns (author, date in upper pane, file list in\n>> lower pane) shrink to a minimum size.\n>>\n>> The following setup triggers the problem on Fedora 38/Gnome 44:\n>> * primary screen 1 has a FHD resolution (1920x1080)\n>> * secondary screen 2 has a QHD resolution (2560x1440)\n>>\n>> Every time gitk opens at screen 2, the resize is triggered and the columns\n>> are shifted 1.33x to the right (2560/1920 = 1.33).\n>> After multiple rounds of closing/opening gitk, the columns are at their\n>> minimum size and the contents are not visible or only a minimum is\n>> visible.\n>>\n>> The following patches are two approaches to fix the problem. Maybe the\n>> hard-coded values could be variables, this is a first shot to solve the\n>> problem.\n>\n> Since you haven't stated it explicitly, I assume that with \"the problem\n> solved\" the resizing does not happen anymore. That's fine, but could be\n> stated explicitly.\n>\n> When you say \"two approaches\", do you mean that the patches are\n> independent and either one solves the problem? And only one of them\n> should be taken?\n>\n> I've not read the code changes (because I don't know a lot of Tcl/Tk).\n> But I've seen the commit messages of the patches. They are mostly empty.\n> This cover letter has a pretty good explanation of the problem. Please\n> copy everything that is relevant for each commit to the commit message,\n> because the cover letter won't be available in the commit history.\n>\n> Thanks,\n> -- Hannes\n\nThank you for your suggestions. I will rephrase the commit messages and\nwill resend the commits.\n\nIn general, the patches are independent and both solve it for me, but\nboth of them make sense since scaling author and date columns above a\ncertain resolution does not make sense anymore and having a sane minimum\nwidth if there is enough space for the first column also makes sense.\n\nBest regards,\nGeorg\n\n\n>>\n>> Georg Müller (2):\n>>    gitk: limit factor scaling on resize to widths below 1900px\n>>    gitk: keep author and date colums to a minimal width on resize\n>>\n>>   gitk-git/gitk | 24 ++++++++++++++++++++++--\n>>   1 file changed, 22 insertions(+), 2 deletions(-)\n>>\n>> --\n>> 2.41.0\n>>\n>>\n>\n"}]}