Пример #1
0
ObPopup *popup_new(void)
{
    XSetWindowAttributes attrib;
    ObPopup *self = g_slice_new0(ObPopup);

    self->obwin.type = OB_WINDOW_CLASS_INTERNAL;
    self->gravity = NorthWestGravity;
    self->x = self->y = self->textw = self->h = 0;
    self->a_bg = RrAppearanceCopy(ob_rr_theme->osd_bg);
    self->a_text = RrAppearanceCopy(ob_rr_theme->osd_hilite_label);
    self->iconwm = self->iconhm = 1;

    attrib.override_redirect = True;
    self->bg = XCreateWindow(obt_display, obt_root(ob_screen),
                             0, 0, 1, 1, 0, RrDepth(ob_rr_inst),
                             InputOutput, RrVisual(ob_rr_inst),
                             CWOverrideRedirect, &attrib);

    self->text = XCreateWindow(obt_display, self->bg,
                               0, 0, 1, 1, 0, RrDepth(ob_rr_inst),
                               InputOutput, RrVisual(ob_rr_inst), 0, NULL);

    XSetWindowBorderWidth(obt_display, self->bg, ob_rr_theme->obwidth);
    XSetWindowBorder(obt_display, self->bg,
                     RrColorPixel(ob_rr_theme->osd_border_color));

    XMapWindow(obt_display, self->text);

    stacking_add(INTERNAL_AS_WINDOW(self));
    window_add(&self->bg, INTERNAL_AS_WINDOW(self));
    return self;
}
Пример #2
0
ObMenuFrame* menu_frame_new(ObMenu *menu, guint show_from, ObClient *client)
{
    ObMenuFrame *self;
    XSetWindowAttributes attr;

    self = g_slice_new0(ObMenuFrame);
    self->obwin.type = OB_WINDOW_CLASS_MENUFRAME;
    self->menu = menu;
    self->selected = NULL;
    self->client = client;
    self->direction_right = TRUE;
    self->show_from = show_from;

    attr.event_mask = FRAME_EVENTMASK;
    self->window = createWindow(obt_root(ob_screen),
                                CWEventMask, &attr);

    /* make it a popup menu type window */
    OBT_PROP_SET32(self->window, NET_WM_WINDOW_TYPE, ATOM,
                   OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_POPUP_MENU));

    XSetWindowBorderWidth(obt_display, self->window, ob_rr_theme->mbwidth);
    XSetWindowBorder(obt_display, self->window,
                     RrColorPixel(ob_rr_theme->menu_border_color));

    self->a_items = RrAppearanceCopy(ob_rr_theme->a_menu);

    window_add(&self->window, MENUFRAME_AS_WINDOW(self));
    stacking_add(MENUFRAME_AS_WINDOW(self));

    return self;
}
Пример #3
0
ObPagerPopup *pager_popup_new(void)
{
    ObPagerPopup *self;

    self = g_slice_new(ObPagerPopup);
    self->popup = popup_new();

    self->desks = 0;
    self->wins = g_new(Window, self->desks);
    self->hilight = RrAppearanceCopy(ob_rr_theme->osd_hilite_bg);
    self->unhilight = RrAppearanceCopy(ob_rr_theme->osd_unhilite_bg);

    self->popup->hasicon = TRUE;
    self->popup->draw_icon = pager_popup_draw_icon;
    self->popup->draw_icon_data = self;

    return self;
}
Пример #4
0
void prompt_startup(gboolean reconfig)
{
    /* note: this is not a copy, don't free it */
    prompt_a_bg = ob_rr_theme->osd_bg;

    prompt_a_button = RrAppearanceCopy(ob_rr_theme->osd_unpressed_button);
    prompt_a_focus = RrAppearanceCopy(ob_rr_theme->osd_focused_button);
    prompt_a_press = RrAppearanceCopy(ob_rr_theme->osd_pressed_button);    

    prompt_a_msg = RrAppearanceCopy(ob_rr_theme->osd_hilite_label);
    prompt_a_msg->texture[0].data.text.flow = TRUE;

    if (reconfig) {
        GList *it;
        for (it = prompt_list; it; it = g_list_next(it)) {
            ObPrompt *p = it->data;
            prompt_layout(p);
            render_all(p);
        }
    }
}
Пример #5
0
void menu_frame_startup(gboolean reconfig)
{
    gint i;

    a_sep = RrAppearanceCopy(ob_rr_theme->a_clear);
    RrAppearanceAddTextures(a_sep, ob_rr_theme->menu_sep_width);
    for (i = 0; i < ob_rr_theme->menu_sep_width; ++i) {
        a_sep->texture[i].type = RR_TEXTURE_LINE_ART;
        a_sep->texture[i].data.lineart.color =
            ob_rr_theme->menu_sep_color;
    }

    if (reconfig) return;

    client_add_destroy_notify(client_dest, NULL);
    menu_frame_map = g_hash_table_new(g_int_hash, g_int_equal);
}
Пример #6
0
ObIconPopup *icon_popup_new(void)
{
    ObIconPopup *self;

    self = g_slice_new0(ObIconPopup);
    self->popup = popup_new();
    self->a_icon = RrAppearanceCopy(ob_rr_theme->a_clear_tex);
    self->icon = XCreateWindow(obt_display, self->popup->bg,
                               0, 0, 1, 1, 0,
                               RrDepth(ob_rr_inst), InputOutput,
                               RrVisual(ob_rr_inst), 0, NULL);
    XMapWindow(obt_display, self->icon);

    self->popup->hasicon = TRUE;
    self->popup->draw_icon = icon_popup_draw_icon;
    self->popup->draw_icon_data = self;

    return self;
}
Пример #7
0
void prompt_startup(gboolean reconfig)
{
    RrColor *c_button, *c_focus, *c_press, *c_pfocus;

    /* note: this is not a copy, don't free it */
    prompt_a_bg = ob_rr_theme->osd_bg;

    prompt_a_button = RrAppearanceCopy(ob_rr_theme->a_focused_unpressed_close);
    prompt_a_focus = RrAppearanceCopy(ob_rr_theme->a_hover_focused_close);
    prompt_a_press = RrAppearanceCopy(ob_rr_theme->a_focused_pressed_close);
    prompt_a_pfocus = RrAppearanceCopy(ob_rr_theme->a_focused_pressed_close);

    c_button = prompt_a_button->texture[0].data.mask.color;
    c_focus = prompt_a_focus->texture[0].data.mask.color;
    c_press = prompt_a_press->texture[0].data.mask.color;
    c_pfocus = prompt_a_press->texture[0].data.mask.color;

    RrAppearanceRemoveTextures(prompt_a_button);
    RrAppearanceRemoveTextures(prompt_a_focus);
    RrAppearanceRemoveTextures(prompt_a_press);
    RrAppearanceRemoveTextures(prompt_a_pfocus);

    /* texture[0] is the text and texture[1-4] (for prompt_a_focus and
       prompt_a_pfocus) is lineart to show where keyboard focus is */
    RrAppearanceAddTextures(prompt_a_button, 1);
    RrAppearanceAddTextures(prompt_a_focus, 5);
    RrAppearanceAddTextures(prompt_a_press, 1);
    RrAppearanceAddTextures(prompt_a_pfocus, 5);

    /* totally cheating here.. */
    prompt_a_button->texture[0] = ob_rr_theme->osd_hilite_label->texture[0];
    prompt_a_focus->texture[0] = ob_rr_theme->osd_hilite_label->texture[0];
    prompt_a_press->texture[0] = ob_rr_theme->osd_hilite_label->texture[0];
    prompt_a_pfocus->texture[0] = ob_rr_theme->osd_hilite_label->texture[0];

    prompt_a_button->texture[0].data.text.justify = RR_JUSTIFY_CENTER;
    prompt_a_focus->texture[0].data.text.justify = RR_JUSTIFY_CENTER;
    prompt_a_press->texture[0].data.text.justify = RR_JUSTIFY_CENTER;
    prompt_a_pfocus->texture[0].data.text.justify = RR_JUSTIFY_CENTER;

    prompt_a_button->texture[0].data.text.color = c_button;
    prompt_a_focus->texture[0].data.text.color = c_focus;
    prompt_a_press->texture[0].data.text.color = c_press;
    prompt_a_pfocus->texture[0].data.text.color = c_pfocus;

    prompt_a_focus->texture[1].data.lineart.color = c_focus;
    prompt_a_focus->texture[2].data.lineart.color = c_focus;
    prompt_a_focus->texture[3].data.lineart.color = c_focus;
    prompt_a_focus->texture[4].data.lineart.color = c_focus;

    prompt_a_pfocus->texture[1].data.lineart.color = c_press;
    prompt_a_pfocus->texture[2].data.lineart.color = c_press;
    prompt_a_pfocus->texture[3].data.lineart.color = c_press;
    prompt_a_pfocus->texture[4].data.lineart.color = c_press;

    prompt_a_msg = RrAppearanceCopy(ob_rr_theme->osd_hilite_label);
    prompt_a_msg->texture[0].data.text.flow = TRUE;

    if (reconfig) {
        GList *it;
        for (it = prompt_list; it; it = g_list_next(it)) {
            ObPrompt *p = it->data;
            prompt_layout(p);
            render_all(p);
        }
    }
}