From 8c8a67f1ad68d22e774e4afddf1f4d491bf94b7d Mon Sep 17 00:00:00 2001 From: rwst Date: Sun, 21 May 2006 15:50:27 +0000 Subject: [PATCH] guard callback, catch release event, set _rgba: fixes #1491876, #1492332 --- src/ui/widget/color-picker.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ui/widget/color-picker.cpp b/src/ui/widget/color-picker.cpp index 883370aec..f79334e31 100644 --- a/src/ui/widget/color-picker.cpp +++ b/src/ui/widget/color-picker.cpp @@ -21,6 +21,8 @@ #include "color-picker.h" +static bool _in_use = false; + namespace Inkscape { namespace UI { namespace Widget { @@ -58,6 +60,8 @@ ColorPicker::setupDialog(const Glib::ustring &title) g_signal_connect(G_OBJECT(_colorSelector), "dragged", G_CALLBACK(sp_color_picker_color_mod), (void *)this); + g_signal_connect(G_OBJECT(_colorSelector), "released", + G_CALLBACK(sp_color_picker_color_mod), (void *)this); g_signal_connect(G_OBJECT(_colorSelector), "changed", G_CALLBACK(sp_color_picker_color_mod), (void *)this); @@ -71,6 +75,8 @@ ColorPicker::setupDialog(const Glib::ustring &title) void ColorPicker::setRgba32 (guint32 rgba) { + if (_in_use) return; + _preview.setRgba32 (rgba); _rgba = rgba; if (_colorSelector) @@ -107,6 +113,9 @@ ColorPicker::on_changed (guint32) void sp_color_picker_color_mod(SPColorSelector *csel, GObject *cp) { + if (_in_use) return; + else _in_use = true; + SPColor color; float alpha; csel->base->getColorAlpha(color, &alpha); @@ -120,7 +129,9 @@ sp_color_picker_color_mod(SPColorSelector *csel, GObject *cp) sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP)); ptr->on_changed (rgba); + _in_use = false; ptr->_changed_signal.emit (rgba); + ptr->_rgba = rgba; } -- 2.30.2