fix ports specific bugs

This commit is contained in:
Geoffray Levasseur committed 2026-11-04 17:11:16 +01:00
1 parent c30531e032
commit 80c329a697
3 files changed
+44 -6

No files matched your search

+15 -4
View File
@@ -39,6 +39,7 @@
#include <QMouseEvent>
#include <QPainter>
#include <QRegion>
#include <QWindow>
namespace Cevo {
@@ -46,6 +47,7 @@ DrawDlg::DrawDlg(QWidget *parent) : Dpi::Form(parent)
{
// The original's dialogs are borderless (BorderStyle = bsNone): they draw their own frame and title.
setWindowFlag(Qt::FramelessWindowHint, true);
setMouseTracking(true); // the dialogs highlight items on mouse over, like the VCL's OnMouseMove
QPalette pal = palette();
pal.setColor(QPalette::Window, Qt::black);
setPalette(pal);
@@ -55,7 +57,12 @@ DrawDlg::DrawDlg(QWidget *parent) : Dpi::Form(parent)
void DrawDlg::mousePressEvent(QMouseEvent *event)
{
const QPoint pos = event->pos();
if (rect().contains(pos) && pos.y() < titleHeight) {
if (event->button() == Qt::LeftButton && rect().contains(pos) && pos.y() < titleHeight) {
// The compositor moves the window: programmatic moves are ignored on Wayland.
if (windowHandle() && windowHandle()->startSystemMove()) {
m_moveActive = false;
return;
}
m_moveMousePos = mapToGlobal(event->pos());
m_moveFormPos = QPoint(x(), y());
m_moveActive = true;
@@ -150,7 +157,7 @@ void BaseMessgDlg::paintEvent(QPaintEvent *)
frame(canvas, 2 + Border, 2 + Border, width() - (3 + Border), height() - (3 + Border),
MainTexture->colorBevelLight, MainTexture->colorBevelShade);
}
splitText(false);
splitText(false, &canvas);
if (MainTexture) {
const auto children = findChildren<ButtonBase *>(QString(), Qt::FindDirectChildrenOnly);
@@ -162,7 +169,7 @@ void BaseMessgDlg::paintEvent(QPaintEvent *)
canvas.unbind();
}
void BaseMessgDlg::splitText(bool preview)
void BaseMessgDlg::splitText(bool preview, Dpi::Canvas *target)
{
// Best-effort port of the 1-indexed Pascal word-wrap logic below; wraps
// messageText at word boundaries (or '\' line breaks) to fit within
@@ -175,6 +182,9 @@ void BaseMessgDlg::splitText(bool preview)
QPainter painter(&dummy);
Dpi::Canvas canvas;
canvas.bind(&painter);
canvas.font().assign(UniFont[static_cast<std::size_t>(FontType::Normal)]);
if (target)
target->font().assign(UniFont[static_cast<std::size_t>(FontType::Normal)]);
while (start < messageText.length()) {
int stop = start;
while (stop < messageText.length() - 1 && messageText.at(stop) != QLatin1Char('\\') &&
@@ -190,7 +200,8 @@ void BaseMessgDlg::splitText(bool preview)
}
if (!preview) {
const QString s = messageText.mid(start, stop - start + 1);
loweredTextOut(canvas, -1, *MainTexture, (width() - biColorTextWidth(canvas, s)) / 2,
Dpi::Canvas &out = target ? *target : canvas;
loweredTextOut(out, -1, *MainTexture, (width() - biColorTextWidth(out, s)) / 2,
19 + Border + topSpace + linesCount * MessageLineSpacing, s);
}
start = stop + 2;