about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-08-23 16:14:04 +0200
committerbptato <nincsnevem662@gmail.com>2024-08-23 16:14:04 +0200
commit80b060be33ce7eea7a4bab18dbfe652cf6d36c0b (patch)
tree3e9956660114a48990632d2c15f689146def0f03
parentb7c2c15a9c2503c01bb63e9e9c4c04378192a1dd (diff)
downloadchawan-80b060be33ce7eea7a4bab18dbfe652cf6d36c0b.tar.gz
winattrs: un-snakeify
-rw-r--r--src/css/cascade.nim4
-rw-r--r--src/css/cssvalues.nim8
-rw-r--r--src/layout/engine.nim4
-rw-r--r--src/local/container.nim2
-rw-r--r--src/local/pager.nim2
-rw-r--r--src/local/term.nim8
-rw-r--r--src/types/winattrs.nim8
7 files changed, 18 insertions, 18 deletions
diff --git a/src/css/cascade.nim b/src/css/cascade.nim
index 56430d52..efa9227f 100644
--- a/src/css/cascade.nim
+++ b/src/css/cascade.nim
@@ -46,9 +46,9 @@ func applies(feature: MediaFeature; window: Window): bool =
   of mftPrefersColorScheme:
     return feature.b
   of mftWidth:
-    return feature.appliesLR(window, toLayoutUnit(window.attrs.width_px))
+    return feature.appliesLR(window, window.attrs.widthPx.toLayoutUnit)
   of mftHeight:
-    return feature.appliesLR(window, toLayoutUnit(window.attrs.height_px))
+    return feature.appliesLR(window, window.attrs.heightPx.toLayoutUnit)
   of mftScripting:
     return feature.b == window.settings.scripting
 
diff --git a/src/css/cssvalues.nim b/src/css/cssvalues.nim
index 8caa823a..f0b3cbc8 100644
--- a/src/css/cssvalues.nim
+++ b/src/css/cssvalues.nim
@@ -582,12 +582,12 @@ func px*(l: CSSLength; window: WindowAttributes; p: LayoutUnit): LayoutUnit =
   of cuIn: toLayoutUnit(l.num * 96)
   of cuPc: toLayoutUnit(l.num * 16)
   of cuPt: toLayoutUnit(l.num * 4 / 3)
-  of cuVw: toLayoutUnit(float64(window.width_px) * l.num / 100)
-  of cuVh: toLayoutUnit(float64(window.height_px) * l.num / 100)
+  of cuVw: toLayoutUnit(float64(window.widthPx) * l.num / 100)
+  of cuVh: toLayoutUnit(float64(window.heightPx) * l.num / 100)
   of cuVmin:
-    toLayoutUnit(min(window.width_px, window.height_px) / 100 * l.num)
+    toLayoutUnit(min(window.widthPx, window.heightPx) / 100 * l.num)
   of cuVmax:
-    toLayoutUnit(max(window.width_px, window.height_px) / 100 * l.num)
+    toLayoutUnit(max(window.widthPx, window.heightPx) / 100 * l.num)
 
 func blockify*(display: CSSDisplay): CSSDisplay =
   case display
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 0a92c185..30895b22 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -3230,8 +3230,8 @@ proc buildTable(ctx: var InnerBlockContext) =
 
 proc layout*(root: StyledNode; attrsp: ptr WindowAttributes): BlockBox =
   let space = availableSpace(
-    w = stretch(attrsp[].width_px),
-    h = stretch(attrsp[].height_px)
+    w = stretch(attrsp[].widthPx),
+    h = stretch(attrsp[].heightPx)
   )
   let lctx = LayoutContext(
     attrsp: attrsp,
diff --git a/src/local/container.nim b/src/local/container.nim
index a21af3af..046e2bc8 100644
--- a/src/local/container.nim
+++ b/src/local/container.nim
@@ -1893,7 +1893,7 @@ proc windowChange*(container: Container; attrs: WindowAttributes) =
       var attrs = attrs
       # subtract status line height
       attrs.height -= 1
-      attrs.height_px -= attrs.ppl
+      attrs.heightPx -= attrs.ppl
       container.iface.windowChange(attrs).then(proc() =
         container.needslines = true
       )
diff --git a/src/local/pager.nim b/src/local/pager.nim
index 43f0d8c4..7c2dde27 100644
--- a/src/local/pager.nim
+++ b/src/local/pager.nim
@@ -1942,7 +1942,7 @@ proc connected(pager: Pager; container: Container; response: Response) =
     var attrs = pager.attrs
     # subtract status line height
     attrs.height -= 1
-    attrs.height_px -= attrs.ppl
+    attrs.heightPx -= attrs.ppl
     container.process = pager.forkserver.forkBuffer(
       container.config,
       container.url,
diff --git a/src/local/term.nim b/src/local/term.nim
index 82a892dd..71d32343 100644
--- a/src/local/term.nim
+++ b/src/local/term.nim
@@ -593,13 +593,13 @@ proc applyConfigDimensions(term: Terminal) =
     term.attrs.ppc = int(term.config.display.pixels_per_column)
   if term.attrs.ppl == 0 or term.config.display.force_pixels_per_line:
     term.attrs.ppl = int(term.config.display.pixels_per_line)
-  term.attrs.width_px = term.attrs.ppc * term.attrs.width
-  term.attrs.height_px = term.attrs.ppl * term.attrs.height
+  term.attrs.widthPx = term.attrs.ppc * term.attrs.width
+  term.attrs.heightPx = term.attrs.ppl * term.attrs.height
   if term.imageMode == imSixel:
     if term.sixelMaxWidth == 0:
-      term.sixelMaxWidth = term.attrs.width_px
+      term.sixelMaxWidth = term.attrs.widthPx
     if term.sixelMaxHeight == 0:
-      term.sixelMaxHeight = term.attrs.height_px
+      term.sixelMaxHeight = term.attrs.heightPx
 
 proc applyConfig(term: Terminal) =
   # colors, formatting
diff --git a/src/types/winattrs.nim b/src/types/winattrs.nim
index 7d9e0218..94b63790 100644
--- a/src/types/winattrs.nim
+++ b/src/types/winattrs.nim
@@ -1,7 +1,7 @@
 type WindowAttributes* = object
   width*: int
   height*: int
-  ppc*: int # cell width
-  ppl*: int # cell height
-  width_px*: int
-  height_px*: int
+  ppc*: int # cell width (pixels per char)
+  ppl*: int # cell height (pixels per line)
+  widthPx*: int
+  heightPx*: int