Re: Going fullscreen and back
- From: "Jim George" <jimgeorge gmail com>
- To: "Carlos Pereira" <jose carlos pereira ist utl pt>
- Cc: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: Going fullscreen and back
- Date: Sun, 27 Apr 2008 11:55:59 -0600
Why not use gtk_window_fullscreen? I've only tried it on a Gnome
desktop, it works well.
On Sun, Apr 27, 2008 at 11:37 AM, Carlos Pereira
<jose carlos pereira ist utl pt> wrote:
Hi there,
The small working code below shows
how my app goes fullscreen and back.
1) Is there a better way of doing this?
2) This code works fine in Enlightenment,
KDE, BlackBox, IceWM, etc. In Gnome and XFCE
it works, but the desktop bars are still visible
(I suppose it should be possible to change this?).
However, in GNOME and only in GNOME, I have to
subtract 1 pixel, on width or height, for this to work.
In other words, if I replace this:
gdk_window_move_resize (window->window,
0, 0, gdk_screen_width (), gdk_screen_height () - 1);
by this:
gdk_window_move_resize (window->window,
0, 0, gdk_screen_width (), gdk_screen_height ());
poor Gnome WM gets confused, indeed goes fullscreen,
but does not come back... :-(
What is the best way to handle this?
going fullscreen is a very useful feature
in many scientific/engineering apps.
Many thanks,
Carlos
*** working code: going fullscreen and back ***
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
int x, y, w, h;
int press_event (GtkWidget *widget, GdkEventKey *event, GtkWidget *window)
{
static int fullscreen = FALSE;
switch (event->keyval)
{
case GDK_Escape:
if (fullscreen == FALSE)
{
gtk_window_get_position (GTK_WINDOW (window), &x, &y);
gtk_window_get_size (GTK_WINDOW (window), &w, &h);
gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
gdk_window_raise (window->window);
gdk_window_move_resize (window->window,
0, 0, gdk_screen_width (), gdk_screen_height () - 1);
fullscreen = TRUE;
}
else
{
gtk_window_set_decorated (GTK_WINDOW (window), TRUE);
gdk_window_move_resize (window->window, x, y, w, h);
fullscreen = FALSE;
}
}
return FALSE;
}
int main (int argc, char **argv)
{
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (window, 200, 200);
g_signal_connect_after (G_OBJECT (window),
"key_press_event", G_CALLBACK (press_event), window);
gtk_widget_show (window);
gtk_main ();
return 0;
}
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]