kusti8 / proton-native

A React environment for cross platform desktop apps
https://proton-native.js.org
MIT License
10.92k stars 360 forks source link

Window resizing on macOS makes windows to jump over. #246

Closed goranmoomin closed 4 years ago

goranmoomin commented 4 years ago

Before the bug report, I would first like to really thank you for the huge work of Proton Native v2! It's a huge step forwards to removing electron from our app ecosystem :-)

Describe the bug On macOS, resizing windows are glitchy and they always jump to the corner of the screen when the user tries to resize it. The following GIF (which is big, sorry :-( - about 50 megs) shows it from the Notepad example, but I also have checked the Calculator example & CatApi example and it had similar behavior.

Edit: looks like GitHub doesn't like Gifs that are too big - the raw link is https://i.imgur.com/Y2n3m1D.gifv

To Reproduce I'm running macOS 10.15.2 (19C57) with node v10.18.1. I think I just used the standard commands to run the application... but for completeness I used the following commands:

$ git clone https://github.com/kusti8/proton-native.git
$ cd proton-native
$ npm i
$ npm link
$ cd examples/Notepad
$ npm link proton-native
$ npm i
$ npm run start

As said, pretty standard :-)

Expected behavior I didn't expect to the title bar disappear when resizing, or jump to the corner. Pretty self-explanatory.

Screenshots Edit: looks like GitHub doesn't like Gifs that are too big - the raw link is https://i.imgur.com/Y2n3m1D.gifv

Versions:

Additional context

roman01la commented 4 years ago

Can confirm this issue is reproducible. It seems like Window component resets its properties when updated.

kusti8 commented 4 years ago

Yeah I suspect that when a user is resizing, this triggers the resize callback that ends up re rendering and resetting the size, which would reset the position. I'll look into it more.

devhammed commented 4 years ago

I am about to open exactly this issue...the window is jumping and glitching on Ubuntu 19.10 too, this is a global issue.

manashathparia commented 4 years ago

Same issue with windows 10 too! Although it doesn't jump to the corner while resizing but it does after clicking anywhere on the app after resized

apollolux commented 4 years ago

Haven't checked yet if resizing resets the position, but for me even just the newly created project from proton-native init myapp starts at the top left corner of the screen.

roman01la commented 4 years ago

After looking more into this it seems like QMainWindow component has to track its position in moveEvent, expose those values to JS and set them onto Yoga layout of the component instance when recalculating the layout. Otherwise both top and left will be always set to initial values, which are 0. Maybe instead we could ignore layout values for top and left for Window component.

apollolux commented 4 years ago

Update: resizing for me not only tries to reset the position, it's also flickering while it does it as if the desire to move is fighting with the existing position. Win10, proton-native 2.0.4

digimbyte commented 4 years ago

Update: resizing for me not only tries to reset the position, it's also flickering while it does it as if the desire to move is fighting with the existing position. Win10, proton-native 2.0.4

Confirmed here too. windows 10 v1906 - window flickers to top corner and original position every frame.

kusti8 commented 4 years ago

For now, I've just excluded Window from changes in position and size due to yoga. I'll figure out a better solution later.

christopherfowers commented 4 years ago

Not sure I followed. Is there a workaround for this issue for the short term?

watery commented 4 years ago

@kusti8 Just installed Proton Native and noticed this bug. Can we do anything before a new release is made?

vs-123 commented 4 years ago

Is there any fix yet?

ghost commented 4 years ago

Version: 2.0.4

File: proton-native/bin/components/Window.js Line: 44 render_1.ROOT_NODE.afterCommit(render_1.ROOT_NODE); Commenting this line out seemed to stop the snapping to the corner when resizing. Hope it works for you!

vs-123 commented 4 years ago

@moranot It worked, thanks.