summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDennis Real <github@tildepipe.org>2012-03-07 17:18:07 +0100
committerDennis Real <github@tildepipe.org>2012-03-07 17:18:07 +0100
commit77fa5aca182435f2771511832ea198d027393ceb (patch)
tree60f98ece1a21b9bcdde21503871d290c3b9d3a2a /src
parent93a90e60d0cf093ca71c34f4f5dbfde974f433f0 (diff)
parent3b2756bf2517f41b319adf9b3155efd1486a801b (diff)
Merge branch 'master' of git://github.com/derf/feh
Diffstat (limited to 'src')
-rw-r--r--src/imlib.c4
-rw-r--r--src/menu.c354
-rw-r--r--src/menu.h11
3 files changed, 157 insertions, 212 deletions
diff --git a/src/imlib.c b/src/imlib.c
index 1b17b49..c0252c3 100644
--- a/src/imlib.c
+++ b/src/imlib.c
@@ -1108,7 +1108,7 @@ void feh_edit_inplace_lossless(winwidget w, int op)
"-outfile", file_str, file_str, NULL);
im_weprintf(w, "lossless %s: Is 'jpegtran' installed? Failed to exec:", op_name);
- return;
+ exit(1);
} else {
waitpid(pid, &status, 0);
@@ -1118,9 +1118,11 @@ void feh_edit_inplace_lossless(winwidget w, int op)
" Commandline was: "
"jpegtran -copy all %s %s -outfile %s %s",
op_name, status >> 8, op_op, op_value, file_str, file_str);
+ free(file_str);
return;
}
}
+ free(file_str);
}
void feh_draw_actions(winwidget w)
diff --git a/src/menu.c b/src/menu.c
index b90161d..ecf98dd 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -45,7 +45,7 @@ static feh_menu *feh_menu_func_gen_info(feh_menu * m);
static void feh_menu_func_free_info(feh_menu * m);
static void feh_menu_func_free_options(feh_menu * m);
static feh_menu *feh_menu_func_gen_options(feh_menu * m);
-void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, void *data);
+void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, unsigned short data);
void feh_menu_cb_opt_fullscreen(feh_menu * m, feh_menu_item * i);
enum {
@@ -99,7 +99,7 @@ feh_menu *feh_menu_new(void)
m->updates = NULL;
m->needs_redraw = 1;
m->func_free = NULL;
- m->data = NULL;
+ m->data = 0;
m->calc = 0;
m->bg = NULL;
@@ -141,8 +141,6 @@ void feh_menu_free(feh_menu * m)
ii = i;
i = i->next;
- if (ii->func_free)
- (ii->func_free) (ii->data);
if (ii->text)
free(ii->text);
if (ii->submenu)
@@ -513,26 +511,25 @@ void feh_menu_show(feh_menu * m)
}
feh_menu_item *feh_menu_add_toggle_entry(feh_menu * m, char *text,
- Imlib_Image icon, char *submenu, int action,
- void *data, void (*func_free) (void *data), int setting)
+ char *submenu, int action,
+ unsigned short data, void (*func_free) (void *data), int setting)
{
feh_menu_item *mi;
- mi = feh_menu_add_entry(m, text, icon, submenu, action, data, func_free);
+ mi = feh_menu_add_entry(m, text, submenu, action, data, func_free);
mi->is_toggle = TRUE;
MENU_ITEM_TOGGLE_SET(mi, setting);
return(mi);
}
-feh_menu_item *feh_menu_add_entry(feh_menu * m, char *text, Imlib_Image icon,
- char *submenu, int action, void *data, void (*func_free) (void *data))
+feh_menu_item *feh_menu_add_entry(feh_menu * m, char *text, char *submenu,
+ int action, unsigned short data, void (*func_free) (void *data))
{
feh_menu_item *mi, *ptr;
mi = (feh_menu_item *) emalloc(sizeof(feh_menu_item));
mi->state = MENU_ITEM_STATE_NORMAL;
- mi->icon = icon;
mi->is_toggle = FALSE;
if (text)
mi->text = estrdup(text);
@@ -584,8 +581,8 @@ void feh_menu_calc_size(feh_menu * m)
{
int prev_w, prev_h;
feh_menu_item *i;
- int j = 0, count = 0, max_w = 0, max_h = 0, icon_w = 0, next_w = 0;
- int toggle_w = 0;
+ int j = 0, count = 0, max_w = 0, max_h = 0, next_w = 0;
+ int toggle_w = 1;
prev_w = m->w;
prev_h = m->h;
@@ -612,33 +609,12 @@ void feh_menu_calc_size(feh_menu * m)
count++;
}
- for (i = m->items; i; i = i->next) {
- if (i->icon) {
- Imlib_Image im;
-
- im = i->icon;
- if (im) {
- int iw, ih, ow;
-
- iw = gib_imlib_image_get_width(im);
- ih = gib_imlib_image_get_height(im);
- if (ih <= max_h) {
- ow = iw;
- } else {
- ow = (iw * max_h) / ih;
- }
- if (ow > icon_w)
- icon_w = ow;
- }
- }
- }
m->h = FEH_MENU_PAD_TOP;
for (i = m->items; i; i = i->next) {
i->x = FEH_MENU_PAD_LEFT;
i->y = m->h;
- i->w = max_w + icon_w + toggle_w + next_w;
- i->icon_x = FEH_MENUITEM_PAD_LEFT;
- i->toggle_x = i->icon_x + icon_w;
+ i->w = max_w + toggle_w + next_w;
+ i->toggle_x = 1;
i->text_x = i->toggle_x + toggle_w;
i->sub_x = i->text_x + max_w;
if (i->text)
@@ -649,7 +625,7 @@ void feh_menu_calc_size(feh_menu * m)
j++;
}
m->h += FEH_MENU_PAD_BOTTOM;
- m->w = next_w + toggle_w + icon_w + max_w + FEH_MENU_PAD_LEFT + FEH_MENU_PAD_RIGHT;
+ m->w = next_w + toggle_w + max_w + FEH_MENU_PAD_LEFT + FEH_MENU_PAD_RIGHT;
if ((prev_w != m->w) || (prev_h != m->h)) {
if (m->pmap)
@@ -702,39 +678,6 @@ void feh_menu_draw_item(feh_menu_item * i, Imlib_Image im, int ox, int oy)
gib_imlib_text_draw(im, opt.menu_fn, opt.menu_style_l,
i->x - ox + i->text_x, i->y - oy + FEH_MENUITEM_PAD_TOP,
i->text, IMLIB_TEXT_TO_RIGHT, 0, 0, 0, 255);
- if (i->icon) {
- Imlib_Image im2;
-
- D(("icon item\n"));
-
- im2 = i->icon;
- if (im2) {
- int iw, ih, ow, oh;
-
- iw = gib_imlib_image_get_width(im2);
- ih = gib_imlib_image_get_height(im2);
- if (ih <= (i->h - FEH_MENUITEM_PAD_TOP - FEH_MENUITEM_PAD_BOTTOM)) {
- ow = iw;
- oh = ih;
- } else {
- ow = (iw * (i->h - FEH_MENUITEM_PAD_TOP - FEH_MENUITEM_PAD_BOTTOM)) / ih;
- oh = i->h - FEH_MENUITEM_PAD_TOP - FEH_MENUITEM_PAD_BOTTOM;
- }
- gib_imlib_blend_image_onto_image(im, im2,
- 0, 0, 0,
- iw, ih,
- i->x +
- i->icon_x -
- ox,
- i->y +
- FEH_MENUITEM_PAD_TOP
- +
- (((i->h -
- FEH_MENUITEM_PAD_TOP - FEH_MENUITEM_PAD_BOTTOM)
- - oh) / 2) - oy, ow, oh, 1, 1, 1);
- gib_imlib_free_image(im2);
- }
- }
if (i->submenu) {
D(("submenu item\n"));
feh_menu_draw_submenu_at(i->x + i->sub_x,
@@ -870,6 +813,7 @@ void feh_menu_draw_submenu_at(int x, int y, Imlib_Image dst, int ox, int oy)
imlib_image_fill_polygon(poly);
imlib_polygon_free(poly);
+
poly = imlib_polygon_new();
imlib_polygon_add_point(poly, x, y + 3);
imlib_polygon_add_point(poly, x + 3, y + 6);
@@ -939,32 +883,32 @@ void feh_menu_init_main(void)
menu_main = feh_menu_new();
menu_main->name = estrdup("MAIN");
- feh_menu_add_entry(menu_main, "File", NULL, "FILE", 0, NULL, NULL);
+ feh_menu_add_entry(menu_main, "File", "FILE", 0, 0, NULL);
if (opt.slideshow || opt.multiwindow) {
- feh_menu_add_entry(menu_main, "Sort List", NULL, "SORT", 0, NULL, NULL);
- mi = feh_menu_add_entry(menu_main, "Image Info", NULL, "INFO", 0, NULL, NULL);
+ feh_menu_add_entry(menu_main, "Sort List", "SORT", 0, 0, NULL);
+ mi = feh_menu_add_entry(menu_main, "Image Info", "INFO", 0, 0, NULL);
mi->func_gen_sub = feh_menu_func_gen_info;
- feh_menu_add_entry(menu_main, NULL, NULL, NULL, 0, NULL, NULL);
+ feh_menu_add_entry(menu_main, NULL, NULL, 0, 0, NULL);
}
- mi = feh_menu_add_entry(menu_main, "Options", NULL, "OPTIONS", 0, NULL, NULL);
+ mi = feh_menu_add_entry(menu_main, "Options", "OPTIONS", 0, 0, NULL);
mi->func_gen_sub = feh_menu_func_gen_options;
if (opt.multiwindow)
- feh_menu_add_entry(menu_main, "Close", NULL, NULL, CB_CLOSE, NULL, NULL);
- feh_menu_add_entry(menu_main, "Exit", NULL, NULL, CB_EXIT, NULL, NULL);
+ feh_menu_add_entry(menu_main, "Close", NULL, CB_CLOSE, 0, NULL);
+ feh_menu_add_entry(menu_main, "Exit", NULL, CB_EXIT, 0, NULL);
m = feh_menu_new();
m->name = estrdup("FILE");
- feh_menu_add_entry(m, "Reset", NULL, NULL, CB_RESET, NULL, NULL);
- feh_menu_add_entry(m, "Resize Window", NULL, NULL, CB_FIT, NULL, NULL);
- feh_menu_add_entry(m, "Reload", NULL, NULL, CB_RELOAD, NULL, NULL);
- feh_menu_add_entry(m, "Save Image", NULL, NULL, CB_SAVE_IMAGE, NULL, NULL);
- feh_menu_add_entry(m, "Save List", NULL, NULL, CB_SAVE_FILELIST, NULL, NULL);
- feh_menu_add_entry(m, "Edit in Place", NULL, "EDIT", 0, NULL, NULL);
- feh_menu_add_entry(m, "Background", NULL, "BACKGROUND", 0, NULL, NULL);
- feh_menu_add_entry(m, NULL, NULL, NULL, 0, NULL, NULL);
- feh_menu_add_entry(m, "Hide", NULL, NULL, CB_REMOVE, NULL, NULL);
- feh_menu_add_entry(m, "Delete", NULL, "CONFIRM", 0, NULL, NULL);
+ feh_menu_add_entry(m, "Reset", NULL, CB_RESET, 0, NULL);
+ feh_menu_add_entry(m, "Resize Window", NULL, CB_FIT, 0, NULL);
+ feh_menu_add_entry(m, "Reload", NULL, CB_RELOAD, 0, NULL);
+ feh_menu_add_entry(m, "Save Image", NULL, CB_SAVE_IMAGE, 0, NULL);
+ feh_menu_add_entry(m, "Save List", NULL, CB_SAVE_FILELIST, 0, NULL);
+ feh_menu_add_entry(m, "Edit in Place", "EDIT", 0, 0, NULL);
+ feh_menu_add_entry(m, "Background", "BACKGROUND", 0, 0, NULL);
+ feh_menu_add_entry(m, NULL, NULL, 0, 0, NULL);
+ feh_menu_add_entry(m, "Hide", NULL, CB_REMOVE, 0, NULL);
+ feh_menu_add_entry(m, "Delete", "CONFIRM", 0, 0, NULL);
return;
}
@@ -994,42 +938,42 @@ void feh_menu_init_common()
m = feh_menu_new();
m->name = estrdup("SORT");
- feh_menu_add_entry(m, "By File Name", NULL, NULL, CB_SORT_FILENAME, NULL, NULL);
- feh_menu_add_entry(m, "By Image Name", NULL, NULL, CB_SORT_IMAGENAME, NULL, NULL);
+ feh_menu_add_entry(m, "By File Name", NULL, CB_SORT_FILENAME, 0, NULL);
+ feh_menu_add_entry(m, "By Image Name", NULL, CB_SORT_IMAGENAME, 0, NULL);
if (opt.preload || (opt.sort > SORT_FILENAME))
- feh_menu_add_entry(m, "By File Size", NULL, NULL, CB_SORT_FILESIZE, NULL, NULL);
- feh_menu_add_entry(m, "Randomize", NULL, NULL, CB_SORT_RANDOMIZE, NULL, NULL);
+ feh_menu_add_entry(m, "By File Size", NULL, CB_SORT_FILESIZE, 0, NULL);
+ feh_menu_add_entry(m, "Randomize", NULL, CB_SORT_RANDOMIZE, 0, NULL);
m = feh_menu_new();
m->name = estrdup("CONFIRM");
- feh_menu_add_entry(m, "Confirm", NULL, NULL, CB_DELETE, NULL, NULL);
+ feh_menu_add_entry(m, "Confirm", NULL, CB_DELETE, 0, NULL);
m = feh_menu_new();
m->name = estrdup("EDIT");
- feh_menu_add_entry(m, "Rotate 90 CW", NULL, NULL, CB_EDIT_ROTATE, (void *) 1, NULL);
- feh_menu_add_entry(m, "Rotate 180", NULL, NULL, CB_EDIT_ROTATE, (void *) 2, NULL);
- feh_menu_add_entry(m, "Rotate 90 CCW", NULL, NULL, CB_EDIT_ROTATE, (void *) 3, NULL);
+ feh_menu_add_entry(m, "Rotate 90 CW", NULL, CB_EDIT_ROTATE, 1, NULL);
+ feh_menu_add_entry(m, "Rotate 180", NULL, CB_EDIT_ROTATE, 2, NULL);
+ feh_menu_add_entry(m, "Rotate 90 CCW", NULL, CB_EDIT_ROTATE, 3, NULL);
menu_bg = feh_menu_new();
menu_bg->name = estrdup("BACKGROUND");
num_desks = feh_wm_get_num_desks();
if (num_desks > 1) {
- feh_menu_add_entry(menu_bg, "Set Tiled", NULL, "TILED", 0, NULL, NULL);
- feh_menu_add_entry(menu_bg, "Set Scaled", NULL, "SCALED", 0, NULL, NULL);
- feh_menu_add_entry(menu_bg, "Set Centered", NULL, "CENTERED", 0, NULL, NULL);
- feh_menu_add_entry(menu_bg, "Set Filled", NULL, "FILLED", 0, NULL, NULL);
+ feh_menu_add_entry(menu_bg, "Set Tiled", "TILED", 0, 0, NULL);
+ feh_menu_add_entry(menu_bg, "Set Scaled", "SCALED", 0, 0, NULL);
+ feh_menu_add_entry(menu_bg, "Set Centered", "CENTERED", 0, 0, NULL);
+ feh_menu_add_entry(menu_bg, "Set Filled", "FILLED", 0, 0, NULL);
m = feh_menu_new();
m->name = estrdup("TILED");
for (i = 0; i < num_desks; i++) {
snprintf(buf, sizeof(buf), "Desktop %d", i + 1);
if (opt.slideshow || opt.multiwindow)
- feh_menu_add_entry(m, buf, NULL, NULL, CB_BG_TILED,
- (void *) i, NULL);
+ feh_menu_add_entry(m, buf, NULL, CB_BG_TILED,
+ i, NULL);
else
- feh_menu_add_entry(m, buf, NULL, NULL, CB_BG_TILED_NOFILE,
- (void *) i, NULL);
+ feh_menu_add_entry(m, buf, NULL, CB_BG_TILED_NOFILE,
+ i, NULL);
}
m = feh_menu_new();
@@ -1038,11 +982,11 @@ void feh_menu_init_common()
snprintf(buf, sizeof(buf), "Desktop %d", i + 1);
if (opt.slideshow || opt.multiwindow)
- feh_menu_add_entry(m, buf, NULL, NULL, CB_BG_SCALED,
- (void *) i, NULL);
+ feh_menu_add_entry(m, buf, NULL, CB_BG_SCALED,
+ i, NULL);
else
- feh_menu_add_entry(m, buf, NULL, NULL, CB_BG_SCALED_NOFILE,
- (void *) i, NULL);
+ feh_menu_add_entry(m, buf, NULL, CB_BG_SCALED_NOFILE,
+ i, NULL);
}
m = feh_menu_new();
@@ -1050,11 +994,11 @@ void feh_menu_init_common()
for (i = 0; i < num_desks; i++) {
snprintf(buf, sizeof(buf), "Desktop %d", i + 1);
if (opt.slideshow || opt.multiwindow)
- feh_menu_add_entry(m, buf, NULL, NULL,
- CB_BG_CENTERED, (void *) i, NULL);
+ feh_menu_add_entry(m, buf, NULL,
+ CB_BG_CENTERED, i, NULL);
else
- feh_menu_add_entry(m, buf, NULL, NULL,
- CB_BG_CENTERED_NOFILE, (void *) i, NULL);
+ feh_menu_add_entry(m, buf, NULL,
+ CB_BG_CENTERED_NOFILE, i, NULL);
}
m = feh_menu_new();
@@ -1062,33 +1006,33 @@ void feh_menu_init_common()
for (i = 0; i < num_desks; i++) {
snprintf(buf, sizeof(buf), "Desktop %d", i + 1);
if (opt.slideshow || opt.multiwindow)
- feh_menu_add_entry(m, buf, NULL, NULL,
+ feh_menu_add_entry(m, buf, NULL,
CB_BG_FILLED,
- (void *) i, NULL);
+ i, NULL);
else
- feh_menu_add_entry(m, buf, NULL, NULL,
+ feh_menu_add_entry(m, buf, NULL,
CB_BG_FILLED_NOFILE,
- (void *) i, NULL);
+ i, NULL);
}
} else {
if (opt.slideshow || opt.multiwindow) {
- feh_menu_add_entry(menu_bg, "Set Tiled", NULL,
- NULL, CB_BG_TILED, NULL, NULL);
- feh_menu_add_entry(menu_bg, "Set Scaled", NULL,
- NULL, CB_BG_SCALED, NULL, NULL);
- feh_menu_add_entry(menu_bg, "Set Centered", NULL,
- NULL, CB_BG_CENTERED, NULL, NULL);
- feh_menu_add_entry(menu_bg, "Set Filled", NULL,
- NULL, CB_BG_FILLED, NULL, NULL);
+ feh_menu_add_entry(menu_bg, "Set Tiled",
+ NULL, CB_BG_TILED, 0, NULL);
+ feh_menu_add_entry(menu_bg, "Set Scaled",
+ NULL, CB_BG_SCALED, 0, NULL);
+ feh_menu_add_entry(menu_bg, "Set Centered",
+ NULL, CB_BG_CENTERED, 0, NULL);
+ feh_menu_add_entry(menu_bg, "Set Filled",
+ NULL, CB_BG_FILLED, 0, NULL);
} else {
- feh_menu_add_entry(menu_bg, "Set Tiled", NULL,
- NULL, CB_BG_TILED_NOFILE, NULL, NULL);
- feh_menu_add_entry(menu_bg, "Set Scaled", NULL,
- NULL, CB_BG_SCALED_NOFILE, NULL, NULL);
- feh_menu_add_entry(menu_bg, "Set Centered", NULL,
- NULL, CB_BG_CENTERED_NOFILE, NULL, NULL);
- feh_menu_add_entry(menu_bg, "Set Filled", NULL,
- NULL, CB_BG_FILLED_NOFILE, NULL, NULL);
+ feh_menu_add_entry(menu_bg, "Set Tiled",
+ NULL, CB_BG_TILED_NOFILE, 0, NULL);
+ feh_menu_add_entry(menu_bg, "Set Scaled",
+ NULL, CB_BG_SCALED_NOFILE, 0, NULL);
+ feh_menu_add_entry(menu_bg, "Set Centered",
+ NULL, CB_BG_CENTERED_NOFILE, 0, NULL);
+ feh_menu_add_entry(menu_bg, "Set Filled",
+ NULL, CB_BG_FILLED_NOFILE, 0, NULL);
}
}
common_menus = 1;
@@ -1107,29 +1051,29 @@ void feh_menu_init_single_win(void)
menu_single_win = feh_menu_new();
menu_single_win->name = estrdup("SINGLEWIN");
- feh_menu_add_entry(menu_single_win, "File", NULL, "SINGLEWIN_FILE", 0, NULL, NULL);
+ feh_menu_add_entry(menu_single_win, "File", "SINGLEWIN_FILE", 0, 0, NULL);
m = feh_menu_new();
m->name = estrdup("SINGLEWIN_FILE");
- feh_menu_add_entry(m, "Reset", NULL, NULL, CB_RESET, NULL, NULL);
- feh_menu_add_entry(m, "Resize Window", NULL, NULL, CB_FIT, NULL, NULL);
- feh_menu_add_entry(m, "Reload", NULL, NULL, CB_RELOAD, NULL, NULL);
- feh_menu_add_entry(m, "Save Image", NULL, NULL, CB_SAVE_IMAGE, NULL, NULL);
- feh_menu_add_entry(m, "Save List", NULL, NULL, CB_SAVE_FILELIST, NULL, NULL);
- feh_menu_add_entry(m, "Edit in Place", NULL, "EDIT", 0, NULL, NULL);
- feh_menu_add_entry(m, "Background", NULL, "BACKGROUND", 0, NULL, NULL);
+ feh_menu_add_entry(m, "Reset", NULL, CB_RESET, 0, NULL);
+ feh_menu_add_entry(m, "Resize Window", NULL, CB_FIT, 0, NULL);
+ feh_menu_add_entry(m, "Reload", NULL, CB_RELOAD, 0, NULL);
+ feh_menu_add_entry(m, "Save Image", NULL, CB_SAVE_IMAGE, 0, NULL);
+ feh_menu_add_entry(m, "Save List", NULL, CB_SAVE_FILELIST, 0, NULL);
+ feh_menu_add_entry(m, "Edit in Place", "EDIT", 0, 0, NULL);
+ feh_menu_add_entry(m, "Background", "BACKGROUND", 0, 0, NULL);
if (opt.multiwindow || opt.slideshow) {
- feh_menu_add_entry(m, NULL, NULL, NULL, 0, NULL, NULL);
- feh_menu_add_entry(m, "Hide", NULL, NULL, CB_REMOVE, NULL, NULL);
- feh_menu_add_entry(m, "Delete", NULL, "CONFIRM", 0, NULL, NULL);
+ feh_menu_add_entry(m, NULL, NULL, 0, 0, NULL);
+ feh_menu_add_entry(m, "Hide", NULL, CB_REMOVE, 0, NULL);
+ feh_menu_add_entry(m, "Delete", "CONFIRM", 0, 0, NULL);
}
- mi = feh_menu_add_entry(menu_single_win, "Image Info", NULL, "INFO", 0, NULL, NULL);
+ mi = feh_menu_add_entry(menu_single_win, "Image Info", "INFO", 0, 0, NULL);
mi->func_gen_sub = feh_menu_func_gen_info;
- feh_menu_add_entry(menu_single_win, NULL, NULL, NULL, 0, NULL, NULL);
- mi = feh_menu_add_entry(menu_single_win, "Options", NULL, "OPTIONS", 0, NULL, NULL);
+ feh_menu_add_entry(menu_single_win, NULL, NULL, 0, 0, NULL);
+ mi = feh_menu_add_entry(menu_single_win, "Options", "OPTIONS", 0, 0, NULL);
mi->func_gen_sub = feh_menu_func_gen_options;
- feh_menu_add_entry(menu_single_win, "Close", NULL, NULL, CB_CLOSE, NULL, NULL);
- feh_menu_add_entry(menu_single_win, "Exit", NULL, NULL, CB_EXIT, NULL, NULL);
+ feh_menu_add_entry(menu_single_win, "Close", NULL, CB_CLOSE, 0, NULL);
+ feh_menu_add_entry(menu_single_win, "Exit", NULL, CB_EXIT, 0, NULL);
return;
}
@@ -1145,19 +1089,19 @@ void feh_menu_init_thumbnail_win(void)
menu_thumbnail_win = feh_menu_new();
menu_thumbnail_win->name = estrdup("THUMBWIN");
- feh_menu_add_entry(menu_thumbnail_win, "File", NULL, "THUMBWIN_FILE", 0, NULL, NULL);
+ feh_menu_add_entry(menu_thumbnail_win, "File", "THUMBWIN_FILE", 0, 0, NULL);
m = feh_menu_new();
m->name = estrdup("THUMBWIN_FILE");
- feh_menu_add_entry(m, "Reset", NULL, NULL, CB_RESET, NULL, NULL);
- feh_menu_add_entry(m, "Resize Window", NULL, NULL, CB_FIT, NULL, NULL);
- feh_menu_add_entry(m, "Save Image", NULL, NULL, CB_SAVE_IMAGE, NULL, NULL);
- feh_menu_add_entry(m, "Save List", NULL, NULL, CB_SAVE_FILELIST, NULL, NULL);
- feh_menu_add_entry(m, "Background", NULL, "BACKGROUND", 0, NULL, NULL);
- feh_menu_add_entry(menu_thumbnail_win, NULL, NULL, NULL, 0, NULL, NULL);
- mi = feh_menu_add_entry(menu_thumbnail_win, "Options", NULL, "OPTIONS", 0, NULL, NULL);
+ feh_menu_add_entry(m, "Reset", NULL, CB_RESET, 0, NULL);
+ feh_menu_add_entry(m, "Resize Window", NULL, CB_FIT, 0, NULL);
+ feh_menu_add_entry(m, "Save Image", NULL, CB_SAVE_IMAGE, 0, NULL);
+ feh_menu_add_entry(m, "Save List", NULL, CB_SAVE_FILELIST, 0, NULL);
+ feh_menu_add_entry(m, "Background", "BACKGROUND", 0, 0, NULL);
+ feh_menu_add_entry(menu_thumbnail_win, NULL, NULL, 0, 0, NULL);
+ mi = feh_menu_add_entry(menu_thumbnail_win, "Options", "OPTIONS", 0, 0, NULL);
mi->func_gen_sub = feh_menu_func_gen_options;
- feh_menu_add_entry(menu_thumbnail_win, "Close", NULL, NULL, CB_CLOSE, NULL, NULL);
- feh_menu_add_entry(menu_thumbnail_win, "Exit", NULL, NULL, CB_EXIT, NULL, NULL);
+ feh_menu_add_entry(menu_thumbnail_win, "Close", NULL, CB_CLOSE, 0, NULL);
+ feh_menu_add_entry(menu_thumbnail_win, "Exit", NULL, CB_EXIT, 0, NULL);
return;
}
@@ -1172,32 +1116,32 @@ void feh_menu_init_thumbnail_viewer(void)
menu_thumbnail_viewer = feh_menu_new();
menu_thumbnail_viewer->name = estrdup("THUMBVIEW");
- feh_menu_add_entry(menu_thumbnail_viewer, "File", NULL, "THUMBVIEW_FILE",
- 0, NULL, NULL);
+ feh_menu_add_entry(menu_thumbnail_viewer, "File", "THUMBVIEW_FILE",
+ 0, 0, NULL);
m = feh_menu_new();
m->name = estrdup("THUMBVIEW_FILE");
- feh_menu_add_entry(m, "Reset", NULL, NULL, CB_RESET, NULL, NULL);
- feh_menu_add_entry(m, "Resize Window", NULL, NULL, CB_FIT, NULL, NULL);
- feh_menu_add_entry(m, "Reload", NULL, NULL, CB_RELOAD, NULL, NULL);
- feh_menu_add_entry(m, "Save Image", NULL, NULL, CB_SAVE_IMAGE, NULL, NULL);
- feh_menu_add_entry(m, "Save List", NULL, NULL, CB_SAVE_FILELIST, NULL, NULL);
- feh_menu_add_entry(m, "Edit in Place", NULL, "EDIT", 0, NULL, NULL);
- feh_menu_add_entry(m, "Background", NULL, "BACKGROUND", 0, NULL, NULL);
- feh_menu_add_entry(m, NULL, NULL, NULL, 0, NULL, NULL);
- feh_menu_add_entry(m, "Hide", NULL, NULL, CB_REMOVE_THUMB, NULL, NULL);
- feh_menu_add_entry(m, "Delete", NULL, "THUMBVIEW_CONFIRM", 0, NULL, NULL);
- mi = feh_menu_add_entry(menu_thumbnail_viewer, "Image Info", NULL,
- "INFO", 0, NULL, NULL);
+ feh_menu_add_entry(m, "Reset", NULL, CB_RESET, 0, NULL);
+ feh_menu_add_entry(m, "Resize Window", NULL, CB_FIT, 0, NULL);
+ feh_menu_add_entry(m, "Reload", NULL, CB_RELOAD, 0, NULL);
+ feh_menu_add_entry(m, "Save Image", NULL, CB_SAVE_IMAGE, 0, NULL);
+ feh_menu_add_entry(m, "Save List", NULL, CB_SAVE_FILELIST, 0, NULL);
+ feh_menu_add_entry(m, "Edit in Place", "EDIT", 0, 0, NULL);
+ feh_menu_add_entry(m, "Background", "BACKGROUND", 0, 0, NULL);
+ feh_menu_add_entry(m, NULL, NULL, 0, 0, NULL);
+ feh_menu_add_entry(m, "Hide", NULL, CB_REMOVE_THUMB, 0, NULL);
+ feh_menu_add_entry(m, "Delete", "THUMBVIEW_CONFIRM", 0, 0, NULL);
+ mi = feh_menu_add_entry(menu_thumbnail_viewer, "Image Info",
+ "INFO", 0, 0, NULL);
mi->func_gen_sub = feh_menu_func_gen_info;
- feh_menu_add_entry(menu_thumbnail_viewer, NULL, NULL, NULL, 0, NULL, NULL);
- mi = feh_menu_add_entry(menu_thumbnail_viewer, "Options", NULL,
- "OPTIONS", 0, NULL, NULL);
+ feh_menu_add_entry(menu_thumbnail_viewer, NULL, NULL, 0, 0, NULL);
+ mi = feh_menu_add_entry(menu_thumbnail_viewer, "Options",
+ "OPTIONS", 0, 0, NULL);
mi->func_gen_sub = feh_menu_func_gen_options;
- feh_menu_add_entry(menu_thumbnail_viewer, "Close", NULL, NULL, CB_CLOSE, NULL, NULL);
- feh_menu_add_entry(menu_thumbnail_viewer, "Exit", NULL, NULL, CB_EXIT, NULL, NULL);
+ feh_menu_add_entry(menu_thumbnail_viewer, "Close", NULL, CB_CLOSE, 0, NULL);
+ feh_menu_add_entry(menu_thumbnail_viewer, "Exit", NULL, CB_EXIT, 0, NULL);
m = feh_menu_new();
m->name = estrdup("THUMBVIEW_CONFIRM");
- feh_menu_add_entry(m, "Confirm", NULL, NULL, CB_DELETE_THUMB, NULL, NULL);
+ feh_menu_add_entry(m, "Confirm", NULL, CB_DELETE_THUMB, 0, NULL);
return;
}
@@ -1249,42 +1193,42 @@ void feh_menu_cb_opt_fullscreen(feh_menu * m, feh_menu_item * i)
#endif /* HAVE_LIBXINERAMA */
}
-void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, void *data)
+void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, unsigned short data)
{
char *path;
switch (action) {
case CB_BG_TILED:
path = feh_absolute_path(FEH_FILE(m->fehwin->file->data)->filename);
- feh_wm_set_bg(path, m->fehwin->im, 0, 0, 0, (int) data, 0);
+ feh_wm_set_bg(path, m->fehwin->im, 0, 0, 0, data, 0);
free(path);
break;
case CB_BG_SCALED:
path = feh_absolute_path(FEH_FILE(m->fehwin->file->data)->filename);
- feh_wm_set_bg(path, m->fehwin->im, 0, 1, 0, (int) data, 0);
+ feh_wm_set_bg(path, m->fehwin->im, 0, 1, 0, data, 0);
free(path);
break;
case CB_BG_CENTERED:
path = feh_absolute_path(FEH_FILE(m->fehwin->file->data)->filename);
- feh_wm_set_bg(path, m->fehwin->im, 1, 0, 0, (int) data, 0);
+ feh_wm_set_bg(path, m->fehwin->im, 1, 0, 0, data, 0);
free(path);
break;
case CB_BG_FILLED:
path = feh_absolute_path(FEH_FILE(m->fehwin->file->data)->filename);
- feh_wm_set_bg(path, m->fehwin->im, 0, 0, 1, (int) data, 0);
+ feh_wm_set_bg(path, m->fehwin->im, 0, 0, 1, data, 0);
free(path);
break;
case CB_BG_TILED_NOFILE:
- feh_wm_set_bg(NULL, m->fehwin->im, 0, 0, 0, (int) data, 0);
+ feh_wm_set_bg(NULL, m->fehwin->im, 0, 0, 0, data, 0);
break;
case CB_BG_SCALED_NOFILE:
- feh_wm_set_bg(NULL, m->fehwin->im, 0, 1, 0, (int) data, 0);
+ feh_wm_set_bg(NULL, m->fehwin->im, 0, 1, 0, data, 0);
break;
case CB_BG_CENTERED_NOFILE:
- feh_wm_set_bg(NULL, m->fehwin->im, 1, 0, 0, (int) data, 0);
+ feh_wm_set_bg(NULL, m->fehwin->im, 1, 0, 0, data, 0);
break;
case CB_BG_FILLED_NOFILE:
- feh_wm_set_bg(NULL, m->fehwin->im, 0, 0, 1, (int) data, 0);
+ feh_wm_set_bg(NULL, m->fehwin->im, 0, 0, 1, data, 0);
break;
case CB_CLOSE:
winwidget_destroy(m->fehwin);
@@ -1346,7 +1290,7 @@ void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, void *data)
winwidget_size_to_image(m->fehwin);
break;
case CB_EDIT_ROTATE:
- feh_edit_inplace(m->fehwin, (int) data);
+ feh_edit_inplace(m->fehwin, data);
break;
case CB_SAVE_IMAGE:
slideshow_save_image(m->fehwin);
@@ -1418,16 +1362,16 @@ static feh_menu *feh_menu_func_gen_info(feh_menu * m)
mm = feh_menu_new();
mm->name = estrdup("INFO");
snprintf(buffer, sizeof(buffer), "Filename: %s", file->name);
- feh_menu_add_entry(mm, buffer, NULL, NULL, 0, NULL, NULL);
+ feh_menu_add_entry(mm, buffer, NULL, 0, 0, NULL);
if (!file->info)
feh_file_info_load(file, im);
if (file->info) {
snprintf(buffer, sizeof(buffer), "Size: %dKb", file->info->size / 1024);
- feh_menu_add_entry(mm, buffer, NULL, NULL, 0, NULL, NULL);
+ feh_menu_add_entry(mm, buffer, NULL, 0, 0, NULL);
snprintf(buffer, sizeof(buffer), "Dimensions: %dx%d", file->info->width, file->info->height);
- feh_menu_add_entry(mm, buffer, NULL, NULL, 0, NULL, NULL);
+ feh_menu_add_entry(mm, buffer, NULL, 0, 0, NULL);
snprintf(buffer, sizeof(buffer), "Type: %s", file->info->format);
- feh_menu_add_entry(mm, buffer, NULL, NULL, 0, NULL, NULL);
+ feh_menu_add_entry(mm, buffer, NULL, 0, 0, NULL);
}
mm->func_free = feh_menu_func_free_info;
@@ -1447,21 +1391,21 @@ static feh_menu *feh_menu_func_gen_options(feh_menu * m)
mm = feh_menu_new();
mm->name = estrdup("OPTIONS");
mm->fehwin = m->fehwin;
- feh_menu_add_toggle_entry(mm, "Auto-Zoom", NULL, NULL, CB_OPT_AUTO_ZOOM,
- NULL, NULL, opt.zoom_mode);
- feh_menu_add_toggle_entry(mm, "Freeze Window Size", NULL, NULL,
- CB_OPT_FREEZE_WINDOW, NULL, NULL, opt.geom_flags);
- feh_menu_add_toggle_entry(mm, "Fullscreen", NULL, NULL,
- CB_OPT_FULLSCREEN, NULL, NULL, m->fehwin->full_screen);
-
- feh_menu_add_entry(mm, NULL, NULL, NULL, 0, NULL, NULL);
-
- feh_menu_add_toggle_entry(mm, "Draw Filename", NULL, NULL,
- CB_OPT_DRAW_FILENAME, NULL, NULL, opt.draw_filename);
- feh_menu_add_toggle_entry(mm, "Draw Actions", NULL, NULL,
- CB_OPT_DRAW_ACTIONS, NULL, NULL, opt.draw_actions);
- feh_menu_add_toggle_entry(mm, "Keep HTTP Files", NULL, NULL,
- CB_OPT_KEEP_HTTP, NULL, NULL, opt.keep_http);
+ feh_menu_add_toggle_entry(mm, "Auto-Zoom", NULL, CB_OPT_AUTO_ZOOM,
+ 0, NULL, opt.zoom_mode);
+ feh_menu_add_toggle_entry(mm, "Freeze Window Size", NULL,
+ CB_OPT_FREEZE_WINDOW, 0, NULL, opt.geom_flags);
+ feh_menu_add_toggle_entry(mm, "Fullscreen", NULL,
+ CB_OPT_FULLSCREEN, 0, NULL, m->fehwin->full_screen);
+
+ feh_menu_add_entry(mm, NULL, NULL, 0, 0, NULL);
+
+ feh_menu_add_toggle_entry(mm, "Draw Filename", NULL,
+ CB_OPT_DRAW_FILENAME, 0, NULL, opt.draw_filename);
+ feh_menu_add_toggle_entry(mm, "Draw Actions", NULL,
+ CB_OPT_DRAW_ACTIONS, 0, NULL, opt.draw_actions);
+ feh_menu_add_toggle_entry(mm, "Keep HTTP Files", NULL,
+ CB_OPT_KEEP_HTTP, 0, NULL, opt.keep_http);
mm->func_free = feh_menu_func_free_options;
return(mm);
}
diff --git a/src/menu.h b/src/menu.h
index 3cbc346..403728f 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -86,12 +86,11 @@ struct _feh_menu_list {
struct _feh_menu_item {
int state;
- Imlib_Image icon;
char *text;
char *submenu;
int action;
void (*func_free) (void *data);
- void *data;
+ unsigned short data;
feh_menu_item *next;
feh_menu_item *prev;
unsigned char is_toggle;
@@ -131,11 +130,11 @@ void feh_menu_show_at_submenu(feh_menu * m, feh_menu * parent_m, feh_menu_item *
void feh_menu_hide(feh_menu * m, int func_free);
void feh_menu_show(feh_menu * m);
feh_menu_item *feh_menu_add_entry(feh_menu * m, char *text,
- Imlib_Image icon, char *submenu,
- int action, void *data, void (*func_free) (void *data));
+ char *submenu,
+ int action, unsigned short data, void (*func_free) (void *data));
feh_menu_item *feh_menu_add_toggle_entry(feh_menu * m, char *text,
- Imlib_Image icon, char *submenu,
- int action, void *data, void (*func_free) (void *data), int setting);
+ char *submenu,
+ int action, unsigned short data, void (*func_free) (void *data), int setting);
void feh_menu_entry_get_size(feh_menu_item * i, int *w, int *h);
void feh_menu_calc_size(feh_menu * m);
void feh_menu_draw_item(feh_menu_item * i, Imlib_Image im, int ox, int oy);