From da1000cb15f6d668a01e056975d716d8451c4bdb Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 4 Feb 2014 07:43:13 +0000 Subject: [PATCH] CtrlCore: Caret fixed in GTK mode for older GTK versions git-svn-id: svn://ultimatepp.org/upp/trunk@6863 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlCore/Gtk.h | 2 +- uppsrc/CtrlCore/GtkDrawOp.cpp | 5 +++-- uppsrc/CtrlCore/GtkEvent.cpp | 2 +- uppsrc/CtrlLib/ChGtk0.cpp | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/uppsrc/CtrlCore/Gtk.h b/uppsrc/CtrlCore/Gtk.h index e24b83d84..4b86ca186 100644 --- a/uppsrc/CtrlCore/Gtk.h +++ b/uppsrc/CtrlCore/Gtk.h @@ -71,7 +71,7 @@ public: bool CanSetSurface() { return true; } static void Flush() {} // TODO? - SystemDraw(cairo_t *cr, GdkDrawable *dw = NULL) : cr(cr), drawable(dw) {} + SystemDraw(cairo_t *cr, GdkDrawable *dw/* = NULL*/) : cr(cr), drawable(dw) {} }; class ImageDraw : public SystemDraw { diff --git a/uppsrc/CtrlCore/GtkDrawOp.cpp b/uppsrc/CtrlCore/GtkDrawOp.cpp index 5afeaabbd..d64f9e76d 100644 --- a/uppsrc/CtrlCore/GtkDrawOp.cpp +++ b/uppsrc/CtrlCore/GtkDrawOp.cpp @@ -126,9 +126,10 @@ void SystemDraw::DrawRectOp(int x, int y, int cx, int cy, Color color) if(drawable) { GdkGC *gc = gdk_gc_new(drawable); gdk_gc_set_function(gc, GDK_INVERT); - gdk_draw_drawable(drawable, gc, drawable, x, y, x, y, cx, cy); + Point o = GetOffset(); + gdk_draw_drawable(drawable, gc, drawable, x + o.x, y + o.y, x + o.x, y + o.y, cx, cy); gdk_gc_set_function(gc, GDK_COPY); - gdk_gc_destroy(drawable); + gdk_gc_destroy(gc); } #endif } diff --git a/uppsrc/CtrlCore/GtkEvent.cpp b/uppsrc/CtrlCore/GtkEvent.cpp index 127e44d40..588e45748 100644 --- a/uppsrc/CtrlCore/GtkEvent.cpp +++ b/uppsrc/CtrlCore/GtkEvent.cpp @@ -103,7 +103,7 @@ gboolean Ctrl::GtkEvent(GtkWidget *widget, GdkEvent *event, gpointer user_data) #endif p->fullrefresh = false; GdkEventExpose *e = (GdkEventExpose *)event; - SystemDraw w(gdk_cairo_create(p->gdk())); + SystemDraw w(gdk_cairo_create(p->gdk()), p->gdk()); painting = true; Rect r = RectC(e->area.x, e->area.y, e->area.width, e->area.height); w.Clip(r); diff --git a/uppsrc/CtrlLib/ChGtk0.cpp b/uppsrc/CtrlLib/ChGtk0.cpp index 22605dfb6..f2dde02c0 100644 --- a/uppsrc/CtrlLib/ChGtk0.cpp +++ b/uppsrc/CtrlLib/ChGtk0.cpp @@ -144,7 +144,7 @@ Image GetGTK(GtkWidget *widget, int state, int shadow, const char *detail, int t #ifdef GUI_GTK GdkPixmap *pixmap = gdk_pixmap_new(gdk_get_default_root_window(), isz.cx, isz.cy, -1); cairo_t *cairo = gdk_cairo_create(pixmap); - SystemDraw sw(cairo); + SystemDraw sw(cairo, NULL); sw.DrawRect(isz, back); cairo_destroy(cairo); #else