GTK+ / Gnome Application Development | |||
---|---|---|---|
<<< Previous | Home | Next >>> |
Really polished application windows behave well on small screens, and set hints so the window manager can keep track of them.
The functions in Figure 12 allow you to query the size of the screen in pixels. You can use this information to adjust the layout of your application window; for example, if you know your usual application window is too large for a 640 by 480 display, you could provide an alternative widget layout for small screens. Applications that automatically adapt to the screen size are very impressive.
Of course, you should leave control in the hands of the user; users with large screens might want the small version of your application anyway, and you should always try to respond sensibly if the user resizes the window. Use the screen size to select the best default from among your application's possible configurations.
The "class hint" is a property of GtkWindow window managers can read to decide how to treat the window. Most window managers allow you to set icons and other properties based on the class hint. Two elements make up the hint. The wmclass_name field should be unique for each kind of toplevel window in an application (such as the main window or a tools dialog). The wmclass_class field is conventionally set to the name of the application, capitalized. For example: xterm windows set these properties to xterm (name) and XTerm (class). The GIMP toolbox sets its name to toolbox and its class to Gimp. The gtk_window_set_wmclass() function sets these hints for GtkWindow.