Open KiddoV opened 2 years ago
Can't you normally resize a maximised (not fullscreen) window? EDIT: No! 😉
Depends on #1349
Bumping this to v2.2. I think we need to rework how we detect window status (fullscreen/maximised/minimised) to make this work properly. Waiting for a callback to Go is not a great solution: I'd like the state pushed to JS as soon as it happens so the test for resizing can be instant.
More info: https://stackoverflow.com/a/47911169
Hi @leaanthony, Any update on this bug, as v2.2.0 is out?
Indeed it's a small bug but it prevents me from dragging the window. (When the cursor changes on edges in fullscreen)
Oh sorry no - it slipped from the release. It's an aggressive roadmap. I think we need to pare it down somewhat and this particular bug isn't a high priority. Would be happy to accept a PR if you can create a fix though?
Sure, Can you point me in some direction?
To fix the original bug, when a cursor hits the edges, we want to first check the window is fullscreen and if so, cancel out the drag operation.
Place to look: v2/internal/frontend/runtime
Here is a semi-solution. So it's fixed when the user will use buttons to maximize and minimize (Basically when using functions, it fixed it)
But the common way users will go maximize is by dragging the title and hitting the top to maximize.
The best way would be if we have an event handler so that whenever the window goes maximize we can change enableResize
.
Or may be using WindowIsMaximised()
in v2\internal\frontend\runtime\desktop\main.js
, Like this
Note: Code needs to be updated as the function returns promise, but just for example.
Yeah, it does feel like the state should be available in the frontend without making a call to the backend. And this needs to be per window in the future 😅
I think you should be able to Enable/Disable resize with ExecJS
from the WndProc in window.go
here, that line is only executed for Frameless windows.
Depending on style&w32.WS_MAXIMIZE
you can either disable/enable it. IIRC that should fix the problem in all cases, since that's the event Windows raises when when maximizing/unmaximizing.
Well in that case I think w
& f
both need to be connected with the parent struct.
So I can use f
's funcitons in w
. Consider r
(root) as the parent struct, so I can use r.f.ExecJS
You can directly access chromium and do an eval, like in this snippet in window.go
Great! This worked when I maximized.
But when I put to use the same code in the else statement for unmaximized it crashes and shows a nil memory address
error.
I tried different things but not working.
I think if we invoke the code after the window appears it should work.
Yeah you are right, needs some more handling than just adding it there.
Yeah, it does feel like the state should be available in the front end without making a call to the back end. And this needs to be per window in the future 😅
I like this Idea, seems like it will solve multiple problems including zoom problems as well.
Yeah, state sync is a general problem that should be usable in user-space as well as Wails internals...
This bug also applies to Linux.
On macOS the resize cursor are also shown, but on that platform it's possible to resize from maximized.
There is another really really... small bug about the cursor I forgot to mention back then. When the window in full screen mode (maximize), the mouse cursor should NOT change to
resize arrow
when hover the edges of the window.Originally posted by @KiddoV in https://github.com/wailsapp/wails/issues/1087#issuecomment-1168646102