X11-Window

Offers support for displaying 2D output in a rectangular area called window on a screen served by an X11 display server.

Summary
X11-WindowOffers support for displaying 2D output in a rectangular area called window on a screen served by an X11 display server.
CopyrightThis program is free software.
Files
C-kern/api/platform/X11/x11window.hHeader file X11-Window.
C-kern/platform/X11/x11window.cImplementation file X11-Window impl.
Types
struct x11window_tExport x11window_t into global namespace.
struct x11window_evh_tExport x11window_evh_t into global namespace.
Enumerations
x11window_state_eState of a x11window_t object.
x11window_flags_eAdditional state flags inidicating ownership of system resources.
Functions
test
unittest_platform_X11_x11windowTest x11window_t functionality.
x11window_evh_tCallback interface for X11 events.
oncloseThe event handler is called if the user requested to close the window.
ondestroyThe event handler is called if the window was destroyed by another process.
onredrawThe event handler is called if the window was (partially) obscured and the obscured content has to be redrawn.
onreshapeThe event handler is called whenever the geometry of the window changes.
onvisibleThe event handler is called whenever the window changes from hidden to shown state or vice versa.
generic
x11window_evh_INITStatic initializer.
genericcast_x11windowevhCasts parameter evhimpl into pointer to interface x11window_evh_t.
x11window_evh_DECLAREDeclares an interface function table for getting notified if window an event has occurred.
x11window_tDisplays a window (rectangular area) on a screen.
displayReference to x11display_t.
sys_drawableX window ID.
sys_colormapX window ID.
evhimplReference to x11window_evh_t which handles events.
stateCurrent state of window (shown, hidden, destroyed).
flagsAdditional flags inidicating ownership of system objects.
lifetime
x11window_FREEStatic initializer.
init_x11windowCreate a native X11 window on x11screen and assign it to x11win.
initvid_x11windowCreate a native X11 window on x11screen and assign it to x11win.
initmove_x11windowMust be called if address of x11window_t changes.
free_x11windowFrees all associated resources in case <w11window_t.flags> inidcates ownership.
query
display_x11windowReturns the display the window is associated with.
screen_x11windowReturns the screen number the window is located on.
flags_x11windowReturns flags which indicate ownership state of system resources.
state_x11windowReturns the state of the window as seen by the user.
title_x11windowReturns the window title string in title encoded in UTF-8.
pos_x11windowReturns the position of the window in screen coordinates.
size_x11windowReturns the width and height of the window in pixels.
geometry_x11windowThis is the geometry of x11win without the window manager frame in screen coordinates.
frame_x11windowThis is the geometry of window including the window manager frame in screen coordinates.
isfree_x11windowReturns true if x11win is set to x11window_FREE.
update
show_x11windowMakes window visible to the user.
hide_x11windowIn X11 terms unmaps a window: makes it invisible to the user.
setpos_x11windowChanges the position of the window on the screen.
resize_x11windowChanges the size of the window.
sendclose_x11windowSends a close request to a window.
sendredraw_x11windowSends a redraw event to a window.
settitle_x11windowSets the text of the window titile bar.
setopacity_x11windowSets the opacity of the window and its window manager frame.
swapbuffer_x11windowChanges the content of the double buffer with the window.
generic
genericcast_x11windowCasts a pointer to object into a pointer to x11window_t.
helper
configfilter_x11windowReturns a <gconfig_filter_f> which helps to filter for a specific window visual.
inline implementation
x11window_evh_t
genericcast_x11windowevhImplements x11window_evh_t.genericcast_x11windowevh.
x11window_evh_DECLAREImplements x11window_evh_t.x11window_evh_DECLARE.
x11window_t
display_x11windowImplements x11window_t.display_x11window.
flags_x11windowImplements x11window_t.flags_x11window.
isfree_x11windowImplements x11window_t.isfree_x11window.
pos_x11windowImplements x11window_t.pos_x11window.
size_x11windowImplements x11window_t.size_x11window.
state_x11windowImplements x11window_t.state_x11window.
genericcast_x11windowImplements x11window_t.genericcast_x11window.

Copyright

This program is free software.  You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

Author

© 2013 Jörg Seebohn

Files

C-kern/api/platform/X11/x11window.h

Header file X11-Window.

C-kern/platform/X11/x11window.c

Implementation file X11-Window impl.

Types

struct x11window_t

typedef struct x11window_t x11window_t

Export x11window_t into global namespace.

struct x11window_evh_t

typedef struct x11window_evh_t x11window_evh_t

Export x11window_evh_t into global namespace.

Enumerations

x11window_state_e

State of a x11window_t object.

x11window_state_DESTROYEDThe window is destroyed.  This state is set if you call <free_x11window> or after some other process destroyed the window (for example xkill) and the destroy event is handled in the internal dispatch loop.
x11window_state_HIDDENThe window is created but not shown to the user (iconic or minimized state).
x11window_state_SHOWNThe window is created and shown to the user but may be only partially visible or obscured by another window.

x11window_flags_e

Additional state flags inidicating ownership of system resources.

x11window_flags_OWNWINDOWThe system window is owned by this object.  Freeing this object also frees the system handle.
x11window_flags_OWNCOLORMAPThe system colormap is owned by this object.  Freeing this object also frees the system handle.

Functions

test

unittest_platform_X11_x11window

int unittest_platform_X11_x11window(void)

Test x11window_t functionality.

x11window_evh_t

struct x11window_evh_t

Callback interface for X11 events.

Summary
oncloseThe event handler is called if the user requested to close the window.
ondestroyThe event handler is called if the window was destroyed by another process.
onredrawThe event handler is called if the window was (partially) obscured and the obscured content has to be redrawn.
onreshapeThe event handler is called whenever the geometry of the window changes.
onvisibleThe event handler is called whenever the window changes from hidden to shown state or vice versa.
generic
x11window_evh_INITStatic initializer.
genericcast_x11windowevhCasts parameter evhimpl into pointer to interface x11window_evh_t.
x11window_evh_DECLAREDeclares an interface function table for getting notified if window an event has occurred.

onclose

void (*onclose) (x11window_t * x11win)

The event handler is called if the user requested to close the window.  You can save state information before calling <free_x11window>.

ondestroy

void (*ondestroy) (x11window_t * x11win)

The event handler is called if the window was destroyed by another process.  The x11window_t.state is set to x11window_state_DESTROYED before this callback is called.  You must call <free_x11window> - any other function which uses x11window_t.sys_drawable as parameter would cause an Xlib error which would cause the process to abort.  Not calling <free_x11window> results in a memory leak.  Calling <free_x11window> in response to an onclose event does not trigger an ondestroy callback.

onredraw

void (*onredraw) (x11window_t * x11win)

The event handler is called if the window was (partially) obscured and the obscured content has to be redrawn.

onreshape

void (*onreshape) (x11window_t * x11win, uint32_t width, uint32_t height)

The event handler is called whenever the geometry of the window changes.  The x and y coordinates can be queried for with a call to pos_x11window.

onvisible

void (*onvisible) (x11window_t * x11win, bool isVisible)

The event handler is called whenever the window changes from hidden to shown state or vice versa.  If isVisible is set the window state is x11window_state_SHOWN else x11window_state_HIDDEN.

generic

x11window_evh_INIT

#define x11window_evh_INIT(
   subwindow_fct_suffix
) { & onclose ## subwindow_fct_suffix, & ondestroy ## subwindow_fct_suffix, & onredraw ## subwindow_fct_suffix, & onreshape ## subwindow_fct_suffix, & onvisible ## subwindow_fct_suffix }

Static initializer.

genericcast_x11windowevh

const x11window_evh_t * genericcast_x11windowevh(const void *evhimpl,
TYPENAME subwindow_t)

Casts parameter evhimpl into pointer to interface x11window_evh_t.  The parameter evhimpl has to be of type pointer to type declared with x11window_evh_DECLARE.  The other parameters must be the same as in x11window_evh_DECLARE without the first.

x11window_evh_DECLARE

void x11window_evh_DECLARE(TYPENAME declared_evh_t,
TYPENAME subwindow_t)

Declares an interface function table for getting notified if window an event has occurred.  The declared interface is structural compatible with x11window_evh_t.  See x11window_evh_t for a list of declared functions.

Parameter

declared_evh_tThe name of the structure which is declared as the interface.  The name should have the suffix “_evh_t”.
subwindow_tThe window subtype for which declared_evh_t implements the callback functions.

x11window_t

struct x11window_t

Displays a window (rectangular area) on a screen.  The window can have a frame and title bar which is draw and managed by the window manager.  Use <windowconfig_INIT_FRAME> in your configuration list before calling init_x11window to add a frame and title bar.  Use <windowconfig_INIT_TITLE> to name the title bar.

Summary
displayReference to x11display_t.
sys_drawableX window ID.
sys_colormapX window ID.
evhimplReference to x11window_evh_t which handles events.
stateCurrent state of window (shown, hidden, destroyed).
flagsAdditional flags inidicating ownership of system objects.
lifetime
x11window_FREEStatic initializer.
init_x11windowCreate a native X11 window on x11screen and assign it to x11win.
initvid_x11windowCreate a native X11 window on x11screen and assign it to x11win.
initmove_x11windowMust be called if address of x11window_t changes.
free_x11windowFrees all associated resources in case <w11window_t.flags> inidcates ownership.
query
display_x11windowReturns the display the window is associated with.
screen_x11windowReturns the screen number the window is located on.
flags_x11windowReturns flags which indicate ownership state of system resources.
state_x11windowReturns the state of the window as seen by the user.
title_x11windowReturns the window title string in title encoded in UTF-8.
pos_x11windowReturns the position of the window in screen coordinates.
size_x11windowReturns the width and height of the window in pixels.
geometry_x11windowThis is the geometry of x11win without the window manager frame in screen coordinates.
frame_x11windowThis is the geometry of window including the window manager frame in screen coordinates.
isfree_x11windowReturns true if x11win is set to x11window_FREE.
update
show_x11windowMakes window visible to the user.
hide_x11windowIn X11 terms unmaps a window: makes it invisible to the user.
setpos_x11windowChanges the position of the window on the screen.
resize_x11windowChanges the size of the window.
sendclose_x11windowSends a close request to a window.
sendredraw_x11windowSends a redraw event to a window.
settitle_x11windowSets the text of the window titile bar.
setopacity_x11windowSets the opacity of the window and its window manager frame.
swapbuffer_x11windowChanges the content of the double buffer with the window.
generic
genericcast_x11windowCasts a pointer to object into a pointer to x11window_t.
helper
configfilter_x11windowReturns a <gconfig_filter_f> which helps to filter for a specific window visual.

display

struct x11display_t* display

Reference to x11display_t.  Every call to X library needs this parameter.

sys_drawable

uint32_t sys_drawable

X window ID.  The ID describes a drawable of type window.

sys_colormap

uint32_t sys_colormap

X window ID.  The ID describes a colormap which is associated with the window.  A colormap is used to map the window pixel depth to the screen pixel depth.

evhimpl

const x11window_evh_t * evhimpl

Reference to x11window_evh_t which handles events.

state

uint8_t state

Current state of window (shown, hidden, destroyed).  See x11window_state_e.

flags

uint8_t flags

Additional flags inidicating ownership of system objects.  See x11window_flags_e.

lifetime

x11window_FREE

#define x11window_FREE { 0, 0, 0, 0, 0, 0 }

Static initializer.

init_x11window

int init_x11window(/*out*/x11window_t *x11win,
struct x11display_t *x11disp,
uint32_t screennr,
const struct x11window_evh_t *eventhandler,
const int32_t *gconf_attrib,
const struct windowconfig_t *winconf_attrib)

Create a native X11 window on x11screen and assign it to x11win.  After successful return state_x11window returns x11window_state_HIDDEN.  Call show_x11window to show the window to the user.  Do not use this function to initialize an X11 window with OpenGL specific attributes.  Use initvid_x11window instead and determine the visualid with visualid_gconfig - see gconfig_t.

initvid_x11window

int initvid_x11window(/*out*/x11window_t *x11win,
struct x11display_t *x11disp,
uint32_t screennr,
const struct x11window_evh_t *eventhandler,
/*(X11) VisualID*/uint32_t config_visualid,
const struct windowconfig_t *winconf_attrib)

Create a native X11 window on x11screen and assign it to x11win.  Same as init_x11window except that the visual type of the window is not determined by a list of gconfig_e attributes but with parameter config_visualid which holds the ID of the X11 visual.  The visual of a window determines its capabilities like nr of bits per color channel, double buffering and other OpenGL related stuff.

initmove_x11window

int initmove_x11window(/*out*/x11window_t *dest_x11win,
x11window_t *src_x11win)

Must be called if address of x11window_t changes.  A simple memcpy from source to destination does not work.

free_x11window

int free_x11window(x11window_t *x11win)

Frees all associated resources in case <w11window_t.flags> inidcates ownership.  If the object does not own the system resources they are not freed.  You can use this to wrap system windows (desktop window for example) into an x11window_t object.

query

display_x11window

struct x11display_t * display_x11window(const x11window_t *x11win)

Returns the display the window is associated with.

screen_x11window

uint32_t screen_x11window(const x11window_t *x11win)

Returns the screen number the window is located on.

flags_x11window

x11window_flags_e flags_x11window(const x11window_t *x11win)

Returns flags which indicate ownership state of system resources.  See x11window_flags_e.

state_x11window

x11window_state_e state_x11window(const x11window_t *x11win)

Returns the state of the window as seen by the user.  See x11window_state_e.  After calling init_x11window the state is set to x11window_state_HIDDEN.

title_x11window

int title_x11window(const x11window_t *x11win,
/*ret*/struct cstring_t *title)

Returns the window title string in title encoded in UTF-8.

pos_x11window

int pos_x11window(const x11window_t *x11win,
/*out*/int32_t *screen_x,
/*out*/int32_t *screen_y)

Returns the position of the window in screen coordinates.  The value (screen_x == 0, screen_y == 0) denotes the top left corner of the screen.

size_x11window

int size_x11window(const x11window_t *x11win,
/*out*/uint32_t *width,
/*out*/uint32_t *height)

Returns the width and height of the window in pixels.

geometry_x11window

int geometry_x11window(const x11window_t *x11win,
/*out*/int32_t *screen_x,
/*out*/int32_t *screen_y,
/*out*/uint32_t *width,
/*out*/uint32_t *height)

This is the geometry of x11win without the window manager frame in screen coordinates.  The value (screen_x == 0, screen_y == 0) denotes the top left corner of the screen.

frame_x11window

int frame_x11window(const x11window_t *x11win,
/*out*/int32_t *screen_x,
/*out*/int32_t *screen_y,
/*out*/uint32_t *width,
/*out*/uint32_t *height)

This is the geometry of window including the window manager frame in screen coordinates.  The value (screen_x == 0, screen_y == 0) denotes the top left corner of the screen.

isfree_x11window

static inline bool isfree_x11window(const x11window_t *x11win)

Returns true if x11win is set to x11window_FREE.

update

show_x11window

int show_x11window(x11window_t *x11win)

Makes window visible to the user.  In X11 speak it is mapped.  After receiveing the notification from the X server the window state is set to x11window_state_SHOWN.

hide_x11window

int hide_x11window(x11window_t *x11win)

In X11 terms unmaps a window: makes it invisible to the user.  After receiveing the notification from the X server the window state is set to x11window_state_HIDDEN.

setpos_x11window

int setpos_x11window(x11window_t *x11win,
int32_t screen_x,
int32_t screen_y)

Changes the position of the window on the screen.  Coordinates are in screen coordinates.  The coordinate (0,0) is top left.

resize_x11window

int resize_x11window(x11window_t *x11win,
uint32_t width,
uint32_t height)

Changes the size of the window.  Parameter width and height must be > 0 else result is undefined.

sendclose_x11window

int sendclose_x11window(x11window_t *x11win)

Sends a close request to a window.  If the window has installed an event handler it should free (destroy) the window after having received the request.

sendredraw_x11window

int sendredraw_x11window(x11window_t *x11win)

Sends a redraw event to a window.  If no event handler is installed nothing is received.

settitle_x11window

int settitle_x11window(const x11window_t *x11win,
const char *title)

Sets the text of the window titile bar.  This function assumes title to be encoded in UTF-8.

setopacity_x11window

int setopacity_x11window(x11window_t *x11win,
double opacity)

Sets the opacity of the window and its window manager frame.  An opacity value of 1 draws the window opaque.  A value of 0 makes it totally translucent.  If opacity is set to a value outside of [0..1] EINVAL is returned.  The opacity is different from gconfig_TRANSPARENT_ALPHA.  A value of 0 makes the window invisible.

Wheras an alpha value of 0 in case of gconfig_TRANSPARENT_ALPHA does contribute by adding it to the background value.

Blending Function

Screen-Pixel-RGB = (Window-Pixel-Alpha) * Window-Pixel-RGB + (1 - Window-Pixel-Alpha) * Background-Pixel-RGB

Precondition

For the function to work the X11 server and window manager must support the X11 composite extension.

swapbuffer_x11window

int swapbuffer_x11window(x11window_t *x11win)

Changes the content of the double buffer with the window.  Do not call this function if no x11dblbuffer_t has been allocated.

generic

genericcast_x11window

x11window_t * genericcast_x11window(void *object)

Casts a pointer to object into a pointer to x11window_t.  All fields of object must be compatible with x11window_t and at the same offset.

helper

configfilter_x11window

int configfilter_x11window(/*out*/struct gconfig_filter_t *filter,
const int32_t config_attributes[])

Returns a <gconfig_filter_f> which helps to filter for a specific window visual.  The content of the array config_attributes must be the same as it will be used in <initfiltered_gconfig>.  The returned filter is never null and either it returns always true and selects the first matching surface configuration or in case of gconfig_TRANSPARENT_ALPHA switched on it returns only true for a configuration which supports this feature under X11.  The first supplied value of gconfig_TRANSPARENT_ALPHA in config_attributes is used.  Do not define attributes more than once else the returned filter could be the wrong one.  If more than gconfig_NROFELEMENTS attributes are defined in config_attributes error E2BIG is returned.

x11window_evh_t

genericcast_x11windowevh

#define genericcast_x11windowevh(
   evhimpl,
   subwindow_t
) ( __extension__ ({ static_assert( offsetof(typeof(*(evhimpl)), onclose) == offsetof(x11window_evh_t, onclose) && offsetof(typeof(*(evhimpl)), ondestroy) == offsetof(x11window_evh_t, ondestroy) && offsetof(typeof(*(evhimpl)), onredraw) == offsetof(x11window_evh_t, onredraw) && offsetof(typeof(*(evhimpl)), onreshape) == offsetof(x11window_evh_t, onreshape) && offsetof(typeof(*(evhimpl)), onvisible) == offsetof(x11window_evh_t, onvisible), "ensure same structure"); if (0) { (evhimpl)->onclose((subwindow_t*)0); (evhimpl)->ondestroy((subwindow_t*)0); (evhimpl)->onredraw((subwindow_t*)0); (evhimpl)->onreshape((subwindow_t*)0, (uint32_t)0, (uint32_t)0); (evhimpl)->onvisible((subwindow_t*)0, (bool)0); } (const x11window_evh_t*) (evhimpl); }))

Implements x11window_evh_t.genericcast_x11windowevh.

x11window_evh_DECLARE

#define x11window_evh_DECLARE(
   declared_evh_t,
   subwindow_t
) typedef struct declared_evh_t declared_evh_t; struct declared_evh_t { void (* onclose) (subwindow_t * x11win); void (* ondestroy) (subwindow_t * x11win); void (* onredraw) (subwindow_t * x11win); void (* onreshape) (subwindow_t * x11win, uint32_t width, uint32_t height); void (* onvisible) (subwindow_t * x11win, bool isVisible); }

Implements x11window_evh_t.x11window_evh_DECLARE.

x11window_t

display_x11window

#define display_x11window(x11win) ((x11win)->display)

Implements x11window_t.display_x11window.

flags_x11window

#define flags_x11window(x11win) ((x11window_flags_e)(x11win)->flags)

Implements x11window_t.flags_x11window.

isfree_x11window

static inline bool isfree_x11window(const x11window_t *x11win)

Implements x11window_t.isfree_x11window.

pos_x11window

#define pos_x11window(
   x11win,
   screen_x,
   screen_y
) (geometry_x11window(x11win, screen_x, screen_y, 0, 0))

Implements x11window_t.pos_x11window.

size_x11window

#define size_x11window(
   x11win,
   width,
   height
) (geometry_x11window(x11win, 0, 0, width, height))

