PDA

View Full Version : Disabling Mouse in Qt?



ashukla
2nd December 2007, 11:15
Dear Everyone!

How a way I can disable mouse for a definite period?
or
Any way is possible in Qt to disable mouse port (communication port or usb port) logically(programatically)?

Thanking in advance!

jpn
2nd December 2007, 11:23
No, Qt does not provide support for such. Why would you like to do so?

wysota
2nd December 2007, 11:24
You can grab the mouse (QWidget::grabMouse()) and ignore all mouse events you receive. Don't forget to release the mouse afterwards or your system becomes unusable.

ashukla
2nd December 2007, 12:03
You can grab the mouse (QWidget::grabMouse()) and ignore all mouse events you receive. Don't forget to release the mouse afterwards or your system becomes unusable.
I am creating one parent widget & three child QX11EmbedContainer widget.
In first child widget I am embedding GTK application in QX11EmbedContainer. When I am grabbing mouse, It grabs the mouse only for second & third widgets. but not in First widget.

This is the reason I want to disable mouse port when I showing the widget & when I close the widget enable the port.

Is it possible in Qt.
I am knowing to do this in windows using interrupt handling?
but How a way it can be implemented in Linux FC6 using pure C/C++ programming if it is not possible in Qt.

MarkoSan
2nd December 2007, 12:14
Well, mouse cursor can bi hidden with bios service 33h. Function code is 2. That means:

mov ax, 02
int 33h

will hide mouse cursor and disable mouse, regardless of port. This method is way low level, but efficent.

ashukla
4th December 2007, 06:35
Well, mouse cursor can bi hidden with bios service 33h. Function code is 2. That means:

mov ax, 02
int 33h

will hide mouse cursor and disable mouse, regardless of port. This method is way low level, but efficent.
How to disable mouse port in Linux?

MarkoSan
4th December 2007, 06:41
This approach work on all pc computers, regardless of operating system. However, I think you must write assembler program and to "touch" bios you must be careful because you are turning to kernel mode.

ashukla
4th December 2007, 07:01
This approach work on all pc computers, regardless of operating system. However, I think you must write assembler program and to "touch" bios you must be careful because you are turning to kernel mode.
But It only hides the mouse. I want to disable the mouse port for a specified amount of time.

plz give me a example for this purpose or link.

MarkoSan
4th December 2007, 07:04
From my experience, the mouse is disabled if this bios function is called. I've done it and it worked in good old DOS.

ashukla
4th December 2007, 07:12
From my experience, the mouse is disabled if this bios function is called. I've done it and it worked in good old DOS.
I have also done in DOS and windows OS; but I don't know how to do this in Linux.
Can u give me any link or example to do this.

wysota
4th December 2007, 11:15
What do you need the functionality for? If you want to do it on Linux, you have to have superuser privileges, otherwise forget it, it won't work. I don't know why it doesn't work when you grab the mouse, maybe it grabs the pointer only within the current application and your GTK widget is another application. In that case you need an appropriate Xlib call to grab the mouse for the whole desktop or filter out mouse events that are received by the server.

ashukla
4th December 2007, 13:16
What do you need the functionality for? If you want to do it on Linux, you have to have superuser privileges, otherwise forget it, it won't work. I don't know why it doesn't work when you grab the mouse, maybe it grabs the pointer only within the current application and your GTK widget is another application. In that case you need an appropriate Xlib call to grab the mouse for the whole desktop or filter out mouse events that are received by the server.
Dear Sir!
Where I get the Xlib call example to grab mouse?

wysota
4th December 2007, 19:18
I didn't say such a call exists. But studying Xlib manual might be a good place to start looking for a solution.