-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: preferences.yml for window size #185
Conversation
71a2ba2
to
73f5f41
Compare
73f5f41
to
6259f73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, looks good to me. I found one bug, but since I am not going to use the fullscreen mode by default, I don't think it applies to me :)
Apart from that, just some naming nits
WindowPreferences struct { | ||
Width int | ||
Height int | ||
Maximized bool `yaml:",omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: To me, "maximized" means a different concept from fullscreen. Maximized means the window takes maximal amount of space, but keeping the decoration. Fullscreen means the bottom bars and window decorations are gone. So please change this to either "fullscreen" or consider implementing both "fullscreen" and "maximized"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gioui seems to agree: maximized, minimized, windowed and fullscreen are different options: https://github.com/gioui/gio/blob/8daff13af6cdbe4cb689e324f6ba343062dad050/app/window.go#L853
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, yeah, this confuses me. All I ever meant was "Maximized" (and I also see no use for actual Fullscreen), but when I try the gioui options, the app.Fullscreen.Option() that I used and the app.Maximized.Option() give the same effect (i.e. Maximized).
as the app.Fullscreen.Option() gave me what I wanted, I didn't get the idea of looking further; but as no other people really asked for Fullscreen, I would then just use the different Option, even if they look the same for me.
tracker/gioui/preferences.yml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had trouble getting out of the fullscreen mode, by doing following:
- Make a small custom configuration file with
window:
maximized: true
- Start tracker
- Close the window once. The tracker asks if we want to save. Click cancel.
- Try to exit fullscreen by hitting ctrl-enter
I don't know if this is bug in gioui or our main event loop. Please try fixing this if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, too, I don't quite get it.
Ctrl + Enter does not seem to have any effect for me
EDIT: Oh. Just found, pressing "Alt+Enter" does the Fullscreen thing. I didn't even know it.
But still, it's a bit different for me: Alt + Enter just seems to work sometimes, and sometimes it just does some movements and stays Fullscreen. Regardless of whether the App was Maximized at any point, or Closed-and-Opened again.
Did that work successfully at some point?
} | ||
t.Theme.Shaper = text.NewShaper(text.WithCollection(fontCollection)) | ||
t.PopupAlert = NewPopupAlert(model.Alerts(), t.Theme.Shaper) | ||
if t.preferences.YmlError != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine for now. In future, and even for the keybindings, I'm thinking of loading them every time a new tracker is created instead of init(). Because:
In the VST, init is called only once, when the DLL is loaded. But the DLL stays loaded even if you close the plugin. So, to make new config take effect, you have to close the entire DAW.
tracker/gioui/preferences.go
Outdated
return true, err | ||
} | ||
|
||
func NewPreferences() Preferences { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I prefer reserving word "New" only for heap allocations, so typically functions returning pointers to structs. This matches the meaning of "new" in C++. Using MakePreferences
would match how new
and make
keywords work in go: new(type)
returns a pointer to a type, whereas make(type)
returns type. So please change to MakePreferences
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes dropping the Make altogether and using some convenient short word is great. For example, gioui has layout.Rigid basically just doing similar thing i.e. constructing a struct, but it would be pretty verbose to write "layout.MakeFlexChild" every time. But here, the MakePreferences won't be called too many times, so I think a bit more lengthy name is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, I didn't notice before that the New...() only return pointers. but I have no feelings whatsoever about that name for now, so... yeah :)
LGTM, merged! Thank you for your contribution! P.S. MacOs runners seem to have been broken again, so the failing github actions was not related to this PR. |
Howdy again :)
I went on implementing the config file, I see you created an issue #184 but I didn't read it yet -- will do so now :)
please take your time, I'm not in a hurry, just have some time and motivation at hand, but the upstream merges can go as slow and careful as feels right for you