tasn pushed a commit to branch master. http://git.enlightenment.org/bindings/cxx/eflxx.git/commit/?id=158039f74a80ad4b63370f32615bc6e9bf5ec465
commit 158039f74a80ad4b63370f32615bc6e9bf5ec465 Author: Andreas Volz <li...@brachttal.net> Date: Mon Feb 7 22:34:23 2011 +0000 split into several files to not get confused... SVN revision: 56788 --- ecorexx/include/ecorexx/Ecorexx.h | 4 + ecorexx/include/ecorexx/EvasWindow.h | 81 +--------- ecorexx/include/ecorexx/EvasWindowFB.h | 24 +++ ecorexx/include/ecorexx/EvasWindowGLX11.h | 37 +++++ ecorexx/include/ecorexx/EvasWindowSoftwareX11.h | 37 +++++ ecorexx/include/ecorexx/EvasWindowXRenderX11.h | 37 +++++ ecorexx/include/ecorexx/Makefile.am | 6 +- ecorexx/include/ecorexx/XWindow.h | 2 +- ecorexx/src/EvasWindow.cpp | 191 ------------------------ ecorexx/src/EvasWindowFB.cpp | 87 +++++++++++ ecorexx/src/EvasWindowGLX11.cpp | 61 ++++++++ ecorexx/src/EvasWindowSoftwareX11.cpp | 59 ++++++++ ecorexx/src/EvasWindowXRenderX11.cpp | 58 +++++++ ecorexx/src/Makefile.am | 6 +- 14 files changed, 418 insertions(+), 272 deletions(-) diff --git a/ecorexx/include/ecorexx/Ecorexx.h b/ecorexx/include/ecorexx/Ecorexx.h index 1b0d715..6c1487e 100644 --- a/ecorexx/include/ecorexx/Ecorexx.h +++ b/ecorexx/include/ecorexx/Ecorexx.h @@ -10,6 +10,10 @@ #include "Animator.h" #include "Application.h" #include "EvasWindow.h" +#include "EvasWindowFB.h" +#include "EvasWindowGLX11.h" +#include "EvasWindowSoftwareX11.h" +#include "EvasWindowXRenderX11.h" #include "Timer.h" #include "XWindow.h" #include "Job.h" diff --git a/ecorexx/include/ecorexx/EvasWindow.h b/ecorexx/include/ecorexx/EvasWindow.h index 5a6d226..110b372 100644 --- a/ecorexx/include/ecorexx/EvasWindow.h +++ b/ecorexx/include/ecorexx/EvasWindow.h @@ -1,5 +1,5 @@ -#ifndef ECORE_EVAS_WINDOW_H -#define ECORE_EVAS_WINDOW_H +#ifndef ECOREXX_EVAS_WINDOW_H +#define ECOREXX_EVAS_WINDOW_H /* EFLxx */ #include <eflxx/Common.h> @@ -16,7 +16,6 @@ namespace Ecorexx { /* forward declarations */ -class XWindow; // TODO: Test for supported backends? class EvasWindow : public Eflxx::Trackable @@ -162,80 +161,6 @@ private: bool mQuit; }; -class EvasWindowSoftwareX11 : public EvasWindow -{ -public: - EvasWindowSoftwareX11( const Eflxx::Size &size, const char* display = 0 ); - virtual ~EvasWindowSoftwareX11(); - - /*! - * \brief Gets a pointer to the X window. The returned pointer needs to be - * deleted if you don't need it any longer. - * - * \return The XWindow. - */ - XWindow *getXWindow(); - -private: - EvasWindowSoftwareX11(); - bool operator=( const EvasWindowSoftwareX11& ); - bool operator==( const EvasWindowSoftwareX11& ); -}; - -class EvasWindowGLX11 : public EvasWindow -{ -public: - EvasWindowGLX11( const Eflxx::Size &size, const char* display = 0 ); - virtual ~EvasWindowGLX11(); - - /*! - * \brief Gets a pointer to the X window. The returned pointer needs to be - * deleted if you don't need it any longer. - * - * \return The XWindow. - */ - XWindow *getXWindow(); - -private: - EvasWindowGLX11(); - bool operator=( const EvasWindowGLX11& ); - bool operator==( const EvasWindowGLX11& ); -}; - -class EvasWindowXRenderX11 : public EvasWindow -{ -public: - EvasWindowXRenderX11( const Eflxx::Size &size, const char* display = 0 ); - virtual ~EvasWindowXRenderX11(); - - /*! - * \brief Gets a pointer to the X window. The returned pointer needs to be - * deleted if you don't need it any longer. - * - * \return The XWindow. - */ - XWindow *getXWindow(); - -private: - EvasWindowXRenderX11(); - bool operator=( const EvasWindowXRenderX11& ); - bool operator==( const EvasWindowXRenderX11& ); -}; - -class EvasWindowFB : public EvasWindow -{ -public: - EvasWindowFB( const Eflxx::Size &size, const char* display = 0, int rotation = 0 ); - virtual ~EvasWindowFB(); - - XWindow *getXWindow(); - -private: - EvasWindowFB(); - bool operator=( const EvasWindowFB& ); - bool operator==( const EvasWindowFB& ); -}; - } // end namespace Ecorexx -#endif // ECORE_EVAS_WINDOW_H +#endif // ECOREXX_EVAS_WINDOW_H diff --git a/ecorexx/include/ecorexx/EvasWindowFB.h b/ecorexx/include/ecorexx/EvasWindowFB.h new file mode 100644 index 0000000..8dd315b --- /dev/null +++ b/ecorexx/include/ecorexx/EvasWindowFB.h @@ -0,0 +1,24 @@ +#ifndef ECOREXX_EVAS_WINDOW_FB_H +#define ECOREXX_EVAS_WINDOW_FB_H + + /* EFLxx */ +#include <evasxx/Evasxx.h> +#include "EvasWindow.h" + +namespace Ecorexx { + +class EvasWindowFB : public EvasWindow +{ +public: + EvasWindowFB( const Eflxx::Size &size, const char* display = 0, int rotation = 0 ); + virtual ~EvasWindowFB(); + +private: + EvasWindowFB(); + bool operator=( const EvasWindowFB& ); + bool operator==( const EvasWindowFB& ); +}; + +} // end namespace Ecorexx + +#endif // ECOREXX_EVAS_WINDOW_FB_H diff --git a/ecorexx/include/ecorexx/EvasWindowGLX11.h b/ecorexx/include/ecorexx/EvasWindowGLX11.h new file mode 100644 index 0000000..dc36fc0 --- /dev/null +++ b/ecorexx/include/ecorexx/EvasWindowGLX11.h @@ -0,0 +1,37 @@ +#ifndef ECOREXX_EVAS_WINDOW_GL_X11_H +#define ECOREXX_EVAS_WINDOW_GL_X11_H + +/* EFLxx */ +#include <evasxx/Evasxx.h> +#include "EvasWindow.h" + +namespace Ecorexx { + +/* forward declarations */ +class XWindow; + +class EvasWindowGLX11 : public EvasWindow +{ +public: + EvasWindowGLX11( const Eflxx::Size &size, const char* display = 0 ); + virtual ~EvasWindowGLX11(); + + /*! + * \brief Gets a pointer to the X window. The returned pointer needs to be + * deleted if you don't need it any longer. + * + * \return The XWindow. + */ + XWindow *getXWindow(); + +private: + EvasWindowGLX11(); + bool operator=( const EvasWindowGLX11& ); + bool operator==( const EvasWindowGLX11& ); + + XWindow *mExwin; +}; + +} // end namespace Ecorexx + +#endif // ECOREXX_EVAS_WINDOW_GL_X11_H diff --git a/ecorexx/include/ecorexx/EvasWindowSoftwareX11.h b/ecorexx/include/ecorexx/EvasWindowSoftwareX11.h new file mode 100644 index 0000000..ec65a40 --- /dev/null +++ b/ecorexx/include/ecorexx/EvasWindowSoftwareX11.h @@ -0,0 +1,37 @@ +#ifndef ECOREXX_EVAS_WINDOW_SOFTWARE_X11_H +#define ECOREXX_EVAS_WINDOW_SOFTWARE_X11_H + +/* EFLxx */ +#include <evasxx/Evasxx.h> +#include "EvasWindow.h" + +namespace Ecorexx { + +/* forward declarations */ +class XWindow; + +class EvasWindowSoftwareX11 : public EvasWindow +{ +public: + EvasWindowSoftwareX11( const Eflxx::Size &size, const char* display = 0 ); + virtual ~EvasWindowSoftwareX11(); + + /*! + * \brief Gets a pointer to the X window. The returned pointer needs to be + * deleted if you don't need it any longer. + * + * \return The XWindow. + */ + XWindow *getXWindow(); + +private: + EvasWindowSoftwareX11(); + bool operator=( const EvasWindowSoftwareX11& ); + bool operator==( const EvasWindowSoftwareX11& ); + + XWindow *mExwin; +}; + +} // end namespace Ecorexx + +#endif // ECORXX_EVAS_WINDOW_SOFTWARE_X11_H diff --git a/ecorexx/include/ecorexx/EvasWindowXRenderX11.h b/ecorexx/include/ecorexx/EvasWindowXRenderX11.h new file mode 100644 index 0000000..a8cb257 --- /dev/null +++ b/ecorexx/include/ecorexx/EvasWindowXRenderX11.h @@ -0,0 +1,37 @@ +#ifndef ECOREXX_EVAS_WINDOW_XRENDER_X11_H +#define ECOREXX_EVAS_WINDOW_XRENDER_X11_H + +/* EFLxx */ +#include <evasxx/Evasxx.h> +#include "EvasWindow.h" + +namespace Ecorexx { + +/* forward declarations */ +class XWindow; + +class EvasWindowXRenderX11 : public EvasWindow +{ +public: + EvasWindowXRenderX11( const Eflxx::Size &size, const char* display = 0 ); + virtual ~EvasWindowXRenderX11(); + + /*! + * \brief Gets a pointer to the X window. The returned pointer needs to be + * deleted if you don't need it any longer. + * + * \return The XWindow. + */ + XWindow *getXWindow(); + +private: + EvasWindowXRenderX11(); + bool operator=( const EvasWindowXRenderX11& ); + bool operator==( const EvasWindowXRenderX11& ); + + XWindow *mExwin; +}; + +} // end namespace Ecorexx + +#endif // ECOREXX_EVAS_WINDOW_XRENDER_X11_H diff --git a/ecorexx/include/ecorexx/Makefile.am b/ecorexx/include/ecorexx/Makefile.am index 58114c2..91afce8 100644 --- a/ecorexx/include/ecorexx/Makefile.am +++ b/ecorexx/include/ecorexx/Makefile.am @@ -6,7 +6,11 @@ libecorexx_HEADERS = \ Animator.h \ Timer.h \ Ecorexx.h \ - Job.h + Job.h \ + EvasWindowFB.h \ + EvasWindowGLX11.h \ + EvasWindowSoftwareX11.h \ + EvasWindowXRenderX11.h libecorexxdir = \ $(pkgincludedir) diff --git a/ecorexx/include/ecorexx/XWindow.h b/ecorexx/include/ecorexx/XWindow.h index df9395c..f4e4164 100644 --- a/ecorexx/include/ecorexx/XWindow.h +++ b/ecorexx/include/ecorexx/XWindow.h @@ -50,7 +50,7 @@ public: protected: private: - bool operator=( const XWindow& ); + //bool operator=( const XWindow& ); bool operator==( const XWindow& ); Ecore_X_Window _exwin; diff --git a/ecorexx/src/EvasWindow.cpp b/ecorexx/src/EvasWindow.cpp index cc4c2b0..4952182 100644 --- a/ecorexx/src/EvasWindow.cpp +++ b/ecorexx/src/EvasWindow.cpp @@ -445,195 +445,4 @@ EvasWindow* EvasWindow::objectLink( Ecore_Evas* ee ) return static_cast<EvasWindow*>( ecore_evas_data_get( ee, "obj_c++" ) ); } -EvasWindowSoftwareX11::EvasWindowSoftwareX11( const Eflxx::Size &size, const char* display ) - :EvasWindow() -{ - Dout( dc::notice, "EvasWindow::EvasWindowSoftwareX11" ); - Application::getInstance()->setMainWindow( this ); - - /*if ( ::getenv( "EFL_DISPLAY" ) ) display = ::getenv( "EFL_DISPLAY" ); - if ( ::getenv( "EFL_WIDTH" ) ) size.width (atoi( ::getenv( "EFL_WIDTH" ) )); - if ( ::getenv( "EFL_HEIGHT" ) ) size.height (atoi( ::getenv( "EFL_HEIGHT" ) ));*/ - - Dout( dc::notice, "- detected display string '" << ( display ? display:"<null>" ) << "' - starting X11 engine" ); - //FIXME: Should we care about positioning? 0, 0 for now - _ee = ecore_evas_software_x11_new( const_cast<char*>( display ), 0, 0, 0, size.width (), size.height () ); - - ecore_evas_title_set( _ee, Application::getInstance()->getName().c_str() ); - ecore_evas_borderless_set( _ee, 0 ); - - _canvas = Evasxx::Canvas::wrap ( ecore_evas_get( _ee ) ); - - /* Set up magic object back link */ - ecore_evas_data_set( _ee, "obj_c++", this ); - - /* Set up default callbacks */ - setEventEnabled( Resize, true ); - setEventEnabled( DeleteRequest, true ); -} - -EvasWindowSoftwareX11::~EvasWindowSoftwareX11() -{ -} - -XWindow *EvasWindowSoftwareX11::getXWindow() -{ - Ecore_X_Window exw = ecore_evas_software_x11_window_get( _ee ); - XWindow *exwin = new XWindow( exw ); - - return exwin; -} - -EvasWindowGLX11::EvasWindowGLX11( const Eflxx::Size &size, const char* display ) - :EvasWindow() -{ - Dout( dc::notice, "EvasWindow::EvasWindowGL" ); - Application::getInstance()->setMainWindow( this ); - - /*if ( ::getenv( "EFL_DISPLAY" ) ) display = ::getenv( "EFL_DISPLAY" ); - if ( ::getenv( "EFL_WIDTH" ) ) size.width (atoi( ::getenv( "EFL_WIDTH" ) )); - if ( ::getenv( "EFL_HEIGHT" ) ) size.height (atoi( ::getenv( "EFL_HEIGHT" ) ));*/ - - Dout( dc::notice, "- detected display string '" << ( display ? display:"<null>" ) << "' - starting X11 engine" ); - //FIXME: Should we care about positioning? 0, 0 for now - _ee = ecore_evas_gl_x11_new( const_cast<char*>( display ), 0, 0, 0, size.width (), size.height () ); - - ecore_evas_title_set( _ee, Application::getInstance()->getName().c_str() ); - ecore_evas_borderless_set( _ee, 0 ); - - _canvas = Evasxx::Canvas::wrap (ecore_evas_get( _ee )); - - /* Set up magic object back link */ - ecore_evas_data_set( _ee, "obj_c++", this ); - - /* Set up default callbacks */ - setEventEnabled( Resize, true ); - setEventEnabled( DeleteRequest, true ); -} - -EvasWindowGLX11::~EvasWindowGLX11() -{ - -} - -XWindow *EvasWindowGLX11::getXWindow() -{ - Ecore_X_Window exw = ecore_evas_gl_x11_window_get( _ee ); - XWindow *exwin = new XWindow( exw ); - - return exwin; -} - -EvasWindowXRenderX11::EvasWindowXRenderX11( const Eflxx::Size &size, const char* display ) - :EvasWindow() -{ - Dout( dc::notice, "EvasWindow::EvasWindowGL" ); - Application::getInstance()->setMainWindow( this ); - - /*if ( ::getenv( "EFL_DISPLAY" ) ) display = ::getenv( "EFL_DISPLAY" ); - if ( ::getenv( "EFL_WIDTH" ) ) size.width (atoi( ::getenv( "EFL_WIDTH" ) )); - if ( ::getenv( "EFL_HEIGHT" ) ) size.height (atoi( ::getenv( "EFL_HEIGHT" ) ));*/ - - Dout( dc::notice, "- detected display string '" << ( display ? display:"<null>" ) << "' - starting X11 engine" ); - //FIXME: Should we care about positioning? 0, 0 for now - _ee = ecore_evas_xrender_x11_new( const_cast<char*>( display ), 0, 0, 0, size.width (), size.height () ); - - ecore_evas_title_set( _ee, Application::getInstance()->getName().c_str() ); - ecore_evas_borderless_set( _ee, 0 ); - - _canvas = Evasxx::Canvas::wrap (ecore_evas_get( _ee )); - - /* Set up magic object back link */ - ecore_evas_data_set( _ee, "obj_c++", this ); - - /* Set up default callbacks */ - setEventEnabled( Resize, true ); - setEventEnabled( DeleteRequest, true ); -} - -EvasWindowXRenderX11::~EvasWindowXRenderX11() -{ -} - -XWindow *EvasWindowXRenderX11::getXWindow() -{ - Ecore_X_Window exw = ecore_evas_xrender_x11_window_get( _ee ); - XWindow *exwin = new XWindow( exw ); - - return exwin; -} - -// TODO: Possible without #ifdef stuff? -EvasWindowFB::EvasWindowFB( const Eflxx::Size &size, const char* display, int rotation ) - :EvasWindow() -{ - Dout( dc::notice, "EvasWindow::EvasWindowFB" ); - Application::getInstance()->setMainWindow( this ); - - /*if ( ::getenv( "EFL_DISPLAY" ) ) display = ::getenv( "EFL_DISPLAY" ); - if ( ::getenv( "EFL_WIDTH" ) ) size.width (atoi( ::getenv( "EFL_WIDTH" ) )); - if ( ::getenv( "EFL_HEIGHT" ) ) size.height (atoi( ::getenv( "EFL_HEIGHT" ) )); - if ( ::getenv( "EFL_ROTATION" ) ) rotation = atoi( ::getenv( "EFL_ROTATION" ) );*/ - - if ( display /*&& ::strstr( display, "/dev/fb" )*/ ) - { -#ifdef ENABLE_EFLPP_FB - int fb_dev_fd = ::open( display, O_RDONLY ); - if ( fb_dev_fd < 0 ) - { - fprintf(stderr,"Can't open display '%s': %s\n", display, strerror(errno)); - exit( 1 ); - } - - struct fb_var_screeninfo fb_vinfo; - struct fb_fix_screeninfo fb_finfo; - - // read VScreen info from fb - if ( ioctl( fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo ) ) - { - fprintf(stderr,"Can't get VSCREENINFO: %s\n", strerror(errno)); - exit(1); - } - - // readFScreen info from fb - if ( ioctl( fb_dev_fd, FBIOGET_FSCREENINFO, &fb_finfo ) ) - { - fprintf(stderr,"Can't get FSCREENINFO: %s\n", strerror(errno)); - exit(1); - } - - Dout( dc::notice, "- using display '" << display << "' [" << fb_finfo.id << "] - " << fb_vinfo.xres << "x" << fb_vinfo.yres << "@" << rotation ); - width = ( rotation % 180 ) ? fb_vinfo.yres : fb_vinfo.xres; - height = ( rotation % 180 ) ? fb_vinfo.xres : fb_vinfo.yres; - Dout( dc::notice, "- using size (after rotating) " << size.width () << "x" << size.height () ); -#ifdef ECORE_FB_NO_ROTATION_BUG - //FIXME EFL BUG: initial rotation is not taken into account for evas calculation - _ee = ecore_evas_fb_new( const_cast<char*>( display ), rotation, 50, 50 ); -#else - _ee = ecore_evas_fb_new( const_cast<char*>( display ), 0, 50, 50 ); // start with rotation 0 to workaround bug -#endif - ecore_evas_fullscreen_set( _ee, 1 ); // fullscreen is default to get auto resize on changing rotation - ecore_evas_rotation_set( _ee, rotation ); // force resize -#else - printf("FB engine not enabled\n"); -#endif - } - - ecore_evas_title_set( _ee, Application::getInstance()->getName().c_str() ); - ecore_evas_borderless_set( _ee, 0 ); - - _canvas = Evasxx::Canvas::wrap (ecore_evas_get( _ee )); - - /* Set up magic object back link */ - ecore_evas_data_set( _ee, "obj_c++", this ); - - /* Set up default callbacks */ - setEventEnabled( Resize, true ); - setEventEnabled( DeleteRequest, true ); -} - -EvasWindowFB::~EvasWindowFB() -{ -} - } // end namespace Ecorexx diff --git a/ecorexx/src/EvasWindowFB.cpp b/ecorexx/src/EvasWindowFB.cpp new file mode 100644 index 0000000..df2ed1c --- /dev/null +++ b/ecorexx/src/EvasWindowFB.cpp @@ -0,0 +1,87 @@ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +/* STD */ +#include <iostream> + +/* EFLxx */ +#include <evasxx/Canvas.h> +#include "../include/ecorexx/EvasWindowFB.h" + +namespace Ecorexx { + +// TODO: Possible without #ifdef stuff? +EvasWindowFB::EvasWindowFB( const Eflxx::Size &size, const char* display, int rotation ) : + EvasWindow() +{ + Dout( dc::notice, "EvasWindow::EvasWindowFB" ); + Application::getInstance()->setMainWindow( this ); + + /*if ( ::getenv( "EFL_DISPLAY" ) ) display = ::getenv( "EFL_DISPLAY" ); + if ( ::getenv( "EFL_WIDTH" ) ) size.width (atoi( ::getenv( "EFL_WIDTH" ) )); + if ( ::getenv( "EFL_HEIGHT" ) ) size.height (atoi( ::getenv( "EFL_HEIGHT" ) )); + if ( ::getenv( "EFL_ROTATION" ) ) rotation = atoi( ::getenv( "EFL_ROTATION" ) );*/ + + if ( display /*&& ::strstr( display, "/dev/fb" )*/ ) + { +#ifdef ENABLE_EFLPP_FB + int fb_dev_fd = ::open( display, O_RDONLY ); + if ( fb_dev_fd < 0 ) + { + fprintf(stderr,"Can't open display '%s': %s\n", display, strerror(errno)); + exit( 1 ); + } + + struct fb_var_screeninfo fb_vinfo; + struct fb_fix_screeninfo fb_finfo; + + // read VScreen info from fb + if ( ioctl( fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo ) ) + { + fprintf(stderr,"Can't get VSCREENINFO: %s\n", strerror(errno)); + exit(1); + } + + // readFScreen info from fb + if ( ioctl( fb_dev_fd, FBIOGET_FSCREENINFO, &fb_finfo ) ) + { + fprintf(stderr,"Can't get FSCREENINFO: %s\n", strerror(errno)); + exit(1); + } + + Dout( dc::notice, "- using display '" << display << "' [" << fb_finfo.id << "] - " << fb_vinfo.xres << "x" << fb_vinfo.yres << "@" << rotation ); + width = ( rotation % 180 ) ? fb_vinfo.yres : fb_vinfo.xres; + height = ( rotation % 180 ) ? fb_vinfo.xres : fb_vinfo.yres; + Dout( dc::notice, "- using size (after rotating) " << size.width () << "x" << size.height () ); +#ifdef ECORE_FB_NO_ROTATION_BUG + //FIXME EFL BUG: initial rotation is not taken into account for evas calculation + _ee = ecore_evas_fb_new( const_cast<char*>( display ), rotation, 50, 50 ); +#else + _ee = ecore_evas_fb_new( const_cast<char*>( display ), 0, 50, 50 ); // start with rotation 0 to workaround bug +#endif + ecore_evas_fullscreen_set( _ee, 1 ); // fullscreen is default to get auto resize on changing rotation + ecore_evas_rotation_set( _ee, rotation ); // force resize +#else + printf("FB engine not enabled\n"); +#endif + } + + ecore_evas_title_set( _ee, Application::getInstance()->getName().c_str() ); + ecore_evas_borderless_set( _ee, 0 ); + + _canvas = Evasxx::Canvas::wrap (ecore_evas_get( _ee )); + + /* Set up magic object back link */ + ecore_evas_data_set( _ee, "obj_c++", this ); + + /* Set up default callbacks */ + setEventEnabled( Resize, true ); + setEventEnabled( DeleteRequest, true ); +} + +EvasWindowFB::~EvasWindowFB() +{ +} + +} // end namespace Ecorexx diff --git a/ecorexx/src/EvasWindowGLX11.cpp b/ecorexx/src/EvasWindowGLX11.cpp new file mode 100644 index 0000000..71d1615 --- /dev/null +++ b/ecorexx/src/EvasWindowGLX11.cpp @@ -0,0 +1,61 @@ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +/* STD */ +#include <iostream> + +/* EFLxx */ +#include <evasxx/Canvas.h> +#include "../include/ecorexx/EvasWindowGLX11.h" +#include "../include/ecorexx/XWindow.h" + +namespace Ecorexx { + +EvasWindowGLX11::EvasWindowGLX11( const Eflxx::Size &size, const char* display ) : + EvasWindow (), + mExwin (NULL) +{ + Dout( dc::notice, "EvasWindow::EvasWindowGL" ); + Application::getInstance()->setMainWindow( this ); + + /*if ( ::getenv( "EFL_DISPLAY" ) ) display = ::getenv( "EFL_DISPLAY" ); + if ( ::getenv( "EFL_WIDTH" ) ) size.width (atoi( ::getenv( "EFL_WIDTH" ) )); + if ( ::getenv( "EFL_HEIGHT" ) ) size.height (atoi( ::getenv( "EFL_HEIGHT" ) ));*/ + + Dout( dc::notice, "- detected display string '" << ( display ? display:"<null>" ) << "' - starting X11 engine" ); + //FIXME: Should we care about positioning? 0, 0 for now + _ee = ecore_evas_gl_x11_new( const_cast<char*>( display ), 0, 0, 0, size.width (), size.height () ); + + ecore_evas_title_set( _ee, Application::getInstance()->getName().c_str() ); + ecore_evas_borderless_set( _ee, 0 ); + + _canvas = Evasxx::Canvas::wrap (ecore_evas_get( _ee )); + + /* Set up magic object back link */ + ecore_evas_data_set( _ee, "obj_c++", this ); + + /* Set up default callbacks */ + setEventEnabled( Resize, true ); + setEventEnabled( DeleteRequest, true ); +} + +EvasWindowGLX11::~EvasWindowGLX11() +{ + +} + +XWindow *EvasWindowGLX11::getXWindow() +{ + // lazy construction.... + if (!mExwin) + { + Ecore_X_Window exw = ecore_evas_gl_x11_window_get( _ee ); + mExwin = new XWindow( exw ); + } + + return mExwin; +} + + +} // end namespace Ecorexx diff --git a/ecorexx/src/EvasWindowSoftwareX11.cpp b/ecorexx/src/EvasWindowSoftwareX11.cpp new file mode 100644 index 0000000..0101f9d --- /dev/null +++ b/ecorexx/src/EvasWindowSoftwareX11.cpp @@ -0,0 +1,59 @@ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +/* STD */ +#include <iostream> + +/* EFLxx */ +#include <evasxx/Canvas.h> +#include "../include/ecorexx/EvasWindowSoftwareX11.h" +#include "../include/ecorexx/XWindow.h" + +namespace Ecorexx { + +EvasWindowSoftwareX11::EvasWindowSoftwareX11( const Eflxx::Size &size, const char* display ) : + EvasWindow(), + mExwin (NULL) +{ + Dout( dc::notice, "EvasWindow::EvasWindowSoftwareX11" ); + Application::getInstance()->setMainWindow( this ); + + /*if ( ::getenv( "EFL_DISPLAY" ) ) display = ::getenv( "EFL_DISPLAY" ); + if ( ::getenv( "EFL_WIDTH" ) ) size.width (atoi( ::getenv( "EFL_WIDTH" ) )); + if ( ::getenv( "EFL_HEIGHT" ) ) size.height (atoi( ::getenv( "EFL_HEIGHT" ) ));*/ + + Dout( dc::notice, "- detected display string '" << ( display ? display:"<null>" ) << "' - starting X11 engine" ); + //FIXME: Should we care about positioning? 0, 0 for now + _ee = ecore_evas_software_x11_new( const_cast<char*>( display ), 0, 0, 0, size.width (), size.height () ); + + ecore_evas_title_set( _ee, Application::getInstance()->getName().c_str() ); + ecore_evas_borderless_set( _ee, 0 ); + + _canvas = Evasxx::Canvas::wrap ( ecore_evas_get( _ee ) ); + + /* Set up magic object back link */ + ecore_evas_data_set( _ee, "obj_c++", this ); + + /* Set up default callbacks */ + setEventEnabled( Resize, true ); + setEventEnabled( DeleteRequest, true ); +} + +EvasWindowSoftwareX11::~EvasWindowSoftwareX11() +{ +} + +XWindow *EvasWindowSoftwareX11::getXWindow() +{ + // lazy construction... + if (!mExwin) + { + Ecore_X_Window exw = ecore_evas_software_x11_window_get( _ee ); + mExwin = new XWindow( exw ); + } + + return mExwin; +} + +} // end namespace Ecorexx diff --git a/ecorexx/src/EvasWindowXRenderX11.cpp b/ecorexx/src/EvasWindowXRenderX11.cpp new file mode 100644 index 0000000..d6a48cd --- /dev/null +++ b/ecorexx/src/EvasWindowXRenderX11.cpp @@ -0,0 +1,58 @@ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +/* STD */ +#include <iostream> + +/* EFLxx */ +#include <evasxx/Canvas.h> +#include "../include/ecorexx/EvasWindowXRenderX11.h" +#include "../include/ecorexx/XWindow.h" + +namespace Ecorexx { + +EvasWindowXRenderX11::EvasWindowXRenderX11( const Eflxx::Size &size, const char* display ) : + EvasWindow (), + mExwin (NULL) +{ + Dout( dc::notice, "EvasWindow::EvasWindowGL" ); + Application::getInstance()->setMainWindow( this ); + + /*if ( ::getenv( "EFL_DISPLAY" ) ) display = ::getenv( "EFL_DISPLAY" ); + if ( ::getenv( "EFL_WIDTH" ) ) size.width (atoi( ::getenv( "EFL_WIDTH" ) )); + if ( ::getenv( "EFL_HEIGHT" ) ) size.height (atoi( ::getenv( "EFL_HEIGHT" ) ));*/ + + Dout( dc::notice, "- detected display string '" << ( display ? display:"<null>" ) << "' - starting X11 engine" ); + //FIXME: Should we care about positioning? 0, 0 for now + _ee = ecore_evas_xrender_x11_new( const_cast<char*>( display ), 0, 0, 0, size.width (), size.height () ); + + ecore_evas_title_set( _ee, Application::getInstance()->getName().c_str() ); + ecore_evas_borderless_set( _ee, 0 ); + + _canvas = Evasxx::Canvas::wrap (ecore_evas_get( _ee )); + + /* Set up magic object back link */ + ecore_evas_data_set( _ee, "obj_c++", this ); + + /* Set up default callbacks */ + setEventEnabled( Resize, true ); + setEventEnabled( DeleteRequest, true ); +} + +EvasWindowXRenderX11::~EvasWindowXRenderX11() +{ +} + +XWindow *EvasWindowXRenderX11::getXWindow() +{ + // lazy construction... + if (!mExwin) + { + Ecore_X_Window exw = ecore_evas_xrender_x11_window_get( _ee ); + mExwin = new XWindow( exw ); + } + return mExwin; +} + +} // end namespace Ecorexx diff --git a/ecorexx/src/Makefile.am b/ecorexx/src/Makefile.am index 8b1cfa8..61b543e 100644 --- a/ecorexx/src/Makefile.am +++ b/ecorexx/src/Makefile.am @@ -21,7 +21,11 @@ libecorexx_la_SOURCES = \ XWindow.cpp \ Animator.cpp \ Timer.cpp \ - Job.cpp + Job.cpp \ + EvasWindowFB.cpp \ + EvasWindowGLX11.cpp \ + EvasWindowSoftwareX11.cpp \ + EvasWindowXRenderX11.cpp libecorexx_la_LIBADD = \ $(EFL_LIBS) --