Logo
  • Main Page
  • Related Pages
  • Modules
  • Classes
  • Files

mmsinputlishandler.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider,             *
00003  *                           Matthias Hardt, Guido Madaus                  *
00004  *                                                                         *
00005  *   Copyright (C) 2007-2008 BerLinux Solutions GbR                        *
00006  *                           Stefan Schwarzer & Guido Madaus               *
00007  *                                                                         *
00008  *   Copyright (C) 2009-2013 BerLinux Solutions GmbH                       *
00009  *                                                                         *
00010  *   Authors:                                                              *
00011  *      Stefan Schwarzer   <stefan.schwarzer@diskohq.org>,                 *
00012  *      Matthias Hardt     <matthias.hardt@diskohq.org>,                   *
00013  *      Jens Schneider     <jens.schneider@diskohq.org>,                   *
00014  *      Guido Madaus       <guido.madaus@diskohq.org>,                     *
00015  *      Patrick Helterhoff <patrick.helterhoff@diskohq.org>,               *
00016  *      René Bählkow       <rene.baehlkow@diskohq.org>                     *
00017  *                                                                         *
00018  *   This library is free software; you can redistribute it and/or         *
00019  *   modify it under the terms of the GNU Lesser General Public            *
00020  *   License version 2.1 as published by the Free Software Foundation.     *
00021  *                                                                         *
00022  *   This library is distributed in the hope that it will be useful,       *
00023  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00024  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00025  *   Lesser General Public License for more details.                       *
00026  *                                                                         *
00027  *   You should have received a copy of the GNU Lesser General Public      *
00028  *   License along with this library; if not, write to the                 *
00029  *   Free Software Foundation, Inc.,                                       *
00030  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
00031  **************************************************************************/
00032 
00033 #ifndef MMSINPUTLISHANDLER_H_
00034 #define MMSINPUTLISHANDLER_H_
00035 
00036 #include "mmsgui/mmsguitools.h"
00037 #include "mmsinput/mmsinputhandler.h"
00038 
00039 //! maximum number of linux input devices
00040 #define MMSINPUTLISHANDLER_MAX_DEVICES  16
00041 
00042 #define MMSINPUTLISHANDLER_EVENT_BUFFER_SIZE    100
00043 
00044 typedef int MMSINPUTLISHANDLER_DEVTYPE;
00045 
00046 #define MMSINPUTLISHANDLER_DEVTYPE_UNKNOWN      "UNKNOWN"
00047 #define MMSINPUTLISHANDLER_DEVTYPE_KEYBOARD     "KEYBOARD"
00048 #define MMSINPUTLISHANDLER_DEVTYPE_REMOTE       "REMOTE"
00049 #define MMSINPUTLISHANDLER_DEVTYPE_TOUCHSCREEN  "TOUCHSCREEN"
00050 
00051 typedef struct {
00052     float           xFactor;        /**< multiplicate the x value to get the real value (touchscreen only) */
00053     float           yFactor;        /**< multiplicate the y value to get the real value (touchscreen only) */
00054     bool            swapX;          /**< swap x axis */
00055     bool            swapY;          /**< swap y axis */
00056     bool            swapXY;         /**< swap x and y axis */
00057     MMSFBRectangle  rect;           /**< specifies resolution of touch controller */
00058     bool            haveBtnEvents;  /**< touch driver sends BTN_xxx events */
00059 } MMSINPUTLISHANDLER_DEV_TOUCH;
00060 
00061 typedef struct {
00062     string  name;
00063     string  desc;
00064     string  type;
00065 
00066     MMSINPUTLISHANDLER_DEV_TOUCH touch;
00067 } MMSINPUTLISHANDLER_DEV;
00068 
00069 
00070 class MMSInputLISHandler : public MMSInputHandler {
00071     private:
00072         //! available input devices
00073         MMSINPUTLISHANDLER_DEV devices[MMSINPUTLISHANDLER_MAX_DEVICES];
00074 
00075         //! number of available input devices
00076         int devcnt;
00077 
00078 
00079         //! event ring buffer
00080         MMSInputEvent   ie_buffer[MMSINPUTLISHANDLER_EVENT_BUFFER_SIZE];
00081 
00082         //! current number of events in ring buffer
00083         unsigned char   ie_count;
00084 
00085         //! event ring buffer, read pos
00086         unsigned char   ie_read_pos;
00087 
00088         //! event ring buffer, write pos
00089         unsigned char   ie_write_pos;
00090 
00091         class MMSInputLISThread *listhread;
00092 
00093         //! lock
00094         MMSMutex lock;
00095 
00096         bool checkDevice();
00097         void getDevices();
00098 
00099         bool addEvent(MMSInputEvent *inputevent);
00100 
00101     public:
00102         MMSInputLISHandler(MMS_INPUT_DEVICE device);
00103         ~MMSInputLISHandler();
00104         void grabEvents(MMSInputEvent *inputevent);
00105 
00106     // friends
00107     friend class MMSInputLISThread;
00108 };
00109 
00110 #endif /* MMSINPUTLISHANDLER_H_ */

Generated by doxygen