Results 1 to 2 of 2
Howdy all. I have a question about using Gtk+.
I'm writing a program that needs to display an image. My approach was to either set the window size to the ...
- 05-13-2007 #1
Gtk+ Max Window Size
Howdy all. I have a question about using Gtk+.
I'm writing a program that needs to display an image. My approach was to either set the window size to the resolution of the image (which I have successfully obtained), or if this is too big, then set it to the max size that it can be (that is, maximize it), and then let the scroll pane take over.
To do this, I need to figure out the max size of a window. I've tried this code, but it returns 200x200, not the max size:
Does anyone know how to actually find the maximum size? If not, how can I find the resolution of the screen? I could hack together a solution using that, if necessary.Code:static void determine_max_vals(void) { GtkWidget *window; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_maximize(GTK_WINDOW(window)); gtk_window_get_size(GTK_WINDOW(window), &max_window_width, &max_window_height); printf("Max Width: %d\nMax Height: %d\n", max_window_width, max_window_height); }DISTRO=Arch
Registered Linux User #388732
- 05-15-2007 #2Just Joined!
- Join Date
- Feb 2007
- Location
- Elkesley, Nottinghamshire, UK
- Posts
- 3
That should get the resolution of the screen you window is currently on, if that helps.Code:GdkScreen* screen = NULL; screen = gtk_window_get_screen(GTK_WINDOW(window)); width = gdk_screen_get_width(screen); height = gdk_screen_get_height(screen); printf("Screen resolution is (%d x %d)\n", width, height);


Reply With Quote