almost done the ustring conversion

This commit is contained in:
Dana Jansens 2003-01-13 05:54:40 +00:00
parent 5a90d2b671
commit ef02a0c8ae
17 changed files with 107 additions and 90 deletions

View file

@ -29,6 +29,7 @@
#include "timerqueue.hh" #include "timerqueue.hh"
#include "timerqueuemanager.hh" #include "timerqueuemanager.hh"
#include "util.hh" #include "util.hh"
#include "ustring.hh"
#include "widget.hh" #include "widget.hh"
#endif // __otk_hh #endif // __otk_hh

View file

@ -12,6 +12,7 @@
%include "stl.i" %include "stl.i"
//%include std_list.i //%include std_list.i
%include "ustring.i"
%ignore otk::OBDisplay::display; %ignore otk::OBDisplay::display;
%inline %{ %inline %{

View file

@ -382,7 +382,7 @@ bool Property::get(Window win, Atoms atom, StringType type,
bool Property::get(Window win, Atoms atom, StringType type, bool Property::get(Window win, Atoms atom, StringType type,
unsigned long *nelements, StringVect *strings) const unsigned long *nelements, StringVect *strings) const
{ {
assert(atom >= 0 && atom < NUM_ATOMS); assert(atom >= 0 && atom < NUM_ATOMS);
assert(type >= 0 && type < NUM_STRING_TYPE); assert(type >= 0 && type < NUM_STRING_TYPE);

View file

@ -142,6 +142,11 @@ ustring::size_type ustring::max_size() const
return _string.max_size(); return _string.max_size();
} }
bool ustring::empty() const
{
return _string.empty();
}
void ustring::clear() void ustring::clear()
{ {
_string.erase(); _string.erase();

View file

@ -152,7 +152,7 @@ public:
ustring(const ustring& other); ustring(const ustring& other);
ustring& operator=(const ustring& other); ustring& operator=(const ustring& other);
ustring(const std::string& src); ustring(const std::string& src);
ustring::ustring(const char* src); ustring(const char* src);
// append to the string // append to the string
@ -166,6 +166,7 @@ public:
ustring::size_type bytes() const; ustring::size_type bytes() const;
ustring::size_type capacity() const; ustring::size_type capacity() const;
ustring::size_type max_size() const; ustring::size_type max_size() const;
bool empty() const;
// erase substrings // erase substrings

View file

@ -531,15 +531,15 @@ void Client::updateClass()
if (property->get(_window, otk::Property::wm_class, if (property->get(_window, otk::Property::wm_class,
otk::Property::ascii, &num, &v)) { otk::Property::ascii, &num, &v)) {
if (num > 0) _app_name = v[0]; if (num > 0) _app_name = v[0].c_str();
if (num > 1) _app_class = v[1]; if (num > 1) _app_class = v[1].c_str();
} }
v.clear(); v.clear();
num = 1; num = 1;
if (property->get(_window, otk::Property::wm_window_role, if (property->get(_window, otk::Property::wm_window_role,
otk::Property::ascii, &num, &v)) { otk::Property::ascii, &num, &v)) {
if (num > 0) _role = v[0]; if (num > 0) _role = v[0].c_str();
} }
} }

View file

@ -12,6 +12,7 @@
#include "otk/strut.hh" #include "otk/strut.hh"
#include "otk/rect.hh" #include "otk/rect.hh"
#include "otk/eventhandler.hh" #include "otk/eventhandler.hh"
#include "otk/ustring.hh"
extern "C" { extern "C" {
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -182,9 +183,9 @@ private:
long _desktop; long _desktop;
//! Normal window title //! Normal window title
std::string _title; // XXX: Have to keep track if this string is Utf8 or not otk::ustring _title;
//! Window title when iconifiged //! Window title when iconifiged
std::string _icon_title; otk::ustring _icon_title;
//! The application that created the window //! The application that created the window
std::string _app_name; std::string _app_name;
@ -412,9 +413,9 @@ BB @param window The window id that the Client class should handle
*/ */
inline long desktop() const { return _desktop; } inline long desktop() const { return _desktop; }
//! Returns the window's title //! Returns the window's title
inline const std::string &title() const { return _title; } inline const otk::ustring &title() const { return _title; }
//! Returns the window's title when it is iconified //! Returns the window's title when it is iconified
inline const std::string &iconTitle() const { return _title; } inline const otk::ustring &iconTitle() const { return _title; }
//! Returns the application's name to whom the window belongs //! Returns the application's name to whom the window belongs
inline const std::string &appName() const { return _app_name; } inline const std::string &appName() const { return _app_name; }
//! Returns the class of the window //! Returns the class of the window

View file

@ -64,7 +64,7 @@ Frame::~Frame()
} }
void Frame::setTitle(const std::string &text) void Frame::setTitle(const otk::ustring &text)
{ {
_label.setText(text); _label.setText(text);
_label.update(); _label.update();
@ -172,7 +172,7 @@ void Frame::adjustSize()
// separation between titlebar elements // separation between titlebar elements
const int sep = bevel + 1; const int sep = bevel + 1;
std::string layout; otk::ustring layout;
if (!python_get_string("titlebar_layout", &layout)) if (!python_get_string("titlebar_layout", &layout))
layout = "ILMC"; layout = "ILMC";

View file

@ -18,6 +18,7 @@ extern "C" {
#include "otk/screeninfo.hh" #include "otk/screeninfo.hh"
#include "otk/style.hh" #include "otk/style.hh"
#include "otk/widget.hh" #include "otk/widget.hh"
#include "otk/ustring.hh"
#include <string> #include <string>
@ -88,7 +89,7 @@ public:
//! Displays unfocused decorations //! Displays unfocused decorations
virtual void unfocus(); virtual void unfocus();
void setTitle(const std::string &text); void setTitle(const otk::ustring &text);
//! Reparents the client window from the root window onto the frame //! Reparents the client window from the root window onto the frame
void grabClient(); void grabClient();

View file

@ -26,7 +26,7 @@ LabelWidget::~LabelWidget()
} }
void LabelWidget::setText(const std::string &text) void LabelWidget::setText(const otk::ustring &text)
{ {
_text = text; _text = text;
_dirty = true; _dirty = true;
@ -77,7 +77,7 @@ void LabelWidget::update()
otk::Widget::update(); otk::Widget::update();
if (draw) { if (draw) {
std::string t = _text; otk::ustring t = _text;
int x = _sidemargin; // x coord for the text int x = _sidemargin; // x coord for the text
// find a string that will fit inside the area for text // find a string that will fit inside the area for text

View file

@ -6,6 +6,7 @@
#include "otk/widget.hh" #include "otk/widget.hh"
#include "otk/font.hh" #include "otk/font.hh"
#include "otk/style.hh" #include "otk/style.hh"
#include "otk/ustring.hh"
namespace ob { namespace ob {
@ -17,7 +18,7 @@ private:
otk::Color *_text_color; otk::Color *_text_color;
int _sidemargin; int _sidemargin;
otk::Style::TextJustify _justify; otk::Style::TextJustify _justify;
std::string _text; otk::ustring _text;
//! Object used by Xft to render to the drawable //! Object used by Xft to render to the drawable
XftDraw *_xftdraw; XftDraw *_xftdraw;
@ -34,8 +35,8 @@ public:
virtual void update(); virtual void update();
inline const std::string &text() const { return _text; } inline const otk::ustring &text() const { return _text; }
void setText(const std::string &text); void setText(const otk::ustring &text);
}; };
} }

View file

@ -112,6 +112,8 @@ void python_callback(PyObject *func, KeyData *data)
Display *Display_display() { return otk::Display::display; } Display *Display_display() { return otk::Display::display; }
%}; %};
%include "../otk/ustring.i"
%include "../otk/display.hh" %include "../otk/display.hh"
%include "../otk/point.hh" %include "../otk/point.hh"
%include "../otk/property.hh" %include "../otk/property.hh"

View file

@ -676,8 +676,8 @@ SWIG_InstallConstants(PyObject *d, swig_const_info constants[]) {
#define SWIGTYPE_p_XConfigureEvent swig_types[28] #define SWIGTYPE_p_XConfigureEvent swig_types[28]
#define SWIGTYPE_p_XCirculateEvent swig_types[29] #define SWIGTYPE_p_XCirculateEvent swig_types[29]
#define SWIGTYPE_p_XRectangle swig_types[30] #define SWIGTYPE_p_XRectangle swig_types[30]
#define SWIGTYPE_p_std__string swig_types[31] #define SWIGTYPE_p_otk__ustring swig_types[31]
#define SWIGTYPE_p_ustring swig_types[32] #define SWIGTYPE_p_std__string swig_types[32]
#define SWIGTYPE_p_XCrossingEvent swig_types[33] #define SWIGTYPE_p_XCrossingEvent swig_types[33]
#define SWIGTYPE_p_Display swig_types[34] #define SWIGTYPE_p_Display swig_types[34]
#define SWIGTYPE_p_otk__Display swig_types[35] #define SWIGTYPE_p_otk__Display swig_types[35]
@ -885,6 +885,9 @@ void python_callback(PyObject *func, KeyData *data)
Display *Display_display() { return otk::Display::display; } Display *Display_display() { return otk::Display::display; }
#include "ustring.hh"
ob::Client *ob_Screen_client(ob::Screen *self,int i){ ob::Client *ob_Screen_client(ob::Screen *self,int i){
if (i >= (int)self->clients.size()) if (i >= (int)self->clients.size())
return NULL; return NULL;
@ -1506,7 +1509,8 @@ static PyObject *_wrap_Property_set__SWIG_2(PyObject *self, PyObject *args) {
Window arg2 ; Window arg2 ;
int arg3 ; int arg3 ;
int arg4 ; int arg4 ;
ustring *arg5 = 0 ; otk::ustring *arg5 = 0 ;
otk::ustring temp5 ;
PyObject * obj0 = 0 ; PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ; PyObject * obj1 = 0 ;
PyObject * obj4 = 0 ; PyObject * obj4 = 0 ;
@ -1515,11 +1519,15 @@ static PyObject *_wrap_Property_set__SWIG_2(PyObject *self, PyObject *args) {
if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Property,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Property,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
arg2 = (Window) PyInt_AsLong(obj1); arg2 = (Window) PyInt_AsLong(obj1);
if (PyErr_Occurred()) SWIG_fail; if (PyErr_Occurred()) SWIG_fail;
if ((SWIG_ConvertPtr(obj4,(void **) &arg5, SWIGTYPE_p_ustring,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; {
if (arg5 == NULL) { if (PyString_Check(obj4)) {
PyErr_SetString(PyExc_TypeError,"null reference"); SWIG_fail; temp5 = otk::ustring(PyString_AsString(obj4));
arg5 = &temp5;
}else {
SWIG_exception(SWIG_TypeError, "ustring expected");
}
} }
((otk::Property const *)arg1)->set(arg2,(otk::Property::Atoms )arg3,(otk::Property::StringType )arg4,(ustring const &)*arg5); ((otk::Property const *)arg1)->set(arg2,(otk::Property::Atoms )arg3,(otk::Property::StringType )arg4,(otk::ustring const &)*arg5);
Py_INCREF(Py_None); resultobj = Py_None; Py_INCREF(Py_None); resultobj = Py_None;
return resultobj; return resultobj;
@ -1565,47 +1573,6 @@ static PyObject *_wrap_Property_set(PyObject *self, PyObject *args) {
for (ii = 0; (ii < argc) && (ii < 6); ii++) { for (ii = 0; (ii < argc) && (ii < 6); ii++) {
argv[ii] = PyTuple_GetItem(args,ii); argv[ii] = PyTuple_GetItem(args,ii);
} }
if (argc == 5) {
int _v;
{
void *ptr;
if (SWIG_ConvertPtr(argv[0], (void **) &ptr, SWIGTYPE_p_otk__Property, 0) == -1) {
_v = 0;
PyErr_Clear();
}else {
_v = 1;
}
}
if (_v) {
{
_v = (PyInt_Check(argv[1]) || PyLong_Check(argv[1])) ? 1 : 0;
}
if (_v) {
{
_v = (PyInt_Check(argv[2]) || PyLong_Check(argv[2])) ? 1 : 0;
}
if (_v) {
{
_v = (PyInt_Check(argv[3]) || PyLong_Check(argv[3])) ? 1 : 0;
}
if (_v) {
{
void *ptr;
if (SWIG_ConvertPtr(argv[4], (void **) &ptr, SWIGTYPE_p_ustring, 0) == -1) {
_v = 0;
PyErr_Clear();
}else {
_v = 1;
}
}
if (_v) {
return _wrap_Property_set__SWIG_2(self,args);
}
}
}
}
}
}
if (argc == 5) { if (argc == 5) {
int _v; int _v;
{ {
@ -1682,6 +1649,41 @@ static PyObject *_wrap_Property_set(PyObject *self, PyObject *args) {
} }
} }
} }
if (argc == 5) {
int _v;
{
void *ptr;
if (SWIG_ConvertPtr(argv[0], (void **) &ptr, SWIGTYPE_p_otk__Property, 0) == -1) {
_v = 0;
PyErr_Clear();
}else {
_v = 1;
}
}
if (_v) {
{
_v = (PyInt_Check(argv[1]) || PyLong_Check(argv[1])) ? 1 : 0;
}
if (_v) {
{
_v = (PyInt_Check(argv[2]) || PyLong_Check(argv[2])) ? 1 : 0;
}
if (_v) {
{
_v = (PyInt_Check(argv[3]) || PyLong_Check(argv[3])) ? 1 : 0;
}
if (_v) {
{
_v = PyString_Check(argv[4]) ? 1 : 0;
}
if (_v) {
return _wrap_Property_set__SWIG_2(self,args);
}
}
}
}
}
}
if (argc == 6) { if (argc == 6) {
int _v; int _v;
{ {
@ -1795,7 +1797,7 @@ static PyObject *_wrap_Property_get__SWIG_2(PyObject *self, PyObject *args) {
Window arg2 ; Window arg2 ;
int arg3 ; int arg3 ;
int arg4 ; int arg4 ;
std::string *arg5 = (std::string *) 0 ; otk::ustring *arg5 = (otk::ustring *) 0 ;
bool result; bool result;
PyObject * obj0 = 0 ; PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ; PyObject * obj1 = 0 ;
@ -1805,7 +1807,7 @@ static PyObject *_wrap_Property_get__SWIG_2(PyObject *self, PyObject *args) {
if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Property,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Property,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
arg2 = (Window) PyInt_AsLong(obj1); arg2 = (Window) PyInt_AsLong(obj1);
if (PyErr_Occurred()) SWIG_fail; if (PyErr_Occurred()) SWIG_fail;
if ((SWIG_ConvertPtr(obj4,(void **) &arg5, SWIGTYPE_p_std__string,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; if ((SWIG_ConvertPtr(obj4,(void **) &arg5, SWIGTYPE_p_otk__ustring,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
result = (bool)((otk::Property const *)arg1)->get(arg2,(otk::Property::Atoms )arg3,(otk::Property::StringType )arg4,arg5); result = (bool)((otk::Property const *)arg1)->get(arg2,(otk::Property::Atoms )arg3,(otk::Property::StringType )arg4,arg5);
resultobj = PyInt_FromLong((long)result); resultobj = PyInt_FromLong((long)result);
@ -1920,7 +1922,7 @@ static PyObject *_wrap_Property_get(PyObject *self, PyObject *args) {
if (_v) { if (_v) {
{ {
void *ptr; void *ptr;
if (SWIG_ConvertPtr(argv[4], (void **) &ptr, SWIGTYPE_p_std__string, 0) == -1) { if (SWIG_ConvertPtr(argv[4], (void **) &ptr, SWIGTYPE_p_otk__ustring, 0) == -1) {
_v = 0; _v = 0;
PyErr_Clear(); PyErr_Clear();
}else { }else {
@ -5596,8 +5598,8 @@ static PyObject *_wrap_Screen_setDesktopName(PyObject *self, PyObject *args) {
PyObject *resultobj; PyObject *resultobj;
ob::Screen *arg1 = (ob::Screen *) 0 ; ob::Screen *arg1 = (ob::Screen *) 0 ;
long arg2 ; long arg2 ;
std::string *arg3 = 0 ; otk::ustring *arg3 = 0 ;
std::string temp3 ; otk::ustring temp3 ;
PyObject * obj0 = 0 ; PyObject * obj0 = 0 ;
PyObject * obj2 = 0 ; PyObject * obj2 = 0 ;
@ -5605,13 +5607,13 @@ static PyObject *_wrap_Screen_setDesktopName(PyObject *self, PyObject *args) {
if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__Screen,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__Screen,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
{ {
if (PyString_Check(obj2)) { if (PyString_Check(obj2)) {
temp3 = std::string(PyString_AsString(obj2)); temp3 = otk::ustring(PyString_AsString(obj2));
arg3 = &temp3; arg3 = &temp3;
}else { }else {
SWIG_exception(SWIG_TypeError, "string expected"); SWIG_exception(SWIG_TypeError, "ustring expected");
} }
} }
(arg1)->setDesktopName(arg2,(std::string const &)*arg3); (arg1)->setDesktopName(arg2,(otk::ustring const &)*arg3);
Py_INCREF(Py_None); resultobj = Py_None; Py_INCREF(Py_None); resultobj = Py_None;
return resultobj; return resultobj;
@ -5969,14 +5971,14 @@ static PyObject *_wrap_Client_desktop(PyObject *self, PyObject *args) {
static PyObject *_wrap_Client_title(PyObject *self, PyObject *args) { static PyObject *_wrap_Client_title(PyObject *self, PyObject *args) {
PyObject *resultobj; PyObject *resultobj;
ob::Client *arg1 = (ob::Client *) 0 ; ob::Client *arg1 = (ob::Client *) 0 ;
std::string *result; otk::ustring *result;
PyObject * obj0 = 0 ; PyObject * obj0 = 0 ;
if(!PyArg_ParseTuple(args,(char *)"O:Client_title",&obj0)) goto fail; if(!PyArg_ParseTuple(args,(char *)"O:Client_title",&obj0)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__Client,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__Client,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
{ {
std::string const &_result_ref = ((ob::Client const *)arg1)->title(); otk::ustring const &_result_ref = ((ob::Client const *)arg1)->title();
result = (std::string *) &_result_ref; result = (otk::ustring *) &_result_ref;
} }
{ {
@ -5991,14 +5993,14 @@ static PyObject *_wrap_Client_title(PyObject *self, PyObject *args) {
static PyObject *_wrap_Client_iconTitle(PyObject *self, PyObject *args) { static PyObject *_wrap_Client_iconTitle(PyObject *self, PyObject *args) {
PyObject *resultobj; PyObject *resultobj;
ob::Client *arg1 = (ob::Client *) 0 ; ob::Client *arg1 = (ob::Client *) 0 ;
std::string *result; otk::ustring *result;
PyObject * obj0 = 0 ; PyObject * obj0 = 0 ;
if(!PyArg_ParseTuple(args,(char *)"O:Client_iconTitle",&obj0)) goto fail; if(!PyArg_ParseTuple(args,(char *)"O:Client_iconTitle",&obj0)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__Client,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_ob__Client,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
{ {
std::string const &_result_ref = ((ob::Client const *)arg1)->iconTitle(); otk::ustring const &_result_ref = ((ob::Client const *)arg1)->iconTitle();
result = (std::string *) &_result_ref; result = (otk::ustring *) &_result_ref;
} }
{ {
@ -8252,8 +8254,8 @@ static swig_type_info _swigt__p_ob__KeyData[] = {{"_p_ob__KeyData", 0, "ob::KeyD
static swig_type_info _swigt__p_XConfigureEvent[] = {{"_p_XConfigureEvent", 0, "XConfigureEvent *", 0},{"_p_XConfigureEvent"},{0}}; static swig_type_info _swigt__p_XConfigureEvent[] = {{"_p_XConfigureEvent", 0, "XConfigureEvent *", 0},{"_p_XConfigureEvent"},{0}};
static swig_type_info _swigt__p_XCirculateEvent[] = {{"_p_XCirculateEvent", 0, "XCirculateEvent *", 0},{"_p_XCirculateEvent"},{0}}; static swig_type_info _swigt__p_XCirculateEvent[] = {{"_p_XCirculateEvent", 0, "XCirculateEvent *", 0},{"_p_XCirculateEvent"},{0}};
static swig_type_info _swigt__p_XRectangle[] = {{"_p_XRectangle", 0, "XRectangle *", 0},{"_p_XRectangle"},{0}}; static swig_type_info _swigt__p_XRectangle[] = {{"_p_XRectangle", 0, "XRectangle *", 0},{"_p_XRectangle"},{0}};
static swig_type_info _swigt__p_otk__ustring[] = {{"_p_otk__ustring", 0, "otk::ustring *", 0},{"_p_otk__ustring"},{0}};
static swig_type_info _swigt__p_std__string[] = {{"_p_std__string", 0, "std::string *", 0},{"_p_std__string"},{0}}; static swig_type_info _swigt__p_std__string[] = {{"_p_std__string", 0, "std::string *", 0},{"_p_std__string"},{0}};
static swig_type_info _swigt__p_ustring[] = {{"_p_ustring", 0, "ustring *", 0},{"_p_ustring"},{0}};
static swig_type_info _swigt__p_XCrossingEvent[] = {{"_p_XCrossingEvent", 0, "XCrossingEvent *", 0},{"_p_XCrossingEvent"},{0}}; static swig_type_info _swigt__p_XCrossingEvent[] = {{"_p_XCrossingEvent", 0, "XCrossingEvent *", 0},{"_p_XCrossingEvent"},{0}};
static swig_type_info _swigt__p_Display[] = {{"_p_Display", 0, "Display *", 0},{"_p_Display"},{0}}; static swig_type_info _swigt__p_Display[] = {{"_p_Display", 0, "Display *", 0},{"_p_Display"},{0}};
static swig_type_info _swigt__p_otk__Display[] = {{"_p_otk__Display", 0, "otk::Display *", 0},{"_p_otk__Display"},{0}}; static swig_type_info _swigt__p_otk__Display[] = {{"_p_otk__Display", 0, "otk::Display *", 0},{"_p_otk__Display"},{0}};
@ -8316,8 +8318,8 @@ _swigt__p_ob__KeyData,
_swigt__p_XConfigureEvent, _swigt__p_XConfigureEvent,
_swigt__p_XCirculateEvent, _swigt__p_XCirculateEvent,
_swigt__p_XRectangle, _swigt__p_XRectangle,
_swigt__p_otk__ustring,
_swigt__p_std__string, _swigt__p_std__string,
_swigt__p_ustring,
_swigt__p_XCrossingEvent, _swigt__p_XCrossingEvent,
_swigt__p_Display, _swigt__p_Display,
_swigt__p_otk__Display, _swigt__p_otk__Display,

View file

@ -66,7 +66,7 @@ bool python_get_long(const char *name, long *value)
return true; return true;
} }
bool python_get_string(const char *name, std::string *value) bool python_get_string(const char *name, otk::ustring *value)
{ {
PyObject *val = PyDict_GetItemString(obdict, const_cast<char*>(name)); PyObject *val = PyDict_GetItemString(obdict, const_cast<char*>(name));
if (!(val && PyString_Check(val))) return false; if (!(val && PyString_Check(val))) return false;
@ -75,7 +75,7 @@ bool python_get_string(const char *name, std::string *value)
return true; return true;
} }
bool python_get_stringlist(const char *name, std::vector<std::string> *value) bool python_get_stringlist(const char *name, std::vector<otk::ustring> *value)
{ {
PyObject *val = PyDict_GetItemString(obdict, const_cast<char*>(name)); PyObject *val = PyDict_GetItemString(obdict, const_cast<char*>(name));
if (!(val && PyList_Check(val))) return false; if (!(val && PyList_Check(val))) return false;

View file

@ -10,6 +10,7 @@
#include "otk/rect.hh" #include "otk/rect.hh"
#include "otk/property.hh" #include "otk/property.hh"
#include "otk/display.hh" #include "otk/display.hh"
#include "otk/ustring.hh"
extern "C" { extern "C" {
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -165,8 +166,8 @@ void python_destroy();
bool python_exec(const std::string &path); bool python_exec(const std::string &path);
bool python_get_long(const char *name, long *value); bool python_get_long(const char *name, long *value);
bool python_get_string(const char *name, std::string *value); bool python_get_string(const char *name, otk::ustring *value);
bool python_get_stringlist(const char *name, std::vector<std::string> *value); bool python_get_stringlist(const char *name, std::vector<otk::ustring> *value);
/*********************************************** /***********************************************
* These are found in openbox.i, not python.cc * * These are found in openbox.i, not python.cc *

View file

@ -82,10 +82,10 @@ Screen::Screen(int screen)
// initialize the screen's style // initialize the screen's style
_style.setImageControl(_image_control); _style.setImageControl(_image_control);
std::string stylepath; otk::ustring stylepath;
python_get_string("theme", &stylepath); python_get_string("theme", &stylepath);
otk::Configuration sconfig(false); otk::Configuration sconfig(false);
sconfig.setFile(otk::expandTilde(stylepath)); sconfig.setFile(otk::expandTilde(stylepath.c_str()));
if (!sconfig.load()) { if (!sconfig.load()) {
sconfig.setFile(otk::expandTilde(DEFAULTSTYLE)); sconfig.setFile(otk::expandTilde(DEFAULTSTYLE));
if (!sconfig.load()) { if (!sconfig.load()) {
@ -107,7 +107,7 @@ Screen::Screen(int screen)
geometry, 2); geometry, 2);
// Set the net_desktop_names property // Set the net_desktop_names property
std::vector<std::string> names; std::vector<otk::ustring> names;
python_get_stringlist("desktop_names", &names); python_get_stringlist("desktop_names", &names);
Openbox::instance->property()->set(_info->rootWindow(), Openbox::instance->property()->set(_info->rootWindow(),
otk::Property::net_desktop_names, otk::Property::net_desktop_names,
@ -710,7 +710,7 @@ void Screen::updateDesktopNames()
} }
void Screen::setDesktopName(long i, const std::string &name) void Screen::setDesktopName(long i, const otk::ustring &name)
{ {
assert(i >= 0); assert(i >= 0);

View file

@ -19,6 +19,7 @@ extern "C" {
#include "otk/screeninfo.hh" #include "otk/screeninfo.hh"
#include "otk/eventhandler.hh" #include "otk/eventhandler.hh"
#include "otk/property.hh" #include "otk/property.hh"
#include "otk/ustring.hh"
#include <string> #include <string>
#include <list> #include <list>
@ -191,7 +192,7 @@ public:
@param name The name to set for the desktop @param name The name to set for the desktop
If the index is too large, it is simply ignored. If the index is too large, it is simply ignored.
*/ */
void setDesktopName(long i, const std::string &name); void setDesktopName(long i, const otk::ustring &name);
virtual void propertyHandler(const XPropertyEvent &e); virtual void propertyHandler(const XPropertyEvent &e);
virtual void clientMessageHandler(const XClientMessageEvent &e); virtual void clientMessageHandler(const XClientMessageEvent &e);