]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/reparent.cpp
TRUE not true, FALSE not false
[wxWidgets.git] / src / x11 / reparent.cpp
index 2a57d3d339559408073982df3c729decfaea67e1..50eb66f5607055be6829561213d7fee204ae9bfa 100644 (file)
     #pragma implementation "reparent.h"
 #endif
 
+#include "wx/setup.h"
+
+#if !wxUSE_NANOX
+
 #include "wx/x11/reparent.h"
 #include "wx/evtloop.h"
 #include "wx/log.h"
@@ -91,7 +95,7 @@ wxAdoptedWindow::wxAdoptedWindow()
 
 wxAdoptedWindow::wxAdoptedWindow(WXWindow window)
 {
-    m_mainWidget = window;
+    m_mainWindow = window;
 }
 
 wxAdoptedWindow::~wxAdoptedWindow()
@@ -128,15 +132,15 @@ bool wxReparenter::Reparent(wxWindow* newParent, wxAdoptedWindow* toReparent)
     int parentOffset = 0;
 
     old = XSetErrorHandler(ErrorHandler);
-    XReparentWindow((Display*) newParent->GetXDisplay(),
-                    (Window) toReparent->GetXWindow(),
-                    (Window) newParent->GetXWindow(),
-                    0, 0);
-
-    if (!XQueryTree((Display*) newParent->GetXDisplay(),
-                    (Window) toReparent->GetXWindow(),
-                    &returnroot, &returnparent,
-                    &children, &numchildren) || Xerror)
+    XReparentWindow( wxGlobalDisplay(),
+                     (Window) toReparent->GetMainWindow(),
+                     (Window) newParent->GetMainWindow(),
+                     0, 0);
+
+    if (!XQueryTree( wxGlobalDisplay(),
+                     (Window) toReparent->GetMainWindow(),
+                     &returnroot, &returnparent,
+                     &children, &numchildren) || Xerror)
     {
         XSetErrorHandler(old);
         return TRUE;
@@ -157,14 +161,14 @@ bool wxReparenter::Reparent(wxWindow* newParent, wxAdoptedWindow* toReparent)
          */
         for (each=0; each<numchildren; each++)
         {
-            XGetWindowAttributes((Display*) newParent->GetXDisplay(),
-                                 children[each], &xwa);
+            XGetWindowAttributes( wxGlobalDisplay(),
+                                  children[each], &xwa);
             fprintf(stderr,
               "Reparenting child at offset %d and position %d, %d.\n",
                parentOffset, parentOffset+xwa.x, parentOffset+xwa.y);
-            XReparentWindow((Display*) newParent->GetXDisplay(),
-                            children[each], (Window) newParent->GetXWindow(),
-              xwa.x, xwa.y);
+            XReparentWindow( wxGlobalDisplay(),
+                             children[each], (Window) newParent->GetMainWindow(),
+                             xwa.x, xwa.y);
         }
     }
 
@@ -184,7 +188,7 @@ bool wxReparenter::WaitAndReparent(wxWindow* newParent, wxAdoptedWindow* toRepar
     sm_exactMatch = exactMatch;
     sm_name = windowName;
     
-    Display* display = (Display*) newParent->GetXDisplay() ;
+    Display* display = wxGlobalDisplay();
     XSelectInput(display,
         RootWindowOfScreen(DefaultScreenOfDisplay(display)),
         SubstructureNotifyMask);
@@ -292,13 +296,13 @@ WXWindow wxReparenter::FindAClientWindow(WXWindow window, const wxString& name)
       XFetchName((Display*) wxGetDisplay(), (Window) window, &clientName);
 
       wxString str1(name);
-      wxString str2(clientName);
+      wxString str2 = wxString::FromAscii(clientName);
       str1.Lower();
       str2.Lower();
 
       bool matches;
       if (sm_exactMatch)
-          matches = (name == clientName);
+          matches = (name == wxString::FromAscii(clientName));
       else
           matches = (str1.Contains(str2) || str2.Contains(str1));
       
@@ -312,7 +316,8 @@ WXWindow wxReparenter::FindAClientWindow(WXWindow window, const wxString& name)
 
   old = XSetErrorHandler(ErrorHandler);
   if (!XQueryTree((Display*) wxGetDisplay(), (Window) window, &returnroot, &returnparent,
-    &children, &numchildren) || Xerror) {
+    &children, &numchildren) || Xerror)
+  {
     XSetErrorHandler(old);
     return NULL;
   }
@@ -327,3 +332,4 @@ WXWindow wxReparenter::FindAClientWindow(WXWindow window, const wxString& name)
   } return (WXWindow) result;
 }
 
+#endif