#include <gtk/gtk.h>
#include <gdk/gdkprivate.h>
#include <gdk/gdkkeysyms.h>
-#include <wx/gtk/win_gtk.h>
-
#include <gdk/gdkx.h>
+#include <gtk/gtk.h>
+#include <gtk/gtkprivate.h>
+
+#include "wx/gtk/win_gtk.h"
+
//-----------------------------------------------------------------------------
// documentation on internals
//-----------------------------------------------------------------------------
if (g_isIdle)
wxapp_install_idle_handler();
- if (win->m_queuedFullRedraw)
- return TRUE;
-
/*
- if (win->GetName() == wxT("htmlWindow"))
+ if (win->GetName() == wxT("panel"))
{
wxPrintf( wxT("OnExpose from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
}
*/
- win->GetUpdateRegion().Union( gdk_event->area.x,
- gdk_event->area.y,
- gdk_event->area.width,
- gdk_event->area.height );
-
+ if (!win->m_queuedFullRedraw)
+ {
- if (gdk_event->count > 0)
- return TRUE;
+ win->GetUpdateRegion().Union( gdk_event->area.x,
+ gdk_event->area.y,
+ gdk_event->area.width,
+ gdk_event->area.height );
- wxEraseEvent eevent( win->GetId() );
- eevent.SetEventObject( win );
- win->GetEventHandler()->ProcessEvent(eevent);
+ if (gdk_event->count == 0)
+ {
+ wxEraseEvent eevent( win->GetId() );
+ eevent.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent(eevent);
- wxPaintEvent event( win->GetId() );
- event.SetEventObject( win );
- win->GetEventHandler()->ProcessEvent( event );
+ wxPaintEvent event( win->GetId() );
+ event.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( event );
- win->GetUpdateRegion().Clear();
+ win->GetUpdateRegion().Clear();
+ }
- /* 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 */
+ /* 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 */
- GtkPizza *pizza = GTK_PIZZA (widget);
+ GtkPizza *pizza = GTK_PIZZA (widget);
- GList *children = pizza->children;
- while (children)
- {
- GtkPizzaChild *child = (GtkPizzaChild*) children->data;
- children = children->next;
+ GList *children = pizza->children;
+ while (children)
+ {
+ GtkPizzaChild *child = (GtkPizzaChild*) children->data;
+ children = children->next;
- GdkEventExpose child_event = *gdk_event;
+ GdkEventExpose child_event = *gdk_event;
- if (GTK_WIDGET_NO_WINDOW (child->widget) &&
- GTK_WIDGET_DRAWABLE (child->widget))
- {
- 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);
+ 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);
+ }
}
}
/* 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,
- looking for the expose events and then we can always send them. */
+ 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 )
{
return ret;
}
-
return FALSE;
}
if (g_isIdle)
wxapp_install_idle_handler();
- if (win->m_queuedFullRedraw)
- return;
-
- GtkPizza *pizza = GTK_PIZZA (widget);
-
- 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);
- }
-
/*
- if (win->GetName() == wxT("htmlWindow"))
+ if (win->GetName() == wxT("panel"))
{
wxPrintf( wxT("OnDraw from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
}
*/
- win->GetUpdateRegion().Union( rect->x, rect->y,
- rect->width, rect->height );
+ GtkPizza *pizza = GTK_PIZZA (widget);
+
+ if (!win->m_queuedFullRedraw)
+ {
+
+ 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;
+ win->m_clipPaintRegion = TRUE;
- wxEraseEvent eevent( win->GetId() );
- eevent.SetEventObject( win );
- win->GetEventHandler()->ProcessEvent(eevent);
+ wxEraseEvent eevent( win->GetId() );
+ eevent.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent(eevent);
- wxPaintEvent event( win->GetId() );
- event.SetEventObject( win );
- win->GetEventHandler()->ProcessEvent( event );
+ wxPaintEvent event( win->GetId() );
+ event.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( event );
- win->GetUpdateRegion().Clear();
+ win->GetUpdateRegion().Clear();
- win->m_clipPaintRegion = FALSE;
+ win->m_clipPaintRegion = FALSE;
- GList *children = pizza->children;
- while (children)
- {
- GtkPizzaChild *child = (GtkPizzaChild*) children->data;
- children = children->next;
-
- GdkRectangle child_area;
- if (gtk_widget_intersect (child->widget, rect, &child_area))
+
+ GList *children = pizza->children;
+ while (children)
{
- gtk_widget_draw (child->widget, &child_area /* (GdkRectangle*) NULL*/ );
+ GtkPizzaChild *child = (GtkPizzaChild*) children->data;
+ children = children->next;
+
+ GdkRectangle child_area;
+ if (gtk_widget_intersect (child->widget, rect, &child_area))
+ {
+ gtk_widget_draw (child->widget, &child_area /* (GdkRectangle*) NULL*/ );
+ }
}
}
}
if (g_isIdle)
wxapp_install_idle_handler();
+
g_blockEventsOnScroll = TRUE;
win->m_isScrolling = (gdk_event->window == widget->slider);
if (win->m_isScrolling)
{
- wxEventType command = wxEVT_SCROLL_THUMBRELEASE;
+ wxEventType command = wxEVT_SCROLLWIN_THUMBRELEASE;
int value = -1;
int dir = -1;
if ((colormap = gtk_widget_get_colormap (widget)) !=
gtk_widget_get_default_colormap ())
{
- attrmask |= GDK_IC_PREEDIT_COLORMAP;
- attr->preedit_colormap = colormap;
+ attrmask |= GDK_IC_PREEDIT_COLORMAP;
+ attr->preedit_colormap = colormap;
}
attrmask |= GDK_IC_PREEDIT_FOREGROUND;
if (!m_noExpose)
{
/* these get reported to wxWindows -> wxPaintEvent */
+
+ gtk_pizza_set_external( GTK_PIZZA(m_wxwindow), TRUE );
+
gtk_signal_connect( GTK_OBJECT(m_wxwindow), "event",
GTK_SIGNAL_FUNC(gtk_window_event_event_callback), (gpointer)this );
the actual size of window, in which case all expose events that resulted
from resizing the window have been sent (and discarded) and we can
now do our full redraw and switch on expose event handling again. */
-
- if ((m_width == m_widget->allocation.width) && (m_height == m_widget->allocation.height))
+
+ bool child_already_resized = FALSE;
+ if (m_isFrame)
+ child_already_resized = gtk_pizza_child_resized( GTK_PIZZA(m_wxwindow->parent), m_wxwindow );
+ else
+ child_already_resized = gtk_pizza_child_resized( GTK_PIZZA(m_widget->parent), m_widget );
+
+ if (child_already_resized)
{
m_queuedFullRedraw = FALSE;
m_updateRegion.Clear();
m_updateRegion.Union( 0,0,m_width,m_height );
gtk_widget_draw( m_wxwindow, (GdkRectangle*) NULL );
-
+
GdkEventMask mask = gdk_window_get_events( GTK_PIZZA(m_wxwindow)->bin_window );
mask = (GdkEventMask)(mask | GDK_EXPOSURE_MASK);
gdk_window_set_events( GTK_PIZZA(m_wxwindow)->bin_window, mask );
gtk_pizza_set_clear( pizza, old_clear );
*/
GdkEventExpose gdk_event;
+ gdk_event.type = GDK_EXPOSE;
+ gdk_event.window = GTK_PIZZA(m_wxwindow)->bin_window;
gdk_event.count = 0;
gdk_event.area.x = 0;
gdk_event.area.y = 0;
gtk_pizza_set_clear( pizza, old_clear );
*/
GdkEventExpose gdk_event;
+ gdk_event.type = GDK_EXPOSE;
+ gdk_event.window = GTK_PIZZA(m_wxwindow)->bin_window;
gdk_event.count = 0;
gdk_event.area.x = rect->x;
gdk_event.area.y = rect->y;