limit menus' width to 400px
This commit is contained in:
parent
eb603bf118
commit
8419fe8a11
1 changed files with 4 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#define PADDING 2
|
#define PADDING 2
|
||||||
#define SEPARATOR_HEIGHT 3
|
#define SEPARATOR_HEIGHT 3
|
||||||
|
#define MAX_MENU_WIDTH 400
|
||||||
|
|
||||||
#define FRAME_EVENTMASK (ButtonPressMask |ButtonMotionMask | EnterWindowMask |\
|
#define FRAME_EVENTMASK (ButtonPressMask |ButtonMotionMask | EnterWindowMask |\
|
||||||
LeaveWindowMask)
|
LeaveWindowMask)
|
||||||
|
@ -369,6 +370,7 @@ static void menu_frame_render(ObMenuFrame *self)
|
||||||
|
|
||||||
self->a_title->texture[0].data.text.string = self->menu->title;
|
self->a_title->texture[0].data.text.string = self->menu->title;
|
||||||
RrMinsize(self->a_title, &tw, &th);
|
RrMinsize(self->a_title, &tw, &th);
|
||||||
|
tw = MIN(tw, MAX_MENU_WIDTH);
|
||||||
tw += 2*PADDING;
|
tw += 2*PADDING;
|
||||||
th += 2*PADDING;
|
th += 2*PADDING;
|
||||||
w = MAX(w, tw);
|
w = MAX(w, tw);
|
||||||
|
@ -408,6 +410,7 @@ static void menu_frame_render(ObMenuFrame *self)
|
||||||
case OB_MENU_ENTRY_TYPE_NORMAL:
|
case OB_MENU_ENTRY_TYPE_NORMAL:
|
||||||
text_a->texture[0].data.text.string = e->entry->data.normal.label;
|
text_a->texture[0].data.text.string = e->entry->data.normal.label;
|
||||||
RrMinsize(text_a, &tw, &th);
|
RrMinsize(text_a, &tw, &th);
|
||||||
|
tw = MIN(tw, MAX_MENU_WIDTH);
|
||||||
|
|
||||||
if (e->entry->data.normal.icon_data ||
|
if (e->entry->data.normal.icon_data ||
|
||||||
e->entry->data.normal.mask)
|
e->entry->data.normal.mask)
|
||||||
|
@ -417,6 +420,7 @@ static void menu_frame_render(ObMenuFrame *self)
|
||||||
sub = e->entry->data.submenu.submenu;
|
sub = e->entry->data.submenu.submenu;
|
||||||
text_a->texture[0].data.text.string = sub ? sub->title : "";
|
text_a->texture[0].data.text.string = sub ? sub->title : "";
|
||||||
RrMinsize(text_a, &tw, &th);
|
RrMinsize(text_a, &tw, &th);
|
||||||
|
tw = MIN(tw, MAX_MENU_WIDTH);
|
||||||
|
|
||||||
if (e->entry->data.normal.icon_data ||
|
if (e->entry->data.normal.icon_data ||
|
||||||
e->entry->data.normal.mask)
|
e->entry->data.normal.mask)
|
||||||
|
|
Loading…
Reference in a new issue