summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-08-28 08:08:18 +0000
committerDana Jansens <danakj@orodu.net>2003-08-28 08:08:18 +0000
commit15386e86d42898664f682d03d3f510452e2d9f69 (patch)
treee1eae5b6f38b91bb48cf4f66b50c176c49b463cd
parent2c263fc8236afdd4dcf0a89d4defb1736cc3700b (diff)
add icons to the client-list-menu
-rw-r--r--openbox/menu.h5
-rw-r--r--openbox/menuframe.c17
-rw-r--r--plugins/menu/client_list_menu.c14
3 files changed, 29 insertions, 7 deletions
diff --git a/openbox/menu.h b/openbox/menu.h
index c91be82b..c6058635 100644
--- a/openbox/menu.h
+++ b/openbox/menu.h
@@ -59,6 +59,11 @@ struct _ObNormalMenuEntry {
/* List of ObActions */
GSList *actions;
+
+ /* Icon shit */
+ gint icon_width;
+ gint icon_height;
+ RrPixel32 *icon_data;
};
struct _ObSubmenuMenuEntry {
diff --git a/openbox/menuframe.c b/openbox/menuframe.c
index 8ffd27ad..8126b5d5 100644
--- a/openbox/menuframe.c
+++ b/openbox/menuframe.c
@@ -134,7 +134,6 @@ void menu_entry_frame_free(ObMenuEntryFrame *self)
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);
}
@@ -171,6 +170,7 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self)
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) ?
@@ -230,11 +230,17 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self)
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;
@@ -314,7 +320,8 @@ static void menu_frame_render(ObMenuFrame *self)
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;
diff --git a/plugins/menu/client_list_menu.c b/plugins/menu/client_list_menu.c
index 2f5c5f9f..5b014116 100644
--- a/plugins/menu/client_list_menu.c
+++ b/plugins/menu/client_list_menu.c
@@ -29,20 +29,30 @@ static void desk_menu_update(ObMenuFrame *frame, gpointer data)
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;
+ }
}
}