X11 Work Bench Toolkit  1.0
window_helper.h File Reference

'window helper' main header file for the X11workbench Toolkit API More...

#include <string.h>
#include "platform_helper.h"
#include "font_helper.h"

Go to the source code of this file.

Data Structures

struct  _WBRect_
 internal wrapper struct for 'rectangle' definition More...
 
struct  _WBGeom_
 internal wrapper struct for X11 'geometry' definition More...
 
struct  __WB_ERROR_INFO__
 Structure definition for X11 error information. More...
 

Macros

#define WB_DEFAULT_CURSOR   XC_left_ptr
 The default window cursor (this is what xterm uses)
 
#define WB_WAIT_CURSOR   XC_watch /*XC_clock*/
 The 'wait' cursor (this is what xterm uses)
 
#define WB_DEFAULT_FONT   "fixed"
 The default X11 font name (currently "fixed")
 
#define WB_DEFAULT_FONT_SIZE   13 /* override via settings */
 The default X11 font size (currently 13)
 
#define WINDOW_DATA_SIZE   4 /* size of a 'void *' array that stores per-window data */
 The 'window data' array size (currently 4 void pointers)
 
#define EVENT_ALL_MASK   0x01ffffffL /* 2^24 | 2^23 ... 2^0 - see X.h */
 An event mask for ALL events, with bits 0 through 24 set - see X.h which only defines bits 0 to 24 for an event mask.
 
#define GCAll
 A bit mask for ALL GC properties (used when copying a GC) More...
 
#define BEGIN_XCALL_DEBUG_WRAPPER   { const char *__szOldXCallFunc__ = sz_xcall_func; int __iOldXCallLine__ = i_xcall_line; sz_xcall_func = __FUNCTION__; i_xcall_line = __LINE__; {
 wrapper macro for calls into the X11 library. This macro precedes the call(s)
 
#define END_XCALL_DEBUG_WRAPPER   } sz_xcall_func = __szOldXCallFunc__; i_xcall_line = __iOldXCallLine__; }
 wrapper macro for calls into the X11 library. This macro follows the call(s)
 
#define WB_DEBUG_PRINT(L,...)
 Preferred method of implementing conditional debug output. More...
 
#define WB_DEBUG_DUMP(L, X, Y, Z)
 Preferred method of implementing conditional debug 'dump' output. More...
 
#define WB_IF_DEBUG_LEVEL(L)
 Preferred method of implementing conditional debug 'if block' code. More...
 
#define WB_WARN_PRINT(...)   WB_DEBUG_PRINT(DebugLevel_WARN, __VA_ARGS__)
 Preferred method of implementing a 'warning level' debug message for all subsystems. More...
 
#define WB_ERROR_PRINT(...)   WB_DEBUG_PRINT(DebugLevel_ERROR, __VA_ARGS__)
 Preferred method of implementing an 'error level' debug message for all subsystems. More...
 
#define WB_WARN_DUMP(X, Y, Z)   WB_DEBUG_DUMP(DebugLevel_WARN, X,Y,Z)
 Preferred method of implementing a 'warning level' binary dump for all subsystems. More...
 
#define WB_ERROR_DUMP(X, Y, Z)   WB_DEBUG_DUMP(DebugLevel_ERROR, X,Y,Z)
 Preferred method of implementing an 'error level' binary dump for all subsystems. More...
 
#define WB_STANDARD_INPUT_MASK   (FocusChangeMask | PropertyChangeMask | ExposureMask | StructureNotifyMask | VisibilityChangeMask | SubstructureNotifyMask)
 'Standard' input mask, bit flag for window creation More...
 
#define WB_KEYBOARD_INPUT_MASK   (KeyPressMask | KeyReleaseMask)
 'Keyboard' input mask, bit flag for window creation More...
 
#define WB_MOUSE_INPUT_MASK   (ButtonPressMask | ButtonReleaseMask | PointerMotionMask | EnterWindowMask | LeaveWindowMask)
 'Mouse' input mask, bit flag for window creation More...
 
#define WBGetWindowCopyGC2(wID, gcSrc)   WBCopyDrawableGC(WBGetWindowDisplay(wID), wID, gcSrc)
 makes a copy of the specified GC for the desired window More...
 
#define WBPointInRect(X, Y, R)   ((X) >= (R).left && (X) < (R).right && (Y) >= (R).top && (Y) < (R).bottom)
 Returns logical TRUE if the point (X,Y) is within the borders of the rectangle 'R'. More...
 
