pthom / imgui_bundle

Your fast track to powerful GUIs: Dear ImGui Bundle, an extensive toolkit for Python and C++ with immediate mode efficiency.
https://pthom.github.io/imgui_bundle/
MIT License
703 stars 73 forks source link

hello_imgui.FullScreenMode.full_monitor_work_area positions window wrong #234

Closed dcnieho closed 4 months ago

dcnieho commented 4 months ago

I am testing with a 1.5.1 wheel i got from your CI, on Windows 11, Python 3.10. Configuring the app to open at hello_imgui.FullScreenMode.full_monitor_work_area doesn't work, the window shows up mostly offscreen (to the top-left).

test code:

from imgui_bundle import imgui, immapp, hello_imgui

def _gui_func():
    imgui.text('test')

params = hello_imgui.RunnerParams()
params.app_window_params.window_geometry.full_screen_mode = hello_imgui.FullScreenMode.full_monitor_work_area
#params.app_window_params.window_geometry.position_mode = hello_imgui.WindowPositionMode.monitor_center
params.callbacks.show_gui  = _gui_func

immapp.run(params)

Here some extra info about what happens with a more complicated draw function:

w=-1
def _gui_func():
    global w
    w+=1
    imgui.text('test')
    if w>2:
        exit(0)
    win     = glfw_utils.glfw_window_hello_imgui()
    print(hello_imgui.dpi_window_size_factor())
    print(glfw.get_window_pos(win))
    print(glfw.get_window_size(win))

returns:

2.5
(0, 12)
(3840, 2268)
2.5
(-2880, -1689)
(3844, 2348)
2.5
(-2880, -1689)
(3844, 2348)

I have only one monitor and its work area according to glfw is (0, 0, 3840, 2280)

pthom commented 4 months ago

Nice catch. I will study this, thanks

dcnieho commented 4 months ago

That was quick, nice!