Re: fullscreen window-manager troubles



Ronald Bultje <rbultje ronald bitfreak net> writes:
> 
> I'm having weird troubles with trying to run my application full-screen.
> To switch to full-screen, I thought I'd just use
> gtk_widget_set_usize(window, gdk_screen_width(), gdk_screen_height() );
> and gtk_widget_set_uposition(window, 0, 0);. This works in, for example,
> blackbox, but in sawfish, I still see the title bar of the application's
> window at the top and also the border of the GtkWindow at the left. It
> seems like all these window managers are behaving differently.

Blackbox is doing the wrong thing - if you set the position to 0, 0,
then that should be the position of the top-left of the window frame,
not of the window itself, if your window has NorthWest gravity which
is the default. If you set StaticGravity or the window has no frame,
then you are positioning the window itself. 

Read the docs for gtk_window_move(), gtk_window_get_position(),
gtk_window_resize(), gtk_window_set_gravity(), etc. in the GTK 2.0 API
docs:

 http://developer.gnome.org/doc/API/2.0/gtk/gtkwindow.html

Note that many window managers were recently fixed to behave correctly
in the case where you move a window after mapping it.

> Secondly, connected to this, when trying to go back to non-fullscreen, I
> use (before going fullscreen) gdk_window_get_size(window->window, &w,
> &h); and gdk_window_get_origin(window->window, &x, &y); to save the old
> values and then gtk_widget_set_{usize|uposition}() again to go back to
> the old state, but here too, the window moves a bit to the right and
> down, as if the first functions (gdk_window_get_{size|origin}() )
> retrieve the position of the window without decorations while
> gtk_widget_set_{usize|uposition}() place the window including
> decorations.

Yes, that's an accurate description of the problem.

> I tried using gdk_window_set_decoration(window->window, 0), but that
> doesn't seem to help either since sawfish cannot seem to remove these
> window decorations while the widget is already being shown...

This will be window-manager-dependent.
 
> Does gtk, or gnome or X, have a better way to switch to fullscreen mode
> and/or to get/set the position of a window?

I think the mechanisms for getting/setting the position/size of a
window are adequate, but somewhat hard to figure out using the GTK 1.2
API. GTK 2.0 helps here, we added all the new functions and docs I
mentioned.

For going fullscreen, this really needs to be a feature supported in
the window manager; so for the future, we are adding
_NET_WM_STATE_FULLSCREEN alongside _NET_WM_STATE_MAXIMIZED, etc. to
the WM spec 
(see http://www.freedesktop.org/standards/wm-spec.html).
However, this isn't in there yet.

Havoc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]