diff options
-rw-r--r-- | fb-gui.c | 1 | ||||
-rw-r--r-- | fbi.c | 2 | ||||
-rw-r--r-- | fbpdf.c | 6 | ||||
-rw-r--r-- | fbtools.c | 18 | ||||
-rw-r--r-- | filter.c | 46 | ||||
-rw-r--r-- | gfx.c | 2 | ||||
-rw-r--r-- | gfx.h | 1 | ||||
-rw-r--r-- | meson.build | 8 | ||||
-rw-r--r-- | op.c | 56 | ||||
-rw-r--r-- | rd/read-bmp.c | 31 | ||||
-rw-r--r-- | rd/read-gif.c | 14 | ||||
-rw-r--r-- | rd/read-jpeg.c | 14 | ||||
-rw-r--r-- | rd/read-png.c | 14 | ||||
-rw-r--r-- | readers.c | 6 | ||||
-rw-r--r-- | vt.c | 31 |
15 files changed, 133 insertions, 117 deletions
@@ -6,7 +6,6 @@ #include <wchar.h> #include <inttypes.h> #include <sys/ioctl.h> -#include <linux/fb.h> #include <pixman.h> @@ -1151,7 +1151,7 @@ static void flist_img_load(struct flist *f, int prefetch) /* ---------------------------------------------------------------------- */ -static jmp_buf fb_fatal_cleanup; +static sigjmp_buf fb_fatal_cleanup; static void catch_exit_signal(int signal) { @@ -26,10 +26,6 @@ #include <sys/time.h> #include <sys/ioctl.h> -#include <linux/kd.h> -#include <linux/vt.h> -#include <linux/fb.h> - #include <poppler.h> #include <cairo.h> @@ -153,7 +149,7 @@ static void page_render(void) /* ---------------------------------------------------------------------- */ -static jmp_buf fb_fatal_cleanup; +static sigjmp_buf fb_fatal_cleanup; static void catch_exit_signal(int signal) { @@ -18,14 +18,16 @@ #include <sys/wait.h> #include <sys/stat.h> -#include <linux/kd.h> -#include <linux/vt.h> -#include <linux/fb.h> - #include "vt.h" #include "fbtools.h" #include "logind.h" +#ifdef SYSTEM_LINUX + +#include <linux/kd.h> +#include <linux/vt.h> +#include <linux/fb.h> + /* -------------------------------------------------------------------- */ /* internal variables */ @@ -330,3 +332,11 @@ gfxstate* fb_init(const char *device, char *mode) fb_cleanup_display(); exit(1); } + +#else /* SYSTEM_LINUX */ + +gfxstate* fb_init(const char *device, char *mode) +{ + return NULL; +} +#endif @@ -198,9 +198,9 @@ op_sharpe_work(struct ida_image *src, struct ida_rect *rect, unsigned char *dst, int line, void *data) { static struct op_3x3_parm laplace = { - f1: { 1, 1, 1 }, - f2: { 1, -8, 1 }, - f3: { 1, 1, 1 }, + .f1 = { 1, 1, 1 }, + .f2 = { 1, -8, 1 }, + .f3 = { 1, 1, 1 }, }; struct op_sharpe_handle *h = data; unsigned char *scanline; @@ -460,32 +460,32 @@ op_rotate_done(void *data) /* ----------------------------------------------------------------------- */ struct ida_op desc_grayscale = { - name: "grayscale", - init: op_none_init, - work: op_grayscale, - done: op_none_done, + .name = "grayscale", + .init = op_none_init, + .work = op_grayscale, + .done = op_none_done, }; struct ida_op desc_3x3 = { - name: "3x3", - init: op_3x3_init, - work: op_3x3_work, - done: op_3x3_free, + .name = "3x3", + .init = op_3x3_init, + .work = op_3x3_work, + .done = op_3x3_free, }; struct ida_op desc_sharpe = { - name: "sharpe", - init: op_sharpe_init, - work: op_sharpe_work, - done: op_sharpe_free, + .name = "sharpe", + .init = op_sharpe_init, + .work = op_sharpe_work, + .done = op_sharpe_free, }; struct ida_op desc_resize = { - name: "resize", - init: op_resize_init, - work: op_resize_work, - done: op_resize_done, + .name = "resize", + .init = op_resize_init, + .work = op_resize_work, + .done = op_resize_done, }; struct ida_op desc_rotate = { - name: "rotate", - init: op_rotate_init, - work: op_rotate_work, - done: op_rotate_done, + .name = "rotate", + .init = op_rotate_init, + .work = op_rotate_work, + .done = op_rotate_done, }; @@ -1,11 +1,11 @@ #include <stdlib.h> -#include <endian.h> #include <fcntl.h> #include <sys/types.h> #include <libdrm/drm_fourcc.h> #include "gfx.h" +#include "byteorder.h" gfxfmt fmt_list[] = { { @@ -1,5 +1,6 @@ #include <stdbool.h> #include <inttypes.h> +#include <sys/stat.h> /* dev_t */ #include <pixman.h> #include <cairo.h> diff --git a/meson.build b/meson.build index 590fed8..cf00f6d 100644 --- a/meson.build +++ b/meson.build @@ -3,7 +3,6 @@ project('fbida', 'c', default_options : [ 'c_std=gnu99' ]) # tweak warnings add_global_arguments('-Wno-pointer-sign', language : 'c') -add_global_arguments('-D_POSIX_SOURCE=1', language : 'c') add_global_arguments('-D_GNU_SOURCE=1', language : 'c') # init configuration @@ -35,6 +34,7 @@ systemd_dep = dependency('libsystemd', required : false, version : '>=221') cc = meson.get_compiler('c') jpeg_dep = cc.find_library('jpeg') util_dep = cc.find_library('util') +iconv_dep = cc.find_library('iconv', required : false) math_dep = cc.find_library('m', required : false) pcd_dep = cc.find_library('pcd', required : false) gif_dep = cc.find_library('gif', required : false) @@ -96,7 +96,7 @@ fbi_srcs = [ 'fbi.c', 'fb-gui.c', 'desktop.c', 'filter.c', 'op.c', 'jpegtools.c', trans_src, read_srcs ] fbi_deps = [ drm_dep, pixman_dep, cairo_dep, - exif_dep, image_deps, + exif_dep, image_deps, iconv_dep, math_dep, udev_dep, input_dep, xkb_dep, systemd_dep ] executable('fbi', @@ -143,7 +143,7 @@ fbcon_srcs = [ 'fbcon.c', 'drmtools.c', 'fbtools.c', 'gfx.c', fbcon_deps = [ drm_dep, cairo_dep, util_dep, udev_dep, input_dep, xkb_dep, glib_dep, tsm_dep, systemd_dep ] -if tsm_dep.found() +if tsm_dep.found() and target_machine.system() == 'linux' executable('fbcon', sources : fbcon_srcs, dependencies : fbcon_deps, @@ -182,7 +182,7 @@ ida_srcs = [ 'ida.c', 'man.c', 'hex.c', 'x11.c', 'viewer.c', trans_src, read_srcs, write_srcs, 'rd/read-xwd.c', 'rd/read-xpm.c', ida_ad, ida_logo ] -ida_deps = [ pixman_dep, exif_dep, image_deps, math_dep, +ida_deps = [ pixman_dep, exif_dep, image_deps, iconv_dep, math_dep, motif_dep, xpm_dep, xt_dep, xext_dep, x11_dep ] if motif_dep.found() @@ -250,44 +250,44 @@ void op_free_done(void *data) { free(data); } /* ----------------------------------------------------------------------- */ struct ida_op desc_flip_vert = { - name: "flip-vert", - init: op_none_init, - work: op_flip_vert, - done: op_none_done, + .name = "flip-vert", + .init = op_none_init, + .work = op_flip_vert, + .done = op_none_done, }; struct ida_op desc_flip_horz = { - name: "flip-horz", - init: op_none_init, - work: op_flip_horz, - done: op_none_done, + .name = "flip-horz", + .init = op_none_init, + .work = op_flip_horz, + .done = op_none_done, }; struct ida_op desc_rotate_cw = { - name: "rotate-cw", - init: op_rotate_init, - work: op_rotate_cw, - done: op_none_done, + .name = "rotate-cw", + .init = op_rotate_init, + .work = op_rotate_cw, + .done = op_none_done, }; struct ida_op desc_rotate_ccw = { - name: "rotate-ccw", - init: op_rotate_init, - work: op_rotate_ccw, - done: op_none_done, + .name = "rotate-ccw", + .init = op_rotate_init, + .work = op_rotate_ccw, + .done = op_none_done, }; struct ida_op desc_invert = { - name: "invert", - init: op_none_init, - work: op_invert, - done: op_none_done, + .name = "invert", + .init = op_none_init, + .work = op_invert, + .done = op_none_done, }; struct ida_op desc_crop = { - name: "crop", - init: op_crop_init, - work: op_crop_work, - done: op_none_done, + .name = "crop", + .init = op_crop_init, + .work = op_crop_work, + .done = op_none_done, }; struct ida_op desc_autocrop = { - name: "autocrop", - init: op_autocrop_init, - work: op_crop_work, - done: op_none_done, + .name = "autocrop", + .init = op_autocrop_init, + .work = op_crop_work, + .done = op_none_done, }; diff --git a/rd/read-bmp.c b/rd/read-bmp.c index f92a808..8008a41 100644 --- a/rd/read-bmp.c +++ b/rd/read-bmp.c @@ -3,30 +3,15 @@ #include <stddef.h> #include <string.h> #include <errno.h> -#include <endian.h> #include "readers.h" +#include "byteorder.h" /* ---------------------------------------------------------------------- */ typedef unsigned int uint32; typedef unsigned short uint16; -/* bitmap files are little endian */ -#if BYTE_ORDER == LITTLE_ENDIAN -# define le16_to_cpu(x) (x) -# define le32_to_cpu(x) (x) -#elif BYTE_ORDER == BIG_ENDIAN -# define le16_to_cpu(x) (((x>>8) & 0x00ff) |\ - ((x<<8) & 0xff00)) -# define le32_to_cpu(x) (((x>>24) & 0x000000ff) |\ - ((x>>8) & 0x0000ff00) |\ - ((x<<8) & 0x00ff0000) |\ - ((x<<24) & 0xff000000)) -#else -# error "Oops: unknown byte order" -#endif - /* ---------------------------------------------------------------------- */ /* load */ @@ -200,13 +185,13 @@ bmp_done(void *data) } static struct ida_loader bmp_loader = { - magic: "BM", - moff: 0, - mlen: 2, - name: "bmp", - init: bmp_init, - read: bmp_read, - done: bmp_done, + .magic = "BM", + .moff = 0, + .mlen = 2, + .name = "bmp", + .init = bmp_init, + .read = bmp_read, + .done = bmp_done, }; static void __init init_rd(void) diff --git a/rd/read-gif.c b/rd/read-gif.c index 27c53a8..f747b88 100644 --- a/rd/read-gif.c +++ b/rd/read-gif.c @@ -220,13 +220,13 @@ gif_done(void *data) } static struct ida_loader gif_loader = { - magic: "GIF", - moff: 0, - mlen: 3, - name: "giflib", - init: gif_init, - read: gif_read, - done: gif_done, + .magic = "GIF", + .moff = 0, + .mlen = 3, + .name = "giflib", + .init = gif_init, + .read = gif_read, + .done = gif_done, }; static void __init init_rd(void) diff --git a/rd/read-jpeg.c b/rd/read-jpeg.c index b6b13f6..b42b574 100644 --- a/rd/read-jpeg.c +++ b/rd/read-jpeg.c @@ -194,13 +194,13 @@ jpeg_done(void *data) } struct ida_loader jpeg_loader = { - magic: "\xff\xd8", - moff: 0, - mlen: 2, - name: "libjpeg", - init: jpeg_init, - read: jpeg_read, - done: jpeg_done, + .magic = "\xff\xd8", + .moff = 0, + .mlen = 2, + .name = "libjpeg", + .init = jpeg_init, + .read = jpeg_read, + .done = jpeg_done, }; static void __init init_rd(void) diff --git a/rd/read-png.c b/rd/read-png.c index f06ed6d..618c6f5 100644 --- a/rd/read-png.c +++ b/rd/read-png.c @@ -150,13 +150,13 @@ png_done(void *data) } static struct ida_loader png_loader = { - magic: "\x89PNG", - moff: 0, - mlen: 4, - name: "libpng", - init: png_init, - read: png_read, - done: png_done, + .magic = "\x89PNG", + .moff = 0, + .mlen = 4, + .name = "libpng", + .init = png_init, + .read = png_read, + .done = png_done, }; static void __init init_rd(void) @@ -3,9 +3,9 @@ #include <stddef.h> #include <string.h> #include <assert.h> -#include <endian.h> #include "readers.h" +#include "byteorder.h" /* ----------------------------------------------------------------------- */ @@ -13,7 +13,7 @@ void load_bits_lsb(unsigned char *dst, unsigned char *src, int width, int on, int off) { int i,mask,bit; - + for (i = 0; i < width; i++) { mask = 1 << (i & 0x07); bit = src[i>>3] & mask; @@ -28,7 +28,7 @@ void load_bits_msb(unsigned char *dst, unsigned char *src, int width, int on, int off) { int i,mask,bit; - + for (i = 0; i < width; i++) { mask = 1 << (7 - (i & 0x07)); bit = src[i>>3] & mask; @@ -8,13 +8,15 @@ #include <signal.h> #include <sys/ioctl.h> -#include <linux/kd.h> -#include <linux/vt.h> - #include "vt.h" /* -------------------------------------------------------------------- */ +#ifdef SYSTEM_LINUX + +#include <linux/kd.h> +#include <linux/vt.h> + #define CONSOLE_ACTIVE 0 #define CONSOLE_REL_REQ 1 #define CONSOLE_INACTIVE 2 @@ -167,3 +169,26 @@ int console_activate_current(void) } return 0; } + +/* -------------------------------------------------------------------- */ + +#else /* SYSTEM_LINUX */ + +int console_visible = 1; + +int console_switch_init(void (*suspend)(void), + void (*resume)(void)) +{ + return -1; +} + +void console_switch_cleanup(void) +{ +} + +int check_console_switch(void) +{ + return 0; +} + +#endif /* SYSTEM_LINUX */ |