Trim legacy web binding and Win32 pointer state
This commit is contained in:
@@ -70,13 +70,16 @@ What is already real:
|
|||||||
- `pp_app_core`
|
- `pp_app_core`
|
||||||
|
|
||||||
Latest slice:
|
Latest slice:
|
||||||
|
- `src/platform_legacy/legacy_platform_state.*` no longer keeps its own
|
||||||
|
retained Web platform-service binding; the legacy Web helper path now uses
|
||||||
|
the shared `platform_api` injection surface instead.
|
||||||
- `src/platform_legacy/legacy_platform_state.*` no longer carries any retained
|
- `src/platform_legacy/legacy_platform_state.*` no longer carries any retained
|
||||||
GLFW window state; the leftover `set_legacy_glfw_window*` surface is gone.
|
GLFW window state; the leftover `set_legacy_glfw_window*` surface is gone.
|
||||||
- `linux/src/main.cpp` and `webgl/src/main.cpp` no longer seed legacy GLFW
|
- `linux/src/main.cpp` and `webgl/src/main.cpp` no longer seed legacy GLFW
|
||||||
retained state at startup.
|
retained state at startup.
|
||||||
- `src/platform_windows/windows_window_shell.cpp` no longer keeps a function-
|
- `src/platform_windows/windows_window_shell.cpp` no longer keeps any retained
|
||||||
local `lastPoint` static inside the Win32 window proc; that mouse-position
|
mouse-position pocket for button events; it now reads client coordinates
|
||||||
state now lives in the retained runtime shell session pocket.
|
directly from the Win32 messages that already carry them.
|
||||||
- `src/platform_legacy/legacy_platform_services.*` now accepts an injected
|
- `src/platform_legacy/legacy_platform_services.*` now accepts an injected
|
||||||
`LegacyGlfwPlatformShell` for Linux/WebGL `acquire_render_context`,
|
`LegacyGlfwPlatformShell` for Linux/WebGL `acquire_render_context`,
|
||||||
`present_render_context`, and app-close callbacks.
|
`present_render_context`, and app-close callbacks.
|
||||||
|
|||||||
@@ -78,13 +78,16 @@ Completed, blocked, and superseded task history moved to
|
|||||||
the queue is now ordered by code movement instead.
|
the queue is now ordered by code movement instead.
|
||||||
|
|
||||||
Current slice:
|
Current slice:
|
||||||
|
- `src/platform_legacy/legacy_platform_state.*` no longer keeps a separate
|
||||||
|
retained Web platform-service binding; the Web helper path now uses the
|
||||||
|
shared `platform_api` injection hook.
|
||||||
- `src/platform_legacy/legacy_platform_state.*` no longer keeps any retained
|
- `src/platform_legacy/legacy_platform_state.*` no longer keeps any retained
|
||||||
GLFW window state.
|
GLFW window state.
|
||||||
- `linux/src/main.cpp` and `webgl/src/main.cpp` no longer seed legacy GLFW
|
- `linux/src/main.cpp` and `webgl/src/main.cpp` no longer seed legacy GLFW
|
||||||
retained state.
|
retained state.
|
||||||
- `src/platform_windows/windows_window_shell.cpp` no longer keeps a local
|
- `src/platform_windows/windows_window_shell.cpp` no longer keeps any retained
|
||||||
static mouse-position pocket; the Win32 window proc now reads that state
|
mouse-position pocket for button events; it now reads client coordinates
|
||||||
through the retained runtime shell session helpers.
|
directly from the Win32 messages that already carry them.
|
||||||
- `src/platform_legacy/legacy_platform_services.*` now uses an injected
|
- `src/platform_legacy/legacy_platform_services.*` now uses an injected
|
||||||
`LegacyGlfwPlatformShell` for the remaining Linux/WebGL
|
`LegacyGlfwPlatformShell` for the remaining Linux/WebGL
|
||||||
acquire/present/request-close path.
|
acquire/present/request-close path.
|
||||||
|
|||||||
@@ -17,10 +17,6 @@ struct RetainedLegacyAndroidStoragePaths final {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct RetainedLegacyWebPlatformServicesBinding final {
|
|
||||||
pp::platform::WebPlatformServices* services = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
[[nodiscard]] RetainedLegacyAndroidStoragePaths& retained_legacy_android_storage_paths()
|
[[nodiscard]] RetainedLegacyAndroidStoragePaths& retained_legacy_android_storage_paths()
|
||||||
{
|
{
|
||||||
@@ -29,12 +25,6 @@ struct RetainedLegacyWebPlatformServicesBinding final {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
[[nodiscard]] RetainedLegacyWebPlatformServicesBinding& retained_legacy_web_platform_services_binding()
|
|
||||||
{
|
|
||||||
static RetainedLegacyWebPlatformServicesBinding state;
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
class RetainedWebPlatformServices final : public pp::platform::WebPlatformServices {
|
class RetainedWebPlatformServices final : public pp::platform::WebPlatformServices {
|
||||||
public:
|
public:
|
||||||
void publish_exported_image(std::string_view path) override
|
void publish_exported_image(std::string_view path) override
|
||||||
@@ -76,9 +66,6 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] pp::platform::WebPlatformServices& active_legacy_web_platform_services()
|
[[nodiscard]] pp::platform::WebPlatformServices& active_legacy_web_platform_services()
|
||||||
{
|
{
|
||||||
if (auto* services = retained_legacy_web_platform_services_binding().services)
|
|
||||||
return *services;
|
|
||||||
|
|
||||||
static RetainedWebPlatformServices services;
|
static RetainedWebPlatformServices services;
|
||||||
return pp::platform::resolve_web_platform_services(services);
|
return pp::platform::resolve_web_platform_services(services);
|
||||||
}
|
}
|
||||||
@@ -88,11 +75,6 @@ public:
|
|||||||
return std::make_unique<RetainedWebPlatformServices>();
|
return std::make_unique<RetainedWebPlatformServices>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_legacy_web_platform_services(pp::platform::WebPlatformServices* services)
|
|
||||||
{
|
|
||||||
retained_legacy_web_platform_services_binding().services = services;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] bool handles_legacy_web_platform_family(pp::platform::PlatformFamily family) noexcept
|
[[nodiscard]] bool handles_legacy_web_platform_family(pp::platform::PlatformFamily family) noexcept
|
||||||
{
|
{
|
||||||
return family == pp::platform::PlatformFamily::webgl;
|
return family == pp::platform::PlatformFamily::webgl;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ namespace pp::platform::legacy {
|
|||||||
|
|
||||||
[[nodiscard]] pp::platform::WebPlatformServices& active_legacy_web_platform_services();
|
[[nodiscard]] pp::platform::WebPlatformServices& active_legacy_web_platform_services();
|
||||||
[[nodiscard]] std::unique_ptr<pp::platform::WebPlatformServices> create_legacy_web_platform_services();
|
[[nodiscard]] std::unique_ptr<pp::platform::WebPlatformServices> create_legacy_web_platform_services();
|
||||||
void set_legacy_web_platform_services(pp::platform::WebPlatformServices* services);
|
|
||||||
[[nodiscard]] bool handles_legacy_web_platform_family(pp::platform::PlatformFamily family) noexcept;
|
[[nodiscard]] bool handles_legacy_web_platform_family(pp::platform::PlatformFamily family) noexcept;
|
||||||
void publish_legacy_web_exported_image(std::string_view path);
|
void publish_legacy_web_exported_image(std::string_view path);
|
||||||
[[nodiscard]] bool try_publish_legacy_web_exported_image(
|
[[nodiscard]] bool try_publish_legacy_web_exported_image(
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ namespace {
|
|||||||
struct RetainedMainWindowSessionState final {
|
struct RetainedMainWindowSessionState final {
|
||||||
HWND handle{};
|
HWND handle{};
|
||||||
wchar_t title[512]{};
|
wchar_t title[512]{};
|
||||||
POINT last_point{};
|
|
||||||
bool sandboxed = false;
|
bool sandboxed = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -170,16 +169,6 @@ void set_main_window_sandboxed(bool sandboxed) noexcept
|
|||||||
retained_main_window_session_state().sandboxed = sandboxed;
|
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)
|
int run_main_application(int argc, char** argv)
|
||||||
{
|
{
|
||||||
const auto instance = GetModuleHandle(NULL);
|
const auto instance = GetModuleHandle(NULL);
|
||||||
|
|||||||
@@ -18,7 +18,5 @@ void release_bound_app() noexcept;
|
|||||||
[[nodiscard]] const wchar_t* main_window_title() noexcept;
|
[[nodiscard]] const wchar_t* main_window_title() noexcept;
|
||||||
[[nodiscard]] bool main_window_sandboxed() noexcept;
|
[[nodiscard]] bool main_window_sandboxed() noexcept;
|
||||||
void set_main_window_sandboxed(bool 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;
|
break;
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
set_main_window_last_point({ GET_X_LPARAM(lp), GET_Y_LPARAM(lp) });
|
{
|
||||||
{
|
POINT pt{ GET_X_LPARAM(lp), GET_Y_LPARAM(lp) };
|
||||||
auto pt = main_window_last_point();
|
auto& tablet = active_wacom_tablet();
|
||||||
auto& tablet = active_wacom_tablet();
|
app->ui_task_async([app, pt, extra, p = tablet.get_pressure()] {
|
||||||
app->ui_task_async([app, pt, extra, p = tablet.get_pressure()] {
|
auto& ui_tablet = active_wacom_tablet();
|
||||||
auto& ui_tablet = active_wacom_tablet();
|
app->mouse_move((float)pt.x, (float)pt.y, p,
|
||||||
app->mouse_move((float)pt.x, (float)pt.y, p,
|
resolve_pointer_source(ui_tablet, extra), ui_tablet.m_eraser);
|
||||||
resolve_pointer_source(ui_tablet, extra), ui_tablet.m_eraser);
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
{
|
{
|
||||||
SetCapture(hWnd);
|
SetCapture(hWnd);
|
||||||
auto pt = main_window_last_point();
|
POINT pt{ GET_X_LPARAM(lp), GET_Y_LPARAM(lp) };
|
||||||
auto& tablet = active_wacom_tablet();
|
auto& tablet = active_wacom_tablet();
|
||||||
app->ui_task_async([app, pt, extra, p = tablet.get_pressure()] {
|
app->ui_task_async([app, pt, extra, p = tablet.get_pressure()] {
|
||||||
auto& ui_tablet = active_wacom_tablet();
|
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:
|
case WM_LBUTTONUP:
|
||||||
{
|
{
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
auto pt = main_window_last_point();
|
POINT pt{ GET_X_LPARAM(lp), GET_Y_LPARAM(lp) };
|
||||||
app->ui_task_async([app, pt, extra] {
|
app->ui_task_async([app, pt, extra] {
|
||||||
auto& tablet = active_wacom_tablet();
|
auto& tablet = active_wacom_tablet();
|
||||||
tablet.reset_pressure();
|
tablet.reset_pressure();
|
||||||
@@ -187,7 +186,7 @@ LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
|||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
{
|
{
|
||||||
SetCapture(hWnd);
|
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] {
|
app->ui_task_async([app, pt, extra] {
|
||||||
const auto& tablet = active_wacom_tablet();
|
const auto& tablet = active_wacom_tablet();
|
||||||
app->mouse_down(1, (float)pt.x, (float)pt.y, 1.f, resolve_pointer_source(tablet, extra), 0);
|
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:
|
case WM_RBUTTONUP:
|
||||||
{
|
{
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
auto pt = main_window_last_point();
|
POINT pt{ GET_X_LPARAM(lp), GET_Y_LPARAM(lp) };
|
||||||
app->ui_task_async([app, pt, extra] {
|
app->ui_task_async([app, pt, extra] {
|
||||||
const auto& tablet = active_wacom_tablet();
|
const auto& tablet = active_wacom_tablet();
|
||||||
app->mouse_up(1, (float)pt.x, (float)pt.y, resolve_pointer_source(tablet, extra), 0);
|
app->mouse_up(1, (float)pt.x, (float)pt.y, resolve_pointer_source(tablet, extra), 0);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <app.h>
|
#include <app.h>
|
||||||
|
#include <platform_api/platform_services.h>
|
||||||
#include <platform_legacy/legacy_platform_state.h>
|
#include <platform_legacy/legacy_platform_state.h>
|
||||||
#include <platform_legacy/legacy_platform_services.h>
|
#include <platform_legacy/legacy_platform_services.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@@ -121,7 +122,7 @@ void CanvasOnWheel(float y)
|
|||||||
void StartApp()
|
void StartApp()
|
||||||
{
|
{
|
||||||
App::I = &app;
|
App::I = &app;
|
||||||
pp::platform::legacy::set_legacy_web_platform_services(g_web_platform_services.get());
|
pp::platform::set_injected_web_platform_services(g_web_platform_services.get());
|
||||||
app.set_platform_services(g_platform_services.get());
|
app.set_platform_services(g_platform_services.get());
|
||||||
app.initLog();
|
app.initLog();
|
||||||
app.create();
|
app.create();
|
||||||
|
|||||||
Reference in New Issue
Block a user