X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dee28fdd4dda8fc428aec093b9633f52d5144540..ed8385818f26035d2f60d3a719250ffab48e6c34:/src/gtk/utilsgtk.cpp diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index faf8184ba8..1f9ea333a7 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -21,10 +21,12 @@ #include "wx/apptrait.h" #include "wx/process.h" +#include "wx/sysopt.h" #include "wx/unix/execute.h" #include "wx/gtk/private/timer.h" +#include "wx/evtloop.h" #ifdef __WXDEBUG__ #include "wx/gtk/assertdlg_gtk.h" @@ -185,16 +187,17 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt) #if !wxUSE_UNICODE -wxCharBuffer wxConvertToGTK(const wxString& s, wxFontEncoding enc) +WXDLLIMPEXP_CORE wxCharBuffer +wxConvertToGTK(const wxString& s, wxFontEncoding enc) { wxWCharBuffer wbuf; if ( enc == wxFONTENCODING_SYSTEM || enc == wxFONTENCODING_DEFAULT ) { - wbuf = wxConvUI->cMB2WC(s); + wbuf = wxConvUI->cMB2WC(s.c_str()); } else // another encoding, use generic conversion class { - wbuf = wxCSConv(enc).cMB2WC(s); + wbuf = wxCSConv(enc).cMB2WC(s.c_str()); } if ( !wbuf && !s.empty() ) @@ -205,17 +208,18 @@ wxCharBuffer wxConvertToGTK(const wxString& s, wxFontEncoding enc) // we choose ISO8859-1 here arbitrarily, it's just the most common // encoding probably and, also importantly here, conversion from it // never fails as it's done internally by wxCSConv - wbuf = wxCSConv(wxFONTENCODING_ISO8859_1).cMB2WC(s); + wbuf = wxCSConv(wxFONTENCODING_ISO8859_1).cMB2WC(s.c_str()); } return wxConvUTF8.cWC2MB(wbuf); } -wxCharBuffer wxConvertFromGTK(const wxString& s, wxFontEncoding enc) +WXDLLIMPEXP_CORE wxCharBuffer +wxConvertFromGTK(const wxString& s, wxFontEncoding enc) { // this conversion should never fail as GTK+ always uses UTF-8 internally // so there are no complications here - const wxWCharBuffer wbuf(wxConvUTF8.cMB2WC(s)); + const wxWCharBuffer wbuf(wxConvUTF8.cMB2WC(s.c_str())); if ( enc == wxFONTENCODING_SYSTEM ) return wxConvUI->cWC2MB(wbuf); @@ -310,11 +314,15 @@ wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const return wxPORT_GTK; } +#if wxUSE_TIMER + wxTimerImpl *wxGUIAppTraits::CreateTimerImpl(wxTimer *timer) { return new wxGTKTimerImpl(timer); } +#endif // wxUSE_TIMER + #if wxUSE_DETECT_SM static wxString GetSM() { @@ -362,6 +370,12 @@ static wxString GetSM() // wxGUIAppTraits //----------------------------------------------------------------------------- +wxEventLoopBase *wxGUIAppTraits::CreateEventLoop() +{ + return new wxEventLoop(); +} + + #if wxUSE_INTL void wxGUIAppTraits::SetLocale() { @@ -474,17 +488,20 @@ bool wxGUIAppTraits::ShowAssertDialog(const wxString& msg) wxString wxGUIAppTraits::GetDesktopEnvironment() const { + wxString de = wxSystemOptions::GetOption(_T("gtk.desktop")); #if wxUSE_DETECT_SM - static const wxString SM = GetSM(); - - if (SM == wxT("GnomeSM")) - return wxT("GNOME"); + if ( de.empty() ) + { + static const wxString s_SM = GetSM(); - if (SM == wxT("KDE")) - return wxT("KDE"); + if (s_SM == wxT("GnomeSM")) + de = wxT("GNOME"); + else if (s_SM == wxT("KDE")) + de = wxT("KDE"); + } #endif // wxUSE_DETECT_SM - return wxEmptyString; + return de; } #ifdef __WXGTK26__