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 <cstdint>
27 #include <vector>
28 
29 #include <linux/fb.h>
30 
31 #include "gui.h"
32 #include "events/InputDevice.h"
33 #include "Renderer.h"
34 
35 #define PIXELFORMAT_LUT8
36 
37 #ifdef USE_MOUSE_PS2
38 # define MOUSE_DEVICE "/dev/input/mice"
39 #endif
40 
41 // FIXME: this should really be TSLIB_DEVICE_NAME, but I don't have the
42 // ETT SDK, so for now, leave it the way it was.
43 #ifdef USE_ETT_TSLIB
44 #define MOUSE_DEVICE "/dev/usb/tkpanel0"
45 #endif
46 
47 // Define this to request a new virtual terminal at startup. This doesn't always
48 // work and probably is not necessary anyway
49 //#define REQUEST_NEW_VT
50 
51 namespace gnash {
52 
53 namespace gui {
54 
55 class FBGlue;
56 
78 //
79 // Supported graphics modes:
95 class FBGui : public Gui
96 {
97 public:
98  FBGui(unsigned long xid, float scale, bool loop, RunResources& r);
99  virtual ~FBGui();
103  virtual bool init(int argc, char ***argv);
112  bool createWindow(const char *title, int width, int height,
113  int xPosition = 0, int yPosition = 0);
114 
117  void renderBuffer();
118 
120  bool run();
121 
122  // Resize the viewing area within the total framebuffer display
123  bool resize_view(int width, int height);
124 
126  //
140  // does not need to be implemented (optional feature),
141  // but still needs to be available.
142  //
143  void setInvalidatedRegion(const SWFRect& bounds);
144  void setInvalidatedRegions(const InvalidatedRanges& ranges);
145 
148  bool want_multiple_regions() { return true; }
149 
150  // Information for System.capabilities to be reimplemented in
151  // each gui.
152  double getPixelAspectRatio() const { return 0; }
153  int getScreenResX() { return 0; }
154  int getScreenResY() { return 0; }
155  double getScreenDPI() const { return 0; }
156  std::string getScreenColor() const { return ""; }
157 
158  // For the framebuffer, these are mostly just stubs.
159 
160  void setFullscreen();
161  void unsetFullscreen();
162 
163  bool createMenu();
164  bool setupEvents();
165  void setInterval(unsigned int interval);
166  void setTimeout(unsigned int timeout);
167 
168  void showMenu(bool show);
169  bool showMouse(bool show);
170 
171  // Poll this to see if there is any input data.
172  void checkForData();
173 
174 private:
175  // bool initialize_renderer();
176 
178  char* find_accessible_tty(int no);
179  char* find_accessible_tty(const char* format, int no);
180 
182  bool disable_terminal();
183 
185  bool enable_terminal();
186 
187  int _fd;
188  int _original_vt; // virtual terminal that was active at startup
189  int _original_kd; // keyboard mode at startup
190  int _own_vt; // virtual terminal we are running in
191 
192  int _xpos; // X position of the output window
193  int _ypos; // Y position of the output window
194  size_t _timeout; // timeout period for the event loop
195  bool _fullscreen;
196 
197  std::shared_ptr<FBGlue> _glue;
198 
200  std::vector<std::shared_ptr<InputDevice> > _inputs;
201 
202  std::shared_ptr<Renderer> _renderer;
203 #ifdef HAVE_LINUX_UINPUT_H
204  UinputDevice _uinput;
205 #endif
206 };
207 
208 } // end of namespace gui
209 } // end of namespace gnash
210 
211 #endif // end of GNASH_FBSUP_H
212 
213 // local Variables:
214 // mode: C++
215 // indent-tabs-mode: nil
216 // End:
virtual ~FBGui()
Definition: fb.cpp:173
bool run()
Start main rendering loop.
Definition: fb.cpp:373
bool createMenu()
Definition: fb.cpp:449
void setInvalidatedRegion(const SWFRect &bounds)
Gives the GUI a hint which region of the stage should be redrawn.
Definition: fb.cpp:505
double getPixelAspectRatio() const
Definition: fbsup.h:152
bool showMouse(bool show)
Sets whether the gui should show the system mouse pointer.
Definition: fb.cpp:496
void setInvalidatedRegions(const InvalidatedRanges &ranges)
Definition: fb.cpp:513
Definition: InputDevice.h:50
void showMenu(bool show)
Sets whether the menus should be shown (for fscommand)
Definition: fb.cpp:490
void unsetFullscreen()
Definition: fb.cpp:484
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
int getScreenResX()
Definition: fbsup.h:153
void setInterval(unsigned int interval)
Set main loop delay in milliseconds.
Definition: fb.cpp:463
void renderBuffer()
Definition: fb.cpp:430
Definition: klash_part.cpp:329
std::string getScreenColor() const
Get the screen color type.
Definition: fbsup.h:156
Parent class from which all GUI implementations will depend.
Definition: gui.h:88
Definition: GnashKey.h:164
double getScreenDPI() const
Definition: fbsup.h:155
Definition: klash_part.cpp:329
int getScreenResY()
Definition: fbsup.h:154
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:53
Definition: fbsup.h:95
bool resize_view(int width, int height)
Definition: fb.cpp:362
virtual bool init(int argc, char ***argv)
Initialize the framebuffer.
Definition: fb.cpp:185
bool createWindow(const char *title, int width, int height, int xPosition=0, int yPosition=0)
Create and display our window.
Definition: fb.cpp:438
void setTimeout(unsigned int timeout)
Set the time in milliseconds after which the programme should exit.
Definition: fb.cpp:469
bool setupEvents()
Definition: fb.cpp:456
bool want_multiple_regions()
Definition: fbsup.h:148
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:44
FBGui(unsigned long xid, float scale, bool loop, RunResources &r)
Definition: fb.cpp:154
void setFullscreen()
Definition: fb.cpp:478
void checkForData()
Definition: fb.cpp:738