Re: how to get mouse and keyboard focus?



I want to develop a software that periodically gets mouse and keyboard focus
and lock both for some minutes.
In other words, I want to prevent the user to use mouse and keyboard.

Does anyone know what functions of Gtk+ and/or glib can I use?

Perhaps you could just use a modal window:
        gtk_grab_add (window)  gtk1.2
which by definition grabs focus, so everything else
is blocked. Your dialog window could have only
a label showing a message, something as: 

"time for cofee :-), mouse and keyboard disabled :-("

After some minutes you just remove this
window and the user has control again.
If you want (and you know the times)
you can even add a progress
bar in continous mode, so the user
knows how much time has to wait.

If you do this, you must block also 
the delete_event signal in the window,
so users cannot close it with the
WM decoration tools, Close, etc...
(no way to block the Kill though)

This is simple and gives users a clue.

Carlos



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]