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.
This commit is contained in:
Michael Natterer
2015-10-27 21:41:32 +01:00
parent 6ad5530408
commit ace40d125d
5 changed files with 72 additions and 1 deletions

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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)
{

View File

@ -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,