/************************************************* * * Routine to send done request. */ void DoneRequest(int doneCode) { static int beenhere = 0; Tt_message msg; Tt_status status; char *procid; /* * Only allow one Done(Request) to be issued. */ if (!beenhere) { beenhere = 1; procid = tt_default_procid(); msg = dtexec_tttk_message_create( (Tt_message) NULL, TT_REQUEST, TT_SESSION, dtSvcProcIdG, "_DtActDtexecDone", DoneRequestReplyCB ); tt_message_iarg_add( msg, TT_IN, dtexec_Tttk_integer, dtSvcInvIdG ); tt_message_iarg_add( msg, TT_IN, dtexec_Tttk_integer, dtSvcChildIdG ); tt_message_iarg_add( msg, TT_IN, dtexec_Tttk_integer, doneCode ); status = tt_message_send( msg ); tt_free(procid); if (status != TT_OK) { dtexec_tttk_message_destroy( msg ); DetachFromTooltalk(NULL); } } }
/************************************************* * * Routine to send identification request. */ void IdSelfToCallerRequest(void) { Tt_message msg; Tt_status status; char *procid; procid = tt_default_procid(); msg = dtexec_tttk_message_create( (Tt_message) NULL, TT_REQUEST, TT_SESSION, dtSvcProcIdG, "_DtActDtexecID", IdSelfToCallerReplyCB ); tt_message_iarg_add( msg, TT_IN, dtexec_Tttk_integer, dtSvcInvIdG ); tt_message_iarg_add( msg, TT_IN, dtexec_Tttk_integer, dtSvcChildIdG ); tt_message_arg_add( msg, TT_IN, dtexec_Tttk_message_id, procid ); status = tt_message_send( msg ); tt_free(procid); if (status != TT_OK) { dtexec_tttk_message_destroy( msg ); DetachFromTooltalk(NULL); } }
// // Create and optionally send a {GS}et_Iconified request or edict // static Tt_message _ttdt_GSet_Iconified( Tttk_op op, const char *handler, Tt_message commission, Tt_class theClass, Ttdt_Iconified_in_cb callback, void *clientdata, int iconified, int send ) { Tt_message msg = _ttDesktopMessageCreate( commission, theClass, handler, op, _ttdt_Iconified_in_cb, (void *)callback, clientdata ); Tt_status status = tt_ptr_error( msg ); if (status != TT_OK) { return msg; } _TttkItem2Free fuse = msg; if (op == TTDT_GET_ICONIFIED) { status = tt_message_arg_add( msg, TT_OUT, Tttk_boolean, 0 ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } } else { status = tt_message_iarg_add( msg, TT_IN, Tttk_boolean, iconified ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } } fuse = (caddr_t)0; return _ttDesktopMessageFinish( msg, commission, send ); }
static Tt_message create_new_message(char *name, int height, int width) { Tt_message msg; msg = tt_message_create(); exit_err_ptr(msg); exit_err(tt_message_address_set (msg, TT_PROCEDURE)); exit_err(tt_message_class_set (msg, TT_REQUEST)); exit_err(tt_message_scope_set (msg, TT_SESSION)); exit_err(tt_message_op_set (msg, "emacs-make-client-frame")); exit_err(tt_message_arg_add (msg, TT_IN, "string", name)); exit_err(tt_message_iarg_add (msg, TT_IN, "int", height)); exit_err(tt_message_iarg_add (msg, TT_IN, "int", width)); exit_err(tt_message_callback_add(msg, callback_fn)); return msg; }
// // Create and optionally send a {GS}et_XInfo request or edict // static Tt_message _ttdt_GSet_XInfo( Tttk_op op, const char *handler, Tt_message commission, Tt_class theClass, Ttdt_XInfo_in_cb callback, void *clientdata, const char *display, int visual, int depth, int send ) { Tt_message msg = _ttDesktopMessageCreate( commission, theClass, handler, op, _ttdt_XInfo_in_cb, (void *)callback, clientdata ); Tt_status status = tt_ptr_error( msg ); if (status != TT_OK) { return msg; } _TttkItem2Free fuse = msg; if (op == TTDT_GET_XINFO) { status = tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } status = tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } status = tt_message_arg_add( msg, TT_OUT, Tttk_integer, 0 ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } } else { status = tt_message_arg_add( msg, TT_IN, Tttk_string, display); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } status = tt_message_arg_add( msg, TT_IN, Tttk_string, _ttDtVisualString( visual )); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } status = tt_message_iarg_add( msg, TT_INOUT, Tttk_integer, depth ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } } fuse = (caddr_t)0; return _ttDesktopMessageFinish( msg, commission, send ); }
// // Create and optionally send a {GS}et_Geometry request or edict // static Tt_message _ttdt_GSet_Geometry( Tttk_op op, const char *handler, Tt_message commission, Tt_class theClass, Ttdt_Geometry_in_cb callback, void *clientdata, int w, int h, int x, int y, int send ) { Tt_message msg = _ttDesktopMessageCreate( commission, theClass, handler, op, _ttdt_Geometry_in_cb, (void *)callback, clientdata ); Tt_status status = tt_ptr_error( msg ); if (status != TT_OK) { return msg; } _TttkItem2Free fuse = msg; if (op == TTDT_GET_GEOMETRY) { status = tt_message_arg_add( msg, TT_OUT, Tttk_width, 0 ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } status = tt_message_arg_add( msg, TT_OUT, Tttk_height, 0 ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } status = tt_message_arg_add( msg, TT_OUT, Tttk_xoffset, 0 ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } status = tt_message_arg_add( msg, TT_OUT, Tttk_yoffset, 0 ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } } else { status = tt_message_iarg_add( msg, TT_INOUT, Tttk_width, w ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } status = tt_message_iarg_add( msg, TT_INOUT, Tttk_height, h ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } status = tt_message_iarg_add( msg, TT_INOUT, Tttk_xoffset, x ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } status = tt_message_iarg_add( msg, TT_INOUT, Tttk_yoffset, y ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } } fuse = (caddr_t)0; return _ttDesktopMessageFinish( msg, commission, send ); }