Files
RedBear-OS/local/recipes/qt/qtbase/source/tests/manual/windowmask/main.cpp
T
vasilito f31522130f fix: comprehensive boot warnings and exceptions — fixable silenced, unfixable diagnosed
Build system (5 gaps hardened):
- COOKBOOK_OFFLINE defaults to true (fork-mode)
- normalize_patch handles diff -ruN format
- New 'repo validate-patches' command (25/25 relibc patches)
- 14 patched Qt/Wayland/display recipes added to protected list
- relibc archive regenerated with current patch chain

Boot fixes (fixable):
- Full ISO EFI partition: 16 MiB → 1 MiB (matches mini, BIOS hardcoded 2 MiB offset)
- D-Bus system bus: absolute /usr/bin/dbus-daemon path (was skipped)
- redbear-sessiond: absolute /usr/bin/redbear-sessiond path (was skipped)
- daemon framework: silenced spurious INIT_NOTIFY warnings for oneshot_async services (P0-daemon-silence-init-notify.patch)
- udev-shim: demoted INIT_NOTIFY warning to INFO (expected for oneshot_async)
- relibc: comprehensive named semaphores (sem_open/close/unlink) replacing upstream todo!() stubs
- greeterd: Wayland socket timeout 15s → 30s (compositor DRM wait)
- greeter-ui: built and linked (header guard unification, sem_compat stubs removed)
- mc: un-ignored in both configs, fixed glib/libiconv/pcre2 transitive deps
- greeter config: removed stale keymapd dependency from display/greeter services
- prefix toolchain: relibc headers synced, _RELIBC_STDLIB_H guard unified

Unfixable (diagnosed, upstream):
- i2c-hidd: abort on no-I2C-hardware (QEMU) — process::exit → relibc abort
- kded6/greeter-ui: page fault 0x8 — Qt library null deref
- Thread panics fd != -1 — Rust std library on Redox
- DHCP timeout / eth0 MAC — QEMU user-mode networking
- hwrngd/thermald — no hardware RNG/thermal in VM
- live preload allocation — BIOS memory fragmentation, continues on demand
2026-05-05 20:20:37 +01:00

125 lines
3.7 KiB
C++

// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtWidgets>
template<typename Paintable>
class Circle : public Paintable
{
public:
using Paintable::setMinimumSize;
using Paintable::setMaximumSize;
using Paintable::width;
using Paintable::height;
using Paintable::screen;
using Paintable::devicePixelRatio;
using Paintable::metaObject;
using Paintable::setMask;
using Paintable::frameGeometry;
using Paintable::setPosition;
using Paintable::startSystemMove;
using Paintable::setFlags;
using Paintable::requestUpdate;
Circle()
{
setMinimumSize({200, 200});
setMaximumSize({200, 200});
setFlags(Qt::Window | Qt::FramelessWindowHint);
}
protected:
void paintEvent(QPaintEvent *) override
{
qWarning() << "Painting into a" << this << "with DPR" << devicePixelRatio()
<< "on a screen with DPR" << screen()->devicePixelRatio();
QPainter painter(static_cast<Paintable *>(this));
painter.fillRect(0, 0, width(), height(), devicePixelRatio() == 1 ? Qt::red : Qt::green);
painter.setPen(QPen(Qt::black, 5));
painter.drawRect(10, 10, width() - 20, height() - 20);
painter.drawText(0, 0, width(), height(), Qt::AlignHCenter | Qt::AlignVCenter, metaObject()->className());
}
void mousePressEvent(QMouseEvent *event) override
{
if (event->button() == Qt::LeftButton) {
if (event->modifiers() & Qt::ControlModifier)
requestUpdate();
else if (event->modifiers() & Qt::AltModifier)
updateMask();
else if (event->modifiers() & Qt::ShiftModifier && startSystemMove())
dragPosition = {};
else
dragPosition = event->globalPosition() - frameGeometry().topLeft();
}
}
void mouseMoveEvent(QMouseEvent *event) override
{
if (event->buttons() & Qt::LeftButton && !dragPosition.isNull())
setPosition((event->globalPosition() - dragPosition).toPoint());
}
void resizeEvent(QResizeEvent *) override
{
updateMask();
}
void updateMask()
{
int side = qMin(width(), height());
QRegion maskedRegion(width() / 2 - side / 2, height() / 2 - side / 2, side,
side, QRegion::Ellipse);
qDebug() << "Updating mask for" << this << "to" << maskedRegion.boundingRect();
setMask(maskedRegion);
}
QPointF dragPosition;
};
class WindowLikeWidget : public QWidget
{
public:
void setPosition(const QPoint &point) { QWidget::move(point); }
bool startSystemMove() { return windowHandle()->startSystemMove(); }
void setFlags(Qt::WindowFlags flags) { setWindowFlags(flags); }
void requestUpdate() { update(); }
};
class Widget : public Circle<WindowLikeWidget>
{
public:
Widget()
{
setAttribute(Qt::WA_TranslucentBackground);
}
};
class Window : public Circle<QRasterWindow>
{
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Widget widget;
widget.show();
Window window;
window.show();
auto dumpScreenData = [](QScreen *screen){
qDebug() << "- name:" << screen->name();
qDebug() << "- dpr :" << screen->devicePixelRatio();
};
QObject::connect(widget.windowHandle(), &QWindow::screenChanged, &widget, [&]{
qDebug() << "Screen changed for" << &widget;
dumpScreenData(widget.screen());
});
QObject::connect(&window, &QWindow::screenChanged, &window, [&]{
qDebug() << "Screen changed for" << &window;
dumpScreenData(window.screen());
});
return app.exec();
}