diff options
author | Denis Gorodnichev <[email protected]> | 2014-07-24 10:37:41 +0400 |
---|---|---|
committer | infirit <[email protected]> | 2014-11-25 18:06:24 +0100 |
commit | b25395fab6fe9ee38bc0cd359941d0a825d88451 (patch) | |
tree | e7b6720a543a00495fae1dd1423d652056bedb03 /src/ui/preview-widget.c | |
parent | b8d8e52f0effbf76ff909f88932098d4daf4336e (diff) | |
download | marco-b25395fab6fe9ee38bc0cd359941d0a825d88451.tar.bz2 marco-b25395fab6fe9ee38bc0cd359941d0a825d88451.tar.xz |
merge metacity(gtk3) changes
merge metacity(gtk3) changes
fix warnings
clean up unused variables
replace UNUSED_VARIABLE by G_GNUC_UNUSED
Diffstat (limited to 'src/ui/preview-widget.c')
-rw-r--r-- | src/ui/preview-widget.c | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c index 0bc6b42a..58122706 100644 --- a/src/ui/preview-widget.c +++ b/src/ui/preview-widget.c @@ -253,6 +253,66 @@ ensure_info (MetaPreview *preview) } #if GTK_CHECK_VERSION(3, 0, 0) +static gboolean +meta_preview_draw (GtkWidget *widget, + cairo_t *cr) +{ + MetaPreview *preview; + GtkAllocation allocation; + int border_width; + int client_width; + int client_height; + MetaButtonState button_states[META_BUTTON_TYPE_LAST] = + { + META_BUTTON_STATE_NORMAL, + META_BUTTON_STATE_NORMAL, + META_BUTTON_STATE_NORMAL, + META_BUTTON_STATE_NORMAL + }; + + g_return_val_if_fail (META_IS_PREVIEW (widget), FALSE); + + preview = META_PREVIEW (widget); + + ensure_info (preview); + + cairo_save (cr); + + border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); + + gtk_widget_get_allocation (widget, &allocation); + client_width = allocation.width - preview->left_width - preview->right_width - border_width * 2; + client_height = allocation.height - preview->top_height - preview->bottom_height - border_width * 2; + + if (client_width < 0) + client_width = 1; + if (client_height < 0) + client_height = 1; + + if (preview->theme) + { + border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); + + meta_theme_draw_frame (preview->theme, + widget, + cr, + preview->type, + preview->flags, + client_width, client_height, + preview->layout, + preview->text_height, + &preview->button_layout, + button_states, + meta_preview_get_mini_icon (), + meta_preview_get_icon ()); + } + + cairo_restore (cr); + + /* draw child */ + return GTK_WIDGET_CLASS (meta_preview_parent_class)->draw (widget, cr); +} + static void meta_preview_get_preferred_width (GtkWidget *widget, gint *minimum, @@ -325,66 +385,6 @@ meta_preview_get_preferred_height (GtkWidget *widget, *natural += border_width * 2; } -static gboolean -meta_preview_draw(GtkWidget *widget, - cairo_t *cr) -{ - MetaPreview *preview; - GtkAllocation allocation; - int border_width; - int client_width; - int client_height; - MetaButtonState button_states[META_BUTTON_TYPE_LAST] = - { - META_BUTTON_STATE_NORMAL, - META_BUTTON_STATE_NORMAL, - META_BUTTON_STATE_NORMAL, - META_BUTTON_STATE_NORMAL - }; - - g_return_val_if_fail (META_IS_PREVIEW (widget), FALSE); - - preview = META_PREVIEW (widget); - - ensure_info (preview); - - cairo_save (cr); - - border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); - - gtk_widget_get_allocation (widget, &allocation); - client_width = allocation.width - preview->left_width - preview->right_width - border_width * 2; - client_height = allocation.height - preview->top_height - preview->bottom_height - border_width * 2; - - if (client_width < 0) - client_width = 1; - if (client_height < 0) - client_height = 1; - - if (preview->theme) - { - border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); - - meta_theme_draw_frame (preview->theme, - widget, - cr, - preview->type, - preview->flags, - client_width, client_height, - preview->layout, - preview->text_height, - &preview->button_layout, - button_states, - meta_preview_get_mini_icon (), - meta_preview_get_icon ()); - } - - cairo_restore (cr); - - /* draw child */ - return GTK_WIDGET_CLASS (meta_preview_parent_class)->draw (widget, cr); -} - #else static gboolean |