All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] gitk spacing/sizing tuning for HiDPI
@ 2015-12-06 12:25 Giuseppe Bilotta
  2015-12-06 12:25 ` [PATCH 1/2] gitk: match ttk fonts to gitk fonts Giuseppe Bilotta
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Giuseppe Bilotta @ 2015-12-06 12:25 UTC (permalink / raw)
  To: git; +Cc: Paul Mackerras, Giuseppe Bilotta

On my HiDPI monitor, most elements in gitk are correctly rendered, with two
exceptions:

* when using ttk, some elements do not use the same fonts as gitk would use
  without, and since ttk picks _unscaled_ sizes this is very noticeable (and
borderline illegible); the first patch fixes this;
* the spacing between the checkboxes on top of the diff window are a little too
  tightly-spaced; the second patch adds a little bit of breathing space.

Giuseppe Bilotta (2):
  gitk: match ttk fonts to gitk fonts
  gitk: let .bleft.mid widgets 'breathe'

 gitk | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

-- 
2.6.3.659.gfdd8f28

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] gitk: match ttk fonts to gitk fonts
  2015-12-06 12:25 [PATCH 0/2] gitk spacing/sizing tuning for HiDPI Giuseppe Bilotta
@ 2015-12-06 12:25 ` Giuseppe Bilotta
  2015-12-06 12:25 ` [PATCH 2/2] gitk: let .bleft.mid widgets 'breathe' Giuseppe Bilotta
  2015-12-07  4:09 ` [PATCH 0/2] gitk spacing/sizing tuning for HiDPI Eric Sunshine
  2 siblings, 0 replies; 8+ messages in thread
From: Giuseppe Bilotta @ 2015-12-06 12:25 UTC (permalink / raw)
  To: git; +Cc: Paul Mackerras, Giuseppe Bilotta

The fonts set in setoptions aren't consistently picked up by ttk, who
uses its own predefined fonts. This is noticeable when switching
between using and not using ttk with custom fonts or in HiDPI settings
(where the default TTK fonts do _not_ respect tk sclaing).

Fix by mapping the ttk fontset to the one used by gitk internally.
---
 gitk | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gitk b/gitk
