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

Unable to move the window around when only the text editor widget is visible at startup #508

Closed guihkx closed 1 year ago

guihkx commented 1 year ago

If you hide both the notes and folders panels (while in frameless mode), the next time you launch Notes, you won't be able to move the window (unless you unhide one of the panels first).

Steps to reproduce:

  1. Enable frameless mode
  2. Hide the folders panel
  3. Hide the notes panel
  4. Quit Notes
  5. Open Notes
  6. Try to move the window around

I bisected this and it points to ef4bb7f08ea84fbb6213e9fdea4fc053c58bbb23, but I haven't found a fix yet.

@zjeffer Would you have any idea?

zjeffer commented 1 year ago

Wow that's so weird, I don't really see anything in that commit that could cause this...

bjorn commented 1 year ago

It's because in this case, the ui->searchEdit position hasn't been set since the layout is delayed, which causes this code to always eat the press and double-click events:

https://github.com/nuttyartist/notes/blob/4aebc2f15a68e487a22325430c7cb2c600ddf27f/src/mainwindow.cpp#L3501-L3510

If filtering that event is necessary (it was added to fix #173), it should probably use a different mechanism for determining where the "top part of the window" is. But personally I think we shouldn't filter out the event, but rather check this condition in MainWindow::mousePressEvent (which I think you're doing in #505, @guihkx?).

guihkx commented 1 year ago

Thanks a lot for the investigative work @bjorn. I believe I have fixed this in #505.

It'd be great if it could get your approval as well!