I have re-written my own canvas class and I would like to get the information when the arrows: kkey_left, kkey_right… are pressed. And I want this working on linux ans mac_os.
The problem I have with the “standard” way to do in HandleInput(EEventType event, Int_t px, Int_t py)
is that on my mac, when I am pressing the arrows, the px and py values are not corresponding to the KeySymbols but to the x and y positions on my canvas. I still have the possibility to check wether the x is lower than the previous recorded one but its not optimal and does not work for kkey_Up and down.
A solution I have found is to use the EventProcessed(Event_t *ev, Window_t) method, with:
But I realized that on some computer, for a reason that I cannot understand, this LookupString method crash, so I cannot use it anymore as my software is used by a large community.
I have seen that the event->fcode is different if I press the different arrows, but for what I have understood, the fcode can be different on different architectures, so I cannot use it neither.
The fact is that, for a reason that I cannot understand, the method: gVirtualX->LookupString(event, input, sizeof(input), keysym); crashes on some users architectures. So I wanted to find a way to not use this LookupString method.
The problem is that I cannot reproduce this crash myself but they obtain something like this:
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00007ff1150e307a in __GI___waitpid (pid=13078, stat_loc=stat_loc
entry=0x7ffc545e6580, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1 0x00007ff11505bfbb in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2 0x00007ff1163a5ed0 in TUnixSystem::StackTrace() () from /illdata/applications/fipps/root/root-6.20.00_install/lib/libCore.so
#3 0x00007ff1163a8934 in TUnixSystem::DispatchSignals(ESignals) () from /illdata/applications/fipps/root/root-6.20.00_install/lib/libCore.so
#4 <signal handler called>
#5 0x00007ff10ea94107 in XLookupString () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#6 0x00007ff0fab4ffc5 in TGX11::LookupString(Event_t*, char*, int, unsigned int&) () from /illdata/applications/fipps/root/root-6.20.00_install/lib/libGX11.so
#7 0x00007ff116b25e64 in CXMainWindow::ProcessedKeyEvent (this=0x33581e0, event=0x7ffc545e9b80) at /illdata/applications/fipps/gammaSoftware/LYON/gw/src/root/gui/cubix/src/CXMainWindow.cpp:1253
#8 0x00007ff038cb4034 in ?? ()
#9 0x0000000000000000 in ?? ()
===========================================================
Yes this works also for me… I am trying to find a user for whom this LookupString is crashing to try to understand why and find a patch that works for everyone… but it’s really not easy to test developments on a computer that you don"t have.