After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 602946 - [GtkDrawingArea] fullscreen fails when GDK_NATIVE_WINDOWS is set
[GtkDrawingArea] fullscreen fails when GDK_NATIVE_WINDOWS is set
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Backend: Win32
2.20.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
csw
Depends on:
Blocks:
 
 
Reported: 2009-11-25 15:02 UTC by Julien Isorce
Modified: 2012-01-02 10:59 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Julien Isorce 2009-11-25 15:02:37 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
Comment 1 Alexander Larsson 2009-11-30 17:23:01 UTC
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.
Comment 2 Julien Isorce 2009-12-02 10:14:57 UTC
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;
}
Comment 3 Alexander Larsson 2009-12-03 09:25:54 UTC
clearly the win32 parts of client side window support needs some work.
Comment 4 Julien Isorce 2009-12-21 16:17:20 UTC
Same result with gtk+_2.18.5-1
Comment 5 Olivier Aubert 2010-06-11 14:04:30 UTC
Bug always present in 2.20
Comment 6 Julien Isorce 2011-12-23 10:44:47 UTC
ping ?
Comment 7 Dieter Verfaillie 2011-12-27 09:03:09 UTC
(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!
Comment 8 Julien Isorce 2012-01-02 10:59:29 UTC
(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 !