#ifndef WH_INTERNAL_H_21bba98d_ #define WH_INTERNAL_H_21bba98d_ #include #include #include "lx.h" #include "lx-xi.h" typedef enum { BS_NEVER = 1, BS_WHENMAPPED, BS_ALWAYS, } BACKINGSTORE; typedef unsigned char VISUALCLASS; #define VC_StaticGray 0 #define VC_GrayScale 1 #define VC_StaticColor 2 #define VC_PseudoColor 3 #define VC_TrueColor 4 #define VC_DirectColor 5 #define VC__MUTABLE(vc) ((vc)&1) // Event state #define EVS_KEYBUTMASK_MBZ 0xe000 #define EVS_KEYMASK_MBZ 0xff00 // Event mask #define EVM_EVENT_MBZ 0xfe000000 #define EVM_POINTEREVENT_MBZ 0xffff8003 #define EVM_DEVICEEVENT_MBZ 0xffffc0b0 typedef struct open_state OPEN_STATE; typedef struct str_tconc STR_TCONC; typedef struct str_entry STR_ENTRY; typedef struct pmformat PMFORMAT; typedef struct screen SCREEN; typedef struct screendepth SCREENDEPTH; typedef struct visualtype VISUALTYPE; typedef struct sgc SGC; typedef struct chainer CHAINER; struct chainer { void *(*start)(LX_CONN *); void (*done)(LX_CONN *, void *); } ; #define CHAINER_INIT(name) { &chain_##name##_start, &chain_##name##_done } struct lx_conn { unsigned int flags; #define XCF_FAIL 0x00000001 #define XCF_OPENING 0x00000002 #define XCF_DEBUG 0x00000004 #define XCF_BREAK 0x00000008 #define XCF_SEQSYNC 0x00000010 int fd; int sno; AIO_LOOP *io; AIO_OQ oq; int pid; unsigned int proto_major; unsigned int proto_minor; unsigned int release; unsigned int resource_base; unsigned int resource_mask; unsigned int resource_val; unsigned int resource_inc; unsigned int motion_size; int vendor_len; char *vendor; unsigned int max_request; int nscreens; int nformats; LX_IMAGE_BYTE_ORDER ibo; LX_BITMAP_BIT_ORDER bbo; int scanline_unit; int scanline_pad; int keycode_min; int keycode_max; PMFORMAT *pmformats; SCREEN *screens; int (*gotdata)(LX_CONN *, const void *, int); OPEN_STATE *os; CARD32 next_oserial; CARD32 last_iserial; LX_OP *pendf; LX_OP *pendb; LX_OP *intlf; LX_OP *intlb; char *text; unsigned char *rb; int rba; int rbl; int rbw; void *udata; LX_X_ERR_ACTION (*x_err)(LX_CONN *, const LX_X_ERR *); void (*lib_err)(LX_CONN *, const LX_LIB_ERR *); void (*event)(LX_CONN *, LX_EVENT *); LX_EVENT evbuf; int nsgc; int minfreesgc; SGC **sgcv; int npriv; void **privv; CHAINER *chain; void *chainpriv; } ; typedef enum { LXS_USER = 1, } LX_OP_STATE; struct lx_op { LX_CONN *conn; LX_OP *flink; LX_OP *blink; CARD32 serial; void (*usercb)(void *); void *usercbarg; void (*done)(LX_OP *, const unsigned char *, void *); int (*err)(LX_OP *, const LX_X_ERR *, void *); void *reqarg; unsigned int flags; #define LXOF_DONE 0x00000001 #define LXOF_MORE 0x00000002 #define LXOF_DROP 0x00000004 #define LXOF_KEEP 0x00000008 #define LXOF_LINK 0x00000010 #define LXOF_INTL 0x00000020 void *udata; } ; struct lx_hostlist { int len; LX_HOSTTYPE *types; int *sizes; void **data; unsigned char *alldata; } ; struct lx_strlist { int len; int *lens; char **data; char *alldata; } ; struct lx_XIDlist { int len; LX_XID *ids; } ; struct pmformat { unsigned char depth; unsigned char bpp; unsigned char scanline_pad; } ; struct screen { LX_XID root; LX_XID cmap; CARD32 whitepixel; CARD32 blackpixel; CARD32 inputmasks; CARD16 w_pixels; CARD16 h_pixels; CARD16 w_mm; CARD16 h_mm; CARD16 min_maps; CARD16 max_maps; LX_XID rootvisual; BACKINGSTORE backingstore; int saveunders; CARD8 rootdepth; CARD8 ndepths; SCREENDEPTH *depths; } ; struct screendepth { CARD8 depth; CARD16 nvisuals; VISUALTYPE *visuals; } ; struct visualtype { LX_XID id; VISUALCLASS class; CARD8 bitsperrgb; CARD16 cmapentries; CARD32 rmask; CARD32 gmask; CARD32 bmask; } ; struct str_tconc { STR_ENTRY *head; STR_ENTRY **tail; } ; struct str_entry { STR_ENTRY *link; char *str; } ; struct open_state { LX_CONN *conn; unsigned int flags; #define OSF_NUMERIC_ADDR 0x00000001 #define OSF_NO_PREAMBLE 0x00000002 void (*err)(const LX_LIB_ERR *, void *); void (*done)(LX_CONN *, void *); void *cbarg; int dispno; struct addrinfo *ai0; struct addrinfo *ai; int fd; int pid; int bid; unsigned char *ihdata; int ihwant; int ihfill; char *text; char *failmsg; int multifail; } ; struct sgc { LX_CONN *xc; LX_XID sgcid; LX_XID gcid; LX_XID drawable; LX_GC_ATTRIBUTES shadow; unsigned int set; unsigned int unk; } ; extern const LX_LIB_ERR lx__nomem_err; extern void lx__str_tconc_init(STR_TCONC *); extern int lx__str_tconc_push_printf(STR_TCONC *, const char *, ...) __attribute__((__format__(__printf__,2,3))); extern void lx__str_tconc_flush(STR_TCONC *); extern void lx__protoerr(LX_CONN *, const char *, ...) __attribute__((__format__(__printf__,2,3))); extern void lx__protoerr_v(LX_CONN *, const char *, va_list); #define r_card16 lx__r_card16 extern CARD16 r_card16(const unsigned char *); #define w_card16 lx__w_card16 extern void w_card16(unsigned char *, CARD16); #define w_char2b lx__w_char2b extern void w_char2b(unsigned char *, unsigned int); #define r_int16 lx__r_int16 extern int r_int16(const unsigned char *); #define w_int16 lx__w_int16 extern void w_int16(unsigned char *, INT16); #define r_card32 lx__r_card32 extern CARD32 r_card32(const unsigned char *); #define r_int32 lx__r_int32 extern int r_int32(const unsigned char *); #define w_card32 lx__w_card32 extern void w_card32(unsigned char *, CARD32); #define w_int32 lx__w_int32 extern void w_int32(unsigned char *, int); #define w_card32be lx__w_card32be extern void w_card32be(unsigned char *, CARD32); /* * Mapping between protocol values and API values. */ extern int lx__wclass_to_proto(LX_WINDOW_CLASS); extern LX_WINDOW_CLASS lx__proto_to_wclass(unsigned int); extern int lx__backingstore_to_proto(LX_BACKINGSTORE); extern LX_BACKINGSTORE lx__proto_to_backingstore(unsigned int); extern int lx__bitgravity_to_proto(LX_GRAVITY); extern LX_GRAVITY lx__proto_to_bitgravity(unsigned int); extern int lx__wingravity_to_proto(LX_GRAVITY); extern LX_GRAVITY lx__proto_to_wingravity(unsigned int); extern int lx__gcfunction_to_proto(LX_GCFUNCTION); extern LX_GCFUNCTION lx__proto_to_gcfunction(unsigned int); extern int lx__gclinestyle_to_proto(LX_GCLINESTYLE); extern LX_GCLINESTYLE lx__proto_to_gclinestyle(unsigned int); extern int lx__gccapstyle_to_proto(LX_GCCAPSTYLE); extern LX_GCCAPSTYLE lx__proto_to_gccapstyle(unsigned int); extern int lx__gcjoinstyle_to_proto(LX_GCJOINSTYLE); extern LX_GCJOINSTYLE lx__proto_to_gcjoinstyle(unsigned int); extern int lx__gcfillstyle_to_proto(LX_GCFILLSTYLE); extern LX_GCFILLSTYLE lx__proto_to_gcfillstyle(unsigned int); extern int lx__gcfillrule_to_proto(LX_GCFILLRULE); extern LX_GCFILLRULE lx__proto_to_gcfillrule(unsigned int); extern int lx__gcsubwindowmode_to_proto(LX_GCSUBWINDOWMODE); extern LX_GCSUBWINDOWMODE lx__proto_to_gcsubwindowmode(unsigned int); extern int lx__gcarcmode_to_proto(LX_GCARCMODE); extern LX_GCARCMODE lx__proto_to_gcarcmode(unsigned int); extern int lx__coordmode_to_proto(LX_COORDMODE); extern int lx__boolean_to_proto(int); extern int lx__proto_to_boolean(unsigned int); extern int lx__forcescreensaver_to_proto(LX_FORCESCREENSAVER); extern int lx__closedownmode_to_proto(LX_CLOSEDOWNMODE); extern int lx__accesscontrol_to_proto(LX_ACCESSCONTROL); extern LX_ACCESSCONTROL lx__proto_to_accesscontrol(unsigned int); extern int lx__hosttype_to_proto(LX_HOSTTYPE); extern LX_HOSTTYPE lx__proto_to_hosttype(unsigned int); extern int lx__changehostsmode_to_proto(LX_CHANGEHOSTSMODE); extern int lx__ssblanking_to_proto(LX_SSBLANKING); extern LX_SSBLANKING lx__proto_to_ssblanking(unsigned int); extern int lx__ssexposures_to_proto(LX_SSEXPOSURES); extern LX_SSEXPOSURES lx__proto_to_ssexposures(unsigned int); extern int lx__keyboardcontrolledaction_to_proto(LX_KBCTLLEDACTION); extern int lx__keyboardcontrolrepeataction_to_proto(LX_KBCTLREPEATACTION); extern int lx__sizeclass_to_proto(LX_SIZECLASS); extern int lx__imageformat_to_proto(LX_IMAGEFORMAT); extern int lx__shapeclass_to_proto(LX_SHAPECLASS); extern int lx__rectorder_to_proto(LX_RECTORDER); extern LX_MAPSTATE lx__proto_to_mapstate(unsigned int); extern int lx__changesavesetmode_to_proto(LX_CHANGESAVESETMODE); extern int lx__stackmode_to_proto(LX_STACKMODE); extern int lx__circulate_to_proto(LX_CIRCULATE); extern int lx__propertymode_to_proto(LX_PROPERTYMODE); extern int lx__grabmode_to_proto(LX_GRABMODE); extern LX_GRABSTATUS lx__proto_to_grabstatus(unsigned int); extern int lx__allowmode_to_proto(LX_ALLOWMODE); extern LX_TEXTDIRECTION lx__proto_to_textdirection(unsigned int); extern LX_MOTIONDETAIL lx__proto_to_motiondetail(unsigned int); extern LX_ENTERLEAVEDETAIL lx__proto_to_enterleavedetail(unsigned int); extern LX_ENTERLEAVEMODE lx__proto_to_enterleavemode(unsigned int); extern LX_FOCUSDETAIL lx__proto_to_focusdetail(unsigned int); extern LX_FOCUSMODE lx__proto_to_focusmode(unsigned int); extern LX_VISIBILITYSTATE lx__proto_to_visibilitystate(unsigned int); extern LX_STACKMODE lx__proto_to_stackmode(unsigned int); extern LX_CIRCULATEPLACE lx__proto_to_circulateplace(unsigned int); extern LX_PROPERTYSTATE lx__proto_to_propertystate(unsigned int); extern LX_COLORMAPSTATE lx__proto_to_colormapstate(unsigned int); extern LX_MAPPINGREQUEST lx__proto_to_mappingrequest(unsigned int); extern int lx__motiondetail_to_proto(LX_MOTIONDETAIL); extern int lx__enterleavedetail_to_proto(LX_ENTERLEAVEDETAIL); extern int lx__enterleavemode_to_proto(LX_ENTERLEAVEMODE); extern int lx__focusdetail_to_proto(LX_FOCUSDETAIL); extern int lx__focusmode_to_proto(LX_FOCUSMODE); extern int lx__visibilitystate_to_proto(LX_VISIBILITYSTATE); extern int lx__circulateplace_to_proto(LX_CIRCULATEPLACE); extern int lx__propertystate_to_proto(LX_PROPERTYSTATE); extern int lx__colormapstate_to_proto(LX_COLORMAPSTATE); extern int lx__mappingrequest_to_proto(LX_MAPPINGREQUEST); extern void lx__send_req(LX_CONN *, const unsigned char *, int); extern void lx__send_req_free(LX_CONN *, unsigned char *, int); extern void lx__just_send(LX_CONN *, const unsigned char *, int); extern void lx__send_padding(LX_CONN *, unsigned int n); extern LX_OP *lx__expect_reply(LX_CONN *, const unsigned char *, int, void (*)(LX_OP *, const unsigned char *, void *), void *); extern LX_OP *lx__predone_op(LX_CONN *); extern LX_OP *lx__internal_op(LX_CONN *); extern int lx__proto_pkt(LX_CONN *, const void *, int); extern void lx__proto_newpkt(LX_CONN *); extern LX_XID lx__new_resource_id(LX_CONN *); extern int lx__loop_once(LX_CONN *); extern void lx__teardown_xc(LX_CONN *); extern void lx__teardown_os(OPEN_STATE *); extern void lx__bad_call(LX_CONN *, const char *); extern void lx__nomem_fail(LX_CONN *); extern void lx__simple_none(LX_CONN *, const char *, int); extern void lx__simple_single(LX_CONN *, LX_XID, const char *, int); extern void lx__grab_charinfo(LX_CHARINFO *, const unsigned char *); extern void lx__dumphex(const char *, const unsigned char *, int); extern void lx__process_event(LX_CONN *); extern int lx__serialize_event(unsigned char *, const LX_EVENT *); extern int lx__findauth_local(LX_CONN *, int *, unsigned char **, int *, unsigned char **); extern int lx__findauth_network(LX_CONN *, int *, unsigned char **, int *, unsigned char **); extern void lx__op_finished(LX_OP *); extern void *lx__chainable(LX_CONN *, CHAINER *); extern void lx__nochain(LX_CONN *); extern void lx__PolyFillArc_inbatch(LX_CONN *, LX_XID, LX_XID, int, const LX_ARC *); extern void lx__PolyFillRectangle_inbatch(LX_CONN *, LX_XID, LX_XID, int, const LX_RECTANGLE *); extern void lx__PolyPoint_inbatch(LX_CONN *, LX_XID, LX_XID, LX_COORDMODE, int, const LX_POINT *); extern void lx__PolyRectangle_inbatch(LX_CONN *, LX_XID, LX_XID, int, const LX_RECTANGLE *); extern void lx__PolySegment_inbatch(LX_CONN *, LX_XID, LX_XID, int, const LX_SEGMENT *); // Internal LookupColor, exported for lx_lookup_color extern LX_OP *lx__do_LookupColor(const char *, LX_CONN *, LX_XID, const char *, int, unsigned int *, unsigned int *, unsigned int *, unsigned int *, unsigned int *, unsigned int *); extern SGC *lx__new_sgc(LX_CONN *); extern void lx__free_sgc(LX_CONN *, SGC *); extern SGC *lx__lookup_sgc(LX_CONN *, LX_XID); #define GCFIELDS\ MAPPED(Function,lx__gcfunction_to_proto,0x000001,function) \ SIMPLE(PlaneMask,unsigned int,ui,0x000002,plane_mask) \ SIMPLE(Foreground,unsigned int,ui,0x000004,foreground) \ SIMPLE(Background,unsigned int,ui,0x000008,background) \ SIMPLE(LineWidth,unsigned int,ui,0x000010,line_width) \ MAPPED(LineStyle,lx__gclinestyle_to_proto,0x000020,line_style) \ MAPPED(CapStyle,lx__gccapstyle_to_proto,0x000040,cap_style) \ MAPPED(JoinStyle,lx__gcjoinstyle_to_proto,0x000080,join_style) \ MAPPED(FillStyle,lx__gcfillstyle_to_proto,0x000100,fill_style) \ MAPPED(FillRule,lx__gcfillrule_to_proto,0x000200,fill_rule) \ SIMPLE(Tile,unsigned long int,uli,0x000400,tile) \ SIMPLE(Stipple,unsigned long int,uli,0x000800,stipple) \ SIMPLE(TileStipXOrigin,int,i,0x001000,tile_stip_x_origin) \ SIMPLE(TileStipYOrigin,int,i,0x002000,tile_stip_y_origin) \ SIMPLE(Font,unsigned long int,uli,0x004000,font) \ MAPPED(SubwindowMode,lx__gcsubwindowmode_to_proto,0x008000,subwindow_mode)\ GRAPHICSEXPOSURES(GraphicsExposures,int,i,0x010000,graphics_exposures)\ SIMPLE(ClipXOrigin,int,i,0x020000,clip_x_origin) \ SIMPLE(ClipYOrigin,int,i,0x040000,clip_y_origin) \ CLIPMASK(ClipMask,unsigned long int,uli,0x080000,clip_mask) \ SIMPLE(DashOffset,unsigned int,ui,0x100000,dash_offset) \ SIMPLE(Dashes,unsigned int,ui,0x200000,dashes) \ MAPPED(ArcMode,lx__gcarcmode_to_proto,0x400000,arc_mode) #define LX__map_error 0x20000019 extern const LX_KEYSYM lx__cmap[][3]; extern const int lx__n_casemap; #endif