Krolyxon
Commit 7121e7b

Branches

Refs →

nsxiv7121e7b

Initialize imlib2

Author
Bert
Date
2011-01-18 16:40 +0100
Parent
22db1ed
Commit
7121e7b468e133cda882c574bf1d6933c490ae94

+18 −1

4 files changed

  1. M Makefile +1 −1
  2. M app.c +2 −0
  3. M image.c +11 −0
  4. M image.h +4 −0
M Makefile View
@@ -4,7 +4,7 @@ CC?=gcc
44 PREFIX?=/usr/local
55 CFLAGS+= -std=c99 -Wall -pedantic -g
66 LDFLAGS+=
7−LIBS+= -lX11
7+LIBS+= -lX11 -lImlib2
88
99 SRCFILES=$(wildcard *.c)
1010 OBJFILES=$(SRCFILES:.c=.o)
M app.c View
@@ -35,6 +35,8 @@ void app_init(app_t *app) {
3535 app->win.h = WIN_HEIGHT;
3636
3737 win_open(&app->win);
38+
39+ imlib_init(&app->win);
3840 }
3941
4042 void app_run(app_t *app) {
M image.c View
@@ -16,6 +16,17 @@
1616 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1717 */
1818
19+#include <Imlib2.h>
20+
1921 #include "sxiv.h"
2022 #include "image.h"
2123
24+void imlib_init(win_t *win) {
25+ if (!win)
26+ return;
27+
28+ imlib_context_set_display(win->env.dpy);
29+ imlib_context_set_visual(win->env.vis);
30+ imlib_context_set_colormap(win->env.cmap);
31+ imlib_context_set_drawable(win->xwin);
32+}
M image.h View
@@ -19,6 +19,8 @@
1919 #ifndef IMAGE_H
2020 #define IMAGE_H
2121
22+#include "window.h"
23+
2224 typedef enum scalemode_e {
2325 SCALE_DOWN = 0,
2426 SCALE_FIT,
@@ -34,4 +36,6 @@ typedef struct img_s {
3436 int y;
3537 } img_t;
3638
39+void imlib_init(win_t*);
40+
3741 #endif /* IMAGE_H */