]> git.saurik.com Git - wxWidgets.git/commitdiff
Tried to make wxGLCanvas work again. WIP.
authorRobert Roebling <robert@roebling.de>
Mon, 11 Oct 1999 15:24:49 +0000 (15:24 +0000)
committerRobert Roebling <robert@roebling.de>
Mon, 11 Oct 1999 15:24:49 +0000 (15:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3929 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/win_gtk.h
include/wx/gtk/window.h
include/wx/gtk1/win_gtk.h
include/wx/gtk1/window.h
src/gtk/win_gtk.c
src/gtk/window.cpp
src/gtk1/win_gtk.c
src/gtk1/window.cpp
utils/glcanvas/gtk/glcanvas.cpp
utils/glcanvas/gtk/glcanvas.h
utils/glcanvas/samples/penguin/penguin.cpp

index 968d1d105182609d7141da78ac468e916e89f5a9..f12bc34655658bf7193e91b9846474b4257b45be 100644 (file)
@@ -55,6 +55,8 @@ struct _GtkMyFixed
   gulong configure_serial;
   gint scroll_x;
   gint scroll_y;
   gulong configure_serial;
   gint scroll_x;
   gint scroll_y;
+  
+  gboolean clear_on_draw;
 };
 
 struct _GtkMyFixedClass
 };
 
 struct _GtkMyFixedClass
@@ -68,9 +70,13 @@ struct _GtkMyFixedClass
 
 guint      gtk_myfixed_get_type        (void);
 GtkWidget* gtk_myfixed_new             (void);
 
 guint      gtk_myfixed_get_type        (void);
 GtkWidget* gtk_myfixed_new             (void);
+
 void       gtk_myfixed_set_shadow_type (GtkMyFixed     *myfixed,
                                        GtkMyShadowType  type);
                                        
 void       gtk_myfixed_set_shadow_type (GtkMyFixed     *myfixed,
                                        GtkMyShadowType  type);
                                        
+void       gtk_my_fixed_set_clear      (GtkMyFixed     *myfixed,
+                                        gboolean        clear);                
+                                       
 void       gtk_myfixed_scroll                  (GtkMyFixed     *myfixed,       
                                          gint         dx,
                                          gint         dy);
 void       gtk_myfixed_scroll                  (GtkMyFixed     *myfixed,       
                                          gint         dx,
                                          gint         dy);
index ae02499808c9e5562de9209db1b47a4e52bd0c2d..9f255ab617575442859f59acedcf40fadacc9379 100644 (file)
@@ -172,14 +172,9 @@ public:
     float                m_oldHorizontalPos;
     float                m_oldVerticalPos;
 
     float                m_oldHorizontalPos;
     float                m_oldVerticalPos;
 
-    // we need an extra XGC flag set to get exposed
-    // events from overlapping children upon moving
-    // them. this flag will be set in this GC and
-    // the GC will be used in wxWindow::ScrollWindow().
-    GdkGC               *m_scrollGC;
-
     // extra (wxGTK-specific) flags
     bool                 m_needParent:1;    /* ! wxFrame, wxDialog, wxNotebookPage ?  */
     // extra (wxGTK-specific) flags
     bool                 m_needParent:1;    /* ! wxFrame, wxDialog, wxNotebookPage ?  */
+    bool                 m_noExpose:1;      /* wxGLCanvas has its own redrawing */
     bool                 m_hasScrolling:1;
     bool                 m_isScrolling:1;
     bool                 m_hasVMT:1;
     bool                 m_hasScrolling:1;
     bool                 m_isScrolling:1;
     bool                 m_hasVMT:1;
@@ -188,7 +183,7 @@ public:
     bool                 m_isStaticBox:1;   /* faster than IS_KIND_OF */
     bool                 m_isRadioButton:1; /* faster than IS_KIND_OF */
     bool                 m_isFrame:1;       /* faster than IS_KIND_OF */
     bool                 m_isStaticBox:1;   /* faster than IS_KIND_OF */
     bool                 m_isRadioButton:1; /* faster than IS_KIND_OF */
     bool                 m_isFrame:1;       /* faster than IS_KIND_OF */
-    bool                 m_acceptsFocus:1;  /* ! wxStaticBox etc.  */
+    bool                 m_acceptsFocus:1;  /* not wxStaticBox, not wxStaticBitmap etc.  */
 
     // these are true if the style were set before the widget was realized
     // (typcally in the constructor) but the actual GTK style must not be set
 
     // these are true if the style were set before the widget was realized
     // (typcally in the constructor) but the actual GTK style must not be set
