+ // wxASSERT_MSG( (g_activeFrame == win), wxT("TLW deactivatd although it wasn't active") );
+
+ // wxPrintf( wxT("inactive: %s\n"), win->GetTitle().c_str() );
+
+ if (g_activeFrame)
+ {
+ wxLogTrace(wxT("activate"), wxT("Activating frame %p (from focus_in)"), g_activeFrame);
+ wxActivateEvent event(wxEVT_ACTIVATE, false, g_activeFrame->GetId());
+ event.SetEventObject(g_activeFrame);
+ g_activeFrame->HandleWindowEvent(event);
+
+ g_activeFrame = NULL;
+ }
+
+ return FALSE;
+}
+}
+
+// ----------------------------------------------------------------------------
+// "key_press_event"
+// ----------------------------------------------------------------------------
+
+extern "C" {
+static gboolean
+wxgtk_tlw_key_press_event(GtkWidget *widget, GdkEventKey *event)
+{
+ GtkWindow* const window = GTK_WINDOW(widget);
+
+ // By default GTK+ checks for the menu accelerators in this (top level)
+ // window first and then propagates the event to the currently focused
+ // child from where it bubbles up the window parent chain. In wxWidgets,
+ // however, we want the child window to have the event first but still
+ // handle it as an accelerator if it's not processed there, so we need to
+ // customize this by reversing the order of the steps done in the standard
+ // GTK+ gtk_window_key_press_event() handler.
+
+ if ( gtk_window_propagate_key_event(window, event) )
+ return TRUE;
+
+ if ( gtk_window_activate_key(window, event) )
+ return TRUE;
+
+ if (GTK_WIDGET_GET_CLASS(widget)->key_press_event(widget, event))
+ return TRUE;
+
+ return FALSE;
+}
+}
+
+//-----------------------------------------------------------------------------
+// "size_allocate" from m_wxwindow
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static void
+size_allocate(GtkWidget*, GtkAllocation* alloc, wxTopLevelWindowGTK* win)
+{
+ win->m_useCachedClientSize = true;
+ if (win->m_clientWidth != alloc->width ||
+ win->m_clientHeight != alloc->height)
+ {
+ win->m_clientWidth = alloc->width;
+ win->m_clientHeight = alloc->height;
+
+ GtkAllocation a;
+ gtk_widget_get_allocation(win->m_widget, &a);
+ wxSize size(a.width, a.height);
+ size += win->m_decorSize;
+ win->m_width = size.x;
+ win->m_height = size.y;
+
+ if (!win->IsIconized())
+ {
+ wxSizeEvent event(size, win->GetId());
+ event.SetEventObject(win);
+ win->HandleWindowEvent(event);
+ }
+ // else the window is currently unmapped, don't generate size events
+ }
+}
+}
+
+//-----------------------------------------------------------------------------
+// "delete_event"
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static gboolean
+gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget),
+ GdkEvent *WXUNUSED(event),
+ wxTopLevelWindowGTK *win )
+{