Created
April 17, 2015 23:54
-
-
Save chergert/b9054dc8a54987e30247 to your computer and use it in GitHub Desktop.
gtk patch to get access to drawing functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b9455b61e45835d67bc2fbb97667fee5ab99b318 Mon Sep 17 00:00:00 2001 | |
From: Christian Hergert <[email protected]> | |
Date: Fri, 17 Apr 2015 16:54:05 -0700 | |
Subject: [PATCH] wip access to text drawing. | |
--- | |
gtk/gtktextview.c | 33 ++++++++++++++++++++++++--------- | |
gtk/gtktextview.h | 5 +++++ | |
2 files changed, 29 insertions(+), 9 deletions(-) | |
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c | |
index a247586..95e0962 100644 | |
--- a/gtk/gtktextview.c | |
+++ b/gtk/gtktextview.c | |
@@ -5414,23 +5414,24 @@ gtk_text_view_paint (GtkWidget *widget, | |
cairo_restore (cr); | |
} | |
-static void | |
-draw_text (cairo_t *cr, | |
- gpointer user_data) | |
+void | |
+gtk_text_view_draw_text_with_area (GtkTextView *text_view, | |
+ cairo_t *cr, | |
+ const GdkRectangle *area) | |
{ | |
- GtkWidget *widget = user_data; | |
- GtkTextView *text_view = GTK_TEXT_VIEW (widget); | |
+ GtkWidget *widget = (GtkWidget *)text_view; | |
GtkStyleContext *context; | |
- GdkRectangle bg_rect; | |
- gdk_cairo_get_clip_rectangle (cr, &bg_rect); | |
+ g_return_if_fail (GTK_IS_TEXT_VIEW (text_view)); | |
+ g_return_if_fail (cr != NULL); | |
+ g_return_if_fail (area != NULL); | |
context = gtk_widget_get_style_context (widget); | |
gtk_style_context_save (context); | |
gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW); | |
gtk_render_background (context, cr, | |
- bg_rect.x, bg_rect.y, | |
- bg_rect.width, bg_rect.height); | |
+ area->x, area->y, | |
+ area->width, area->height); | |
gtk_style_context_restore (context); | |
if (GTK_TEXT_VIEW_GET_CLASS (text_view)->draw_layer != NULL) | |
@@ -5451,6 +5452,20 @@ draw_text (cairo_t *cr, | |
} | |
static void | |
+draw_text (cairo_t *cr, | |
+ gpointer user_data) | |
+{ | |
+ GtkTextView *text_view = user_data; | |
+ GdkRectangle bg_rect; | |
+ | |
+ g_assert (cr != NULL); | |
+ g_assert (GTK_IS_TEXT_VIEW (text_view)); | |
+ | |
+ gdk_cairo_get_clip_rectangle (cr, &bg_rect); | |
+ gtk_text_view_draw_text_with_area (text_view, cr, &bg_rect); | |
+} | |
+ | |
+static void | |
paint_border_window (GtkTextView *text_view, | |
cairo_t *cr, | |
GtkTextWindowType type, | |
diff --git a/gtk/gtktextview.h b/gtk/gtktextview.h | |
index 91396ba..7a85eb0 100644 | |
--- a/gtk/gtktextview.h | |
+++ b/gtk/gtktextview.h | |
@@ -436,6 +436,11 @@ void gtk_text_view_set_monospace (GtkTextView *text_vi | |
GDK_AVAILABLE_IN_3_16 | |
gboolean gtk_text_view_get_monospace (GtkTextView *text_view); | |
+GDK_AVAILABLE_IN_3_16 | |
+void gtk_text_view_draw_text_with_area (GtkTextView *text_view, | |
+ cairo_t *cr, | |
+ const GdkRectangle *area); | |
+ | |
G_END_DECLS | |
#endif /* __GTK_TEXT_VIEW_H__ */ | |
-- | |
2.3.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment