Description Methods and Functions Hierarchy Detailed Description Composited Windows Offscreen Windows Structures Convenient Construction Enums and Flags User Functions Signals Properties Author(s) References
Onscreen display areas in the target window system
gdkWindowNew(parent = NULL, attributes)
gdkWindowDestroy(object)
gdkWindowGetWindowType(object)
gdkWindowAtPointer()
gdkWindowShow(object)
gdkWindowShowUnraised(object)
gdkWindowHide(object)
gdkWindowIsDestroyed(object)
gdkWindowIsVisible(object)
gdkWindowIsViewable(object)
gdkWindowGetState(object)
gdkWindowWithdraw(object)
gdkWindowIconify(object)
gdkWindowDeiconify(object)
gdkWindowStick(object)
gdkWindowUnstick(object)
gdkWindowMaximize(object)
gdkWindowUnmaximize(object)
gdkWindowFullscreen(object)
gdkWindowUnfullscreen(object)
gdkWindowSetKeepAbove(object, setting)
gdkWindowSetKeepBelow(object, setting)
gdkWindowSetOpacity(object, opacity)
gdkWindowSetComposited(object, composited)
gdkWindowMove(object, x, y)
gdkWindowResize(object, width, height)
gdkWindowMoveResize(object, x, y, width, height)
gdkWindowScroll(object, dx, dy)
gdkWindowMoveRegion(object, region, x, y)
gdkWindowFlush(object)
gdkWindowEnsureNative(object)
gdkWindowReparent(object, new.parent, x, y)
gdkWindowClear(object)
gdkWindowClearArea(object, x, y, width, height)
gdkWindowClearAreaE(object, x, y, width, height)
gdkWindowRaise(object)
gdkWindowLower(object)
gdkWindowRestack(object, sibling, above)
gdkWindowFocus(object, timestamp = "GDK_CURRENT_TIME")
gdkWindowRegisterDnd(object)
gdkWindowBeginResizeDrag(object, edge, button, root.x, root.y, timestamp)
gdkWindowBeginMoveDrag(object, button, root.x, root.y, timestamp)
gdkWindowConstrainSize(geometry, width, height)
gdkWindowBeep(object)
gdkWindowBeginPaintRect(object, rectangle)
gdkWindowBeginPaintRegion(object, region)
gdkWindowEndPaint(object)
gdkWindowInvalidateRect(object, rect = NULL, invalidate.children)
gdkWindowInvalidateRegion(object, region, invalidate.children)
gdkWindowInvalidateMaybeRecurse(object, region, child.func, user.data)
gdkWindowGetUpdateArea(object)
gdkWindowFreezeUpdates(object)
gdkWindowThawUpdates(object)
gdkWindowProcessAllUpdates()
gdkWindowProcessUpdates(object, update.children)
gdkWindowSetDebugUpdates(setting)
gdkWindowGetInternalPaintInfo(object)
gdkWindowEnableSynchronizedConfigure(object)
gdkWindowConfigureFinished(object)
gdkWindowSetUserData(object, user.data = NULL)
gdkWindowSetOverrideRedirect(object, override.redirect)
gdkWindowSetAcceptFocus(object, accept.focus)
gdkWindowSetFocusOnMap(object, focus.on.map)
gdkWindowAddFilter(object, fun, data)
gdkWindowRemoveFilter(object, fun, data)
gdkWindowShapeCombineMask(object, shape.mask = NULL, offset.x, offset.y)
gdkWindowShapeCombineRegion(object, shape.region = NULL, offset.x, offset.y)
gdkWindowSetChildShapes(object)
gdkWindowMergeChildShapes(object)
gdkWindowInputShapeCombineMask(object, mask, x, y)
gdkWindowInputShapeCombineRegion(object, shape.region, offset.x, offset.y)
gdkWindowSetChildInputShapes(object)
gdkWindowMergeChildInputShapes(object)
gdkWindowSetStaticGravities(object, use.static)
gdkWindowSetHints(object, x, y, min.width, min.height, max.width, max.height, flags)
gdkWindowSetTitle(object, title)
gdkWindowSetBackground(object, color)
gdkWindowSetBackPixmap(object, pixmap = NULL, parent.relative)
gdkWindowSetCursor(object, cursor = NULL)
gdkWindowGetCursor(object)
gdkWindowGetUserData(object)
gdkWindowGetGeometry(object)
gdkWindowSetGeometryHints(object, geometry)
gdkWindowSetIconList(object, pixbufs)
gdkWindowSetModalHint(object, modal)
gdkWindowSetTypeHint(object, hint)
gdkWindowGetTypeHint(object)
gdkWindowSetSkipTaskbarHint(object, modal)
gdkWindowSetSkipPagerHint(object, modal)
gdkWindowSetUrgencyHint(object, urgent)
gdkWindowGetPosition(object)
gdkWindowGetRootOrigin(object)
gdkWindowGetFrameExtents(object)
gdkWindowGetOrigin(object)
gdkWindowGetDeskrelativeOrigin(object)
gdkWindowGetRootCoords(object, x, y)
gdkWindowGetPointer(object)
gdkWindowGetParent(object)
gdkWindowGetToplevel(object)
gdkWindowGetChildren(object)
gdkWindowPeekChildren(object)
gdkWindowGetEvents(object)
gdkWindowSetEvents(object, event.mask)
gdkWindowSetIcon(object, icon.window, pixmap, mask)
gdkWindowSetIconName(object, name)
gdkWindowSetTransientFor(object, leader)
gdkWindowSetRole(object, role)
gdkWindowSetStartupId(object, startup.id)
gdkWindowSetGroup(object, leader)
gdkWindowGetGroup(object)
gdkWindowSetDecorations(object, decorations)
gdkWindowGetDecorations(object)
gdkWindowSetFunctions(object, functions)
gdkWindowGetToplevels()
gdkGetDefaultRootWindow()
gdkSetPointerHooks(object, new.hooks)
gdkOffscreenWindowGetPixmap(window)
gdkOffscreenWindowSetEmbedder(window, embedder)
gdkOffscreenWindowGetEmbedder(window)
gdkWindowGeometryChanged(object)
gdkWindowRedirectToDrawable(object, drawable, src.x, src.y, dest.x, dest.y, width, height)
gdkWindowRemoveRedirection(object)
gdkWindow(parent = NULL, attributes)
1 2 3 | GObject
+----GdkDrawable
+----GdkWindow
|
A GdkWindow is a rectangular region on the screen. It's a low-level object,
used to implement high-level objects such as GtkWidget and GtkWindow on the
GTK+ level. A GtkWindow is a toplevel window, the thing a user might think of
as a "window" with a titlebar and so on; a GtkWindow may contain many GdkWindow.
For example, each GtkButton has a GdkWindow associated with it.
Normally, the windowing system takes care of rendering the contents of a child
window onto its parent window. This mechanism can be intercepted by calling
gdkWindowSetComposited on the child window. For a
composited window it is the responsibility of the
application to render the window contents at the right spot.
Composited windows
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | # The expose event handler for the event box.
#
# This function simply draws a transparency onto a widget on the area
# for which it receives expose events. This is intended to give the
# event box a "transparent" background.
#
# In order for this to work properly, the widget must have an RGBA
# colormap. The widget should also be set as app-paintable since it
# doesn't make sense for GTK+ to draw a background if we are drawing it
# (and because GTK+ might actually replace our transparency with its
# default background color).
#
transparent_expose <- function(widget, event)
{
cr <- gdkCairoCreate(widget$window)
cr$setOperator("clear")
gdkCairoRegion(cr, event$region)
cr$fill()
return(FALSE)
}
# The expose event handler for the window.
#
# This function performs the actual compositing of the event box onto
# the already-existing background of the window at 50% normal opacity.
#
# In this case we do not want app-paintable to be set on the widget
# since we want it to draw its own (red) background. Because of this,
# however, we must ensure that we set after = TRUE when connecting to the signal
# so that this handler is called after the red has been drawn. If it was
# called before then GTK would just blindly paint over our work.
#
# Note: if the child window has children, then you need a cairo 1.16
# feature to make this work correctly.
#
window_expose_event <- function(widget, event)
{
# get our child (in this case, the event box)
child <- widget$getChild()
# create a cairo context to draw to the window
cr <- gdkCairoCreate(widget$window)
# the source data is the (composited) event box
gdkCairoSetSourcePixmap(cr, child$window, child$allocation$x,
child$allocation$y)
# draw no more than our expose event intersects our child
region <- gdkRegionRectangle(child$allocation)
region$intersect(event$region)
gdkCairoRegion(cr, region)
cr$clip()
# composite, with a 50% opacity
cr$setOperator("over")
cr$paintWithAlpha(0.5)
return(FALSE)
}
# Make the widgets
button <- gtkButton("A Button")
event <- gtkEventBox()
window <- gtkWindow()
# Put a red background on the window
red <- gdkColorParse("red")$color
window$modifyBg("normal", red)
# Set the colormap for the event box.
# Must be done before the event box is realized.
#
screen <- event$getScreen()
rgba <- screen$getRgbaColormap()
event$setColormap(rgba)
# Set our event box to have a fully-transparent background
# drawn on it. Currently there is no way to simply tell GTK+
# that "transparency" is the background color for a widget.
#
event$setAppPaintable(TRUE)
gSignalConnect(event, "expose-event", transparent_expose)
# Put them inside one another
window$setBorderWidth(10)
window$add(event)
event$add(button)
# Set the event box GdkWindow to be composited.
# Obviously must be performed after event box is realized.
#
event$window$setComposited(TRUE)
# Set up the compositing handler.
# Note that we do _after_ so that the normal (red) background is drawn
# by gtk before our compositing occurs.
#
gSignalConnect(window, "expose-event", window_expose_event, after = TRUE)
|
In the example , a button is placed inside of an event box inside of a window. The event box is set as composited and therefore is no longer automatically drawn to the screen.
When the contents of the event box change, an expose event is
generated on its parent window (which, in this case, belongs to
the toplevel GtkWindow). The expose handler for this widget is
responsible for merging the changes back on the screen in the way
that it wishes.
In our case, we merge the contents with a 50% transparency. We also set the background colour of the window to red. The effect is that the background shows through the button.
Offscreen windows are more general than composited windows, since they allow not only to modify the rendering of the child window onto its parent, but also to apply coordinate transformations.
To integrate an offscreen window into a window hierarchy, one has to call
gdkWindowSetEmbedder() and handle a number of signals. The
gdkOffscreenWindowSetEmbedder and handle a number of signals. The
"pick-embedded-child" signal on the embedder window is used to
select an offscreen child at given coordinates, and the "to-embedder"
and "from-embedder" signals on the offscreen window are used to
translate coordinates between the embedder and the offscreen window.
For rendering an offscreen window onto its embedder, the contents of the
offscreen window are available as a pixmap, via
gdkOffscreenWindowGetPixmap.
GdkWindowAn 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.
GdkGeometryThe GdkGeometry struct gives the window manager information about
a window's geometry constraints. Normally you would set these on
the GTK+ level using gtkWindowSetGeometryHints. GtkWindow
then sets the hints on the GdkWindow it creates.
gdkWindowSetGeometryHints expects the hints to be fully valid already and
simply passes them to the window manager; in contrast,
gtkWindowSetGeometryHints 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 gtkWindowSetGeometryHints 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":
fields <- c("base.width", "base.height", "min.width", "min.height", "width.inc",
"height.inc")
hints[fields] <- char_width
toplevel$setGeometryHints(terminal, hints)
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.
GdkGeometry is a transparent-type.
min_widthminimum width of window (or -1 to use requisition, with GtkWindow only)
min_heightminimum height of window (or -1 to use requisition, with GtkWindow only)
max_widthmaximum width of window (or -1 to use requisition, with GtkWindow only)
max_heightmaximum height of window (or -1 to use requisition, with GtkWindow only)
base_widthallowed window widths are base.width + width.inc * N where N is any integer (-1 allowed with GtkWindow)
base_heightallowed window widths are base.height + height.inc * N where N is any integer (-1 allowed with GtkWindow)
width_incwidth resize increment
height_incheight resize increment
min_aspectminimum width/height ratio
max_aspectmaximum width/height ratio
win_gravitywindow gravity, see gtkWindowSetGravity
GdkWindowAttrAttributes to use for a newly-created window.
GdkWindowAttr is a transparent-type.
titletitle of the window (for toplevel windows)
event_maskevent mask (see gdkWindowSetEvents)
xX coordinate relative to parent window (see gdkWindowMove)
yY coordinate relative to parent window (see gdkWindowMove)
widthwidth of window
heightheight of window
wclassGDK_INPUT_OUTPUT (normal window) or GDK_INPUT_ONLY (invisible window that receives events)
visualGdkVisual for window
colormapGdkColormap for window
window_typetype of window
cursorcursor for the window (see gdkWindowSetCursor)
wmclass_namedon't use (see gtkWindowSetWmclass)
wmclass_classdon't use (see gtkWindowSetWmclass)
override_redirectTRUE to bypass the window manager
type_hinta hint of the function of the window
GdkFilterReturnSpecifies the result of applying a GdkFilterFunc to a native event.
gdkWindow is the equivalent of gdkWindowNew.
GdkWindowTypeDescribes the kind of window.
rootroot window; this window has no parent, covers the entire screen, and is created by the window system
topleveltoplevel window (used to implement GtkWindow)
childchild window (used to implement e.g. GtkEntry)
dialoguseless/deprecated compatibility type
tempoverride redirect temporary window (used to implement GtkMenu)
foreignforeign window (see gdkWindowForeignNew())
GdkWindowClassGDK.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.
outputwindow for graphics and events
onlywindow for events only
GdkWindowHintsUsed 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 gtkWindowMove. 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; gtkWindowParseGeometry() automatically sets these
flags.
posindicates that the program has positioned the window
min-sizemin size fields are set
max-sizemax size fields are set
base-sizebase size fields are set
aspectaspect ratio fields are set
resize-incresize increment fields are set
win-gravitywindow gravity field is set
user-posindicates that the window's position was explicitly set by the user
user-sizeindicates that the window's size was explicitly set by the user
GdkGravityDefines the reference point of a window and the meaning of coordinates
passed to gtkWindowMove. See gtkWindowMove and the "implementation
notes" section of the
Extended
Window Manager Hints (http://www.freedesktop.org/Standards/wm-spec) specification for more details.
north-westthe reference point is at the top left corner.
norththe reference point is in the middle of the top edge.
north-eastthe reference point is at the top right corner.
westthe reference point is at the middle of the left edge.
centerthe reference point is at the center of the window.
eastthe reference point is at the middle of the right edge.
south-westthe reference point is at the lower left corner.
souththe reference point is at the middle of the lower edge.
south-eastthe reference point is at the lower right corner.
staticthe reference point is at the top left corner of the window itself, ignoring window manager decorations.
GdkWindowEdgeDetermines a window edge or corner.
north-westthe top left corner.
norththe top edge.
north-eastthe top right corner.
westthe left edge.
eastthe right edge.
south-westthe lower left corner.
souththe lower edge.
south-eastthe lower right corner.
GdkWindowTypeHintThese are hints for the window manager that indicate what type of function the window has. The window manager can use this when determining decoration and behaviour of the window. The hint must be set before mapping the window.
See the Extended Window Manager Hints (http://www.freedesktop.org/Standards/wm-spec) specification for more details about window types.
normalNormal toplevel window.
dialogDialog window.
menuWindow used to implement a menu; GTK+ uses
this hint only for torn-off menus, see GtkTearoffMenuItem.
toolbarWindow used to implement toolbars.
splashscreenWindow used to display a splash screen during application startup.
utilityUtility windows which are not detached toolbars or dialogs.
dockUsed for creating dock or panel windows.
desktopUsed for creating the desktop background window.
GdkWindowAttributesTypeUsed 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 gdkWindowNew. 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.
titleHonor the title field
xHonor the X coordinate field
yHonor the Y coordinate field
cursorHonor the cursor field
colormapHonor the colormap field
visualHonor the visual field
wmclassHonor the wmclass_class and wmclass_name fields
noredirHonor the override_redirect field
GdkFilterReturnSpecifies the result of applying a GdkFilterFunc to a native event.
continueevent not handled, continue processing.
translatenative event translated into a GDK event and stored
in the event structure that was passed in.
removeevent handled, terminate processing.
GdkModifierTypeA 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.
Since 2.10, GDK recognizes which of the Meta, Super or Hyper keys are mapped
to Mod2 - Mod5, and indicates this by setting GDK_SUPER_MASK, GDK_HYPER_MASK
or GDK_META_MASK in the state field of key events.
shift-maskthe Shift key.
lock-maska Lock key (depending on the modifier mapping of the X server this may either be CapsLock or ShiftLock).
control-maskthe Control key.
mod1-maskthe fourth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier, but normally it is the Alt key).
mod2-maskthe fifth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).
mod3-maskthe sixth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).
mod4-maskthe seventh modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).
mod5-maskthe eighth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).
button1-maskthe first mouse button.
button2-maskthe second mouse button.
button3-maskthe third mouse button.
button4-maskthe fourth mouse button.
button5-maskthe fifth mouse button.
release-maskthe Super modifier. Since 2.10
modifier-maskthe Hyper modifier. Since 2.10
GdkWMDecorationThese 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.
allall decorations should be applied.
bordera frame should be drawn around the window.
resizehthe frame should have resize handles.
titlea titlebar should be placed above the window.
menua button for opening a menu should be included.
minimizea minimize button should be included.
maximizea maximize button should be included.
GdkWMFunctionThese 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.
allall functions should be offered.
resizethe window should be resizable.
movethe window should be movable.
minimizethe window should be minimizable.
maximizethe window should be maximizable.
closethe window should be closable.
GdkFilterFunc(xevent, event, data)Specifies the type of function used to filter native events before they are converted to GDK events.
When a filter is called, event is unpopulated, except for
event->window. The filter may translate the native
event to a GDK event and store the result in event, or handle it without
translation. If the filter translates the event and processing should
continue, it should return GDK_FILTER_TRANSLATE.
xeventthe native event to filter.
eventthe GDK event to which the X event will be translated.
datauser data set when the filter was installed.
Returns: [GdkFilterReturn] a GdkFilterReturn value.
from-embedder(window, embedder-x, embedder-y, offscreen-x, offscreen-y, user.data)The ::from-embedder signal is emitted to translate coordinates in the embedder of an offscreen window to the offscreen window.
See also "to-embedder".
Since 2.18
windowthe offscreen window on which the signal is emitted
embedder-xx coordinate in the embedder window
embedder-yy coordinate in the embedder window
offscreen-xreturn location for the x coordinate in the offscreen window
offscreen-yreturn location for the y coordinate in the offscreen window
user.datauser data set when the signal handler was connected.
pick-embedded-child(window, x, y, user.data)The ::pick-embedded-child signal is emitted to find an embedded child at the given position. Since 2.18
windowthe window on which the signal is emitted
xx coordinate in the window
yy coordinate in the window
user.datauser data set when the signal handler was connected.
Returns: [GdkWindow] the GdkWindow of the embedded child at x, y, or NULL
to-embedder(window, offscreen-x, offscreen-y, embedder-x, embedder-y, user.data)The ::to-embedder signal is emitted to translate coordinates in an offscreen window to its embedder.
See also "from-embedder".
Since 2.18
windowthe offscreen window on which the signal is emitted
offscreen-xx coordinate in the offscreen window
offscreen-yy coordinate in the offscreen window
embedder-xreturn location for the x coordinate in the embedder window
embedder-yreturn location for the y coordinate in the embedder window
user.datauser data set when the signal handler was connected.
cursor [GdkCursor : * : Read / Write]The mouse pointer for a GdkWindow. See gdkWindowSetCursor and
gdkWindowGetCursor for details.
Since 2.18
Derived by RGtkGen from GTK+ documentation
https://developer.gnome.org/gdk2/stable/gdk2-Windows.html
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.