GDK Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
struct GdkWindowAttr { gchar *title; gint event_mask; gint x, y; gint width; gint height; GdkWindowClass wclass; GdkVisual *visual; GdkColormap *colormap; GdkWindowType window_type; GdkCursor *cursor; gchar *wmclass_name; gchar *wmclass_class; gboolean override_redirect; }; |
typedef enum { GDK_WINDOW_ROOT, GDK_WINDOW_TOPLEVEL, GDK_WINDOW_CHILD, GDK_WINDOW_DIALOG, GDK_WINDOW_TEMP, GDK_WINDOW_FOREIGN } GdkWindowType; |
typedef enum { GDK_WA_TITLE = 1 << 1, GDK_WA_X = 1 << 2, GDK_WA_Y = 1 << 3, GDK_WA_CURSOR = 1 << 4, GDK_WA_COLORMAP = 1 << 5, GDK_WA_VISUAL = 1 << 6, GDK_WA_WMCLASS = 1 << 7, GDK_WA_NOREDIR = 1 << 8 } GdkWindowAttributesType; |
typedef enum { GDK_HINT_POS = 1 << 0, GDK_HINT_MIN_SIZE = 1 << 1, GDK_HINT_MAX_SIZE = 1 << 2, GDK_HINT_BASE_SIZE = 1 << 3, GDK_HINT_ASPECT = 1 << 4, GDK_HINT_RESIZE_INC = 1 << 5, GDK_HINT_WIN_GRAVITY = 1 << 6 } GdkWindowHints; |
struct GdkGeometry { gint min_width; gint min_height; gint max_width; gint max_height; gint base_width; gint base_height; gint width_inc; gint height_inc; gdouble min_aspect; gdouble max_aspect; GdkGravity win_gravity; }; |
typedef enum { GDK_GRAVITY_NORTH_WEST = 1, GDK_GRAVITY_NORTH, GDK_GRAVITY_NORTH_EAST, GDK_GRAVITY_WEST, GDK_GRAVITY_CENTER, GDK_GRAVITY_EAST, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_SOUTH, GDK_GRAVITY_SOUTH_EAST, GDK_GRAVITY_STATIC } GdkGravity; |
typedef enum { GDK_WINDOW_EDGE_NORTH_WEST, GDK_WINDOW_EDGE_NORTH, GDK_WINDOW_EDGE_NORTH_EAST, GDK_WINDOW_EDGE_WEST, GDK_WINDOW_EDGE_EAST, GDK_WINDOW_EDGE_SOUTH_WEST, GDK_WINDOW_EDGE_SOUTH, GDK_WINDOW_EDGE_SOUTH_EAST } GdkWindowEdge; |
typedef enum { GDK_WINDOW_TYPE_HINT_NORMAL, GDK_WINDOW_TYPE_HINT_DIALOG, GDK_WINDOW_TYPE_HINT_MENU, GDK_WINDOW_TYPE_HINT_TOOLBAR } GdkWindowTypeHint; |
GdkWindow* gdk_window_new (GdkWindow *parent, GdkWindowAttr *attributes, gint attributes_mask); |
GdkWindowState gdk_window_get_state (GdkWindow *window); |
Gets the bitwise OR of the currently active window state flags, from the GdkWindowState enumeration.
window : | a GdkWindow |
Returns : | window state bitfield |
void gdk_window_move_resize (GdkWindow *window, gint x, gint y, gint width, gint height); |
void gdk_window_scroll (GdkWindow *window, gint dx, gint dy); |
Scroll the contents of its window, both pixels and children, by the given amount. Portions of the window that the scroll operation brings in from offscreen areas are invalidated. The invalidated region may be bigger than what would strictly be necessary. (For X11, a minimum area will be invalidated if the window has no subwindows, or if the edges of the window's parent do not extend beyond the edges of the window. In other cases, a multi-step process is used to scroll the window which may produce temporary visual artifacts and unnecessary invalidations.)
window : | a GdkWindow |
dx : | Amount to scroll in the X direction |
dy : | Amount to scroll in the Y direction |
void gdk_window_reparent (GdkWindow *window, GdkWindow *new_parent, gint x, gint y); |
void gdk_window_clear_area (GdkWindow *window, gint x, gint y, gint width, gint height); |
void gdk_window_clear_area_e (GdkWindow *window, gint x, gint y, gint width, gint height); |
#define gdk_window_copy_area(drawable,gc,x,y,source_drawable,source_x,source_y,width,height) |
void gdk_window_begin_resize_drag (GdkWindow *window, GdkWindowEdge edge, gint button, gint root_x, gint root_y, guint32 timestamp); |
void gdk_window_begin_move_drag (GdkWindow *window, gint button, gint root_x, gint root_y, guint32 timestamp); |
void gdk_window_constrain_size (GdkGeometry *geometry, guint flags, gint width, gint height, gint *new_width, gint *new_height); |
Constrains a desired width and height according to a set of geometry hints (such as minimum and maximum size).
geometry : | a GdkGeometry structure |
flags : | a mask indicating what portions of geometry are set |
width : | desired width of window |
height : | desired height of the window |
new_width : | location to store resulting width |
new_height : | location to store resulting height |
void gdk_window_begin_paint_rect (GdkWindow *window, GdkRectangle *rectangle); |
A convenience wrapper around gdk_window_begin_paint_region() which creates a rectangular region for you. See gdk_window_begin_paint_region() for details.
window : | a GdkWindow |
rectangle : | rectangle you intend to draw to |
void gdk_window_begin_paint_region (GdkWindow *window, GdkRegion *region); |
Indicates that you are beginning the process of redrawing region. A backing store (offscreen buffer) large enough to contain region will be created. The backing store will be initialized with the background color or background pixmap for window. Then, all drawing operations performed on window will be diverted to the backing store. When you call gdk_window_end_paint(), the backing store will be copied to window, making it visible onscreen. Only the part of window contained in region will be modified; that is, drawing operations are clipped to region.
The net result of all this is to remove flicker, because the user sees the finished product appear all at once when you call gdk_window_end_paint(). If you draw to window directly without calling gdk_window_begin_paint_region(), the user may see flicker as individual drawing operations are performed in sequence. The clipping and background-initializing features of gdk_window_begin_paint_region() are conveniences for the programmer, so you can avoid doing that work yourself.
When using GTK+, the widget system automatically places calls to gdk_window_begin_paint_region() and gdk_window_end_paint() around emissions of the expose_event signal. That is, if you're writing an expose event handler, you can assume that the exposed area in GdkEventExpose has already been cleared to the window background, is already set as the clip region, and already has a backing store. Therefore in most cases, application code need not call gdk_window_begin_paint_region(). (You can disable the automatic calls around expose events on a widget-by-widget basis by calling gtk_widget_set_double_buffered().)
If you call this function multiple times before calling the matching gdk_window_end_paint(), the backing stores are pushed onto a stack. gdk_window_end_paint() copies the topmost backing store onscreen, subtracts the topmost region from all other regions in the stack, and pops the stack. All drawing operations affect only the topmost backing store in the stack. One matching call to gdk_window_end_paint() is required for each call to gdk_window_begin_paint_region().
window : | a GdkWindow |
region : | region you intend to draw to |
void gdk_window_end_paint (GdkWindow *window); |
Indicates that the backing store created by the most recent call to gdk_window_begin_paint_region() should be copied onscreen and deleted, leaving the next-most-recent backing store or no backing store at all as the active paint region. See gdk_window_begin_paint_region() for full details. It is an error to call this function without a matching gdk_window_begin_paint_region() first.
window : | a GdkWindow |
void gdk_window_invalidate_rect (GdkWindow *window, GdkRectangle *rect, gboolean invalidate_children); |
A convenience wrapper around gdk_window_invalidate_region() which invalidates a rectangular region. See gdk_window_invalidate_region() for details.
window : | a GdkWindow |
rect : | rectangle to invalidate |
invalidate_children : | whether to also invalidate child windows |
void gdk_window_invalidate_region (GdkWindow *window, GdkRegion *region, gboolean invalidate_children); |
Adds region to the update area for window. The update area is the region that needs to be redrawn, or "dirty region." The call gdk_window_process_updates() sends one or more expose events to the window, which together cover the entire update area. An application would normally redraw the contents of window in response to those expose events.
GDK will call gdk_window_process_all_updates() on your behalf whenever your program returns to the main loop and becomes idle, so normally there's no need to do that manually, you just need to invalidate regions that you know should be redrawn.
The invalidate_children parameter controls whether the region of each child window that intersects region will also be invalidated. If FALSE, then the update area for child windows will remain unaffected.
GdkRegion* gdk_window_get_update_area (GdkWindow *window); |
Transfers ownership of the update area from window to the caller of the function. That is, after calling this function, window will no longer have an invalid/dirty region; the update area is removed from window and handed to you. If a window has no update area, gdk_window_get_update_area() returns NULL. You are responsible for calling gdk_region_destroy() on the returned region if it's non-NULL.
window : | a GdkWindow |
Returns : | the update area for window |
void gdk_window_process_all_updates (void); |
Calls gdk_window_process_updates() for all windows (see GdkWindow) in the application.
void gdk_window_process_updates (GdkWindow *window, gboolean update_children); |
Sends one or more expose events to window. The areas in each expose event will cover the entire update area for the window (see gdk_window_invalidate_region() for details). Normally GDK calls gdk_window_process_all_updates() on your behalf, so there's no need to call this function unless you want to force expose events to be delivered immediately and synchronously (vs. the usual case, where GDK delivers them in an idle handler). Occasionally this is useful to produce nicer scrolling behavior, for example.
window : | a GdkWindow |
update_children : | whether to also process updates for child windows |
void gdk_window_set_debug_updates (gboolean setting); |
With update debugging enabled, calls to gdk_window_invalidate_region() clear the invalidated region of the screen to a noticeable color, and GDK pauses for a short time before sending exposes to windows during gdk_window_process_updates(). The net effect is that you can see the invalid region for each window and watch redraws as they occur. This allows you to diagnose inefficiencies in your application.
In essence, because the GDK rendering model prevents all flicker, if you are redrawing the same region 400 times you may never notice, aside from noticing a speed problem. Enabling update debugging causes GTK to flicker slowly and noticeably, so you can see exactly what's being redrawn when, in what order.
The --gtk-debug=updates command line option passed to GTK+ programs enables this debug option at application startup time. That's usually more useful than calling gdk_window_set_debug_updates() yourself, though you might want to use this function to enable updates sometime after application startup time.
void gdk_window_set_override_redirect (GdkWindow *window, gboolean override_redirect); |
void gdk_window_add_filter (GdkWindow *window, GdkFilterFunc function, gpointer data); |
void gdk_window_remove_filter (GdkWindow *window, GdkFilterFunc function, gpointer data); |
GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent, GdkEvent *event, gpointer data); |
typedef enum { GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */ GDK_FILTER_TRANSLATE, /* Translated event stored */ GDK_FILTER_REMOVE /* Terminate processing, removing event */ } GdkFilterReturn; |
void gdk_window_shape_combine_mask (GdkWindow *window, GdkBitmap *shape_mask, gint offset_x, gint offset_y); |
void gdk_window_shape_combine_region (GdkWindow *window, GdkRegion *shape_region, gint offset_x, gint offset_y); |
gboolean gdk_window_set_static_gravities (GdkWindow *window, gboolean use_static); |
void gdk_window_set_hints (GdkWindow *window, gint x, gint y, gint min_width, gint min_height, gint max_width, gint max_height, gint flags); |
void gdk_window_set_back_pixmap (GdkWindow *window, GdkPixmap *pixmap, gboolean parent_relative); |
void gdk_window_get_geometry (GdkWindow *window, gint *x, gint *y, gint *width, gint *height, gint *depth); |
void gdk_window_set_geometry_hints (GdkWindow *window, GdkGeometry *geometry, GdkWindowHints flags); |
gboolean gdk_window_set_icon_list (GdkWindow *window, GList *pixbufs); |
Sets a list of icons for the window. One of these will be used to represent the window when it has been iconified. The icon is usually shown in an icon box or some sort of task bar. Which icon size is shown depends on the window manager. The window manager can scale the icon but setting several size icons can give better image quality since the window manager may only need to scale the icon by a small amount or not at all.
On the X11 backend this call might fail if the window manager doesn't support the Extended Window Manager Hints. Then this function returns FALSE, and the application should fall back to #gdk_window_set_icon().
window : | The GdkWindow toplevel window to set the icon of. |
pixbufs : | A list of pixbufs, of different sizes. |
Returns : | TRUE if the icons were set, false otherwise |
void gdk_window_set_modal_hint (GdkWindow *window, gboolean modal); |
The application can use this hint to tell the window manager that a certain window has modal behaviour. The window manager can use this information to handle modal windows in a special way.
You should only use this on windows for which you have previously called #gdk_window_set_transient_for()
window : | A GdkWindow |
modal : | TRUE if the window is modal, FALSE otherwise. |
void gdk_window_set_type_hint (GdkWindow *window, GdkWindowTypeHint hint); |
The application can use this call to provide a hint to the window manager about the functionality of a window. The window manager can use this information when determining the decoration and behaviour of the window.
The hint must be set before the window is mapped.
window : | A GdkWindow |
hint : | A hint of the function this window will have |
void gdk_window_get_root_origin (GdkWindow *window, gint *x, gint *y); |
Obtains the top-left corner of the window manager frame in root window coordinates.
window : | a GdkWindow |
x : | return location for X position of window frame |
y : | return location for Y position of window frame |
void gdk_window_get_frame_extents (GdkWindow *window, GdkRectangle *rect); |
Obtains the bounding box of the window, including window manager titlebar/borders if any. The frame position is given in root window coordinates. To get the position of the window itself (rather than the frame) in root window coordinates, use gdk_window_get_origin().
window : | a GdkWindow |
rect : | rectangle to fill with bounding box of the window frame |
gint gdk_window_get_origin (GdkWindow *window, gint *x, gint *y); |
Obtains the position of a window in root window coordinates. (Compare with gdk_window_get_position() and gdk_window_get_geometry() which return the position of a window relative to its parent window.)
window : | a GdkWindow |
x : | return location for X coordinate |
y : | return location for Y coordinate |
Returns : | not meaningful, ignore |
gboolean gdk_window_get_deskrelative_origin (GdkWindow *window, gint *x, gint *y); |
This gets the origin of a GdkWindow relative to an Enlightenment-window-manager desktop. As long as you don't assume that the user's desktop/workspace covers the entire root window (i.e. you don't assume that the desktop begins at root window coordinate 0,0) this function is not necessary. It's deprecated for that reason.
window : | a GdkWindow |
x : | return location for X coordinate |
y : | return location for Y coordinate |
Returns : | not meaningful |
GdkWindow* gdk_window_get_pointer (GdkWindow *window, gint *x, gint *y, GdkModifierType *mask); |
typedef enum { GDK_SHIFT_MASK = 1 << 0, GDK_LOCK_MASK = 1 << 1, GDK_CONTROL_MASK = 1 << 2, GDK_MOD1_MASK = 1 << 3, GDK_MOD2_MASK = 1 << 4, GDK_MOD3_MASK = 1 << 5, GDK_MOD4_MASK = 1 << 6, GDK_MOD5_MASK = 1 << 7, GDK_BUTTON1_MASK = 1 << 8, GDK_BUTTON2_MASK = 1 << 9, GDK_BUTTON3_MASK = 1 << 10, GDK_BUTTON4_MASK = 1 << 11, GDK_BUTTON5_MASK = 1 << 12, /* The next few modifiers are used by XKB, so we skip to the end */ GDK_RELEASE_MASK = 1 << 31, GDK_MODIFIER_MASK = GDK_RELEASE_MASK | 0x1fff } GdkModifierType; |
void gdk_window_set_icon (GdkWindow *window, GdkWindow *icon_window, GdkPixmap *pixmap, GdkBitmap *mask); |
void gdk_window_set_transient_for (GdkWindow *window, GdkWindow *leader); |
void gdk_window_set_decorations (GdkWindow *window, GdkWMDecoration decorations); |
gboolean gdk_window_get_decorations (GdkWindow *window, GdkWMDecoration *decorations); |
Returns the decorations set on the GdkWindow with gdk_window_set_decorations
window : | The GdkWindow to get the decorations from |
decorations : | The window decorations will be written here |
Returns : | TRUE if the window has decorations set, FALSE otherwise. |
typedef enum { GDK_DECOR_ALL = 1 << 0, GDK_DECOR_BORDER = 1 << 1, GDK_DECOR_RESIZEH = 1 << 2, GDK_DECOR_TITLE = 1 << 3, GDK_DECOR_MENU = 1 << 4, GDK_DECOR_MINIMIZE = 1 << 5, GDK_DECOR_MAXIMIZE = 1 << 6 } GdkWMDecoration; |
void gdk_window_set_functions (GdkWindow *window, GdkWMFunction functions); |
typedef enum { GDK_FUNC_ALL = 1 << 0, GDK_FUNC_RESIZE = 1 << 1, GDK_FUNC_MOVE = 1 << 2, GDK_FUNC_MINIMIZE = 1 << 3, GDK_FUNC_MAXIMIZE = 1 << 4, GDK_FUNC_CLOSE = 1 << 5 } GdkWMFunction; |