index 968d1d105182609d7141da78ac468e916e89f5a9..f12bc34655658bf7193e91b9846474b4257b45be 100644 (file)
@@ -55,6 +55,8 @@ struct _GtkMyFixed
   gulong configure_serial;
   gint scroll_x;
   gint scroll_y;
   gulong configure_serial;
   gint scroll_x;
   gint scroll_y;
+  
+  gboolean clear_on_draw;
 };
 
 struct _GtkMyFixedClass
 };
 
 struct _GtkMyFixedClass
@@ -68,9 +70,13 @@ struct _GtkMyFixedClass
 
 guint      gtk_myfixed_get_type        (void);
 GtkWidget* gtk_myfixed_new             (void);
 
 guint      gtk_myfixed_get_type        (void);
 GtkWidget* gtk_myfixed_new             (void);
+
 void       gtk_myfixed_set_shadow_type (GtkMyFixed     *myfixed,
                                        GtkMyShadowType  type);
                                        
 void       gtk_myfixed_set_shadow_type (GtkMyFixed     *myfixed,
                                        GtkMyShadowType  type);
                                        
+void       gtk_my_fixed_set_clear      (GtkMyFixed     *myfixed,
+                                        gboolean        clear);                
+                                       
 void       gtk_myfixed_scroll                  (GtkMyFixed     *myfixed,       
                                          gint         dx,
                                          gint         dy);
 void       gtk_myfixed_scroll                  (GtkMyFixed     *myfixed,       
                                          gint         dx,
                                          gint         dy);
index ae02499808c9e5562de9209db1b47a4e52bd0c2d..9f255ab617575442859f59acedcf40fadacc9379 100644 (file)
@@ -172,14 +172,9 @@ public:
     float                m_oldHorizontalPos;
     float                m_oldVerticalPos;
 
     float                m_oldHorizontalPos;
     float                m_oldVerticalPos;
 
-    // we need an extra XGC flag set to get exposed
-    // events from overlapping children upon moving
-    // them. this flag will be set in this GC and
-    // the GC will be used in wxWindow::ScrollWindow().
-    GdkGC               *m_scrollGC;
-
     // extra (wxGTK-specific) flags
     bool                 m_needParent:1;    /* ! wxFrame, wxDialog, wxNotebookPage ?  */
     // extra (wxGTK-specific) flags
     bool                 m_needParent:1;    /* ! wxFrame, wxDialog, wxNotebookPage ?  */
+    bool                 m_noExpose:1;      /* wxGLCanvas has its own redrawing */
     bool                 m_hasScrolling:1;
     bool                 m_isScrolling:1;
     bool                 m_hasVMT:1;
     bool                 m_hasScrolling:1;
     bool                 m_isScrolling:1;
     bool                 m_hasVMT:1;
@@ -188,7 +183,7 @@ public:
     bool                 m_isStaticBox:1;   /* faster than IS_KIND_OF */
     bool                 m_isRadioButton:1; /* faster than IS_KIND_OF */
     bool                 m_isFrame:1;       /* faster than IS_KIND_OF */
     bool                 m_isStaticBox:1;   /* faster than IS_KIND_OF */
     bool                 m_isRadioButton:1; /* faster than IS_KIND_OF */
     bool                 m_isFrame:1;       /* faster than IS_KIND_OF */
-    bool                 m_acceptsFocus:1;  /* ! wxStaticBox etc.  */
+    bool                 m_acceptsFocus:1;  /* not wxStaticBox, not wxStaticBitmap etc.  */
 
     // these are true if the style were set before the widget was realized
     // (typcally in the constructor) but the actual GTK style must not be set
 
     // these are true if the style were set before the widget was realized
     // (typcally in the constructor) but the actual GTK style must not be set
index 10f8d2ca2840926e9a44f4b9f309b457799574b3..18606b962e31048892612694e8b750d82bc45ccf 100644 (file)
@@ -187,6 +187,8 @@ gtk_myfixed_init (GtkMyFixed *myfixed)
     myfixed->scroll_x = 0;
     myfixed->scroll_y = 0;
     myfixed->visibility = GDK_VISIBILITY_PARTIAL;
     myfixed->scroll_x = 0;
     myfixed->scroll_y = 0;
     myfixed->visibility = GDK_VISIBILITY_PARTIAL;
