pi3d / pi3d.github.com

Org page for pi3d
22 stars 7 forks source link

in proper display size on Linux x86 #10

Open jacceko opened 3 years ago

jacceko commented 3 years ago

On Linux (Mint 19.3 Xfce like Ubuntu 18.04 on x86) when I specify Display width and height, drawing area is about 100pixels below window border (like 100 pixels of top padding ). It is only when specify width and height of Display, when size is auto this problem not exists. On Raspberry (arm) this problem not exists at all.

To replicate this problem - please use "Slideshow_2d.py" from pi3_demos, and add to Display h and w values - which will be smaller then screen w and h (when values equal screen size problem not exist)

paddywwoof commented 3 years ago

Hi, I think this is a way that ubuntu or xfce controls the x11 windowing system. It's possible to make the pi3d window full screen as that's an option available but if you try to set the x and y values less than the margin the window just gets stuck at the edge.

There is another issue that the Display window doesn't get positioned when it's created, x11 decides where it will go once something is rendered, and that could be anywhere it will fit. It is then possible to position it (subject to the restriction I mentioned above) using Display.resize(x=,y=,w=,h=) so you have to do that after the first display loop - which is bit messy.

On raspberry Pis prior to v4 the GLES output went to a dispmanx layer that wasn't subject to any x11 interference so it could go anywhere and allowed more direct control. I think you will find the same issues with RPi4

You could try this mod

...
DISPLAY = pi3d.Display.create(background=(0.0, 0.0, 0.0, 1.0), frames_per_second=27, x=10, y=10, w=600, h=600)
...
(xloc, yloc) = (50, 50)
while DISPLAY.loop_running():
    tm = time.time()
...
    if k==ord(' '): # press space to position and resize the window. Will move left and up each time. ############
        xloc -= 1
        yloc -= 1
        print(xloc, yloc)
        DISPLAY.resize(x=xloc, y=yloc, w=400, h=400)

kbd.close()
DISPLAY.destroy()

and see where the display window stops moving left or up.

Paddy

jacceko commented 3 years ago

Hi Paddy Thanks for quick answer, I try your solution but Display resize change position of whole window with title bar. But in my case I have space (margin) between Title bar and content - and changing of windows size, not change this margin - I can only hide some portion of window - but it is not so good solution.

I find out that on first frame is always ok, but on second frame rednered content goes about 100 pixels down. How to fix it? (Additionally - is a way to hide title bar on pi3d window on linux? )

paddywwoof commented 3 years ago

Hi, I'm away for a week or so, but will check this out when I get back. I'm sure that x11 has a window setting to hide the title bar but not sure if and how pi3d accesses it.