static int SetEwinBoolean(const char *txt, char *item, const char *value, int set) { int vold, vnew; vnew = vold = *item != 0; /* Remember old value */ if (!value || value[0] == '\0') vnew = !vold; else if (!strcmp(value, "on")) vnew = 1; else if (!strcmp(value, "off")) vnew = 0; else if (!strcmp(value, "?")) IpcPrintf("%s: %s\n", txt, (vold) ? "on" : "off"); else IpcPrintf("Error: %s\n", value); if (vnew != vold) { if (set) *item = vnew; return 1; } return 0; }
static void IPC_Screen(const char *params) { char param[1024]; int l; const char *p; param[0] = '\0'; p = params; if (p) { l = 0; sscanf(p, "%1000s %n", param, &l); p += l; } if (!p || !strncmp(param, "list", 2)) { ScreenShowInfo(p); } else if (!strncmp(param, "size", 2)) { IpcPrintf("Screen %d size %dx%d\n", Dpy.screen, WinGetW(VROOT), WinGetH(VROOT)); } else if (!strcmp(param, "split")) { unsigned int nx, ny; nx = 2; ny = 1; sscanf(p, "%u %u\n", &nx, &ny); ScreenSplit(nx, ny); } }
static void CursorsIpc(const char *params) { const char *p; char cmd[128], prm[4096]; int len; ECursor *ec; cmd[0] = prm[0] = '\0'; p = params; if (p) { len = 0; sscanf(p, "%100s %4000s %n", cmd, prm, &len); } if (!strncmp(cmd, "list", 2)) { LIST_FOR_EACH(ECursor, &cursor_list, ec) IpcPrintf("%s\n", ec->name); } }
static void ImageclassIpc(const char *params) { char param1[1024]; char param2[1024]; int l; const char *p; ImageClass *ic; if (!params) { IpcPrintf("Please specify...\n"); return; } p = params; l = 0; param1[0] = param2[0] = '\0'; sscanf(p, "%1000s %1000s %n", param1, param2, &l); p += l; if (!strncmp(param1, "list", 2)) { ECORE_LIST_FOR_EACH(iclass_list, ic) IpcPrintf("%s\n", ic->name); return; } if (!param1[0]) { IpcPrintf("ImageClass not specified\n"); return; } if (!strcmp(param2, "free_pixmap")) { Pixmap pmap; pmap = (Pixmap) strtol(p, NULL, 0); EImagePixmapsFree(pmap, None); return; } ic = ImageclassFind(param1, 0); if (!ic) { IpcPrintf("ImageClass not found: %s\n", param1); return; } if (!strcmp(param2, "get_padding")) { IpcPrintf("%i %i %i %i\n", ic->padding.left, ic->padding.right, ic->padding.top, ic->padding.bottom); } else if (!strcmp(param2, "get_image_size")) { ImagestateRealize(ic->norm.normal); if (ic->norm.normal->im) { int w, h; EImageGetSize(ic->norm.normal->im, &w, &h); EImageFree(ic->norm.normal->im); IpcPrintf("%i %i\n", w, h); } } else if (!strcmp(param2, "apply")) { Window xwin; Win win; char state[20]; int st, w, h; /* 3:xwin 4:state 5:w 6:h */ xwin = None; state[0] = '\0'; w = h = -1; sscanf(p, "%lx %16s %d %d", &xwin, state, &w, &h); win = ECreateWinFromXwin(xwin); if (!win) return; if (!strcmp(state, "normal")) st = STATE_NORMAL; else if (!strcmp(state, "hilited")) st = STATE_HILITED; else if (!strcmp(state, "clicked")) st = STATE_CLICKED; else if (!strcmp(state, "disabled")) st = STATE_DISABLED; else st = STATE_NORMAL; ImageclassApply(ic, win, 0, 0, st, ST_SOLID); EDestroyWin(win); } else if (!strcmp(param2, "apply_copy")) { Window xwin; Win win; char state[20]; int st, w, h; PmapMask pmm; /* 3:xwin 4:state 5:w 6:h */ xwin = None; state[0] = '\0'; w = h = -1; sscanf(p, "%lx %16s %d %d", &xwin, state, &w, &h); win = ECreateWinFromXwin(xwin); if (!win) return; if (!strcmp(state, "normal")) st = STATE_NORMAL; else if (!strcmp(state, "hilited")) st = STATE_HILITED; else if (!strcmp(state, "clicked")) st = STATE_CLICKED; else if (!strcmp(state, "disabled")) st = STATE_DISABLED; else st = STATE_NORMAL; if (w < 0 || h < 0) { IpcPrintf("Error: missing width and/or height\n"); return; } ImageclassApplyCopy(ic, win, w, h, 0, 0, st, &pmm, IC_FLAG_MAKE_MASK | IC_FLAG_FULL_SIZE, ST_SOLID); IpcPrintf("0x%08lx 0x%08lx\n", pmm.pmap, pmm.mask); EDestroyWin(win); } else if (!strcmp(param2, "query")) { IpcPrintf("ImageClass %s found\n", ic->name); } else if (!strcmp(param2, "ref_count")) { IpcPrintf("%u references remain\n", ic->ref_count); } else { IpcPrintf("Error: unknown operation specified\n"); } }