Viewport, Platform, Examples: Changes to resizing flow + restored support for Platform events affecting the ImGui windows (so Decorated windows are functional). (#1542, #1042) ..

SDL: Added platform move/resize/close support.
GLFW: Added platform move/resize support. Moved Close to use callback for consistency.
Win32:
Vulkan: Fixed resize support.
Naming is WIP "PlatforrmRequestXXX" is too ambiguous. Basically we either have a ImGui->Platform flow or a Platform->ImGui flow. Working a bigger refactor now.
This commit is contained in:
omar
2018-03-15 10:54:27 +01:00
parent 207ad45983
commit 6e58a95a01
6 changed files with 90 additions and 34 deletions

View File

@ -535,10 +535,12 @@ struct ImGuiViewport
void* PlatformUserData; // void* to hold custom data structure for the platform (e.g. windowing info, render context)
void* PlatformHandle; // void* for FindViewportByPlatformHandle(). (e.g. HWND, GlfwWindow*)
bool PlatformRequestClose; // Platform window requested closure
bool PlatformRequestResize; // Platform window requested resize
bool PlatformRequestMove; // Platform window requested move (e.g. window was moved using OS windowing facility)
bool PlatformRequestResize; // Platform window requested resize (e.g. window was resize using OS windowing facility)
void* RendererUserData; // void* to hold custom data structure for the renderer (e.g. framebuffer)
ImVec2 RendererLastSize;
ImGuiViewport(ImGuiID id, int idx) { ID = id; Idx = idx; Flags = 0; LastFrameActive = LastFrameAsRefViewport = -1; LastNameHash = 0; Window = NULL; DpiScale = 0.0f; PlatformUserData = PlatformHandle = NULL; PlatformRequestClose = PlatformRequestResize = false; RendererUserData = NULL; }
ImGuiViewport(ImGuiID id, int idx) { ID = id; Idx = idx; Flags = 0; LastFrameActive = LastFrameAsRefViewport = -1; LastNameHash = 0; Window = NULL; DpiScale = 0.0f; PlatformUserData = PlatformHandle = NULL; PlatformRequestClose = PlatformRequestMove = PlatformRequestResize = false; RendererUserData = NULL; RendererLastSize = ImVec2(-1.0f,-1.0f); }
~ImGuiViewport() { IM_ASSERT(PlatformUserData == NULL && RendererUserData == NULL); }
ImRect GetRect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }
float GetNextX() const { const float SPACING = 4.0f; return Pos.x + Size.x + SPACING; }