Add kwin full source tree, greeter login, zsh, pcid service, and build system improvements
This commit is contained in:
@@ -233,7 +233,6 @@ target_link_libraries(kwin
|
||||
PRIVATE
|
||||
Qt::Concurrent
|
||||
Qt::GuiPrivate
|
||||
Qt::Qml
|
||||
Qt::Svg
|
||||
|
||||
KF6::ColorScheme
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
#include "appmenu.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
#include <appmenu_interface.h>
|
||||
|
||||
#include <QDBusObjectPath>
|
||||
#include <QDBusServiceWatcher>
|
||||
|
||||
#include "decorations/decorationbridge.h"
|
||||
#include <KDecoration3/DecorationSettings>
|
||||
@@ -19,8 +22,28 @@
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
static const QString s_viewService(QStringLiteral("org.kde.kappmenuview"));
|
||||
|
||||
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
|
||||
@@ -30,7 +53,13 @@ bool ApplicationMenu::applicationMenuEnabled() const
|
||||
|
||||
void ApplicationMenu::setViewEnabled(bool enabled)
|
||||
{
|
||||
Q_UNUSED(enabled)
|
||||
if (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)
|
||||
@@ -63,9 +92,10 @@ void ApplicationMenu::slotMenuHidden(const QString &serviceName, const QDBusObje
|
||||
|
||||
void ApplicationMenu::showApplicationMenu(const QPoint &p, Window *c, int actionId)
|
||||
{
|
||||
Q_UNUSED(p)
|
||||
Q_UNUSED(c)
|
||||
Q_UNUSED(actionId)
|
||||
if (!c->hasApplicationMenu()) {
|
||||
return;
|
||||
}
|
||||
m_appmenuInterface->showMenu(p.x(), p.y(), c->applicationMenuServiceName(), QDBusObjectPath(c->applicationMenuObjectPath()), actionId);
|
||||
}
|
||||
|
||||
Window *ApplicationMenu::findWindowWithApplicationMenu(const QString &serviceName, const QDBusObjectPath &menuObjectPath)
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "pointer_input.h"
|
||||
|
||||
#include <QCryptographicHash>
|
||||
#include <libudev.h>
|
||||
#include <QDBusArgument>
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMetaType>
|
||||
@@ -331,10 +330,10 @@ Device::Device(libinput_device *device, QObject *parent)
|
||||
, 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_tabletSwitch(m_switch ? libinput_device_switch_has_switch(m_device, LIBINPUT_SWITCH_TABLET_MODE) : false)
|
||||
, m_touchpad(false)
|
||||
, m_touchpad(m_pointer && udev_device_get_property_value(libinput_device_get_udev_device(m_device), "ID_INPUT_TOUCHPAD"))
|
||||
, m_name(QString::fromLocal8Bit(libinput_device_get_name(m_device)))
|
||||
, m_sysName(QString::fromLocal8Bit(libinput_device_get_sysname(m_device)))
|
||||
, m_sysPath(QString())
|
||||
, m_sysPath(QString::fromLocal8Bit(udev_device_get_syspath(libinput_device_get_udev_device(m_device))))
|
||||
, m_outputName(QString::fromLocal8Bit(libinput_device_get_output_name(m_device)))
|
||||
, m_product(libinput_device_get_id_product(m_device))
|
||||
, m_vendor(libinput_device_get_id_vendor(m_device))
|
||||
|
||||
@@ -22,9 +22,6 @@ namespace KWin
|
||||
|
||||
static std::unique_ptr<DrmDevice> findRenderDevice()
|
||||
{
|
||||
#ifdef Q_OS_REDOX
|
||||
return nullptr;
|
||||
#endif
|
||||
const int deviceCount = drmGetDevices2(0, nullptr, 0);
|
||||
if (deviceCount <= 0) {
|
||||
return nullptr;
|
||||
|
||||
@@ -35,22 +35,11 @@ std::unique_ptr<Session> Session::create()
|
||||
|
||||
std::unique_ptr<Session> Session::create(Type type)
|
||||
{
|
||||
#ifdef Q_OS_REDOX
|
||||
for (const auto &sessionInfo : s_availableSessions) {
|
||||
if (sessionInfo.type == type) {
|
||||
if (auto session = sessionInfo.createFunc()) {
|
||||
return session;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NoopSession::create();
|
||||
#else
|
||||
for (const auto &sessionInfo : s_availableSessions) {
|
||||
if (sessionInfo.type == type) {
|
||||
return sessionInfo.createFunc();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,19 +108,7 @@ static bool activate(const QString &sessionPath)
|
||||
|
||||
std::unique_ptr<LogindSession> LogindSession::create()
|
||||
{
|
||||
const QDBusConnection systemBus = QDBusConnection::systemBus();
|
||||
if (!systemBus.isConnected()) {
|
||||
qCWarning(KWIN_CORE) << "Could not connect to the system D-Bus";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QDBusConnectionInterface *busInterface = systemBus.interface();
|
||||
if (!busInterface) {
|
||||
qCWarning(KWIN_CORE) << "Could not acquire the system D-Bus interface";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!busInterface->isServiceRegistered(s_serviceName)) {
|
||||
if (!QDBusConnection::systemBus().interface()->isServiceRegistered(s_serviceName)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
|
||||
#include "session_noop.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
@@ -43,18 +40,11 @@ uint NoopSession::terminal() const
|
||||
|
||||
int NoopSession::openRestricted(const QString &fileName)
|
||||
{
|
||||
int fd = open(fileName.toUtf8().constData(), O_RDWR | O_CLOEXEC);
|
||||
if (fd >= 0) {
|
||||
return fd;
|
||||
}
|
||||
return open(fileName.toUtf8().constData(), O_RDONLY | O_CLOEXEC);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void NoopSession::closeRestricted(int fileDescriptor)
|
||||
{
|
||||
if (fileDescriptor >= 0) {
|
||||
close(fileDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
void NoopSession::switchTo(uint terminal)
|
||||
|
||||
@@ -6,45 +6,7 @@
|
||||
#include "syncobjtimeline.h"
|
||||
|
||||
#include <cerrno>
|
||||
#ifdef __redox__
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef EFD_CLOEXEC
|
||||
#define EFD_CLOEXEC O_CLOEXEC
|
||||
#endif
|
||||
|
||||
#ifndef EFD_NONBLOCK
|
||||
#define EFD_NONBLOCK O_NONBLOCK
|
||||
#endif
|
||||
|
||||
#ifndef EFD_SEMAPHORE
|
||||
#define EFD_SEMAPHORE 0x1
|
||||
#endif
|
||||
|
||||
static int eventfd(unsigned int initval, int flags)
|
||||
{
|
||||
const int supported = EFD_CLOEXEC | EFD_NONBLOCK | EFD_SEMAPHORE;
|
||||
int oflag = O_RDWR;
|
||||
char path[64];
|
||||
|
||||
if ((flags & ~supported) != 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if (flags & EFD_CLOEXEC) {
|
||||
oflag |= O_CLOEXEC;
|
||||
}
|
||||
if (flags & EFD_NONBLOCK) {
|
||||
oflag |= O_NONBLOCK;
|
||||
}
|
||||
|
||||
snprintf(path, sizeof(path), "/scheme/event/eventfd/%u/%d", initval, (flags & EFD_SEMAPHORE) ? 1 : 0);
|
||||
return open(path, oflag);
|
||||
}
|
||||
#else
|
||||
#include <sys/eventfd.h>
|
||||
#endif
|
||||
#include <sys/ioctl.h>
|
||||
#include <xf86drm.h>
|
||||
|
||||
|
||||
@@ -30,9 +30,7 @@
|
||||
#include <QScreen>
|
||||
#include <QTimer>
|
||||
|
||||
#if KWIN_BUILD_X11
|
||||
#include <xcb/xcb_cursor.h>
|
||||
#endif
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <QPoint>
|
||||
// KF
|
||||
#include <KSharedConfig>
|
||||
|
||||
// xcb
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
class QTimer;
|
||||
|
||||
@@ -9,11 +9,16 @@
|
||||
|
||||
// own
|
||||
#include "dbusinterface.h"
|
||||
#include "compositingadaptor.h"
|
||||
#include "pluginsadaptor.h"
|
||||
#include "virtualdesktopmanageradaptor.h"
|
||||
|
||||
// kwin
|
||||
#include "compositor.h"
|
||||
#include "core/output.h"
|
||||
#include "core/renderbackend.h"
|
||||
#include "debug_console.h"
|
||||
#include "kwinadaptor.h"
|
||||
#include "main.h"
|
||||
#include "placement.h"
|
||||
#include "pluginmanager.h"
|
||||
@@ -26,8 +31,6 @@
|
||||
|
||||
// Qt
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMetaType>
|
||||
#include <QDBusServiceWatcher>
|
||||
#include <QOpenGLContext>
|
||||
|
||||
namespace KWin
|
||||
@@ -37,8 +40,10 @@ DBusInterface::DBusInterface(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_serviceName(QStringLiteral("org.kde.KWin"))
|
||||
{
|
||||
(void)new KWinAdaptor(this);
|
||||
|
||||
QDBusConnection dbus = QDBusConnection::sessionBus();
|
||||
dbus.registerObject(QStringLiteral("/KWin"), this, QDBusConnection::ExportScriptableSlots | QDBusConnection::ExportScriptableSignals | QDBusConnection::ExportScriptableProperties);
|
||||
dbus.registerObject(QStringLiteral("/KWin"), this);
|
||||
dbus.registerService(m_serviceName);
|
||||
dbus.connect(QString(), QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reloadConfig"),
|
||||
Workspace::self(), SLOT(slotReloadConfig()));
|
||||
@@ -132,7 +137,8 @@ void DBusInterface::previousDesktop()
|
||||
|
||||
void DBusInterface::showDebugConsole()
|
||||
{
|
||||
// Debug console is intentionally disabled in the reduced Wayland-only build.
|
||||
DebugConsole *console = new DebugConsole;
|
||||
console->show();
|
||||
}
|
||||
|
||||
void DBusInterface::replace()
|
||||
@@ -256,6 +262,7 @@ CompositorDBusInterface::CompositorDBusInterface(Compositor *parent)
|
||||
, m_compositor(parent)
|
||||
{
|
||||
connect(m_compositor, &Compositor::compositingToggled, this, &CompositorDBusInterface::compositingToggled);
|
||||
new CompositingAdaptor(this);
|
||||
QDBusConnection dbus = QDBusConnection::sessionBus();
|
||||
dbus.registerObject(QStringLiteral("/Compositor"), this);
|
||||
dbus.connect(QString(), QStringLiteral("/Compositor"), QStringLiteral("org.kde.kwin.Compositing"),
|
||||
@@ -336,6 +343,7 @@ VirtualDesktopManagerDBusInterface::VirtualDesktopManagerDBusInterface(VirtualDe
|
||||
qDBusRegisterMetaType<KWin::DBusDesktopDataStruct>();
|
||||
qDBusRegisterMetaType<KWin::DBusDesktopDataVector>();
|
||||
|
||||
new VirtualDesktopManagerAdaptor(this);
|
||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/VirtualDesktopManager"),
|
||||
QStringLiteral("org.kde.KWin.VirtualDesktopManager"),
|
||||
this);
|
||||
@@ -483,6 +491,8 @@ PluginManagerDBusInterface::PluginManagerDBusInterface(PluginManager *manager)
|
||||
: QObject(manager)
|
||||
, m_manager(manager)
|
||||
{
|
||||
new PluginsAdaptor(this);
|
||||
|
||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Plugins"),
|
||||
QStringLiteral("org.kde.KWin.Plugins"),
|
||||
this);
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
# killer helper depends on private Qt QPA headers unavailable in the reduced Redox Qt build.
|
||||
# Skip it for now to keep the compositor build moving.
|
||||
# add_subdirectory(killer)
|
||||
add_subdirectory(wayland_wrapper)
|
||||
|
||||
@@ -27,12 +27,9 @@
|
||||
#include <QDebug>
|
||||
#include <QProcess>
|
||||
#include <QTemporaryFile>
|
||||
#include <QTimer>
|
||||
|
||||
#include <KSignalHandler>
|
||||
#ifndef Q_OS_REDOX
|
||||
#include <KUpdateLaunchEnvironmentJob>
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
@@ -151,9 +148,7 @@ void KWinWrapper::run()
|
||||
}
|
||||
qputenv("KWIN_RESTART_COUNT", QByteArray::number(m_crashCount));
|
||||
// restart
|
||||
QTimer::singleShot(0, this, [this]() {
|
||||
m_kwinProcess->start();
|
||||
});
|
||||
m_kwinProcess->start();
|
||||
});
|
||||
|
||||
m_kwinProcess->start();
|
||||
@@ -168,15 +163,11 @@ void KWinWrapper::run()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef Q_OS_REDOX
|
||||
Q_UNUSED(env)
|
||||
#else
|
||||
auto envSyncJob = new KUpdateLaunchEnvironmentJob(env);
|
||||
connect(envSyncJob, &KUpdateLaunchEnvironmentJob::finished, this, []() {
|
||||
// The service name is merely there to indicate to the world that we're up and ready with all envs exported
|
||||
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.KWinWrapper"));
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
void KWinWrapper::terminate(std::chrono::milliseconds timeout)
|
||||
@@ -203,15 +194,12 @@ int main(int argc, char **argv)
|
||||
QCoreApplication app(argc, argv);
|
||||
app.setQuitLockEnabled(false); // don't exit when the first KJob finishes
|
||||
|
||||
#ifndef Q_OS_REDOX
|
||||
KSignalHandler::self()->watchSignal(SIGTERM);
|
||||
KSignalHandler::self()->watchSignal(SIGHUP);
|
||||
#endif
|
||||
|
||||
KWinWrapper wrapper(&app);
|
||||
wrapper.run();
|
||||
|
||||
#ifndef Q_OS_REDOX
|
||||
QObject::connect(KSignalHandler::self(), &KSignalHandler::signalReceived, &app, [&app, &wrapper](int signal) {
|
||||
if (signal == SIGTERM) {
|
||||
app.quit();
|
||||
@@ -219,7 +207,6 @@ int main(int argc, char **argv)
|
||||
wrapper.restart();
|
||||
}
|
||||
});
|
||||
#endif
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
@@ -21,10 +21,6 @@
|
||||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef SUN_LEN
|
||||
#define SUN_LEN(ptr) ((socklen_t)(offsetof(struct sockaddr_un, sun_path) + strlen((ptr)->sun_path)))
|
||||
#endif
|
||||
|
||||
/* This is the size of the char array in struct sock_addr_un.
|
||||
* No Wayland socket can be created with a path longer than this,
|
||||
* including the null terminator.
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <QMenu>
|
||||
|
||||
#include <linux/input-event-codes.h>
|
||||
#include <private/qxkbcommon_p.h>
|
||||
#include <unistd.h>
|
||||
#include <xkbcommon/xkbcommon-keysyms.h>
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "compositor_wayland.h"
|
||||
#include "core/outputbackend.h"
|
||||
#include "core/session.h"
|
||||
#include "core/session_noop.h"
|
||||
#include "effect/effecthandler.h"
|
||||
#include "inputmethod.h"
|
||||
#include "tabletmodemanager.h"
|
||||
@@ -55,9 +54,11 @@
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
Q_IMPORT_PLUGIN(KWinIntegrationPlugin)
|
||||
#if KWIN_BUILD_GLOBALSHORTCUTS
|
||||
Q_IMPORT_PLUGIN(KGlobalAccelImpl)
|
||||
#endif
|
||||
Q_IMPORT_PLUGIN(KWindowSystemKWinPlugin)
|
||||
Q_IMPORT_PLUGIN(KWinIdleTimePoller)
|
||||
|
||||
namespace KWin
|
||||
@@ -432,6 +433,7 @@ int main(int argc, char *argv[])
|
||||
};
|
||||
|
||||
BackendType backendType;
|
||||
QString pluginName;
|
||||
QSize initialWindowSize;
|
||||
int outputCount = 1;
|
||||
qreal outputScale = 1;
|
||||
|
||||
@@ -16,10 +16,8 @@
|
||||
#include <kwin_export.h>
|
||||
#include <memory>
|
||||
|
||||
#if KWIN_BUILD_QTQUICK
|
||||
class QQmlContext;
|
||||
class QQmlComponent;
|
||||
#endif
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
@@ -141,10 +139,8 @@ public:
|
||||
void hide() override;
|
||||
|
||||
private:
|
||||
#if KWIN_BUILD_QTQUICK
|
||||
std::unique_ptr<QQmlContext> m_qmlContext;
|
||||
std::unique_ptr<QQmlComponent> m_qmlComponent;
|
||||
#endif
|
||||
std::unique_ptr<QObject> m_mainItem;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
#include "input_event.h"
|
||||
#include "kscreenintegration.h"
|
||||
#include "workspace.h"
|
||||
#include "utils/qorientationreading_compat.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QOrientationReading>
|
||||
#include <ranges>
|
||||
|
||||
namespace KWin
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
add_library(KWinQpaPlugin MODULE
|
||||
add_library(KWinQpaPlugin OBJECT)
|
||||
target_sources(KWinQpaPlugin PRIVATE
|
||||
backingstore.cpp
|
||||
clipboard.cpp
|
||||
eglhelpers.cpp
|
||||
@@ -12,13 +13,6 @@ add_library(KWinQpaPlugin MODULE
|
||||
window.cpp
|
||||
)
|
||||
|
||||
set_target_properties(KWinQpaPlugin PROPERTIES
|
||||
AUTOMOC ON
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/plugins/platforms"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/plugins/platforms"
|
||||
OUTPUT_NAME "qwayland-org.kde.kwin.qpa"
|
||||
)
|
||||
|
||||
ecm_qt_declare_logging_category(KWinQpaPlugin
|
||||
HEADER logging.h
|
||||
IDENTIFIER KWIN_QPA
|
||||
@@ -26,6 +20,8 @@ ecm_qt_declare_logging_category(KWinQpaPlugin
|
||||
DEFAULT_SEVERITY Critical
|
||||
)
|
||||
|
||||
target_compile_definitions(KWinQpaPlugin PRIVATE QT_STATICPLUGIN)
|
||||
|
||||
target_link_libraries(KWinQpaPlugin PRIVATE
|
||||
Qt::Concurrent
|
||||
Qt::CorePrivate
|
||||
@@ -34,5 +30,3 @@ target_link_libraries(KWinQpaPlugin PRIVATE
|
||||
Fontconfig::Fontconfig
|
||||
kwin
|
||||
)
|
||||
|
||||
install(TARGETS KWinQpaPlugin DESTINATION plugins/platforms)
|
||||
|
||||
@@ -137,7 +137,7 @@ QPlatformWindow *Integration::createPlatformWindow(QWindow *window) const
|
||||
|
||||
QPlatformOffscreenSurface *Integration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
|
||||
{
|
||||
return new KWin::QPA::OffscreenSurface(surface);
|
||||
return new OffscreenSurface(surface);
|
||||
}
|
||||
|
||||
QPlatformFontDatabase *Integration::fontDatabase() const
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
File=rulesettings.kcfg
|
||||
IncludeFiles="rules.h",netwm_def.h
|
||||
IncludeFiles=\"rules.h\",netwm_def.h
|
||||
NameSpace=KWin
|
||||
ClassName=RuleSettings
|
||||
UseEnumTypes=true
|
||||
|
||||
@@ -31,6 +31,7 @@ class SwipeGesture;
|
||||
class SwipeGestureHandler : public QObject, public QQmlParserStatus
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QQmlParserStatus)
|
||||
|
||||
Q_PROPERTY(Direction direction READ direction WRITE setDirection NOTIFY directionChanged)
|
||||
Q_PROPERTY(int fingerCount READ fingerCount WRITE setFingerCount NOTIFY fingerCountChanged)
|
||||
@@ -103,6 +104,7 @@ private:
|
||||
class PinchGestureHandler : public QObject, public QQmlParserStatus
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QQmlParserStatus)
|
||||
|
||||
Q_PROPERTY(Direction direction READ direction WRITE setDirection NOTIFY directionChanged)
|
||||
Q_PROPERTY(int fingerCount READ fingerCount WRITE setFingerCount NOTIFY fingerCountChanged)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "effect/quickeffect.h"
|
||||
|
||||
#include <KDeclarative/KConfigPropertyMap>
|
||||
#include <KConfigPropertyMap>
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
|
||||
@@ -22,11 +22,9 @@
|
||||
#include <QDBusContext>
|
||||
#include <QDBusMessage>
|
||||
|
||||
class QQmlComponent;
|
||||
class QQmlContext;
|
||||
class QQmlEngine;
|
||||
#if KWIN_BUILD_QTQUICK
|
||||
class QQmlComponent;
|
||||
#endif
|
||||
class QAction;
|
||||
class QMenu;
|
||||
class QRecursiveMutex;
|
||||
@@ -251,7 +249,6 @@ private:
|
||||
QJSValueList m_userActionsMenuCallbacks;
|
||||
};
|
||||
|
||||
#if KWIN_BUILD_QTQUICK
|
||||
class DeclarativeScript : public AbstractScript
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -269,7 +266,6 @@ private:
|
||||
QQmlContext *m_context;
|
||||
QQmlComponent *m_component;
|
||||
};
|
||||
#endif
|
||||
|
||||
class JSEngineGlobalMethodsWrapper : public QObject
|
||||
{
|
||||
@@ -297,14 +293,14 @@ public:
|
||||
ScreenArea
|
||||
};
|
||||
Q_ENUM(ClientAreaOption)
|
||||
explicit JSEngineGlobalMethodsWrapper(AbstractScript *parent);
|
||||
explicit JSEngineGlobalMethodsWrapper(DeclarativeScript *parent);
|
||||
~JSEngineGlobalMethodsWrapper() override;
|
||||
|
||||
public Q_SLOTS:
|
||||
QVariant readConfig(const QString &key, QVariant defaultValue = QVariant());
|
||||
|
||||
private:
|
||||
AbstractScript *m_script;
|
||||
DeclarativeScript *m_script;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -329,9 +325,7 @@ private:
|
||||
public:
|
||||
~Scripting() override;
|
||||
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());
|
||||
#endif
|
||||
Q_SCRIPTABLE Q_INVOKABLE bool isScriptLoaded(const QString &pluginName) const;
|
||||
Q_SCRIPTABLE Q_INVOKABLE bool unloadScript(const QString &pluginName);
|
||||
|
||||
@@ -346,10 +340,8 @@ public:
|
||||
|
||||
QQmlEngine *qmlEngine() const;
|
||||
QQmlEngine *qmlEngine();
|
||||
#if KWIN_BUILD_QTQUICK
|
||||
QQmlContext *declarativeScriptSharedContext() const;
|
||||
QQmlContext *declarativeScriptSharedContext();
|
||||
#endif
|
||||
QtScriptWorkspaceWrapper *workspaceWrapper() const;
|
||||
|
||||
AbstractScript *findScript(const QString &pluginName) const;
|
||||
@@ -383,7 +375,6 @@ inline QQmlEngine *Scripting::qmlEngine()
|
||||
return m_qmlEngine;
|
||||
}
|
||||
|
||||
#if KWIN_BUILD_QTQUICK
|
||||
inline QQmlContext *Scripting::declarativeScriptSharedContext() const
|
||||
{
|
||||
return m_declarativeScriptSharedContext;
|
||||
@@ -393,7 +384,6 @@ inline QQmlContext *Scripting::declarativeScriptSharedContext()
|
||||
{
|
||||
return m_declarativeScriptSharedContext;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline QtScriptWorkspaceWrapper *Scripting::workspaceWrapper() const
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace KWin
|
||||
class ShortcutHandler : public QObject, public QQmlParserStatus
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QQmlParserStatus)
|
||||
|
||||
/**
|
||||
* This property specifies the unique shortcut identifier, not localized.
|
||||
|
||||
@@ -2,5 +2,5 @@ File=kwin.kcfg
|
||||
NameSpace=KWin
|
||||
ClassName=Settings
|
||||
# options.h is needed for FocusPolicy and PlacementPolicy
|
||||
IncludeFiles="options.h"
|
||||
IncludeFiles=\"options.h\"
|
||||
UseEnumTypes=true
|
||||
|
||||
@@ -31,8 +31,7 @@
|
||||
#include <KService>
|
||||
#endif
|
||||
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMessage>
|
||||
#include "sessionadaptor.h"
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
@@ -356,6 +355,7 @@ SessionInfo *SessionManager::takeSessionInfo(X11Window *c)
|
||||
SessionManager::SessionManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
new SessionAdaptor(this);
|
||||
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Session"), this);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
|
||||
#include "tabletmodemanager.h"
|
||||
|
||||
#include "backends/libinput/device.h"
|
||||
#include "core/inputdevice.h"
|
||||
#include "input.h"
|
||||
#include "input_event.h"
|
||||
#include "input_event_spy.h"
|
||||
#include "main.h"
|
||||
#include "wayland_server.h"
|
||||
|
||||
@@ -18,8 +21,99 @@
|
||||
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()
|
||||
{
|
||||
if (waylandServer()) {
|
||||
if (input()->hasTabletModeSwitch()) {
|
||||
input()->installInputEventSpy(new TabletModeSwitchEventSpy(this));
|
||||
} else {
|
||||
hasTabletModeInputChanged(false);
|
||||
}
|
||||
}
|
||||
|
||||
KSharedConfig::Ptr kwinSettings = kwinApp()->config();
|
||||
m_settingsWatcher = KConfigWatcher::create(kwinSettings);
|
||||
connect(m_settingsWatcher.data(), &KConfigWatcher::configChanged, this, &KWin::TabletModeManager::refreshSettings);
|
||||
@@ -31,8 +125,9 @@ TabletModeManager::TabletModeManager()
|
||||
// NOTE: slots must be exported for properties to work correctly
|
||||
QDBusConnection::ExportAllProperties | QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllSlots);
|
||||
|
||||
setTabletModeAvailable(false);
|
||||
setIsTablet(false);
|
||||
if (waylandServer()) {
|
||||
connect(input(), &InputRedirection::hasTabletModeSwitchChanged, this, &TabletModeManager::hasTabletModeInputChanged);
|
||||
}
|
||||
}
|
||||
|
||||
void KWin::TabletModeManager::refreshSettings()
|
||||
@@ -58,9 +153,17 @@ void KWin::TabletModeManager::refreshSettings()
|
||||
|
||||
void KWin::TabletModeManager::hasTabletModeInputChanged(bool set)
|
||||
{
|
||||
Q_UNUSED(set)
|
||||
setTabletModeAvailable(false);
|
||||
setIsTablet(false);
|
||||
if (set) {
|
||||
input()->installInputEventSpy(new TabletModeSwitchEventSpy(this));
|
||||
setTabletModeAvailable(true);
|
||||
} else {
|
||||
auto spy = new TabletModeTouchpadRemovedSpy(this);
|
||||
connect(input(), &InputRedirection::hasTabletModeSwitchChanged, spy, [spy](bool set) {
|
||||
if (set) {
|
||||
spy->deleteLater();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
bool TabletModeManager::isTabletModeAvailable() const
|
||||
|
||||
@@ -48,13 +48,7 @@
|
||||
|
||||
#include <QAction>
|
||||
#include <QCheckBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QKeySequenceEdit>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QToolButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWindow>
|
||||
|
||||
#include <KGlobalAccel>
|
||||
@@ -770,35 +764,16 @@ void UserActionsMenu::slotWindowOperation(QAction *action)
|
||||
ShortcutDialog::ShortcutDialog(const QKeySequence &cut)
|
||||
: _shortcut(cut)
|
||||
{
|
||||
auto *layout = new QVBoxLayout(this);
|
||||
|
||||
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);
|
||||
m_ui.setupUi(this);
|
||||
m_ui.keySequenceEdit->setKeySequence(cut);
|
||||
m_ui.warning->hide();
|
||||
|
||||
// Listen to changed shortcuts
|
||||
connect(m_keySequenceEdit, &QKeySequenceEdit::editingFinished, this, &ShortcutDialog::keySequenceChanged);
|
||||
connect(m_clearButton, &QToolButton::clicked, this, [this] {
|
||||
connect(m_ui.keySequenceEdit, &QKeySequenceEdit::editingFinished, this, &ShortcutDialog::keySequenceChanged);
|
||||
connect(m_ui.clearButton, &QToolButton::clicked, this, [this] {
|
||||
_shortcut = QKeySequence();
|
||||
});
|
||||
m_keySequenceEdit->setFocus();
|
||||
m_ui.keySequenceEdit->setFocus();
|
||||
|
||||
setWindowFlags(Qt::Popup | Qt::X11BypassWindowManagerHint);
|
||||
}
|
||||
@@ -813,7 +788,7 @@ void ShortcutDialog::accept()
|
||||
}
|
||||
if (seq[0] == QKeyCombination(Qt::Key_Space) || seq[0].keyboardModifiers() == Qt::NoModifier) {
|
||||
// clear
|
||||
m_keySequenceEdit->clear();
|
||||
m_ui.keySequenceEdit->clear();
|
||||
QDialog::accept();
|
||||
return;
|
||||
}
|
||||
@@ -830,7 +805,7 @@ void ShortcutDialog::done(int r)
|
||||
void ShortcutDialog::keySequenceChanged()
|
||||
{
|
||||
activateWindow(); // where is the kbd focus lost? cause of popup state?
|
||||
QKeySequence seq = m_keySequenceEdit->keySequence();
|
||||
QKeySequence seq = m_ui.keySequenceEdit->keySequence();
|
||||
if (_shortcut == seq) {
|
||||
return; // don't try to update the same
|
||||
}
|
||||
@@ -841,7 +816,7 @@ void ShortcutDialog::keySequenceChanged()
|
||||
}
|
||||
if (seq.count() > 1) {
|
||||
seq = QKeySequence(seq[0]);
|
||||
m_keySequenceEdit->setKeySequence(seq);
|
||||
m_ui.keySequenceEdit->setKeySequence(seq);
|
||||
}
|
||||
|
||||
// Check if the key sequence is used currently
|
||||
@@ -850,15 +825,15 @@ void ShortcutDialog::keySequenceChanged()
|
||||
QList<KGlobalShortcutInfo> conflicting = KGlobalAccel::globalShortcutsByKey(seq);
|
||||
if (!conflicting.isEmpty()) {
|
||||
const KGlobalShortcutInfo &conflict = conflicting.at(0);
|
||||
m_warning->setText(i18nc("'%1' is a keyboard shortcut like 'ctrl+w'",
|
||||
m_ui.warning->setText(i18nc("'%1' is a keyboard shortcut like 'ctrl+w'",
|
||||
"<b>%1</b> is already in use", sc));
|
||||
m_warning->setToolTip(i18nc("keyboard shortcut '%1' is used by action '%2' in application '%3'",
|
||||
m_ui.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()));
|
||||
m_warning->show();
|
||||
m_keySequenceEdit->setKeySequence(shortcut());
|
||||
m_ui.warning->show();
|
||||
m_ui.keySequenceEdit->setKeySequence(shortcut());
|
||||
} else if (seq != _shortcut) {
|
||||
m_warning->hide();
|
||||
if (QPushButton *ok = m_buttonBox->button(QDialogButtonBox::Ok)) {
|
||||
m_ui.warning->hide();
|
||||
if (QPushButton *ok = m_ui.buttonBox->button(QDialogButtonBox::Ok)) {
|
||||
ok->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#pragma once
|
||||
#include "ui_shortcutdialog.h"
|
||||
|
||||
#include "effect/globals.h"
|
||||
|
||||
// Qt
|
||||
@@ -15,11 +17,7 @@
|
||||
#include <QPointer>
|
||||
|
||||
class QAction;
|
||||
class QLabel;
|
||||
class QDialogButtonBox;
|
||||
class QKeySequenceEdit;
|
||||
class QRect;
|
||||
class QToolButton;
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
@@ -229,10 +227,7 @@ protected:
|
||||
void done(int r) override;
|
||||
|
||||
private:
|
||||
QKeySequenceEdit *m_keySequenceEdit = nullptr;
|
||||
QLabel *m_warning = nullptr;
|
||||
QToolButton *m_clearButton = nullptr;
|
||||
QDialogButtonBox *m_buttonBox = nullptr;
|
||||
Ui::ShortcutDialog m_ui;
|
||||
QKeySequence _shortcut;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,28 +6,7 @@
|
||||
*/
|
||||
#include "orientationsensor.h"
|
||||
|
||||
#include "qorientationreading_compat.h"
|
||||
|
||||
#if __has_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
|
||||
{
|
||||
@@ -43,7 +22,6 @@ OrientationSensor::~OrientationSensor() = default;
|
||||
|
||||
void OrientationSensor::setEnabled(bool enable)
|
||||
{
|
||||
#if KWIN_HAVE_QT_ORIENTATION_SENSOR
|
||||
if (enable) {
|
||||
connect(m_sensor.get(), &QOrientationSensor::readingChanged, this, &OrientationSensor::update, Qt::UniqueConnection);
|
||||
m_sensor->start();
|
||||
@@ -51,10 +29,6 @@ void OrientationSensor::setEnabled(bool enable)
|
||||
disconnect(m_sensor.get(), &QOrientationSensor::readingChanged, this, &OrientationSensor::update);
|
||||
m_reading->setOrientation(QOrientationReading::Undefined);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(enable)
|
||||
m_reading->setOrientation(QOrientationReading::Undefined);
|
||||
#endif
|
||||
}
|
||||
|
||||
QOrientationReading *OrientationSensor::reading() const
|
||||
@@ -64,7 +38,6 @@ QOrientationReading *OrientationSensor::reading() const
|
||||
|
||||
void OrientationSensor::update()
|
||||
{
|
||||
#if KWIN_HAVE_QT_ORIENTATION_SENSOR
|
||||
if (auto reading = m_sensor->reading()) {
|
||||
if (m_reading->orientation() != reading->orientation()) {
|
||||
m_reading->setOrientation(reading->orientation());
|
||||
@@ -74,7 +47,6 @@ void OrientationSensor::update()
|
||||
m_reading->setOrientation(QOrientationReading::Orientation::Undefined);
|
||||
Q_EMIT orientationChanged();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#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,18 +78,14 @@ RamFile::RamFile(const char *name, const void *inData, int size, RamFile::Flags
|
||||
m_tmp->unmap(data);
|
||||
#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;
|
||||
if (flags.testFlag(RamFile::Flag::SealWrite)) {
|
||||
#if defined(F_SEAL_WRITE)
|
||||
seals |= F_SEAL_WRITE;
|
||||
#endif
|
||||
}
|
||||
// This can fail for QTemporaryFile based on the underlying file system.
|
||||
if (fcntl(fd(), F_ADD_SEALS, seals) != 0) {
|
||||
qCDebug(KWIN_CORE).nospace() << name << ": Failed to seal RamFile: " << strerror(errno);
|
||||
}
|
||||
#endif
|
||||
|
||||
guard.dismiss();
|
||||
}
|
||||
@@ -141,16 +137,12 @@ RamFile::Flags RamFile::effectiveFlags() const
|
||||
{
|
||||
Flags flags = {};
|
||||
|
||||
#if defined(F_GET_SEALS) && defined(F_SEAL_WRITE)
|
||||
const int seals = fcntl(fd(), F_GET_SEALS);
|
||||
if (seals > 0) {
|
||||
if (seals & F_SEAL_WRITE) {
|
||||
flags.setFlag(Flag::SealWrite);
|
||||
}
|
||||
}
|
||||
#else
|
||||
flags = m_flags;
|
||||
#endif
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ SecurityContext::~SecurityContext()
|
||||
|
||||
void SecurityContext::onListenFdActivated(QSocketDescriptor socketDescriptor)
|
||||
{
|
||||
const int clientFd = accept(socketDescriptor, nullptr, nullptr);
|
||||
const int clientFd = accept4(socketDescriptor, nullptr, nullptr, SOCK_CLOEXEC);
|
||||
if (clientFd < 0) {
|
||||
qCWarning(KWIN_CORE) << "Failed to accept client from security listen FD:" << strerror(errno);
|
||||
return;
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
#include "wayland/plasmawindowmanagement.h"
|
||||
#include "wayland/surface.h"
|
||||
#include "wayland_server.h"
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include "workspace.h"
|
||||
|
||||
#include <KDecoration3/DecoratedWindow>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "xkb.h"
|
||||
#include "dbusproperties_interface.h"
|
||||
#include "inputmethod.h"
|
||||
#include "utils/c_ptr.h"
|
||||
#include "utils/common.h"
|
||||
@@ -17,9 +18,8 @@
|
||||
#include <KConfigGroup>
|
||||
// Qt
|
||||
#include <QKeyEvent>
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusReply>
|
||||
#include <QTemporaryFile>
|
||||
#include <QtGui/private/qxkbcommon_p.h>
|
||||
// xkbcommon
|
||||
#include <xkbcommon/xkbcommon-compose.h>
|
||||
#include <xkbcommon/xkbcommon-keysyms.h>
|
||||
@@ -406,80 +406,6 @@ static const TransKey g_rgSymXToQT[] = {
|
||||
{ XKB_KEY_XF86LaunchE, Qt::Key_LaunchE },
|
||||
{ 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
|
||||
|
||||
static void xkbLogHandler(xkb_context *context, xkb_log_level priority, const char *format, va_list args)
|
||||
@@ -688,9 +614,8 @@ xkb_keymap *Xkb::loadDefaultKeymap()
|
||||
|
||||
xkb_keymap *Xkb::loadKeymapFromLocale1()
|
||||
{
|
||||
QDBusInterface locale1Properties(s_locale1Interface, "/org/freedesktop/locale1", s_locale1Interface, QDBusConnection::systemBus(), this);
|
||||
QDBusReply<QVariantMap> reply = locale1Properties.call(QStringLiteral("GetAll"), QString::fromLatin1(s_locale1Interface));
|
||||
const QVariantMap properties = reply.isValid() ? reply.value() : QVariantMap{};
|
||||
OrgFreedesktopDBusPropertiesInterface locale1Properties(s_locale1Interface, "/org/freedesktop/locale1", QDBusConnection::systemBus(), this);
|
||||
const QVariantMap properties = locale1Properties.GetAll(s_locale1Interface);
|
||||
|
||||
const QByteArray model = properties["X11Model"].toByteArray();
|
||||
const QByteArray layout = properties["X11Layout"].toByteArray();
|
||||
@@ -1040,9 +965,7 @@ Qt::Key Xkb::toQtKey(xkb_keysym_t keySym,
|
||||
Qt::KeyboardModifiers modifiers) const
|
||||
{
|
||||
// FIXME: passing superAsMeta doesn't have impact due to bug in the Qt function, so handle it below
|
||||
Q_UNUSED(modifiers)
|
||||
Q_UNUSED(scanCode)
|
||||
Qt::Key qtKey = Qt::Key(keysymToQtKeyLocal(keySym));
|
||||
Qt::Key qtKey = Qt::Key(QXkbCommon::keysymToQtKey(keySym, modifiers, m_state, scanCode + EVDEV_OFFSET));
|
||||
|
||||
// FIXME: workarounds for symbols currently wrong/not mappable via keysymToQtKey()
|
||||
if (qtKey > 0xff && keySym <= 0xff) {
|
||||
@@ -1332,9 +1255,9 @@ QList<xkb_keysym_t> Xkb::keysymsFromQtKey(int keyQt)
|
||||
syms.append(XKB_KEY_KP_0 + (symQt - Qt::Key_0));
|
||||
return syms;
|
||||
}
|
||||
} else if (isLatin1Keysym(symQt)) {
|
||||
} else if (QXkbCommon::isLatin1(symQt)) {
|
||||
xkb_keysym_t lower, upper;
|
||||
convertCase(symQt, &lower, &upper);
|
||||
QXkbCommon::xkbcommon_XConvertCase(symQt, &lower, &upper);
|
||||
if (keyQt & Qt::ShiftModifier) {
|
||||
syms.append(upper);
|
||||
} else {
|
||||
@@ -1346,10 +1269,10 @@ QList<xkb_keysym_t> Xkb::keysymsFromQtKey(int keyQt)
|
||||
for (const TransKey &tk : g_rgSymXToQT) {
|
||||
if (tk.keySymQt == symQt) {
|
||||
// Use keysyms from the keypad if and only if KeypadModifier is set
|
||||
if (hasKeypadMod && !isKeypadKeysym(tk.keySymX)) {
|
||||
if (hasKeypadMod && !QXkbCommon::isKeypad(tk.keySymX)) {
|
||||
continue;
|
||||
}
|
||||
if (!hasKeypadMod && isKeypadKeysym(tk.keySymX)) {
|
||||
if (!hasKeypadMod && QXkbCommon::isKeypad(tk.keySymX)) {
|
||||
continue;
|
||||
}
|
||||
syms.append(tk.keySymX);
|
||||
|
||||
Reference in New Issue
Block a user