Bug 4711 - Wrong main window maximisation state configuration saved when using trayicon
Summary: Wrong main window maximisation state configuration saved when using trayicon
Status: NEW
Alias: None
Product: Claws Mail
Classification: Unclassified
Component: Plugins/Notification (show other bugs)
Version: 4.2.0
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2023-10-24 20:17 UTC by Pawel Pekala
Modified: 2023-10-29 10:44 UTC (History)
0 users

See Also:


Attachments
fix maximisation state with trayicon (579 bytes, patch)
2023-10-24 20:17 UTC, Pawel Pekala
Details | Diff
fix maximisation state with trayicon v2 (1.29 KB, patch)
2023-10-26 19:14 UTC, Pawel Pekala
Details | Diff

Description Pawel Pekala 2023-10-24 20:17:34 UTC
Created attachment 2363 [details]
fix maximisation state with trayicon

When using trayicon from notification plugin maximisation state of main
window is wrongly saved under certain circumstances.
Way to reproduce this behavior:

- start claws-mail with tryicon enabled, maximise main window
- click on tray icon or close window button (must have selected "close to tray"
  option for this to work) to minimise window to tray
- close claws-mail by right clicking on tray icon and choosing "Exit Claws Mail"   or close desktop session while claws-mail is minimised
- on next run main window will be not maximised

Proposed patch prevents maximisation state update when hiding to tray by ignoring windows state events with GDK_WINDOW_STATE_WITHDRAWN flag set. This flag appears only when trayicon is used.
Comment 1 Paul 2023-10-25 07:05:12 UTC
I cannot reproduce this. I followed your instructions but on the next run Claws Mail started maximised as expected.
Comment 2 wwp 2023-10-25 09:39:06 UTC
I do reproduce here (CentOS MATE with CM Gtk2, Rocky Linux 9 MATE with CM Gtk3), will check how it behaves with the patch later this week.
Comment 3 Pawel Pekala 2023-10-25 21:50:38 UTC
Just a note, this needs more work. Just discovered that when option
"Hide at startup" is set window is in demaximised state after startup even
when clawsrc clearly states: mainwin_maximised=1.
Comment 4 Pawel Pekala 2023-10-26 19:14:42 UTC
Created attachment 2365 [details]
fix maximisation state with trayicon v2

This one fixes all issues for me.

Some comments, GDK_WINDOW_STATE_WITHDRAWN state means basically
window is not visible. When not visible window is not maximised so
ignore events with this flag set when saving maximised state.

Move setting of maxmised window to main_window_show() - this function
is executed when we click on trayicon to show main window. This part
fixes hide_at_startup issue.
Comment 5 Pawel Pekala 2023-10-29 10:32:46 UTC
Seems window manager dependent, Cinnamon needs fix while under XFCE works fine without.
Comment 6 Paul 2023-10-29 10:44:59 UTC
That's what I thought. Using KDE everything works. I'm not sure we should be "fixing" or working around WMs, at least not with it being reported upstream first.

Note You need to log in before you can comment on or make changes to this bug.