95 ImGuiContext* ctx = ImGui::GetCurrentContext();
97 return R
"({"error": "ImGui context not available"})";
100 ImGuiIO& io = ImGui::GetIO();
110 if (ctx->NavWindow !=
nullptr) {
115 ImGuiID active_id = ImGui::GetActiveID();
116 if (active_id != 0) {
121 ImGuiID hovered_id = ImGui::GetHoveredID();
122 if (hovered_id != 0) {
127 for (ImGuiWindow* window : ctx->Windows) {
128 if (window && window->Active && !window->Hidden) {
134 for (
int i = 0; i < ctx->OpenPopupStack.Size; i++) {
135 ImGuiPopupData& popup = ctx->OpenPopupStack[i];
136 if (popup.Window && !popup.Window->Hidden) {
142 state.
nav_id = ctx->NavId;
146 for (
int i = 0; i < 5; i++) {
161#if defined(YAZE_WITH_JSON)
171 j[
"navigation"] = {{
"nav_id", absl::StrFormat(
"0x%08X", state.
nav_id)},
174 nlohmann::json mouse_buttons;
175 for (
int i = 0; i < 5; ++i) {
179 j[
"input"] = {{
"mouse_buttons", mouse_buttons},
192 json.append(
" \"frame_count\": ");
196 json.append(
" \"frame_rate\": ");
200 json.append(
" \"focused_window\": ");
204 json.append(
" \"focused_widget\": ");
208 json.append(
" \"hovered_widget\": ");
212 json.append(
" \"visible_windows\": [");
221 json.append(
" \"open_popups\": [");
222 for (
size_t i = 0; i < state.
open_popups.size(); ++i) {
230 json.append(
" \"navigation\": {\n");
231 json.append(
" \"nav_id\": ");
232 json.append(EscapeJsonString(absl::StrFormat(
"0x%08X", state.
nav_id)));
234 json.append(
" \"nav_active\": ");
236 json.append(
"\n },\n");
238 json.append(
" \"input\": {\n");
239 json.append(
" \"mouse_buttons\": [");
240 for (
int i = 0; i < 5; ++i) {
248 json.append(
" \"mouse_pos\": [");
254 json.append(
" \"modifiers\": {\n");
255 json.append(
" \"ctrl\": ");
258 json.append(
" \"shift\": ");
261 json.append(
" \"alt\": ");
263 json.append(
"\n }\n");