#define WBPointInGeom(X, Y, G)   ((X) >= (G).x && (X) < ((G).x + (G).width) && (Y) >= (G).y && (Y) < ((G).y + (G).height))
 Returns logical TRUE if the point (X,Y) is within the borders of the geometry 'G'. More...
 
#define WBRectOverlapped(R1, R2)
 Returns logical TRUE if the rectangle R1 overlaps/intersects R2. More...
 
#define WBGeomOverlapped(G1, G2)
 Returns logical TRUE if the geometry G1 overlaps/intersects G2. More...
 
#define WB_KEYEVENT_KEYSYM   8 /* bit flags for 'piAltCtrlShift' below */
 'AltCtrlShift' bit flag for 'VK_' keys for WBKeyEventProcessKey()
 
#define WB_KEYEVENT_ALT   4
 'AltCtrlShift' bit flag for ALT modifier for WBKeyEventProcessKey()
 
#define WB_KEYEVENT_CTRL   2
 'AltCtrlShift' bit flag for Control modifier for WBKeyEventProcessKey()
 
#define WB_KEYEVENT_SHIFT   1
 'AltCtrlShift' bit flag for Shift modifier for WBKeyEventProcessKey()
 
#define WB_KEYEVENT_ACSMASK   7
 'AltCtrlShift' bit mask for Alt+Ctrl+Shift bits for WBKeyEventProcessKey()
 
#define WB_POINTER_UNSPECIFIED   0 /* possible motion or state-change notifications */
 Unspecified event, possible motion or state-chagne notification.
 
#define WB_POINTER_CLICK   1
 Mouse 'click' event.
 
#define WB_POINTER_DBLCLICK   2
 WM_POINTER 'double-click' event, send in lieu of WB_POINTER_CLICK for double-click.
 
#define WB_POINTER_DRAG   3 /* window proc returns window ID to support drag/drop */
 WM_POINTER 'drag' event, window proc MUST return the window ID to auto-support drag/drop.
 
#define WB_POINTER_DROP   4 /* may not happen if drag is canceled */
 WM_POINTER 'drop' event, only sent if drag/drop supported AND was not 'canceled'; see WB_POINTER_CANCEL.
 
#define WB_POINTER_MOVE   5 /* motion notify while dragging */
 WM_POINTER 'move' event, for motion notification during drag/drop.
 
#define WB_POINTER_CANCEL   6 /* reservedly any kind of cancellation, but for now, 'drag cancel' */
 WM_POINTER 'cancel' event, cancels an ongoing operation, such as drag/drop (useful for resource cleanup)
 
#define WB_POINTER_SCROLLUP   7 /* scroll event, mouse button 4 */
 WM_POINTER 'scroll up' event, caused by mouse button 4.
 
#define WB_POINTER_SCROLLDOWN   8 /* scroll event, mouse button 5 */
 WM_POINTER 'scroll down' event, caused by mouse button 5.
 
#define WB_POINTER_BUTTON1   1 /* these are bitmasks */
 WM_POINTER button bitmask indicating that button 1 is pressed.
 
#define WB_POINTER_BUTTON2   2
 WM_POINTER button bitmask indicating that button 2 is pressed.
 
#define WB_POINTER_BUTTON3   4
 WM_POINTER button bitmask indicating that button 3 is pressed.
 
#define WB_POINTER_BUTTON4   8
 WM_POINTER button bitmask indicating that button 4 (scroll wheel 'up') is pressed.
 
#define WB_POINTER_BUTTON5   16
 WM_POINTER button bitmask indicating that button 5 (scroll wheel 'down') is pressed.
 

Typedefs

typedef int(* WBWinEvent )(Window wID, XEvent *pEvent)
 event callback function type for window events More...
 
typedef int(* WBAppEvent )(XEvent *pEvent)
 event callback function type for application events More...
 
typedef struct _WBRect_ WB_RECT
 internal wrapper struct for 'rectangle' definition More...
 
typedef struct _WBGeom_ WB_GEOM
 internal wrapper struct for X11 'geometry' definition More...
 
typedef int(* WBLocateWindowCallback )(Window wID, void *pData)
 callback definition for WBLocateWindow More...
 
typedef struct __WB_ERROR_INFO__ WB_ERROR_INFO
 Structure definition for X11 error information. More...
 

Enumerations

enum  DebugLevel {
  DebugLevel_None = 0, DebugLevel_ERROR = 0, DebugLevel_WARN = 1, DebugLevel_Minimal = 1,
  DebugLevel_Light = 2, DebugLevel_Medium = 3, DebugLevel_Heavy = 4, DebugLevel_Chatty = 5,
  DebugLevel_Verbose = 6, DebugLevel_Excessive = 7, DebugLevel_MASK = 7, DebugSubSystem_ALL = 0,
  DebugSubSystem_RESTRICT = 0x80000000, DebugSubSystem_BITSHIFT = 3, DebugSubSystem_Init = 0x00000008, DebugSubSystem_Application = 0x00000010,
  DebugSubSystem_Window = 0x00000020, DebugSubSystem_Menu = 0x00000040, DebugSubSystem_Event = 0x00000080, DebugSubSystem_Dialog = 0x00000100,
  DebugSubSystem_DialogCtrl = 0x00000200, DebugSubSystem_Frame = 0x00000400, DebugSubSystem_Keyboard = 0x00000800, DebugSubSystem_Mouse = 0x00001000,
  DebugSubSystem_Font = 0x00002000, DebugSubSystem_Settings = 0x00004000, DebugSubSystem_Selection = 0x00008000, DebugSubSystem_Pixmap = 0x00010000,
  DebugSubSystem_Expose = 0x00020000, DebugSubSystem_MASK = ~7L
}
 Debug level enumeration. More...
 
enum  WMPropertiesWindowType {
  WMPropertiesWindowType_TypeMask = 0x3f, WMPropertiesWindowType_Normal = 0, WMPropertiesWindowType_Desktop = 1, WMPropertiesWindowType_Dock = 2,
  WMPropertiesWindowType_ToolBar = 3, WMPropertiesWindowType_Menu = 4, WMPropertiesWindowType_Utility = 5, WMPropertiesWindowType_Splash = 6,
  WMPropertiesWindowType_Dialog = 7, WMPropertiesWindowType_DropDownMenu = 8, WMPropertiesWindowType_PopupMenu = 9, WMPropertiesWindowType_ToolTip = 10,
  WMPropertiesWindowType_Notification = 11, WMPropertiesWindowType_Combo = 12, WMPropertiesWindowType_Drag_N_Drop = 13, WMPropertiesWindowType_Reserved14 = 14,
  WMPropertiesWindowType_Reserved15 = 15, WMPropertiesWindowType_StateMask = 0xfffC0, WMPropertiesWindowType_NoState = 0, WMPropertiesWindowType_Modal = 0x00040,
  WMPropertiesWindowType_Sticky = 0x00080, WMPropertiesWindowType_VMax = 0x00100, WMPropertiesWindowType_HMax = 0x00200, WMPropertiesWindowType_FullScreen = 0x00400,
  WMPropertiesWindowType_Hidden = 0x00800, WMPropertiesWindowType_Shaded = 0x01000, WMPropertiesWindowType_SkipTaskbar = 0x02000, WMPropertiesWindowType_SkipPager = 0x04000,
  WMPropertiesWindowType_Above = 0x08000, WMPropertiesWindowType_Below = 0x10000, WMPropertiesWindowType_Focused = 0x20000, WMPropertiesWindowType_DemandsAttention = 0x40000,
  WMPropertiesWindowType_Reserved80000 = 0x80000, WMPropertiesWindowType_Max = 0x80000000
}
 Window type enumeration. Reserved for future implementation. More...
 
enum  WMPropertiesWMProtocols {
  WMPropertiesWMProtocols_Mask = 0xff, WMPropertiesWMProtocols_None = 0x0, WMPropertiesWMProtocols_DeleteWindow = 0x01, WMPropertiesWMProtocols_Reserved2 = 0x02,
  WMPropertiesWMProtocols_Reserved3 = 0x04, WMPropertiesWMProtocols_Reserved4 = 0x08, WMPropertiesWMProtocols_Reserved5 = 0x10, WMPropertiesWMProtocols_Reserved6 = 0x20,
  WMPropertiesWMProtocols_Reserved7 = 0x40, WMPropertiesWMProtocols_Reserved8 = 0x80
}
 Window WMProtocols support enumeration. More...
 

Functions

Display * WBInit (const char *szDisplayName)
 initializes default objects for the specified Display (required) More...
 
int WBInitDisplay (Display *pDisplay)
 initializes default objects for the specified Display More...
 
int WBInitClipboardSystem (Display *pDisplay, const char *szDisplayName)
 initializes clipboard sub-system More...
 
void WBExit (void)
 deletes any remaining global objects, frees the Display pointer, and terminates event processing More...
 
void WBExitClipboardSystem (Display *pDisplay)
 Shut down the clipboard sub-system. More...
 