+    
+    myfixed->clear_on_draw = TRUE;
 }
 
 GtkWidget*
 }
 
 GtkWidget*
@@ -226,6 +228,16 @@ gtk_myfixed_set_shadow_type (GtkMyFixed      *myfixed,
     }
 }
 
     }
 }
 
+void       
+gtk_my_fixed_set_clear (GtkMyFixed     *myfixed,
+                        gboolean        clear)
+{
+    g_return_if_fail (myfixed != NULL);
+    g_return_if_fail (GTK_IS_MYFIXED (myfixed));
+    
+    myfixed->clear_on_draw = clear;
+}      
+                                       
 void
 gtk_myfixed_put (GtkMyFixed    *myfixed,
                  GtkWidget     *widget,
 void
 gtk_myfixed_put (GtkMyFixed    *myfixed,
                  GtkWidget     *widget,
@@ -637,7 +649,8 @@ gtk_myfixed_draw (GtkWidget    *widget,
     myfixed = GTK_MYFIXED (widget);
       
     children = myfixed->children;
     myfixed = GTK_MYFIXED (widget);
       
     children = myfixed->children;
-    if ( !(GTK_WIDGET_APP_PAINTABLE (widget)) )
+    if ( !(GTK_WIDGET_APP_PAINTABLE (widget)) &&
+         (myfixed->clear_on_draw))
     {
         gdk_window_clear_area( myfixed->bin_window,
                                area->x, area->y, area->width, area->height);
     {
         gdk_window_clear_area( myfixed->bin_window,
                                area->x, area->y, area->width, area->height);
index fb798b8e5c500dd8729b8795bb1d02b9cce0ecc6..7e235b0c06335305cd875a287ecbb6cc38bbbe66 100644 (file)
@@ -303,7 +303,7 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
 }
 
 //-----------------------------------------------------------------------------
 }
 
 //-----------------------------------------------------------------------------
-// "draw" of m_wxwindow
+// "draw" of m_widget
 //-----------------------------------------------------------------------------
 
 static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
 //-----------------------------------------------------------------------------
 
 static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
@@ -1766,6 +1766,8 @@ void wxWindow::Init()
     m_hasVMT = FALSE;
     m_needParent = TRUE;
     m_isBeingDeleted = FALSE;
     m_hasVMT = FALSE;
     m_needParent = TRUE;
     m_isBeingDeleted = FALSE;
+    
+    m_noExpose = FALSE;
 
     m_hasScrolling = FALSE;
     m_isScrolling = FALSE;
 
     m_hasScrolling = FALSE;
     m_isScrolling = FALSE;
@@ -1776,7 +1778,6 @@ void wxWindow::Init()
     m_oldVerticalPos = 0.0;
 
     m_resizing = FALSE;
     m_oldVerticalPos = 0.0;
 
     m_resizing = FALSE;
-    m_scrollGC = (GdkGC*) NULL;
     m_widgetStyle = (GtkStyle*) NULL;
 
     m_insertCallback = (wxInsertChildFunction) NULL;
     m_widgetStyle = (GtkStyle*) NULL;
 
     m_insertCallback = (wxInsertChildFunction) NULL;
@@ -1977,12 +1978,6 @@ wxWindow::~wxWindow()
         m_widgetStyle = (GtkStyle*) NULL;
     }
 
         m_widgetStyle = (GtkStyle*) NULL;
     }
 
-    if (m_scrollGC)
-    {
-        gdk_gc_unref( m_scrollGC );
-        m_scrollGC = (GdkGC*) NULL;
-    }
-
     if (m_wxwindow)
     {
         gtk_widget_destroy( m_wxwindow );
     if (m_wxwindow)
     {
         gtk_widget_destroy( m_wxwindow );
@@ -2034,12 +2029,15 @@ void wxWindow::PostCreation()
 
     if (m_wxwindow)
     {
 
     if (m_wxwindow)
     {
-        /* these get reported to wxWindows -> wxPaintEvent */
-        gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
-          GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this );
+        if (!m_noExpose)
+       {
+            /* these get reported to wxWindows -> wxPaintEvent */
+            gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
+                GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this );
 
 
-       gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
-          GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
+            gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
+                GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
+       }
          
 #if (GTK_MINOR_VERSION > 0)
         /* these are called when the "sunken" or "raised" borders are drawn */
          
 #if (GTK_MINOR_VERSION > 0)
         /* these are called when the "sunken" or "raised" borders are drawn */
index 10f8d2ca2840926e9a44f4b9f309b457799574b3..18606b962e31048892612694e8b750d82bc45ccf 100644 (file)
@@ -187,6 +187,8 @@ gtk_myfixed_init (GtkMyFixed *myfixed)
     myfixed->scroll_x = 0;
     myfixed->scroll_y = 0;
     myfixed->visibility = GDK_VISIBILITY_PARTIAL;
     myfixed->scroll_x = 0;
     myfixed->scroll_y = 0;
     myfixed->visibility = GDK_VISIBILITY_PARTIAL;
+    
+    myfixed->clear_on_draw = TRUE;
 }
 
 GtkWidget*
 }
 
 GtkWidget*
@@ -226,6 +228,16 @@ gtk_myfixed_set_shadow_type (GtkMyFixed      *myfixed,
     }
 }
 
     }
 }
 
