// (2) The widget with the focus may not be in the widget table
     // depending on which widgets I put in the table
     wxWindow *winFocus = (wxWindow *)NULL;
-    for ( wxWindowList::Node *node = wxTopLevelWindows.GetFirst();
+    for ( wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
           node;
           node = node->GetNext() )
     {
     wxBrush brush(GetBackgroundColour(), wxSOLID);
     dc.SetBrush(brush); // FIXME: needed?
 
-    wxWindowList::Node *cnode = m_children.GetFirst();
+    wxWindowList::compatibility_iterator cnode = m_children.GetFirst();
     while (cnode)
     {
         wxWindow *child = cnode->GetData();
 
     // Now send expose events
 
-    wxList::Node* node = updateRects.GetFirst();
+    wxList::compatibility_iterator  node = updateRects.GetFirst();
     while (node)
     {
         wxRect* rect = (wxRect*) node->GetData();
 // Responds to colour changes: passes event on to children.
 void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event)
 {
-    wxWindowList::Node *node = GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
     while ( node )
     {
         // Only propagate to non-top-level windows
 // Motif-specific accessors
 // ----------------------------------------------------------------------------
 
+WXWindow wxWindow::GetClientXWindow() const
+{
+    Widget wMain = (Widget)GetClientWidget();
+    if ( wMain )
+        return (WXWindow) XtWindow(wMain);
+    else
+        return (WXWindow) 0;
+}
+
 // Get the underlying X window
 WXWindow wxWindow::GetXWindow() const
 {
 
 /////////////////////////////////////////////////////////////////////////////
 // Name:        glcanvas.cpp
-// Purpose:     wxGLCanvas, for using OpenGL with wxWindows 2.0 for Motif.
+// Purpose:     wxGLCanvas, for using OpenGL with wxWindows
 //              Uses the GLX extension.
 // Author:      Julian Smart and Wolfram Gloger
 // Modified by:
 
 #if wxUSE_GLCANVAS
 
-// #error Sorry, wxGLCanvas does not work yet with wxX11
-
 #include "wx/glcanvas.h"
 #include "wx/utils.h"
 #include "wx/app.h"
 #ifdef __VMS
 # pragma message disable nosimpint
 #endif
-#include <Xm/Xm.h>
+#include <X11/Xlib.h>
 #ifdef __VMS
 # pragma message enable nosimpint
 #endif
-#include "wx/motif/private.h"
+#include "wx/x11/private.h"
+
+static inline WXWindow wxGetClientAreaWindow(wxWindow* win)
+{
+#ifdef __WXMOTIF__
+    return win->GetClientXWindow();
+#else
+    return win->GetClientAreaWindow();
+#endif
+}
 
 #ifdef OLD_MESA
 // workaround for bug in Mesa's glx.c
     if (m_glContext)
     {
         Display* display = (Display*) wxGetDisplay();
-        glXSwapBuffers(display, (Window) m_window->GetClientAreaWindow());
+        glXSwapBuffers(display, (Window) wxGetClientAreaWindow(m_window));
     }
 }
 
     if (m_glContext) 
     { 
         Display* display = (Display*) wxGetDisplay();
-        glXMakeCurrent(display, (Window) m_window->GetClientAreaWindow(), 
+        glXMakeCurrent(display, (Window) wxGetClientAreaWindow(m_window), 
                        m_glContext );;
     }
 }
                       the_colour->Green(),
                       the_colour->Blue());
        } else {
+#ifdef __WXMOTIF__
+            the_colour->AllocColour(m_window->GetXDisplay());
+#else
             the_colour->CalcPixel(wxTheApp->GetMainColormap(wxGetDisplay()));
+#endif
            GLint pix = (GLint)the_colour->GetPixel();
            if(pix == -1)
             {
     } else {
        // By default, we use the visual of xwindow
         // NI: is this really senseful ? opengl in e.g. color index mode ?
-       XGetWindowAttributes(display, (Window) GetClientAreaWindow(), &xwa);
+       XGetWindowAttributes(display, (Window)wxGetClientAreaWindow(this), &xwa);
        vi_templ.visualid = XVisualIDFromVisual(xwa.visual);
        vi = XGetVisualInfo(display, VisualIDMask, &vi_templ, &n);
        if(!vi) return FALSE;