summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e806447)
raw | patch | inline | side by side (parent: e806447)
author | mental <mental@users.sourceforge.net> | |
Wed, 29 Aug 2007 03:24:44 +0000 (03:24 +0000) | ||
committer | mental <mental@users.sourceforge.net> | |
Wed, 29 Aug 2007 03:24:44 +0000 (03:24 +0000) |
src/inkscape-private.h | patch | blob | history | |
src/inkscape.cpp | patch | blob | history | |
src/main.cpp | patch | blob | history | |
src/preferences-skeleton.h | patch | blob | history |
diff --git a/src/inkscape-private.h b/src/inkscape-private.h
index e6e6a44ea66c9430f88d6271d08fe6291f587e89..93fd9c8afb7a881fa54834987848a485a811ce4d 100644 (file)
--- a/src/inkscape-private.h
+++ b/src/inkscape-private.h
void inkscape_ref (void);
void inkscape_unref (void);
+guint inkscape_mapalt();
+void inkscape_mapalt(guint);
+
/*
* These are meant solely for desktop, document etc. implementations
*/
diff --git a/src/inkscape.cpp b/src/inkscape.cpp
index c167be493c0900a05a12b9560472da180c80b6a8..7e46efce6eb672e94fc91a195ff82bc2e9a5dc47 100644 (file)
--- a/src/inkscape.cpp
+++ b/src/inkscape.cpp
gboolean dialogs_toggle;
gboolean use_gui; // may want to consider a virtual function
// for overriding things like the warning dlg's
+ guint mapalt;
};
struct Inkscape::ApplicationClass {
inkscape->desktops = NULL;
inkscape->dialogs_toggle = TRUE;
-}
+ inkscape->mapalt=GDK_MOD1_MASK;
+}
static void
inkscape_dispose (GObject *object)
g_object_unref (G_OBJECT (inkscape));
}
+/* returns the mask of the keyboard modifier to map to Alt, zero if no mapping */
+/* Needs to be a guint because gdktypes.h does not define a 'no-modifier' value */
+guint
+inkscape_mapalt() {
+ return inkscape->mapalt;
+}
+
+/* Sets the keyboard modifer to map to Alt. Zero switches off mapping, as does '1', which is the default */
+void inkscape_mapalt(guint maskvalue)
+{
+ if(maskvalue<2 || maskvalue> 5 ){ /* MOD5 is the highest defined in gdktypes.h */
+ inkscape->mapalt=0;
+ }else{
+ inkscape->mapalt=(GDK_MOD1_MASK << (maskvalue-1));
+ }
+}
static void
inkscape_activate_desktop_private (Inkscape::Application *inkscape, SPDesktop *desktop)
Inkscape::UI::Dialogs::DebugDialog::getInstance()->captureLogMessages();
}
+ /* Check for global remapping of Alt key */
+ if(use_gui)
+ {
+ inkscape_mapalt(guint(prefs_get_int_attribute("options.mapalt","value",0)));
+ }
+
/* Initialize the extensions */
Inkscape::Extension::init();
diff --git a/src/main.cpp b/src/main.cpp
index 87913a80144e11ea01b536195afd8608b822bc44..cc359793a518983bdec6b68639fe8777cce17d10 100644 (file)
--- a/src/main.cpp
+++ b/src/main.cpp
return 0;
}
+static void
+snooper(GdkEvent *event, gpointer data) {
+ if(inkscape_mapalt()) /* returns the map of the keyboard modifier to map to Alt, zero if no mapping */
+ {
+ GdkModifierType mapping=(GdkModifierType)inkscape_mapalt();
+ switch (event->type) {
+ case GDK_MOTION_NOTIFY:
+ if(event->motion.state & mapping) {
+ event->motion.state|=GDK_MOD1_MASK;
+ }
+ break;
+ case GDK_BUTTON_PRESS:
+ if(event->button.state & mapping) {
+ event->button.state|=GDK_MOD1_MASK;
+ }
+ break;
+ case GDK_KEY_PRESS:
+ if(event->key.state & mapping) {
+ event->key.state|=GDK_MOD1_MASK;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ gtk_main_do_event (event);
+}
+
int
sp_main_gui(int argc, char const **argv)
{
inkscape_gtk_stock_init();
+ gdk_event_handler_set((GdkEventFunc)snooper, NULL, NULL);
+
Inkscape::Debug::log_display_config();
/* Set default icon */
index eb83a2b95c570a6046456d8fd67b07ff0ac687e4..457fa692631ff73d074c156bd059120262ef0f3f 100644 (file)
" </group>\n"
"\n"
" <group id=\"options\">\n"
+" <group id=\"mapalt\" value=\"1\" />"
" <group id=\"useextinput\" value=\"1\" />"
" <group id=\"nudgedistance\" value=\"2\"/>\n"
" <group id=\"rotationsnapsperpi\" value=\"12\"/>\n"