From 1d55cf26a355b89a007e4a9bf7361d8a5c2c64cd Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Sun, 31 Aug 2025 13:50:05 +0200 Subject: Fix hr width exceeding available space The hr ruler was directly using the available content width to compute its allocation. However, the width needs to take into account the border of the hr element (1 pixel on each side) to avoid making the element larger than the available space. Co-authored-by: dogma --- dw/ruler.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'dw/ruler.cc') diff --git a/dw/ruler.cc b/dw/ruler.cc index fc0bbce6..5e922723 100644 --- a/dw/ruler.cc +++ b/dw/ruler.cc @@ -2,6 +2,7 @@ * Dillo Widget * * Copyright 2005-2007 Sebastian Geerken + * Copyright 2025 Rodrigo Arias Mallo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,7 +42,10 @@ Ruler::~Ruler () void Ruler::sizeRequestSimpl (core::Requisition *requisition) { - requisition->width = lout::misc::max (getAvailWidth (true), boxDiffWidth ()); + /* The ruler will be drawn by using a 1px border, so we substract the + * border from the available width when computing the content width. */ + int w = lout::misc::max(0, getAvailWidth(true) - boxDiffWidth()); + requisition->width = w; requisition->ascent = boxOffsetY (); requisition->descent = boxRestHeight (); } -- cgit v1.2.3