static void render_button(ObPrompt *self, ObPromptElement *e) { RrAppearance *a; if (e->hover && self->focus == e) a = prompt_a_pfocus; else if (self->focus == e) a = prompt_a_focus; else if (e->pressed) a = prompt_a_press; else a = prompt_a_button; a->surface.parent = prompt_a_bg; a->surface.parentx = e->x; a->surface.parenty = e->y; /* draw the keyfocus line */ if (a == prompt_a_pfocus || a == prompt_a_focus) setup_button_focus_tex(e, a, TRUE); a->texture[0].data.text.string = e->text; RrPaint(a, e->window, e->width, e->height); /* turn off the keyfocus line so that it doesn't affect size calculations */ if (a == prompt_a_pfocus || a == prompt_a_focus) setup_button_focus_tex(e, a, FALSE); }
static void framerender_label(ObFrame *self, RrAppearance *a) { if (!self->label_on) return; /* set the texture's text! */ a->texture[0].data.text.string = self->client->title; RrPaint(a, self->label, self->label_width, ob_rr_theme->label_height); }
static void render_all(ObPrompt *self) { gint i; RrPaint(prompt_a_bg, self->super.window, self->width, self->height); prompt_a_msg->surface.parent = prompt_a_bg; prompt_a_msg->surface.parentx = self->msg.x; prompt_a_msg->surface.parenty = self->msg.y; prompt_a_msg->texture[0].data.text.string = self->msg.text; prompt_a_msg->texture[0].data.text.maxwidth = self->msg_wbound; RrPaint(prompt_a_msg, self->msg.window, self->msg.width, self->msg.height); for (i = 0; i < self->n_buttons; ++i) render_button(self, &self->button[i]); }
static void icon_popup_draw_icon(gint x, gint y, gint w, gint h, gpointer data) { ObIconPopup *self = data; self->a_icon->surface.parent = self->popup->a_bg; self->a_icon->surface.parentx = x; self->a_icon->surface.parenty = y; XMoveResizeWindow(obt_display, self->icon, x, y, w, h); RrPaint(self->a_icon, self->icon, w, h); }
static void framerender_icon(ObFrame *self, RrAppearance *a) { RrImage *icon; if (!self->icon_on) return; icon = client_icon(self->client); if (icon) { RrAppearanceClearTextures(a); a->texture[0].type = RR_TEXTURE_IMAGE; a->texture[0].data.image.alpha = 0xff; a->texture[0].data.image.image = icon; } else { RrAppearanceClearTextures(a); a->texture[0].type = RR_TEXTURE_NONE; } RrPaint(a, self->icon, ob_rr_theme->button_size + 2, ob_rr_theme->button_size + 2); }
void menu_frame_render(ObMenuFrame *self) { gint w = 0, h = 0; gint tw, th; /* temps */ GList *it; gboolean has_icon = FALSE; ObMenu *sub; ObMenuEntryFrame *e; /* find text dimensions */ STRUT_SET(self->item_margin, 0, 0, 0, 0); if (self->entries) { gint l, t, r, b; e = self->entries->data; ob_rr_theme->a_menu_text_normal->texture[0].data.text.string = ""; tw = RrMinWidth(ob_rr_theme->a_menu_text_normal); tw += 2*PADDING; th = ITEM_HEIGHT; RrMargins(ob_rr_theme->a_menu_normal, &l, &t, &r, &b); STRUT_SET(self->item_margin, MAX(self->item_margin.left, l), MAX(self->item_margin.top, t), MAX(self->item_margin.right, r), MAX(self->item_margin.bottom, b)); RrMargins(ob_rr_theme->a_menu_selected, &l, &t, &r, &b); STRUT_SET(self->item_margin, MAX(self->item_margin.left, l), MAX(self->item_margin.top, t), MAX(self->item_margin.right, r), MAX(self->item_margin.bottom, b)); RrMargins(ob_rr_theme->a_menu_disabled, &l, &t, &r, &b); STRUT_SET(self->item_margin, MAX(self->item_margin.left, l), MAX(self->item_margin.top, t), MAX(self->item_margin.right, r), MAX(self->item_margin.bottom, b)); RrMargins(ob_rr_theme->a_menu_disabled_selected, &l, &t, &r, &b); STRUT_SET(self->item_margin, MAX(self->item_margin.left, l), MAX(self->item_margin.top, t), MAX(self->item_margin.right, r), MAX(self->item_margin.bottom, b)); } /* render the entries */ for (it = self->entries; it; it = g_list_next(it)) { RrAppearance *text_a; e = it->data; /* if the first entry is a labeled separator, then make its border overlap with the menu's outside border */ if (it == self->entries && e->entry->type == OB_MENU_ENTRY_TYPE_SEPARATOR && e->entry->data.separator.label) { h -= ob_rr_theme->mbwidth; } if (e->entry->type == OB_MENU_ENTRY_TYPE_SEPARATOR && e->entry->data.separator.label) { e->border = ob_rr_theme->mbwidth; } RECT_SET_POINT(e->area, 0, h+e->border); XMoveWindow(obt_display, e->window, e->area.x-e->border, e->area.y-e->border); XSetWindowBorderWidth(obt_display, e->window, e->border); XSetWindowBorder(obt_display, e->window, RrColorPixel(ob_rr_theme->menu_border_color)); text_a = (e->entry->type == OB_MENU_ENTRY_TYPE_NORMAL && !e->entry->data.normal.enabled ? /* disabled */ (e == self->selected ? ob_rr_theme->a_menu_text_disabled_selected : ob_rr_theme->a_menu_text_disabled) : /* enabled */ (e == self->selected ? ob_rr_theme->a_menu_text_selected : ob_rr_theme->a_menu_text_normal)); switch (e->entry->type) { case OB_MENU_ENTRY_TYPE_NORMAL: text_a->texture[0].data.text.string = e->entry->data.normal.label; tw = RrMinWidth(text_a); tw = MIN(tw, MAX_MENU_WIDTH); th = ob_rr_theme->menu_font_height; if (e->entry->data.normal.icon || e->entry->data.normal.mask) has_icon = TRUE; break; case OB_MENU_ENTRY_TYPE_SUBMENU: sub = e->entry->data.submenu.submenu; text_a->texture[0].data.text.string = sub ? sub->title : ""; tw = RrMinWidth(text_a); tw = MIN(tw, MAX_MENU_WIDTH); th = ob_rr_theme->menu_font_height; if (e->entry->data.normal.icon || e->entry->data.normal.mask) has_icon = TRUE; tw += ITEM_HEIGHT - PADDING; break; case OB_MENU_ENTRY_TYPE_SEPARATOR: if (e->entry->data.separator.label != NULL) { ob_rr_theme->a_menu_text_title->texture[0].data.text.string = e->entry->data.separator.label; tw = RrMinWidth(ob_rr_theme->a_menu_text_title) + 2*ob_rr_theme->paddingx; tw = MIN(tw, MAX_MENU_WIDTH); th = ob_rr_theme->menu_title_height + (ob_rr_theme->mbwidth - PADDING) *2; } else { tw = 0; th = ob_rr_theme->menu_sep_width + 2*ob_rr_theme->menu_sep_paddingy - 2*PADDING; } break; default: g_assert_not_reached(); } tw += 2*PADDING; th += 2*PADDING; w = MAX(w, tw); h += th; } /* if the last entry is a labeled separator, then make its border overlap with the menu's outside border */ it = g_list_last(self->entries); e = it ? it->data : NULL; if (e && e->entry->type == OB_MENU_ENTRY_TYPE_SEPARATOR && e->entry->data.separator.label) { h -= ob_rr_theme->mbwidth; } self->text_x = PADDING; self->text_w = w; if (self->entries) { if (has_icon) { w += ITEM_HEIGHT + PADDING; self->text_x += ITEM_HEIGHT + PADDING; } } if (!w) w = 10; if (!h) h = 3; XResizeWindow(obt_display, self->window, w, h); self->inner_w = w; RrPaint(self->a_items, self->window, w, h); for (it = self->entries; it; it = g_list_next(it)) menu_entry_frame_render(it->data); w += ob_rr_theme->mbwidth * 2; h += ob_rr_theme->mbwidth * 2; RECT_SET_SIZE(self->area, w, h); XFlush(obt_display); }
static void menu_entry_frame_render(ObMenuEntryFrame *self) { RrAppearance *item_a, *text_a; gint th; /* temp */ ObMenu *sub; ObMenuFrame *frame = self->frame; switch (self->entry->type) { case OB_MENU_ENTRY_TYPE_NORMAL: case OB_MENU_ENTRY_TYPE_SUBMENU: item_a = (self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL && !self->entry->data.normal.enabled ? /* disabled */ (self == self->frame->selected ? ob_rr_theme->a_menu_disabled_selected : ob_rr_theme->a_menu_disabled) : /* enabled */ (self == self->frame->selected ? ob_rr_theme->a_menu_selected : ob_rr_theme->a_menu_normal)); th = ITEM_HEIGHT; break; case OB_MENU_ENTRY_TYPE_SEPARATOR: if (self->entry->data.separator.label) { item_a = ob_rr_theme->a_menu_title; th = ob_rr_theme->menu_title_height; } else { item_a = ob_rr_theme->a_menu_normal; th = ob_rr_theme->menu_sep_width + 2*ob_rr_theme->menu_sep_paddingy; } break; default: g_assert_not_reached(); } RECT_SET_SIZE(self->area, self->frame->inner_w, th); XResizeWindow(obt_display, self->window, self->area.width, self->area.height); item_a->surface.parent = self->frame->a_items; item_a->surface.parentx = self->area.x; item_a->surface.parenty = self->area.y; RrPaint(item_a, self->window, self->area.width, self->area.height); switch (self->entry->type) { case OB_MENU_ENTRY_TYPE_NORMAL: text_a = (self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL && !self->entry->data.normal.enabled ? /* disabled */ (self == self->frame->selected ? ob_rr_theme->a_menu_text_disabled_selected : ob_rr_theme->a_menu_text_disabled) : /* enabled */ (self == self->frame->selected ? ob_rr_theme->a_menu_text_selected : ob_rr_theme->a_menu_text_normal)); text_a->texture[0].data.text.string = self->entry->data.normal.label; if (self->entry->data.normal.shortcut && (self->frame->menu->show_all_shortcuts || self->entry->data.normal.shortcut_always_show || self->entry->data.normal.shortcut_position > 0)) { text_a->texture[0].data.text.shortcut = TRUE; text_a->texture[0].data.text.shortcut_pos = self->entry->data.normal.shortcut_position; } else text_a->texture[0].data.text.shortcut = FALSE; break; case OB_MENU_ENTRY_TYPE_SUBMENU: text_a = (self == self->frame->selected ? ob_rr_theme->a_menu_text_selected : ob_rr_theme->a_menu_text_normal); sub = self->entry->data.submenu.submenu; text_a->texture[0].data.text.string = sub ? sub->title : ""; if (sub && sub->shortcut && (self->frame->menu->show_all_shortcuts || sub->shortcut_always_show || sub->shortcut_position > 0)) { text_a->texture[0].data.text.shortcut = TRUE; text_a->texture[0].data.text.shortcut_pos = sub->shortcut_position; } else text_a->texture[0].data.text.shortcut = FALSE; break; case OB_MENU_ENTRY_TYPE_SEPARATOR: if (self->entry->data.separator.label != NULL) { text_a = ob_rr_theme->a_menu_text_title; text_a->texture[0].data.text.string = self->entry->data.separator.label; } else text_a = ob_rr_theme->a_menu_text_normal; break; default: g_assert_not_reached(); } switch (self->entry->type) { case OB_MENU_ENTRY_TYPE_NORMAL: XMoveResizeWindow(obt_display, self->text, self->frame->text_x, PADDING, self->frame->text_w, ITEM_HEIGHT - 2*PADDING); text_a->surface.parent = item_a; text_a->surface.parentx = self->frame->text_x; text_a->surface.parenty = PADDING; RrPaint(text_a, self->text, self->frame->text_w, ITEM_HEIGHT - 2*PADDING); break; case OB_MENU_ENTRY_TYPE_SUBMENU: XMoveResizeWindow(obt_display, self->text, self->frame->text_x, PADDING, self->frame->text_w - ITEM_HEIGHT, ITEM_HEIGHT - 2*PADDING); text_a->surface.parent = item_a; text_a->surface.parentx = self->frame->text_x; text_a->surface.parenty = PADDING; RrPaint(text_a, self->text, self->frame->text_w - ITEM_HEIGHT, ITEM_HEIGHT - 2*PADDING); break; case OB_MENU_ENTRY_TYPE_SEPARATOR: if (self->entry->data.separator.label != NULL) { /* labeled separator */ XMoveResizeWindow(obt_display, self->text, ob_rr_theme->paddingx, ob_rr_theme->paddingy, self->area.width - 2*ob_rr_theme->paddingx, ob_rr_theme->menu_title_height - 2*ob_rr_theme->paddingy); text_a->surface.parent = item_a; text_a->surface.parentx = ob_rr_theme->paddingx; text_a->surface.parenty = ob_rr_theme->paddingy; RrPaint(text_a, self->text, self->area.width - 2*ob_rr_theme->paddingx, ob_rr_theme->menu_title_height - 2*ob_rr_theme->paddingy); } else { gint i; /* unlabeled separator */ XMoveResizeWindow(obt_display, self->text, 0, 0, self->area.width, ob_rr_theme->menu_sep_width + 2*ob_rr_theme->menu_sep_paddingy); a_sep->surface.parent = item_a; a_sep->surface.parentx = 0; a_sep->surface.parenty = 0; for (i = 0; i < ob_rr_theme->menu_sep_width; ++i) { a_sep->texture[i].data.lineart.x1 = ob_rr_theme->menu_sep_paddingx; a_sep->texture[i].data.lineart.y1 = ob_rr_theme->menu_sep_paddingy + i; a_sep->texture[i].data.lineart.x2 = self->area.width - ob_rr_theme->menu_sep_paddingx - 1; a_sep->texture[i].data.lineart.y2 = ob_rr_theme->menu_sep_paddingy + i; } RrPaint(a_sep, self->text, self->area.width, ob_rr_theme->menu_sep_width + 2*ob_rr_theme->menu_sep_paddingy); } break; default: g_assert_not_reached(); } if (((self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL) || (self->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU)) && self->entry->data.normal.icon) { RrAppearance *clear; XMoveResizeWindow(obt_display, self->icon, PADDING, frame->item_margin.top, ITEM_HEIGHT - frame->item_margin.top - frame->item_margin.bottom, ITEM_HEIGHT - frame->item_margin.top - frame->item_margin.bottom); clear = ob_rr_theme->a_clear_tex; RrAppearanceClearTextures(clear); clear->texture[0].type = RR_TEXTURE_IMAGE; clear->texture[0].data.image.image = self->entry->data.normal.icon; clear->texture[0].data.image.alpha = self->entry->data.normal.icon_alpha; clear->surface.parent = item_a; clear->surface.parentx = PADDING; clear->surface.parenty = frame->item_margin.top; RrPaint(clear, self->icon, ITEM_HEIGHT - frame->item_margin.top - frame->item_margin.bottom, ITEM_HEIGHT - frame->item_margin.top - frame->item_margin.bottom); XMapWindow(obt_display, self->icon); } else if (self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL && self->entry->data.normal.mask) { RrColor *c; RrAppearance *clear; XMoveResizeWindow(obt_display, self->icon, PADDING, frame->item_margin.top, ITEM_HEIGHT - frame->item_margin.top - frame->item_margin.bottom, ITEM_HEIGHT - frame->item_margin.top - frame->item_margin.bottom); clear = ob_rr_theme->a_clear_tex; RrAppearanceClearTextures(clear); clear->texture[0].type = RR_TEXTURE_MASK; clear->texture[0].data.mask.mask = self->entry->data.normal.mask; c = (self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL && !self->entry->data.normal.enabled ? /* disabled */ (self == self->frame->selected ? self->entry->data.normal.mask_disabled_selected_color : self->entry->data.normal.mask_disabled_color) : /* enabled */ (self == self->frame->selected ? self->entry->data.normal.mask_selected_color : self->entry->data.normal.mask_normal_color)); clear->texture[0].data.mask.color = c; clear->surface.parent = item_a; clear->surface.parentx = PADDING; clear->surface.parenty = frame->item_margin.top; RrPaint(clear, self->icon, ITEM_HEIGHT - frame->item_margin.top - frame->item_margin.bottom, ITEM_HEIGHT - frame->item_margin.top - frame->item_margin.bottom); XMapWindow(obt_display, self->icon); } else XUnmapWindow(obt_display, self->icon); if (self->entry->type == OB_MENU_ENTRY_TYPE_SUBMENU) { RrAppearance *bullet_a; XMoveResizeWindow(obt_display, self->bullet, self->frame->text_x + self->frame->text_w - ITEM_HEIGHT + PADDING, PADDING, ITEM_HEIGHT - 2*PADDING, ITEM_HEIGHT - 2*PADDING); bullet_a = (self == self->frame->selected ? ob_rr_theme->a_menu_bullet_selected : ob_rr_theme->a_menu_bullet_normal); bullet_a->surface.parent = item_a; bullet_a->surface.parentx = self->frame->text_x + self->frame->text_w - ITEM_HEIGHT + PADDING; bullet_a->surface.parenty = PADDING; RrPaint(bullet_a, self->bullet, ITEM_HEIGHT - 2*PADDING, ITEM_HEIGHT - 2*PADDING); XMapWindow(obt_display, self->bullet); } else XUnmapWindow(obt_display, self->bullet); XFlush(obt_display); }
static void pager_popup_draw_icon(gint px, gint py, gint w, gint h, gpointer data) { ObPagerPopup *self = data; gint x, y; guint rown, n; guint horz_inc; guint vert_inc; guint r, c; gint eachw, eachh; const guint cols = screen_desktop_layout.columns; const guint rows = screen_desktop_layout.rows; const gint linewidth = ob_rr_theme->obwidth; eachw = (w - ((cols + 1) * linewidth)) / cols; eachh = (h - ((rows + 1) * linewidth)) / rows; /* make them squares */ eachw = eachh = MIN(eachw, eachh); /* center */ px += (w - (cols * (eachw + linewidth) + linewidth)) / 2; py += (h - (rows * (eachh + linewidth) + linewidth)) / 2; if (eachw <= 0 || eachh <= 0) return; switch (screen_desktop_layout.orientation) { case OB_ORIENTATION_HORZ: switch (screen_desktop_layout.start_corner) { case OB_CORNER_TOPLEFT: n = 0; horz_inc = 1; vert_inc = cols; break; case OB_CORNER_TOPRIGHT: n = cols - 1; horz_inc = -1; vert_inc = cols; break; case OB_CORNER_BOTTOMRIGHT: n = rows * cols - 1; horz_inc = -1; vert_inc = -screen_desktop_layout.columns; break; case OB_CORNER_BOTTOMLEFT: n = (rows - 1) * cols; horz_inc = 1; vert_inc = -cols; break; default: g_assert_not_reached(); } break; case OB_ORIENTATION_VERT: switch (screen_desktop_layout.start_corner) { case OB_CORNER_TOPLEFT: n = 0; horz_inc = rows; vert_inc = 1; break; case OB_CORNER_TOPRIGHT: n = rows * (cols - 1); horz_inc = -rows; vert_inc = 1; break; case OB_CORNER_BOTTOMRIGHT: n = rows * cols - 1; horz_inc = -rows; vert_inc = -1; break; case OB_CORNER_BOTTOMLEFT: n = rows - 1; horz_inc = rows; vert_inc = -1; break; default: g_assert_not_reached(); } break; default: g_assert_not_reached(); } rown = n; for (r = 0, y = 0; r < rows; ++r, y += eachh + linewidth) { for (c = 0, x = 0; c < cols; ++c, x += eachw + linewidth) { RrAppearance *a; if (n < self->desks) { a = (n == self->curdesk ? self->hilight : self->unhilight); a->surface.parent = self->popup->a_bg; a->surface.parentx = x + px; a->surface.parenty = y + py; XMoveResizeWindow(obt_display, self->wins[n], x + px, y + py, eachw, eachh); RrPaint(a, self->wins[n], eachw, eachh); } n += horz_inc; } n = rown += vert_inc; } }
void popup_delay_show(ObPopup *self, gulong msec, gchar *text) { gint l, t, r, b; gint x, y, w, h; guint m; gint emptyx, emptyy; /* empty space between elements */ gint textx, texty, textw, texth; gint iconx, icony, iconw, iconh; const Rect *area; Rect mon; gboolean hasicon = self->hasicon; /* when there is no icon and the text is not parent relative, then fill the whole dialog with the text appearance, don't use the bg at all */ if (hasicon || self->a_text->surface.grad == RR_SURFACE_PARENTREL) RrMargins(self->a_bg, &l, &t, &r, &b); else l = t = r = b = 0; /* set up the textures */ self->a_text->texture[0].data.text.string = text; /* measure the text out */ if (text[0] != '\0') { RrMinSize(self->a_text, &textw, &texth); } else { textw = 0; texth = RrMinHeight(self->a_text); } /* get the height, which is also used for the icon width */ emptyy = t + b + ob_rr_theme->paddingy * 2; if (self->h) texth = self->h - emptyy; h = texth * self->iconhm + emptyy; if (self->textw) textw = self->textw; iconx = textx = l + ob_rr_theme->paddingx; emptyx = l + r + ob_rr_theme->paddingx * 2; if (hasicon) { iconw = texth * self->iconwm; iconh = texth * self->iconhm; textx += iconw + ob_rr_theme->paddingx; if (textw) emptyx += ob_rr_theme->paddingx; /* between the icon and text */ icony = (h - iconh - emptyy) / 2 + t + ob_rr_theme->paddingy; } else iconw = 0; texty = (h - texth - emptyy) / 2 + t + ob_rr_theme->paddingy; /* when there is no icon, then fill the whole dialog with the text appearance */ if (!hasicon) { textx = texty = 0; texth += emptyy; textw += emptyx; emptyx = emptyy = 0; } w = textw + emptyx + iconw; /* cap it at maxw/minw */ if (self->maxw) w = MIN(w, self->maxw); if (self->minw) w = MAX(w, self->minw); textw = w - emptyx - iconw; /* sanity checks to avoid crashes! */ if (w < 1) w = 1; if (h < 1) h = 1; if (texth < 1) texth = 1; /* set up the x coord */ x = self->x; switch (self->gravity) { case NorthGravity: case CenterGravity: case SouthGravity: x -= w / 2; break; case NorthEastGravity: case EastGravity: case SouthEastGravity: x -= w; break; } /* set up the y coord */ y = self->y; switch (self->gravity) { case WestGravity: case CenterGravity: case EastGravity: y -= h / 2; break; case SouthWestGravity: case SouthGravity: case SouthEastGravity: y -= h; break; } /* Find the monitor which contains the biggest part of the popup. * If the popup is completely off screen, limit it to the intersection * of all monitors and then try again. If it's still off screen, put it * on monitor 0. */ RECT_SET(mon, x, y, w, h); m = screen_find_monitor(&mon); area = screen_physical_area_monitor(m); x=MAX(MIN(x, area->x+area->width-w),area->x); y=MAX(MIN(y, area->y+area->height-h),area->y); if (m == screen_num_monitors) { RECT_SET(mon, x, y, w, h); m = screen_find_monitor(&mon); if (m == screen_num_monitors) m = 0; area = screen_physical_area_monitor(m); x=MAX(MIN(x, area->x+area->width-w),area->x); y=MAX(MIN(y, area->y+area->height-h),area->y); } /* set the windows/appearances up */ XMoveResizeWindow(obt_display, self->bg, x, y, w, h); /* when there is no icon and the text is not parent relative, then fill the whole dialog with the text appearance, don't use the bg at all */ if (hasicon || self->a_text->surface.grad == RR_SURFACE_PARENTREL) RrPaint(self->a_bg, self->bg, w, h); if (textw) { self->a_text->surface.parent = self->a_bg; self->a_text->surface.parentx = textx; self->a_text->surface.parenty = texty; XMoveResizeWindow(obt_display, self->text, textx, texty, textw, texth); RrPaint(self->a_text, self->text, textw, texth); } if (hasicon) self->draw_icon(iconx, icony, iconw, iconh, self->draw_icon_data); /* do the actual showing */ if (!self->mapped) { if (msec) { /* don't kill previous show timers */ if (!self->delay_mapped) { self->delay_timer = g_timeout_add(msec, popup_show_timeout, self); self->delay_mapped = TRUE; } } else { popup_show_timeout(self); } } }
static void framerender_close(ObFrame *self, RrAppearance *a) { if (!self->close_on) return; RrPaint(a, self->close, ob_rr_theme->button_size, ob_rr_theme->button_size); }
static void framerender_iconify(ObFrame *self, RrAppearance *a) { if (!self->iconify_on) return; RrPaint(a, self->iconify, ob_rr_theme->button_size, ob_rr_theme->button_size); }
void framerender_frame(ObFrame *self) { if (frame_iconify_animating(self)) return; /* delay redrawing until the animation is done */ if (!self->need_render) return; if (!self->visible) return; self->need_render = FALSE; { gulong px; px = (self->focused ? RrColorPixel(ob_rr_theme->cb_focused_color) : RrColorPixel(ob_rr_theme->cb_unfocused_color)); XSetWindowBackground(obt_display, self->backback, px); XClearWindow(obt_display, self->backback); XSetWindowBackground(obt_display, self->innerleft, px); XClearWindow(obt_display, self->innerleft); XSetWindowBackground(obt_display, self->innertop, px); XClearWindow(obt_display, self->innertop); XSetWindowBackground(obt_display, self->innerright, px); XClearWindow(obt_display, self->innerright); XSetWindowBackground(obt_display, self->innerbottom, px); XClearWindow(obt_display, self->innerbottom); XSetWindowBackground(obt_display, self->innerbll, px); XClearWindow(obt_display, self->innerbll); XSetWindowBackground(obt_display, self->innerbrr, px); XClearWindow(obt_display, self->innerbrr); XSetWindowBackground(obt_display, self->innerblb, px); XClearWindow(obt_display, self->innerblb); XSetWindowBackground(obt_display, self->innerbrb, px); XClearWindow(obt_display, self->innerbrb); px = (self->focused ? RrColorPixel(ob_rr_theme->frame_focused_border_color) : RrColorPixel(ob_rr_theme->frame_unfocused_border_color)); XSetWindowBackground(obt_display, self->left, px); XClearWindow(obt_display, self->left); XSetWindowBackground(obt_display, self->right, px); XClearWindow(obt_display, self->right); XSetWindowBackground(obt_display, self->titleleft, px); XClearWindow(obt_display, self->titleleft); XSetWindowBackground(obt_display, self->titletop, px); XClearWindow(obt_display, self->titletop); XSetWindowBackground(obt_display, self->titletopleft, px); XClearWindow(obt_display, self->titletopleft); XSetWindowBackground(obt_display, self->titletopright, px); XClearWindow(obt_display, self->titletopright); XSetWindowBackground(obt_display, self->titleright, px); XClearWindow(obt_display, self->titleright); XSetWindowBackground(obt_display, self->handleleft, px); XClearWindow(obt_display, self->handleleft); XSetWindowBackground(obt_display, self->handletop, px); XClearWindow(obt_display, self->handletop); XSetWindowBackground(obt_display, self->handleright, px); XClearWindow(obt_display, self->handleright); XSetWindowBackground(obt_display, self->handlebottom, px); XClearWindow(obt_display, self->handlebottom); XSetWindowBackground(obt_display, self->lgripleft, px); XClearWindow(obt_display, self->lgripleft); XSetWindowBackground(obt_display, self->lgriptop, px); XClearWindow(obt_display, self->lgriptop); XSetWindowBackground(obt_display, self->lgripbottom, px); XClearWindow(obt_display, self->lgripbottom); XSetWindowBackground(obt_display, self->rgripright, px); XClearWindow(obt_display, self->rgripright); XSetWindowBackground(obt_display, self->rgriptop, px); XClearWindow(obt_display, self->rgriptop); XSetWindowBackground(obt_display, self->rgripbottom, px); XClearWindow(obt_display, self->rgripbottom); /* don't use the separator color for shaded windows */ if (!self->client->shaded) px = (self->focused ? RrColorPixel(ob_rr_theme->title_separator_focused_color) : RrColorPixel(ob_rr_theme->title_separator_unfocused_color)); XSetWindowBackground(obt_display, self->titlebottom, px); XClearWindow(obt_display, self->titlebottom); } if (self->decorations & OB_FRAME_DECOR_TITLEBAR) { RrAppearance *t, *l, *m, *n, *i, *d, *s, *c, *clear; if (self->focused) { t = ob_rr_theme->a_focused_title; l = ob_rr_theme->a_focused_label; m = (!(self->decorations & OB_FRAME_DECOR_MAXIMIZE) ? ob_rr_theme->btn_max->a_disabled_focused : (self->client->max_vert || self->client->max_horz ? (self->max_press ? ob_rr_theme->btn_max->a_toggled_focused_pressed : (self->max_hover ? ob_rr_theme->btn_max->a_toggled_hover_focused : ob_rr_theme->btn_max->a_toggled_focused_unpressed)) : (self->max_press ? ob_rr_theme->btn_max->a_focused_pressed : (self->max_hover ? ob_rr_theme->btn_max->a_hover_focused : ob_rr_theme->btn_max->a_focused_unpressed)))); n = ob_rr_theme->a_icon; i = (!(self->decorations & OB_FRAME_DECOR_ICONIFY) ? ob_rr_theme->btn_iconify->a_disabled_focused : (self->iconify_press ? ob_rr_theme->btn_iconify->a_focused_pressed : (self->iconify_hover ? ob_rr_theme->btn_iconify->a_hover_focused : ob_rr_theme->btn_iconify->a_focused_unpressed))); d = (!(self->decorations & OB_FRAME_DECOR_ALLDESKTOPS) ? ob_rr_theme->btn_desk->a_disabled_focused : (self->client->desktop == DESKTOP_ALL ? (self->desk_press ? ob_rr_theme->btn_desk->a_toggled_focused_pressed : (self->desk_hover ? ob_rr_theme->btn_desk->a_toggled_hover_focused : ob_rr_theme->btn_desk->a_toggled_focused_unpressed)) : (self->desk_press ? ob_rr_theme->btn_desk->a_focused_pressed : (self->desk_hover ? ob_rr_theme->btn_desk->a_hover_focused : ob_rr_theme->btn_desk->a_focused_unpressed)))); s = (!(self->decorations & OB_FRAME_DECOR_SHADE) ? ob_rr_theme->btn_shade->a_disabled_focused : (self->client->shaded ? (self->shade_press ? ob_rr_theme->btn_shade->a_toggled_focused_pressed : (self->shade_hover ? ob_rr_theme->btn_shade->a_toggled_hover_focused : ob_rr_theme->btn_shade->a_toggled_focused_unpressed)) : (self->shade_press ? ob_rr_theme->btn_shade->a_focused_pressed : (self->shade_hover ? ob_rr_theme->btn_shade->a_hover_focused : ob_rr_theme->btn_shade->a_focused_unpressed)))); c = (!(self->decorations & OB_FRAME_DECOR_CLOSE) ? ob_rr_theme->btn_close->a_disabled_focused : (self->close_press ? ob_rr_theme->btn_close->a_focused_pressed : (self->close_hover ? ob_rr_theme->btn_close->a_hover_focused : ob_rr_theme->btn_close->a_focused_unpressed))); } else { t = ob_rr_theme->a_unfocused_title; l = ob_rr_theme->a_unfocused_label; m = (!(self->decorations & OB_FRAME_DECOR_MAXIMIZE) ? ob_rr_theme->btn_max->a_disabled_unfocused : (self->client->max_vert || self->client->max_horz ? (self->max_press ? ob_rr_theme->btn_max->a_toggled_unfocused_pressed : (self->max_hover ? ob_rr_theme->btn_max->a_toggled_hover_unfocused : ob_rr_theme->btn_max->a_toggled_unfocused_unpressed)) : (self->max_press ? ob_rr_theme->btn_max->a_unfocused_pressed : (self->max_hover ? ob_rr_theme->btn_max->a_hover_unfocused : ob_rr_theme->btn_max->a_unfocused_unpressed)))); n = ob_rr_theme->a_icon; i = (!(self->decorations & OB_FRAME_DECOR_ICONIFY) ? ob_rr_theme->btn_iconify->a_disabled_unfocused : (self->iconify_press ? ob_rr_theme->btn_iconify->a_unfocused_pressed : (self->iconify_hover ? ob_rr_theme->btn_iconify->a_hover_unfocused : ob_rr_theme->btn_iconify->a_unfocused_unpressed))); d = (!(self->decorations & OB_FRAME_DECOR_ALLDESKTOPS) ? ob_rr_theme->btn_desk->a_disabled_unfocused : (self->client->desktop == DESKTOP_ALL ? (self->desk_press ? ob_rr_theme->btn_desk->a_toggled_unfocused_pressed : (self->desk_hover ? ob_rr_theme->btn_desk->a_toggled_hover_unfocused : ob_rr_theme->btn_desk->a_toggled_unfocused_unpressed)) : (self->desk_press ? ob_rr_theme->btn_desk->a_unfocused_pressed : (self->desk_hover ? ob_rr_theme->btn_desk->a_hover_unfocused : ob_rr_theme->btn_desk->a_unfocused_unpressed)))); s = (!(self->decorations & OB_FRAME_DECOR_SHADE) ? ob_rr_theme->btn_shade->a_disabled_unfocused : (self->client->shaded ? (self->shade_press ? ob_rr_theme->btn_shade->a_toggled_unfocused_pressed : (self->shade_hover ? ob_rr_theme->btn_shade->a_toggled_hover_unfocused : ob_rr_theme->btn_shade->a_toggled_unfocused_unpressed)) : (self->shade_press ? ob_rr_theme->btn_shade->a_unfocused_pressed : (self->shade_hover ? ob_rr_theme->btn_shade->a_hover_unfocused : ob_rr_theme->btn_shade->a_unfocused_unpressed)))); c = (!(self->decorations & OB_FRAME_DECOR_CLOSE) ? ob_rr_theme->btn_close->a_disabled_unfocused : (self->close_press ? ob_rr_theme->btn_close->a_unfocused_pressed : (self->close_hover ? ob_rr_theme->btn_close->a_hover_unfocused : ob_rr_theme->btn_close->a_unfocused_unpressed))); } clear = ob_rr_theme->a_clear; RrPaint(t, self->title, self->width, ob_rr_theme->title_height); clear->surface.parent = t; clear->surface.parenty = 0; clear->surface.parentx = ob_rr_theme->grip_width; RrPaint(clear, self->topresize, self->width - ob_rr_theme->grip_width * 2, ob_rr_theme->paddingy + 1); clear->surface.parentx = 0; if (ob_rr_theme->grip_width > 0) RrPaint(clear, self->tltresize, ob_rr_theme->grip_width, ob_rr_theme->paddingy + 1); if (ob_rr_theme->title_height > 0) RrPaint(clear, self->tllresize, ob_rr_theme->paddingx + 1, ob_rr_theme->title_height); clear->surface.parentx = self->width - ob_rr_theme->grip_width; if (ob_rr_theme->grip_width > 0) RrPaint(clear, self->trtresize, ob_rr_theme->grip_width, ob_rr_theme->paddingy + 1); clear->surface.parentx = self->width - (ob_rr_theme->paddingx + 1); if (ob_rr_theme->title_height > 0) RrPaint(clear, self->trrresize, ob_rr_theme->paddingx + 1, ob_rr_theme->title_height); /* set parents for any parent relative guys */ l->surface.parent = t; l->surface.parentx = self->label_x; l->surface.parenty = ob_rr_theme->paddingy; m->surface.parent = t; m->surface.parentx = self->max_x; m->surface.parenty = ob_rr_theme->paddingy + 1; n->surface.parent = t; n->surface.parentx = self->icon_x; n->surface.parenty = ob_rr_theme->paddingy; i->surface.parent = t; i->surface.parentx = self->iconify_x; i->surface.parenty = ob_rr_theme->paddingy + 1; d->surface.parent = t; d->surface.parentx = self->desk_x; d->surface.parenty = ob_rr_theme->paddingy + 1; s->surface.parent = t; s->surface.parentx = self->shade_x; s->surface.parenty = ob_rr_theme->paddingy + 1; c->surface.parent = t; c->surface.parentx = self->close_x; c->surface.parenty = ob_rr_theme->paddingy + 1; framerender_label(self, l); framerender_max(self, m); framerender_icon(self, n); framerender_iconify(self, i); framerender_desk(self, d); framerender_shade(self, s); framerender_close(self, c); } if (self->decorations & OB_FRAME_DECOR_HANDLE && ob_rr_theme->handle_height > 0) { RrAppearance *h, *g; h = (self->focused ? ob_rr_theme->a_focused_handle : ob_rr_theme->a_unfocused_handle); RrPaint(h, self->handle, self->width, ob_rr_theme->handle_height); if (self->decorations & OB_FRAME_DECOR_GRIPS) { g = (self->focused ? ob_rr_theme->a_focused_grip : ob_rr_theme->a_unfocused_grip); if (g->surface.grad == RR_SURFACE_PARENTREL) g->surface.parent = h; g->surface.parentx = 0; g->surface.parenty = 0; RrPaint(g, self->lgrip, ob_rr_theme->grip_width, ob_rr_theme->handle_height); g->surface.parentx = self->width - ob_rr_theme->grip_width; g->surface.parenty = 0; RrPaint(g, self->rgrip, ob_rr_theme->grip_width, ob_rr_theme->handle_height); } } XFlush(obt_display); }