diff options
author | Nelson Marques <[email protected]> | 2012-10-16 17:34:30 +0100 |
---|---|---|
committer | Nelson Marques <[email protected]> | 2012-10-16 17:34:30 +0100 |
commit | 354fc0e850efbfa44065bcd2f9f3fb1b2267f135 (patch) | |
tree | 3b9c065518d608a4597c473b14848983ad70bf93 | |
parent | 23656ae5a7fa38ab90cb35fe9ad2604253fb1185 (diff) | |
download | marco-354fc0e850efbfa44065bcd2f9f3fb1b2267f135.tar.bz2 marco-354fc0e850efbfa44065bcd2f9f3fb1b2267f135.tar.xz |
improve button theming - taken from Ubuntu
-rw-r--r-- | src/ui/theme.c | 52 | ||||
-rw-r--r-- | src/ui/theme.h | 2 |
2 files changed, 29 insertions, 25 deletions
diff --git a/src/ui/theme.c b/src/ui/theme.c index 63103960..f8579f1a 100644 --- a/src/ui/theme.c +++ b/src/ui/theme.c @@ -705,8 +705,14 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, for (i = 0; i < n_left; i++) { - if (i == 0) /* prefer left background if only one button */ - left_bg_rects[i] = &fgeom->left_left_background; + if (i == 0) /* For the first button (From left to right) */ + { + if (n_left > 1) /* Set left_left_background + if we have more than one button */ + left_bg_rects[i] = &fgeom->left_left_background; + else /* No background if we have only one single button */ + left_bg_rects[i] = &fgeom->left_single_background; + } else if (i == (n_left - 1)) left_bg_rects[i] = &fgeom->left_right_background; else @@ -715,9 +721,14 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, for (i = 0; i < n_right; i++) { - /* prefer right background if only one button */ - if (i == (n_right - 1)) - right_bg_rects[i] = &fgeom->right_right_background; + if (i == (n_right - 1)) /* For the first button (From right to left) */ + { + if (n_right > 1) /* Set right_right_background + if we have more than one button */ + right_bg_rects[i] = &fgeom->right_right_background; + else /* No background if we have only one single button */ + right_bg_rects[i] = &fgeom->right_single_background; + } else if (i == 0) right_bg_rects[i] = &fgeom->right_left_background; else @@ -839,9 +850,9 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, if (flags & META_FRAME_MAXIMIZED) { rect->clickable.x = rect->visible.x; - rect->clickable.y = 0; - rect->clickable.width = rect->visible.width; - rect->clickable.height = button_height + button_y; + rect->clickable.y = rect->visible.y; + rect->clickable.width = button_width; + rect->clickable.height = button_height; if (i == n_right - 1) rect->clickable.width += layout->right_titlebar_edge + layout->right_width + layout->button_border.right; @@ -877,22 +888,13 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, if (flags & META_FRAME_MAXIMIZED) { - if (i==0) - { - rect->clickable.x = 0; - rect->clickable.width = button_width + x; - } - else - { - rect->clickable.x = rect->visible.x; - rect->clickable.width = button_width; - } - - rect->clickable.y = 0; - rect->clickable.height = button_height + button_y; - } - else - g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable)); + rect->clickable.x = rect->visible.x; + rect->clickable.y = rect->visible.y; + rect->clickable.width = button_width; + rect->clickable.height = button_height; + } + else + g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable)); x = rect->visible.x + rect->visible.width + layout->button_border.right; @@ -4542,7 +4544,7 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style, /* MIDDLE_BACKGROUND type may get drawn more than once */ if ((j == META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND || j == META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND) && - middle_bg_offset < MAX_MIDDLE_BACKGROUNDS) + (middle_bg_offset < (MAX_MIDDLE_BACKGROUNDS - 1))) { ++middle_bg_offset; } diff --git a/src/ui/theme.h b/src/ui/theme.h index 4df8b00e..afad3cb2 100644 --- a/src/ui/theme.h +++ b/src/ui/theme.h @@ -200,9 +200,11 @@ struct _MetaFrameGeometry MetaButtonSpace unstick_rect; #define MAX_MIDDLE_BACKGROUNDS (MAX_BUTTONS_PER_CORNER - 2) + GdkRectangle left_single_background; GdkRectangle left_left_background; GdkRectangle left_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS]; GdkRectangle left_right_background; + GdkRectangle right_single_background; GdkRectangle right_left_background; GdkRectangle right_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS]; GdkRectangle right_right_background; |