summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile9
-rw-r--r--roi.c15
2 files changed, 11 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 1d9e0a0..fce35b1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,9 @@
CC = gcc
CFLAGS = -ggdb -std=c99 -pedantic -Wall $(DEFINES) \
- $(shell pkg-config --cflags gdk-pixbuf-2.0 gtk+-2.0 glib-2.0 gthread-2.0) \
+ $(shell pkg-config --cflags gdk-pixbuf-2.0 glib-2.0 gthread-2.0) \
-DN_THREADS=$(shell grep -c ^processor /proc/cpuinfo || echo 2)
LDFLAGS = $(LIBS) -lm \
- $(shell pkg-config --libs gdk-pixbuf-2.0 gtk+-2.0 glib-2.0 gthread-2.0)
+ $(shell pkg-config --libs gdk-pixbuf-2.0 glib-2.0 gthread-2.0)
PROGS = wimmel wimmel_gl roi
OBJS = wimmel.o wimmel_gl.o util.o roi.o
@@ -26,5 +26,10 @@ roi: roi.o
wimmel_gl:
$(CC) $(LDFLAGS) `pkg-config --cflags --libs egl glesv2` -o $@ $+
+roi.o: roi.c
+ $(CC) $(CFLAGS) `pkg-config --cflags gtk+-3.0` -c -o $@ $<
+roi:
+ $(CC) $(LDFLAGS) `pkg-config --libs gtk+-3.0` -o $@ $+
+
clean:
rm -f $(PROGS) $(OBJS)
diff --git a/roi.c b/roi.c
index a3465c4..3033d0a 100644
--- a/roi.c
+++ b/roi.c
@@ -237,20 +237,13 @@ configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data)
}
gboolean
-expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer userdata)
+draw_cb(GtkWidget *widget, cairo_t *cr, gpointer userdata)
{
struct roi *roi = userdata;
- cairo_t *cr;
- cr = gdk_cairo_create(gtk_widget_get_window(widget));
gdk_cairo_set_source_pixbuf(cr, roi->modified_input ?
roi->modified_input : roi->input, 0, 0);
- cairo_rectangle(cr,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
- /* cairo_paint(cr); */
- cairo_fill(cr);
- cairo_destroy(cr);
+ cairo_paint(cr);
return FALSE;
}
@@ -276,8 +269,8 @@ main(int argc, char *argv[])
g_signal_connect(roi.window, "destroy",
G_CALLBACK(gtk_main_quit), NULL);
- g_signal_connect(G_OBJECT(roi.drawing_area), "expose-event",
- G_CALLBACK(expose_event), &roi);
+ g_signal_connect(G_OBJECT(roi.drawing_area), "draw",
+ G_CALLBACK(draw_cb), &roi);
g_signal_connect(G_OBJECT(roi.drawing_area), "configure-event",
G_CALLBACK(configure_event), &roi);