Commit ae46674d authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

--debug-level → --debug

parent cb6b53e2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ xinerama = -DHAVE_LIBXINERAMA
xinerama_ld = -lXinerama

# Uncomment this for debug mode
# (Use feh -+ <level> or feh --debug-level <level> to see debug output)
# (Use feh -+ or feh --debug to see debug output)
#CFLAGS += -DDEBUG

# Uncomment this to use dmalloc
+6 −6
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ void init_collage_mode(void)
			trans_bg = 1;
		else {

			D(4, ("Time to apply a background to blend onto\n"));
			D(("Time to apply a background to blend onto\n"));
			if (feh_load_image_char(&bg_im, opt.bg_file) != 0) {
				bg_w = gib_imlib_image_get_width(bg_im);
				bg_h = gib_imlib_image_get_height(bg_im);
@@ -82,7 +82,7 @@ void init_collage_mode(void)

	w = opt.limit_w;
	h = opt.limit_h;
	D(4, ("Limiting width to %d and height to %d\n", w, h));
	D(("Limiting width to %d and height to %d\n", w, h));

	im_main = imlib_create_image(w, h);

@@ -119,9 +119,9 @@ void init_collage_mode(void)
			filelist = feh_file_remove_from_list(filelist, last);
			last = NULL;
		}
		D(3, ("About to load image %s\n", file->filename));
		D(("About to load image %s\n", file->filename));
		if (feh_load_image(&im_temp, file) != 0) {
			D(3, ("Successfully loaded %s\n", file->filename));
			D(("Successfully loaded %s\n", file->filename));
			if (opt.verbose)
				feh_display_status('.');
			www = opt.thumb_w;
@@ -150,7 +150,7 @@ void init_collage_mode(void)
			/* pick random coords for thumbnail */
			xxx = ((w - www) * ((double) rand() / RAND_MAX));
			yyy = ((h - hhh) * ((double) rand() / RAND_MAX));
			D(5, ("image going on at x=%d, y=%d\n", xxx, yyy));
			D(("image going on at x=%d, y=%d\n", xxx, yyy));

			im_thumb = gib_imlib_create_cropped_scaled_image(im_temp,
					0, 0, ww, hh, www, hhh, 1);
@@ -159,7 +159,7 @@ void init_collage_mode(void)
			if (opt.alpha) {
				DATA8 atab[256];

				D(4, ("Applying alpha options\n"));
				D(("Applying alpha options\n"));
				gib_imlib_image_set_has_alpha(im_thumb, 1);
				memset(atab, opt.alpha_level, sizeof(atab));
				gib_imlib_apply_color_modifier_to_rectangle(im_thumb,
+14 −16
Original line number Diff line number Diff line
@@ -39,28 +39,26 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#ifdef DEBUG
#ifdef __GNUC__
#define D(i, a) \
{ \
      if(i <= opt.debug_level) \
#define D(a) \
{ \
	if (opt.debug) { \
		printf("%-12s +%-4u %-20s : ",__FILE__,__LINE__,__FUNCTION__); \
		printf a; \
		fflush(stdout); \
	} \
  }
#else					/* __GNUC__ */
#define D(i, a) \
{ \
   if(i <= opt.debug_level) \
#define D(a) \
{ \
	if (opt.debug) { \
		printf("%-12s +%-4u : ",__FILE__,__LINE__); \
		printf a; \
   } \
		fflush(stdout); \
	} \
}
#endif					/* __GNUC__ */
#else					/* DEBUG */
#define D(i,a)
#define D(a)
#endif					/* DEBUG */

#endif					/* DEBUG_H */
+30 −30
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ static void feh_event_handle_ButtonPress(XEvent * ev)
	}

	if (!opt.no_menus && EV_IS_MENU_BUTTON(ev)) {
		D(3, ("Menu Button Press event\n"));
		D(("Menu Button Press event\n"));
		if (winwid != NULL) {
			winwidget_show_menu(winwid);
		}
@@ -84,7 +84,7 @@ static void feh_event_handle_ButtonPress(XEvent * ev)
		if (winwid != NULL) {
			opt.mode = MODE_ROTATE;
			winwid->mode = MODE_ROTATE;
			D(3, ("rotate starting at %d, %d\n", ev->xbutton.x, ev->xbutton.y));
			D(("rotate starting at %d, %d\n", ev->xbutton.x, ev->xbutton.y));
		}
	} else if ((ev->xbutton.button == opt.blur_button)
		   && ((opt.no_blur_ctrl_mask)
@@ -92,25 +92,25 @@ static void feh_event_handle_ButtonPress(XEvent * ev)
		if (winwid != NULL) {
			opt.mode = MODE_BLUR;
			winwid->mode = MODE_BLUR;
			D(3, ("blur starting at %d, %d\n", ev->xbutton.x, ev->xbutton.y));
			D(("blur starting at %d, %d\n", ev->xbutton.x, ev->xbutton.y));
		}
	} else if (ev->xbutton.button == opt.pan_button) {
		D(3, ("Pan Button Press event\n"));
		D(("Pan Button Press event\n"));
		if (winwid != NULL) {
			D(3, ("Next button, but could be pan mode\n"));
			D(("Next button, but could be pan mode\n"));
			opt.mode = MODE_NEXT;
			winwid->mode = MODE_NEXT;
			D(3, ("click offset is %d,%d\n", ev->xbutton.x, ev->xbutton.y));
			D(("click offset is %d,%d\n", ev->xbutton.x, ev->xbutton.y));
			winwid->click_offset_x = ev->xbutton.x - winwid->im_x;
			winwid->click_offset_y = ev->xbutton.y - winwid->im_y;
		}
	} else if (ev->xbutton.button == opt.zoom_button) {
		D(3, ("Zoom Button Press event\n"));
		D(("Zoom Button Press event\n"));
		if (winwid != NULL) {
			D(3, ("Zoom mode baby!\n"));
			D(("Zoom mode baby!\n"));
			opt.mode = MODE_ZOOM;
			winwid->mode = MODE_ZOOM;
			D(3, ("click offset is %d,%d\n", ev->xbutton.x, ev->xbutton.y));
			D(("click offset is %d,%d\n", ev->xbutton.x, ev->xbutton.y));
			winwid->click_offset_x = ev->xbutton.x;
			winwid->click_offset_y = ev->xbutton.y;
			winwid->old_zoom = winwid->zoom;
@@ -126,21 +126,21 @@ static void feh_event_handle_ButtonPress(XEvent * ev)
			winwidget_render_image(winwid, 0, 0);
		}
	} else if (ev->xbutton.button == opt.reload_button) {
		D(3, ("Reload Button Press event\n"));
		D(("Reload Button Press event\n"));
		if (winwid != NULL)
			feh_reload_image(winwid, 0, 0);
	} else if (ev->xbutton.button == opt.prev_button) {
		D(3, ("Prev Button Press event\n"));
		D(("Prev Button Press event\n"));
		if ((winwid != NULL)
				&& (winwid->type == WIN_TYPE_SLIDESHOW))
			slideshow_change_image(winwid, SLIDE_PREV);
	} else if (ev->xbutton.button == opt.next_button) {
		D(3, ("Next Button Press event\n"));
		D(("Next Button Press event\n"));
		if ((winwid != NULL)
				&& (winwid->type == WIN_TYPE_SLIDESHOW))
			slideshow_change_image(winwid, SLIDE_NEXT);
	} else {
		D(3, ("Received other ButtonPress event\n"));
		D(("Received other ButtonPress event\n"));
	}
	return;
}
@@ -182,7 +182,7 @@ static void feh_event_handle_ButtonRelease(XEvent * ev)
	else if (ev->xbutton.button == opt.pan_button) {
		if (opt.mode == MODE_PAN) {
			if (winwid != NULL) {
				D(3, ("Disabling pan mode\n"));
				D(("Disabling pan mode\n"));
				opt.mode = MODE_NORMAL;
				winwid->mode = MODE_NORMAL;
				winwidget_sanitise_offsets(winwid);
@@ -237,9 +237,9 @@ static void feh_event_handle_ButtonRelease(XEvent * ev)
		}
	} else if ((ev->xbutton.button == opt.rotate_button)
			|| (ev->xbutton.button == opt.zoom_button)) {
		D(3, ("Mode-based Button Release event\n"));
		D(("Mode-based Button Release event\n"));
		if (winwid != NULL) {
			D(3, ("Disabling mode\n"));
			D(("Disabling mode\n"));
			opt.mode = MODE_NORMAL;
			winwid->mode = MODE_NORMAL;
			winwidget_sanitise_offsets(winwid);
@@ -248,9 +248,9 @@ static void feh_event_handle_ButtonRelease(XEvent * ev)
	} else if ((ev->xbutton.button == opt.blur_button)
			&& ((opt.no_blur_ctrl_mask)
				|| (ev->xbutton.state & ControlMask))) {
		D(3, ("Blur Button Release event\n"));
		D(("Blur Button Release event\n"));
		if (winwid != NULL) {
			D(3, ("Disabling Blur mode\n"));
			D(("Disabling Blur mode\n"));
			opt.mode = MODE_NORMAL;
			winwid->mode = MODE_NORMAL;
		}
@@ -265,10 +265,10 @@ static void feh_event_handle_ConfigureNotify(XEvent * ev)
		winwidget w = winwidget_get_from_window(ev->xconfigure.window);

		if (w) {
			D(3, ("configure size %dx%d\n", ev->xconfigure.width, ev->xconfigure.height));
			D(("configure size %dx%d\n", ev->xconfigure.width, ev->xconfigure.height));
			if ((w->w != ev->xconfigure.width)
					|| (w->h != ev->xconfigure.height)) {
				D(3, ("assigning size and rerendering\n"));
				D(("assigning size and rerendering\n"));
				w->w = ev->xconfigure.width;
				w->h = ev->xconfigure.height;
				w->had_resize = 1;
@@ -289,10 +289,10 @@ static void feh_event_handle_LeaveNotify(XEvent * ev)
	if ((menu_root) && (ev->xcrossing.window == menu_root->win)) {
		feh_menu_item *ii;

		D(4, ("It is for a menu\n"));
		D(("It is for a menu\n"));
		for (ii = menu_root->items; ii; ii = ii->next) {
			if (MENU_ITEM_IS_SELECTED(ii)) {
				D(4, ("Unselecting menu\n"));
				D(("Unselecting menu\n"));
				MENU_ITEM_SET_NORMAL(ii);
				menu_root->updates =
					imlib_update_append_rect(menu_root->updates, ii->x, ii->y, ii->w, ii->h);
@@ -324,7 +324,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
		feh_menu *m;
		feh_menu_item *selected_item, *mouseover_item;

		D(3, ("motion notify with menus open\n"));
		D(("motion notify with menus open\n"));
		while (XCheckTypedWindowEvent(disp, ev->xmotion.window, MotionNotify, ev));

		if (ev->xmotion.window == menu_cover) {
@@ -334,7 +334,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
			mouseover_item = feh_menu_find_at_xy(m, ev->xmotion.x, ev->xmotion.y);

			if (selected_item != mouseover_item) {
				D(4, ("selecting a menu item\n"));
				D(("selecting a menu item\n"));
				if (selected_item)
					feh_menu_deselect_selected(m);
				if ((mouseover_item)
@@ -411,7 +411,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
				opt.mode = MODE_PAN;
				winwid->mode = MODE_PAN;
			}
			D(5, ("Panning\n"));
			D(("Panning\n"));
			orig_x = winwid->im_x;
			orig_y = winwid->im_y;

@@ -420,7 +420,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev)

			winwidget_sanitise_offsets(winwid);

			D(4, ("im_x %d, im_w %d, off %d, mx %d\n", winwid->im_x,
			D(("im_x %d, im_w %d, off %d, mx %d\n", winwid->im_x,
				winwid->im_w, winwid->click_offset_x, ev->xmotion.x));

			/* XWarpPointer generates a MotionNotify event which we will
@@ -464,7 +464,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
		while (XCheckTypedWindowEvent(disp, ev->xmotion.window, MotionNotify, ev));
		winwid = winwidget_get_from_window(ev->xmotion.window);
		if (winwid) {
			D(5, ("Rotating\n"));
			D(("Rotating\n"));
			if (!winwid->has_rotated) {
				Imlib_Image temp;

@@ -477,7 +477,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
				winwid->has_rotated = 1;
			}
			winwid->im_angle = (ev->xmotion.x - winwid->w / 2) / ((double) winwid->w / 2) * 3.1415926535;
			D(5, ("angle: %f\n", winwid->im_angle));
			D(("angle: %f\n", winwid->im_angle));
			winwidget_render_image(winwid, 0, 0);
		}
	} else if (opt.mode == MODE_BLUR) {
@@ -487,11 +487,11 @@ static void feh_event_handle_MotionNotify(XEvent * ev)
			Imlib_Image temp, ptr;
			signed int blur_radius;

			D(5, ("Blurring\n"));
			D(("Blurring\n"));

			temp = gib_imlib_clone_image(winwid->im);
			blur_radius = (((double) ev->xmotion.x / winwid->w) * 20) - 10;
			D(5, ("angle: %d\n", blur_radius));
			D(("angle: %d\n", blur_radius));
			if (blur_radius > 0)
				gib_imlib_image_sharpen(temp, blur_radius);
			else
+14 −14
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ gib_list *feh_file_rm_and_free(gib_list * list, gib_list * l)
gib_list *feh_file_remove_from_list(gib_list * list, gib_list * l)
{
	feh_file_free(FEH_FILE(l->data));
	D(4, ("filelist_len %d -> %d\n", filelist_len, filelist_len - 1));
	D(("filelist_len %d -> %d\n", filelist_len, filelist_len - 1));
	filelist_len--;
	return(gib_list_remove(list, l));
}
@@ -121,7 +121,7 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level)
		return;

	path = estrdup(origpath);
	D(4, ("file is %s\n", path));
	D(("file is %s\n", path));

	if (level == FILELIST_FIRST) {
		/* First time through, sort out pathname */
@@ -135,7 +135,7 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level)
				|| (!strncmp(path, "https://", 8))
				|| (!strncmp(path, "ftp://", 6))) {
			/* Its a url */
			D(3, ("Adding url %s to filelist\n", path));
			D(("Adding url %s to filelist\n", path));
			filelist = gib_list_add_front(filelist, feh_file_new(path));
			/* We'll download it later... */
			free(path);
@@ -178,7 +178,7 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level)
		struct dirent *de;
		DIR *dir;

		D(4, ("It is a directory\n"));
		D(("It is a directory\n"));

		if ((dir = opendir(path)) == NULL) {
			if (!opt.quiet)
@@ -207,7 +207,7 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level)
		}
		closedir(dir);
	} else if (S_ISREG(st.st_mode)) {
		D(5, ("Adding regular file %s to filelist\n", path));
		D(("Adding regular file %s to filelist\n", path));
		filelist = gib_list_add_front(filelist, feh_file_new(path));
	}
	free(path);
@@ -240,9 +240,9 @@ gib_list *feh_file_info_preload(gib_list * list)

	for (l = list; l; l = l->next) {
		file = FEH_FILE(l->data);
		D(5, ("file %p, file->next %p, file->name %s\n", l, l->next, file->name));
		D(("file %p, file->next %p, file->name %s\n", l, l->next, file->name));
		if (feh_file_info_load(file, NULL)) {
			D(3, ("Failed to load file %p\n", file));
			D(("Failed to load file %p\n", file));
			remove_list = gib_list_add_front(remove_list, l);
			if (opt.verbose)
				feh_display_status('x');
@@ -268,7 +268,7 @@ int feh_file_info_load(feh_file * file, Imlib_Image im)
	int need_free = 1;
	Imlib_Image im1;

	D(4, ("im is %p\n", im));
	D(("im is %p\n", im));

	if (im)
		need_free = 0;
@@ -369,7 +369,7 @@ void feh_prepare_filelist(void)
			show_mini_usage();
	}

	D(3, ("sort mode requested is: %d\n", opt.sort));
	D(("sort mode requested is: %d\n", opt.sort));
	switch (opt.sort) {
	case SORT_NONE:
		if (opt.randomize) {
@@ -407,7 +407,7 @@ void feh_prepare_filelist(void)

	/* no point reversing a random list */
	if (opt.reverse && (opt.sort != SORT_NONE)) {
		D(3, ("Reversing filelist as requested\n"));
		D(("Reversing filelist as requested\n"));
		filelist = gib_list_reverse(filelist);
	}

@@ -467,12 +467,12 @@ gib_list *feh_read_filelist(char *filename)
	}

	for (; fgets(s, sizeof(s), fp);) {
		D(5, ("Got line '%s'\n", s));
		D(("Got line '%s'\n", s));
		s1[0] = '\0';
		sscanf(s, "%[^\n]", (char *) &s1);
		if (!(*s1) || (*s1 == '\n'))
			continue;
		D(5, ("Got filename %s from filelist file\n", s1));
		D(("Got filename %s from filelist file\n", s1));
		/* Add it to the new list */
		list = gib_list_add_front(list, feh_file_new(s1));
	}
@@ -495,7 +495,7 @@ char *feh_absolute_path(char *path)
	/* This path is not relative. We're gonna convert it, so that a
	   filelist file can be saved anywhere and feh will still find the
	   images */
	D(4, ("Need to convert %s to an absolute form\n", path));
	D(("Need to convert %s to an absolute form\n", path));
	/* I SHOULD be able to just use a simple realpath() here, but dumb * 
	   old Solaris's realpath doesn't return an absolute path if the
	   path you give it is relative. Linux and BSD get this right... */
@@ -506,7 +506,7 @@ char *feh_absolute_path(char *path)
	} else {
		ret = estrdup(temp);
	}
	D(4, ("Converted path to %s\n", ret));
	D(("Converted path to %s\n", ret));
	return(ret);
}

Loading