split menu overlap into x and y components

This commit is contained in:
Dana Jansens 2008-02-11 22:10:21 -05:00 committed by Mikael Magnusson
parent 6bda8c2903
commit 8186a81fe0
3 changed files with 16 additions and 9 deletions

View file

@ -249,23 +249,24 @@ static void menu_frame_place_topmenu(ObMenuFrame *self, gint *x, gint *y)
static void menu_frame_place_submenu(ObMenuFrame *self, gint *x, gint *y) static void menu_frame_place_submenu(ObMenuFrame *self, gint *x, gint *y)
{ {
gint overlap; gint overlapx, overlapy;
gint bwidth; gint bwidth;
overlap = ob_rr_theme->menu_overlap; overlapx = ob_rr_theme->menu_overlap_x;
overlapy = ob_rr_theme->menu_overlap_y;
bwidth = ob_rr_theme->mbwidth; bwidth = ob_rr_theme->mbwidth;
if (self->direction_right) if (self->direction_right)
*x = self->parent->area.x + self->parent->area.width - *x = self->parent->area.x + self->parent->area.width -
overlap - bwidth; overlapx - bwidth;
else else
*x = self->parent->area.x - self->area.width + overlap + bwidth; *x = self->parent->area.x - self->area.width + overlapx + bwidth;
*y = self->parent->area.y + self->parent_entry->area.y; *y = self->parent->area.y + self->parent_entry->area.y;
if (config_menu_middle) if (config_menu_middle)
*y -= (self->area.height - (bwidth * 2) - ITEM_HEIGHT) / 2; *y -= (self->area.height - (bwidth * 2) - ITEM_HEIGHT) / 2;
else else
*y += overlap; *y += overlapy;
} }
void menu_frame_move_on_screen(ObMenuFrame *self, gint x, gint y, void menu_frame_move_on_screen(ObMenuFrame *self, gint x, gint y,

View file

@ -177,9 +177,14 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name,
theme->osd_font = RrFontOpenDefault(inst); theme->osd_font = RrFontOpenDefault(inst);
/* load direct dimensions */ /* load direct dimensions */
if (!read_int(db, "menu.overlap", &theme->menu_overlap) || if ((!read_int(db, "menu.overlap.x", &theme->menu_overlap_x) &&
theme->menu_overlap < -100 || theme->menu_overlap > 100) !read_int(db, "menu.overlap", &theme->menu_overlap_x)) ||
theme->menu_overlap = 0; theme->menu_overlap_x < -100 || theme->menu_overlap_x > 100)
theme->menu_overlap_x = 0;
if ((!read_int(db, "menu.overlap.y", &theme->menu_overlap_y) &&
!read_int(db, "menu.overlap", &theme->menu_overlap_y)) ||
theme->menu_overlap_y < -100 || theme->menu_overlap_y > 100)
theme->menu_overlap_y = 0;
if (!read_int(db, "window.handle.width", &theme->handle_height) || if (!read_int(db, "window.handle.width", &theme->handle_height) ||
theme->handle_height < 0 || theme->handle_height > 100) theme->handle_height < 0 || theme->handle_height > 100)
theme->handle_height = 6; theme->handle_height = 6;

View file

@ -45,7 +45,8 @@ struct _RrTheme {
gint obwidth; /*!< osd border width */ gint obwidth; /*!< osd border width */
gint cbwidthx; gint cbwidthx;
gint cbwidthy; gint cbwidthy;
gint menu_overlap; gint menu_overlap_x;
gint menu_overlap_y;
/* 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;