void prompt_show(ObPrompt *self, ObClient *parent, gboolean modal) { gint i; if (self->mapped) { /* activate the prompt */ OBT_PROP_MSG(ob_screen, self->super.window, NET_ACTIVE_WINDOW, 1, /* from an application.. */ event_time(), 0, 0, 0); return; } /* set the focused button (if not found then the first button is used) */ self->focus = &self->button[0]; for (i = 0; i < self->n_buttons; ++i) if (self->button[i].result == self->default_result) { self->focus = &self->button[i]; break; } if (parent) { Atom states[1]; gint nstates; Window p; XWMHints h; if (parent->group) { /* make it transient for the window's group */ h.flags = WindowGroupHint; h.window_group = parent->group->leader; p = obt_root(ob_screen); } else { /* make it transient for the window directly */ h.flags = 0; p = parent->window; } XSetWMHints(obt_display, self->super.window, &h); OBT_PROP_SET32(self->super.window, WM_TRANSIENT_FOR, WINDOW, p); states[0] = OBT_PROP_ATOM(NET_WM_STATE_MODAL); nstates = (modal ? 1 : 0); OBT_PROP_SETA32(self->super.window, NET_WM_STATE, ATOM, states, nstates); } else OBT_PROP_ERASE(self->super.window, WM_TRANSIENT_FOR); /* set up the dialog and render it */ prompt_layout(self); render_all(self); client_manage(self->super.window, self); self->mapped = TRUE; }
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); } } }
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); } } }