summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorLiam P. White <inkscapebronyat-signgmaildotcom>2014-03-30 00:42:24 +0000
committerLiam P. White <inkscapebronyat-signgmaildotcom>2014-03-30 00:42:24 +0000
commit189ec94a227498b9d1e3f720bddd4099e9de8652 (patch)
tree89278142aafd94d61b00109c316e8e2a82ab1d4c /src/ui
parentMinor fixes (diff)
parentRemoved obsolete header file. (diff)
downloadinkscape-189ec94a227498b9d1e3f720bddd4099e9de8652.tar.gz
inkscape-189ec94a227498b9d1e3f720bddd4099e9de8652.zip
Update to trunk
(bzr r13090.1.38)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/dialog.cpp4
-rw-r--r--src/ui/dialog/guides.cpp43
-rw-r--r--src/ui/dialog/guides.h2
-rw-r--r--src/ui/dialog/pixelartdialog.cpp152
-rw-r--r--src/ui/tools/connector-tool.cpp22
-rw-r--r--src/ui/tools/pencil-tool.cpp21
-rw-r--r--src/ui/tools/pencil-tool.h4
-rw-r--r--src/ui/tools/tool-base.cpp2
-rw-r--r--src/ui/tools/tool-base.h2
9 files changed, 160 insertions, 92 deletions
diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp
index 3cc3f3d88..645294bb5 100644
--- a/src/ui/dialog/dialog.cpp
+++ b/src/ui/dialog/dialog.cpp
@@ -26,11 +26,11 @@
#include "ui/tools/tool-base.h"
#include "desktop.h"
#include "desktop-handles.h"
-#include "modifier-fns.h"
#include "shortcuts.h"
#include "preferences.h"
#include "interface.h"
#include "verbs.h"
+#include "ui/tool/event-utils.h"
#include <gtk/gtk.h>
@@ -279,7 +279,7 @@ bool Dialog::_onEvent(GdkEvent *event)
case GDK_KEY_F4:
case GDK_KEY_w:
case GDK_KEY_W: {
- if (mod_ctrl_only(event->key.state)) {
+ if (Inkscape::UI::held_only_control(event->key)) {
_close();
ret = true;
}
diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp
index e84f25733..80740113c 100644
--- a/src/ui/dialog/guides.cpp
+++ b/src/ui/dialog/guides.cpp
@@ -68,20 +68,6 @@ void GuidelinePropertiesDialog::showDialog(SPGuide *guide, SPDesktop *desktop) {
dialog.run();
}
-void GuidelinePropertiesDialog::_colorChanged()
-{
-#if WITH_GTKMM_3_0
- const Gdk::RGBA c = _color.get_rgba();
- unsigned r = c.get_red_u()/257, g = c.get_green_u()/257, b = c.get_blue_u()/257;
-#else
- const Gdk::Color c = _color.get_color();
- unsigned r = c.get_red()/257, g = c.get_green()/257, b = c.get_blue()/257;
-#endif
- //TODO: why 257? verify this!
-
- sp_guide_set_color(*_guide, r, g, b, true);
-}
-
void GuidelinePropertiesDialog::_modeChanged()
{
_mode = !_relative_toggle.get_active();
@@ -100,7 +86,7 @@ void GuidelinePropertiesDialog::_modeChanged()
}
}
-void GuidelinePropertiesDialog::_onApply()
+void GuidelinePropertiesDialog::_onOK()
{
double deg_angle = _spin_angle.getValue(DEG);
if (!_mode)
@@ -124,18 +110,26 @@ void GuidelinePropertiesDialog::_onApply()
sp_guide_moveto(*_guide, newpos, true);
- const gchar* name = _label_entry.getEntry()->get_text().c_str();
+ const gchar* name = g_strdup( _label_entry.getEntry()->get_text().c_str() );
+
sp_guide_set_label(*_guide, name, true);
+ g_free((gpointer) name);
+
+#if WITH_GTKMM_3_0
+ const Gdk::RGBA c = _color.get_rgba();
+ unsigned r = c.get_red_u()/257, g = c.get_green_u()/257, b = c.get_blue_u()/257;
+#else
+ const Gdk::Color c = _color.get_color();
+ unsigned r = c.get_red()/257, g = c.get_green()/257, b = c.get_blue()/257;
+#endif
+ //TODO: why 257? verify this!
+
+ sp_guide_set_color(*_guide, r, g, b, true);
DocumentUndo::done(_guide->document, SP_VERB_NONE,
_("Set guide properties"));
}
-void GuidelinePropertiesDialog::_onOK()
-{
- _onApply();
-}
-
void GuidelinePropertiesDialog::_onDelete()
{
SPDocument *doc = _guide->document;
@@ -157,10 +151,6 @@ void GuidelinePropertiesDialog::_response(gint response)
break;
case Gtk::RESPONSE_DELETE_EVENT:
break;
-/* case GTK_RESPONSE_APPLY:
- _onApply();
- break;
-*/
default:
g_assert_not_reached();
}
@@ -222,9 +212,6 @@ void GuidelinePropertiesDialog::_setup() {
1, 3, 3, 4, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
#endif
- _color.signal_color_set().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_colorChanged));
-
-
// unitmenus
/* fixme: We should allow percents here too, as percents of the canvas size */
_unit_menu.setUnitType(UNIT_TYPE_LINEAR);
diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h
index 422fed7fe..22bf5097a 100644
--- a/src/ui/dialog/guides.h
+++ b/src/ui/dialog/guides.h
@@ -62,13 +62,11 @@ public:
protected:
void _setup();
- void _onApply();
void _onOK();
void _onDelete();
void _response(gint response);
void _modeChanged();
- void _colorChanged();
private:
GuidelinePropertiesDialog(GuidelinePropertiesDialog const &); // no copy
diff --git a/src/ui/dialog/pixelartdialog.cpp b/src/ui/dialog/pixelartdialog.cpp
index ce5b6584d..31449d4e7 100644
--- a/src/ui/dialog/pixelartdialog.cpp
+++ b/src/ui/dialog/pixelartdialog.cpp
@@ -16,6 +16,16 @@
# include <config.h>
#endif
+#ifdef GLIBMM_DISABLE_DEPRECATED
+# undef GLIBMM_DISABLE_DEPRECATED
+# include <glibmm/thread.h>
+# include <glibmm/dispatcher.h>
+# define GLIBMM_DISABLE_DEPRECATED 1
+#else // GLIBMM_DISABLE_DEPRECATED
+# include <glibmm/thread.h>
+# include <glibmm/dispatcher.h>
+#endif // GLIBMM_DISABLE_DEPRECATED
+
#include "pixelartdialog.h"
#include <gtkmm/radiobutton.h>
#include <gtkmm/stock.h>
@@ -54,18 +64,6 @@ namespace Inkscape {
namespace UI {
namespace Dialog {
-template<class T>
-T move(T &obj)
-{
-#ifdef LIBDEPIXELIZE_ENABLE_CPP11
- return std::move(obj);
-#else
- T ret;
- std::swap(obj, ret);
- return ret;
-#endif // LIBDEPIXELIZE_ENABLE_CPP11
-}
-
/**
* A dialog for adjusting pixel art -> vector tracing parameters
*/
@@ -77,6 +75,23 @@ public:
~PixelArtDialogImpl();
private:
+ struct Input
+ {
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf;
+ SVGLength x;
+ SVGLength y;
+ };
+ struct Output
+ {
+ Output(Tracer::Splines splines, SVGLength x, SVGLength y) :
+ splines(splines), x(x), y(y)
+ {}
+
+ Tracer::Splines splines;
+ SVGLength x;
+ SVGLength y;
+ };
+
void setDesktop(SPDesktop *desktop);
void setTargetDesktop(SPDesktop *desktop);
@@ -89,7 +104,8 @@ private:
Tracer::Kopf2011::Options options();
void vectorize();
- void processLibdepixelize(SPImage *img);
+ void processLibdepixelize(const Input &image);
+ void importOutput(const Output &out);
void setDefaults();
void updatePreview();
@@ -133,9 +149,21 @@ private:
Gtk::RadioButton optimizeRadioButton;
#endif // LIBDEPIXELIZE_INKSCAPE_ENABLE_SMOOTH
+ //############ UI Logic data
+
SPDesktop *desktop;
DesktopTracker deskTrack;
sigc::connection desktopChangeConn;
+
+ //############ Threads
+ void workerThread();
+ void onWorkerThreadFinished();
+ Glib::Thread *thread;
+ volatile gint abortThread; // C++11's atomic stuff is sooo much nicer
+ Glib::Dispatcher dispatcher;
+ std::vector<Input> queue;
+ std::vector<Output> output;
+ Tracer::Kopf2011::Options lastOptions;
};
void PixelArtDialogImpl::setDesktop(SPDesktop *desktop)
@@ -288,6 +316,9 @@ PixelArtDialogImpl::PixelArtDialogImpl() :
deskTrack.connect(GTK_WIDGET(gobj()));
signalResponse().connect(sigc::mem_fun(*this, &PixelArtDialogImpl::responseCallback));
+
+ dispatcher.connect(
+ sigc::mem_fun(*this, &PixelArtDialogImpl::onWorkerThreadFinished) );
}
void PixelArtDialogImpl::responseCallback(int response_id)
@@ -295,7 +326,8 @@ void PixelArtDialogImpl::responseCallback(int response_id)
if (response_id == GTK_RESPONSE_OK) {
vectorize();
} else if (response_id == GTK_RESPONSE_CANCEL) {
- // TODO
+ // libdepixelize's interface need to be extended to allow aborts
+ g_atomic_int_set(&abortThread, true);
} else if (response_id == GTK_RESPONSE_HELP) {
setDefaults();
} else {
@@ -340,39 +372,53 @@ void PixelArtDialogImpl::vectorize()
return;
}
- bool found = false;
-
for ( GSList const *list = desktop->selection->itemList() ; list
; list = list->next ) {
if ( !SP_IS_IMAGE(list->data) )
continue;
- found = true;
+ SPImage *img = SP_IMAGE(list->data);
+ Input input;
+ input.pixbuf = Glib::wrap(img->pixbuf->getPixbufRaw(), true);
+ input.x = img->x;
+ input.y = img->y;
+
+ if ( input.pixbuf->get_width() > 256
+ || input.pixbuf->get_height() > 256 ) {
+ char *msg = _("Image looks too big. Process may take a while and is"
+ " wise to save your document before continue."
+ "\n\nContinue the procedure (without saving)?");
+ Gtk::MessageDialog dialog(msg, false, Gtk::MESSAGE_WARNING,
+ Gtk::BUTTONS_OK_CANCEL, true);
+
+ if ( dialog.run() != Gtk::RESPONSE_OK )
+ continue;
+ }
- processLibdepixelize(SP_IMAGE(list->data));
+ queue.push_back(input);
}
- if ( !found ) {
+ if ( !queue.size() ) {
char *msg = _("Select an <b>image</b> to trace");
msgStack->flash(Inkscape::ERROR_MESSAGE, msg);
return;
}
- DocumentUndo::done(desktop->doc(), SP_VERB_SELECTION_PIXEL_ART,
- _("Trace pixel art"));
+ mainCancelButton->set_sensitive(true);
+ mainOkButton->set_sensitive(false);
- // Flush pending updates
- desktop->doc()->ensureUpToDate();
+ lastOptions = options();
+
+ g_atomic_int_set(&abortThread, false);
+ thread = Glib::Thread::create(
+ sigc::mem_fun(*this, &PixelArtDialogImpl::workerThread) );
}
-void PixelArtDialogImpl::processLibdepixelize(SPImage *img)
+void PixelArtDialogImpl::processLibdepixelize(const Input &input)
{
Tracer::Splines out;
- Glib::RefPtr<Gdk::Pixbuf> pixbuf
- = Glib::wrap(img->pixbuf->getPixbufRaw(), true);
-
- if ( pixbuf->get_width() > 256 || pixbuf->get_height() > 256 ) {
+ if ( input.pixbuf->get_width() > 256 || input.pixbuf->get_height() > 256 ) {
char *msg = _("Image looks too big. Process may take a while and it is"
" wise to save your document before continuing."
"\n\nContinue the procedure (without saving)?");
@@ -384,16 +430,23 @@ void PixelArtDialogImpl::processLibdepixelize(SPImage *img)
}
if ( voronoiRadioButton.get_active() ) {
- out = Tracer::Kopf2011::to_voronoi(pixbuf, options());
+ output.push_back(Output(Tracer::Kopf2011::to_voronoi(input.pixbuf,
+ lastOptions),
+ input.x, input.y));
} else {
- out = Tracer::Kopf2011::to_splines(pixbuf, options());
+ output.push_back(Output(Tracer::Kopf2011::to_splines(input.pixbuf,
+ lastOptions),
+ input.x, input.y));
}
+}
+void PixelArtDialogImpl::importOutput(const Output &output)
+{
Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
Inkscape::XML::Node *group = xml_doc->createElement("svg:g");
- for ( Tracer::Splines::iterator it = out.begin(), end = out.end()
- ; it != end ; ++it ) {
+ for ( Tracer::Splines::const_iterator it = output.splines.begin(),
+ end = output.splines.end() ; it != end ; ++it ) {
Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
{
@@ -421,7 +474,7 @@ void PixelArtDialogImpl::processLibdepixelize(SPImage *img)
sp_repr_css_attr_unref(css);
}
- gchar *str = sp_svg_write_path(Dialog::move(it->pathVector));
+ gchar *str = sp_svg_write_path(it->pathVector);
repr->setAttribute("d", str);
g_free(str);
@@ -433,14 +486,20 @@ void PixelArtDialogImpl::processLibdepixelize(SPImage *img)
{
group->setAttribute("transform",
(std::string("translate(")
- + sp_svg_length_write_with_units(img->x)
- + ' ' + sp_svg_length_write_with_units(img->y)
+ + sp_svg_length_write_with_units(output.x)
+ + ' ' + sp_svg_length_write_with_units(output.y)
+ ')').c_str());
}
desktop->currentLayer()->appendChildRepr(group);
Inkscape::GC::release(group);
+
+ DocumentUndo::done(desktop->doc(), SP_VERB_SELECTION_PIXEL_ART,
+ _("Trace pixel art"));
+
+ // Flush pending updates
+ desktop->doc()->ensureUpToDate();
}
void PixelArtDialogImpl::setDefaults()
@@ -481,6 +540,29 @@ void PixelArtDialogImpl::updatePreview()
pendingPreview = false;
}
+void PixelArtDialogImpl::workerThread()
+{
+ for ( std::vector<Input>::iterator it = queue.begin(), end = queue.end()
+ ; it != end && !g_atomic_int_get(&abortThread) ; ++it ) {
+ processLibdepixelize(*it);
+ }
+ queue.clear();
+ dispatcher();
+}
+
+void PixelArtDialogImpl::onWorkerThreadFinished()
+{
+ thread->join();
+ thread = NULL;
+ for ( std::vector<Output>::const_iterator it = output.begin(),
+ end = output.end() ; it != end ; ++it ) {
+ importOutput(*it);
+ }
+ output.clear();
+ mainCancelButton->set_sensitive(false);
+ mainOkButton->set_sensitive(true);
+}
+
/**
* Factory method. Use this to create a new PixelArtDialog
*/
diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp
index 4f918b483..d1355e807 100644
--- a/src/ui/tools/connector-tool.cpp
+++ b/src/ui/tools/connector-tool.cpp
@@ -366,7 +366,7 @@ cc_select_handle(SPKnot* knot)
knot->setSize(10);
knot->setAnchor(SP_ANCHOR_CENTER);
knot->setFill(0x0000ffff, 0x0000ffff, 0x0000ffff);
- knot->update_ctrl();
+ knot->updateCtrl();
}
static void
@@ -376,7 +376,7 @@ cc_deselect_handle(SPKnot* knot)
knot->setSize(8);
knot->setAnchor(SP_ANCHOR_CENTER);
knot->setFill(0xffffff00, 0xff0000ff, 0xff0000ff);
- knot->update_ctrl();
+ knot->updateCtrl();
}
bool ConnectorTool::item_handler(SPItem* item, GdkEvent* event) {
@@ -981,7 +981,7 @@ cc_generic_knot_handler(SPCanvasItem *, GdkEvent *event, SPKnot *knot)
gchar const *knot_tip = "Click to join at this point";
switch (event->type) {
case GDK_ENTER_NOTIFY:
- knot->set_flag(SP_KNOT_MOUSEOVER, TRUE);
+ knot->setFlag(SP_KNOT_MOUSEOVER, TRUE);
cc->active_handle = knot;
if (knot_tip)
@@ -993,7 +993,7 @@ cc_generic_knot_handler(SPCanvasItem *, GdkEvent *event, SPKnot *knot)
consumed = TRUE;
break;
case GDK_LEAVE_NOTIFY:
- knot->set_flag(SP_KNOT_MOUSEOVER, FALSE);
+ knot->setFlag(SP_KNOT_MOUSEOVER, FALSE);
/* FIXME: the following test is a workaround for LP Bug #1273510.
* It seems that a signal is not correctly disconnected, maybe
@@ -1076,7 +1076,7 @@ void ConnectorTool::_activeShapeAddKnot(SPItem* item) {
knot->setSize(8);
knot->setAnchor(SP_ANCHOR_CENTER);
knot->setFill(0xffffff00, 0xff0000ff, 0xff0000ff);
- knot->update_ctrl();
+ knot->updateCtrl();
// We don't want to use the standard knot handler.
g_signal_handler_disconnect(G_OBJECT(knot->item),
@@ -1087,7 +1087,7 @@ void ConnectorTool::_activeShapeAddKnot(SPItem* item) {
g_signal_connect(G_OBJECT(knot->item), "event",
G_CALLBACK(cc_generic_knot_handler), knot);
- knot->set_position(item->avoidRef->getConnectionPointPos() * desktop->doc2dt(), 0);
+ knot->setPosition(item->avoidRef->getConnectionPointPos() * desktop->doc2dt(), 0);
knot->show();
this->knots[knot] = 1;
}
@@ -1159,10 +1159,10 @@ void ConnectorTool::cc_set_active_conn(SPItem *item) {
{
// Just adjust handle positions.
Geom::Point startpt = *(curve->first_point()) * i2dt;
- this->endpt_handle[0]->set_position(startpt, 0);
+ this->endpt_handle[0]->setPosition(startpt, 0);
Geom::Point endpt = *(curve->last_point()) * i2dt;
- this->endpt_handle[1]->set_position(endpt, 0);
+ this->endpt_handle[1]->setPosition(endpt, 0);
}
return;
@@ -1195,7 +1195,7 @@ void ConnectorTool::cc_set_active_conn(SPItem *item) {
knot->setAnchor(SP_ANCHOR_CENTER);
knot->setFill(0xffffff00, 0xff0000ff, 0xff0000ff);
knot->setStroke(0x000000ff, 0x000000ff, 0x000000ff);
- knot->update_ctrl();
+ knot->updateCtrl();
// We don't want to use the standard knot handler,
// since we don't want this knot to be draggable.
@@ -1235,10 +1235,10 @@ void ConnectorTool::cc_set_active_conn(SPItem *item) {
}
Geom::Point startpt = *(curve->first_point()) * i2dt;
- this->endpt_handle[0]->set_position(startpt, 0);
+ this->endpt_handle[0]->setPosition(startpt, 0);
Geom::Point endpt = *(curve->last_point()) * i2dt;
- this->endpt_handle[1]->set_position(endpt, 0);
+ this->endpt_handle[1]->setPosition(endpt, 0);
this->endpt_handle[0]->show();
this->endpt_handle[1]->show();
diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp
index 374846539..fb4e82c32 100644
--- a/src/ui/tools/pencil-tool.cpp
+++ b/src/ui/tools/pencil-tool.cpp
@@ -26,7 +26,6 @@
#include "draw-anchor.h"
#include "message-stack.h"
#include "message-context.h"
-#include "modifier-fns.h"
#include "sp-path.h"
#include "preferences.h"
#include "snap.h"
@@ -45,6 +44,7 @@
#include "display/curve.h"
#include "livarot/Path.h"
#include "tool-factory.h"
+#include "ui/tool/event-utils.h"
namespace Inkscape {
namespace UI {
@@ -131,11 +131,11 @@ bool PencilTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
- ret = this->_handleKeyPress(get_group0_keyval (&event->key), event->key.state);
+ ret = this->_handleKeyPress(event->key);
break;
case GDK_KEY_RELEASE:
- ret = this->_handleKeyRelease(get_group0_keyval (&event->key), event->key.state);
+ ret = this->_handleKeyRelease(event->key);
break;
default:
@@ -467,16 +467,16 @@ void PencilTool::_cancel() {
this->desktop->canvas->endForcedFullRedraws();
}
-bool PencilTool::_handleKeyPress(guint const keyval, guint const state) {
+bool PencilTool::_handleKeyPress(GdkEventKey const &event) {
bool ret = false;
- switch (keyval) {
+ switch (get_group0_keyval(&event)) {
case GDK_KEY_Up:
case GDK_KEY_Down:
case GDK_KEY_KP_Up:
case GDK_KEY_KP_Down:
// Prevent the zoom field from activation.
- if (!mod_ctrl_only(state)) {
+ if (!Inkscape::UI::held_only_control(event)) {
ret = true;
}
break;
@@ -491,7 +491,7 @@ bool PencilTool::_handleKeyPress(guint const keyval, guint const state) {
break;
case GDK_KEY_z:
case GDK_KEY_Z:
- if (mod_ctrl_only(state) && this->npoints != 0) {
+ if (Inkscape::UI::held_only_control(event) && this->npoints != 0) {
// if drawing, cancel, otherwise pass it up for undo
if (this->state != SP_PENCIL_CONTEXT_IDLE) {
this->_cancel();
@@ -501,7 +501,7 @@ bool PencilTool::_handleKeyPress(guint const keyval, guint const state) {
break;
case GDK_KEY_g:
case GDK_KEY_G:
- if (mod_shift_only(state)) {
+ if (Inkscape::UI::held_only_shift(event)) {
sp_selection_to_guides(this->desktop);
ret = true;
}
@@ -520,9 +520,10 @@ bool PencilTool::_handleKeyPress(guint const keyval, guint const state) {
return ret;
}
-bool PencilTool::_handleKeyRelease(guint const keyval, guint const /*state*/) {
+bool PencilTool::_handleKeyRelease(GdkEventKey const &event) {
bool ret = false;
- switch (keyval) {
+
+ switch (get_group0_keyval(&event)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Meta_L:
diff --git a/src/ui/tools/pencil-tool.h b/src/ui/tools/pencil-tool.h
index e01b0afb5..e8d156dbd 100644
--- a/src/ui/tools/pencil-tool.h
+++ b/src/ui/tools/pencil-tool.h
@@ -57,8 +57,8 @@ private:
bool _handleButtonPress(GdkEventButton const &bevent);
bool _handleMotionNotify(GdkEventMotion const &mevent);
bool _handleButtonRelease(GdkEventButton const &revent);
- bool _handleKeyPress(guint const keyval, guint const state);
- bool _handleKeyRelease(guint const keyval, guint const state);
+ bool _handleKeyPress(GdkEventKey const &event);
+ bool _handleKeyRelease(GdkEventKey const &event);
void _setStartpoint(Geom::Point const &p);
void _setEndpoint(Geom::Point const &p);
diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp
index 96ac95926..4195c9eb2 100644
--- a/src/ui/tools/tool-base.cpp
+++ b/src/ui/tools/tool-base.cpp
@@ -1132,7 +1132,7 @@ void sp_event_show_modifier_tip(Inkscape::MessageContext *message_context,
* Use this instead of simply event->keyval, so that your keyboard shortcuts
* work regardless of layouts (e.g., in Cyrillic).
*/
-guint get_group0_keyval(GdkEventKey *event) {
+guint get_group0_keyval(GdkEventKey const *event) {
guint keyval = 0;
gdk_keymap_translate_keyboard_state(gdk_keymap_get_for_display(
diff --git a/src/ui/tools/tool-base.h b/src/ui/tools/tool-base.h
index e11a22296..b27de9030 100644
--- a/src/ui/tools/tool-base.h
+++ b/src/ui/tools/tool-base.h
@@ -244,7 +244,7 @@ gint gobble_motion_events(gint mask);
void sp_event_show_modifier_tip(Inkscape::MessageContext *message_context, GdkEvent *event,
gchar const *ctrl_tip, gchar const *shift_tip, gchar const *alt_tip);
-guint get_group0_keyval(GdkEventKey *event);
+guint get_group0_keyval(GdkEventKey const *event);
SPItem *sp_event_context_find_item (SPDesktop *desktop, Geom::Point const &p, bool select_under, bool into_groups);
SPItem *sp_event_context_over_item (SPDesktop *desktop, SPItem *item, Geom::Point const &p);