]> git.saurik.com Git - wxWidgets.git/blobdiff - src/x11/reparent.cpp
Fit the generic preferences editor dialog to its pages size initially.
[wxWidgets.git] / src / x11 / reparent.cpp
index be8dbe53248007d6c50fd0ce7210282a66ec0118..ff976cd946f0d79abe936bf9854a6e9fec89e5a5 100644 (file)
 
 #ifndef WX_PRECOMP
     #include "wx/log.h"
+    #include "wx/app.h"
+    #include "wx/timer.h"
 #endif
 
 #include "wx/evtloop.h"
-#include "wx/app.h"
-#include "wx/timer.h"
 
 #include "wx/x11/private.h"
 #include "X11/Xatom.h"
 
+#include "wx/generic/private/timer.h"
+
 /*
  * wxAdoptedWindow
  */
@@ -62,13 +64,13 @@ wxAdoptedWindow::~wxAdoptedWindow()
 
 static bool Xerror;
 static Atom WM_STATE = 0;
-bool wxReparenter::sm_done = FALSE;
+bool wxReparenter::sm_done = false;
 wxAdoptedWindow* wxReparenter::sm_toReparent = NULL;
 wxWindow* wxReparenter::sm_newParent = NULL;
 wxString wxReparenter::sm_name;
-bool wxReparenter::sm_exactMatch = FALSE;
+bool wxReparenter::sm_exactMatch = false;
 
-static int ErrorHandler(Display* dpy, XErrorEvent* event)
+static int ErrorHandler(Display* WXUNUSED(dpy), XErrorEvent* WXUNUSED(event))
 {
     Xerror = True;
     return False;
@@ -87,12 +89,12 @@ bool wxReparenter::Reparent(wxWindow* newParent, wxAdoptedWindow* toReparent)
 
     old = XSetErrorHandler(ErrorHandler);
     XReparentWindow( wxGlobalDisplay(),
-                     (Window) toReparent->GetMainWindow(),
-                     (Window) newParent->GetMainWindow(),
+                     (Window) toReparent->X11GetMainWindow(),
+                     (Window) newParent->X11GetMainWindow(),
                      0, 0);
 
     if (!XQueryTree( wxGlobalDisplay(),
-                     (Window) toReparent->GetMainWindow(),
+                     (Window) toReparent->X11GetMainWindow(),
                      &returnroot, &returnparent,
                      &children, &numchildren) || Xerror)
     {
@@ -121,7 +123,7 @@ bool wxReparenter::Reparent(wxWindow* newParent, wxAdoptedWindow* toReparent)
               "Reparenting child at offset %d and position %d, %d.\n",
                parentOffset, parentOffset+xwa.x, parentOffset+xwa.y);
             XReparentWindow( wxGlobalDisplay(),
-                             children[each], (Window) newParent->GetMainWindow(),
+                             children[each], (Window) newParent->X11GetMainWindow(),
                              xwa.x, xwa.y);
         }
     }
@@ -131,7 +133,7 @@ bool wxReparenter::Reparent(wxWindow* newParent, wxAdoptedWindow* toReparent)
 }
 
 // Wait for an appropriate window to be created.
-// If exactMatch is FALSE, a substring match is OK.
+// If exactMatch is false, a substring match is OK.
 // If windowName is empty, then wait for the next overrideRedirect window.
 bool wxReparenter::WaitAndReparent(wxWindow* newParent, wxAdoptedWindow* toReparent,
                                    const wxString& windowName,
@@ -150,12 +152,7 @@ bool wxReparenter::WaitAndReparent(wxWindow* newParent, wxAdoptedWindow* toRepar
     if (!WM_STATE)
         WM_STATE = XInternAtom(display, "WM_STATE", False);
 
-#ifdef __WXDEBUG__
-    if (!windowName.empty())
-        wxLogDebug(_T("Waiting for window %s"), windowName.c_str());
-#endif
-
-    sm_done = FALSE;
+    sm_done = false;
 
     wxEventLoop eventLoop;
     while (!sm_done)
@@ -173,7 +170,7 @@ bool wxReparenter::WaitAndReparent(wxWindow* newParent, wxAdoptedWindow* toRepar
         else
         {
 #if wxUSE_TIMER
-            wxTimer::NotifyTimers();
+            wxGenericTimerImpl::NotifyTimers();
             wxTheApp->ProcessIdle();
 #endif
         }
@@ -190,13 +187,13 @@ bool wxReparenter::ProcessXEvent(WXEvent* event)
     {
         if (xevent->type == MapNotify)
         {
-            wxLogDebug(_T("Window was mapped"));
+            wxLogDebug(wxT("Window was mapped"));
         }
 
         if (xevent->type == MapNotify && !xevent->xmap.override_redirect &&
             (client = (Window) FindAClientWindow((WXWindow) xevent->xmap.window, sm_name)))
         {
-            wxLogDebug(_T("Found a client window, about to reparent"));
+            wxLogDebug(wxT("Found a client window, about to reparent"));
             wxASSERT(sm_toReparent->GetParent() == NULL);
 
             sm_toReparent->SetHandle((WXWindow) client);
@@ -207,7 +204,7 @@ bool wxReparenter::ProcessXEvent(WXEvent* event)
                    xevent->xmap.override_redirect &&
                    xevent->xmap.window)
         {
-            wxLogDebug(_T("Found an override redirect window, about to reparent"));
+            wxLogDebug(wxT("Found an override redirect window, about to reparent"));
             sm_toReparent->SetHandle((WXWindow) xevent->xmap.window);
             sm_newParent->AddChild(sm_toReparent);
             wxASSERT(sm_toReparent->GetParent() == NULL);
@@ -216,7 +213,7 @@ bool wxReparenter::ProcessXEvent(WXEvent* event)
             return sm_done;
         }
     }
-    return FALSE;
+    return false;
 }
 
 WXWindow wxReparenter::FindAClientWindow(WXWindow window, const wxString& name)