[Qt-interest] Multiple monitors and multiple input devices

Matthias Paul slayer81 at gmx.de
Thu Aug 25 11:54:07 CEST 2011


Hello Qt community!

I was able to answer the question myself.

Working in windows only, I was able to get the mouse/touch device ids by WinAPI calls to GetRawInputDeviceList() and GetRawInputDeviceInfo(). Then the raw input devices were registered for receiving WM_INPUT events by call to RegisterRawInputDevices().
Next step utilized QApplication::winEventFilter(), which captures mouse move and mouse press events. This method jails the original mouse on monitor 1 by checking QCursor::pos() for valid screen coordinates. I didnt use the original MSG object delivered QApplication::winEventFilter(), because this uses raw, unfiltered values (saves me the hazzle of impl'ing a mouse driver).

If someone need's code, let me know :)

Cheers,
Paule



-------- Original-Nachricht --------
> Datum: Wed, 10 Aug 2011 10:38:30 +0200
> Von: "Matthias Paul" <slayer81 at gmx.de>
> An: qt-interest at qt.nokia.com.
> Betreff: [Qt-interest] Multiple monitors and multiple input devices

> Dear Qt community,
> 
> I'm currently working on a new display setup: Windows 7x64 machine plugged
> to a usual HD display as primary display device.
> Also there's a small LCD display (800x400 pixel), which is attached to
> secondary graphics adapter output.
> 
> I'd like to separate the two desktops which are currently init'ed as one
> virtual display using Qt:
> 
> 1. The user must not be able to move dialogs/windows from one display the
> one.
> Already partly fulfilled, because I prevent to move the widget from LCD to
> HD by setting the window size as fixed and maximize it. Still I'm able to
> move windows from HD to LCD. I'd be able to catch QMoveEvent and
> QResizeEvent of my Qt widgets and check them, whether they are spanning into second
> display and react. But I guess, I cannot catch events of native windows
> applications to prevent the same behaviour, am I right?
> 
> 2. The user must not be able to operate with the mouse on LCD display
> (secondary).
> 
> 3. The user must not be able to operate with the additional touch pad,
> which is attached to LCD, on HD display (primary).
> This is easy by driver setting. Nevertheless, after using the touchpad and
> then returning to mouse input, the mouse cursor is located on touchpanel
> region. There seems to be no way to use both inputs at the same time, is
> there one?
> 
> I'm not sure: Can touchpad and mouse be distinguished programmatically, so
> I simply push cursor to a valid location, if they leave their areas (LCD
> or HD)?
> 
> Thank you for reading!
> Paule
> -- 
> NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!		
> Jetzt informieren: http://www.gmx.net/de/go/freephone
> 

-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de



More information about the Qt-interest-old mailing list