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 
123  void quitUI();
124 
125  // Resize the viewing area within the total framebuffer display
126  bool resize_view(int width, int height);
127 
129  //
143  // does not need to be implemented (optional feature),
144  // but still needs to be available.
145  //
146  void setInvalidatedRegion(const SWFRect& bounds);
147  void setInvalidatedRegions(const InvalidatedRanges& ranges);
148 
151  bool want_multiple_regions() { return true; }
152 
153  // Information for System.capabilities to be reimplemented in
154  // each gui.
155  double getPixelAspectRatio() const { return 0; }
156  int getScreenResX() { return 0; }
157  int getScreenResY() { return 0; }
158  double getScreenDPI() const { return 0; }
159  std::string getScreenColor() const { return ""; }
160 
161  // For the framebuffer, these are mostly just stubs.
162 
163  void setFullscreen();
164  void unsetFullscreen();
165 
166  bool createMenu();
167  bool setupEvents();
168  void setInterval(unsigned int interval);
169  void setTimeout(unsigned int timeout);
170 
171  void showMenu(bool show);
172  bool showMouse(bool show);
173 
174  // Poll this to see if there is any input data.
175  void checkForData();
176 
177 private:
178  // bool initialize_renderer();
179 
181  char* find_accessible_tty(int no);
182  char* find_accessible_tty(const char* format, int no);
183 
185  bool disable_terminal();
186 
188  bool enable_terminal();
189 
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  std::shared_ptr<FBGlue> _glue;
200 
202  std::vector<std::shared_ptr<InputDevice> > _inputs;
203 
204  std::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:
virtual ~FBGui()
Definition: fb.cpp:172
double getPixelAspectRatio() const
Definition: fbsup.h:155
bool run()
Start main rendering loop.
Definition: fb.cpp:368
bool createMenu()
Definition: fb.cpp:444
void setInvalidatedRegion(const SWFRect &bounds)
Gives the GUI a hint which region of the stage should be redrawn.
Definition: fb.cpp:500
void quitUI()
Stop main rendering loop.
Definition: fb.cpp:516
bool showMouse(bool show)
Sets whether the gui should show the system mouse pointer.
Definition: fb.cpp:491
void setInvalidatedRegions(const InvalidatedRanges &ranges)
Definition: fb.cpp:508
Definition: InputDevice.h:50
void showMenu(bool show)
Sets whether the menus should be shown (for fscommand)
Definition: fb.cpp:485
void unsetFullscreen()
Definition: fb.cpp:479
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
int getScreenResX()
Definition: fbsup.h:156
void setInterval(unsigned int interval)
Set main loop delay in milliseconds.
Definition: fb.cpp:458
void renderBuffer()
Definition: fb.cpp:425
Definition: klash_part.cpp:329
double getScreenDPI() const
Definition: fbsup.h:158
Parent class from which all GUI implementations will depend.
Definition: gui.h:88
Definition: GnashKey.h:164
Definition: klash_part.cpp:329
int getScreenResY()
Definition: fbsup.h:157
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:357
std::string getScreenColor() const
Get the screen color type.
Definition: fbsup.h:159
virtual bool init(int argc, char ***argv)
Initialize the framebuffer.
Definition: fb.cpp:180
bool createWindow(const char *title, int width, int height, int xPosition=0, int yPosition=0)
Create and display our window.
Definition: fb.cpp:433
void setTimeout(unsigned int timeout)
Set the time in milliseconds after which the programme should exit.
Definition: fb.cpp:464
bool setupEvents()
Definition: fb.cpp:451
bool want_multiple_regions()
Definition: fbsup.h:151
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:473
void checkForData()
Definition: fb.cpp:735