]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/window.cpp
applying patch 1873285
[wxWidgets.git] / src / gtk1 / window.cpp
index eebfa24d1e8a38704929e8387bd2380436da6552..82fbdedf02d0ebe767dd9c5aeadf856f1c992cb6 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        gtk/window.cpp
+// Name:        src/gtk1/window.cpp
 // Purpose:
 // Author:      Robert Roebling
 // Id:          $Id$
 #endif
 
 #include "wx/window.h"
-#include "wx/dcclient.h"
-#include "wx/frame.h"
-#include "wx/app.h"
-#include "wx/layout.h"
-#include "wx/utils.h"
-#include "wx/dialog.h"
-#include "wx/msgdlg.h"
-#include "wx/module.h"
-#include "wx/combobox.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/intl.h"
+    #include "wx/log.h"
+    #include "wx/app.h"
+    #include "wx/utils.h"
+    #include "wx/frame.h"
+    #include "wx/dcclient.h"
+    #include "wx/menu.h"
+    #include "wx/dialog.h"
+    #include "wx/settings.h"
+    #include "wx/msgdlg.h"
+    #include "wx/textctrl.h"
+    #include "wx/combobox.h"
+    #include "wx/layout.h"
+    #include "wx/statusbr.h"
+    #include "wx/math.h"
+    #include "wx/module.h"
+#endif
 
 #if wxUSE_DRAG_AND_DROP
     #include "wx/dnd.h"
     #include "wx/caret.h"
 #endif // wxUSE_CARET
 
-#if wxUSE_TEXTCTRL
-    #include "wx/textctrl.h"
-#endif
-
-#include "wx/menu.h"
-#include "wx/statusbr.h"
-#include "wx/intl.h"
-#include "wx/settings.h"
-#include "wx/log.h"
 #include "wx/fontutil.h"
 
 #ifdef __WXDEBUG__
     #include "wx/thread.h"
 #endif
 
-#include "wx/math.h"
 #include <ctype.h>
 
 #include "wx/gtk1/private.h"
 // data
 //-----------------------------------------------------------------------------
 
-extern wxList     wxPendingDelete;
 extern bool       g_blockEventsOnDrag;
 extern bool       g_blockEventsOnScroll;
 extern wxCursor   g_globalCursor;
@@ -226,6 +225,11 @@ wxWindowGTK *g_delayedFocus = (wxWindowGTK*) NULL;
 // the last click here (extern: used from gtk/menu.cpp)
 guint32 wxGtkTimeLastClick = 0;
 
+// global variables because GTK+ DnD want to have the
+// mouse event that caused it
+GdkEvent *g_lastMouseEvent = (GdkEvent*) NULL;
+int g_lastButtonNumber = 0;
+
 extern bool g_mainThreadLocked;
 
 //-----------------------------------------------------------------------------
@@ -367,7 +371,7 @@ static void draw_frame( GtkWidget *widget, wxWindowGTK *win )
         return;
     }
 
