diff options
author | Nelson Marques <[email protected]> | 2012-10-16 09:48:54 -0700 |
---|---|---|
committer | Nelson Marques <[email protected]> | 2012-10-16 09:48:54 -0700 |
commit | cab5893d5e33fa40a14ca3a471c03532075f73c3 (patch) | |
tree | 3b9c065518d608a4597c473b14848983ad70bf93 /src/ui/theme.c | |
parent | 23656ae5a7fa38ab90cb35fe9ad2604253fb1185 (diff) | |
parent | 354fc0e850efbfa44065bcd2f9f3fb1b2267f135 (diff) | |
download | marco-cab5893d5e33fa40a14ca3a471c03532075f73c3.tar.bz2 marco-cab5893d5e33fa40a14ca3a471c03532075f73c3.tar.xz |
Merge pull request #17 from ketheriel/master
improve support for button layout (ported from Ubuntu)
Diffstat (limited to 'src/ui/theme.c')
-rw-r--r-- | src/ui/theme.c | 52 |
1 files changed, 27 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; } |