Gdk.Window¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
Virtual Methods¶
- Inherited:
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
Cursor |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The |
|
The |
|
Emitted when the position of window is finalized after being moved to a destination rectangle. |
|
The |
|
The |
Fields¶
- Inherited:
Class Details¶
- class Gdk.Window(parent, attributes, attributes_mask)¶
- Bases:
- Abstract:
Yes
- Structure:
- classmethod at_pointer()[source]¶
- Returns:
window under the mouse pointer
- win_x:
return location for origin of the window under the pointer
- win_y:
return location for origin of the window under the pointer
- Return type:
(
Gdk.Window
, win_x:int
, win_y:int
)
Obtains the window underneath the mouse pointer, returning the location of that window in win_x, win_y. Returns
None
if the window under the mouse pointer is not known to GDK (if the window belongs to another application and aGdk.Window
hasn’t been created for it with gdk_window_foreign_new())NOTE: For multihead-aware widgets or applications use
Gdk.Display.get_window_at_pointer
() instead.Deprecated since version 3.0: Use
Gdk.Device.get_window_at_position
() instead.
- classmethod constrain_size(geometry, flags, width, height)[source]¶
- Parameters:
geometry (
Gdk.Geometry
) – aGdk.Geometry
structureflags (
Gdk.WindowHints
) – a mask indicating what portions of geometry are setwidth (
int
) – desired width of windowheight (
int
) – desired height of the window
- Returns:
- new_width:
location to store resulting width
- new_height:
location to store resulting height
- Return type:
Constrains a desired width and height according to a set of geometry hints (such as minimum and maximum size).
- classmethod new(parent, attributes, attributes_mask)[source]¶
- Parameters:
parent (
Gdk.Window
orNone
) – aGdk.Window
, orNone
to create the window as a child of the default root window for the default display.attributes (
Gdk.WindowAttr
) – attributes of the new windowattributes_mask (
Gdk.WindowAttributesType
) – mask indicating which fields in attributes are valid
- Returns:
the new
Gdk.Window
- Return type:
Creates a new
Gdk.Window
using the attributes from attributes. SeeGdk.WindowAttr
andGdk.WindowAttributesType
for more details. Note: to use this on displays other than the default display, parent must be specified.
- classmethod process_all_updates()[source]¶
Calls
Gdk.Window.process_updates
() for all windows (seeGdk.Window
) in the application.Deprecated since version 3.22.
- classmethod set_debug_updates(setting)[source]¶
-
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 duringGdk.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.Deprecated since version 3.22.
- beep()[source]¶
Emits a short beep associated to self in the appropriate display, if supported. Otherwise, emits a short beep on the display just as
Gdk.Display.beep
().New in version 2.12.
- begin_draw_frame(region)[source]¶
- Parameters:
region (
cairo.Region
) – a Cairo region- Returns:
a
Gdk.DrawingContext
context that should be used to draw the contents of the window; the returned context is owned by GDK.- Return type:
Indicates that you are beginning the process of redrawing region on self, and provides you with a
Gdk.DrawingContext
.If self is a top level
Gdk.Window
, backed by a native window implementation, 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 surface for self. Then, all drawing operations performed on self will be diverted to the backing store. When you call gdk_window_end_frame(), the contents of the backing store will be copied to self, making it visible on screen. Only the part of self 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_draw_frame
(). If you draw to self directly without callingGdk.Window.begin_draw_frame
(), the user may see flicker as individual drawing operations are performed in sequence.When using GTK+, the widget system automatically places calls to
Gdk.Window.begin_draw_frame
() andGdk.Window.end_draw_frame
() around emissions of theGtkWidget::draw
signal. That is, if you’re drawing the contents of the widget yourself, you can assume that the widget has a cleared background, is already set as the clip region, and already has a backing store. Therefore in most cases, application code in GTK does not need to callGdk.Window.begin_draw_frame
() explicitly.New in version 3.22.
- begin_move_drag(button, root_x, root_y, timestamp)[source]¶
- Parameters:
Begins a window move operation (for a toplevel window).
This function assumes that the drag is controlled by the client pointer device, use
Gdk.Window.begin_move_drag_for_device
() to begin a drag with a different device.
- begin_move_drag_for_device(device, button, root_x, root_y, timestamp)[source]¶
- Parameters:
device (
Gdk.Device
) – the device used for the operationbutton (
int
) – the button being used to drag, or 0 for a keyboard-initiated dragroot_x (
int
) – root window X coordinate of mouse click that began the dragroot_y (
int
) – root window Y coordinate of mouse click that began the dragtimestamp (
int
) – timestamp of mouse click that began the 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 but has a fallback implementation for other window managers.
New in version 3.4.
- begin_paint_rect(rectangle)[source]¶
- Parameters:
rectangle (
Gdk.Rectangle
) – rectangle you intend to draw to
A convenience wrapper around
Gdk.Window.begin_paint_region
() which creates a rectangular region for you. SeeGdk.Window.begin_paint_region
() for details.Deprecated since version 3.22: Use
Gdk.Window.begin_draw_frame
() instead
- begin_paint_region(region)[source]¶
- Parameters:
region (
cairo.Region
) – region you intend to draw to
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 surface for self. Then, all drawing operations performed on self will be diverted to the backing store. When you call
Gdk.Window.end_paint
(), the backing store will be copied to self, making it visible onscreen. Only the part of self 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 self directly without callingGdk.Window.begin_paint_region
(), the user may see flicker as individual drawing operations are performed in sequence. The clipping and background-initializing features ofGdk.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
() andGdk.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 inGdk.EventExpose
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 callGdk.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 toGdk.Window.end_paint
() is required for each call toGdk.Window.begin_paint_region
().Deprecated since version 3.22: Use
Gdk.Window.begin_draw_frame
() instead
- begin_resize_drag(edge, button, root_x, root_y, timestamp)[source]¶
- Parameters:
edge (
Gdk.WindowEdge
) – the edge or corner from which the drag is startedbutton (
int
) – the button being used to drag, or 0 for a keyboard-initiated dragroot_x (
int
) – root window X coordinate of mouse click that began the dragroot_y (
int
) – root window Y coordinate of mouse click that began the dragtimestamp (
int
) – timestamp of mouse click that began the drag (useGdk.Event.get_time
())
Begins a window resize operation (for a toplevel window).
This function assumes that the drag is controlled by the client pointer device, use
Gdk.Window.begin_resize_drag_for_device
() to begin a drag with a different device.
- begin_resize_drag_for_device(edge, device, button, root_x, root_y, timestamp)[source]¶
- Parameters:
edge (
Gdk.WindowEdge
) – the edge or corner from which the drag is starteddevice (
Gdk.Device
) – the device used for the operationbutton (
int
) – the button being used to drag, or 0 for a keyboard-initiated dragroot_x (
int
) – root window X coordinate of mouse click that began the dragroot_y (
int
) – root window Y coordinate of mouse click that began the dragtimestamp (
int
) – timestamp of mouse click that began the drag (useGdk.Event.get_time
())
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 but has a fallback implementation for other window managers.
New in version 3.4.
- cairo_create()¶
- configure_finished()[source]¶
Does nothing, present only for compatiblity.
New in version 2.6.
Deprecated since version 3.8: this function is no longer needed
- coords_from_parent(parent_x, parent_y)[source]¶
- Parameters:
- Returns:
- x:
return location for X coordinate in child’s coordinate system
- y:
return location for Y coordinate in child’s coordinate system
- Return type:
Transforms window coordinates from a parent window to a child window, where the parent window is the normal parent as returned by
Gdk.Window.get_parent
() for normal windows, and the window’s embedder as returned byGdk.offscreen_window_get_embedder
() for offscreen windows.For normal windows, calling this function is equivalent to subtracting the return values of
Gdk.Window.get_position
() from the parent coordinates. For offscreen windows however (which can be arbitrarily transformed), this function calls theGdk.Window
::from-embedder
: signal to translate the coordinates.You should always use this function when writing generic code that walks down a window hierarchy.
See also:
Gdk.Window.coords_to_parent
()New in version 2.22.
- coords_to_parent(x, y)[source]¶
- Parameters:
- Returns:
- Return type:
Transforms window coordinates from a child window to its parent window, where the parent window is the normal parent as returned by
Gdk.Window.get_parent
() for normal windows, and the window’s embedder as returned byGdk.offscreen_window_get_embedder
() for offscreen windows.For normal windows, calling this function is equivalent to adding the return values of
Gdk.Window.get_position
() to the child coordinates. For offscreen windows however (which can be arbitrarily transformed), this function calls theGdk.Window
::to-embedder
: signal to translate the coordinates.You should always use this function when writing generic code that walks up a window hierarchy.
See also:
Gdk.Window.coords_from_parent
()New in version 2.22.
- create_gl_context()[source]¶
- Raises:
- Returns:
the newly created
Gdk.GLContext
, orNone
on error- Return type:
Creates a new
Gdk.GLContext
matching the framebuffer format to the visual of theGdk.Window
. The context is disconnected from any particular window or surface.If the creation of the
Gdk.GLContext
failed, error will be set.Before using the returned
Gdk.GLContext
, you will need to callGdk.GLContext.make_current
() orGdk.GLContext.realize
().New in version 3.16.
- create_similar_image_surface(format, width, height, scale)[source]¶
- Parameters:
format (
cairo.Format
) – the format for the new surfacewidth (
int
) – width of the new surfaceheight (
int
) – height of the new surfacescale (
int
) – the scale of the new surface, or 0 to use same as self
- Returns:
a pointer to the newly allocated surface. The caller owns the surface and should call cairo_surface_destroy() when done with it.
This function always returns a valid pointer, but it will return a pointer to a “nil” surface if other is already in an error state or any other error occurs.
- Return type:
Create a new image surface that is efficient to draw on the given self.
Initially the surface contents are all 0 (transparent if contents have transparency, black otherwise.)
The width and height of the new surface are not affected by the scaling factor of the self, or by the scale argument; they are the size of the surface in device pixels. If you wish to create an image surface capable of holding the contents of self you can use:
int scale = gdk_window_get_scale_factor (window); int width = gdk_window_get_width (window) * scale; int height = gdk_window_get_height (window) * scale; // format is set elsewhere cairo_surface_t *surface = gdk_window_create_similar_image_surface (window, format, width, height, scale);
Note that unlike
cairo.Surface.create_similar_image
(), the new surface’s device scale is set to scale, or to the scale factor of self if scale is 0.New in version 3.10.
- create_similar_surface(content, width, height)[source]¶
- Parameters:
content (
cairo.Content
) – the content for the new surfacewidth (
int
) – width of the new surfaceheight (
int
) – height of the new surface
- Returns:
a pointer to the newly allocated surface. The caller owns the surface and should call cairo_surface_destroy() when done with it.
This function always returns a valid pointer, but it will return a pointer to a “nil” surface if other is already in an error state or any other error occurs.
- Return type:
Create a new surface that is as compatible as possible with the given self. For example the new surface will have the same fallback resolution and font options as self. Generally, the new surface will also use the same backend as self, unless that is not possible for some reason. The type of the returned surface may be examined with cairo_surface_get_type().
Initially the surface contents are all 0 (transparent if contents have transparency, black otherwise.)
New in version 2.22.
- deiconify()[source]¶
Attempt to deiconify (unminimize) self. On X11 the window manager may choose to ignore the request to deiconify. When using GTK+, use gtk_window_deiconify() instead of the
Gdk.Window
variant. Or better yet, you probably want to use gtk_window_present_with_time(), which raises the window, focuses it, unminimizes it, and puts it on the current desktop.
- destroy()[source]¶
Destroys the window system resources associated with self and decrements self's reference count. The window system resources for all children of self 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.
- enable_synchronized_configure()[source]¶
Does nothing, present only for compatiblity.
New in version 2.6.
Deprecated since version 3.8: this function is no longer needed
- end_draw_frame(context)[source]¶
- Parameters:
context (
Gdk.DrawingContext
) – theGdk.DrawingContext
created byGdk.Window.begin_draw_frame
()
Indicates that the drawing of the contents of self started with gdk_window_begin_frame() has been completed.
This function will take care of destroying the
Gdk.DrawingContext
.It is an error to call this function without a matching gdk_window_begin_frame() first.
New in version 3.22.
- end_paint()[source]¶
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. SeeGdk.Window.begin_paint_region
() for full details.It is an error to call this function without a matching
Gdk.Window.begin_paint_region
() first.
- ensure_native()[source]¶
-
Tries to ensure that there is a window-system native window for this
Gdk.Window
. This may fail in some situations, returningFalse
.Offscreen window and children of them can never have native windows.
Some backends may not support native child windows.
New in version 2.18.
- focus(timestamp)[source]¶
- Parameters:
timestamp (
int
) – timestamp of the event triggering the window focus
Sets keyboard focus to self. In most cases, gtk_window_present_with_time() should be used on a #GtkWindow, rather than calling this function.
- freeze_toplevel_updates_libgtk_only()[source]¶
Temporarily freezes a window and all its descendants such that it won’t receive expose events. The window will begin receiving expose events again when
Gdk.Window.thaw_toplevel_updates_libgtk_only
() is called. IfGdk.Window.freeze_toplevel_updates_libgtk_only
() has been called more than once,Gdk.Window.thaw_toplevel_updates_libgtk_only
() must be called an equal number of times to begin processing exposes.This function is not part of the GDK public API and is only for use by GTK+.
Deprecated since version 3.16: This symbol was never meant to be used outside of GTK+
- freeze_updates()[source]¶
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. IfGdk.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.
- fullscreen()[source]¶
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 self 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.
New in version 2.2.
- fullscreen_on_monitor(monitor)[source]¶
- Parameters:
monitor (
int
) – Which monitor to display fullscreen on.
Moves the window into fullscreen mode on the given monitor. 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.
- geometry_changed()[source]¶
This function informs GDK that the geometry of an embedded offscreen window has changed. This is necessary for GDK to keep track of which offscreen window the pointer is in.
New in version 2.18.
- get_accept_focus()[source]¶
- Returns:
whether or not the window should receive input focus.
- Return type:
Determines whether or not the desktop environment shuld be hinted that the window does not want to receive input focus.
New in version 2.22.
- get_background_pattern()[source]¶
- Returns:
The pattern to use for the background or
None
if there is no background.- Return type:
Gets the pattern used to clear the background on self.
New in version 2.22.
Deprecated since version 3.22: Don’t use this function
- get_children()[source]¶
- Returns:
list of child windows inside self
- Return type:
Gets the list of children of self 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.
- get_children_with_user_data(user_data)[source]¶
- Parameters:
- Returns:
list of child windows inside self
- Return type:
Gets the list of children of self known to GDK with a particular user_data set on it.
The returned list must be freed, but the elements in the list need not be.
The list is returned in (relative) stacking order, i.e. the lowest window is first.
New in version 3.10.
- get_clip_region()[source]¶
- Returns:
a
cairo.Region
. This must be freed with cairo_region_destroy() when you are done.- Return type:
Computes the region of a window that potentially can be written to by drawing primitives. This region may not take into account other factors such as if the window is obscured by other windows, but no area outside of this region will be affected by drawing primitives.
- get_composited()[source]¶
-
Determines whether self is composited.
See
Gdk.Window.set_composited
().New in version 2.22.
Deprecated since version 3.16: Compositing is an outdated technology that only ever worked on X11.
- get_cursor()[source]¶
- Returns:
a
Gdk.Cursor
, orNone
. The returned object is owned by theGdk.Window
and should not be unreferenced directly. UseGdk.Window.set_cursor
() to unset the cursor of the window- Return type:
Gdk.Cursor
orNone
Retrieves a
Gdk.Cursor
pointer for the cursor currently set on the specifiedGdk.Window
, orNone
. If the return value isNone
then there is no custom cursor set on the specified window, and it is using the cursor for its parent window.New in version 2.18.
- get_decorations()[source]¶
- Returns:
True
if the window has decorations set,False
otherwise.- decorations:
The window decorations will be written here
- Return type:
(
bool
, decorations:Gdk.WMDecoration
)
Returns the decorations set on the
Gdk.Window
withGdk.Window.set_decorations
().
- get_device_cursor(device)[source]¶
- Parameters:
device (
Gdk.Device
) – a master, pointerGdk.Device
.- Returns:
a
Gdk.Cursor
, orNone
. The returned object is owned by theGdk.Window
and should not be unreferenced directly. UseGdk.Window.set_cursor
() to unset the cursor of the window- Return type:
Gdk.Cursor
orNone
Retrieves a
Gdk.Cursor
pointer for the device currently set on the specifiedGdk.Window
, orNone
. If the return value isNone
then there is no custom cursor set on the specified window, and it is using the cursor for its parent window.New in version 3.0.
- get_device_events(device)[source]¶
- Parameters:
device (
Gdk.Device
) – aGdk.Device
.- Returns:
device event mask for self
- Return type:
Returns the event mask for self corresponding to an specific device.
New in version 3.0.
- get_device_position(device)[source]¶
- Parameters:
device (
Gdk.Device
) – pointerGdk.Device
to query to.- Returns:
The window underneath device (as with
Gdk.Device.get_window_at_position
()), orNone
if the window is not known to GDK.- Return type:
(
Gdk.Window
orNone
, x:int
, y:int
, mask:Gdk.ModifierType
)
Obtains the current device position and modifier state. The position is given in coordinates relative to the upper left corner of self.
Use
Gdk.Window.get_device_position_double
() if you need subpixel precision.New in version 3.0.
- get_device_position_double(device)[source]¶
- Parameters:
device (
Gdk.Device
) – pointerGdk.Device
to query to.- Returns:
The window underneath device (as with
Gdk.Device.get_window_at_position
()), orNone
if the window is not known to GDK.- Return type:
(
Gdk.Window
orNone
, x:float
, y:float
, mask:Gdk.ModifierType
)
Obtains the current device position in doubles and modifier state. The position is given in coordinates relative to the upper left corner of self.
New in version 3.10.
- get_display()[source]¶
- Returns:
the
Gdk.Display
associated with self- Return type:
Gets the
Gdk.Display
associated with aGdk.Window
.New in version 2.24.
- get_drag_protocol()[source]¶
- Returns:
the supported DND protocol.
- target:
location of the window where the drop should happen. This may be self or a proxy window, or
None
if self does not support Drag and Drop.
- Return type:
(
Gdk.DragProtocol
, target:Gdk.Window
)
Finds out the DND protocol supported by a window.
New in version 3.0.
- get_effective_parent()[source]¶
- Returns:
effective parent of self
- Return type:
Obtains the parent of self, as known to GDK. Works like
Gdk.Window.get_parent
() for normal windows, but returns the window’s embedder for offscreen windows.See also:
Gdk.offscreen_window_get_embedder
()New in version 2.22.
- get_effective_toplevel()[source]¶
- Returns:
the effective toplevel window containing self
- Return type:
Gets the toplevel window that’s an ancestor of self.
Works like
Gdk.Window.get_toplevel
(), but treats an offscreen window’s embedder as its parent, usingGdk.Window.get_effective_parent
().See also:
Gdk.offscreen_window_get_embedder
()New in version 2.22.
- get_event_compression()[source]¶
-
Get the current event compression setting for this window.
New in version 3.12.
- get_events()[source]¶
- Returns:
event mask for self
- Return type:
Gets the event mask for self for all master input devices. See
Gdk.Window.set_events
().
- get_focus_on_map()[source]¶
- Returns:
whether or not the window wants to receive input focus when it is mapped.
- Return type:
Determines whether or not the desktop environment should be hinted that the window does not want to receive input focus when it is mapped.
New in version 2.22.
- get_frame_clock()[source]¶
- Returns:
the frame clock
- Return type:
Gets the frame clock for the window. The frame clock for a window never changes unless the window is reparented to a new toplevel window.
New in version 3.8.
- get_frame_extents()[source]¶
- Returns:
rectangle to fill with bounding box of the window frame
- Return type:
rect:
Gdk.Rectangle
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
().
- get_fullscreen_mode()[source]¶
- Returns:
The
Gdk.FullscreenMode
applied to the window when fullscreen.- Return type:
Obtains the
Gdk.FullscreenMode
of the self.New in version 3.8.
- get_geometry()[source]¶
- Returns:
- x:
return location for X coordinate of window (relative to its parent)
- y:
return location for Y coordinate of window (relative to its parent)
- width:
return location for width of window
- height:
return location for height of window
- Return type:
Any of the return location arguments to this function may be
None
, 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 self, 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 self; this may be out-of-sync with the position of self delivered in the most-recently-processed
Gdk.EventConfigure
.Gdk.Window.get_position
() in contrast gets the position from the most recent configure event.Note: If self is not a toplevel, it is much better to call
Gdk.Window.get_position
(),Gdk.Window.get_width
() andGdk.Window.get_height
() instead, because it avoids the roundtrip to the X server and because these functions support the full 32-bit coordinate space, whereasGdk.Window.get_geometry
() is restricted to the 16-bit coordinates of X11.
- get_group()[source]¶
- Returns:
the group leader window for self
- Return type:
Returns the group leader window for self. See
Gdk.Window.set_group
().New in version 2.4.
- get_height()[source]¶
- Returns:
The height of self
- Return type:
Returns the height of the given self.
On the X11 platform the returned size is the size reported in the most-recently-processed configure event, rather than the current size on the X server.
New in version 2.24.
- get_modal_hint()[source]¶
- Returns:
whether or not the window has the modal hint set.
- Return type:
Determines whether or not the window manager is hinted that self has modal behaviour.
New in version 2.22.
- get_origin()[source]¶
- Returns:
not meaningful, ignore
- x:
return location for X coordinate
- y:
return location for Y coordinate
- Return type:
Obtains the position of a window in root window coordinates. (Compare with
Gdk.Window.get_position
() andGdk.Window.get_geometry
() which return the position of a window relative to its parent window.)
- get_parent()[source]¶
- Returns:
parent of self
- Return type:
Obtains the parent of self, 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.Note that you should use
Gdk.Window.get_effective_parent
() when writing generic code that walks up a window hierarchy, becauseGdk.Window.get_parent
() will most likely not do what you expect if there are offscreen windows in the hierarchy.
- get_pass_through()[source]¶
- Return type:
Returns whether input to the window is passed through to the window below.
See
Gdk.Window.set_pass_through
() for detailsNew in version 3.18.
- get_pointer()[source]¶
- Returns:
the window containing the pointer (as with
Gdk.Window.at_pointer
()), orNone
if the window containing the pointer isn’t known to GDK- Return type:
(
Gdk.Window
orNone
, x:int
, y:int
, mask:Gdk.ModifierType
)
Obtains the current pointer position and modifier state. The position is given in coordinates relative to the upper left corner of self.
Deprecated since version 3.0: Use
Gdk.Window.get_device_position
() instead.
- get_position()[source]¶
-
Obtains the position of the window as reported in the most-recently-processed
Gdk.EventConfigure
. Contrast withGdk.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.
- get_root_coords(x, y)[source]¶
- Parameters:
- Returns:
- root_x:
return location for X coordinate
- root_y:
return location for Y coordinate
- Return type:
Obtains the position of a window position in root window coordinates. This is similar to
Gdk.Window.get_origin
() but allows you to pass in any position in the window, not just the origin.New in version 2.18.
- get_root_origin()[source]¶
- Returns:
- x:
return location for X position of window frame
- y:
return location for Y position of window frame
- Return type:
Obtains the top-left corner of the window manager frame in root window coordinates.
- get_scale_factor()[source]¶
- Returns:
the scale factor
- Return type:
Returns the internal scale factor that maps from window coordiantes to the actual device pixels. On traditional systems this is 1, but on very high density outputs this can be a higher value (often 2).
A higher value means that drawing is automatically scaled up to a higher resolution, so any code doing drawing will automatically look nicer. However, if you are supplying pixel-based data the scale value can be used to determine whether to use a pixel resource with higher resolution data.
The scale of a window may change during runtime, if this happens a configure event will be sent to the toplevel window.
New in version 3.10.
- get_screen()[source]¶
- Returns:
the
Gdk.Screen
associated with self- Return type:
Gets the
Gdk.Screen
associated with aGdk.Window
.New in version 2.24.
- get_source_events(source)[source]¶
- Parameters:
source (
Gdk.InputSource
) – aGdk.InputSource
to define the source class.- Returns:
source event mask for self
- Return type:
Returns the event mask for self corresponding to the device class specified by source.
- get_state()[source]¶
- Returns:
window state bitfield
- Return type:
Gets the bitwise OR of the currently active window state flags, from the
Gdk.WindowState
enumeration.
- get_support_multidevice()[source]¶
-
Returns
True
if the window is aware of the existence of multiple devices.New in version 3.0.
- get_toplevel()[source]¶
- Returns:
the toplevel window containing self
- Return type:
Gets the toplevel window that’s an ancestor of self.
Any window type but
Gdk.WindowType.CHILD
is considered a toplevel window, as is aGdk.WindowType.CHILD
window that has a root window as parent.Note that you should use
Gdk.Window.get_effective_toplevel
() when you want to get to a window’s toplevel as seen on screen, becauseGdk.Window.get_toplevel
() will most likely not do what you expect if there are offscreen windows in the hierarchy.
- get_type_hint()[source]¶
- Returns:
The type hint set for self
- Return type:
This function returns the type hint set for a window.
New in version 2.10.
- get_update_area()[source]¶
- Returns:
the update area for self
- Return type:
Transfers ownership of the update area from self to the caller of the function. That is, after calling this function, self will no longer have an invalid/dirty region; the update area is removed from self and handed to you. If a window has no update area,
Gdk.Window.get_update_area
() returnsNone
. You are responsible for calling cairo_region_destroy() on the returned region if it’s non-None
.
- get_user_data()[source]¶
- Returns:
return location for user data
- Return type:
data:
object
Retrieves the user data for self, which is normally the widget that self belongs to. See
Gdk.Window.set_user_data
().
- get_visible_region()[source]¶
- Returns:
a
cairo.Region
. This must be freed with cairo_region_destroy() when you are done.- Return type:
Computes the region of the self that is potentially visible. This does not necessarily take into account if the window is obscured by other windows, but no area outside of this region is visible.
- get_visual()[source]¶
- Returns:
- Return type:
Gets the
Gdk.Visual
describing the pixel format of self.New in version 2.24.
- get_width()[source]¶
- Returns:
The width of self
- Return type:
Returns the width of the given self.
On the X11 platform the returned size is the size reported in the most-recently-processed configure event, rather than the current size on the X server.
New in version 2.24.
- get_window_type()[source]¶
- Returns:
type of window
- Return type:
Gets the type of the window. See
Gdk.WindowType
.
- has_native()[source]¶
-
Checks whether the window has a native window or not. Note that you can use
Gdk.Window.ensure_native
() if a native window is needed.New in version 2.22.
- hide()[source]¶
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().
- iconify()[source]¶
Asks to iconify (minimize) self. 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.
This function only makes sense when self is a toplevel window.
- input_shape_combine_region(shape_region, offset_x, offset_y)[source]¶
- Parameters:
shape_region (
cairo.Region
) – region of window to be non-transparentoffset_x (
int
) – X position of shape_region in self coordinatesoffset_y (
int
) – Y position of shape_region in self coordinates
Like
Gdk.Window.shape_combine_region
(), but the shape applies only to event handling. Mouse events which happen while the pointer position corresponds to an unset bit in the mask will be passed on the window below self.An input shape is typically used with RGBA windows. The alpha channel of the window defines which pixels are invisible and allows for nicely antialiased borders, and the input shape controls where the window is “clickable”.
On the X11 platform, this requires version 1.1 of the shape extension.
On the Win32 platform, this functionality is not present and the function does nothing.
New in version 2.10.
- invalidate_maybe_recurse(region, child_func, *user_data)[source]¶
- Parameters:
region (
cairo.Region
) – acairo.Region
child_func (
Gdk.WindowChildFunc
orNone
) – function to use to decide if to recurse to a child,None
means never recurse.
Adds region to the update area for self. 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 self 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.
- invalidate_rect(rect, invalidate_children)[source]¶
- Parameters:
rect (
Gdk.Rectangle
orNone
) – rectangle to invalidate orNone
to invalidate the whole windowinvalidate_children (
bool
) – whether to also invalidate child windows
A convenience wrapper around
Gdk.Window.invalidate_region
() which invalidates a rectangular region. SeeGdk.Window.invalidate_region
() for details.
- invalidate_region(region, invalidate_children)[source]¶
- Parameters:
region (
cairo.Region
) – acairo.Region
invalidate_children (
bool
) –True
to also invalidate child windows
Adds region to the update area for self. 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 self 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. SeeGdk.Window.invalidate_maybe_recurse
if you need fine grained control over which children are invalidated.
- is_input_only()[source]¶
-
Determines whether or not the window is an input only window.
New in version 2.22.
- is_viewable()[source]¶
-
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.)
- is_visible()[source]¶
-
Checks whether the window has been mapped (with
Gdk.Window.show
() orGdk.Window.show_unraised
()).
- lower()[source]¶
Lowers self to the bottom of the Z-order (stacking order), so that other windows with the same parent window appear above self. This is true whether or not the other windows are visible.
If self 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 beforeGdk.Window.show
(). (TryGdk.Window.show_unraised
().)
- mark_paint_from_clip(cr)[source]¶
- Parameters:
cr (
cairo.Context
) – acairo.Context
If you call this during a paint (e.g. between
Gdk.Window.begin_paint_region
() andGdk.Window.end_paint
() then GDK will mark the current clip region of the window as being drawn. This is required when mixing GL rendering viaGdk.cairo_draw_from_gl
() and cairo rendering, as otherwise GDK has no way of knowing when something paints over the GL-drawn regions.This is typically called automatically by GTK+ and you don’t need to care about this.
New in version 3.16.
- maximize()[source]¶
Maximizes the window. If the window was already maximized, then this function does nothing.
On X11, asks the window manager to maximize self, 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.
- merge_child_input_shapes()[source]¶
Merges the input shape masks for any child windows into the input shape mask for self. i.e. the union of all input masks for self and its children will become the new input mask for self. See
Gdk.Window.input_shape_combine_region
().This function is distinct from
Gdk.Window.set_child_input_shapes
() because it includes self’s input shape mask in the set of shapes to be merged.New in version 2.10.
- merge_child_shapes()[source]¶
Merges the shape masks for any child windows into the shape mask for self. i.e. the union of all masks for self and its children will become the new mask for self. See
Gdk.Window.shape_combine_region
().This function is distinct from
Gdk.Window.set_child_shapes
() because it includes self’s shape mask in the set of shapes to be merged.
- move(x, y)[source]¶
- Parameters:
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.
- move_region(region, dx, dy)[source]¶
- Parameters:
region (
cairo.Region
) – Thecairo.Region
to movedx (
int
) – Amount to move in the X directiondy (
int
) – Amount to move in the Y direction
Move the part of self indicated by region by dy pixels in the Y direction and dx pixels in the X direction. The portions of region that not covered by the new position of region are invalidated.
Child windows are not moved.
New in version 2.8.
- move_resize(x, y, width, height)[source]¶
- Parameters:
Equivalent to calling
Gdk.Window.move
() andGdk.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 useGdk.Window.move_resize
().)
- move_to_rect(rect, rect_anchor, window_anchor, anchor_hints, rect_anchor_dx, rect_anchor_dy)[source]¶
- Parameters:
rect (
Gdk.Rectangle
) – the destinationGdk.Rectangle
to align self withrect_anchor (
Gdk.Gravity
) – the point on rect to align with self's anchor pointwindow_anchor (
Gdk.Gravity
) – the point on self to align with rect's anchor pointanchor_hints (
Gdk.AnchorHints
) – positioning hints to use when limited on spacerect_anchor_dx (
int
) – horizontal offset to shift self, i.e. rect's anchor pointrect_anchor_dy (
int
) – vertical offset to shift self, i.e. rect's anchor point
Moves self to rect, aligning their anchor points.
rect is relative to the top-left corner of the window that self is transient for. rect_anchor and window_anchor determine anchor points on rect and self to pin together. rect's anchor point can optionally be offset by rect_anchor_dx and rect_anchor_dy, which is equivalent to offsetting the position of self.
anchor_hints determines how self will be moved if the anchor points cause it to move off-screen. For example,
Gdk.AnchorHints.FLIP_X
will replaceGdk.Gravity.NORTH_WEST
withGdk.Gravity.NORTH_EAST
and vice versa if self extends beyond the left or right edges of the monitor.Connect to the
Gdk.Window
::moved-to-rect
signal to find out how it was actually positioned.New in version 3.24.
- peek_children()[source]¶
- Returns:
a reference to the list of child windows in self
- Return type:
Like
Gdk.Window.get_children
(), but does not copy the list of children, so the list does not need to be freed.
- process_updates(update_children)[source]¶
- Parameters:
update_children (
bool
) – whether to also process updates for child windows
Sends one or more expose events to self. The areas in each expose event will cover the entire update area for the window (see
Gdk.Window.invalidate_region
() for details). Normally GDK callsGdk.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.Deprecated since version 3.22.
- raise_()[source]¶
Raises self to the top of the Z-order (stacking order), so that other windows with the same parent window appear below self. This is true whether or not the windows are visible.
If self 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.
- reparent(new_parent, x, y)[source]¶
- Parameters:
new_parent (
Gdk.Window
) – new parent to move self intox (
int
) – X location inside the new parenty (
int
) – Y location inside the new parent
Reparents self into the given new_parent. The window being reparented will be unmapped as a side effect.
- resize(width, height)[source]¶
-
Resizes self; 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.
- restack(sibling, above)[source]¶
- Parameters:
sibling (
Gdk.Window
orNone
) – aGdk.Window
that is a sibling of self, orNone
above (
bool
) – a boolean
Changes the position of self in the Z-order (stacking order), so that it is above sibling (if above is
True
) or below sibling (if above isFalse
).If sibling is
None
, then this either raises (if above isTrue
) or lowers the window.If self is a toplevel, the window manager may choose to deny the request to move the window in the Z-order,
Gdk.Window.restack
() only requests the restack, does not guarantee it.New in version 2.18.
- scroll(dx, dy)[source]¶
- Parameters:
Scroll the contents of self, both pixels and children, by the given amount. self 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.
- set_accept_focus(accept_focus)[source]¶
-
Setting accept_focus to
False
hints the desktop environment that the window doesn’t want to receive input focus.On X, it is the responsibility of the window manager to interpret this hint. ICCCM-compliant window manager usually respect it.
New in version 2.4.
- set_background(color)[source]¶
-
Sets the background color of self.
However, when using GTK+, influence the background of a widget using a style class or CSS — if you’re an application — or with gtk_style_context_set_background() — if you’re implementing a custom widget.
Deprecated since version 3.4: Don’t use this function
- set_background_pattern(pattern)[source]¶
- Parameters:
pattern (
cairo.Pattern
orNone
) – a pattern to use, orNone
Sets the background of self.
A background of
None
means that the window won’t have any background. On the X11 backend it’s also possible to inherit the background from the parent window using gdk_x11_get_parent_relative_pattern().The windowing system will normally fill a window with its background when the window is obscured then exposed.
Deprecated since version 3.22: Don’t use this function
- set_background_rgba(rgba)[source]¶
-
Sets the background color of self.
See also
Gdk.Window.set_background_pattern
().Deprecated since version 3.22: Don’t use this function
- set_child_input_shapes()[source]¶
Sets the input shape mask of self to the union of input shape masks for all children of self, ignoring the input shape mask of self itself. Contrast with
Gdk.Window.merge_child_input_shapes
() which includes the input shape mask of self in the masks to be merged.New in version 2.10.
- set_child_shapes()[source]¶
Sets the shape mask of self to the union of shape masks for all children of self, ignoring the shape mask of self itself. Contrast with
Gdk.Window.merge_child_shapes
() which includes the shape mask of self in the masks to be merged.
- set_composited(composited)[source]¶
-
Sets a
Gdk.Window
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.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.New in version 2.12.
Deprecated since version 3.16: Compositing is an outdated technology that only ever worked on X11.
- set_cursor(cursor)[source]¶
- Parameters:
cursor (
Gdk.Cursor
orNone
) – a cursor
Sets the default mouse pointer for a
Gdk.Window
.Note that cursor must be for the same display as self.
Use
Gdk.Cursor.new_for_display
() orGdk.Cursor.new_from_pixbuf
() to create the cursor. To make the cursor invisible, useGdk.CursorType.BLANK_CURSOR
. PassingNone
for the cursor argument toGdk.Window.set_cursor
() means that self will use the cursor of its parent window. Most windows should use this default.
- set_decorations(decorations)[source]¶
- Parameters:
decorations (
Gdk.WMDecoration
) – decoration hint mask
“Decorations” are the features the window manager adds to a toplevel
Gdk.Window
. 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
Gdk.WMDecoration
enumeration. IfGdk.WMDecoration.ALL
is included in the mask, the other bits indicate which decorations should be turned off. IfGdk.WMDecoration.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.
- set_device_cursor(device, cursor)[source]¶
- Parameters:
device (
Gdk.Device
) – a master, pointerGdk.Device
cursor (
Gdk.Cursor
) – aGdk.Cursor
Sets a specific
Gdk.Cursor
for a given device when it gets inside self. UseGdk.Cursor.new_for_display
() orGdk.Cursor.new_from_pixbuf
() to create the cursor. To make the cursor invisible, useGdk.CursorType.BLANK_CURSOR
. PassingNone
for the cursor argument toGdk.Window.set_cursor
() means that self will use the cursor of its parent window. Most windows should use this default.New in version 3.0.
- set_device_events(device, event_mask)[source]¶
- Parameters:
device (
Gdk.Device
) –Gdk.Device
to enable events for.event_mask (
Gdk.EventMask
) – event mask for self
Sets the event mask for a given device (Normally a floating device, not attached to any visible pointer) to self. For example, an event mask including
Gdk.EventMask.BUTTON_PRESS_MASK
means the window should report button press events. The event mask is the bitwise OR of values from theGdk.EventMask
enumeration.See the ‘input handling overview [event-masks]’ for details.
New in version 3.0.
- set_event_compression(event_compression)[source]¶
-
Determines whether or not extra unprocessed motion events in the event queue can be discarded. If
True
only the most recent event will be delivered.Some types of applications, e.g. paint programs, need to see all motion events and will benefit from turning off event compression.
By default, event compression is enabled.
New in version 3.12.
- set_events(event_mask)[source]¶
- Parameters:
event_mask (
Gdk.EventMask
) – event mask for self
The event mask for a window determines which events will be reported for that window from all master input devices. For example, an event mask including
Gdk.EventMask.BUTTON_PRESS_MASK
means the window should report button press events. The event mask is the bitwise OR of values from theGdk.EventMask
enumeration.See the ‘input handling overview [event-masks]’ for details.
- set_focus_on_map(focus_on_map)[source]¶
-
Setting focus_on_map to
False
hints the desktop environment that the window doesn’t want to receive input focus when it is mapped. focus_on_map should be turned off for windows that aren’t triggered interactively (such as popups from network activity).On X, it is the responsibility of the window manager to interpret this hint. Window managers following the freedesktop.org window manager extension specification should respect it.
New in version 2.6.
- set_fullscreen_mode(mode)[source]¶
- Parameters:
mode (
Gdk.FullscreenMode
) – fullscreen mode
Specifies whether the self should span over all monitors (in a multi-head setup) or only the current monitor when in fullscreen mode.
The mode argument is from the
Gdk.FullscreenMode
enumeration. IfGdk.FullscreenMode.ALL_MONITORS
is specified, the fullscreen self will span over all monitors from theGdk.Screen
.On X11, searches through the list of monitors from the
Gdk.Screen
the ones which delimit the 4 edges of the entireGdk.Screen
and will ask the window manager to span the self over these monitors.If the XINERAMA extension is not available or not usable, this function has no effect.
Not all window managers support this, so you can’t rely on the fullscreen window to span over the multiple monitors when
Gdk.FullscreenMode.ALL_MONITORS
is specified.New in version 3.8.
- set_functions(functions)[source]¶
- Parameters:
functions (
Gdk.WMFunction
) – bitmask of operations to allow on self
Sets hints about the window management functions to make available via buttons on the window frame.
On the X backend, this function sets the traditional Motif window manager hint for this purpose. 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
Gdk.WMFunction
enumeration. If the bitmask includesGdk.WMFunction.ALL
, then the other bits indicate which functions to disable; if it doesn’t includeGdk.WMFunction.ALL
, it indicates which functions to enable.
- set_geometry_hints(geometry, geom_mask)[source]¶
- Parameters:
geometry (
Gdk.Geometry
) – geometry hintsgeom_mask (
Gdk.WindowHints
) – bitmask indicating fields of geometry to pay attention to
Sets the geometry hints for self. 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
None
.This function provides hints to the windowing system about acceptable sizes for a toplevel window. The purpose of this is to constrain user resizing, but the windowing system will typically (but is not required to) also constrain the current size of the window to the provided values and constrain programatic resizing via
Gdk.Window.resize
() orGdk.Window.move_resize
().Note that on X11, this effect has no effect on windows of type
Gdk.WindowType.TEMP
or windows where override redirect has been turned on viaGdk.Window.set_override_redirect
() since these windows are not resizable by the user.Since you can’t count on the windowing system doing the constraints for programmatic resizes, you should generally call
Gdk.Window.constrain_size
() yourself to determine appropriate sizes.
- set_group(leader)[source]¶
- Parameters:
leader (
Gdk.Window
orNone
) – group leader window, orNone
to restore the default group leader window
Sets the group leader window for self. 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.
- set_icon_list(pixbufs)[source]¶
- Parameters:
pixbufs ([
GdkPixbuf.Pixbuf
]) – A list of pixbufs, of different sizes.
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.
Note that some platforms don’t support window icons.
- set_icon_name(name)[source]¶
-
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.
After calling this with a non-
None
name, calls toGdk.Window.set_title
() will not update the icon title.Using
None
for name unsets the icon title; further calls toGdk.Window.set_title
() will again update the icon title as well.Note that some platforms don’t support window icons.
- set_keep_above(setting)[source]¶
- Parameters:
setting (
bool
) – whether to keep self above other windows
Set if self 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 self 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.
New in version 2.4.
- set_keep_below(setting)[source]¶
- Parameters:
setting (
bool
) – whether to keep self below other windows
Set if self 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 self 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.
New in version 2.4.
- set_modal_hint(modal)[source]¶
-
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
()
- set_opacity(opacity)[source]¶
- Parameters:
opacity (
float
) – opacity
Set self to render as partially transparent, with opacity 0 being fully transparent and 1 fully opaque. (Values of the opacity parameter are clamped to the [0,1] range.)
For toplevel windows this depends on support from the windowing system that may not always be there. For instance, On X11, this works only on X screens with a compositing manager running. On Wayland, there is no per-window opacity value that the compositor would apply. Instead, use
gdk_window_set_opaque_region (window, NULL)
to tell the compositor that the entire window is (potentially) non-opaque, and draw your content with alpha, or use gtk_widget_set_opacity() to set an overall opacity for your widgets.For child windows this function only works for non-native windows.
For setting up per-pixel alpha topelevels, see
Gdk.Screen.get_rgba_visual
(), and for non-toplevels, seeGdk.Window.set_composited
().Support for non-toplevel windows was added in 3.8.
New in version 2.12.
- set_opaque_region(region)[source]¶
- Parameters:
region (
cairo.Region
orNone
) – a region, orNone
For optimisation purposes, compositing window managers may like to not draw obscured regions of windows, or turn off blending during for these regions. With RGB windows with no transparency, this is just the shape of the window, but with ARGB32 windows, the compositor does not know what regions of the window are transparent or not.
This function only works for toplevel windows.
GTK+ will update this property automatically if the self background is opaque, as we know where the opaque regions are. If your window background is not opaque, please update this property in your #GtkWidget::style-updated handler.
New in version 3.10.
- set_override_redirect(override_redirect)[source]¶
-
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.
- set_pass_through(pass_through)[source]¶
- Parameters:
pass_through (
bool
) – a boolean
Sets whether input to the window is passed through to the window below.
The default value of this is
False
, which means that pointer events that happen inside the window are send first to the window, but if the event is not selected by the event mask then the event is sent to the parent window, and so on up the hierarchy.If pass_through is
True
then such pointer events happen as if the window wasn’t there at all, and thus will be sent first to any windows below self. This is useful if the window is used in a transparent fashion. In the terminology of the web this would be called “pointer-events: none”.Note that a window with pass_through
True
can still have a subwindow without pass through, so you can get events on a subset of a window. And in that cases you would get the in-between related events such as the pointer enter/leave events on its way to the destination window.New in version 3.18.
- set_role(role)[source]¶
- Parameters:
role (
str
) – a string indicating its 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.
- set_shadow_width(left, right, top, bottom)[source]¶
- Parameters:
Newer GTK+ windows using client-side decorations use extra geometry around their frames for effects like shadows and invisible borders. Window managers that want to maximize windows or snap to edges need to know where the extents of the actual frame lie, so that users don’t feel like windows are snapping against random invisible edges.
Note that this property is automatically updated by GTK+, so this function should only be used by applications which do not use GTK+ to create toplevel windows.
New in version 3.12.
- set_skip_pager_hint(skips_pager)[source]¶
-
Toggles whether a window should appear in a pager (workspace switcher, or other desktop utility program that displays a small thumbnail representation of the windows on the desktop). If a window’s semantic type as specified with
Gdk.Window.set_type_hint
() already fully describes the window, this function should not be called in addition, instead you should allow the window to be treated according to standard policy for its semantic type.New in version 2.2.
- set_skip_taskbar_hint(skips_taskbar)[source]¶
-
Toggles whether a window should appear in a task list or window list. If a window’s semantic type as specified with
Gdk.Window.set_type_hint
() already fully describes the window, this function should not be called in addition, instead you should allow the window to be treated according to standard policy for its semantic type.New in version 2.2.
- set_source_events(source, event_mask)[source]¶
- Parameters:
source (
Gdk.InputSource
) – aGdk.InputSource
to define the source class.event_mask (
Gdk.EventMask
) – event mask for self
Sets the event mask for any floating device (i.e. not attached to any visible pointer) that has the source defined as source. This event mask will be applied both to currently existing, newly added devices after this call, and devices being attached/detached.
New in version 3.0.
- set_startup_id(startup_id)[source]¶
- Parameters:
startup_id (
str
) – a string with startup-notification identifier
When using GTK+, typically you should use gtk_window_set_startup_id() instead of this low-level function.
New in version 2.12.
- set_static_gravities(use_static)[source]¶
-
Used to 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.
Deprecated since version 3.16: static gravities haven’t worked on anything but X11 for a long time.
- set_support_multidevice(support_multidevice)[source]¶
-
This function will enable multidevice features in self.
Multidevice aware windows will need to handle properly multiple, per device enter/leave events, device grabs and grab ownerships.
New in version 3.0.
- set_title(title)[source]¶
- Parameters:
title (
str
) – title of self
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 beNone
.
- set_transient_for(parent)[source]¶
- Parameters:
parent (
Gdk.Window
) – another toplevelGdk.Window
Indicates to the window manager that self is a transient dialog associated with the application window parent. This allows the window manager to do things like center self on parent and keep self above parent.
See gtk_window_set_transient_for() if you’re using #GtkWindow or #GtkDialog.
- set_type_hint(hint)[source]¶
- Parameters:
hint (
Gdk.WindowTypeHint
) – A hint of the function this window will have
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.
- set_urgency_hint(urgent)[source]¶
-
Toggles whether a window needs the user’s urgent attention.
New in version 2.8.
- set_user_data(user_data)[source]¶
- Parameters:
user_data (
GObject.Object
orNone
) – user data
For most purposes this function is deprecated in favor of
GObject.Object.set_data
(). However, for historical reasons GTK+ stores the #GtkWidget that owns aGdk.Window
as user data on theGdk.Window
. So, custom widget implementations should use this function for that. If GTK+ receives an event for aGdk.Window
, and the user data for the window is non-None
, GTK+ will assume the user data is a #GtkWidget, and forward the event to that widget.
- shape_combine_region(shape_region, offset_x, offset_y)[source]¶
- Parameters:
shape_region (
cairo.Region
orNone
) – region of window to be non-transparentoffset_x (
int
) – X position of shape_region in self coordinatesoffset_y (
int
) – Y position of shape_region in self coordinates
Makes pixels in self outside shape_region be transparent, so that the window may be nonrectangular.
If shape_region is
None
, the shape will be unset, so the whole window will be opaque again. offset_x and offset_y are ignored if shape_region isNone
.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.
This function works on both toplevel and child windows.
- show()[source]¶
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
Gdk.Window
as part of the “map” method.
- show_unraised()[source]¶
Shows a
Gdk.Window
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).
- Parameters:
- Returns:
- Return type:
Asks the windowing system to show the window menu. The window menu is the menu shown when right-clicking the titlebar on traditional windows managed by the window manager. This is useful for windows using client-side decorations, activating it with a right-click on the window decorations.
New in version 3.14.
- stick()[source]¶
“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.
- thaw_toplevel_updates_libgtk_only()[source]¶
Thaws a window frozen with
Gdk.Window.freeze_toplevel_updates_libgtk_only
().This function is not part of the GDK public API and is only for use by GTK+.
Deprecated since version 3.16: This symbol was never meant to be used outside of GTK+
- thaw_updates()[source]¶
Thaws a window frozen with
Gdk.Window.freeze_updates
().
- unfullscreen()[source]¶
Moves the window out of fullscreen mode. If the window was not fullscreen, does nothing.
On X11, asks the window manager to move self 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.
New in version 2.2.
- unmaximize()[source]¶
Unmaximizes the window. If the window wasn’t maximized, then this function does nothing.
On X11, asks the window manager to unmaximize self, 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.
- unstick()[source]¶
Reverse operation for
Gdk.Window.stick
(); seeGdk.Window.stick
(), and gtk_window_unstick().
- withdraw()[source]¶
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.
- do_create_surface(width, height) virtual¶
- Parameters:
- Return type:
- do_from_embedder(embedder_x, embedder_y, offscreen_x, offscreen_y) virtual¶
Signal Details¶
- Gdk.Window.signals.create_surface(window, width, height)¶
- Signal Name:
create-surface
- Flags:
- Parameters:
window (
Gdk.Window
) – The object which received the signalwidth (
int
) – the width of the offscreen surface to createheight (
int
) – the height of the offscreen surface to create
- Returns:
the newly created
cairo.Surface
for the offscreen window- Return type:
The
::create-surface
signal is emitted when an offscreen window needs its surface (re)created, which happens either when the window is first drawn to, or when the window is being resized. The first signal handler that returns a non-None
surface will stop any further signal emission, and its surface will be used.Note that it is not possible to access the window’s previous surface from within any callback of this signal. Calling
Gdk.offscreen_window_get_surface
() will lead to a crash.New in version 3.0.
- Gdk.Window.signals.from_embedder(window, embedder_x, embedder_y)¶
- Signal Name:
from-embedder
- Flags:
- Parameters:
window (
Gdk.Window
) – The object which received the signalembedder_x (
float
) – x coordinate in the embedder windowembedder_y (
float
) – y coordinate in the embedder window
- Returns:
- offscreen_x:
return location for the x coordinate in the offscreen window
- offscreen_y:
return location for the y coordinate in the offscreen window
- Return type:
The
::from-embedder
signal is emitted to translate coordinates in the embedder of an offscreen window to the offscreen window.See also
Gdk.Window
::to-embedder
.New in version 2.18.
- Gdk.Window.signals.moved_to_rect(window, flipped_rect, final_rect, flipped_x, flipped_y)¶
- Signal Name:
moved-to-rect
- Flags:
- Parameters:
window (
Gdk.Window
) – The object which received the signalflipped_rect (
object
orNone
) – the position of window after any possible flipping orNone
if the backend can’t obtain itfinal_rect (
object
orNone
) – the final position of window orNone
if the backend can’t obtain itflipped_x (
bool
) –True
if the anchors were flipped horizontallyflipped_y (
bool
) –True
if the anchors were flipped vertically
Emitted when the position of window is finalized after being moved to a destination rectangle.
window might be flipped over the destination rectangle in order to keep it on-screen, in which case flipped_x and flipped_y will be set to
True
accordingly.flipped_rect is the ideal position of window after any possible flipping, but before any possible sliding. final_rect is flipped_rect, but possibly translated in the case that flipping is still ineffective in keeping window on-screen.
New in version 3.22.
- Gdk.Window.signals.pick_embedded_child(window, x, y)¶
- Signal Name:
pick-embedded-child
- Flags:
- Parameters:
window (
Gdk.Window
) – The object which received the signalx (
float
) – x coordinate in the windowy (
float
) – y coordinate in the window
- Returns:
the
Gdk.Window
of the embedded child at x, y, orNone
- Return type:
Gdk.Window
orNone
The
::pick-embedded-child
signal is emitted to find an embedded child at the given position.New in version 2.18.
- Gdk.Window.signals.to_embedder(window, offscreen_x, offscreen_y)¶
- Signal Name:
to-embedder
- Flags:
- Parameters:
window (
Gdk.Window
) – The object which received the signaloffscreen_x (
float
) – x coordinate in the offscreen windowoffscreen_y (
float
) – y coordinate in the offscreen window
- Returns:
- embedder_x:
return location for the x coordinate in the embedder window
- embedder_y:
return location for the y coordinate in the embedder window
- Return type:
The
::to-embedder
signal is emitted to translate coordinates in an offscreen window to its embedder.See also
Gdk.Window
::from-embedder
.New in version 2.18.
Property Details¶
- Gdk.Window.props.cursor¶
- Name:
cursor
- Type:
- Default Value:
- Flags:
The mouse pointer for a
Gdk.Window
. SeeGdk.Window.set_cursor
() andGdk.Window.get_cursor
() for details.New in version 2.18.