The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/bitsy/mouse.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #include "u.h"
    2 #include "../port/lib.h"
    3 #include "mem.h"
    4 #include "dat.h"
    5 #include "fns.h"
    6 #include "../port/error.h"
    7 #include "io.h"
    8 
    9 #define Image   IMAGE
   10 #include <draw.h>
   11 #include <memdraw.h>
   12 #include <cursor.h>
   13 #include "screen.h"
   14 
   15 enum {
   16         Button1 = 0x1;
   17         Button2 = 0x2;
   18         Button3 = 0x4;
   19 };
   20 
   21 int             buttons;
   22 Point   position;
   23 
   24 static void
   25 mousevent(void) {
   26         static int              curbuttons;
   27         static Point    curposition;
   28 
   29         if (buttons == curbuttons && eqpt(position, curposition))
   30                 return;
   31 
   32         /* generate a mouse event */
   33         curbuttons = buttons;
   34         curposition = position;
   35 }
   36 
   37 void
   38 buttonevent(int event) {
   39         switch (event) {
   40         case 0x02:
   41                 /* Button 2 down */
   42                 buttons |= Button2;
   43                 mousevent();
   44                 break;
   45         case 0x82:
   46                 /* Button 2 up */
   47                 buttons &= ~Button2;
   48                 mousevent();
   49                 break;
   50         case 0x03:
   51                 /* Button 3 down */
   52                 buttons |= Button3;
   53                 mousevent();
   54                 break;
   55         case 0x83:
   56                 /* Button 3 up */
   57                 buttons &= ~Button3;
   58                 mousevent();
   59                 break;
   60         default:
   61                 /* other buttons */
   62         }
   63 }

Cache object: 3a4dbd51f33c5e0dc4a1611dec101c69


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.