[gimp] app: derive GimpFgBgEditor from GtkEventBox instead of GtkDrawingArea
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: derive GimpFgBgEditor from GtkEventBox instead of GtkDrawingArea
- Date: Fri, 19 May 2017 10:03:41 +0000 (UTC)
commit 81fe78bd9b292fb5e062dd5a3b5a284aa7b413d3
Author: Michael Natterer <mitch gimp org>
Date: Fri May 19 12:02:48 2017 +0200
app: derive GimpFgBgEditor from GtkEventBox instead of GtkDrawingArea
it doesn't need a visible GdkWindow.
app/widgets/gimpfgbgeditor.c | 14 +++++++++-----
app/widgets/gimpfgbgeditor.h | 4 ++--
2 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/app/widgets/gimpfgbgeditor.c b/app/widgets/gimpfgbgeditor.c
index 96c935d..d06dede 100644
--- a/app/widgets/gimpfgbgeditor.c
+++ b/app/widgets/gimpfgbgeditor.c
@@ -102,7 +102,7 @@ static void gimp_fg_bg_editor_create_transform (GimpFgBgEditor *editor);
static void gimp_fg_bg_editor_destroy_transform (GimpFgBgEditor *editor);
-G_DEFINE_TYPE (GimpFgBgEditor, gimp_fg_bg_editor, GTK_TYPE_DRAWING_AREA)
+G_DEFINE_TYPE (GimpFgBgEditor, gimp_fg_bg_editor, GTK_TYPE_EVENT_BOX)
#define parent_class gimp_fg_bg_editor_parent_class
@@ -154,6 +154,8 @@ gimp_fg_bg_editor_init (GimpFgBgEditor *editor)
{
editor->active_color = GIMP_ACTIVE_COLOR_FOREGROUND;
+ gtk_event_box_set_visible_window (GTK_EVENT_BOX (editor), FALSE);
+
gtk_widget_add_events (GTK_WIDGET (editor),
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK);
@@ -276,7 +278,6 @@ gimp_fg_bg_editor_expose (GtkWidget *widget,
return FALSE;
cr = gdk_cairo_create (eevent->window);
-
gdk_cairo_region (cr, eevent->region);
cairo_clip (cr);
@@ -285,6 +286,8 @@ gimp_fg_bg_editor_expose (GtkWidget *widget,
width = allocation.width;
height = allocation.height;
+ cairo_translate (cr, allocation.x, allocation.y);
+
/* draw the default colors pixbuf */
if (! editor->default_icon)
editor->default_icon = gimp_widget_load_icon (widget,
@@ -384,8 +387,8 @@ gimp_fg_bg_editor_expose (GtkWidget *widget,
editor->active_color == GIMP_ACTIVE_COLOR_FOREGROUND ?
GTK_SHADOW_OUT : GTK_SHADOW_IN,
NULL, widget, NULL,
- (width - rect_w),
- (height - rect_h),
+ allocation.x + (width - rect_w),
+ allocation.y + (height - rect_h),
rect_w, rect_h);
@@ -434,7 +437,8 @@ gimp_fg_bg_editor_expose (GtkWidget *widget,
editor->active_color == GIMP_ACTIVE_COLOR_BACKGROUND ?
GTK_SHADOW_OUT : GTK_SHADOW_IN,
NULL, widget, NULL,
- 0, 0,
+ allocation.x,
+ allocation.y,
rect_w, rect_h);
cairo_destroy (cr);
diff --git a/app/widgets/gimpfgbgeditor.h b/app/widgets/gimpfgbgeditor.h
index 19b57e5..ebb9643 100644
--- a/app/widgets/gimpfgbgeditor.h
+++ b/app/widgets/gimpfgbgeditor.h
@@ -34,7 +34,7 @@ typedef struct _GimpFgBgEditorClass GimpFgBgEditorClass;
struct _GimpFgBgEditor
{
- GtkDrawingArea parent_instance;
+ GtkEventBox parent_instance;
GimpContext *context;
GimpColorConfig *color_config;
@@ -52,7 +52,7 @@ struct _GimpFgBgEditor
struct _GimpFgBgEditorClass
{
- GtkDrawingAreaClass parent_class;
+ GtkEventBoxClass parent_class;
/* signals */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]