Re: Maximize a window?
- From: Chris Wareham <chris wareham catchword com>
- To: Gtk-list <gtk-list gnome org>
- Cc: Ottavio Campana <bott iol it>
- Subject: Re: Maximize a window?
- Date: Fri, 29 Sep 2000 10:02:57 +0100
Ottavio Campana wrote:
>
> How can I expand a window to cover the whole screen?
>
I couldn't find a GTK+ native way of determining the screen
size, so unless someone else knows better here's how I would
do it. Basically, I use raw Xlib calls to get the size of
the default screen, and later on I set the size of the
toplevel GTK+ widget with gtk_widget_set_usize().
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
int main(int argc, char *argv[]) {
Display *display;
int def_screen;
char *display_name = NULL, *progname;
unsigned int width, height;
progname = argv[0];
if(!(display = XOpenDisplay(display_name))) {
fprintf(stderr, "%s: cannot connect to X server %s\n",
progname, XDisplayName(display_name));
return 1;
}
def_screen = DefaultScreen(display);
width = DisplayWidth(display, def_screen);
height = DisplayHeight(display, def_screen);
printf("width : %u\nheight : %u\n", width, height);
XCloseDisplay(display);
/* intitialise GTK+ and create toplevel window */
...
gtk_widget_set_usize(toplevel, width, height);
...
return 0;
}
--
lukewarm juices with no excuses
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]