@@ -1972,6 +1972,7 @@ void FullscreenUI::DrawIntRangeSetting(SettingsInterface* bsi, const char* title
19721972 if (MenuButtonWithValue (title, summary, value_text.c_str (), enabled, height, font, summary_font))
19731973 ImGui::OpenPopup (title);
19741974
1975+ /*
19751976 ImGui::SetNextWindowSize(LayoutScale(500.0f, 192.0f));
19761977 ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
19771978
@@ -1981,10 +1982,20 @@ void FullscreenUI::DrawIntRangeSetting(SettingsInterface* bsi, const char* title
19811982 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
19821983 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,
19831984 LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING, ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
1984-
1985+ */
19851986 bool is_open = true ;
1986- if (ImGui::BeginPopupModal (title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
1987+
1988+ ImVec2 win_size = ImVec2 (LayoutScale (500 .0f , 212 .0f ));
1989+ ImVec2 win_pos = s_game_size / 2 - win_size / 2 ;
1990+ // from BeginPopupModal
1991+ ImGuiContext& g = *GImGui;
1992+ ImGuiWindow* window = g.CurrentWindow ;
1993+ const ImGuiID id = window->GetID (title);
1994+ if (!ImGui::IsPopupOpen (id, ImGuiPopupFlags_None))
1995+ return ;
1996+ if (ImGuiFullscreen::BeginPTR2PopupModal (win_pos, win_size, title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
19871997 {
1998+ ImGui::PushStyleColor (ImGuiCol_Text, HEX_TO_IMVEC4 (0x9e001f , 0xff ));
19881999 BeginMenuButtons ();
19892000
19902001 const float end = ImGui::GetCurrentWindow ()->WorkRect .GetWidth ();
@@ -2006,12 +2017,12 @@ void FullscreenUI::DrawIntRangeSetting(SettingsInterface* bsi, const char* title
20062017 ImGui::CloseCurrentPopup ();
20072018 }
20082019 EndMenuButtons ();
2009-
20102020 ImGui::EndPopup ();
20112021 }
2012-
2013- ImGui::PopStyleVar (4 );
2014- ImGui::PopFont ();
2022+ ImGuiFullscreen::EndPTR2PopupModal ();
2023+ // ImGui::PopStyleVar(4);
2024+ // ImGui::PopFont();
2025+
20152026}
20162027
20172028void FullscreenUI::DrawIntSpinBoxSetting (SettingsInterface* bsi, const char * title, const char * summary, const char * section,
@@ -2032,6 +2043,7 @@ void FullscreenUI::DrawIntSpinBoxSetting(SettingsInterface* bsi, const char* tit
20322043 manual_input = false ;
20332044 }
20342045
2046+ /*
20352047 ImGui::SetNextWindowSize(LayoutScale(500.0f, 192.0f));
20362048 ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
20372049
@@ -2041,10 +2053,21 @@ void FullscreenUI::DrawIntSpinBoxSetting(SettingsInterface* bsi, const char* tit
20412053 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
20422054 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,
20432055 LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING, ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
2056+ */
20442057
20452058 bool is_open = true ;
2046- if (ImGui::BeginPopupModal (title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
2059+
2060+ ImVec2 win_size = ImVec2 (LayoutScale (500 .0f , 212 .0f ));
2061+ ImVec2 win_pos = s_game_size / 2 - win_size / 2 ;
2062+ // from BeginPopupModal
2063+ ImGuiContext& g = *GImGui;
2064+ ImGuiWindow* window = g.CurrentWindow ;
2065+ const ImGuiID id = window->GetID (title);
2066+ if (!ImGui::IsPopupOpen (id, ImGuiPopupFlags_None))
2067+ return ;
2068+ if (ImGuiFullscreen::BeginPTR2PopupModal (win_pos, win_size, title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
20472069 {
2070+ ImGui::PushStyleColor (ImGuiCol_Text, HEX_TO_IMVEC4 (0x9e001f , 0xff ));
20482071 BeginMenuButtons ();
20492072
20502073 s32 dlg_value = static_cast <s32>(value.value_or (default_value));
@@ -2125,12 +2148,13 @@ void FullscreenUI::DrawIntSpinBoxSetting(SettingsInterface* bsi, const char* tit
21252148 ImGui::CloseCurrentPopup ();
21262149 }
21272150 EndMenuButtons ();
2128-
2151+ ImGui::PopStyleColor ();
21292152 ImGui::EndPopup ();
21302153 }
21312154
2132- ImGui::PopStyleVar (4 );
2133- ImGui::PopFont ();
2155+ // ImGui::PopStyleVar(4);
2156+ // ImGui::PopFont();
2157+ ImGuiFullscreen::EndPTR2PopupModal ();
21342158}
21352159
21362160#if 0
@@ -2210,7 +2234,7 @@ void FullscreenUI::DrawFloatSpinBoxSetting(SettingsInterface* bsi, const char* t
22102234 ImGui::OpenPopup (title);
22112235 manual_input = false ;
22122236 }
2213-
2237+ /*
22142238 ImGui::SetNextWindowSize(LayoutScale(500.0f, 192.0f));
22152239 ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
22162240
@@ -2220,10 +2244,19 @@ void FullscreenUI::DrawFloatSpinBoxSetting(SettingsInterface* bsi, const char* t
22202244 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
22212245 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,
22222246 LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING, ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
2223-
2247+ */
22242248 bool is_open = true ;
2225- if (ImGui::BeginPopupModal (title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
2249+ ImVec2 win_size = ImVec2 (LayoutScale (500 .0f , 212 .0f ));
2250+ ImVec2 win_pos = s_game_size / 2 - win_size / 2 ;
2251+ // from BeginPopupModal
2252+ ImGuiContext& g = *GImGui;
2253+ ImGuiWindow* window = g.CurrentWindow ;
2254+ const ImGuiID id = window->GetID (title);
2255+ if (!ImGui::IsPopupOpen (id, ImGuiPopupFlags_None))
2256+ return ;
2257+ if (ImGuiFullscreen::BeginPTR2PopupModal (win_pos, win_size, title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
22262258 {
2259+ ImGui::PushStyleColor (ImGuiCol_Text, HEX_TO_IMVEC4 (0x9e001f , 0xff ));
22272260 BeginMenuButtons ();
22282261
22292262 float dlg_value = value.value_or (default_value) * multiplier;
@@ -2311,12 +2344,13 @@ void FullscreenUI::DrawFloatSpinBoxSetting(SettingsInterface* bsi, const char* t
23112344 ImGui::CloseCurrentPopup ();
23122345 }
23132346 EndMenuButtons ();
2314-
2347+ ImGui::PopStyleColor ();
23152348 ImGui::EndPopup ();
23162349 }
23172350
2318- ImGui::PopStyleVar (4 );
2319- ImGui::PopFont ();
2351+ // ImGui::PopStyleVar(4);
2352+ // ImGui::PopFont();
2353+ ImGuiFullscreen::EndPTR2PopupModal ();
23202354}
23212355
23222356void FullscreenUI::DrawIntRectSetting (SettingsInterface* bsi, const char * title, const char * summary, const char * section,
@@ -2346,7 +2380,7 @@ void FullscreenUI::DrawIntRectSetting(SettingsInterface* bsi, const char* title,
23462380 ImGui::OpenPopup (title);
23472381 manual_input = false ;
23482382 }
2349-
2383+ /*
23502384 ImGui::SetNextWindowSize(LayoutScale(550.0f, 370.0f));
23512385 ImGui::SetNextWindowPos(ImGui::GetIO().DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
23522386
@@ -2356,10 +2390,19 @@ void FullscreenUI::DrawIntRectSetting(SettingsInterface* bsi, const char* title,
23562390 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
23572391 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,
23582392 LayoutScale(ImGuiFullscreen::LAYOUT_MENU_BUTTON_X_PADDING, ImGuiFullscreen::LAYOUT_MENU_BUTTON_Y_PADDING));
2359-
2393+ */
23602394 bool is_open = true ;
2361- if (ImGui::BeginPopupModal (title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
2395+ ImVec2 win_size = ImVec2 (LayoutScale (500 .0f , 390 .0f ));
2396+ ImVec2 win_pos = s_game_size / 2 - win_size / 2 ;
2397+ // from BeginPopupModal
2398+ ImGuiContext& g = *GImGui;
2399+ ImGuiWindow* window = g.CurrentWindow ;
2400+ const ImGuiID id = window->GetID (title);
2401+ if (!ImGui::IsPopupOpen (id, ImGuiPopupFlags_None))
2402+ return ;
2403+ if (ImGuiFullscreen::BeginPTR2PopupModal (win_pos, win_size, title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
23622404 {
2405+ ImGui::PushStyleColor (ImGuiCol_Text, HEX_TO_IMVEC4 (0x9e001f , 0xff ));
23632406 static constexpr const char * labels[4 ] = {FSUI_NSTR (" Left: " ), FSUI_NSTR (" Top: " ), FSUI_NSTR (" Right: " ), FSUI_NSTR (" Bottom: " )};
23642407 const char * keys[4 ] = {left_key, top_key, right_key, bottom_key};
23652408 int defaults[4 ] = {default_left, default_top, default_right, default_bottom};
@@ -2461,12 +2504,13 @@ void FullscreenUI::DrawIntRectSetting(SettingsInterface* bsi, const char* title,
24612504 ImGui::CloseCurrentPopup ();
24622505 }
24632506 EndMenuButtons ();
2464-
2507+ ImGui::PopStyleColor ();
24652508 ImGui::EndPopup ();
24662509 }
24672510
2468- ImGui::PopStyleVar (4 );
2469- ImGui::PopFont ();
2511+ // ImGui::PopStyleVar(4);
2512+ // ImGui::PopFont();
2513+ ImGuiFullscreen::EndPTR2PopupModal ();
24702514}
24712515
24722516void FullscreenUI::DrawStringListSetting (SettingsInterface* bsi, const char * title, const char * summary, const char * section,
0 commit comments