-    if (win->HasFlag(wxSUNKEN_BORDER))
+    if (win->HasFlag(wxSUNKEN_BORDER) || win->HasFlag(wxBORDER_THEME))
     {
         gtk_draw_shadow( widget->style,
                          widget->window,
@@ -424,7 +428,7 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
 
 // make it extern because wxStaticText needs to disconnect this one
 extern "C" {
-void wxgtk_window_size_request_callback(GtkWidget *widget,
+void wxgtk_window_size_request_callback(GtkWidget *WXUNUSED(widget),
                                         GtkRequisition *requisition,
                                         wxWindow *win)
 {
@@ -442,7 +446,7 @@ void wxgtk_window_size_request_callback(GtkWidget *widget,
 
 extern "C" {
 static
-void wxgtk_combo_size_request_callback(GtkWidget *widget,
+void wxgtk_combo_size_request_callback(GtkWidget *WXUNUSED(widget),
                                        GtkRequisition *requisition,
                                        wxComboBox *win)
 {
@@ -474,7 +478,7 @@ void wxgtk_combo_size_request_callback(GtkWidget *widget,
 //-----------------------------------------------------------------------------
 
 extern "C" {
-static int gtk_window_expose_callback( GtkWidget *widget,
+static int gtk_window_expose_callback( GtkWidget *WXUNUSED(widget),
                                        GdkEventExpose *gdk_event,
                                        wxWindow *win )
 {
@@ -739,11 +743,11 @@ static long wxTranslateKeySymToWXKey(KeySym keysym, bool isChar)
             break;
 
         case GDK_Prior:     // == GDK_Page_Up
-            key_code = WXK_PRIOR;
+            key_code = WXK_PAGEUP;
             break;
 
         case GDK_Next:      // == GDK_Page_Down
-            key_code = WXK_NEXT;
+            key_code = WXK_PAGEDOWN;
             break;
 
         case GDK_End:
@@ -822,11 +826,11 @@ static long wxTranslateKeySymToWXKey(KeySym keysym, bool isChar)
             break;
 
         case GDK_KP_Prior: // == GDK_KP_Page_Up
-            key_code = isChar ? WXK_PRIOR : WXK_NUMPAD_PRIOR;
+            key_code = isChar ? WXK_PAGEUP : WXK_NUMPAD_PAGEUP;
             break;
 
         case GDK_KP_Next: // == GDK_KP_Page_Down
-            key_code = isChar ? WXK_NEXT : WXK_NUMPAD_NEXT;
+            key_code = isChar ? WXK_PAGEDOWN : WXK_NUMPAD_PAGEDOWN;
             break;
 
         case GDK_KP_End:
@@ -923,7 +927,10 @@ static void wxFillOtherKeyEventFields(wxKeyEvent& event,
     event.m_rawCode = (wxUint32) gdk_event->keyval;
     event.m_rawFlags = 0;
 #if wxUSE_UNICODE
-    event.m_uniChar = gdk_keyval_to_unicode(gdk_event->keyval);
+#if 0
+   // this is not gtk1.x
+   event.m_uniChar = gdk_keyval_to_unicode(gdk_event->keyval);
+#endif
 #endif
     wxGetMousePosition( &x, &y );
     win->ScreenToClient( &x, &y );
@@ -1056,19 +1063,18 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
     bool ret = false;
     bool return_after_IM = false;
 
-    if( wxTranslateGTKKeyEventToWx(event, win, gdk_event) == false )
+    if ( wxTranslateGTKKeyEventToWx(event, win, gdk_event) )
+    {
+        // Emit KEY_DOWN event
+        ret = win->HandleWindowEvent( event );
+    }
+    else
     {
         // Return after IM processing as we cannot do
         // anything with it anyhow.
         return_after_IM = true;
     }
 
-    if (return_after_IM)
-        return false;
-
-    // Emit KEY_DOWN event
-    ret = win->GetEventHandler()->ProcessEvent( event );
-
     // This is for GTK+ 1.2 only. The char event generatation for GTK+ 2.0 is done
     // in the "commit" handler.
 
@@ -1116,17 +1122,20 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
             if (parent)
             {
                 event.SetEventType( wxEVT_CHAR_HOOK );
-                ret = parent->GetEventHandler()->ProcessEvent( event );
+                ret = parent->HandleWindowEvent( event );
             }
             if (!ret)
             {
                 event.SetEventType(wxEVT_CHAR);
-                win->GetEventHandler()->ProcessEvent( event );
+                win->HandleWindowEvent( event );
             }
         }
         return true;
     }
 
+    if (return_after_IM)
+        return false;
+
 #if wxUSE_ACCEL
     if (!ret)
     {
@@ -1137,7 +1146,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
             if (command != -1)
             {
                 wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
-                ret = ancestor->GetEventHandler()->ProcessEvent( command_event );
+                ret = ancestor->HandleWindowEvent( command_event );
                 break;
             }
             if (ancestor->IsTopLevel())
@@ -1182,13 +1191,13 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
             if (parent)
             {
                 event.SetEventType( wxEVT_CHAR_HOOK );
-                ret = parent->GetEventHandler()->ProcessEvent( event );
+                ret = parent->HandleWindowEvent( event );
             }
 
             if (!ret)
             {
                 event.SetEventType(wxEVT_CHAR);
-                ret = win->GetEventHandler()->ProcessEvent( event );
+                ret = win->HandleWindowEvent( event );
             }
         }
     }
@@ -1218,7 +1227,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
         // CTRL-TAB changes the (parent) window, i.e. switch notebook page
         new_event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) );
         new_event.SetCurrentFocus( win );
-        ret = win->GetParent()->GetEventHandler()->ProcessEvent( new_event );
+        ret = win->GetParent()->HandleWindowEvent( new_event );
     }
 
     // generate wxID_CANCEL if <esc> has been pressed (typically in dialogs)
@@ -1254,7 +1263,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
         {
             wxCommandEvent eventClick(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
             eventClick.SetEventObject(btnCancel);
-            ret = btnCancel->GetEventHandler()->ProcessEvent(eventClick);
+            ret = btnCancel->HandleWindowEvent(eventClick);
         }
     }
 
@@ -1295,7 +1304,7 @@ static gint gtk_window_key_release_callback( GtkWidget *widget,
         return FALSE;
     }
 
-    if ( !win->GetEventHandler()->ProcessEvent( event ) )
+    if ( !win->HandleWindowEvent( event ) )
         return FALSE;
 
     gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_release_event" );
@@ -1346,7 +1355,7 @@ template<typename T> void InitMouseEvent(wxWindowGTK *win,
 static void AdjustEventButtonState(wxMouseEvent& event)
 {
     // GDK reports the old state of the button for a button press event, but
-    // for compatibility with MSW and common sense we want m_leftDown be TRUE
+    // for compatibility with MSW and common sense we want m_leftDown be true
     // for a LEFT_DOWN event, not FALSE, so we will invert
     // left/right/middleDown for the corresponding click events
 
@@ -1467,7 +1476,9 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
 
     if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
 
-    if (win->m_wxwindow && (g_focusWindow != win) && win->AcceptsFocus())
+    g_lastButtonNumber = gdk_event->button;
+
+    if (win->m_wxwindow && (g_focusWindow != win) && win->IsFocusable())
     {
         gtk_widget_grab_focus( win->m_wxwindow );
 /*
@@ -1574,6 +1585,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
         return FALSE;
     }
 
+    g_lastMouseEvent = (GdkEvent*) gdk_event;
+
     wxMouseEvent event( event_type );
     InitMouseEvent( win, event, gdk_event );
 
@@ -1603,11 +1616,13 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
         }
     }
 
-    if (win->GetEventHandler()->ProcessEvent( event ))
+    if (win->HandleWindowEvent( event ))
     {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_event" );
+        g_lastMouseEvent = NULL;
         return TRUE;
     }
+    g_lastMouseEvent = NULL;
 
     if (event_type == wxEVT_RIGHT_DOWN)
     {
@@ -1623,7 +1638,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
             win->GetId(),
             win->ClientToScreen(event.GetPosition()));
         evtCtx.SetEventObject(win);
-        return win->GetEventHandler()->ProcessEvent(evtCtx);
+        return win->HandleWindowEvent(evtCtx);
     }
 
     return FALSE;
@@ -1650,6 +1665,8 @@ static gint gtk_window_button_release_callback( GtkWidget *widget,
 
     if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
 
+    g_lastButtonNumber = 0;
+
     wxEventType event_type = wxEVT_NULL;
 
     switch (gdk_event->button)
@@ -1671,6 +1688,8 @@ static gint gtk_window_button_release_callback( GtkWidget *widget,
             return FALSE;
     }
 
+    g_lastMouseEvent = (GdkEvent*) gdk_event;
+
     wxMouseEvent event( event_type );
     InitMouseEvent( win, event, gdk_event );
 
@@ -1682,7 +1701,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget,
     if ( !g_captureWindow )
         win = FindWindowForMouseEvent(win, event.m_x, event.m_y);
 
-    if (win->GetEventHandler()->ProcessEvent( event ))
+    if (win->HandleWindowEvent( event ))
     {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_release_event" );
         return TRUE;
@@ -1722,6 +1741,8 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget,
         gdk_event->y = y;
     }
 
+    g_lastMouseEvent = (GdkEvent*) gdk_event;
+
 /*
     printf( "OnMotion from " );
     if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -1750,7 +1771,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget,
                                                         : wxEVT_LEAVE_WINDOW);
             InitMouseEvent(win, eventM, gdk_event);
             eventM.SetEventObject(win);
-            win->GetEventHandler()->ProcessEvent(eventM);
+            win->HandleWindowEvent(eventM);
         }
     }
     else // no capture
@@ -1758,13 +1779,15 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget,
         win = FindWindowForMouseEvent(win, event.m_x, event.m_y);
     }
 
-    if (win->GetEventHandler()->ProcessEvent( event ))
+    bool ret = win->HandleWindowEvent( event );
+    g_lastMouseEvent = NULL;
+
+    if ( ret )
     {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "motion_notify_event" );
-        return TRUE;
     }
 
-    return FALSE;
+    return ret ? TRUE : FALSE;
 }
 }
 
@@ -1779,12 +1802,12 @@ static bool DoSendFocusEvents(wxWindow *win)
     // Notify the parent keeping track of focus for the kbd navigation
     // purposes that we got it.
     wxChildFocusEvent eventChildFocus(win);
-    (void)win->GetEventHandler()->ProcessEvent(eventChildFocus);
+    (void)win->HandleWindowEvent(eventChildFocus);
 
     wxFocusEvent eventFocus(wxEVT_SET_FOCUS, win->GetId());
     eventFocus.SetEventObject(win);
 
-    return win->GetEventHandler()->ProcessEvent(eventFocus);
+    return win->HandleWindowEvent(eventFocus);
 }
 
 extern "C" {
@@ -1839,7 +1862,9 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget,
 //-----------------------------------------------------------------------------
 
 extern "C" {
-static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk_event, wxWindowGTK *win )
+static gint gtk_window_focus_out_callback( GtkWidget *WXUNUSED(widget),
+                                           GdkEventFocus *WXUNUSED(gdk_event),
+                                           wxWindowGTK *win )
 {
     DEBUG_MAIN_THREAD
 
@@ -1883,7 +1908,7 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk
         // process it too as otherwise bad things happen, especially in GTK2
         // where the text control simply aborts the program if it doesn't get
         // the matching focus out event
-        (void)win->GetEventHandler()->ProcessEvent( event );
+        (void)win->HandleWindowEvent( event );
     }
 
     return FALSE;
@@ -1925,7 +1950,7 @@ gint gtk_window_enter_callback( GtkWidget *widget,
     event.m_x = x + pt.x;
     event.m_y = y + pt.y;
 
-    if (win->GetEventHandler()->ProcessEvent( event ))
+    if (win->HandleWindowEvent( event ))
     {
        gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "enter_notify_event" );
        return TRUE;
@@ -1977,7 +2002,7 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_
     event.m_x = x + pt.x;
     event.m_y = y + pt.y;
 
-    if (win->GetEventHandler()->ProcessEvent( event ))
+    if (win->HandleWindowEvent( event ))
     {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "leave_notify_event" );
         return TRUE;
@@ -2017,7 +2042,7 @@ static void gtk_window_vscroll_callback( GtkAdjustment *adjust,
 
     wxScrollWinEvent event( command, value, wxVERTICAL );
     event.SetEventObject( win );
-    win->GetEventHandler()->ProcessEvent( event );
+    win->HandleWindowEvent( event );
 }
 }
 
@@ -2050,7 +2075,7 @@ static void gtk_window_hscroll_callback( GtkAdjustment *adjust,
 
     wxScrollWinEvent event( command, value, wxHORIZONTAL );
     event.SetEventObject( win );
-    win->GetEventHandler()->ProcessEvent( event );
+    win->HandleWindowEvent( event );
 }
 }
 
@@ -2116,7 +2141,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
 
         wxScrollWinEvent event( command, value, dir );
         event.SetEventObject( win );
-        win->GetEventHandler()->ProcessEvent( event );
+        win->HandleWindowEvent( event );
     }
 
     win->m_isScrolling = false;
@@ -2145,7 +2170,7 @@ wxWindow *wxWindowBase::DoFindFocus()
 
 extern "C" {
 static gint
-gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win )
+gtk_window_realized_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
 {
     DEBUG_MAIN_THREAD
 
@@ -2154,7 +2179,7 @@ gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win )
 
     wxWindowCreateEvent event( win );
     event.SetEventObject( win );
-    win->GetEventHandler()->ProcessEvent( event );
+    win->HandleWindowEvent( event );
 
     return FALSE;
 }
@@ -2188,7 +2213,7 @@ void gtk_window_size_callback( GtkWidget *WXUNUSED(widget),
     {
         wxSizeEvent event( win->GetSize(), win->GetId() );
         event.SetEventObject( win );
-        win->GetEventHandler()->ProcessEvent( event );
+        win->HandleWindowEvent( event );
     }
 }
 }
@@ -2205,7 +2230,7 @@ void gtk_window_size_callback( GtkWidget *WXUNUSED(widget),
 extern "C" {
 static
 void gtk_wxwindow_size_callback( GtkWidget* WXUNUSED_UNLESS_XIM(widget),
-                                 GtkAllocation* WXUNUSED_UNLESS_XIM(alloc),
+                                 GtkAllocation* WXUNUSED(alloc),
                                  wxWindowGTK* WXUNUSED_UNLESS_XIM(win) )
 {
     if (g_isIdle)
@@ -2470,6 +2495,11 @@ bool wxWindowGTK::Create( wxWindow *parent,
                           long style,
                           const wxString &name  )
 {
+    // Get default border
+    wxBorder border = GetBorder(style);
+    style &= ~wxBORDER_MASK;
+    style |= border;
+
     if (!PreCreation( parent, pos, size ) ||
         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
     {
@@ -2501,7 +2531,7 @@ bool wxWindowGTK::Create( wxWindow *parent,
     {
         gtk_pizza_set_shadow_type( pizza, GTK_MYSHADOW_OUT );
     }
-    else if (HasFlag(wxSUNKEN_BORDER))
+    else if (HasFlag(wxSUNKEN_BORDER) || HasFlag(wxBORDER_THEME))
     {
         gtk_pizza_set_shadow_type( pizza, GTK_MYSHADOW_IN );
     }
@@ -2887,7 +2917,7 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
     {
         wxSizeEvent event( wxSize(m_width,m_height), GetId() );
         event.SetEventObject( this );
-        GetEventHandler()->ProcessEvent( event );
+        HandleWindowEvent( event );
     }
 
     m_resizing = false;
@@ -2930,17 +2960,15 @@ void wxWindowGTK::OnInternalIdle()
                 gdk_window_set_cursor( window, cursor.GetCursor() );
 
         }
-        else
+        else if ( m_widget )
         {
-
             GdkWindow *window = m_widget->window;
-            if ((window) && !(GTK_WIDGET_NO_WINDOW(m_widget)))
+            if ( window && !GTK_WIDGET_NO_WINDOW(m_widget) )
                gdk_window_set_cursor( window, cursor.GetCursor() );
-
         }
     }
 
-    if (wxUpdateUIEvent::CanUpdate(this))
+    if (wxUpdateUIEvent::CanUpdate(this) && IsShownOnScreen())
         UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
 }
 
@@ -2966,7 +2994,7 @@ void wxWindowGTK::DoSetClientSize( int width, int height )
         int dh = 0;
 
 #ifndef __WXUNIVERSAL__
-        if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
+        if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER) || HasFlag(wxBORDER_THEME))
         {
             /* when using GTK 1.2 we set the shadow border size to 2 */
             dw += 2 * 2;
@@ -3030,7 +3058,7 @@ void wxWindowGTK::DoGetClientSize( int *width, int *height ) const
         int dh = 0;
 
 #ifndef __WXUNIVERSAL__
-        if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
+        if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER) || HasFlag(wxBORDER_THEME))
         {
             /* when using GTK 1.2 we set the shadow border size to 2 */
             dw += 2 * 2;
@@ -3180,45 +3208,18 @@ bool wxWindowGTK::Show( bool show )
     wxShowEvent eventShow(GetId(), show);
     eventShow.SetEventObject(this);
 
-    GetEventHandler()->ProcessEvent(eventShow);
+    HandleWindowEvent(eventShow);
 
     return true;
 }
 
-static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable)
-{
-    win->OnParentEnable(enable);
-
-    // Recurse, so that children have the opportunity to Do The Right Thing
-    // and reset colours that have been messed up by a parent's (really ancestor's)
-    // Enable call
-    for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
-          node;
-          node = node->GetNext() )
-    {
-        wxWindow *child = node->GetData();
-        if (!child->IsKindOf(CLASSINFO(wxDialog)) && !child->IsKindOf(CLASSINFO(wxFrame)))
-            wxWindowNotifyEnable(child, enable);
-    }
-}
-
-bool wxWindowGTK::Enable( bool enable )
+void wxWindowGTK::DoEnable( bool enable )
 {
-    wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") );
-
-    if (!wxWindowBase::Enable(enable))
-    {
-        // nothing to do
-        return false;
-    }
+    wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
 
     gtk_widget_set_sensitive( m_widget, enable );
     if ( m_wxwindow )
         gtk_widget_set_sensitive( m_wxwindow, enable );
-
-    wxWindowNotifyEnable(this, enable);
-
-    return true;
 }
 
 int wxWindowGTK::GetCharHeight() const
@@ -3413,16 +3414,14 @@ bool wxWindowGTK::SetCursor( const wxCursor &cursor )
 {
     wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") );
 
-    if (cursor == m_cursor)
+    if ( cursor.IsSameAs(m_cursor) )
        return false;
 
     if (g_isIdle)
         wxapp_install_idle_handler();
 
-    if (cursor == wxNullCursor)
-       return wxWindowBase::SetCursor( *wxSTANDARD_CURSOR );
-    else
-       return wxWindowBase::SetCursor( cursor );
+    return wxWindowBase::SetCursor( cursor.IsOk() ? cursor
+                                                  : *wxSTANDARD_CURSOR );
 }
 
 void wxWindowGTK::WarpPointer( int x, int y )
@@ -3597,7 +3596,7 @@ void wxWindowGTK::GtkSendPaintEvents()
         wxEraseEvent erase_event( GetId(), &dc );
         erase_event.SetEventObject( this );
 
-        if (!GetEventHandler()->ProcessEvent(erase_event) && GetBackgroundStyle() != wxBG_STYLE_CUSTOM)
+        if (!HandleWindowEvent(erase_event) && GetBackgroundStyle() != wxBG_STYLE_CUSTOM)
         {
             if (!g_eraseGC)
             {
@@ -3619,11 +3618,11 @@ void wxWindowGTK::GtkSendPaintEvents()
 
     wxNcPaintEvent nc_paint_event( GetId() );
     nc_paint_event.SetEventObject( this );
-    GetEventHandler()->ProcessEvent( nc_paint_event );
+    HandleWindowEvent( nc_paint_event );
 
     wxPaintEvent paint_event( GetId() );
     paint_event.SetEventObject( this );
-    GetEventHandler()->ProcessEvent( paint_event );
+    HandleWindowEvent( paint_event );
 
     m_clipPaintRegion = false;
 
@@ -3926,7 +3925,7 @@ void wxWindowGTK::DoCaptureMouse()
 
     wxCHECK_RET( window, _T("CaptureMouse() failed") );
 
-    wxCursor* cursor = & m_cursor;
+    const wxCursor* cursor = &m_cursor;
     if (!cursor->Ok())
         cursor = wxSTANDARD_CURSOR;
 
@@ -4231,3 +4230,10 @@ void wxWinModule::OnExit()
         gdk_gc_unref( g_eraseGC );
 }
 
+GdkWindow* wxWindowGTK::GTKGetDrawingWindow() const
+{
+    GdkWindow* window = NULL;
+    if (m_wxwindow)
+        window = GTK_PIZZA(m_wxwindow)->bin_window;
+    return window;
+}