diff --git a/src/dbackingstoreproxy.cpp b/src/dbackingstoreproxy.cpp index c2b56453..eaad7299 100644 --- a/src/dbackingstoreproxy.cpp +++ b/src/dbackingstoreproxy.cpp @@ -308,7 +308,6 @@ void DBackingStoreProxy::updateWallpaperShared() const qint32 *header = reinterpret_cast(m_sharedMemory->constData()); const uchar *content = reinterpret_cast(m_sharedMemory->constData()) + HEADER_SIZE; - qint32 byte_count = header[0]; qint32 image_width = header[1]; qint32 image_height = header[2]; qint32 image_format = header[3]; diff --git a/src/ddesktopinputselectioncontrol.cpp b/src/ddesktopinputselectioncontrol.cpp index 15dfb740..188ea4d7 100644 --- a/src/ddesktopinputselectioncontrol.cpp +++ b/src/ddesktopinputselectioncontrol.cpp @@ -127,7 +127,7 @@ QRect DDesktopInputSelectionControl::cursorHandleRect() const return handleRectForCursorRect(cursorRectangle()); } -static int getInputRectangleY(const QPoint &pos) +[[maybe_unused]] static int getInputRectangleY(const QPoint &pos) { // 保证handle不会超出TextEdit类输入框 int posY = pos.y(); diff --git a/src/dnativesettings.h b/src/dnativesettings.h index 68572524..39da1716 100644 --- a/src/dnativesettings.h +++ b/src/dnativesettings.h @@ -17,7 +17,7 @@ DPP_BEGIN_NAMESPACE class DPlatformSettings; -class Q_DECL_HIDDEN DNativeSettings : public QAbstractDynamicMetaObject +class DNativeSettings : public QAbstractDynamicMetaObject { public: explicit DNativeSettings(QObject *base, DPlatformSettings *settings, bool global_settings); diff --git a/src/dplatformsettings.h b/src/dplatformsettings.h index e667c82a..5ae5b10e 100644 --- a/src/dplatformsettings.h +++ b/src/dplatformsettings.h @@ -15,7 +15,7 @@ QT_END_NAMESPACE DPP_BEGIN_NAMESPACE -class Q_DECL_HIDDEN DPlatformSettings +class DPlatformSettings { public: virtual ~DPlatformSettings() {} @@ -42,13 +42,13 @@ class Q_DECL_HIDDEN DPlatformSettings void handleNotify(const QByteArray &signal, qint32 data1, qint32 data2); private: - struct Q_DECL_HIDDEN Callback + struct Callback { PropertyChangeFunc func; void *handle; }; - struct Q_DECL_HIDDEN SignalCallback + struct SignalCallback { SignalFunc func; void *handle; diff --git a/src/dxcbxsettings.cpp b/src/dxcbxsettings.cpp index 1b9611b9..377eaa61 100644 --- a/src/dxcbxsettings.cpp +++ b/src/dxcbxsettings.cpp @@ -48,7 +48,7 @@ static xcb_atom_t internAtom(xcb_connection_t *conn, const char *name) return atom; } -static QByteArray atomName(xcb_connection_t *conn, xcb_atom_t atom) +[[maybe_unused]] static QByteArray atomName(xcb_connection_t *conn, xcb_atom_t atom) { xcb_get_atom_name_cookie_t cookie = xcb_get_atom_name(conn, atom); xcb_get_atom_name_reply_t *reply = xcb_get_atom_name_reply(conn, cookie, nullptr); @@ -169,9 +169,12 @@ class Q_DECL_HIDDEN DXcbXSettingsPrivate { public: DXcbXSettingsPrivate(xcb_connection_t *connection, const QByteArray &property, DXcbXSettings *qq) - : connection(connection) + : q_ptr(qq) + , connection(connection) + , x_settings_window(0) + , x_settings_atom(0) + , serial(-1) , initialized(false) - , q_ptr(qq) { if (property.isEmpty()) { x_settings_atom = internAtom(connection, "_XSETTINGS_SETTINGS"); diff --git a/src/dxcbxsettings.h b/src/dxcbxsettings.h index 60bde14e..6d54770c 100644 --- a/src/dxcbxsettings.h +++ b/src/dxcbxsettings.h @@ -21,7 +21,7 @@ DPP_BEGIN_NAMESPACE class DXcbXSettingsPrivate; -class Q_DECL_HIDDEN DXcbXSettings : public DPlatformSettings +class DXcbXSettings : public DPlatformSettings { Q_DECLARE_PRIVATE(DXcbXSettings) public: diff --git a/src/vtablehook.h b/src/vtablehook.h index f0b99012..9121e515 100644 --- a/src/vtablehook.h +++ b/src/vtablehook.h @@ -95,7 +95,7 @@ class VtableHook quintptr fun1_offset = toQuintptr(&fun1); quintptr fun2_offset = toQuintptr(&fun2); - if (fun1_offset < 0 || fun1_offset > UINT_LEAST16_MAX) + if (fun1_offset > UINT_LEAST16_MAX) return false; quintptr *vfun = vfptr_t1 + fun1_offset / sizeof(quintptr); @@ -180,7 +180,7 @@ class VtableHook quintptr fun1_offset = toQuintptr(&fun1); quintptr fun2_offset = toQuintptr(&fun2); - if (fun1_offset < 0 || fun1_offset > UINT_LEAST16_MAX) + if (fun1_offset > UINT_LEAST16_MAX) return false; quintptr *vfun = vfptr_t1 + fun1_offset / sizeof(quintptr); diff --git a/tests/src/ut_dnativesettings.cpp b/tests/src/ut_dnativesettings.cpp index aec38a17..0e2e3101 100644 --- a/tests/src/ut_dnativesettings.cpp +++ b/tests/src/ut_dnativesettings.cpp @@ -9,11 +9,11 @@ DPP_USE_NAMESPACE -class TDNativeSettings : public testing::Test +class GTEST_API_ TDNativeSettings : public testing::Test { protected: - void SetUp(); - void TearDown(); + void SetUp() override; + void TearDown() override; QWindow *window = nullptr; }; diff --git a/tests/src/ut_dxcbxsettings.cpp b/tests/src/ut_dxcbxsettings.cpp index 608e782c..05f8bb3b 100644 --- a/tests/src/ut_dxcbxsettings.cpp +++ b/tests/src/ut_dxcbxsettings.cpp @@ -20,7 +20,7 @@ static void propertyChangedfunc(xcb_connection_t *, const QByteArray &, const QV testPropertyChangedCallback = true; } -class TDXcbXSettings : public testing::Test +class GTEST_API_ TDXcbXSettings : public testing::Test { protected: void SetUp(); diff --git a/wayland/dwayland/dhighdpi.cpp b/wayland/dwayland/dhighdpi.cpp index 7145b94f..4d2cce70 100755 --- a/wayland/dwayland/dhighdpi.cpp +++ b/wayland/dwayland/dhighdpi.cpp @@ -159,6 +159,7 @@ void DHighDpi::removeScreenFactorCache(QScreen *screen) } else { screenFactorMap.clear(); #else + Q_UNUSED(screen) { #endif // 刷新所有窗口 diff --git a/wayland/dwayland/dwaylandinterfacehook.cpp b/wayland/dwayland/dwaylandinterfacehook.cpp index d29d1456..9a2b7885 100755 --- a/wayland/dwayland/dwaylandinterfacehook.cpp +++ b/wayland/dwayland/dwaylandinterfacehook.cpp @@ -247,7 +247,8 @@ bool DWaylandInterfaceHook::supportForSplittingWindowByType(quint32 wid, quint32 if(!window || !window->handle()) return false; DNoTitlebarWlWindowHelper::setWindowProperty(window, ::supportForSplittingWindow, false); - return window->property(::supportForSplittingWindow).toInt() >= screenSplittingType; + int propertyValue = window->property(::supportForSplittingWindow).toInt(); + return propertyValue >= 0 && static_cast(propertyValue) >= screenSplittingType; } DPP_END_NAMESPACE diff --git a/wayland/wayland-shell/dwaylandshellmanager.cpp b/wayland/wayland-shell/dwaylandshellmanager.cpp index 86a6108d..ebcb6017 100644 --- a/wayland/wayland-shell/dwaylandshellmanager.cpp +++ b/wayland/wayland-shell/dwaylandshellmanager.cpp @@ -144,6 +144,8 @@ static void checkIsDWayland(const QString &function) { #ifndef D_DEEPIN_IS_DWAYLAND qCWarning(dwlp) << "This package is not compiled as dwayland, and [" << function << "] not support in this version."; +#else + Q_UNUSED(function) #endif } diff --git a/xcb/dhighdpi.cpp b/xcb/dhighdpi.cpp index d4c45633..45cda3d0 100644 --- a/xcb/dhighdpi.cpp +++ b/xcb/dhighdpi.cpp @@ -155,14 +155,15 @@ qreal DHighDpi::devicePixelRatio(QPlatformWindow *w) void DHighDpi::onDPIChanged(xcb_connection_t *connection, const QByteArray &name, const QVariant &property, void *handle) { + Q_UNUSED(connection) + Q_UNUSED(name) + Q_UNUSED(handle) + static bool dynamic_dpi = qEnvironmentVariableIsSet("D_DXCB_RT_HIDPI"); if (!dynamic_dpi) return; - Q_UNUSED(connection) - Q_UNUSED(name) - // 判断值是否有效 if (!property.isValid()) return; diff --git a/xcb/dplatformbackingstorehelper.cpp b/xcb/dplatformbackingstorehelper.cpp index e090b1d1..d42384ca 100644 --- a/xcb/dplatformbackingstorehelper.cpp +++ b/xcb/dplatformbackingstorehelper.cpp @@ -10,7 +10,9 @@ #ifdef Q_OS_LINUX #define private public +#define protected public #include "qxcbbackingstore.h" +#undef protected #undef private #endif @@ -158,12 +160,7 @@ void DPlatformBackingStoreHelper::resize(const QSize &size, const QRegion &stati VtableHook::callOriginalFun(this->backingStore(), &QPlatformBackingStore::resize, size, staticContents); QXcbBackingStore *bs = static_cast(backingStore()); -#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0) QXcbShmImage *shm_image = reinterpret_cast(bs->m_image); -#else - struct _QXcbBackingStore { QImage *m_image; }; // Expose m_image - QXcbShmImage *shm_image = reinterpret_cast(reinterpret_cast<_QXcbBackingStore*>( &bs )->m_image); -#endif if (shm_image->m_shm_info.shmaddr) { DPlatformWindowHelper *window_helper = DPlatformWindowHelper::mapped.value(bs->window()->handle()); diff --git a/xcb/dplatformintegration.cpp b/xcb/dplatformintegration.cpp index 9c6d598b..e4fef040 100644 --- a/xcb/dplatformintegration.cpp +++ b/xcb/dplatformintegration.cpp @@ -873,7 +873,7 @@ static bool updateCursorTheme(void *dpy) return setTheme; } -static xcb_cursor_t overrideCreateFontCursor(QXcbCursor *xcb_cursor, QCursor *c, QWindow *window) +[[maybe_unused]] static xcb_cursor_t overrideCreateFontCursor(QXcbCursor *xcb_cursor, QCursor *c, QWindow *window) { const Qt::CursorShape cshape = c->shape(); xcb_connection_t *conn = xcb_cursor->xcb_connection(); @@ -944,6 +944,7 @@ static void overrideChangeCursor(QPlatformCursor *cursorHandle, QCursor * cursor if (widget->property(disableOverrideCursor).toBool()) return; + Q_UNUSED(w) // Variable is used in some Qt versions but not all #ifdef D_ENABLE_CURSOR_HOOK // set cursor size scale static bool xcursrSizeIsSet = qEnvironmentVariableIsSet("XCURSOR_SIZE");