1 #ifndef MODULE_H 2 #define MODULE_H 3 4 #include "screen.h" 5 6 #ifdef __cplusplus 7 extern "C" { 8 #endif 9 10 struct ASTBarProps; 11 struct button_t; 12 13 /************************************************************************* 14 * Standard Module types : 15 *************************************************************************/ 16 #define AS_MODULE_CLASS "ASModule" /* for WM_CLASS_HINT only */ 17 18 #define CLASS_AFTERSTEP "AfterStep" 19 #define CLASS_ANIMATE "Animate" 20 #define CLASS_ARRANGE "Arrange" 21 #define CLASS_ASRENDER "ASRenderer" 22 #define CLASS_ASDOCGEN "ASDocGen" 23 #define CLASS_ASCONFIG "ASConfig" 24 #define CLASS_ASCP "ASCP" 25 #define CLASS_ASCOLOR "ASColor" 26 #define CLASS_ASIMBROWSER "ASIMBrowser" 27 #define CLASS_ASWALLPAPER "ASWallpaper" 28 #define CLASS_ASETROOT "asetroot" 29 #define CLASS_SOUND "Sound" 30 #define CLASS_BANNER "Banner" 31 #define CLASS_CLEAN "Clean" 32 #define CLASS_GNOME "Gnome" 33 #define CLASS_IDENT "Ident" 34 #define CLASS_PAGER "Pager" 35 #define CLASS_SCROLL "Scroll" 36 #define CLASS_WHARF "Wharf" 37 #define CLASS_WHARF_WITHDRAWN "WharfWithdrawn" 38 #define CLASS_WINCOMMAND "WinCommand" 39 #define CLASS_WINLIST "WinList" 40 #define CLASS_WINTABS "WinTabs" 41 #define CLASS_TEST "Test" 42 #define CLASS_GADGET "Gadget" 43 44 #define CLASS_CUSTOM "ASCustom" 45 #define CLASS_ASRUN "ASRun" 46 #define CLASS_ASMOUNT "ASMount" 47 48 #define BASE_CONFIG (0x01<<0) 49 #define LOOK_CONFIG (0x01<<1) 50 #define FEEL_CONFIG (0x01<<2) 51 #define DATABASE_CONFIG (0x01<<3) 52 #define AUTOEXEC_CONFIG (0x01<<4) 53 #define COLORSCHEME_CONFIG (0x01<<5) 54 #define THEME_CONFIG (0x01<<6) 55 56 #define START_FLAG 0xffffffff 57 58 #define M_TOGGLE_PAGING (1<<0) 59 #define M_NEW_DESKVIEWPORT (1<<1) 60 #define M_ADD_WINDOW (1<<2) 61 #define M_CONFIGURE_WINDOW (1<<3) 62 #define M_STATUS_CHANGE (1<<4) 63 #define M_MAP (1<<5) 64 #define M_FOCUS_CHANGE (1<<6) 65 #define M_DESTROY_WINDOW (1<<7) 66 #define M_WINDOW_NAME (1<<8) 67 #define M_WINDOW_NAME_MATCHED (1<<9) 68 #define M_ICON_NAME (1<<10) 69 #define M_RES_CLASS (1<<11) 70 #define M_RES_NAME (1<<12) 71 #define M_END_WINDOWLIST (1<<13) 72 #define M_STACKING_ORDER (1<<14) 73 #define M_NEW_BACKGROUND (1<<15) 74 #define M_NEW_CONFIG (1<<16) 75 #define M_NEW_MODULE_CONFIG (1<<17) 76 #define M_PLAY_SOUND (1<<18) 77 #define M_SWALLOW_WINDOW (1<<19) 78 #define M_SHUTDOWN (1<<20) 79 80 //#define M_LOCKONSEND (1<<19) 81 82 83 #define MAX_MESSAGES 21 84 #define MAX_MASK ((1<<MAX_MESSAGES)-1) 85 86 #define WAIT_AS_RESPONSE_TIMEOUT 20 /* seconds */ 87 88 /* M_LOCKONSEND when set causes afterstep to wait for the module to send an 89 * unlock message back, needless to say, we wouldn't want this on by default 90 */ 91 92 typedef CARD32 send_data_type; 93 typedef CARD32 send_ID_type; 94 typedef INT32 send_signed_data_type; 95 96 #define HEADER_SIZE 3 97 #define MSG_HEADER_SIZE HEADER_SIZE 98 #define MAX_PACKET_SIZE 27 99 #define MAX_BODY_SIZE (MAX_PACKET_SIZE - HEADER_SIZE) 100 101 /* from lib/module.c */ 102 int module_connect (const char *socket_name); 103 char *module_get_socket_property (Window w); 104 105 /* from lib/readpacket.c */ 106 int ReadASPacket (int, send_data_type *, send_data_type **); 107 108 typedef struct 109 { 110 send_data_type header[3]; 111 send_data_type *body; 112 } 113 ASMessage; 114 115 /* from lib/module.c */ 116 /* checks if there is message from Afterstep in incoming pipe, 117 * and reads it if it is . Returns NULL if there is nothing available yet 118 */ 119 ASMessage *CheckASMessageFine ( int t_sec, int t_usec); 120 #define CheckASMessage(t_sec) CheckASMessageFine(t_sec,0) 121 void DestroyASMessage (ASMessage * msg); 122 void module_wait_pipes_input ( void (*as_msg_handler) (send_data_type type, send_data_type *body) ); 123 124 /* returns fd of the AfterStep connection */ 125 int ConnectAfterStep (send_data_type message_mask, send_data_type lock_on_send_mask); 126 void SetAfterStepDisconnected(); 127 128 int get_module_out_fd(); 129 int get_module_in_fd(); 130 131 void SendInfo (char *message, send_ID_type window); 132 void SendNumCommand ( int func, const char *name, const send_signed_data_type *func_val, const send_signed_data_type *unit_val, send_ID_type window); 133 void SendTextCommand ( int func, const char *name, const char *text, send_ID_type window); 134 void SendCommand( FunctionData * pfunc, send_ID_type window); 135 136 137 138 139 /* constructs config filename and calls supplied user function */ 140 void LoadBaseConfig (void (*read_base_options_func) (const char *)); 141 void LoadConfig (char *config_file_name, void (*read_options_func) (const char *)); 142 143 Bool 144 button_from_astbar_props( struct ASTBarProps *tbar_props, struct button_t *button, 145 int context, Atom kind, Atom kind_pressed ); 146 void destroy_astbar_props( struct ASTBarProps **props ); 147 148 149 #ifdef __cplusplus 150 } 151 #endif 152 153 154 #endif /* MODULE_H */ 155