Gnash  0.8.10
fbsup.h
Go to the documentation of this file.
00001 //
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
00003 //   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 <boost/shared_ptr.hpp>
00028 #include <boost/cstdint.hpp>
00029 #include <vector>
00030 
00031 #include <linux/fb.h>
00032 
00033 #include "gui.h"
00034 #include "events/InputDevice.h"
00035 #include "Renderer.h"
00036 
00037 #define PIXELFORMAT_LUT8
00038 
00039 #ifdef USE_MOUSE_PS2
00040 # define MOUSE_DEVICE "/dev/input/mice"
00041 #endif
00042 
00043 // FIXME: this should really be TSLIB_DEVICE_NAME, but I don't have the
00044 // ETT SDK, so for now, leave it the way it was.
00045 #ifdef USE_ETT_TSLIB
00046 #define MOUSE_DEVICE "/dev/usb/tkpanel0"
00047 #endif
00048 
00049 // Define this to request a new virtual terminal at startup. This doesn't always
00050 // work and probably is not necessary anyway
00051 //#define REQUEST_NEW_VT
00052 
00053 namespace gnash {
00054 
00055 namespace gui {
00056 
00057 class FBGlue;
00058 
00080 //
00081 // Supported graphics modes:
00097 class FBGui : public Gui
00098 {
00099 public:
00100     FBGui(unsigned long xid, float scale, bool loop, RunResources& r);
00101     virtual ~FBGui();
00105     virtual bool init(int argc, char ***argv);
00114     bool createWindow(const char *title, int width, int height,
00115                               int xPosition = 0, int yPosition = 0);
00116 
00119     void renderBuffer();
00120     
00122     bool run();
00123 
00124     // Resize the viewing area within the total framebuffer display
00125     bool resize_view(int width, int height);
00126     
00128     //
00142     // does not need to be implemented (optional feature),
00143     // but still needs to be available.
00144     //
00145     void setInvalidatedRegion(const SWFRect& bounds);
00146     void setInvalidatedRegions(const InvalidatedRanges& ranges);
00147 
00150     bool want_multiple_regions() { return true; }
00151 
00152     // Information for System.capabilities to be reimplemented in
00153     // each gui.
00154     double getPixelAspectRatio() { return 0; }
00155     int getScreenResX() { return 0; }
00156     int getScreenResY() { return 0; }
00157     double getScreenDPI() { return 0; }
00158     std::string getScreenColor() { return ""; }
00159 
00160     // For the framebuffer, these are mostly just stubs.
00161 
00162     void setFullscreen();
00163     void unsetFullscreen();
00164     
00165     bool createMenu();
00166     bool setupEvents();
00167     void setInterval(unsigned int interval);
00168     void setTimeout(unsigned int timeout);
00169     
00170     void showMenu(bool show);
00171     bool showMouse(bool show);    
00172 
00173     // Poll this to see if there is any input data.
00174     void checkForData();
00175     
00176 private:
00177     // bool initialize_renderer();
00178     
00180     char* find_accessible_tty(int no);
00181     char* find_accessible_tty(const char* format, int no);
00182     
00184     bool disable_terminal();
00185     
00187     bool enable_terminal();
00188     
00189     int         _fd;
00190     int         _original_vt;   // virtual terminal that was active at startup
00191     int         _original_kd;   // keyboard mode at startup
00192     int         _own_vt;        // virtual terminal we are running in   
00193     
00194     int         _xpos;          // X position of the output window
00195     int         _ypos;          // Y position of the output window
00196     size_t      _timeout;       // timeout period for the event loop
00197     bool        _fullscreen;
00198 
00199     boost::shared_ptr<FBGlue>   _glue;
00200 
00202     std::vector<boost::shared_ptr<InputDevice> > _inputs;
00203 
00204     boost::shared_ptr<Renderer> _renderer;
00205     UinputDevice                _uinput;
00206 };
00207 
00208 } // end of namespace gui
00209 } // end of namespace gnash
00210 
00211 #endif  // end of GNASH_FBSUP_H
00212 
00213 // local Variables:
00214 // mode: C++
00215 // indent-tabs-mode: nil
00216 // End: