GNOME Bugzilla – Bug 602946
[GtkDrawingArea] fullscreen fails when GDK_NATIVE_WINDOWS is set
Last modified: 2012-01-02 10:59:29 UTC
#include <gtk/gtk.h> * Steps to reproduce: -> on win32, with gtk 2.18.3-1 (18 oct 09) got from here: http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.18/ When using: set GDK_NATIVE_WINDOWS=1 the following code shows that the fullscreen fails. It seems that the drawing area is not resized. (it works fine when GDK_NATIVE_WINDOWS is not set) I really need to set GDK_NATIVE_WINDOWS because I need to retrieve the native handle of the drawing area. And this is just a minimal example, so in a real case, there is several drawing areas in one window. --------------------------------------------------- #include <gdk/gdk.h> int main(gint argc, gchar *argv[]) { GtkWidget* window = NULL; GtkWidget* area = NULL; GdkColor color; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_fullscreen GTK_WINDOW (window); area = gtk_drawing_area_new(); gdk_color_parse("GREEN", &color); gtk_widget_modify_bg(area, GTK_STATE_NORMAL, &color); gtk_container_add (GTK_CONTAINER (window), area); gtk_widget_show_all (window); gtk_main(); return 0; } --------------------------------------------------- * other infos: the use of a color and background is just to demonstrate that the drawing area is not resized when going to full screen
GDK_NATIVE_WINDOWS makes *all* windows native. Thats not necessary to get the native handle of a single window. Just call gdk_window_ensure_native to make that window native. (On X11 the gdk_window_get_xid calls even do this automatically). I'm not sure how well this works on win32 atm, but if its broken it should be fixed.
I tried to just call gdk_window_ensure_native in the drawing area. (and not set the global var GDK_NATIVE_WINDOWS) But it's worst because even without fullscreen the drawing area has a wrong size. #include <gtk/gtk.h> static void realize_cb(GtkWidget* area, gpointer data) { gdk_window_ensure_native(area->window); } int main(gint argc, gchar *argv[]) { GtkWidget* window = NULL; GtkWidget* area = NULL; GdkColor color; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_fullscreen GTK_WINDOW (window); area = gtk_drawing_area_new(); g_signal_connect(G_OBJECT(area), "realize", G_CALLBACK(realize_cb), NULL); gdk_color_parse("GREEN", &color); gtk_widget_modify_bg(area, GTK_STATE_NORMAL, &color); gtk_container_add (GTK_CONTAINER (window), area); gtk_widget_show_all (window); gtk_main(); return 0; }
clearly the win32 parts of client side window support needs some work.
Same result with gtk+_2.18.5-1
Bug always present in 2.20
ping ?
(In reply to comment #6) > ping ? GTK+ has recently received a huge amount of win32 specific fixes (which are not going to be backported to older versions), so please try again with GTK+ 2.24.8 (using gdk_window_ensure_native() as suggested in comment #1). Thanks!
(In reply to comment #7) > (using gdk_window_ensure_native() as suggested in > comment #1). Thanks! Hi, I already did it in comment #2. Anyway, I tested with GTK+ 2.24.8 and I cannot reproduce the problem. So it seems the bug has been solved. Great !