?
Solved

Linux/X11 Keyboard interceptor

Posted on 2004-04-11
8
Medium Priority
?
317 Views
Last Modified: 2010-04-21
Hi,

for some twisted reason, i need to write a program that locks any input from keyboard/mouse for other than my application.
I already tried, with limited success, with SDL WM_GrabInput, but that does not grab key combinations like CTRL+ALT+BACKSPACE or CTRL+ALT+F2.

What i need is advice, and possibly C (im programming in FPC for this) code to accomplish a total lockout from the keyboard, in order to prevent X shutdown, or console switching.
I dont expect answers or comments like "use XDM" or "disable the TTYs and run in X runlevel", since that's not what im looking for (actually might be the worst case scenario if there's no other solution to my problem".

Thanks.
0
Comment
Question by:KiCk
  • 3
  • 2
6 Comments
 
LVL 9

Expert Comment

by:Alf666
ID: 10804493
Get the source of the "xev" utility.

It's a small X11 utility that allows you to grab any X11 events (including key presses/releases).
It's a very old X11 stuff which is a perfect example of what you are trying to achieve. It uses native X11 calls.
0
 
LVL 9

Expert Comment

by:Alf666
ID: 10804500
0
 
LVL 2

Expert Comment

by:astrand
ID: 10893157
To prevent the Xserver from ending / switching to VTs on CTRL+ALT+BACKSPACE / CTRL+ALT+F2, you need to change you XF86Config. Activate options DontZoom and DontZap.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:KiCk
ID: 10907005
DontZap does not prevent console switching.
DontZoom prevents the user from switching screen resolution, which i actually need :)

As for xev, that captures the events from within the window, not from all windows.
0
 
LVL 2

Accepted Solution

by:
astrand earned 2000 total points
ID: 10907454
> DontZap does not prevent console switching.0

Ah, sorry. DontVTSwitch is what you want in this case.

As for listen to all events, try the program ftp://ftp.lysator.liu.se/pub/misc/evcnt-1.0.tar.gz.
0
 
LVL 9

Expert Comment

by:Alf666
ID: 10908301
I know the xev does not get all events, but it's a good example of what can be done.
Based on that, you can do whatever you want.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Loops Section Overview
Suggested Courses
Course of the Month13 days, 19 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question