+void       
+gtk_my_fixed_set_clear (GtkMyFixed     *myfixed,
+                        gboolean        clear)
+{
+    g_return_if_fail (myfixed != NULL);
+    g_return_if_fail (GTK_IS_MYFIXED (myfixed));
+    
+    myfixed->clear_on_draw = clear;
+}      
+                                       
 void
 gtk_myfixed_put (GtkMyFixed    *myfixed,
                  GtkWidget     *widget,
 void
 gtk_myfixed_put (GtkMyFixed    *myfixed,
                  GtkWidget     *widget,
@@ -637,7 +649,8 @@ gtk_myfixed_draw (GtkWidget    *widget,
     myfixed = GTK_MYFIXED (widget);
       
     children = myfixed->children;
     myfixed = GTK_MYFIXED (widget);
       
     children = myfixed->children;
-    if ( !(GTK_WIDGET_APP_PAINTABLE (widget)) )
+    if ( !(GTK_WIDGET_APP_PAINTABLE (widget)) &&
+         (myfixed->clear_on_draw))
     {
         gdk_window_clear_area( myfixed->bin_window,
                                area->x, area->y, area->width, area->height);
     {
         gdk_window_clear_area( myfixed->bin_window,
                                area->x, area->y, area->width, area->height);
index fb798b8e5c500dd8729b8795bb1d02b9cce0ecc6..7e235b0c06335305cd875a287ecbb6cc38bbbe66 100644 (file)
@@ -303,7 +303,7 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
 }
 
 //-----------------------------------------------------------------------------
 }
 
 //-----------------------------------------------------------------------------
-// "draw" of m_wxwindow
+// "draw" of m_widget
 //-----------------------------------------------------------------------------
 
 static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
 //-----------------------------------------------------------------------------
 
 static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
@@ -1766,6 +1766,8 @@ void wxWindow::Init()
     m_hasVMT = FALSE;
     m_needParent = TRUE;
     m_isBeingDeleted = FALSE;
     m_hasVMT = FALSE;
     m_needParent = TRUE;
     m_isBeingDeleted = FALSE;
+    
+    m_noExpose = FALSE;
 
     m_hasScrolling = FALSE;
     m_isScrolling = FALSE;
 
     m_hasScrolling = FALSE;
     m_isScrolling = FALSE;
@@ -1776,7 +1778,6 @@ void wxWindow::Init()
     m_oldVerticalPos = 0.0;
 
     m_resizing = FALSE;
     m_oldVerticalPos = 0.0;
 
     m_resizing = FALSE;
-    m_scrollGC = (GdkGC*) NULL;
     m_widgetStyle = (GtkStyle*) NULL;
 
     m_insertCallback = (wxInsertChildFunction) NULL;
     m_widgetStyle = (GtkStyle*) NULL;
 
     m_insertCallback = (wxInsertChildFunction) NULL;
@@ -1977,12 +1978,6 @@ wxWindow::~wxWindow()
         m_widgetStyle = (GtkStyle*) NULL;
     }
 
         m_widgetStyle = (GtkStyle*) NULL;
     }
 
-    if (m_scrollGC)
-    {
-        gdk_gc_unref( m_scrollGC );
-        m_scrollGC = (GdkGC*) NULL;
-    }
-
     if (m_wxwindow)
     {
         gtk_widget_destroy( m_wxwindow );
     if (m_wxwindow)
     {
         gtk_widget_destroy( m_wxwindow );
@@ -2034,12 +2029,15 @@ void wxWindow::PostCreation()
 
     if (m_wxwindow)
     {
 
     if (m_wxwindow)
     {
-        /* these get reported to wxWindows -> wxPaintEvent */
-        gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
-          GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this );
+        if (!m_noExpose)
+       {
+            /* these get reported to wxWindows -> wxPaintEvent */
+            gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
+                GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this );
 
 
-       gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
-          GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
+            gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
+                GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
+       }
          
 #if (GTK_MINOR_VERSION > 0)
         /* these are called when the "sunken" or "raised" borders are drawn */
          
 #if (GTK_MINOR_VERSION > 0)
         /* these are called when the "sunken" or "raised" borders are drawn */
index 2095f0fbc2a59833272b1d60a8fe703d30b66bf4..9ee7d285436759ed1ec993f362e977c21e4dc0cc 100644 (file)
@@ -88,7 +88,8 @@ void wxGLContext::SwapBuffers()
 {
     if (m_glContext)
     {
 {
     if (m_glContext)
     {
-        glXSwapBuffers( GDK_DISPLAY(), GDK_WINDOW_XWINDOW( m_widget->window ) );
+        GdkWindow *window = GTK_MYFIXED(m_widget)->bin_window;
+        glXSwapBuffers( GDK_DISPLAY(), GDK_WINDOW_XWINDOW( window ) );
     }
 }
 
     }
 }
 
@@ -96,7 +97,8 @@ void wxGLContext::SetCurrent()
 {
     if (m_glContext) 
     { 
 {
     if (m_glContext) 
     { 
-        glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(m_widget->window), m_glContext );
+        GdkWindow *window = GTK_MYFIXED(m_widget)->bin_window;
+        glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(window), m_glContext );
     }
 }
 
     }
 }
 
@@ -135,7 +137,7 @@ wxPalette wxGLContext::CreateDefaultPalette()
 static gint
 gtk_glwindow_realized_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win )
 {
 static gint
 gtk_glwindow_realized_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win )
 {
-    win->m_glContext = new wxGLContext( TRUE, win, wxNullPalette, win->m_glContext );
+    win->m_glContext = new wxGLContext( TRUE, win, wxNullPalette, win->m_sharedContext );
 
     XFree( g_vi );
     g_vi = (XVisualInfo*) NULL;
 
     XFree( g_vi );
     g_vi = (XVisualInfo*) NULL;
@@ -143,6 +145,34 @@ gtk_glwindow_realized_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win )
     return FALSE;
 }
 
     return FALSE;
 }
 
