Commits (3)
......@@ -557,7 +557,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data)
desktop->guidesMessageContext()->clear();
break;
case GDK_KEY_PRESS:
switch (Inkscape::UI::Tools::get_group0_keyval (&event->key)) {
switch (Inkscape::UI::Tools::get_latin_keyval (&event->key)) {
case GDK_KEY_Delete:
case GDK_KEY_KP_Delete:
case GDK_KEY_BackSpace:
......@@ -590,7 +590,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data)
}
break;
case GDK_KEY_RELEASE:
switch (Inkscape::UI::Tools::get_group0_keyval (&event->key)) {
switch (Inkscape::UI::Tools::get_latin_keyval (&event->key)) {
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
{
......
......@@ -20,7 +20,7 @@ static bool on_window_key_press(GdkEventKey* event)
{
unsigned shortcut = 0;
// FIXME why?
shortcut = Inkscape::UI::Tools::get_group0_keyval (event) |
shortcut = Inkscape::UI::Tools::get_latin_keyval (event) |
( event->state & GDK_SHIFT_MASK ?
SP_SHORTCUT_SHIFT_MASK : 0 ) |
( event->state & GDK_CONTROL_MASK ?
......
......@@ -458,9 +458,10 @@ Application::Application(const char* argv, bool use_gui) :
Inkscape::UI::Dialog::DebugDialog::getInstance()->captureLogMessages();
}
/* Check for global remapping of Alt key */
if (use_gui)
{
Inkscape::UI::Tools::init_latin_keys_group();
/* Check for global remapping of Alt key */
mapalt(guint(prefs->getInt("/options/mapalt/value", 0)));
trackalt(guint(prefs->getInt("/options/trackalt/value", 0)));
}
......
......@@ -331,7 +331,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot
consumed = TRUE;
break;
case GDK_KEY_PRESS: // keybindings for knot
switch (Inkscape::UI::Tools::get_group0_keyval(&event->key)) {
switch (Inkscape::UI::Tools::get_latin_keyval(&event->key)) {
case GDK_KEY_Escape:
knot->setFlag(SP_KNOT_GRABBED, FALSE);
......
......@@ -945,7 +945,7 @@ namespace Inkscape {
namespace UI {
namespace Tools {
guint get_group0_keyval(GdkEventKey const* event);
guint get_latin_keyval(GdkEventKey const* event);
}
}
......@@ -1003,7 +1003,7 @@ snooper(GdkEvent *event, gpointer /*data*/) {
alt_pressed = TRUE && (event->button.state & GDK_MOD1_MASK);
break;
case GDK_KEY_PRESS:
keyval = Inkscape::UI::Tools::get_group0_keyval(&event->key);
keyval = Inkscape::UI::Tools::get_latin_keyval(&event->key);
if (keyval == GDK_KEY_Alt_L) altL_pressed = TRUE;
if (keyval == GDK_KEY_Alt_R) altR_pressed = TRUE;
alt_pressed = alt_pressed || altL_pressed || altR_pressed;
......@@ -1014,7 +1014,7 @@ snooper(GdkEvent *event, gpointer /*data*/) {
event->key.state &= ~GDK_MOD1_MASK;
break;
case GDK_KEY_RELEASE:
keyval = Inkscape::UI::Tools::get_group0_keyval(&event->key);
keyval = Inkscape::UI::Tools::get_latin_keyval(&event->key);
if (keyval == GDK_KEY_Alt_L) altL_pressed = FALSE;
if (keyval == GDK_KEY_Alt_R) altR_pressed = FALSE;
if (!altL_pressed && !altR_pressed)
......
......@@ -69,7 +69,7 @@ static gboolean sp_sel_trans_handle_event(SPKnot *knot, GdkEvent *event, SPSelTr
case GDK_MOTION_NOTIFY:
break;
case GDK_KEY_PRESS:
if (Inkscape::UI::Tools::get_group0_keyval (&event->key) == GDK_KEY_space) {
if (Inkscape::UI::Tools::get_latin_keyval (&event->key) == GDK_KEY_space) {
/* stamping mode: both mode(show content and outline) operation with knot */
if (!SP_KNOT_IS_GRABBED(knot)) {
return FALSE;
......
......@@ -111,7 +111,7 @@ static void try_shortcuts_file(char const *filename) {
/*
* Inkscape expects to add the Shift modifier to any accel_keys create with Shift
* For exmaple on en_US keyboard <Shift>+6 = "&" - in this case return <Shift>+&
* See get_group0_keyval() for explanation on why
* See get_latin_keyval() for explanation on why
*/
unsigned int sp_gdkmodifier_to_shortcut(guint accel_key, Gdk::ModifierType gdkmodifier, guint hardware_keycode) {
......@@ -121,7 +121,7 @@ unsigned int sp_gdkmodifier_to_shortcut(guint accel_key, Gdk::ModifierType gdkmo
event.state = gdkmodifier;
event.keyval = accel_key;
event.hardware_keycode = hardware_keycode;
guint keyval = Inkscape::UI::Tools::get_group0_keyval (&event);
guint keyval = Inkscape::UI::Tools::get_latin_keyval (&event);
shortcut = accel_key |
( (gdkmodifier & GDK_SHIFT_MASK) ?
......@@ -431,7 +431,7 @@ void sp_shortcut_file_export_do(char const *exportname) {
* Shortcut file consists of pairs of bind elements :
* Element (a) is used for shortcut display in menus (display="True") and contains the gdk_keyval_name of the shortcut key
* Element (b) is used in shortcut lookup and contains an uppercase version of the gdk_keyval_name,
* or a gdk_keyval_name name and the "Shift" modifier for Shift altered hardware code keys (see get_group0_keyval() for explanation)
* or a gdk_keyval_name name and the "Shift" modifier for Shift altered hardware code keys (see get_latin_keyval() for explanation)
*/
void sp_shortcut_delete_from_file(char const * /*action*/, unsigned int const shortcut) {
......
......@@ -103,7 +103,7 @@ sp_dialog_event_handler (GtkWindow *win, GdkEvent *event, gpointer data)
case GDK_KEY_PRESS:
switch (Inkscape::UI::Tools::get_group0_keyval (&event->key)) {
switch (Inkscape::UI::Tools::get_latin_keyval (&event->key)) {
case GDK_KEY_Escape:
sp_dialog_defocus (win);
ret = TRUE;
......
......@@ -240,7 +240,7 @@ bool Dialog::_onEvent(GdkEvent *event)
switch (event->type) {
case GDK_KEY_PRESS: {
switch (Inkscape::UI::Tools::get_group0_keyval (&event->key)) {
switch (Inkscape::UI::Tools::get_latin_keyval (&event->key)) {
case GDK_KEY_Escape: {
_defocus();
ret = true;
......@@ -270,7 +270,7 @@ bool Dialog::_onEvent(GdkEvent *event)
bool Dialog::_onKeyPress(GdkEventKey *event)
{
unsigned int shortcut;
shortcut = Inkscape::UI::Tools::get_group0_keyval(event) |
shortcut = Inkscape::UI::Tools::get_latin_keyval(event) |
( event->state & GDK_SHIFT_MASK ?
SP_SHORTCUT_SHIFT_MASK : 0 ) |
( event->state & GDK_CONTROL_MASK ?
......
......@@ -154,7 +154,7 @@ KnotPropertiesDialog::_close()
bool KnotPropertiesDialog::_handleKeyEvent(GdkEventKey * /*event*/)
{
/*switch (get_group0_keyval(event)) {
/*switch (get_latin_keyval(event)) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter: {
_apply();
......
......@@ -318,7 +318,7 @@ SPObject* LayerPropertiesDialog::_selectedLayer()
bool LayerPropertiesDialog::_handleKeyEvent(GdkEventKey *event)
{
switch (Inkscape::UI::Tools::get_group0_keyval(event)) {
switch (Inkscape::UI::Tools::get_latin_keyval(event)) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter: {
_strategy->perform(*this);
......
......@@ -544,7 +544,7 @@ void LayersPanel::_toggled( Glib::ustring const& str, int targetCol )
bool LayersPanel::_handleKeyEvent(GdkEventKey *event)
{
switch (Inkscape::UI::Tools::get_group0_keyval(event)) {
switch (Inkscape::UI::Tools::get_latin_keyval(event)) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
case GDK_KEY_F2: {
......
......@@ -155,7 +155,7 @@ PowerstrokePropertiesDialog::_close()
bool PowerstrokePropertiesDialog::_handleKeyEvent(GdkEventKey * /*event*/)
{
/*switch (get_group0_keyval(event)) {
/*switch (get_latin_keyval(event)) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter: {
_apply();
......
......@@ -715,7 +715,7 @@ bool ObjectsPanel::_handleKeyEvent(GdkEventKey *event)
return false;
unsigned int shortcut;
shortcut = Inkscape::UI::Tools::get_group0_keyval(event) |
shortcut = Inkscape::UI::Tools::get_latin_keyval(event) |
( event->state & GDK_SHIFT_MASK ?
SP_SHORTCUT_SHIFT_MASK : 0 ) |
( event->state & GDK_CONTROL_MASK ?
......@@ -748,7 +748,7 @@ bool ObjectsPanel::_handleKeyEvent(GdkEventKey *event)
// handle events for the treeview
bool empty = _desktop->selection->isEmpty();
switch (Inkscape::UI::Tools::get_group0_keyval(event)) {
switch (Inkscape::UI::Tools::get_latin_keyval(event)) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
{
......
......@@ -537,7 +537,7 @@ void TagsPanel::_checkTreeSelection()
bool TagsPanel::_handleKeyEvent(GdkEventKey *event)
{
switch (Inkscape::UI::Tools::get_group0_keyval(event)) {
switch (Inkscape::UI::Tools::get_latin_keyval(event)) {
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
case GDK_KEY_F2: {
......
......@@ -339,7 +339,7 @@ void XmlTree::attr_reset_context(gint attr)
bool XmlTree::sp_xml_tree_key_press(GdkEventKey *event)
{
unsigned int shortcut = Inkscape::UI::Tools::get_group0_keyval (event) |
unsigned int shortcut = Inkscape::UI::Tools::get_latin_keyval (event) |
( event->state & GDK_SHIFT_MASK ?
SP_SHORTCUT_SHIFT_MASK : 0 ) |
( event->state & GDK_CONTROL_MASK ?
......@@ -854,7 +854,7 @@ void XmlTree::on_document_uri_set(gchar const * /*uri*/, SPDocument * /*document
gboolean XmlTree::quit_on_esc (GtkWidget *w, GdkEventKey *event, GObject */*tbl*/)
{
switch (Inkscape::UI::Tools::get_group0_keyval (event)) {
switch (Inkscape::UI::Tools::get_latin_keyval (event)) {
case GDK_KEY_Escape: // defocus
gtk_widget_destroy(w);
return TRUE;
......
......@@ -382,7 +382,7 @@ bool ControlPoint::_eventHandler(Inkscape::UI::Tools::ToolBase *event_context, G
// update tips on modifier state change
// TODO add ESC keybinding as drag cancel
case GDK_KEY_PRESS:
switch (Inkscape::UI::Tools::get_group0_keyval(&event->key))
switch (Inkscape::UI::Tools::get_latin_keyval(&event->key))
{
case GDK_KEY_Escape: {
// ignore Escape if this is not a drag
......
......@@ -228,7 +228,7 @@ bool ArcTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
......
......@@ -344,7 +344,7 @@ bool Box3dTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Up:
case GDK_KEY_Down:
case GDK_KEY_KP_Up:
......
......@@ -785,7 +785,7 @@ bool CalligraphicTool::root_handler(GdkEvent* event) {
}
case GDK_KEY_PRESS:
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Up:
case GDK_KEY_KP_Up:
if (!MOD__CTRL_ONLY(event)) {
......@@ -866,7 +866,7 @@ bool CalligraphicTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_RELEASE:
switch (get_group0_keyval(&event->key)) {
switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Control_L:
case GDK_KEY_Control_R:
this->message_context->clear();
......
......@@ -441,7 +441,7 @@ bool ConnectorTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
ret = this->_handleKeyPress(get_group0_keyval (&event->key));
ret = this->_handleKeyPress(get_latin_keyval (&event->key));
break;
default:
......
......@@ -336,7 +336,7 @@ bool DropperTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
switch (get_group0_keyval(&event->key)) {
switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Up:
case GDK_KEY_Down:
case GDK_KEY_KP_Up:
......@@ -363,7 +363,7 @@ bool DropperTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_RELEASE:
switch (get_group0_keyval(&event->key)) {
switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
if (!desktop->isWaitingCursor() && !prefs->getBool("/tools/dropper/onetimepick", false)) {
......
......@@ -499,7 +499,7 @@ bool EraserTool::root_handler(GdkEvent* event) {
}
case GDK_KEY_PRESS:
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
// case GDK_KEY_Up:
// case GDK_KEY_KP_Up:
// if (!MOD__CTRL_ONLY(event)) {
......@@ -603,7 +603,7 @@ bool EraserTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_RELEASE:
switch (get_group0_keyval(&event->key)) {
switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Control_L:
case GDK_KEY_Control_R:
this->message_context->clear();
......
......@@ -1199,7 +1199,7 @@ bool FloodTool::root_handler(GdkEvent* event) {
}
break;
case GDK_KEY_PRESS:
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Up:
case GDK_KEY_Down:
case GDK_KEY_KP_Up:
......
......@@ -185,7 +185,7 @@ bool FreehandBase::root_handler(GdkEvent* event) {
switch (event->type) {
case GDK_KEY_PRESS:
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Up:
case GDK_KEY_Down:
case GDK_KEY_KP_Up:
......
......@@ -683,7 +683,7 @@ bool GradientTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
......@@ -737,7 +737,7 @@ bool GradientTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_4:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
drag->selected_move_screen(mul*-10, 0); // shift
......@@ -760,7 +760,7 @@ bool GradientTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_8:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
drag->selected_move_screen(0, mul*10); // shift
......@@ -784,7 +784,7 @@ bool GradientTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_6:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
......@@ -809,7 +809,7 @@ bool GradientTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_2:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
......@@ -866,7 +866,7 @@ bool GradientTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_RELEASE:
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
......
......@@ -228,14 +228,14 @@ bool LpeTool::root_handler(GdkEvent* event) {
case GDK_KEY_PRESS:
/**
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
}
break;
**/
case GDK_KEY_RELEASE:
/**
switch (get_group0_keyval(&event->key)) {
switch (get_latin_keyval(&event->key)) {
case GDK_Control_L:
case GDK_Control_R:
dc->_message_context->clear();
......
......@@ -887,7 +887,7 @@ bool MeshTool::root_handler(GdkEvent* event) {
#endif
// FIXME: tip
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
......@@ -926,7 +926,7 @@ bool MeshTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_Left:
case GDK_KEY_KP_4:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
......@@ -950,7 +950,7 @@ bool MeshTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_Up:
case GDK_KEY_KP_8:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
......@@ -974,7 +974,7 @@ bool MeshTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_Right:
case GDK_KEY_KP_6:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
......@@ -998,7 +998,7 @@ bool MeshTool::root_handler(GdkEvent* event) {
case GDK_KEY_KP_Down:
case GDK_KEY_KP_2:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
......@@ -1096,7 +1096,7 @@ bool MeshTool::root_handler(GdkEvent* event) {
#ifdef DEBUG_MESH
std::cout << "sp_mesh_context_root_handler: GDK_KEY_RELEASE" << std::endl;
#endif
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
......
......@@ -546,7 +546,7 @@ bool NodeTool::root_handler(GdkEvent* event) {
// otherwise some features cease to work
case GDK_KEY_PRESS:
switch (get_group0_keyval(&event->key))
switch (get_latin_keyval(&event->key))
{
case GDK_KEY_Escape: // deselect everything
if (this->_selected_nodes->empty()) {
......
......@@ -1062,7 +1062,7 @@ bool PenTool::_handleKeyPress(GdkEvent *event) {
// Check for undo if we have started drawing a path.
if (this->npoints > 0) {
unsigned int shortcut = Inkscape::UI::Tools::get_group0_keyval (&event->key) |
unsigned int shortcut = Inkscape::UI::Tools::get_latin_keyval (&event->key) |
( event->key.state & GDK_SHIFT_MASK ?
SP_SHORTCUT_SHIFT_MASK : 0 ) |
( event->key.state & GDK_CONTROL_MASK ?
......@@ -1077,7 +1077,7 @@ bool PenTool::_handleKeyPress(GdkEvent *event) {
}
}
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Left: // move last point left
case GDK_KEY_KP_Left:
if (!MOD__CTRL(event)) { // not ctrl
......
......@@ -460,7 +460,7 @@ void PencilTool::_cancel() {
bool PencilTool::_handleKeyPress(GdkEventKey const &event) {
bool ret = false;
switch (get_group0_keyval(&event)) {
switch (get_latin_keyval(&event)) {
case GDK_KEY_Up:
case GDK_KEY_Down:
case GDK_KEY_KP_Up:
......@@ -513,7 +513,7 @@ bool PencilTool::_handleKeyPress(GdkEventKey const &event) {
bool PencilTool::_handleKeyRelease(GdkEventKey const &event) {
bool ret = false;
switch (get_group0_keyval(&event)) {
switch (get_latin_keyval(&event)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Meta_L:
......
......@@ -263,7 +263,7 @@ bool RectTool::root_handler(GdkEvent* event) {
}
break;
case GDK_KEY_PRESS:
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
......@@ -340,7 +340,7 @@ bool RectTool::root_handler(GdkEvent* event) {
}
break;
case GDK_KEY_RELEASE:
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
......
......@@ -354,18 +354,18 @@ bool SelectTool::item_handler(SPItem* item, GdkEvent* event) {
break;
case GDK_KEY_PRESS:
if (get_group0_keyval (&event->key) == GDK_KEY_space) {
if (get_latin_keyval (&event->key) == GDK_KEY_space) {
if (this->dragging && this->grabbed) {
/* stamping mode: show content mode moving */
_seltrans->stamp();
ret = TRUE;
}
} else if (get_group0_keyval (&event->key) == GDK_KEY_Tab) {
} else if (get_latin_keyval (&event->key) == GDK_KEY_Tab) {
if (this->dragging && this->grabbed) {
_seltrans->getNextClosestPoint(false);
ret = TRUE;
}
} else if (get_group0_keyval (&event->key) == GDK_KEY_ISO_Left_Tab) {
} else if (get_latin_keyval (&event->key) == GDK_KEY_ISO_Left_Tab) {
if (this->dragging && this->grabbed) {
_seltrans->getNextClosestPoint(true);
ret = TRUE;
......@@ -864,7 +864,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
case GDK_KEY_PRESS: // keybindings for select context
{
{
guint keyval = get_group0_keyval(&event->key);
guint keyval = get_latin_keyval(&event->key);
bool alt = ( MOD__ALT(event)
|| (keyval == GDK_KEY_Alt_L)
......@@ -906,11 +906,11 @@ bool SelectTool::root_handler(GdkEvent* event) {
gdouble const offset = prefs->getDoubleLimited("/options/defaultscale/value", 2, 0, 1000, "px");
int const snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12);
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Left: // move selection left
case GDK_KEY_KP_Left:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events( get_group0_keyval(&event->key), 0); // with any mask
gint mul = 1 + gobble_key_events( get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
......@@ -933,7 +933,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
case GDK_KEY_Up: // move selection up
case GDK_KEY_KP_Up:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
......@@ -956,7 +956,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
case GDK_KEY_Right: // move selection right
case GDK_KEY_KP_Right:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
......@@ -979,7 +979,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
case GDK_KEY_Down: // move selection down
case GDK_KEY_KP_Down:
if (!MOD__CTRL(event)) { // not ctrl
gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
if (MOD__ALT(event)) { // alt
if (MOD__SHIFT(event)) {
......@@ -1034,7 +1034,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
case GDK_KEY_bracketleft:
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
sp_selection_rotate_screen(selection, mul*1);
} else if (MOD__CTRL(event)) {
sp_selection_rotate(selection, 90);
......@@ -1047,7 +1047,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
case GDK_KEY_bracketright:
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
sp_selection_rotate_screen(selection, -1*mul);
} else if (MOD__CTRL(event)) {
sp_selection_rotate(selection, -90);
......@@ -1061,12 +1061,12 @@ bool SelectTool::root_handler(GdkEvent* event) {
case GDK_KEY_less:
case GDK_KEY_comma:
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
sp_selection_scale_screen(selection, -2*mul);
} else if (MOD__CTRL(event)) {
sp_selection_scale_times(selection, 0.5);
} else {
gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
sp_selection_scale(selection, -offset*mul);
}
......@@ -1076,12 +1076,12 @@ bool SelectTool::root_handler(GdkEvent* event) {
case GDK_KEY_greater:
case GDK_KEY_period:
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
sp_selection_scale_screen(selection, 2*mul);
} else if (MOD__CTRL(event)) {
sp_selection_scale_times(selection, 2);
} else {
gint mul = 1 + gobble_key_events(get_group0_keyval(&event->key), 0); // with any mask
gint mul = 1 + gobble_key_events(get_latin_keyval(&event->key), 0); // with any mask
sp_selection_scale(selection, offset*mul);
}
......@@ -1137,7 +1137,7 @@ bool SelectTool::root_handler(GdkEvent* event) {
break;
}
case GDK_KEY_RELEASE: {
guint keyval = get_group0_keyval(&event->key);
guint keyval = get_latin_keyval(&event->key);
if (key_is_a_modifier (keyval)) {
this->defaultMessageContext()->clear();
}
......
......@@ -237,7 +237,7 @@ bool SpiralTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
switch (get_group0_keyval(&event->key)) {
switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
case GDK_KEY_Control_R:
......@@ -304,7 +304,7 @@ bool SpiralTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_RELEASE:
switch (get_group0_keyval(&event->key)) {
switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
......
......@@ -1393,7 +1393,7 @@ bool SprayTool::root_handler(GdkEvent* event) {
}
case GDK_KEY_PRESS:
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_j:
case GDK_KEY_J:
if (MOD__SHIFT_ONLY(event)) {
......@@ -1505,7 +1505,7 @@ bool SprayTool::root_handler(GdkEvent* event) {
case GDK_KEY_RELEASE: {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
switch (get_group0_keyval(&event->key)) {
switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
this->update_cursor(false);
......
......@@ -249,7 +249,7 @@ bool StarTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_PRESS:
switch (get_group0_keyval(&event->key)) {
switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
case GDK_KEY_Control_R:
......@@ -318,7 +318,7 @@ bool StarTool::root_handler(GdkEvent* event) {
break;
case GDK_KEY_RELEASE:
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Alt_L:
case GDK_KEY_Alt_R:
case GDK_KEY_Control_L:
......
......@@ -663,7 +663,7 @@ bool TextTool::root_handler(GdkEvent* event) {
}
break;
case GDK_KEY_PRESS: {
guint const group0_keyval = get_group0_keyval(&event->key);
guint const group0_keyval = get_latin_keyval(&event->key);
if (group0_keyval == GDK_KEY_KP_Add ||
group0_keyval == GDK_KEY_KP_Subtract) {
......@@ -971,7 +971,7 @@ bool TextTool::root_handler(GdkEvent* event) {
if (this->text) {
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
get_latin_keyval(&event->key), 0); // with any mask
if (MOD__SHIFT(event))
sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(mul*-10, 0));
else
......@@ -995,7 +995,7 @@ bool TextTool::root_handler(GdkEvent* event) {
if (this->text) {
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
get_latin_keyval(&event->key), 0); // with any mask
if (MOD__SHIFT(event))
sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(mul*10, 0));
else
......@@ -1019,7 +1019,7 @@ bool TextTool::root_handler(GdkEvent* event) {
if (this->text) {
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
get_latin_keyval(&event->key), 0); // with any mask
if (MOD__SHIFT(event))
sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(0, mul*-10));
else
......@@ -1043,7 +1043,7 @@ bool TextTool::root_handler(GdkEvent* event) {
if (this->text) {
if (MOD__ALT(event)) {
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
get_latin_keyval(&event->key), 0); // with any mask
if (MOD__SHIFT(event))
sp_te_adjust_kerning_screen(this->text, this->text_sel_start, this->text_sel_end, desktop, Geom::Point(0, mul*10));
else
......
......@@ -70,6 +70,9 @@ static guint32 scroll_event_time = 0;
static gdouble scroll_multiply = 1;
static guint scroll_keyval = 0;
// globals for key processing
static bool latin_keys_group_valid = FALSE;
static gint latin_keys_group;
namespace Inkscape {
namespace UI {
......@@ -585,7 +588,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
int const key_scroll = prefs->getIntLimited("/options/keyscroll/value",
10, 0, 1000);
switch (get_group0_keyval(&event->key)) {
switch (get_latin_keyval(&event->key)) {
// GDK insists on stealing these keys (F1 for no idea what, tab for cycling widgets
// in the editing window). So we resteal them back and run our regular shortcut
// invoker on them.
......@@ -593,7 +596,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
case GDK_KEY_Tab:
case GDK_KEY_ISO_Left_Tab:
case GDK_KEY_F1:
shortcut = get_group0_keyval(&event->key);
shortcut = get_latin_keyval(&event->key);
if (event->key.state & GDK_SHIFT_MASK) {
shortcut |= SP_SHORTCUT_SHIFT_MASK;
......@@ -638,7 +641,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
int i = (int) floor(key_scroll * accelerate_scroll(event,
acceleration, desktop->getCanvas()));
gobble_key_events(get_group0_keyval(&event->key), GDK_CONTROL_MASK);
gobble_key_events(get_latin_keyval(&event->key), GDK_CONTROL_MASK);
this->desktop->scroll_world(i, 0);
ret = TRUE;
}
......@@ -651,7 +654,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
int i = (int) floor(key_scroll * accelerate_scroll(event,
acceleration, desktop->getCanvas()));
gobble_key_events(get_group0_keyval(&event->key), GDK_CONTROL_MASK);
gobble_key_events(get_latin_keyval(&event->key), GDK_CONTROL_MASK);
this->desktop->scroll_world(0, i);
ret = TRUE;
}
......@@ -664,7 +667,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
int i = (int) floor(key_scroll * accelerate_scroll(event,
acceleration, desktop->getCanvas()));
gobble_key_events(get_group0_keyval(&event->key), GDK_CONTROL_MASK);
gobble_key_events(get_latin_keyval(&event->key), GDK_CONTROL_MASK);
this->desktop->scroll_world(-i, 0);
ret = TRUE;
}
......@@ -677,7 +680,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
int i = (int) floor(key_scroll * accelerate_scroll(event,
acceleration, desktop->getCanvas()));
gobble_key_events(get_group0_keyval(&event->key), GDK_CONTROL_MASK);
gobble_key_events(get_latin_keyval(&event->key), GDK_CONTROL_MASK);
this->desktop->scroll_world(0, -i);
ret = TRUE;
}
......@@ -744,7 +747,7 @@ bool ToolBase::root_handler(GdkEvent* event) {
gdk_window_set_cursor(gtk_widget_get_window (w), this->cursor);
}
switch (get_group0_keyval(&event->key)) {
switch (get_latin_keyval(&event->key)) {
case GDK_KEY_space:
if (within_tolerance) {
// Space was pressed, but not panned
......@@ -1107,7 +1110,7 @@ void sp_event_root_menu_popup(SPDesktop *desktop, SPItem *item, GdkEvent *event)
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 keyval = get_group0_keyval(&event->key);
guint keyval = get_latin_keyval(&event->key);
bool ctrl = ctrl_tip && (MOD__CTRL(event) || (keyval == GDK_KEY_Control_L) || (keyval
== GDK_KEY_Control_R));
......@@ -1128,19 +1131,48 @@ void sp_event_show_modifier_tip(Inkscape::MessageContext *message_context,
}
/**
* Return the keyval corresponding to the key event in group 0, i.e.,
* in the main (English) layout.
* Try to determine the keys group of Latin layout.
* Check available keymap entries for Latin 'a' key and find the minimal integer value.
*/
static void update_latin_keys_group() {
GdkKeymapKey* keys;
gint n_keys;
latin_keys_group_valid = FALSE;
if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), GDK_KEY_a, &keys, &n_keys)) {
for (gint i = 0; i < n_keys; i++) {
if (!latin_keys_group_valid || keys[i].group < latin_keys_group) {
latin_keys_group = keys[i].group;
latin_keys_group_valid = TRUE;
}
}
g_free(keys);
}
}
/**
* Initialize Latin keys group handling.
*/
void init_latin_keys_group() {
g_signal_connect(G_OBJECT(gdk_keymap_get_default()),
"keys-changed", G_CALLBACK(update_latin_keys_group), NULL);
update_latin_keys_group();
}
/**
* Return the keyval corresponding to the key event in Latin group.
*
* 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 const *event) {
guint get_latin_keyval(GdkEventKey const *event) {
guint keyval = 0;
gint group = latin_keys_group_valid ? latin_keys_group : event->group;
gdk_keymap_translate_keyboard_state(gdk_keymap_get_for_display(
gdk_display_get_default()), event->hardware_keycode,
(GdkModifierType) event->state, 0 /*event->key.group*/, &keyval,
NULL, NULL, NULL);
gdk_keymap_translate_keyboard_state(
gdk_keymap_get_for_display(gdk_display_get_default()),
event->hardware_keycode, (GdkModifierType) event->state, group,
&keyval, NULL, NULL, NULL);
return keyval;
}
......@@ -1216,10 +1248,10 @@ void event_context_print_event_info(GdkEvent *event, bool print_return) {
break;
case GDK_KEY_PRESS:
g_print("GDK_KEY_PRESS: %d", get_group0_keyval(&event->key));
g_print("GDK_KEY_PRESS: %d", get_latin_keyval(&event->key));
break;
case GDK_KEY_RELEASE:
g_print("GDK_KEY_RELEASE: %d", get_group0_keyval(&event->key));
g_print("GDK_KEY_RELEASE: %d", get_latin_keyval(&event->key));
break;
default:
//g_print ("even type not recognized");
......
......@@ -251,7 +251,8 @@ 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 const *event);
void init_latin_keys_group();
guint get_latin_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);
......
......@@ -1300,7 +1300,7 @@ bool TweakTool::root_handler(GdkEvent* event) {
}
case GDK_KEY_PRESS:
{
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_m:
case GDK_KEY_M:
case GDK_KEY_0:
......@@ -1495,7 +1495,7 @@ bool TweakTool::root_handler(GdkEvent* event) {
}
case GDK_KEY_RELEASE: {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
switch (get_group0_keyval(&event->key)) {
switch (get_latin_keyval(&event->key)) {
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
this->update_cursor(false);
......
......@@ -167,7 +167,7 @@ bool ZoomTool::root_handler(GdkEvent* event) {
break;
}
case GDK_KEY_PRESS:
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Escape:
if (!Inkscape::Rubberband::get(desktop)->is_started()) {
Inkscape::SelectionHelper::selectNone(desktop);
......@@ -205,7 +205,7 @@ bool ZoomTool::root_handler(GdkEvent* event) {
}
break;
case GDK_KEY_RELEASE:
switch (get_group0_keyval (&event->key)) {
switch (get_latin_keyval (&event->key)) {
case GDK_KEY_Shift_L:
case GDK_KEY_Shift_R:
this->cursor_shape = cursor_zoom_xpm;
......
......@@ -71,7 +71,7 @@ bool SpinButton::on_my_focus_in_event(GdkEventFocus* /*event*/)
bool SpinButton::on_my_key_press_event(GdkEventKey* event)
{
switch (Inkscape::UI::Tools::get_group0_keyval (event)) {
switch (Inkscape::UI::Tools::get_latin_keyval (event)) {
case GDK_KEY_Escape:
undo();
return true; // I consumed the event
......
......@@ -67,7 +67,7 @@ gboolean spinbutton_keypress(GtkWidget *w, GdkEventKey *event, gpointer /*data*/
{
gboolean result = FALSE; // I didn't consume the event
switch (Inkscape::UI::Tools::get_group0_keyval(event)) {
switch (Inkscape::UI::Tools::get_latin_keyval(event)) {
case GDK_KEY_Escape: // defocus
spinbutton_undo(w);
spinbutton_defocus(w);
......