Summary: | Embedding external editor through GtkSocket | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Claws Mail (GTK 2) | Reporter: | David Schneider <dnschneid> | ||||||||
Component: | UI/Compose Window | Assignee: | users | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | enhancement | CC: | flammie, kae, marcel | ||||||||
Priority: | P3 | ||||||||||
Version: | 3.8.0 | ||||||||||
Hardware: | PC | ||||||||||
OS: | Linux | ||||||||||
Attachments: |
|
Description
David Schneider
2011-01-26 00:58:12 UTC
I don't think this would be pretty awesome. Rather it would be totally awesome and would be yet another way in which claws is set apart from other email clients. Created attachment 1056 [details]
Implementation of the GtkSocket feature
Found time to code it! It didn't take very long.
Feedback welcome/requested.
This patch works great. You can't send, send later or save the message as a draft until you quit the embedded editor. That's the same behavior as the old way, it just feels less intuitive since the editor is embedded. That's no show-stopper, just an interesting side effect of the new functionality. Using the external editor shortcut to bounce out of the editor and back up into the header pane makes using an external editor more preferable to the native editor in an entirely different way as well. You don't have to touch the mouse to add or remove recipients from the mail. I hope this patch gets included. As discussed on IRC, I'll improve the patch to allow send/send later/save without having to manually close the editor, and investigate auto-saving of drafts (by monitoring the temporary file, if that's not already being done). After that, it sounds like the feature will be added within the next version or two. Feel free to email me off-list if you want help testing. Created attachment 1076 [details]
WIP: Graceful quitting of the socketted editors
WIP patch of graceful quitting of socketted editors. Must be applied on top of patch 1056.
With this, send, send later, save draft, and close act more like the built-in editor.
This is not ideal, however. Since we cannot tell the difference between the user taking time to respond "save" to a save as dialog versus the user outright canceling it, we wait for 5 seconds for the app to quit before deciding that the user canceled the action.
Also, for certain IO events to fire we empty the GTK main loop, which is an ugly (and potentially dangerous) hack. We hide the editor vbox to avoid extra redraws in that instance. Ideally, we trigger the correct events ourselves so that we don't have to iterate the main loop.
If you have any ideas/suggestions on how to fix the above issues (or other suggestions in general), please comment.
Comment on attachment 1076 [details]
WIP: Graceful quitting of the socketted editors
The WIP patch apparently messes up the compose window sizes in clawsrc, causing the compose vbox to not appear even on vanilla installs, and a critical "(claws-mail:25000): Gtk-CRITICAL **: IA__gtk_widget_event: assertion
`WIDGET_REALIZED_FOR_EVENT (widget, event)' failed" when you try to tab into it.
GtkSocket might disappear on wayland [1]. So maybe it's worth considering another approach for the long term, or get in touch with wayland/gtk folk to sort that out. [1] http://lists.freedesktop.org/archives/wayland-devel/2012-February/002030.html Indeed, although Xfce has *way* more at stake there than we do. Regardless, people won't be ditching X anytime soon, and XEmbed (what GtkSocket uses) is far more elegant than the alternatives right now. This is pretty neat. I just applied it to 3.9.2, cleanly, and it works as advertised. Any plans to get this into mainline? Keith Applied the patch and tried it. Definitely following this with interest. My editor of choice is emacs and I've played around with embedding it trhough the use of emacsclient --parent-id %w %s Screenshot is here: http://media.mrblog.nl/u/mrb/m/embed-emacs-in-claws/ It works, but this will be hard to get right I think. Embedding a fully configurable editor inside a very flexible mail composer in an unknown environment will no doubt lead to some subtle bugs. Nevertheless, this made my evening! Thanks! Glad to see the patch still applies cleanly, and that there's still interest. I haven't really looked into fixing the bugs in the second patch, which is a bit more invasive but necessary for a more intuitive experience. The issues I raised in comment 6 also need to be addressed. I'm not sure when I'll get to looking at this again, so if someone has the inclination to figure out the bug in the second patch, please go for it. In the meantime, it might be worth merging in the first patch, as it is at least strictly better than the current external editor behavior. Biggest problem I've found so far is that it's possible to send the mail before exiting the editor. I'm in the habit of ending the mail with control-enter, which - if using this patch - results in sending an empty mail and losing the text entered. I think certain Claws compose functions (such as "send") need to be disabled while the edit window exists. Created attachment 1451 [details]
Updated patch for Claws-Mail 3.11.1
Updated patch that applies on top of Claws-Mail 3.11.1.
Changes related to this bug have been committed. Please check latest Git and update the bug accordingly. You can also get the patch from: http://git.claws-mail.org/ ++ ChangeLog 2015-11-23 20:09:02.743905997 +0100 http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=85d27f304bb25f6c4f23564ced190649be259b90 Merge: 6b85605 8b99c24 Author: Colin Leroy <colin@colino.net> Date: Mon Nov 23 20:09:02 2015 +0100 Merge branch 'master' of file:///home/git/claws http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=8b99c246a19ac9281964d810c2f280b2ee799bfc Author: Ricardo Mones <ricardo@mones.org> Date: Mon Nov 23 20:07:24 2015 +0100 Fix bug #2355: Embedding external editor through GtkSocket Original patch by David Schneider, updated by Darko Koruga, Also added emacs command as suggested by Marcel van der Boom. Many thanks to all of them! :-) After almost 5 years in the making...thanks for taking the patch to the finish line! Next would be to see if anyone can fix the issues with the WIP patch to make the experience cleaner... This still suffers from the problem that the mail can be sent with the external editor open. I'm using gvim, and if I type control-enter, Claws sends the mail as it was before the external editor was invoked. We need to disable sending while the editor is active. Not sure that my limited knowledge of GTK programming will be able to help much here. Changes related to this bug have been committed. Please check latest Git and update the bug accordingly. You can also get the patch from: http://git.claws-mail.org/ ++ ChangeLog 2015-11-24 10:32:02.424374990 +0100 http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=8f3343f35346e6a767124382df1226d9efcd91c8 Merge: 4deafd5 a5bd5e1 Author: Colin Leroy <colin@colino.net> Date: Tue Nov 24 10:32:01 2015 +0100 Merge branch 'master' of file:///home/git/claws http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=a5bd5e1504fb941d63ee2f1532c0b469ed651989 Author: Ricardo Mones <ricardo@mones.org> Date: Tue Nov 24 10:26:18 2015 +0100 Bug #2355: don't send while external editor is open |