Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 1 addition & 7 deletions Imgui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,8 @@ else()
if(PLATFORM_WIN32)
list(APPEND DEAR_IMGUI_SOURCE ${DILIGENT_DEAR_IMGUI_PATH}/backends/imgui_impl_win32.cpp)
list(APPEND DEAR_IMGUI_INCLUDE ${DILIGENT_DEAR_IMGUI_PATH}/backends/imgui_impl_win32.h)
elseif(PLATFORM_MACOS)
set(DEAR_IMGUI_V185_SOURCE
../ThirdParty/imgui_v1.85/imgui_impl_osx_v1.85.mm
../ThirdParty/imgui_v1.85/imgui_impl_osx_v1.85.h
)
target_sources(Diligent-Imgui PRIVATE ${DEAR_IMGUI_V185_SOURCE})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/../ThirdParty/imgui_v1.85 PREFIX "dear_imgui_v1.85" FILES ${DEAR_IMGUI_V185_SOURCE})
endif()
# MacOS uses the self-contained ImGuiImplMacOS.mm (no dear imgui platform backend).

target_sources(Diligent-Imgui PRIVATE
${DEAR_IMGUI_SOURCE}
Expand Down
22 changes: 21 additions & 1 deletion Imgui/interface/ImGuiImplMacOS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@

#pragma once

#include <atomic>
#include <chrono>
#include <mutex>
#include <vector>

#include "imgui.h"
#include "ImGuiImplDiligent.hpp"

@class NSEvent;
@class NSView;
@class NSCursor;

namespace Diligent
{
Expand All @@ -58,7 +64,21 @@ class ImGuiImplMacOS final : public ImGuiImplDiligent
bool HandleOSXEvent(NSEvent* _Nonnull event, NSView* _Nonnull view);

private:
std::mutex m_Mtx;
void InitMouseCursors();
void UpdateMouseCursor();

// clang-format off
NSCursor* _Nullable m_MouseCursors[ImGuiMouseCursor_COUNT] = {};

int32_t m_LastMouseCursor = ImGuiMouseCursor_Arrow;
id _Nullable m_FocusObserver = nullptr;
std::atomic<bool> m_AppActive = true;
std::atomic<bool> m_FocusDirty = false;

std::vector<ImGuiKey> m_KeysPressedWithCmd;
std::chrono::high_resolution_clock::time_point m_LastTime = {};
std::mutex m_Mtx;
// clang-format on
};

} // namespace Diligent
Loading
Loading