Move X11 specific KGlobalAccel handling into the x11-standalone platform
Summary: InputRedirection has a workaround to add a connect on a QAction which is used for a global shortcut. This is specific to the X11 platform as the xtime needs to be updated. This change adds a new virtual method to the Platform and moves the implementation into the X11 standalone platform. Thus it does no longer gets called on Wayland. Reviewers: #kwin, #plasma Subscribers: plasma-devel Tags: #kwin Differential Revision: https://phabricator.kde.org/D4168
This commit is contained in:
parent
516eb822dd
commit
2904d4a0be
8 changed files with 38 additions and 24 deletions
|
@ -87,11 +87,6 @@ void InputRedirection::registerAxisShortcut(Qt::KeyboardModifiers modifiers, Poi
|
|||
Q_UNUSED(action)
|
||||
}
|
||||
|
||||
void InputRedirection::registerShortcutForGlobalAccelTimestamp(QAction *action)
|
||||
{
|
||||
Q_UNUSED(action)
|
||||
}
|
||||
|
||||
void updateXTime()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -44,11 +44,6 @@ void InputRedirection::registerAxisShortcut(Qt::KeyboardModifiers modifiers, Poi
|
|||
Q_UNUSED(action)
|
||||
}
|
||||
|
||||
void InputRedirection::registerShortcutForGlobalAccelTimestamp(QAction *action)
|
||||
{
|
||||
Q_UNUSED(action)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(Qt::Orientation)
|
||||
|
|
14
input.cpp
14
input.cpp
|
@ -1807,7 +1807,7 @@ Qt::KeyboardModifiers InputRedirection::modifiersRelevantForGlobalShortcuts() co
|
|||
void InputRedirection::registerShortcut(const QKeySequence &shortcut, QAction *action)
|
||||
{
|
||||
m_shortcuts->registerShortcut(action, shortcut);
|
||||
registerShortcutForGlobalAccelTimestamp(action);
|
||||
kwinApp()->platform()->setupActionForGlobalAccel(action);
|
||||
}
|
||||
|
||||
void InputRedirection::registerPointerShortcut(Qt::KeyboardModifiers modifiers, Qt::MouseButton pointerButtons, QAction *action)
|
||||
|
@ -1825,18 +1825,6 @@ void InputRedirection::registerGlobalAccel(KGlobalAccelInterface *interface)
|
|||
m_shortcuts->setKGlobalAccelInterface(interface);
|
||||
}
|
||||
|
||||
void InputRedirection::registerShortcutForGlobalAccelTimestamp(QAction *action)
|
||||
{
|
||||
connect(action, &QAction::triggered, kwinApp(), [action] {
|
||||
QVariant timestamp = action->property("org.kde.kglobalaccel.activationTimestamp");
|
||||
bool ok = false;
|
||||
const quint32 t = timestamp.toULongLong(&ok);
|
||||
if (ok) {
|
||||
kwinApp()->setX11Time(t);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void InputRedirection::warpPointer(const QPointF &pos)
|
||||
{
|
||||
m_pointer->warp(pos);
|
||||
|
|
1
input.h
1
input.h
|
@ -267,7 +267,6 @@ Q_SIGNALS:
|
|||
private:
|
||||
void setupLibInput();
|
||||
void setupLibInputWithScreens();
|
||||
void registerShortcutForGlobalAccelTimestamp(QAction *action);
|
||||
void setupWorkspace();
|
||||
void reconfigure();
|
||||
void setupInputFilters();
|
||||
|
|
|
@ -386,4 +386,9 @@ void Platform::startInteractivePositionSelection(std::function<void(const QPoint
|
|||
input()->startInteractivePositionSelection(callback);
|
||||
}
|
||||
|
||||
void Platform::setupActionForGlobalAccel(QAction *action)
|
||||
{
|
||||
Q_UNUSED(action)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
18
platform.h
18
platform.h
|
@ -28,6 +28,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <functional>
|
||||
|
||||
class QAction;
|
||||
|
||||
namespace KWayland {
|
||||
namespace Server {
|
||||
class OutputConfigurationInterface;
|
||||
|
@ -195,6 +197,22 @@ public:
|
|||
**/
|
||||
virtual void startInteractivePositionSelection(std::function<void(const QPoint &)> callback);
|
||||
|
||||
/**
|
||||
* Platform specific preparation for an @p action which is used for KGlobalAccel.
|
||||
*
|
||||
* A platform might need to do preparation for an @p action before
|
||||
* it can be used with KGlobalAccel.
|
||||
*
|
||||
* Code using KGlobalAccel should invoke this method for the @p action
|
||||
* prior to setting up any shortcuts and connections.
|
||||
*
|
||||
* The default implementation does nothing.
|
||||
*
|
||||
* @param action The action which will be used with KGlobalAccel.
|
||||
* @since 5.10
|
||||
**/
|
||||
virtual void setupActionForGlobalAccel(QAction *action);
|
||||
|
||||
bool usesSoftwareCursor() const {
|
||||
return m_softWareCursor;
|
||||
}
|
||||
|
|
|
@ -282,4 +282,16 @@ void X11StandalonePlatform::startInteractiveWindowSelection(std::function<void(K
|
|||
m_windowSelector->start(callback, cursorName);
|
||||
}
|
||||
|
||||
void X11StandalonePlatform::setupActionForGlobalAccel(QAction *action)
|
||||
{
|
||||
connect(action, &QAction::triggered, kwinApp(), [action] {
|
||||
QVariant timestamp = action->property("org.kde.kglobalaccel.activationTimestamp");
|
||||
bool ok = false;
|
||||
const quint32 t = timestamp.toULongLong(&ok);
|
||||
if (ok) {
|
||||
kwinApp()->setX11Time(t);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,6 +53,8 @@ public:
|
|||
|
||||
PlatformCursorImage cursorImage() const override;
|
||||
|
||||
void setupActionForGlobalAccel(QAction *action) override;
|
||||
|
||||
protected:
|
||||
void doHideCursor() override;
|
||||
void doShowCursor() override;
|
||||
|
|
Loading…
Reference in a new issue