Display * WBThreadInitDisplay (void)
 initializes default Display for a thread (must call WBInit() first) More...
 
void WBThreadFreeDisplay (Display *pThreadDisplay)
 un-initializes a Display for a thread that was allocated by WBThreadInitDisplay() More...
 
int WBParseStandardArguments (int *pargc, char ***pargv, char ***penvp)
 parses standard C arguments as passed to 'main()' More...
 
void WBToolkitUsage (void)
 Displays 'usage' for toolkit options to stderr. More...
 
const char * GetStartupAppName (void)
 returns a pointer to a copy of the application name from argv[0] More...
 
const char * GetStartupDisplayName (void)
 returns character name of the display to be opened and passed to WBInit More...
 
void GetStartupGeometry (WB_GEOM *pGeom)
 returns the startup geometry based on command line parameters More...
 
int GetStartupMinMax (void)
 returns the min/max/normal window state for startup More...
 
static __inline__ Colormap WBDefaultColormap (Display *pDisplay)
 returns the default colormap for the default screen of the specified display More...
 
void WBInitWindowAttributes (XSetWindowAttributes *pXSWA, unsigned long lBorderPixel, unsigned long lBackgroundPixel, Colormap clrMap, int iBitGravity)
 initializes the XSetWIndowAttributes structure with minimal attributes More...
 
void WBInitSizeHints (XSizeHints *pSH, Display *pDisplay, int iMinHeight, int iMinWidth)
 initializes the XSizeHints structure with standard attributes More...
 
void WBSetDebugLevel (unsigned int iLevel)
 set debug level More...
 
static __inline__ unsigned int WBGetDebugLevel (void)
 Returns the current debug level assigned by WBSetDebugLevel. More...
 
