April 26, 2006

MPX:Multi-Pointer X Server

先說一個故事,以前我在 W-Channel 服務時,當時有個國內的大客戶要求一個相當特別的功能,希望能在我們的 Linux-based Thin client 中同時做到「前景顯示、前景部份操控」與「遠端顯示、遠端完全操控」,細節就不提了,設計頗 tricky,並且也 hack 了 X Extensions 才克服,結果沒多久,客戶說很滿意,期望再加入「多點操控」,簡單來說,就是希望能夠每個遠端登入都擁有自己的 cursor 並操控應用程式。

從事那個專案的開發,讓我學到頗多 X Window System 的內部設計與限制,前述的要求即 Multi-Point,在兩年前,類似的解決方案不多見。現在,來自南澳大利亞大學 Wearable Computer Labs 的 Peter Hutterer 成功實做 [The Multi-Pointer X Server (MPX)],他所要克服的議題,就很類似兩年前那個專案的需求,引用網頁介紹:
    The Multi-Pointer X Server (MPX) is compatible to legacy applications such as the GIMP, the Firefox web browser and numerous other applications. Each mouse device that is connected to the host computer can be configured to have a distinct system cursor. All cursors can operate on all applications. This allows for two-handed interaction and/or collaboration on a single display.
而,所謂「一圖勝千文」,咱們看看以下示意圖:

圖中有四個 Xeyes 應用程式,並且硬體提供四個 mouse,這四個 X Input device 彼此獨立,亦即系統配置四個 X cursors,上圖即展示在 [MPX:The Multi-Pointer X Server] 達到的效果。
目前的實做以 Xorg 為基礎,同時,為了更適合 Multi-Point 操控,Peter Hutterer 還發展了 Multi-Pointer Window Manager (MPWM),連同 patch 與 release tarball 都可自網頁取得。

注意到 FAQ 所提到的:
    Limitations?
    ...
    Some applications (e.g. xterm) stop listening for events when a LeaveNotify is received. Even if multiple mice are within the window, if one mouse leaves the window, xterm will not receive events. Finally, the X Protocol does not allow to specify devices on GrabPointer or QueryPointer requests. MPX has to guess which pointer to use. In some cases, this can be a semantically wrong choice.
也就是說,如果我們要發展更好的 Multi-Point 機制,勢必還得處理 XEvent expose/notify 的議題。
由 jserv 發表於 April 26, 2006 08:50 PM
迴響