Commit MetaInfo

Revisionbff74f815a7b985cb5402df7abc0a26e003bad24 (tree)
Time2017-08-01 00:30:21
Author <exeal@user...>

Log Message

fixed: Caret tracking when the cursor is outside of the viewer.

Change Summary

Incremental Difference

diff -r aa55de3fb1cb -r bff74f815a7b ascension/ascension/viewer/text-viewer.hpp
--- a/ascension/ascension/viewer/text-viewer.hpp Fri Jul 28 22:07:55 2017 +0900
+++ b/ascension/ascension/viewer/text-viewer.hpp Tue Aug 01 00:30:21 2017 +0900
@@ -371,6 +371,7 @@
371371 std::shared_ptr<TextArea> textArea_;
372372 Configuration configuration_;
373373 std::weak_ptr<MouseInputStrategy> lockedMouseInputStrategy_;
374+ boost::optional<ascension::detail::ScopeGuard> inputGrabber_;
374375 #if ASCENSION_SELECTS_WINDOW_SYSTEM(WIN32)
375376 win32::Handle<HWND> toolTip_;
376377 std::basic_string<WCHAR> tipText_;
diff -r aa55de3fb1cb -r bff74f815a7b ascension/ascension/viewer/widgetapi/event/user-input.hpp
--- a/ascension/ascension/viewer/widgetapi/event/user-input.hpp Fri Jul 28 22:07:55 2017 +0900
+++ b/ascension/ascension/viewer/widgetapi/event/user-input.hpp Tue Aug 01 00:30:21 2017 +0900
@@ -111,8 +111,8 @@
111111 inline Point makeMouseLocation(LPARAM lp) {
112112 #ifndef GET_X_LPARAM
113113 // <windowsx.h> defines the followings
114-# define GET_X_LPARAM(l) LOWORD(l)
115-# define GET_Y_LPARAM(l) HIWORD(l)
114+# define GET_X_LPARAM(l) static_cast<int>(static_cast<short>(LOWORD(l)))
115+# define GET_Y_LPARAM(l) static_cast<int>(static_cast<short>(HIWORD(l)))
116116 #endif
117117 return boost::geometry::make<Point>(GET_X_LPARAM(lp), GET_Y_LPARAM(lp));
118118 }
diff -r aa55de3fb1cb -r bff74f815a7b ascension/src/viewer/text-viewer.cpp
--- a/ascension/src/viewer/text-viewer.cpp Fri Jul 28 22:07:55 2017 +0900
+++ b/ascension/src/viewer/text-viewer.cpp Tue Aug 01 00:30:21 2017 +0900
@@ -506,6 +506,7 @@
506506 throw std::bad_weak_ptr();
507507 if(lockedMouseInputStrategy_.expired()) {
508508 lockedMouseInputStrategy_ = strategy;
509+ inputGrabber_ = widgetapi::grabInput(*this);
509510 return true;
510511 }
511512 return false;
@@ -759,8 +760,10 @@
759760
760761 /// @see MouseInputStrategy#TargetLocker#unlockMouseInputTarget
761762 void TextViewer::unlockMouseInputTarget(MouseInputStrategy& strategy) BOOST_NOEXCEPT {
762- if(&strategy == lockedMouseInputStrategy_.lock().get())
763+ if(&strategy == lockedMouseInputStrategy_.lock().get()) {
763764 lockedMouseInputStrategy_.reset();
765+ inputGrabber_ = boost::none;
766+ }
764767 }
765768
766769 /**
Show on old repository browser