Пример #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
static Window createWindow(Window parent, gulong mask,
                           XSetWindowAttributes *attrib)
{
    return XCreateWindow(obt_display, parent, 0, 0, 1, 1, 0,
                         RrDepth(ob_rr_inst), InputOutput,
                         RrVisual(ob_rr_inst), mask, attrib);
}
Пример #3
0
void pager_popup_delay_show(ObPagerPopup *self, gulong msec,
                            gchar *text, guint desk)
{
    guint i;

    if (screen_num_desktops < self->desks)
        for (i = screen_num_desktops; i < self->desks; ++i)
            XDestroyWindow(obt_display, self->wins[i]);

    if (screen_num_desktops != self->desks)
        self->wins = g_renew(Window, self->wins, screen_num_desktops);

    if (screen_num_desktops > self->desks)
        for (i = self->desks; i < screen_num_desktops; ++i) {
            XSetWindowAttributes attr;

            attr.border_pixel =
                RrColorPixel(ob_rr_theme->osd_border_color);
            self->wins[i] = XCreateWindow(obt_display, self->popup->bg,
                                          0, 0, 1, 1, ob_rr_theme->obwidth,
                                          RrDepth(ob_rr_inst), InputOutput,
                                          RrVisual(ob_rr_inst), CWBorderPixel,
                                          &attr);
            XMapWindow(obt_display, self->wins[i]);
        }

    self->desks = screen_num_desktops;
    self->curdesk = desk;

    popup_delay_show(self->popup, msec, text);
}
Пример #4
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;
}