dnd: drop on tablet pen tip up (#11270)
This commit is contained in:
parent
f309d86003
commit
23be1db1e3
3 changed files with 13 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
#include "../../desktop/Window.hpp"
|
#include "../../desktop/Window.hpp"
|
||||||
#include "../../protocols/Tablet.hpp"
|
#include "../../protocols/Tablet.hpp"
|
||||||
#include "../../devices/Tablet.hpp"
|
#include "../../devices/Tablet.hpp"
|
||||||
|
#include "../../managers/HookSystemManager.hpp"
|
||||||
#include "../../managers/PointerManager.hpp"
|
#include "../../managers/PointerManager.hpp"
|
||||||
#include "../../managers/SeatManager.hpp"
|
#include "../../managers/SeatManager.hpp"
|
||||||
#include "../../protocols/PointerConstraints.hpp"
|
#include "../../protocols/PointerConstraints.hpp"
|
||||||
|
|
@ -167,6 +168,8 @@ void CInputManager::onTabletAxis(CTablet::SAxisEvent e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::onTabletTip(CTablet::STipEvent e) {
|
void CInputManager::onTabletTip(CTablet::STipEvent e) {
|
||||||
|
EMIT_HOOK_EVENT_CANCELLABLE("tabletTip", e);
|
||||||
|
|
||||||
const auto PTAB = e.tablet;
|
const auto PTAB = e.tablet;
|
||||||
const auto PTOOL = ensureTabletToolPresent(e.tool);
|
const auto PTOOL = ensureTabletToolPresent(e.tool);
|
||||||
const auto POS = e.tip;
|
const auto POS = e.tip;
|
||||||
|
|
|
||||||
|
|
@ -591,6 +591,14 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
|
||||||
dropDrag();
|
dropDrag();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
m_dnd.tabletTip = g_pHookSystem->hookDynamic("tabletTip", [this](void* self, SCallbackInfo& info, std::any e) {
|
||||||
|
auto E = std::any_cast<CTablet::STipEvent>(e);
|
||||||
|
if (!E.in) {
|
||||||
|
LOGM(LOG, "Dropping drag on tablet tipUp");
|
||||||
|
dropDrag();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
m_dnd.mouseMove = g_pHookSystem->hookDynamic("mouseMove", [this](void* self, SCallbackInfo& info, std::any e) {
|
m_dnd.mouseMove = g_pHookSystem->hookDynamic("mouseMove", [this](void* self, SCallbackInfo& info, std::any e) {
|
||||||
auto V = std::any_cast<const Vector2D>(e);
|
auto V = std::any_cast<const Vector2D>(e);
|
||||||
if (m_dnd.focusedDevice && g_pSeatManager->m_state.dndPointerFocus) {
|
if (m_dnd.focusedDevice && g_pSeatManager->m_state.dndPointerFocus) {
|
||||||
|
|
@ -695,6 +703,7 @@ void CWLDataDeviceProtocol::cleanupDndState(bool resetDevice, bool resetSource,
|
||||||
m_dnd.mouseMove.reset();
|
m_dnd.mouseMove.reset();
|
||||||
m_dnd.touchUp.reset();
|
m_dnd.touchUp.reset();
|
||||||
m_dnd.touchMove.reset();
|
m_dnd.touchMove.reset();
|
||||||
|
m_dnd.tabletTip.reset();
|
||||||
|
|
||||||
if (resetDevice)
|
if (resetDevice)
|
||||||
m_dnd.focusedDevice.reset();
|
m_dnd.focusedDevice.reset();
|
||||||
|
|
|
||||||
|
|
@ -180,6 +180,7 @@ class CWLDataDeviceProtocol : public IWaylandProtocol {
|
||||||
SP<HOOK_CALLBACK_FN> mouseButton;
|
SP<HOOK_CALLBACK_FN> mouseButton;
|
||||||
SP<HOOK_CALLBACK_FN> touchUp;
|
SP<HOOK_CALLBACK_FN> touchUp;
|
||||||
SP<HOOK_CALLBACK_FN> touchMove;
|
SP<HOOK_CALLBACK_FN> touchMove;
|
||||||
|
SP<HOOK_CALLBACK_FN> tabletTip;
|
||||||
} m_dnd;
|
} m_dnd;
|
||||||
|
|
||||||
void abortDrag();
|
void abortDrag();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue