6#include <QtFbSupport/private/qfbcursor_p.h>
7#include <QtFbSupport/private/qfbwindow_p.h>
9#include <QtCore/QRegularExpression>
10#include <QtGui/QPainter>
12#include <private/qcore_unix_p.h>
28#include <sys/consio.h>
62 int xxoff = userGeometry.
x(), yyoff = userGeometry.
y();
63 if (xxoff != 0 || yyoff != 0) {
64 if (xxoff < 0 || xxoff + w > fb.fb_width)
65 xxoff = fb.fb_width -
w;
66 if (yyoff < 0 || yyoff + h > fb.fb_height)
67 yyoff = fb.fb_height -
h;
71 xoff += (fb.fb_width -
w)/2;
72 yoff += (fb.fb_height -
h)/2;
79 if (
w == 0 ||
h == 0) {
80 qWarning(
"Unable to find screen geometry, using 320x240");
90 int mmWidth = mmSize.
width();
91 int mmHeight = mmSize.
height();
93 if (mmWidth <= 0 && mmHeight <= 0) {
95 mmWidth =
qRound(
res.width() * 25.4 / dpi);
96 mmHeight =
qRound(
res.height() * 25.4 / dpi);
97 }
else if (mmWidth > 0 && mmHeight <= 0) {
98 mmHeight =
res.height() * mmWidth/
res.width();
99 }
else if (mmHeight > 0 && mmWidth <= 0) {
100 mmWidth =
res.width() * mmHeight/
res.height();
103 return QSize(mmWidth, mmHeight);
113 if (m_framebufferFd != -1) {
114 munmap(m_mmap.data - m_mmap.offset, m_mmap.size);
131 for (
const QString &
arg : std::as_const(m_arguments)) {
134 userMmSize =
QSize(
match.captured(1).toInt(),
match.captured(2).toInt());
135 else if (
arg.contains(sizeRx, &
match))
137 else if (
arg.contains(offsetRx, &
match))
139 else if (
arg.contains(fbRx, &
match))
140 fbDevice =
match.captured(1);
147 m_framebufferFd = STDIN_FILENO;
150 if (m_framebufferFd == -1) {
156 if (ioctl(m_framebufferFd, FBIOGTYPE, &fb) != 0) {
157 qErrnoWarning(errno,
"Error reading framebuffer information");
162 if (ioctl(m_framebufferFd, FBIO_GETLINEWIDTH, &line_length) != 0) {
163 qErrnoWarning(errno,
"Error reading line length information");
169 m_bytesPerLine = line_length;
188 const size_t pagemask = getpagesize() - 1;
189 m_mmap.size = (m_bytesPerLine * fb.fb_height + pagemask) & ~pagemask;
190 uchar *
data =
static_cast<uchar*
>(mmap(
nullptr, m_mmap.size, PROT_READ | PROT_WRITE, MAP_SHARED, m_framebufferFd, 0));
197 m_mmap.data =
data + m_mmap.offset;
bool initialize() override
QBsdFbScreen(const QStringList &args)
QRegion doRedraw() override
QPixmap grabWindow(WId wid, int x, int y, int width, int height) const override
This function is called when Qt needs to be able to grab the content of a window.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
QFbWindow * windowForId(WId wid) const
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
void initializeCompositor()
virtual QRegion doRedraw()
static QByteArray encodeName(const QString &fileName)
Converts fileName to an 8-bit encoding that you can use in native APIs.
int width() const
Returns the width of the image.
int height() const
Returns the height of the image.
The QPainter class performs low-level painting on widgets and other paint devices.
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
Draws the rectangular portion source of the given image into the target rectangle in the paint device...
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
QPixmap copy(int x, int y, int width, int height) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr bool isValid() const noexcept
Returns true if the rectangle is valid, otherwise returns false.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr void setSize(const QSize &s) noexcept
Sets the size of the rectangle to the given size.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr void setTopLeft(const QPoint &p) noexcept
Set the top-left corner of the rectangle to the given position.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
The QRegion class specifies a clip region for a painter.
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
\inmodule QtCore \reentrant
\inmodule QtCore \reentrant
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void qErrnoWarning(const char *msg,...)
Combined button and popup list for selecting options.
static QRect determineGeometry(const struct fbtype &fb, const QRect &userGeometry)
static int openFramebufferDevice(const QString &dev)
static QSizeF determinePhysicalSize(const QSize &mmSize, const QSize &res)
static int qt_safe_close(int fd)
int qRound(qfloat16 d) noexcept
constexpr const T & qMin(const T &a, const T &b)
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat GLfloat GLfloat h
#define qPrintable(string)
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)