parent
ff3cebfffd
commit
6ac4529f3b
|
@ -322,14 +322,8 @@ bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event)
|
|||
mouse_pos.y += window_y;
|
||||
}
|
||||
// Fix for high DPI mac/idevice/wayland
|
||||
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
||||
if (!platform_io.Monitors.empty() && platform_io.Monitors[0].DpiScale > 1.0f)
|
||||
{
|
||||
// The Framebuffer is scaled by an integer ceiling of the actual ratio, so 2.0 not 1.685 on Mac!
|
||||
//printf("multiply by %f\n",platform_io.Monitors[0].DpiScale);
|
||||
mouse_pos.x *= std::ceil(platform_io.Monitors[0].DpiScale);
|
||||
mouse_pos.y *= std::ceil(platform_io.Monitors[0].DpiScale);
|
||||
}
|
||||
mouse_pos.x *= io.InputScale;
|
||||
mouse_pos.y *= io.InputScale;
|
||||
io.AddMouseSourceEvent(event->motion.which == SDL_TOUCH_MOUSEID ? ImGuiMouseSource_TouchScreen : ImGuiMouseSource_Mouse);
|
||||
io.AddMousePosEvent(mouse_pos.x, mouse_pos.y);
|
||||
return true;
|
||||
|
@ -627,13 +621,8 @@ static void ImGui_ImplSDL2_UpdateMouseData()
|
|||
mouse_y -= window_y;
|
||||
}
|
||||
// Fix for high DPI mac/idevice/wayland
|
||||
ImGuiPlatformIO& platform_io = ImGui::GetPlatformIO();
|
||||
if (!platform_io.Monitors.empty() && platform_io.Monitors[0].DpiScale > 1.0f)
|
||||
{
|
||||
// The Framebuffer is scaled by an integer ceiling of the actual ratio, so 2.0 not 1.685 on Mac!
|
||||
mouse_x *= std::ceil(platform_io.Monitors[0].DpiScale);
|
||||
mouse_y *= std::ceil(platform_io.Monitors[0].DpiScale);
|
||||
}
|
||||
mouse_x *= io.InputScale;
|
||||
mouse_y *= io.InputScale;
|
||||
io.AddMousePosEvent((float)mouse_x, (float)mouse_y);
|
||||
}
|
||||
}
|
||||
|
@ -793,7 +782,7 @@ void ImGui_ImplSDL2_NewFrame()
|
|||
io.DisplayFramebufferScale = ImVec2(1.0f, 1.0f);
|
||||
io.DisplaySize = ImVec2((float)display_w, (float)display_h);
|
||||
//printf("write %d/%d to DpiScale\n",display_w,w);
|
||||
platform_io.Monitors[0].DpiScale=(float)display_w/(float)w;
|
||||
io.InputScale=(float)display_w/(float)w;
|
||||
}
|
||||
|
||||
// Setup time step (we don't use SDL_GetTicks() because it is using millisecond resolution)
|
||||
|
|
|
@ -1273,6 +1273,7 @@ ImGuiIO::ImGuiIO()
|
|||
DisplaySize = ImVec2(-1.0f, -1.0f);
|
||||
DeltaTime = 1.0f / 60.0f;
|
||||
IniSavingRate = 5.0f;
|
||||
InputScale = 1.0f;
|
||||
IniFilename = "imgui.ini"; // Important: "imgui.ini" is relative to current working dir, most apps will want to lock this to an absolute path (e.g. same path as executables).
|
||||
LogFilename = "imgui_log.txt";
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO
|
||||
|
|
|
@ -2060,6 +2060,7 @@ struct ImGuiIO
|
|||
ImVec2 DisplaySize; // <unset> // Main display size, in pixels (generally == GetMainViewport()->Size). May change every frame.
|
||||
float DeltaTime; // = 1.0f/60.0f // Time elapsed since last frame, in seconds. May change every frame.
|
||||
float IniSavingRate; // = 5.0f // Minimum time between saving positions/sizes to .ini file, in seconds.
|
||||
float InputScale; // = 1.0f // Used by backend in system managed scale situations.
|
||||
const char* IniFilename; // = "imgui.ini" // Path to .ini file (important: default "imgui.ini" is relative to current working dir!). Set NULL to disable automatic .ini loading/saving or if you want to manually call LoadIniSettingsXXX() / SaveIniSettingsXXX() functions.
|
||||
const char* LogFilename; // = "imgui_log.txt"// Path to .log file (default parameter to ImGui::LogToFile when no file is specified).
|
||||
void* UserData; // = NULL // Store your own data.
|
||||
|
|
|
@ -3628,6 +3628,8 @@ bool FurnaceGUI::loop() {
|
|||
if (prevScrW!=scrW || prevScrH!=scrH) {
|
||||
logV("size change 2: %dx%d (from %dx%d)",scrW,scrH,prevScrW,prevScrH);
|
||||
}
|
||||
|
||||
ImGui::GetIO().InputScale=(float)canvasW/(float)scrW;
|
||||
}
|
||||
|
||||
wantCaptureKeyboard=ImGui::GetIO().WantTextInput;
|
||||
|
|
Loading…
Reference in New Issue