pharo-graphics / Bloc

Low-level UI infrastructure & framework for Pharo
MIT License
83 stars 40 forks source link

Window control for minimize, maximize, close hidden on windows #507

Open rvillemeur opened 6 months ago

rvillemeur commented 6 months ago

When I open a Space window in Windows 10, the top bar is hidden. I need to resize the space to see them. This issue happen on Pharo 11 or 12

image image
astares commented 6 months ago

Can confirm, have seen this too when trying out Bloc/Toplo examples on Windows

rvillemeur commented 4 months ago

As an easy fix, we could update BlOSWindowHost >> createAttributesFor: aSpace to set a default position which will show the title bar, like:

aSpace knowsPosition ifTrue: [ 
        theAttributes position: aSpace position ] ifFalse: [theAttributes windowCentered: true ].

Which is the same behaviour we currently have when we open Pharo Morphic world

tinchodias commented 4 months ago

@plantec @labordep what do you think about @rvillemeur 's idea? I think it's a valid behavior to adopt.

I think an alternative can be to sum the title bae height to BlSpace's y, and call the SDL2 function using that sum... then the title bar can't be hidden. I will check. I think this is the SDL2 behavior on Mac platform... you can't open the window without the title bar being visible.

labordep commented 4 months ago

Hi! Yes I confirm this is crappy to always moving the window xD I like this proposition, what is the behavior on multiple screens?

tinchodias commented 4 months ago

Aha, I knew I fought with this problem: #121 first I wasn't realizing that the title bar was hidden "out of the screen".

tinchodias commented 4 months ago

I've found an interesting example to think on this problem, that is a low-level example of basic SDL2 window creation and destruction. It shows the usage of the "undefined position", and it opens on the center of the screen both in Mac and Windows. Try it evaluating: SDL2Example new simpleWindow.

I consider this a point in favor of opening the BlSpace on the center of the screen.

rvillemeur commented 4 months ago

Hi! Yes I confirm this is crappy to always moving the window xD I like this proposition, what is the behavior on multiple screens?

I'll open jn the center of the main screen. This is the same default behavior when you launch a specific pharo image from pharo launcher

tinchodias commented 4 months ago

On my Windows 10, I observe that 0@0 position, currently the initial position, places the window like this. And I set 0@16 and it starts to be partially inside the screen. And the SDL_Window function to get windows position returns exactly the set value,

https://github.com/pharo-graphics/Bloc/assets/3044265/b5a4286d-11cf-44ca-96f0-0a72fb186d32

This is a tricky way to call that get win position function directly, without any possible wrapping modification, is: (s hostSpace instVarNamed: 'window') validHandle sdl2Window position)... it returns what you set.

Now in Mac platform this is not the same. I shared in next comment.

tinchodias commented 4 months ago

In Mac:

https://github.com/pharo-graphics/Bloc/assets/3044265/54c7b3d9-9bed-4529-815f-b26a9f5709ea