diff options
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/App.cc | 9 | ||||
-rw-r--r-- | src/FbTk/FileUtil.cc | 11 | ||||
-rw-r--r-- | src/FbTk/I18n.cc | 8 | ||||
-rw-r--r-- | src/FbTk/SignalHandler.cc | 8 | ||||
-rw-r--r-- | src/FbTk/Timer.cc | 4 |
5 files changed, 29 insertions, 11 deletions
diff --git a/src/FbTk/App.cc b/src/FbTk/App.cc index 8157839..f494a0e 100644 --- a/src/FbTk/App.cc +++ b/src/FbTk/App.cc | |||
@@ -60,8 +60,13 @@ App::App(const char *displayname):m_done(false), m_display(0) { | |||
60 | if (displayname != 0 && displayname[0] == '\0') | 60 | if (displayname != 0 && displayname[0] == '\0') |
61 | displayname = 0; | 61 | displayname = 0; |
62 | m_display = XOpenDisplay(displayname); | 62 | m_display = XOpenDisplay(displayname); |
63 | if (!m_display) | 63 | if (!m_display) { |
64 | throw std::string("Couldn't connect to XServer"); | 64 | if (displayname) { |
65 | throw std::string("Couldn't connect to XServer") + displayname; | ||
66 | } else { | ||
67 | throw std::string("Couldn't connect to XServer passing null display"); | ||
68 | } | ||
69 | } | ||
65 | 70 | ||
66 | FbStringUtil::init(); | 71 | FbStringUtil::init(); |
67 | } | 72 | } |
diff --git a/src/FbTk/FileUtil.cc b/src/FbTk/FileUtil.cc index 5de560b..c92b336 100644 --- a/src/FbTk/FileUtil.cc +++ b/src/FbTk/FileUtil.cc | |||
@@ -63,9 +63,14 @@ bool FileUtil::isExecutable(const char* filename) { | |||
63 | if (!filename || stat(filename, &buf)) | 63 | if (!filename || stat(filename, &buf)) |
64 | return false; | 64 | return false; |
65 | 65 | ||
66 | return buf.st_mode & S_IXUSR || | 66 | return buf.st_mode & S_IXUSR |
67 | buf.st_mode & S_IXGRP || | 67 | #ifdef S_IXGRP |
68 | buf.st_mode & S_IXOTH; | 68 | || buf.st_mode & S_IXGRP |
69 | #endif | ||
70 | #ifdef S_IXOTH | ||
71 | || buf.st_mode & S_IXOTH | ||
72 | #endif | ||
73 | ; | ||
69 | } | 74 | } |
70 | 75 | ||
71 | bool FileUtil::copyFile(const char* from, const char* to) { | 76 | bool FileUtil::copyFile(const char* from, const char* to) { |
diff --git a/src/FbTk/I18n.cc b/src/FbTk/I18n.cc index 81ff078..3daa2e9 100644 --- a/src/FbTk/I18n.cc +++ b/src/FbTk/I18n.cc | |||
@@ -72,17 +72,17 @@ void NLSInit(const char *catalog) { | |||
72 | 72 | ||
73 | 73 | ||
74 | I18n::I18n():m_multibyte(false), m_utf8_translate(false), m_catalog_fd((nl_catd)(-1)) { | 74 | I18n::I18n():m_multibyte(false), m_utf8_translate(false), m_catalog_fd((nl_catd)(-1)) { |
75 | #ifdef HAVE_SETLOCALE | 75 | #if defined(HAVE_SETLOCALE) && defined(NLS) |
76 | //make sure we don't get 0 to m_locale string | 76 | //make sure we don't get 0 to m_locale string |
77 | char *temp = setlocale(LC_MESSAGES, ""); | 77 | char *temp = setlocale(LC_MESSAGES, ""); |
78 | m_locale = ( temp ? temp : ""); | 78 | m_locale = ( temp ? temp : ""); |
79 | if (m_locale.empty()) { | 79 | if (m_locale.empty()) { |
80 | cerr<<"Warning: Failed to set locale, reverting to \"C\""<<endl; | 80 | cerr<<"Warning: Failed to set locale, reverting to \"C\""<<endl; |
81 | #endif // HAVE_SETLOCALE | 81 | #endif // defined(HAVE_SETLOCALE) && defined(NLS) |
82 | 82 | ||
83 | m_locale = "C"; | 83 | m_locale = "C"; |
84 | 84 | ||
85 | #ifdef HAVE_SETLOCALE | 85 | #if defined(HAVE_SETLOCALE) && defined(NLS) |
86 | 86 | ||
87 | } else { | 87 | } else { |
88 | 88 | ||
@@ -102,7 +102,7 @@ I18n::I18n():m_multibyte(false), m_utf8_translate(false), m_catalog_fd((nl_catd) | |||
102 | if (index != string::npos) | 102 | if (index != string::npos) |
103 | m_locale.erase(0,index+1); //erase all characters starting up to index | 103 | m_locale.erase(0,index+1); //erase all characters starting up to index |
104 | } | 104 | } |
105 | #endif // HAVE_SETLOCALE | 105 | #endif // defined(HAVE_SETLOCALE) && defined(NLS) |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
diff --git a/src/FbTk/SignalHandler.cc b/src/FbTk/SignalHandler.cc index a0a4c4c..5f06210 100644 --- a/src/FbTk/SignalHandler.cc +++ b/src/FbTk/SignalHandler.cc | |||
@@ -46,6 +46,7 @@ bool SignalHandler::registerHandler(int signum, SignalEventHandler *eh, | |||
46 | if (oldhandler_ret != 0) | 46 | if (oldhandler_ret != 0) |
47 | *oldhandler_ret = s_signal_handler[signum]; | 47 | *oldhandler_ret = s_signal_handler[signum]; |
48 | 48 | ||
49 | #ifdef HAVE_SIGACTION | ||
49 | struct sigaction sa; | 50 | struct sigaction sa; |
50 | // set callback | 51 | // set callback |
51 | sa.sa_handler = SignalHandler::handleSignal; | 52 | sa.sa_handler = SignalHandler::handleSignal; |
@@ -54,7 +55,12 @@ bool SignalHandler::registerHandler(int signum, SignalEventHandler *eh, | |||
54 | 55 | ||
55 | if (sigaction(signum, &sa, 0) == -1) | 56 | if (sigaction(signum, &sa, 0) == -1) |
56 | return false; | 57 | return false; |
57 | 58 | #else | |
59 | // Fallback code for Windows and other platforms lacking sigaction. | ||
60 | if (signal(signum, &SignalHandler::handleSignal) == SIG_ERR) { | ||
61 | return false; | ||
62 | } | ||
63 | #endif | ||
58 | s_signal_handler[signum] = eh; | 64 | s_signal_handler[signum] = eh; |
59 | 65 | ||
60 | return true; | 66 | return true; |
diff --git a/src/FbTk/Timer.cc b/src/FbTk/Timer.cc index 9b3fe8c..4d9f54f 100644 --- a/src/FbTk/Timer.cc +++ b/src/FbTk/Timer.cc | |||
@@ -49,7 +49,9 @@ | |||
49 | # include <string.h> | 49 | # include <string.h> |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | #include <sys/select.h> | 52 | #ifdef HAVE_SYS_SELECT_H |
53 | # include <sys/select.h> | ||
54 | #endif | ||
53 | 55 | ||
54 | namespace FbTk { | 56 | namespace FbTk { |
55 | 57 | ||