+ if (event->length == 1)
+ {
+ key_code = (unsigned char)*event->string;
+ }
+ else if ((keysym & 0xFF) == keysym)
+ {
+ key_code = (guint)keysym;
+ }
+ }
+ }
+
+ return (key_code);
+}
+
+//-----------------------------------------------------------------------------
+// "size_request" of m_widget
+//-----------------------------------------------------------------------------
+
+static void gtk_window_size_request_callback( GtkWidget *widget, GtkRequisition *requisition, wxWindow *win )
+{
+ int w,h;
+ win->GetSize( &w, &h );
+ if (w < 2) w = 2;
+ if (h < 2) h = 2;
+
+ requisition->height = h;
+ requisition->width = w;
+}
+
+//-----------------------------------------------------------------------------
+// "expose_event" of m_wxwindow
+//-----------------------------------------------------------------------------
+
+static int gtk_window_expose_callback( GtkWidget *widget,
+ GdkEventExpose *gdk_event,
+ wxWindow *win )
+{
+ DEBUG_MAIN_THREAD
+
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+/*
+ if (win->GetName() == wxT("panel"))
+ {
+ wxPrintf( wxT("OnExpose from ") );
+ if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( wxT(" %d %d %d %d\n"), (int)gdk_event->area.x,
+ (int)gdk_event->area.y,
+ (int)gdk_event->area.width,
+ (int)gdk_event->area.height );
+ }
+*/
+
+ GtkPizza *pizza = GTK_PIZZA (widget);
+
+ if (win->GetThemeEnabled())
+ {
+ wxWindow *parent = win->GetParent();
+ while (parent && !parent->IsTopLevel())
+ parent = parent->GetParent();
+ if (!parent)
+ parent = win;
+
+ gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
+ GTK_SHADOW_NONE, &gdk_event->area, parent->m_widget, "base", 0, 0, -1, -1);
+ }
+
+ win->GetUpdateRegion().Union( gdk_event->area.x,
+ gdk_event->area.y,
+ gdk_event->area.width,
+ gdk_event->area.height );
+
+ if (gdk_event->count == 0)
+ {
+ win->m_clipPaintRegion = TRUE;
+
+ wxWindowDC dc(win);
+ dc.SetClippingRegion(win->GetUpdateRegion());
+ wxEraseEvent eevent( win->GetId(), &dc );
+ eevent.SetEventObject( win );
+#if 1
+ (void)win->GetEventHandler()->ProcessEvent(eevent);
+#else // 0
+ if (!win->GetEventHandler()->ProcessEvent(eevent))
+ {
+ wxClientDC dc( win );
+ dc.SetBrush( wxBrush( win->GetBackgroundColour(), wxSOLID ) );
+ dc.SetPen( *wxTRANSPARENT_PEN );
+
+ wxRegionIterator upd( win->GetUpdateRegion() );
+ while (upd)
+ {
+ dc.DrawRectangle( upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() );
+ upd ++;
+ }
+ }
+#endif // 1/0
+
+ wxNcPaintEvent eventNc( win->GetId() );
+ eventNc.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( eventNc );
+
+ wxPaintEvent event( win->GetId() );
+ event.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( event );
+
+ win->GetUpdateRegion().Clear();
+
+ win->m_clipPaintRegion = FALSE;
+ }
+
+ /* The following code will result in all window-less widgets
+ being redrawn if the wxWindows class is given a chance to
+ paint *anything* because it will then be allowed to paint
+ over the window-less widgets */
+ GList *children = pizza->children;
+ while (children)
+ {
+ GtkPizzaChild *child = (GtkPizzaChild*) children->data;
+ children = children->next;
+
+ GdkEventExpose child_event = *gdk_event;
+
+ if (GTK_WIDGET_NO_WINDOW (child->widget) &&
+ GTK_WIDGET_DRAWABLE (child->widget) /* &&
+ gtk_widget_intersect (child->widget, &gdk_event->area, &child_event.area)*/ )
+ {
+ child_event.area.x = child->widget->allocation.x;
+ child_event.area.y = child->widget->allocation.y;
+ child_event.area.width = child->widget->allocation.width;
+ child_event.area.height = child->widget->allocation.height;
+ gtk_widget_event (child->widget, (GdkEvent*) &child_event);
+ }
+ }
+
+ return TRUE;
+}
+
+//-----------------------------------------------------------------------------
+// "event" of m_wxwindow
+//-----------------------------------------------------------------------------
+
+/* GTK thinks it is clever and filters out a certain amount of "unneeded"
+ expose events. We need them, of course, so we override the main event
+ procedure in GtkWidget by giving our own handler for all system events.
+ There, we look for expose events ourselves whereas all other events are
+ handled normally. */
+
+gint gtk_window_event_event_callback( GtkWidget *widget,
+ GdkEventExpose *event,
+ wxWindow *win )
+{
+ if (event->type == GDK_EXPOSE)
+ {
+ gint ret = gtk_window_expose_callback( widget, event, win );
+ return ret;
+ }
+
+ return FALSE;
+}
+
+//-----------------------------------------------------------------------------
+// "draw" of m_wxwindow
+//-----------------------------------------------------------------------------
+
+/* This callback is a complete replacement of the gtk_pizza_draw() function,
+ which disabled. */
+
+static void gtk_window_draw_callback( GtkWidget *widget,
+ GdkRectangle *rect,
+ wxWindow *win )
+{
+ DEBUG_MAIN_THREAD
+
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if ((win->HasFlag(wxNO_FULL_REPAINT_ON_RESIZE)) &&
+ (win->GetChildren().GetCount() == 0))
+ {
+ return;
+ }
+
+/*
+ if (win->GetName() == wxT("panel"))
+ {
+ wxPrintf( wxT("OnDraw from ") );
+ if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( wxT(" %d %d %d %d\n"), (int)rect->x,
+ (int)rect->y,
+ (int)rect->width,
+ (int)rect->height );
+ }
+*/
+
+ GtkPizza *pizza = GTK_PIZZA (widget);
+
+ if (win->GetThemeEnabled())
+ {
+ wxWindow *parent = win->GetParent();
+ while (parent && !parent->IsTopLevel())
+ parent = parent->GetParent();
+ if (!parent)
+ parent = win;
+
+ gtk_paint_flat_box (parent->m_widget->style, pizza->bin_window, GTK_STATE_NORMAL,
+ GTK_SHADOW_NONE, rect, parent->m_widget, "base", 0, 0, -1, -1);
+ }
+
+
+ if (!(GTK_WIDGET_APP_PAINTABLE (widget)) &&
+ (pizza->clear_on_draw))
+ {
+ gdk_window_clear_area( pizza->bin_window,
+ rect->x, rect->y, rect->width, rect->height);
+ }
+
+ win->GetUpdateRegion().Union( rect->x, rect->y, rect->width, rect->height );
+
+ win->m_clipPaintRegion = TRUE;
+
+ wxWindowDC dc(win);
+ dc.SetClippingRegion(win->GetUpdateRegion());
+ wxEraseEvent eevent( win->GetId(), &dc );
+ eevent.SetEventObject( win );
+
+#if 1
+ (void)win->GetEventHandler()->ProcessEvent(eevent);
+#else
+ if (!win->GetEventHandler()->ProcessEvent(eevent))
+ {
+ if (!win->GetEventHandler()->ProcessEvent(eevent))
+ {
+ wxClientDC dc( win );
+ dc.SetBrush( wxBrush( win->GetBackgroundColour(), wxSOLID ) );
+ dc.SetPen( *wxTRANSPARENT_PEN );
+
+ wxRegionIterator upd( win->GetUpdateRegion() );
+ while (upd)
+ {
+ dc.DrawRectangle( upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() );
+ upd ++;
+ }