Advance KWin Wayland port for Red Bear desktop session
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -50,8 +50,8 @@ option(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON)
|
|||||||
option(KWIN_BUILD_NOTIFICATIONS "Enable building of KWin with knotifications support" ON)
|
option(KWIN_BUILD_NOTIFICATIONS "Enable building of KWin with knotifications support" ON)
|
||||||
option(KWIN_BUILD_SCREENLOCKER "Enable building of KWin lockscreen functionality" ON)
|
option(KWIN_BUILD_SCREENLOCKER "Enable building of KWin lockscreen functionality" ON)
|
||||||
option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON)
|
option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON)
|
||||||
option(KWIN_BUILD_X11 "Enable building X11 common code and Xwayland support" ON)
|
option(KWIN_BUILD_X11 "Enable building X11 common code and Xwayland support" OFF)
|
||||||
option(KWIN_BUILD_X11_BACKEND "Enable building kwin_x11" ON)
|
option(KWIN_BUILD_X11_BACKEND "Enable building kwin_x11" OFF)
|
||||||
option(KWIN_BUILD_GLOBALSHORTCUTS "Enable building of KWin with global shortcuts support" ON)
|
option(KWIN_BUILD_GLOBALSHORTCUTS "Enable building of KWin with global shortcuts support" ON)
|
||||||
option(KWIN_BUILD_RUNNERS "Enable building of KWin with krunner support" ON)
|
option(KWIN_BUILD_RUNNERS "Enable building of KWin with krunner support" ON)
|
||||||
option(KWIN_BUILD_EFFECTS "Enable building of KWin effect plugins" ON)
|
option(KWIN_BUILD_EFFECTS "Enable building of KWin effect plugins" ON)
|
||||||
@@ -66,6 +66,7 @@ endif()
|
|||||||
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
|
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
|
||||||
Concurrent
|
Concurrent
|
||||||
Core
|
Core
|
||||||
|
Qml
|
||||||
WaylandClient
|
WaylandClient
|
||||||
Widgets
|
Widgets
|
||||||
Svg
|
Svg
|
||||||
@@ -98,6 +99,7 @@ find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
|
|||||||
ConfigWidgets
|
ConfigWidgets
|
||||||
CoreAddons
|
CoreAddons
|
||||||
Crash
|
Crash
|
||||||
|
Declarative
|
||||||
GlobalAccel
|
GlobalAccel
|
||||||
GuiAddons
|
GuiAddons
|
||||||
I18n
|
I18n
|
||||||
@@ -441,19 +443,13 @@ endif()
|
|||||||
cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "PlasmaActivities_FOUND" OFF)
|
cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "PlasmaActivities_FOUND" OFF)
|
||||||
cmake_dependent_option(KWIN_BUILD_EIS "Enable building KWin with libeis support" ON "Libeis-1.0_FOUND" OFF)
|
cmake_dependent_option(KWIN_BUILD_EIS "Enable building KWin with libeis support" ON "Libeis-1.0_FOUND" OFF)
|
||||||
|
|
||||||
# --- Redox stub targets for missing deps ---
|
# --- Redox fallback targets for deps still using reduced compatibility paths ---
|
||||||
if(NOT TARGET epoxy::epoxy)
|
if(NOT TARGET epoxy::epoxy)
|
||||||
add_library(epoxy::epoxy INTERFACE IMPORTED)
|
add_library(epoxy::epoxy INTERFACE IMPORTED)
|
||||||
endif()
|
endif()
|
||||||
if(NOT TARGET UDev::UDev)
|
|
||||||
add_library(UDev::UDev INTERFACE IMPORTED)
|
|
||||||
endif()
|
|
||||||
if(NOT TARGET lcms2::lcms2)
|
if(NOT TARGET lcms2::lcms2)
|
||||||
add_library(lcms2::lcms2 INTERFACE IMPORTED)
|
add_library(lcms2::lcms2 INTERFACE IMPORTED)
|
||||||
endif()
|
endif()
|
||||||
if(NOT TARGET PkgConfig::libdisplayinfo)
|
|
||||||
add_library(PkgConfig::libdisplayinfo INTERFACE IMPORTED)
|
|
||||||
endif()
|
|
||||||
if(NOT TARGET PkgConfig::Libxcvt)
|
if(NOT TARGET PkgConfig::Libxcvt)
|
||||||
add_library(PkgConfig::Libxcvt INTERFACE IMPORTED)
|
add_library(PkgConfig::Libxcvt INTERFACE IMPORTED)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=KDE Window Manager
|
|
||||||
After=plasma-kcminit.service
|
|
||||||
PartOf=graphical-session.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/kwin_x11 --replace
|
|
||||||
BusName=org.kde.KWin
|
|
||||||
Slice=session.slice
|
|
||||||
Restart=on-failure
|
|
||||||
@@ -81,7 +81,6 @@ target_sources(kwin PRIVATE
|
|||||||
cursor.cpp
|
cursor.cpp
|
||||||
cursorsource.cpp
|
cursorsource.cpp
|
||||||
dbusinterface.cpp
|
dbusinterface.cpp
|
||||||
debug_console.cpp
|
|
||||||
decorations/decoratedwindow.cpp
|
decorations/decoratedwindow.cpp
|
||||||
decorations/decorationbridge.cpp
|
decorations/decorationbridge.cpp
|
||||||
decorations/decorationpalette.cpp
|
decorations/decorationpalette.cpp
|
||||||
@@ -234,6 +233,7 @@ target_link_libraries(kwin
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
Qt::Concurrent
|
Qt::Concurrent
|
||||||
Qt::GuiPrivate
|
Qt::GuiPrivate
|
||||||
|
Qt::Qml
|
||||||
Qt::Svg
|
Qt::Svg
|
||||||
|
|
||||||
KF6::ColorScheme
|
KF6::ColorScheme
|
||||||
@@ -247,13 +247,18 @@ target_link_libraries(kwin
|
|||||||
KDecoration3::KDecoration
|
KDecoration3::KDecoration
|
||||||
KDecoration3::KDecoration3Private
|
KDecoration3::KDecoration3Private
|
||||||
|
|
||||||
$<$<TARGET_EXISTS:UDev::UDev>:UDev::UDev>
|
UDev::UDev
|
||||||
XKB::XKB
|
XKB::XKB
|
||||||
EGL::EGL
|
EGL::EGL
|
||||||
|
|
||||||
Threads::Threads
|
Threads::Threads
|
||||||
$<$<TARGET_EXISTS:lcms2::lcms2>:lcms2::lcms2>
|
$<$<TARGET_EXISTS:lcms2::lcms2>:lcms2::lcms2>
|
||||||
$<$<TARGET_EXISTS:PkgConfig::libdisplayinfo>:PkgConfig::libdisplayinfo>
|
PkgConfig::libdisplayinfo
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(kwin PRIVATE
|
||||||
|
${CMAKE_PREFIX_PATH}/include/KF6/KDeclarative
|
||||||
|
$ENV{COOKBOOK_ROOT}/recipes/wip/qt/qtbase/source/src/gui
|
||||||
)
|
)
|
||||||
|
|
||||||
if (KWIN_BUILD_QTQUICK)
|
if (KWIN_BUILD_QTQUICK)
|
||||||
@@ -328,28 +333,16 @@ kconfig_add_kcfg_files(kwin
|
|||||||
)
|
)
|
||||||
|
|
||||||
ki18n_wrap_ui(kwin
|
ki18n_wrap_ui(kwin
|
||||||
debug_console.ui
|
|
||||||
shortcutdialog.ui
|
shortcutdialog.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
if(Qt6DBus_FOUND)
|
if(Qt6DBus_FOUND)
|
||||||
set(kwin_dbus_SRCS)
|
set(kwin_dbus_SRCS)
|
||||||
qt_add_dbus_adaptor(kwin_dbus_SRCS scripting/org.kde.kwin.Script.xml scripting/scripting.h KWin::AbstractScript)
|
|
||||||
qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface)
|
|
||||||
qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.kwin.Compositing.xml dbusinterface.h KWin::CompositorDBusInterface)
|
|
||||||
qt_add_dbus_adaptor(kwin_dbus_SRCS ${kwin_effects_dbus_xml} effect/effecthandler.h KWin::EffectsHandler)
|
|
||||||
qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.KWin.VirtualDesktopManager.xml dbusinterface.h KWin::VirtualDesktopManagerDBusInterface)
|
|
||||||
qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.KWin.Session.xml sm.h KWin::SessionManager)
|
|
||||||
qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.KWin.Plugins.xml dbusinterface.h KWin::PluginManagerDBusInterface)
|
|
||||||
qt_add_dbus_interface(kwin_dbus_SRCS org.freedesktop.DBus.Properties.xml dbusproperties_interface)
|
|
||||||
|
|
||||||
if (KWIN_BUILD_SCREENLOCKER)
|
if (KWIN_BUILD_SCREENLOCKER)
|
||||||
qt_add_dbus_interface(kwin_dbus_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/kf6_org.freedesktop.ScreenSaver.xml screenlocker_interface)
|
qt_add_dbus_interface(kwin_dbus_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/kf6_org.freedesktop.ScreenSaver.xml screenlocker_interface)
|
||||||
qt_add_dbus_interface(kwin_dbus_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/org.kde.screensaver.xml kscreenlocker_interface)
|
qt_add_dbus_interface(kwin_dbus_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/org.kde.screensaver.xml kscreenlocker_interface)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
qt_add_dbus_interface(kwin_dbus_SRCS org.kde.kappmenu.xml appmenu_interface)
|
|
||||||
|
|
||||||
target_sources(kwin PRIVATE ${kwin_dbus_SRCS})
|
target_sources(kwin PRIVATE ${kwin_dbus_SRCS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -451,8 +444,6 @@ if (HAVE_LIBCAP)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(kwin_wayland
|
target_link_libraries(kwin_wayland
|
||||||
KWinQpaPlugin
|
|
||||||
KF6WindowSystemKWinPlugin
|
|
||||||
KF6IdleTimeKWinPlugin
|
KF6IdleTimeKWinPlugin
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -502,7 +493,6 @@ install(FILES
|
|||||||
cursor.h
|
cursor.h
|
||||||
cursorsource.h
|
cursorsource.h
|
||||||
dbusinterface.h
|
dbusinterface.h
|
||||||
debug_console.h
|
|
||||||
focuschain.h
|
focuschain.h
|
||||||
ftrace.h
|
ftrace.h
|
||||||
gestures.h
|
gestures.h
|
||||||
|
|||||||
@@ -11,10 +11,7 @@
|
|||||||
#include "appmenu.h"
|
#include "appmenu.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#include <appmenu_interface.h>
|
|
||||||
|
|
||||||
#include <QDBusObjectPath>
|
#include <QDBusObjectPath>
|
||||||
#include <QDBusServiceWatcher>
|
|
||||||
|
|
||||||
#include "decorations/decorationbridge.h"
|
#include "decorations/decorationbridge.h"
|
||||||
#include <KDecoration3/DecorationSettings>
|
#include <KDecoration3/DecorationSettings>
|
||||||
@@ -22,28 +19,8 @@
|
|||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
static const QString s_viewService(QStringLiteral("org.kde.kappmenuview"));
|
|
||||||
|
|
||||||
ApplicationMenu::ApplicationMenu()
|
ApplicationMenu::ApplicationMenu()
|
||||||
: m_appmenuInterface(new OrgKdeKappmenuInterface(QStringLiteral("org.kde.kappmenu"), QStringLiteral("/KAppMenu"), QDBusConnection::sessionBus(), this))
|
|
||||||
{
|
{
|
||||||
connect(m_appmenuInterface, &OrgKdeKappmenuInterface::showRequest, this, &ApplicationMenu::slotShowRequest);
|
|
||||||
connect(m_appmenuInterface, &OrgKdeKappmenuInterface::menuShown, this, &ApplicationMenu::slotMenuShown);
|
|
||||||
connect(m_appmenuInterface, &OrgKdeKappmenuInterface::menuHidden, this, &ApplicationMenu::slotMenuHidden);
|
|
||||||
|
|
||||||
m_kappMenuWatcher = new QDBusServiceWatcher(QStringLiteral("org.kde.kappmenu"), QDBusConnection::sessionBus(),
|
|
||||||
QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration, this);
|
|
||||||
|
|
||||||
connect(m_kappMenuWatcher, &QDBusServiceWatcher::serviceRegistered, this, [this]() {
|
|
||||||
m_applicationMenuEnabled = true;
|
|
||||||
Q_EMIT applicationMenuEnabledChanged(true);
|
|
||||||
});
|
|
||||||
connect(m_kappMenuWatcher, &QDBusServiceWatcher::serviceUnregistered, this, [this]() {
|
|
||||||
m_applicationMenuEnabled = false;
|
|
||||||
Q_EMIT applicationMenuEnabledChanged(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
m_applicationMenuEnabled = QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.kappmenu"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApplicationMenu::applicationMenuEnabled() const
|
bool ApplicationMenu::applicationMenuEnabled() const
|
||||||
@@ -53,13 +30,7 @@ bool ApplicationMenu::applicationMenuEnabled() const
|
|||||||
|
|
||||||
void ApplicationMenu::setViewEnabled(bool enabled)
|
void ApplicationMenu::setViewEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
if (enabled) {
|
Q_UNUSED(enabled)
|
||||||
QDBusConnection::sessionBus().interface()->registerService(s_viewService,
|
|
||||||
QDBusConnectionInterface::QueueService,
|
|
||||||
QDBusConnectionInterface::DontAllowReplacement);
|
|
||||||
} else {
|
|
||||||
QDBusConnection::sessionBus().interface()->unregisterService(s_viewService);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationMenu::slotShowRequest(const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId)
|
void ApplicationMenu::slotShowRequest(const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId)
|
||||||
@@ -92,10 +63,9 @@ void ApplicationMenu::slotMenuHidden(const QString &serviceName, const QDBusObje
|
|||||||
|
|
||||||
void ApplicationMenu::showApplicationMenu(const QPoint &p, Window *c, int actionId)
|
void ApplicationMenu::showApplicationMenu(const QPoint &p, Window *c, int actionId)
|
||||||
{
|
{
|
||||||
if (!c->hasApplicationMenu()) {
|
Q_UNUSED(p)
|
||||||
return;
|
Q_UNUSED(c)
|
||||||
}
|
Q_UNUSED(actionId)
|
||||||
m_appmenuInterface->showMenu(p.x(), p.y(), c->applicationMenuServiceName(), QDBusObjectPath(c->applicationMenuObjectPath()), actionId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Window *ApplicationMenu::findWindowWithApplicationMenu(const QString &serviceName, const QDBusObjectPath &menuObjectPath)
|
Window *ApplicationMenu::findWindowWithApplicationMenu(const QString &serviceName, const QDBusObjectPath &menuObjectPath)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "pointer_input.h"
|
#include "pointer_input.h"
|
||||||
|
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
|
#include <libudev.h>
|
||||||
#include <QDBusArgument>
|
#include <QDBusArgument>
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
#include <QDBusMetaType>
|
#include <QDBusMetaType>
|
||||||
@@ -330,10 +331,10 @@ Device::Device(libinput_device *device, QObject *parent)
|
|||||||
, m_switch(libinput_device_has_capability(m_device, LIBINPUT_DEVICE_CAP_SWITCH))
|
, m_switch(libinput_device_has_capability(m_device, LIBINPUT_DEVICE_CAP_SWITCH))
|
||||||
, m_lidSwitch(m_switch ? libinput_device_switch_has_switch(m_device, LIBINPUT_SWITCH_LID) : false)
|
, m_lidSwitch(m_switch ? libinput_device_switch_has_switch(m_device, LIBINPUT_SWITCH_LID) : false)
|
||||||
, m_tabletSwitch(m_switch ? libinput_device_switch_has_switch(m_device, LIBINPUT_SWITCH_TABLET_MODE) : false)
|
, m_tabletSwitch(m_switch ? libinput_device_switch_has_switch(m_device, LIBINPUT_SWITCH_TABLET_MODE) : false)
|
||||||
, m_touchpad(m_pointer && udev_device_get_property_value(libinput_device_get_udev_device(m_device), "ID_INPUT_TOUCHPAD"))
|
, m_touchpad(false)
|
||||||
, m_name(QString::fromLocal8Bit(libinput_device_get_name(m_device)))
|
, m_name(QString::fromLocal8Bit(libinput_device_get_name(m_device)))
|
||||||
, m_sysName(QString::fromLocal8Bit(libinput_device_get_sysname(m_device)))
|
, m_sysName(QString::fromLocal8Bit(libinput_device_get_sysname(m_device)))
|
||||||
, m_sysPath(QString::fromLocal8Bit(udev_device_get_syspath(libinput_device_get_udev_device(m_device))))
|
, m_sysPath(QString())
|
||||||
, m_outputName(QString::fromLocal8Bit(libinput_device_get_output_name(m_device)))
|
, m_outputName(QString::fromLocal8Bit(libinput_device_get_output_name(m_device)))
|
||||||
, m_product(libinput_device_get_id_product(m_device))
|
, m_product(libinput_device_get_id_product(m_device))
|
||||||
, m_vendor(libinput_device_get_id_vendor(m_device))
|
, m_vendor(libinput_device_get_id_vendor(m_device))
|
||||||
|
|||||||
@@ -9,16 +9,11 @@
|
|||||||
|
|
||||||
// own
|
// own
|
||||||
#include "dbusinterface.h"
|
#include "dbusinterface.h"
|
||||||
#include "compositingadaptor.h"
|
|
||||||
#include "pluginsadaptor.h"
|
|
||||||
#include "virtualdesktopmanageradaptor.h"
|
|
||||||
|
|
||||||
// kwin
|
// kwin
|
||||||
#include "compositor.h"
|
#include "compositor.h"
|
||||||
#include "core/output.h"
|
#include "core/output.h"
|
||||||
#include "core/renderbackend.h"
|
#include "core/renderbackend.h"
|
||||||
#include "debug_console.h"
|
|
||||||
#include "kwinadaptor.h"
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "placement.h"
|
#include "placement.h"
|
||||||
#include "pluginmanager.h"
|
#include "pluginmanager.h"
|
||||||
@@ -31,6 +26,8 @@
|
|||||||
|
|
||||||
// Qt
|
// Qt
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
|
#include <QDBusMetaType>
|
||||||
|
#include <QDBusServiceWatcher>
|
||||||
#include <QOpenGLContext>
|
#include <QOpenGLContext>
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
@@ -40,10 +37,8 @@ DBusInterface::DBusInterface(QObject *parent)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_serviceName(QStringLiteral("org.kde.KWin"))
|
, m_serviceName(QStringLiteral("org.kde.KWin"))
|
||||||
{
|
{
|
||||||
(void)new KWinAdaptor(this);
|
|
||||||
|
|
||||||
QDBusConnection dbus = QDBusConnection::sessionBus();
|
QDBusConnection dbus = QDBusConnection::sessionBus();
|
||||||
dbus.registerObject(QStringLiteral("/KWin"), this);
|
dbus.registerObject(QStringLiteral("/KWin"), this, QDBusConnection::ExportScriptableSlots | QDBusConnection::ExportScriptableSignals | QDBusConnection::ExportScriptableProperties);
|
||||||
dbus.registerService(m_serviceName);
|
dbus.registerService(m_serviceName);
|
||||||
dbus.connect(QString(), QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reloadConfig"),
|
dbus.connect(QString(), QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reloadConfig"),
|
||||||
Workspace::self(), SLOT(slotReloadConfig()));
|
Workspace::self(), SLOT(slotReloadConfig()));
|
||||||
@@ -137,8 +132,7 @@ void DBusInterface::previousDesktop()
|
|||||||
|
|
||||||
void DBusInterface::showDebugConsole()
|
void DBusInterface::showDebugConsole()
|
||||||
{
|
{
|
||||||
DebugConsole *console = new DebugConsole;
|
// Debug console is intentionally disabled in the reduced Wayland-only build.
|
||||||
console->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBusInterface::replace()
|
void DBusInterface::replace()
|
||||||
@@ -262,7 +256,6 @@ CompositorDBusInterface::CompositorDBusInterface(Compositor *parent)
|
|||||||
, m_compositor(parent)
|
, m_compositor(parent)
|
||||||
{
|
{
|
||||||
connect(m_compositor, &Compositor::compositingToggled, this, &CompositorDBusInterface::compositingToggled);
|
connect(m_compositor, &Compositor::compositingToggled, this, &CompositorDBusInterface::compositingToggled);
|
||||||
new CompositingAdaptor(this);
|
|
||||||
QDBusConnection dbus = QDBusConnection::sessionBus();
|
QDBusConnection dbus = QDBusConnection::sessionBus();
|
||||||
dbus.registerObject(QStringLiteral("/Compositor"), this);
|
dbus.registerObject(QStringLiteral("/Compositor"), this);
|
||||||
dbus.connect(QString(), QStringLiteral("/Compositor"), QStringLiteral("org.kde.kwin.Compositing"),
|
dbus.connect(QString(), QStringLiteral("/Compositor"), QStringLiteral("org.kde.kwin.Compositing"),
|
||||||
@@ -343,7 +336,6 @@ VirtualDesktopManagerDBusInterface::VirtualDesktopManagerDBusInterface(VirtualDe
|
|||||||
qDBusRegisterMetaType<KWin::DBusDesktopDataStruct>();
|
qDBusRegisterMetaType<KWin::DBusDesktopDataStruct>();
|
||||||
qDBusRegisterMetaType<KWin::DBusDesktopDataVector>();
|
qDBusRegisterMetaType<KWin::DBusDesktopDataVector>();
|
||||||
|
|
||||||
new VirtualDesktopManagerAdaptor(this);
|
|
||||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/VirtualDesktopManager"),
|
QDBusConnection::sessionBus().registerObject(QStringLiteral("/VirtualDesktopManager"),
|
||||||
QStringLiteral("org.kde.KWin.VirtualDesktopManager"),
|
QStringLiteral("org.kde.KWin.VirtualDesktopManager"),
|
||||||
this);
|
this);
|
||||||
@@ -491,8 +483,6 @@ PluginManagerDBusInterface::PluginManagerDBusInterface(PluginManager *manager)
|
|||||||
: QObject(manager)
|
: QObject(manager)
|
||||||
, m_manager(manager)
|
, m_manager(manager)
|
||||||
{
|
{
|
||||||
new PluginsAdaptor(this);
|
|
||||||
|
|
||||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Plugins"),
|
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Plugins"),
|
||||||
QStringLiteral("org.kde.KWin.Plugins"),
|
QStringLiteral("org.kde.KWin.Plugins"),
|
||||||
this);
|
this);
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
#if KWIN_BUILD_QTQUICK
|
#if KWIN_BUILD_QTQUICK
|
||||||
#include "effect/offscreenquickview.h"
|
#include "effect/offscreenquickview.h"
|
||||||
#endif
|
#endif
|
||||||
#include "effectsadaptor.h"
|
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "input_event.h"
|
#include "input_event.h"
|
||||||
#include "inputmethod.h"
|
#include "inputmethod.h"
|
||||||
@@ -61,8 +60,10 @@
|
|||||||
#include <KDecoration3/Decoration>
|
#include <KDecoration3/Decoration>
|
||||||
#include <KDecoration3/DecorationSettings>
|
#include <KDecoration3/DecorationSettings>
|
||||||
|
|
||||||
|
#include <QDBusConnection>
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
#include <QMatrix4x4>
|
#include <QMatrix4x4>
|
||||||
|
#include <QMetaProperty>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QTimeLine>
|
#include <QTimeLine>
|
||||||
@@ -139,9 +140,6 @@ EffectsHandler::EffectsHandler(Compositor *compositor, WorkspaceScene *scene)
|
|||||||
effectsChanged();
|
effectsChanged();
|
||||||
});
|
});
|
||||||
m_effectLoader->setConfig(kwinApp()->config());
|
m_effectLoader->setConfig(kwinApp()->config());
|
||||||
new EffectsAdaptor(this);
|
|
||||||
QDBusConnection dbus = QDBusConnection::sessionBus();
|
|
||||||
dbus.registerObject(QStringLiteral("/Effects"), this);
|
|
||||||
|
|
||||||
connect(options, &Options::animationSpeedChanged, this, &EffectsHandler::reconfigureEffects);
|
connect(options, &Options::animationSpeedChanged, this, &EffectsHandler::reconfigureEffects);
|
||||||
|
|
||||||
|
|||||||
@@ -173,6 +173,10 @@ bool ScriptedEffectLoader::loadJavascriptEffect(const KPluginMetaData &effect)
|
|||||||
|
|
||||||
bool ScriptedEffectLoader::loadDeclarativeEffect(const KPluginMetaData &metadata)
|
bool ScriptedEffectLoader::loadDeclarativeEffect(const KPluginMetaData &metadata)
|
||||||
{
|
{
|
||||||
|
#if !KWIN_BUILD_QTQUICK
|
||||||
|
Q_UNUSED(metadata)
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
const QString name = metadata.pluginId();
|
const QString name = metadata.pluginId();
|
||||||
const QString scriptFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
|
const QString scriptFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
|
||||||
QLatin1String("kwin/effects/") + name + QLatin1String("/contents/ui/main.qml"));
|
QLatin1String("kwin/effects/") + name + QLatin1String("/contents/ui/main.qml"));
|
||||||
@@ -207,6 +211,7 @@ bool ScriptedEffectLoader::loadDeclarativeEffect(const KPluginMetaData &metadata
|
|||||||
Q_EMIT effectLoaded(effect, name);
|
Q_EMIT effectLoaded(effect, name);
|
||||||
m_loadedEffects << name;
|
m_loadedEffects << name;
|
||||||
return true;
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptedEffectLoader::queryAndLoadAll()
|
void ScriptedEffectLoader::queryAndLoadAll()
|
||||||
|
|||||||
@@ -54,11 +54,9 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
Q_IMPORT_PLUGIN(KWinIntegrationPlugin)
|
|
||||||
#if KWIN_BUILD_GLOBALSHORTCUTS
|
#if KWIN_BUILD_GLOBALSHORTCUTS
|
||||||
Q_IMPORT_PLUGIN(KGlobalAccelImpl)
|
Q_IMPORT_PLUGIN(KGlobalAccelImpl)
|
||||||
#endif
|
#endif
|
||||||
Q_IMPORT_PLUGIN(KWindowSystemKWinPlugin)
|
|
||||||
Q_IMPORT_PLUGIN(KWinIdleTimePoller)
|
Q_IMPORT_PLUGIN(KWinIdleTimePoller)
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
#include <QTimer>
|
||||||
#endif
|
#endif
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
@@ -50,6 +51,7 @@ void show(const QString &message, const QString &iconName, int timeout)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
if (QThread::currentThread() != qGuiApp->thread()) {
|
if (QThread::currentThread() != qGuiApp->thread()) {
|
||||||
QTimer::singleShot(0, QCoreApplication::instance(), [message, iconName, timeout] {
|
QTimer::singleShot(0, QCoreApplication::instance(), [message, iconName, timeout] {
|
||||||
show(message, iconName, timeout);
|
show(message, iconName, timeout);
|
||||||
@@ -62,6 +64,7 @@ void show(const QString &message, const QString &iconName, int timeout)
|
|||||||
notification->setMessage(message);
|
notification->setMessage(message);
|
||||||
notification->setTimeout(timeout);
|
notification->setTimeout(timeout);
|
||||||
notification->setVisible(true);
|
notification->setVisible(true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void show(const QString &message, int timeout)
|
void show(const QString &message, int timeout)
|
||||||
@@ -86,8 +89,10 @@ void hide(HideFlags flags)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
osd()->setSkipCloseAnimation(flags.testFlag(HideFlag::SkipCloseAnimation));
|
osd()->setSkipCloseAnimation(flags.testFlag(HideFlag::SkipCloseAnimation));
|
||||||
osd()->setVisible(false);
|
osd()->setVisible(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,8 +143,10 @@ OutlineVisual::~OutlineVisual()
|
|||||||
|
|
||||||
CompositedOutlineVisual::CompositedOutlineVisual(Outline *outline)
|
CompositedOutlineVisual::CompositedOutlineVisual(Outline *outline)
|
||||||
: OutlineVisual(outline)
|
: OutlineVisual(outline)
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
, m_qmlContext()
|
, m_qmlContext()
|
||||||
, m_qmlComponent()
|
, m_qmlComponent()
|
||||||
|
#endif
|
||||||
, m_mainItem()
|
, m_mainItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,10 @@
|
|||||||
#include <kwin_export.h>
|
#include <kwin_export.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
class QQmlContext;
|
class QQmlContext;
|
||||||
class QQmlComponent;
|
class QQmlComponent;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
@@ -139,8 +141,10 @@ public:
|
|||||||
void hide() override;
|
void hide() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
std::unique_ptr<QQmlContext> m_qmlContext;
|
std::unique_ptr<QQmlContext> m_qmlContext;
|
||||||
std::unique_ptr<QQmlComponent> m_qmlComponent;
|
std::unique_ptr<QQmlComponent> m_qmlComponent;
|
||||||
|
#endif
|
||||||
std::unique_ptr<QObject> m_mainItem;
|
std::unique_ptr<QObject> m_mainItem;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,8 +46,6 @@ function(kwin_add_script name source)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
add_subdirectory(idletime)
|
add_subdirectory(idletime)
|
||||||
add_subdirectory(qpa)
|
|
||||||
add_subdirectory(windowsystem)
|
|
||||||
|
|
||||||
if (KWIN_BUILD_EFFECTS)
|
if (KWIN_BUILD_EFFECTS)
|
||||||
add_subdirectory(private)
|
add_subdirectory(private)
|
||||||
@@ -124,9 +122,6 @@ endif()
|
|||||||
if (PipeWire_FOUND AND KWIN_BUILD_EFFECTS)
|
if (PipeWire_FOUND AND KWIN_BUILD_EFFECTS)
|
||||||
add_subdirectory(screencast)
|
add_subdirectory(screencast)
|
||||||
endif()
|
endif()
|
||||||
if (KWIN_BUILD_RUNNERS)
|
|
||||||
add_subdirectory(krunner-integration)
|
|
||||||
endif()
|
|
||||||
if(TARGET K::KGlobalAccelD)
|
if(TARGET K::KGlobalAccelD)
|
||||||
add_subdirectory(kglobalaccel)
|
add_subdirectory(kglobalaccel)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
File=rulesettings.kcfg
|
File=rulesettings.kcfg
|
||||||
IncludeFiles=\"rules.h\",netwm_def.h
|
IncludeFiles="rules.h",netwm_def.h
|
||||||
NameSpace=KWin
|
NameSpace=KWin
|
||||||
ClassName=RuleSettings
|
ClassName=RuleSettings
|
||||||
UseEnumTypes=true
|
UseEnumTypes=true
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "effect/quickeffect.h"
|
#include "effect/quickeffect.h"
|
||||||
|
|
||||||
#include <KConfigPropertyMap>
|
#include <KDeclarative/KConfigPropertyMap>
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
|||||||
@@ -41,15 +41,17 @@
|
|||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
// KDE
|
// KDE
|
||||||
#include <KConfigGroup>
|
#include <KConfigGroup>
|
||||||
#include <KConfigPropertyMap>
|
#if KWIN_BUILD_QTQUICK
|
||||||
|
#include <KDeclarative/KConfigPropertyMap>
|
||||||
|
#endif
|
||||||
#include <KGlobalAccel>
|
#include <KGlobalAccel>
|
||||||
#include <KLocalizedContext>
|
#include <KLocalizedContext>
|
||||||
#include <KLocalizedQmlContext>
|
|
||||||
#include <KPackage/PackageLoader>
|
#include <KPackage/PackageLoader>
|
||||||
// Qt
|
// Qt
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
#include <QDBusPendingCallWatcher>
|
#include <QDBusPendingCallWatcher>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QFile>
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
@@ -59,7 +61,6 @@
|
|||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QtConcurrentRun>
|
#include <QtConcurrentRun>
|
||||||
|
|
||||||
#include "scriptadaptor.h"
|
|
||||||
|
|
||||||
static QRect scriptValueToRect(const QJSValue &value)
|
static QRect scriptValueToRect(const QJSValue &value)
|
||||||
{
|
{
|
||||||
@@ -112,8 +113,6 @@ KWin::AbstractScript::AbstractScript(int id, QString scriptName, QString pluginN
|
|||||||
m_pluginName = scriptName;
|
m_pluginName = scriptName;
|
||||||
}
|
}
|
||||||
|
|
||||||
new ScriptAdaptor(this);
|
|
||||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Scripting/Script") + QString::number(scriptId()), this, QDBusConnection::ExportAdaptors);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KWin::AbstractScript::~AbstractScript()
|
KWin::AbstractScript::~AbstractScript()
|
||||||
@@ -566,6 +565,7 @@ QAction *KWin::Script::createMenu(const QString &title, const QJSValue &items, Q
|
|||||||
return menu->menuAction();
|
return menu->menuAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
KWin::DeclarativeScript::DeclarativeScript(int id, QString scriptName, QString pluginName, QObject *parent)
|
KWin::DeclarativeScript::DeclarativeScript(int id, QString scriptName, QString pluginName, QObject *parent)
|
||||||
: AbstractScript(id, scriptName, pluginName, parent)
|
: AbstractScript(id, scriptName, pluginName, parent)
|
||||||
, m_context(new QQmlContext(Scripting::self()->declarativeScriptSharedContext(), this))
|
, m_context(new QQmlContext(Scripting::self()->declarativeScriptSharedContext(), this))
|
||||||
@@ -603,8 +603,9 @@ void KWin::DeclarativeScript::createComponent()
|
|||||||
}
|
}
|
||||||
setRunning(true);
|
setRunning(true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
KWin::JSEngineGlobalMethodsWrapper::JSEngineGlobalMethodsWrapper(KWin::DeclarativeScript *parent)
|
KWin::JSEngineGlobalMethodsWrapper::JSEngineGlobalMethodsWrapper(KWin::AbstractScript *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_script(parent)
|
, m_script(parent)
|
||||||
{
|
{
|
||||||
@@ -636,7 +637,9 @@ KWin::Scripting::Scripting(QObject *parent)
|
|||||||
, m_workspaceWrapper(new QtScriptWorkspaceWrapper(this))
|
, m_workspaceWrapper(new QtScriptWorkspaceWrapper(this))
|
||||||
{
|
{
|
||||||
m_qmlEngine->setProperty("_kirigamiTheme", QStringLiteral("KirigamiPlasmaStyle"));
|
m_qmlEngine->setProperty("_kirigamiTheme", QStringLiteral("KirigamiPlasmaStyle"));
|
||||||
m_qmlEngine->rootContext()->setContextObject(new KLocalizedQmlContext(m_qmlEngine));
|
#if KWIN_BUILD_QTQUICK
|
||||||
|
m_qmlEngine->rootContext()->setContextObject(new KLocalizedContext(m_qmlEngine));
|
||||||
|
#endif
|
||||||
init();
|
init();
|
||||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Scripting"), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportScriptableInvokables);
|
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Scripting"), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportScriptableInvokables);
|
||||||
connect(Workspace::self(), &Workspace::configChanged, this, &Scripting::start);
|
connect(Workspace::self(), &Workspace::configChanged, this, &Scripting::start);
|
||||||
@@ -670,7 +673,9 @@ void KWin::Scripting::init()
|
|||||||
});
|
});
|
||||||
qmlRegisterSingletonInstance("org.kde.kwin", 3, 0, "Options", options);
|
qmlRegisterSingletonInstance("org.kde.kwin", 3, 0, "Options", options);
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
qmlRegisterAnonymousType<KConfigPropertyMap>("org.kde.kwin", 3);
|
qmlRegisterAnonymousType<KConfigPropertyMap>("org.kde.kwin", 3);
|
||||||
|
#endif
|
||||||
qmlRegisterAnonymousType<KWin::Output>("org.kde.kwin", 3);
|
qmlRegisterAnonymousType<KWin::Output>("org.kde.kwin", 3);
|
||||||
qmlRegisterAnonymousType<KWin::Window>("org.kde.kwin", 3);
|
qmlRegisterAnonymousType<KWin::Window>("org.kde.kwin", 3);
|
||||||
qmlRegisterAnonymousType<KWin::VirtualDesktop>("org.kde.kwin", 3);
|
qmlRegisterAnonymousType<KWin::VirtualDesktop>("org.kde.kwin", 3);
|
||||||
@@ -697,7 +702,9 @@ void KWin::Scripting::start()
|
|||||||
if (it->first) {
|
if (it->first) {
|
||||||
loadScript(it->second.first, it->second.second);
|
loadScript(it->second.first, it->second.second);
|
||||||
} else {
|
} else {
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
loadDeclarativeScript(it->second.first, it->second.second);
|
loadDeclarativeScript(it->second.first, it->second.second);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -764,7 +771,9 @@ void KWin::Scripting::slotScriptsQueried()
|
|||||||
if (it->first) {
|
if (it->first) {
|
||||||
loadScript(it->second.first, it->second.second);
|
loadScript(it->second.first, it->second.second);
|
||||||
} else {
|
} else {
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
loadDeclarativeScript(it->second.first, it->second.second);
|
loadDeclarativeScript(it->second.first, it->second.second);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,6 +836,7 @@ int KWin::Scripting::loadScript(const QString &filePath, const QString &pluginNa
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
int KWin::Scripting::loadDeclarativeScript(const QString &filePath, const QString &pluginName)
|
int KWin::Scripting::loadDeclarativeScript(const QString &filePath, const QString &pluginName)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(m_scriptsLock.get());
|
QMutexLocker locker(m_scriptsLock.get());
|
||||||
@@ -839,6 +849,7 @@ int KWin::Scripting::loadDeclarativeScript(const QString &filePath, const QStrin
|
|||||||
scripts.append(script);
|
scripts.append(script);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
KWin::Scripting::~Scripting()
|
KWin::Scripting::~Scripting()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,9 +22,11 @@
|
|||||||
#include <QDBusContext>
|
#include <QDBusContext>
|
||||||
#include <QDBusMessage>
|
#include <QDBusMessage>
|
||||||
|
|
||||||
class QQmlComponent;
|
|
||||||
class QQmlContext;
|
class QQmlContext;
|
||||||
class QQmlEngine;
|
class QQmlEngine;
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
|
class QQmlComponent;
|
||||||
|
#endif
|
||||||
class QAction;
|
class QAction;
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class QRecursiveMutex;
|
class QRecursiveMutex;
|
||||||
@@ -249,6 +251,7 @@ private:
|
|||||||
QJSValueList m_userActionsMenuCallbacks;
|
QJSValueList m_userActionsMenuCallbacks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
class DeclarativeScript : public AbstractScript
|
class DeclarativeScript : public AbstractScript
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -266,6 +269,7 @@ private:
|
|||||||
QQmlContext *m_context;
|
QQmlContext *m_context;
|
||||||
QQmlComponent *m_component;
|
QQmlComponent *m_component;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
class JSEngineGlobalMethodsWrapper : public QObject
|
class JSEngineGlobalMethodsWrapper : public QObject
|
||||||
{
|
{
|
||||||
@@ -293,14 +297,14 @@ public:
|
|||||||
ScreenArea
|
ScreenArea
|
||||||
};
|
};
|
||||||
Q_ENUM(ClientAreaOption)
|
Q_ENUM(ClientAreaOption)
|
||||||
explicit JSEngineGlobalMethodsWrapper(DeclarativeScript *parent);
|
explicit JSEngineGlobalMethodsWrapper(AbstractScript *parent);
|
||||||
~JSEngineGlobalMethodsWrapper() override;
|
~JSEngineGlobalMethodsWrapper() override;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
QVariant readConfig(const QString &key, QVariant defaultValue = QVariant());
|
QVariant readConfig(const QString &key, QVariant defaultValue = QVariant());
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeclarativeScript *m_script;
|
AbstractScript *m_script;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -325,7 +329,9 @@ private:
|
|||||||
public:
|
public:
|
||||||
~Scripting() override;
|
~Scripting() override;
|
||||||
Q_SCRIPTABLE Q_INVOKABLE int loadScript(const QString &filePath, const QString &pluginName = QString());
|
Q_SCRIPTABLE Q_INVOKABLE int loadScript(const QString &filePath, const QString &pluginName = QString());
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
Q_SCRIPTABLE Q_INVOKABLE int loadDeclarativeScript(const QString &filePath, const QString &pluginName = QString());
|
Q_SCRIPTABLE Q_INVOKABLE int loadDeclarativeScript(const QString &filePath, const QString &pluginName = QString());
|
||||||
|
#endif
|
||||||
Q_SCRIPTABLE Q_INVOKABLE bool isScriptLoaded(const QString &pluginName) const;
|
Q_SCRIPTABLE Q_INVOKABLE bool isScriptLoaded(const QString &pluginName) const;
|
||||||
Q_SCRIPTABLE Q_INVOKABLE bool unloadScript(const QString &pluginName);
|
Q_SCRIPTABLE Q_INVOKABLE bool unloadScript(const QString &pluginName);
|
||||||
|
|
||||||
@@ -340,8 +346,10 @@ public:
|
|||||||
|
|
||||||
QQmlEngine *qmlEngine() const;
|
QQmlEngine *qmlEngine() const;
|
||||||
QQmlEngine *qmlEngine();
|
QQmlEngine *qmlEngine();
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
QQmlContext *declarativeScriptSharedContext() const;
|
QQmlContext *declarativeScriptSharedContext() const;
|
||||||
QQmlContext *declarativeScriptSharedContext();
|
QQmlContext *declarativeScriptSharedContext();
|
||||||
|
#endif
|
||||||
QtScriptWorkspaceWrapper *workspaceWrapper() const;
|
QtScriptWorkspaceWrapper *workspaceWrapper() const;
|
||||||
|
|
||||||
AbstractScript *findScript(const QString &pluginName) const;
|
AbstractScript *findScript(const QString &pluginName) const;
|
||||||
@@ -375,6 +383,7 @@ inline QQmlEngine *Scripting::qmlEngine()
|
|||||||
return m_qmlEngine;
|
return m_qmlEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
inline QQmlContext *Scripting::declarativeScriptSharedContext() const
|
inline QQmlContext *Scripting::declarativeScriptSharedContext() const
|
||||||
{
|
{
|
||||||
return m_declarativeScriptSharedContext;
|
return m_declarativeScriptSharedContext;
|
||||||
@@ -384,6 +393,7 @@ inline QQmlContext *Scripting::declarativeScriptSharedContext()
|
|||||||
{
|
{
|
||||||
return m_declarativeScriptSharedContext;
|
return m_declarativeScriptSharedContext;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
inline QtScriptWorkspaceWrapper *Scripting::workspaceWrapper() const
|
inline QtScriptWorkspaceWrapper *Scripting::workspaceWrapper() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ File=kwin.kcfg
|
|||||||
NameSpace=KWin
|
NameSpace=KWin
|
||||||
ClassName=Settings
|
ClassName=Settings
|
||||||
# options.h is needed for FocusPolicy and PlacementPolicy
|
# options.h is needed for FocusPolicy and PlacementPolicy
|
||||||
IncludeFiles=\"options.h\"
|
IncludeFiles="options.h"
|
||||||
UseEnumTypes=true
|
UseEnumTypes=true
|
||||||
|
|||||||
@@ -31,7 +31,8 @@
|
|||||||
#include <KService>
|
#include <KService>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "sessionadaptor.h"
|
#include <QDBusConnection>
|
||||||
|
#include <QDBusMessage>
|
||||||
|
|
||||||
using namespace Qt::StringLiterals;
|
using namespace Qt::StringLiterals;
|
||||||
|
|
||||||
@@ -355,7 +356,6 @@ SessionInfo *SessionManager::takeSessionInfo(X11Window *c)
|
|||||||
SessionManager::SessionManager(QObject *parent)
|
SessionManager::SessionManager(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
new SessionAdaptor(this);
|
|
||||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Session"), this);
|
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Session"), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,8 @@
|
|||||||
|
|
||||||
#include "tabletmodemanager.h"
|
#include "tabletmodemanager.h"
|
||||||
|
|
||||||
#include "backends/libinput/device.h"
|
|
||||||
#include "core/inputdevice.h"
|
#include "core/inputdevice.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "input_event.h"
|
|
||||||
#include "input_event_spy.h"
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "wayland_server.h"
|
#include "wayland_server.h"
|
||||||
|
|
||||||
@@ -21,99 +18,8 @@
|
|||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
static bool blocksTabletMode(InputDevice *device)
|
|
||||||
{
|
|
||||||
if (auto libinputDevice = qobject_cast<LibInput::Device *>(device)) {
|
|
||||||
bool ignore = false;
|
|
||||||
if (auto udev = libinput_device_get_udev_device(libinputDevice->device()); udev) {
|
|
||||||
ignore = udev_device_has_tag(udev, "kwin-ignore-tablet-mode");
|
|
||||||
udev_device_unref(udev);
|
|
||||||
}
|
|
||||||
return !ignore;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
class TabletModeSwitchEventSpy : public QObject, public InputEventSpy
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit TabletModeSwitchEventSpy(TabletModeManager *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
, m_parent(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void switchEvent(SwitchEvent *event) override
|
|
||||||
{
|
|
||||||
if (!event->device->isTabletModeSwitch()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (event->state) {
|
|
||||||
case SwitchState::Off:
|
|
||||||
m_parent->setIsTablet(false);
|
|
||||||
break;
|
|
||||||
case SwitchState::On:
|
|
||||||
m_parent->setIsTablet(true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Q_UNREACHABLE();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
TabletModeManager *const m_parent;
|
|
||||||
};
|
|
||||||
|
|
||||||
class TabletModeTouchpadRemovedSpy : public QObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit TabletModeTouchpadRemovedSpy(TabletModeManager *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
, m_parent(parent)
|
|
||||||
{
|
|
||||||
connect(input(), &InputRedirection::deviceAdded, this, &TabletModeTouchpadRemovedSpy::refresh);
|
|
||||||
connect(input(), &InputRedirection::deviceRemoved, this, &TabletModeTouchpadRemovedSpy::refresh);
|
|
||||||
|
|
||||||
check();
|
|
||||||
}
|
|
||||||
|
|
||||||
void refresh(InputDevice *inputDevice)
|
|
||||||
{
|
|
||||||
if (inputDevice->isTouch() || inputDevice->isPointer()) {
|
|
||||||
check();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void check()
|
|
||||||
{
|
|
||||||
const auto devices = input()->devices();
|
|
||||||
const bool hasTouch = std::any_of(devices.constBegin(), devices.constEnd(), [](InputDevice *device) {
|
|
||||||
return device->isTouch() && blocksTabletMode(device);
|
|
||||||
});
|
|
||||||
m_parent->setTabletModeAvailable(hasTouch);
|
|
||||||
|
|
||||||
const bool hasPointer = std::any_of(devices.constBegin(), devices.constEnd(), [](InputDevice *device) {
|
|
||||||
return device->isPointer() && blocksTabletMode(device);
|
|
||||||
});
|
|
||||||
m_parent->setIsTablet(hasTouch && !hasPointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
TabletModeManager *const m_parent;
|
|
||||||
};
|
|
||||||
|
|
||||||
TabletModeManager::TabletModeManager()
|
TabletModeManager::TabletModeManager()
|
||||||
{
|
{
|
||||||
if (waylandServer()) {
|
|
||||||
if (input()->hasTabletModeSwitch()) {
|
|
||||||
input()->installInputEventSpy(new TabletModeSwitchEventSpy(this));
|
|
||||||
} else {
|
|
||||||
hasTabletModeInputChanged(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
KSharedConfig::Ptr kwinSettings = kwinApp()->config();
|
KSharedConfig::Ptr kwinSettings = kwinApp()->config();
|
||||||
m_settingsWatcher = KConfigWatcher::create(kwinSettings);
|
m_settingsWatcher = KConfigWatcher::create(kwinSettings);
|
||||||
connect(m_settingsWatcher.data(), &KConfigWatcher::configChanged, this, &KWin::TabletModeManager::refreshSettings);
|
connect(m_settingsWatcher.data(), &KConfigWatcher::configChanged, this, &KWin::TabletModeManager::refreshSettings);
|
||||||
@@ -125,9 +31,8 @@ TabletModeManager::TabletModeManager()
|
|||||||
// NOTE: slots must be exported for properties to work correctly
|
// NOTE: slots must be exported for properties to work correctly
|
||||||
QDBusConnection::ExportAllProperties | QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllSlots);
|
QDBusConnection::ExportAllProperties | QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllSlots);
|
||||||
|
|
||||||
if (waylandServer()) {
|
setTabletModeAvailable(false);
|
||||||
connect(input(), &InputRedirection::hasTabletModeSwitchChanged, this, &TabletModeManager::hasTabletModeInputChanged);
|
setIsTablet(false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KWin::TabletModeManager::refreshSettings()
|
void KWin::TabletModeManager::refreshSettings()
|
||||||
@@ -153,17 +58,9 @@ void KWin::TabletModeManager::refreshSettings()
|
|||||||
|
|
||||||
void KWin::TabletModeManager::hasTabletModeInputChanged(bool set)
|
void KWin::TabletModeManager::hasTabletModeInputChanged(bool set)
|
||||||
{
|
{
|
||||||
if (set) {
|
Q_UNUSED(set)
|
||||||
input()->installInputEventSpy(new TabletModeSwitchEventSpy(this));
|
setTabletModeAvailable(false);
|
||||||
setTabletModeAvailable(true);
|
setIsTablet(false);
|
||||||
} else {
|
|
||||||
auto spy = new TabletModeTouchpadRemovedSpy(this);
|
|
||||||
connect(input(), &InputRedirection::hasTabletModeSwitchChanged, spy, [spy](bool set) {
|
|
||||||
if (set) {
|
|
||||||
spy->deleteLater();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TabletModeManager::isTabletModeAvailable() const
|
bool TabletModeManager::isTabletModeAvailable() const
|
||||||
|
|||||||
@@ -48,7 +48,13 @@
|
|||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QKeySequenceEdit>
|
||||||
|
#include <QLabel>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QToolButton>
|
||||||
|
#include <QVBoxLayout>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
|
|
||||||
#include <KGlobalAccel>
|
#include <KGlobalAccel>
|
||||||
@@ -764,16 +770,35 @@ void UserActionsMenu::slotWindowOperation(QAction *action)
|
|||||||
ShortcutDialog::ShortcutDialog(const QKeySequence &cut)
|
ShortcutDialog::ShortcutDialog(const QKeySequence &cut)
|
||||||
: _shortcut(cut)
|
: _shortcut(cut)
|
||||||
{
|
{
|
||||||
m_ui.setupUi(this);
|
auto *layout = new QVBoxLayout(this);
|
||||||
m_ui.keySequenceEdit->setKeySequence(cut);
|
|
||||||
m_ui.warning->hide();
|
m_keySequenceEdit = new QKeySequenceEdit(this);
|
||||||
|
m_keySequenceEdit->setKeySequence(cut);
|
||||||
|
layout->addWidget(m_keySequenceEdit);
|
||||||
|
|
||||||
|
m_warning = new QLabel(this);
|
||||||
|
m_warning->hide();
|
||||||
|
layout->addWidget(m_warning);
|
||||||
|
|
||||||
|
auto *actionsLayout = new QHBoxLayout();
|
||||||
|
m_clearButton = new QToolButton(this);
|
||||||
|
m_clearButton->setText(i18nc("@action:button", "Clear"));
|
||||||
|
actionsLayout->addWidget(m_clearButton);
|
||||||
|
actionsLayout->addStretch(1);
|
||||||
|
layout->addLayout(actionsLayout);
|
||||||
|
|
||||||
|
m_buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
||||||
|
layout->addWidget(m_buttonBox);
|
||||||
|
|
||||||
|
connect(m_buttonBox, &QDialogButtonBox::accepted, this, &ShortcutDialog::accept);
|
||||||
|
connect(m_buttonBox, &QDialogButtonBox::rejected, this, &ShortcutDialog::reject);
|
||||||
|
|
||||||
// Listen to changed shortcuts
|
// Listen to changed shortcuts
|
||||||
connect(m_ui.keySequenceEdit, &QKeySequenceEdit::editingFinished, this, &ShortcutDialog::keySequenceChanged);
|
connect(m_keySequenceEdit, &QKeySequenceEdit::editingFinished, this, &ShortcutDialog::keySequenceChanged);
|
||||||
connect(m_ui.clearButton, &QToolButton::clicked, this, [this] {
|
connect(m_clearButton, &QToolButton::clicked, this, [this] {
|
||||||
_shortcut = QKeySequence();
|
_shortcut = QKeySequence();
|
||||||
});
|
});
|
||||||
m_ui.keySequenceEdit->setFocus();
|
m_keySequenceEdit->setFocus();
|
||||||
|
|
||||||
setWindowFlags(Qt::Popup | Qt::X11BypassWindowManagerHint);
|
setWindowFlags(Qt::Popup | Qt::X11BypassWindowManagerHint);
|
||||||
}
|
}
|
||||||
@@ -788,7 +813,7 @@ void ShortcutDialog::accept()
|
|||||||
}
|
}
|
||||||
if (seq[0] == QKeyCombination(Qt::Key_Space) || seq[0].keyboardModifiers() == Qt::NoModifier) {
|
if (seq[0] == QKeyCombination(Qt::Key_Space) || seq[0].keyboardModifiers() == Qt::NoModifier) {
|
||||||
// clear
|
// clear
|
||||||
m_ui.keySequenceEdit->clear();
|
m_keySequenceEdit->clear();
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -805,7 +830,7 @@ void ShortcutDialog::done(int r)
|
|||||||
void ShortcutDialog::keySequenceChanged()
|
void ShortcutDialog::keySequenceChanged()
|
||||||
{
|
{
|
||||||
activateWindow(); // where is the kbd focus lost? cause of popup state?
|
activateWindow(); // where is the kbd focus lost? cause of popup state?
|
||||||
QKeySequence seq = m_ui.keySequenceEdit->keySequence();
|
QKeySequence seq = m_keySequenceEdit->keySequence();
|
||||||
if (_shortcut == seq) {
|
if (_shortcut == seq) {
|
||||||
return; // don't try to update the same
|
return; // don't try to update the same
|
||||||
}
|
}
|
||||||
@@ -816,7 +841,7 @@ void ShortcutDialog::keySequenceChanged()
|
|||||||
}
|
}
|
||||||
if (seq.count() > 1) {
|
if (seq.count() > 1) {
|
||||||
seq = QKeySequence(seq[0]);
|
seq = QKeySequence(seq[0]);
|
||||||
m_ui.keySequenceEdit->setKeySequence(seq);
|
m_keySequenceEdit->setKeySequence(seq);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the key sequence is used currently
|
// Check if the key sequence is used currently
|
||||||
@@ -825,15 +850,15 @@ void ShortcutDialog::keySequenceChanged()
|
|||||||
QList<KGlobalShortcutInfo> conflicting = KGlobalAccel::globalShortcutsByKey(seq);
|
QList<KGlobalShortcutInfo> conflicting = KGlobalAccel::globalShortcutsByKey(seq);
|
||||||
if (!conflicting.isEmpty()) {
|
if (!conflicting.isEmpty()) {
|
||||||
const KGlobalShortcutInfo &conflict = conflicting.at(0);
|
const KGlobalShortcutInfo &conflict = conflicting.at(0);
|
||||||
m_ui.warning->setText(i18nc("'%1' is a keyboard shortcut like 'ctrl+w'",
|
m_warning->setText(i18nc("'%1' is a keyboard shortcut like 'ctrl+w'",
|
||||||
"<b>%1</b> is already in use", sc));
|
"<b>%1</b> is already in use", sc));
|
||||||
m_ui.warning->setToolTip(i18nc("keyboard shortcut '%1' is used by action '%2' in application '%3'",
|
m_warning->setToolTip(i18nc("keyboard shortcut '%1' is used by action '%2' in application '%3'",
|
||||||
"<b>%1</b> is used by %2 in %3", sc, conflict.friendlyName(), conflict.componentFriendlyName()));
|
"<b>%1</b> is used by %2 in %3", sc, conflict.friendlyName(), conflict.componentFriendlyName()));
|
||||||
m_ui.warning->show();
|
m_warning->show();
|
||||||
m_ui.keySequenceEdit->setKeySequence(shortcut());
|
m_keySequenceEdit->setKeySequence(shortcut());
|
||||||
} else if (seq != _shortcut) {
|
} else if (seq != _shortcut) {
|
||||||
m_ui.warning->hide();
|
m_warning->hide();
|
||||||
if (QPushButton *ok = m_ui.buttonBox->button(QDialogButtonBox::Ok)) {
|
if (QPushButton *ok = m_buttonBox->button(QDialogButtonBox::Ok)) {
|
||||||
ok->setFocus();
|
ok->setFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,6 @@
|
|||||||
SPDX-License-Identifier: GPL-2.0-or-later
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "ui_shortcutdialog.h"
|
|
||||||
|
|
||||||
#include "effect/globals.h"
|
#include "effect/globals.h"
|
||||||
|
|
||||||
// Qt
|
// Qt
|
||||||
@@ -17,7 +15,11 @@
|
|||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
class QAction;
|
class QAction;
|
||||||
|
class QLabel;
|
||||||
|
class QDialogButtonBox;
|
||||||
|
class QKeySequenceEdit;
|
||||||
class QRect;
|
class QRect;
|
||||||
|
class QToolButton;
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
@@ -227,7 +229,10 @@ protected:
|
|||||||
void done(int r) override;
|
void done(int r) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ShortcutDialog m_ui;
|
QKeySequenceEdit *m_keySequenceEdit = nullptr;
|
||||||
|
QLabel *m_warning = nullptr;
|
||||||
|
QToolButton *m_clearButton = nullptr;
|
||||||
|
QDialogButtonBox *m_buttonBox = nullptr;
|
||||||
QKeySequence _shortcut;
|
QKeySequence _shortcut;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -78,14 +78,18 @@ RamFile::RamFile(const char *name, const void *inData, int size, RamFile::Flags
|
|||||||
m_tmp->unmap(data);
|
m_tmp->unmap(data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(F_SEAL_SHRINK) && defined(F_SEAL_GROW) && defined(F_SEAL_SEAL) && defined(F_ADD_SEALS)
|
||||||
int seals = F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_SEAL;
|
int seals = F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_SEAL;
|
||||||
if (flags.testFlag(RamFile::Flag::SealWrite)) {
|
if (flags.testFlag(RamFile::Flag::SealWrite)) {
|
||||||
|
#if defined(F_SEAL_WRITE)
|
||||||
seals |= F_SEAL_WRITE;
|
seals |= F_SEAL_WRITE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// This can fail for QTemporaryFile based on the underlying file system.
|
// This can fail for QTemporaryFile based on the underlying file system.
|
||||||
if (fcntl(fd(), F_ADD_SEALS, seals) != 0) {
|
if (fcntl(fd(), F_ADD_SEALS, seals) != 0) {
|
||||||
qCDebug(KWIN_CORE).nospace() << name << ": Failed to seal RamFile: " << strerror(errno);
|
qCDebug(KWIN_CORE).nospace() << name << ": Failed to seal RamFile: " << strerror(errno);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
guard.dismiss();
|
guard.dismiss();
|
||||||
}
|
}
|
||||||
@@ -137,12 +141,16 @@ RamFile::Flags RamFile::effectiveFlags() const
|
|||||||
{
|
{
|
||||||
Flags flags = {};
|
Flags flags = {};
|
||||||
|
|
||||||
|
#if defined(F_GET_SEALS) && defined(F_SEAL_WRITE)
|
||||||
const int seals = fcntl(fd(), F_GET_SEALS);
|
const int seals = fcntl(fd(), F_GET_SEALS);
|
||||||
if (seals > 0) {
|
if (seals > 0) {
|
||||||
if (seals & F_SEAL_WRITE) {
|
if (seals & F_SEAL_WRITE) {
|
||||||
flags.setFlag(Flag::SealWrite);
|
flags.setFlag(Flag::SealWrite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
flags = m_flags;
|
||||||
|
#endif
|
||||||
|
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ SecurityContext::~SecurityContext()
|
|||||||
|
|
||||||
void SecurityContext::onListenFdActivated(QSocketDescriptor socketDescriptor)
|
void SecurityContext::onListenFdActivated(QSocketDescriptor socketDescriptor)
|
||||||
{
|
{
|
||||||
const int clientFd = accept4(socketDescriptor, nullptr, nullptr, SOCK_CLOEXEC);
|
const int clientFd = accept(socketDescriptor, nullptr, nullptr);
|
||||||
if (clientFd < 0) {
|
if (clientFd < 0) {
|
||||||
qCWarning(KWIN_CORE) << "Failed to accept client from security listen FD:" << strerror(errno);
|
qCWarning(KWIN_CORE) << "Failed to accept client from security listen FD:" << strerror(errno);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
#include "wayland/plasmawindowmanagement.h"
|
#include "wayland/plasmawindowmanagement.h"
|
||||||
#include "wayland/surface.h"
|
#include "wayland/surface.h"
|
||||||
#include "wayland_server.h"
|
#include "wayland_server.h"
|
||||||
|
|
||||||
|
#include <KLocalizedString>
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
|
||||||
#include <KDecoration3/DecoratedWindow>
|
#include <KDecoration3/DecoratedWindow>
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
SPDX-License-Identifier: GPL-2.0-or-later
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
#include "xkb.h"
|
#include "xkb.h"
|
||||||
#include "dbusproperties_interface.h"
|
|
||||||
#include "inputmethod.h"
|
#include "inputmethod.h"
|
||||||
#include "utils/c_ptr.h"
|
#include "utils/c_ptr.h"
|
||||||
#include "utils/common.h"
|
#include "utils/common.h"
|
||||||
@@ -18,8 +17,9 @@
|
|||||||
#include <KConfigGroup>
|
#include <KConfigGroup>
|
||||||
// Qt
|
// Qt
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QDBusInterface>
|
||||||
|
#include <QDBusReply>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
#include <QtGui/private/qxkbcommon_p.h>
|
|
||||||
// xkbcommon
|
// xkbcommon
|
||||||
#include <xkbcommon/xkbcommon-compose.h>
|
#include <xkbcommon/xkbcommon-compose.h>
|
||||||
#include <xkbcommon/xkbcommon-keysyms.h>
|
#include <xkbcommon/xkbcommon-keysyms.h>
|
||||||
@@ -406,6 +406,80 @@ static const TransKey g_rgSymXToQT[] = {
|
|||||||
{ XKB_KEY_XF86LaunchE, Qt::Key_LaunchE },
|
{ XKB_KEY_XF86LaunchE, Qt::Key_LaunchE },
|
||||||
{ XKB_KEY_XF86LaunchF, Qt::Key_LaunchF },
|
{ XKB_KEY_XF86LaunchF, Qt::Key_LaunchF },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool isLatin1Keysym(xkb_keysym_t sym)
|
||||||
|
{
|
||||||
|
return sym >= 0x20 && sym <= 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool isKeypadKeysym(xkb_keysym_t sym)
|
||||||
|
{
|
||||||
|
switch (sym) {
|
||||||
|
case XKB_KEY_KP_Space:
|
||||||
|
case XKB_KEY_KP_Tab:
|
||||||
|
case XKB_KEY_KP_Enter:
|
||||||
|
case XKB_KEY_KP_F1:
|
||||||
|
case XKB_KEY_KP_F2:
|
||||||
|
case XKB_KEY_KP_F3:
|
||||||
|
case XKB_KEY_KP_F4:
|
||||||
|
case XKB_KEY_KP_Home:
|
||||||
|
case XKB_KEY_KP_Left:
|
||||||
|
case XKB_KEY_KP_Up:
|
||||||
|
case XKB_KEY_KP_Right:
|
||||||
|
case XKB_KEY_KP_Down:
|
||||||
|
case XKB_KEY_KP_Prior:
|
||||||
|
case XKB_KEY_KP_Next:
|
||||||
|
case XKB_KEY_KP_End:
|
||||||
|
case XKB_KEY_KP_Begin:
|
||||||
|
case XKB_KEY_KP_Insert:
|
||||||
|
case XKB_KEY_KP_Delete:
|
||||||
|
case XKB_KEY_KP_Equal:
|
||||||
|
case XKB_KEY_KP_Multiply:
|
||||||
|
case XKB_KEY_KP_Add:
|
||||||
|
case XKB_KEY_KP_Separator:
|
||||||
|
case XKB_KEY_KP_Subtract:
|
||||||
|
case XKB_KEY_KP_Decimal:
|
||||||
|
case XKB_KEY_KP_Divide:
|
||||||
|
case XKB_KEY_KP_0:
|
||||||
|
case XKB_KEY_KP_1:
|
||||||
|
case XKB_KEY_KP_2:
|
||||||
|
case XKB_KEY_KP_3:
|
||||||
|
case XKB_KEY_KP_4:
|
||||||
|
case XKB_KEY_KP_5:
|
||||||
|
case XKB_KEY_KP_6:
|
||||||
|
case XKB_KEY_KP_7:
|
||||||
|
case XKB_KEY_KP_8:
|
||||||
|
case XKB_KEY_KP_9:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void convertCase(xkb_keysym_t sym, xkb_keysym_t *lower, xkb_keysym_t *upper)
|
||||||
|
{
|
||||||
|
if (lower) {
|
||||||
|
*lower = xkb_keysym_to_lower(sym);
|
||||||
|
}
|
||||||
|
if (upper) {
|
||||||
|
*upper = xkb_keysym_to_upper(sym);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int keysymToQtKeyLocal(xkb_keysym_t keysym)
|
||||||
|
{
|
||||||
|
for (const TransKey &tk : g_rgSymXToQT) {
|
||||||
|
if (tk.keySymX == keysym) {
|
||||||
|
return tk.keySymQt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isLatin1Keysym(keysym)) {
|
||||||
|
return int(keysym);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Qt::Key_unknown;
|
||||||
|
}
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
static void xkbLogHandler(xkb_context *context, xkb_log_level priority, const char *format, va_list args)
|
static void xkbLogHandler(xkb_context *context, xkb_log_level priority, const char *format, va_list args)
|
||||||
@@ -614,8 +688,9 @@ xkb_keymap *Xkb::loadDefaultKeymap()
|
|||||||
|
|
||||||
xkb_keymap *Xkb::loadKeymapFromLocale1()
|
xkb_keymap *Xkb::loadKeymapFromLocale1()
|
||||||
{
|
{
|
||||||
OrgFreedesktopDBusPropertiesInterface locale1Properties(s_locale1Interface, "/org/freedesktop/locale1", QDBusConnection::systemBus(), this);
|
QDBusInterface locale1Properties(s_locale1Interface, "/org/freedesktop/locale1", s_locale1Interface, QDBusConnection::systemBus(), this);
|
||||||
const QVariantMap properties = locale1Properties.GetAll(s_locale1Interface);
|
QDBusReply<QVariantMap> reply = locale1Properties.call(QStringLiteral("GetAll"), QString::fromLatin1(s_locale1Interface));
|
||||||
|
const QVariantMap properties = reply.isValid() ? reply.value() : QVariantMap{};
|
||||||
|
|
||||||
const QByteArray model = properties["X11Model"].toByteArray();
|
const QByteArray model = properties["X11Model"].toByteArray();
|
||||||
const QByteArray layout = properties["X11Layout"].toByteArray();
|
const QByteArray layout = properties["X11Layout"].toByteArray();
|
||||||
@@ -965,7 +1040,9 @@ Qt::Key Xkb::toQtKey(xkb_keysym_t keySym,
|
|||||||
Qt::KeyboardModifiers modifiers) const
|
Qt::KeyboardModifiers modifiers) const
|
||||||
{
|
{
|
||||||
// FIXME: passing superAsMeta doesn't have impact due to bug in the Qt function, so handle it below
|
// FIXME: passing superAsMeta doesn't have impact due to bug in the Qt function, so handle it below
|
||||||
Qt::Key qtKey = Qt::Key(QXkbCommon::keysymToQtKey(keySym, modifiers, m_state, scanCode + EVDEV_OFFSET));
|
Q_UNUSED(modifiers)
|
||||||
|
Q_UNUSED(scanCode)
|
||||||
|
Qt::Key qtKey = Qt::Key(keysymToQtKeyLocal(keySym));
|
||||||
|
|
||||||
// FIXME: workarounds for symbols currently wrong/not mappable via keysymToQtKey()
|
// FIXME: workarounds for symbols currently wrong/not mappable via keysymToQtKey()
|
||||||
if (qtKey > 0xff && keySym <= 0xff) {
|
if (qtKey > 0xff && keySym <= 0xff) {
|
||||||
@@ -1255,9 +1332,9 @@ QList<xkb_keysym_t> Xkb::keysymsFromQtKey(int keyQt)
|
|||||||
syms.append(XKB_KEY_KP_0 + (symQt - Qt::Key_0));
|
syms.append(XKB_KEY_KP_0 + (symQt - Qt::Key_0));
|
||||||
return syms;
|
return syms;
|
||||||
}
|
}
|
||||||
} else if (QXkbCommon::isLatin1(symQt)) {
|
} else if (isLatin1Keysym(symQt)) {
|
||||||
xkb_keysym_t lower, upper;
|
xkb_keysym_t lower, upper;
|
||||||
QXkbCommon::xkbcommon_XConvertCase(symQt, &lower, &upper);
|
convertCase(symQt, &lower, &upper);
|
||||||
if (keyQt & Qt::ShiftModifier) {
|
if (keyQt & Qt::ShiftModifier) {
|
||||||
syms.append(upper);
|
syms.append(upper);
|
||||||
} else {
|
} else {
|
||||||
@@ -1269,10 +1346,10 @@ QList<xkb_keysym_t> Xkb::keysymsFromQtKey(int keyQt)
|
|||||||
for (const TransKey &tk : g_rgSymXToQT) {
|
for (const TransKey &tk : g_rgSymXToQT) {
|
||||||
if (tk.keySymQt == symQt) {
|
if (tk.keySymQt == symQt) {
|
||||||
// Use keysyms from the keypad if and only if KeypadModifier is set
|
// Use keysyms from the keypad if and only if KeypadModifier is set
|
||||||
if (hasKeypadMod && !QXkbCommon::isKeypad(tk.keySymX)) {
|
if (hasKeypadMod && !isKeypadKeysym(tk.keySymX)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!hasKeypadMod && QXkbCommon::isKeypad(tk.keySymX)) {
|
if (!hasKeypadMod && isKeypadKeysym(tk.keySymX)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
syms.append(tk.keySymX);
|
syms.append(tk.keySymX);
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#TODO: KWin Wayland compositor — DRM backend → scheme:drm, libinput → via evdevd, session → seatd
|
#TODO: KWin Wayland compositor — DRM backend → scheme:drm, libinput → via evdevd, session → seatd
|
||||||
# Stub deps remaining: libepoxy-stub, libudev-stub, lcms2-stub, libdisplay-info-stub
|
# Reduced-path compatibility deps: legacy-named libudev-stub recipe now stages the real scheme-backed libudev provider; libdisplay-info-stub now provides a bounded real base-EDID parser for KWin.
|
||||||
# provide INTERFACE IMPORTED cmake targets so KWin links without real implementations.
|
# The libudev provider path is intentionally udev-shim / scheme:udev-backed rather than eudev.
|
||||||
# Re-enabled (deps built): decorations, global shortcuts, runners, notifications, D-Bus
|
# Re-enabled in the current reduced path: decorations, runners, D-Bus
|
||||||
# Still disabled: KCMS (QML), screen locking, tabbox, effects, X11, QML, signing docs
|
# Still disabled: global shortcuts, notifications, KCMS (QML), screen locking, screenlocker,
|
||||||
|
# tabbox, effects, X11, QML, running-in-kde, signing docs
|
||||||
[source]
|
[source]
|
||||||
tar = "https://invent.kde.org/plasma/kwin/-/archive/v6.3.4/kwin-v6.3.4.tar.gz"
|
tar = "https://invent.kde.org/plasma/kwin/-/archive/v6.3.4/kwin-v6.3.4.tar.gz"
|
||||||
|
|
||||||
@@ -42,14 +43,15 @@ dependencies = [
|
|||||||
"mesa",
|
"mesa",
|
||||||
"libdrm",
|
"libdrm",
|
||||||
"libinput",
|
"libinput",
|
||||||
|
"libxcb",
|
||||||
"libxkbcommon",
|
"libxkbcommon",
|
||||||
"dbus",
|
"dbus",
|
||||||
"freetype2",
|
"freetype2",
|
||||||
"fontconfig",
|
"fontconfig",
|
||||||
"libxcvt",
|
"libxcvt",
|
||||||
"libepoxy-stub",
|
"libepoxy",
|
||||||
"libudev-stub",
|
"libudev-stub",
|
||||||
"lcms2-stub",
|
"liblcms",
|
||||||
"libdisplay-info-stub",
|
"libdisplay-info-stub",
|
||||||
]
|
]
|
||||||
script = """
|
script = """
|
||||||
@@ -122,12 +124,86 @@ for d in plugins mkspecs metatypes modules; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ -d "${COOKBOOK_SYSROOT}/include/QtGui/6.11.0/QtGui/qpa" ] && [ ! -e "${COOKBOOK_SYSROOT}/include/QtGui/qpa" ]; then
|
||||||
|
ln -sf "6.11.0/QtGui/qpa" "${COOKBOOK_SYSROOT}/include/QtGui/qpa"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "${COOKBOOK_ROOT}/recipes/core/relibc/target/${TARGET}/stage.tmp/usr/include/stdlib.h" ]; then
|
||||||
|
cp -f "${COOKBOOK_ROOT}/recipes/core/relibc/target/${TARGET}/stage.tmp/usr/include/stdlib.h" \
|
||||||
|
"${COOKBOOK_ROOT}/recipes/wip/qt/qtdeclarative/target/${TARGET}/sysroot/include/stdlib.h"
|
||||||
|
cp -f "${COOKBOOK_ROOT}/recipes/core/relibc/target/${TARGET}/stage.tmp/usr/include/stdlib.h" \
|
||||||
|
"${COOKBOOK_ROOT}/recipes/wip/qt/qtdeclarative/target/${TARGET}/sysroot/usr/include/stdlib.h" 2>/dev/null || true
|
||||||
|
sed -i '/^long double strtold(const char \\*nptr, char \\*\\*endptr);$/d' \
|
||||||
|
"${COOKBOOK_ROOT}/recipes/wip/qt/qtdeclarative/target/${TARGET}/sysroot/include/stdlib.h" 2>/dev/null || true
|
||||||
|
sed -i '/^long double strtold(const char \\*nptr, char \\*\\*endptr);$/d' \
|
||||||
|
"${COOKBOOK_ROOT}/recipes/wip/qt/qtdeclarative/target/${TARGET}/sysroot/usr/include/stdlib.h" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "${COOKBOOK_ROOT}/local/recipes/libs/libudev-stub/source/include/libudev.h" ]; then
|
||||||
|
cp -f "${COOKBOOK_ROOT}/local/recipes/libs/libudev-stub/source/include/libudev.h" \
|
||||||
|
"${COOKBOOK_SYSROOT}/usr/include/libudev.h"
|
||||||
|
cp -f "${COOKBOOK_ROOT}/local/recipes/libs/libudev-stub/source/include/libudev.h" \
|
||||||
|
"${COOKBOOK_SYSROOT}/include/libudev.h" 2>/dev/null || true
|
||||||
|
cp -f "${COOKBOOK_ROOT}/local/recipes/libs/libudev-stub/source/include/libudev.h" \
|
||||||
|
"${COOKBOOK_ROOT}/recipes/wip/qt/qtdeclarative/target/${TARGET}/sysroot/include/libudev.h"
|
||||||
|
cp -f "${COOKBOOK_ROOT}/local/recipes/libs/libudev-stub/source/include/libudev.h" \
|
||||||
|
"${COOKBOOK_ROOT}/recipes/wip/qt/qtdeclarative/target/${TARGET}/sysroot/usr/include/libudev.h" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "${COOKBOOK_ROOT}/recipes/wip/libs/other/liblcms/target/${TARGET}/stage.tmp/usr/lib/liblcms2.so.2.15" ]; then
|
||||||
|
cp -f "${COOKBOOK_ROOT}/recipes/wip/libs/other/liblcms/target/${TARGET}/stage.tmp/usr/lib/liblcms2.so.2.15" \
|
||||||
|
"${COOKBOOK_SYSROOT}/lib/"
|
||||||
|
ln -sf liblcms2.so.2.15 "${COOKBOOK_SYSROOT}/lib/liblcms2.so.2"
|
||||||
|
ln -sf liblcms2.so.2.15 "${COOKBOOK_SYSROOT}/lib/liblcms2.so"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "${COOKBOOK_SYSROOT}/include/QtGui/private" "${COOKBOOK_SYSROOT}/include/QtCore/private"
|
||||||
|
mkdir -p "${COOKBOOK_SYSROOT}/usr/include/QtGui/private" "${COOKBOOK_SYSROOT}/usr/include/QtCore/private"
|
||||||
|
for hdr in "${COOKBOOK_ROOT}"/recipes/wip/qt/qtbase/source/src/corelib/global/*_p.h; do
|
||||||
|
[ -f "$hdr" ] || continue
|
||||||
|
base=$(basename "$hdr")
|
||||||
|
ln -sf "$hdr" "${COOKBOOK_SYSROOT}/include/QtCore/private/$base"
|
||||||
|
ln -sf "$hdr" "${COOKBOOK_SYSROOT}/usr/include/QtCore/private/$base"
|
||||||
|
done
|
||||||
|
qt_qconfig_priv="${COOKBOOK_ROOT}/recipes/wip/qt/qtdeclarative/target/${TARGET}/sysroot/usr/include/QtCore/6.11.0/QtCore/private/qconfig_p.h"
|
||||||
|
if [ -f "${qt_qconfig_priv}" ]; then
|
||||||
|
ln -sf "${qt_qconfig_priv}" "${COOKBOOK_SYSROOT}/include/QtCore/private/qconfig_p.h"
|
||||||
|
ln -sf "${qt_qconfig_priv}" "${COOKBOOK_SYSROOT}/usr/include/QtCore/private/qconfig_p.h"
|
||||||
|
fi
|
||||||
|
for hdr in "${COOKBOOK_ROOT}"/recipes/wip/qt/qtbase/source/src/gui/kernel/*_p.h "${COOKBOOK_ROOT}"/recipes/wip/qt/qtbase/source/src/gui/platform/unix/*_p.h; do
|
||||||
|
[ -f "$hdr" ] || continue
|
||||||
|
base=$(basename "$hdr")
|
||||||
|
ln -sf "$hdr" "${COOKBOOK_SYSROOT}/include/QtGui/private/$base"
|
||||||
|
ln -sf "$hdr" "${COOKBOOK_SYSROOT}/usr/include/QtGui/private/$base"
|
||||||
|
done
|
||||||
|
|
||||||
if [ ! -e "${COOKBOOK_SYSROOT}/bin/wayland-scanner" ] || [ -f "${COOKBOOK_SYSROOT}/bin/wayland-scanner" ]; then
|
if [ ! -e "${COOKBOOK_SYSROOT}/bin/wayland-scanner" ] || [ -f "${COOKBOOK_SYSROOT}/bin/wayland-scanner" ]; then
|
||||||
mkdir -p "${COOKBOOK_SYSROOT}/bin"
|
mkdir -p "${COOKBOOK_SYSROOT}/bin"
|
||||||
rm -f "${COOKBOOK_SYSROOT}/bin/wayland-scanner"
|
rm -f "${COOKBOOK_SYSROOT}/bin/wayland-scanner"
|
||||||
ln -sf "/usr/bin/wayland-scanner" "${COOKBOOK_SYSROOT}/bin/wayland-scanner"
|
ln -sf "/usr/bin/wayland-scanner" "${COOKBOOK_SYSROOT}/bin/wayland-scanner"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f "${COOKBOOK_SYSROOT}/lib/cmake/Qt6Svg/Qt6SvgTargets.cmake" ]; then
|
||||||
|
python - <<'PY'
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
path = Path(os.environ['COOKBOOK_SYSROOT']) / 'lib/cmake/Qt6Svg/Qt6SvgTargets.cmake'
|
||||||
|
text = path.read_text()
|
||||||
|
text = text.replace('IMPORTED_LOCATION_RELEASE "/usr/lib/', f'IMPORTED_LOCATION_RELEASE "{os.environ["COOKBOOK_SYSROOT"]}/usr/lib/')
|
||||||
|
path.write_text(text)
|
||||||
|
PY
|
||||||
|
fi
|
||||||
|
if [ -f "${COOKBOOK_SYSROOT}/lib/cmake/Qt6Svg/Qt6SvgTargets-release.cmake" ]; then
|
||||||
|
python - <<'PY'
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
path = Path(os.environ['COOKBOOK_SYSROOT']) / 'lib/cmake/Qt6Svg/Qt6SvgTargets-release.cmake'
|
||||||
|
text = path.read_text()
|
||||||
|
text = text.replace('${_IMPORT_PREFIX}/lib/', f'{os.environ["COOKBOOK_SYSROOT"]}/usr/lib/')
|
||||||
|
path.write_text(text)
|
||||||
|
PY
|
||||||
|
fi
|
||||||
|
|
||||||
cp "${COOKBOOK_RECIPE}/inspect/kwin-v6.3.4/CMakeLists.txt" \
|
cp "${COOKBOOK_RECIPE}/inspect/kwin-v6.3.4/CMakeLists.txt" \
|
||||||
"${COOKBOOK_SOURCE}/CMakeLists.txt"
|
"${COOKBOOK_SOURCE}/CMakeLists.txt"
|
||||||
cp "${COOKBOOK_RECIPE}/inspect/kwin-v6.3.4/src/config-kwin.h.cmake" \
|
cp "${COOKBOOK_RECIPE}/inspect/kwin-v6.3.4/src/config-kwin.h.cmake" \
|
||||||
@@ -159,6 +235,7 @@ rm -f CMakeCache.txt
|
|||||||
rm -rf CMakeFiles
|
rm -rf CMakeFiles
|
||||||
|
|
||||||
cmake "${COOKBOOK_SOURCE}" \
|
cmake "${COOKBOOK_SOURCE}" \
|
||||||
|
-GNinja \
|
||||||
-DCMAKE_TOOLCHAIN_FILE="${COOKBOOK_ROOT}/local/recipes/qt/redox-toolchain.cmake" \
|
-DCMAKE_TOOLCHAIN_FILE="${COOKBOOK_ROOT}/local/recipes/qt/redox-toolchain.cmake" \
|
||||||
-DQT_HOST_PATH="${HOST_BUILD}" \
|
-DQT_HOST_PATH="${HOST_BUILD}" \
|
||||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||||
@@ -180,9 +257,9 @@ cmake "${COOKBOOK_SOURCE}" \
|
|||||||
-DKWIN_BUILD_EFFECTS=OFF \
|
-DKWIN_BUILD_EFFECTS=OFF \
|
||||||
-DKWIN_BUILD_RUNNING_IN_KDE=OFF \
|
-DKWIN_BUILD_RUNNING_IN_KDE=OFF \
|
||||||
-DKWIN_BUILD_X11=OFF \
|
-DKWIN_BUILD_X11=OFF \
|
||||||
-DKWIN_BUILD_GLOBALSHORTCUTS=ON \
|
-DKWIN_BUILD_GLOBALSHORTCUTS=OFF \
|
||||||
-DKWIN_BUILD_RUNNERS=ON \
|
-DKWIN_BUILD_RUNNERS=ON \
|
||||||
-DKWIN_BUILD_NOTIFICATIONS=ON \
|
-DKWIN_BUILD_NOTIFICATIONS=OFF \
|
||||||
-DKWIN_BUILD_ELECTRONICALLY_SIGNING_DOCS=OFF \
|
-DKWIN_BUILD_ELECTRONICALLY_SIGNING_DOCS=OFF \
|
||||||
-DKWIN_BUILD_SCREENLOCKER=OFF \
|
-DKWIN_BUILD_SCREENLOCKER=OFF \
|
||||||
-DQT_GENERATE_SBOM=OFF \
|
-DQT_GENERATE_SBOM=OFF \
|
||||||
@@ -192,8 +269,127 @@ cmake "${COOKBOOK_SOURCE}" \
|
|||||||
-DUSE_DBUS=ON \
|
-DUSE_DBUS=ON \
|
||||||
-Wno-dev
|
-Wno-dev
|
||||||
|
|
||||||
|
mkdir -p "${COOKBOOK_BUILD}/src"
|
||||||
|
if [ -e "${HOST_BUILD}/bin/qdbuscpp2xml" ]; then
|
||||||
|
ln -sf "${HOST_BUILD}/bin/qdbuscpp2xml" "${COOKBOOK_BUILD}/src/Qt6::qdbuscpp2xml"
|
||||||
|
fi
|
||||||
|
if [ -e "${HOST_BUILD}/bin/qdbusxml2cpp" ]; then
|
||||||
|
cat > "${COOKBOOK_BUILD}/src/Qt6::qdbusxml2cpp" <<EOF
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
"${HOST_BUILD}/bin/qdbusxml2cpp" "\\$@"
|
||||||
|
python - <<'PY'
|
||||||
|
from pathlib import Path
|
||||||
|
for path in Path('.').glob('*.h'):
|
||||||
|
lines = [line for line in path.read_text().splitlines() if line.strip() != 'class QStringList;']
|
||||||
|
path.write_text(chr(10).join(lines) + chr(10))
|
||||||
|
PY
|
||||||
|
EOF
|
||||||
|
chmod +x "${COOKBOOK_BUILD}/src/Qt6::qdbusxml2cpp"
|
||||||
|
fi
|
||||||
|
export PATH="${COOKBOOK_BUILD}/src:${HOST_BUILD}/bin:${PATH}"
|
||||||
|
|
||||||
mkdir -p src
|
mkdir -p src
|
||||||
touch src/kwineffects_interface.moc
|
touch src/kwineffects_interface.moc
|
||||||
|
touch src/kwinadaptor.moc
|
||||||
|
touch src/dbusproperties_interface.moc
|
||||||
|
|
||||||
|
"${COOKBOOK_SYSROOT}/lib/libexec/kf6/kconfig_compiler_kf6" \
|
||||||
|
"${COOKBOOK_SOURCE}/src/kwin.kcfg" \
|
||||||
|
"${COOKBOOK_SOURCE}/src/settings.kcfgc" \
|
||||||
|
-d "${COOKBOOK_BUILD}/src/"
|
||||||
|
"${COOKBOOK_SYSROOT}/lib/libexec/kf6/kconfig_compiler_kf6" \
|
||||||
|
"${COOKBOOK_SOURCE}/src/rulesettings.kcfg" \
|
||||||
|
"${COOKBOOK_SOURCE}/src/rulesettings.kcfgc" \
|
||||||
|
-d "${COOKBOOK_BUILD}/src/"
|
||||||
|
"${COOKBOOK_SYSROOT}/lib/libexec/kf6/kconfig_compiler_kf6" \
|
||||||
|
"${COOKBOOK_SOURCE}/src/rulebooksettingsbase.kcfg" \
|
||||||
|
"${COOKBOOK_SOURCE}/src/rulebooksettingsbase.kcfgc" \
|
||||||
|
-d "${COOKBOOK_BUILD}/src/"
|
||||||
|
|
||||||
|
cd "${COOKBOOK_BUILD}/src"
|
||||||
|
./Qt6::qdbusxml2cpp -m -p appmenu_interface "${COOKBOOK_SOURCE}/src/org.kde.kappmenu.xml"
|
||||||
|
./Qt6::qdbusxml2cpp -m -a compositingadaptor -i dbusinterface.h -l KWin::CompositorDBusInterface "${COOKBOOK_SOURCE}/src/org.kde.kwin.Compositing.xml"
|
||||||
|
./Qt6::qdbusxml2cpp -m -a effectsadaptor -i effect/effecthandler.h -l KWin::EffectsHandler "${COOKBOOK_SOURCE}/src/org.kde.kwin.Effects.xml"
|
||||||
|
for header in appmenu_interface.h compositingadaptor.h effectsadaptor.h scriptadaptor.h sessionadaptor.h pluginsadaptor.h dbusproperties_interface.h virtualdesktopmanageradaptor.h kwinadaptor.h; do
|
||||||
|
if [ -f "$header" ]; then
|
||||||
|
"${HOST_BUILD}/libexec/moc" "$header" -o "${header%.h}.moc"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
for source in kwinadaptor.cpp dbusproperties_interface.cpp; do
|
||||||
|
if [ -f "$source" ]; then
|
||||||
|
"${HOST_BUILD}/libexec/moc" "$source" -o "${source%.cpp}.moc"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
cd - >/dev/null
|
||||||
|
|
||||||
|
python - <<'PY'
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
build = Path(os.environ["COOKBOOK_BUILD"])
|
||||||
|
root_src = build / "src"
|
||||||
|
|
||||||
|
for d in [root_src] + [p for p in root_src.rglob('*') if p.is_dir()]:
|
||||||
|
d.mkdir(parents=True, exist_ok=True)
|
||||||
|
for tool in ("Qt6::qdbuscpp2xml", "Qt6::qdbusxml2cpp"):
|
||||||
|
source = root_src / tool
|
||||||
|
target = d / tool
|
||||||
|
if target == source:
|
||||||
|
continue
|
||||||
|
if target.exists() or target.is_symlink():
|
||||||
|
target.unlink()
|
||||||
|
target.symlink_to(source)
|
||||||
|
PY
|
||||||
|
|
||||||
|
cmake --build . -j"${COOKBOOK_MAKE_JOBS}" || true
|
||||||
|
|
||||||
|
python - <<'PY'
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
build = Path(os.environ["COOKBOOK_BUILD"])
|
||||||
|
for path in build.rglob("*"):
|
||||||
|
if not path.is_file():
|
||||||
|
continue
|
||||||
|
if not (path.name.endswith("adaptor.h") or path.name.endswith("interface.h")):
|
||||||
|
continue
|
||||||
|
lines = [line for line in path.read_text().splitlines() if line.strip() != "class QStringList;"]
|
||||||
|
path.write_text(chr(10).join(lines) + chr(10))
|
||||||
|
|
||||||
|
for path in build.rglob("ui_*.h"):
|
||||||
|
text = path.read_text()
|
||||||
|
bad = chr(10) + "include <klocalizedstring.h>" + chr(10)
|
||||||
|
good = chr(10) + "#include <klocalizedstring.h>" + chr(10)
|
||||||
|
text = text.replace(bad, good)
|
||||||
|
path.write_text(text)
|
||||||
|
|
||||||
|
host_build = os.environ.get("HOST_BUILD")
|
||||||
|
if host_build:
|
||||||
|
host_moc = Path(host_build) / "libexec/moc"
|
||||||
|
else:
|
||||||
|
host_moc = Path(os.environ["COOKBOOK_ROOT"]) / "build/qt-host-build/libexec/moc"
|
||||||
|
if host_moc.exists():
|
||||||
|
for path in build.rglob("*"):
|
||||||
|
if not path.is_file():
|
||||||
|
continue
|
||||||
|
if not (
|
||||||
|
path.name.endswith("adaptor.h")
|
||||||
|
or path.name.endswith("interface.h")
|
||||||
|
or path.name in {"kwinadaptor.cpp", "dbusproperties_interface.cpp"}
|
||||||
|
):
|
||||||
|
continue
|
||||||
|
out = path.with_suffix('.moc')
|
||||||
|
os.system(f'"{host_moc}" "{path}" -o "{out}"')
|
||||||
|
|
||||||
|
for path in build.rglob("*.cpp"):
|
||||||
|
if path.name in {"kwinadaptor.cpp", "dbusproperties_interface.cpp"}:
|
||||||
|
lines = [
|
||||||
|
line for line in path.read_text().splitlines()
|
||||||
|
if line.strip() not in {'#include "kwinadaptor.moc"', '#include "dbusproperties_interface.moc"'}
|
||||||
|
]
|
||||||
|
path.write_text(chr(10).join(lines) + chr(10))
|
||||||
|
PY
|
||||||
|
|
||||||
cmake --build . -j"${COOKBOOK_MAKE_JOBS}"
|
cmake --build . -j"${COOKBOOK_MAKE_JOBS}"
|
||||||
cmake --install . --prefix "${COOKBOOK_STAGE}/usr"
|
cmake --install . --prefix "${COOKBOOK_STAGE}/usr"
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ option(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON)
|
|||||||
option(KWIN_BUILD_NOTIFICATIONS "Enable building of KWin with knotifications support" ON)
|
option(KWIN_BUILD_NOTIFICATIONS "Enable building of KWin with knotifications support" ON)
|
||||||
option(KWIN_BUILD_SCREENLOCKER "Enable building of KWin lockscreen functionality" ON)
|
option(KWIN_BUILD_SCREENLOCKER "Enable building of KWin lockscreen functionality" ON)
|
||||||
option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON)
|
option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON)
|
||||||
option(KWIN_BUILD_X11 "Enable building X11 common code and Xwayland support" ON)
|
option(KWIN_BUILD_X11 "Enable building X11 common code and Xwayland support" OFF)
|
||||||
option(KWIN_BUILD_X11_BACKEND "Enable building kwin_x11" ON)
|
option(KWIN_BUILD_X11_BACKEND "Enable building kwin_x11" OFF)
|
||||||
option(KWIN_BUILD_GLOBALSHORTCUTS "Enable building of KWin with global shortcuts support" ON)
|
option(KWIN_BUILD_GLOBALSHORTCUTS "Enable building of KWin with global shortcuts support" ON)
|
||||||
option(KWIN_BUILD_RUNNERS "Enable building of KWin with krunner support" ON)
|
option(KWIN_BUILD_RUNNERS "Enable building of KWin with krunner support" ON)
|
||||||
option(KWIN_BUILD_EFFECTS "Enable building of KWin effect plugins" ON)
|
option(KWIN_BUILD_EFFECTS "Enable building of KWin effect plugins" ON)
|
||||||
@@ -66,6 +66,7 @@ endif()
|
|||||||
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
|
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
|
||||||
Concurrent
|
Concurrent
|
||||||
Core
|
Core
|
||||||
|
Qml
|
||||||
WaylandClient
|
WaylandClient
|
||||||
Widgets
|
Widgets
|
||||||
Svg
|
Svg
|
||||||
@@ -98,6 +99,7 @@ find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
|
|||||||
ConfigWidgets
|
ConfigWidgets
|
||||||
CoreAddons
|
CoreAddons
|
||||||
Crash
|
Crash
|
||||||
|
Declarative
|
||||||
GlobalAccel
|
GlobalAccel
|
||||||
GuiAddons
|
GuiAddons
|
||||||
I18n
|
I18n
|
||||||
@@ -441,19 +443,13 @@ endif()
|
|||||||
cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "PlasmaActivities_FOUND" OFF)
|
cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "PlasmaActivities_FOUND" OFF)
|
||||||
cmake_dependent_option(KWIN_BUILD_EIS "Enable building KWin with libeis support" ON "Libeis-1.0_FOUND" OFF)
|
cmake_dependent_option(KWIN_BUILD_EIS "Enable building KWin with libeis support" ON "Libeis-1.0_FOUND" OFF)
|
||||||
|
|
||||||
# --- Redox stub targets for missing deps ---
|
# --- Redox fallback targets for deps still using reduced compatibility paths ---
|
||||||
if(NOT TARGET epoxy::epoxy)
|
if(NOT TARGET epoxy::epoxy)
|
||||||
add_library(epoxy::epoxy INTERFACE IMPORTED)
|
add_library(epoxy::epoxy INTERFACE IMPORTED)
|
||||||
endif()
|
endif()
|
||||||
if(NOT TARGET UDev::UDev)
|
|
||||||
add_library(UDev::UDev INTERFACE IMPORTED)
|
|
||||||
endif()
|
|
||||||
if(NOT TARGET lcms2::lcms2)
|
if(NOT TARGET lcms2::lcms2)
|
||||||
add_library(lcms2::lcms2 INTERFACE IMPORTED)
|
add_library(lcms2::lcms2 INTERFACE IMPORTED)
|
||||||
endif()
|
endif()
|
||||||
if(NOT TARGET PkgConfig::libdisplayinfo)
|
|
||||||
add_library(PkgConfig::libdisplayinfo INTERFACE IMPORTED)
|
|
||||||
endif()
|
|
||||||
if(NOT TARGET PkgConfig::Libxcvt)
|
if(NOT TARGET PkgConfig::Libxcvt)
|
||||||
add_library(PkgConfig::Libxcvt INTERFACE IMPORTED)
|
add_library(PkgConfig::Libxcvt INTERFACE IMPORTED)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=KDE Window Manager
|
|
||||||
After=plasma-kcminit.service
|
|
||||||
PartOf=graphical-session.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/kwin_x11 --replace
|
|
||||||
BusName=org.kde.KWin
|
|
||||||
Slice=session.slice
|
|
||||||
Restart=on-failure
|
|
||||||
@@ -81,7 +81,6 @@ target_sources(kwin PRIVATE
|
|||||||
cursor.cpp
|
cursor.cpp
|
||||||
cursorsource.cpp
|
cursorsource.cpp
|
||||||
dbusinterface.cpp
|
dbusinterface.cpp
|
||||||
debug_console.cpp
|
|
||||||
decorations/decoratedwindow.cpp
|
decorations/decoratedwindow.cpp
|
||||||
decorations/decorationbridge.cpp
|
decorations/decorationbridge.cpp
|
||||||
decorations/decorationpalette.cpp
|
decorations/decorationpalette.cpp
|
||||||
@@ -234,6 +233,7 @@ target_link_libraries(kwin
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
Qt::Concurrent
|
Qt::Concurrent
|
||||||
Qt::GuiPrivate
|
Qt::GuiPrivate
|
||||||
|
Qt::Qml
|
||||||
Qt::Svg
|
Qt::Svg
|
||||||
|
|
||||||
KF6::ColorScheme
|
KF6::ColorScheme
|
||||||
@@ -247,13 +247,18 @@ target_link_libraries(kwin
|
|||||||
KDecoration3::KDecoration
|
KDecoration3::KDecoration
|
||||||
KDecoration3::KDecoration3Private
|
KDecoration3::KDecoration3Private
|
||||||
|
|
||||||
$<$<TARGET_EXISTS:UDev::UDev>:UDev::UDev>
|
UDev::UDev
|
||||||
XKB::XKB
|
XKB::XKB
|
||||||
EGL::EGL
|
EGL::EGL
|
||||||
|
|
||||||
Threads::Threads
|
Threads::Threads
|
||||||
$<$<TARGET_EXISTS:lcms2::lcms2>:lcms2::lcms2>
|
$<$<TARGET_EXISTS:lcms2::lcms2>:lcms2::lcms2>
|
||||||
$<$<TARGET_EXISTS:PkgConfig::libdisplayinfo>:PkgConfig::libdisplayinfo>
|
PkgConfig::libdisplayinfo
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(kwin PRIVATE
|
||||||
|
${CMAKE_PREFIX_PATH}/include/KF6/KDeclarative
|
||||||
|
$ENV{COOKBOOK_ROOT}/recipes/wip/qt/qtbase/source/src/gui
|
||||||
)
|
)
|
||||||
|
|
||||||
if (KWIN_BUILD_QTQUICK)
|
if (KWIN_BUILD_QTQUICK)
|
||||||
@@ -328,28 +333,16 @@ kconfig_add_kcfg_files(kwin
|
|||||||
)
|
)
|
||||||
|
|
||||||
ki18n_wrap_ui(kwin
|
ki18n_wrap_ui(kwin
|
||||||
debug_console.ui
|
|
||||||
shortcutdialog.ui
|
shortcutdialog.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
if(Qt6DBus_FOUND)
|
if(Qt6DBus_FOUND)
|
||||||
set(kwin_dbus_SRCS)
|
set(kwin_dbus_SRCS)
|
||||||
qt_add_dbus_adaptor(kwin_dbus_SRCS scripting/org.kde.kwin.Script.xml scripting/scripting.h KWin::AbstractScript)
|
|
||||||
qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface)
|
|
||||||
qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.kwin.Compositing.xml dbusinterface.h KWin::CompositorDBusInterface)
|
|
||||||
qt_add_dbus_adaptor(kwin_dbus_SRCS ${kwin_effects_dbus_xml} effect/effecthandler.h KWin::EffectsHandler)
|
|
||||||
qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.KWin.VirtualDesktopManager.xml dbusinterface.h KWin::VirtualDesktopManagerDBusInterface)
|
|
||||||
qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.KWin.Session.xml sm.h KWin::SessionManager)
|
|
||||||
qt_add_dbus_adaptor(kwin_dbus_SRCS org.kde.KWin.Plugins.xml dbusinterface.h KWin::PluginManagerDBusInterface)
|
|
||||||
qt_add_dbus_interface(kwin_dbus_SRCS org.freedesktop.DBus.Properties.xml dbusproperties_interface)
|
|
||||||
|
|
||||||
if (KWIN_BUILD_SCREENLOCKER)
|
if (KWIN_BUILD_SCREENLOCKER)
|
||||||
qt_add_dbus_interface(kwin_dbus_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/kf6_org.freedesktop.ScreenSaver.xml screenlocker_interface)
|
qt_add_dbus_interface(kwin_dbus_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/kf6_org.freedesktop.ScreenSaver.xml screenlocker_interface)
|
||||||
qt_add_dbus_interface(kwin_dbus_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/org.kde.screensaver.xml kscreenlocker_interface)
|
qt_add_dbus_interface(kwin_dbus_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/org.kde.screensaver.xml kscreenlocker_interface)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
qt_add_dbus_interface(kwin_dbus_SRCS org.kde.kappmenu.xml appmenu_interface)
|
|
||||||
|
|
||||||
target_sources(kwin PRIVATE ${kwin_dbus_SRCS})
|
target_sources(kwin PRIVATE ${kwin_dbus_SRCS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -451,8 +444,6 @@ if (HAVE_LIBCAP)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(kwin_wayland
|
target_link_libraries(kwin_wayland
|
||||||
KWinQpaPlugin
|
|
||||||
KF6WindowSystemKWinPlugin
|
|
||||||
KF6IdleTimeKWinPlugin
|
KF6IdleTimeKWinPlugin
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -502,7 +493,6 @@ install(FILES
|
|||||||
cursor.h
|
cursor.h
|
||||||
cursorsource.h
|
cursorsource.h
|
||||||
dbusinterface.h
|
dbusinterface.h
|
||||||
debug_console.h
|
|
||||||
focuschain.h
|
focuschain.h
|
||||||
ftrace.h
|
ftrace.h
|
||||||
gestures.h
|
gestures.h
|
||||||
|
|||||||
@@ -11,10 +11,7 @@
|
|||||||
#include "appmenu.h"
|
#include "appmenu.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#include <appmenu_interface.h>
|
|
||||||
|
|
||||||
#include <QDBusObjectPath>
|
#include <QDBusObjectPath>
|
||||||
#include <QDBusServiceWatcher>
|
|
||||||
|
|
||||||
#include "decorations/decorationbridge.h"
|
#include "decorations/decorationbridge.h"
|
||||||
#include <KDecoration3/DecorationSettings>
|
#include <KDecoration3/DecorationSettings>
|
||||||
@@ -22,28 +19,8 @@
|
|||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
static const QString s_viewService(QStringLiteral("org.kde.kappmenuview"));
|
|
||||||
|
|
||||||
ApplicationMenu::ApplicationMenu()
|
ApplicationMenu::ApplicationMenu()
|
||||||
: m_appmenuInterface(new OrgKdeKappmenuInterface(QStringLiteral("org.kde.kappmenu"), QStringLiteral("/KAppMenu"), QDBusConnection::sessionBus(), this))
|
|
||||||
{
|
{
|
||||||
connect(m_appmenuInterface, &OrgKdeKappmenuInterface::showRequest, this, &ApplicationMenu::slotShowRequest);
|
|
||||||
connect(m_appmenuInterface, &OrgKdeKappmenuInterface::menuShown, this, &ApplicationMenu::slotMenuShown);
|
|
||||||
connect(m_appmenuInterface, &OrgKdeKappmenuInterface::menuHidden, this, &ApplicationMenu::slotMenuHidden);
|
|
||||||
|
|
||||||
m_kappMenuWatcher = new QDBusServiceWatcher(QStringLiteral("org.kde.kappmenu"), QDBusConnection::sessionBus(),
|
|
||||||
QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration, this);
|
|
||||||
|
|
||||||
connect(m_kappMenuWatcher, &QDBusServiceWatcher::serviceRegistered, this, [this]() {
|
|
||||||
m_applicationMenuEnabled = true;
|
|
||||||
Q_EMIT applicationMenuEnabledChanged(true);
|
|
||||||
});
|
|
||||||
connect(m_kappMenuWatcher, &QDBusServiceWatcher::serviceUnregistered, this, [this]() {
|
|
||||||
m_applicationMenuEnabled = false;
|
|
||||||
Q_EMIT applicationMenuEnabledChanged(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
m_applicationMenuEnabled = QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.kappmenu"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApplicationMenu::applicationMenuEnabled() const
|
bool ApplicationMenu::applicationMenuEnabled() const
|
||||||
@@ -53,13 +30,7 @@ bool ApplicationMenu::applicationMenuEnabled() const
|
|||||||
|
|
||||||
void ApplicationMenu::setViewEnabled(bool enabled)
|
void ApplicationMenu::setViewEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
if (enabled) {
|
Q_UNUSED(enabled)
|
||||||
QDBusConnection::sessionBus().interface()->registerService(s_viewService,
|
|
||||||
QDBusConnectionInterface::QueueService,
|
|
||||||
QDBusConnectionInterface::DontAllowReplacement);
|
|
||||||
} else {
|
|
||||||
QDBusConnection::sessionBus().interface()->unregisterService(s_viewService);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationMenu::slotShowRequest(const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId)
|
void ApplicationMenu::slotShowRequest(const QString &serviceName, const QDBusObjectPath &menuObjectPath, int actionId)
|
||||||
@@ -92,10 +63,9 @@ void ApplicationMenu::slotMenuHidden(const QString &serviceName, const QDBusObje
|
|||||||
|
|
||||||
void ApplicationMenu::showApplicationMenu(const QPoint &p, Window *c, int actionId)
|
void ApplicationMenu::showApplicationMenu(const QPoint &p, Window *c, int actionId)
|
||||||
{
|
{
|
||||||
if (!c->hasApplicationMenu()) {
|
Q_UNUSED(p)
|
||||||
return;
|
Q_UNUSED(c)
|
||||||
}
|
Q_UNUSED(actionId)
|
||||||
m_appmenuInterface->showMenu(p.x(), p.y(), c->applicationMenuServiceName(), QDBusObjectPath(c->applicationMenuObjectPath()), actionId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Window *ApplicationMenu::findWindowWithApplicationMenu(const QString &serviceName, const QDBusObjectPath &menuObjectPath)
|
Window *ApplicationMenu::findWindowWithApplicationMenu(const QString &serviceName, const QDBusObjectPath &menuObjectPath)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "pointer_input.h"
|
#include "pointer_input.h"
|
||||||
|
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
|
#include <libudev.h>
|
||||||
#include <QDBusArgument>
|
#include <QDBusArgument>
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
#include <QDBusMetaType>
|
#include <QDBusMetaType>
|
||||||
@@ -330,10 +331,10 @@ Device::Device(libinput_device *device, QObject *parent)
|
|||||||
, m_switch(libinput_device_has_capability(m_device, LIBINPUT_DEVICE_CAP_SWITCH))
|
, m_switch(libinput_device_has_capability(m_device, LIBINPUT_DEVICE_CAP_SWITCH))
|
||||||
, m_lidSwitch(m_switch ? libinput_device_switch_has_switch(m_device, LIBINPUT_SWITCH_LID) : false)
|
, m_lidSwitch(m_switch ? libinput_device_switch_has_switch(m_device, LIBINPUT_SWITCH_LID) : false)
|
||||||
, m_tabletSwitch(m_switch ? libinput_device_switch_has_switch(m_device, LIBINPUT_SWITCH_TABLET_MODE) : false)
|
, m_tabletSwitch(m_switch ? libinput_device_switch_has_switch(m_device, LIBINPUT_SWITCH_TABLET_MODE) : false)
|
||||||
, m_touchpad(m_pointer && udev_device_get_property_value(libinput_device_get_udev_device(m_device), "ID_INPUT_TOUCHPAD"))
|
, m_touchpad(false)
|
||||||
, m_name(QString::fromLocal8Bit(libinput_device_get_name(m_device)))
|
, m_name(QString::fromLocal8Bit(libinput_device_get_name(m_device)))
|
||||||
, m_sysName(QString::fromLocal8Bit(libinput_device_get_sysname(m_device)))
|
, m_sysName(QString::fromLocal8Bit(libinput_device_get_sysname(m_device)))
|
||||||
, m_sysPath(QString::fromLocal8Bit(udev_device_get_syspath(libinput_device_get_udev_device(m_device))))
|
, m_sysPath(QString())
|
||||||
, m_outputName(QString::fromLocal8Bit(libinput_device_get_output_name(m_device)))
|
, m_outputName(QString::fromLocal8Bit(libinput_device_get_output_name(m_device)))
|
||||||
, m_product(libinput_device_get_id_product(m_device))
|
, m_product(libinput_device_get_id_product(m_device))
|
||||||
, m_vendor(libinput_device_get_id_vendor(m_device))
|
, m_vendor(libinput_device_get_id_vendor(m_device))
|
||||||
|
|||||||
@@ -30,7 +30,9 @@
|
|||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#if KWIN_BUILD_X11
|
||||||
#include <xcb/xcb_cursor.h>
|
#include <xcb/xcb_cursor.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
// KF
|
// KF
|
||||||
#include <KSharedConfig>
|
#include <KSharedConfig>
|
||||||
// xcb
|
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
|
|
||||||
class QTimer;
|
class QTimer;
|
||||||
|
|||||||
@@ -9,16 +9,11 @@
|
|||||||
|
|
||||||
// own
|
// own
|
||||||
#include "dbusinterface.h"
|
#include "dbusinterface.h"
|
||||||
#include "compositingadaptor.h"
|
|
||||||
#include "pluginsadaptor.h"
|
|
||||||
#include "virtualdesktopmanageradaptor.h"
|
|
||||||
|
|
||||||
// kwin
|
// kwin
|
||||||
#include "compositor.h"
|
#include "compositor.h"
|
||||||
#include "core/output.h"
|
#include "core/output.h"
|
||||||
#include "core/renderbackend.h"
|
#include "core/renderbackend.h"
|
||||||
#include "debug_console.h"
|
|
||||||
#include "kwinadaptor.h"
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "placement.h"
|
#include "placement.h"
|
||||||
#include "pluginmanager.h"
|
#include "pluginmanager.h"
|
||||||
@@ -31,6 +26,8 @@
|
|||||||
|
|
||||||
// Qt
|
// Qt
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
|
#include <QDBusMetaType>
|
||||||
|
#include <QDBusServiceWatcher>
|
||||||
#include <QOpenGLContext>
|
#include <QOpenGLContext>
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
@@ -40,10 +37,8 @@ DBusInterface::DBusInterface(QObject *parent)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_serviceName(QStringLiteral("org.kde.KWin"))
|
, m_serviceName(QStringLiteral("org.kde.KWin"))
|
||||||
{
|
{
|
||||||
(void)new KWinAdaptor(this);
|
|
||||||
|
|
||||||
QDBusConnection dbus = QDBusConnection::sessionBus();
|
QDBusConnection dbus = QDBusConnection::sessionBus();
|
||||||
dbus.registerObject(QStringLiteral("/KWin"), this);
|
dbus.registerObject(QStringLiteral("/KWin"), this, QDBusConnection::ExportScriptableSlots | QDBusConnection::ExportScriptableSignals | QDBusConnection::ExportScriptableProperties);
|
||||||
dbus.registerService(m_serviceName);
|
dbus.registerService(m_serviceName);
|
||||||
dbus.connect(QString(), QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reloadConfig"),
|
dbus.connect(QString(), QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reloadConfig"),
|
||||||
Workspace::self(), SLOT(slotReloadConfig()));
|
Workspace::self(), SLOT(slotReloadConfig()));
|
||||||
@@ -137,8 +132,7 @@ void DBusInterface::previousDesktop()
|
|||||||
|
|
||||||
void DBusInterface::showDebugConsole()
|
void DBusInterface::showDebugConsole()
|
||||||
{
|
{
|
||||||
DebugConsole *console = new DebugConsole;
|
// Debug console is intentionally disabled in the reduced Wayland-only build.
|
||||||
console->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBusInterface::replace()
|
void DBusInterface::replace()
|
||||||
@@ -262,7 +256,6 @@ CompositorDBusInterface::CompositorDBusInterface(Compositor *parent)
|
|||||||
, m_compositor(parent)
|
, m_compositor(parent)
|
||||||
{
|
{
|
||||||
connect(m_compositor, &Compositor::compositingToggled, this, &CompositorDBusInterface::compositingToggled);
|
connect(m_compositor, &Compositor::compositingToggled, this, &CompositorDBusInterface::compositingToggled);
|
||||||
new CompositingAdaptor(this);
|
|
||||||
QDBusConnection dbus = QDBusConnection::sessionBus();
|
QDBusConnection dbus = QDBusConnection::sessionBus();
|
||||||
dbus.registerObject(QStringLiteral("/Compositor"), this);
|
dbus.registerObject(QStringLiteral("/Compositor"), this);
|
||||||
dbus.connect(QString(), QStringLiteral("/Compositor"), QStringLiteral("org.kde.kwin.Compositing"),
|
dbus.connect(QString(), QStringLiteral("/Compositor"), QStringLiteral("org.kde.kwin.Compositing"),
|
||||||
@@ -343,7 +336,6 @@ VirtualDesktopManagerDBusInterface::VirtualDesktopManagerDBusInterface(VirtualDe
|
|||||||
qDBusRegisterMetaType<KWin::DBusDesktopDataStruct>();
|
qDBusRegisterMetaType<KWin::DBusDesktopDataStruct>();
|
||||||
qDBusRegisterMetaType<KWin::DBusDesktopDataVector>();
|
qDBusRegisterMetaType<KWin::DBusDesktopDataVector>();
|
||||||
|
|
||||||
new VirtualDesktopManagerAdaptor(this);
|
|
||||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/VirtualDesktopManager"),
|
QDBusConnection::sessionBus().registerObject(QStringLiteral("/VirtualDesktopManager"),
|
||||||
QStringLiteral("org.kde.KWin.VirtualDesktopManager"),
|
QStringLiteral("org.kde.KWin.VirtualDesktopManager"),
|
||||||
this);
|
this);
|
||||||
@@ -491,8 +483,6 @@ PluginManagerDBusInterface::PluginManagerDBusInterface(PluginManager *manager)
|
|||||||
: QObject(manager)
|
: QObject(manager)
|
||||||
, m_manager(manager)
|
, m_manager(manager)
|
||||||
{
|
{
|
||||||
new PluginsAdaptor(this);
|
|
||||||
|
|
||||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Plugins"),
|
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Plugins"),
|
||||||
QStringLiteral("org.kde.KWin.Plugins"),
|
QStringLiteral("org.kde.KWin.Plugins"),
|
||||||
this);
|
this);
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
#if KWIN_BUILD_QTQUICK
|
#if KWIN_BUILD_QTQUICK
|
||||||
#include "effect/offscreenquickview.h"
|
#include "effect/offscreenquickview.h"
|
||||||
#endif
|
#endif
|
||||||
#include "effectsadaptor.h"
|
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "input_event.h"
|
#include "input_event.h"
|
||||||
#include "inputmethod.h"
|
#include "inputmethod.h"
|
||||||
@@ -61,8 +60,10 @@
|
|||||||
#include <KDecoration3/Decoration>
|
#include <KDecoration3/Decoration>
|
||||||
#include <KDecoration3/DecorationSettings>
|
#include <KDecoration3/DecorationSettings>
|
||||||
|
|
||||||
|
#include <QDBusConnection>
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
#include <QMatrix4x4>
|
#include <QMatrix4x4>
|
||||||
|
#include <QMetaProperty>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QTimeLine>
|
#include <QTimeLine>
|
||||||
@@ -139,9 +140,6 @@ EffectsHandler::EffectsHandler(Compositor *compositor, WorkspaceScene *scene)
|
|||||||
effectsChanged();
|
effectsChanged();
|
||||||
});
|
});
|
||||||
m_effectLoader->setConfig(kwinApp()->config());
|
m_effectLoader->setConfig(kwinApp()->config());
|
||||||
new EffectsAdaptor(this);
|
|
||||||
QDBusConnection dbus = QDBusConnection::sessionBus();
|
|
||||||
dbus.registerObject(QStringLiteral("/Effects"), this);
|
|
||||||
|
|
||||||
connect(options, &Options::animationSpeedChanged, this, &EffectsHandler::reconfigureEffects);
|
connect(options, &Options::animationSpeedChanged, this, &EffectsHandler::reconfigureEffects);
|
||||||
|
|
||||||
|
|||||||
@@ -173,6 +173,10 @@ bool ScriptedEffectLoader::loadJavascriptEffect(const KPluginMetaData &effect)
|
|||||||
|
|
||||||
bool ScriptedEffectLoader::loadDeclarativeEffect(const KPluginMetaData &metadata)
|
bool ScriptedEffectLoader::loadDeclarativeEffect(const KPluginMetaData &metadata)
|
||||||
{
|
{
|
||||||
|
#if !KWIN_BUILD_QTQUICK
|
||||||
|
Q_UNUSED(metadata)
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
const QString name = metadata.pluginId();
|
const QString name = metadata.pluginId();
|
||||||
const QString scriptFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
|
const QString scriptFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
|
||||||
QLatin1String("kwin/effects/") + name + QLatin1String("/contents/ui/main.qml"));
|
QLatin1String("kwin/effects/") + name + QLatin1String("/contents/ui/main.qml"));
|
||||||
@@ -207,6 +211,7 @@ bool ScriptedEffectLoader::loadDeclarativeEffect(const KPluginMetaData &metadata
|
|||||||
Q_EMIT effectLoaded(effect, name);
|
Q_EMIT effectLoaded(effect, name);
|
||||||
m_loadedEffects << name;
|
m_loadedEffects << name;
|
||||||
return true;
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptedEffectLoader::queryAndLoadAll()
|
void ScriptedEffectLoader::queryAndLoadAll()
|
||||||
|
|||||||
@@ -44,7 +44,6 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
#include <linux/input-event-codes.h>
|
#include <linux/input-event-codes.h>
|
||||||
#include <private/qxkbcommon_p.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <xkbcommon/xkbcommon-keysyms.h>
|
#include <xkbcommon/xkbcommon-keysyms.h>
|
||||||
|
|
||||||
|
|||||||
@@ -54,11 +54,9 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
Q_IMPORT_PLUGIN(KWinIntegrationPlugin)
|
|
||||||
#if KWIN_BUILD_GLOBALSHORTCUTS
|
#if KWIN_BUILD_GLOBALSHORTCUTS
|
||||||
Q_IMPORT_PLUGIN(KGlobalAccelImpl)
|
Q_IMPORT_PLUGIN(KGlobalAccelImpl)
|
||||||
#endif
|
#endif
|
||||||
Q_IMPORT_PLUGIN(KWindowSystemKWinPlugin)
|
|
||||||
Q_IMPORT_PLUGIN(KWinIdleTimePoller)
|
Q_IMPORT_PLUGIN(KWinIdleTimePoller)
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
#include <QTimer>
|
||||||
#endif
|
#endif
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
@@ -50,6 +51,7 @@ void show(const QString &message, const QString &iconName, int timeout)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
if (QThread::currentThread() != qGuiApp->thread()) {
|
if (QThread::currentThread() != qGuiApp->thread()) {
|
||||||
QTimer::singleShot(0, QCoreApplication::instance(), [message, iconName, timeout] {
|
QTimer::singleShot(0, QCoreApplication::instance(), [message, iconName, timeout] {
|
||||||
show(message, iconName, timeout);
|
show(message, iconName, timeout);
|
||||||
@@ -62,6 +64,7 @@ void show(const QString &message, const QString &iconName, int timeout)
|
|||||||
notification->setMessage(message);
|
notification->setMessage(message);
|
||||||
notification->setTimeout(timeout);
|
notification->setTimeout(timeout);
|
||||||
notification->setVisible(true);
|
notification->setVisible(true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void show(const QString &message, int timeout)
|
void show(const QString &message, int timeout)
|
||||||
@@ -86,8 +89,10 @@ void hide(HideFlags flags)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
osd()->setSkipCloseAnimation(flags.testFlag(HideFlag::SkipCloseAnimation));
|
osd()->setSkipCloseAnimation(flags.testFlag(HideFlag::SkipCloseAnimation));
|
||||||
osd()->setVisible(false);
|
osd()->setVisible(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,8 +143,10 @@ OutlineVisual::~OutlineVisual()
|
|||||||
|
|
||||||
CompositedOutlineVisual::CompositedOutlineVisual(Outline *outline)
|
CompositedOutlineVisual::CompositedOutlineVisual(Outline *outline)
|
||||||
: OutlineVisual(outline)
|
: OutlineVisual(outline)
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
, m_qmlContext()
|
, m_qmlContext()
|
||||||
, m_qmlComponent()
|
, m_qmlComponent()
|
||||||
|
#endif
|
||||||
, m_mainItem()
|
, m_mainItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,10 @@
|
|||||||
#include <kwin_export.h>
|
#include <kwin_export.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
class QQmlContext;
|
class QQmlContext;
|
||||||
class QQmlComponent;
|
class QQmlComponent;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
@@ -139,8 +141,10 @@ public:
|
|||||||
void hide() override;
|
void hide() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
std::unique_ptr<QQmlContext> m_qmlContext;
|
std::unique_ptr<QQmlContext> m_qmlContext;
|
||||||
std::unique_ptr<QQmlComponent> m_qmlComponent;
|
std::unique_ptr<QQmlComponent> m_qmlComponent;
|
||||||
|
#endif
|
||||||
std::unique_ptr<QObject> m_mainItem;
|
std::unique_ptr<QObject> m_mainItem;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,12 +16,12 @@
|
|||||||
#include "input_event.h"
|
#include "input_event.h"
|
||||||
#include "kscreenintegration.h"
|
#include "kscreenintegration.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
#include "utils/qorientationreading_compat.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QOrientationReading>
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
|
|||||||
@@ -46,8 +46,6 @@ function(kwin_add_script name source)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
add_subdirectory(idletime)
|
add_subdirectory(idletime)
|
||||||
add_subdirectory(qpa)
|
|
||||||
add_subdirectory(windowsystem)
|
|
||||||
|
|
||||||
if (KWIN_BUILD_EFFECTS)
|
if (KWIN_BUILD_EFFECTS)
|
||||||
add_subdirectory(private)
|
add_subdirectory(private)
|
||||||
@@ -124,9 +122,6 @@ endif()
|
|||||||
if (PipeWire_FOUND AND KWIN_BUILD_EFFECTS)
|
if (PipeWire_FOUND AND KWIN_BUILD_EFFECTS)
|
||||||
add_subdirectory(screencast)
|
add_subdirectory(screencast)
|
||||||
endif()
|
endif()
|
||||||
if (KWIN_BUILD_RUNNERS)
|
|
||||||
add_subdirectory(krunner-integration)
|
|
||||||
endif()
|
|
||||||
if(TARGET K::KGlobalAccelD)
|
if(TARGET K::KGlobalAccelD)
|
||||||
add_subdirectory(kglobalaccel)
|
add_subdirectory(kglobalaccel)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
File=rulesettings.kcfg
|
File=rulesettings.kcfg
|
||||||
IncludeFiles=\"rules.h\",netwm_def.h
|
IncludeFiles="rules.h",netwm_def.h
|
||||||
NameSpace=KWin
|
NameSpace=KWin
|
||||||
ClassName=RuleSettings
|
ClassName=RuleSettings
|
||||||
UseEnumTypes=true
|
UseEnumTypes=true
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "effect/quickeffect.h"
|
#include "effect/quickeffect.h"
|
||||||
|
|
||||||
#include <KConfigPropertyMap>
|
#include <KDeclarative/KConfigPropertyMap>
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
|||||||
@@ -41,15 +41,17 @@
|
|||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
// KDE
|
// KDE
|
||||||
#include <KConfigGroup>
|
#include <KConfigGroup>
|
||||||
#include <KConfigPropertyMap>
|
#if KWIN_BUILD_QTQUICK
|
||||||
|
#include <KDeclarative/KConfigPropertyMap>
|
||||||
|
#endif
|
||||||
#include <KGlobalAccel>
|
#include <KGlobalAccel>
|
||||||
#include <KLocalizedContext>
|
#include <KLocalizedContext>
|
||||||
#include <KLocalizedQmlContext>
|
|
||||||
#include <KPackage/PackageLoader>
|
#include <KPackage/PackageLoader>
|
||||||
// Qt
|
// Qt
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
#include <QDBusPendingCallWatcher>
|
#include <QDBusPendingCallWatcher>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QFile>
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
@@ -59,7 +61,6 @@
|
|||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QtConcurrentRun>
|
#include <QtConcurrentRun>
|
||||||
|
|
||||||
#include "scriptadaptor.h"
|
|
||||||
|
|
||||||
static QRect scriptValueToRect(const QJSValue &value)
|
static QRect scriptValueToRect(const QJSValue &value)
|
||||||
{
|
{
|
||||||
@@ -112,8 +113,6 @@ KWin::AbstractScript::AbstractScript(int id, QString scriptName, QString pluginN
|
|||||||
m_pluginName = scriptName;
|
m_pluginName = scriptName;
|
||||||
}
|
}
|
||||||
|
|
||||||
new ScriptAdaptor(this);
|
|
||||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Scripting/Script") + QString::number(scriptId()), this, QDBusConnection::ExportAdaptors);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KWin::AbstractScript::~AbstractScript()
|
KWin::AbstractScript::~AbstractScript()
|
||||||
@@ -566,6 +565,7 @@ QAction *KWin::Script::createMenu(const QString &title, const QJSValue &items, Q
|
|||||||
return menu->menuAction();
|
return menu->menuAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
KWin::DeclarativeScript::DeclarativeScript(int id, QString scriptName, QString pluginName, QObject *parent)
|
KWin::DeclarativeScript::DeclarativeScript(int id, QString scriptName, QString pluginName, QObject *parent)
|
||||||
: AbstractScript(id, scriptName, pluginName, parent)
|
: AbstractScript(id, scriptName, pluginName, parent)
|
||||||
, m_context(new QQmlContext(Scripting::self()->declarativeScriptSharedContext(), this))
|
, m_context(new QQmlContext(Scripting::self()->declarativeScriptSharedContext(), this))
|
||||||
@@ -603,8 +603,9 @@ void KWin::DeclarativeScript::createComponent()
|
|||||||
}
|
}
|
||||||
setRunning(true);
|
setRunning(true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
KWin::JSEngineGlobalMethodsWrapper::JSEngineGlobalMethodsWrapper(KWin::DeclarativeScript *parent)
|
KWin::JSEngineGlobalMethodsWrapper::JSEngineGlobalMethodsWrapper(KWin::AbstractScript *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_script(parent)
|
, m_script(parent)
|
||||||
{
|
{
|
||||||
@@ -636,7 +637,9 @@ KWin::Scripting::Scripting(QObject *parent)
|
|||||||
, m_workspaceWrapper(new QtScriptWorkspaceWrapper(this))
|
, m_workspaceWrapper(new QtScriptWorkspaceWrapper(this))
|
||||||
{
|
{
|
||||||
m_qmlEngine->setProperty("_kirigamiTheme", QStringLiteral("KirigamiPlasmaStyle"));
|
m_qmlEngine->setProperty("_kirigamiTheme", QStringLiteral("KirigamiPlasmaStyle"));
|
||||||
m_qmlEngine->rootContext()->setContextObject(new KLocalizedQmlContext(m_qmlEngine));
|
#if KWIN_BUILD_QTQUICK
|
||||||
|
m_qmlEngine->rootContext()->setContextObject(new KLocalizedContext(m_qmlEngine));
|
||||||
|
#endif
|
||||||
init();
|
init();
|
||||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Scripting"), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportScriptableInvokables);
|
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Scripting"), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportScriptableInvokables);
|
||||||
connect(Workspace::self(), &Workspace::configChanged, this, &Scripting::start);
|
connect(Workspace::self(), &Workspace::configChanged, this, &Scripting::start);
|
||||||
@@ -670,7 +673,9 @@ void KWin::Scripting::init()
|
|||||||
});
|
});
|
||||||
qmlRegisterSingletonInstance("org.kde.kwin", 3, 0, "Options", options);
|
qmlRegisterSingletonInstance("org.kde.kwin", 3, 0, "Options", options);
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
qmlRegisterAnonymousType<KConfigPropertyMap>("org.kde.kwin", 3);
|
qmlRegisterAnonymousType<KConfigPropertyMap>("org.kde.kwin", 3);
|
||||||
|
#endif
|
||||||
qmlRegisterAnonymousType<KWin::Output>("org.kde.kwin", 3);
|
qmlRegisterAnonymousType<KWin::Output>("org.kde.kwin", 3);
|
||||||
qmlRegisterAnonymousType<KWin::Window>("org.kde.kwin", 3);
|
qmlRegisterAnonymousType<KWin::Window>("org.kde.kwin", 3);
|
||||||
qmlRegisterAnonymousType<KWin::VirtualDesktop>("org.kde.kwin", 3);
|
qmlRegisterAnonymousType<KWin::VirtualDesktop>("org.kde.kwin", 3);
|
||||||
@@ -697,7 +702,9 @@ void KWin::Scripting::start()
|
|||||||
if (it->first) {
|
if (it->first) {
|
||||||
loadScript(it->second.first, it->second.second);
|
loadScript(it->second.first, it->second.second);
|
||||||
} else {
|
} else {
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
loadDeclarativeScript(it->second.first, it->second.second);
|
loadDeclarativeScript(it->second.first, it->second.second);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -764,7 +771,9 @@ void KWin::Scripting::slotScriptsQueried()
|
|||||||
if (it->first) {
|
if (it->first) {
|
||||||
loadScript(it->second.first, it->second.second);
|
loadScript(it->second.first, it->second.second);
|
||||||
} else {
|
} else {
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
loadDeclarativeScript(it->second.first, it->second.second);
|
loadDeclarativeScript(it->second.first, it->second.second);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,6 +836,7 @@ int KWin::Scripting::loadScript(const QString &filePath, const QString &pluginNa
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
int KWin::Scripting::loadDeclarativeScript(const QString &filePath, const QString &pluginName)
|
int KWin::Scripting::loadDeclarativeScript(const QString &filePath, const QString &pluginName)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(m_scriptsLock.get());
|
QMutexLocker locker(m_scriptsLock.get());
|
||||||
@@ -839,6 +849,7 @@ int KWin::Scripting::loadDeclarativeScript(const QString &filePath, const QStrin
|
|||||||
scripts.append(script);
|
scripts.append(script);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
KWin::Scripting::~Scripting()
|
KWin::Scripting::~Scripting()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,9 +22,11 @@
|
|||||||
#include <QDBusContext>
|
#include <QDBusContext>
|
||||||
#include <QDBusMessage>
|
#include <QDBusMessage>
|
||||||
|
|
||||||
class QQmlComponent;
|
|
||||||
class QQmlContext;
|
class QQmlContext;
|
||||||
class QQmlEngine;
|
class QQmlEngine;
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
|
class QQmlComponent;
|
||||||
|
#endif
|
||||||
class QAction;
|
class QAction;
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class QRecursiveMutex;
|
class QRecursiveMutex;
|
||||||
@@ -249,6 +251,7 @@ private:
|
|||||||
QJSValueList m_userActionsMenuCallbacks;
|
QJSValueList m_userActionsMenuCallbacks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
class DeclarativeScript : public AbstractScript
|
class DeclarativeScript : public AbstractScript
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -266,6 +269,7 @@ private:
|
|||||||
QQmlContext *m_context;
|
QQmlContext *m_context;
|
||||||
QQmlComponent *m_component;
|
QQmlComponent *m_component;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
class JSEngineGlobalMethodsWrapper : public QObject
|
class JSEngineGlobalMethodsWrapper : public QObject
|
||||||
{
|
{
|
||||||
@@ -293,14 +297,14 @@ public:
|
|||||||
ScreenArea
|
ScreenArea
|
||||||
};
|
};
|
||||||
Q_ENUM(ClientAreaOption)
|
Q_ENUM(ClientAreaOption)
|
||||||
explicit JSEngineGlobalMethodsWrapper(DeclarativeScript *parent);
|
explicit JSEngineGlobalMethodsWrapper(AbstractScript *parent);
|
||||||
~JSEngineGlobalMethodsWrapper() override;
|
~JSEngineGlobalMethodsWrapper() override;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
QVariant readConfig(const QString &key, QVariant defaultValue = QVariant());
|
QVariant readConfig(const QString &key, QVariant defaultValue = QVariant());
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeclarativeScript *m_script;
|
AbstractScript *m_script;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -325,7 +329,9 @@ private:
|
|||||||
public:
|
public:
|
||||||
~Scripting() override;
|
~Scripting() override;
|
||||||
Q_SCRIPTABLE Q_INVOKABLE int loadScript(const QString &filePath, const QString &pluginName = QString());
|
Q_SCRIPTABLE Q_INVOKABLE int loadScript(const QString &filePath, const QString &pluginName = QString());
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
Q_SCRIPTABLE Q_INVOKABLE int loadDeclarativeScript(const QString &filePath, const QString &pluginName = QString());
|
Q_SCRIPTABLE Q_INVOKABLE int loadDeclarativeScript(const QString &filePath, const QString &pluginName = QString());
|
||||||
|
#endif
|
||||||
Q_SCRIPTABLE Q_INVOKABLE bool isScriptLoaded(const QString &pluginName) const;
|
Q_SCRIPTABLE Q_INVOKABLE bool isScriptLoaded(const QString &pluginName) const;
|
||||||
Q_SCRIPTABLE Q_INVOKABLE bool unloadScript(const QString &pluginName);
|
Q_SCRIPTABLE Q_INVOKABLE bool unloadScript(const QString &pluginName);
|
||||||
|
|
||||||
@@ -340,8 +346,10 @@ public:
|
|||||||
|
|
||||||
QQmlEngine *qmlEngine() const;
|
QQmlEngine *qmlEngine() const;
|
||||||
QQmlEngine *qmlEngine();
|
QQmlEngine *qmlEngine();
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
QQmlContext *declarativeScriptSharedContext() const;
|
QQmlContext *declarativeScriptSharedContext() const;
|
||||||
QQmlContext *declarativeScriptSharedContext();
|
QQmlContext *declarativeScriptSharedContext();
|
||||||
|
#endif
|
||||||
QtScriptWorkspaceWrapper *workspaceWrapper() const;
|
QtScriptWorkspaceWrapper *workspaceWrapper() const;
|
||||||
|
|
||||||
AbstractScript *findScript(const QString &pluginName) const;
|
AbstractScript *findScript(const QString &pluginName) const;
|
||||||
@@ -375,6 +383,7 @@ inline QQmlEngine *Scripting::qmlEngine()
|
|||||||
return m_qmlEngine;
|
return m_qmlEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if KWIN_BUILD_QTQUICK
|
||||||
inline QQmlContext *Scripting::declarativeScriptSharedContext() const
|
inline QQmlContext *Scripting::declarativeScriptSharedContext() const
|
||||||
{
|
{
|
||||||
return m_declarativeScriptSharedContext;
|
return m_declarativeScriptSharedContext;
|
||||||
@@ -384,6 +393,7 @@ inline QQmlContext *Scripting::declarativeScriptSharedContext()
|
|||||||
{
|
{
|
||||||
return m_declarativeScriptSharedContext;
|
return m_declarativeScriptSharedContext;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
inline QtScriptWorkspaceWrapper *Scripting::workspaceWrapper() const
|
inline QtScriptWorkspaceWrapper *Scripting::workspaceWrapper() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ File=kwin.kcfg
|
|||||||
NameSpace=KWin
|
NameSpace=KWin
|
||||||
ClassName=Settings
|
ClassName=Settings
|
||||||
# options.h is needed for FocusPolicy and PlacementPolicy
|
# options.h is needed for FocusPolicy and PlacementPolicy
|
||||||
IncludeFiles=\"options.h\"
|
IncludeFiles="options.h"
|
||||||
UseEnumTypes=true
|
UseEnumTypes=true
|
||||||
|
|||||||
@@ -31,7 +31,8 @@
|
|||||||
#include <KService>
|
#include <KService>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "sessionadaptor.h"
|
#include <QDBusConnection>
|
||||||
|
#include <QDBusMessage>
|
||||||
|
|
||||||
using namespace Qt::StringLiterals;
|
using namespace Qt::StringLiterals;
|
||||||
|
|
||||||
@@ -355,7 +356,6 @@ SessionInfo *SessionManager::takeSessionInfo(X11Window *c)
|
|||||||
SessionManager::SessionManager(QObject *parent)
|
SessionManager::SessionManager(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
new SessionAdaptor(this);
|
|
||||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Session"), this);
|
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Session"), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,8 @@
|
|||||||
|
|
||||||
#include "tabletmodemanager.h"
|
#include "tabletmodemanager.h"
|
||||||
|
|
||||||
#include "backends/libinput/device.h"
|
|
||||||
#include "core/inputdevice.h"
|
#include "core/inputdevice.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "input_event.h"
|
|
||||||
#include "input_event_spy.h"
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "wayland_server.h"
|
#include "wayland_server.h"
|
||||||
|
|
||||||
@@ -21,99 +18,8 @@
|
|||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
static bool blocksTabletMode(InputDevice *device)
|
|
||||||
{
|
|
||||||
if (auto libinputDevice = qobject_cast<LibInput::Device *>(device)) {
|
|
||||||
bool ignore = false;
|
|
||||||
if (auto udev = libinput_device_get_udev_device(libinputDevice->device()); udev) {
|
|
||||||
ignore = udev_device_has_tag(udev, "kwin-ignore-tablet-mode");
|
|
||||||
udev_device_unref(udev);
|
|
||||||
}
|
|
||||||
return !ignore;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
class TabletModeSwitchEventSpy : public QObject, public InputEventSpy
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit TabletModeSwitchEventSpy(TabletModeManager *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
, m_parent(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void switchEvent(SwitchEvent *event) override
|
|
||||||
{
|
|
||||||
if (!event->device->isTabletModeSwitch()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (event->state) {
|
|
||||||
case SwitchState::Off:
|
|
||||||
m_parent->setIsTablet(false);
|
|
||||||
break;
|
|
||||||
case SwitchState::On:
|
|
||||||
m_parent->setIsTablet(true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Q_UNREACHABLE();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
TabletModeManager *const m_parent;
|
|
||||||
};
|
|
||||||
|
|
||||||
class TabletModeTouchpadRemovedSpy : public QObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit TabletModeTouchpadRemovedSpy(TabletModeManager *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
, m_parent(parent)
|
|
||||||
{
|
|
||||||
connect(input(), &InputRedirection::deviceAdded, this, &TabletModeTouchpadRemovedSpy::refresh);
|
|
||||||
connect(input(), &InputRedirection::deviceRemoved, this, &TabletModeTouchpadRemovedSpy::refresh);
|
|
||||||
|
|
||||||
check();
|
|
||||||
}
|
|
||||||
|
|
||||||
void refresh(InputDevice *inputDevice)
|
|
||||||
{
|
|
||||||
if (inputDevice->isTouch() || inputDevice->isPointer()) {
|
|
||||||
check();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void check()
|
|
||||||
{
|
|
||||||
const auto devices = input()->devices();
|
|
||||||
const bool hasTouch = std::any_of(devices.constBegin(), devices.constEnd(), [](InputDevice *device) {
|
|
||||||
return device->isTouch() && blocksTabletMode(device);
|
|
||||||
});
|
|
||||||
m_parent->setTabletModeAvailable(hasTouch);
|
|
||||||
|
|
||||||
const bool hasPointer = std::any_of(devices.constBegin(), devices.constEnd(), [](InputDevice *device) {
|
|
||||||
return device->isPointer() && blocksTabletMode(device);
|
|
||||||
});
|
|
||||||
m_parent->setIsTablet(hasTouch && !hasPointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
TabletModeManager *const m_parent;
|
|
||||||
};
|
|
||||||
|
|
||||||
TabletModeManager::TabletModeManager()
|
TabletModeManager::TabletModeManager()
|
||||||
{
|
{
|
||||||
if (waylandServer()) {
|
|
||||||
if (input()->hasTabletModeSwitch()) {
|
|
||||||
input()->installInputEventSpy(new TabletModeSwitchEventSpy(this));
|
|
||||||
} else {
|
|
||||||
hasTabletModeInputChanged(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
KSharedConfig::Ptr kwinSettings = kwinApp()->config();
|
KSharedConfig::Ptr kwinSettings = kwinApp()->config();
|
||||||
m_settingsWatcher = KConfigWatcher::create(kwinSettings);
|
m_settingsWatcher = KConfigWatcher::create(kwinSettings);
|
||||||
connect(m_settingsWatcher.data(), &KConfigWatcher::configChanged, this, &KWin::TabletModeManager::refreshSettings);
|
connect(m_settingsWatcher.data(), &KConfigWatcher::configChanged, this, &KWin::TabletModeManager::refreshSettings);
|
||||||
@@ -125,9 +31,8 @@ TabletModeManager::TabletModeManager()
|
|||||||
// NOTE: slots must be exported for properties to work correctly
|
// NOTE: slots must be exported for properties to work correctly
|
||||||
QDBusConnection::ExportAllProperties | QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllSlots);
|
QDBusConnection::ExportAllProperties | QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllSlots);
|
||||||
|
|
||||||
if (waylandServer()) {
|
setTabletModeAvailable(false);
|
||||||
connect(input(), &InputRedirection::hasTabletModeSwitchChanged, this, &TabletModeManager::hasTabletModeInputChanged);
|
setIsTablet(false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KWin::TabletModeManager::refreshSettings()
|
void KWin::TabletModeManager::refreshSettings()
|
||||||
@@ -153,17 +58,9 @@ void KWin::TabletModeManager::refreshSettings()
|
|||||||
|
|
||||||
void KWin::TabletModeManager::hasTabletModeInputChanged(bool set)
|
void KWin::TabletModeManager::hasTabletModeInputChanged(bool set)
|
||||||
{
|
{
|
||||||
if (set) {
|
Q_UNUSED(set)
|
||||||
input()->installInputEventSpy(new TabletModeSwitchEventSpy(this));
|
setTabletModeAvailable(false);
|
||||||
setTabletModeAvailable(true);
|
setIsTablet(false);
|
||||||
} else {
|
|
||||||
auto spy = new TabletModeTouchpadRemovedSpy(this);
|
|
||||||
connect(input(), &InputRedirection::hasTabletModeSwitchChanged, spy, [spy](bool set) {
|
|
||||||
if (set) {
|
|
||||||
spy->deleteLater();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TabletModeManager::isTabletModeAvailable() const
|
bool TabletModeManager::isTabletModeAvailable() const
|
||||||
|
|||||||
@@ -48,7 +48,13 @@
|
|||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QKeySequenceEdit>
|
||||||
|
#include <QLabel>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QToolButton>
|
||||||
|
#include <QVBoxLayout>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
|
|
||||||
#include <KGlobalAccel>
|
#include <KGlobalAccel>
|
||||||
@@ -764,16 +770,35 @@ void UserActionsMenu::slotWindowOperation(QAction *action)
|
|||||||
ShortcutDialog::ShortcutDialog(const QKeySequence &cut)
|
ShortcutDialog::ShortcutDialog(const QKeySequence &cut)
|
||||||
: _shortcut(cut)
|
: _shortcut(cut)
|
||||||
{
|
{
|
||||||
m_ui.setupUi(this);
|
auto *layout = new QVBoxLayout(this);
|
||||||
m_ui.keySequenceEdit->setKeySequence(cut);
|
|
||||||
m_ui.warning->hide();
|
m_keySequenceEdit = new QKeySequenceEdit(this);
|
||||||
|
m_keySequenceEdit->setKeySequence(cut);
|
||||||
|
layout->addWidget(m_keySequenceEdit);
|
||||||
|
|
||||||
|
m_warning = new QLabel(this);
|
||||||
|
m_warning->hide();
|
||||||
|
layout->addWidget(m_warning);
|
||||||
|
|
||||||
|
auto *actionsLayout = new QHBoxLayout();
|
||||||
|
m_clearButton = new QToolButton(this);
|
||||||
|
m_clearButton->setText(i18nc("@action:button", "Clear"));
|
||||||
|
actionsLayout->addWidget(m_clearButton);
|
||||||
|
actionsLayout->addStretch(1);
|
||||||
|
layout->addLayout(actionsLayout);
|
||||||
|
|
||||||
|
m_buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
||||||
|
layout->addWidget(m_buttonBox);
|
||||||
|
|
||||||
|
connect(m_buttonBox, &QDialogButtonBox::accepted, this, &ShortcutDialog::accept);
|
||||||
|
connect(m_buttonBox, &QDialogButtonBox::rejected, this, &ShortcutDialog::reject);
|
||||||
|
|
||||||
// Listen to changed shortcuts
|
// Listen to changed shortcuts
|
||||||
connect(m_ui.keySequenceEdit, &QKeySequenceEdit::editingFinished, this, &ShortcutDialog::keySequenceChanged);
|
connect(m_keySequenceEdit, &QKeySequenceEdit::editingFinished, this, &ShortcutDialog::keySequenceChanged);
|
||||||
connect(m_ui.clearButton, &QToolButton::clicked, this, [this] {
|
connect(m_clearButton, &QToolButton::clicked, this, [this] {
|
||||||
_shortcut = QKeySequence();
|
_shortcut = QKeySequence();
|
||||||
});
|
});
|
||||||
m_ui.keySequenceEdit->setFocus();
|
m_keySequenceEdit->setFocus();
|
||||||
|
|
||||||
setWindowFlags(Qt::Popup | Qt::X11BypassWindowManagerHint);
|
setWindowFlags(Qt::Popup | Qt::X11BypassWindowManagerHint);
|
||||||
}
|
}
|
||||||
@@ -788,7 +813,7 @@ void ShortcutDialog::accept()
|
|||||||
}
|
}
|
||||||
if (seq[0] == QKeyCombination(Qt::Key_Space) || seq[0].keyboardModifiers() == Qt::NoModifier) {
|
if (seq[0] == QKeyCombination(Qt::Key_Space) || seq[0].keyboardModifiers() == Qt::NoModifier) {
|
||||||
// clear
|
// clear
|
||||||
m_ui.keySequenceEdit->clear();
|
m_keySequenceEdit->clear();
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -805,7 +830,7 @@ void ShortcutDialog::done(int r)
|
|||||||
void ShortcutDialog::keySequenceChanged()
|
void ShortcutDialog::keySequenceChanged()
|
||||||
{
|
{
|
||||||
activateWindow(); // where is the kbd focus lost? cause of popup state?
|
activateWindow(); // where is the kbd focus lost? cause of popup state?
|
||||||
QKeySequence seq = m_ui.keySequenceEdit->keySequence();
|
QKeySequence seq = m_keySequenceEdit->keySequence();
|
||||||
if (_shortcut == seq) {
|
if (_shortcut == seq) {
|
||||||
return; // don't try to update the same
|
return; // don't try to update the same
|
||||||
}
|
}
|
||||||
@@ -816,7 +841,7 @@ void ShortcutDialog::keySequenceChanged()
|
|||||||
}
|
}
|
||||||
if (seq.count() > 1) {
|
if (seq.count() > 1) {
|
||||||
seq = QKeySequence(seq[0]);
|
seq = QKeySequence(seq[0]);
|
||||||
m_ui.keySequenceEdit->setKeySequence(seq);
|
m_keySequenceEdit->setKeySequence(seq);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the key sequence is used currently
|
// Check if the key sequence is used currently
|
||||||
@@ -825,15 +850,15 @@ void ShortcutDialog::keySequenceChanged()
|
|||||||
QList<KGlobalShortcutInfo> conflicting = KGlobalAccel::globalShortcutsByKey(seq);
|
QList<KGlobalShortcutInfo> conflicting = KGlobalAccel::globalShortcutsByKey(seq);
|
||||||
if (!conflicting.isEmpty()) {
|
if (!conflicting.isEmpty()) {
|
||||||
const KGlobalShortcutInfo &conflict = conflicting.at(0);
|
const KGlobalShortcutInfo &conflict = conflicting.at(0);
|
||||||
m_ui.warning->setText(i18nc("'%1' is a keyboard shortcut like 'ctrl+w'",
|
m_warning->setText(i18nc("'%1' is a keyboard shortcut like 'ctrl+w'",
|
||||||
"<b>%1</b> is already in use", sc));
|
"<b>%1</b> is already in use", sc));
|
||||||
m_ui.warning->setToolTip(i18nc("keyboard shortcut '%1' is used by action '%2' in application '%3'",
|
m_warning->setToolTip(i18nc("keyboard shortcut '%1' is used by action '%2' in application '%3'",
|
||||||
"<b>%1</b> is used by %2 in %3", sc, conflict.friendlyName(), conflict.componentFriendlyName()));
|
"<b>%1</b> is used by %2 in %3", sc, conflict.friendlyName(), conflict.componentFriendlyName()));
|
||||||
m_ui.warning->show();
|
m_warning->show();
|
||||||
m_ui.keySequenceEdit->setKeySequence(shortcut());
|
m_keySequenceEdit->setKeySequence(shortcut());
|
||||||
} else if (seq != _shortcut) {
|
} else if (seq != _shortcut) {
|
||||||
m_ui.warning->hide();
|
m_warning->hide();
|
||||||
if (QPushButton *ok = m_ui.buttonBox->button(QDialogButtonBox::Ok)) {
|
if (QPushButton *ok = m_buttonBox->button(QDialogButtonBox::Ok)) {
|
||||||
ok->setFocus();
|
ok->setFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,6 @@
|
|||||||
SPDX-License-Identifier: GPL-2.0-or-later
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "ui_shortcutdialog.h"
|
|
||||||
|
|
||||||
#include "effect/globals.h"
|
#include "effect/globals.h"
|
||||||
|
|
||||||
// Qt
|
// Qt
|
||||||
@@ -17,7 +15,11 @@
|
|||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
class QAction;
|
class QAction;
|
||||||
|
class QLabel;
|
||||||
|
class QDialogButtonBox;
|
||||||
|
class QKeySequenceEdit;
|
||||||
class QRect;
|
class QRect;
|
||||||
|
class QToolButton;
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
@@ -227,7 +229,10 @@ protected:
|
|||||||
void done(int r) override;
|
void done(int r) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ShortcutDialog m_ui;
|
QKeySequenceEdit *m_keySequenceEdit = nullptr;
|
||||||
|
QLabel *m_warning = nullptr;
|
||||||
|
QToolButton *m_clearButton = nullptr;
|
||||||
|
QDialogButtonBox *m_buttonBox = nullptr;
|
||||||
QKeySequence _shortcut;
|
QKeySequence _shortcut;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,28 @@
|
|||||||
*/
|
*/
|
||||||
#include "orientationsensor.h"
|
#include "orientationsensor.h"
|
||||||
|
|
||||||
|
#include "qorientationreading_compat.h"
|
||||||
|
|
||||||
|
#if __has_include(<QOrientationSensor>)
|
||||||
#include <QOrientationSensor>
|
#include <QOrientationSensor>
|
||||||
|
#define KWIN_HAVE_QT_ORIENTATION_SENSOR 1
|
||||||
|
#else
|
||||||
|
#define KWIN_HAVE_QT_ORIENTATION_SENSOR 0
|
||||||
|
class QOrientationSensor : public QObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using QObject::QObject;
|
||||||
|
|
||||||
|
QOrientationReading *reading() const
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void start()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
@@ -22,6 +43,7 @@ OrientationSensor::~OrientationSensor() = default;
|
|||||||
|
|
||||||
void OrientationSensor::setEnabled(bool enable)
|
void OrientationSensor::setEnabled(bool enable)
|
||||||
{
|
{
|
||||||
|
#if KWIN_HAVE_QT_ORIENTATION_SENSOR
|
||||||
if (enable) {
|
if (enable) {
|
||||||
connect(m_sensor.get(), &QOrientationSensor::readingChanged, this, &OrientationSensor::update, Qt::UniqueConnection);
|
connect(m_sensor.get(), &QOrientationSensor::readingChanged, this, &OrientationSensor::update, Qt::UniqueConnection);
|
||||||
m_sensor->start();
|
m_sensor->start();
|
||||||
@@ -29,6 +51,10 @@ void OrientationSensor::setEnabled(bool enable)
|
|||||||
disconnect(m_sensor.get(), &QOrientationSensor::readingChanged, this, &OrientationSensor::update);
|
disconnect(m_sensor.get(), &QOrientationSensor::readingChanged, this, &OrientationSensor::update);
|
||||||
m_reading->setOrientation(QOrientationReading::Undefined);
|
m_reading->setOrientation(QOrientationReading::Undefined);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
Q_UNUSED(enable)
|
||||||
|
m_reading->setOrientation(QOrientationReading::Undefined);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QOrientationReading *OrientationSensor::reading() const
|
QOrientationReading *OrientationSensor::reading() const
|
||||||
@@ -38,6 +64,7 @@ QOrientationReading *OrientationSensor::reading() const
|
|||||||
|
|
||||||
void OrientationSensor::update()
|
void OrientationSensor::update()
|
||||||
{
|
{
|
||||||
|
#if KWIN_HAVE_QT_ORIENTATION_SENSOR
|
||||||
if (auto reading = m_sensor->reading()) {
|
if (auto reading = m_sensor->reading()) {
|
||||||
if (m_reading->orientation() != reading->orientation()) {
|
if (m_reading->orientation() != reading->orientation()) {
|
||||||
m_reading->setOrientation(reading->orientation());
|
m_reading->setOrientation(reading->orientation());
|
||||||
@@ -47,6 +74,7 @@ void OrientationSensor::update()
|
|||||||
m_reading->setOrientation(QOrientationReading::Orientation::Undefined);
|
m_reading->setOrientation(QOrientationReading::Orientation::Undefined);
|
||||||
Q_EMIT orientationChanged();
|
Q_EMIT orientationChanged();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if __has_include(<QOrientationReading>)
|
||||||
|
#include <QOrientationReading>
|
||||||
|
#else
|
||||||
|
class QOrientationReading
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Orientation {
|
||||||
|
TopUp,
|
||||||
|
TopDown,
|
||||||
|
LeftUp,
|
||||||
|
RightUp,
|
||||||
|
FaceUp,
|
||||||
|
FaceDown,
|
||||||
|
Undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
QOrientationReading() = default;
|
||||||
|
|
||||||
|
Orientation orientation() const
|
||||||
|
{
|
||||||
|
return m_orientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setOrientation(Orientation orientation)
|
||||||
|
{
|
||||||
|
m_orientation = orientation;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Orientation m_orientation = Undefined;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
@@ -78,14 +78,18 @@ RamFile::RamFile(const char *name, const void *inData, int size, RamFile::Flags
|
|||||||
m_tmp->unmap(data);
|
m_tmp->unmap(data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(F_SEAL_SHRINK) && defined(F_SEAL_GROW) && defined(F_SEAL_SEAL) && defined(F_ADD_SEALS)
|
||||||
int seals = F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_SEAL;
|
int seals = F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_SEAL;
|
||||||
if (flags.testFlag(RamFile::Flag::SealWrite)) {
|
if (flags.testFlag(RamFile::Flag::SealWrite)) {
|
||||||
|
#if defined(F_SEAL_WRITE)
|
||||||
seals |= F_SEAL_WRITE;
|
seals |= F_SEAL_WRITE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// This can fail for QTemporaryFile based on the underlying file system.
|
// This can fail for QTemporaryFile based on the underlying file system.
|
||||||
if (fcntl(fd(), F_ADD_SEALS, seals) != 0) {
|
if (fcntl(fd(), F_ADD_SEALS, seals) != 0) {
|
||||||
qCDebug(KWIN_CORE).nospace() << name << ": Failed to seal RamFile: " << strerror(errno);
|
qCDebug(KWIN_CORE).nospace() << name << ": Failed to seal RamFile: " << strerror(errno);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
guard.dismiss();
|
guard.dismiss();
|
||||||
}
|
}
|
||||||
@@ -137,12 +141,16 @@ RamFile::Flags RamFile::effectiveFlags() const
|
|||||||
{
|
{
|
||||||
Flags flags = {};
|
Flags flags = {};
|
||||||
|
|
||||||
|
#if defined(F_GET_SEALS) && defined(F_SEAL_WRITE)
|
||||||
const int seals = fcntl(fd(), F_GET_SEALS);
|
const int seals = fcntl(fd(), F_GET_SEALS);
|
||||||
if (seals > 0) {
|
if (seals > 0) {
|
||||||
if (seals & F_SEAL_WRITE) {
|
if (seals & F_SEAL_WRITE) {
|
||||||
flags.setFlag(Flag::SealWrite);
|
flags.setFlag(Flag::SealWrite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
flags = m_flags;
|
||||||
|
#endif
|
||||||
|
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ SecurityContext::~SecurityContext()
|
|||||||
|
|
||||||
void SecurityContext::onListenFdActivated(QSocketDescriptor socketDescriptor)
|
void SecurityContext::onListenFdActivated(QSocketDescriptor socketDescriptor)
|
||||||
{
|
{
|
||||||
const int clientFd = accept4(socketDescriptor, nullptr, nullptr, SOCK_CLOEXEC);
|
const int clientFd = accept(socketDescriptor, nullptr, nullptr);
|
||||||
if (clientFd < 0) {
|
if (clientFd < 0) {
|
||||||
qCWarning(KWIN_CORE) << "Failed to accept client from security listen FD:" << strerror(errno);
|
qCWarning(KWIN_CORE) << "Failed to accept client from security listen FD:" << strerror(errno);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
#include "wayland/plasmawindowmanagement.h"
|
#include "wayland/plasmawindowmanagement.h"
|
||||||
#include "wayland/surface.h"
|
#include "wayland/surface.h"
|
||||||
#include "wayland_server.h"
|
#include "wayland_server.h"
|
||||||
|
|
||||||
|
#include <KLocalizedString>
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
|
||||||
#include <KDecoration3/DecoratedWindow>
|
#include <KDecoration3/DecoratedWindow>
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
SPDX-License-Identifier: GPL-2.0-or-later
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
#include "xkb.h"
|
#include "xkb.h"
|
||||||
#include "dbusproperties_interface.h"
|
|
||||||
#include "inputmethod.h"
|
#include "inputmethod.h"
|
||||||
#include "utils/c_ptr.h"
|
#include "utils/c_ptr.h"
|
||||||
#include "utils/common.h"
|
#include "utils/common.h"
|
||||||
@@ -18,8 +17,9 @@
|
|||||||
#include <KConfigGroup>
|
#include <KConfigGroup>
|
||||||
// Qt
|
// Qt
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QDBusInterface>
|
||||||
|
#include <QDBusReply>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
#include <QtGui/private/qxkbcommon_p.h>
|
|
||||||
// xkbcommon
|
// xkbcommon
|
||||||
#include <xkbcommon/xkbcommon-compose.h>
|
#include <xkbcommon/xkbcommon-compose.h>
|
||||||
#include <xkbcommon/xkbcommon-keysyms.h>
|
#include <xkbcommon/xkbcommon-keysyms.h>
|
||||||
@@ -406,6 +406,80 @@ static const TransKey g_rgSymXToQT[] = {
|
|||||||
{ XKB_KEY_XF86LaunchE, Qt::Key_LaunchE },
|
{ XKB_KEY_XF86LaunchE, Qt::Key_LaunchE },
|
||||||
{ XKB_KEY_XF86LaunchF, Qt::Key_LaunchF },
|
{ XKB_KEY_XF86LaunchF, Qt::Key_LaunchF },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool isLatin1Keysym(xkb_keysym_t sym)
|
||||||
|
{
|
||||||
|
return sym >= 0x20 && sym <= 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool isKeypadKeysym(xkb_keysym_t sym)
|
||||||
|
{
|
||||||
|
switch (sym) {
|
||||||
|
case XKB_KEY_KP_Space:
|
||||||
|
case XKB_KEY_KP_Tab:
|
||||||
|
case XKB_KEY_KP_Enter:
|
||||||
|
case XKB_KEY_KP_F1:
|
||||||
|
case XKB_KEY_KP_F2:
|
||||||
|
case XKB_KEY_KP_F3:
|
||||||
|
case XKB_KEY_KP_F4:
|
||||||
|
case XKB_KEY_KP_Home:
|
||||||
|
case XKB_KEY_KP_Left:
|
||||||
|
case XKB_KEY_KP_Up:
|
||||||
|
case XKB_KEY_KP_Right:
|
||||||
|
case XKB_KEY_KP_Down:
|
||||||
|
case XKB_KEY_KP_Prior:
|
||||||
|
case XKB_KEY_KP_Next:
|
||||||
|
case XKB_KEY_KP_End:
|
||||||
|
case XKB_KEY_KP_Begin:
|
||||||
|
case XKB_KEY_KP_Insert:
|
||||||
|
case XKB_KEY_KP_Delete:
|
||||||
|
case XKB_KEY_KP_Equal:
|
||||||
|
case XKB_KEY_KP_Multiply:
|
||||||
|
case XKB_KEY_KP_Add:
|
||||||
|
case XKB_KEY_KP_Separator:
|
||||||
|
case XKB_KEY_KP_Subtract:
|
||||||
|
case XKB_KEY_KP_Decimal:
|
||||||
|
case XKB_KEY_KP_Divide:
|
||||||
|
case XKB_KEY_KP_0:
|
||||||
|
case XKB_KEY_KP_1:
|
||||||
|
case XKB_KEY_KP_2:
|
||||||
|
case XKB_KEY_KP_3:
|
||||||
|
case XKB_KEY_KP_4:
|
||||||
|
case XKB_KEY_KP_5:
|
||||||
|
case XKB_KEY_KP_6:
|
||||||
|
case XKB_KEY_KP_7:
|
||||||
|
case XKB_KEY_KP_8:
|
||||||
|
case XKB_KEY_KP_9:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void convertCase(xkb_keysym_t sym, xkb_keysym_t *lower, xkb_keysym_t *upper)
|
||||||
|
{
|
||||||
|
if (lower) {
|
||||||
|
*lower = xkb_keysym_to_lower(sym);
|
||||||
|
}
|
||||||
|
if (upper) {
|
||||||
|
*upper = xkb_keysym_to_upper(sym);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int keysymToQtKeyLocal(xkb_keysym_t keysym)
|
||||||
|
{
|
||||||
|
for (const TransKey &tk : g_rgSymXToQT) {
|
||||||
|
if (tk.keySymX == keysym) {
|
||||||
|
return tk.keySymQt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isLatin1Keysym(keysym)) {
|
||||||
|
return int(keysym);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Qt::Key_unknown;
|
||||||
|
}
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
static void xkbLogHandler(xkb_context *context, xkb_log_level priority, const char *format, va_list args)
|
static void xkbLogHandler(xkb_context *context, xkb_log_level priority, const char *format, va_list args)
|
||||||
@@ -614,8 +688,9 @@ xkb_keymap *Xkb::loadDefaultKeymap()
|
|||||||
|
|
||||||
xkb_keymap *Xkb::loadKeymapFromLocale1()
|
xkb_keymap *Xkb::loadKeymapFromLocale1()
|
||||||
{
|
{
|
||||||
OrgFreedesktopDBusPropertiesInterface locale1Properties(s_locale1Interface, "/org/freedesktop/locale1", QDBusConnection::systemBus(), this);
|
QDBusInterface locale1Properties(s_locale1Interface, "/org/freedesktop/locale1", s_locale1Interface, QDBusConnection::systemBus(), this);
|
||||||
const QVariantMap properties = locale1Properties.GetAll(s_locale1Interface);
|
QDBusReply<QVariantMap> reply = locale1Properties.call(QStringLiteral("GetAll"), QString::fromLatin1(s_locale1Interface));
|
||||||
|
const QVariantMap properties = reply.isValid() ? reply.value() : QVariantMap{};
|
||||||
|
|
||||||
const QByteArray model = properties["X11Model"].toByteArray();
|
const QByteArray model = properties["X11Model"].toByteArray();
|
||||||
const QByteArray layout = properties["X11Layout"].toByteArray();
|
const QByteArray layout = properties["X11Layout"].toByteArray();
|
||||||
@@ -965,7 +1040,9 @@ Qt::Key Xkb::toQtKey(xkb_keysym_t keySym,
|
|||||||
Qt::KeyboardModifiers modifiers) const
|
Qt::KeyboardModifiers modifiers) const
|
||||||
{
|
{
|
||||||
// FIXME: passing superAsMeta doesn't have impact due to bug in the Qt function, so handle it below
|
// FIXME: passing superAsMeta doesn't have impact due to bug in the Qt function, so handle it below
|
||||||
Qt::Key qtKey = Qt::Key(QXkbCommon::keysymToQtKey(keySym, modifiers, m_state, scanCode + EVDEV_OFFSET));
|
Q_UNUSED(modifiers)
|
||||||
|
Q_UNUSED(scanCode)
|
||||||
|
Qt::Key qtKey = Qt::Key(keysymToQtKeyLocal(keySym));
|
||||||
|
|
||||||
// FIXME: workarounds for symbols currently wrong/not mappable via keysymToQtKey()
|
// FIXME: workarounds for symbols currently wrong/not mappable via keysymToQtKey()
|
||||||
if (qtKey > 0xff && keySym <= 0xff) {
|
if (qtKey > 0xff && keySym <= 0xff) {
|
||||||
@@ -1255,9 +1332,9 @@ QList<xkb_keysym_t> Xkb::keysymsFromQtKey(int keyQt)
|
|||||||
syms.append(XKB_KEY_KP_0 + (symQt - Qt::Key_0));
|
syms.append(XKB_KEY_KP_0 + (symQt - Qt::Key_0));
|
||||||
return syms;
|
return syms;
|
||||||
}
|
}
|
||||||
} else if (QXkbCommon::isLatin1(symQt)) {
|
} else if (isLatin1Keysym(symQt)) {
|
||||||
xkb_keysym_t lower, upper;
|
xkb_keysym_t lower, upper;
|
||||||
QXkbCommon::xkbcommon_XConvertCase(symQt, &lower, &upper);
|
convertCase(symQt, &lower, &upper);
|
||||||
if (keyQt & Qt::ShiftModifier) {
|
if (keyQt & Qt::ShiftModifier) {
|
||||||
syms.append(upper);
|
syms.append(upper);
|
||||||
} else {
|
} else {
|
||||||
@@ -1269,10 +1346,10 @@ QList<xkb_keysym_t> Xkb::keysymsFromQtKey(int keyQt)
|
|||||||
for (const TransKey &tk : g_rgSymXToQT) {
|
for (const TransKey &tk : g_rgSymXToQT) {
|
||||||
if (tk.keySymQt == symQt) {
|
if (tk.keySymQt == symQt) {
|
||||||
// Use keysyms from the keypad if and only if KeypadModifier is set
|
// Use keysyms from the keypad if and only if KeypadModifier is set
|
||||||
if (hasKeypadMod && !QXkbCommon::isKeypad(tk.keySymX)) {
|
if (hasKeypadMod && !isKeypadKeysym(tk.keySymX)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!hasKeypadMod && QXkbCommon::isKeypad(tk.keySymX)) {
|
if (!hasKeypadMod && isKeypadKeysym(tk.keySymX)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
syms.append(tk.keySymX);
|
syms.append(tk.keySymX);
|
||||||
|
|||||||
Reference in New Issue
Block a user