From 93dd7773515cb759453701a7ef23045e3127ea80 Mon Sep 17 00:00:00 2001 From: l10n daemon script Date: Mon, 5 Feb 2018 06:51:49 +0100 Subject: [PATCH 1/2] SVN_SILENT made messages (.desktop file) - always resolve ours In case of conflict in i18n, keep the version of the branch "ours" To resolve a particular conflict, "git checkout --ours path/to/file.desktop" --- effects/slide/slide_config.desktop | 1 + 1 file changed, 1 insertion(+) diff --git a/effects/slide/slide_config.desktop b/effects/slide/slide_config.desktop index cb884e504d..f5a613e91a 100644 --- a/effects/slide/slide_config.desktop +++ b/effects/slide/slide_config.desktop @@ -32,6 +32,7 @@ Name[hu]=Csúsztatott váltás Name[ia]=Glissa Name[is]=Renna til Name[it]=Scivola +Name[ja]=スライド Name[kk]=Сырғанату Name[km]=ស្លាយ Name[kn]=ಜಾರು From ea5e70116456975b3ca3f379777b8a83291bb4e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Fl=C3=B6ser?= Date: Sun, 4 Feb 2018 18:01:30 +0100 Subject: [PATCH 2/2] [x11] Fix interactive point selection Summary: The support for interactive point selection was missing. This results in the ColorPicker dbus API always returning an error on X11. We either need to disable the ColorPicker on X11 or add support for this functionality. As the X11 platform basically supports selecting a point in the interactive window selection it makes more sense to add this missing method in the platform than to disable support of color picker effect. BUG: 387720 FIXED-IN: 5.12.1 Test Plan: Run KWin/X11 on Xephyr and was able to pick a color and kill a window Reviewers: #kwin, #plasma Subscribers: plasma-devel, kwin Tags: #plasma Differential Revision: https://phabricator.kde.org/D10302 --- .../x11/standalone/windowselector.cpp | 68 +++++++++++++++---- .../platforms/x11/standalone/windowselector.h | 6 ++ .../platforms/x11/standalone/x11_platform.cpp | 8 +++ .../platforms/x11/standalone/x11_platform.h | 1 + 4 files changed, 70 insertions(+), 13 deletions(-) diff --git a/plugins/platforms/x11/standalone/windowselector.cpp b/plugins/platforms/x11/standalone/windowselector.cpp index a5fe3ed2cf..4f7d39e5e8 100644 --- a/plugins/platforms/x11/standalone/windowselector.cpp +++ b/plugins/platforms/x11/standalone/windowselector.cpp @@ -56,12 +56,38 @@ WindowSelector::~WindowSelector() void WindowSelector::start(std::function callback, const QByteArray &cursorName) { - xcb_cursor_t cursor = createCursor(cursorName); if (m_active) { callback(nullptr); return; } + m_active = activate(cursorName); + if (!m_active) { + callback(nullptr); + return; + } + m_callback = callback; +} + +void WindowSelector::start(std::function callback) +{ + if (m_active) { + callback(QPoint(-1, -1)); + return; + } + + m_active = activate(); + if (!m_active) { + callback(QPoint(-1, -1)); + return; + } + m_pointSelectionFallback = callback; +} + +bool WindowSelector::activate(const QByteArray &cursorName) +{ + xcb_cursor_t cursor = createCursor(cursorName); + xcb_connection_t *c = connection(); ScopedCPointer grabPointer(xcb_grab_pointer_reply(c, xcb_grab_pointer_unchecked(c, false, rootWindow(), XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | @@ -70,17 +96,15 @@ void WindowSelector::start(std::function callback, const XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_WINDOW_NONE, cursor, XCB_TIME_CURRENT_TIME), NULL)); if (grabPointer.isNull() || grabPointer->status != XCB_GRAB_STATUS_SUCCESS) { - callback(nullptr); - return; + return false; } - m_active = grabXKeyboard(); - if (!m_active) { + const bool grabbed = grabXKeyboard(); + if (grabbed) { + grabXServer(); + } else { xcb_ungrab_pointer(connection(), XCB_TIME_CURRENT_TIME); - callback(nullptr); - return; } - grabXServer(); - m_callback = callback; + return grabbed; } xcb_cursor_t WindowSelector::createCursor(const QByteArray &cursorName) @@ -136,12 +160,16 @@ bool WindowSelector::event(xcb_generic_event_t *event) void WindowSelector::handleButtonRelease(xcb_button_t button, xcb_window_t window) { if (button == XCB_BUTTON_INDEX_3) { - m_callback(nullptr); + cancelCallback(); release(); return; } if (button == XCB_BUTTON_INDEX_1 || button == XCB_BUTTON_INDEX_2) { - selectWindowId(window); + if (m_callback) { + selectWindowId(window); + } else if (m_pointSelectionFallback) { + m_pointSelectionFallback(Cursor::pos()); + } release(); return; } @@ -173,11 +201,15 @@ void WindowSelector::handleKeyPress(xcb_keycode_t keycode, uint16_t state) } Cursor::setPos(Cursor::pos() + QPoint(mx, my)); if (returnPressed) { - selectWindowUnderPointer(); + if (m_callback) { + selectWindowUnderPointer(); + } else if (m_pointSelectionFallback) { + m_pointSelectionFallback(Cursor::pos()); + } } if (returnPressed || escapePressed) { if (escapePressed) { - m_callback(nullptr); + cancelCallback(); } release(); } @@ -199,6 +231,7 @@ void WindowSelector::release() ungrabXServer(); m_active = false; m_callback = std::function(); + m_pointSelectionFallback = std::function(); } void WindowSelector::selectWindowId(xcb_window_t window_to_select) @@ -228,4 +261,13 @@ void WindowSelector::selectWindowId(xcb_window_t window_to_select) } } +void WindowSelector::cancelCallback() +{ + if (m_callback) { + m_callback(nullptr); + } else if (m_pointSelectionFallback) { + m_pointSelectionFallback(QPoint(-1, -1)); + } +} + } // namespace diff --git a/plugins/platforms/x11/standalone/windowselector.h b/plugins/platforms/x11/standalone/windowselector.h index 3cbbbd22fc..5e1cbab332 100644 --- a/plugins/platforms/x11/standalone/windowselector.h +++ b/plugins/platforms/x11/standalone/windowselector.h @@ -29,6 +29,8 @@ along with this program. If not, see . #include +class QPoint; + namespace KWin { class Toplevel; @@ -41,6 +43,7 @@ public: ~WindowSelector(); void start(std::function callback, const QByteArray &cursorName); + void start(std::function callback); bool isActive() const { return m_active; } @@ -55,8 +58,11 @@ private: void handleKeyPress(xcb_keycode_t keycode, uint16_t state); void handleButtonRelease(xcb_button_t button, xcb_window_t window); void selectWindowId(xcb_window_t window_to_kill); + bool activate(const QByteArray &cursorName = QByteArray()); + void cancelCallback(); bool m_active; std::function m_callback; + std::function m_pointSelectionFallback; }; } // namespace diff --git a/plugins/platforms/x11/standalone/x11_platform.cpp b/plugins/platforms/x11/standalone/x11_platform.cpp index 806d8044d3..7439ed246f 100644 --- a/plugins/platforms/x11/standalone/x11_platform.cpp +++ b/plugins/platforms/x11/standalone/x11_platform.cpp @@ -318,6 +318,14 @@ void X11StandalonePlatform::startInteractiveWindowSelection(std::functionstart(callback, cursorName); } +void X11StandalonePlatform::startInteractivePositionSelection(std::function callback) +{ + if (m_windowSelector.isNull()) { + m_windowSelector.reset(new WindowSelector); + } + m_windowSelector->start(callback); +} + void X11StandalonePlatform::setupActionForGlobalAccel(QAction *action) { connect(action, &QAction::triggered, kwinApp(), [action] { diff --git a/plugins/platforms/x11/standalone/x11_platform.h b/plugins/platforms/x11/standalone/x11_platform.h index 07d79b8893..3cfdb47df1 100644 --- a/plugins/platforms/x11/standalone/x11_platform.h +++ b/plugins/platforms/x11/standalone/x11_platform.h @@ -54,6 +54,7 @@ public: bool openGLCompositingIsBroken() const override; void createOpenGLSafePoint(OpenGLSafePoint safePoint) override; void startInteractiveWindowSelection(std::function callback, const QByteArray &cursorName = QByteArray()) override; + void startInteractivePositionSelection(std::function callback) override; PlatformCursorImage cursorImage() const override;