community icon indicating copy to clipboard operation
community copied to clipboard

Window misspositioned and too big when using CustomTitlebar

Open CoreTaxxe opened this issue 2 years ago • 0 comments

Software Versions

  • Python: 3.11.5
  • OS: Win11
  • Kivy: 2.3.0
  • Kivy installation method: pip

Describe the bug When using

Window.custom_titlebar = True Window.maximize()

The Window gets positioned "off the screen" (for me (-8, -8)) and becomes larger than the actual desktop. (2576, 1408) instead of the actual work area of (2560, 1392).

Expected behavior The Window should be positioned at 0,0 and should have the proper size.

To Reproduce

  1. Set custom Titlebar.

Code and Logs and screenshots

from ctypes import windll

windll.user32.SetProcessDpiAwarenessContext(c_int64(-4))
windll.user32.SetProcessDPIAware()

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.floatlayout import FloatLayout
from kivy.core.window import Window


class CustomBar(FloatLayout):
    draggable = True


class Root(FloatLayout):
    def on_touch_up(self, touch):
        print(Window.left, Window.top)
        print(Window.size)
        super().on_touch_up(touch)


class BrokenWindowSize(App):
    def build(self):
        root = Root()
        Window.custom_titlebar = True
        Window.maximize()
        Window.set_custom_titlebar(root.ids.b)
        return root


Builder.load_string("""

<Root>:
    canvas:
        Color:
            rgb : 1, 0,0
            
        Line:
            rectangle: (0,0,self.width, self.height)
            
    CustomBar:
        id : b
        size_hint : (1, 0.1)
        pos_hint: {'top':1}
""")

BrokenWindowSize().run()

Additional context Probably liked to the issue where the window gets very small as soon as it opens when Windowsscaling is above 100%

Note here the scaling is 100%

CoreTaxxe avatar Feb 09 '24 19:02 CoreTaxxe