X11 Work Bench Toolkit  1.0
window_helper.c File Reference

'window helper' main implementation file for the X11 Work Bench Toolkit API More...

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <limits.h>
#include <unistd.h>
#include <memory.h>
#include <string.h>
#include <strings.h>
#include <signal.h>
#include <time.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include <pthread.h>
#include <X11/cursorfont.h>
#include <X11/keysymdef.h>
#include "window_helper.h"
#include "pixmap_helper.h"
#include "conf_help.h"
#include <X11/Xproto.h>

Go to the source code of this file.

Data Structures

struct  __EVENT_ENTRY__
 Core (internal) structure for storing and dispatching events. More...
 
struct  __TIMER_ENTRY__
 Core (internal) structure for managing timers. More...
 
struct  __DELAYED_EVENT_ENTRY__
 Core (internal) structure for managing delayed events. More...
 

Macros

#define XK_MISCELLANY   /* mostly for interix */
 
#define _WINDOW_HELPER_C_   /*this causes some header definitions to change slightly */
 
#define WINDOW_ENTRY_ARRAY_SIZE   2048 /* must be a power of 2 and twice the max expected # of windows */
 
#define WINDOW_ENTRY_ARRAY_MAX   2047 /* must be the above value minus 1 */
 
#define WINDOW_ENTRY_HASH(X)
 
#define WINDOW_ENTRY_UNUSED   ((Window)-1)
 
#define WB_WINDOW_DELETE   -3 /* entry to be deleted during cleanup phase */
 
#define WB_WINDOW_DESTROYED   -2 /* window has been destroyed, entry remains */
 
#define WB_WINDOW_DESTROYING   -1 /* not destroyed yet - prevent recursion */
 
#define WB_WINDOW_UNMAPPED   0 /* window created, but not yet mapped */
 
#define WB_WINDOW_MAPPED   1 /* window mapped */
 
#define WB_WINDOW_SET_FOCUS_ON_MAP   2 /* focus is to be set when the window is mapped */
 
#define WB_WINDOW_DELETE_TIMEOUT   5 /* seconds to wait before deleting hash entry (was 30, now 5) */
 
#define WB_CHECK_SET_FOCUS_ON_MAP(X)   ((X).iWindowState == WB_WINDOW_SET_FOCUS_ON_MAP)
 
#define WB_IS_WINDOW_UNMAPPED(X)   ((X).iWindowState == WB_WINDOW_UNMAPPED || (X).iWindowState == WB_WINDOW_SET_FOCUS_ON_MAP)
 
#define WB_IS_WINDOW_MAPPED(X)   ((X).iWindowState == WB_WINDOW_MAPPED)
 
#define WB_IS_WINDOW_BEING_DESTROYED(X)   ((X).iWindowState == WB_WINDOW_DESTROYING)
 
#define WB_IS_WINDOW_DESTROYED(X)   ((X).iWindowState == WB_WINDOW_DESTROYED || (X).iWindowState == WB_WINDOW_DELETE)
 
#define WB_TO_DELETE_WINDOW_ENTRY(X)   ((X).iWindowState == WB_WINDOW_DELETE)
 
#define EVENT_ARRAY_SIZE   0x2000 /* this many events maximum */
 
#define EVENT_ARRAY_MASK   0x1fff /* 'and' this for modular math */
 
#define TIMER_ARRAY_SIZE   512
 
#define WBGetWindowEntry(X)   Debug_WBGetWindowEntry(X, __FUNCTION__, __LINE__)
 
#define WBInitSizeHints__max(X, Y)   ((X) > (Y) ? (X) : (Y))
 
#define WBGetWindowEntry(X)   Debug_WBGetWindowEntry(X, __FUNCTION__, __LINE__)
 
#define WB_IS_WINDOW_UNMAPPED(X)   ((X).iWindowState == WB_WINDOW_UNMAPPED || (X).iWindowState == WB_WINDOW_SET_FOCUS_ON_MAP)
 
#define WB_IS_WINDOW_MAPPED(X)   ((X).iWindowState == WB_WINDOW_MAPPED)
 
#define WB_IS_WINDOW_BEING_DESTROYED(X)   ((X).iWindowState == WB_WINDOW_DESTROYING)
 
#define WB_IS_WINDOW_DESTROYED(X)   ((X).iWindowState == WB_WINDOW_DESTROYED || (X).iWindowState == WB_WINDOW_DELETE)
 
#define EVENT_NAME_ENTRY(X)   { X, #X }
 
#define X_PROTO_ENTRY(X)   { X, #X },
 

