-#define TRACE_FOCUS _T("focus")
-
-//-----------------------------------------------------------------------------
-// missing gdk functions
-//-----------------------------------------------------------------------------
-
-void
-gdk_window_warp_pointer (GdkWindow *window,
- gint x,
- gint y)
-{
- if (!window)
- window = gdk_get_default_root_window();
-
- if (!GDK_WINDOW_DESTROYED(window))
- {
- XWarpPointer (GDK_WINDOW_XDISPLAY(window),
- None, /* not source window -> move from anywhere */
- GDK_WINDOW_XID(window), /* dest window */
- 0, 0, 0, 0, /* not source window -> move from anywhere */
- x, y );
- }
-}
-
-//-----------------------------------------------------------------------------
-// local code (see below)
-//-----------------------------------------------------------------------------
-
-// returns the child of win which currently has focus or NULL if not found
-//
-// Note: can't be static, needed by textctrl.cpp.
-wxWindow *wxFindFocusedChild(wxWindowGTK *win)
-{
- wxWindow *winFocus = wxWindowGTK::FindFocus();
- if ( !winFocus )
- return (wxWindow *)NULL;
-
- if ( winFocus == win )
- return (wxWindow *)win;
-
- for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst();
- node;
- node = node->GetNext() )
- {
- wxWindow *child = wxFindFocusedChild(node->GetData());
- if ( child )
- return child;
- }
-
- return (wxWindow *)NULL;
-}
-
-static void GetScrollbarWidth(GtkWidget* widget, int& w, int& h)
-{
- GtkScrolledWindow* scroll_window = GTK_SCROLLED_WINDOW(widget);
- GtkScrolledWindowClass* scroll_class = GTK_SCROLLED_WINDOW_CLASS(GTK_OBJECT_GET_CLASS(scroll_window));
- GtkRequisition scroll_req;
-
- w = 0;
- if (scroll_window->vscrollbar_visible)
- {
- scroll_req.width = 2;
- scroll_req.height = 2;
- (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(scroll_window->vscrollbar) )->size_request )
- (scroll_window->vscrollbar, &scroll_req );
- w = scroll_req.width +
- scroll_class->scrollbar_spacing;
- }
-
- h = 0;
- if (scroll_window->hscrollbar_visible)
- {
- scroll_req.width = 2;
- scroll_req.height = 2;
- (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(scroll_window->hscrollbar) )->size_request )
- (scroll_window->hscrollbar, &scroll_req );
- h = scroll_req.height +
- scroll_class->scrollbar_spacing;
- }
-}
-
-static void draw_frame( GtkWidget *widget, wxWindowGTK *win )
-{
- // wxUniversal widgets draw the borders and scrollbars themselves
-#ifndef __WXUNIVERSAL__
- if (!win->m_hasVMT)
- return;
-
- int dx = 0;
- int dy = 0;
- if (GTK_WIDGET_NO_WINDOW (widget))
- {
- dx += widget->allocation.x;
- dy += widget->allocation.y;
- }
-
- int x = dx;
- int y = dy;
-
- int dw = 0;
- int dh = 0;
- if (win->m_hasScrolling)
- {
- GetScrollbarWidth(widget, dw, dh);
-
- if (win->GetLayoutDirection() == wxLayout_RightToLeft)
- {
- // This is actually wrong for old GTK+ version
- // which do not display the scrollbar on the
- // left side in RTL
- x += dw;
- }
- }
-
- int w = widget->allocation.width-dw;
- int h = widget->allocation.height-dh;
-
- if (win->HasFlag(wxRAISED_BORDER))
- {
- gtk_paint_shadow (widget->style,
- widget->window,
- GTK_STATE_NORMAL,
- GTK_SHADOW_OUT,
- NULL, NULL, NULL, // FIXME: No clipping?
- x, y, w, h );
- return;
- }
-
- if (win->HasFlag(wxSUNKEN_BORDER))
- {
- gtk_paint_shadow (widget->style,
- widget->window,
- GTK_STATE_NORMAL,
- GTK_SHADOW_IN,
- NULL, NULL, NULL, // FIXME: No clipping?
- x, y, w, h );
- 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, x, y, w-1, h-1 );
- g_object_unref (gc);
- return;
- }
-#endif // __WXUNIVERSAL__
-}
-
-//-----------------------------------------------------------------------------
-// "expose_event" of m_widget
-//-----------------------------------------------------------------------------
-
-extern "C" {
-static gboolean
-gtk_window_own_expose_callback( GtkWidget *widget,
- GdkEventExpose *gdk_event,
- wxWindowGTK *win )
-{
- if (gdk_event->count == 0)
- draw_frame(widget, win);
- return false;
-}
-}