]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/gtk/misc.cpp
wxUniversal fixes:
[wxWidgets.git] / wxPython / src / gtk / misc.cpp
index 07f36a4733898e2b21741424dde4c0167723986c..abe4cf77a98eed0232c8a673718b1259b846082e 100644 (file)
@@ -87,6 +87,9 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
     return target;
 }
 
     return target;
 }
 
+    // Put some wx default wxChar* values into wxStrings.
+    static const wxString wxPyEmptyString(wxT(""));
+
     PyObject* wxIntersectRect(wxRect* r1, wxRect* r2) {
         wxRegion  reg1(*r1);
         wxRegion  reg2(*r2);
     PyObject* wxIntersectRect(wxRect* r1, wxRect* r2) {
         wxRegion  reg1(*r1);
         wxRegion  reg2(*r2);
@@ -111,7 +114,7 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
     }
 
     wxString wxGetResource(const wxString& section, const wxString& entry,
     }
 
     wxString wxGetResource(const wxString& section, const wxString& entry,
-                          const wxString& file = wxEmptyString) {
+                           const wxString& file = wxPyEmptyString) {
         wxChar * retval;
         wxGetResource(section, entry, &retval, file);
         return retval;
         wxChar * retval;
         wxGetResource(section, entry, &retval, file);
         return retval;
@@ -396,7 +399,7 @@ static PyObject *_wrap_wxNow(PyObject *self, PyObject *args, PyObject *kwargs) {
 static PyObject *_wrap_wxShell(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     bool  _result;
 static PyObject *_wrap_wxShell(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     bool  _result;
-    wxString * _arg0 = (wxString *) &wxEmptyString;
+    wxString * _arg0 = (wxString *) &wxPyEmptyString;
     PyObject * _obj0 = 0;
     char *_kwnames[] = { "command", NULL };
 
     PyObject * _obj0 = 0;
     char *_kwnames[] = { "command", NULL };
 
@@ -606,7 +609,7 @@ static PyObject *_wrap_wxGetResource(PyObject *self, PyObject *args, PyObject *k
     wxString * _result;
     wxString * _arg0;
     wxString * _arg1;
     wxString * _result;
     wxString * _arg0;
     wxString * _arg1;
-    wxString * _arg2 = (wxString *) &wxEmptyString;
+    wxString * _arg2 = (wxString *) &wxPyEmptyString;
     PyObject * _obj0 = 0;
     PyObject * _obj1 = 0;
     PyObject * _obj2 = 0;
     PyObject * _obj0 = 0;
     PyObject * _obj1 = 0;
     PyObject * _obj2 = 0;
@@ -865,15 +868,22 @@ static PyObject *_wrap_wxGetHomeDir(PyObject *self, PyObject *args, PyObject *kw
 static PyObject *_wrap_wxGetUserHome(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxString * _result;
 static PyObject *_wrap_wxGetUserHome(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxString * _result;
-    char * _arg0 = (char *) "";
+    wxString * _arg0 = (wxString *) &wxPyEmptyString;
+    PyObject * _obj0 = 0;
     char *_kwnames[] = { "user", NULL };
 
     self = self;
     char *_kwnames[] = { "user", NULL };
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|s:wxGetUserHome",_kwnames,&_arg0)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|O:wxGetUserHome",_kwnames,&_obj0)) 
+        return NULL;
+    if (_obj0)
+{
+    _arg0 = wxString_in_helper(_obj0);
+    if (_arg0 == NULL)
         return NULL;
         return NULL;
+}
 {
     PyThreadState* __tstate = wxPyBeginAllowThreads();
 {
     PyThreadState* __tstate = wxPyBeginAllowThreads();
-    _result = new wxString (wxGetUserHome(_arg0));
+    _result = new wxString (wxGetUserHome(*_arg0));
 
     wxPyEndAllowThreads(__tstate);
     if (PyErr_Occurred()) return NULL;
 
     wxPyEndAllowThreads(__tstate);
     if (PyErr_Occurred()) return NULL;
@@ -884,6 +894,10 @@ static PyObject *_wrap_wxGetUserHome(PyObject *self, PyObject *args, PyObject *k
     _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
 #endif
 }
     _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
 #endif
 }
+{
+    if (_obj0)
+        delete _arg0;
+}
 {
     delete _result;
 }
 {
     delete _result;
 }
@@ -1369,9 +1383,11 @@ static PyObject *_wrap_wxSize_SetHeight(PyObject *self, PyObject *args, PyObject
 }
 
 static PyObject * wxSize_asTuple(wxSize *self) {
 }
 
 static PyObject * wxSize_asTuple(wxSize *self) {
+            wxPyBeginBlockThreads();
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
+            wxPyEndBlockThreads();
             return tup;
         }
 static PyObject *_wrap_wxSize_asTuple(PyObject *self, PyObject *args, PyObject *kwargs) {
             return tup;
         }
 static PyObject *_wrap_wxSize_asTuple(PyObject *self, PyObject *args, PyObject *kwargs) {
@@ -1639,9 +1655,11 @@ static PyObject *_wrap_wxRealPoint_Set(PyObject *self, PyObject *args, PyObject
 }
 
 static PyObject * wxRealPoint_asTuple(wxRealPoint *self) {
 }
 
 static PyObject * wxRealPoint_asTuple(wxRealPoint *self) {
+            wxPyBeginBlockThreads();
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x));
             PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y));
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x));
             PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y));
+            wxPyEndBlockThreads();
             return tup;
         }
 static PyObject *_wrap_wxRealPoint_asTuple(PyObject *self, PyObject *args, PyObject *kwargs) {
             return tup;
         }
 static PyObject *_wrap_wxRealPoint_asTuple(PyObject *self, PyObject *args, PyObject *kwargs) {
@@ -1989,9 +2007,11 @@ static PyObject *_wrap_wxPoint_Set(PyObject *self, PyObject *args, PyObject *kwa
 }
 
 static PyObject * wxPoint_asTuple(wxPoint *self) {
 }
 
 static PyObject * wxPoint_asTuple(wxPoint *self) {
+            wxPyBeginBlockThreads();
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
+            wxPyEndBlockThreads();
             return tup;
         }
 static PyObject *_wrap_wxPoint_asTuple(PyObject *self, PyObject *args, PyObject *kwargs) {
             return tup;
         }
 static PyObject *_wrap_wxPoint_asTuple(PyObject *self, PyObject *args, PyObject *kwargs) {
@@ -2975,11 +2995,13 @@ static PyObject *_wrap_wxRect_height_get(PyObject *self, PyObject *args, PyObjec
 }
 
 static PyObject * wxRect_asTuple(wxRect *self) {
 }
 
 static PyObject * wxRect_asTuple(wxRect *self) {
+            wxPyBeginBlockThreads();
             PyObject* tup = PyTuple_New(4);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
             PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(self->width));
             PyTuple_SET_ITEM(tup, 3, PyInt_FromLong(self->height));
             PyObject* tup = PyTuple_New(4);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
             PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(self->width));
             PyTuple_SET_ITEM(tup, 3, PyInt_FromLong(self->height));
+            wxPyEndBlockThreads();
             return tup;
         }
 static PyObject *_wrap_wxRect_asTuple(PyObject *self, PyObject *args, PyObject *kwargs) {
             return tup;
         }
 static PyObject *_wrap_wxRect_asTuple(PyObject *self, PyObject *args, PyObject *kwargs) {