Remove dead legacy GLFW retained state
This commit is contained in:
@@ -70,6 +70,13 @@ What is already real:
|
|||||||
- `pp_app_core`
|
- `pp_app_core`
|
||||||
|
|
||||||
Latest slice:
|
Latest slice:
|
||||||
|
- `src/platform_legacy/legacy_platform_state.*` no longer carries any retained
|
||||||
|
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
|
||||||
|
retained state at startup.
|
||||||
|
- `src/platform_windows/windows_window_shell.cpp` no longer keeps a function-
|
||||||
|
local `lastPoint` static inside the Win32 window proc; that mouse-position
|
||||||
|
state now lives in the retained runtime shell session pocket.
|
||||||
- `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,6 +78,13 @@ 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 any retained
|
||||||
|
GLFW window state.
|
||||||
|
- `linux/src/main.cpp` and `webgl/src/main.cpp` no longer seed legacy GLFW
|
||||||
|
retained state.
|
||||||
|
- `src/platform_windows/windows_window_shell.cpp` no longer keeps a local
|
||||||
|
static mouse-position pocket; the Win32 window proc now reads that state
|
||||||
|
through the retained runtime shell session helpers.
|
||||||
- `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.
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ int main(int argc, char** args)
|
|||||||
printf("could not create window\n");
|
printf("could not create window\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
pp::platform::legacy::set_legacy_glfw_window(wnd);
|
|
||||||
pp::platform::linux_desktop::set_fps_title_callback([wnd](std::string title) {
|
pp::platform::linux_desktop::set_fps_title_callback([wnd](std::string title) {
|
||||||
glfwSetWindowTitle(wnd, title.c_str());
|
glfwSetWindowTitle(wnd, title.c_str());
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,10 +2,6 @@
|
|||||||
#include "platform_legacy/legacy_platform_state.h"
|
#include "platform_legacy/legacy_platform_state.h"
|
||||||
#include "platform_api/platform_policy.h"
|
#include "platform_api/platform_policy.h"
|
||||||
|
|
||||||
#if defined(__LINUX__) || defined(__WEB__)
|
|
||||||
#include <GLFW/glfw3.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void webgl_pick_file_save(
|
void webgl_pick_file_save(
|
||||||
const std::string& path,
|
const std::string& path,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
@@ -21,12 +17,6 @@ struct RetainedLegacyAndroidStoragePaths final {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__LINUX__) || defined(__WEB__)
|
|
||||||
struct RetainedLegacyGlfwPlatformState final {
|
|
||||||
GLFWwindow* window = nullptr;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct RetainedLegacyWebPlatformServicesBinding final {
|
struct RetainedLegacyWebPlatformServicesBinding final {
|
||||||
pp::platform::WebPlatformServices* services = nullptr;
|
pp::platform::WebPlatformServices* services = nullptr;
|
||||||
};
|
};
|
||||||
@@ -39,14 +29,6 @@ struct RetainedLegacyWebPlatformServicesBinding final {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__LINUX__) || defined(__WEB__)
|
|
||||||
[[nodiscard]] RetainedLegacyGlfwPlatformState& retained_legacy_glfw_platform_state()
|
|
||||||
{
|
|
||||||
static RetainedLegacyGlfwPlatformState state;
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[[nodiscard]] RetainedLegacyWebPlatformServicesBinding& retained_legacy_web_platform_services_binding()
|
[[nodiscard]] RetainedLegacyWebPlatformServicesBinding& retained_legacy_web_platform_services_binding()
|
||||||
{
|
{
|
||||||
static RetainedLegacyWebPlatformServicesBinding state;
|
static RetainedLegacyWebPlatformServicesBinding state;
|
||||||
@@ -92,23 +74,6 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__LINUX__) || defined(__WEB__)
|
|
||||||
void set_legacy_glfw_window(GLFWwindow* window)
|
|
||||||
{
|
|
||||||
retained_legacy_glfw_platform_state().window = window;
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_legacy_glfw_window_title(std::string_view title)
|
|
||||||
{
|
|
||||||
auto* const window = retained_legacy_glfw_platform_state().window;
|
|
||||||
if (!window)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const std::string title_value(title);
|
|
||||||
glfwSetWindowTitle(window, title_value.c_str());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[[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)
|
if (auto* services = retained_legacy_web_platform_services_binding().services)
|
||||||
|
|||||||
@@ -5,17 +5,8 @@
|
|||||||
#include "platform_api/platform_policy.h"
|
#include "platform_api/platform_policy.h"
|
||||||
#include "platform_api/platform_services.h"
|
#include "platform_api/platform_services.h"
|
||||||
|
|
||||||
#if __LINUX__ || __WEB__
|
|
||||||
struct GLFWwindow;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace pp::platform::legacy {
|
namespace pp::platform::legacy {
|
||||||
|
|
||||||
#if defined(__LINUX__) || defined(__WEB__)
|
|
||||||
void set_legacy_glfw_window(GLFWwindow* window);
|
|
||||||
void set_legacy_glfw_window_title(std::string_view title);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[[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);
|
void set_legacy_web_platform_services(pp::platform::WebPlatformServices* services);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ 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;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -169,6 +170,16 @@ 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,5 +18,7 @@ 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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ pp::platform::windows::VrShellState& pp::platform::windows::retained_vr_shell_st
|
|||||||
LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||||
{
|
{
|
||||||
auto* app = bound_app();
|
auto* app = bound_app();
|
||||||
static glm::vec2 lastPoint;
|
|
||||||
|
|
||||||
auto extra = GetMessageExtraInfo();
|
auto extra = GetMessageExtraInfo();
|
||||||
|
|
||||||
@@ -150,9 +149,9 @@ LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
lastPoint = { GET_X_LPARAM(lp), GET_Y_LPARAM(lp) };
|
set_main_window_last_point({ GET_X_LPARAM(lp), GET_Y_LPARAM(lp) });
|
||||||
{
|
{
|
||||||
auto pt = lastPoint;
|
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();
|
||||||
@@ -164,7 +163,7 @@ LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
|||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
{
|
{
|
||||||
SetCapture(hWnd);
|
SetCapture(hWnd);
|
||||||
auto pt = lastPoint;
|
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();
|
||||||
@@ -176,7 +175,7 @@ LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
|||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
{
|
{
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
auto pt = lastPoint;
|
auto pt = main_window_last_point();
|
||||||
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();
|
||||||
@@ -188,7 +187,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 = lastPoint;
|
auto pt = main_window_last_point();
|
||||||
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);
|
||||||
@@ -198,7 +197,7 @@ LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
|||||||
case WM_RBUTTONUP:
|
case WM_RBUTTONUP:
|
||||||
{
|
{
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
auto pt = lastPoint;
|
auto pt = main_window_last_point();
|
||||||
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);
|
||||||
|
|||||||
@@ -202,7 +202,6 @@ int main()
|
|||||||
if (glfwInit() != GL_TRUE)
|
if (glfwInit() != GL_TRUE)
|
||||||
printf("Failed to init GLFW");
|
printf("Failed to init GLFW");
|
||||||
wnd = glfwCreateWindow(1024, 768, "PanoPainter", nullptr, nullptr);
|
wnd = glfwCreateWindow(1024, 768, "PanoPainter", nullptr, nullptr);
|
||||||
pp::platform::legacy::set_legacy_glfw_window(wnd);
|
|
||||||
g_platform_services = pp::platform::legacy::create_platform_services({
|
g_platform_services = pp::platform::legacy::create_platform_services({
|
||||||
.acquire_render_context = [wnd] { glfwMakeContextCurrent(wnd); },
|
.acquire_render_context = [wnd] { glfwMakeContextCurrent(wnd); },
|
||||||
.present_render_context = [wnd] { glfwSwapBuffers(wnd); },
|
.present_render_context = [wnd] { glfwSwapBuffers(wnd); },
|
||||||
|
|||||||
Reference in New Issue
Block a user