From 97ca65ffbcac0ad9d3ced57110f9bfa2f345ae20 Mon Sep 17 00:00:00 2001 From: spartanj Date: Sat, 12 Mar 2011 03:12:19 -0300 Subject: [PATCH] Removed a couple of things that didn't make sense to continue in eepp. --- src/ee.h | 2 +- src/utils/utils.cpp | 35 +++++--------------- src/utils/utils.hpp | 3 -- src/window/backend/SDL/cclipboardsdl.cpp | 24 ++++++++++++-- src/window/backend/SDL/cclipboardsdl.hpp | 2 -- src/window/backend/allegro5/cclipboardal.cpp | 3 -- src/window/backend/allegro5/cclipboardal.hpp | 2 -- src/window/backend/null/cclipboardnull.cpp | 3 -- src/window/backend/null/cclipboardnull.hpp | 2 -- src/window/cclipboard.hpp | 3 -- 10 files changed, 31 insertions(+), 48 deletions(-) diff --git a/src/ee.h b/src/ee.h index ca88a74a6..b6efaf5ff 100755 --- a/src/ee.h +++ b/src/ee.h @@ -23,7 +23,7 @@ /** @TODO Check for endianness problems, and make EEPP endianness agnostic. - @TODO Add backend for SDL 1.3 ( support for Android ). And may be SFML backend ( just for fun ). + @TODO Add backend for SDL 1.3 ( support for Android ). And may be SFML backend ( may be implement as the default build-in backend with sfml-window static linked ). @TODO Support for Android and iOS. @TODO Support color cursors \n SDL 1.2 Not even posible ( win32 and x11 backends for this ready ) \n diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index 71541c57e..2e7563f03 100755 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -421,22 +421,6 @@ bool MakeDir( const std::string& path, const Uint16& mode ) { return v == 0; } -std::string GetWindowsPath() { -#if EE_PLATFORM == EE_PLATFORM_WIN - #ifdef UNICODE - wchar_t Buffer[1024]; - GetWindowsDirectory( Buffer, 1024 ); - return String( Buffer ).ToUtf8(); - #else - char Buffer[1024]; - GetWindowsDirectory( Buffer, 1024 ); - return std::string( Buffer ); - #endif -#else - return std::string( "/usr/bin/" ); // :P -#endif -} - Uint32 MakeHash( const std::string& str ) { return MakeHash( reinterpret_cast( &str[0] ) ); } @@ -540,33 +524,32 @@ eeInt GetNumCPUs() { GetSystemInfo(&info); nprocs = (eeInt) info.dwNumberOfProcessors; - #elif EE_PLATFORM == EE_PLATFORM_LINUX + #elif EE_PLATFORM == EE_PLATFORM_LINUX || EE_PLATFORM == EE_PLATFORM_SOLARIS nprocs = sysconf(_SC_NPROCESSORS_ONLN); - #elif EE_PLATFORM == EE_PLATFORM_MACOSX + #elif EE_PLATFORM == EE_PLATFORM_MACOSX || EE_PLATFORM == EE_PLATFORM_BSD int mib[2]; - size_t len; int maxproc = 1; + size_t len = sizeof(int); mib[0] = CTL_HW; mib[1] = HW_NCPU; + len = sizeof(maxproc); - // sysctl != 0 == error - if ( sysctl(mib, 2, &maxproc, &len, NULL, NULL == -1) ) - return 1; - + sysctl( mib, 2, &maxproc, &len, NULL, 0 ); + nprocs = maxproc; #elif EE_PLATFORM == EE_PLATFORM_HAIKU system_info info; - if ( get_system_info( &info ) == B_OK ) { - return info.cpu_count; + if ( B_OK == get_system_info( &info ) ) { + nprocs = info.cpu_count; } #else #warning GetNumCPUs not implemented on this platform ( it will return 1 ). #endif - if ( nprocs < 0 ) + if ( nprocs < 1 ) nprocs = 1; return nprocs; diff --git a/src/utils/utils.hpp b/src/utils/utils.hpp index 99df0607e..11b2f0a3f 100755 --- a/src/utils/utils.hpp +++ b/src/utils/utils.hpp @@ -37,9 +37,6 @@ namespace EE { namespace Utils { /** Creates a new directory */ bool EE_API MakeDir( const std::string& path, const Uint16& mode = 0770 ); - /** @return The default windows directory */ - std::string EE_API GetWindowsPath(); - /** @return string hash */ Uint32 EE_API MakeHash( const std::string& str ); diff --git a/src/window/backend/SDL/cclipboardsdl.cpp b/src/window/backend/SDL/cclipboardsdl.cpp index 30050ad70..19c55ef4f 100644 --- a/src/window/backend/SDL/cclipboardsdl.cpp +++ b/src/window/backend/SDL/cclipboardsdl.cpp @@ -88,10 +88,28 @@ void cClipboardSDL::Init() { mInfo = &( reinterpret_cast ( mWindow )->mWMinfo ); } -void cClipboardSDL::SetText( const std::string& Text ) { -} +#if defined( EE_X11_PLATFORM ) +#ifdef X_HAVE_UTF8_STRING +#define TEXT_FORMAT XInternAtom(display, "UTF8_STRING", False) +#else +#define TEXT_FORMAT XA_STRING +#endif +#endif -void cClipboardSDL::SetText( const String& Text ) { +void cClipboardSDL::SetText( const std::string& Text ) { + #if defined( EE_X11_PLATFORM ) + eeWindowHandler display = mInfo->info.x11.display; + X11Window window = mInfo->info.x11.wmwindow; + Atom format = TEXT_FORMAT; + + XChangeProperty( display, DefaultRootWindow( display ), XA_CUT_BUFFER0, format, 8, PropModeReplace, (const unsigned char *)Text.c_str(), Text.size() ); + + if ( XGetSelectionOwner( display, XA_PRIMARY ) != window ) { + XSetSelectionOwner( display, XA_PRIMARY, window, CurrentTime ); + } + #elif EE_PLATFORM == EE_PLATFORM_WIN + + #endif } int cClipboardSDL::clipboard_convert_scrap( int type, char *dst, char *src, int srclen ) { diff --git a/src/window/backend/SDL/cclipboardsdl.hpp b/src/window/backend/SDL/cclipboardsdl.hpp index 23cac5fe6..5185c042f 100644 --- a/src/window/backend/SDL/cclipboardsdl.hpp +++ b/src/window/backend/SDL/cclipboardsdl.hpp @@ -21,8 +21,6 @@ class EE_API cClipboardSDL : public cClipboard { String GetWideText(); void SetText( const std::string& Text ); - - void SetText( const String& Text ); protected: friend class cWindowSDL; diff --git a/src/window/backend/allegro5/cclipboardal.cpp b/src/window/backend/allegro5/cclipboardal.cpp index 74f96f08c..ba7e7dd2f 100644 --- a/src/window/backend/allegro5/cclipboardal.cpp +++ b/src/window/backend/allegro5/cclipboardal.cpp @@ -19,9 +19,6 @@ void cClipboardAl::Init() { void cClipboardAl::SetText( const std::string& Text ) { } -void cClipboardAl::SetText( const String& Text ) { -} - std::string cClipboardAl::GetText() { return std::string(); } diff --git a/src/window/backend/allegro5/cclipboardal.hpp b/src/window/backend/allegro5/cclipboardal.hpp index 817e079ec..543bb2348 100644 --- a/src/window/backend/allegro5/cclipboardal.hpp +++ b/src/window/backend/allegro5/cclipboardal.hpp @@ -19,8 +19,6 @@ class EE_API cClipboardAl : public cClipboard { String GetWideText(); void SetText( const std::string& Text ); - - void SetText( const String& Text ); protected: friend class cWindowAl; diff --git a/src/window/backend/null/cclipboardnull.cpp b/src/window/backend/null/cclipboardnull.cpp index 7f4e838f7..e691a42a9 100644 --- a/src/window/backend/null/cclipboardnull.cpp +++ b/src/window/backend/null/cclipboardnull.cpp @@ -17,9 +17,6 @@ void cClipboardNull::Init() { void cClipboardNull::SetText( const std::string& Text ) { } -void cClipboardNull::SetText( const String& Text ) { -} - std::string cClipboardNull::GetText() { return std::string(); } diff --git a/src/window/backend/null/cclipboardnull.hpp b/src/window/backend/null/cclipboardnull.hpp index 4c2e2c31f..4fdbdedf7 100644 --- a/src/window/backend/null/cclipboardnull.hpp +++ b/src/window/backend/null/cclipboardnull.hpp @@ -15,8 +15,6 @@ class EE_API cClipboardNull : public cClipboard { String GetWideText(); void SetText( const std::string& Text ); - - void SetText( const String& Text ); protected: friend class cWindowNull; diff --git a/src/window/cclipboard.hpp b/src/window/cclipboard.hpp index 5339289cb..3225dd119 100644 --- a/src/window/cclipboard.hpp +++ b/src/window/cclipboard.hpp @@ -17,9 +17,6 @@ class cClipboard { /** Set the current clipboard text */ virtual void SetText( const std::string& Text ) = 0; - - /** Set the current clipboard text */ - virtual void SetText( const String& Text ) = 0; cWindow * GetWindow() const; protected: