]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/window.cpp
Added wxMenu::Delete() and fixed some menu deleted memory
[wxWidgets.git] / src / gtk1 / window.cpp
index 0df4401e3248e23f5000d245070ceef80a152cf3..7e235b0c06335305cd875a287ecbb6cc38bbbe66 100644 (file)
@@ -210,6 +210,109 @@ gdk_window_warp_pointer (GdkWindow      *window,
 extern void wxapp_install_idle_handler();
 extern bool g_isIdle;
 
 extern void wxapp_install_idle_handler();
 extern bool g_isIdle;
 
+//-----------------------------------------------------------------------------
+// local code (see below)
+//-----------------------------------------------------------------------------
+
+#if (GTK_MINOR_VERSION > 0)
+
+static void draw_frame( GtkWidget *widget, wxWindow *win )
+{
+    if (!win->m_hasVMT)
+        return;
+
+    int dw = 0;
+    int dh = 0;
+
+    if (win->HasScrolling())
+    {
+        GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(widget);
+        GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(widget)->klass );
+
+/*
+            GtkWidget *hscrollbar = scroll_window->hscrollbar;
+            GtkWidget *vscrollbar = scroll_window->vscrollbar;
+
+            we use this instead:  range.slider_width = 11 + 2*2pts edge
+*/
+
+        if (scroll_window->vscrollbar_visible)
+        {
+            dw += 15;   /* dw += vscrollbar->allocation.width; */
+            dw += scroll_class->scrollbar_spacing;
+        }
+
+        if (scroll_window->hscrollbar_visible)
+        {
+            dh += 15;   /* dh += hscrollbar->allocation.height; */
+            dh += scroll_class->scrollbar_spacing;
+        }
+    }
+
+    int dx = 0;
+    int dy = 0;
+    if (GTK_WIDGET_NO_WINDOW (widget))
+    {
+        dx += widget->allocation.x;
+        dy += widget->allocation.y;
+    }
+
+    if (win->HasFlag(wxRAISED_BORDER))
+    {
+        gtk_draw_shadow( widget->style,
+                         widget->window,
+                         GTK_STATE_NORMAL,
+                         GTK_SHADOW_OUT,
+                         dx, dy,
+                         win->m_width-dw, win->m_height-dh );
+        return;
+    }
+
+    if (win->HasFlag(wxSUNKEN_BORDER))
+    {
+        gtk_draw_shadow( widget->style,
+                         widget->window,
+                         GTK_STATE_NORMAL,
+                         GTK_SHADOW_IN,
+                         dx, dy,
+                         win->m_width-dw, win->m_height-dh );
+        return;
+    }
+    
+    if (win->HasFlag(wxSIMPLE_BORDER))
+    {
+        GdkGC *gc;
+       gc = gdk_gc_new( widget->window );
+        gdk_gc_set_foreground( gc, &widget->style->black );
+        gdk_draw_rectangle( widget->window, gc, FALSE, 
+                         dx, dy,
+                         win->m_width-dw-1, win->m_height-dh-1 );
+        gdk_gc_unref( gc );
+        return;
+    }
+}
+
+//-----------------------------------------------------------------------------
+// "expose_event" of m_widget
+//-----------------------------------------------------------------------------
+
+static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win )
+{
+    if (gdk_event->count > 0) return;
+    draw_frame( widget, win );
+}
+
+//-----------------------------------------------------------------------------
+// "draw" of m_widget
+//-----------------------------------------------------------------------------
+
+static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
+{
+    draw_frame( widget, win );
+}
+
+#endif // GTK_MINOR_VERSION > 0
+
 //-----------------------------------------------------------------------------
 // key event conversion routines
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // key event conversion routines
 //-----------------------------------------------------------------------------
@@ -564,108 +667,6 @@ static long map_to_wx_keysym( KeySym keysym )
     return (key_code);
 }
 
     return (key_code);
 }
 
-//-----------------------------------------------------------------------------
-// local code (see below)
-//-----------------------------------------------------------------------------
-
-#if (GTK_MINOR_VERSION > 0)
-
-static void draw_frame( GtkWidget *widget, wxWindow *win )
-{
-    if (!win->m_hasVMT)
-        return;
-
-    int dw = 0;
-    int dh = 0;
-
-    if (win->HasScrolling())
-    {
-        GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(widget);
-        GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(widget)->klass );
-
-/*
-            GtkWidget *hscrollbar = scroll_window->hscrollbar;
-            GtkWidget *vscrollbar = scroll_window->vscrollbar;
-
-            we use this instead:  range.slider_width = 11 + 2*2pts edge
-*/
-
-        if (scroll_window->vscrollbar_visible)
-        {
-            dw += 15;   /* dw += vscrollbar->allocation.width; */
-            dw += scroll_class->scrollbar_spacing;
-        }
-
-        if (scroll_window->hscrollbar_visible)
-        {
-            dh += 15;   /* dh += hscrollbar->allocation.height; */
-            dh += scroll_class->scrollbar_spacing;
-        }
-    }
-
-    int dx = 0;
-    int dy = 0;
-    if (GTK_WIDGET_NO_WINDOW (widget))
-    {
-        dx += widget->allocation.x;
-        dy += widget->allocation.y;
-    }
-
-    if (win->HasFlag(wxRAISED_BORDER))
-    {
-        gtk_draw_shadow( widget->style,
-                         widget->window,
-                         GTK_STATE_NORMAL,
-                         GTK_SHADOW_OUT,
-                         dx, dy,
-                         win->m_width-dw, win->m_height-dh );
-        return;
-    }
-
-    if (win->HasFlag(wxSUNKEN_BORDER))
-    {
-        gtk_draw_shadow( widget->style,
-                         widget->window,
-                         GTK_STATE_NORMAL,
-                         GTK_SHADOW_IN,
-                         dx, dy,
-                         win->m_width-dw, win->m_height-dh );
-        return;
-    }
-    
-    if (win->HasFlag(wxSIMPLE_BORDER))
-    {
-        GdkGC *gc = gdk_gc_new( widget->window );
-        gdk_gc_set_foreground( gc, &widget->style->black );
-        gdk_draw_rectangle( widget->window, gc, FALSE, 
-                         dx, dy,
-                         win->m_width-dw-1, win->m_height-dh-1 );
-        gdk_gc_unref( gc );
-        return;
-    }
-}
-
-//-----------------------------------------------------------------------------
-// "expose_event" of m_widget
-//-----------------------------------------------------------------------------
-
-static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win )
-{
-    if (gdk_event->count > 0) return;
-    draw_frame( widget, win );
-}
-
-//-----------------------------------------------------------------------------
-// "draw" of m_wxwindow
-//-----------------------------------------------------------------------------
-
-static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
-{
-    draw_frame( widget, win );
-}
-
-#endif // GTK_MINOR_VERSION > 0
-
 //-----------------------------------------------------------------------------
 // "expose_event" of m_wxwindow
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // "expose_event" of m_wxwindow
 //-----------------------------------------------------------------------------
@@ -675,9 +676,6 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
     if (!win->m_hasVMT)
         return;
 
     if (!win->m_hasVMT)
         return;
 
-    if (gdk_event->window != win->m_wxwindow->window)
-        return;
-
     win->GetUpdateRegion().Union( gdk_event->area.x,
                                   gdk_event->area.y,
                                   gdk_event->area.width,
     win->GetUpdateRegion().Union( gdk_event->area.x,
                                   gdk_event->area.y,
                                   gdk_event->area.width,
@@ -715,10 +713,6 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW
     if (!win->m_hasVMT)
         return;
 
     if (!win->m_hasVMT)
         return;
 
-    GtkMyFixed *myfixed = GTK_MYFIXED (widget);
-    if (!myfixed->children) 
-        return; /* mini optimisation */
-        
     win->GetUpdateRegion().Union( rect->x, rect->y,
                                   rect->width, rect->height );
 
     win->GetUpdateRegion().Union( rect->x, rect->y,
                                   rect->width, rect->height );
 
@@ -1717,6 +1711,12 @@ gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
 
 static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
 {
 
 static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
 {
+    /* the window might have been scrolled already, do we
+       have to adapt the position */
+    GtkMyFixed *myfixed = GTK_MYFIXED(parent->m_wxwindow);
+    child->m_x += myfixed->xoffset;
+    child->m_y += myfixed->yoffset;
+    
     gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
                      GTK_WIDGET(child->m_widget),
                      child->m_x,
     gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
                      GTK_WIDGET(child->m_widget),
                      child->m_x,
@@ -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,15 +2029,18 @@ 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)
          
 #if (GTK_MINOR_VERSION > 0)
-        /* these are called when the "sunken", "raised" or "simple" borders are drawn */
+        /* these are called when the "sunken" or "raised" borders are drawn */
         gtk_signal_connect( GTK_OBJECT(m_widget), "expose_event",
           GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this );
 
         gtk_signal_connect( GTK_OBJECT(m_widget), "expose_event",
           GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this );
 
@@ -2120,17 +2118,19 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
     }
     else
     {
     }
     else
     {
+        GtkMyFixed *myfixed = GTK_MYFIXED(m_parent->m_wxwindow);
+       
         if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0)
         {
         if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0)
         {
-            if (x != -1) m_x = x;
-            if (y != -1) m_y = y;
+            if (x != -1) m_x = x + myfixed->xoffset;
+            if (y != -1) m_y = y + myfixed->yoffset;
             if (width != -1) m_width = width;
             if (height != -1) m_height = height;
         }
         else
         {
             if (width != -1) m_width = width;
             if (height != -1) m_height = height;
         }
         else
         {
-            m_x = x;
-            m_y = y;
+            m_x = x + myfixed->xoffset;
+            m_y = y + myfixed->yoffset;
             m_width = width;
             m_height = height;
         }
             m_width = width;
             m_height = height;
         }
@@ -2160,27 +2160,6 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
             bottom_border = 5;
         }
 
             bottom_border = 5;
         }
 
-        /* this is the result of hours of debugging: the following code
-           means that if we have a m_wxwindow and we set the size of
-           m_widget, m_widget (which is a GtkScrolledWindow) does NOT
-           automatically propagate its size down to its m_wxwindow,
-           which is its client area. therefore, we have to tell the
-           client area directly that it has to resize itself.
-           this will lead to that m_widget (GtkScrolledWindow) will
-           calculate how much size it needs for scrollbars etc and
-           it will then call XXX_size_allocate of its child, which
-           is m_wxwindow. m_wxwindow in turn will do the same with its
-           children and so on. problems can arise if this happens
-           before all the children have been realized as some widgets
-           stupidy need to be realized during XXX_size_allocate (e.g.
-           GtkNotebook) and they will segv if called otherwise. this
-           emergency is tested in gtk_myfixed_size_allocate. Normally
-           this shouldn't be needed and only gtk_widget_queue_resize()
-           should be enough to provoke a resize at the next appropriate
-           moment, but this seems to fail, e.g. when a wxNotebook contains
-           a wxSplitterWindow: the splitter window's children won't
-           show up properly resized then. */
-
         gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow),
                               m_widget,
                               m_x-border,
         gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow),
                               m_widget,
                               m_x-border,
@@ -2209,10 +2188,10 @@ void wxWindow::OnInternalIdle()
           as setting the cursor in a parent window also effects the
           windows above so that checking for the current cursor is
           not possible. */
           as setting the cursor in a parent window also effects the
           windows above so that checking for the current cursor is
           not possible. */
-          
+       
         if (m_wxwindow)
         {
         if (m_wxwindow)
         {
-            GdkWindow *window = m_wxwindow->window;
+            GdkWindow *window = GTK_MYFIXED(m_wxwindow)->bin_window;
             if (window)
                 gdk_window_set_cursor( window, cursor.GetCursor() );
 
             if (window)
                 gdk_window_set_cursor( window, cursor.GetCursor() );
 
@@ -2398,8 +2377,17 @@ void wxWindow::DoGetPosition( int *x, int *y ) const
 {
     wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
 
 {
     wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
 
-    if (x) (*x) = m_x;
-    if (y) (*y) = m_y;
+    int dx = 0;
+    int dy = 0;
+    if (m_parent && m_parent->m_wxwindow)
+    {
+        GtkMyFixed *myfixed = GTK_MYFIXED(m_parent->m_wxwindow);
+       dx = myfixed->xoffset;
+       dy = myfixed->yoffset;
+    }
+
+    if (x) (*x) = m_x - dx;
+    if (y) (*y) = m_y - dy;
 }
 
 void wxWindow::DoClientToScreen( int *x, int *y ) const
 }
 
 void wxWindow::DoClientToScreen( int *x, int *y ) const
@@ -2410,7 +2398,7 @@ void wxWindow::DoClientToScreen( int *x, int *y ) const
 
     GdkWindow *source = (GdkWindow *) NULL;
     if (m_wxwindow)
 
     GdkWindow *source = (GdkWindow *) NULL;
     if (m_wxwindow)
-        source = m_wxwindow->window;
+        source = GTK_MYFIXED(m_wxwindow)->bin_window;
     else
         source = m_widget->window;
 
     else
         source = m_widget->window;
 
@@ -2439,7 +2427,7 @@ void wxWindow::DoScreenToClient( int *x, int *y ) const
 
     GdkWindow *source = (GdkWindow *) NULL;
     if (m_wxwindow)
 
     GdkWindow *source = (GdkWindow *) NULL;
     if (m_wxwindow)
-        source = m_wxwindow->window;
+        source = GTK_MYFIXED(m_wxwindow)->bin_window;
     else
         source = m_widget->window;
 
     else
         source = m_widget->window;
 
@@ -2642,13 +2630,17 @@ void wxWindow::WarpPointer( int x, int y )
 {
     wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
 
 {
     wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
 
-    GtkWidget *connect_widget = GetConnectWidget();
-    if (connect_widget->window)
-    {
-        /* we provide this function ourselves as it is
-           missing in GDK */
-        gdk_window_warp_pointer( connect_widget->window, x, y );
-    }
+    /* we provide this function ourselves as it is
+       missing in GDK (top of this file)  */
+    
+    GdkWindow *window = (GdkWindow*) NULL;
+    if (m_wxwindow)
+        window = GTK_MYFIXED(m_wxwindow)->bin_window;
+    else
+        window = GetConnectWidget()->window;
+       
+    if (window)
+        gdk_window_warp_pointer( window, x, y );
 }
 
 void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
 }
 
 void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
@@ -2661,13 +2653,13 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
     {
         if (rect)
         {
     {
         if (rect)
         {
-            gdk_window_clear_area( m_wxwindow->window,
+            gdk_window_clear_area( GTK_MYFIXED(m_wxwindow)->bin_window,
                                    rect->x, rect->y,
                                    rect->width, rect->height );
         }
         else
         {
                                    rect->x, rect->y,
                                    rect->width, rect->height );
         }
         else
         {
-            gdk_window_clear( m_wxwindow->window );
+            gdk_window_clear( GTK_MYFIXED(m_wxwindow)->bin_window );
         }
     }
 
         }
     }
 
@@ -2756,8 +2748,13 @@ bool wxWindow::SetBackgroundColour( const wxColour &colour )
         if (!m_delayedBackgroundColour) return FALSE;
     }
 
         if (!m_delayedBackgroundColour) return FALSE;
     }
 
-    GtkWidget *connect_widget = GetConnectWidget();
-    if (!connect_widget->window)
+    GdkWindow *window = (GdkWindow*) NULL;
+    if (m_wxwindow)
+        window = GTK_MYFIXED(m_wxwindow)->bin_window;
+    else
+        window = GetConnectWidget()->window;
+       
+    if (!window)
     {
         // indicate that a new style has been set
         // but it couldn't get applied as the
     {
         // indicate that a new style has been set
         // but it couldn't get applied as the
@@ -2768,13 +2765,13 @@ bool wxWindow::SetBackgroundColour( const wxColour &colour )
         return TRUE;
     }
 
         return TRUE;
     }
 
-    if (m_wxwindow && m_wxwindow->window)
+    if (m_wxwindow)
     {
         /* wxMSW doesn't clear the window here. I don't do that either to
           provide compatibility. call Clear() to do the job. */
 
     {
         /* wxMSW doesn't clear the window here. I don't do that either to
           provide compatibility. call Clear() to do the job. */
 
-        m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_wxwindow->window ) );
-        gdk_window_set_background( m_wxwindow->window, m_backgroundColour.GetColor() );
+        m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
+        gdk_window_set_background( window, m_backgroundColour.GetColor() );
     }
 
     wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
     }
 
     wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
@@ -2803,8 +2800,13 @@ bool wxWindow::SetForegroundColour( const wxColour &colour )
         if (!m_delayedForegroundColour) return FALSE;
     }
 
         if (!m_delayedForegroundColour) return FALSE;
     }
 