+//-----------------------------------------------------------------------------
+// "expose_event" of m_wxwindow
+//-----------------------------------------------------------------------------
+
+static void 
+gtk_glwindow_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxGLCanvas *win )
+{
+    win->m_exposed = TRUE;
+
+    win->GetUpdateRegion().Union( gdk_event->area.x,
+                                  gdk_event->area.y,
+                                  gdk_event->area.width,
+                                  gdk_event->area.height );
+}
+
+//-----------------------------------------------------------------------------
+// "draw" of m_wxwindow
+//-----------------------------------------------------------------------------
+
+static void 
+gtk_glwindow_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxGLCanvas *win )
+{
+    win->m_exposed = TRUE;
+
+    win->GetUpdateRegion().Union( rect->x, rect->y,
+                                  rect->width, rect->height );
+}
+
 //---------------------------------------------------------------------------
 // wxGlCanvas
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 // wxGlCanvas
 //---------------------------------------------------------------------------
@@ -181,7 +211,10 @@ bool wxGLCanvas::Create( wxWindow *parent,
                          int *attribList, 
                         const wxPalette& palette)
 {
                          int *attribList, 
                         const wxPalette& palette)
 {
-    m_glContext = (wxGLContext*)shared;  // const_cast
+    m_sharedContext = (wxGLContext*)shared;  // const_cast
+    
+    m_exposed = FALSE;
+    m_noExpose = TRUE;
     
     if (!attribList)
     {
     
     if (!attribList)
     {
@@ -239,8 +272,17 @@ bool wxGLCanvas::Create( wxWindow *parent,
 
     m_glWidget = m_wxwindow;
     
 
     m_glWidget = m_wxwindow;
     
-    gtk_signal_connect( GTK_OBJECT(m_glWidget), "realize",
+    gtk_my_fixed_set_clear( GTK_MYFIXED(m_wxwindow), FALSE );
+    
+    gtk_signal_connect( GTK_OBJECT(m_wxwindow), "realize",
                             GTK_SIGNAL_FUNC(gtk_glwindow_realized_callback), (gpointer) this );
                             GTK_SIGNAL_FUNC(gtk_glwindow_realized_callback), (gpointer) this );
+
+    gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
+        GTK_SIGNAL_FUNC(gtk_glwindow_expose_callback), (gpointer)this );
+
+    gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
+        GTK_SIGNAL_FUNC(gtk_glwindow_draw_callback), (gpointer)this );
+       
     gtk_widget_pop_visual();
     gtk_widget_pop_colormap();
     
     gtk_widget_pop_visual();
     gtk_widget_pop_colormap();
     
@@ -284,12 +326,15 @@ void wxGLCanvas::SetColour( const char *colour )
     if (m_glContext) m_glContext->SetColour( colour );
 }
 
     if (m_glContext) m_glContext->SetColour( colour );
 }
 
