[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:27:46 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=9cba780
The following commit has been merged in the master branch:
commit 9cba780f751b72889df8aff7e83eea12802e5e0e
Author: Albert Vaca <albertvaka at gmail.com>
Date: Sun Jun 29 17:30:24 2014 +0200
Added right and middle click, even though it's not implemented in Android yet
CCMAIL: ahmedibrahimkhali at gmail.com
---
plugins/mousepad/mousepadplugin.cpp | 34 ++++++++++++++++++++--------------
plugins/mousepad/mousepadplugin.h | 8 ++++++++
2 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/plugins/mousepad/mousepadplugin.cpp b/plugins/mousepad/mousepadplugin.cpp
index 0191f66..08e06a4 100644
--- a/plugins/mousepad/mousepadplugin.cpp
+++ b/plugins/mousepad/mousepadplugin.cpp
@@ -26,9 +26,7 @@
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< MousepadPlugin >(); )
K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_mousepad", "kdeconnect-plugins") )
-#define LEFT_MOUSE_BUTTON 1 // Source: http://bharathisubramanian.wordpress.com/2010/04/01/x11-fake-mouse-events-generation-using-xtest/
-#define MOUSE_WHEEL_UP_BUTTON 4
-#define MOUSE_WHEEL_DOWN_BUTTON 5
+// Source: http://bharathisubramanian.wordpress.com/2010/04/01/x11-fake-mouse-events-generation-using-xtest/
MousepadPlugin::MousepadPlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args), m_display(0)
@@ -51,29 +49,37 @@ bool MousepadPlugin::receivePackage(const NetworkPackage& np)
bool isSingleClick = np.get<bool>("singleclick", false);
bool isDoubleClick = np.get<bool>("doubleclick", false);
+ bool isMiddleClick = np.get<bool>("middleclick", false);
+ bool isRightClick = np.get<bool>("rightclick", false);
bool isScroll = np.get<bool>("scroll", false);
- if (isSingleClick || isDoubleClick || isScroll) {
+ if (isSingleClick || isDoubleClick || isMiddleClick || isRightClick || isScroll) {
if(!m_display) {
m_display = XOpenDisplay(NULL);
}
if(m_display) {
if (isSingleClick) {
- XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, true, CurrentTime);
- XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, false, CurrentTime);
+ XTestFakeButtonEvent(m_display, LeftMouseButton, true, CurrentTime);
+ XTestFakeButtonEvent(m_display, LeftMouseButton, false, CurrentTime);
} else if (isDoubleClick) {
- XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, true, CurrentTime);
- XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, false, CurrentTime);
- XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, true, CurrentTime);
- XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, false, CurrentTime);
+ XTestFakeButtonEvent(m_display, LeftMouseButton, true, CurrentTime);
+ XTestFakeButtonEvent(m_display, LeftMouseButton, false, CurrentTime);
+ XTestFakeButtonEvent(m_display, LeftMouseButton, true, CurrentTime);
+ XTestFakeButtonEvent(m_display, LeftMouseButton, false, CurrentTime);
+ } else if (isMiddleClick) {
+ XTestFakeButtonEvent(m_display, MiddleMouseButton, true, CurrentTime);
+ XTestFakeButtonEvent(m_display, MiddleMouseButton, false, CurrentTime);
+ } else if (isRightClick) {
+ XTestFakeButtonEvent(m_display, RightMouseButton, true, CurrentTime);
+ XTestFakeButtonEvent(m_display, RightMouseButton, false, CurrentTime);
} else if( isScroll ) {
if (dy < 0) {
- XTestFakeButtonEvent(m_display, MOUSE_WHEEL_DOWN_BUTTON, true, CurrentTime);
- XTestFakeButtonEvent(m_display, MOUSE_WHEEL_DOWN_BUTTON, false, CurrentTime);
+ XTestFakeButtonEvent(m_display, MouseWheelDown, true, CurrentTime);
+ XTestFakeButtonEvent(m_display, MouseWheelDown, false, CurrentTime);
} else {
- XTestFakeButtonEvent(m_display, MOUSE_WHEEL_UP_BUTTON, true, CurrentTime);
- XTestFakeButtonEvent(m_display, MOUSE_WHEEL_UP_BUTTON, false, CurrentTime);
+ XTestFakeButtonEvent(m_display, MouseWheelUp, true, CurrentTime);
+ XTestFakeButtonEvent(m_display, MouseWheelUp, false, CurrentTime);
}
}
XFlush(m_display);
diff --git a/plugins/mousepad/mousepadplugin.h b/plugins/mousepad/mousepadplugin.h
index 6a0c047..64f5d88 100644
--- a/plugins/mousepad/mousepadplugin.h
+++ b/plugins/mousepad/mousepadplugin.h
@@ -33,6 +33,14 @@ class MousepadPlugin
{
Q_OBJECT
+ enum MouseButtons {
+ LeftMouseButton = 1,
+ MiddleMouseButton = 2,
+ RightMouseButton = 3,
+ MouseWheelUp = 4,
+ MouseWheelDown = 5
+ };
+
public:
explicit MousepadPlugin(QObject *parent, const QVariantList &args);
virtual ~MousepadPlugin();
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list