}
*/
+#ifndef __WXUNIVERSAL__
GtkPizza *pizza = GTK_PIZZA (widget);
if (win->GetThemeEnabled())
(char *)"base",
0, 0, -1, -1);
}
+#endif
win->GetUpdateRegion().Union( gdk_event->area.x,
gdk_event->area.y,
gdk_event->area.width,
gdk_event->area.height );
- // Actually send the various events based on the
- // current update region.
- if (gdk_event->count == 0)
- win->GtkSendPaintEvents();
+ // Actual redrawing takes place in idle time.
+ win->Update();
return TRUE;
}
}
*/
+#ifndef __WXUNIVERSAL__
GtkPizza *pizza = GTK_PIZZA (widget);
if (win->GetThemeEnabled())
gdk_window_clear_area( pizza->bin_window,
rect->x, rect->y, rect->width, rect->height);
}
+#endif
win->GetUpdateRegion().Union( rect->x, rect->y, rect->width, rect->height );
- // Actually send the various events based on the
- // current update region.
- win->GtkSendPaintEvents();
+ // Actual redrawing takes place in idle time.
+
+ win->Update();
+#ifndef __WXUNIVERSAL__
// Redraw child widgets
GList *children = pizza->children;
while (children)
gtk_widget_draw (child->widget, &child_area /* (GdkRectangle*) NULL*/ );
}
}
+#endif
}
//-----------------------------------------------------------------------------
if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
- if (win->m_wxwindow)
+ if (win->m_wxwindow && (g_focusWindow != win) && win->AcceptsFocus())
{
- if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow) && !GTK_WIDGET_HAS_FOCUS (win->m_wxwindow) )
- {
- gtk_widget_grab_focus (win->m_wxwindow);
-
+ gtk_widget_grab_focus( win->m_wxwindow );
/*
- wxPrintf( wxT("GrabFocus from ") );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- wxPrintf( win->GetClassInfo()->GetClassName() );
- wxPrintf( wxT(".\n") );
+ wxPrintf( wxT("GrabFocus from ") );
+ if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( wxT(".\n") );
*/
-
- }
}
wxEventType event_type = wxEVT_NULL;
g_focusWindow = win;
#if 0
- wxPrintf( "OnSetFocus from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- wxPrintf( win->GetClassInfo()->GetClassName() );
- wxPrintf( ".\n" );
+ wxLogDebug( wxT("OnSetFocus from %s\n"), win->GetName().c_str() );
#endif
// notify the parent keeping track of focus for the kbd navigation
// "focus_out_event"
//-----------------------------------------------------------------------------
-static GtkWidget *gs_widgetLastFocus = NULL;
-
-static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindowGTK *win )
+static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk_event, wxWindowGTK *win )
{
DEBUG_MAIN_THREAD
if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
- // VZ: this is really weird but GTK+ seems to call us from inside
- // gtk_widget_grab_focus(), i.e. it first sends "focus_out" signal to
- // this widget and then "focus_in". This is totally unexpected and
- // completely breaks wxUniv code so ignore this dummy event (we can't
- // be losing focus if we're about to acquire it!)
- if ( widget == gs_widgetLastFocus )
- {
- gs_widgetLastFocus = NULL;
-
- return FALSE;
- }
+#if 0
+ wxLogDebug( wxT("OnKillFocus from %s"), win->GetName().c_str() );
+#endif
if ( !g_activeFrameLostFocus && g_activeFrame )
{
g_focusWindow = (wxWindowGTK *)NULL;
-#if 0
- wxPrintf( "OnKillFocus from " );
- if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- wxPrintf( win->GetClassInfo()->GetClassName() );
- wxPrintf( ".\n" );
-#endif
-
#ifdef HAVE_XIM
if (win->m_ic)
gdk_im_end();
if (height == -1) m_height = 26;
}
- if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
- if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
+ int minWidth = GetMinWidth(),
+ minHeight = GetMinHeight(),
+ maxWidth = GetMaxWidth(),
+ maxHeight = GetMaxHeight();
+
+ if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
+ if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
+ if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth;
+ if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
int border = 0;
int bottom_border = 0;
{
if (!GTK_WIDGET_HAS_FOCUS (m_wxwindow))
{
- // see comment in gtk_window_focus_out_callback()
- gs_widgetLastFocus = m_wxwindow;
gtk_widget_grab_focus (m_wxwindow);
}
}
// ?
}
}
-
-#if 0
- wxPrintf( "SetFocus finished in " );
- if (GetClassInfo() && GetClassInfo()->GetClassName())
- wxPrintf( GetClassInfo()->GetClassName() );
- wxPrintf( ".\n" );
-#endif
-
}
bool wxWindowGTK::AcceptsFocus() const
m_clipPaintRegion = TRUE;
- if (!m_clearRegion.IsEmpty())
+ // if (!m_clearRegion.IsEmpty()) // always send an erase event
{
wxWindowDC dc( (wxWindow*)this );
dc.SetClippingRegion( m_clearRegion );
m_clipPaintRegion = FALSE;
+#ifndef __WXUNIVERSAL__
+ // The following code will result in all window-less widgets
+ // being redrawn because the wxWindows class is allowed to
+ // paint over the window-less widgets.
+
GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
- if (g_list_length(pizza->children) > 0)
+
+ GList *children = pizza->children;
+ while (children)
{
- // The following code will result in all window-less widgets
- // being redrawn because the wxWindows class is allowed to
- // paint over the window-less widgets.
- GList *children = pizza->children;
- while (children)
- {
- GtkPizzaChild *child = (GtkPizzaChild*) children->data;
- children = children->next;
+ GtkPizzaChild *child = (GtkPizzaChild*) children->data;
+ children = children->next;
- if (GTK_WIDGET_NO_WINDOW (child->widget) &&
- GTK_WIDGET_DRAWABLE (child->widget))
+ if (GTK_WIDGET_NO_WINDOW (child->widget) &&
+ GTK_WIDGET_DRAWABLE (child->widget))
+ {
+ // Get intersection of widget area and update region
+ wxRegion region( m_updateRegion );
+
+ GdkEventExpose gdk_event;
+ gdk_event.type = GDK_EXPOSE;
+ gdk_event.window = pizza->bin_window;
+ gdk_event.count = 0;
+
+ wxRegionIterator upd( m_updateRegion );
+ while (upd)
{
- // Get intersection of widget area and update region
- wxRegion region( m_updateRegion );
- region.Intersect( child->widget->allocation.x,
- child->widget->allocation.y,
- child->widget->allocation.width,
- child->widget->allocation.height );
+ GdkRectangle rect;
+ rect.x = upd.GetX();
+ rect.y = upd.GetY();
+ rect.width = upd.GetWidth();
+ rect.height = upd.GetHeight();
- // Redraw the whole widget anyway
- if (!region.IsEmpty())
- gtk_widget_draw( child->widget, NULL );
+ if (gtk_widget_intersect (child->widget, &rect, &gdk_event.area))
+ {
+ gtk_widget_event (child->widget, (GdkEvent*) &gdk_event);
+ }
+
+ upd ++;
}
}
}
+#endif
m_updateRegion.Clear();
}
void wxWindowGTK::SetWidgetStyle()
{
-#if DISABLE_STYLE_IF_BROKEN_THEM
+#if DISABLE_STYLE_IF_BROKEN_THEME
if (m_widget->style->engine_data)
{
static bool s_warningPrinted = FALSE;