saturday, 1 september 2007

posted at 09:14
  • mood: grumpy

So I spent my bus rides and my evening yesterday writing a whole new mouse input setup for FFE. It works properly, in that pressing the right mouse button stops the system receiving mouse events. As is typical for AROS, there's a problem. Admittedly its specific to the hosted environment but thats where I live so its frustrating.

The input system for AROS (and AmigaOS) is layered. At the bottom is the hardware - keyboard, mouse, game ports. Above that is input.device, which hits the hardware (actually it has drivers to do this, but lets just say it does). Higher layers register with input.device and arrange to be called when events come in. Each thing registers with a priority, and when an event happens, the thing with the higher priority gets informed of it first, then the next, until they've all been called. The higher levels can modify the received events so the lower ones don't see them.

Its worth noting that the Commodities Exchange registers with priority 56, with Intuition at 50. console.device is at 0, so it picks up the dregs. CX appearing before Intuition is how it is able to intercept mouse clicks and do fancy things.

On native, Intuition is responsible for managing the mouse pointer, moving it, etc, so if you stop it from receiving mouse events (eg by doing what I do with FFE with a priority 100 handler), it doesn't move. On hosted though, its a different story. X11 controls the mouse there, and the hosted environment fakes mouse hardware stuff to tell input.handler what's happening. The mouse continues to move though - there's no way to stop it.

This is incredibly frustrating, of course. AROS should do what other emulation things with their own mouse (eg VMWare) do - capture mouse input from X, releasing it only when some magic key combination is pressed.

To make this happen means hacking on the X11 HIDD, which is some of the worst code ever. So as usual, implementing some tiny feature (making my spaceship fly properly) means learning and rewriting some major OS subsystem. And people wonder why AROS is hard for devs to get into? All I want to do is write my app. I don't want to have to fix every damn mistake in the OS to get there.

Yes, this is something of a rant. I've been here before though - remember that whole DOS trip I went on a few months back?

So FFE is backburnered for a little while, and I'm considering writing a new HIDD based on SDL (I stubbed one a while ago). If I did, it would be clean and pure and incredibly well documented so that graphics HIDDs aren't deep magic any more.