| Summary: | GTK-BIDI: RTL support in Scale | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Semion Chichelnitsky <semion> |
| Component: | SWT | Assignee: | Bogdan Gheorghe <gheorghe> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | billy.biggs, eclipse.felipe, ericwill, markus.kell.r, matial, salexb |
| Version: | 3.0 | Keywords: | helpwanted, triaged |
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux-GTK | ||
| Whiteboard: | stalebug | ||
| Attachments: | |||
|
Description
Semion Chichelnitsky
Created attachment 5665 [details]
OS.java from build N20030729 with proposed changes.
Our changes are marked with tag "bidi for scale".
Created attachment 5666 [details]
os.c from build N20030729
Our changes are marked with tag "bidi for scale".
Created attachment 5667 [details]
Scale.java from build N20030729
Created attachment 7825 [details]
os.c from build I20040210 with proposed changes.
Our changes are marked with tag b41240.
Created attachment 7826 [details]
OS.java from build I20040210 with proposed changes.
Our changes are marked with tag b41240.
Created attachment 7827 [details] Scale.java from build I20040210 with proposed changes. Our suggestion (about using of *Up and *Down keys) for some reason was declined by GTK team. Therefore workaround is needed here. It is supposed, that general problem, which is described in the bug 41184, is solved by the newly suggested way. Our changes are marked with tag b41240. The patch is not quite right, it has custom c code, it leaks memory, and it
doesn't honour the group and the level of the event (not sure this last item
matters).
For me, when the scale is vertical RTL the left/arrow key don't move the thumb
in the right direction.
I also changed the code to do the work right before return to the OS, swapping
the keys before running translate mnemonic and sending the event to the
application is wrong in my opnion (test on windows).
Here is the code I'm working on:
int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ event) {
int /*long*/ result = super.gtk_key_press_event (widget, event);
if (result != 0) return result;
if ((style & SWT.RIGHT_TO_LEFT) != 0) {
GdkEventKey keyEvent = new GdkEventKey ();
OS.memmove (keyEvent, event, GdkEventKey.sizeof);
int key = keyEvent.keyval;
if ((style & SWT.HORIZONTAL) != 0) {
switch (key) {
case OS.GDK_Up: key = OS.GDK_Down; break;
case OS.GDK_KP_Up: key = OS.GDK_KP_Down; break;
case OS.GDK_Down: key = OS.GDK_Up; break;
case OS.GDK_KP_Down: key = OS.GDK_KP_Up; break;
case OS.GDK_Page_Up: key = OS.GDK_Page_Down; break;
case OS.GDK_Page_Down: key = OS.GDK_Page_Up; break;
}
} else {
switch (key) {
case OS.GDK_Right: key = OS.GDK_Left; break;
case OS.GDK_KP_Right: key = OS.GDK_KP_Left; break;
case OS.GDK_Left: key = OS.GDK_Right; break;
case OS.GDK_KP_Left: key = OS.GDK_KP_Right; break;
}
}
if (key != keyEvent.keyval) {
int keymap = OS.gdk_keymap_get_default ();
int /*long*/[] keys = new int /*long*/[1];
int /*long*/[] n_keys = new int /*long*/[1];
if (OS.gdk_keymap_get_entries_for_keyval (keymap, key, keys, n_keys)) {
int [] keymapKey = new int [3];
int level = (keyEvent.state & OS.GDK_SHIFT_MASK) != 0 ? 1 : 0;
for (int i = 0; i < n_keys [0]; i++) {
OS.memmove(keymapKey, keys [0] + (i*3*4), 3*4);
if (keymapKey [1] == keyEvent.group && keymapKey [2] == level) {
keyEvent.hardware_keycode = (short) keymapKey [0];
keyEvent.keyval = key;
OS.memmove (event, keyEvent, GdkEventKey.sizeof);
break;
}
}
OS.g_free (keys [0]);
}
}
}
return 0;
}
This kind of code is very bad, I wish we could find a different solution for the problem... Billy, you who masters gtk, any advise ? This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |