Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions lib/gdi/grc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,24 @@ void gDC::exec(const gOpcode *o)
}

para->setBlend(flags & gPainter::RT_BLEND);

// For RT_HALIGN_RIGHT, precisely expand the DC clip to prevent the last
// glyph's right-side bearing from being clipped by the render area boundary.
gRegion savedClip;
bool clipExpanded = false;
if (flags & gPainter::RT_HALIGN_RIGHT)
{
const eRect &bbox = para->getBoundBox();
int areaRight = o->parm.renderText->area.right() + offset.x();
int overflow = bbox.right() + offset.x() - areaRight;
if (overflow > 0)
{
savedClip = m_current_clip;
clipExpanded = true;
m_current_clip |= gRegion(eRect(areaRight, o->parm.renderText->area.top() + offset.y(),
overflow + 1, o->parm.renderText->area.height()));
}
}

if (o->parm.renderText->border)
{
Expand All @@ -929,6 +947,8 @@ void gDC::exec(const gOpcode *o)
{
para->blit(*this, offset, m_background_color_rgb, m_foreground_color_rgb);
}
if (clipExpanded)
m_current_clip = savedClip;
delete o->parm.renderText;
break;
}
Expand Down
21 changes: 16 additions & 5 deletions lib/gui/elistbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,11 +733,22 @@ void eListbox::updateScrollBar()
}
else
{
if (m_orientation == orVertical)
m_content->setSize(eSize(width, m_itemheight));
else if (m_orientation == orHorizontal)
m_content->setSize(eSize(m_itemwidth, height));
else
// showOnDemand with no scrollbar needed: still reserve scrollbar space
// so item width stays constant if scrollbar later appears (avoids
// clipping fixed-position template content when scrollbar toggles).
if (m_orientation == orVertical) {
if (m_scrollbar_mode == showOnDemand) {
m_content->setSize(eSize(width-m_scrollbar_width-5, m_itemheight));
} else {
m_content->setSize(eSize(width, m_itemheight));
}
} else if (m_orientation == orHorizontal) {
if (m_scrollbar_mode == showOnDemand) {
m_content->setSize(eSize(m_itemwidth, height-m_scrollbar_height-5));
} else {
m_content->setSize(eSize(m_itemwidth, height));
}
} else
m_content->setSize(eSize(m_itemwidth, m_itemwidth));

m_scrollbar->hide();
Expand Down
Loading