-GtkWidget *wxGLCanvas::GetConnectWidget()
+void wxGLCanvas::OnInternalIdle()
 {
 {
-    return m_wxwindow;
-}
+    if (m_glContext && m_exposed)
+    {
+        wxPaintEvent event( GetId() );
+        event.SetEventObject( this );
+        GetEventHandler()->ProcessEvent( event );
 
 
-bool wxGLCanvas::IsOwnGtkWindow( GdkWindow *window )
-{
-    return (window == m_wxwindow->window);
-}
+        m_exposed = FALSE;
+        GetUpdateRegion().Clear();
+    }
+}
\ No newline at end of file
index fc0d51561e1fe3fb2da4bf8c1879849d7585c630..9b8e910bd50fe760cce28834873c81d32c937a33 100644 (file)
@@ -123,16 +123,17 @@ public:
    void SwapBuffers();
 
    void OnSize(wxSizeEvent& event);
    void SwapBuffers();
 
    void OnSize(wxSizeEvent& event);
+   
+   void OnInternalIdle();
 
    inline wxGLContext* GetContext() const { return m_glContext; } 
 
  // implementation
   
 
    inline wxGLContext* GetContext() const { return m_glContext; } 
 
  // implementation
   
-    virtual GtkWidget *GetConnectWidget();
-    bool IsOwnGtkWindow( GdkWindow *window );
-  
-    wxGLContext      *m_glContext; 
+    wxGLContext      *m_glContext,
+                     *m_sharedContext;
     GtkWidget        *m_glWidget;
     GtkWidget        *m_glWidget;
+    bool              m_exposed;
 
 private:
     DECLARE_EVENT_TABLE()
 
 private:
     DECLARE_EVENT_TABLE()
index 8eaed6a1d9bd74fb9361e90604628e42da3190fd..0d49b80611955ebd7efc1c1d085c694ed0713953 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "penguin.h"
 #include <GL/glu.h>
 
 #include "penguin.h"
 #include <GL/glu.h>
+#include "wx/gtk/win_gtk.h"
 
 #define VIEW_ASPECT 1.3
 
 
 #define VIEW_ASPECT 1.3
 
@@ -105,6 +106,14 @@ void TestGLCanvas::OnPaint( wxPaintEvent& event )
     if (!GetContext()) return;
 #endif
 
     if (!GetContext()) return;
 #endif
 
+    printf( "on refresh.\n" );
+    int x,y;
+    GtkMyFixed *fixed = GTK_MYFIXED(m_wxwindow);
+    gdk_window_get_size( m_wxwindow->window, &x, &y );
+    printf( "-> window %d %d.\n", x, y );
+    gdk_window_get_size( fixed->bin_window, &x, &y );
+    printf( "-> bin_window %d %d.\n", x, y );
+    
     SetCurrent();
     
     /* initialize OpenGL */
     SetCurrent();
     
     /* initialize OpenGL */
@@ -146,6 +155,8 @@ void TestGLCanvas::OnSize(wxSizeEvent& event)
     int width, height;
     GetClientSize(& width, & height);
     
     int width, height;
     GetClientSize(& width, & height);
     
+    printf( "onsize %d %d.\n", width, height );
+    
 #ifndef __WXMOTIF__
     if (GetContext())
 #endif
 #ifndef __WXMOTIF__
     if (GetContext())
 #endif