Bug 2396 - GNOME Shell : Claws Mail starts with minimized window
Summary: GNOME Shell : Claws Mail starts with minimized window
Status: RESOLVED INVALID
Alias: None
Product: Claws Mail
Classification: Unclassified
Component: UI (show other bugs)
Version: 3.7.9
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
: 2457 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-04-05 23:17 CEST by Michael Schwendt
Modified: 2012-08-16 14:53 CEST (History)
1 user (show)

See Also:


Attachments
drop the gtk_window_iconify call that is the culprit (386 bytes, patch)
2011-04-05 23:17 CEST, Michael Schwendt
no flags Details | Diff
debug patch 1 (940 bytes, patch)
2011-06-18 01:38 CEST, Michael Schwendt
no flags Details | Diff
debug patch 2 (2.30 KB, patch)
2011-06-18 11:44 CEST, Michael Schwendt
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Schwendt 2011-04-05 23:17:08 CEST
Created attachment 960 [details]
drop the gtk_window_iconify call that is the culprit

Quoting a thread from 2010-12-06 20:38:
|
| Claws Mail starts minimized (or hidden?) with Gnome Shell.
| It's the only app that does it. Should I contact the devs of CM?
|
http://forums.debian.net/viewtopic.php?f=6&t=54011&start=15#p335950

Apparently this has not been reported to you. Or perhaps it is a bug in GNOME Shell? It also affects Fedora 15 development with GNOME Shell and Claws Mail 3.7.8cvs68: https://bugzilla.redhat.com/693846

Attached patch just drops the gtk_window_iconify() call that is the culprit, and that fixes the issue. I haven't done any deep digging to examine what is going on.
Comment 1 Paul 2011-04-06 07:29:54 CEST
(If I remember correctly) This is done so that the TrayIcon plugin's 'Hide at start-up' option works in a more agreeable manner.

On slow systems this may mean that there is a very (very) short amount of time before the claws-mail main window is shown, (< 1 second).

I don't really see what problem this causes, and it is not a bug. This is surely better than a splash screen.

Try using the TrayIcon's 'Hide at start-up' with your patch and then decide which behaviour is less desirable.
Comment 2 Colin Leroy 2011-04-06 08:42:19 CEST
I'll add that if Gnome Shell honors the gtk_window_iconify() request, but not the gtk_window_deiconify() request that comes after, it's a Gnome Shell problem unless I deeply misunderstood the role of window managers.
Comment 3 Michael Schwendt 2011-04-06 10:32:13 CEST
Indeed, thanks for the insight. That's what I meant with "not done any deep digging". ;)

The deiconify() call is done here actually (just to confirm that), but doesn't raise the window. I've poked the "Mutter" (2.91.93) maintainers at Fedora.


> Try using the TrayIcon's 'Hide at start-up' with your patch and then
> decide which behaviour is less desirable.

Certainly the one with the patch, because this is GNOME Shell - so much is different. Currently, there is no startup notification or anything like that when starting Claws Mail with a simple click on its app icon. Only those users, who visit the "Windows" view (e.g. with Alt+TAB) would find/see the active albeit minimized Claws Mail window and would need to raise it explicitly. That would be very confusing.

The tray icon plugin is not loaded by default. If loaded and configured for "Hide at startup", the patched Claws Mail appears briefly before it minimizes again. Acceptable as a work-around IMO.

Anyway, I'm not asking you to apply the patch. I just want to learn what's broken where and what will need to be changed.
Comment 4 Colin Leroy 2011-04-06 10:51:51 CEST
Hi Michael,

Thanks ! Keep us informed about what the Shell guys think about that. (I love that we deiconify our main window once everything's ready, it has the advantage of looking nicer, and this is especially visible on slow machines or slow ssh -X, and I'd hate to have to remove it).
Comment 5 Michael Schwendt 2011-04-06 11:07:01 CEST
As an alternative to dropping the iconify call, the following also works in mainwindow.c main_window_popup():

		gtk_window_deiconify(GTK_WINDOW(mainwin->window));
+		gtkut_window_popup(mainwin->window);
Comment 6 Colin Leroy 2011-04-06 20:57:16 CEST
Thanks, I've tried it with xfwm4 and it works fine. Maybe it can be commited if it also works with Metacity and KDE's WM ?

But, let's wait for Gnome Shell's people response first.
Comment 7 users 2011-04-10 10:07:35 CEST
Changes related to this bug have been committed.
Please check latest CVS and update the bug accordingly.
You can also get the patch from:
http://www.colino.net/claws-mail/

2011-04-10 [colin]	3.7.9cvs3

	* src/addr_compl.c
	* src/addressbook.c
	* src/browseldap.c
	* src/compose.c
	* src/folder.c
	* src/folderview.c
	* src/gtk/gtkvscrollbutton.c
	* src/gtk/gtkvscrollbutton.h
		s/GtkFunction/GSourceFunc

2011-04-10 [colin]	3.7.9cvs2

	* src/mainwindow.c
		Use gtkut_window_popup() to work around a bug in Gnome Shell.
		This is the patch from bug #2396, it should be innocuous even
		if that's useless to do deiconify + present window...
