From 6f5efe4759276bb5f4add3db93b14051700d2e0d Mon Sep 17 00:00:00 2001 From: Sebastien Braun Date: Tue, 5 Oct 2010 14:57:32 +0200 Subject: Remove unnecessary Qt dependency from inputEvent.cpp --- src/gui/frame.cpp | 10 ++++------ src/input/inputEvent.cpp | 15 ++++++++------- src/input/inputEvent.h | 7 ++++--- 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gui/frame.cpp b/src/gui/frame.cpp index 96ea26c..32257ec 100644 --- a/src/gui/frame.cpp +++ b/src/gui/frame.cpp @@ -255,7 +255,7 @@ void Frame::mousePressEvent(QMouseEvent* event) ConsoleLog writeLine("Captured remote control mousePressEvent"); updateMousePosition(event); - sendInputEvent(InputEvent::mousePressRelease(event)); + sendInputEvent(InputEvent::mousePressRelease(event->button(), event->buttons())); } } @@ -271,7 +271,7 @@ void Frame::mouseReleaseEvent ( QMouseEvent * event ) ConsoleLog writeLine("Captured remote control mouseReleaseEvent"); updateMousePosition(event); - sendInputEvent(InputEvent::mousePressRelease(event)); + sendInputEvent(InputEvent::mousePressRelease(event->button(), event->buttons())); } } @@ -501,8 +501,7 @@ void Frame::keyPressEvent(QKeyEvent* event) { // The action of the keyboard may depend on the position of the pointer sendMouseMotionEvent(); - InputEvent evt = InputEvent::keyboardPress(event); - sendInputEvent(evt); + sendInputEvent(InputEvent::keyboardPress(event->key(), event->modifiers())); } else { @@ -516,8 +515,7 @@ void Frame::keyReleaseEvent(QKeyEvent* event) { // The action of the keyboard may depend on the position of the pointer sendMouseMotionEvent(); - InputEvent evt = InputEvent::keyboardRelease(event); - sendInputEvent(evt); + sendInputEvent(InputEvent::keyboardRelease(event->key(), event->modifiers())); } else { diff --git a/src/input/inputEvent.cpp b/src/input/inputEvent.cpp index 04a84e7..9b69a3a 100644 --- a/src/input/inputEvent.cpp +++ b/src/input/inputEvent.cpp @@ -66,10 +66,10 @@ quint16 InputEvent::mouseButtonsFromQt(int b) return ret; } -InputEvent InputEvent::mousePressRelease(QMouseEvent const* evt) +InputEvent InputEvent::mousePressRelease(int qt_button, int qt_buttons) { - quint16 button = mouseButtonsFromQt(evt->button()); - quint16 buttons = mouseButtonsFromQt(evt->buttons()); + quint16 button = mouseButtonsFromQt(qt_button); + quint16 buttons = mouseButtonsFromQt(qt_buttons); quint16 code; if(buttons & button) @@ -85,14 +85,15 @@ InputEvent InputEvent::mousePressRelease(QMouseEvent const* evt) return InputEvent(ET_BUTTON, code, value); } -InputEvent InputEvent::keyboardPress(QKeyEvent const* evt) +InputEvent InputEvent::keyboardPress(int key, int mods) { - quint32 value = evt->key() | evt->modifiers(); + quint32 value = key | mods; return InputEvent(ET_KEY, EC_PRESS, value); } -InputEvent InputEvent::keyboardRelease(QKeyEvent const* evt) +InputEvent InputEvent::keyboardRelease(int key, int mods) { - quint32 value = evt->key() | evt->modifiers(); + quint32 value = key | mods; return InputEvent(ET_KEY, EC_RELEASE, value); } + diff --git a/src/input/inputEvent.h b/src/input/inputEvent.h index 917cc64..7a64bfc 100644 --- a/src/input/inputEvent.h +++ b/src/input/inputEvent.h @@ -62,9 +62,9 @@ public: static uint16_t mouseButtonsFromQt(int b); - static InputEvent mousePressRelease(QMouseEvent const* event); - static InputEvent keyboardPress(QKeyEvent const* event); - static InputEvent keyboardRelease(QKeyEvent const* event); + static InputEvent mousePressRelease(int button, int buttons); + static InputEvent keyboardPress(int key, int mods); + static InputEvent keyboardRelease(int key, int mods); static const uint16_t ET_KEY = 0; static const uint16_t ET_BUTTON = 1; @@ -76,6 +76,7 @@ public: static const uint16_t EC_REBOOT = 2; static const uint16_t EC_SYSRQ = 3; static const uint16_t EC_KILL_X = 4; + static const uint16_t EC_SAY_HELLO = 5; //< for debugging purposes typedef uint32_t event_key; -- cgit v1.2.3-55-g7522