Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capturing events in X11 even after the loss of focus

Tags:

java

c

x11

I am trying to develop an application which responds to multiple digital pens (IRIS Pens) so that if any of the pen writes on paper; I relay the output to a single screen. Thus making a multi-input whiteboard for myself.

In Ubuntu these pens are recognized as mouse and thus can be handled in a similar manner as mouse events are handled.

So now what I plan to do is to handle these events in C/C++ using XLib and pass these events to a Java Swing application using JNI callback. I am able to do this but when the X11 window looses focus no events are transferred to the Swing frame. I also tried to use the root window in X11 but it does not seem to work.

Any help would be really appreciated. Thanking you in advance.

like image 919
Himanshu Verma Avatar asked Sep 01 '25 01:09

Himanshu Verma


1 Answers

How about maximizing the C/X11 window in front of the Java one, and making it transparent? You should be able to see the Java window while still focusing on the C/X11 one.

Since you are using Ubuntu, you can achieve this using the "Opacity, brightness and saturation" plugin for Compiz. It is in the compiz-plugins-main package, and you can activate it with Compiz Settings Manager (from the compizconfig-settings-manager package). When you activate the plugin, alt+wheel is bound by default to change the transparency of the focused window.

like image 71
user981733 Avatar answered Sep 03 '25 06:09

user981733