Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Linux/X11 Keyboard interceptor

Posted on 2004-04-11
8
Medium Priority
?
314 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
8 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 Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

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…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

618 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