www.nico.schottelius.org/software/gpm/browse_source/gpm-1.99.7/gpm2/mice
Nico Schottelius 95a46c5577 import gpm from unix.schottelius.org
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-10-08 22:52:35 +02:00
..
deps import gpm from unix.schottelius.org 2009-10-08 22:52:35 +02:00
init_mice_handler.c import gpm from unix.schottelius.org 2009-10-08 22:52:35 +02:00
mice_handler.c import gpm from unix.schottelius.org 2009-10-08 22:52:35 +02:00
ps2.c import gpm from unix.schottelius.org 2009-10-08 22:52:35 +02:00
README import gpm from unix.schottelius.org 2009-10-08 22:52:35 +02:00

This directory should contain the mice-protocol implementations.

Each file (or if bigger: directory) implements one protocol.

You have to create three functions:

   gpm2_open_<protocol>();
   gpm2_handle_<protocol>();
   gpm2_close_<protocol>();

It's not yet clear, how to register protocols to gpm2.

First idea of inclusion:

- create deps/mouse-<protocol> containging all dependencies
- conf/built-options/mice specifies which mice protocols to include
- a script generates include/gpm2-daemon-mice.h containg a struct-array
  that looks like:

   struct mice_protos {
      char *name;
      int (*open)();
      int (*handle)();
      int (*open)();
   };

--------------------------------------------------------------------------------
More design ideas for using mice:

   - The gpm2_handle function gets a pointer to a char array containing the
     data packet.
   - The gpm2_handle function returns what the packet means
   - gpm2_daemon may then decide what todo with this information

--------------------------------------------------------------------------------
It would be nice to have a read_config_<proto> that reads and verifies
the protocol specific options.

For this, it would be nice to have a libcconfig() like this:

   struct cconfig_fd    *cconfig_open(char *dir);
   struct cconfig_tree  *cconfig_read_tree(struct cconfig_fd *which);

   struct cconfig_element  *cconfig_select_below(char *basepath, struct cconfig_fd *which, ...);

   The tree, cconfig_read_tree creates could consist of elements
   of the following definition:

   struct cconfig_element {
      char        *path;
      struct stat sbuf;
   };

--------------------------------------------------------------------------------
gpm2_open_*:
   - needs fd
   - needs options

--------------------------------------------------------------------------------
struct datapacket *gpm2_read_*(int fd)
   - reads one packet
   - returns it
--------------------------------------------------------------------------------