Logo
  • Main Page
  • Related Pages
  • Modules
  • Classes
  • Files

mmsfb.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider,             *
00003  *                           Matthias Hardt, Guido Madaus                  *
00004  *                                                                         *
00005  *   Copyright (C) 2007-2008 BerLinux Solutions GbR                        *
00006  *                           Stefan Schwarzer & Guido Madaus               *
00007  *                                                                         *
00008  *   Copyright (C) 2009-2012 BerLinux Solutions GmbH                       *
00009  *                                                                         *
00010  *   Authors:                                                              *
00011  *      Stefan Schwarzer   <stefan.schwarzer@diskohq.org>,                 *
00012  *      Matthias Hardt     <matthias.hardt@diskohq.org>,                   *
00013  *      Jens Schneider     <jens.schneider@diskohq.org>,                   *
00014  *      Guido Madaus       <guido.madaus@diskohq.org>,                     *
00015  *      Patrick Helterhoff <patrick.helterhoff@diskohq.org>,               *
00016  *      René Bählkow       <rene.baehlkow@diskohq.org>                     *
00017  *                                                                         *
00018  *   This library is free software; you can redistribute it and/or         *
00019  *   modify it under the terms of the GNU Lesser General Public            *
00020  *   License version 2.1 as published by the Free Software Foundation.     *
00021  *                                                                         *
00022  *   This library is distributed in the hope that it will be useful,       *
00023  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00024  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00025  *   Lesser General Public License for more details.                       *
00026  *                                                                         *
00027  *   You should have received a copy of the GNU Lesser General Public      *
00028  *   License along with this library; if not, write to the                 *
00029  *   Free Software Foundation, Inc.,                                       *
00030  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
00031  **************************************************************************/
00032 
00033 #ifndef MMSFB_H_
00034 #define MMSFB_H_
00035 
00036 #include "mmstools/mmstypes.h"
00037 #include "mmstools/mmslogger.h"
00038 
00039 #include "mmsgui/fb/mmsfbdev.h"
00040 #include "mmsgui/fb/mmsfbdevmatrox.h"
00041 #include "mmsgui/fb/mmsfbdevdavinci.h"
00042 #include "mmsgui/fb/mmsfbdevomap.h"
00043 #include "mmsgui/fb/mmsfblayer.h"
00044 #include "mmsgui/fb/mmsfbwindowmanager.h"
00045 #include "mmsgui/fb/mmsfbfont.h"
00046 #include "mmsgui/fb/mmsfbbackendinterface.h"
00047 
00048 #ifdef __HAVE_OPENGL__
00049 #define LOCK_OGL(fbo)   { mmsfb->lock(); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); glDisable(GL_SCISSOR_TEST); }
00050 #define UNLOCK_OGL      { glDisable(GL_SCISSOR_TEST); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); mmsfb->unlock(); }
00051 #endif
00052 
00053 #define MMSFBLAYER_MAXNUM 32
00054 
00055 //! The lowest layer to the backends like DFB, X11(XSHM/XVSHM) or FBDEV.
00056 /*!
00057 \author Jens Schneider
00058 */
00059 class MMSFB {
00060     private:
00061         int              argc;       /* commandline arguments */
00062         char             **argv;
00063         string           applname;
00064         string           appliconname;
00065         bool             hidden;
00066         MMSFBPointerMode pointer;
00067 
00068         //! name of binary
00069         string           bin;
00070 
00071         //! is initialized?
00072         bool initialized;
00073 
00074         MMSFBFullScreenMode fullscreen;
00075 
00076 #ifdef  __HAVE_DIRECTFB__
00077         // interface to dfb
00078         IDirectFB       *dfb;
00079 #endif
00080 
00081 #ifdef  __HAVE_FBDEV__
00082         // interface to own FB device
00083         MMSFBDev        *mmsfbdev;
00084 #endif
00085 
00086 #ifdef __HAVE_XLIB__
00087         //! connection to the x-server
00088         Display         *x_display;
00089         int             x_screen;
00090         Window          x_window;
00091         Window          input_window;
00092         GC              x_gc;
00093         Visual          *x_visual;
00094         int             x_depth;
00095         MMSMutex        xlock;
00096         int             display_w;
00097         int             display_h;
00098         int             target_window_w;
00099         int             target_window_h;
00100         bool            resized;
00101         bool            resizeWindow();
00102         Window          x_windows[MMSFBLAYER_MAXNUM];
00103         XImage          *rootimage;
00104 #endif
00105 
00106 #ifdef __HAVE_XV__
00107         int         xv_port;
00108 #endif
00109 
00110 #ifdef __HAVE_OPENGL__
00111         // backend interface server needed for OPENGL
00112         MMSFBBackEndInterface   *bei;
00113 #endif
00114 
00115         MMSFBLayer      *layer[MMSFBLAYER_MAXNUM];
00116 
00117         MMSFBBackend    backend;
00118         MMSFBRectangle  x11_win_rect;
00119 
00120         //! to make it thread-safe
00121         MMSMutex        Lock;
00122 
00123     public:
00124         MMSFB();
00125         virtual ~MMSFB();
00126 
00127         bool init(int argc, char **argv, MMSFBBackend backend, MMSFBRectangle x11_win_rect,
00128                   bool extendedaccel, MMSFBFullScreenMode fullscreen, MMSFBPointerMode pointer,
00129                   string appl_name = "Disko Application", string appl_icon_name = "Disko Application", bool hidden=false);
00130         bool release();
00131         bool isInitialized();
00132 
00133         MMSFBBackend getBackend();
00134 
00135         bool lock();
00136         bool unlock();
00137 
00138         bool getLayer(int id, MMSFBLayer **layer, MMSFBOutputType outputtype, bool virtual_console);
00139         bool getLayer(int id, MMSFBLayer **layer);
00140 
00141         void *getX11Window();
00142         void *getX11Display();
00143         bool refresh();
00144 
00145         bool createSurface(MMSFBSurface **surface, int w, int h, MMSFBSurfacePixelFormat pixelformat, int backbuffer = 0, bool systemonly = false);
00146 
00147 #ifdef  __HAVE_DIRECTFB__
00148         bool createImageProvider(IDirectFBImageProvider **provider, string filename);
00149 #endif
00150         bool createFont(MMSFBFont **font, string filename, int width = 0, int height = 0);
00151 
00152 
00153         void realignLayer();
00154 
00155     friend class MMSFBLayer;
00156     friend class MMSFBSurface;
00157     friend class MMSFBFont;
00158     friend class MMSInputX11Handler;
00159     friend class MMSInputLISHandler;
00160     friend class MMSFBBuffer;
00161 };
00162 
00163 /* access to global mmsfb */
00164 extern MMSFB *mmsfb;
00165 
00166 #endif /*MMSFB_H_*/

Generated by doxygen