
@node X Objects
@chapter X Objects

All X operations are performed by invoking object methods.

The objects and their methods are listed in the following nodes, however
with no detailed explanations.  The reader are referred to other sources
of X documentation for details, e.g. the X protocol specification, the C
Xlib documentation or man pages.  A vast collection of X documentation
links can be found at @uref{http://www.rahul.net/kenton/xsites.html}.

Methods returning a single value will return that directly.  Otherwise,
an object containing attributes for each of the result values is
returned.

Methods returning some value will raise an exception on error.  Methods
which does not return any value have instead an @code{on_error}
parameter, which can be used to specify an error handler.

@menu
* Display::       Methods on Display objects.
* Resource::      Methods common to all the following resource objects.
* Colormap::      Methods on Colormap objects. 
* Cursor::        Methods on Cursor objects.
* Drawable::      Methods common to Window and Pixmap objects.
* Window::        Methods on Window objects.
* Pixmap::        Methods on Pixmap objects.
* Fontable::      Methods common to GC and Font objects.
* GC::            Methods on GC objects.
* Font::          Methods on Font objects.
@end menu


@node Display
@section Display

Display information retrieval methods:

@defmethod Display get_display_name ( )

Returns the name used to connect to the server, either provided when
creating the @code{Display} object, or fetched from the environmental
variable @code{$DISPLAY}.

@end defmethod


@defmethod Display fileno ( )

Returns the file descriptor number of the underlying socket.  This
method is provided to allow @code{Display} objects to be passed
@code{select.select()}.

@end defmethod

@defmethod Display close ( )

Close the display, freeing the resources that it holds.

@end defmethod

@defmethod Display set_error_handler ( handler )

Set the default error handler which will be called for all unhandled
errors.  @var{handler} should take two arguments as a normal request
error handler, but the second argument (the request) will be None.

@xref{Error Handling}.

@end defmethod


@defmethod Display flush ( )

Flush the request queue, building and sending the queued requests.  This
can be necessary in applications that never wait for events, and in
threaded applications.

@end defmethod

@defmethod Display sync ( )

Flush the queue and wait until the server has processed all the queued
requests.  Use this e.g. when it is important that errors caused by a
certain request is trapped.

@end defmethod


@defmethod Display next_event ( )

Return the next event.  If there are no events queued, it will block
until the next event is fetched from the server.

@end defmethod

@defmethod Display pending_events ( )

Return the number of events queued, i.e. the number of times that
@code{Display.next_event()} can be called without blocking.

@end defmethod


@defmethod Display has_extension ( extension )

Check if both the server and the client library support the X extension
named @var{extension}.

@end defmethod


@defmethod Display create_resource_object ( type, id )

Create a resource object of @var{type} for the integer @var{id}.
@var{type} should be one of the following strings:

@table @code
@item resource
@itemx drawable
@itemx window
@itemx pixmap
@itemx fontable
@itemx font
@itemx gc
@itemx colormap
@itemx cursor

@end table

This function can be used when a resource ID has been fetched e.g. from
an resource or a command line argument.  Resource objects should never
be created by instantiating the appropriate class directly, since any X
extensions dynamically added by the library will not be available.

@end defmethod


@defmethod Display screen ( sno = None )

Return the information about screen number @var{sno}, or the default
screen if @var{sno} is @code{None}.

The return object has the following attributes:

@table @code

@item root
The screen root window.

@item default_colormap
The default colormap for the root window and its children.

@item white_pixel
@itemx black_pixel
The pixel values for white and black, respectively, in the default
colormap.

@item current_input_mask
The event mask of the root window at the time the connection was set up.

@item width_in_pixels
@itemx height_in_pixels
The size of the root window in pixels, i.e. the size of the entire screen.

@item width_in_mms
@itemx height_in_mms
The physical size of the screen, in millimeters.

@item min_installed_maps
@itemx max_installed_maps
The minimum and maximum number of colormaps that can be installed at the
same time.

@item root_visual
The visual type of the root window.

@item backing_store
Whether the screen supports backing store, one of the values
@code{X.WhenMapped}, @code{X.NotUseful}, or @code{X.Always}.

@item save_unders
True if the screen supports save unders.

@item root_depth
The depth of the root window.

@item allowed_depths

A list of the pixmap and windows depths that this screen supports.  The
list items have the following attributes:

@table @code
@item depth
This depth is supported by the screen.

@item visuals
A list of visual types that is valid for this depth.  If this list is
empty, this depth is only valid for pixmaps and not for windows.  The
list items have the following attributes:

@table @code
@item visual_id
The ID of this visual.

@item visual_class
One of @code{X.StaticGray}, @code{X.StaticColor}, @code{X.TrueColor},
@code{X.GrayScale}, @code{X.PseudoColor}, or @code{X.DirectColor}.

@item bits_per_rgb_value
The number of bits used to represent an entire RGB-value, allowing a
total of @code{2^bits_per_rgb_value} distinct colors.

@item colormap_entries
The number of free entries in a newly created colormap.

@item red_mask
@itemx blue_mask
@itemx green_mask

Bitmasks selecting the three color components from the entire RGB value.

@end table

@end table

@end table

@end defmethod


@defmethod Display screen_count ( )

Return the total number of screens on the display.

@end defmethod

@defmethod Display get_default_screen ( )

Return the number of the default screen, extracted from the display
name.

@end defmethod


@defmethod Display keycode_to_keysym ( keycode, index )

Convert a @var{keycode} to a keysym, looking in entry @var{index}.
Normally index 0 is unshifted, 1 is shifted, 2 is alt grid, and 3 is
shift+alt grid.  If that key entry is not bound, @code{X.NoSymbol} is
returned.

@end defmethod

@defmethod Display keysym_to_keycode ( keysym )

Look up the primary keycode that is bound to @var{keysym}.  If several
keycodes are found, the one with the lowest index and lowest code is
returned.  If @var{keysym} is not bound to any key, 0 is returned.

@end defmethod

@defmethod Display keysym_to_keycodes ( keysym )

Look up all the keycodes that is bound to @code{keysym}.  A list of
tuples @code{(keycode, index)} is returned, sorted primarily on the
lowest index and secondarily on the lowest keycode.

@end defmethod

@defmethod Display refresh_keyboard_mapping ( evt )

This method should be called once when a @code{MappingNotify} event is
received, to update the keymap cache.  @var{evt} should be the event
object.

@end defmethod

@defmethod Display lookup_string ( keysym )

Attempt to convert @var{keysym} into a single character or a string.  If
no translation is found, @code{None} is returned.

@end defmethod

@defmethod Display rebind_string ( keysym, newstring )

Set the string representation of @code{keysym} to @code{newstring}, so
that it will be returned by @code{Display.lookup_string()}.

@end defmethod


X requests methods:

@defmethod Display intern_atom ( name, only_if_exists = 0 )

Intern the string @var{name}, returning its atom number.  If
@var{only_if_exists} is true and the atom does not already exist,
it will not be created and @code{X.NONE} is returned.

@end defmethod


@defmethod Display get_atom_name ( atom )

Look up the name of @var{atom}, returning it as a string.  Will raise
@code{BadAtom} if @var{atom} does not exist.

@end defmethod


@defmethod Display get_selection_owner ( selection )

Return the window that owns @var{selection} (an atom), or @code{X.NONE}
if there is no owner for the selection.  Can raise @code{BadAtom}.

@end defmethod


@defmethod Display send_event ( destination, event, @w{event_mask = 0,} @w{propagate = 0,} @w{onerror = None )}

Send a synthetic event to the window @code{destination} which can be a
window object, or @code{X.PointerWindow} or @code{X.InputFocus}.
@code{event} is the event object to send, instantiated from one of the
classes in @code{protocol.events}.  See XSendEvent(3X11) for details.

There is also a @code{Window.send_event()} method.

@end defmethod


@defmethod Display ungrab_pointer ( time, onerror = None )

Release a grabbed pointer and any queued events.  See
XUngrabPointer(3X11).

@end defmethod


@defmethod Display change_active_pointer_grab ( event_mask, cursor, time, @w{onerror = None )}

Change the dynamic parameters of a pointer grab.  See
XChangeActivePointerGrab(3X11).

@end defmethod


@defmethod Display ungrab_keyboard ( time, onerror = None )

Ungrab a grabbed keyboard and any queued events.  See
XUngrabKeyboard(3X11).

@end defmethod

@defmethod Display allow_events ( mode, time, @w{onerror = None )}

Release some queued events.  @var{mode} should be one of
@code{X.AsyncPointer}, @code{X.SyncPointer}, @code{X.AsyncKeyboard},
@code{X.SyncKeyboard}, @code{X.ReplayPointer}, @code{X.ReplayKeyboard},
@code{X.AsyncBoth}, or @code{X.SyncBoth}.  @var{time} should be a
timestamp or @code{X.CurrentTime}.

@end defmethod


@defmethod Display grab_server ( onerror = None )

Disable processing of requests on all other client connections until the
server is ungrabbed.  Server grabbing should be avoided as much as
possible.

@end defmethod


@defmethod Display ungrab_server ( onerror = None )

Release the server if it was previously grabbed by this client.

@end defmethod


@defmethod Display warp_pointer ( x, y, @w{src_window = X.NONE,} @w{src_x = 0,} @w{src_y = 0,} @w{src_width = 0,} @w{src_height = 0,} @w{onerror = None )}

Move the pointer relative its current position by the offsets
(@var{x}, @var{y}).  However, if @var{src_window} is a window the
pointer is only moved if the specified rectangle in @var{src_window}
contains it.  If @var{src_width} is 0 it will be replaced with the width
of @var{src_window} - @var{src_x}.  @var{src_height} is treated in a
similar way.

To move the pointer to absolute coordinates, use
@code{Window.warp_pointer()}.

@end defmethod


@defmethod Display set_input_focus ( focus, revert_to, time, @w{onerror = None )}

Set input focus to @var{focus}, which should be a window,
@code{X.PointerRoot} or @code{X.NONE}.  @var{revert_to} specifies where
the focus reverts to if the focused window becomes not visible, and
should be @code{X.RevertToParent}, @code{RevertToPointerRoot}, or
@code{RevertToNone}.  See XSetInputFocus(3X11) for details.

There is also a @code{Window.set_input_focus()}.

@end defmethod


@defmethod Display get_input_focus ( )

Return an object with the following attributes:

@table @code
@item focus
The window which currently holds the input focus, @code{X.NONE} or
@code{X.PointerRoot}. 

@item revert_to
Where the focus will revert, one of @code{X.RevertToParent},
@code{RevertToPointerRoot}, or @code{RevertToNone}.

@end table

@end defmethod


@defmethod Display query_keymap ( )

Return a bit vector for the logical state of the keyboard, where each
bit set to 1 indicates that the corresponding key is currently pressed
down.  The vector is represented as a list of 32 integers.  List item N
contains the bits for keys 8N to 8N + 7 with the least significant bit
in the byte representing key 8N.

@end defmethod


@defmethod Display open_font ( name )

Open the font identifed by the pattern @var{name} and return its font
object.  If @var{name} does not match any font, @code{None} is returned.

@end defmethod

@defmethod Display list_fonts ( pattern, max_names )

Return a list of font names matching @var{pattern}.  No more than
@var{max_names} will be returned.

@end defmethod


@defmethod Display list_fonts_with_info ( pattern, max_names )

Return a list of fonts matching @var{pattern}.  No more than
@var{max_names} will be returned.  Each list item represents one font
and has the following properties:

@table @code
@item name
The name of the font.

@item min_bounds
@itemx max_bounds
@itemx min_char_or_byte2
@itemx max_char_or_byte2
@itemx default_char
@itemx draw_direction
@itemx min_byte1
@itemx max_byte1
@itemx all_chars_exist
@itemx font_ascent
@itemx font_descent
@itemx replies_hint
See the description of XFontStruct in XGetFontProperty(3X11) for details
on these values.

@item properties
A list of properties.  Each entry has two attributes:

@table @code
@item name
The atom identifying this property.

@item value
A 32-bit unsigned value.

@end table

@end table

@end defmethod


@defmethod Display set_font_path ( path, onerror = None )

Set the font path to @var{path}, which should be a list of strings.  If
@var{path} is empty, the default font path of the server will be
restored.

@end defmethod


@defmethod Display get_font_path ( )

Return the current font path as a list of strings.

@end defmethod


@defmethod Display query_extension ( name )

Ask the server if it supports the extension @var{name}.  If it is
supported an object with the following attributes is returned:

@table @code
@item major_opcode
The major opcode that the requests of this extension uses.

@item first_event
The base event code if the extension have additional events, or 0.

@item first_error
The base error code if the extension have additional errors, or 0.

@end table

If the extension is not supported, @code{None} is returned.

@end defmethod


@defmethod Display list_extensions ( )

Return a list of all the extensions provided by the server.

@end defmethod


@defmethod Display change_keyboard_mapping ( first_keycode, keysyms, @w{onerror = None )}

Modify the keyboard mapping, starting with @var{first_keycode}.
@var{keysyms} is a list of tuples of keysyms.  @code{keysyms[n][i]} will
be assigned to keycode @code{first_keycode+n} at index @code{i}.

@end defmethod


@defmethod Display get_keyboard_mapping ( first_keycode, count )

Return the current keyboard mapping as a list of tuples, starting at
@var{first_keycount} and no more than @var{count}.

@end defmethod


@defmethod Display change_keyboard_control ( @w{onerror = None,} **keys )

Change the parameters provided as keyword arguments:

@table @code
@item key_click_percent
The volume of key clicks between 0 (off) and 100 (load).  -1 will restore
default setting.

@item bell_percent
The base volume of the bell, coded as above.

@item bell_pitch
The pitch of the bell in Hz, -1 restores the default.

@item bell_duration
The duration of the bell in milliseconds, -1 restores the default.

@item led
@itemx led_mode
@code{led_mode} should be @code{X.LedModeOff} or @code{X.LedModeOn}.  If
@code{led} is provided, it should be a 32-bit mask listing the LEDs that
should change.  If @code{led} is not provided, all LEDs are changed.

@item key
@itemx auto_repeat_mode
@code{auto_repeat_mode} should be one of @code{X.AutoRepeatModeOff},
@code{X.AutoRepeatModeOn}, or @code{X.AutoRepeatModeDefault}.  If
@code{key} is provided, that key will be modified, otherwise the global
state for the entire keyboard will be modified.

@end table

@end defmethod

@defmethod Display get_keyboard_control ( )

Return an object with the following attributes:

@table @code
@item global_auto_repeat
@code{X.AutoRepeatModeOn} or @code{X.AutoRepeatModeOff}.

@item auto_repeats
A list of 32 integers.  List item N contains the bits for keys 8N to 8N
+ 7 with the least significant bit in the byte representing key 8N.  If
a bit is on, autorepeat is enabled for the corresponding key.

@item led_mask
A 32-bit mask indicating which LEDs are on.

@item key_click_percent
The volume of key click, from 0 to 100.

@item bell_percent
@itemx bell_pitch
@itemx bell_duration
The volume, pitch and duration of the bell.

@end table

@end defmethod


@defmethod Display bell ( percent = 0, onerror = None )

Ring the bell at the volume @var{percent} which is relative the base
volume.  See XBell(3X11).

@end defmethod


@defmethod Display change_pointer_control ( @w{accel = None,} @w{threshold = None,} @w{onerror = None )}

To change the pointer acceleration, set @var{accel} to a tuple
@code{(num, denum)}.  The pointer will then move @code{num/denum} times
the normal speed if it moves beyond the threshold number of pixels at
once.  To change the threshold, set it to the number of pixels.  -1
restores the default.

@end defmethod


@defmethod Display get_pointer_control ( )

Return an object with the following attributes:

@table @code
@item accel_num
@itemx accel_denom
The acceleration as numerator/denumerator.

@item threshold
The number of pixels the pointer must move before the acceleration kicks
in.

@end table

@end defmethod


@defmethod Display set_screen_saver ( timeout, interval, prefer_blank, allow_exposures, @w{onerror = None )}

See XSetScreenSaver(3X11).

@end defmethod


@defmethod Display get_screen_saver ( )

Return an object with the attributes @code{timeout}, @code{interval},
@code{prefer_blanking}, @code{allow_exposures}.  See
XGetScreenSaver(3X11) for details.

@end defmethod


@defmethod Display change_hosts ( mode, host_family, host, @w{onerror = None )}

@var{mode} is either @code{X.HostInsert} or @code{X.HostDelete}.
@var{host_family} is one of @code{X.FamilyInternet},
@code{X.FamilyDECnet}, @code{X.FamilyChaos}, @code{X.FamilyServerInterpreted}
or @code{X.FamilyInternetV6}.

@var{host} is a list of bytes.  For the Internet family, it should be
the four bytes of an IPv4 address.

@end defmethod

@defmethod Display list_hosts ( )

Return an object with the following attributes:

@table @code
@item mode
@code{X.EnableAccess} if the access control list is used,
@code{X.DisableAccess} otherwise.

@item hosts
The hosts on the access list.  Each entry has the following attributes:

@table @code
@item family
@code{X.FamilyInternet}, @code{X.FamilyDECnet}, @code{X.FamilyChaos},
@code{X.FamilyServerInterpreted} or @code{X.FamilyInternetV6}.

@item name
A list of byte values, the coding depends on @code{family}.  For the
Internet family, it is the 4 bytes of an IPv4 address. 

@end table

@end table

@end defmethod


@defmethod Display set_access_control ( mode, onerror = None )

Enable use of access control lists at connection setup if @var{mode} is
@code{X.EnableAccess}, disable if it is @code{X.DisableAccess}.

@end defmethod


@defmethod Display set_close_down_mode ( mode, onerror = None )

Control what will happen with the client's resources at connection
close.  The default is @code{X.DestroyAll}, the other values are
@code{X.RetainPermanent} and @code{X.RetainTemporary}.

@end defmethod


@defmethod Display force_screen_saver ( mode, onerror = None )

If @var{mode} is @code{X.ScreenSaverActive} the screen saver is
activated.  If it is @code{X.ScreenSaverReset}, the screen saver is
deactivated as if device input had been received.

@end defmethod


@defmethod Display set_pointer_mapping ( map )

Set the mapping of the pointer buttons.  @var{map} is a list of logical
button numbers.  @var{map} must be of the same length as the list
returned by @code{Display.get_pointer_mapping()}.

@code{map[n]} sets the logical number for the physical button
@code{n+1}.  Logical number 0 disables the button.  Two physical buttons
cannot be mapped to the same logical number.

If one of the buttons to be altered are logically in the down state,
@code{X.MappingBusy} is returned and the mapping is not changed.
Otherwise the mapping is changed and @code{X.MappingSuccess} is returned.

@end defmethod


@defmethod Display get_pointer_mapping ( )

Return a list of the pointer button mappings.  Entry N in the list sets
the logical button number for the physical button N+1.

@end defmethod


@defmethod Display set_modifier_mapping ( keycodes )

Set the keycodes for the eight modifiers @code{X.Shift}, @code{X.Lock},
@code{X.Control}, @code{X.Mod1}, @code{X.Mod2}, @code{X.Mod3},
@code{X.Mod4} and @code{X.Mod5}.  @var{keycodes} should be a
eight-element list where each entry is a list of the keycodes that
should be bound to that modifier.

If any changed key is logically in the down state, @code{X.MappingBusy}
is returned and the mapping is not changed.  If the mapping violates
some server restriction, @code{X.MappingFailed} is returned.  Otherwise
the mapping is changed and @code{X.MappingSuccess} is returned.

@end defmethod

@defmethod Display get_modifier_mapping ( )

Return a list of eight lists, one for each modifier.  The list can be
indexed using @code{X.ShiftMapIndex}, @code{X.Mod1MapIndex}, and so on.
The sublists list the keycodes bound to that modifier.

@end defmethod

@defmethod Display no_operation ( onerror = None )

Do nothing but send a request to the server.

@end defmethod


@node Resource
@section Resource

All resource objects can be compared and hashed, so they can be used as
mapping indices.  They also have this method:

@defmethod Resource kill_client ( onerror = None )
@end defmethod


@node Colormap
@section Colormap

@xref{Resource}, for additional methods on @code{Colormap} objects.

@defmethod Colormap free ( onerror = None )
@end defmethod

@defmethod Colormap copy_colormap_and_free ( scr_cmap )
Returns Colormap.
@end defmethod

@defmethod Colormap install_colormap ( onerror = None )
@end defmethod

@defmethod Colormap uninstall_colormap ( onerror = None )
@end defmethod

@defmethod Colormap alloc_color ( red, green, blue )
@end defmethod

@defmethod Colormap alloc_named_color ( name )
Returns None or  Card32('pixel'),
Card16('exact_red'),
Card16('exact_green'),
Card16('exact_blue'),
Card16('screen_red'),
Card16('screen_green'),
Card16('screen_blue'),
@end defmethod

@defmethod Colormap alloc_color_cells ( contiguous, colors, planes )
Returns  List('pixels', Card32Obj),
List('masks', Card32Obj),
@end defmethod

@defmethod Colormap alloc_color_planes ( contiguous, colors, red, green, blue )
Returns  Card32('red_mask'),
Card32('green_mask'),
Card32('blue_mask'),
List('pixels', Card32Obj),
@end defmethod

@defmethod Colormap free_colors ( pixels, plane_mask, onerror = None )
@end defmethod

@defmethod Colormap store_colors ( items, onerror = None )
@end defmethod

@defmethod Colormap store_named_color ( name, pixel, flags, onerror = None )
@end defmethod

@defmethod Colormap query_colors ( pixels )
Returns List('colors', structs.RGB),
@end defmethod

@defmethod Colormap lookup_color ( name )
Returns  Card16('exact_red'),
Card16('exact_green'),
Card16('exact_blue'),
Card16('screen_red'),
Card16('screen_green'),
Card16('screen_blue'),
@end defmethod


@node Cursor
@section Cursor

@xref{Resource}, for additional methods on @code{Cursor} objects.

@defmethod Cursor free ( onerror = None )
@end defmethod

@defmethod Cursor recolor ( (fore_red, fore_green, fore_blue), (back_red, back_green, back_blue), onerror = None )
@end defmethod


@node Drawable
@section Drawable

@code{Drawable} is a base class of @code{Window} and @code{Pixmap}
objects.  @xref{Window}, and @ref{Pixmap}.

@xref{Resource}, for additional methods.

@defmethod Drawable get_geometry ( )
Returns
Window('root'),
Int16('x'),
Int16('y'),
Card16('width'),
Card16('height'),
Card16('border_width'),
@end defmethod

@defmethod Drawable create_pixmap ( width, height, depth )
Returns Pixmap.
@end defmethod

@defmethod Drawable create_gc ( **keys )
Returns GC.
@end defmethod

@defmethod Drawable copy_area ( gc, src_drawable, src_x, src_y, width, height, dst_x, dst_y, onerror = None )
@end defmethod

@defmethod Drawable copy_plane ( gc, src_drawable, src_x, src_y, width, height, dst_x, dst_y, bit_plane, onerror = None )
@end defmethod

@defmethod Drawable poly_point ( gc, coord_mode, points, onerror = None )
@end defmethod
request.PolyPoint(display = self.display,
onerror = onerror,
coord_mode = coord_mode,
drawable = self.id,
gc = gc,
points = points)

@defmethod Drawable point ( gc, x, y, onerror = None )
@end defmethod

@defmethod Drawable poly_line ( gc, coord_mode, points, onerror = None )
@end defmethod

@defmethod Drawable line ( gc, x1, y1, x2, y2, onerror = None )
@end defmethod

@defmethod Drawable poly_segment ( gc, segments, onerror = None )
@end defmethod

@defmethod Drawable poly_rectangle ( gc, rectangles, onerror = None )
@end defmethod

@defmethod Drawable rectangle ( gc, x, y, width, height, onerror = None )
@end defmethod

@defmethod Drawable poly_arc ( gc, arcs, onerror = None )
@end defmethod

@defmethod Drawable arc ( gc,  x, y, width, height, angle1, angle2, onerror = None )
@end defmethod

@defmethod Drawable fill_poly ( gc, shape, coord_mode, points, onerror = None )
@end defmethod

@defmethod Drawable poly_fill_rectangle ( gc, rectangles, onerror = None )
@end defmethod

@defmethod Drawable fill_rectangle ( gc, x, y, width, height, onerror = None )
@end defmethod

@defmethod Drawable poly_fill_arc ( gc, arcs, onerror = None )
@end defmethod

@defmethod Drawable fill_arc ( gc,  x, y, width, height, angle1, angle2, onerror = None )
@end defmethod

@defmethod Drawable put_image ( )
Not implemented yet.
@end defmethod

@defmethod Drawable get_image ( )
Not implemented yet.
@end defmethod

@defmethod Drawable draw_text ( gc, x, y, text, onerror = None )
@end defmethod

@defmethod Drawable poly_text ( gc, x, y, items, onerror = None )
@end defmethod

@defmethod Drawable poly_text_16 ( gc, x, y, items, onerror = None )
@end defmethod

@defmethod Drawable image_text ( gc, x, y, string, onerror = None )
@end defmethod

@defmethod Drawable image_text_16 ( gc, x, y, string, onerror = None )
@end defmethod

@defmethod Drawable query_best_size ( item_class, width, height )
Returns
Card16('width'),
Card16('height'),
@end defmethod

@node Window
@section Window

@code{Window} objects have additional objects, see @ref{Resource} and @ref{Drawable}.

@defmethod Window create_window ( x, y, width, height, border_width, depth, window_class =  X.CopyFromParent, visual = X.CopyFromParent, **keys )
Returns Window
@end defmethod

@defmethod Window change_attributes ( onerror = None, **keys )
@end defmethod


@defmethod Window get_attributes ( )
Returns
Card8('backing_store'),
Card32('visual'),
Card16('class'),
Card8('bit_gravity'),
Card8('win_gravity'),
Card32('backing_bit_planes'),
Card32('backing_pixel'),
Card8('save_under'),
Card8('map_is_installed'),
Card8('map_state'),
Card8('override_redirect'),
Colormap('colormap', (X.NONE, )),
Card32('all_event_masks'),
Card32('your_event_mask'),
Card16('do_not_propagate_mask'),
@end defmethod

@defmethod Window destroy ( onerror = None )
@end defmethod

@defmethod Window destroy_sub_windows ( onerror = None )
@end defmethod

@defmethod Window change_save_set ( mode, onerror = None )
@end defmethod

@defmethod Window reparent ( parent, x, y, onerror = None )
@end defmethod

@defmethod Window map ( onerror = None )
@end defmethod

@defmethod Window map_sub_windows ( onerror = None )
@end defmethod

@defmethod Window unmap ( onerror = None )
@end defmethod

@defmethod Window unmap_sub_windows ( onerror = None )
@end defmethod

@defmethod Window configure ( onerror = None, **keys )
@end defmethod

@defmethod Window circulate ( direction, onerror = None )
@end defmethod

@defmethod Window query_tree ( )
Returns
Window('root'),
Window('parent', (X.NONE, )),
List('children', WindowObj),
@end defmethod

@defmethod Window change_property ( property, type, format, data, mode = X.PropModeReplace, onerror = None )
@end defmethod

@defmethod Window delete_property ( property, onerror = None )
@end defmethod

@defmethod Window get_property ( property, type, offset, length, delete = 0 )
Returns None or 
Card32('property_type'),
Card8('format'),
PropertyData('value'),
Card32('bytes_after'),
@end defmethod

@defmethod Window get_full_property ( property, type, sizehint = 10 )
Returns None or 
Card32('property_type'),
Card8('format'),
PropertyData('value'),
Card32('bytes_after'),
@end defmethod

@defmethod Window list_properties ( )
Returns List('atoms', Card32Obj),
@end defmethod

@defmethod Window set_selection_owner ( selection, time, onerror = None )
@end defmethod

@defmethod Window convert_selection ( selection, target, property, time, onerror = None )
@end defmethod

@defmethod Window send_event ( event, event_mask = 0, propagate = 0, onerror = None )
@end defmethod

@defmethod Window grab_pointer ( owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, time )
Returns Card8('status'),
@end defmethod

@defmethod Window grab_button ( button, modifiers, owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, onerror = None )
@end defmethod

@defmethod Window ungrab_button ( button, modifiers, onerror = None )
@end defmethod

@defmethod Window grab_keyboard ( owner_events, pointer_mode, keyboard_mode, time )
Returns Card8('status'),
@end defmethod

@defmethod Window grab_key ( key, modifiers, owner_events, pointer_mode, keyboard_mode, onerror = None )
@end defmethod

@defmethod Window ungrab_key ( key, modifiers, onerror = None )
@end defmethod

@defmethod Window query_pointer ( )
Returns
Card8('same_screen'),
Window('root'),
Window('child', (X.NONE, )),
Int16('root_x'),
Int16('root_y'),
Int16('win_x'),
Int16('win_y'),
Card16('mask'),
@end defmethod

@defmethod Window get_motion_events ( start, stop )
Returns List('events', structs.TimeCoord),
@end defmethod

@defmethod Window translate_coords ( src_window, src_x, src_y )
Returns
Window('child', (X.NONE, )),
Int16('x'),
Int16('y'),
@end defmethod

@defmethod Window warp_pointer ( x, y, src_window = 0, src_x = 0, src_y = 0, src_width = 0, src_height = 0, onerror = None )
@end defmethod

@defmethod Window set_input_focus ( revert_to, time, onerror = None )
@end defmethod

@defmethod Window clear_area ( x = 0, y = 0, width = 0, height = 0, exposures = 0, onerror = None )
@end defmethod

@defmethod Window create_colormap ( visual, alloc )
Returns Colormap.
@end defmethod

@defmethod Window list_installed_colormaps ( )
Returns List('cmaps', ColormapObj),
@end defmethod

@defmethod Window rotate_properties ( properties, delta, onerror = None )
@end defmethod

@defmethod Window set_wm_name ( name, onerror = None )
@end defmethod

@defmethod Window get_wm_name ( )
Returns None or string.
@end defmethod

@defmethod Window set_wm_icon_name ( name, onerror = None )
@end defmethod

@defmethod Window get_wm_icon_name ( )
Returns None or string.
@end defmethod

@defmethod Window set_wm_class ( inst, cls, onerror = None )
@end defmethod

@defmethod Window get_wm_class ( )
Returns None or (instance, class)
@end defmethod

@defmethod Window set_wm_transient_for ( window, onerror = None )
@end defmethod

@defmethod Window get_wm_transient_for ( )
Returns None or Window.
@end defmethod


@defmethod Window set_wm_protocols ( protocols, onerror = None )
@end defmethod

@defmethod Window get_wm_protocols ( )
Returns list of atoms.
@end defmethod

@defmethod Window set_wm_colormap_windows ( windows, onerror = None )
@end defmethod

@defmethod Window get_wm_colormap_windows ( )
Returns list of Windows.
@end defmethod


@defmethod Window set_wm_client_machine ( name, onerror = None )
@end defmethod

@defmethod Window get_wm_client_machine ( )
Returns None or string.
@end defmethod

@defmethod Window set_wm_normal_hints ( hints = {}, onerror = None, **keys )
@end defmethod

@defmethod Window get_wm_normal_hints ( )
Returns  Card32('flags'),
Int32('min_width', default = 0),
Int32('min_height', default = 0),
Int32('max_width', default = 0),
Int32('max_height', default = 0),
Int32('width_inc', default = 0),
Int32('height_inc', default = 0),
Object('min_aspect', Aspect, default = (0, 0)),
Object('max_aspect', Aspect, default = (0, 0)),
Int32('base_width', default = 0),
Int32('base_height', default = 0),
Int32('win_gravity', default = 0),
@end defmethod

@defmethod Window set_wm_hints ( hints = {}, onerror = None, **keys )
@end defmethod

@defmethod Window get_wm_hints ( )
Returns Card32('flags'),
Card32('input', default = 0),
Set('initial_state', 4,
( Xutil.NormalState, Xutil.IconicState ),
default = Xutil.NormalState),
Pixmap('icon_pixmap', default = 0),
Window('icon_window', default = 0),
Int32('icon_x', default = 0),
Int32('icon_y', default = 0),
Pixmap('icon_mask', default = 0),
Window('window_group', default = 0),
@end defmethod

@defmethod Window set_wm_state ( hints = {}, onerror = None, **keys )
@end defmethod

@defmethod Window get_wm_state ( )
Returns  Set('state', 4,
( Xutil.WithdrawnState,
Xutil.NormalState,
Xutil.IconicState )),
Window('icon', ( X.NONE, )),
@end defmethod

@defmethod Window set_wm_icon_size ( hints = {}, onerror = None, **keys )
@end defmethod

@defmethod Window get_wm_icon_size ( )
Returns Card32('min_width'),
Card32('min_height'),
Card32('max_width'),
Card32('max_height'),
Card32('width_inc'),
Card32('height_inc'),
@end defmethod


@node Pixmap
@section Pixmap

@code{Pixmap} objects have additional objects, see @ref{Resource} and
@ref{Drawable}.

@defmethod Pixmap free ( onerror = None )
@end defmethod

@defmethod Pixmap create_cursor ( mask, (fore_red, fore_green, fore_blue), (back_red, back_green, back_blue), x, y )
Returns Cursor.
@end defmethod


@node Fontable
@section Fontable

@code{Fontable} is a base class of @code{GC} and @code{Font}
objects.  @xref{GC}, and @ref{Font}.

@xref{Resource}, for additional methods.

@defmethod Fontable query ( )
Returns
Object('min_bounds', structs.CharInfo),
Object('max_bounds', structs.CharInfo),
Card16('min_char_or_byte2'),
Card16('max_char_or_byte2'),
Card16('default_char'),
Card8('draw_direction'),
Card8('min_byte1,'),
Card8('max_byte1,'),
Card8('all_chars_exist'),
Int16('font_ascent'),
Int16('font_descent'),
List('properties', structs.FontProp),
List('char_infos', structs.CharInfo),
@end defmethod

@defmethod Fontable query_text_extents ( string )
Returns
Card8('draw_direction'),
Int16('font_ascent'),
Int16('font_descent'),
Int16('overall_ascent'),
Int16('overall_descent'),
Int32('overall_width'),
Int32('overall_left'),
Int32('overall_right'),
@end defmethod


@node GC
@section GC 

@code{GC} objects have additional objects, see @ref{Resource} and
@ref{Fontable}. 

@defmethod GC change ( onerror = None, **keys )
@end defmethod

@defmethod GC copy ( src_gc, mask, onerror = None )
@end defmethod

@defmethod GC set_dashes ( offset, dashes, onerror = None )
@end defmethod

@defmethod GC set_clip_rectangles ( x_origin, y_origin, rectangles, ordering, onerror = None )
@end defmethod

@defmethod GC free ( onerror = None )
@end defmethod

@node Font
@section Font

@code{Font} objects have additional objects, see @ref{Resource} and
@ref{Fontable}. 

@defmethod Font close ( onerror = None )
@end defmethod

@defmethod Font create_glyph_cursor ( mask, source_char, mask_char, (fore_red, fore_green, fore_blue), (back_red, back_green, back_blue) )
Returns Cursor.
@end defmethod
