Cleanup
Alpine 3.24 Success
Arch Linux AUR Success

This commit is contained in:
2026-09-02 15:03:42 +02:00
parent ea0afd0c91
commit de0cdb96b2
8 changed files with 79 additions and 68 deletions
+9 -12
View File
@@ -2143,7 +2143,7 @@ pack_standin_icons(Browser &b)
void
pack_toolbar_icons(Browser &b)
{
const int px = max(16, int(lround(kIconPts * b.kit_.dpr_)));
const int px = b.kit_.icon_px();
for (const Spec &spec : kItems) {
const ActionDef &d = action_def(spec.action);
b.kit_.pack_icon(action_icon(d, false), px);
@@ -2646,9 +2646,13 @@ Browser::prepare(Kit &kit)
pack_standin_icons(*this);
if (!this->show_names_)
return;
for (const File &f : this->files_) {
if (f.cell.empty() || f.cap.h <= 0)
// Exactly the band paint() draws, asked the same way, so that the cache
// is warm for what is about to be drawn and for nothing else.
if (!thumb_in_band(*this, f, 0.f) || f.cap.h <= 0)
continue;
Label lab;
lab.text = f.cap_text;
lab.wrap = true;
@@ -2673,9 +2677,7 @@ Browser::paint(Kit &kit) const
const Colour frame = kit.colours_[ColourFrame];
for (int i = 0; i < int(this->files_.size()); ++i) {
const File &f = this->files_[size_t(i)];
if (f.cell.w <= 0)
continue;
if (f.cell.bottom() < this->r.y || f.cell.y > this->r.bottom())
if (!thumb_in_band(*this, f, 0.f))
continue;
const int tw = f.tile.w > 0 ? f.tile.w : th;
const int thp = f.tile.h > 0 ? f.tile.h : th;
@@ -2754,7 +2756,7 @@ make_browser_page(
if (page->toolbar)
page->toolbar->actor = page->actor;
if (page->app_menu)
page->app_menu->build(page->menu_tree, page->actor);
page->app_menu->build(kit, page->menu_tree, page->actor);
b->places_dirty_ = true;
b->page_ = page.get();
if (out)
@@ -2865,14 +2867,9 @@ Browser::set_screen_profile(
this->screen_icc_ = std::move(screen_icc);
this->screen_profile_ = std::move(profile);
this->kit_.bake_colours(this->cmm_.get(), this->screen_profile_.get());
if (this->kit_.renderer_) {
const Colour well = this->kit_.colours_[ColourWell];
const Colour tile = this->kit_.colours_[ColourToolbarBottom];
this->kit_.renderer_->set_well_colour(well.r, well.g, well.b);
this->kit_.renderer_->set_checker_colour(tile.r, tile.g, tile.b);
if (this->kit_.renderer_)
this->kit_.renderer_->set_transfer(
profile_transfer(this->screen_profile_.get()));
}
if (reload_thumbs) {
invalidate_thumbs(*this);
enqueue_thumbs(*this);
+3 -3
View File
@@ -54,9 +54,9 @@ Sidebar::key(Kit &kit, const Key &ev)
// --- Context menu ------------------------------------------------------------
void
ContextMenu::fill_items(const QUrl &url)
ContextMenu::fill_items(Kit &kit, const QUrl &url)
{
clear();
clear(kit);
this->min_w = 200.f;
// Open With and Move to Trash are filesystem operations on a real file.
@@ -125,7 +125,7 @@ void
ContextMenu::show(Kit &kit, const QUrl &url, Rect anchor, bool kbd)
{
kit.forget_tree(this);
fill_items(url);
fill_items(kit, url);
bool any = false;
if (this->col) {
for (const auto &k : this->col->kids) {
+1 -1
View File
@@ -44,7 +44,7 @@ struct ContextMenu : Menu {
void show(Kit &kit, const QUrl &url, Rect anchor, bool kbd);
private:
void fill_items(const QUrl &url);
void fill_items(Kit &kit, const QUrl &url);
};
void dialog_about(Kit &kit, Dialog &dialog);
+3 -8
View File
@@ -388,7 +388,7 @@ struct Viewer::Worker {
static void
pack_toolbar_icons(Viewer &v)
{
const int px = max(16, int(lround(kIconPts * v.kit_.dpr_)));
const int px = v.kit_.icon_px();
for (const Spec &spec : kItems) {
const ActionDef &d = action_def(spec.action);
v.kit_.pack_icon(action_icon(d, false), px);
@@ -1885,7 +1885,7 @@ make_viewer_page(Kit &kit, const HostActions &host, Viewer **out)
if (page->toolbar)
page->toolbar->actor = page->actor;
if (page->app_menu)
page->app_menu->build(page->menu_tree, page->actor);
page->app_menu->build(kit, page->menu_tree, page->actor);
v->page_ = page.get();
if (out)
*out = v;
@@ -2025,15 +2025,10 @@ Viewer::set_screen_profile(
this->screen_profile_ = std::move(profile);
this->screen_profile_fallback_ = fallback;
this->kit_.bake_colours(this->cmm_.get(), this->screen_profile_.get());
if (this->kit_.renderer_) {
const Colour well = this->kit_.colours_[ColourWell];
const Colour tile = this->kit_.colours_[ColourToolbarBottom];
this->kit_.renderer_->set_well_colour(well.r, well.g, well.b);
this->kit_.renderer_->set_checker_colour(tile.r, tile.g, tile.b);
if (this->kit_.renderer_)
this->kit_.renderer_->set_transfer(this->enable_cms_
? profile_transfer(this->screen_profile_.get())
: dawn::Transfer::Srgb);
}
if (reload) {
this->restore_view_ = {true, this->scale_, this->pan_x_, this->pan_y_,
this->orientation_, this->angle_, this->view_locked_};
+32 -12
View File
@@ -697,7 +697,7 @@ void
Button::measure(Kit &kit, int, int)
{
const int px = kit.px(kFramePadX + this->pad_x);
const int icon = kit.px(kIconPts);
const int icon = kit.icon_px();
int cw = 0;
int ch = kit.text_height(QStringLiteral("Ag"), 0, false);
if (this->icon) {
@@ -734,7 +734,7 @@ Button::paint(Kit &kit) const
kit.draw_border(
this->r, col(kit.colours_[ColourDivider]), kit.hairline());
const int px = kit.px(kFramePadX + this->pad_x);
const int icon = kit.px(kIconPts);
const int icon = kit.icon_px();
const float ink_a = (this->enabled_ ? 1.f : 0.375f) *
(this->dim ? 0.5f : 1.f) * kit.ink_alpha();
if (this->icon)
@@ -2372,7 +2372,7 @@ menu_cols(const Kit &kit, const MenuItem &m)
{
MenuCols c;
c.accel_w = m.accel_col > 0 ? m.accel_col : m.accel_width(kit);
c.chevron = m.sub ? kit.px(kIconPts) : 0;
c.chevron = m.sub ? kit.icon_px() : 0;
c.label_x = kit.px(kFramePadX * 2.f + kIconPts);
c.accel_x = m.r.w - kit.px(kFramePadX) - c.chevron - c.accel_w;
c.avail = max(1, c.accel_x - kit.px(kFramePadX) - c.label_x);
@@ -2720,18 +2720,24 @@ Menu::add_sep()
}
void
Menu::clear()
Menu::clear(Kit &kit)
{
// A sub is on the popup stack for as long as it is open, so dropping it
// here would leave kit.popups_ walking freed memory every frame.
for (auto &sub : this->subs_) {
if (sub)
sub->close(kit);
}
this->subs_.clear();
if (this->col)
this->col->erase_children();
}
void
Menu::build(span<const MenuNode> nodes, const Actor &a)
Menu::build(Kit &kit, span<const MenuNode> nodes, const Actor &a)
{
this->actor = a;
clear();
clear(kit);
if (!this->col)
return;
this->col->grow = false;
@@ -2739,7 +2745,7 @@ Menu::build(span<const MenuNode> nodes, const Actor &a)
for (const MenuNode &node : nodes) {
if (!node.items.empty()) {
auto child = make_unique<Menu>();
child->build(node.items, this->actor);
child->build(kit, node.items, this->actor);
auto *item = add_item_with_mnemonic(node.title);
item->sub = child.get();
this->subs_.push_back(std::move(child));
@@ -2838,7 +2844,7 @@ MenuItem::measure(Kit &kit, int, int)
{
const int lw = this->label_col > 0 ? this->label_col : label_width(kit);
const int aw = this->accel_col > 0 ? this->accel_col : accel_width(kit);
const int icon = kit.px(kIconPts);
const int icon = kit.icon_px();
// One conversion for the whole run of padding, rather than rounding
// each term and accumulating the error.
int width = kit.px(kIconPts + kFramePadX * 5.f) + lw + aw;
@@ -2865,7 +2871,7 @@ MenuItem::paint(Kit &kit) const
kit.draw_fill(this->r, col(kit.colours_[ColourPress]));
const MenuCols cols = menu_cols(kit, *this);
const int icon = kit.px(kIconPts), pad_x = kit.px(kFramePadX);
const int icon = kit.icon_px(), pad_x = kit.px(kFramePadX);
const int lead_x = this->r.x + pad_x;
const int label_x = this->r.x + cols.label_x;
const int accel_x = this->r.x + cols.accel_x;
@@ -2903,9 +2909,9 @@ void
MenuItem::prepare(Kit &kit)
{
if (this->sub)
kit.pack_icon("go-next-symbolic", int(kIconPts * kit.dpr_));
kit.pack_icon("go-next-symbolic", kit.icon_px());
if (this->checkable)
kit.pack_icon("object-select-symbolic", int(kIconPts * kit.dpr_));
kit.pack_icon("object-select-symbolic", kit.icon_px());
if (this->text.isEmpty())
return;
cache_text(kit, menu_shown(kit, *this), false, 0);
@@ -3484,7 +3490,7 @@ Titlebar::arrange(Kit &kit, Rect alloc)
void
Titlebar::prepare(Kit &kit)
{
const int px = max(16, kit.px(kIconPts));
const int px = kit.icon_px();
kit.pack_icon("window-minimize", px);
kit.pack_icon("window-maximize", px);
kit.pack_icon("window-restore", px);
@@ -4265,6 +4271,16 @@ Kit::bake_colours(dawn::Cmm *cmm, dawn::Profile *target)
this->colours_[ColourPanel] = bake_grey(cmm, target, 0xf0);
this->colours_[ColourHint] = bake_rgb(cmm, target, 0xff, 0xee, 0x00);
}
// The well and the checkerboard are drawn by the renderer's own passes
// rather than out of the draw list, so they have to be handed over
// whenever the palette is rebaked -- which is the only time they change.
if (this->renderer_) {
const Colour &well = this->colours_[ColourWell];
const Colour &tile = this->colours_[ColourToolbarBottom];
this->renderer_->set_well_colour(well.r, well.g, well.b);
this->renderer_->set_checker_colour(tile.r, tile.g, tile.b);
}
}
void
@@ -4306,6 +4322,10 @@ Kit::tooltip(const Widget *hot)
}
}
// TODO(p): The only text emitted without a caching pass ahead of it, so this
// is where a novel glyph -- Browser::tip() hands us filenames -- can grow the
// atlas mid-frame and invalidate the UVs already in the draw list. See the
// note on Sheet::uv().
void
paint_tooltip(Kit &kit)
{
+11 -10
View File
@@ -542,12 +542,12 @@ struct Menu : MenuPopup {
std::vector<std::unique_ptr<Menu>> subs_;
Menu();
void build(std::span<const MenuNode> nodes, const Actor &actor);
void build(Kit &kit, std::span<const MenuNode> nodes, const Actor &actor);
void sync();
MenuItem *add_item(const QString &text);
MenuItem *add_item_with_mnemonic(const QString &text);
void add_sep();
void clear();
void clear(Kit &kit);
void measure(Kit &kit, int max_w, int max_h) override;
bool key(Kit &kit, const Key &ev) override;
};
@@ -810,6 +810,7 @@ struct Kit {
const QString &text, int wrap_px, int max_lines, bool bold) const;
[[nodiscard]] int text_height(
const QString &text, int wrap_px, bool bold) const;
// Points to device pixels. Converted on use rather than cached: a sum of
// point terms rounds once here, where baked-up constants would each round
// separately and accumulate the error.
@@ -817,14 +818,14 @@ struct Kit {
{
return int(lround(double(pts) * double(this->dpr_)));
}
// One hairline: a rule, border or caret, in device pixels. These are
// meant to look equally thin at any scale, so they track the display
// rather than staying a single pixel.
[[nodiscard]] int hairline() const
{
const int n = px(1.f);
return n > 1 ? n : 1;
}
// An appropriately thick rule, border or caret, in device pixels.
[[nodiscard]] int hairline() const { return std::min(px(1.f), 1); }
// One icon square, in device pixels: the size pack_icon() rasterises at,
// and the size the quad that samples it is drawn at.
[[nodiscard]] int icon_px() const { return std::min(px(kIconPts), 16); }
// Raw atlas bytes: 16-bit RGBA UNORM, 8 bytes/pixel, row-major.
[[nodiscard]] bool font_pixels(
unsigned char **out_pixels, int *width, int *height) const;
+7
View File
@@ -167,6 +167,13 @@ Sheet::blit(Packed slot, const uint16_t *src, int src_w, int src_h, int stride)
this->dirty = true;
}
// TODO(p): These are normalised against the sheet as it is right now, and go
// straight into the draw list -- but glyphs are packed lazily, so a grow()
// during a paint leaves every quad emitted earlier in that frame sampling at
// the old scale. Emitting texels and dividing in the shader (or at
// OverlayList::end()) would make the normalisation happen once, after the
// sheet has settled. Reachable today through paint_tooltip(), which is the
// one emitter with no caching pass ahead of it.
void
Sheet::uv(const Packed &slot, float *u0, float *v0, float *u1, float *v1) const
{
+13 -22
View File
@@ -732,12 +732,6 @@ Window::apply_dark(bool dark)
{
this->kit_.dark_ = dark;
this->kit_.bake_colours(this->cmm_.get(), this->screen_profile_.get());
if (this->kit_.renderer_) {
const Colour well = this->kit_.colours_[ColourWell];
const Colour tile = this->kit_.colours_[ColourToolbarBottom];
this->kit_.renderer_->set_well_colour(well.r, well.g, well.b);
this->kit_.renderer_->set_checker_colour(tile.r, tile.g, tile.b);
}
#ifdef Q_OS_MACOS
sync_macos_window_appearance(this, dark);
#endif
@@ -1570,24 +1564,21 @@ Window::handle_touch(QTouchEvent *event)
int n = 0;
int id0 = -1, id1 = -1;
float x0 = 0, y0 = 0, x1 = 0, y1 = 0;
// A lifted finger is no longer part of the gesture; every other state
// still is, whether it moved this event or not.
for (const QEventPoint &p : pts) {
if (p.state() == QEventPoint::Released ||
p.state() == QEventPoint::Stationary ||
p.state() == QEventPoint::Pressed ||
p.state() == QEventPoint::Updated) {
if (p.state() == QEventPoint::Released)
continue;
if (n == 0) {
id0 = int(p.id());
x0 = float(p.position().x());
y0 = float(p.position().y());
} else if (n == 1) {
id1 = int(p.id());
x1 = float(p.position().x());
y1 = float(p.position().y());
}
++n;
if (p.state() == QEventPoint::Released)
continue;
if (n == 0) {
id0 = int(p.id());
x0 = float(p.position().x());
y0 = float(p.position().y());
} else if (n == 1) {
id1 = int(p.id());
x1 = float(p.position().x());
y1 = float(p.position().y());
}
++n;
}
if (event->type() == QEvent::TouchCancel || n < 2) {
this->touch_pinch_ = false;