diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2016-08-18 18:54:38 +0300 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2016-08-18 19:05:19 +0300 |
commit | 2ee0ffbee0b52cb8fc3112906bea1eaa737559f7 (patch) | |
tree | 4b0276b21d5565933cdac49d6a81e8fbe5d4c975 /libmetacity | |
parent | dfa271fab6c2af18e7f0a320062fecb9a2bcb66c (diff) | |
download | metacity-2ee0ffbee0b52cb8fc3112906bea1eaa737559f7.tar.gz |
libmetacity: don't expose MetaButton struct
Diffstat (limited to 'libmetacity')
-rw-r--r-- | libmetacity/Makefile.am | 1 | ||||
-rw-r--r-- | libmetacity/meta-button-layout-private.h | 2 | ||||
-rw-r--r-- | libmetacity/meta-button-private.h | 22 | ||||
-rw-r--r-- | libmetacity/meta-button.c | 33 | ||||
-rw-r--r-- | libmetacity/meta-button.h | 21 | ||||
-rw-r--r-- | libmetacity/meta-theme.c | 14 | ||||
-rw-r--r-- | libmetacity/meta-theme.h | 5 |
7 files changed, 68 insertions, 30 deletions
diff --git a/libmetacity/Makefile.am b/libmetacity/Makefile.am index c26d310f..3620645f 100644 --- a/libmetacity/Makefile.am +++ b/libmetacity/Makefile.am @@ -3,6 +3,7 @@ NULL = lib_LTLIBRARIES = libmetacity.la libmetacity_la_SOURCES = \ + meta-button.c \ meta-button.h \ meta-button-layout.c \ meta-button-layout-private.h \ diff --git a/libmetacity/meta-button-layout-private.h b/libmetacity/meta-button-layout-private.h index 4926b1dc..d4397ef6 100644 --- a/libmetacity/meta-button-layout-private.h +++ b/libmetacity/meta-button-layout-private.h @@ -19,7 +19,7 @@ #ifndef META_BUTTON_LAYOUT_PRIVATE_H #define META_BUTTON_LAYOUT_PRIVATE_H -#include "meta-button.h" +#include "meta-button-private.h" G_BEGIN_DECLS diff --git a/libmetacity/meta-button-private.h b/libmetacity/meta-button-private.h index d6e2ec6d..f849e086 100644 --- a/libmetacity/meta-button-private.h +++ b/libmetacity/meta-button-private.h @@ -18,7 +18,7 @@ #ifndef META_BUTTON_PRIVATE_H #define META_BUTTON_PRIVATE_H -#include <glib.h> +#include "meta-button.h" G_BEGIN_DECLS @@ -47,6 +47,26 @@ typedef enum META_BUTTON_FUNCTION_LAST } MetaButtonFunction; +struct _MetaButton +{ + MetaButtonType type; + MetaButtonState state; + + /* The computed size of a button (really just a way of tying its visible + * and clickable areas together). The reason for two different rectangles + * here is Fitts' law & maximized windows; See bug #97703 for more details. + */ + struct { + /* The area where the button's image is drawn. */ + GdkRectangle visible; + + /* The area where the button can be activated by clicking */ + GdkRectangle clickable; + } rect; + + gboolean visible; +}; + G_END_DECLS #endif diff --git a/libmetacity/meta-button.c b/libmetacity/meta-button.c new file mode 100644 index 00000000..e3d4e769 --- /dev/null +++ b/libmetacity/meta-button.c @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2016 Alberts Muktupāvels + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "config.h" + +#include "meta-button-private.h" + +MetaButtonType +meta_button_get_type (MetaButton *button) +{ + return button->type; +} + +void +meta_button_get_event_rect (MetaButton *button, + GdkRectangle *rect) +{ + *rect = button->rect.clickable; +} diff --git a/libmetacity/meta-button.h b/libmetacity/meta-button.h index a087e147..9edf2753 100644 --- a/libmetacity/meta-button.h +++ b/libmetacity/meta-button.h @@ -48,25 +48,12 @@ typedef enum META_BUTTON_STATE_LAST } MetaButtonState; -typedef struct -{ - MetaButtonType type; - MetaButtonState state; - - /* The computed size of a button (really just a way of tying its visible - * and clickable areas together). The reason for two different rectangles - * here is Fitts' law & maximized windows; See bug #97703 for more details. - */ - struct { - /* The area where the button's image is drawn. */ - GdkRectangle visible; +typedef struct _MetaButton MetaButton; - /* The area where the button can be activated by clicking */ - GdkRectangle clickable; - } rect; +MetaButtonType meta_button_get_type (MetaButton *button); - gboolean visible; -} MetaButton; +void meta_button_get_event_rect (MetaButton *button, + GdkRectangle *rect); G_END_DECLS diff --git a/libmetacity/meta-theme.c b/libmetacity/meta-theme.c index 7084ef49..bd03f051 100644 --- a/libmetacity/meta-theme.c +++ b/libmetacity/meta-theme.c @@ -570,11 +570,10 @@ meta_theme_set_button_layout (MetaTheme *theme, theme->button_layout = meta_button_layout_new (button_layout, invert); } -gboolean -meta_theme_get_button (MetaTheme *theme, - gint x, - gint y, - MetaButton *button) +MetaButton * +meta_theme_get_button (MetaTheme *theme, + gint x, + gint y) { gint side; @@ -618,13 +617,12 @@ meta_theme_get_button (MetaTheme *theme, if (x >= rect.x && x < (rect.x + rect.width) && y >= rect.y && y < (rect.y + rect.height)) { - *button = *btn; - return TRUE; + return btn; } } } - return FALSE; + return NULL; } void diff --git a/libmetacity/meta-theme.h b/libmetacity/meta-theme.h index 4174ffe6..f3228d41 100644 --- a/libmetacity/meta-theme.h +++ b/libmetacity/meta-theme.h @@ -113,10 +113,9 @@ void meta_theme_set_button_layout (MetaTheme *theme, const gchar *button_layout, gboolean invert); -gboolean meta_theme_get_button (MetaTheme *theme, +MetaButton *meta_theme_get_button (MetaTheme *theme, gint x, - gint y, - MetaButton *button); + gint y); void meta_theme_set_composited (MetaTheme *theme, gboolean composited); |