summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm24
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks.h3
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks_stub.cpp26
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp6
6 files changed, 47 insertions, 16 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index 1484ae2ba3..d863861288 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -258,13 +258,17 @@ QPixmap QCocoaTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &siz
NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:QCFString::toNSString(fileInfo.canonicalFilePath())];
if (!iconImage)
return QPixmap();
-
- NSRect iconRect = NSMakeRect(0, 0, size.width(), size.height());
- NSGraphicsContext *gc = [NSGraphicsContext currentContext];
- CGImageRef cgImage = [iconImage CGImageForProposedRect:&iconRect
- context:([gc graphicsPort] ? gc : nil)
- hints:nil];
- QPixmap pixmap = QPixmap::fromImage(qt_mac_toQImage(cgImage));
+ NSSize pixmapSize = NSMakeSize(size.width(), size.height());
+ QPixmap pixmap(pixmapSize.width, pixmapSize.height);
+ pixmap.fill(Qt::transparent);
+ [iconImage setSize:pixmapSize];
+ NSRect iconRect = NSMakeRect(0, 0, pixmapSize.width, pixmapSize.height);
+ CGContextRef ctx = qt_mac_cg_context(&pixmap);
+ NSGraphicsContext *gc = [NSGraphicsContext graphicsContextWithGraphicsPort:ctx flipped:YES];
+ [NSGraphicsContext saveGraphicsState];
+ [NSGraphicsContext setCurrentContext:gc];
+ [iconImage drawInRect:iconRect fromRect:iconRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil];
+ [NSGraphicsContext restoreGraphicsState];
return pixmap;
}
@@ -280,8 +284,12 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const
case TabAllWidgets:
return QVariant(bool([[NSApplication sharedApplication] isFullKeyboardAccessEnabled]));
case IconPixmapSizes: {
+ qreal devicePixelRatio = qGuiApp->devicePixelRatio();
QList<int> sizes;
- sizes << 16 << 32 << 64 << 128;
+ sizes << 16 * devicePixelRatio
+ << 32 * devicePixelRatio
+ << 64 * devicePixelRatio
+ << 128 * devicePixelRatio;
return QVariant::fromValue(sizes);
}
case QPlatformTheme::PasswordMaskCharacter:
diff --git a/src/plugins/platforms/eglfs/qeglfshooks.h b/src/plugins/platforms/eglfs/qeglfshooks.h
index 1cd1380994..0251e27f96 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks.h
+++ b/src/plugins/platforms/eglfs/qeglfshooks.h
@@ -77,7 +77,8 @@ public:
virtual bool filterConfig(EGLDisplay display, EGLConfig config) const;
virtual void waitForVSync() const;
- virtual const char *fbDeviceName() const;
+ virtual QByteArray fbDeviceName() const;
+ virtual int framebufferIndex() const;
static QEglFSHooks *hooks()
{
diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
index 4dc0783d43..4368f37e50 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
+++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
@@ -41,6 +41,7 @@
#include "qeglfshooks.h"
#include "qeglfscursor.h"
+#include <QtCore/QRegularExpression>
#include <fcntl.h>
#include <unistd.h>
@@ -56,17 +57,34 @@ QT_BEGIN_NAMESPACE
// this is a global static to keep the QEglFSHooks interface as clean as possible
static int framebuffer = -1;
-const char *QEglFSHooks::fbDeviceName() const
+QByteArray QEglFSHooks::fbDeviceName() const
{
- return "/dev/fb0";
+ QByteArray fbDev = qgetenv("QT_QPA_EGLFS_FB");
+ if (fbDev.isEmpty())
+ fbDev = QByteArrayLiteral("/dev/fb0");
+
+ return fbDev;
+}
+
+int QEglFSHooks::framebufferIndex() const
+{
+ int fbIndex = 0;
+ QRegularExpression fbIndexRx(QLatin1String("fb(\\d+)"));
+ QRegularExpressionMatch match = fbIndexRx.match(fbDeviceName());
+ if (match.hasMatch())
+ fbIndex = match.captured(1).toInt();
+
+ return fbIndex;
}
void QEglFSHooks::platformInit()
{
- framebuffer = qt_safe_open(fbDeviceName(), O_RDONLY);
+ QByteArray fbDev = fbDeviceName();
+
+ framebuffer = qt_safe_open(fbDev, O_RDONLY);
if (framebuffer == -1)
- qWarning("EGLFS: Failed to open %s", fbDeviceName());
+ qWarning("EGLFS: Failed to open %s", qPrintable(fbDev));
}
void QEglFSHooks::platformDestroy()
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 497d0975af..8ebfd018d0 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -572,6 +572,8 @@ bool QWindowsDialogHelperBase<BaseClass>::show(Qt::WindowFlags,
QWindow *parent)
{
const bool modal = (windowModality != Qt::NonModal);
+ if (!parent)
+ parent = QGuiApplication::focusWindow(); // Need a parent window, else the application loses activation when closed.
if (parent) {
m_ownerWindow = QWindowsWindow::handleOf(parent);
} else {
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 530ebc38b7..1fc1be53c7 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -306,6 +306,8 @@ QList<QPlatformScreen *> QWindowsScreen::virtualSiblings() const
void QWindowsScreen::handleChanges(const QWindowsScreenData &newData)
{
+ m_data.physicalSizeMM = newData.physicalSizeMM;
+
if (m_data.geometry != newData.geometry) {
m_data.geometry = newData.geometry;
QWindowSystemInterface::handleScreenGeometryChange(screen(),
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index f46bed77d6..3d8f91649a 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -1550,7 +1550,7 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even
handleXEmbedMessage(event);
} else if (event->type == atom(QXcbAtom::_NET_ACTIVE_WINDOW)) {
connection()->setFocusWindow(this);
- QWindowSystemInterface::handleWindowActivated(window());
+ QWindowSystemInterface::handleWindowActivated(window(), Qt::ActiveWindowFocusReason);
} else if (event->type == atom(QXcbAtom::MANAGER)
|| event->type == atom(QXcbAtom::_NET_WM_STATE)
|| event->type == atom(QXcbAtom::WM_CHANGE_STATE)) {
@@ -1855,14 +1855,14 @@ void QXcbWindow::handleFocusInEvent(const xcb_focus_in_event_t *)
QWindow *w = window();
w = static_cast<QWindowPrivate *>(QObjectPrivate::get(w))->eventReceiver();
connection()->setFocusWindow(static_cast<QXcbWindow *>(w->handle()));
- QWindowSystemInterface::handleWindowActivated(w);
+ QWindowSystemInterface::handleWindowActivated(w, Qt::ActiveWindowFocusReason);
}
static bool focusInPeeker(QXcbConnection *connection, xcb_generic_event_t *event)
{
if (!event) {
// FocusIn event is not in the queue, proceed with FocusOut normally.
- QWindowSystemInterface::handleWindowActivated(0);
+ QWindowSystemInterface::handleWindowActivated(0, Qt::ActiveWindowFocusReason);
return true;
}
uint response_type = event->response_type & ~0x80;