summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-10-10 11:58:59 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-10-10 12:09:23 +0200
commit6d84a1d22038d0a03c19d43ec4c8a01acbf13426 (patch)
tree4851e1c9b60a065485f90bae6c4afd7cd0ed6ca6
parent58e7ef40a6fc437f84b7761d2bf83acfc534ceb8 (diff)
downloadfeh-6d84a1d22038d0a03c19d43ec4c8a01acbf13426.zip
Code cleanup
-rw-r--r--src/keyevents.c3
-rw-r--r--src/options.c9
-rw-r--r--src/thumbnail.c30
-rw-r--r--src/wallpaper.c44
4 files changed, 37 insertions, 49 deletions
diff --git a/src/keyevents.c b/src/keyevents.c
index 05f1f5b..3c864fb 100644
--- a/src/keyevents.c
+++ b/src/keyevents.c
@@ -347,7 +347,6 @@ void feh_event_invoke_action(winwidget winwid, unsigned char action)
winwidget_destroy(winwid);
} else if (winwid->type == WIN_TYPE_THUMBNAIL) {
feh_file *thumbfile;
- /* also see events.c:306 */
thumbfile = feh_thumbnail_get_selected_file();
if (thumbfile) {
@@ -356,8 +355,6 @@ void feh_event_invoke_action(winwidget winwid, unsigned char action)
if (!opt.hold_actions[action])
feh_thumbnail_mark_removed(thumbfile, 0);
}
- else
- weprintf("No thumbnail selected");
}
}
return;
diff --git a/src/options.c b/src/options.c
index eeb8340..b7eb544 100644
--- a/src/options.c
+++ b/src/options.c
@@ -743,7 +743,7 @@ static void check_options(void)
}
if (opt.full_screen && opt.multiwindow) {
- eprintf("You cannot combine --full-screen with --multiwindow");
+ eprintf("You cannot combine --fullscreen with --multiwindow");
}
if (opt.list && (opt.multiwindow || opt.index || opt.collage)) {
@@ -760,13 +760,6 @@ static void check_options(void)
eprintf("You cannot combine --loadable with --unloadable");
}
- if (opt.thumb_title && (!opt.thumbs)) {
- weprintf("Doesn't make sense to set thumbnail title when not in\n"
- "thumbnail mode.\n");
- free(opt.thumb_title);
- opt.thumb_title = NULL;
- }
-
return;
}
diff --git a/src/thumbnail.c b/src/thumbnail.c
index 860308d..b13b3d8 100644
--- a/src/thumbnail.c
+++ b/src/thumbnail.c
@@ -475,24 +475,20 @@ void feh_thumbnail_mark_removed(feh_file * file, int deleted)
if (thumb) {
w = winwidget_get_first_window_of_type(WIN_TYPE_THUMBNAIL);
if (w) {
- td.font_main = imlib_load_font(DEFAULT_FONT_TITLE);
+ int tw, th;
if (deleted)
gib_imlib_image_fill_rectangle(w->im, thumb->x, thumb->y,
thumb->w, thumb->h, 255, 0, 0, 150);
else
gib_imlib_image_fill_rectangle(w->im, thumb->x, thumb->y,
thumb->w, thumb->h, 0, 0, 255, 150);
- if (td.font_main) {
- int tw, th;
-
- gib_imlib_get_text_size(td.font_main, "X", NULL, &tw, &th,
- IMLIB_TEXT_TO_RIGHT);
- gib_imlib_text_draw(w->im, td.font_main, NULL,
- thumb->x + ((thumb->w - tw) / 2),
- thumb->y + ((thumb->h - th) / 2), "X",
- IMLIB_TEXT_TO_RIGHT, 205, 205, 50, 255);
- } else
- weprintf(DEFAULT_FONT_TITLE);
+
+ gib_imlib_get_text_size(td.font_main, "X", NULL, &tw, &th,
+ IMLIB_TEXT_TO_RIGHT);
+ gib_imlib_text_draw(w->im, td.font_main, NULL,
+ thumb->x + ((thumb->w - tw) / 2),
+ thumb->y + ((thumb->h - th) / 2), "X",
+ IMLIB_TEXT_TO_RIGHT, 205, 205, 50, 255);
winwidget_render_image(w, 0, 1);
}
thumb->exists = 0;
@@ -502,12 +498,6 @@ void feh_thumbnail_mark_removed(feh_file * file, int deleted)
void feh_thumbnail_calculate_geometry(void)
{
- gib_list *l;
- feh_file *file;
-
- int x = 0, y = 0;
- int fw, fh;
-
if (!opt.limit_w && !opt.limit_h) {
if (td.im_bg) {
opt.limit_w = td.bg_w;
@@ -843,13 +833,13 @@ int feh_thumbnail_setup_thumbnail_dir(void)
if (stat(dir_thumbnails, &sb) != 0) {
if (mkdir(dir_thumbnails, 0700) == -1)
- weprintf("unable to create %s directory", dir_thumbnails);
+ weprintf("unable to create directory %s", dir_thumbnails);
}
free(dir_thumbnails);
if (mkdir(dir, 0700) == -1)
- weprintf("unable to create %s directory", dir);
+ weprintf("unable to create directory %s", dir);
else
status = 1;
}
diff --git a/src/wallpaper.c b/src/wallpaper.c
index 930e52e..90b59e6 100644
--- a/src/wallpaper.c
+++ b/src/wallpaper.c
@@ -99,11 +99,13 @@ static void feh_wm_set_bg_scaled(Pixmap pmap, Imlib_Image im, int use_filelist,
static void feh_wm_set_bg_centered(Pixmap pmap, Imlib_Image im, int use_filelist,
int x, int y, int w, int h)
{
+ int offset_x, offset_y;
+
if (use_filelist)
feh_wm_load_next(&im);
- int offset_x = (w - gib_imlib_image_get_width(im)) >> 1;
- int offset_y = (h - gib_imlib_image_get_height(im)) >> 1;
+ offset_x = (w - gib_imlib_image_get_width(im)) >> 1;
+ offset_y = (h - gib_imlib_image_get_height(im)) >> 1;
gib_imlib_render_image_part_on_drawable_at_size(pmap, im,
((offset_x < 0) ? -offset_x : 0),
@@ -125,19 +127,22 @@ static void feh_wm_set_bg_centered(Pixmap pmap, Imlib_Image im, int use_filelist
static void feh_wm_set_bg_filled(Pixmap pmap, Imlib_Image im, int use_filelist,
int x, int y, int w, int h)
{
+ int img_w, img_h, cut_x;
+ int render_w, render_h, render_x, render_y;
+
if (use_filelist)
feh_wm_load_next(&im);
- int img_w = gib_imlib_image_get_width(im);
- int img_h = gib_imlib_image_get_height(im);
+ img_w = gib_imlib_image_get_width(im);
+ img_h = gib_imlib_image_get_height(im);
- int cut_x = (((img_w * h) > (img_h * w)) ? 1 : 0);
+ cut_x = (((img_w * h) > (img_h * w)) ? 1 : 0);
- int render_w = ( cut_x ? ((img_h * w) / h) : img_w);
- int render_h = ( !cut_x ? ((img_w * h) / w) : img_h);
+ render_w = ( cut_x ? ((img_h * w) / h) : img_w);
+ render_h = ( !cut_x ? ((img_w * h) / w) : img_h);
- int render_x = ( cut_x ? ((img_w - render_w) >> 1) : 0);
- int render_y = ( !cut_x ? ((img_h - render_h) >> 1) : 0);
+ render_x = ( cut_x ? ((img_w - render_w) >> 1) : 0);
+ render_y = ( !cut_x ? ((img_h - render_h) >> 1) : 0);
gib_imlib_render_image_part_on_drawable_at_size(pmap, im,
render_x, render_y,
@@ -154,19 +159,22 @@ static void feh_wm_set_bg_filled(Pixmap pmap, Imlib_Image im, int use_filelist,
static void feh_wm_set_bg_maxed(Pixmap pmap, Imlib_Image im, int use_filelist,
int x, int y, int w, int h)
{
+ int img_w, img_h, border_x;
+ int render_w, render_h, render_x, render_y;
+
if (use_filelist)
feh_wm_load_next(&im);
- int img_w = gib_imlib_image_get_width(im);
- int img_h = gib_imlib_image_get_height(im);
+ img_w = gib_imlib_image_get_width(im);
+ img_h = gib_imlib_image_get_height(im);
- int border_x = (((img_w * h) > (img_h * w)) ? 0 : 1);
+ border_x = (((img_w * h) > (img_h * w)) ? 0 : 1);
- int render_w = ( border_x ? ((img_w * h) / img_h) : w);
- int render_h = ( !border_x ? ((img_h * w) / img_w) : h);
+ render_w = ( border_x ? ((img_w * h) / img_h) : w);
+ render_h = ( !border_x ? ((img_h * w) / img_w) : h);
- int render_x = x + ( border_x ? ((w - render_w) >> 1) : 0);
- int render_y = y + ( !border_x ? ((h - render_h) >> 1) : 0);
+ render_x = x + ( border_x ? ((w - render_w) >> 1) : 0);
+ render_y = y + ( !border_x ? ((h - render_h) >> 1) : 0);
gib_imlib_render_image_on_drawable_at_size(pmap, im,
render_x, render_y,
@@ -394,7 +402,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
char *path;
path = estrjoin("/", home, ".fehbg", NULL);
if ((fp = fopen(path, "w")) == NULL) {
- weprintf("Can't open %s for write", path);
+ weprintf("Can't write to %s", path);
} else {
fprintf(fp, "%s\n", fehbg);
fclose(fp);
@@ -445,7 +453,7 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled,
prop_esetroot = XInternAtom(disp2, "ESETROOT_PMAP_ID", False);
if (prop_root == None || prop_esetroot == None)
- weprintf("creation of pixmap property failed.");
+ eprintf("creation of pixmap property failed.");
XChangeProperty(disp2, root2, prop_root, XA_PIXMAP, 32, PropModeReplace, (unsigned char *) &pmap_d2, 1);
XChangeProperty(disp2, root2, prop_esetroot, XA_PIXMAP, 32,