aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-01-18 16:40:37 +0100
committerBert <ber.t@gmx.com>2011-01-18 16:40:37 +0100
commit7121e7b468e133cda882c574bf1d6933c490ae94 (patch)
tree6bd9966e5b2243850270f2c9d0b9892ec0f28c7a
parent22db1ed3614cbaf67bac7d24f86ebbe824188bef (diff)
downloadnsxiv-7121e7b468e133cda882c574bf1d6933c490ae94.tar.zst
Initialize imlib2
-rw-r--r--Makefile2
-rw-r--r--app.c2
-rw-r--r--image.c11
-rw-r--r--image.h4
4 files changed, 18 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 3e755b4..e6644ee 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ CC?=gcc
PREFIX?=/usr/local
CFLAGS+= -std=c99 -Wall -pedantic -g
LDFLAGS+=
-LIBS+= -lX11
+LIBS+= -lX11 -lImlib2
SRCFILES=$(wildcard *.c)
OBJFILES=$(SRCFILES:.c=.o)
diff --git a/app.c b/app.c
index d9ee033..e9ff727 100644
--- a/app.c
+++ b/app.c
@@ -35,6 +35,8 @@ void app_init(app_t *app) {
app->win.h = WIN_HEIGHT;
win_open(&app->win);
+
+ imlib_init(&app->win);
}
void app_run(app_t *app) {
diff --git a/image.c b/image.c
index e5503f1..2ffa07c 100644
--- a/image.c
+++ b/image.c
@@ -16,6 +16,17 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include <Imlib2.h>
+
#include "sxiv.h"
#include "image.h"
+void imlib_init(win_t *win) {
+ if (!win)
+ return;
+
+ imlib_context_set_display(win->env.dpy);
+ imlib_context_set_visual(win->env.vis);
+ imlib_context_set_colormap(win->env.cmap);
+ imlib_context_set_drawable(win->xwin);
+}
diff --git a/image.h b/image.h
index e542c22..2634fe1 100644
--- a/image.h
+++ b/image.h
@@ -19,6 +19,8 @@
#ifndef IMAGE_H
#define IMAGE_H
+#include "window.h"
+
typedef enum scalemode_e {
SCALE_DOWN = 0,
SCALE_FIT,
@@ -34,4 +36,6 @@ typedef struct img_s {
int y;
} img_t;
+void imlib_init(win_t*);
+
#endif /* IMAGE_H */