summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk3
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@novell.com>2011-08-17 14:33:25 +0100
committerMichael Meeks <michael.meeks@suse.com>2011-10-25 13:41:44 +0100
commitc11c452aa180393e56b79eb256c79e895fa169c8 (patch)
tree6c7a238642476a2170f92da99d7f5830a12b731d /vcl/unx/gtk3
parent4a7e3482912c90b73d6e12c82bcd9ce31975e3f1 (diff)
remove conditionals, and split pieces into salnativewidgets
Diffstat (limited to 'vcl/unx/gtk3')
-rw-r--r--vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx93
1 files changed, 93 insertions, 0 deletions
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index c07cb44ab4ae..5a6179ad3ea7 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -30,5 +30,98 @@
#include "../../headless/svpgdi.cxx"
+void GtkData::initNWF() {}
+void GtkData::deInitNWF() {}
+
+GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
+ : SvpSalGraphics(),
+ mpFrame( pFrame ),
+ mpWindow( pWindow ),
+ mpButtonStyle( NULL )
+{
+}
+
+void GtkSalGraphics::updateSettings( AllSettings& rSettings )
+{
+ g_warning ("unimplemented GtkSalGraphics update");
+}
+
+static void print_cairo_region (cairo_region_t *region, const char *msg)
+{
+ if (!region) {
+ fprintf (stderr, "%s - NULL\n", msg);
+ return;
+ }
+ int numrect = cairo_region_num_rectangles (region);
+ fprintf (stderr, "%s - %d rects\n", msg, numrect);
+ for (int i = 0; i < numrect; i++) {
+ cairo_rectangle_int_t rect;
+ cairo_region_get_rectangle (region, i, &rect);
+ fprintf( stderr, "\t%d -> %d,%d %dx%d\n", i,
+ rect.x, rect.y, rect.width, rect.height );
+ }
+}
+
+static void print_update_area (GdkWindow *window, const char *msg)
+{
+ print_cairo_region (gdk_window_get_update_area (window), msg);
+}
+
+void GtkSalGraphics::copyArea( long nDestX, long nDestY,
+ long nSrcX, long nSrcY,
+ long nSrcWidth, long nSrcHeight,
+ sal_uInt16 nFlags )
+{
+ mpFrame->pushIgnoreDamage();
+ SvpSalGraphics::copyArea( nDestX, nDestY, nSrcX, nSrcY, nSrcWidth, nSrcHeight, nFlags );
+ mpFrame->popIgnoreDamage();
+
+ cairo_rectangle_int_t rect = { (int)nSrcX, (int)nSrcY, (int)nSrcWidth, (int)nSrcHeight };
+ cairo_region_t *region = cairo_region_create_rectangle( &rect );
+
+ print_update_area( gtk_widget_get_window( mpFrame->getWindow() ), "before copy area" );
+
+// print_cairo_region( mpFrame->m_pRegion, "extremely odd SalFrame: shape combine region! - ");
+
+ g_warning( "FIXME: copy area delta: %d %d needs clip intersect\n",
+ nDestX - nSrcX, nDestY - nSrcY );
+
+ // get clip region and translate it in the opposite direction & intersect ...
+ cairo_region_t *clip_region;
+
+ if( m_aClipRegion.GetRectCount() <= 0)
+ {
+ basegfx::B2IVector aSize = GetSize();
+ cairo_rectangle_int_t aCairoSize = { 0, 0, aSize.getX(), aSize.getY() };
+ clip_region = cairo_region_create_rectangle( &aCairoSize );
+ }
+ else
+ {
+ clip_region = cairo_region_create();
+ Rectangle aClipRect;
+ RegionHandle aHnd = m_aClipRegion.BeginEnumRects();
+ while( m_aClipRegion.GetNextEnumRect( aHnd, aClipRect ) )
+ {
+ cairo_rectangle_int_t aRect = { aClipRect.Left(), aClipRect.Top(),
+ aClipRect.Right(), aClipRect.Bottom() };
+ cairo_region_union_rectangle( clip_region, &aRect );
+ }
+ m_aClipRegion.EndEnumRects (aHnd);
+ }
+ print_cairo_region( clip_region, "pristine clip region" );
+ cairo_region_translate( clip_region, - (nDestX - nSrcX), - (nDestY - nSrcY) );
+ print_cairo_region( clip_region, "translated clip region" );
+ cairo_region_intersect( region, clip_region );
+ print_cairo_region( region, "reduced copy area region" );
+
+ // FIXME: this will queue (duplicate) gtk+ re-rendering for the exposed area, c'est la vie
+ gdk_window_move_region( gtk_widget_get_window( mpFrame->getWindow() ),
+ region, nDestX - nSrcX, nDestY - nSrcY );
+
+ print_update_area( gtk_widget_get_window( mpFrame->getWindow() ), "after copy area" );
+ cairo_region_destroy( clip_region );
+ cairo_region_destroy( region );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */