Merge branch 'backport' into work

Conflicts:

	openbox/menuframe.c
	openbox/prompt.c
	openbox/prop.c
	openbox/prop.h
This commit is contained in:
Dana Jansens 2008-02-22 12:31:26 -05:00
commit 97de737767
8 changed files with 102 additions and 31 deletions

View file

@ -62,6 +62,7 @@ void obt_prop_startup(void)
CREATE(WM_CLIENT_MACHINE); CREATE(WM_CLIENT_MACHINE);
CREATE(WM_COMMAND); CREATE(WM_COMMAND);
CREATE(WM_CLIENT_LEADER); CREATE(WM_CLIENT_LEADER);
CREATE(WM_TRANSIENT_FOR);
CREATE_(MOTIF_WM_HINTS); CREATE_(MOTIF_WM_HINTS);
CREATE(SM_CLIENT_ID); CREATE(SM_CLIENT_ID);

View file

@ -51,6 +51,7 @@ typedef enum {
OBT_PROP_WM_CLIENT_MACHINE, OBT_PROP_WM_CLIENT_MACHINE,
OBT_PROP_WM_COMMAND, OBT_PROP_WM_COMMAND,
OBT_PROP_WM_CLIENT_LEADER, OBT_PROP_WM_CLIENT_LEADER,
OBT_PROP_WM_TRANSIENT_FOR,
OBT_PROP_MOTIF_WM_HINTS, OBT_PROP_MOTIF_WM_HINTS,
/* SM atoms */ /* SM atoms */

View file

@ -1541,7 +1541,7 @@ void client_update_normal_hints(ObClient *self)
self->min_ratio = 0.0f; self->min_ratio = 0.0f;
self->max_ratio = 0.0f; self->max_ratio = 0.0f;
SIZE_SET(self->size_inc, 1, 1); SIZE_SET(self->size_inc, 1, 1);
SIZE_SET(self->base_size, 0, 0); SIZE_SET(self->base_size, -1, -1);
SIZE_SET(self->min_size, 0, 0); SIZE_SET(self->min_size, 0, 0);
SIZE_SET(self->max_size, G_MAXINT, G_MAXINT); SIZE_SET(self->max_size, G_MAXINT, G_MAXINT);
@ -2817,7 +2817,7 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h,
0 : self->max_ratio; 0 : self->max_ratio;
/* base size is substituted with min size if not specified */ /* base size is substituted with min size if not specified */
if (self->base_size.width || self->base_size.height) { if (self->base_size.width >= 0 || self->base_size.height >= 0) {
basew = self->base_size.width; basew = self->base_size.width;
baseh = self->base_size.height; baseh = self->base_size.height;
} else { } else {
@ -3364,7 +3364,7 @@ static void client_prompt_kill(ObClient *self)
g_free(m); g_free(m);
} }
prompt_show(self->kill_prompt, self); prompt_show(self->kill_prompt, self, TRUE);
} }
void client_kill(ObClient *self) void client_kill(ObClient *self)

View file

@ -29,7 +29,6 @@
#include "render/theme.h" #include "render/theme.h"
#define PADDING 2 #define PADDING 2
#define SEPARATOR_HEIGHT 3
#define MAX_MENU_WIDTH 400 #define MAX_MENU_WIDTH 400
#define ITEM_HEIGHT (ob_rr_theme->menu_font_height + 2*PADDING) #define ITEM_HEIGHT (ob_rr_theme->menu_font_height + 2*PADDING)
@ -40,6 +39,9 @@
ButtonPressMask | ButtonReleaseMask) ButtonPressMask | ButtonReleaseMask)
GList *menu_frame_visible; GList *menu_frame_visible;
GHashTable *menu_frame_map;
static RrAppearance *a_sep;
static ObMenuEntryFrame* menu_entry_frame_new(ObMenuEntry *entry, static ObMenuEntryFrame* menu_entry_frame_new(ObMenuEntry *entry,
ObMenuFrame *frame); ObMenuFrame *frame);
@ -56,10 +58,18 @@ static Window createWindow(Window parent, gulong mask,
RrVisual(ob_rr_inst), mask, attrib); RrVisual(ob_rr_inst), mask, attrib);
} }
GHashTable *menu_frame_map;
void menu_frame_startup(gboolean reconfig) 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; if (reconfig) return;
menu_frame_map = g_hash_table_new(g_int_hash, g_int_equal); menu_frame_map = g_hash_table_new(g_int_hash, g_int_equal);
@ -67,6 +77,8 @@ void menu_frame_startup(gboolean reconfig)
void menu_frame_shutdown(gboolean reconfig) void menu_frame_shutdown(gboolean reconfig)
{ {
RrAppearanceFree(a_sep);
if (reconfig) return; if (reconfig) return;
g_hash_table_destroy(menu_frame_map); g_hash_table_destroy(menu_frame_map);
@ -338,7 +350,8 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self)
th = ob_rr_theme->menu_title_height; th = ob_rr_theme->menu_title_height;
} else { } else {
item_a = ob_rr_theme->a_menu_normal; item_a = ob_rr_theme->a_menu_normal;
th = SEPARATOR_HEIGHT + 2*PADDING; th = ob_rr_theme->menu_sep_width +
2*ob_rr_theme->menu_sep_paddingy;
} }
break; break;
default: default:
@ -442,26 +455,31 @@ static void menu_entry_frame_render(ObMenuEntryFrame *self)
ob_rr_theme->menu_title_height - ob_rr_theme->menu_title_height -
2*ob_rr_theme->paddingy); 2*ob_rr_theme->paddingy);
} else { } else {
RrAppearance *clear; gint i;
/* unlabeled separaator */ /* unlabeled separator */
XMoveResizeWindow(obt_display, self->text, PADDING, PADDING, XMoveResizeWindow(obt_display, self->text, 0, 0,
self->area.width - 2*PADDING, SEPARATOR_HEIGHT); self->area.width,
ob_rr_theme->menu_sep_width +
2*ob_rr_theme->menu_sep_paddingy);
clear = ob_rr_theme->a_clear_tex; a_sep->surface.parent = item_a;
RrAppearanceClearTextures(clear); a_sep->surface.parentx = 0;
clear->texture[0].type = RR_TEXTURE_LINE_ART; a_sep->surface.parenty = 0;
clear->surface.parent = item_a; for (i = 0; i < ob_rr_theme->menu_sep_width; ++i) {
clear->surface.parentx = PADDING; a_sep->texture[i].data.lineart.x1 =
clear->surface.parenty = PADDING; ob_rr_theme->menu_sep_paddingx;
clear->texture[0].data.lineart.color = a_sep->texture[i].data.lineart.y1 =
text_a->texture[0].data.text.color; ob_rr_theme->menu_sep_paddingy + i;
clear->texture[0].data.lineart.x1 = 2*PADDING; a_sep->texture[i].data.lineart.x2 =
clear->texture[0].data.lineart.y1 = SEPARATOR_HEIGHT/2; self->area.width - ob_rr_theme->menu_sep_paddingx - 1;
clear->texture[0].data.lineart.x2 = self->area.width - 4*PADDING; a_sep->texture[i].data.lineart.y2 =
clear->texture[0].data.lineart.y2 = SEPARATOR_HEIGHT/2; ob_rr_theme->menu_sep_paddingy + i;
RrPaint(clear, self->text, }
self->area.width - 2*PADDING, SEPARATOR_HEIGHT);
RrPaint(a_sep, self->text, self->area.width,
ob_rr_theme->menu_sep_width +
2*ob_rr_theme->menu_sep_paddingy);
} }
break; break;
} }
@ -597,7 +615,8 @@ static gint menu_entry_frame_get_height(ObMenuEntryFrame *self,
if (last_entry) if (last_entry)
h -= ob_rr_theme->mbwidth; h -= ob_rr_theme->mbwidth;
} else { } else {
h += SEPARATOR_HEIGHT; h += ob_rr_theme->menu_sep_width +
2*ob_rr_theme->menu_sep_paddingy - PADDING * 2;
} }
break; break;
} }
@ -728,7 +747,8 @@ void menu_frame_render(ObMenuFrame *self)
(ob_rr_theme->mbwidth - PADDING) *2; (ob_rr_theme->mbwidth - PADDING) *2;
} else { } else {
tw = 0; tw = 0;
th = SEPARATOR_HEIGHT; th = ob_rr_theme->menu_sep_width +
2*ob_rr_theme->menu_sep_paddingy - 2*PADDING;
} }
break; break;
} }

View file

