[gimp] Bug 735891 - color areas in the color picker info window are half transparent
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 735891 - color areas in the color picker info window are half transparent
- Date: Tue, 27 Oct 2015 20:45:15 +0000 (UTC)
commit ace40d125deef8d419c4e8e3687405ccfd68674f
Author: Michael Natterer <mitch gimp org>
Date: Tue Oct 27 21:41:32 2015 +0100
Bug 735891 - color areas in the color picker info window are half transparent
Add code to GimpOverlayChild which can render arbitrary children of
the widget fully opaque, ignoring the configured opacity.
Add gimp_widget_get,set_fully_opaque() which gets/sets a per-widget
boolean flag to trigger that code.
Set the color picker's and the text tool style widget's color areas to
fully opaque.
app/tools/gimpcolorpickertool.c | 1 +
app/widgets/gimpoverlaychild.c | 44 +++++++++++++++++++++++++++++++++++++
app/widgets/gimptextstyleeditor.c | 2 +
app/widgets/gimpwidgets-utils.c | 20 ++++++++++++++++
app/widgets/gimpwidgets-utils.h | 6 ++++-
5 files changed, 72 insertions(+), 1 deletions(-)
---
diff --git a/app/tools/gimpcolorpickertool.c b/app/tools/gimpcolorpickertool.c
index 021575d..5670f50 100644
--- a/app/tools/gimpcolorpickertool.c
+++ b/app/tools/gimpcolorpickertool.c
@@ -371,6 +371,7 @@ gimp_color_picker_tool_info_create (GimpColorPickerTool *picker_tool)
gtk_widget_show (picker_tool->color_frame2);
frame = gtk_frame_new (NULL);
+ gimp_widget_set_fully_opaque (frame, TRUE);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
diff --git a/app/widgets/gimpoverlaychild.c b/app/widgets/gimpoverlaychild.c
index de9a7a7..44c3aaf 100644
--- a/app/widgets/gimpoverlaychild.c
+++ b/app/widgets/gimpoverlaychild.c
@@ -31,6 +31,7 @@
#include "gimpoverlaybox.h"
#include "gimpoverlaychild.h"
+#include "gimpwidgets-utils.h"
/* local function prototypes */
@@ -302,6 +303,42 @@ gimp_overlay_child_size_allocate (GimpOverlayBox *box,
gimp_overlay_child_invalidate (box, child);
}
+static void
+gimp_overlay_child_clip_fully_opaque (GimpOverlayChild *child,
+ GtkContainer *container,
+ cairo_t *cr)
+{
+ GList *children;
+ GList *list;
+
+ children = gtk_container_get_children (container);
+
+ for (list = children; list; list = g_list_next (list))
+ {
+ GtkWidget *widget = list->data;
+
+ if (gimp_widget_get_fully_opaque (widget))
+ {
+ GtkAllocation allocation;
+ gint x, y;
+
+ gtk_widget_get_allocation (widget, &allocation);
+ gtk_widget_translate_coordinates (widget, child->widget,
+ 0, 0, &x, &y);
+
+ cairo_rectangle (cr, x, y, allocation.width, allocation.height);
+ }
+ else if (GTK_IS_CONTAINER (widget))
+ {
+ gimp_overlay_child_clip_fully_opaque (child,
+ GTK_CONTAINER (widget),
+ cr);
+ }
+ }
+
+ g_list_free (children);
+}
+
gboolean
gimp_overlay_child_expose (GimpOverlayBox *box,
GimpOverlayChild *child,
@@ -341,6 +378,13 @@ gimp_overlay_child_expose (GimpOverlayBox *box,
cairo_transform (cr, &child->matrix);
gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
cairo_paint_with_alpha (cr, child->opacity);
+
+ gimp_overlay_child_clip_fully_opaque (child,
+ GTK_CONTAINER (child->widget),
+ cr);
+ cairo_clip (cr);
+ cairo_paint (cr);
+
cairo_destroy (cr);
}
}
diff --git a/app/widgets/gimptextstyleeditor.c b/app/widgets/gimptextstyleeditor.c
index 72c6e9b..ac94a19 100644
--- a/app/widgets/gimptextstyleeditor.c
+++ b/app/widgets/gimptextstyleeditor.c
@@ -41,6 +41,7 @@
#include "gimptextbuffer.h"
#include "gimptextstyleeditor.h"
#include "gimptexttag.h"
+#include "gimpwidgets-utils.h"
#include "gimp-intl.h"
@@ -247,6 +248,7 @@ gimp_text_style_editor_init (GimpTextStyleEditor *editor)
editor->color_button = gimp_color_panel_new (_("Change color of selected text"),
&color,
GIMP_COLOR_AREA_FLAT, 20, 20);
+ gimp_widget_set_fully_opaque (editor->color_button, TRUE);
gtk_box_pack_end (GTK_BOX (editor->lower_hbox), editor->color_button,
FALSE, FALSE, 0);
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index d28ede1..263b837 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -1264,6 +1264,26 @@ gimp_widget_flush_expose (GtkWidget *widget)
gdk_flush ();
}
+gboolean
+gimp_widget_get_fully_opaque (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+ return g_object_get_data (G_OBJECT (widget),
+ "gimp-widget-fully-opaque") != NULL;
+}
+
+void
+gimp_widget_set_fully_opaque (GtkWidget *widget,
+ gboolean fully_opaque)
+{
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ return g_object_set_data (G_OBJECT (widget),
+ "gimp-widget-fully-opaque",
+ GINT_TO_POINTER (fully_opaque));
+}
+
static gboolean
gimp_print_event_free (gpointer data)
{
diff --git a/app/widgets/gimpwidgets-utils.h b/app/widgets/gimpwidgets-utils.h
index 3bed890..e2a3f59 100644
--- a/app/widgets/gimpwidgets-utils.h
+++ b/app/widgets/gimpwidgets-utils.h
@@ -97,12 +97,16 @@ GtkWidget * gimp_dock_with_window_new (GimpDialogFactory *factor
GdkScreen *screen,
gint monitor,
gboolean toolbox);
-GtkWidget * gimp_tools_get_tool_options_gui (GimpToolOptions *tool_options);
+GtkWidget * gimp_tools_get_tool_options_gui (GimpToolOptions *tool_options);
void gimp_tools_set_tool_options_gui (GimpToolOptions *tool_options,
GtkWidget *widget);
void gimp_widget_flush_expose (GtkWidget *widget);
+gboolean gimp_widget_get_fully_opaque (GtkWidget *widget);
+void gimp_widget_set_fully_opaque (GtkWidget *widget,
+ gboolean fully_opaque);
+
const gchar * gimp_print_event (const GdkEvent *event);
void gimp_session_write_position (GimpConfigWriter *writer,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]