Typedefs

typedef struct __EVENT_ENTRY__ EVENT_ENTRY
 Core (internal) structure for storing and dispatching events.
 
typedef struct __TIMER_ENTRY__ TIMER_ENTRY
 Core (internal) structure for managing timers.
 
typedef struct
__DELAYED_EVENT_ENTRY__ 
DELAYED_EVENT_ENTRY
 Core (internal) structure for managing delayed events.
 

Enumerations

enum  {
  MouseState_NONE = 0, MouseState_LCLICK = 1, MouseState_WAS_LCLICK, MouseState_LDRAG,
  MouseState_RCLICK, MouseState_WAS_RCLICK, MouseState_RDRAG, MouseState_CCLICK,
  MouseState_WAS_CCLICK, MouseState_CDRAG
}
 

Functions

static __inline__ _WINDOW_ENTRY_ * Debug_WBGetWindowEntry (Window wID, const char *szFunction, int nLine)
 
static void __WBInitEvent ()
 
static int __WBAddEvent (Display *pDisp, Window wID, XEvent *pEvent)
 
static void __WBDelWindowPaintEvents (Display *pDisp, Window wID)
 
static void __WBDelWindowEvents (Display *pDisp, Window wID)
 
static int __WBInsertPriorityEvent (Display *pDisp, Window wID, XEvent *pEvent)
 
static int __WBNextPaintEvent (Display *pDisp, XEvent *pEvent, Window wID)
 
static int __WBNextDisplayEvent (Display *pDisp, XEvent *pEvent)
 
static void WBInternalProcessExposeEvent (XExposeEvent *pEvent)
 
static int __internal_alloc_WMHints (_WINDOW_ENTRY_ *pEntry)
 
static Window __internal_GetParent (Display *pDisplay, Window wID, Window *pwRoot)
 
static const char * __internal_event_type_string (int iEventType)
 
static int __InternalCheckGetEvent (Display *pDisplay, XEvent *pEvent, Window wIDModal)
 
static void DeletAllTimersForWindow (Display *pDisplay, Window wID)
 
void __InternalDestroyWindow (Display *pDisp, Window wID, _WINDOW_ENTRY_ *pEntry)
 
static int WBXIOErrorHandler (Display *pDisp)
 
static int WBXErrorHandler (Display *pDisplay, XErrorEvent *pError)
 
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...
 
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...
 
void WBExit ()
 deletes any remaining global objects, frees the Display pointer, and terminates event processing 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 * GetStartupDisplayName (void)
 returns character name of the display to be opened and passed to WBInit More...
 
const char * GetStartupAppName (void)
 returns a pointer to a copy of the application name from argv[0] 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...
 
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...
 
int WBShowModal (Window wID, int bMenuSplashFlag)
 Shows a 'modal' window by processing events until the window closes. More...
 
void WBEndModal (Window wID, int iRval)
 End a modal window with a specific return value. More...
 
void WBSetInputFocus (Window wID)
 set input focus to a specific window More...
 
void WBDestroyWindow (Window wID)
 Destroy a window. More...
 
void WBRegisterAppCallback (WBAppEvent pCallback)
 Registers a callback function for application events. More...
 
void WBUnregisterAppCallback ()
 unregister callback function for application events More...
 
static __inline__ void InternalRestoreWindowDefaults (int iIndex)
 
static _WINDOW_ENTRY_ * __AddOrLocateEntry (Window wID)
 
static void __WindowEntryRestoreDefaultResources (int iIndex)
 
static void __WindowEntryDestructor (int iIndex)
 
static void __PeriodicWindowEntryCleanup (void)
 
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 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 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 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 wmProp, 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...
 
Window WBGetApplicationWindow (void)
 Destroy a window. More...
 
void WBSetApplicationWindow (Window wID)
 Destroy a window. 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...
 
static void __DeleteTimer (TIMER_ENTRY *pPrev, TIMER_ENTRY *pEntry)
 
void DeleteTimer (Display *pDisplay, Window wID, long lID)
 Deletes an existing timer's resources. More...
 
static int __CheckTimers (Display *pDisplay, XEvent *pEvent)
 
static void __CreateDelayedEvent (XEvent *pEvent, unsigned int uiInterval)
 
static void __DeleteDelayedEvent (DELAYED_EVENT_ENTRY *pPrev, DELAYED_EVENT_ENTRY *pEntry)
 
static int __attribute__ ((noinline))
 
static Bool __WBCheckIfEventPredicate (Display *pDisplay, XEvent *pEvent, XPointer arg)
 
