Skip to content

imgui incorrectly centred on Linux multi-monitor setup #386

@splondike

Description

@splondike

On i3 and GNOME3 for talon stable (0.2.2) and talon beta (v0.2.0-94-g4a40) the following code does not correctly centre the imgui window for a certain multi-monitor/primary configuration:

from talon import imgui, ui

@imgui.open()
def test(gui):
    gui.text("Test window")

test.show()
rect = test._canvas.rect
print("Screens: ", ui.screens())
print("Expected x/y: ", (1600 - rect.width) / 2, (900 - rect.height) / 2)
print("Actual: ", rect)

I have monitors A: 1600x900 and B: 1920x1080. In xrandr I have A at offset 0,0 and B at offset 1600,0. If I make A the xrandr primary then the above code prints out the expected answer (under v0.2.0-94-g4a40):

Screens:  [Screen(x=0, y=0, size=(1600, 900), mm=(344.000, 194.000)), Screen(x=1600, y=0, size=(1920, 1080), mm=(509.000, 286.000))]
Expected x/y:  755.0 437.0
Actual:  Rect(755.0, 437.0, 90.0, 26.0)

If I make B the primary and restart Talon then it prints out the wrong answer:

Screens:  [Screen(x=1600, y=0, size=(1920, 1080), mm=(509.000, 286.000)), Screen(x=0, y=0, size=(1600, 900), mm=(344.000, 194.000))]
Expected x/y:  755.0 437.0
Actual:  Rect(915.0, 527.0, 90.0, 26.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions