nuttyartist / notes

Fast and beautiful note-taking app written in C++. Write down your thoughts.
https://notes-foss.com
Mozilla Public License 2.0
3.77k stars 333 forks source link

Linux: Update window margins on maximize/unmaximize #500

Closed guihkx closed 1 year ago

guihkx commented 1 year ago

Now that we delegate window moving to the window manager via startSystemMove(), some window managers on Linux allow us to snap the window to the top edge of the screen, in order to maximize it.

Since we didn't know when this would happen, we were not removing the margins added around the window (when in 'frameless mode'), causing them to stay visible even when the window was maximized.

This is a follow-up to #492.

Before:

https://user-images.githubusercontent.com/626206/221020903-9cf53ade-5570-48c1-aedb-7375ebeceb17.mp4


After:

https://user-images.githubusercontent.com/626206/221020953-a802a396-2ffd-495f-a170-e9036eb46c08.mp4

guihkx commented 1 year ago

image

☝️ Any way I can elegantly get rid of these warnings on macOS and Windows? I'm thinking of:

#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
    // do the thing
#else
    Q_UNUSED(event);
#endif

But that doesn't look very elegant, I think. :p

I can probably declare changeEvent() only on Linux too, but at this point I'm not sure what would be the "best-looking" solution.

nuttyartist commented 1 year ago

Very nice!

I noticed this as well but didn't expect a fix that quickly. Thanks!