Preparation for adding uiDrawCaret().

This commit is contained in:
Pietro Gagliardi 2017-02-10 16:16:43 -05:00
parent 0e5be32299
commit b52600d9cd
4 changed files with 7 additions and 3 deletions

View File

@ -119,7 +119,8 @@ static gboolean areaWidget_draw(GtkWidget *w, cairo_t *cr)
uiAreaDrawParams dp; uiAreaDrawParams dp;
double clipX0, clipY0, clipX1, clipY1; double clipX0, clipY0, clipX1, clipY1;
dp.Context = newContext(cr); dp.Context = newContext(cr,
gtk_widget_get_style_context(a->widget));
loadAreaSize(a, &(dp.AreaWidth), &(dp.AreaHeight)); loadAreaSize(a, &(dp.AreaWidth), &(dp.AreaHeight));

View File

@ -2,17 +2,19 @@
#include "uipriv_unix.h" #include "uipriv_unix.h"
#include "draw.h" #include "draw.h"
uiDrawContext *newContext(cairo_t *cr) uiDrawContext *newContext(cairo_t *cr, GtkStyleContext *style)
{ {
uiDrawContext *c; uiDrawContext *c;
c = uiNew(uiDrawContext); c = uiNew(uiDrawContext);
c->cr = cr; c->cr = cr;
c->style = style;
return c; return c;
} }
void freeContext(uiDrawContext *c) void freeContext(uiDrawContext *c)
{ {
// free neither cr nor style; we own neither
uiFree(c); uiFree(c);
} }

View File

@ -3,6 +3,7 @@
// draw.c // draw.c
struct uiDrawContext { struct uiDrawContext {
cairo_t *cr; cairo_t *cr;
GtkStyleContext *style;
}; };
// drawpath.c // drawpath.c

View File

@ -42,7 +42,7 @@ extern GtkWidget *childBox(struct child *c);
extern void childSetMargined(struct child *c, int margined); extern void childSetMargined(struct child *c, int margined);
// draw.c // draw.c
extern uiDrawContext *newContext(cairo_t *); extern uiDrawContext *newContext(cairo_t *cr, GtkStyleContext *style);
extern void freeContext(uiDrawContext *); extern void freeContext(uiDrawContext *);
// drawtext.c // drawtext.c