Re: Win32 modal support
| From: | Jeff Beidler | Date: | Tue, 30 Aug 2005 03:48:46 +0000 |
| Subject: | Re: Win32 modal support | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-6185@lists.php.net to get a copy of this message | ||
Thanks for the work, Tom. :)
If I'm not mistaken, though, this won't work until PHP-GTK2 is released,
right? Thought I read that PHP-GTK only works with GTK 1.x. I hope
PHP-GTK2 comes out soon! It looks awesome.
"Tom Rogers" <trogers@kwikin.com> wrote in message
news:1715736296.20050828164104@kwikin.com...
> Hi,
>
> Saturday, August 27, 2005, 5:09:50 AM, you wrote:
>
> JB> Hello,
>
> JB> Does anyone know of a workaround for set_modal() and
> set_transient_for() not
> JB> working on Windows platforms?
>
> JB> Thanks,
>
> JB> Jeff
>
> I have modified gdk to make this work under windows using gtk2.4 as a
> base. If you are compiling your own gtk replace the function:
>
> gdk_window_set_transient_for() in ...\gtk\gdk\win32\gdkwindow-win32.c
>
> (which currently does nothing) with this:
>
> gdk_window_set_transient_for (GdkWindow *window,
> GdkWindow *parent)
> {
> HWND window_id, parent_id;
> LONG style;
>
> g_return_if_fail (window != NULL);
> g_return_if_fail (GDK_IS_WINDOW (window));
>
> GDK_NOTE (MISC, g_print ("gdk_window_set_transient_for: %p %p\n",
> GDK_DRAWABLE_XID (window),
> GDK_DRAWABLE_XID (parent)));
>
> window_id = GDK_DRAWABLE_XID (window);
> parent_id = GDK_DRAWABLE_XID (parent);
>
> if ((style = GetWindowLong (window_id, GWL_STYLE)) == 0)
> WIN32_API_FAILED ("GetWindowLong");
>
> style |= WS_CHILD;
>
> if (!SetWindowLong (window_id, GWL_STYLE, style))
> WIN32_API_FAILED ("SetWindowLong");
> if (!SetParent (window_id, parent_id))
> WIN32_API_FAILED ("SetParent");
>
> if (!RedrawWindow (window_id, NULL, NULL,
> RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW))
> WIN32_API_FAILED ("RedrawWindow");
> }
>
> If you need a precompiled dll you can download it from:
>
> http://kwiktemplates.com/gtk.zip
>
> If you don't want the parent to be active you will need to combine
> set_transient_for() with set_modal().
> It also behaves in that it does not create a new icon on the taskbar
> and will minimize if the main window minimizes.
>
> The only thing to watch for is if you kill the parent while the dialog
> is showing you will get a gdk error message. This won't happen if you
> use set_modal(TRUE) of course.
> --
> regards,
> Tom