git.lucas.co / cce-browser
web browser (Servo)
git clone https://git.lucas.co/cce-browser.git

commit598a82942dd17b58fb80344a257d4d998c17dc88
parent30f031524c
authorLucas Galante <lsgalante12@gmail.com>
date2026-10-05 19:36
feat(chrome): draw the corner control at 1.5x the DE's dot

Folded, the dot is the whole chrome, and the pane-corner size
(plate_dock::CORNER_R, 8px) was too small to find or hit. The browser
now draws and hit-tests its own disc (DOT_R, 12px; DOT_INSET keeps the
DE's margin to the plate edge), same plate-border color, so cce-ui's
shared constant -- every other app's dot -- is left alone. DOT_COL,
the unfold seed and the bookmarks menu's anchor follow the new size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

 CLAUDE.md   | 15 ++++++++++-----
 src/main.rs | 30 ++++++++++++++++++++++--------
 2 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/CLAUDE.md b/CLAUDE.md
index fdffa73..5557fe4 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -373,11 +373,16 @@ stripped), else the file name; internal pages are refused.
 
 ### The bar is a circle menu
 
-The chrome's persistent element is the **DE's corner control** —
-`cce_ui::widget::plate_dock::draw_corner_dot`, the same 8px plate-border-colored
-dot a designer pane or the terminal window wears at its top-right — sitting in
-the **bar's corner nearest the window corner it is anchored to** (`dot_center()`:
-top-right for a top bar, bottom-right for a bottom one, at the DE inset). A
+The chrome's persistent element is the **DE's corner control** — the
+plate-border-colored dot `cce_ui::widget::plate_dock::draw_corner_dot` draws on
+a designer pane or the terminal window — sitting in the **bar's corner nearest
+the window corner it is anchored to** (`dot_center()`: top-right for a top bar,
+bottom-right for a bottom one). It is drawn here at **1.5x the DE's size**
+(`DOT_R`, 12px radius against `plate_dock::CORNER_R`'s 8, with `DOT_INSET`
+keeping the DE's margin to the plate edge): folded, it is the whole chrome, and
+the pane-corner size was too small to find. The size lives in this crate, not
+in `cce-ui` — the shared constant is every other app's dot too — so the drawing
+and the hit circle are the browser's own (`dot_hit`), same disc, same color. A
 circle menu is the corner of the thing it expands into, so the dot sits where
 the bar's corner will be, the bar grows out of the dot's own disc, and open,
 the dot is the bar's corner. It is always drawn and always live: clicking it
diff --git a/src/main.rs b/src/main.rs
index 0b09932..fc9890e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -112,10 +112,18 @@ fn chrome_step(t: f32, target: f32, dt: f32, animate: bool) -> f32 {
         (t - step).max(target)
     }
 }
+/// Radius of the corner control, drawn and hit. The DE's dot
+/// (`plate_dock::CORNER_R`) is sized for a pane's corner; the browser's is
+/// the whole chrome while folded, so it is half again as big — the same
+/// plain plate-border disc, just easier to see and to hit.
+const DOT_R: f32 = 1.5 * plate_dock::CORNER_R;
+/// Centre inset from the bar's corner, on both axes: the DE's margin
+/// between the dot and the plate edge, kept as the dot grew.
+const DOT_INSET: f32 = plate_dock::CORNER_INSET + (DOT_R - plate_dock::CORNER_R);
 /// Width reserved at the right end of the row the corner control sits on
 /// (the tab row for a top bar, the controls row for a bottom one), so the
 /// "+" or the bookmark star clears the dot in the bar's corner.
-const DOT_COL: f32 = 2.0 * plate_dock::CORNER_INSET;
+const DOT_COL: f32 = 2.0 * DOT_INSET;
 
 /// The reservation a row makes for the corner control: `DOT_COL` on the
 /// row in the bar's anchored corner, nothing on the other.
@@ -1362,7 +1370,7 @@ impl BrowserApp {
         let width = SAVE_W.min(self.win.0 - 2.0 * bar_margin()).max(220.0);
         let height = plate_pad() * 2.0 + 20.0 + 18.0 + 18.0 + inner_gap() + BTN_H;
         let (cx, cy) = self.dot_center();
-        let edge = cx + plate_dock::CORNER_R;
+        let edge = cx + DOT_R;
         let x = (edge - width).clamp(0.0, (self.win.0 - width).max(0.0));
         let gap = item_gap();
         let y = match self.settings.bar_position {
@@ -1371,7 +1379,7 @@ impl BrowserApp {
                     let (bar, _) = self.chrome_plate();
                     bar.y + bar.height
                 } else {
-                    cy + plate_dock::CORNER_R
+                    cy + DOT_R
                 };
                 below + gap
             }
@@ -1379,7 +1387,7 @@ impl BrowserApp {
                 let above = if self.chrome_t > 0.0 {
                     self.chrome_plate().0.y
                 } else {
-                    cy - plate_dock::CORNER_R
+                    cy - DOT_R
                 };
                 (above - gap - height).max(0.0)
             }
@@ -1820,7 +1828,7 @@ impl BrowserApp {
     /// stays there when the bar is out.
     fn dot_center(&self) -> (f32, f32) {
         let bar = self.bar();
-        let inset = plate_dock::CORNER_INSET;
+        let inset = DOT_INSET;
         let cy = match self.settings.bar_position {
             settings::BarPosition::Top => bar.y + inset,
             settings::BarPosition::Bottom => bar.y + bar.height - inset,
@@ -1829,7 +1837,9 @@ impl BrowserApp {
     }
 
     fn dot_hit(&self, x: f32, y: f32) -> bool {
-        plate_dock::corner_hit(self.dot_center(), x, y)
+        let (cx, cy) = self.dot_center();
+        let (dx, dy) = (x - cx, y - cy);
+        dx * dx + dy * dy <= DOT_R * DOT_R
     }
 
     /// Unfold progress with easing applied — what the plate is drawn from.
@@ -1845,7 +1855,7 @@ impl BrowserApp {
     fn chrome_plate(&self) -> (Rect, f32) {
         let e = self.chrome_ease();
         let (cx, cy) = self.dot_center();
-        let seed = plate_dock::CORNER_R;
+        let seed = DOT_R;
         let bar = self.bar();
         let lerp = |a: f32, b: f32| a + (b - a) * e;
         let plate = Rect {
@@ -4444,7 +4454,11 @@ impl Application for BrowserApp {
 
         // The corner control, over the bar: the DE's dot, emphasized while
         // hovered or while the bar it opens is out.
-        plate_dock::draw_corner_dot(&mut pc, self.dot_center(), self.dot_hover || self.chrome_open);
+        // `plate_dock::draw_corner_dot`'s disc, at the browser's size.
+        let (cx, cy) = self.dot_center();
+        let r = if self.dot_hover || self.chrome_open { DOT_R * 1.15 } else { DOT_R };
+        let fill = cce_ui::color::plate_border_color().unwrap_or([0.55, 0.58, 0.66, 0.85]);
+        pc.circle(cx, cy, r, fill);
 
         self.paint_bm_menu(&mut pc, &sans);
         #[cfg(feature = "wpe")]