@ -20,6 +20,7 @@
#include "openbox.h" #include "openbox.h"
#include "screen.h" #include "screen.h"
#include "client.h" #include "client.h"
#include "group.h"
#include "event.h" #include "event.h"
#include "obt/display.h" #include "obt/display.h"
#include "obt/keyboard.h" #include "obt/keyboard.h"
@ -433,7 +434,7 @@ static void render_all(ObPrompt *self)
render_button(self, &self->button[i]); render_button(self, &self->button[i]);
} }
void prompt_show(ObPrompt *self, ObClient *parent) void prompt_show(ObPrompt *self, ObClient *parent, gboolean modal)
{ {
gint i; gint i;
@ -455,8 +456,34 @@ void prompt_show(ObPrompt *self, ObClient *parent)
break; break;
} }
XSetTransientForHint(obt_display, self->super.window, if (parent) {
(parent ? parent->window : 0)); 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 */ /* set up the dialog and render it */
prompt_layout(self); prompt_layout(self);

View file

@ -100,7 +100,7 @@ void prompt_ref(ObPrompt *self);
void prompt_unref(ObPrompt *self); void prompt_unref(ObPrompt *self);
/*! Show the prompt. It will be centered within the given area rectangle */ /*! Show the prompt. It will be centered within the given area rectangle */
void prompt_show(ObPrompt *self, struct _ObClient *parent); void prompt_show(ObPrompt *self, struct _ObClient *parent, gboolean modal);
void prompt_hide(ObPrompt *self); void prompt_hide(ObPrompt *self);
gboolean prompt_key_event(ObPrompt *self, XEvent *e); gboolean prompt_key_event(ObPrompt *self, XEvent *e);

View file

@ -211,6 +211,17 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
if (!read_int(db, "window.client.padding.height", &theme->cbwidthy) || if (!read_int(db, "window.client.padding.height", &theme->cbwidthy) ||
theme->cbwidthy < 0 || theme->cbwidthy > 100) theme->cbwidthy < 0 || theme->cbwidthy > 100)
theme->cbwidthy = theme->cbwidthx; theme->cbwidthy = theme->cbwidthx;
if (!read_int(db, "menu.separator.width", &theme->menu_sep_width) ||
theme->menu_sep_width < 1 || theme->menu_sep_width > 100)
theme->menu_sep_width = 1;
if (!read_int(db, "menu.separator.padding.width",
&theme->menu_sep_paddingx) ||
theme->menu_sep_paddingx < 0 || theme->menu_sep_paddingx > 100)
theme->menu_sep_paddingx = 6;
if (!read_int(db, "menu.separator.padding.height",
&theme->menu_sep_paddingy) ||
theme->menu_sep_paddingy < 0 || theme->menu_sep_paddingy > 100)
theme->menu_sep_paddingy = 3;
/* load colors */ /* load colors */
if (!read_color(db, inst, if (!read_color(db, inst,
@ -408,6 +419,12 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
"menu.items.active.text.color", "menu.items.active.text.color",
&theme->menu_selected_color)) &theme->menu_selected_color))
theme->menu_selected_color = RrColorNew(inst, 0, 0, 0); theme->menu_selected_color = RrColorNew(inst, 0, 0, 0);
if (!read_color(db, inst,
"menu.separator.color", &theme->menu_sep_color))
theme->menu_sep_color = RrColorNew(inst,
theme->menu_color->r,
theme->menu_color->g,
theme->menu_color->b);
/* load the image masks */ /* load the image masks */
@ -1418,6 +1435,7 @@ void RrThemeFree(RrTheme *theme)
RrColorFree(theme->titlebut_focused_unpressed_color); RrColorFree(theme->titlebut_focused_unpressed_color);
RrColorFree(theme->titlebut_unfocused_unpressed_color); RrColorFree(theme->titlebut_unfocused_unpressed_color);
RrColorFree(theme->menu_title_color); RrColorFree(theme->menu_title_color);
RrColorFree(theme->menu_sep_color);
RrColorFree(theme->menu_color); RrColorFree(theme->menu_color);
RrColorFree(theme->menu_selected_color); RrColorFree(theme->menu_selected_color);
RrColorFree(theme->menu_disabled_color); RrColorFree(theme->menu_disabled_color);

View file

@ -47,6 +47,9 @@ struct _RrTheme {
gint cbwidthy; gint cbwidthy;
gint menu_overlap_x; gint menu_overlap_x;
gint menu_overlap_y; gint menu_overlap_y;
gint menu_sep_width;
gint menu_sep_paddingx;
gint menu_sep_paddingy;
/* these ones are calculated, not set directly by the theme file */ /* these ones are calculated, not set directly by the theme file */
gint win_font_height; gint win_font_height;
gint menu_title_font_height; gint menu_title_font_height;
@ -84,6 +87,7 @@ struct _RrTheme {
RrColor *titlebut_focused_unpressed_color; RrColor *titlebut_focused_unpressed_color;
RrColor *titlebut_unfocused_unpressed_color; RrColor *titlebut_unfocused_unpressed_color;
RrColor *menu_title_color; RrColor *menu_title_color;
RrColor *menu_sep_color;
RrColor *menu_color; RrColor *menu_color;
RrColor *menu_selected_color; RrColor *menu_selected_color;
RrColor *menu_disabled_color; RrColor *menu_disabled_color;