diff options
author | Paul Gilbert | 2018-10-27 19:03:11 -0700 |
---|---|---|
committer | Paul Gilbert | 2018-12-08 19:05:59 -0800 |
commit | efacc17bd1bea3f0ca316c57f90a5ca9849932b6 (patch) | |
tree | 7ca47de4bed28cc0c983d8001434523924ba7bdf | |
parent | 9eb4debd158f0348c9a13f548c788d9f9d721f70 (diff) | |
download | scummvm-rg350-efacc17bd1bea3f0ca316c57f90a5ca9849932b6.tar.gz scummvm-rg350-efacc17bd1bea3f0ca316c57f90a5ca9849932b6.tar.bz2 scummvm-rg350-efacc17bd1bea3f0ca316c57f90a5ca9849932b6.zip |
GLK: Handle more user events
-rw-r--r-- | engines/gargoyle/clipboard.cpp | 4 | ||||
-rw-r--r-- | engines/gargoyle/clipboard.h | 6 | ||||
-rw-r--r-- | engines/gargoyle/events.cpp | 47 | ||||
-rw-r--r-- | engines/gargoyle/events.h | 20 | ||||
-rw-r--r-- | engines/gargoyle/windows.cpp | 5 | ||||
-rw-r--r-- | engines/gargoyle/windows.h | 5 |
6 files changed, 80 insertions, 7 deletions
diff --git a/engines/gargoyle/clipboard.cpp b/engines/gargoyle/clipboard.cpp index ef11d55a9a..69ef8f833c 100644 --- a/engines/gargoyle/clipboard.cpp +++ b/engines/gargoyle/clipboard.cpp @@ -28,11 +28,11 @@ void Clipboard::store(const uint32 *text, size_t len) { // TODO } -void Clipboard::send() { +void Clipboard::send(ClipSource source) { // TODO } -void Clipboard::receive() { +void Clipboard::receive(ClipSource source) { // TODO } diff --git a/engines/gargoyle/clipboard.h b/engines/gargoyle/clipboard.h index ccd8d79f50..23e7aafefb 100644 --- a/engines/gargoyle/clipboard.h +++ b/engines/gargoyle/clipboard.h @@ -27,15 +27,17 @@ namespace Gargoyle { +enum ClipSource { PRIMARY = 0, CLIPBOARD = 1 }; + class Clipboard { private: Common::Array<uint32> _text; public: void store(const uint32 *text, size_t len); - void send(); + void send(ClipSource source); - void receive(); + void receive(ClipSource source); }; } // End of namespace Gargoyle diff --git a/engines/gargoyle/events.cpp b/engines/gargoyle/events.cpp index 00adce84ab..b1f1823276 100644 --- a/engines/gargoyle/events.cpp +++ b/engines/gargoyle/events.cpp @@ -94,6 +94,13 @@ void Events::pollEvents() { case Common::EVENT_KEYDOWN: handleKeyDown(event.kbd); return; + case Common::EVENT_WHEELUP: + case Common::EVENT_WHEELDOWN: + handleScroll(event.type == Common::EVENT_WHEELUP); + return; + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_RBUTTONDOWN: + default: break; } @@ -108,15 +115,15 @@ void Events::handleKeyDown(const Common::KeyState &ks) { if (ks.keycode == Common::KEYCODE_a) windows.inputHandleKey(keycode_Home); else if (ks.keycode == Common::KEYCODE_c) - clipboard.send(); + clipboard.send(CLIPBOARD); else if (ks.keycode == Common::KEYCODE_e) windows.inputHandleKey(keycode_End); else if (ks.keycode == Common::KEYCODE_u) windows.inputHandleKey(keycode_Escape); else if (ks.keycode == Common::KEYCODE_v) - clipboard.receive(); + clipboard.receive(CLIPBOARD); else if (ks.keycode == Common::KEYCODE_x) - clipboard.send(); + clipboard.send(CLIPBOARD); else if (ks.keycode == Common::KEYCODE_LEFT || ks.keycode == Common::KEYCODE_KP4) windows.inputHandleKey(keycode_SkipWordLeft); else if (ks.keycode == Common::KEYCODE_RIGHT || ks.keycode == Common::KEYCODE_KP6) @@ -156,4 +163,38 @@ void Events::handleKeyDown(const Common::KeyState &ks) { else windows.inputHandleKey(ks.ascii); } +void Events::handleScroll(bool wheelUp) { + g_vm->_windows->inputHandleKey(wheelUp ? keycode_MouseWheelUp : keycode_MouseWheelDown); +} + +void Events::handleMouseMove(const Common::Point &pos) { + // hyperlinks and selection + // TODO: Properly handle commented out lines + if (g_vm->_copySelect) { + //gdk_window_set_cursor((GTK_WIDGET(widget)->window), gdk_ibeam); + g_vm->_windowMask->moveSelection(pos); + } else { + if (g_vm->_windowMask->getHyperlink(pos)) { + //gdk_window_set_cursor((GTK_WIDGET(widget)->window), gdk_hand); + } else { + //gdk_window_set_cursor((GTK_WIDGET(widget)->window), NULL); + } + } +} + +void Events::handleButtonDown(bool isLeft, const Common::Point &pos) { + if (isLeft) + g_vm->_windows->inputHandleClick(pos); + else + g_vm->_clipboard->receive(PRIMARY); +} + +void Events::handleButtonUp(bool isLeft, const Common::Point &pos) { + if (isLeft) { + g_vm->_copySelect = false; + //gdk_window_set_cursor((GTK_WIDGET(widget)->window), NULL); + g_vm->_clipboard->send(PRIMARY); + } +} + } // End of namespace Gargoyle diff --git a/engines/gargoyle/events.h b/engines/gargoyle/events.h index cd0a3a6620..544b524d51 100644 --- a/engines/gargoyle/events.h +++ b/engines/gargoyle/events.h @@ -162,6 +162,26 @@ private: * Handle a key down event */ void handleKeyDown(const Common::KeyState &ks); + + /** + * Handle scroll events + */ + void handleScroll(bool wheelUp); + + /** + * Handle mouse move events + */ + void handleMouseMove(const Common::Point &pos); + + /** + * Handle mouse down events + */ + void handleButtonDown(bool isLeft, const Common::Point &pos); + + /** + * Handle mouse up events + */ + void handleButtonUp(bool isLeft, const Common::Point &pos); public: bool _forceClick; public: diff --git a/engines/gargoyle/windows.cpp b/engines/gargoyle/windows.cpp index 06b83e14bb..0f1c9eb69c 100644 --- a/engines/gargoyle/windows.cpp +++ b/engines/gargoyle/windows.cpp @@ -384,6 +384,11 @@ void Windows::inputHandleKey(glui32 key) { g_vm->quitGame(); } +void Windows::inputHandleClick(const Common::Point &pos) { + if (_rootWin) + _rootWin->click(pos); +} + void Windows::selectionChanged() { _claimSelect = false; _forceRedraw = true; diff --git a/engines/gargoyle/windows.h b/engines/gargoyle/windows.h index 08408223d4..643fecf5ab 100644 --- a/engines/gargoyle/windows.h +++ b/engines/gargoyle/windows.h @@ -176,6 +176,11 @@ public: */ void inputHandleKey(glui32 key); + /** + * Handle mouse clicks + */ + void inputHandleClick(const Common::Point &pos); + void selectionChanged(); void clearClaimSelect() { _claimSelect = false; } |