module X11
Included Modules
Defined in:
x11.crx11/any_event.cr
x11/arc.cr
x11/atom.cr
x11/bad_alloc_exception.cr
x11/button_event.cr
x11/c/X.cr
x11/char_struct.cr
x11/circulate_event.cr
x11/circulate_request_event.cr
x11/client_message_event.cr
x11/color.cr
x11/colormap_event.cr
x11/configure_event.cr
x11/configure_request_event.cr
x11/create_window_event.cr
x11/crossing_event.cr
x11/destroy_window_event.cr
x11/display.cr
x11/error_event.cr
x11/event.cr
x11/expose_event.cr
x11/ext_codes.cr
x11/ext_data.cr
x11/focus_change_event.cr
x11/font_struct.cr
x11/gc_values.cr
x11/generic_event.cr
x11/graphics_expose_event.cr
x11/gravity_event.cr
x11/host_address.cr
x11/image.cr
x11/key_event.cr
x11/keyboard_control.cr
x11/keyboard_state.cr
x11/keymap_event.cr
x11/map_event.cr
x11/map_request_event.cr
x11/mapping_event.cr
x11/mb_text_item.cr
x11/modifier_keymap.cr
x11/motion_event.cr
x11/no_expose_event.cr
x11/pixmap_format_values.cr
x11/point.cr
x11/property_event.cr
x11/rectangle.cr
x11/reparent_event.cr
x11/resize_request_event.cr
x11/screen.cr
x11/segment.cr
x11/selection_clear_event.cr
x11/selection_event.cr
x11/selection_request_event.cr
x11/server_interpreted_address.cr
x11/set_window_attributes.cr
x11/text_item 16.cr
x11/text_item.cr
x11/time_coord.cr
x11/unmap_event.cr
x11/version.cr
x11/visibility_event.cr
x11/visual.cr
x11/wc_text_item.cr
x11/window_changes.cr
x11/window_event.cr
Constant Summary
-
VERSION =
"1.0.0"
Class Method Summary
-
.all_planes : UInt64
Returns a value with all bits set to 1 suitable for use in a plane argument to a procedure.
-
.find_on_extension_list(structure : Pointer(X11::C::X::PExtData), number : Int32) : ExtData | Nil
Returns the first extension data structure for the extension numbered number.
-
.free(data : X11::C::PChar) : Int32
Frees the specified data.
-
.free_string_list(list : X11::C::PPChar)
Releases memory.
-
.g_context_from_gc(gc : X11::C::X::GC) : X11::C::GContext
Returns GC-context from GC.
-
.init_threads : X11::C::Status
Initializes Xlib support for concurrent threads.
-
.keysym_to_string(keysym : X11::C::KeySym) : String
Returns the string representation of a given keysym.
-
.parse_geometry(parse_string : String) : NamedTuple(x: Int32, y: Int32, width: UInt32, height: UInt32, res: Int32)
Allows you to parse the standard window geometry.
-
.set_error_handler(handler : X11::C::X::ErrorHandler) : X11::C::X::ErrorHandler
Sets the error handler.
-
.set_io_error_handler(handler : X11::C::X::IOErrorHandler) : X11::C::X::IOErrorHandler
Sets the I/O error handler.
-
.set_locale_modifiers(modifier_list : String) : String
Sets the X modifiers for the current locale setting.
-
.string_to_keysym(string : String) : X11::C::KeySym
Returns the KeySym representation of a given string.
-
.supports_locale : Bool
Returns true if Xlib functions are capable of operating under the current locale.
Class methods inherited from module X11::C
add_pixel(ximage, value)
add_pixel,
add_rect(reg, r, rx1, ry1, rx2, ry2)
add_rect,
add_rect_nox(reg, r, rx1, ry1, rx2, ry2)
add_rect_nox,
all_planes
all_planes,
bitmap_bit_order(dpy)
bitmap_bit_order,
bitmap_pad(dpy)
bitmap_pad,
bitmap_unit(dpy)
bitmap_unit,
black_pixel(dpy, scr)
black_pixel,
black_pixel_of_screen(s)
black_pixel_of_screen,
cells_of_screen(s)
cells_of_screen,
check_previous(reg, r, rx1, ry1, rx2, ry2)
check_previous,
connection_number(dpy)
connection_number,
default_colormap(dpy, scr)
default_colormap,
default_colormap_of_screen(s)
default_colormap_of_screen,
default_depth(dpy, scr)
default_depth,
default_depth_of_screen(s)
default_depth_of_screen,
default_gc(dpy, scr)
default_gc,
default_gc_of_screen(s)
default_gc_of_screen,
default_root_window(dpy)
default_root_window,
default_screen(dpy)
default_screen,
default_screen_of_display(dpy)
default_screen_of_display,
default_visual(dpy, scr)
default_visual,
default_visual_of_screen(s)
default_visual_of_screen,
destroy_image(ximage)
destroy_image,
display_cells(dpy, scr)
display_cells,
display_height(dpy, scr)
display_height,
display_height_mm(dpy, scr)
display_height_mm,
display_of_screen(s)
display_of_screen,
display_planes(dpy, scr)
display_planes,
display_string(dpy)
display_string,
display_width(dpy, scr)
display_width,
display_width_mm(dpy, scr)
display_width_mm,
does_backing_store(s)
does_backing_store,
does_save_unders(s)
does_save_unders,
empty_region(p_reg)
empty_region,
event_mask_of_screen(s)
event_mask_of_screen,
extent_check(r1, r2)
extent_check,
extents(r, id_rect)
extents,
get_pixel(ximage, x, y)
get_pixel,
height_mm_of_screen(s)
height_mm_of_screen,
height_of_screen(s)
height_of_screen,
image_byte_order(dpy)
image_byte_order,
inbox(r, x, y)
inbox,
is_cursor_key(keysym : KeySym)
is_cursor_key,
is_function_key(keysym : KeySym)
is_function_key,
is_keypad_key(keysym : KeySym)
is_keypad_key,
is_misc_function_key(keysym : KeySym)
is_misc_function_key,
is_modifier_key(keysym : KeySym)
is_modifier_key,
is_pf_key(keysym : KeySym)
is_pf_key,
is_private_keypad_key(keysym : KeySym)
is_private_keypad_key,
last_known_request_processed(dpy)
last_known_request_processed,
max(a, b)
max,
max_cmaps_of_screen(s)
max_cmaps_of_screen,
min(a, b)
min,
min_cmaps_of_screen(s)
min_cmaps_of_screen,
next_request(dpy)
next_request,
planes_of_screen(s)
planes_of_screen,
protocol_revision(dpy)
protocol_revision,
protocol_version(dpy)
protocol_version,
put_pixel(ximage, x, y, pixel)
put_pixel,
q_length(dpy)
q_length,
region_not_empty(p_reg)
region_not_empty,
root_window(dpy, scr)
root_window,
root_window_of_screen(s)
root_window_of_screen,
screen_count(dpy)
screen_count,
screen_of_display(dpy, scr)
screen_of_display,
server_vendor(dpy)
server_vendor,
string_to_context(string)
string_to_context,
sub_image(ximage, x, y, width, height)
sub_image,
unique_context
unique_context,
vendor_release(dpy)
vendor_release,
white_pixel(dpy, scr)
white_pixel,
white_pixel_of_screen(s)
white_pixel_of_screen,
width_mm_of_screen(s)
width_mm_of_screen,
width_of_screen(s)
width_of_screen
Class Method Detail
Returns a value with all bits set to 1 suitable for use in a plane argument to a procedure.
Returns the first extension data structure for the extension numbered number.
###Arguments
- structure Specifies the extension list.
- number Specifies the extension number from
Display::init_extension
.
###Description
The .find_on_extension_list
function returns the first extension data
structure for the extension numbered number. It is expected that an extension
will add at most one extension data structure to any single data structure's
extension data list. There is no way to find additional structures.
Frees the specified data.
###Arguments
- data Specifies the data that is to be freed.
###Description
The .free
function is a general-purpose Xlib routine that frees the specified data.
You must use it to free any objects that were allocated by Xlib, unless an
alternate function is explicitly specified for the object. A null pointer
cannot be passed to this function.
Releases memory.
###Arguments
- list Specifies the list of strings to be freed.
###Description
The .free_string_list
function releases memory allocated by
Display::mb_text_property_to_text_list
and TextProperty::to_string_list
and the missing charset list allocated by Display::create_font_set
.
###See also
X11::alloc_class_hint
, X11::alloc_icon_size
, X11::alloc_size_hints
,
X11::alloc_wm_hints
, X11::free
, Display::set_command
,
Display::set_transient_for_hint
, Display::set_text_property
,
Display::set_wm_client_machine
, Display::set_wm_colormap_windows
,
Display::set_wm_icon_name
, Display::set_wm_name
, Display::set_wm_properties
,
Display::set_wm_protocols
, string_list_to_text_property
, TextProperty::to_string_list
.
Returns GC-context from GC.
###Arguments
- gc Specifies the GC for which you want the resource ID.
###See also
Display::all_planes
, Display::change_gc
, Display::copy_area
,
Display::copy_gc
, Display::create_gc
, Display::draw_arc
,
Display::draw line
, Display::draw_rectangle
, Display::draw_text
,
Display::fill_rectangle
, Display::free_gc
, Display::gc_values
,
Display::query_best_size
, Display::set_arc_mode
, Display::set_clip_origin
.
Initializes Xlib support for concurrent threads.
###Description
The .init_threads
function initializes Xlib support for concurrent threads.
This function must be the first Xlib function a multi-threaded program calls,
and it must complete before any other Xlib call is made. This function
returns a nonzero status if initialization was successful; otherwise, it returns zero.
On systems that do not support threads, this function always returns zero.
It is only necessary to call this function if multiple threads might use Xlib
concurrently. If all calls to Xlib functions are protected by some other access
mechanism (for example, a mutual exclusion lock in a toolkit or through explicit
client programming), Xlib thread initialization is not required. It is recommended
that single-threaded programs not call this function.
Returns the string representation of a given keysym.
###Arguments
- keysym Specifies the
X::C::KeySym
that is to be converted.
###Description
The returned string is in a static area and must not be modified.
The returned string is in the Host Portable Character Encoding.
If the specified KeySym
is not defined, returns an empty String
.
###See also
Display::keycode_to_keysym
, KeyEvent::lookup_keysym
.
Allows you to parse the standard window geometry.
###Arguments
- parse_string Specifies the string you want to parse.
###Returns
- x, y Return the x and y offsets.
- width, height Return the width and height determined.
###Description
By convention, X applications use a standard string to indicate window size
and placement. .parse_geometry
makes it easier to conform to this standard
because it allows you to parse the standard window geometry. Specifically,
this function lets you parse strings of the form:
[=][<width>{xX}<height>][{+-}<xoffset>{+-}<yoffset>]
The fields map into the arguments associated with this function. (Items enclosed in <> are integers, items in [] are optional, and items enclosed in {} indicate "choose one of." Note that the brackets should not appear in the actual string.) If the string is not in the Host Portable Character Encoding, the result is implementation dependent.
The .parse_geometry
function returns a bitmask that indicates which of the
four values (width, height, xoffset, and yoffset) were actually found in the
string and whether the x and y values are negative. By convention, -0 is not
equal to +0, because the user needs to be able to say "position the window
relative to the right or bottom edge." For each value found, the
corresponding argument is updated. For each value not found, the argument is
left unchanged. The bits are represented by XValue, YValue,
WidthValue, HeightValue, XNegative, or YNegative and are
defined in x11/c/Xutil.cr
. They will be set whenever one of the values is
defined or one of the signs is set.
If the function returns either the XValue or YValue flag, you should place the window at the requested position.
###See also
Display::wm_geometry
, Display::set_wm_properties
.
Sets the error handler.
###Arguments
- handler Specifies the program's supplied error handler.
###Description Xlib generally calls the program's supplied error handler whenever an error is received. It is not called on BadName errors from OpenFont, LookupColor, or AllocNamedColor protocol requests or on BadFont errors from a QueryFont protocol request. These errors generally are reflected back to the program through the procedural interface. Because this condition is not assumed to be fatal, it is acceptable for your error handler to return; the returned value is ignored. However, the error handler should not call any functions (directly or indirectly) on the display that will generate protocol requests or that will look for input events. The previous error handler is returned.
###See also
display_name
, Display::error_database_text
, Display::error_text
,
Display::new
, .set_io_error_handler
, Display::synchronize
.
Sets the I/O error handler.
###Arguments
- handler Specifies the program's supplied error handler.
###Description
The .set_io_error_handler
sets the fatal I/O error handler. Xlib calls the
program's supplied error handler if any sort of system call error occurs
(for example, the connection to the server was lost). This is assumed to be
a fatal condition, and the called routine should not return. If the I/O error
handler does return, the client process exits.
Note that the previous error handler is returned.
###See also
display_name
, Display::error_database_text
, Display::error_text
,
Display::new
, .set_error_handler
, Display::synchronize
.
Sets the X modifiers for the current locale setting.
###Arguments
- modifier_list Specifies the modifiers.
###Description
The .set_locale_modifiers
function sets the X modifiers for the current
locale setting. The modifier_list argument is a null-terminated string of
the form {@category=value}
, that is, having zero or more concatenated
@category=value
entries, where category is a category name and value is
the (possibly empty) setting for that category. The values are encoded in
the current locale. Category names are restricted to the POSIX Portable
Filename Character Set.
The local host X locale modifiers announcer (on POSIX-compliant systems, the XMODIFIERS environment variable) is appended to the modifier_list to provide default values on the local host. If a given category appears more than once in the list, the first setting in the list is used. If a given category is not included in the full modifier list, the category is set to an implementation-dependent default for the current locale. An empty value for a category explicitly specifies the implementation-dependent default.
If the function is successful, it returns a pointer to a string. The contents
of the string are such that a subsequent call with that string (in the same
locale) will restore the modifiers to the same settings. If modifier_list is
a empty srting, .set_locale_modifiers
also returns a pointer to such a string,
and the current locale modifiers are not changed.
If invalid values are given for one or more modifier categories supported by the locale, an empty string is returned, and none of the current modifiers are changed.
At program startup, the modifiers that are in effect are unspecified until the
first successful call to set them. Whenever the locale is changed, the modifiers
that are in effect become unspecified until the next successful call to set them.
Clients should always call .set_locale_modifiers
with a non-empty modifier_list
after setting the locale before they call any locale-dependent Xlib routine.
The only standard modifier category currently defined is im
, which identifies
the desired input method. The values for input method are not standardized.
A single locale may use multiple input methods, switching input method under
user control. The modifier may specify the initial input method in effect or
an ordered list of input methods. Multiple input methods may be specified in
a single im value string in an implementation-dependent manner.
The returned modifiers string is owned by Xlib and should not be modified or freed by the client. It may be freed by Xlib after the current locale or modifiers are changed. Until freed, it will not be modified by Xlib.
Returns the KeySym representation of a given string.
###Arguments
- string Specifies the name of the KeySym that is to be converted.
###Description
Standard KeySym names are obtained from x11/c/keysymdef.cr
by removing the
XK_ prefix from each name. KeySyms that are not part of the Xlib standard also
may be obtained with this function. The set of KeySyms that are available in
this manner and the mechanisms by which Xlib obtains them is implementation dependent.
If the KeySym name is not in the Host Portable Character Encoding, the
result is implementation dependent. If the specified string does not match
a valid KeySym, .string_to_keysym
returns NoSymbol
.
###See also
convert_case
, Display::keycode_to_keysym
, .keysym_to_string
, KeyEvent::lookup_keysym
.
Returns true if Xlib functions are capable of operating under the current locale. If it returns false.