diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2016-08-18 19:47:00 +0300 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2016-08-18 19:47:00 +0300 |
commit | 14b3453bc325f25a135810ff53d562f831271856 (patch) | |
tree | 90a50af3d8eb9a2d5479f6abe0f998984794f5d3 /libmetacity | |
parent | 6a1e3c1b658e997049ae0ea36b05c7cc30033c28 (diff) | |
download | metacity-14b3453bc325f25a135810ff53d562f831271856.tar.gz |
libmetacity: add meta_theme_get_buttons
Diffstat (limited to 'libmetacity')
-rw-r--r-- | libmetacity/meta-theme.c | 58 | ||||
-rw-r--r-- | libmetacity/meta-theme.h | 2 |
2 files changed, 60 insertions, 0 deletions
diff --git a/libmetacity/meta-theme.c b/libmetacity/meta-theme.c index bd03f051..ccbd1100 100644 --- a/libmetacity/meta-theme.c +++ b/libmetacity/meta-theme.c @@ -625,6 +625,64 @@ meta_theme_get_button (MetaTheme *theme, return NULL; } +MetaButton ** +meta_theme_get_buttons (MetaTheme *theme) +{ + MetaButtonLayout *layout; + gint size; + MetaButton **retval; + gint index; + gint side; + + layout = theme->button_layout; + size = layout->n_left_buttons + layout->n_right_buttons + 1; + retval = g_new0 (MetaButton *, size); + index = 0; + + for (side = 0; side < 2; side++) + { + MetaButton *buttons; + gint n_buttons; + gint i; + + if (side == 0) + { + buttons = layout->left_buttons; + n_buttons = layout->n_left_buttons; + } + else if (side == 1) + { + buttons = layout->right_buttons; + n_buttons = layout->n_right_buttons; + } + else + { + g_assert_not_reached (); + } + + for (i = 0; i < n_buttons; i++) + { + MetaButton *btn; + GdkRectangle rect; + + btn = &buttons[i]; + rect = btn->rect.visible; + + if (!btn->visible || btn->type == META_BUTTON_TYPE_SPACER || + rect.width <= 0 || rect.height <= 0) + { + continue; + } + + retval[index++] = btn; + } + } + + retval[index] = NULL; + + return retval; +} + void meta_theme_set_composited (MetaTheme *theme, gboolean composited) diff --git a/libmetacity/meta-theme.h b/libmetacity/meta-theme.h index f3228d41..6cc136a4 100644 --- a/libmetacity/meta-theme.h +++ b/libmetacity/meta-theme.h @@ -117,6 +117,8 @@ MetaButton *meta_theme_get_button (MetaTheme *theme, gint x, gint y); +MetaButton **meta_theme_get_buttons (MetaTheme *theme); + void meta_theme_set_composited (MetaTheme *theme, gboolean composited); |