Gnash 0.8.10dev
fbsup.h
Go to the documentation of this file.
00001 //
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
00003 //   2011 Free Software Foundation, Inc
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 #ifndef GNASH_FBSUP_H
00020 #define GNASH_FBSUP_H
00021 
00022 #ifdef HAVE_CONFIG_H
00023 #include "gnashconfig.h"
00024 #endif
00025 
00026 #include <boost/scoped_array.hpp>
00027 #include <vector>
00028 #include <linux/fb.h>
00029 
00030 #include "gui.h"
00031 #include "InputDevice.h"
00032 
00033 #define PIXELFORMAT_LUT8
00034 #define CMAP_SIZE (256*2)
00035 
00036 #ifdef USE_MOUSE_PS2
00037 # define MOUSE_DEVICE "/dev/input/mice"
00038 #endif
00039 
00040 // FIXME: this should really be TSLIB_DEVICE_NAME, but I don't have the
00041 // ETT SDK, so for now, leave it the way it was.
00042 #ifdef USE_ETT_TSLIB
00043 #define MOUSE_DEVICE "/dev/usb/tkpanel0"
00044 #endif
00045 
00046 // Define this to request a new virtual terminal at startup. This doesn't always
00047 // work and probably is not necessary anyway
00048 //#define REQUEST_NEW_VT
00049 
00050 namespace gnash
00051 {
00052 
00074 //
00075 // Supported graphics modes:
00091 class FBGui : public Gui
00092 {
00093 private:
00094     int fd;
00095     int original_vt;       // virtual terminal that was active at startup
00096     int original_kd;       // keyboard mode at startup
00097     int own_vt;            // virtual terminal we are running in   
00098     unsigned char *fbmem;  // framebuffer memory
00099     unsigned char *buffer; // offscreen buffer
00100     
00101     std::vector< geometry::Range2d<int> > _drawbounds;
00102 
00103     // X position of the output window
00104     int _xpos;
00105 
00106     // Y position of the output window
00107     int _ypos;
00108     
00109     unsigned m_rowsize;
00110     
00111     std::vector<boost::shared_ptr<InputDevice> > _inputs;
00112 
00113     struct fb_var_screeninfo var_screeninfo;
00114     struct fb_fix_screeninfo fix_screeninfo;
00115 
00116     unsigned int _timeout; /* TODO: should we move this to base class ? */
00117     
00119     //
00122     bool set_grayscale_lut8();
00123     
00124     bool initialize_renderer();
00125     
00127     char* find_accessible_tty(int no);
00128     char* find_accessible_tty(const char* format, int no);
00129     
00131     bool disable_terminal();
00132     
00134     bool enable_terminal();
00135     
00136 public:
00137     FBGui(unsigned long xid, float scale, bool loop, RunResources& r);
00138     virtual ~FBGui();
00139     virtual bool init(int argc, char ***argv);
00140     virtual bool createWindow(const char *title, int width, int height,
00141                               int xPosition = 0, int yPosition = 0);
00142     virtual bool run();
00143     virtual bool createMenu();
00144     virtual bool setupEvents();
00145     virtual void renderBuffer();
00146     virtual void setInterval(unsigned int interval);
00147     virtual void setTimeout(unsigned int timeout);
00148     
00149     virtual void setFullscreen();
00150     virtual void unsetFullscreen();
00151     
00152     virtual void showMenu(bool show);
00153     virtual bool showMouse(bool show);
00154     
00155     virtual void setInvalidatedRegions(const InvalidatedRanges& ranges);
00156     virtual bool want_multiple_regions() { return true; }
00157 
00158     void checkForData();    
00159 };
00160 
00161 // end of namespace gnash
00162 }
00163 
00164 #ifdef ENABLE_FAKE_FRAMEBUFFER
00165 
00166 
00167 
00168 int fakefb_ioctl(int fd, int request, void *data);
00169 #endif
00170 
00171 #endif  // end of GNASH_FBSUP_H
00172 
00173 // local Variables:
00174 // mode: C++
00175 // indent-tabs-mode: nil
00176 // End: