Details
struct GdkWindow
struct GdkPixmap
{
gpointer user_data;
}; |
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.
enum GdkWindowType
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.
enum GdkWindowClass
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.
enum GdkWindowHints
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 GtkWindow
if you call 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() automatically sets these
flags.
struct GdkGeometry
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;
}; |
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(). GtkWindow
then sets the hints on the GdkWindow it creates.
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() performs some interpretation. For example,
GtkWindow will apply the hints to the geometry widget instead of the toplevel
window, if you set a geometry widget. Also, the
min_width/min_height/max_width/max_height fields may be set to -1, and
GtkWindow will substitute the size request of the window or geometry widget. If
the minimum size hint is not provided, GtkWindow will use its requisition as
the minimum size. If the minimum size is provided and a geometry widget is set,
GtkWindow will take the minimum size as the minimum size of the geometry widget
rather than the entire window. The base size is treated similarly.
The canonical use-case for gtk_window_set_geometry_hints() is to get a terminal
widget to resize properly. Here, the terminal text area should be the geometry
widget; GtkWindow will then automatically set the base size to the size of
other widgets in the terminal window, such as the menubar and scrollbar. Then,
the 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":
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.
enum GdkGravity
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(). See gtk_window_move() and the "implementation
notes" section of the
extended
window manager hints specification for more details.
enum GdkWindowEdge
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.
enum GdkWindowTypeHint
typedef enum
{
GDK_WINDOW_TYPE_HINT_NORMAL,
GDK_WINDOW_TYPE_HINT_DIALOG,
GDK_WINDOW_TYPE_HINT_MENU,
GDK_WINDOW_TYPE_HINT_TOOLBAR
} 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.
struct GdkWindowAttr
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;
}; |
Attributes to use for a newly-created window.
enum GdkWindowAttributesType
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; |
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.
struct GdkScreen
struct GdkScreen
{
GObject parent_instance;
}; |
This is a currently just a placeholder typedef for the first argument of
the window_at_pointer function in GdkPointerHooks. It will be used
when GDK gets multihead support.
gdk_window_destroy ()
Destroys window (destroys the server-side resource associated with
window). Memory allocated for window may not be freed until all
references to window are dropped. All children of window are also
destroyed.
There's normally no need to use this function, window are automatically
destroyed when their reference count reaches 0.
gdk_window_ref
#define gdk_window_ref gdk_drawable_ref |
Warning |
gdk_window_ref is deprecated and should not be used in newly-written code. |
Deprecated equivalent of g_object_ref()
gdk_window_unref
#define gdk_window_unref gdk_drawable_unref |
Warning |
gdk_window_unref is deprecated and should not be used in newly-written code. |
Deprecated equivalent of g_object_unref()
gdk_window_get_window_type ()
Gets the type of the window. See GdkWindowType.
gdk_window_at_pointer ()
Obtains the window underneath the mouse pointer, returning the
location of that window in win_x, win_y. Returns NULL if the
window under the mouse pointer is not known to GDK (for example,
belongs to another application).
gdk_window_show ()
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 GtkWidget, you should call this function on the widget's
GdkWindow as part of the "map" method.
gdk_window_show_unraised ()
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() (it also updates some internal GDK state, which means
that you can't really use XMapWindow() directly on a GDK window).
gdk_window_hide ()
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().
gdk_window_is_viewable ()
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.)
gdk_window_get_state ()
Gets the bitwise OR of the currently active window state flags,
from the GdkWindowState enumeration.
gdk_window_withdraw ()
void gdk_window_withdraw (GdkWindow *window); |
Withdraws a window (unmaps it and asks the window manager to forget about it).
Normally done automatically by gtk_widget_hide() called on a GtkWindow.
gdk_window_iconify ()
Asks to iconify (minimize) window. The window manager may choose
to ignore the request, but normally will honor it. Using
gtk_window_iconify() is preferred, if you have a GtkWindow widget.
gdk_window_deiconify ()
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() instead of the GdkWindow variant. Or better yet,
you probably want to use gtk_window_present(), which raises the window, focuses it,
unminimizes it, and puts it on the current desktop.
gdk_window_stick ()
"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 GtkWindow, gtk_window_stick() may be more useful.)
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.
gdk_window_maximize ()
void gdk_window_maximize (GdkWindow *window); |
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.
If the window was already maximized, then this function does nothing.
gdk_window_unmaximize ()
void gdk_window_unmaximize (GdkWindow *window); |
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.
If the window wasn't maximized, then this function does nothing.
gdk_window_move ()
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() on a GtkWindow widget
anyway, instead of using GDK functions. For child windows,
the move will reliably succeed.
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.
gdk_window_resize ()
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() instead of this low-level GDK function.
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.
gdk_window_move_resize ()
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().)
gdk_window_scroll ()
Scroll the contents of window, both pixels and children, by the given
amount. window itself does not move. 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.)
gdk_window_reparent ()
Reparents window into the given new_parent. The window being
reparented will be unmapped as a side effect.
gdk_window_clear ()
Clears an entire window to the background color or background pixmap.
gdk_window_clear_area ()
Clears an area of window to the background color or background pixmap.
gdk_window_clear_area_e ()
Like gdk_window_clear_area(), but also generates an expose event for
the cleared area.
This function has a stupid name because it dates back to the mists
time, pre-GDK-1.0.
gdk_window_copy_area()
#define gdk_window_copy_area(drawable,gc,x,y,source_drawable,source_x,source_y,width,height) |
Warning |
gdk_window_copy_area is deprecated and should not be used in newly-written code. |
Deprecated equivalent to gdk_draw_drawable(), see that function for docs
gdk_window_raise ()
Raises window to the top of the Z-order (stacking order), so that
other windows with the same parent window appear below window.
If window is a toplevel, the window manager may choose to deny the
request to move the window in the Z-order, gdk_window_raise() only
requests the restack, does not guarantee it.
gdk_window_lower ()
Lowers window to the bottom of the Z-order (stacking order), so that
other windows with the same parent window appear above window.
If window is a toplevel, the window manager may choose to deny the
request to move the window in the Z-order, gdk_window_lower() only
requests the restack, does not guarantee it.
Note that gdk_window_show() raises the window again, so don't call this
function before gdk_window_show(). (Try gdk_window_show_unraised().)
gdk_window_focus ()
Sets keyboard focus to window. If window is not onscreen this
will not work. In most cases, gtk_window_present() should be used on
a GtkWindow, rather than calling this function.
gdk_window_register_dnd ()
void gdk_window_register_dnd (GdkWindow *window); |
Registers a window as a potential drop destination.
gdk_window_begin_resize_drag ()
Begins a window resize operation (for a toplevel window).
You might use this function to implement a "window resize grip," for
example; in fact GtkStatusbar uses it. The function works best
with window managers that support the Extended Window Manager Hints spec
(see http://www.freedesktop.org), but has a fallback implementation
for other window managers.
gdk_window_begin_move_drag ()
Begins a window move operation (for a toplevel window). You might
use this function to implement a "window move grip," for
example. The function works best with window managers that support
the Extended Window Manager Hints spec (see
http://www.freedesktop.org), but has a fallback implementation for
other window managers.
gdk_window_constrain_size ()
Constrains a desired width and height according to a
set of geometry hints (such as minimum and maximum size).
gdk_window_begin_paint_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().
gdk_window_invalidate_region ()
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. See gdk_window_invalidate_maybe_recurse if you need
fine grained control over which children are invalidated.
gdk_window_invalidate_maybe_recurse ()
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 child_func parameter controls whether the region of
each child window that intersects region will also be invalidated.
Only children for which child_func returns TRUE will have the area
invalidated.
gdk_window_get_update_area ()
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.
gdk_window_freeze_updates ()
void gdk_window_freeze_updates (GdkWindow *window); |
Temporarily freezes a window such that it won't receive expose
events. The window will begin receiving expose events again when
gdk_window_thaw_updates() is called. If gdk_window_freeze_updates()
has been called more than once, gdk_window_thaw_updates() must be called
an equal number of times to begin processing exposes.
gdk_window_process_updates ()
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.
gdk_window_set_debug_updates ()
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.
gdk_window_get_internal_paint_info ()
If you bypass the GDK layer and use windowing system primitives to
draw directly onto a GdkWindow, then you need to deal with two
details: there may be an offset between GDK coordinates and windowing
system coordinates, and GDK may have redirected drawing to a offscreen
pixmap as the result of a gdk_window_begin_paint_region() calls.
This function allows retrieving the information you need to compensate
for these effects.
This function exposes details of the GDK implementation, and is thus
likely to change in future releases of GDK.
gdk_window_set_user_data ()
For most purposes this function is deprecated in favor of
g_object_set_data(). However, for historical reasons GTK+ stores
the GtkWidget that owns a GdkWindow as user data on the
GdkWindow. So, custom widget implementations should use
this function for that. If GTK+ receives an event for a GdkWindow,
and the user data for the window is non-NULL, GTK+ will assume the
user data is a GtkWidget, and forward the event to that widget.
gdk_window_set_override_redirect ()
void gdk_window_set_override_redirect
(GdkWindow *window,
gboolean override_redirect); |
An override redirect window is not under the control of the window manager.
This means it won't have a titlebar, won't be minimizable, etc. - it will
be entirely under the control of the application. The window manager
can't see the override redirect window at all.
Override redirect should only be used for short-lived temporary
windows, such as popup menus. GtkMenu uses an override redirect
window in its implementation, for example.
gdk_window_add_filter ()
Adds an event filter to window, allowing you to intercept events
before they reach GDK. This is a low-level operation and makes it
easy to break GDK and/or GTK+, so you have to know what you're
doing. Pass NULL for window to get all events for all windows,
instead of events for a specific window.
GdkFilterFunc ()
Specifies the type of function used to filter native events before they are
converted to GDK events. A filter may translate the native event to a GDK
event or handle it without translation.
enum GdkFilterReturn
typedef enum {
GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
GDK_FILTER_TRANSLATE, /* Translated event stored */
GDK_FILTER_REMOVE /* Terminate processing, removing event */
} GdkFilterReturn; |
Specifies the result of applying a GdkFilterFunc to a native event.
GdkXEvent
typedef void GdkXEvent; /* Can be cast to window system specific |
Used to represent native events (XEvents for the X11
backend, MSGs for Win32).
gdk_window_shape_combine_mask ()
Applies a shape mask to window. Pixels in window corresponding to
set bits in the mask will be visible; pixels in window
corresponding to unset bits in the mask will be transparent. This
gives a non-rectangular window.
If mask is NULL, the shape mask will be unset, and the x/y
parameters are not used.
On the X11 platform, this uses an X server extension which is
widely available on most common platforms, but not available on
very old X servers, and occasionally the implementation will be
buggy. On servers without the shape extension, this function
will do nothing.
gdk_window_shape_combine_region ()
Makes pixels in window outside shape_region be transparent,
so that the window may be nonrectangular. See also
gdk_window_shape_combine_mask() to use a bitmap as the mask.
If shape_region is NULL, the shape will be unset, so the whole
window will be opaque again. offset_x and offset_y are ignored
if shape_region is NULL.
On the X11 platform, this uses an X server extension which is
widely available on most common platforms, but not available on
very old X servers, and occasionally the implementation will be
buggy. On servers without the shape extension, this function
will do nothing.
gdk_window_set_child_shapes ()
void gdk_window_set_child_shapes (GdkWindow *window); |
Sets the shape mask of window to the union of shape masks
for all children of window, ignoring the shape mask of window
itself. Contrast with gdk_window_merge_child_shapes() which includes
the shape mask of window in the masks to be merged.
gdk_window_merge_child_shapes ()
void gdk_window_merge_child_shapes (GdkWindow *window); |
Merges the shape masks for any child windows into the
shape mask for window. i.e. the union of all masks
for window and its children will become the new mask
for window. See gdk_window_shape_combine_mask().
This function is distinct from gdk_window_set_child_shapes()
because it includes window's shape mask in the set of shapes to
be merged.
gdk_window_set_static_gravities ()
Set the bit gravity of the given window to static, and flag it so
all children get static subwindow gravity. This is used if you are
implementing scary features that involve deep knowledge of the
windowing system. Don't worry about it unless you have to.
gdk_window_set_hints ()
Warning |
gdk_window_set_hints is deprecated and should not be used in newly-written code. |
This function is broken and useless and you should ignore it.
If using GTK+, use functions such as gtk_window_resize(), gtk_window_set_size_request(),
gtk_window_move(), gtk_window_parse_geometry(), and gtk_window_set_geometry_hints(),
depending on what you're trying to do.
If using GDK directly, use gdk_window_set_geometry_hints().
gdk_window_set_title ()
Sets the title of a toplevel window, to be displayed in the titlebar.
If you haven't explicitly set the icon name for the window
(using gdk_window_set_icon_name()), the icon name will be set to
title as well. title must be in UTF-8 encoding (as with all
user-readable strings in GDK/GTK+). title may not be NULL.
gdk_window_set_background ()
Sets the background color of window. (However, when using GTK+,
set the background of a widget with gtk_widget_modify_bg() - if
you're an application - or gtk_style_set_background() - if you're
implementing a custom widget.)
The color must be allocated; gdk_rgb_find_color() is the best way
to allocate a color.
See also gdk_window_set_back_pixmap().
gdk_window_set_back_pixmap ()
Sets the background pixmap of window. May also be used to set a background of
"None" on window, by setting a background pixmap of NULL.
A background pixmap will be tiled, positioning the first tile at the origin of
window, or if parent_relative is TRUE, the tiling will be done based on the
origin of the parent window (useful to align tiles in a parent with tiles
in a child).
A background pixmap of NULL means that the window will have no
background. A window with no background will never have its
background filled by the windowing system, instead the window will
contain whatever pixels were already in the corresponding area of
the display.
The windowing system will normally fill a window with its background
when the window is obscured then exposed, and when you call
gdk_window_clear().
GDK_PARENT_RELATIVE
#define GDK_PARENT_RELATIVE 1L |
A special value for GdkPixmap* variables, indicating
that the background pixmap for a window should be inherited from the parent
window.
gdk_window_set_colormap
#define gdk_window_set_colormap gdk_drawable_set_colormap |
Warning |
gdk_window_set_colormap is deprecated and should not be used in newly-written code. |
Deprecated equivalent to gdk_drawable_set_colormap()
gdk_window_get_user_data ()
Retrieves the user data for window, which is normally the widget
that window belongs to. See gdk_window_set_user_data().
gdk_window_get_geometry ()
Any of the return location arguments to this function may be NULL,
if you aren't interested in getting the value of that field.
The X and Y coordinates returned are relative to the parent window
of window, which for toplevels usually means relative to the
window decorations (titlebar, etc.) rather than relative to the
root window (screen-size background window).
On the X11 platform, the geometry is obtained from the X server,
so reflects the latest position of window; this may be out-of-sync
with the position of window delivered in the most-recently-processed
GdkEventConfigure. gdk_window_get_position() in contrast gets the
position from the most recent configure event.
gdk_window_set_geometry_hints ()
Sets the geometry hints for window. Hints flagged in geom_mask
are set, hints not flagged in geom_mask are unset.
To unset all hints, use a geom_mask of 0 and a geometry of NULL.
gdk_window_set_icon_list ()
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.
gdk_window_set_modal_hint ()
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()
gdk_window_set_type_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.
gdk_window_get_position ()
Obtains the position of the window as reported in the
most-recently-processed GdkEventConfigure. Contrast with
gdk_window_get_geometry() which queries the X server for the
current window position, regardless of which events have been
received or processed.
The position coordinates are relative to the window's parent window.
gdk_window_get_root_origin ()
Obtains the top-left corner of the window manager frame in root
window coordinates.
gdk_window_get_frame_extents ()
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().
gdk_window_get_size
#define gdk_window_get_size gdk_drawable_get_size |
Warning |
gdk_window_get_size is deprecated and should not be used in newly-written code. |
Deprecated equivalent of gdk_drawable_get_size().
gdk_window_get_visual
#define gdk_window_get_visual gdk_drawable_get_visual |
Warning |
gdk_window_get_visual is deprecated and should not be used in newly-written code. |
Deprecated equivalent of gdk_drawable_get_visual().
gdk_window_get_colormap
#define gdk_window_get_colormap gdk_drawable_get_colormap |
Warning |
gdk_window_get_colormap is deprecated and should not be used in newly-written code. |
Deprecated equivalent of gdk_drawable_get_colormap().
gdk_window_get_type
#define gdk_window_get_type gdk_window_get_window_type |
Warning |
gdk_window_get_type is deprecated and should not be used in newly-written code. |
Deprecated equivalent of gdk_drawable_get_type().
gdk_window_get_deskrelative_origin ()
Warning |
gdk_window_get_deskrelative_origin is deprecated and should not be used in newly-written code. |
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.
gdk_window_get_pointer ()
Obtains the current pointer position and modifier state.
The position is given in coordinates relative to window.
enum GdkModifierType
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 << 30,
GDK_MODIFIER_MASK = GDK_RELEASE_MASK | 0x1fff
} GdkModifierType; |
A set of bit-flags to indicate the state of modifier keys and mouse buttons
in various event types. Typical modifier keys are Shift, Control, Meta, Super,
Hyper, Alt, Compose, Apple, CapsLock or ShiftLock.
Like the X Window System, GDK supports 8 modifier keys and 5 mouse buttons.
gdk_window_get_parent ()
Obtains the parent of window, as known to GDK. Does not query the
X server; thus this returns the parent as passed to gdk_window_new(),
not the actual parent. This should never matter unless you're using
Xlib calls mixed with GDK calls on the X11 platform. It may also
matter for toplevel windows, because the window manager may choose
to reparent them.
gdk_window_get_toplevel ()
Gets the toplevel window that's an ancestor of window.
gdk_window_get_children ()
Gets the list of children of window known to GDK.
This function only returns children created via GDK,
so for example it's useless when used with the root window;
it only returns windows an application created itself.
The returned list must be freed, but the elements in the
list need not be.
gdk_window_peek_children ()
Like gdk_window_get_children(), but does not copy the list of
children, so the list does not need to be freed.
gdk_window_set_events ()
The event mask for a window determines which events will be reported
for that window. For example, an event mask including GDK_BUTTON_PRESS_MASK
means the window should report button press events. The event mask
is the bitwise OR of values from the GdkEventMask enumeration.
gdk_window_set_icon ()
Sets the icon of window as a pixmap or window. If using GTK+, investigate
gtk_window_set_default_icon_list() first, and then gtk_window_set_icon_list()
and gtk_window_set_icon(). If those don't meet your needs, look at
gdk_window_set_icon_list(). Only if all those are too high-level do you
want to fall back to gdk_window_set_icon().
gdk_window_set_icon_name ()
Windows may have a name used while minimized, distinct from the
name they display in their titlebar. Most of the time this is a bad
idea from a user interface standpoint. But you can set such a name
with this function, if you like.
gdk_window_set_transient_for ()
Indicates to the window manager that window is a transient dialog
associated with the application window parent. This allows the
window manager to do things like center window on parent and
keep window above parent.
See gtk_window_set_transient_for() if you're using GtkWindow or
GtkDialog.
gdk_window_set_role ()
When using GTK+, typically you should use gtk_window_set_role() instead
of this low-level function.
The window manager and session manager use a window's role to
distinguish it from other kinds of window in the same application.
When an application is restarted after being saved in a previous
session, all windows with the same title and role are treated as
interchangeable. So if you have two windows with the same title
that should be distinguished for session management purposes, you
should set the role on those windows. It doesn't matter what string
you use for the role, as long as you have a different role for each
non-interchangeable kind of window.
gdk_window_set_group ()
Sets the group leader window for window. By default,
GDK sets the group leader for all toplevel windows
to a global window implicitly created by GDK. With this function
you can override this default.
The group leader window allows the window manager to distinguish
all windows that belong to a single application. It may for example
allow users to minimize/unminimize all windows belonging to an
application at once. You should only set a non-default group window
if your application pretends to be multiple applications.
The group leader window may not be changed after a window has been
mapped (with gdk_window_show() for example).
gdk_window_set_decorations ()
"Decorations" are the features the window manager adds to a toplevel GdkWindow.
This function sets the traditional Motif window manager hints that tell the
window manager which decorations you would like your window to have.
Usually you should use gtk_window_set_decorated() on a GtkWindow instead of
using the GDK function directly.
The decorations argument is the logical OR of the fields in
the GdkWMDecoration enumeration. If GDK_DECOR_ALL is included in the
mask, the other bits indicate which decorations should be turned off.
If GDK_DECOR_ALL is not included, then the other bits indicate
which decorations should be turned on.
Most window managers honor a decorations hint of 0 to disable all decorations,
but very few honor all possible combinations of bits.
enum GdkWMDecoration
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; |
These are hints originally defined by the Motif toolkit.
The window manager can use them when determining how to decorate
the window. The hint must be set before mapping the window.
gdk_window_set_functions ()
This function isn't really good for much. It sets the traditional
Motif window manager hint for which operations the window manager
should allow on a toplevel window. However, few window managers do
anything reliable or interesting with this hint. Many ignore it
entirely.
The functions argument is the logical OR of values from the
GdkWMFunction enumeration. If the bitmask includes GDK_FUNC_ALL,
then the other bits indicate which functions to disable; if
it doesn't include GDK_FUNC_ALL, it indicates which functions to
enable.
enum GdkWMFunction
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; |
These are hints originally defined by the Motif toolkit.
The window manager can use them when determining the functions
to offer for the window.
The hint must be set before mapping the window.
gdk_window_get_toplevels ()
GList* gdk_window_get_toplevels (void); |
Obtains a list of all toplevel windows known to GDK.
A toplevel window is a child of the root window (see
gdk_get_default_root_window()).
The returned list should be freed with g_list_free(), but
its elements need not be freed.
gdk_get_default_root_window ()
GdkWindow* gdk_get_default_root_window (void); |
Obtains the root window (parent all other windows are inside)
for the default display and screen.
struct GdkPointerHooks
struct GdkPointerHooks
{
GdkWindow* (*get_pointer) (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask);
GdkWindow* (*window_at_pointer) (GdkScreen *screen, /* unused for now*/
gint *win_x,
gint *win_y);
}; |
A table of pointers to functions for getting quantities related to
the current pointer position. GDK has one global table of this type,
which can be set using gdk_set_pointer_hooks().
This is only useful for such low-level tools as an event recorder.
Applications should never have any reason to use this facility
gdk_set_pointer_hooks ()
This function allows for hooking into the operation
of getting the current location of the pointer. This
is only useful for such low-level tools as an
event recorder. Applications should never have any
reason to use this facility