本文整理汇总了C++中TGetExecBase函数的典型用法代码示例。如果您正苦于以下问题:C++ TGetExecBase函数的具体用法?C++ TGetExecBase怎么用?C++ TGetExecBase使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TGetExecBase函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tek_lib_exec_sendtaskport
static TBOOL tek_lib_exec_sendtaskport(struct TTask *task,
const char *portname, const char *buf, size_t len)
{
struct TExecBase *TExecBase = TGetExecBase(task);
char atomname[256];
TAPTR atom;
TBOOL success = TFALSE;
sprintf(atomname, "msgport.%s.%p", portname, task);
atom = TLockAtom(atomname, TATOMF_SHARED | TATOMF_NAME);
if (atom)
{
TAPTR imsgport = (TAPTR) TGetAtomData(atom);
if (imsgport)
{
TAPTR msg = TAllocMsg0(len);
if (msg)
{
memcpy(msg, buf, len);
TPutMsg(imsgport, TNULL, msg);
success = TTRUE;
}
}
TUnlockAtom(atom, TATOMF_KEEP);
}
return success;
}
示例2: x11_getimsg
static TBOOL x11_getimsg(struct X11Display *mod, struct X11Window *v,
TIMSG ** msgptr, TUINT type)
{
TAPTR TExecBase = TGetExecBase(mod);
TIMSG *msg = (TIMSG *) TRemHead(&mod->x11_imsgpool);
if (msg == TNULL)
msg = TAllocMsg0(sizeof(TIMSG));
if (msg)
{
msg->timsg_Instance = v;
msg->timsg_UserData = v->userdata;
msg->timsg_Type = type;
msg->timsg_Qualifier = mod->x11_KeyQual;
msg->timsg_ScreenMouseX = mod->x11_ScreenMouseX;
msg->timsg_ScreenMouseY = mod->x11_ScreenMouseY;
msg->timsg_MouseX = v->mousex;
msg->timsg_MouseY = v->mousey;
TGetSystemTime(&msg->timsg_TimeStamp);
*msgptr = msg;
return TTRUE;
}
*msgptr = TNULL;
return TFALSE;
}
示例3: tek_init_visual
TMODENTRY TUINT
tek_init_visual(struct TTask *task, struct TModule *vis, TUINT16 version,
TTAGITEM *tags)
{
struct TVisualBase *mod = (struct TVisualBase *) vis;
if (mod == TNULL)
{
if (version == 0xffff)
return sizeof(TAPTR) * VISUAL_NUMVECTORS;
if (version <= VISUAL_VERSION)
return sizeof(struct TVisualBase);
return 0;
}
for (;;)
{
struct TExecBase *TExecBase = TGetExecBase(mod);
mod->vis_Lock = TCreateLock(TNULL);
if (mod->vis_Lock == TNULL) break;
mod->vis_Module.tmd_Version = VISUAL_VERSION;
mod->vis_Module.tmd_Revision = VISUAL_REVISION;
mod->vis_Module.tmd_Handle.thn_Hook.thk_Entry = vis_dispatch;
mod->vis_Module.tmd_Flags = TMODF_VECTORTABLE | TMODF_OPENCLOSE;
TInitVectors(&mod->vis_Module, vis_vectors, VISUAL_NUMVECTORS);
return TTRUE;
}
vis_destroy(mod);
return TFALSE;
}
示例4: rfb_getimsg
LOCAL TBOOL rfb_getimsg(RFBDISPLAY *mod, RFBWINDOW *v, TIMSG **msgptr,
TUINT type)
{
TAPTR TExecBase = TGetExecBase(mod);
TIMSG *msg;
TLock(mod->rfb_InstanceLock);
msg = (TIMSG *) TRemHead(&mod->rfb_IMsgPool);
TUnlock(mod->rfb_InstanceLock);
if (msg == TNULL)
msg = TAllocMsg(sizeof(TIMSG));
*msgptr = msg;
if (msg)
{
memset(msg, 0, sizeof(TIMSG));
msg->timsg_Instance = v;
msg->timsg_UserData = v->userdata;
msg->timsg_Type = type;
msg->timsg_Qualifier = mod->rfb_KeyQual;
msg->timsg_MouseX = mod->rfb_MouseX;
msg->timsg_MouseY = mod->rfb_MouseY;
TGetSystemTime(&msg->timsg_TimeStamp);
return TTRUE;
}
return TFALSE;
}
示例5: dfb_closevisual
LOCAL void
dfb_closevisual(DFBDISPLAY *mod, struct TVRequest *req)
{
struct DFBPen *pen;
TAPTR exec = TGetExecBase(mod);
DFBWINDOW *v = req->tvr_Op.CloseWindow.Window;
if (v == TNULL) return;
TDBPRINTF(TDB_INFO,("Visual close\n"));
TRemove(&v->node);
if (mod->dfb_Focused == (TAPTR) v)
{
/* pass focus on to the next window */
DFBWINDOW *vt = (DFBWINDOW *)TFIRSTNODE(&mod->dfb_vlist);
if (vt) genimsg(mod, TNULL, vt, TITYPE_FOCUS);
mod->dfb_Focused = (TAPTR) vt;
}
if (mod->dfb_Active == (TAPTR) v)
mod->dfb_Active = TNULL;
while ((pen = (struct DFBPen *) TRemHead(&v->penlist)))
{
/* free pens */
TRemove(&pen->node);
TExecFree(mod->dfb_ExecBase, pen);
}
v->winsurface->Release(v->winsurface);
v->window->Release(v->window);
mod->dfb_fm.defref--;
TExecFree(exec, v);
}
示例6: fb_dowindow
static void fb_dowindow(TAPTR task)
{
struct TExecBase *TExecBase = TGetExecBase(task);
WINWINDOW *win = TGetTaskData(task);
WINDISPLAY *mod = win->fbv_Display;
MSG msg;
TUINT sig;
TDBPRINTF(TDB_INFO,("DoWindow...\n"));
do
{
WaitMessage();
while (PeekMessage(&msg, win->fbv_HWnd, 0,0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// PostMessage(win->fbv_HWnd, WM_USER, 0, 0);
sig = TSetSignal(0, TTASK_SIG_ABORT);
} while (!(sig & TTASK_SIG_ABORT));
TDBPRINTF(TDB_INFO,("Window Done\n"));
TLock(mod->fbd_Lock);
TRemove(&win->fbv_Node);
TUnlock(mod->fbd_Lock);
fb_closeall(mod, win, TTRUE);
}
示例7: dfb_hostopenfont
LOCAL TAPTR
dfb_hostopenfont(DFBDISPLAY *mod, TTAGITEM *tags)
{
struct fnt_attr fattr;
struct FontNode *fn;
TAPTR font = TNULL;
TAPTR exec = TGetExecBase(mod);
/* fetch user specified attributes */
fattr.fname = (TSTRPTR) TGetTag(tags, TVisual_FontName, (TTAG) FNT_DEFNAME);
fattr.fpxsize = (TINT) TGetTag(tags, TVisual_FontPxSize, (TTAG) FNT_DEFPXSIZE);
/* not yet
fattr.fitalic = (TBOOL) TGetTag(tags, TVisual_FontItalic, (TTAG) TFALSE);
fattr.fbold = (TBOOL) TGetTag(tags, TVisual_FontBold, (TTAG) TFALSE);
fattr.fscale = (TBOOL) TGetTag(tags, TVisual_FontScaleable, (TTAG) TFALSE);
*/
if (fattr.fname)
{
fn = TExecAlloc0(exec, mod->dfb_MemMgr, sizeof(struct FontNode));
if (fn)
{
fn->handle.thn_Owner = mod;
if (hostopenfont(mod, fn, &fattr))
{
/* load succeeded, save font attributes */
fn->pxsize = fattr.fpxsize;
fn->font->GetHeight(fn->font, &fn->height);
fn->font->GetAscender(fn->font, &fn->ascent);
fn->font->GetDescender(fn->font, &fn->descent);
/* not yet
if (fattr.fitalic)
fn->attr = FNT_ITALIC;
if (fattr.fbold)
fn->attr |= FNT_BOLD;
*/
/* append to the list of open fonts */
TDBPRINTF(TDB_INFO, ("O '%s' %dpx\n", fattr.fname, fattr.fpxsize));
TAddTail(&mod->dfb_fm.openfonts, &fn->handle.thn_Node);
font = (TAPTR)fn;
}
else
{
/* load failed, free fontnode */
TDBPRINTF(TDB_INFO,("X unable to load '%s'\n", fattr.fname));
TExecFree(exec, fn);
}
}
else
TDBPRINTF(TDB_FAIL,("out of memory :(\n"));
}
else
TDBPRINTF(TDB_ERROR,("X invalid fontname '%s' specified\n", fattr.fname));
return font;
}
示例8: hostopenfont
static TBOOL
hostopenfont(DFBDISPLAY *mod, struct FontNode *fn, struct fnt_attr *fattr)
{
TBOOL succ = TFALSE;
TAPTR exec = TGetExecBase(mod);
DFBFontDescription fdsc;
TSTRPTR fontfile = TExecAlloc0(exec, mod->dfb_MemMgr,
strlen(fattr->fname) + strlen(FNT_DEFDIR) + 5);
if (fontfile)
{
fdsc.flags = DFDESC_HEIGHT;
fdsc.height = fattr->fpxsize;
sprintf(fontfile, "%s%s.ttf", FNT_DEFDIR, fattr->fname);
TDBPRINTF(TDB_INFO,("? %s:%d\n", fontfile, fattr->fpxsize));
if (mod->dfb_DFB->CreateFont(mod->dfb_DFB, fontfile,
&fdsc, &fn->font) == DFB_OK)
succ = TTRUE;
TExecFree(exec, fontfile);
}
else
TDBPRINTF(TDB_FAIL,("out of memory :(\n"));
return succ;
}
示例9: fb_closeall
static void
fb_closeall(WINDISPLAY *mod, WINWINDOW *win, TBOOL unref_font)
{
struct TExecBase *TExecBase = TGetExecBase(mod);
struct FBPen *pen;
if (win->fbv_HDC)
ReleaseDC(win->fbv_HWnd, win->fbv_HDC);
if (mod->fbd_WindowFocussedApp == win->fbv_HWnd)
mod->fbd_WindowFocussedApp = NULL;
if (mod->fbd_WindowUnderCursor == win->fbv_HWnd)
mod->fbd_WindowUnderCursor = NULL;
if (mod->fbd_WindowActivePopup == win->fbv_HWnd)
mod->fbd_WindowActivePopup = NULL;
if (win->fbv_HWnd)
DestroyWindow(win->fbv_HWnd);
while ((pen = (struct FBPen *) TRemHead(&win->penlist)))
TFree(pen);
if (unref_font)
mod->fbd_FontManager.defref--;
if (win->fbv_InputMask & TITYPE_INTERVAL)
--mod->fbd_NumInterval;
TFree(win);
}
示例10: rfb_focuswindow
LOCAL void rfb_focuswindow(struct rfb_Display *mod, struct rfb_Window *v)
{
TAPTR TExecBase = TGetExecBase(mod);
TIMSG *imsg;
if (v == mod->rfb_FocusWindow || (v && (v->rfbw_Flags & RFBWFL_IS_POPUP)))
return;
if (mod->rfb_FocusWindow)
{
if (rfb_getimsg(mod, mod->rfb_FocusWindow, &imsg, TITYPE_FOCUS))
{
imsg->timsg_Code = 0;
TPutMsg(mod->rfb_FocusWindow->rfbw_IMsgPort, TNULL, imsg);
}
}
if (v)
{
if (rfb_getimsg(mod, v, &imsg, TITYPE_FOCUS))
{
imsg->timsg_Code = 1;
TPutMsg(v->rfbw_IMsgPort, TNULL, imsg);
}
}
mod->rfb_FocusWindow = v;
}
示例11: fb_init
LOCAL TBOOL
fb_init(WINDISPLAY *mod, TTAGITEM *tags)
{
struct TExecBase *TExecBase = TGetExecBase(mod);
// mod->fbd_OpenTags = tags;
for (;;)
{
TTAGITEM tags[2];
tags[0].tti_Tag = TTask_UserData;
tags[0].tti_Value = (TTAG) mod;
tags[1].tti_Tag = TTAG_DONE;
mod->fbd_Task = TCreateTask(&mod->fbd_Module.tmd_Handle.thn_Hook,
tags);
if (mod->fbd_Task == TNULL) break;
mod->fbd_CmdPort = TGetUserPort(mod->fbd_Task);
mod->fbd_CmdPortSignal = TGetPortSignal(mod->fbd_CmdPort);
return TTRUE;
}
fb_exit(mod);
return TFALSE;
}
示例12: vis_exit
static void
vis_exit(struct TVisualBase *mod)
{
struct TExecBase *TExecBase = TGetExecBase(mod);
if (mod->vis_Displays)
{
struct TList dlist;
struct TNode *next, *node;
if (mod->vis_InitRequest)
TDisplayFreeReq((struct TDisplayBase *)
mod->vis_InitRequest->tvr_Req.io_Device,
mod->vis_InitRequest);
TInitList(&dlist);
vis_hashtolist(mod, mod->vis_Displays, &dlist);
for (node = dlist.tlh_Head; (next = node->tln_Succ); node = next)
{
#if defined(VISUAL_USE_INTERNAL_HASH)
struct TModule *dmod = (struct TModule *)
((struct vis_HashNode *) node)->value;
#else
struct TModule *dmod = (struct TModule *)
((struct THashNode *) node)->thn_Value;
#endif
TCloseModule(dmod);
}
vis_destroyhash(mod, mod->vis_Displays);
}
}
示例13: fb_getimsg
LOCAL TBOOL
fb_getimsg(WINDISPLAY *mod, WINWINDOW *win, TIMSG **msgptr, TUINT type)
{
struct TExecBase *TExecBase = TGetExecBase(mod);
TIMSG *msg;
TBOOL res = TFALSE;
TLock(mod->fbd_Lock);
msg = (TIMSG *) TRemHead(&mod->fbd_IMsgPool);
if (msg == TNULL)
msg = TAllocMsg0(sizeof(TIMSG));
if (msg)
{
msg->timsg_Instance = win;
msg->timsg_UserData = win->fbv_UserData;
msg->timsg_Type = type;
msg->timsg_Qualifier = win->fbv_KeyQual;
msg->timsg_MouseX = win->fbv_MouseX;
msg->timsg_MouseY = win->fbv_MouseY;
TGetSystemTime(&msg->timsg_TimeStamp);
*msgptr = msg;
res = TTRUE;
}
else
*msgptr = TNULL;
TUnlock(mod->fbd_Lock);
return res;
}
示例14: rfb_passevent
static TBOOL rfb_passevent(RFBDISPLAY *mod, RFBWINDOW *v, TIMSG *omsg)
{
TAPTR TExecBase = TGetExecBase(mod);
TUINT type = omsg->timsg_Type;
if (v && (v->rfbw_InputMask & type))
{
TIMSG *imsg;
if (rfb_getimsg(mod, v, &imsg, omsg->timsg_Type))
{
TINT x = omsg->timsg_MouseX;
TINT y = omsg->timsg_MouseY;
mod->rfb_MouseX = x;
mod->rfb_MouseY = y;
imsg->timsg_Code = omsg->timsg_Code;
imsg->timsg_Qualifier = omsg->timsg_Qualifier;
imsg->timsg_MouseX = x - v->rfbw_WinRect[0];
imsg->timsg_MouseY = y - v->rfbw_WinRect[1];
imsg->timsg_ScreenMouseX = x;
imsg->timsg_ScreenMouseY = y;
memcpy(imsg->timsg_KeyCode, omsg->timsg_KeyCode, 8);
TPutMsg(v->rfbw_IMsgPort, TNULL, imsg);
return TTRUE;
}
}
return TFALSE;
}
示例15: rfb_passevent
static TBOOL rfb_passevent(struct rfb_Display *mod, struct rfb_Window *v,
TIMSG *omsg)
{
TAPTR TExecBase = TGetExecBase(mod);
TUINT type = omsg->timsg_Type;
if (v && (v->rfbw_InputMask & type))
{
TIMSG *imsg;
if (rfb_getimsg(mod, v, &imsg, omsg->timsg_Type))
{
/* note: screen coordinates */
TINT x = omsg->timsg_MouseX;
TINT y = omsg->timsg_MouseY;
mod->rfb_MouseX = x;
mod->rfb_MouseY = y;
imsg->timsg_Code = omsg->timsg_Code;
imsg->timsg_Qualifier = omsg->timsg_Qualifier;
imsg->timsg_MouseX = x - v->rfbw_ScreenRect.r[0];
imsg->timsg_MouseY = y - v->rfbw_ScreenRect.r[1];
imsg->timsg_ScreenMouseX = x;
imsg->timsg_ScreenMouseY = y;
memcpy(imsg->timsg_KeyCode, omsg->timsg_KeyCode, 8);
TPutMsg(v->rfbw_IMsgPort, TNULL, imsg);
return TTRUE;
}
}
return TFALSE;
}