xcb: Extract QXcbWindow::isTrayIconWindow()

Introduce this static function to detect tray icon windows.
The old non-static method was unused, so drop it.

Change-Id: Ia97b8a857bd1807ecd56340efbc9b145844d593e
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
This commit is contained in:
Alexander Volkov 2018-09-24 13:45:57 +03:00 committed by Shawn Rutledge
parent 60cecc86f8
commit a34054c75e
3 changed files with 7 additions and 4 deletions

View File

@ -232,7 +232,7 @@ QPlatformPixmap *QXcbIntegration::createPlatformPixmap(QPlatformPixmap::PixelTyp
QPlatformWindow *QXcbIntegration::createPlatformWindow(QWindow *window) const
{
QXcbGlIntegration *glIntegration = nullptr;
const bool isTrayIconWindow = window->objectName() == QLatin1String("QSystemTrayIconSysWindow");
const bool isTrayIconWindow = QXcbWindow::isTrayIconWindow(window);;
if (window->type() != Qt::Desktop && !isTrayIconWindow) {
if (window->supportsOpenGL()) {
glIntegration = defaultConnection()->glIntegration();
@ -277,7 +277,7 @@ QPlatformOpenGLContext *QXcbIntegration::createPlatformOpenGLContext(QOpenGLCont
QPlatformBackingStore *QXcbIntegration::createPlatformBackingStore(QWindow *window) const
{
const bool isTrayIconWindow = window->objectName() == QLatin1String("QSystemTrayIconSysWindow");
const bool isTrayIconWindow = QXcbWindow::isTrayIconWindow(window);
if (isTrayIconWindow)
return new QXcbSystemTrayBackingStore(window);

View File

@ -297,7 +297,7 @@ void QXcbWindow::create()
destroy();
m_windowState = Qt::WindowNoState;
m_trayIconWindow = window()->objectName() == QLatin1String("QSystemTrayIconSysWindow");
m_trayIconWindow = isTrayIconWindow(window());
Qt::WindowType type = window()->type();

View File

@ -173,7 +173,10 @@ public:
bool startSystemMoveResize(const QPoint &pos, int corner);
void doStartSystemMoveResize(const QPoint &globalPos, int corner);
bool isTrayIconWindow() const { return m_trayIconWindow; }
static bool isTrayIconWindow(QWindow *window)
{
return window->objectName() == QLatin1String("QSystemTrayIconSysWindow");
}
virtual void create();
virtual void destroy();