static Bool __WBCheckIfEventPredicate0 (Display *pDisplay, XEvent *pEvent, XPointer arg)
 
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...
 
int WBAppDispatch (XEvent *pEvent)
 Dispatches an application XEvent. May be called directly. More...
 
void WBDispatch (XEvent *pEvent)
 Generic Event Dispatcher, using message type to dispatch. More...
 
int WBWindowDispatch (Window wID, XEvent *pEvent)
 Dispatches a window XEvent. May be called directly. More...
 
int WBAppDefault (XEvent *pEvent)
 implements the default application event callback behavior More...
 
int WBDefault (Window wID, XEvent *pEvent)
 implements the default window event callback behavior 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...
 
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...
 
int WBIsValid (Display *pDisplay, Window wID)
 returns non-zero if 'valid' (i.e. 'not destroyed') 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 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...
 
void WBSetWindowData (Window wID, int iIndex, void *pData)
 assign 'data pointer' for a window and specified index value More...
 
GC WBGetWindowDefaultGC (Window wID)
 Returns the default GC currently assigned to the 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...
 
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...
 
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...
 
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...
 
static void __InternalSetWindowCursor (Window wID, int idCursor)
 
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 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...
 
void WBGetWindowGeom0 (Window wID, WB_GEOM *pGeom)
 Returns the ABSOLUTE window geometry relative the screen. 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 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...
 
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...
 
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 WBRegisterMenuCallback (Window wID, WBWinEvent pMenuCallback)
 (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...
 
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...
 
void WBInvalidateGeom (Window wID, const WB_GEOM *pGeom, int bPaintNow)
 '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 WBCopyRegion (Region rgnSource)
 
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...
 
GC WBBeginPaint (Window wID, XExposeEvent *pEvent, WB_GEOM *pgBounds)
 '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 WBClearWindow (Window wID, GC gc)
 'Paint' helper, erases background by painting the background color within the clipping region More...
 
void WBEndPaint (Window wID, GC gc)
 'Paint' helper, frees resources and marks the update region 'valid' 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...
 
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 WBPostPriorityEvent (Window wID, XEvent *pEvent)
 Places a copy of the specified event at the end of the priority (internal) event queue. 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 iDelay)
 Creates a 'set focus' ClientMessage event for the application event handler. More...
 
const char * WBEventName (int iEventID)
 debug function to return the name of an X11 event More...
 
void WBSetDebugLevel (unsigned int iNew)
 set debug level More...
 
void WBDebugPrint (const char *fmt,...)
 
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 WBDebugDumpEvent (XEvent *pEvent)
 dumps the contents of an XEvent More...
 
void WBDebugDumpRegion (Region hRgn, int bRotate)
 dumps contents of a region 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 = NULL
 debug helper variable tracking the function calling into the X11 library
 
int i_xcall_line = 0
 debug helper variable indicating the line number of the function calling into the X11 library
 
XFontStruct * pDefaultFont = NULL
 
XFontSet fontsetDefault = None
 
Display * pDefaultDisplay = NULL
 
int bQuitFlag
 'Quit' Flag - you should check this periodically in your main message loop and exit whenever it is TRUE (non-zero) More...
 
unsigned int iWBDebugLevel = 0
 
int iStartupMinMax = 0
 
Atom aMENU_COMMAND
 commands sent by menus via ClientMessage More...
 
Atom aMENU_UI_COMMAND
 UI notifications sent by menus to owning Frame windows via ClientMessage using 'WBWindowDispatch'. More...
 
Atom aRESIZE_NOTIFY
 notification of window re-size via ClientMessage More...
 
Atom aDESTROY_NOTIFY
 notify parent that child is being destroyed More...
 
Atom aCONTROL_NOTIFY
 dialog control and child window notification messages More...
 
Atom aQUERY_CLOSE
 query if it's ok to close (and optionally destroy yourself if ok) a window More...
 
Atom aRECALC_LAYOUT
 notify window that it should re-calculate things like scrollbars and viewports More...
 
Atom aDLG_FOCUS
 dialog focus messages More...
 
Atom aSET_FOCUS
 dialog focus messages More...
 
Atom aWM_CHAR
 keystroke/character notifications generated by API More...
 
Atom aWM_TIMER
 timer notifications generated by API More...
 
Atom aWM_POINTER
 pointer click/double-click/drag notifications generated by API More...
 
Atom aWM_PROTOCOLS
 WM supported protocols. More...
 
Atom aWM_DELETE_WINDOW
 Delete Window notification event. More...
 
