void menu_frame_move(ObMenuFrame *self, gint x, gint y)
{
- /* XXX screen constraints */
RECT_SET_POINT(self->area, x, y);
XMoveWindow(ob_display, self->window, self->area.x, self->area.y);
}
RrAppearance *item_a, *text_a;
gint th; /* temp */
ObMenu *sub;
+ ObClientIcon *icon;
item_a = ((self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL &&
!self->entry->data.normal.enabled) ?
break;
}
- /* XXX draw icons */
- if (0) {
+ if (self->entry->type == OB_MENU_ENTRY_TYPE_NORMAL &&
+ self->entry->data.normal.icon_data)
+ {
XMoveResizeWindow(ob_display, self->icon, 0, 0,
self->frame->item_h, self->frame->item_h);
- /* XXX set the RGBA surface stuff */
+ self->a_icon->texture[0].data.rgba.width =
+ self->entry->data.normal.icon_width;
+ self->a_icon->texture[0].data.rgba.height =
+ self->entry->data.normal.icon_height;
+ self->a_icon->texture[0].data.rgba.data =
+ self->entry->data.normal.icon_data;
self->a_icon->surface.parent = item_a;
self->a_icon->surface.parentx = 0;
self->a_icon->surface.parenty = 0;
text_a->texture[0].data.text.string = e->entry->data.normal.label;
RrMinsize(text_a, &tw, &th);
- /* XXX has_icon = TRUE; */
+ if (e->entry->data.normal.icon_data)
+ has_icon = TRUE;
break;
case OB_MENU_ENTRY_TYPE_SUBMENU:
sub = e->entry->data.submenu.submenu;
ObMenu *menu = frame->menu;
DesktopData *d = data;
GList *it;
+ gint i;
menu_clear_entries(menu->name);
- for (it = focus_order[d->desktop]; it; it = g_list_next(it)) {
+ for (it = focus_order[d->desktop], i = 0; it; it = g_list_next(it), ++i) {
ObClient *c = it->data;
if (client_normal(c)) {
GSList *acts;
ObAction* act;
+ ObMenuEntry *e;
+ ObClientIcon *icon;
act = action_from_string("activate");
act->data.activate.c = c;
acts = g_slist_prepend(NULL, act);
- menu_add_normal(menu->name, 0,
+ menu_add_normal(menu->name, i,
(c->iconic ? c->icon_title : c->title), acts);
+
+ if ((icon = client_icon(c, 32, 32))) {
+ e = menu_find_entry_id(menu, i);
+ e->data.normal.icon_width = icon->width;
+ e->data.normal.icon_height = icon->height;
+ e->data.normal.icon_data = icon->data;
+ }
}
}