Skip to content

ImGui docking branch issues with SDL2 + Metal #5392

@slajerek

Description

@slajerek

Hello!

I added SDL2 + Metal on docking branch to my app based on example_sdl_metal. It seems the example does not support docking features:

There were a few changes required, the example does not have these lines in render loop (i.e. docking windows update):

	if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
	{
		ImGui::UpdatePlatformWindows();
		ImGui::RenderPlatformWindowsDefault();
	}

Also, I had to add in imgui_impl_sdl.cpp update of the PlatformHandleRaw around line 418 and 765, otherwise it crashed when Metal backend tried to cast SDL_Window PlatformHandle to NSWindow:

#ifdef __APPLE__
	SDL_SysWMinfo info;
	SDL_VERSION(&info.version);
	if (SDL_GetWindowWMInfo(window, &info))
		main_viewport->PlatformHandleRaw = (void*)info.info.cocoa.window;
#endif

The above works almost perfect:

  1. The code needs to be updated to add nearest-neighbour texture sampler, not only bilinear (I know how to do that).

  2. However, I have an issue when I deserialise INI file in the runtime - I have workspaces feature, so that user can store and restore layout of windows, this works perfect for OpenGL3, but has problems with properly restoring windows layout when running on Metal backend:

ImGui::LoadIniSettingsFromMemory((const char*)data);

When windows are restored in Metal then interior size is smaller than window's, please check this screenshot:

Screenshot 2022-06-13 at 13 39 08

The X button shows where are window's interior boundaries, and black border around shows where it should be. Any hint how to fix this @ocornut ? Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions