Hello

Yes I am still around and you probably got lucky because I need this fix
for a class I am teaching once a year and I am currently preparing that
class. I have not touched the tiemu part yet, though.

It has to be said that this fix is not complete at all, it is more of a
hack to allow me to use some keys during said class. It should be fairly
easy to add additional mappings to suit your needs, though.

In general, this diff may help you to see what I did:

https://launchpad.net/~launchpad-
weyland/+archive/ppa/+files/tiemu_3.02-1ubuntu2ppa1.diff.gz

I just realised that this patch contains more stuff than it should, so
here is a brief walkthrough of what I did:

1. Define keynames with their appropriate pckey number. This is done in
tiemu-3.02/src/gui/calc/pckeys.h. Apparently, I am making use of
gdkkeysyms.h definitions here. I don't quite remember why I did this but
I don't see any reason why this is critical, so it was probably bare
convenience or something.

Example:
#define PCKEY_PERIOD GDK_period
#define PCKEY_PIPE GDK_bar
#define PCKEY_EQUALS GDK_equal

2. Assign strings to these definitions. This is done in
tiemu-3.02/src/gui/calc/keynames.c.

Example:
    { PCKEY_PERIOD, "PCKEY_PERIOD" },
    { PCKEY_PIPE, "PCKEY_PIPE" },
    { PCKEY_EQUALS, "PCKEY_EQUALS" },

3. Map these strings to the appropriate ti key. This is done in
tiemu-3.02/skins/ti89.map.

Example:
PCKEY_PERIOD:TIKEY_PERIOD
PCKEY_PIPE:TIKEY_PIPE
PCKEY_EQUALS:TIKEY_EQUALS

4. Because I used the gdk definitions above, I have to add the proper
translation in tiemu-3.02/src/gui/calc/keyboard.c:

 -        return hwkey_to_tikey(event->hardware_keycode, !0) ? TRUE : FALSE;
+    {
+        if(!hwkey_to_tikey(event->keyval, !0))
+        {
+            guint newkeyval;
+            GdkKeymap *keymap = gdk_keymap_get_default();
+            gdk_keymap_translate_keyboard_state(
+                    keymap, event->hardware_keycode, 0, event->group,
+                    &newkeyval,NULL,NULL,NULL);
+            return hwkey_to_tikey(newkeyval, !0) ? TRUE : FALSE;
+        }
+        return TRUE;
+    }

[...]

-    return hwkey_to_tikey(event->hardware_keycode, 0) ? TRUE : FALSE;
+    if(!hwkey_to_tikey(event->keyval, 0))
+    {
+        guint newkeyval;
+        GdkKeymap *keymap = gdk_keymap_get_default();
+        gdk_keymap_translate_keyboard_state(
+                keymap, event->hardware_keycode, 0, event->group,
+                &newkeyval,NULL,NULL,NULL);
+        return hwkey_to_tikey(newkeyval, 0) ? TRUE : FALSE;
+    }
+    return TRUE;

(the information in the patch shows where this has to be put. To be
honest it looks quite messy and I am not even sure that I knew what I
was doing, so I guess I will have to revise this anyway. I remember that
I did this the night before the first time I had to teach the class and
time was not exactly the resource I had at hands.)

One additional note: Both the left and the right shift keys are mapped
to the TI89 shift key by default. I did not like this and removed the
binding of the right shift key. This allows me to use the TI89 shift
using my left shift key and pass through capital letters using a
combination with the right shift key. You may or may not want this
behaviour.

An attempt to answer your questions:

1. I used the gdk bindings, probably because I was too lazy to retrieve the 
actual pckey value. (Or now that I think of it, gdk may add another layer of 
abstraction that deals with the y vs. z problem mentioned in the bug 
description).
2. TIemu interprets these codes by the pckey definition -> pckey string -> 
tikey mapping in the three files mentioned above.
3. I altered the existing mapping in these files such that it would fix the bug 
and suit my needs. (Maybe I also introduced new mappings).

As for the PPA, I am not sure what "my PPA is not responding" means.
Last time I dealt with PPAs, you just had to upload your stuff; no
further action was required. If you mean that there is no version in
there for the current ubuntu release, that is indeed correct. I am not
sure about the consequences of using the existing packets. The TIemu
version seems to be the one you are looking for, but you may run into
dependency problems.

Whether my PPA solves your problem in general depends on what kind of
mappings are broken on your system. (Mostly depends on the keyboard
layout and on personal preferences). Since I have to dive into this
anyway: In case you can afford waiting for a fix for a couple of days,
you could describe your particular mapping issues in more detail and I
could add this to the new version of the patch. However, I abandoned
ubuntu due to some shenanigans canonical pulled which shall remain
unnamed here, so I cannot guarantee that my upload will work, but you
may be interested in doing some testing and reporting it back here.

Best regards

Matt

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/373767

Title:
  Incorrect keyboard mapping

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/tiemu/+bug/373767/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to