git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16491
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
+wxRegion::wxRegion( GdkRegion *region )
+{
+ m_refData = new wxRegionRefData();
+ M_REGIONDATA->m_region = gdk_region_copy( region );
+}
+
wxRegion::wxRegion( size_t n, const wxPoint *points, int fillStyle )
{
GdkPoint *gdkpoints = new GdkPoint[n];
wxRegion::wxRegion( size_t n, const wxPoint *points, int fillStyle )
{
GdkPoint *gdkpoints = new GdkPoint[n];
+#ifdef __WXGTK20__
+ // This callback gets called in drawing-idle time under
+ // GTK 2.0, so we don't need to defer anything to idle
+ // time anymore.
+
+ win->GetUpdateRegion() = wxRegion( gdk_event->region );
+
+ win->GtkSendPaintEvents();
+
+ // Draw window less widgets
+ (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, gdk_event);
+#else
+ // This gets called immediately after an expose event
+ // under GTK 1.2 so we collect the calls and wait for
+ // the idle handler to pick things up.
+
win->GetUpdateRegion().Union( gdk_event->area.x,
gdk_event->area.y,
gdk_event->area.width,
win->GetUpdateRegion().Union( gdk_event->area.x,
gdk_event->area.y,
gdk_event->area.width,
// Actual redrawing takes place in idle time.
// win->GtkUpdate();
// Actual redrawing takes place in idle time.
// win->GtkUpdate();
-
-#ifdef __WXGTK20__
-
- (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, gdk_event);
-
- if (x) (*y) = 0;
- if (x) (*y) = 0;
+ if (x) (*x) = 0;
+ if (y) (*y) = 0;
return;
}
#ifdef __WXGTK20__
return;
}
#ifdef __WXGTK20__
- if (x) (*y) = 0;
- if (x) (*y) = 0;
+ if (x) (*x) = 0;
+ if (y) (*y) = 0;
PangoRectangle rect;
pango_layout_line_get_extents(line, NULL, &rect);
PangoRectangle rect;
pango_layout_line_get_extents(line, NULL, &rect);
- if (x) (*x) = (wxCoord) rect.width;
- if (y) (*y) = (wxCoord) rect.height;
+ if (x) (*x) = (wxCoord) (rect.width / PANGO_SCALE);
+ if (y) (*y) = (wxCoord) (rect.height / PANGO_SCALE);
if (descent)
{
// Do something about metrics here
if (descent)
{
// Do something about metrics here
#ifdef __WXGTK20__
if (m_wxwindow && GTK_PIZZA(m_wxwindow)->bin_window)
gdk_window_process_updates( GTK_PIZZA(m_wxwindow)->bin_window, FALSE );
#ifdef __WXGTK20__
if (m_wxwindow && GTK_PIZZA(m_wxwindow)->bin_window)
gdk_window_process_updates( GTK_PIZZA(m_wxwindow)->bin_window, FALSE );
if (!m_updateRegion.IsEmpty())
GtkSendPaintEvents();
if (!m_updateRegion.IsEmpty())
GtkSendPaintEvents();
}
void wxWindowGTK::GtkSendPaintEvents()
{
if (!m_wxwindow)
{
}
void wxWindowGTK::GtkSendPaintEvents()
{
if (!m_wxwindow)
{
m_updateRegion.Clear();
return;
}
m_updateRegion.Clear();
return;
}
- // widget to draw on
- GtkPizza *pizza = GTK_PIZZA (m_wxwindow);
-
// Clip to paint region in wxClientDC
m_clipPaintRegion = TRUE;
// Clip to paint region in wxClientDC
m_clipPaintRegion = TRUE;
+#ifndef __WXGTK20__
+ // widget to draw on
+ GtkPizza *pizza = GTK_PIZZA (m_wxwindow);
+
+ // later for GTK 2.0, too.
if (GetThemeEnabled())
{
// find ancestor from which to steal background
if (GetThemeEnabled())
{
// find ancestor from which to steal background
-#ifdef __WXGTK20__
- if (!m_clearRegion.IsEmpty()) // Always send an erase event under GTK 1.2
-#endif
+
+#ifdef __WXGTK20__
+ {
+ wxWindowDC dc( (wxWindow*)this );
+ dc.SetClippingRegion( m_updateRegion );
+
+ wxEraseEvent erase_event( GetId(), &dc );
+ erase_event.SetEventObject( this );
+
+ GetEventHandler()->ProcessEvent(erase_event);
+ }
+#else
+ // if (!m_clearRegion.IsEmpty()) // Always send an erase event under GTK 1.2
{
wxWindowDC dc( (wxWindow*)this );
if (m_clearRegion.IsEmpty())
{
wxWindowDC dc( (wxWindow*)this );
if (m_clearRegion.IsEmpty())
if (!GetEventHandler()->ProcessEvent(erase_event))
{
if (!GetEventHandler()->ProcessEvent(erase_event))
{
if (!g_eraseGC)
{
g_eraseGC = gdk_gc_new( pizza->bin_window );
if (!g_eraseGC)
{
g_eraseGC = gdk_gc_new( pizza->bin_window );
upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() );
upd ++;
}
upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() );
upd ++;
}
}
m_clearRegion.Clear();
}
}
m_clearRegion.Clear();
}
wxNcPaintEvent nc_paint_event( GetId() );
nc_paint_event.SetEventObject( this );
wxNcPaintEvent nc_paint_event( GetId() );
nc_paint_event.SetEventObject( this );
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
if (m_wxwindow && m_wxwindow->window)
{
m_clearRegion.Clear();
if (m_wxwindow && m_wxwindow->window)
{
m_clearRegion.Clear();
// Better do this in idle?
GtkUpdate();
}
// Better do this in idle?
GtkUpdate();
}
+wxRegion::wxRegion( GdkRegion *region )
+{
+ m_refData = new wxRegionRefData();
+ M_REGIONDATA->m_region = gdk_region_copy( region );
+}
+
wxRegion::wxRegion( size_t n, const wxPoint *points, int fillStyle )
{
GdkPoint *gdkpoints = new GdkPoint[n];
wxRegion::wxRegion( size_t n, const wxPoint *points, int fillStyle )
{
GdkPoint *gdkpoints = new GdkPoint[n];
+#ifdef __WXGTK20__
+ // This callback gets called in drawing-idle time under
+ // GTK 2.0, so we don't need to defer anything to idle
+ // time anymore.
+
+ win->GetUpdateRegion() = wxRegion( gdk_event->region );
+
+ win->GtkSendPaintEvents();
+
+ // Draw window less widgets
+ (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, gdk_event);
+#else
+ // This gets called immediately after an expose event
+ // under GTK 1.2 so we collect the calls and wait for
+ // the idle handler to pick things up.
+
win->GetUpdateRegion().Union( gdk_event->area.x,
gdk_event->area.y,
gdk_event->area.width,
win->GetUpdateRegion().Union( gdk_event->area.x,
gdk_event->area.y,
gdk_event->area.width,
// Actual redrawing takes place in idle time.
// win->GtkUpdate();
// Actual redrawing takes place in idle time.
// win->GtkUpdate();
-
-#ifdef __WXGTK20__
-
- (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, gdk_event);
-
- if (x) (*y) = 0;
- if (x) (*y) = 0;
+ if (x) (*x) = 0;
+ if (y) (*y) = 0;
return;
}
#ifdef __WXGTK20__
return;
}
#ifdef __WXGTK20__
- if (x) (*y) = 0;
- if (x) (*y) = 0;
+ if (x) (*x) = 0;
+ if (y) (*y) = 0;
PangoRectangle rect;
pango_layout_line_get_extents(line, NULL, &rect);
PangoRectangle rect;
pango_layout_line_get_extents(line, NULL, &rect);
- if (x) (*x) = (wxCoord) rect.width;
- if (y) (*y) = (wxCoord) rect.height;
+ if (x) (*x) = (wxCoord) (rect.width / PANGO_SCALE);
+ if (y) (*y) = (wxCoord) (rect.height / PANGO_SCALE);
if (descent)
{
// Do something about metrics here
if (descent)
{
// Do something about metrics here
#ifdef __WXGTK20__
if (m_wxwindow && GTK_PIZZA(m_wxwindow)->bin_window)
gdk_window_process_updates( GTK_PIZZA(m_wxwindow)->bin_window, FALSE );
#ifdef __WXGTK20__
if (m_wxwindow && GTK_PIZZA(m_wxwindow)->bin_window)
gdk_window_process_updates( GTK_PIZZA(m_wxwindow)->bin_window, FALSE );
if (!m_updateRegion.IsEmpty())
GtkSendPaintEvents();
if (!m_updateRegion.IsEmpty())
GtkSendPaintEvents();
}
void wxWindowGTK::GtkSendPaintEvents()
{
if (!m_wxwindow)
{
}
void wxWindowGTK::GtkSendPaintEvents()
{
if (!m_wxwindow)
{
m_updateRegion.Clear();
return;
}
m_updateRegion.Clear();
return;
}
- // widget to draw on
- GtkPizza *pizza = GTK_PIZZA (m_wxwindow);
-
// Clip to paint region in wxClientDC
m_clipPaintRegion = TRUE;
// Clip to paint region in wxClientDC
m_clipPaintRegion = TRUE;
+#ifndef __WXGTK20__
+ // widget to draw on
+ GtkPizza *pizza = GTK_PIZZA (m_wxwindow);
+
+ // later for GTK 2.0, too.
if (GetThemeEnabled())
{
// find ancestor from which to steal background
if (GetThemeEnabled())
{
// find ancestor from which to steal background
-#ifdef __WXGTK20__
- if (!m_clearRegion.IsEmpty()) // Always send an erase event under GTK 1.2
-#endif
+
+#ifdef __WXGTK20__
+ {
+ wxWindowDC dc( (wxWindow*)this );
+ dc.SetClippingRegion( m_updateRegion );
+
+ wxEraseEvent erase_event( GetId(), &dc );
+ erase_event.SetEventObject( this );
+
+ GetEventHandler()->ProcessEvent(erase_event);
+ }
+#else
+ // if (!m_clearRegion.IsEmpty()) // Always send an erase event under GTK 1.2
{
wxWindowDC dc( (wxWindow*)this );
if (m_clearRegion.IsEmpty())
{
wxWindowDC dc( (wxWindow*)this );
if (m_clearRegion.IsEmpty())
if (!GetEventHandler()->ProcessEvent(erase_event))
{
if (!GetEventHandler()->ProcessEvent(erase_event))
{
if (!g_eraseGC)
{
g_eraseGC = gdk_gc_new( pizza->bin_window );
if (!g_eraseGC)
{
g_eraseGC = gdk_gc_new( pizza->bin_window );
upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() );
upd ++;
}
upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() );
upd ++;
}
}
m_clearRegion.Clear();
}
}
m_clearRegion.Clear();
}
wxNcPaintEvent nc_paint_event( GetId() );
nc_paint_event.SetEventObject( this );
wxNcPaintEvent nc_paint_event( GetId() );
nc_paint_event.SetEventObject( this );
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
{
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
if (m_wxwindow && m_wxwindow->window)
{
m_clearRegion.Clear();
if (m_wxwindow && m_wxwindow->window)
{
m_clearRegion.Clear();
// Better do this in idle?
GtkUpdate();
}
// Better do this in idle?
GtkUpdate();
}