Comment 8 Michael Schwendt 2011-06-08 18:29:31 CEST
The patch causes damage. It just seems to work. In GNOME Shell, several of Claws Mail's dialogs don't receive focus due to this patch.
Comment 9 Michael Schwendt 2011-06-08 18:38:13 CEST
Calling
        gtk_widget_show(GTK_WINDOW(mainwin->window));
instead of
	gtkut_window_popup(mainwin->window);
makes the main window appear without affecting the dialogs.
Comment 10 Michael Schwendt 2011-06-08 18:44:13 CEST
Hmm, not really... :/
Comment 11 Michael Schwendt 2011-06-18 01:38:23 CEST
Created attachment 990 [details]
debug patch 1

I've been trying to find out how close together I can move the iconify() and deiconify() calls to prevent the main window from disappearing. Something in Claws Mail between the two calls triggers this bug's symptoms. The "debug patch 1" is the most minimal change to Claws Mail I've arrived at. With it, Claws Mail starts with a visible main window.

[ The further down I move the deiconify() call, the more I need to patch Claws Mail in various files. For example, if I move it down two lines further, I need to patch summaryview.c summary_init() and take out the gtk_widget_modify_font() and summary_clear_list() calls, and also patch textview.c and take out the gdk_cursor_new(GDK_WATCH) call. ]

Is everything okay with the GtkCMCTree implementation?
Comment 12 Michael Schwendt 2011-06-18 11:44:37 CEST
Created attachment 991 [details]
debug patch 2

If the deiconify() is not inserted directly after folderview_init() as in debug patch 1, but two lines further down after summary_init() and messageview_init(), a few more things need to be taken out to prevent the main window from starting minimized.
It seems some of the things taken out corrupt GTK structures.
Comment 14 Colin Leroy 2011-08-31 19:41:19 CEST
(Reverted 3.7.9cvs2 at 3.7.9cvs27)
Comment 15 ppr 2011-09-16 02:02:32 CEST
I have the same bug in archlinux.

Is it solve or gonna be solve soon ?
Comment 16 Michael Schwendt 2011-09-16 13:09:00 CEST
@ pierre.willaime@gmail.com

Notice beginning of comment 13 of this bug report. If you need a work-around (under consideration of everything that has been commented on before in related tickets), here's a brute-force one:
http://pkgs.fedoraproject.org/gitweb/?p=claws-mail.git;a=blob_plain;f=claws-gnome-shell-dont-start-minimized.patch;hb=HEAD
Comment 17 ppr 2011-09-16 14:57:42 CEST
thanks for the response.

But if there is a patch to fix this issue, why the status of this bug is RESOLVED INVALID ? This problem will be fix or not in the next release of claws-mail ?
Comment 18 Michael Schwendt 2011-09-16 20:19:38 CEST
If you had actually read comment 3, you would know that it is a bug in GNOME Shell's window manager. The work-around (!) I have pointed you at is not a fix, just a work-around that removes a feature from Claws Mail. A feature that may be important to some users (e.g. those who use the tray icon and want Claws Mail to start minimized).
Comment 19 Colin Leroy 2011-10-27 01:06:42 CEST
Hi Michael,

Do you know whether a fix has reached Gnome Shell ?
Comment 20 Michael Schwendt 2011-10-28 12:18:11 CEST
Upstream ticket hasn't changed yet:
https://bugzilla.gnome.org/show_bug.cgi?id=653061

To test, I would need to rebuild Claws Mail without the work-around sometime this weekend for Fedora 16. Will report the results.
Comment 21 Michael Schwendt 2011-10-28 12:30:34 CEST
Submitted a quick scratch-build ( http://koji.fedoraproject.org/koji/taskinfo?taskID=3468002 ) and it still starts minimized with:

$ rpm -q gnome-shell mutter gtk3 claws-mail
gnome-shell-3.2.1-1.fc16.x86_64
mutter-3.2.1-1.fc16.x86_64
gtk3-3.2.1-1.fc16.x86_64
claws-mail-3.7.10-5.fc16.test1.x86_64
Comment 22 Colin Leroy 2011-10-28 19:10:08 CEST
Thanks Michael !
Comment 23 Colin Leroy 2011-10-29 01:51:11 CEST
Hi,

I've put back something in CVS, gtk_window_present() after the deiconification and a fix for alertpanels too. It seems to work OK...
Comment 24 Michael Schwendt 2011-11-01 13:36:33 CET
> It seems to work OK...

Confirmed.
Comment 25 Colin Leroy 2011-11-01 13:46:36 CET
Can you reproduce weirdness like you had in comment #8 ? For me it seemed to go rather OK, with occasional strangenesses.
Comment 26 Michael Schwendt 2011-11-01 14:49:27 CET
No focus issues noticed. The original ticket for that https://bugzilla.redhat.com/711257
Comment 27 Colin Leroy 2012-08-16 14:53:46 CEST
*** Bug 2457 has been marked as a duplicate of this bug. ***