Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OSX backend following ImGui update #18

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions libs/imgui/backends/imgui_impl_osx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#import "imgui_impl_osx.h"
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
#import <GameController/GameController.h>
#import <time.h>

// CHANGELOG
Expand Down Expand Up @@ -447,7 +446,7 @@ bool ImGui_ImplOSX_Init(NSView* view)
bd->Observer = [ImGuiObserver new];
bd->Window = view.window ?: NSApp.orderedWindows.firstObject;
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
main_viewport->PlatformHandle = main_viewport->PlatformHandleRaw = (__bridge_retained void*)bd->Window;
main_viewport->PlatformHandle = main_viewport->PlatformHandleRaw = (void*)bd->Window; //fix(zig-gamedev)
ImGui_ImplOSX_UpdateMonitors();
ImGui_ImplOSX_InitMultiViewportSupport();

Expand Down Expand Up @@ -883,12 +882,12 @@ static void ImGui_ImplOSX_CreateWindow(ImGuiViewport* viewport)
data->Window = window;
data->WindowOwned = true;
viewport->PlatformRequestResize = false;
viewport->PlatformHandle = viewport->PlatformHandleRaw = (__bridge_retained void*)window;
viewport->PlatformHandle = viewport->PlatformHandleRaw = (void*)window; // fix(zig-gamedev)
}

static void ImGui_ImplOSX_DestroyWindow(ImGuiViewport* viewport)
{
NSWindow* window = (__bridge_transfer NSWindow*)viewport->PlatformHandleRaw;
NSWindow* window = (NSWindow*)viewport->PlatformHandleRaw; // fix(zig-gamedev)
window = nil;

if (ImGuiViewportDataOSX* data = (ImGuiViewportDataOSX*)viewport->PlatformUserData)
Expand Down Expand Up @@ -1040,7 +1039,7 @@ static void ImGui_ImplOSX_UpdateMonitors()
imgui_monitor.WorkPos = ImVec2(visibleFrame.origin.x, visibleFrame.origin.y);
imgui_monitor.WorkSize = ImVec2(visibleFrame.size.width, visibleFrame.size.height);
imgui_monitor.DpiScale = screen.backingScaleFactor;
imgui_monitor.PlatformHandle = (__bridge_retained void*)screen;
imgui_monitor.PlatformHandle = (void*)screen; // fix(zig-gamedev)

platform_io.Monitors.push_back(imgui_monitor);
}
Expand Down
Loading