コード例 #1
0
ファイル: client_list_menu.c プロジェクト: richo/openbox
static gboolean desk_menu_update(ObMenuFrame *frame, gpointer data)
{
    ObMenu *menu = frame->menu;
    DesktopData *d = data;
    GList *it;
    gboolean empty = TRUE;
    gboolean onlyiconic = TRUE;

    menu_clear_entries(menu);

    for (it = focus_order; it; it = g_list_next(it)) {
        ObClient *c = it->data;
        if (focus_valid_target(c, d->desktop,
                               TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE)) {
            ObMenuEntry *e;

            empty = FALSE;

            if (c->iconic) {
                gchar *title = g_strdup_printf("(%s)", c->icon_title);
                e = menu_add_normal(menu, d->desktop, title, NULL, FALSE);
                g_free(title);
            } else {
                onlyiconic = FALSE;
                e = menu_add_normal(menu, d->desktop, c->title, NULL, FALSE);
            }

            if (config_menu_show_icons) {
                e->data.normal.icon = client_icon(c);
                RrImageRef(e->data.normal.icon);
                e->data.normal.icon_alpha = c->iconic ? OB_ICONIC_ALPHA : 0xff;
            }

            e->data.normal.data = c;
        }
    }

    if (empty || onlyiconic) {
        ObMenuEntry *e;

        /* no entries or only iconified windows, so add a
         * way to go to this desktop without uniconifying a window */
        if (!empty)
            menu_add_separator(menu, SEPARATOR, NULL);

        e = menu_add_normal(menu, d->desktop, _("Go there..."), NULL, TRUE);
        if (d->desktop == screen_desktop)
            e->data.normal.enabled = FALSE;
    }

    return TRUE; /* always show */
}
コード例 #2
0
ファイル: framerender.c プロジェクト: asynchrony/openbox
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);
}
コード例 #3
0
static gboolean self_update(ObMenuFrame *frame, gpointer data)
{
    ObMenu *menu = frame->menu;
    ObMenuEntry *e;
    GList *it;
    guint desktop;

    menu_clear_entries(menu);

    for (desktop = 0; desktop < screen_num_desktops; desktop++) {
        gboolean empty = TRUE;
        gboolean onlyiconic = TRUE;

        menu_add_separator(menu, SEPARATOR, screen_desktop_names[desktop]);
        for (it = client_list; it; it = g_list_next(it)) {
            ObClient *c = it->data;
            if (focus_valid_target(c, desktop,
                                   TRUE, TRUE,
                                   FALSE, TRUE, FALSE, FALSE, FALSE))
            {
                empty = FALSE;

                if (c->iconic) {
                    gchar *title = g_strdup_printf("(%s)", c->icon_title);
                    e = menu_add_normal(menu, desktop, title, NULL, FALSE);
                    g_free(title);
                } else {
                    onlyiconic = FALSE;
                    e = menu_add_normal(menu, desktop, c->title, NULL, FALSE);
                    e->data.normal.indent = get_order(c, desktop);
                }

                if (config_menu_show_icons) {
                    e->data.normal.icon = client_icon(c);
                    RrImageRef(e->data.normal.icon);
                    e->data.normal.icon_alpha =
                        c->iconic ? OB_ICONIC_ALPHA : 0xff;
                }

                e->data.normal.data = c;
            }
        }

        if (empty || onlyiconic) {
            /* no entries or only iconified windows, so add a
             * way to go to this desktop without uniconifying a window */
            if (!empty)
                menu_add_separator(menu, SEPARATOR, NULL);

            e = menu_add_normal(menu, desktop, _("Go there..."), NULL, TRUE);
            if (desktop == screen_desktop)
                e->data.normal.enabled = FALSE;
        }
    }

    if (config_menu_manage_desktops) {
        menu_add_separator(menu, SEPARATOR, _("Manage desktops"));
        menu_add_normal(menu, ADD_DESKTOP, _("_Add new desktop"), NULL, TRUE);
        menu_add_normal(menu, REMOVE_DESKTOP, _("_Remove last desktop"),
                        NULL, TRUE);
    }

    return TRUE; /* always show the menu */
}