| GDK Reference Manual | ||||
|---|---|---|---|---|
#include <gdk/gdk.h> struct GdkWindow; enum GdkWindowType; enum GdkWindowClass; enum GdkWindowHints; GdkGeometry; enum GdkGravity; enum GdkWindowEdge; enum GdkWindowTypeHint; GdkWindowAttr; enum GdkWindowAttributesType; GdkWindow* gdk_window_new (GdkWindow *parent, GdkWindowAttr *attributes,gint attributes_mask);void gdk_window_destroy (GdkWindow *window); #define gdk_window_ref #define gdk_window_unref GdkWindowType gdk_window_get_window_type (GdkWindow *window); GdkWindow* gdk_window_at_pointer (gint *win_x,gint *win_y);void gdk_window_show (GdkWindow *window);void gdk_window_show_unraised (GdkWindow *window);void gdk_window_hide (GdkWindow *window);gboolean gdk_window_is_visible (GdkWindow *window);gboolean gdk_window_is_viewable (GdkWindow *window); GdkWindowState gdk_window_get_state (GdkWindow *window);void gdk_window_withdraw (GdkWindow *window);void gdk_window_iconify (GdkWindow *window);void gdk_window_deiconify (GdkWindow *window);void gdk_window_stick (GdkWindow *window);void gdk_window_unstick (GdkWindow *window);void gdk_window_maximize (GdkWindow *window);void gdk_window_unmaximize (GdkWindow *window);void gdk_window_fullscreen (GdkWindow *window);void gdk_window_unfullscreen (GdkWindow *window);void gdk_window_set_keep_above (GdkWindow *window,gboolean setting);void gdk_window_set_keep_below (GdkWindow *window,gboolean setting);void gdk_window_set_opacity (GdkWindow *window,gdouble opacity);void gdk_window_set_composited (GdkWindow *window,gboolean composited);void gdk_window_move (GdkWindow *window,gint x,gint y);void gdk_window_resize (GdkWindow *window,gint width,gint height);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);void gdk_window_move_region (GdkWindow *window, const GdkRegion *region,gint dx,gint dy);void gdk_window_reparent (GdkWindow *window, GdkWindow *new_parent,gint x,gint y);void gdk_window_clear (GdkWindow *window);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_raise (GdkWindow *window);void gdk_window_lower (GdkWindow *window);void gdk_window_focus (GdkWindow *window,guint32 timestamp);void gdk_window_register_dnd (GdkWindow *window);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);void gdk_window_beep (GdkWindow *window);void gdk_window_begin_paint_rect (GdkWindow *window, const GdkRectangle *rectangle);void gdk_window_begin_paint_region (GdkWindow *window, const GdkRegion *region);void gdk_window_end_paint (GdkWindow *window);void gdk_window_invalidate_rect (GdkWindow *window, const GdkRectangle *rect,gboolean invalidate_children);void gdk_window_invalidate_region (GdkWindow *window, const GdkRegion *region,gboolean invalidate_children);void gdk_window_invalidate_maybe_recurse (GdkWindow *window, const GdkRegion *region,gboolean (child_funcGdkWindow *, gpointer) (),gpointer user_data); GdkRegion* gdk_window_get_update_area (GdkWindow *window);void gdk_window_freeze_updates (GdkWindow *window);void gdk_window_thaw_updates (GdkWindow *window);void gdk_window_process_all_updates (void);void gdk_window_process_updates (GdkWindow *window,gboolean update_children);void gdk_window_set_debug_updates (gboolean setting);void gdk_window_get_internal_paint_info (GdkWindow *window, GdkDrawable **real_drawable,gint *x_offset,gint *y_offset);void gdk_window_enable_synchronized_configure (GdkWindow *window);void gdk_window_configure_finished (GdkWindow *window);void gdk_window_set_user_data (GdkWindow *window,gpointer user_data);void gdk_window_set_override_redirect (GdkWindow *window,gboolean override_redirect);void gdk_window_set_accept_focus (GdkWindow *window,gboolean accept_focus);void gdk_window_set_focus_on_map (GdkWindow *window,gboolean focus_on_map);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); enum GdkFilterReturn; typedef GdkXEvent;void gdk_window_shape_combine_mask (GdkWindow *window, GdkBitmap *mask,gint x,gint y);void gdk_window_shape_combine_region (GdkWindow *window, const GdkRegion *shape_region,gint offset_x,gint offset_y);void gdk_window_set_child_shapes (GdkWindow *window);void gdk_window_merge_child_shapes (GdkWindow *window);void gdk_window_input_shape_combine_mask (GdkWindow *window, GdkBitmap *mask,gint x,gint y);void gdk_window_input_shape_combine_region (GdkWindow *window, const GdkRegion *shape_region,gint offset_x,gint offset_y);void gdk_window_set_child_input_shapes (GdkWindow *window);void gdk_window_merge_child_input_shapes (GdkWindow *window);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_title (GdkWindow *window, constgchar *title);void gdk_window_set_background (GdkWindow *window, const GdkColor *color);void gdk_window_set_back_pixmap (GdkWindow *window, GdkPixmap *pixmap,gboolean parent_relative); #define GDK_PARENT_RELATIVEvoid gdk_window_set_cursor (GdkWindow *window, GdkCursor *cursor); #define gdk_window_set_colormapvoid gdk_window_get_user_data (GdkWindow *window,gpointer *data);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, const GdkGeometry *geometry, GdkWindowHints geom_mask);void gdk_window_set_icon_list (GdkWindow *window,GList *pixbufs);void gdk_window_set_modal_hint (GdkWindow *window,gboolean modal);void gdk_window_set_type_hint (GdkWindow *window, GdkWindowTypeHint hint); GdkWindowTypeHint gdk_window_get_type_hint (GdkWindow *window);void gdk_window_set_skip_taskbar_hint (GdkWindow *window,gboolean skips_taskbar);void gdk_window_set_skip_pager_hint (GdkWindow *window,gboolean skips_pager);void gdk_window_set_urgency_hint (GdkWindow *window,gboolean urgent);void gdk_window_get_position (GdkWindow *window,gint *x,gint *y);void gdk_window_get_root_origin (GdkWindow *window,gint *x,gint *y);void gdk_window_get_frame_extents (GdkWindow *window, GdkRectangle *rect); #define gdk_window_get_size #define gdk_window_get_visual #define gdk_window_get_colormap #define gdk_window_get_typegint gdk_window_get_origin (GdkWindow *window,gint *x,gint *y);gboolean gdk_window_get_deskrelative_origin (GdkWindow *window,gint *x,gint *y); GdkWindow* gdk_window_get_pointer (GdkWindow *window,gint *x,gint *y, GdkModifierType *mask); enum GdkModifierType; GdkWindow* gdk_window_get_parent (GdkWindow *window); GdkWindow* gdk_window_get_toplevel (GdkWindow *window);GList * gdk_window_get_children (GdkWindow *window);GList * gdk_window_peek_children (GdkWindow *window); GdkEventMask gdk_window_get_events (GdkWindow *window);void gdk_window_set_events (GdkWindow *window, GdkEventMask event_mask);void gdk_window_set_icon (GdkWindow *window, GdkWindow *icon_window, GdkPixmap *pixmap, GdkBitmap *mask);void gdk_window_set_icon_name (GdkWindow *window, constgchar *name);void gdk_window_set_transient_for (GdkWindow *window, GdkWindow *parent);void gdk_window_set_role (GdkWindow *window, constgchar *role);void gdk_window_set_startup_id (GdkWindow *window, constgchar *startup_id);void gdk_window_set_group (GdkWindow *window, GdkWindow *leader); GdkWindow* gdk_window_get_group (GdkWindow *window);void gdk_window_set_decorations (GdkWindow *window, GdkWMDecoration decorations);gboolean gdk_window_get_decorations (GdkWindow *window, GdkWMDecoration *decorations); enum GdkWMDecoration;void gdk_window_set_functions (GdkWindow *window, GdkWMFunction functions); enum GdkWMFunction;GList * gdk_window_get_toplevels (void); GdkWindow* gdk_get_default_root_window (void); GdkPointerHooks; GdkPointerHooks* gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks); GdkWindowRedirect;void gdk_window_redirect_to_drawable (GdkWindow *window, GdkDrawable *drawable,gint src_x,gint src_y,gint dest_x,gint dest_y,gint width,gint height);void gdk_window_remove_redirection (GdkWindow *window);
A GdkWindow is a rectangular region on the screen. It's a low-level object,
used to implement high-level objects such as
Example 7. Composited windows
#include <gtk/gtk.h>
/* The expose event handler for the event box.
*
* This function simply draws a transparency onto a widget on the area
* for which it receives expose events. This is intended to give the
* event box a "transparent" background.
*
* In order for this to work properly, the widget must have an RGBA
* colourmap. The widget should also be set as app-paintable since it
* doesn't make sense for GTK+ to draw a background if we are drawing it
* (and because GTK+ might actually replace our transparency with its
* default background colour).
*/
static gboolean
transparent_expose (GtkWidget *widget,
GdkEventExpose *event)
{
cairo_t *cr;
cr = gdk_cairo_create (widget->window);
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
gdk_cairo_region (cr, event->region);
cairo_fill (cr);
cairo_destroy (cr);
return FALSE;
}
/* The expose event handler for the window.
*
* This function performs the actual compositing of the event box onto
* the already-existing background of the window at 50% normal opacity.
*
* In this case we do not want app-paintable to be set on the widget
* since we want it to draw its own (red) background. Because of this,
* however, we must ensure that we use g_signal_connect_after so that
* this handler is called after the red has been drawn. If it was
* called before then GTK would just blindly paint over our work.
*
* Note: if the child window has children, then you need a cairo 1.16
* feature to make this work correctly.
*/
static gboolean
window_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
GdkRegion *region;
GtkWidget *child;
cairo_t *cr;
/* get our child (in this case, the event box) */
child = gtk_bin_get_child (GTK_BIN (widget));
/* create a cairo context to draw to the window */
cr = gdk_cairo_create (widget->window);
/* the source data is the (composited) event box */
gdk_cairo_set_source_pixmap (cr, child->window,
child->allocation.x,
child->allocation.y);
/* draw no more than our expose event intersects our child */
region = gdk_region_rectangle (&child->allocation);
gdk_region_intersect (region, event->region);
gdk_cairo_region (cr, region);
cairo_clip (cr);
/* composite, with a 50% opacity */
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
cairo_paint_with_alpha (cr, 0.5);
/* we're done */
cairo_destroy (cr);
return FALSE;
}
int
main (int argc, char **argv)
{
GtkWidget *window, *event, *button;
GdkScreen *screen;
GdkColormap *rgba;
GdkColor red;
gtk_init (&argc, &argv);
/* Make the widgets */
button = gtk_button_new_with_label ("A Button");
event = gtk_event_box_new ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
/* Put a red background on the window */
gdk_color_parse ("red", &red);
gtk_widget_modify_bg (window, GTK_STATE_NORMAL, &red);
/* Set the colourmap for the event box.
* Must be done before the event box is realised.
*/
screen = gtk_widget_get_screen (event);
rgba = gdk_screen_get_rgba_colormap (screen);
gtk_widget_set_colormap (event, rgba);
/* Set our event box to have a fully-transparent background
* drawn on it. Currently there is no way to simply tell GTK+
* that "transparency" is the background colour for a widget.
*/
gtk_widget_set_app_paintable (GTK_WIDGET (event), TRUE);
g_signal_connect (event, "expose-event",
G_CALLBACK (transparent_expose), NULL);
/* Put them inside one another */
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
gtk_container_add (GTK_CONTAINER (window), event);
gtk_container_add (GTK_CONTAINER (event), button);
/* Realise and show everything */
gtk_widget_show_all (window);
/* Set the event box GdkWindow to be composited.
* Obviously must be performed after event box is realised.
*/
gdk_window_set_composited (event->window, TRUE);
/* Set up the compositing handler.
* Note that we do _after_ so that the normal (red) background is drawn
* by gtk before our compositing occurs.
*/
g_signal_connect_after (window, "expose-event",
G_CALLBACK (window_expose_event), NULL);
gtk_main ();
return 0;
}
In the example Example 7, “Composited windows”, a button is placed inside of an event box inside of a window. The event box is set as composited and therefore is no longer automatically drawn to the screen.
When the contents of the event box change, an expose event is
generated on its parent window (which, in this case, belongs to
the toplevel
In our case, we merge the contents with a 50% transparency. We also set the background colour of the window to red. The effect is that the background shows through the button.
struct GdkWindow;
An opaque structure representing an onscreen drawable. Pointers to structures of type GdkPixmap, GdkBitmap, and GdkWindow, can often be used interchangeably. The type GdkDrawable refers generically to any of these types.
typedef enum
{
GDK_WINDOW_ROOT,
GDK_WINDOW_TOPLEVEL,
GDK_WINDOW_CHILD,
GDK_WINDOW_DIALOG,
GDK_WINDOW_TEMP,
GDK_WINDOW_FOREIGN
} GdkWindowType;
Describes the kind of window.
GDK_WINDOW_ROOT |
root window; this window has no parent, covers the entire screen, and is created by the window system |
GDK_WINDOW_TOPLEVEL |
toplevel window (used to implement |
GDK_WINDOW_CHILD |
child window (used to implement e.g. |
GDK_WINDOW_DIALOG |
useless/deprecated compatibility type |
GDK_WINDOW_TEMP |
override redirect temporary window (used to implement |
GDK_WINDOW_FOREIGN |
foreign window (see gdk_window_foreign_new())
|
typedef enum
{
GDK_INPUT_OUTPUT,
GDK_INPUT_ONLY
} GdkWindowClass;
GDK_INPUT_OUTPUT windows are the standard kind of window you might expect.
GDK_INPUT_ONLY windows are invisible; they are used to trap events, but
you can't draw on them.
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,
GDK_HINT_USER_POS = 1 << 7,
GDK_HINT_USER_SIZE = 1 << 8
} GdkWindowHints;
Used to indicate which fields of a GdkGeometry struct should be paid attention
to. Also, the presence/absence of GDK_HINT_POS, GDK_HINT_USER_POS, and
GDK_HINT_USER_SIZE is significant, though they don't directly refer to
GdkGeometry fields. GDK_HINT_USER_POS will be set automatically by gtk_window_move()GDK_HINT_USER_POS and GDK_HINT_USER_SIZE
should be set if the user specified a size/position using a --geometry
command-line argument; gtk_window_parse_geometry()
typedef struct {
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;
} GdkGeometry;
The GdkGeometry struct gives the window manager information about
a window's geometry constraints. Normally you would set these on
the GTK+ level using gtk_window_set_geometry_hints()
gdk_window_set_geometry_hints() expects the hints to be fully valid already and
simply passes them to the window manager; in contrast,
gtk_window_set_geometry_hints()min_width/min_height/max_width/max_height fields may be set to -1, and
The canonical use-case for gtk_window_set_geometry_hints()width_inc and height_inc fields should be set to the size of one character
in the terminal. Finally, the base size should be set to the size of one
character. The net effect is that the minimum size of the terminal
will have a 1x1 character terminal area, and only terminal sizes on
the "character grid" will be allowed.
Here's an example of how the terminal example would be implemented, assuming a terminal area widget called "terminal" and a toplevel window "toplevel":
GdkGeometry hints;
hints.base_width = terminal->char_width;
hints.base_height = terminal->char_height;
hints.min_width = terminal->char_width;
hints.min_height = terminal->char_height;
hints.width_inc = terminal->char_width;
hints.height_inc = terminal->char_height;
gtk_window_set_geometry_hints (GTK_WINDOW (toplevel),
GTK_WIDGET (terminal),
&hints,
GDK_HINT_RESIZE_INC |
GDK_HINT_MIN_SIZE |
GDK_HINT_BASE_SIZE);
The other useful fields are the min_aspect and max_aspect fields; these
contain a width/height ratio as a floating point number. If a geometry widget is
set, the aspect applies to the geometry widget rather than the entire window.
The most common use of these hints is probably to set min_aspect and
max_aspect to the same value, thus forcing the window to keep a constant aspect
ratio.
min_width; |
minimum width of window (or -1 to use requisition, with |
min_height; |
minimum height of window (or -1 to use requisition, with |
max_width; |
maximum width of window (or -1 to use requisition, with |
max_height; |
maximum height of window (or -1 to use requisition, with |
base_width; |
allowed window widths are base_width + width_inc * N where N is any integer (-1 allowed with |
base_height; |
allowed window widths are base_height + height_inc * N where N is any integer (-1 allowed with |
width_inc; |
width resize increment |
height_inc; |
height resize increment |
min_aspect; |
minimum width/height ratio |
max_aspect; |
maximum width/height ratio |
GdkGravity win_gravity; |
window gravity, see gtk_window_set_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;
Defines the reference point of a window and the meaning of coordinates
passed to gtk_window_move()gtk_window_move()
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;
Determines a window edge or corner.
typedef enum
{
GDK_WINDOW_TYPE_HINT_NORMAL,
GDK_WINDOW_TYPE_HINT_DIALOG,
GDK_WINDOW_TYPE_HINT_MENU, /* Torn off menu */
GDK_WINDOW_TYPE_HINT_TOOLBAR,
GDK_WINDOW_TYPE_HINT_SPLASHSCREEN,
GDK_WINDOW_TYPE_HINT_UTILITY,
GDK_WINDOW_TYPE_HINT_DOCK,
GDK_WINDOW_TYPE_HINT_DESKTOP,
GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU, /* A drop down menu (from a menubar) */
GDK_WINDOW_TYPE_HINT_POPUP_MENU, /* A popup menu (from right-click) */
GDK_WINDOW_TYPE_HINT_TOOLTIP,
GDK_WINDOW_TYPE_HINT_NOTIFICATION,
GDK_WINDOW_TYPE_HINT_COMBO,
GDK_WINDOW_TYPE_HINT_DND
} GdkWindowTypeHint;
These are hints for the window manager that indicate what type of function the window has. The window manager can use this when determining decoration and behaviour of the window. The hint must be set before mapping the window.
See the Extended Window Manager Hints specification for more details about window types.
typedef struct {
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;
GdkWindowTypeHint type_hint;
} GdkWindowAttr;
Attributes to use for a newly-created window.
title; |
title of the window (for toplevel windows) |
event_mask; |
event mask (see gdk_window_set_events())
|
x; |
X coordinate relative to parent window (see gdk_window_move())
|
y; |
Y coordinate relative to parent window (see gdk_window_move())
|
width; |
width of window |
height; |
height of window |
GdkWindowClass wclass; |
GDK_INPUT_OUTPUT (normal window) or GDK_INPUT_ONLY (invisible window that receives events) |
GdkVisual *visual; |
GdkVisual for window |
GdkColormap *colormap; |
GdkColormap for window |
GdkWindowType window_type; |
type of window |
GdkCursor *cursor; |
cursor for the window (see gdk_window_set_cursor())
|
wmclass_name; |
don't use (see gtk_window_set_wmclass() |
wmclass_class; |
don't use (see gtk_window_set_wmclass() |
override_redirect; |
TRUE |
GdkWindowTypeHint type_hint; |
a hint of the function of the window |
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,
GDK_WA_TYPE_HINT = 1 << 9
} GdkWindowAttributesType;
Used to indicate which fields in the GdkWindowAttr struct should be
honored. For example, if you filled in the "cursor" and "x" fields of
GdkWindowAttr, pass "GDK_WA_X | GDK_WA_CURSOR" to gdk_window_new(). Fields
in GdkWindowAttr not covered by a bit in this enum are required; for example,
the width/height, wclass, and window_type fields are required, they have no
corresponding flag in GdkWindowAttributesType.
GdkWindow* gdk_window_new (GdkWindow *parent, GdkWindowAttr *attributes,gint attributes_mask);
Creates a new GdkWindow using the attributes from
attributes. See GdkWindowAttr and GdkWindowAttributesType for
more details. Note: to use this on displays other than the default
display, parent must be specified.
void gdk_window_destroy (GdkWindow *window);
Destroys the window system resources associated with window and decrements window's
reference count. The window system resources for all children of window are also
destroyed, but the children's reference counts are not decremented.
Note that a window will not be destroyed automatically when its reference count reaches zero. You must call this function yourself before that happens.
window : |
a GdkWindow |
#define gdk_window_ref gdk_drawable_ref
gdk_window_ref is deprecated and should not be used in newly-written code.
Deprecated equivalent of g_object_ref()
| Returns : | the window |
#define gdk_window_unref gdk_drawable_unref
gdk_window_unref is deprecated and should not be used in newly-written code.
Deprecated equivalent of g_object_unref()
GdkWindowType gdk_window_get_window_type (GdkWindow *window);
Gets the type of the window. See GdkWindowType.
window : |
a GdkWindow |
| Returns : | type of window |
GdkWindow* gdk_window_at_pointer (gint *win_x,gint *win_y);
Obtains the window underneath the mouse pointer, returning the
location of that window in win_x, win_y. Returns NULLgdk_window_foreign_new())
NOTE: For multihead-aware widgets or applications use
gdk_display_get_window_at_pointer() instead.
win_x : |
return location for origin of the window under the pointer |
win_y : |
return location for origin of the window under the pointer |
| Returns : | window under the mouse pointer |
void gdk_window_show (GdkWindow *window);
Like gdk_window_show_unraised(), but also raises the window to the
top of the window stack (moves the window to the front of the
Z-order).
This function maps a window so it's visible onscreen. Its opposite
is gdk_window_hide().
When implementing a
window : |
a GdkWindow |
void gdk_window_show_unraised (GdkWindow *window);
Shows a GdkWindow onscreen, but does not modify its stacking
order. In contrast, gdk_window_show() will raise the window
to the top of the window stack.
On the X11 platform, in Xlib terms, this function calls
XMapWindow()XMapWindow()
window : |
a GdkWindow |
void gdk_window_hide (GdkWindow *window);
For toplevel windows, withdraws them, so they will no longer be
known to the window manager; for all windows, unmaps them, so
they won't be displayed. Normally done automatically as
part of gtk_widget_hide()
window : |
a GdkWindow |
gboolean gdk_window_is_visible (GdkWindow *window);
Checks whether the window has been mapped (with gdk_window_show() or
gdk_window_show_unraised()).
window : |
a GdkWindow |
| Returns : | TRUE |
gboolean gdk_window_is_viewable (GdkWindow *window);
Check if the window and all ancestors of the window are mapped. (This is not necessarily "viewable" in the X sense, since we only check as far as we have GDK window parents, not to the root window.)
window : |
a GdkWindow |
| Returns : | TRUE |
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_withdraw (GdkWindow *window);
Withdraws a window (unmaps it and asks the window manager to forget about it).
This function is not really useful as gdk_window_hide() automatically
withdraws toplevel windows before hiding them.
window : |
a toplevel GdkWindow |
void gdk_window_iconify (GdkWindow *window);
Asks to iconify (minimize) window. The window manager may choose
to ignore the request, but normally will honor it. Using
gtk_window_iconify()
This function only makes sense when window is a toplevel window.
window : |
a toplevel GdkWindow |
void gdk_window_deiconify (GdkWindow *window);
Attempt to deiconify (unminimize) window. On X11 the window manager may
choose to ignore the request to deiconify. When using GTK+,
use gtk_window_deiconify()gtk_window_present()
window : |
a toplevel GdkWindow |
void gdk_window_stick (GdkWindow *window);
"Pins" a window such that it's on all workspaces and does not scroll
with viewports, for window managers that have scrollable viewports.
(When using gtk_window_stick()
On the X11 platform, this function depends on window manager support, so may have no effect with many window managers. However, GDK will do the best it can to convince the window manager to stick the window. For window managers that don't support this operation, there's nothing you can do to force it to happen.
window : |
a toplevel GdkWindow |
void gdk_window_unstick (GdkWindow *window);
Reverse operation for gdk_window_stick(); see gdk_window_stick(),
and gtk_window_unstick()
window : |
a toplevel GdkWindow |
void gdk_window_maximize (GdkWindow *window);
Maximizes the window. If the window was already maximized, then this function does nothing.
On X11, asks the window manager to maximize window, if the window
manager supports this operation. Not all window managers support
this, and some deliberately ignore it or don't have a concept of
"maximized"; so you can't rely on the maximization actually
happening. But it will happen with most standard window managers,
and GDK makes a best effort to get it to happen.
On Windows, reliably maximizes the window.
window : |
a toplevel GdkWindow |
void gdk_window_unmaximize (GdkWindow *window);
Unmaximizes the window. If the window wasn't maximized, then this function does nothing.
On X11, asks the window manager to unmaximize window, if the
window manager supports this operation. Not all window managers
support this, and some deliberately ignore it or don't have a
concept of "maximized"; so you can't rely on the unmaximization
actually happening. But it will happen with most standard window
managers, and GDK makes a best effort to get it to happen.
On Windows, reliably unmaximizes the window.
window : |
a toplevel GdkWindow |
void gdk_window_fullscreen (GdkWindow *window);
Moves the window into fullscreen mode. This means the window covers the entire screen and is above any panels or task bars.
If the window was already fullscreen, then this function does nothing.
On X11, asks the window manager to put window in a fullscreen
state, if the window manager supports this operation. Not all
window managers support this, and some deliberately ignore it or
don't have a concept of "fullscreen"; so you can't rely on the
fullscreenification actually happening. But it will happen with
most standard window managers, and GDK makes a best effort to get
it to happen.
window : |
a toplevel GdkWindow |
Since 2.2
void gdk_window_unfullscreen (GdkWindow *window);
Moves the window out of fullscreen mode. If the window was not fullscreen, does nothing.
On X11, asks the window manager to move window out of the fullscreen
state, if the window manager supports this operation. Not all
window managers support this, and some deliberately ignore it or
don't have a concept of "fullscreen"; so you can't rely on the
unfullscreenification actually happening. But it will happen with
most standard window managers, and GDK makes a best effort to get
it to happen.
window : |
a toplevel GdkWindow |
Since 2.2
void gdk_window_set_keep_above (GdkWindow *window,gboolean setting);
Set if window must be kept above other windows. If the
window was already above, then this function does nothing.
On X11, asks the window manager to keep window above, if the window
manager supports this operation. Not all window managers support
this, and some deliberately ignore it or don't have a concept of
"keep above"; so you can't rely on the window being kept above.
But it will happen with most standard window managers,
and GDK makes a best effort to get it to happen.
window : |
a toplevel GdkWindow |
setting : |
whether to keep window above other windows
|
Since 2.4
void gdk_window_set_keep_below (GdkWindow *window,gboolean setting);
Set if window must be kept below other windows. If the
window was already below, then this function does nothing.
On X11, asks the window manager to keep window below, if the window
manager supports this operation. Not all window managers support
this, and some deliberately ignore it or don't have a concept of
"keep below"; so you can't rely on the window being kept below.
But it will happen with most standard window managers,
and GDK makes a best effort to get it to happen.
window : |
a toplevel GdkWindow |
setting : |
whether to keep window below other windows
|
Since 2.4
void gdk_window_set_opacity (GdkWindow *window,gdouble opacity);
Request the windowing system to make window partially transparent,
with opacity 0 being fully transparent and 1 fully opaque. (Values
of the opacity parameter are clamped to the [0,1] range.)
On X11, this works only on X screens with a compositing manager running.
For setting up per-pixel alpha, see gdk_screen_get_rgba_colormap().
For making non-toplevel windows translucent, see
gdk_window_set_composited().
window : |
a top-level GdkWindow |
opacity : |
opacity |
Since 2.12
void gdk_window_set_composited (GdkWindow *window,gboolean composited);
Sets a GdkWindow as composited, or unsets it. Composited windows do not automatically have their contents drawn to the screen. Drawing is redirected to an offscreen buffer and an expose event is emitted on the parent of the composited window. It is the responsibility of the parent's expose handler to manually merge the off-screen content onto the screen in whatever way it sees fit. See Example 7, “Composited windows” for an example.
It only makes sense for child windows to be composited; see
gdk_window_set_opacity() if you need translucent toplevel
windows.
An additional effect of this call is that the area of this window is no longer clipped from regions marked for invalidation on its parent. Draws done on the parent window are also no longer clipped by the child.
This call is only supported on some systems (currently,
only X11 with new enough Xcomposite and Xdamage extensions).
You must call gdk_display_supports_composite() to check if
setting a window as composited is supported before
attempting to do so.
window : |
a GdkWindow |
composited : |
TRUE |
Since 2.12
void gdk_window_move (GdkWindow *window,gint x,gint y);
Repositions a window relative to its parent window.
For toplevel windows, window managers may ignore or modify the move;
you should probably use gtk_window_move()
If you're also planning to resize the window, use gdk_window_move_resize()
to both move and resize simultaneously, for a nicer visual effect.
window : |
a GdkWindow |
x : |
X coordinate relative to window's parent |
y : |
Y coordinate relative to window's parent |
void gdk_window_resize (GdkWindow *window,gint width,gint height);
Resizes window; for toplevel windows, asks the window manager to resize
the window. The window manager may not allow the resize. When using GTK+,
use gtk_window_resize()
Windows may not be resized below 1x1.
If you're also planning to move the window, use gdk_window_move_resize()
to both move and resize simultaneously, for a nicer visual effect.
window : |
a GdkWindow |
width : |
new width of the window |
height : |
new height of the window |
void gdk_window_move_resize (GdkWindow *window,gint x,gint y,gint width,gint height);
Equivalent to calling gdk_window_move() and gdk_window_resize(),
except that both operations are performed at once, avoiding strange
visual effects. (i.e. the user may be able to see the window first
move, then resize, if you don't use gdk_window_move_resize().)
window : |
a GdkWindow |