forked from github_mirror/framelesshelper
linux: finalize x11 function tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
ea6a070766
commit
0924aeb51f
|
@ -25,7 +25,7 @@
|
||||||
if(FRAMELESSHELPER_BUILD_WIDGETS AND TARGET Qt${QT_VERSION_MAJOR}::Widgets)
|
if(FRAMELESSHELPER_BUILD_WIDGETS AND TARGET Qt${QT_VERSION_MAJOR}::Widgets)
|
||||||
add_subdirectory(widget)
|
add_subdirectory(widget)
|
||||||
add_subdirectory(mainwindow)
|
add_subdirectory(mainwindow)
|
||||||
add_subdirectory(openglwidget)
|
#add_subdirectory(openglwidget) # Currently not functional.
|
||||||
add_subdirectory(dialog)
|
add_subdirectory(dialog)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -53,11 +53,14 @@
|
||||||
* authorization from the authors.
|
* authorization from the authors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// This one is not included in any public headers.
|
||||||
using Display = struct _XDisplay;
|
using Display = struct _XDisplay;
|
||||||
|
|
||||||
#if __has_include(<xcb/xcb.h>)
|
#if __has_include(<xcb/xcb.h>)
|
||||||
# include <xcb/xcb.h>
|
# include <xcb/xcb.h>
|
||||||
|
# define FRAMELESSHELPER_HAS_XCB
|
||||||
#else // !__has_include(<xcb/xcb.h>)
|
#else // !__has_include(<xcb/xcb.h>)
|
||||||
|
|
||||||
using xcb_connection_t = struct xcb_connection_t;
|
using xcb_connection_t = struct xcb_connection_t;
|
||||||
using xcb_button_t = uint8_t;
|
using xcb_button_t = uint8_t;
|
||||||
using xcb_window_t = uint32_t;
|
using xcb_window_t = uint32_t;
|
||||||
|
@ -208,6 +211,7 @@ using xcb_list_properties_reply_t = struct xcb_list_properties_reply_t
|
||||||
[[maybe_unused]] inline constexpr const char ATOM_NET_WM_DEEPIN_BLUR_REGION_ROUNDED[] = "_NET_WM_DEEPIN_BLUR_REGION_ROUNDED";
|
[[maybe_unused]] inline constexpr const char ATOM_NET_WM_DEEPIN_BLUR_REGION_ROUNDED[] = "_NET_WM_DEEPIN_BLUR_REGION_ROUNDED";
|
||||||
[[maybe_unused]] inline constexpr const char ATOM_UTF8_STRING[] = "UTF8_STRING";
|
[[maybe_unused]] inline constexpr const char ATOM_UTF8_STRING[] = "UTF8_STRING";
|
||||||
|
|
||||||
|
#ifndef FRAMELESSHELPER_HAS_XCB
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -328,7 +332,7 @@ xcb_get_property_unchecked(
|
||||||
);
|
);
|
||||||
|
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
#endif // FRAMELESSHELPER_HAS_XCB
|
||||||
|
|
||||||
/* GTK - The GIMP Toolkit
|
/* GTK - The GIMP Toolkit
|
||||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||||
|
@ -355,8 +359,11 @@ xcb_get_property_unchecked(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if __has_include(<gtk/gtk.h>)
|
#if __has_include(<gtk/gtk.h>)
|
||||||
|
# undef signals // Workaround a compilation issue caused by GTK.
|
||||||
# include <gtk/gtk.h>
|
# include <gtk/gtk.h>
|
||||||
|
# define FRAMELESSHELPER_HAS_GTK
|
||||||
#else // !__has_include(<gtk/gtk.h>)
|
#else // !__has_include(<gtk/gtk.h>)
|
||||||
|
|
||||||
#define G_VALUE_INIT { 0, { { 0 } } }
|
#define G_VALUE_INIT { 0, { { 0 } } }
|
||||||
#define g_signal_connect(instance, detailed_signal, c_handler, data) \
|
#define g_signal_connect(instance, detailed_signal, c_handler, data) \
|
||||||
g_signal_connect_data((instance), (detailed_signal), (c_handler), (data), nullptr, G_CONNECT_DEFAULT)
|
g_signal_connect_data((instance), (detailed_signal), (c_handler), (data), nullptr, G_CONNECT_DEFAULT)
|
||||||
|
@ -378,7 +385,7 @@ using gint64 = signed long;
|
||||||
using guint64 = unsigned long;
|
using guint64 = unsigned long;
|
||||||
using gsize = unsigned int;
|
using gsize = unsigned int;
|
||||||
|
|
||||||
using GType = unsigned long;
|
using GType = unsigned long; // TODO: or unsigned int?
|
||||||
using GValue = struct _GValue;
|
using GValue = struct _GValue;
|
||||||
using GObject = struct _GObject;
|
using GObject = struct _GObject;
|
||||||
using GClosure = struct _GClosure;
|
using GClosure = struct _GClosure;
|
||||||
|
@ -417,7 +424,7 @@ struct _GValue
|
||||||
[[maybe_unused]] inline constexpr const char GTK_THEME_NAME_PROP[] = "gtk-theme-name";
|
[[maybe_unused]] inline constexpr const char GTK_THEME_NAME_PROP[] = "gtk-theme-name";
|
||||||
[[maybe_unused]] inline constexpr const char GTK_THEME_PREFER_DARK_PROP[] = "gtk-application-prefer-dark-theme";
|
[[maybe_unused]] inline constexpr const char GTK_THEME_PREFER_DARK_PROP[] = "gtk-application-prefer-dark-theme";
|
||||||
|
|
||||||
#if 0
|
#ifndef FRAMELESSHELPER_HAS_GTK
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -491,7 +498,15 @@ g_clear_object(
|
||||||
);
|
);
|
||||||
|
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif // FRAMELESSHELPER_HAS_GTK
|
||||||
|
|
||||||
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T gtkSettings(const gchar *property);
|
[[nodiscard]] T gtkSettings(const gchar *property);
|
||||||
|
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
using x11_return_type = quint32;
|
||||||
|
#else // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
using x11_return_type = unsigned long;
|
||||||
|
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
|
@ -144,15 +144,11 @@ FRAMELESSHELPER_CORE_API void bringWindowToFront(const WId windowId);
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
[[nodiscard]] FRAMELESSHELPER_CORE_API QScreen *x11_findScreenForVirtualDesktop
|
[[nodiscard]] FRAMELESSHELPER_CORE_API QScreen *x11_findScreenForVirtualDesktop
|
||||||
(const int virtualDesktopNumber);
|
(const int virtualDesktopNumber);
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
[[nodiscard]] FRAMELESSHELPER_CORE_API x11_return_type x11_appRootWindow(const int screen);
|
||||||
[[nodiscard]] FRAMELESSHELPER_CORE_API unsigned long x11_appRootWindow(const int screen);
|
|
||||||
#else // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
[[nodiscard]] FRAMELESSHELPER_CORE_API quint32 x11_appRootWindow(const int screen);
|
|
||||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
[[nodiscard]] FRAMELESSHELPER_CORE_API int x11_appScreen();
|
[[nodiscard]] FRAMELESSHELPER_CORE_API int x11_appScreen();
|
||||||
[[nodiscard]] FRAMELESSHELPER_CORE_API quint32 x11_appTime();
|
[[nodiscard]] FRAMELESSHELPER_CORE_API x11_return_type x11_appTime();
|
||||||
[[nodiscard]] FRAMELESSHELPER_CORE_API quint32 x11_appUserTime();
|
[[nodiscard]] FRAMELESSHELPER_CORE_API x11_return_type x11_appUserTime();
|
||||||
[[nodiscard]] FRAMELESSHELPER_CORE_API quint32 x11_getTimestamp();
|
[[nodiscard]] FRAMELESSHELPER_CORE_API x11_return_type x11_getTimestamp();
|
||||||
[[nodiscard]] FRAMELESSHELPER_CORE_API QByteArray x11_nextStartupId();
|
[[nodiscard]] FRAMELESSHELPER_CORE_API QByteArray x11_nextStartupId();
|
||||||
[[nodiscard]] FRAMELESSHELPER_CORE_API Display *x11_display();
|
[[nodiscard]] FRAMELESSHELPER_CORE_API Display *x11_display();
|
||||||
[[nodiscard]] FRAMELESSHELPER_CORE_API xcb_connection_t *x11_connection();
|
[[nodiscard]] FRAMELESSHELPER_CORE_API xcb_connection_t *x11_connection();
|
||||||
|
|
|
@ -24,10 +24,16 @@
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
if(FRAMELESSHELPER_NO_PRIVATE)
|
if(FRAMELESSHELPER_NO_PRIVATE)
|
||||||
find_package(Qt5 QUIET COMPONENTS X11Extras)
|
# Qt X11Extras is only available in Qt5.
|
||||||
|
if(QT_VERSION_MAJOR LESS 6)
|
||||||
|
find_package(Qt5 QUIET COMPONENTS X11Extras)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
find_package(X11 QUIET)
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
if(PkgConfig_FOUND)
|
||||||
|
pkg_check_modules(GTK3 QUIET IMPORTED_TARGET gtk+-3.0)
|
||||||
endif()
|
endif()
|
||||||
find_package(PkgConfig REQUIRED)
|
|
||||||
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(SUB_MOD_NAME Core)
|
set(SUB_MOD_NAME Core)
|
||||||
|
@ -137,7 +143,7 @@ add_library(${PROJECT_NAME}::${SUB_PROJ_NAME} ALIAS ${SUB_PROJ_NAME})
|
||||||
add_library(${PROJECT_NAME}::${SUB_MOD_NAME} ALIAS ${SUB_PROJ_NAME})
|
add_library(${PROJECT_NAME}::${SUB_MOD_NAME} ALIAS ${SUB_PROJ_NAME})
|
||||||
|
|
||||||
if(NOT FRAMELESSHELPER_NO_BUNDLE_RESOURCE)
|
if(NOT FRAMELESSHELPER_NO_BUNDLE_RESOURCE)
|
||||||
if(${QT_VERSION} VERSION_GREATER_EQUAL 6.2)
|
if(QT_VERSION VERSION_GREATER_EQUAL "6.2")
|
||||||
qt_add_resources(${SUB_PROJ_NAME} framelesshelpercore
|
qt_add_resources(${SUB_PROJ_NAME} framelesshelpercore
|
||||||
PREFIX
|
PREFIX
|
||||||
"/org.wangwenx190.${PROJECT_NAME}"
|
"/org.wangwenx190.${PROJECT_NAME}"
|
||||||
|
@ -187,12 +193,22 @@ if(APPLE)
|
||||||
"-framework AppKit"
|
"-framework AppKit"
|
||||||
)
|
)
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
target_include_directories(${SUB_PROJ_NAME} PRIVATE
|
if(X11_FOUND)
|
||||||
${GTK3_INCLUDE_DIRS}
|
target_link_libraries(${SUB_PROJ_NAME} PRIVATE
|
||||||
)
|
X11::xcb
|
||||||
target_link_libraries(${SUB_PROJ_NAME} PRIVATE
|
)
|
||||||
${GTK3_LINK_LIBRARIES}
|
endif()
|
||||||
)
|
if(GTK3_FOUND)
|
||||||
|
#target_include_directories(${SUB_PROJ_NAME} PRIVATE
|
||||||
|
# ${GTK3_INCLUDE_DIRS}
|
||||||
|
#)
|
||||||
|
target_link_libraries(${SUB_PROJ_NAME} PRIVATE
|
||||||
|
PkgConfig::GTK3
|
||||||
|
)
|
||||||
|
target_compile_definitions(${SUB_PROJ_NAME} PRIVATE
|
||||||
|
GDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_6
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FRAMELESSHELPER_NO_PRIVATE)
|
if(FRAMELESSHELPER_NO_PRIVATE)
|
||||||
|
|
|
@ -22,8 +22,13 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sysapiloader_p.h"
|
|
||||||
#include "framelesshelper_linux.h"
|
#include "framelesshelper_linux.h"
|
||||||
|
#include "sysapiloader_p.h"
|
||||||
|
|
||||||
|
//////////////////////////////////////////////
|
||||||
|
// XCB
|
||||||
|
|
||||||
|
#ifndef FRAMELESSHELPER_HAS_XCB
|
||||||
|
|
||||||
FRAMELESSHELPER_STRING_CONSTANT(libxcb)
|
FRAMELESSHELPER_STRING_CONSTANT(libxcb)
|
||||||
|
|
||||||
|
@ -44,9 +49,6 @@ FRAMELESSHELPER_STRING_CONSTANT(xcb_list_properties_atoms_length)
|
||||||
FRAMELESSHELPER_STRING_CONSTANT(xcb_list_properties_atoms)
|
FRAMELESSHELPER_STRING_CONSTANT(xcb_list_properties_atoms)
|
||||||
FRAMELESSHELPER_STRING_CONSTANT(xcb_get_property_unchecked)
|
FRAMELESSHELPER_STRING_CONSTANT(xcb_get_property_unchecked)
|
||||||
|
|
||||||
//////////////////////////////////////////////
|
|
||||||
// XCB
|
|
||||||
|
|
||||||
extern "C" xcb_void_cookie_t
|
extern "C" xcb_void_cookie_t
|
||||||
xcb_send_event(
|
xcb_send_event(
|
||||||
xcb_connection_t *connection,
|
xcb_connection_t *connection,
|
||||||
|
@ -262,15 +264,19 @@ xcb_get_property_unchecked(
|
||||||
_delete, window, property, type, long_offset, long_length);
|
_delete, window, property, type, long_offset, long_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // FRAMELESSHELPER_HAS_XCB
|
||||||
|
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
// GTK
|
// GTK
|
||||||
|
|
||||||
#if 0
|
#ifndef FRAMELESSHELPER_HAS_GTK
|
||||||
#define GTK_SETTINGS_IMPL(Name, Type, ...) \
|
|
||||||
Type Name(const gchar *property) \
|
#define GTKSETTINGS_IMPL(Type, ...) \
|
||||||
|
Type gtkSettings(const gchar *property) \
|
||||||
{ \
|
{ \
|
||||||
Q_ASSERT(property); \
|
Q_ASSERT(property); \
|
||||||
if (!property) { \
|
Q_ASSERT(*property != '\0'); \
|
||||||
|
if (!property || (*property == '\0')) { \
|
||||||
return Type{}; \
|
return Type{}; \
|
||||||
} \
|
} \
|
||||||
static GtkSettings * const settings = gtk_settings_get_default(); \
|
static GtkSettings * const settings = gtk_settings_get_default(); \
|
||||||
|
@ -441,10 +447,12 @@ g_clear_object(
|
||||||
API_CALL_FUNCTION(g_clear_object, object_ptr);
|
API_CALL_FUNCTION(g_clear_object, object_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
GTK_SETTINGS_IMPL(GTK_bool, bool, const bool result = g_value_get_boolean(&value);)
|
GTKSETTINGS_IMPL(bool, const bool result = g_value_get_boolean(&value);)
|
||||||
GTK_SETTINGS_IMPL(GTK_str, QString, const QString result = QUtf8String(g_value_get_string(&value));)
|
GTKSETTINGS_IMPL(QString, const QString result = QUtf8String(g_value_get_string(&value));)
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif // FRAMELESSHELPER_HAS_GTK
|
||||||
|
|
||||||
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T gtkSettings(const gchar *property)
|
T gtkSettings(const gchar *property)
|
||||||
{
|
{
|
||||||
|
@ -466,8 +474,14 @@ template bool gtkSettings<bool>(const gchar *);
|
||||||
|
|
||||||
QString gtkSettings(const gchar *property)
|
QString gtkSettings(const gchar *property)
|
||||||
{
|
{
|
||||||
const auto raw = gtkSettings<gchar *>(property);
|
Q_ASSERT(property);
|
||||||
|
Q_ASSERT(*property != '\0');
|
||||||
|
if (!property || (*property == '\0')) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
const auto raw = gtkSettings<gchararray>(property);
|
||||||
const QString result = QUtf8String(raw);
|
const QString result = QUtf8String(raw);
|
||||||
g_free(raw);
|
g_free(raw);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
|
@ -44,11 +44,12 @@
|
||||||
# else // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
# else // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
# include <QtPlatformHeaders/qxcbscreenfunctions.h>
|
# include <QtPlatformHeaders/qxcbscreenfunctions.h>
|
||||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
# if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||||
|
# include <QtGui/private/qtx11extras_p.h>
|
||||||
|
# define FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
|
|
||||||
extern template bool gtkSettings<bool>(const gchar *);
|
|
||||||
extern QString gtkSettings(const gchar *);
|
|
||||||
|
|
||||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
Q_LOGGING_CATEGORY(lcUtilsLinux, "wangwenx190.framelesshelper.core.utils.linux")
|
Q_LOGGING_CATEGORY(lcUtilsLinux, "wangwenx190.framelesshelper.core.utils.linux")
|
||||||
|
@ -81,6 +82,9 @@ FRAMELESSHELPER_BYTEARRAY_CONSTANT(connection)
|
||||||
static constexpr const auto _XCB_SEND_EVENT_MASK =
|
static constexpr const auto _XCB_SEND_EVENT_MASK =
|
||||||
(XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY);
|
(XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY);
|
||||||
|
|
||||||
|
extern template bool gtkSettings<bool>(const gchar *);
|
||||||
|
extern QString gtkSettings(const gchar *);
|
||||||
|
|
||||||
[[maybe_unused]] [[nodiscard]] static inline int
|
[[maybe_unused]] [[nodiscard]] static inline int
|
||||||
qtEdgesToWmMoveOrResizeOperation(const Qt::Edges edges)
|
qtEdgesToWmMoveOrResizeOperation(const Qt::Edges edges)
|
||||||
{
|
{
|
||||||
|
@ -143,20 +147,15 @@ QScreen *Utils::x11_findScreenForVirtualDesktop(const int virtualDesktopNumber)
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
x11_return_type Utils::x11_appRootWindow(const int screen)
|
||||||
unsigned long Utils::x11_appRootWindow(const int screen)
|
|
||||||
#else // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
quint32 Utils::x11_appRootWindow(const int screen)
|
|
||||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
|
||||||
{
|
{
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
|
||||||
return QX11Info::appRootWindow(screen);
|
return QX11Info::appRootWindow(screen);
|
||||||
# else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
|
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
Q_UNUSED(screen);
|
Q_UNUSED(screen);
|
||||||
return 0;
|
return 0;
|
||||||
# endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -169,18 +168,18 @@ quint32 Utils::x11_appRootWindow(const int screen)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return static_cast<xcb_window_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(krootwindow, scr)));
|
return static_cast<xcb_window_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(krootwindow, scr)));
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
int Utils::x11_appScreen()
|
int Utils::x11_appScreen()
|
||||||
{
|
{
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
|
||||||
return QX11Info::appScreen();
|
return QX11Info::appScreen();
|
||||||
# else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
|
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
return 0;
|
return 0;
|
||||||
# endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -189,18 +188,18 @@ int Utils::x11_appScreen()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return reinterpret_cast<qintptr>(native->nativeResourceForIntegration(kx11screen));
|
return reinterpret_cast<qintptr>(native->nativeResourceForIntegration(kx11screen));
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 Utils::x11_appTime()
|
x11_return_type Utils::x11_appTime()
|
||||||
{
|
{
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
|
||||||
return QX11Info::appTime();
|
return QX11Info::appTime();
|
||||||
# else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
|
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
return 0;
|
return 0;
|
||||||
# endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -213,18 +212,18 @@ quint32 Utils::x11_appTime()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(kapptime, screen)));
|
return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(kapptime, screen)));
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 Utils::x11_appUserTime()
|
x11_return_type Utils::x11_appUserTime()
|
||||||
{
|
{
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
|
||||||
return QX11Info::appUserTime();
|
return QX11Info::appUserTime();
|
||||||
# else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
|
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
return 0;
|
return 0;
|
||||||
# endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -237,18 +236,18 @@ quint32 Utils::x11_appUserTime()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(kappusertime, screen)));
|
return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(kappusertime, screen)));
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 Utils::x11_getTimestamp()
|
x11_return_type Utils::x11_getTimestamp()
|
||||||
{
|
{
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
|
||||||
return QX11Info::getTimestamp();
|
return QX11Info::getTimestamp();
|
||||||
# else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
|
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
return 0;
|
return 0;
|
||||||
# endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -261,18 +260,18 @@ quint32 Utils::x11_getTimestamp()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(kgettimestamp, screen)));
|
return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(kgettimestamp, screen)));
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Utils::x11_nextStartupId()
|
QByteArray Utils::x11_nextStartupId()
|
||||||
{
|
{
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
|
||||||
return QX11Info::nextStartupId();
|
return QX11Info::nextStartupId();
|
||||||
# else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
|
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
return {};
|
return {};
|
||||||
# endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -281,65 +280,66 @@ QByteArray Utils::x11_nextStartupId()
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return static_cast<char *>(native->nativeResourceForIntegration(kstartupid));
|
return static_cast<char *>(native->nativeResourceForIntegration(kstartupid));
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
Display *Utils::x11_display()
|
Display *Utils::x11_display()
|
||||||
{
|
{
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
|
||||||
return QX11Info::display();
|
return QX11Info::display();
|
||||||
# else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
|
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
return nullptr;
|
return nullptr;
|
||||||
# endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
# if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||||
using App = QNativeInterface::QX11Application;
|
using App = QNativeInterface::QX11Application;
|
||||||
const auto native = qApp->nativeInterface<App>();
|
const auto native = qApp->nativeInterface<App>();
|
||||||
# else // (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
# else // (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
||||||
const auto native = qApp->platformNativeInterface();
|
const auto native = qApp->platformNativeInterface();
|
||||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||||
if (!native) {
|
if (!native) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
# if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||||
return native->display();
|
return native->display();
|
||||||
# else // (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
# else // (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
||||||
return reinterpret_cast<Display *>(native->nativeResourceForIntegration(kdisplay));
|
return reinterpret_cast<Display *>(native->nativeResourceForIntegration(kdisplay));
|
||||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_connection_t *Utils::x11_connection()
|
xcb_connection_t *Utils::x11_connection()
|
||||||
{
|
{
|
||||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
# ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
|
||||||
return QX11Info::connection();
|
return QX11Info::connection();
|
||||||
# else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
|
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
return nullptr;
|
return nullptr;
|
||||||
# endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
|
||||||
if (!qApp) {
|
if (!qApp) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
# if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||||
using App = QNativeInterface::QX11Application;
|
using App = QNativeInterface::QX11Application;
|
||||||
const auto native = qApp->nativeInterface<App>();
|
const auto native = qApp->nativeInterface<App>();
|
||||||
# else // (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
# else // (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
||||||
const auto native = qApp->platformNativeInterface();
|
const auto native = qApp->platformNativeInterface();
|
||||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||||
if (!native) {
|
if (!native) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
# if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||||
return native->connection();
|
return native->connection();
|
||||||
# else // (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
# else // (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
||||||
return reinterpret_cast<xcb_connection_t *>(native->nativeResourceForIntegration(kconnection));
|
return reinterpret_cast<xcb_connection_t *>(native->nativeResourceForIntegration(kconnection));
|
||||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||||
|
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemTheme Utils::getSystemTheme()
|
SystemTheme Utils::getSystemTheme()
|
||||||
|
|
Loading…
Reference in New Issue