Getting the GdkWindow in which a verb was invoked
Hi again,
I'm currently working on a patch to add support for native file dialogs for windows users. It's worked out pretty well, and I'm almost finished. I have one slight problem though: parent windows.
In the GTK version, sp_file_open_dialog (in file.cpp) is called from inside FileVerb::Perform in verbs.cpp. But how is it possible to get the GdkWindow object of the windows in which the verb was invoked? If I have this I can add it as an extra parameter to sp_file_open_dialog, to enable both the GTK, and Win32 file dialogs to be correctly set as child windows of the document's window.
Any suggestions?
Joel Holdsworth
Joel Holdsworth wrote:
Hi again,
I'm currently working on a patch to add support for native file dialogs for windows users. It's worked out pretty well, and I'm almost finished. I have one slight problem though: parent windows.
In the GTK version, sp_file_open_dialog (in file.cpp) is called from inside FileVerb::Perform in verbs.cpp. But how is it possible to get the GdkWindow object of the windows in which the verb was invoked? If I have this I can add it as an extra parameter to sp_file_open_dialog, to enable both the GTK, and Win32 file dialogs to be correctly set as child windows of the document's window.
Any suggestions?
Joel Holdsworth
You might look at src/dialogs/filedialog-win32.cpp as an example. It was the original native dialog that we replaced with the current one.
bob
On 6/26/07, Joel Holdsworth <joel@...1709...> wrote:
I'm currently working on a patch to add support for native file dialogs for windows users. It's worked out pretty well, and I'm almost finished.
Hmm, does it mean there will be no filesystem bookmarks in Windows? What about the preview?
In the GTK version, sp_file_open_dialog (in file.cpp) is called from inside FileVerb::Perform in verbs.cpp. But how is it possible to get the GdkWindow object of the windows in which the verb was invoked?
You can do SP_ACTIVE_DESKTOP, then use getToplevel to get GTK window, and then use ->window to get from GTK to GDK (untested!)
Yes, I have to say I hadn't noticed the bookmarks, but I had noticed the preview.
I think there are several things to weigh up here. My overriding concern is that the file dialogs are useable for windows users. The current GTK file dialog really doesn't pass the my-mum-could-use-it test, it just looks out of place (not looking consistent with other Win32 apps) and confusing (not working in the same way as other Win32 apps). For this reason I (a Windows user) would be willing to sacrifice both those features, even though they're really good, because I think the usability cost is too high.
In the future I don't know if it'll be possible to write an Explorer thumbnail extension to allow XP and Vista users to have the preview functionality back. Furthermore, Vista file dialogs have support for a preview pane so long as there is an explorer thumbnail extension present. All this depends on whether it's easy or hard to render an SVG to an arbitrry buffer in a fast lightweight way.
The second reason I want to replace the file dialog for Windows is the parenting - the topic of this thread. I was planning to kill two birds with one stone. It must *never* be possible to hide the file dialog behind the document. In Windows at least, this is a huge gaffe.
----- Original Message ----- From: "bulia byak" <buliabyak@...400...> To: "Joel Holdsworth" <joel@...1709...> Cc: inkscape-devel@lists.sourceforge.net Sent: Tuesday, June 26, 2007 5:07 PM Subject: Re: [Inkscape-devel] Getting the GdkWindow in which a verb was invoked
On 6/26/07, Joel Holdsworth <joel@...1709...> wrote:
I'm currently working on a patch to add support for native file dialogs for windows users. It's worked out pretty well, and I'm almost finished.
Hmm, does it mean there will be no filesystem bookmarks in Windows? What about the preview?
In the GTK version, sp_file_open_dialog (in file.cpp) is called from inside FileVerb::Perform in verbs.cpp. But how is it possible to get the GdkWindow object of the windows in which the verb was invoked?
You can do SP_ACTIVE_DESKTOP, then use getToplevel to get GTK window, and then use ->window to get from GTK to GDK (untested!)
-- bulia byak Inkscape. Draw Freely. http://www.inkscape.org
On 6/26/07, Joel Holdsworth <joel@...1709...> wrote:
working in the same way as other Win32 apps). For this reason I (a Windows user) would be willing to sacrifice both those features, even though they're really good, because I think the usability cost is too high.
Myself, I'm a Linux user and a command line person; I just type "i filename" most of the time when I want to open a file in Inkscape. But when the GTK filedialog got bookmarks, they turned out to be so convenient (even more useful than previews, for me) that I now often use the dialog.
So, I'm not going to vote on this issue, but I would be curious to hear more opinions of Windows Inkscape users.
On 6/26/07, Joel Holdsworth <joel@...1709...> wrote:
The second reason I want to replace the file dialog for Windows is the parenting - the topic of this thread. I was planning to kill two birds with one stone. It must *never* be possible to hide the file dialog behind the document. In Windows at least, this is a huge gaffe.
Certainly it is. But this must be fixed in GTK. It's not a problem specific to filedialogs.
bulia byak specificò:
The second reason I want to replace the file dialog for Windows is the parenting - the topic of this thread. I was planning to kill two birds with one stone. It must *never* be possible to hide the file dialog behind the document. In Windows at least, this is a huge gaffe.
Certainly it is. But this must be fixed in GTK. It's not a problem specific to filedialogs.
... and the GTK+ developers are always very happy if someone can help them to improve the Windows support, even if only compiling and testing. :)
You can always find them on IRC (#gtk+ on GimpNet) or on the mailing lists on gnome.org.
On Tue, 2007-06-26 at 13:07 -0300, bulia byak wrote:
In the GTK version, sp_file_open_dialog (in file.cpp) is called from inside FileVerb::Perform in verbs.cpp. But how is it possible to get the GdkWindow object of the windows in which the verb was invoked?
You can do SP_ACTIVE_DESKTOP, then use getToplevel to get GTK window, and then use ->window to get from GTK to GDK (untested!)
I don't think this is good, I'd like to see SP_ACTIVE_DESKTOP all but removed from the codebase. When the verb is called it is passed the information on the window that called it. That's currently not passed into sp_file_open_dialog, but should be. (infact, very few verbs use it, but they should).
The desktop can be gotten in any verb "perform" function with the following code:
SPDesktop *dt = dynamic_cast<SPDesktop*>(sp_action_get_view(action));
That is, if it is called on a SPDesktop and not another subclass of an action. But I would imagine that FileOpen always is.
--Ted
participants (5)
-
Bob Jamison
-
bulia byak
-
Emanuele Aina
-
Joel Holdsworth
-
Ted Gould