[gnome-panel] panel: Fix rendering of the handle in the applet frame widget
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] panel: Fix rendering of the handle in the applet frame widget
- Date: Fri, 2 Mar 2012 15:26:13 +0000 (UTC)
commit 3f7d6221a1629b184c88dfa4993f2ce48a90e555
Author: Peter Hurley <peter hurleysoftware com>
Date: Mon Jan 23 23:05:56 2012 -0500
panel: Fix rendering of the handle in the applet frame widget
We were not drawing the handle with the right rectangle.
We also need to re-scale the background pattern to the rendering
rectangle.
https://bugzilla.gnome.org/show_bug.cgi?id=668573
gnome-panel/panel-applet-frame.c | 42 ++++++++++++++++++++++++++++---------
1 files changed, 32 insertions(+), 10 deletions(-)
---
diff --git a/gnome-panel/panel-applet-frame.c b/gnome-panel/panel-applet-frame.c
index a26a254..c6c6db4 100644
--- a/gnome-panel/panel-applet-frame.c
+++ b/gnome-panel/panel-applet-frame.c
@@ -93,6 +93,9 @@ panel_applet_frame_draw (GtkWidget *widget,
{
PanelAppletFrame *frame = PANEL_APPLET_FRAME (widget);
GtkStyleContext *context;
+ GtkStateFlags state;
+ cairo_pattern_t *bg_pattern;
+ PanelBackground *background;
if (GTK_WIDGET_CLASS (panel_applet_frame_parent_class)->draw)
GTK_WIDGET_CLASS (panel_applet_frame_parent_class)->draw (widget, cr);
@@ -101,20 +104,39 @@ panel_applet_frame_draw (GtkWidget *widget,
return FALSE;
context = gtk_widget_get_style_context (widget);
+ state = gtk_widget_get_state_flags (widget);
gtk_style_context_save (context);
- gtk_style_context_set_state (context, gtk_widget_get_state_flags (widget));
+ gtk_style_context_set_state (context, state);
cairo_save (cr);
- cairo_rectangle (cr,
- frame->priv->handle_rect.x,
- frame->priv->handle_rect.y,
- frame->priv->handle_rect.width,
- frame->priv->handle_rect.height);
- cairo_clip (cr);
+
+ /* Set the pattern transform so as to correctly render a patterned
+ * background with the handle */
+ gtk_style_context_get (context, state,
+ "background-image", &bg_pattern,
+ NULL);
+ background = &frame->priv->panel->background;
+
+ if (bg_pattern && (background->type == PANEL_BACK_IMAGE ||
+ (background->type == PANEL_BACK_COLOR && background->has_alpha))) {
+ cairo_matrix_t ptm;
+
+ cairo_matrix_init_translate (&ptm,
+ frame->priv->handle_rect.x,
+ frame->priv->handle_rect.y);
+ cairo_matrix_scale (&ptm,
+ frame->priv->handle_rect.width,
+ frame->priv->handle_rect.height);
+ cairo_pattern_set_matrix (bg_pattern, &ptm);
+ cairo_pattern_destroy (bg_pattern);
+ }
+
gtk_render_handle (context, cr,
- 0, 0,
- gtk_widget_get_allocated_width (widget),
- gtk_widget_get_allocated_height (widget));
+ frame->priv->handle_rect.x,
+ frame->priv->handle_rect.y,
+ frame->priv->handle_rect.width,
+ frame->priv->handle_rect.height);
+
cairo_restore (cr);
gtk_style_context_restore (context);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]