index fcc606e..e04264b 100755
--- a/gitk
+++ b/gitk
@@ -1943,6 +1943,8 @@ proc confirm_popup {msg {owner .}} {
 }
 
 proc setoptions {} {
+    global use_ttk
+
     if {[tk windowingsystem] ne "win32"} {
         option add *Panedwindow.showHandle 1 startupFile
         option add *Panedwindow.sashRelief raised startupFile
@@ -1965,6 +1967,18 @@ proc setoptions {} {
     option add *Listbox.font mainfont startupFile
 }
 
+proc setttkstyle {} {
+    eval font configure TkDefaultFont [fontflags mainfont]
+    eval font configure TkTextFont [fontflags textfont]
+    eval font configure TkHeadingFont [fontflags mainfont]
+    eval font configure TkCaptionFont [fontflags mainfont] -weight bold
+    eval font configure TkTooltipFont [fontflags uifont]
+    eval font configure TkFixedFont   [fontflags textfont]
+    eval font configure TkIconFont    [fontflags uifont]
+    eval font configure TkMenuFont    [fontflags uifont]
+    eval font configure TkSmallCaptionFont [fontflags uifont]
+}
+
 # Make a menu and submenus.
 # m is the window name for the menu, items is the list of menu items to add.
 # Each item is a list {mc label type description options...}
@@ -12356,6 +12370,10 @@ if {![info exists have_ttk]} {
 set use_ttk [expr {$have_ttk && $want_ttk}]
 set NS [expr {$use_ttk ? "ttk" : ""}]
 
+if {$use_ttk} {
+    setttkstyle
+}
+
 regexp {^git version ([\d.]*\d)} [exec git version] _ git_version
 
 set show_notes {}
-- 
2.6.3.659.gfdd8f28

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] gitk: let .bleft.mid widgets 'breathe'
  2015-12-06 12:25 [PATCH 0/2] gitk spacing/sizing tuning for HiDPI Giuseppe Bilotta
  2015-12-06 12:25 ` [PATCH 1/2] gitk: match ttk fonts to gitk fonts Giuseppe Bilotta
@ 2015-12-06 12:25 ` Giuseppe Bilotta
  2015-12-07  4:09 ` [PATCH 0/2] gitk spacing/sizing tuning for HiDPI Eric Sunshine
  2 siblings, 0 replies; 8+ messages in thread
From: Giuseppe Bilotta @ 2015-12-06 12:25 UTC (permalink / raw)
  To: git; +Cc: Paul Mackerras, Giuseppe Bilotta

The widgets on top of the diff window are very tightly packed. Make
them breathe a little by adding an 'i'-spaced padding between them.
---
 gitk | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gitk b/gitk
index e04264b..b621762 100755
--- a/gitk
+++ b/gitk
@@ -2361,6 +2361,9 @@ proc makewindow {} {
     ${NS}::frame .bleft.mid
     ${NS}::frame .bleft.bottom
 
+    # gap between sub-widgets
+    set wgap [font measure uifont "i"]
+
     ${NS}::button .bleft.top.search -text [mc "Search"] -command dosearch
     pack .bleft.top.search -side left -padx 5
     set sstring .bleft.top.sstring
@@ -2375,8 +2378,9 @@ proc makewindow {} {
 	-command changediffdisp -variable diffelide -value {0 1}
     ${NS}::radiobutton .bleft.mid.new -text [mc "New version"] \
 	-command changediffdisp -variable diffelide -value {1 0}
+
     ${NS}::label .bleft.mid.labeldiffcontext -text "      [mc "Lines of context"]: "
-    pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
+    pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left -ipadx $wgap
     spinbox .bleft.mid.diffcontext -width 5 \
 	-from 0 -increment 1 -to 10000000 \
 	-validate all -validatecommand "diffcontextvalidate %P" \
@@ -2384,7 +2388,7 @@ proc makewindow {} {
     .bleft.mid.diffcontext set $diffcontext
     trace add variable diffcontextstring write diffcontextchange
     lappend entries .bleft.mid.diffcontext
-    pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left
+    pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left -ipadx $wgap
     ${NS}::checkbutton .bleft.mid.ignspace -text [mc "Ignore space change"] \
 	-command changeignorespace -variable ignorespace
     pack .bleft.mid.ignspace -side left -padx 5
-- 
2.6.3.659.gfdd8f28

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/2] gitk spacing/sizing tuning for HiDPI
  2015-12-06 12:25 [PATCH 0/2] gitk spacing/sizing tuning for HiDPI Giuseppe Bilotta
  2015-12-06 12:25 ` [PATCH 1/2] gitk: match ttk fonts to gitk fonts Giuseppe Bilotta
  2015-12-06 12:25 ` [PATCH 2/2] gitk: let .bleft.mid widgets 'breathe' Giuseppe Bilotta
@ 2015-12-07  4:09 ` Eric Sunshine
  2015-12-08  7:05   ` [PATCH 1/2] gitk: match ttk fonts to gitk fonts Giuseppe Bilotta
  2015-12-08  7:08   ` [PATCH 0/2] gitk spacing/sizing tuning for HiDPI Giuseppe Bilotta
  2 siblings, 2 replies; 8+ messages in thread
From: Eric Sunshine @ 2015-12-07  4:09 UTC (permalink / raw)
  To: Giuseppe Bilotta; +Cc: Git List, Paul Mackerras

On Sun, Dec 6, 2015 at 7:25 AM, Giuseppe Bilotta
<giuseppe.bilotta@gmail.com> wrote:
> On my HiDPI monitor, most elements in gitk are correctly rendered, with two
> exceptions:
>
> * when using ttk, some elements do not use the same fonts as gitk would use
>   without, and since ttk picks _unscaled_ sizes this is very noticeable (and
> borderline illegible); the first patch fixes this;
> * the spacing between the checkboxes on top of the diff window are a little too
>   tightly-spaced; the second patch adds a little bit of breathing space.

Both patches are missing your Signed-off-by:.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] gitk: match ttk fonts to gitk fonts
  2015-12-07  4:09 ` [PATCH 0/2] gitk spacing/sizing tuning for HiDPI Eric Sunshine
@ 2015-12-08  7:05   ` Giuseppe Bilotta
  2015-12-08  7:05     ` [PATCH 2/2] gitk: let .bleft.mid widgets 'breathe' Giuseppe Bilotta
  2015-12-19  2:26     ` [PATCH 1/2] gitk: match ttk fonts to gitk fonts Paul Mackerras
  2015-12-08  7:08   ` [PATCH 0/2] gitk spacing/sizing tuning for HiDPI Giuseppe Bilotta
  1 sibling, 2 replies; 8+ messages in thread
From: Giuseppe Bilotta @ 2015-12-08  7:05 UTC (permalink / raw)
  To: git, Paul Mackerras; +Cc: Giuseppe Bilotta

The fonts set in setoptions aren't consistently picked up by ttk, who
uses its own predefined fonts. This is noticeable when switching
between using and not using ttk with custom fonts or in HiDPI settings
(where the default TTK fonts do _not_ respect tk sclaing).

Fix by mapping the ttk fontset to the one used by gitk internally.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 gitk | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gitk b/gitk
index fcc606e..e04264b 100755
--- a/gitk
+++ b/gitk
@@ -1943,6 +1943,8 @@ proc confirm_popup {msg {owner .}} {
 }
 
 proc setoptions {} {
+    global use_ttk
+
     if {[tk windowingsystem] ne "win32"} {
         option add *Panedwindow.showHandle 1 startupFile
         option add *Panedwindow.sashRelief raised startupFile
@@ -1965,6 +1967,18 @@ proc setoptions {} {
     option add *Listbox.font mainfont startupFile
 }
 
+proc setttkstyle {} {
+    eval font configure TkDefaultFont [fontflags mainfont]
+    eval font configure TkTextFont [fontflags textfont]
+    eval font configure TkHeadingFont [fontflags mainfont]
+    eval font configure TkCaptionFont [fontflags mainfont] -weight bold
+    eval font configure TkTooltipFont [fontflags uifont]
+    eval font configure TkFixedFont   [fontflags textfont]
+    eval font configure TkIconFont    [fontflags uifont]
+    eval font configure TkMenuFont    [fontflags uifont]
+    eval font configure TkSmallCaptionFont [fontflags uifont]
+}
+
 # Make a menu and submenus.
 # m is the window name for the menu, items is the list of menu items to add.
 # Each item is a list {mc label type description options...}
@@ -12356,6 +12370,10 @@ if {![info exists have_ttk]} {
 set use_ttk [expr {$have_ttk && $want_ttk}]
 set NS [expr {$use_ttk ? "ttk" : ""}]
 
+if {$use_ttk} {
+    setttkstyle
+}
+
 regexp {^git version ([\d.]*\d)} [exec git version] _ git_version
 
 set show_notes {}
-- 
2.6.3.659.gfdd8f28

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] gitk: let .bleft.mid widgets 'breathe'
  2015-12-08  7:05   ` [PATCH 1/2] gitk: match ttk fonts to gitk fonts Giuseppe Bilotta
@ 2015-12-08  7:05     ` Giuseppe Bilotta
  2015-12-19  2:26     ` [PATCH 1/2] gitk: match ttk fonts to gitk fonts Paul Mackerras
  1 sibling, 0 replies; 8+ messages in thread
From: Giuseppe Bilotta @ 2015-12-08  7:05 UTC (permalink / raw)
  To: git, Paul Mackerras; +Cc: Giuseppe Bilotta

The widgets on top of the diff window are very tightly packed. Make
them breathe a little by adding an 'i'-spaced padding between them.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 gitk | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gitk b/gitk
index e04264b..b621762 100755
--- a/gitk
+++ b/gitk
@@ -2361,6 +2361,9 @@ proc makewindow {} {
     ${NS}::frame .bleft.mid
     ${NS}::frame .bleft.bottom
 
+    # gap between sub-widgets
+    set wgap [font measure uifont "i"]
+
     ${NS}::button .bleft.top.search -text [mc "Search"] -command dosearch
     pack .bleft.top.search -side left -padx 5
     set sstring .bleft.top.sstring
@@ -2375,8 +2378,9 @@ proc makewindow {} {
 	-command changediffdisp -variable diffelide -value {0 1}
     ${NS}::radiobutton .bleft.mid.new -text [mc "New version"] \
 	-command changediffdisp -variable diffelide -value {1 0}
+
     ${NS}::label .bleft.mid.labeldiffcontext -text "      [mc "Lines of context"]: "
-    pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
+    pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left -ipadx $wgap
     spinbox .bleft.mid.diffcontext -width 5 \
 	-from 0 -increment 1 -to 10000000 \
 	-validate all -validatecommand "diffcontextvalidate %P" \
@@ -2384,7 +2388,7 @@ proc makewindow {} {
     .bleft.mid.diffcontext set $diffcontext
     trace add variable diffcontextstring write diffcontextchange
     lappend entries .bleft.mid.diffcontext
-    pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left
+    pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left -ipadx $wgap
     ${NS}::checkbutton .bleft.mid.ignspace -text [mc "Ignore space change"] \
 	-command changeignorespace -variable ignorespace
     pack .bleft.mid.ignspace -side left -padx 5
-- 
2.6.3.659.gfdd8f28

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/2] gitk spacing/sizing tuning for HiDPI
  2015-12-07  4:09 ` [PATCH 0/2] gitk spacing/sizing tuning for HiDPI Eric Sunshine
  2015-12-08  7:05   ` [PATCH 1/2] gitk: match ttk fonts to gitk fonts Giuseppe Bilotta
@ 2015-12-08  7:08   ` Giuseppe Bilotta
  1 sibling, 0 replies; 8+ messages in thread
From: Giuseppe Bilotta @ 2015-12-08  7:08 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Git List, Paul Mackerras

On Mon, Dec 7, 2015 at 5:09 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
>
> Both patches are missing your Signed-off-by:.

Doh sorry, resending now.


-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] gitk: match ttk fonts to gitk fonts
  2015-12-08  7:05   ` [PATCH 1/2] gitk: match ttk fonts to gitk fonts Giuseppe Bilotta
  2015-12-08  7:05     ` [PATCH 2/2] gitk: let .bleft.mid widgets 'breathe' Giuseppe Bilotta
@ 2015-12-19  2:26     ` Paul Mackerras
  1 sibling, 0 replies; 8+ messages in thread
From: Paul Mackerras @ 2015-12-19  2:26 UTC (permalink / raw)
  To: Giuseppe Bilotta; +Cc: git

On Tue, Dec 08, 2015 at 08:05:50AM +0100, Giuseppe Bilotta wrote:
> The fonts set in setoptions aren't consistently picked up by ttk, who
> uses its own predefined fonts. This is noticeable when switching
> between using and not using ttk with custom fonts or in HiDPI settings
> (where the default TTK fonts do _not_ respect tk sclaing).
> 
> Fix by mapping the ttk fontset to the one used by gitk internally.
> 
> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>

Thanks, applied both this and the following patch.

Paul.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-12-19  3:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-06 12:25 [PATCH 0/2] gitk spacing/sizing tuning for HiDPI Giuseppe Bilotta
2015-12-06 12:25 ` [PATCH 1/2] gitk: match ttk fonts to gitk fonts Giuseppe Bilotta
2015-12-06 12:25 ` [PATCH 2/2] gitk: let .bleft.mid widgets 'breathe' Giuseppe Bilotta
2015-12-07  4:09 ` [PATCH 0/2] gitk spacing/sizing tuning for HiDPI Eric Sunshine
2015-12-08  7:05   ` [PATCH 1/2] gitk: match ttk fonts to gitk fonts Giuseppe Bilotta
2015-12-08  7:05     ` [PATCH 2/2] gitk: let .bleft.mid widgets 'breathe' Giuseppe Bilotta
2015-12-19  2:26     ` [PATCH 1/2] gitk: match ttk fonts to gitk fonts Paul Mackerras
2015-12-08  7:08   ` [PATCH 0/2] gitk spacing/sizing tuning for HiDPI Giuseppe Bilotta

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.