rnote icon indicating copy to clipboard operation
rnote copied to clipboard

Window does not resize on mac and has no decoration

Open DorianRudolph opened this issue 1 year ago • 31 comments

On macOS 14.0 (23A344), rnote (0.8.2 (76)) has no window decoration and cannot be resized, it stays at the full screen resolution of the macbook.

Screenshot 2023-10-06 at 20 26 27

DorianRudolph avatar Oct 06 '23 18:10 DorianRudolph

Before updating to Sonoma, have you been using Rnote on Ventura without this issue? Intel or Apple Silicon?

dehesselle avatar Oct 06 '23 18:10 dehesselle

Apple Silicon (M1 Max). I'm not sure if it worked before the update. I think it did, but I'm not very certain.

DorianRudolph avatar Oct 06 '23 19:10 DorianRudolph

Wait a second, what do you mean "has no window decoration"? The decoration is right there in your screenshot. It's just not native macOS as Rnote uses a multiplatform UI framework that has its own distinctive look.

I cannot reproduce any issue on my test machine which runs Sonoma beta 3 (updating to release version right now). It is an Intel machine though, I do not have a Apple Silicon machine running Sonoma.

dehesselle avatar Oct 06 '23 21:10 dehesselle

I can't reproduce any issue on the stable version of Sonoma either. Can you record a video of your resizing problem?

dehesselle avatar Oct 06 '23 21:10 dehesselle

Sorry, but after a reboot, I can't reproduce the issue anymore. With "no window decoration" I meant the missing shadow and square corners. It seems on my screenshot, rnote got stuck in a maximized mode and could not be resized anymore. Another thing I noticed was that rnote could be resized by rectangle after the reboot, but not after playing around (moving, resizing, adding and removing monitors) for a bit. If I encounter the issue again, I will record a video.

DorianRudolph avatar Oct 06 '23 22:10 DorianRudolph

I can reproduce the issue on a M2 mac mini with the latest os and rnote 0.9. I could not resize the rnote window at any point.

I started with a rnote window that was taking the full screen but was not resizable and ended up with a window that was smaller than the fullscreen size and still not resizable by any means. Do you have betterdisplay installed ? I have a "non-apple" resolution of 1440p and use betterdisplay to get around the terrible scaling of mac os, and playing with resolutions/scaling made it broke even more.

Doublonmousse avatar Oct 11 '23 04:10 Doublonmousse

Can confirm this on my work macbook (m1). Has been like that since I think 7.1and macos 13 – The first time I ran rnote on a mac.

