Trim legacy web binding and Win32 pointer state
This commit is contained in:
@@ -19,7 +19,6 @@ namespace {
|
||||
struct RetainedMainWindowSessionState final {
|
||||
HWND handle{};
|
||||
wchar_t title[512]{};
|
||||
POINT last_point{};
|
||||
bool sandboxed = false;
|
||||
};
|
||||
|
||||
@@ -170,16 +169,6 @@ void set_main_window_sandboxed(bool sandboxed) noexcept
|
||||
retained_main_window_session_state().sandboxed = sandboxed;
|
||||
}
|
||||
|
||||
POINT main_window_last_point() noexcept
|
||||
{
|
||||
return retained_main_window_session_state().last_point;
|
||||
}
|
||||
|
||||
void set_main_window_last_point(POINT point) noexcept
|
||||
{
|
||||
retained_main_window_session_state().last_point = point;
|
||||
}
|
||||
|
||||
int run_main_application(int argc, char** argv)
|
||||
{
|
||||
const auto instance = GetModuleHandle(NULL);
|
||||
|
||||
@@ -18,7 +18,5 @@ void release_bound_app() noexcept;
|
||||
[[nodiscard]] const wchar_t* main_window_title() noexcept;
|
||||
[[nodiscard]] bool main_window_sandboxed() noexcept;
|
||||
void set_main_window_sandboxed(bool sandboxed) noexcept;
|
||||
[[nodiscard]] POINT main_window_last_point() noexcept;
|
||||
void set_main_window_last_point(POINT point) noexcept;
|
||||
|
||||
}
|
||||
|
||||
@@ -149,21 +149,20 @@ LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
});
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
set_main_window_last_point({ GET_X_LPARAM(lp), GET_Y_LPARAM(lp) });
|
||||
{
|
||||
auto pt = main_window_last_point();
|
||||
auto& tablet = active_wacom_tablet();
|
||||
app->ui_task_async([app, pt, extra, p = tablet.get_pressure()] {
|
||||
auto& ui_tablet = active_wacom_tablet();
|
||||
app->mouse_move((float)pt.x, (float)pt.y, p,
|
||||
resolve_pointer_source(ui_tablet, extra), ui_tablet.m_eraser);
|
||||
});
|
||||
}
|
||||
{
|
||||
POINT pt{ GET_X_LPARAM(lp), GET_Y_LPARAM(lp) };
|
||||
auto& tablet = active_wacom_tablet();
|
||||
app->ui_task_async([app, pt, extra, p = tablet.get_pressure()] {
|
||||
auto& ui_tablet = active_wacom_tablet();
|
||||
app->mouse_move((float)pt.x, (float)pt.y, p,
|
||||
resolve_pointer_source(ui_tablet, extra), ui_tablet.m_eraser);
|
||||
});
|
||||
break;
|
||||
}
|
||||
case WM_LBUTTONDOWN:
|
||||
{
|
||||
SetCapture(hWnd);
|
||||
auto pt = main_window_last_point();
|
||||
POINT pt{ GET_X_LPARAM(lp), GET_Y_LPARAM(lp) };
|
||||
auto& tablet = active_wacom_tablet();
|
||||
app->ui_task_async([app, pt, extra, p = tablet.get_pressure()] {
|
||||
auto& ui_tablet = active_wacom_tablet();
|
||||
@@ -175,7 +174,7 @@ LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
case WM_LBUTTONUP:
|
||||
{
|
||||
ReleaseCapture();
|
||||
auto pt = main_window_last_point();
|
||||
POINT pt{ GET_X_LPARAM(lp), GET_Y_LPARAM(lp) };
|
||||
app->ui_task_async([app, pt, extra] {
|
||||
auto& tablet = active_wacom_tablet();
|
||||
tablet.reset_pressure();
|
||||
@@ -187,7 +186,7 @@ LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
case WM_RBUTTONDOWN:
|
||||
{
|
||||
SetCapture(hWnd);
|
||||
auto pt = main_window_last_point();
|
||||
POINT pt{ GET_X_LPARAM(lp), GET_Y_LPARAM(lp) };
|
||||
app->ui_task_async([app, pt, extra] {
|
||||
const auto& tablet = active_wacom_tablet();
|
||||
app->mouse_down(1, (float)pt.x, (float)pt.y, 1.f, resolve_pointer_source(tablet, extra), 0);
|
||||
@@ -197,7 +196,7 @@ LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
case WM_RBUTTONUP:
|
||||
{
|
||||
ReleaseCapture();
|
||||
auto pt = main_window_last_point();
|
||||
POINT pt{ GET_X_LPARAM(lp), GET_Y_LPARAM(lp) };
|
||||
app->ui_task_async([app, pt, extra] {
|
||||
const auto& tablet = active_wacom_tablet();
|
||||
app->mouse_up(1, (float)pt.x, (float)pt.y, resolve_pointer_source(tablet, extra), 0);
|
||||
|
||||
Reference in New Issue
Block a user