nsxiv7121e7b
Initialize imlib2
+18 −1
4 files changed
| @@ -4,7 +4,7 @@ CC?=gcc | |||
| 4 | 4 | PREFIX?=/usr/local | |
| 5 | 5 | CFLAGS+= -std=c99 -Wall -pedantic -g | |
| 6 | 6 | LDFLAGS+= | |
| 7 | − | LIBS+= -lX11 | |
| 7 | + | LIBS+= -lX11 -lImlib2 | |
| 8 | 8 | ||
| 9 | 9 | SRCFILES=$(wildcard *.c) | |
| 10 | 10 | OBJFILES=$(SRCFILES:.c=.o) | |
| @@ -35,6 +35,8 @@ void app_init(app_t *app) { | |||
| 35 | 35 | app->win.h = WIN_HEIGHT; | |
| 36 | 36 | ||
| 37 | 37 | win_open(&app->win); | |
| 38 | + | ||
| 39 | + | imlib_init(&app->win); | |
| 38 | 40 | } | |
| 39 | 41 | ||
| 40 | 42 | void app_run(app_t *app) { | |
| @@ -16,6 +16,17 @@ | |||
| 16 | 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 17 | 17 | */ | |
| 18 | 18 | ||
| 19 | + | #include <Imlib2.h> | |
| 20 | + | ||
| 19 | 21 | #include "sxiv.h" | |
| 20 | 22 | #include "image.h" | |
| 21 | 23 | ||
| 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 | + | } | |
| @@ -19,6 +19,8 @@ | |||
| 19 | 19 | #ifndef IMAGE_H | |
| 20 | 20 | #define IMAGE_H | |
| 21 | 21 | ||
| 22 | + | #include "window.h" | |
| 23 | + | ||
| 22 | 24 | typedef enum scalemode_e { | |
| 23 | 25 | SCALE_DOWN = 0, | |
| 24 | 26 | SCALE_FIT, | |
| @@ -34,4 +36,6 @@ typedef struct img_s { | |||
| 34 | 36 | int y; | |
| 35 | 37 | } img_t; | |
| 36 | 38 | ||
| 39 | + | void imlib_init(win_t*); | |
| 40 | + | ||
| 37 | 41 | #endif /* IMAGE_H */ | |