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 449892 - Excessive state changes when fullscreening before showing a window
Excessive state changes when fullscreening before showing a window
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 376149
 
 
Reported: 2007-06-21 22:20 UTC by Bastien Nocera
Modified: 2018-02-10 03:24 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Bastien Nocera 2007-06-21 22:20:41 UTC
The attached test fullscreens a window before showing it. It will receive 3 state changes instead of one, and this is a problem when trying to setup a fullscreen window from the application start, as it will cause flickering in the display.

$ gcc -Wall -g -o test test.c `pkg-config --libs --cflags gtk+-2.0`
$ ./test # Wait 5 seconds
** Message: it says we are fullscreen now
** Message: it says we're not fullscreen now
** Message: it says we are fullscreen now

test.c inline:
---8<---
#include <gtk/gtk.h>
#include <stdlib.h>

static gboolean
window_state_event_cb (GtkWidget *window, GdkEventWindowState *event,
                       gpointer user_data)
{
        if ((event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) == 0)
                return FALSE;

        if (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) {
                g_message ("it says we are fullscreen now");
        } else {
                g_message ("it says we're not fullscreen now");
        }

        return FALSE;
}

int main (int argc, char **argv)
{
        GtkWidget *window;

        gtk_init (&argc, &argv);

        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        g_signal_connect (G_OBJECT (window), "window-state-event",
                          G_CALLBACK (window_state_event_cb), NULL);

        gtk_window_fullscreen (GTK_WINDOW(window));

        gtk_widget_show (window);

        g_timeout_add (5000, exit, NULL);

        gtk_main ();

        return 0;
}
---8<---
Comment 1 Christian Persch 2007-06-21 22:55:51 UTC
There's an additional problem here: if you listen to configure-event, you get a configure event after the unfullscreen state event (the sequence is: state=fs, state=!fs, configure, state=fs), but with the size being the full screen size! That's a problem when you want to persist the window size whenever it's changed, except in fullscreen mode. (I just ran into this problem in another programme of mine.)
Comment 2 Miguel Gomez 2008-04-24 17:09:14 UTC
Hi!

A bit strange beaviour here. Those fs, !fs, fs events you comment have changed now. Curiously, now you can't fullscreen a window before it's shown. The result is the window beeing non fullscreen.

You get an fs event, then a !fs, but there's no fs event again so the window keeps unfullscreen (trying with cvs over X).

It seems that once the fs event has been generated, the window manager creates a new fs event, (do_net_wm_state_changes  in gdkevents-x11.c) that finally sets the window to !fs.

Is this the right behaviour? Should the window be set in fs mode only once it has been shown?

Cheers!

Comment 3 Matthias Clasen 2018-02-10 03:24:57 UTC
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and
still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue
for it.