-    GtkWidget *connect_widget = GetConnectWidget();
-    if (!connect_widget->window)
+    GdkWindow *window = (GdkWindow*) NULL;
+    if (m_wxwindow)
+        window = GTK_MYFIXED(m_wxwindow)->bin_window;
+    else
+        window = GetConnectWidget()->window;
+       
+    if (!window)
     {
         // indicate that a new style has been set
         // but it couldn't get applied as the
     {
         // indicate that a new style has been set
         // but it couldn't get applied as the
@@ -2973,7 +2975,9 @@ GtkWidget* wxWindow::GetConnectWidget()
 
 bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
 {
 
 bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
 {
-    if (m_wxwindow) return (window == m_wxwindow->window);
+    if (m_wxwindow) 
+        return (window == GTK_MYFIXED(m_wxwindow)->bin_window);
+    
     return (window == m_widget->window);
 }
 
     return (window == m_widget->window);
 }
 
@@ -2988,8 +2992,13 @@ bool wxWindow::SetFont( const wxFont &font )
         if (!m_delayedFont) return FALSE;
     }
 
         if (!m_delayedFont) return FALSE;
     }
 
-    GtkWidget *connect_widget = GetConnectWidget();
-    if (!connect_widget->window)
+    GdkWindow *window = (GdkWindow*) NULL;
+    if (m_wxwindow)
+        window = GTK_MYFIXED(m_wxwindow)->bin_window;
+    else
+        window = GetConnectWidget()->window;
+       
+    if (!window)
     {
         // indicate that a new style has been set
         // but it couldn't get applied as the
     {
         // indicate that a new style has been set
         // but it couldn't get applied as the
@@ -3021,10 +3030,15 @@ void wxWindow::CaptureMouse()
 
     wxCHECK_RET( g_captureWindow == NULL, wxT("CaptureMouse called twice") );
 
 
     wxCHECK_RET( g_captureWindow == NULL, wxT("CaptureMouse called twice") );
 
-    GtkWidget *connect_widget = GetConnectWidget();
-    if (!connect_widget->window) return;
+    GdkWindow *window = (GdkWindow*) NULL;
+    if (m_wxwindow)
+        window = GTK_MYFIXED(m_wxwindow)->bin_window;
+    else
+        window = GetConnectWidget()->window;
+       
+    if (!window) return;
 
 
-    gdk_pointer_grab( connect_widget->window, FALSE,
+    gdk_pointer_grab( window, FALSE,
                       (GdkEventMask)
                          (GDK_BUTTON_PRESS_MASK |
                           GDK_BUTTON_RELEASE_MASK |
                       (GdkEventMask)
                          (GDK_BUTTON_PRESS_MASK |
                           GDK_BUTTON_RELEASE_MASK |
@@ -3042,8 +3056,13 @@ void wxWindow::ReleaseMouse()
 
     wxCHECK_RET( g_captureWindow, wxT("ReleaseMouse called twice") );
 
 
     wxCHECK_RET( g_captureWindow, wxT("ReleaseMouse called twice") );
 
-    GtkWidget *connect_widget = GetConnectWidget();
-    if (!connect_widget->window) return;
+    GdkWindow *window = (GdkWindow*) NULL;
+    if (m_wxwindow)
+        window = GTK_MYFIXED(m_wxwindow)->bin_window;
+    else
+        window = GetConnectWidget()->window;
+       
+    if (!window) return;
 
     gdk_pointer_ungrab ( GDK_CURRENT_TIME );
     g_captureWindow = (wxWindow*) NULL;
 
     gdk_pointer_ungrab ( GDK_CURRENT_TIME );
     g_captureWindow = (wxWindow*) NULL;
@@ -3203,6 +3222,9 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
 
     wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
 
 
     wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
 
+    gtk_myfixed_scroll( GTK_MYFIXED(m_wxwindow), -dx, -dy );
+
+/*
     if (!m_scrollGC)
     {
         m_scrollGC = gdk_gc_new( m_wxwindow->window );
     if (!m_scrollGC)
     {
         m_scrollGC = gdk_gc_new( m_wxwindow->window );
@@ -3252,6 +3274,7 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
 
         Refresh( TRUE, &rect );
     }
 
         Refresh( TRUE, &rect );
     }
+*/
 }
 
 void wxWindow::SetScrolling(bool scroll)
 }
 
 void wxWindow::SetScrolling(bool scroll)