static WarpFocusWin * WarpFocusWinCreate(void) { WarpFocusWin *fw; fw = ECALLOC(WarpFocusWin, 1); if (!fw) return fw; EoInit(fw, EOBJ_TYPE_MISC, None, 0, 0, 1, 1, 1, "Warp"); EoSetFloating(fw, 1); EoSetLayer(fw, 20); EoSetFade(fw, 1); EoSetShadow(fw, 1); EventCallbackRegister(EoGetWin(fw), WarpFocusHandleEvent, NULL); ESelectInput(EoGetWin(fw), ButtonReleaseMask); fw->tc = TextclassFind("WARPFOCUS", 0); if (!fw->tc) fw->tc = TextclassFind("COORDS", 1); fw->ic = ImageclassFind("WARPFOCUS", 0); if (!fw->ic) fw->ic = ImageclassFind("COORDS", 1); return fw; }
static Group * GroupCreate(int gid) { Group *g; g = ECALLOC(Group, 1); if (!g) return NULL; if (!group_list) group_list = ecore_list_new(); ecore_list_append(group_list, g); if (gid == -1) { /* Create new group id */ /* ... using us time. Should really be checked for uniqueness. */ g->index = (int)GetTimeUs(); } else { /* Use given group id */ g->index = gid; } g->cfg.iconify = Conf_groups.dflt.iconify; g->cfg.kill = Conf_groups.dflt.kill; g->cfg.move = Conf_groups.dflt.move; g->cfg.raise = Conf_groups.dflt.raise; g->cfg.set_border = Conf_groups.dflt.set_border; g->cfg.stick = Conf_groups.dflt.stick; g->cfg.shade = Conf_groups.dflt.shade; Dprintf("grp=%p gid=%d\n", g, g->index); return g; }
static Snapshot * _SnapCreate(const char *name) { Snapshot *sn; sn = ECALLOC(Snapshot, 1); if (!sn) return NULL; LIST_APPEND(Snapshot, &ss_list, sn); sn->name = Estrdup(name); return sn; }
static ImageClass * ImageclassCreate(const char *name) { ImageClass *ic; ic = ECALLOC(ImageClass, 1); if (!ic) return NULL; LIST_PREPEND(ImageClass, &iclass_list, ic); ic->name = Estrdup(name); return ic; }
static MagWindow * MagwinCreate(const char *title, int width, int height) { MagWindow *mw; Win win; int x, y, w, h; mw = ECALLOC(MagWindow, 1); if (!mw) return NULL; win = VROOT; w = width; h = height; x = (win->w - w) / 2; y = (win->h - h) / 2; win = ECreateClientWindow(VROOT, x, y, w, h); mw->title = title; mw->ewin = AddInternalToFamily(win, NULL, EWIN_TYPE_MISC, &_MagEwinOps, mw); if (!mw->ewin) { Efree(mw); return NULL; } mw->filter = 1; mw->disable_text = 1; mw->ewin->o.ghost = 1; EoSetLayer(mw->ewin, 10); EwinMoveResize(mw->ewin, EoGetX(mw->ewin), EoGetY(mw->ewin), mw->ewin->client.w, mw->ewin->client.h); mw->ewin->client.event_mask |= KeyPressMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask; ESelectInput(win, mw->ewin->client.event_mask); EventCallbackRegister(win, MagwinEvent, mw); EQueryPointer(VROOT, &mw->cx, &mw->cy, NULL, NULL); mw->scale = Conf.magwin.zoom_res; mw->step = 4; return mw; }
static ImageState * ImagestateCreate(const char *file) { ImageState *is; is = ECALLOC(ImageState, 1); if (!is) return NULL; is->pixmapfillstyle = FILL_STRETCH; ImagestateColorsSetGray(is, 255, 200, 160, 120, 64); is->bevelstyle = BEVEL_NONE; is->im_file = Estrdup(file); return is; }
static ImageClass * ImageclassCreate(const char *name) { ImageClass *ic; ic = ECALLOC(ImageClass, 1); if (!ic) return NULL; if (!iclass_list) iclass_list = ecore_list_new(); ecore_list_prepend(iclass_list, ic); ic->name = Estrdup(name); return ic; }
static MenuStyle * MenuStyleCreate(const char *name) { MenuStyle *ms; ms = ECALLOC(MenuStyle, 1); if (!ms) return NULL; if (!menu_style_list) menu_style_list = ecore_list_new(); ecore_list_prepend(menu_style_list, ms); ms->name = Estrdup(name); ms->iconpos = ICON_LEFT; return ms; }
Menu * MenuCreate(const char *name, const char *title, Menu * parent, MenuStyle * ms) { Menu *m; m = ECALLOC(Menu, 1); if (!m) return m; m->parent = parent; MenuSetName(m, name); MenuSetTitle(m, title); if (ms) MenuSetStyle(m, ms); m->icon_size = -1; /* Use image size */ if (!menu_list) menu_list = ecore_list_new(); ecore_list_append(menu_list, m); return m; }
static void ECursorCreate(const char *name, const char *image, int native_id, unsigned int fg, unsigned int bg) { ECursor *ec; if ((!name) || (!image && native_id == -1)) return; ec = ECALLOC(ECursor, 1); if (!ec) return; ec->name = Estrdup(name); ec->file = Estrdup(image); ec->fg = 0xff000000 | fg; ec->bg = 0xff000000 | bg; ec->native_id = native_id; LIST_PREPEND(ECursor, &cursor_list, ec); }
MenuItem * MenuItemCreate(const char *text, ImageClass * iclass, const char *action_params, Menu * child) { MenuItem *mi; mi = ECALLOC(MenuItem, 1); mi->icon_iclass = iclass; #if 0 if (iclass) ImageclassIncRefcount(iclass); #endif mi->text = (text) ? Estrdup((text[0]) ? text : "?!?") : NULL; mi->params = Estrdup(action_params); mi->child = child; if (child) child->ref_count++; mi->state = STATE_NORMAL; return mi; }
static ToolTip * TooltipCreate(const char *name, const char *ic0, const char *ic1, const char *ic2, const char *ic3, const char *ic4, const char *tclass, int dist, const char *tooltippic) { ToolTip *tt; ImageClass *ic; if (!ic0 || !tclass) return NULL; ic = ImageclassAlloc(ic0, 0); if (!ic) return NULL; tt = ECALLOC(ToolTip, 1); if (!tt) return NULL; tt->name = Estrdup(name); tt->iclass[0] = ImageclassAlloc(ic1, 0); tt->iclass[1] = ImageclassAlloc(ic2, 0); tt->iclass[2] = ImageclassAlloc(ic3, 0); tt->iclass[3] = ImageclassAlloc(ic4, 0); tt->iclass[4] = ic; tt->tclass = TextclassAlloc(tclass, 1); tt->tooltippic = ImageclassAlloc(tooltippic, 0); tt->dist = dist; if (!tt_list) tt_list = ecore_list_new(); ecore_list_prepend(tt_list, tt); return tt; }
void DrawEwinShape(EWin * ewin, int md, int x, int y, int w, int h, int firstlast, int seqno) { ShapeData *psd; int dx, dy; /* Quit if no change */ if (firstlast == 1 && (x == ewin->shape_x && y == ewin->shape_y && (ewin->state.shaded || (w == ewin->shape_w && h == ewin->shape_h)))) return; if ((md == MR_OPAQUE) || (md == MR_TECH_OPAQUE)) { EwinOpMoveResize(ewin, OPSRC_USER, x, y, w, h); EwinShapeSet(ewin); CoordsShow(ewin); if (md == MR_OPAQUE) goto done; } if (firstlast == 0) { EwinShapeSet(ewin); psd = ECALLOC(ShapeData, 1); ewin->shape_data = psd; if (!psd) goto done; psd->root = WinGetXwin(VROOT); EwinBorderGetSize(ewin, &psd->bl, &psd->br, &psd->bt, &psd->bb); } psd = (ShapeData *) ewin->shape_data; if (!psd) goto done; dx = EoGetX(EoGetDesk(ewin)); dy = EoGetY(EoGetDesk(ewin)); ewin->shape_x = x; ewin->shape_y = y; x += dx; y += dy; if (!ewin->state.shaded) { ewin->shape_w = w; ewin->shape_h = h; } else { w = ewin->shape_w; h = ewin->shape_h; } if (((md <= MR_BOX) || (md == MR_TECH_OPAQUE)) && Conf.movres.avoid_server_grab) { _ShapeDrawNograb_tech_box(ewin, md, firstlast, x, y, w, h, seqno); goto done; } switch (md) { case MR_TECHNICAL: case MR_TECH_OPAQUE: case MR_BOX: _ShapeDrawNontranslucent(ewin, md, firstlast, x, y, w, h); break; default: /* Fall back to opaque mode */ Conf.movres.mode_move = MR_OPAQUE; break; } psd->xo = x; psd->yo = y; psd->wo = w; psd->ho = h; done: if (firstlast == 0 || firstlast == 2 || firstlast == 4) { ewin->req_x = ewin->shape_x; ewin->req_y = ewin->shape_y; if (firstlast == 2) { CoordsHide(); Efree(ewin->shape_data); ewin->shape_data = NULL; } } }