Implements x11window_t.size_x11window.

state_x11window

#define state_x11window(x11win) ((x11window_state_e)(x11win)->state)

Implements x11window_t.state_x11window.

genericcast_x11window

#define genericcast_x11window(
   object
) ( __extension__ ({ static_assert( offsetof(typeof(*(object)), display) == offsetof(x11window_t, display) && offsetof(typeof(*(object)), sys_drawable) == offsetof(x11window_t, sys_drawable) && offsetof(typeof(*(object)), sys_colormap) == offsetof(x11window_t, sys_colormap) && offsetof(typeof(*(object)), evhimpl) == offsetof(x11window_t, evhimpl) && offsetof(typeof(*(object)), state) == offsetof(x11window_t, state) && offsetof(typeof(*(object)), flags) == offsetof(x11window_t, flags) && sizeof((object)->flags) == sizeof(((x11window_t*)0)->flags), "ensure same structure") ; (x11window_t *) (object) ; }))

Implements x11window_t.genericcast_x11window.

Offers support for displaying 2D output in a rectangular area called window on a screen served by an X11 display server.
Implements X11-Window.
typedef struct x11window_t x11window_t
Export x11window_t into global namespace.
struct x11window_t
Displays a window (rectangular area) on a screen.
typedef struct x11window_evh_t x11window_evh_t
Export x11window_evh_t into global namespace.
struct x11window_evh_t
Callback interface for X11 events.
int unittest_platform_X11_x11window(void)
Test x11window_t functionality.
void (*onclose) (x11window_t * x11win)
The event handler is called if the user requested to close the window.
void (*ondestroy) (x11window_t * x11win)
The event handler is called if the window was destroyed by another process.
void (*onredraw) (x11window_t * x11win)
The event handler is called if the window was (partially) obscured and the obscured content has to be redrawn.
void (*onreshape) (x11window_t * x11win, uint32_t width, uint32_t height)
The event handler is called whenever the geometry of the window changes.
void (*onvisible) (x11window_t * x11win, bool isVisible)
The event handler is called whenever the window changes from hidden to shown state or vice versa.
#define x11window_evh_INIT(
   subwindow_fct_suffix
) { & onclose ## subwindow_fct_suffix, & ondestroy ## subwindow_fct_suffix, & onredraw ## subwindow_fct_suffix, & onreshape ## subwindow_fct_suffix, & onvisible ## subwindow_fct_suffix }
Static initializer.
const x11window_evh_t * genericcast_x11windowevh(const void *evhimpl,
TYPENAME subwindow_t)
Casts parameter evhimpl into pointer to interface x11window_evh_t.
void x11window_evh_DECLARE(TYPENAME declared_evh_t,
TYPENAME subwindow_t)
Declares an interface function table for getting notified if window an event has occurred.
struct x11display_t* display
Reference to x11display_t.
uint32_t sys_drawable
X window ID.
uint32_t sys_colormap
X window ID.
const x11window_evh_t * evhimpl
Reference to x11window_evh_t which handles events.
uint8_t state
Current state of window (shown, hidden, destroyed).
uint8_t flags
Additional flags inidicating ownership of system objects.
#define x11window_FREE { 0, 0, 0, 0, 0, 0 }
Static initializer.
int init_x11window(/*out*/x11window_t *x11win,
struct x11display_t *x11disp,
uint32_t screennr,
const struct x11window_evh_t *eventhandler,
const int32_t *gconf_attrib,
const struct windowconfig_t *winconf_attrib)
Create a native X11 window on x11screen and assign it to x11win.
int initvid_x11window(/*out*/x11window_t *x11win,
struct x11display_t *x11disp,
uint32_t screennr,
const struct x11window_evh_t *eventhandler,
/*(X11) VisualID*/uint32_t config_visualid,
const struct windowconfig_t *winconf_attrib)
Create a native X11 window on x11screen and assign it to x11win.
int initmove_x11window(/*out*/x11window_t *dest_x11win,
x11window_t *src_x11win)
Must be called if address of x11window_t changes.
int free_x11window(x11window_t *x11win)
Frees all associated resources in case w11window_t.flags inidcates ownership.
struct x11display_t * display_x11window(const x11window_t *x11win)
Returns the display the window is associated with.
uint32_t screen_x11window(const x11window_t *x11win)
Returns the screen number the window is located on.
x11window_flags_e flags_x11window(const x11window_t *x11win)
Returns flags which indicate ownership state of system resources.
x11window_state_e state_x11window(const x11window_t *x11win)
Returns the state of the window as seen by the user.
int title_x11window(const x11window_t *x11win,
/*ret*/struct cstring_t *title)
Returns the window title string in title encoded in UTF-8.
int pos_x11window(const x11window_t *x11win,
/*out*/int32_t *screen_x,
/*out*/int32_t *screen_y)
Returns the position of the window in screen coordinates.
int size_x11window(const x11window_t *x11win,
/*out*/uint32_t *width,
/*out*/uint32_t *height)
Returns the width and height of the window in pixels.
int geometry_x11window(const x11window_t *x11win,
/*out*/int32_t *screen_x,
/*out*/int32_t *screen_y,
/*out*/uint32_t *width,
/*out*/uint32_t *height)
This is the geometry of x11win without the window manager frame in screen coordinates.
int frame_x11window(const x11window_t *x11win,
/*out*/int32_t *screen_x,
/*out*/int32_t *screen_y,
/*out*/uint32_t *width,
/*out*/uint32_t *height)
This is the geometry of window including the window manager frame in screen coordinates.
static inline bool isfree_x11window(const x11window_t *x11win)
Returns true if x11win is set to x11window_FREE.
int show_x11window(x11window_t *x11win)
Makes window visible to the user.
int hide_x11window(x11window_t *x11win)
In X11 terms unmaps a window: makes it invisible to the user.
int setpos_x11window(x11window_t *x11win,
int32_t screen_x,
int32_t screen_y)
Changes the position of the window on the screen.
int resize_x11window(x11window_t *x11win,
uint32_t width,
uint32_t height)
Changes the size of the window.
int sendclose_x11window(x11window_t *x11win)
Sends a close request to a window.
int sendredraw_x11window(x11window_t *x11win)
Sends a redraw event to a window.
int settitle_x11window(const x11window_t *x11win,
const char *title)
Sets the text of the window titile bar.
int setopacity_x11window(x11window_t *x11win,
double opacity)
Sets the opacity of the window and its window manager frame.
int swapbuffer_x11window(x11window_t *x11win)
Changes the content of the double buffer with the window.
x11window_t * genericcast_x11window(void *object)
Casts a pointer to object into a pointer to x11window_t.
int configfilter_x11window(/*out*/struct gconfig_filter_t *filter,
const int32_t config_attributes[])
Returns a gconfig_filter_f which helps to filter for a specific window visual.
#define genericcast_x11windowevh(
   evhimpl,
   subwindow_t
) ( __extension__ ({ static_assert( offsetof(typeof(*(evhimpl)), onclose) == offsetof(x11window_evh_t, onclose) && offsetof(typeof(*(evhimpl)), ondestroy) == offsetof(x11window_evh_t, ondestroy) && offsetof(typeof(*(evhimpl)), onredraw) == offsetof(x11window_evh_t, onredraw) && offsetof(typeof(*(evhimpl)), onreshape) == offsetof(x11window_evh_t, onreshape) && offsetof(typeof(*(evhimpl)), onvisible) == offsetof(x11window_evh_t, onvisible), "ensure same structure"); if (0) { (evhimpl)->onclose((subwindow_t*)0); (evhimpl)->ondestroy((subwindow_t*)0); (evhimpl)->onredraw((subwindow_t*)0); (evhimpl)->onreshape((subwindow_t*)0, (uint32_t)0, (uint32_t)0); (evhimpl)->onvisible((subwindow_t*)0, (bool)0); } (const x11window_evh_t*) (evhimpl); }))
Implements x11window_evh_t.genericcast_x11windowevh.
#define x11window_evh_DECLARE(
   declared_evh_t,
   subwindow_t
) typedef struct declared_evh_t declared_evh_t; struct declared_evh_t { void (* onclose) (subwindow_t * x11win); void (* ondestroy) (subwindow_t * x11win); void (* onredraw) (subwindow_t * x11win); void (* onreshape) (subwindow_t * x11win, uint32_t width, uint32_t height); void (* onvisible) (subwindow_t * x11win, bool isVisible); }
Implements x11window_evh_t.x11window_evh_DECLARE.
#define display_x11window(x11win) ((x11win)->display)
Implements x11window_t.display_x11window.
#define flags_x11window(x11win) ((x11window_flags_e)(x11win)->flags)
Implements x11window_t.flags_x11window.
static inline bool isfree_x11window(const x11window_t *x11win)
Implements x11window_t.isfree_x11window.
#define pos_x11window(
   x11win,
   screen_x,
   screen_y
) (geometry_x11window(x11win, screen_x, screen_y, 0, 0))
Implements x11window_t.pos_x11window.
#define size_x11window(
   x11win,
   width,
   height
) (geometry_x11window(x11win, 0, 0, width, height))
Implements x11window_t.size_x11window.
#define state_x11window(x11win) ((x11window_state_e)(x11win)->state)
Implements x11window_t.state_x11window.
#define genericcast_x11window(
   object
) ( __extension__ ({ static_assert( offsetof(typeof(*(object)), display) == offsetof(x11window_t, display) && offsetof(typeof(*(object)), sys_drawable) == offsetof(x11window_t, sys_drawable) && offsetof(typeof(*(object)), sys_colormap) == offsetof(x11window_t, sys_colormap) && offsetof(typeof(*(object)), evhimpl) == offsetof(x11window_t, evhimpl) && offsetof(typeof(*(object)), state) == offsetof(x11window_t, state) && offsetof(typeof(*(object)), flags) == offsetof(x11window_t, flags) && sizeof((object)->flags) == sizeof(((x11window_t*)0)->flags), "ensure same structure") ; (x11window_t *) (object) ; }))
Implements x11window_t.genericcast_x11window.
The window is destroyed.
The window is created and shown to the user but may be only partially visible or obscured by another window.
The window is created but not shown to the user (iconic or minimized state).
State of a x11window_t object.
Additional state flags inidicating ownership of system resources.
#define visualid_gconfig(
   gconf,
   display,
   visualid
) visualconfigid_eglconfig(gl_gconfig(gconf), gl_display(display), visualid)
Implements gconfig_t.visualid_gconfig.
struct gconfig_t
Contains a specific surface configuration.
A value != 0 sets a flag which makes the background of a window surface shine through.
struct x11dblbuffer_t
A drawable which describes the double buffer (back buffer) of a x11window_t.
Close