static int panel_parse_global(panel *p) { ENTER; p->orientation = (p->edge == EDGE_TOP || p->edge == EDGE_BOTTOM) ? ORIENT_HORIZ : ORIENT_VERT; if (p->orientation == ORIENT_HORIZ) { p->my_box_new = gtk_hbox_new; } else { p->my_box_new = gtk_vbox_new; } if (p->width < 0) p->width = 100; if (p->widthtype == WIDTH_PERCENT && p->width > 100) p->width = 100; p->heighttype = HEIGHT_PIXEL; if (p->heighttype == HEIGHT_PIXEL) { if (p->height < PANEL_HEIGHT_MIN) { ERR( "height is bound by %i pixels\n", PANEL_HEIGHT_MIN ); p->height = PANEL_HEIGHT_MIN; } else if (p->height > PANEL_HEIGHT_MAX) { ERR( "height is bound by %i pixels\n", PANEL_HEIGHT_MAX ); p->height = PANEL_HEIGHT_MAX; } } panel_start_gui(p); RET(1); }
static int panel_parse_global(panel *p, FILE *fp) { line s; s.len = 256; ENTER; while (get_line(fp, &s) != LINE_NONE) { if (s.type == LINE_VAR) { if (!g_ascii_strcasecmp(s.t[0], "edge")) { p->edge = str2num(edge_pair, s.t[1], EDGE_NONE); } else if (!g_ascii_strcasecmp(s.t[0], "allign")) { p->allign = str2num(allign_pair, s.t[1], ALLIGN_NONE); } else if (!g_ascii_strcasecmp(s.t[0], "margin")) { p->margin = atoi(s.t[1]); } else if (!g_ascii_strcasecmp(s.t[0], "widthtype")) { p->widthtype = str2num(width_pair, s.t[1], WIDTH_NONE); } else if (!g_ascii_strcasecmp(s.t[0], "width")) { p->width = atoi(s.t[1]); } else if (!g_ascii_strcasecmp(s.t[0], "heighttype")) { p->heighttype = str2num(height_pair, s.t[1], HEIGHT_NONE); } else if (!g_ascii_strcasecmp(s.t[0], "height")) { p->height = atoi(s.t[1]); } else if (!g_ascii_strcasecmp(s.t[0], "spacing")) { p->spacing = atoi(s.t[1]); } else if (!g_ascii_strcasecmp(s.t[0], "SetDockType")) { p->setdocktype = str2num(bool_pair, s.t[1], 0); } else if (!g_ascii_strcasecmp(s.t[0], "SetPartialStrut")) { p->setstrut = str2num(bool_pair, s.t[1], 0); } else if (!g_ascii_strcasecmp(s.t[0], "RoundCorners")) { p->round_corners = str2num(bool_pair, s.t[1], 0); } else if (!g_ascii_strcasecmp(s.t[0], "Transparent")) { p->transparent = str2num(bool_pair, s.t[1], 0); } else if (!g_ascii_strcasecmp(s.t[0], "Alpha")) { p->alpha = atoi(s.t[1]); if (p->alpha > 255) p->alpha = 255; } else if (!g_ascii_strcasecmp(s.t[0], "TintColor")) { if (!gdk_color_parse (s.t[1], &p->gtintcolor)) gdk_color_parse ("white", &p->gtintcolor); p->tintcolor = gcolor2rgb24(&p->gtintcolor); DBG("tintcolor=%x\n", p->tintcolor); } else { ERR( "fbpanel: %s - unknown var in Global section\n", s.t[0]); RET(0); } } else if (s.type == LINE_BLOCK_END) { break; } else { ERR( "fbpanel: illegal in this context %s\n", s.str); RET(0); } } p->orientation = (p->edge == EDGE_TOP || p->edge == EDGE_BOTTOM) ? ORIENT_HORIZ : ORIENT_VERT; if (p->orientation == ORIENT_HORIZ) { p->my_box_new = gtk_hbox_new; p->my_separator_new = gtk_vseparator_new; } else { p->my_box_new = gtk_vbox_new; p->my_separator_new = gtk_hseparator_new; } if (p->width < 0) p->width = 100; if (p->widthtype == WIDTH_PERCENT && p->width > 100) p->width = 100; p->heighttype = HEIGHT_PIXEL; if (p->heighttype == HEIGHT_PIXEL) { if (p->height < PANEL_HEIGHT_MIN) p->height = PANEL_HEIGHT_MIN; else if (p->height > PANEL_HEIGHT_MAX) p->height = PANEL_HEIGHT_MAX; } p->curdesk = get_net_current_desktop(); p->desknum = get_net_number_of_desktops(); p->workarea = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_WORKAREA, XA_CARDINAL, &p->wa_len); print_wmdata(p); panel_start_gui(p); RET(1); }
static int panel_parse_global(xconf *xc) { ENTER; /* Set default values */ p->allign = ALLIGN_CENTER; p->edge = EDGE_BOTTOM; p->widthtype = WIDTH_PERCENT; p->width = 100; p->heighttype = HEIGHT_PIXEL; p->height = PANEL_HEIGHT_DEFAULT; p->max_elem_height = PANEL_HEIGHT_MAX; p->setdocktype = 1; p->setstrut = 1; p->round_corners = 1; p->round_corners_radius = 7; p->autohide = 0; p->height_when_hidden = 2; p->transparent = 0; p->alpha = 127; p->tintcolor_name = "white"; p->spacing = 0; p->setlayer = FALSE; p->layer = LAYER_ABOVE; /* Read config */ /* geometry */ XCG(xc, "edge", &p->edge, enum, edge_enum); XCG(xc, "allign", &p->allign, enum, allign_enum); XCG(xc, "widthtype", &p->widthtype, enum, widthtype_enum); XCG(xc, "heighttype", &p->heighttype, enum, heighttype_enum); XCG(xc, "width", &p->width, int); XCG(xc, "height", &p->height, int); XCG(xc, "margin", &p->margin, int); /* properties */ XCG(xc, "setdocktype", &p->setdocktype, enum, bool_enum); XCG(xc, "setpartialstrut", &p->setstrut, enum, bool_enum); XCG(xc, "autohide", &p->autohide, enum, bool_enum); XCG(xc, "heightwhenhidden", &p->height_when_hidden, int); XCG(xc, "setlayer", &p->setlayer, enum, bool_enum); XCG(xc, "layer", &p->layer, enum, layer_enum); /* effects */ XCG(xc, "roundcorners", &p->round_corners, enum, bool_enum); XCG(xc, "roundcornersradius", &p->round_corners_radius, int); XCG(xc, "transparent", &p->transparent, enum, bool_enum); XCG(xc, "alpha", &p->alpha, int); XCG(xc, "tintcolor", &p->tintcolor_name, str); XCG(xc, "maxelemheight", &p->max_elem_height, int); /* Sanity checks */ if (!gdk_color_parse(p->tintcolor_name, &p->gtintcolor)) gdk_color_parse("white", &p->gtintcolor); p->tintcolor = gcolor2rgb24(&p->gtintcolor); DBG("tintcolor=%x\n", p->tintcolor); if (p->alpha > 255) p->alpha = 255; p->orientation = (p->edge == EDGE_TOP || p->edge == EDGE_BOTTOM) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL; if (p->orientation == GTK_ORIENTATION_HORIZONTAL) { p->my_box_new = gtk_hbox_new; p->my_separator_new = gtk_vseparator_new; } else { p->my_box_new = gtk_vbox_new; p->my_separator_new = gtk_hseparator_new; } if (p->width < 0) p->width = 100; if (p->widthtype == WIDTH_PERCENT && p->width > 100) p->width = 100; p->heighttype = HEIGHT_PIXEL; if (p->heighttype == HEIGHT_PIXEL) { if (p->height < PANEL_HEIGHT_MIN) p->height = PANEL_HEIGHT_MIN; else if (p->height > PANEL_HEIGHT_MAX) p->height = PANEL_HEIGHT_MAX; } if (p->max_elem_height > p->height || p->max_elem_height < PANEL_HEIGHT_MIN) p->max_elem_height = p->height; p->curdesk = get_net_current_desktop(); p->desknum = get_net_number_of_desktops(); //p->workarea = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_WORKAREA, // XA_CARDINAL, &p->wa_len); //print_wmdata(p); panel_start_gui(p); RET(1); }