(Since it isn't my personal laptop, I am limited in testing of hotfixes thoug)

https://github.com/flxzt/rnote/assets/47243761/dd8e06f1-43b2-48ea-9a96-4d4d37059c9e

LeSnake04 avatar Oct 11 '23 09:10 LeSnake04

If you disconnect the external monitor and open Rnote using the internal display only, does the issue persist?

dehesselle avatar Oct 11 '23 09:10 dehesselle

I'm curious about that as well. It may work better on natively supported resolution and dpi than on external monitors with custom resolutions/dpi/scaling that mac os doesn't support natively without resorting to additional scaling or tools like betterdisplay.

Now what I'm trying to figure out is how to start from a clean state. For whatever reason, after playing out with resolutions with betterdisplay, the rnote window is not fullscreen anymore, and no amount of rebooting, uninstalling and reinstalling the application helps to restore it to its previous configuration.

Is there additional config files to clear up to start from a clean state ? And I feel like this is also related to the issue, as in the window size/scaling/position get stuck on the wrong values.

Also it's probably a gtk4 bug on mac os. I found this issue that could be related https://gitlab.gnome.org/GNOME/gtk/-/issues/5898

Doublonmousse avatar Oct 11 '23 09:10 Doublonmousse

I don't have BetterDisplay. I occasionally use EasyRes to change the resolution, but I usually don't run nonstandard resolutions. I think a GTK4 bug sounds pretty likely.

DorianRudolph avatar Oct 11 '23 10:10 DorianRudolph

The issue above mentions Gaphor as another GTK4 program to test, but the OP never responded to that. Can someone who is facing this issue give that a spin? Another candidate would be Zrythm. Or any other GTK4 based program that is being built for macOS - let me know if you are aware of any other apps.

dehesselle avatar Oct 11 '23 13:10 dehesselle

For Gaphor

  • resizing works, maximizing as well, even if the animation is a little weird.
  • interaction with Rectangle does not work
  • interaction with alt-tab (another utility to alt-drag windows around) does work, but not for resizing

What I could not find is the specific version of gtk/libadwaita used in the brew package (the repository only list minimum version requirements, maybe we have to look at the brew formula to find it ?).

I'll try zrythm next

Doublonmousse avatar Oct 11 '23 14:10 Doublonmousse

Well I can't get zrythm to launch at all at without it crashing on launch...

Doublonmousse avatar Oct 11 '23 15:10 Doublonmousse

I'll build gtk4-demo so we can confirm if it's a general issue or not.

dehesselle avatar Oct 11 '23 17:10 dehesselle

It might be worth to test the adwaita demo as well - because of its new BreakPoint API and the adaptive widgets.

flxzt avatar Oct 11 '23 18:10 flxzt

If you disconnect the external monitor and open Rnote using the internal display only, does the issue persist?

when I open Rnote without a external display, it becomes fullscreen but I cant rezize it.

LeSnake04 avatar Oct 11 '23 18:10 LeSnake04

@flxzt does rnote try to maximize/modify the window? this comment says not maximizing via the built in function fixed it for them.

LeSnake04 avatar Oct 11 '23 19:10 LeSnake04

rnote restores the saved window dimensions and the maximized state from the last session - see here. And it of course maximizes the window when the maximize button is clicked

flxzt avatar Oct 15 '23 10:10 flxzt

So a build without restoring dimensions and maximized state might fix the issue.

LeSnake04 avatar Oct 20 '23 16:10 LeSnake04

I've created artifacts that contain the demo programs for testing purposes. You need to download them directly from CI.

  1. Drag the application from the dmg to your desktop, not to the applications folder.
  2. Open the terminal.
  3. Remove quarantine flag.
    xattr -r -d com.apple.quarantine $HOME/Desktop/Rnote.app
    
  4. Set environment variables.
    RNOTE_APP=$HOME/Desktop/Rnote.app
    DYLD_LIBRARY_PATH=$RNOTE_APP/Contents/Resources/lib:$RNOTE_APP/Contents/Resources/lib/gdk-pixbuf-2.0/2.10.0/loaders
    GDK_PIXBUF_MODULE_FILE=$RNOTE_APP/Contents/Resources/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
    XDG_DATA_DIRS=$RNOTE_APP/Contents/Resources/share
    export DYLD_LIBRARY_PATH GDK_PIXBUF_MODULE_FILE XDG_DATA_DIRS
    
  5. Run either
    # If you want to run the GTK demo program:
    $RNOTE_APP/Contents/Resources/bin/gtk4-demo
    
    or
    # If you want to run the libadwaita demo program:
    $RNOTE_APP/Contents/Resources/bin/adwaita-1-demo
    

dehesselle avatar Oct 27 '23 22:10 dehesselle

Well, testing the artifacts (gtk4-demo and adwaita-1-demo) I did not encounter any issues, even when switching between resolutions and fullscreen/not fullscreen mode using better display.

Even if I reinstall rnote (remove the rnote app then putting it back again), my rnote window is still the wrong size and will not be able to be maximized (and it is the same wrong size everytime). Where yould the resolution info from the last session be stored ? I would like to know, and potentially edit the info manually to test if it's the culprit.

Edit : found the plist file in ~/Library/Preferences/net.flxzt.Rnote.plist

Doublonmousse avatar Oct 28 '23 06:10 Doublonmousse

How to make the bug appear : close rnote whilst the window is maximized. Then for each subsequent launch of rnote, the size of the window will be fixed and no resizing or maximizing can be done.

Removing the plist file then restarting mac os (seems that the last configuration is loaded even if the plist file is deleted !) resets the defaults parameters and rnote will then work as expected.

On a previous attempt, the maximize state was set to true, but the resolution given in the plist was also respected to the letter, even if the resolution listed did not correspond at all with the resolution rnote's window should have if maximized.

But the bug also occurs if is-maximized is true and the window size is also of the correct dimension.

We could try

  • if is-maximized is true, maximize the window but do NOT restore the width/height in the file (doing both does not work)
  • if is-maximized is false, restore the default width/height. (this is the default start configuration, that works !)

So either the maximize command cannot be used if we also restore the dimension or the maximize command has a bug.

Doublonmousse avatar Oct 28 '23 12:10 Doublonmousse

okay, I pushed a possible fix. Can you create another macos build so it can be tested @dehesselle ?

flxzt avatar Oct 29 '23 11:10 flxzt

Artifacts are ready: https://gitlab.com/dehesselle/rnote_macos/-/pipelines/1054036648/builds

edit: for clarification: this is v0.9.0-20-g99b50661 (as per git describe --tags)

dehesselle avatar Oct 29 '23 21:10 dehesselle

Well, it does not seem to fix the issue on my side. So using the maximize command is probably causing the bug.

Doublonmousse avatar Oct 30 '23 01:10 Doublonmousse

Should the app just not restore the maximized state on macos for now, until this bug is fixed in gtk?

Edit: pushed a commit that changes that the window maximized state is not restored on macos. Another (hopefully last) test build would be nice @dehesselle .

flxzt avatar Oct 31 '23 08:10 flxzt

Artifacts for v0.9.0-24-g0aef3ca2: https://gitlab.com/dehesselle/rnote_macos/-/pipelines/1056092811/builds

dehesselle avatar Oct 31 '23 13:10 dehesselle

This works on my side now. Well it's a shame the first attempt did not work but it was worth trying at least.

Putting the gtk issue link again so we don't have to search for it too much : https://gitlab.gnome.org/GNOME/gtk/-/issues/5898

Doublonmousse avatar Nov 01 '23 01:11 Doublonmousse

One of the main contributor from the gaphor project implemented in gaphor a way to restore the maximize status of the window (not on the start window but on the main window for editing a diagram), and I can test and confirm it works, whilst doing the same in rnote (forcing a maximize to take place, with or without setting first the default window size) doesn't on the same gtk version.

What is done in gaphor is using python but the logic is the same : https://github.com/gaphor/gaphor/pull/2896/files#diff-e457c14223121ea6acd302856d8886fbfc7ab569bab9ae9f1cffccc2b2ec51bd

So I'm wondering if this is somehow a bug in the wrapper, where the python one is correctly working but the rust one (gtk-rs) isn't on the maximize command.

Doublonmousse avatar Jan 29 '24 15:01 Doublonmousse

I found on that doing this

appwindow.present()
appwindow.maximize(); // maximize the window AFTER presenting it

will not trigger the bug. Somehow calling present before maximize on the window prevents the bug on rust but not on pygobject ... I updated the issue on the gtk tracker as well.

Doublonmousse avatar Feb 02 '24 18:02 Doublonmousse