void WBDebugPrint (const char *pFmt,...) __attribute__((format(printf
 conditional debug message output More...
 
void void WBDebugDump (const char *szTitle, void *pData, int cbData)
 conditionally dumps binary data to debug message output More...
 
void WBDebugDumpGC (Display *pDisplay, GC hGC)
 dumps a GC's settings More...
 
void WBDebugDumpRegion (Region hRgn, int bRotate)
 dumps contents of a region More...
 
void WBDebugDumpEvent (XEvent *pEvent)
 dumps the contents of an XEvent More...
 
static __inline__ Display * WBGetDefaultDisplay (void)
 Returns the default Display. More...
 
XFontStruct * WBGetDefaultFont (void)
 Returns a pointer to the default font's XFontStruct. More...
 
XFontSet WBGetDefaultFontSet (Display *pDisplay)
 Returns an XFontSet for the default font. More...
 
Window WBGetHiddenHelperWindow (void)
 Returns a special 'hidden' window used for information purposes. More...
 
Window WBCreateWindow (Display *pDisplay, Window wIDParent, WBWinEvent pProc, const char *szClass, int iX, int iY, int iWidth, int iHeight, int iBorder, int iIO, int iFlags, XSetWindowAttributes *pXSWA)
 Create a window. More...
 
void WBDestroyWindow (Window wID)
 Destroy a window. More...
 
Window WBGetApplicationWindow (void)
 Destroy a window. More...
 
void WBSetApplicationWindow (Window wID)
 Destroy a window. More...
 
int WBDefault (Window wID, XEvent *pEvent)
 implements the default window event callback behavior More...
 
int WBAppDefault (XEvent *pEvent)
 implements the default application event callback behavior More...
 
void WBRegisterAppCallback (WBAppEvent pCallback)
 Registers a callback function for application events. More...
 
void WBUnregisterAppCallback ()
 unregister callback function for application events More...
 
void WBRegisterWindowCallback (Window wID, WBWinEvent pCallback)
 register callback function for a window (required) More...
 
void WBUnregisterWindowCallback (Window wID)
 un-register the window's callback function (implies resource destruction) More...
 
void WBSetWMProperties (Window wID, const char *szTitle, XSizeHints *pNormalHints, XWMHints *pWMHints, XClassHint *pClassHints)
 assign standard WM (Window Manager) properties via XSetWMProperties More...
 
void WBSetWindowTitle (Window wID, const char *szTitle)
 assign window (and icon) title More...
 
void WBSetWMPropertiesWindowType (Window wID, enum WMPropertiesWindowType wmProp)
 assign standard WM (Window Manager) 'window type' properties BEFORE mapping it (reserved) More...
 
void WBChangeWMPropertiesWindowType (Window wID, enum WMPropertiesWindowType wmPropSet, enum WMPropertiesWindowType wmChangeMask)
 re-assign standard WM (Window Manager) 'window type' properties and notify the root window (reserved) More...
 
enum WMPropertiesWindowType WBGetWMPropertiesWindowType (Window wID)
 re-assign standard WM (Window Manager) 'window type' properties and notify the root window (reserved) More...
 
void WBSetWMProtocols (Window wID, Atom aProperty,...)
 re-assign standard WM (Window Manager) 'window type' properties and notify the root window (reserved) More...
 
Window WBLocateWindow (WBLocateWindowCallback callback, void *pData)
 Locate a window by enumerating with a callback function. More...
 
void WBSetInputFocus (Window wID)
 set input focus to a specific window More...
 
Display * WBGetWindowDisplay (Window wID)
 returns the Display associated with a window More...
 
void WBSetWindowIcon (Window wID, int idIcon)
 assigns an icon resource (by ID) to a window More...
 
void WBSetWindowFontStruct (Window wID, XFontStruct *pFontStruct)
 assigns the default XFontStruct to a window More...
 
void WBSetWindowFontSet (Window wID, XFontSet fontSet)
 assigns the default XFontSet to a window More...
 
void WBSetWindowDefaultCursor (Window wID, int idStandardCursor)
 Assigns a default cursor (by ID) to a window. More...
 
int WBGetWindowDefaultCursor (Window wID)
 returns the default cursor ID for a window More...
 
void WBCreateWindowDefaultGC (Window wID, unsigned long clrFG, unsigned long clrBG)
 creates a default GC for a window More...
 
void WBSetWindowDefaultGC (Window wID, GC hGC)
 assigns a default GC to a window More...
 
GC WBGetWindowCopyGC (Window wID)
 makes a copy of the default GC so that it can be modified More...
 
GC WBCopyDrawableGC (Display *pDisplay, Drawable dw, GC gcSrc)
 makes a copy of the specified GC for the desired 'Drawable' More...
 
XFontStruct * WBGetGCFont (Display *pDisplay, GC gc)
 return a copy of the XFontStruct that was assigned to a GC More...
 
void WBSetWindowData (Window wID, int iIndex, void *pData)
 assign 'data pointer' for a window and specified index value More...
 
void WBBeginWaitCursor (Window wID)
 increment 'wait cursor' count, set cursor to WB_WAIT_CURSOR More...
 
void WBEndWaitCursor (Window wID)
 decrement 'wait cursor' count, restore to default when zero More...
 
void WBSetWindowCursor (Window wID, int idCursor)
 immediately set the window cursor More...
 
void WBRestoreDefaultCursor (Window wID)
 restore the default cursor More...
 
GC WBGetWindowDefaultGC (Window wID)
 Returns the default GC currently assigned to the window. More...
 
XFontStruct * WBGetWindowFontStruct (Window wID)
 Returns the current XFontStruct pointer assigned to the window (may be NULL) More...
 
XFontSet WBGetWindowFontSet (Window wID)
 Returns the current XFontSet assigned to the window (may be None) More...
 
unsigned long WBGetWindowFGColor (Window wID)
 Returns the currently assigned foreground color. More...
 
unsigned long WBGetWindowBGColor (Window wID)
 Returns the currently assigned background color. More...
 
unsigned long WBGetGCFGColor (Display *pDisplay, GC gc)
 returns the currently assigned foreground color for a GC More...
 
unsigned long WBGetGCBGColor (Display *pDisplay, GC gc)
 returns the currently assigned background color for a GC More...
 
void WBDefaultStandardColormap (Display *pDisplay, XStandardColormap *pMap)
 returns a default XStandardColormap structure for the default screen of the specified display More...
 
void WBSetWindowClassName (Window wID, const char *szClassName)
 Assignes the window's class name pointer. More...
 
const char * WBGetWindowClassName (Window wID)
 Returns the window's assigned class name pointer. More...
 
void * WBGetWindowData (Window wID, int iIndex)
 Gets the data associated with this window and the specified index. More...
 
void WBGetWindowGeom (Window wID, WB_GEOM *pGeom)
 Returns the RAW geometry of the window as reported by the window manager. More...
 
void WBGetWindowGeom2 (Window wID, WB_GEOM *pGeom)
 Returns the geometry of the window relative to the root window. More...
 
void WBGetWindowGeom0 (Window wID, WB_GEOM *pGeom)
 Returns the ABSOLUTE window geometry relative the screen. More...
 
void WBGetWindowRect (Window wID, WB_RECT *pRect)
 Returns the WB_RECT (rectangle) defined by the window's geometry, including the border area. More...
 
void WBGetClientRect (Window wID, WB_RECT *pRect)
 Returns the WB_RECT (rectangle) defined by the window's geometry, excluding the border area. More...
 
Window WBGetParentWindow (Window wID)
 Returns the window's parent (or None if there is no parent) More...
 
void WBSetParentWindow (Window wID, Window wIDParent)
 Assigns the parent to the specified window within the internal structure. More...
 
int WBReparentWindow (Window wID, Window wIDParent, int iX, int iY)
 Assigns a new parent to the specified window (aka 'Re-parent') More...
 
int WBIsChildWindow (Window wIDParent, Window wIDChild)
 Returns non-zero if wIDParent is in a parent relationsihp with wIDChild. More...
 
void WBXlatCoordPoint (Window wIDSrc, int iXSrc, int iYSrc, Window wIDDest, int *piXDest, int *piYDest)
 Translate X,Y point coordinates relative to a window. More...
 
void WBXlatCoordGeom (Window wIDSrc, const WB_GEOM *pGeomSrc, Window wIDDest, WB_GEOM *pGeomDest)
 Translate geometry coordinates relative to a window. More...
 
void WBXlatCoordRect (Window wIDSrc, const WB_RECT *pRectSrc, Window wIDDest, WB_RECT *pRectDest)
 Translate rectangle coordinates relative to a window. More...
 
int WBPointInWindow (Window wIDRef, int iX, int iY, Window wIDQuery)
 Returna a non-zero value if X,Y coordinates relative to the reference window are within the query window. More...
 
int WBKeyEventProcessKey (const XKeyEvent *pEvent, char *pBuf, int *pcbLen, int *piAltCtrlShift)
 Generic keyboard event translation utility. More...
 
void WBRegisterMenuCallback (Window wID, WBWinEvent pCallback)
 (internal) Register a MENU callback for a window More...
 
void WBAddMenuWindow (Window wID, Window wIDMenu)
 Add a MENU WINDOW to a (frame) window - more than one is possible, only one currently supported. More...
 
Window WBGetMenuWindow (Window wID)
 Returns the Window ID of the (first) menu window assigned to a (frame) window. More...
 
void WBRemoveMenuWindow (Window wID, Window wIDMenu)
 Remove (detach) the specified menu window from a (frame) window. More...
 
int WBIsValid (Display *pDisplay, Window wID)
 returns non-zero if 'valid' (i.e. 'not destroyed') More...
 
Time WBGetLastEventTime (void)
 Main message loop, high level API to check for and retrieve the next event. More...
 
int WBCheckGetEvent (Display *pDisplay, XEvent *pEvent)
 Main message loop, high level API to check for and retrieve the next event. More...
 
void WBWaitForEvent (Display *pDisplay)
 Wait for an event, blocking indefinitely. More...
 
void WBDispatch (XEvent *pEvent)
 Generic Event Dispatcher, using message type to dispatch. More...
 
int WBAppDispatch (XEvent *pEvent)
 Dispatches an application XEvent. May be called directly. More...
 
int WBWindowDispatch (Window wID, XEvent *pEvent)
 Dispatches a window XEvent. May be called directly. More...
 
const char * WBEventName (int iEventID)
 debug function to return the name of an X11 event More...
 
int WBShowModal (Window wID, int bMenuSplashFlag)
 Shows a 'modal' window by processing events until the window closes. More...
 
void WBEndModal (Window wID, int iReturn)
 End a modal window with a specific return value. More...
 
int WBNextEvent (Display *pDisplay, XEvent *pEvent)
 low-level event queue wrapper. Implements the client-side event queue. Does not block if no events available. More...
 
int WBPostEvent (Window wID, XEvent *pEvent)
 Places a copy of the specified event at the end of the regular (internal) event queue. More...
 
int WBPostPriorityEvent (Window wID, XEvent *pEvent)
 Places a copy of the specified event at the end of the priority (internal) event queue. More...
 
void WBPostDelayedEvent (XEvent *pEvent, unsigned int nDelay)
 Delays placing a copy of the specified event at the end of the regular (internal) event queue by a specified number of milliseconds. More...
 
int WBPostAppEvent (XEvent *pEvent)
 Places a copy of the specified event at the end of the priority (internal) event queue. More...
 
void WBPostDelayedSetFocusAppEvent (Display *pDisplay, Window wID, Window wIDFrom, unsigned int nDelay)
 Creates a 'set focus' ClientMessage event for the application event handler. More...
 
void WBProcessExposeEvent (XExposeEvent *pEvent)
 low-level event processing, internal handling of Expose events More...
 
void WBMouseCancel (Display *pDisplay, Window wID)
 low-level event processing, internal handling of Expose events More...
 
void * WBGetClipboardData (Display *pDisplay, Atom *paType, int *piFormat, unsigned long *pnData)
 Get clipboard data of requested type. More...
 
int WBSetClipboardData (Display *pDisplay, Atom aType, int iFormat, const void *pData, unsigned long nData)
 Get clipboard data of requested type. More...
 
void * WBGetSelectionData (Display *pDisplay, Atom aSelection, Atom *paType, int *piFormat, unsigned long *pnData)
 Get clipboard data of requested type. More...
 
int WBSetSelectionData (Display *pDisplay, Atom aSelection, Atom aType, int iFormat, const void *pData, unsigned long nData)
 Get clipboard data of requested type. More...
 
int WBMapWindow (Display *pDisplay, Window wID)
 Wrapper for XMapWindow, makes window visible. More...
 
int WBMapRaised (Display *pDisplay, Window wID)
 wrapper for XMapRaised, makes window visible and moves to top More...
 
int WBUnmapWindow (Display *pDisplay, Window wID)
 wrapper for XUnmapWindow, makes window invisible without destroying it More...
 
int WBIsMapped (Display *pDisplay, Window wID)
 Returns non-zero if window has been mapped; zero otherwise. More...
 
void WBInvalidateGeom (Window wID, const WB_GEOM *pGeom, int bPaintFlag)
 'Paint' helper, invalidates a geometry for asynchronous Expose event generation More...
 
void WBInvalidateRegion (Window wID, Region rgn, int bPaintFlag)
 'Paint' helper, invalidates a region for asynchronous Expose event generation More...
 
void WBValidateGeom (Window wID, const WB_GEOM *pGeom)
 'Paint' helper, validates a geometry for asynchronous Expose event generation More...
 
void WBValidateRegion (Window wID, Region rgn)
 'Paint' helper, validates a region for asynchronous Expose event generation More...
 
Region WBGetInvalidRegion (Window wID)
 'Paint' helper, returns a copy of the invalid region for a window More...
 
Region WBGetPaintRegion (Window wID)
 'Paint' helper, returns a copy of the current 'paint' region for the window More...
 
Region WBRectToRegion (const WB_RECT *pRect)
 'Paint' helper, converts a WB_RECT structure to a Region. More...
 
Region WBGeomToRegion (const WB_GEOM *pGeom)
 'Paint' helper, converts a WB_GEOM structure to a Region. More...
 
void WBUpdateWindow (Window wID)
 'Paint' helper, generates an asynchronous Expose event for non-empty 'invalid' region More...
 
void WBUpdateWindowImmediately (Window wID)
 'Paint' helper, generates an immediate Expose event for non-empty 'invalid' region More...
 
GC WBBeginPaint (Window wID, XExposeEvent *pEvent, WB_GEOM *pgRet)
 'Paint' helper, creates a GC for use in updating the window in an Expose event handler More...
 
GC WBBeginPaintGeom (Window wID, WB_GEOM *pgBounds)
 'Paint' helper, creates a GC for use in updating the window for a specified rectangular area More...
 
void WBEndPaint (Window wID, GC gc)
 'Paint' helper, frees resources and marks the update region 'valid' More...
 
void WBClearWindow (Window wID, GC gc)
 'Paint' helper, erases background by painting the background color within the clipping region More...
 
static __inline__ void WBInvalidateRect (Window wID, const WB_RECT *pRCT, int bPaintFlag)
 'Paint' helper, invalidates a WB_RECT for asynchronous Expose event generation More...
 
static __inline__ void WBValidateRect (Window wID, WB_RECT *pRCT)
 'Paint' helper, validates a WB_RECT for asynchronous Expose event generation More...
 
WB_UINT64 WBGetTimeIndex (void)
 Returns the current 'time index' (in microseconds) More...
 
int CreateTimer (Display *pDisplay, Window wID, unsigned long lInterval, long lID, int iPeriodic)
 Creates a one-shot or periodic timer. More...
 
void DeleteTimer (Display *pDisplay, Window wID, long lID)
 Deletes an existing timer's resources. More...
 
static __inline__ void WBSupressErrorOutput (void)
 Supress X11 XErrorEvent output to stderr. More...
 
static __inline__ void WBAllowErrorOutput (void)
 Restore X11 XErrorEvent output to stderr. More...
 
void WBErrorClear (void)
 Clear the 'last error' information obtained via WBGetLastError() More...
 
int WBErrorCheck (void)
 Check to see whether or not an X11 error was detected. More...
 
int WBErrorCheckRetry (void)
 Check to see whether or not an X11 error was detected AND can be re-tried. More...
 
const WB_ERROR_INFOWBGetLastError (void)
 Obtain a const pointer to the internal WB_ERROR_INFO structure. More...
 

Variables

const char * sz_xcall_func
 debug helper variable tracking the function calling into the X11 library
 
int i_xcall_line
 debug helper variable indicating the line number of the function calling into the X11 library
 
int bQuitFlag
 'Quit' Flag - you should check this periodically in your main message loop and exit whenever it is TRUE (non-zero) More...
 
const Atom aMENU_COMMAND
 commands sent by menus via ClientMessage More...
 
const Atom aMENU_UI_COMMAND
 UI notifications sent by menus to owning Frame windows via ClientMessage using 'WBWindowDispatch'. More...
 
const Atom aRESIZE_NOTIFY
 notification of window re-size via ClientMessage More...
 
const Atom aDESTROY_NOTIFY
 notify parent that child is being destroyed More...
 
const Atom aCONTROL_NOTIFY
 dialog control and child window notification messages More...
 
const Atom aQUERY_CLOSE
 query if it's ok to close (and optionally destroy yourself if ok) a window More...
 
const Atom aRECALC_LAYOUT
 notify window that it should re-calculate things like scrollbars and viewports More...
 
const Atom aDLG_FOCUS
 dialog focus messages More...
 
const Atom aSET_FOCUS
 dialog focus messages More...
 
const Atom aWM_CHAR
 keystroke/character notifications generated by API More...
 
const Atom aWM_TIMER
 timer notifications generated by API More...
 
const Atom aWM_POINTER
 pointer click/double-click/drag notifications generated by API More...
 
const Atom aWM_PROTOCOLS
 WM supported protocols. More...
 
const Atom aWM_DELETE_WINDOW
 Delete Window notification event. More...
 
const Atom aWM_TAKE_FOCUS
 'Take Focus' - TODO document this properly More...
 
const Atom aAVERAGE_WIDTH
 Atoms for fonts - Average Character Width. More...
 
const Atom aCLIPBOARD
 Atoms for the clipboard.
 
const Atom aPRIMARY
 Atoms for the clipboard.
 
const Atom aSECONDARY
 Atoms for the clipboard.
 
const Atom aMANAGER
 Atoms for the clipboard.
 
const Atom aTARGET
 Atoms for the clipboard.
 
const Atom aINCR
 Atoms for the clipboard.
 
const Atom aWINDOW
 Atoms for the clipboard.
 
const Atom aBITMAP
 Atoms for the clipboard.
 
const Atom aDRAWABLE
 Atoms for the clipboard.
 
const Atom aCOLORMAP
 Atoms for the clipboard.
 
const Atom aPIXEL
 Atoms for the clipboard.
 
const Atom aPIXMAP
 Atoms for the clipboard.
 
const Atom aTEXT
 Atoms for the clipboard.
 
const Atom aSTRING
 Atoms for the clipboard.
 
const Atom aUTF8_STRING
 Atoms for the clipboard.
 
const Atom aC_STRING
 Atoms for the clipboard.
 
const Atom aCOMPOUND_TEXT
 Atoms for the clipboard.
 
const Atom aTARGETS
 Atoms for the clipboard.
 
const Atom aMULTIPLE
 Atoms for the clipboard.
 
const Atom aTIMESTAMP
 Atoms for the clipboard.
 
const Atom aNULL
 Atoms for the clipboard.
 

Detailed Description

'window helper' main header file for the X11workbench Toolkit API

X11workbench Toolkit Toolkit API This file defines the main 'Window Helpers' including API initialization the main 'Event loop' window callback procedures upper level font management Expose and GC management Window context/state management X11 API 'wrapper' functions

Definition in file window_helper.h.

Function Documentation

int WBIsValid ( Display *  pDisplay,
Window  wID 
)

returns non-zero if 'valid' (i.e. 'not destroyed')

Parameters
pDisplayThe Display pointer associated with the specified window
wIDA Window ID to test 'valid'
Returns
Non-zero value if the internal window information exists and the window has not been destroyed, else zero

This function works ONLY for windows that have been registered with a callback. It checks to see if the internal window information exists and returns a non-zero value if the internal information exists AND the window itself has not been destroyed. This works whether or not the window was ever mapped.

Header File: window_helper.h

Definition at line 5602 of file window_helper.c.