+/*
+ 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;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// "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
+//-----------------------------------------------------------------------------
+
+static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win )
+{
+ if ( !win->m_hasVMT )
+ return;
+
+ win->GetUpdateRegion().Union( gdk_event->area.x,
+ gdk_event->area.y,
+ gdk_event->area.width,
+ gdk_event->area.height );
+
+ if ( gdk_event->count > 0 )
+ return;
+
+/*
+ printf( "OnExpose from " );
+ if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+ printf( win->GetClassInfo()->GetClassName() );
+ printf( ".\n" );
+*/
+
+ wxPaintEvent event( win->GetId() );
+ event.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( event );
+
+ win->GetUpdateRegion().Clear();
+}
+
+//-----------------------------------------------------------------------------
+// "draw" of m_wxwindow
+//-----------------------------------------------------------------------------
+
+static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win )
+{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT)
+ return;
+
+ win->GetUpdateRegion().Union( rect->x, rect->y,
+ rect->width, rect->height );
+
+ wxPaintEvent event( win->GetId() );
+ event.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( event );
+
+ win->GetUpdateRegion().Clear();
+}
+
+//-----------------------------------------------------------------------------
+// "key_press_event" from any window
+//-----------------------------------------------------------------------------
+
+static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
+{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (!win->m_hasVMT) return FALSE;
+ if (g_blockEventsOnDrag) return FALSE;
+
+/*
+ printf( "KeyDown-ScanCode is: %d.\n", gdk_event->keyval );
+ if (gdk_event->state & GDK_SHIFT_MASK)
+ printf( "ShiftDown.\n" );
+ else
+ printf( "ShiftUp.\n" );
+ if (gdk_event->state & GDK_CONTROL_MASK)
+ printf( "ControlDown.\n" );
+ else
+ printf( "ControlUp.\n" );
+ printf( "\n" );
+*/
+ int x = 0;
+ int y = 0;
+ GdkModifierType state;
+ if (gdk_event->window) gdk_window_get_pointer(gdk_event->window, &x, &y, &state);
+
+ long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval );
+
+ /* sending unknown key events doesn't really make sense */
+ if (key_code == 0) return FALSE;
+
+ bool ret = FALSE;
+
+ wxKeyEvent event( wxEVT_KEY_DOWN );
+ event.SetTimestamp( gdk_event->time );