PDA

View Full Version : Where does InputEvent( ev[i]) get caught?



RolandHughes
1st May 2013, 23:01
Been searching and searching and searching. Pulled down the source for 4.8.4 and cannot find where onInputEvent() gets caught. Cannot find it in the code even, so...either I'm missing some code or there is some hidden knowledge.

I "want" to be able to use this to obtain all of the built in character translation. I need to find where it is done though so I can stop it from generating a keyboard event when a barcode scanner actually originated the text.

I would appreciate BOTH a source file and line number to look at. It appears it "should" be caught in the X11ProcessEvent() method at line 3220 of qapplication_x11.cpp, but not really seeing this.

Thanks!

ChrisW67
2nd May 2013, 01:53
If you don't want an X11 input event generated from a keyboard like device then you could tell X11 to ignore it from xorg.conf:


Section "InputClass"
Identifier "Ignore barcode reader because I am reading it directly through /dev/input/eventx"
MatchProduct "Whizzo barcode reader"
Option "Ignore" "yes"
EndSection


Looks like you should be able to intercept raw XEvents by installing a QCoreApplication::setEventFilter() (or QAbstractEventDispatcher::setEventFilter())

RolandHughes
2nd May 2013, 15:08
If you don't want an X11 input event generated from a keyboard like device then you could tell X11 to ignore it from xorg.conf:


Section "InputClass"
Identifier "Ignore barcode reader because I am reading it directly through /dev/input/eventx"
MatchProduct "Whizzo barcode reader"
Option "Ignore" "yes"
EndSection


Looks like you should be able to intercept raw XEvents by installing a QCoreApplication::setEventFilter() (or QAbstractEventDispatcher::setEventFilter())

Thanks for your response. Was hoping to avoid xorg mod since other targets won't have xorg. Will play with event filter at core application level. Really wanted to get event _after_ translation to Unicode and _before_ it became a keypress event so I wouldn't have to recode the wheel. Will play with this today and see how it turns out.

Thanks again.

ChrisW67
3rd May 2013, 00:41
You can filter cooked events using qApp->installEventFilter() but by that time you can no longer tell where the key event has come from. QApplication::x11EventFilter() might be easier for raw XEvents. I am not sure you can get the original source device this way either.


Was hoping to avoid xorg mod since other targets won't have xorg.
I do not think you will find a universal, platform independent manner in which to do this.