Bloc icon indicating copy to clipboard operation
Bloc copied to clipboard

Window control for minimize, maximize, close hidden on windows

Open rvillemeur opened this issue 1 year ago • 9 comments

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

rvillemeur avatar May 15 '24 13:05 rvillemeur

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

astares avatar May 15 '24 17:05 astares

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

rvillemeur avatar Jul 02 '24 16:07 rvillemeur

@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.

tinchodias avatar Jul 08 '24 19:07 tinchodias

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

labordep avatar Jul 09 '24 13:07 labordep

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 avatar Jul 09 '24 16:07 tinchodias

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.

tinchodias avatar Jul 09 '24 16:07 tinchodias

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

rvillemeur avatar Jul 09 '24 17:07 rvillemeur

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 avatar Jul 09 '24 18:07 tinchodias

In Mac:

  • I tell the space to show and (even if position is 0@0) the answer of get window position is 0@53.
  • Then I set BlSpace's position to 0@10, but the actual Mac OS window didn't move. I ask the space for the position and it tells me it's in 0@10, didn't check why, but you can see the answer in the video
  • then I drag and drop the OS window into the same place, but again the result to position is 0@53

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

tinchodias avatar Jul 09 '24 18:07 tinchodias