Gnash  0.8.11dev
fbsup.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
3 // Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef GNASH_FBSUP_H
20 #define GNASH_FBSUP_H
21 
22 #ifdef HAVE_CONFIG_H
23 #include "gnashconfig.h"
24 #endif
25 
26 #include <boost/scoped_array.hpp>
27 #include <boost/shared_ptr.hpp>
28 #include <boost/cstdint.hpp>
29 #include <vector>
30 
31 #include <linux/fb.h>
32 
33 #include "gui.h"
34 #include "events/InputDevice.h"
35 #include "Renderer.h"
36 
37 #define PIXELFORMAT_LUT8
38 
39 #ifdef USE_MOUSE_PS2
40 # define MOUSE_DEVICE "/dev/input/mice"
41 #endif
42 
43 // FIXME: this should really be TSLIB_DEVICE_NAME, but I don't have the
44 // ETT SDK, so for now, leave it the way it was.
45 #ifdef USE_ETT_TSLIB
46 #define MOUSE_DEVICE "/dev/usb/tkpanel0"
47 #endif
48 
49 // Define this to request a new virtual terminal at startup. This doesn't always
50 // work and probably is not necessary anyway
51 //#define REQUEST_NEW_VT
52 
53 namespace gnash {
54 
55 namespace gui {
56 
57 class FBGlue;
58 
80 //
81 // Supported graphics modes:
97 class FBGui : public Gui
98 {
99 public:
100  FBGui(unsigned long xid, float scale, bool loop, RunResources& r);
101  virtual ~FBGui();
105  virtual bool init(int argc, char ***argv);
114  bool createWindow(const char *title, int width, int height,
115  int xPosition = 0, int yPosition = 0);
116 
119  void renderBuffer();
120 
122  bool run();
123 
124  // Resize the viewing area within the total framebuffer display
125  bool resize_view(int width, int height);
126 
128  //
142  // does not need to be implemented (optional feature),
143  // but still needs to be available.
144  //
145  void setInvalidatedRegion(const SWFRect& bounds);
146  void setInvalidatedRegions(const InvalidatedRanges& ranges);
147 
150  bool want_multiple_regions() { return true; }
151 
152  // Information for System.capabilities to be reimplemented in
153  // each gui.
154  double getPixelAspectRatio() { return 0; }
155  int getScreenResX() { return 0; }
156  int getScreenResY() { return 0; }
157  double getScreenDPI() { return 0; }
158  std::string getScreenColor() { return ""; }
159 
160  // For the framebuffer, these are mostly just stubs.
161 
162  void setFullscreen();
163  void unsetFullscreen();
164 
165  bool createMenu();
166  bool setupEvents();
167  void setInterval(unsigned int interval);
168  void setTimeout(unsigned int timeout);
169 
170  void showMenu(bool show);
171  bool showMouse(bool show);
172 
173  // Poll this to see if there is any input data.
174  void checkForData();
175 
176 private:
177  // bool initialize_renderer();
178 
180  char* find_accessible_tty(int no);
181  char* find_accessible_tty(const char* format, int no);
182 
184  bool disable_terminal();
185 
187  bool enable_terminal();
188 
189  int _fd;
190  int _original_vt; // virtual terminal that was active at startup
191  int _original_kd; // keyboard mode at startup
192  int _own_vt; // virtual terminal we are running in
193 
194  int _xpos; // X position of the output window
195  int _ypos; // Y position of the output window
196  size_t _timeout; // timeout period for the event loop
197  bool _fullscreen;
198 
199  boost::shared_ptr<FBGlue> _glue;
200 
202  std::vector<boost::shared_ptr<InputDevice> > _inputs;
203 
204  boost::shared_ptr<Renderer> _renderer;
205 #ifdef HAVE_LINUX_UINPUT_H
206  UinputDevice _uinput;
207 #endif
208 };
209 
210 } // end of namespace gui
211 } // end of namespace gnash
212 
213 #endif // end of GNASH_FBSUP_H
214 
215 // local Variables:
216 // mode: C++
217 // indent-tabs-mode: nil
218 // End: