/** Parse an option group. */ void ParseGroup(const TokenNode *tp) { const TokenNode *np; struct GroupType *group; Assert(tp); group = CreateGroup(); for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_CLASS: AddGroupClass(group, np->value); break; case TOK_NAME: AddGroupName(group, np->value); break; case TOK_OPTION: ParseGroupOption(np, group, np->value); break; default: InvalidTag(np, TOK_GROUP); break; } } }
/** Parse tray component actions. */ void ParseTrayComponentActions(const TokenNode *tp, TrayComponentType *cp, AddTrayActionFunc func) { const TokenNode *np; const char *mask_str; const int default_mask = (1 << 1) | (1 << 2) | (1 << 3); int mask; if(tp->value) { (func)(cp, tp->value, default_mask); } for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_BUTTON: mask_str = FindAttribute(np->attributes, "mask"); if(mask_str) { int i; mask = 0; for(i = 0; mask_str[i]; i++) { mask |= 1 << (mask_str[i] - '0'); } } else { mask = default_mask; } (func)(cp, np->value, mask); break; default: InvalidTag(np, tp->type); break; } } }
/** Parse active window style information. */ void ParseActiveWindowStyle(const TokenNode *tp) { const TokenNode *np; Assert(tp); for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FOREGROUND: SetColor(COLOR_TITLE_ACTIVE_FG, np->value); break; case TOK_BACKGROUND: ParseGradient(np->value, COLOR_TITLE_ACTIVE_BG1, COLOR_TITLE_ACTIVE_BG2); break; case TOK_OUTLINE: SetColor(COLOR_BORDER_ACTIVE_LINE, np->value); break; case TOK_OPACITY: settings.activeClientOpacity = ParseOpacity(np, np->value); break; default: InvalidTag(np, TOK_ACTIVE); break; } } }
/** Parse task list style. */ void ParseTaskListStyle(const TokenNode *tp) { static const StringMappingType mapping[] = { { "left", INSERT_LEFT }, { "right", INSERT_RIGHT } }; TokenNode *np; settings.taskInsertMode = ParseAttribute(mapping, ARRAY_LENGTH(mapping), tp, "insert", settings.taskInsertMode); for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_TASK, np->value); break; case TOK_ACTIVE: ParseActiveTaskListStyle(np); break; case TOK_FOREGROUND: SetColor(COLOR_TASK_FG, np->value); break; case TOK_BACKGROUND: ParseGradient(np->value, COLOR_TASK_BG1, COLOR_TASK_BG2); break; default: InvalidTag(np, TOK_TASKLISTSTYLE); break; } } }
/** Parse window style. */ void ParseWindowStyle(const TokenNode *tp) { const TokenNode *np; Assert(tp); for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_BORDER, np->value); break; case TOK_WIDTH: settings.borderWidth = ParseUnsigned(np, np->value); break; case TOK_HEIGHT: settings.titleHeight = ParseUnsigned(np, np->value); break; case TOK_ACTIVE: ParseActiveWindowStyle(np); break; case TOK_INACTIVE: ParseInactiveWindowStyle(np); break; default: InvalidTag(np, TOK_WINDOWSTYLE); break; } } }
/** Parse tray style. */ void ParseTrayStyle(const TokenNode *tp) { const TokenNode *np; for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_TRAY, np->value); break; case TOK_BACKGROUND: ParseGradient(np->value, COLOR_TRAY_BG1, COLOR_TRAY_BG2); break; case TOK_FOREGROUND: SetColor(COLOR_TRAY_FG, np->value); break; case TOK_ACTIVEBACKGROUND: ParseGradient(np->value, COLOR_TRAY_ACTIVE_BG1, COLOR_TRAY_ACTIVE_BG2); break; case TOK_ACTIVEFOREGROUND: SetColor(COLOR_TRAY_ACTIVE_FG, np->value); break; case TOK_OPACITY: settings.trayOpacity = ParseOpacity(np, np->value); break; default: InvalidTag(np, TOK_TRAYSTYLE); break; } } }
/** Parse menu style. */ void ParseMenuStyle(const TokenNode *tp) { const TokenNode *np; Assert(tp); for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_MENU, np->value); break; case TOK_FOREGROUND: SetColor(COLOR_MENU_FG, np->value); break; case TOK_BACKGROUND: SetColor(COLOR_MENU_BG, np->value); break; case TOK_ACTIVE: ParseActiveMenuStyle(np); break; case TOK_OPACITY: settings.menuOpacity = ParseOpacity(np, np->value); break; case TOK_OUTLINE: SetColor(COLOR_MENU_OUTLINE, np->value); break; default: InvalidTag(np, TOK_MENUSTYLE); break; } } }
/** Parse clock style. */ void ParseClockStyle(const TokenNode *tp) { const TokenNode *np; Assert(tp); for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_CLOCK, np->value); break; case TOK_FOREGROUND: SetColor(COLOR_CLOCK_FG, np->value); break; case TOK_BACKGROUND: ParseGradient(np->value, COLOR_CLOCK_BG1, COLOR_CLOCK_BG2); break; default: InvalidTag(np, TOK_CLOCKSTYLE); break; } } }
/** Parse pager style. */ void ParsePagerStyle(const TokenNode *tp) { const TokenNode *np; Assert(tp); for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_OUTLINE: SetColor(COLOR_PAGER_OUTLINE, np->value); break; case TOK_FOREGROUND: SetColor(COLOR_PAGER_FG, np->value); break; case TOK_BACKGROUND: SetColor(COLOR_PAGER_BG, np->value); break; case TOK_ACTIVE: ParseActivePagerStyle(np); break; case TOK_FONT: SetFont(FONT_PAGER, np->value); break; case TOK_TEXT: SetColor(COLOR_PAGER_TEXT, np->value); break; default: InvalidTag(np, TOK_PAGERSTYLE); break; } } }
/** Parse tray button style. */ void ParseTrayButtonStyle(const TokenNode *tp) { const TokenNode *np; Assert(tp); for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_TRAYBUTTON, np->value); break; case TOK_FOREGROUND: SetColor(COLOR_TRAYBUTTON_FG, np->value); break; case TOK_BACKGROUND: ParseGradient(np->value, COLOR_TRAYBUTTON_BG1, COLOR_TRAYBUTTON_BG2); break; case TOK_ACTIVE: ParseActiveTrayButtonStyle(np); break; default: InvalidTag(np, TOK_TRAYBUTTONSTYLE); break; } } }
/** Parse popup style. */ void ParsePopupStyle(const TokenNode *tp) { static const StringMappingType enable_mapping[] = { { "button", POPUP_BUTTON }, { "clock", POPUP_CLOCK }, { "false", POPUP_NONE }, { "pager", POPUP_PAGER }, { "task", POPUP_TASK }, { "true", POPUP_ALL } }; const TokenNode *np; const char *str; char *tok; tok = FindAttribute(tp->attributes, "enabled"); if(tok) { settings.popupMask = POPUP_NONE; tok = strtok(tok, ","); while(tok) { const int x = FindValue(enable_mapping, ARRAY_LENGTH(enable_mapping), tok); if(JLIKELY(x >= 0)) { settings.popupMask |= x; } else { ParseError(tp, "invalid value for 'enabled': \"%s\"", tok); } tok = strtok(NULL, ","); } } str = FindAttribute(tp->attributes, "delay"); if(str) { settings.popupDelay = ParseUnsigned(tp, str); } for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_POPUP, np->value); break; case TOK_FOREGROUND: SetColor(COLOR_POPUP_FG, np->value); break; case TOK_BACKGROUND: SetColor(COLOR_POPUP_BG, np->value); break; case TOK_OUTLINE: SetColor(COLOR_POPUP_OUTLINE, np->value); break; default: InvalidTag(np, TOK_POPUPSTYLE); break; } } }
/** Parse window style. */ void ParseWindowStyle(const TokenNode *tp) { const TokenNode *np; const char *decorations; decorations = FindAttribute(tp->attributes, "decorations"); if(decorations) { if(!strcmp(decorations, "motif")) { settings.handles = 1; } else if(!strcmp(decorations, "flat")) { settings.handles = 0; } else { ParseError(tp, "invalid WindowStyle decorations: %s\n", decorations); } } else { settings.handles = 0; } for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_BORDER, np->value); break; case TOK_WIDTH: settings.borderWidth = ParseUnsigned(np, np->value); break; case TOK_HEIGHT: settings.titleHeight = ParseUnsigned(np, np->value); break; case TOK_CORNER: settings.cornerRadius = ParseUnsigned(np, np->value); break; case TOK_ACTIVE: ParseActiveWindowStyle(np); break; case TOK_FOREGROUND: SetColor(COLOR_TITLE_FG, np->value); break; case TOK_BACKGROUND: ParseGradient(np->value, COLOR_TITLE_BG1, COLOR_TITLE_BG2); break; case TOK_OUTLINE: SetColor(COLOR_BORDER_LINE, np->value); break; case TOK_OPACITY: settings.inactiveClientOpacity = ParseOpacity(tp, np->value); break; default: InvalidTag(np, TOK_WINDOWSTYLE); break; } } }
/** Parse active pager style. */ void ParseActivePagerStyle(const TokenNode *tp) { const TokenNode *np; for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FOREGROUND: SetColor(COLOR_PAGER_ACTIVE_FG, np->value); break; case TOK_BACKGROUND: SetColor(COLOR_PAGER_ACTIVE_BG, np->value); break; default: InvalidTag(np, TOK_ACTIVE); break; } } }
/** Parse active menu style. */ void ParseActiveMenuStyle(const TokenNode *tp) { const TokenNode *np; for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FOREGROUND: SetColor(COLOR_MENU_ACTIVE_FG, np->value); break; case TOK_BACKGROUND: ParseGradient(np->value, COLOR_MENU_ACTIVE_BG1, COLOR_MENU_ACTIVE_BG2); break; default: InvalidTag(np, TOK_ACTIVE); break; } } }
/** Parse task list style. */ void ParseTaskListStyle(const TokenNode *tp) { const char *temp; TokenNode *np; temp = FindAttribute(tp->attributes, INSERT_ATTRIBUTE); if(temp) { if(!strcmp(temp, "right")) { settings.taskInsertMode = INSERT_RIGHT; } else if(!strcmp(temp, "left")) { settings.taskInsertMode = INSERT_LEFT; } else { ParseError(tp, _("invalid insert mode: \"%s\""), temp); settings.taskInsertMode = INSERT_RIGHT; } } for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_TASK, np->value); break; case TOK_FOREGROUND: SetColor(COLOR_TASK_FG, np->value); break; case TOK_BACKGROUND: ParseGradient(np->value, COLOR_TASK_BG1, COLOR_TASK_BG2); break; case TOK_ACTIVEFOREGROUND: SetColor(COLOR_TASK_ACTIVE_FG, np->value); break; case TOK_ACTIVEBACKGROUND: ParseGradient(np->value, COLOR_TASK_ACTIVE_BG1, COLOR_TASK_ACTIVE_BG2); break; default: InvalidTag(np, TOK_TASKLISTSTYLE); break; } } }
/** Parse popup style. */ void ParsePopupStyle(const TokenNode *tp) { const TokenNode *np; const char *str; Assert(tp); str = FindAttribute(tp->attributes, "enabled"); if(str && !strcmp(str, FALSE_VALUE)) { settings.popupEnabled = 0; } else { settings.popupEnabled = 1; } str = FindAttribute(tp->attributes, "delay"); if(str) { settings.popupDelay = ParseUnsigned(tp, str); } for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_POPUP, np->value); break; case TOK_OUTLINE: SetColor(COLOR_POPUP_OUTLINE, np->value); break; case TOK_FOREGROUND: SetColor(COLOR_POPUP_FG, np->value); break; case TOK_BACKGROUND: SetColor(COLOR_POPUP_BG, np->value); break; default: InvalidTag(np, TOK_POPUPSTYLE); break; } } }
/** Parse window style. */ void ParseWindowStyle(const TokenNode *tp) { const TokenNode *np; settings.windowDecorations = ParseDecorations(tp); for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_BORDER, np->value); break; case TOK_WIDTH: settings.borderWidth = ParseUnsigned(np, np->value); break; case TOK_HEIGHT: settings.titleHeight = ParseUnsigned(np, np->value); break; case TOK_CORNER: settings.cornerRadius = ParseUnsigned(np, np->value); break; case TOK_ACTIVE: ParseActiveWindowStyle(np); break; case TOK_FOREGROUND: SetColor(COLOR_TITLE_FG, np->value); break; case TOK_BACKGROUND: ParseGradient(np->value, COLOR_TITLE_BG1, COLOR_TITLE_BG2); break; case TOK_OUTLINE: ParseGradient(np->value, COLOR_TITLE_DOWN, COLOR_TITLE_UP); break; case TOK_OPACITY: settings.inactiveClientOpacity = ParseOpacity(tp, np->value); break; default: InvalidTag(np, TOK_WINDOWSTYLE); break; } } }
/** Parse a configuration for a specific desktop. */ void ParseDesktop(int desktop, const TokenNode *tp) { TokenNode *np; const char *attr; attr = FindAttribute(tp->attributes, "name"); if(attr) { SetDesktopName(desktop, attr); } for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_BACKGROUND: ParseDesktopBackground(desktop, np); break; default: InvalidTag(np, TOK_DESKTOP); break; } } }
/** Parse desktop configuration. */ void ParseDesktops(const TokenNode *tp) { TokenNode *np; const char *width; const char *height; int desktop; Assert(tp); width = FindAttribute(tp->attributes, WIDTH_ATTRIBUTE); if(width != NULL) { settings.desktopWidth = ParseUnsigned(tp, width); } height = FindAttribute(tp->attributes, HEIGHT_ATTRIBUTE); if(height != NULL) { settings.desktopHeight = ParseUnsigned(tp, height); } settings.desktopCount = settings.desktopWidth * settings.desktopHeight; desktop = 0; for(np = tp->subnodeHead; np; np = np->next) { if(desktop >= settings.desktopCount) { break; } switch(np->type) { case TOK_BACKGROUND: ParseDesktopBackground(-1, np); break; case TOK_DESKTOP: ParseDesktop(desktop, np); desktop += 1; break; default: InvalidTag(np, TOK_DESKTOPS); break; } } }
/** Parse tray style. */ void ParseTrayStyle(const TokenNode *tp) { const TokenNode *np; const char *temp; settings.trayDecorations = ParseDecorations(tp); temp = FindAttribute(tp->attributes, "group"); if(temp) { settings.groupTasks = !strcmp(temp, TRUE_VALUE); } for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_FONT: SetFont(FONT_TRAY, np->value); break; case TOK_ACTIVE: ParseActiveTrayStyle(np); break; case TOK_BACKGROUND: ParseGradient(np->value, COLOR_TRAY_BG1, COLOR_TRAY_BG2); break; case TOK_FOREGROUND: SetColor(COLOR_TRAY_FG, np->value); break; case TOK_OUTLINE: ParseGradient(np->value, COLOR_TRAY_DOWN, COLOR_TRAY_UP); break; case TOK_OPACITY: settings.trayOpacity = ParseOpacity(np, np->value); break; default: InvalidTag(np, TOK_TRAYSTYLE); break; } } }
/** Parse tray. */ void ParseTray(const TokenNode *tp) { const TokenNode *np; const char *attr; TrayType *tray; Assert(tp); tray = CreateTray(); attr = FindAttribute(tp->attributes, AUTOHIDE_ATTRIBUTE); if(attr && !strcmp(attr, TRUE_VALUE)) { SetAutoHideTray(tray, 1); } else { SetAutoHideTray(tray, 0); } attr = FindAttribute(tp->attributes, X_ATTRIBUTE); if(attr) { SetTrayX(tray, attr); } attr = FindAttribute(tp->attributes, Y_ATTRIBUTE); if(attr) { SetTrayY(tray, attr); } attr = FindAttribute(tp->attributes, WIDTH_ATTRIBUTE); if(attr) { SetTrayWidth(tray, attr); } attr = FindAttribute(tp->attributes, HEIGHT_ATTRIBUTE); if(attr) { SetTrayHeight(tray, attr); } attr = FindAttribute(tp->attributes, VALIGN_ATTRIBUTE); SetTrayVerticalAlignment(tray, attr); attr = FindAttribute(tp->attributes, HALIGN_ATTRIBUTE); SetTrayHorizontalAlignment(tray, attr); attr = FindAttribute(tp->attributes, LAYOUT_ATTRIBUTE); SetTrayLayout(tray, attr); attr = FindAttribute(tp->attributes, LAYER_ATTRIBUTE); if(attr) { const WinLayerType layer = ParseLayer(tp, attr); SetTrayLayer(tray, layer); } attr = FindAttribute(tp->attributes, BORDER_ATTRIBUTE); if(attr) { tray->border = ParseUnsigned(tp, attr); } for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_PAGER: ParsePager(np, tray); break; case TOK_TASKLIST: ParseTaskList(np, tray); break; case TOK_SWALLOW: ParseSwallow(np, tray); break; case TOK_TRAYBUTTON: ParseTrayButton(np, tray); break; case TOK_CLOCK: ParseClock(np, tray); break; case TOK_DOCK: ParseDock(np, tray); break; case TOK_SPACER: ParseSpacer(np, tray); break; default: InvalidTag(np, TOK_TRAY); break; } } }
/** Parse a menu item. */ MenuItem *ParseMenuItem(const TokenNode *start, Menu *menu, MenuItem *last) { Menu *child; const char *value; Assert(menu); menu->offsets = NULL; while(start) { switch(start->type) { case TOK_DYNAMIC: last = InsertMenuItem(last); if(!menu->items) { menu->items = last; } value = FindAttribute(start->attributes, LABEL_ATTRIBUTE); last->name = CopyString(value); value = FindAttribute(start->attributes, ICON_ATTRIBUTE); last->iconName = CopyString(value); last->action.type = MA_DYNAMIC; last->action.str = CopyString(start->value); value = FindAttribute(start->attributes, HEIGHT_ATTRIBUTE); if(value) { last->action.value = ParseUnsigned(start, value); } else { last->action.value = menu->itemHeight; } break; case TOK_MENU: last = InsertMenuItem(last); last->type = MENU_ITEM_SUBMENU; if(!menu->items) { menu->items = last; } value = FindAttribute(start->attributes, LABEL_ATTRIBUTE); last->name = CopyString(value); value = FindAttribute(start->attributes, ICON_ATTRIBUTE); last->iconName = CopyString(value); last->submenu = Allocate(sizeof(Menu)); child = last->submenu; value = FindAttribute(start->attributes, HEIGHT_ATTRIBUTE); if(value) { child->itemHeight = ParseUnsigned(start, value); } else { child->itemHeight = menu->itemHeight; } value = FindAttribute(start->attributes, LABELED_ATTRIBUTE); if(value && !strcmp(value, TRUE_VALUE)) { if(last->name) { child->label = CopyString(last->name); } else { child->label = CopyString(DEFAULT_TITLE); } } else { child->label = NULL; } last->submenu->items = NULL; ParseMenuItem(start->subnodeHead, last->submenu, NULL); break; case TOK_PROGRAM: last = InsertMenuItem(last); if(!menu->items) { menu->items = last; } value = FindAttribute(start->attributes, LABEL_ATTRIBUTE); if(value) { last->name = CopyString(value); } else if(start->value) { last->name = CopyString(start->value); } value = FindAttribute(start->attributes, ICON_ATTRIBUTE); last->iconName = CopyString(value); last->action.type = MA_EXECUTE; last->action.str = CopyString(start->value); break; case TOK_SEPARATOR: last = InsertMenuItem(last); last->type = MENU_ITEM_SEPARATOR; if(!menu->items) { menu->items = last; } break; case TOK_INCLUDE: last = ParseMenuInclude(start, menu, last); break; case TOK_DESKTOPS: case TOK_STICK: case TOK_MAXIMIZE: case TOK_MINIMIZE: case TOK_SHADE: case TOK_MOVE: case TOK_RESIZE: case TOK_KILL: case TOK_CLOSE: case TOK_SENDTO: last = InsertMenuItem(last); if(!menu->items) { menu->items = last; } value = FindAttribute(start->attributes, LABEL_ATTRIBUTE); if(!value) { value = GetTokenName(start); } last->name = CopyString(value); value = FindAttribute(start->attributes, ICON_ATTRIBUTE); last->iconName = CopyString(value); switch(start->type) { case TOK_DESKTOPS: last->action.type = MA_DESKTOP_MENU; break; case TOK_STICK: last->action.type = MA_STICK; break; case TOK_MAXIMIZE: last->action.type = MA_MAXIMIZE; break; case TOK_MINIMIZE: last->action.type = MA_MINIMIZE; break; case TOK_SHADE: last->action.type = MA_SHADE; break; case TOK_MOVE: last->action.type = MA_MOVE; break; case TOK_RESIZE: last->action.type = MA_RESIZE; break; case TOK_KILL: last->action.type = MA_KILL; break; case TOK_CLOSE: last->action.type = MA_CLOSE; break; case TOK_SENDTO: last->action.type = MA_SENDTO_MENU; break; default: break; } break; case TOK_EXIT: last = InsertMenuItem(last); if(!menu->items) { menu->items = last; } value = FindAttribute(start->attributes, CONFIRM_ATTRIBUTE); if(value && !strcmp(value, FALSE_VALUE)) { settings.exitConfirmation = 0; } else { settings.exitConfirmation = 1; } value = FindAttribute(start->attributes, LABEL_ATTRIBUTE); if(!value) { value = GetTokenName(start); } last->name = CopyString(value); value = FindAttribute(start->attributes, ICON_ATTRIBUTE); last->iconName = CopyString(value); last->action.type = MA_EXIT; last->action.str = CopyString(start->value); break; case TOK_RESTART: last = InsertMenuItem(last); if(!menu->items) { menu->items = last; } value = FindAttribute(start->attributes, LABEL_ATTRIBUTE); if(!value) { value = GetTokenName(start); } last->name = CopyString(value); value = FindAttribute(start->attributes, ICON_ATTRIBUTE); last->iconName = CopyString(value); last->action.type = MA_RESTART; break; default: InvalidTag(start, TOK_MENU); break; } start = start->next; } return last; }
/** Parse tray. */ void ParseTray(const TokenNode *tp) { static const StringMappingType mapping[] = { { "bottom", THIDE_BOTTOM }, { "left", THIDE_LEFT }, { "off", THIDE_OFF }, { "right", THIDE_RIGHT }, { "top", THIDE_TOP } }; const TokenNode *np; const char *attr; TrayType *tray; TrayAutoHideType autohide; Assert(tp); tray = CreateTray(); autohide = ParseAttribute(mapping, ARRAY_LENGTH(mapping), tp, "autohide", THIDE_OFF); SetAutoHideTray(tray, autohide); attr = FindAttribute(tp->attributes, X_ATTRIBUTE); if(attr) { SetTrayX(tray, attr); } attr = FindAttribute(tp->attributes, Y_ATTRIBUTE); if(attr) { SetTrayY(tray, attr); } attr = FindAttribute(tp->attributes, WIDTH_ATTRIBUTE); if(attr) { SetTrayWidth(tray, attr); } attr = FindAttribute(tp->attributes, HEIGHT_ATTRIBUTE); if(attr) { SetTrayHeight(tray, attr); } attr = FindAttribute(tp->attributes, "valign"); SetTrayVerticalAlignment(tray, attr); attr = FindAttribute(tp->attributes, "halign"); SetTrayHorizontalAlignment(tray, attr); attr = FindAttribute(tp->attributes, "layout"); SetTrayLayout(tray, attr); attr = FindAttribute(tp->attributes, "layer"); if(attr) { SetTrayLayer(tray, ParseLayer(tp, attr)); } for(np = tp->subnodeHead; np; np = np->next) { switch(np->type) { case TOK_PAGER: ParsePager(np, tray); break; case TOK_TASKLIST: ParseTaskList(np, tray); break; case TOK_SWALLOW: ParseSwallow(np, tray); break; case TOK_TRAYBUTTON: ParseTrayButton(np, tray); break; case TOK_CLOCK: ParseClock(np, tray); break; case TOK_DOCK: ParseDock(np, tray); break; case TOK_SPACER: ParseSpacer(np, tray); break; default: InvalidTag(np, TOK_TRAY); break; } } }
/** Parse a token list. */ void Parse(const TokenNode *start, int depth) { TokenNode *tp; if(!start) { return; } if(JLIKELY(start->type == TOK_JWM)) { for(tp = start->subnodeHead; tp; tp = tp->next) { if(shouldReload) { switch(tp->type) { case TOK_ROOTMENU: ParseRootMenu(tp); break; case TOK_INCLUDE: ParseInclude(tp, depth); break; default: break; } } else { switch(tp->type) { case TOK_DESKTOPS: ParseDesktops(tp); break; case TOK_DOUBLECLICKSPEED: settings.doubleClickSpeed = ParseUnsigned(tp, tp->value); break; case TOK_DOUBLECLICKDELTA: settings.doubleClickDelta = ParseUnsigned(tp, tp->value); break; case TOK_FOCUSMODEL: ParseFocusModel(tp); break; case TOK_GROUP: ParseGroup(tp); break; case TOK_ICONPATH: AddIconPath(tp->value); break; case TOK_INCLUDE: ParseInclude(tp, depth); break; case TOK_KEY: ParseKey(tp); break; case TOK_MENUSTYLE: ParseMenuStyle(tp); break; case TOK_MOVEMODE: ParseMoveMode(tp); break; case TOK_PAGERSTYLE: ParsePagerStyle(tp); break; case TOK_POPUPSTYLE: ParsePopupStyle(tp); break; case TOK_RESIZEMODE: ParseResizeMode(tp); break; case TOK_RESTARTCOMMAND: AddRestartCommand(tp->value); break; case TOK_ROOTMENU: ParseRootMenu(tp); break; case TOK_SHUTDOWNCOMMAND: AddShutdownCommand(tp->value); break; case TOK_SNAPMODE: ParseSnapMode(tp); break; case TOK_STARTUPCOMMAND: AddStartupCommand(tp->value); break; case TOK_TASKLISTSTYLE: ParseTaskListStyle(tp); break; case TOK_TRAY: ParseTray(tp); break; case TOK_TRAYSTYLE: ParseTrayStyle(tp); break; case TOK_TRAYBUTTONSTYLE: ParseTrayButtonStyle(tp); break; case TOK_CLOCKSTYLE: ParseClockStyle(tp); break; case TOK_WINDOWSTYLE: ParseWindowStyle(tp); break; case TOK_BUTTONCLOSE: SetBorderIcon(BI_CLOSE, tp->value); break; case TOK_BUTTONMAX: SetBorderIcon(BI_MAX, tp->value); break; case TOK_BUTTONMAXACTIVE: SetBorderIcon(BI_MAX_ACTIVE, tp->value); break; case TOK_BUTTONMIN: SetBorderIcon(BI_MIN, tp->value); break; default: InvalidTag(tp, TOK_JWM); break; } } } } else { ParseError(start, "invalid start tag: %s", GetTokenName(start)); } }