Atom aWM_TAKE_FOCUS
 'Take Focus' - TODO document this properly More...
 
Atom aAVERAGE_WIDTH
 Atoms for fonts - Average Character Width. More...
 
Atom aCLIPBOARD
 Atoms for the clipboard.
 
Atom aPRIMARY
 Atoms for the clipboard.
 
Atom aSECONDARY
 Atoms for the clipboard.
 
Atom aMANAGER
 Atoms for the clipboard.
 
Atom aTARGET
 Atoms for the clipboard.
 
Atom aINCR
 Atoms for the clipboard.
 
Atom aWINDOW
 Atoms for the clipboard.
 
Atom aBITMAP
 Atoms for the clipboard.
 
Atom aDRAWABLE
 Atoms for the clipboard.
 
Atom aCOLORMAP
 Atoms for the clipboard.
 
Atom aPIXEL
 Atoms for the clipboard.
 
Atom aPIXMAP
 Atoms for the clipboard.
 
Atom aTEXT
 Atoms for the clipboard.
 
Atom aSTRING
 Atoms for the clipboard.
 
Atom aUTF8_STRING
 Atoms for the clipboard.
 
Atom aC_STRING
 Atoms for the clipboard.
 
Atom aCOMPOUND_TEXT
 Atoms for the clipboard.
 
Atom aTARGETS
 Atoms for the clipboard.
 
Atom aMULTIPLE
 Atoms for the clipboard.
 
Atom aTIMESTAMP
 Atoms for the clipboard.
 
Atom aNULL
 Atoms for the clipboard.
 
static _WINDOW_ENTRY_ sWBHashEntries [WINDOW_ENTRY_ARRAY_SIZE] ={{0,0}}
 
static volatile int nWBHashEntries = 0
 
static Window wWBFakeWindow = 0
 
static Window wIDApplication = None
 
int bIgnoreXErrors = 0
 
static WB_ERROR_INFO xErrorInfo = {NULL, NULL, 0, 0, 0, 0, 0, None}
 
Time tmDefaultDisplay = 0
 
WB_UINT64 qwDefaultDisplayTick = 0LL
 
int bStandardColormap = 0
 
XStandardColormap cmapDefault
 
static EVENT_ENTRY axWBEvt [EVENT_ARRAY_SIZE]
 
static int iWBQueuedEvent = -1
 
static int iWBQueueLast = -1
 
static int iWBPaintEvent = -1
 
static int iWBPaintLast = -1
 
static int iWBFreeEvent = -1
 
static int iInitEventFlag = 0
 
static int(* pAppEventCallback )(XEvent *pEvent) = NULL
 
static TIMER_ENTRY axWBTimer [TIMER_ARRAY_SIZE]
 
static TIMER_ENTRYpTimerEntryActive = NULL
 
static TIMER_ENTRYpTimerEntryFree = NULL
 
static DELAYED_EVENT_ENTRY axWBDelayedEvent [TIMER_ARRAY_SIZE]
 
static DELAYED_EVENT_ENTRYpDelayedEventEntryActive = NULL
 
static DELAYED_EVENT_ENTRYpDelayedEventEntryFree = NULL
 
static int(* pOldDisplayIOErrorHandler )(Display *) = NULL
 
static int hBogus [3]
 
static WB_GEOM geomStartup = {0,0,0,0,0}
 
static char szStartupDisplayName [512] =":0.0"
 
static char szDefaultDisplayName [512] = ""
 
static char szAppName [PATH_MAX *2] =""
 
static int iMouseState = 0
 
static int iMouseModShiftCtrl = 0
 
static int iMouseDragButtonState = 0
 
static WB_UINT64 tmMouse
 
static Window wMouseCapture = None
 
static int iMouseX = 0
 
static int iMouseY = 0
 
struct {
   int   iID
 
   const char *   szName
 
aIDName []
 
struct {
   int   iProto
 
   const char *   szProto
 
aXProto []
 

Detailed Description

'window helper' main implementation file for the X11 Work Bench Toolkit API

X11 Work Bench Toolkit Toolkit API This file implements 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.c.

Macro Definition Documentation

#define WINDOW_ENTRY_HASH (   X)
Value:
(((((unsigned long)X & 0xf00) + \
(((unsigned long)X >> 3) & 0x1f) + \
(((unsigned long)X << 5) & 0xe0)) ^ \
((unsigned long)X >> 12)) & WINDOW_ENTRY_ARRAY_MAX)

Definition at line 664 of file window_helper.c.

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.