Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Mousebehaviour

by Jouke (Curate)
on Feb 20, 2001 at 15:40 UTC ( [id://59637]=perlquestion: print w/replies, xml ) Need Help??

Jouke has asked for the wisdom of the Perl Monks concerning the following question:

Hello fellow monks,

I asked some specific questions on this item before, but I haven't quite found the answer I needed. I'm sure that my explanation of what I wanted to do is the reason for this.

I'm writing an application which shows a number of images on the screen, and it lets the user browse through these images until he or she finds the correct one, and with some mouse-action (probably leftclick...) this one is selected.

Very simple, but there is one big difficulty: the application is for disabled people who cannot operate a mouse. There is, however, a device that translates certain actions by disabled people into mouse-events. In case of my daughter: she has a 'thing' around her head (I don't know the english translation for the dutch word 'hoofdsteun') connected to this device, and when she moves her head right or left, a (configurable) mouse-event is generated. These two actions are the only actions that can be generated. I can however configure what mouse-event is generated by moving her head left or right. The possibilities are 'left single click', 'right single click', 'left double click', 'right double click', 'left triple click', 'mouse up', 'mouse down', 'mouse left', 'mouse right'.

To operate the PC normally and to start the program, still a mouse is connected, which can accidentally be moved.

I thought using Tk was the simplests option. The problem however is that I defined 'single click left' to select the active image, and 'single click right' to activate the image to the right (browse). But when the mouse is accidentally moved (the whole installation is on a laptop on a wheelchair...it moves...) the mousepointer moves out of the active window, and a single click left or right after that moves the focus outside of the program and the disabled person needs non-disabled to correct this.
I already started the program in maximized size, but still a gnomepanel or windows-startbar is visible (and clickable).

Does anyone have an idea how to solve this? Should I use something else for this? Is it possible to run it fullscreen?

Any help would be greatly appreciated

Jouke Visser, Perl 'Adept'

Replies are listed 'Best First'.
Re: Mousebehaviour
by jeroenes (Priest) on Feb 20, 2001 at 17:43 UTC
    Well, in CB it appeared you want to run on both win32 and linux. And you want to run more than one app. On linux, the following might do the trick:
    1. Start your xserver without any winmanager or app.
    2. Write yourself a switcher, with nice big icons.
    3. Put this switcher with -geometry in the left upper corner of your screen.
    4. This switcher starts some predefined apps, and place them somewhere on the available space on the right, on top of other apps, but not touching your switcher.
    5. If the switcher must switch to a running app, the switcher send an XEvent to that app, to call it on top.

    You could port the whole darned thing to win32. For that, you need an Xserver, and cygwin, to run your apps in the XServer. The XServer is the tricky thing, as there are no good free XServers. They all have their disadvantages. It should be possible to run a XFree86 on cygwin, but I couldn't get it working a few months ago. MI/X from http://www.microimages.com is a shareware alternative, but sadly enough it starts a window manager right away.

    Hope this gets you started,

    Jeroen
    "We are not alone"(FZ)

    Update: Maybe you just can forget about XServers in win32, and keep a app running that checks for forbidden apps, and kill them. And update the windows position of the 'good' apps every cycle... see Win32::Process in the active state distro.

Re: Mousebehaviour
by Albannach (Monsignor) on Feb 20, 2001 at 19:07 UTC
    I gather that it is not your daughter who actually uses the mouse, but rather someone else who sets up the application for her? Have you thought about some sort of mounting device for the mouse that would protect it from accidental movement? The velcro idea mentioned earlier could be good, but my first thought was a little bracket that would hold the mouse around its edges and leave the ball untouched (another thought, what about the optical mouses that are available?). I think I've seen such mouse 'hangers' marketed for holding the mouse on the side of a monitor.

    No matter what you do though, I think that some small mouse ball movement is going to be inevitable given that your whole workstation is on wheels (would an optical mouse generate random 'movement' from ambient light fluctuations?). Perhaps a switch wired in-line in the mouse cable could be used to disable/enable it? I know in Win32 one can (usually) unplug/replug the mouse with no ill-effects, and you could perhaps wire a switch to cut key wires to simulate this.

    Update: Another thought: I don't know if/how you could do this with Perl/Tk but in Delphi I've seen applications that simply don't allow the mouse pointer to leave a specified area. This isn't friendly to other applications and you have to provide a simple way out of your app, but maybe this is an option (aha, baku has this idea).

    --
    I'd like to be able to assign to an luser

Re: Mousebehaviour
by epoptai (Curate) on Feb 20, 2001 at 16:53 UTC
    If you can't find a software solution just flip the mouse over, the ball doesn't usually move when it's inverted.

    Another thought, get a Logitech cordless mouse and move it out of range of the receiver (~6ft) to disable it.

    Update:

    Use your imagination here. You could invert the mouse and place it somewhere (that exists or that you create) so that the buttons can't be easily pressed. Velcro® is a wonderful way to improvise mounting solutions for small electronic devices :-)

      What do you mean by flipping the mouse over? Laying it on its back? I don't think that would be a good idea, since the buttons would easily be pressed that way.

      The cordless mouse wouldn't either, because she carries everyting with her on her wheelchair. When she goes to school, she takes the laptop with her, along with the mouse...And little seperate things get lost

      Jouke Visser, Perl 'Adept'
Re (tilly) 1: Mousebehaviour
by tilly (Archbishop) on Feb 20, 2001 at 19:35 UTC
    I don't know anything about the hardware space, but before trying to do this from scratch, I would suggest trying to get in contact with disabled people and find out what solutions they use.

    For instance from a brief search I ran across this old mention on /. of a possibly useful technology for your mouse problem. Even if it is wrong, some of the email addresses of people in that thread may be useful contacts in trying to get in contact with other people with similar situations on their hands.

    Sorry that is all I can suggest, and good luck with your daughter.

Re: Mousebehaviour
by baku (Scribe) on Feb 20, 2001 at 19:34 UTC

    You could, perhaps, "grab" the mouse pointer, so that your app will receive all mouse events. This *should* work under Win32 as well as Linux (unless using a particularly cruel & unusual window manager); the Tk::grab manual page describes this. (Common use for grabbing a pointer are menus or drag & drop; the application whence the dragged item is being moved maintains control of the pointer until the button is released, the source of some nasty annoyances if you click "File" in Netscape right when it decides to do a very slow DNS lookup.) You could then scan for e.g. a keypress or some other event not likely to be accidental to release your grab on the pointer.

    Best of luck

Re: Mousebehaviour
by mothra (Hermit) on Feb 20, 2001 at 19:11 UTC
    Perhaps you should consider using a trackball mouse. It's like having the mouse "turned upside down" without worrying about its buttons getting clicked. :)

    Also, using one of these in combination with turning the sensitivity down would reduce these problems to a minimum.

Re: Mousebehaviour
by zigster (Hermit) on Feb 20, 2001 at 16:05 UTC

    Take the mouse ball out? That should prevent the mouse moving when you dont want it to.
    --

    Zigster

      Not an option. The mouse should stay usable for other tasks like starting other applications

      Jouke Visser, Perl 'Adept'

        Can you turn off the mouse with xsetpointer or something? Perhaps the easiest thing to do would be to replace the mouse with a touchpad?

        I know you said that there is a touchpad on the laptop, but could you cover the touchpad with some tape and a flap so that it wouldn't accidently get hit? If I have the right mental image in mind that would protect the touchpad from sensing unwanted input, and the worst thing that may happen would be that a mouse button me be pressed.

        However before doing that I would check to make sure that when the laptop was closed whatever you put there wouldn't touch or be able to scratch the screen.

        One last thought... have you looked into voice recognition products like dragon dictate or IBM's ViaVoice. I am not certain if these products are supported for languages other than English, but typically you can train them for at least simple phrases to do basic commands. Even though they may be English products you might be able to trick them into still working. If you could do that you may be able to vastly increase your range of input.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://59637]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2024-03-28 10:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found