diff options
-rw-r--r-- | src/collage.c | 5 | ||||
-rw-r--r-- | src/debug.h | 59 | ||||
-rw-r--r-- | src/events.c | 36 | ||||
-rw-r--r-- | src/filelist.c | 107 | ||||
-rw-r--r-- | src/imlib.c | 104 | ||||
-rw-r--r-- | src/index.c | 16 | ||||
-rw-r--r-- | src/keyevents.c | 17 | ||||
-rw-r--r-- | src/list.c | 9 | ||||
-rw-r--r-- | src/main.c | 18 | ||||
-rw-r--r-- | src/menu.c | 176 | ||||
-rw-r--r-- | src/multiwindow.c | 4 | ||||
-rw-r--r-- | src/options.c | 43 | ||||
-rw-r--r-- | src/signals.c | 11 | ||||
-rw-r--r-- | src/slideshow.c | 38 | ||||
-rw-r--r-- | src/support.c | 54 | ||||
-rw-r--r-- | src/thumbnail.c | 39 | ||||
-rw-r--r-- | src/timers.c | 21 | ||||
-rw-r--r-- | src/utils.c | 3 | ||||
-rw-r--r-- | src/winwidget.c | 117 |
19 files changed, 287 insertions, 590 deletions
diff --git a/src/collage.c b/src/collage.c index 3e03828..d221ca1 100644 --- a/src/collage.c +++ b/src/collage.c @@ -42,8 +42,6 @@ void init_collage_mode(void) gib_list *l, *last = NULL; char *s; - D_ENTER(4); - mode = "collage"; /* Use bg image dimensions for default size */ @@ -207,5 +205,6 @@ void init_collage_mode(void) if (!opt.display) gib_imlib_free_image_and_decache(im_main); free(s); - D_RETURN_(4); + + return; } diff --git a/src/debug.h b/src/debug.h index 3585cd7..db4369d 100644 --- a/src/debug.h +++ b/src/debug.h @@ -26,8 +26,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef DEBUG_H #define DEBUG_H -/* #define DEBUG */ - #ifdef WITH_DMALLOC #include <dmalloc.h> #define emalloc(a) malloc(a) @@ -50,36 +48,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. fflush(stdout); \ } \ } -#define D_ENTER(i) \ - { \ - call_level++; \ - if(i <= opt.debug_level) \ - { \ - printf("%s +%u %s() %s ENTER\n",__FILE__,__LINE__,__FUNCTION__, stroflen('>', call_level)); \ - fflush(stdout); \ - } \ - } -#define D_RETURN(i, a) \ -{ \ - if(i <= opt.debug_level) \ - { \ - printf("%s +%u %s() %s LEAVE\n",__FILE__,__LINE__,__FUNCTION__, stroflen('<', call_level)); \ - fflush(stdout); \ - } \ - call_level--; \ - return (a); \ - } -#define D_RETURN_(i) \ -{ \ - if(i <= opt.debug_level) \ - { \ - printf("%s +%u %s() %s LEAVE\n",__FILE__,__LINE__,__FUNCTION__, stroflen('<', call_level)); \ - fflush(stdout); \ - } \ - call_level--; \ - return; \ - } -#else +#else /* __GNUC__ */ #define D(i, a) \ { \ if(i <= opt.debug_level) \ @@ -89,27 +58,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. } \ fflush(stdout); \ } -#define D_ENTER(a) -#define D_RETURN(i, a) \ - { \ - return(a); \ - } -#define D_RETURN_(i) \ - { \ - return; \ - } -#endif -#else +#endif /* __GNUC__ */ +#else /* DEBUG */ #define D(i,a) -#define D_ENTER(a) -#define D_RETURN(i, a) \ - { \ - return (a); \ - } -#define D_RETURN_(i) \ - { \ - return; \ - } -#endif +#endif /* DEBUG */ -#endif +#endif /* DEBUG_H */ diff --git a/src/events.c b/src/events.c index b0e9862..815bd7e 100644 --- a/src/events.c +++ b/src/events.c @@ -45,7 +45,6 @@ void feh_event_init(void) { int i; - D_ENTER(4); for (i = 0; i < LASTEvent; i++) ev_handler[i] = NULL; @@ -58,7 +57,7 @@ void feh_event_init(void) ev_handler[MotionNotify] = feh_event_handle_MotionNotify; ev_handler[ClientMessage] = feh_event_handle_ClientMessage; - D_RETURN_(4); + return; } static void feh_event_handle_ButtonPress(XEvent * ev) @@ -66,12 +65,10 @@ static void feh_event_handle_ButtonPress(XEvent * ev) winwidget winwid = NULL; int scr_width, scr_height; - D_ENTER(4); - /* get the heck out if it's a mouse-click on the cover, we'll hide the menus on release */ if (ev->xbutton.window == menu_cover) { - D_RETURN_(4); + return; } scr_width = scr->width; @@ -85,7 +82,7 @@ static void feh_event_handle_ButtonPress(XEvent * ev) winwid = winwidget_get_from_window(ev->xbutton.window); if (winwid && winwid->caption_entry) { - D_RETURN_(4); + return; } if (!opt.no_menus && EV_IS_MENU_BUTTON(ev)) { @@ -173,14 +170,13 @@ static void feh_event_handle_ButtonPress(XEvent * ev) } else { D(3, ("Received other ButtonPress event\n")); } - D_RETURN_(4); + return; } static void feh_event_handle_ButtonRelease(XEvent * ev) { winwidget winwid = NULL; - D_ENTER(4); if (menu_root) { /* if menus are open, close them, and execute action if needed */ @@ -196,12 +192,12 @@ static void feh_event_handle_ButtonRelease(XEvent * ev) feh_menu_item_activate(m, i); } } - D_RETURN_(4); + return; } winwid = winwidget_get_from_window(ev->xbutton.window); if (winwid && winwid->caption_entry) { - D_RETURN_(4); + return; } if ((ev->xbutton.button == opt.menu_button) @@ -287,12 +283,11 @@ static void feh_event_handle_ButtonRelease(XEvent * ev) winwid->mode = MODE_NORMAL; } } - D_RETURN_(4); + return; } static void feh_event_handle_ConfigureNotify(XEvent * ev) { - D_ENTER(4); while (XCheckTypedWindowEvent(disp, ev->xconfigure.window, ConfigureNotify, ev)); if (!menu_root) { winwidget w = winwidget_get_from_window(ev->xconfigure.window); @@ -314,19 +309,16 @@ static void feh_event_handle_ConfigureNotify(XEvent * ev) } } - D_RETURN_(4); + return; } static void feh_event_handle_EnterNotify(XEvent * ev) { - D_ENTER(4); - D_RETURN_(4); - ev = NULL; + return; } static void feh_event_handle_LeaveNotify(XEvent * ev) { - D_ENTER(4); if ((menu_root) && (ev->xcrossing.window == menu_root->win)) { feh_menu_item *ii; @@ -343,7 +335,7 @@ static void feh_event_handle_LeaveNotify(XEvent * ev) feh_raise_all_menus(); } - D_RETURN_(4); + return; } static void feh_event_handle_MotionNotify(XEvent * ev) @@ -361,7 +353,6 @@ static void feh_event_handle_MotionNotify(XEvent * ev) } #endif /* HAVE_LIBXINERAMA */ - D_ENTER(5); if (menu_root) { feh_menu *m; feh_menu_item *selected_item, *mouseover_item; @@ -370,7 +361,7 @@ static void feh_event_handle_MotionNotify(XEvent * ev) while (XCheckTypedWindowEvent(disp, ev->xmotion.window, MotionNotify, ev)); if (ev->xmotion.window == menu_cover) { - D_RETURN_(5); + return; } else if ((m = feh_menu_get_from_window(ev->xmotion.window))) { selected_item = feh_menu_find_selected(m); mouseover_item = feh_menu_find_at_xy(m, ev->xmotion.x, ev->xmotion.y); @@ -600,19 +591,18 @@ static void feh_event_handle_MotionNotify(XEvent * ev) } } } - D_RETURN_(5); + return; } static void feh_event_handle_ClientMessage(XEvent * ev) { winwidget winwid = NULL; - D_ENTER(4); if (ev->xclient.format == 32 && ev->xclient.data.l[0] == (signed) wmDeleteWindow) { winwid = winwidget_get_from_window(ev->xclient.window); if (winwid) winwidget_destroy(winwid); } - D_RETURN_(4); + return; } diff --git a/src/filelist.c b/src/filelist.c index 2eb43af..0a41fee 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -39,8 +39,6 @@ feh_file *feh_file_new(char *filename) feh_file *newfile; char *s; - D_ENTER(4); - newfile = (feh_file *) emalloc(sizeof(feh_file)); newfile->caption = NULL; newfile->filename = estrdup(filename); @@ -50,14 +48,13 @@ feh_file *feh_file_new(char *filename) else newfile->name = estrdup(filename); newfile->info = NULL; - D_RETURN(4, newfile); + return(newfile); } void feh_file_free(feh_file * file) { - D_ENTER(4); if (!file) - D_RETURN_(4); + return; if (file->filename) free(file->filename); if (file->name) @@ -67,14 +64,13 @@ void feh_file_free(feh_file * file) if (file->info) feh_file_info_free(file->info); free(file); - D_RETURN_(4); + return; } feh_file_info *feh_file_info_new(void) { feh_file_info *info; - D_ENTER(4); info = (feh_file_info *) emalloc(sizeof(feh_file_info)); @@ -86,36 +82,33 @@ feh_file_info *feh_file_info_new(void) info->format = NULL; info->extension = NULL; - D_RETURN(4, info); + return(info); } void feh_file_info_free(feh_file_info * info) { - D_ENTER(4); if (!info) - D_RETURN_(4); + return; if (info->format) free(info->format); if (info->extension) free(info->extension); free(info); - D_RETURN_(4); + return; } gib_list *feh_file_rm_and_free(gib_list * list, gib_list * l) { - D_ENTER(4); unlink(FEH_FILE(l->data)->filename); - D_RETURN(4, feh_file_remove_from_list(list, l)); + return(feh_file_remove_from_list(list, l)); } gib_list *feh_file_remove_from_list(gib_list * list, gib_list * l) { - D_ENTER(4); feh_file_free(FEH_FILE(l->data)); D(4, ("filelist_len %d -> %d\n", filelist_len, filelist_len - 1)); filelist_len--; - D_RETURN(4, gib_list_remove(list, l)); + return(gib_list_remove(list, l)); } /* Recursive */ @@ -124,9 +117,8 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level) struct stat st; char *path; - D_ENTER(5); if (!origpath) - D_RETURN_(5); + return; path = estrdup(origpath); D(4, ("file is %s\n", path)); @@ -147,7 +139,7 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level) filelist = gib_list_add_front(filelist, feh_file_new(path)); /* We'll download it later... */ free(path); - D_RETURN_(5); + return; } else if (opt.filelistfile) { char *newpath = feh_absolute_path(path); @@ -179,7 +171,7 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level) break; } free(path); - D_RETURN_(5); + return; } if ((S_ISDIR(st.st_mode)) && (level != FILELIST_LAST)) { @@ -192,7 +184,7 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level) if (!opt.quiet) weprintf("couldn't open directory %s:", path); free(path); - D_RETURN_(5); + return; } de = readdir(dir); while (de != NULL) { @@ -219,24 +211,22 @@ void add_file_to_filelist_recursively(char *origpath, unsigned char level) filelist = gib_list_add_front(filelist, feh_file_new(path)); } free(path); - D_RETURN_(5); + return; } void add_file_to_rm_filelist(char *file) { - D_ENTER(4); rm_filelist = gib_list_add_front(rm_filelist, feh_file_new(file)); - D_RETURN_(4); + return; } void delete_rm_files(void) { gib_list *l; - D_ENTER(4); for (l = rm_filelist; l; l = l->next) unlink(FEH_FILE(l->data)->filename); - D_RETURN_(4); + return; } gib_list *feh_file_info_preload(gib_list * list) @@ -245,7 +235,6 @@ gib_list *feh_file_info_preload(gib_list * list) feh_file *file = NULL; gib_list *remove_list = NULL; - D_ENTER(4); if (opt.verbose) fprintf(stdout, PACKAGE " - preloading...\n"); @@ -270,7 +259,7 @@ gib_list *feh_file_info_preload(gib_list * list) gib_list_free(remove_list); } - D_RETURN(4, list); + return(list); } int feh_file_info_load(feh_file * file, Imlib_Image im) @@ -279,8 +268,6 @@ int feh_file_info_load(feh_file * file, Imlib_Image im) int need_free = 1; Imlib_Image im1; - D_ENTER(4); - D(4, ("im is %p\n", im)); if (im) @@ -308,16 +295,16 @@ int feh_file_info_load(feh_file * file, Imlib_Image im) weprintf("couldn't open %s ", file->filename); break; } - D_RETURN(4, 1); + return(1); } if (im) im1 = im; else if (!feh_load_image(&im1, file)) - D_RETURN(4, 1); + return(1); if (!im1) - D_RETURN(4, 1); + return(1); file->info = feh_file_info_new(); @@ -334,54 +321,46 @@ int feh_file_info_load(feh_file * file, Imlib_Image im) if (need_free && im1) gib_imlib_free_image_and_decache(im1); - D_RETURN(4, 0); + return(0); } int feh_cmp_filename(void *file1, void *file2) { - D_ENTER(4); - D_RETURN(4, strcmp(FEH_FILE(file1)->filename, FEH_FILE(file2)->filename)); + return(strcmp(FEH_FILE(file1)->filename, FEH_FILE(file2)->filename)); } int feh_cmp_name(void *file1, void *file2) { - D_ENTER(4); - D_RETURN(4, strcmp(FEH_FILE(file1)->name, FEH_FILE(file2)->name)); + return(strcmp(FEH_FILE(file1)->name, FEH_FILE(file2)->name)); } int feh_cmp_width(void *file1, void *file2) { - D_ENTER(4); - D_RETURN(4, (FEH_FILE(file1)->info->width - FEH_FILE(file2)->info->width)); + return((FEH_FILE(file1)->info->width - FEH_FILE(file2)->info->width)); } int feh_cmp_height(void *file1, void *file2) { - D_ENTER(4); - D_RETURN(4, (FEH_FILE(file1)->info->height - FEH_FILE(file2)->info->height)); + return((FEH_FILE(file1)->info->height - FEH_FILE(file2)->info->height)); } int feh_cmp_pixels(void *file1, void *file2) { - D_ENTER(4); - D_RETURN(4, (FEH_FILE(file1)->info->pixels - FEH_FILE(file2)->info->pixels)); + return((FEH_FILE(file1)->info->pixels - FEH_FILE(file2)->info->pixels)); } int feh_cmp_size(void *file1, void *file2) { - D_ENTER(4); - D_RETURN(4, (FEH_FILE(file1)->info->size - FEH_FILE(file2)->info->size)); + return((FEH_FILE(file1)->info->size - FEH_FILE(file2)->info->size)); } int feh_cmp_format(void *file1, void *file2) { - D_ENTER(4); - D_RETURN(4, strcmp(FEH_FILE(file1)->info->format, FEH_FILE(file2)->info->format)); + return(strcmp(FEH_FILE(file1)->info->format, FEH_FILE(file2)->info->format)); } void feh_prepare_filelist(void) { - D_ENTER(4); if (opt.list || opt.customlist || (opt.sort > SORT_FILENAME) || opt.preload) { /* For these sort options, we have to preload images */ @@ -432,7 +411,7 @@ void feh_prepare_filelist(void) filelist = gib_list_reverse(filelist); } - D_RETURN_(4); + return; } int feh_write_filelist(gib_list * list, char *filename) @@ -440,15 +419,13 @@ int feh_write_filelist(gib_list * list, char *filename) FILE *fp; gib_list *l; - D_ENTER(4); - if (!list || !filename) - D_RETURN(4, 0); + return(0); errno = 0; if ((fp = fopen(filename, "w")) == NULL) { weprintf("can't write filelist %s:", filename); - D_RETURN(4, 0); + return(0); } for (l = list; l; l = l->next) @@ -456,7 +433,7 @@ int feh_write_filelist(gib_list * list, char *filename) fclose(fp); - D_RETURN(4, 1); + return(1); } gib_list *feh_read_filelist(char *filename) @@ -466,10 +443,8 @@ gib_list *feh_read_filelist(char *filename) char s[1024], s1[1024]; Imlib_Image im1; - D_ENTER(4); - if (!filename) - D_RETURN(4, NULL); + return(NULL); /* try and load the given filelist as an image, cowardly refuse to * overwrite an image with a filelist. (requested by user who did feh -df * @@ -481,14 +456,14 @@ gib_list *feh_read_filelist(char *filename) "The file you specified as a filelist to read - %s - appears to be an image. Ignoring it (this is a common mistake).\n", filename); opt.filelistfile = NULL; - D_RETURN(4, NULL); + return(NULL); } errno = 0; if ((fp = fopen(filename, "r")) == NULL) { /* return quietly, as it's okay to specify a filelist file that doesn't exist. In that case we create it on exit. */ - D_RETURN(4, NULL); + return(NULL); } for (; fgets(s, sizeof(s), fp);) { @@ -503,7 +478,7 @@ gib_list *feh_read_filelist(char *filename) } fclose(fp); - D_RETURN(4, list); + return(list); } char *feh_absolute_path(char *path) @@ -513,12 +488,10 @@ char *feh_absolute_path(char *path) char temp[PATH_MAX]; char *ret; - D_ENTER(4); - if (!path) - D_RETURN(4, NULL); + return(NULL); if (path[0] == '/') - D_RETURN(4, estrdup(path)); + return(estrdup(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 */ @@ -534,15 +507,13 @@ char *feh_absolute_path(char *path) ret = estrdup(temp); } D(4, ("Converted path to %s\n", ret)); - D_RETURN(4, ret); + return(ret); } void feh_save_filelist() { char *tmpname; - D_ENTER(4); - tmpname = feh_unique_filename("", "filelist"); if (!opt.quiet) @@ -550,5 +521,5 @@ void feh_save_filelist() feh_write_filelist(filelist, tmpname); free(tmpname); - D_RETURN_(4); + return; } diff --git a/src/imlib.c b/src/imlib.c index 1681b38..55fd607 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -64,20 +64,16 @@ void init_xinerama(void) void init_imlib_fonts(void) { - D_ENTER(4); - /* Set up the font stuff */ imlib_add_path_to_font_path("."); imlib_add_path_to_font_path(PREFIX "/share/feh/fonts"); imlib_add_path_to_font_path("./ttfonts"); - D_RETURN_(4); + return; } void init_x_and_imlib(void) { - D_ENTER(4); - disp = XOpenDisplay(NULL); if (!disp) eprintf("Can't open X display. It *is* running, yeah?"); @@ -103,7 +99,7 @@ void init_x_and_imlib(void) /* Initialise random numbers */ srand(getpid() * time(NULL) % ((unsigned int) -1)); - D_RETURN_(4); + return; } int feh_load_image_char(Imlib_Image * im, char *filename) @@ -111,22 +107,20 @@ int feh_load_image_char(Imlib_Image * im, char *filename) feh_file *file; int i; - D_ENTER(4); file = feh_file_new(filename); i = feh_load_image(im, file); feh_file_free(file); - D_RETURN(4, i); + return(i); } int feh_load_image(Imlib_Image * im, feh_file * file) { Imlib_Load_Error err; - D_ENTER(4); D(3, ("filename is %s, image is %p\n", file->filename, im)); if (!file || !file->filename) - D_RETURN(4, 0); + return(0); /* Handle URLs */ if ((!strncmp(file->filename, "http://", 7)) || (!strncmp(file->filename, "https://", 8)) @@ -136,7 +130,7 @@ int feh_load_image(Imlib_Image * im, feh_file * file) tmpname = feh_http_load_image(file->filename); if (tmpname == NULL) - D_RETURN(4, 0); + return(0); *im = imlib_load_image_with_error_return(tmpname, &err); if (im) { /* load the info now, in case it's needed after we delete the @@ -228,11 +222,11 @@ int feh_load_image(Imlib_Image * im, feh_file * file) break; } D(3, ("Load *failed*\n")); - D_RETURN(4, 0); + return(0); } D(3, ("Loaded ok\n")); - D_RETURN(4, 1); + return(1); } char *feh_http_load_image(char *url) @@ -245,8 +239,6 @@ char *feh_http_load_image(char *url) int rnum; char *path = NULL; - D_ENTER(4); - if (opt.keep_http) { if (opt.output_dir) path = opt.output_dir; @@ -304,7 +296,7 @@ char *feh_http_load_image(char *url) if (!fp) { weprintf("couldn't write to file %s:", tmpname); free(tmpname); - D_RETURN(4, NULL); + return(NULL); } hostname = feh_strip_hostname(newurl); @@ -314,7 +306,7 @@ char *feh_http_load_image(char *url) unlink(tmpname); free(tmpname); free(newurl); - D_RETURN(4, NULL); + return(NULL); } D(4, ("trying hostname %s\n", hostname)); @@ -326,7 +318,7 @@ char *feh_http_load_image(char *url) free(hostname); free(tmpname); free(newurl); - D_RETURN(4, NULL); + return(NULL); } /* Copy the address of the host to socket description. */ @@ -343,7 +335,7 @@ char *feh_http_load_image(char *url) free(tmpname); free(hostname); free(newurl); - D_RETURN(4, NULL); + return(NULL); } if (connect(sockno, (struct sockaddr *) &addr, sizeof(addr)) == -1) { weprintf("error connecting socket:"); @@ -352,7 +344,7 @@ char *feh_http_load_image(char *url) free(tmpname); free(hostname); free(newurl); - D_RETURN(4, NULL); + return(NULL); } get_url = strchr(newurl, '/') + 2; @@ -382,7 +374,7 @@ char *feh_http_load_image(char *url) free(hostname); free(newurl); weprintf("error sending over socket:"); - D_RETURN(4, NULL); + return(NULL); } free(get_string); free(host_string); @@ -476,7 +468,7 @@ char *feh_http_load_image(char *url) weprintf("open url: fork failed:"); free(tmpname); free(newurl); - D_RETURN(4, NULL); + return(NULL); } else if (pid == 0) { char *quiet = NULL; @@ -497,7 +489,7 @@ char *feh_http_load_image(char *url) unlink(opt.wget_timestamp ? tmpname_timestamper : tmpname); free(newurl); free(tmpname); - D_RETURN(4, NULL); + return(NULL); } if (opt.wget_timestamp) { char cmd[2048]; @@ -509,7 +501,7 @@ char *feh_http_load_image(char *url) } } - D_RETURN(4, tmpname); + return(tmpname); } struct hostent *feh_gethostbyname(const char *name) @@ -517,13 +509,12 @@ struct hostent *feh_gethostbyname(const char *name) struct hostent *hp; unsigned long addr; - D_ENTER(3); addr = (unsigned long) inet_addr(name); if ((int) addr != -1) hp = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET); else hp = gethostbyname(name); - D_RETURN(3, hp); + return(hp); } char *feh_strip_hostname(char *url) @@ -533,24 +524,22 @@ char *feh_strip_hostname(char *url) char *finish; int len; - D_ENTER(3); - start = strchr(url, '/'); if (!start) - D_RETURN(3, NULL); + return(NULL); start += 2; finish = strchr(start, '/'); if (!finish) - D_RETURN(3, NULL); + return(NULL); len = finish - start; ret = emalloc(len + 1); strncpy(ret, start, len); ret[len] = '\0'; - D_RETURN(3, ret); + return(ret); } void feh_draw_zoom(winwidget w) @@ -561,10 +550,8 @@ void feh_draw_zoom(winwidget w) char buf[100]; static DATA8 atab[256]; - D_ENTER(4); - if (!w->im) - D_RETURN_(4); + return; if (!fn) { fn = gib_imlib_load_font(DEFAULT_FONT); @@ -573,7 +560,7 @@ void feh_draw_zoom(winwidget w) if (!fn) { weprintf("Couldn't load font for zoom printing"); - D_RETURN_(4); + return; } snprintf(buf, sizeof(buf), "%.0f%%, %dx%d", w->zoom * 100, @@ -596,7 +583,7 @@ void feh_draw_zoom(winwidget w) gib_imlib_text_draw(im, fn, NULL, 1, 1, buf, IMLIB_TEXT_TO_RIGHT, 255, 255, 255, 255); gib_imlib_render_image_on_drawable(w->bg_pmap, im, 0, w->h - th, 1, 1, 0); gib_imlib_free_image_and_decache(im); - D_RETURN_(4); + return; } void feh_draw_filename(winwidget w) @@ -608,11 +595,9 @@ void feh_draw_filename(winwidget w) char *s = NULL; int len = 0; - D_ENTER(4); - if ((!w->file) || (!FEH_FILE(w->file->data)) || (!FEH_FILE(w->file->data)->filename)) - D_RETURN_(4); + return; if (!fn) { memset(atab, 0, sizeof(atab)); @@ -624,7 +609,7 @@ void feh_draw_filename(winwidget w) if (!fn) { weprintf("Couldn't load font for filename printing"); - D_RETURN_(4); + return; } /* Work out how high the font is */ @@ -662,7 +647,7 @@ void feh_draw_filename(winwidget w) gib_imlib_render_image_on_drawable(w->bg_pmap, im, 0, 0, 1, 1, 0); gib_imlib_free_image_and_decache(im); - D_RETURN_(4); + return; } char *build_caption_filename(feh_file * file) @@ -709,14 +694,12 @@ void feh_draw_caption(winwidget w) static gib_style *caption_style = NULL; feh_file *file; - D_ENTER(4); - if (!w->file) { - D_RETURN_(4); + return; } file = FEH_FILE(w->file->data); if (!file->filename) { - D_RETURN_(4); + return; } if (!file->caption) { @@ -740,7 +723,7 @@ void feh_draw_caption(winwidget w) } if (*(file->caption) == '\0' && !w->caption_entry) - D_RETURN_(4); + return; caption_style = gib_style_new("caption"); caption_style->bits = gib_list_add_front(caption_style->bits, @@ -758,7 +741,7 @@ void feh_draw_caption(winwidget w) if (!fn) { weprintf("Couldn't load font for caption printing"); - D_RETURN_(4); + return; } if (*(file->caption) == '\0') { @@ -769,7 +752,7 @@ void feh_draw_caption(winwidget w) lines = feh_wrap_string(file->caption, w->w, fn, NULL); if (!lines) - D_RETURN_(4); + return; /* Work out how high/wide the caption is */ l = lines; @@ -822,7 +805,7 @@ void feh_draw_caption(winwidget w) gib_imlib_render_image_on_drawable(w->bg_pmap, im, (w->w - tw) / 2, w->h - th, 1, 1, 0); gib_imlib_free_image_and_decache(im); gib_list_free_and_data(lines); - D_RETURN_(4); + return; } unsigned char reset_output = 0; @@ -833,8 +816,6 @@ void feh_display_status(char stat) static int init_len = 0; int j = 0; - D_ENTER(5); - D(5, ("filelist %p, filelist->next %p\n", filelist, filelist->next)); if (!init_len) @@ -863,21 +844,20 @@ void feh_display_status(char stat) fprintf(stdout, "%c", stat); fflush(stdout); i++; - D_RETURN_(5); + return; } void feh_edit_inplace_orient(winwidget w, int orientation) { int ret; Imlib_Image old; - D_ENTER(4); if (!w->file || !w->file->data || !FEH_FILE(w->file->data)->filename) - D_RETURN_(4); + return; if (!strcmp(gib_imlib_image_format(w->im), "jpeg")) { feh_edit_inplace_lossless_rotate(w, orientation); feh_reload_image(w, 1, 1); - D_RETURN_(4); + return; } ret = feh_load_image(&old, FEH_FILE(w->file->data)); @@ -890,7 +870,7 @@ void feh_edit_inplace_orient(winwidget w, int orientation) weprintf("failed to load image from disk to edit it in place\n"); } - D_RETURN_(4); + return; } gib_list *feh_wrap_string(char *text, int wrap_width, Imlib_Font fn, gib_style * style) @@ -1005,7 +985,7 @@ void feh_edit_inplace_lossless_rotate(winwidget w, int orientation) if ((pid = fork()) < 0) { weprintf("lossless rotate: fork failed:"); - D_RETURN_(4); + return; } else if (pid == 0) { execlp("jpegtran", "jpegtran", "-copy", "all", "-rotate", @@ -1020,7 +1000,7 @@ void feh_edit_inplace_lossless_rotate(winwidget w, int orientation) " Commandline was:\n" "jpegtran -copy all -rotate %d -outfile %s %s\n", status >> 8, rotate_str, file_str, file_str); - D_RETURN_(4); + return; } } } @@ -1040,8 +1020,6 @@ void feh_draw_actions(winwidget w) char index[1]; char *line; - D_ENTER(4); - /* Count number of defined actions. This method sucks a bit since it needs * to be changed if the number of actions changes, but at least it doesn't * miss actions 2 to 9 if action1 isn't defined @@ -1056,7 +1034,7 @@ void feh_draw_actions(winwidget w) if ((!w->file) || (!FEH_FILE(w->file->data)) || (!FEH_FILE(w->file->data)->filename)) - D_RETURN_(4); + return; if (!fn) { memset(atab, 0, sizeof(atab)); @@ -1068,7 +1046,7 @@ void feh_draw_actions(winwidget w) if (!fn) { weprintf("Couldn't load font for actions printing"); - D_RETURN_(4); + return; } gib_imlib_get_text_size(fn, "defined actions:", NULL, &tw, &th, IMLIB_TEXT_TO_RIGHT); @@ -1134,5 +1112,5 @@ void feh_draw_actions(winwidget w) gib_imlib_render_image_on_drawable(w->bg_pmap, im, 0, 0 + th_offset, 1, 1, 0); gib_imlib_free_image_and_decache(im); - D_RETURN_(4); + return; } diff --git a/src/index.c b/src/index.c index 80f420c..8321185 100644 --- a/src/index.c +++ b/src/index.c @@ -62,8 +62,6 @@ void init_index_mode(void) int x_offset_name = 0, x_offset_dim = 0, x_offset_size = 0; char *s; - D_ENTER(3); - if (opt.montage) { mode = "montage"; } else { @@ -492,13 +490,12 @@ void init_index_mode(void) gib_imlib_free_image_and_decache(im_main); free(s); - D_RETURN_(3); + return; } char *chop_file_from_full_path(char *str) { - D_ENTER(4); - D_RETURN(4, strrchr(str, '/') + 1); + return(strrchr(str, '/') + 1); } static char *create_index_size_string(char *file) @@ -508,7 +505,6 @@ static char *create_index_size_string(char *file) double kbs = 0.0; struct stat st; - D_ENTER(4); if (stat(file, &st)) kbs = 0.0; else { @@ -517,23 +513,21 @@ static char *create_index_size_string(char *file) } snprintf(str, sizeof(str), "%.2fKb", kbs); - D_RETURN(4, str); + return(str); } static char *create_index_dimension_string(int w, int h) { static char str[50]; - D_ENTER(4); snprintf(str, sizeof(str), "%dx%d", w, h); - D_RETURN(4, str); + return(str); } static char *create_index_title_string(int num, int w, int h) { static char str[50]; - D_ENTER(4); snprintf(str, sizeof(str), PACKAGE " index - %d thumbnails, %d by %d pixels", num, w, h); - D_RETURN(4, str); + return(str); } diff --git a/src/keyevents.c b/src/keyevents.c index a5cafb9..67f5389 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -31,7 +31,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. void feh_event_invoke_action(winwidget winwid, char *action) { - D_ENTER(4); D(4, ("action is '%s'\n", action)); D(4, ("winwid is '%p'\n", winwid)); if (action) { @@ -47,7 +46,7 @@ void feh_event_invoke_action(winwidget winwid, char *action) printf("For now, open the image to perform the action on it.\n"); } } - D_RETURN_(4); + return; } void feh_event_handle_keypress(XEvent * ev) @@ -61,8 +60,6 @@ void feh_event_handle_keypress(XEvent * ev) feh_menu_item *selected_item; feh_menu *selected_menu; - D_ENTER(4); - winwid = winwidget_get_from_window(ev->xkey.window); /* nuke dupe events, unless we're typing text */ @@ -100,11 +97,11 @@ void feh_event_handle_keypress(XEvent * ev) break; } - D_RETURN_(4); + return; } if (winwid == NULL) - D_RETURN_(4); + return; if (winwid->caption_entry) { switch (keysym) { @@ -125,7 +122,7 @@ void feh_event_handle_keypress(XEvent * ev) fp = fopen(caption_filename, "w"); if (!fp) { weprintf("couldn't write to captions file %s:", caption_filename); - D_RETURN_(4); + return; } fprintf(fp, "%s", FEH_FILE(winwid->file->data)->caption); free(caption_filename); @@ -154,7 +151,7 @@ void feh_event_handle_keypress(XEvent * ev) } break; } - D_RETURN_(4); + return; } switch (keysym) { @@ -289,7 +286,7 @@ void feh_event_handle_keypress(XEvent * ev) } if (len <= 0 || len > (int) sizeof(kbuf)) - D_RETURN_(4); + return; kbuf[len] = '\0'; switch (*kbuf) { @@ -409,5 +406,5 @@ void feh_event_handle_keypress(XEvent * ev) default: break; } - D_RETURN_(4); + return; } @@ -33,8 +33,6 @@ void init_list_mode(void) feh_file *file = NULL; int j = 0; - D_ENTER(4); - mode = "list"; if (!opt.customlist) @@ -58,18 +56,16 @@ void init_list_mode(void) void init_loadables_mode(void) { - D_ENTER(4); mode = "loadables"; real_loadables_mode(1); - D_RETURN_(4); + return; } void init_unloadables_mode(void) { - D_ENTER(4); mode = "unloadables"; real_loadables_mode(0); - D_RETURN_(4); + return; } void real_loadables_mode(int loadable) @@ -77,7 +73,6 @@ void real_loadables_mode(int loadable) feh_file *file; gib_list *l; - D_ENTER(4); opt.quiet = 1; for (l = filelist; l; l = l->next) { @@ -38,7 +38,6 @@ char *mode = NULL; int main(int argc, char **argv) { - D_ENTER(4); atexit(feh_clean_exit); init_parse_options(argc, argv); @@ -77,7 +76,7 @@ int main(int argc, char **argv) /* main event loop */ while (feh_main_iteration(1)); - D_RETURN(4, 0); + return(0); } /* Return 0 to stop iterating, 1 if ok to continue. */ @@ -94,10 +93,8 @@ int feh_main_iteration(int block) double t1 = 0.0, t2 = 0.0; fehtimer ft; - D_ENTER(5); - if (window_num == 0) - D_RETURN(5, 0); + return(0); if (first) { /* Only need to set these up the first time */ @@ -117,7 +114,7 @@ int feh_main_iteration(int block) (*(ev_handler[ev.type])) (&ev); if (window_num == 0) - D_RETURN(5, 0); + return(0); } XFlush(disp); @@ -182,18 +179,17 @@ int feh_main_iteration(int block) } } if (window_num == 0) - D_RETURN(5, 0); - D_RETURN(5, 1); + return(0); + + return(1); } void feh_clean_exit(void) { - D_ENTER(4); - delete_rm_files(); if (opt.filelistfile) feh_write_filelist(filelist, opt.filelistfile); - D_RETURN_(4); + return; } @@ -67,8 +67,6 @@ feh_menu *feh_menu_new(void) static Imlib_Image bg = NULL; static Imlib_Border border; - D_ENTER(4); - m = (feh_menu *) emalloc(sizeof(feh_menu)); attr.backing_store = NotUseful; @@ -125,7 +123,7 @@ feh_menu *feh_menu_new(void) if (bg) m->bg = gib_imlib_clone_image(bg); - D_RETURN(4, m); + return(m); } void feh_menu_free(feh_menu * m) @@ -133,8 +131,6 @@ void feh_menu_free(feh_menu * m) feh_menu_item *i; feh_menu_list *l, *pl = NULL; - D_ENTER(4); - if (m->name) free(m->name); XDestroyWindow(disp, m->win); @@ -172,22 +168,20 @@ void feh_menu_free(feh_menu * m) free(m); - D_RETURN_(4); + return; } feh_menu_item *feh_menu_find_selected(feh_menu * m) { feh_menu_item *i; - D_ENTER(4); - D(5, ("menu %p\n", m)); for (i = m->items; i; i = i->next) { if (MENU_ITEM_IS_SELECTED(i)) - D_RETURN(4, i); + return(i); } - D_RETURN(4, NULL); + return(NULL); } feh_menu_item *feh_menu_find_selected_r(feh_menu * m, feh_menu ** parent) @@ -195,27 +189,25 @@ feh_menu_item *feh_menu_find_selected_r(feh_menu * m, feh_menu ** parent) feh_menu_item *i, *ii; feh_menu *mm; - D_ENTER(4); - D(5, ("menu %p\n", m)); for (i = m->items; i; i = i->next) { if (MENU_ITEM_IS_SELECTED(i)) { if (parent) *parent = m; - D_RETURN(4, i); + return(i); } else if (i->submenu) { mm = feh_menu_find(i->submenu); if (mm) { ii = feh_menu_find_selected_r(mm, parent); if (ii) - D_RETURN(4, ii); + return(ii); } } } if (parent) *parent = m; - D_RETURN(4, NULL); + return(NULL); } void feh_menu_select_next(feh_menu * selected_menu, feh_menu_item * selected_item) @@ -309,26 +301,23 @@ feh_menu_item *feh_menu_find_at_xy(feh_menu * m, int x, int y) { feh_menu_item *i; - D_ENTER(4); D(4, ("looking for menu item at %d,%d\n", x, y)); for (i = m->items; i; i = i->next) { if (XY_IN_RECT(x, y, i->x, i->y, i->w, i->h)) { D(4, ("Found an item\n")); - D_RETURN(4, i); + return(i); } } D(4, ("didn't find an item\n")); - D_RETURN(4, NULL); + return(NULL); } void feh_menu_deselect_selected(feh_menu * m) { feh_menu_item *i; - D_ENTER(4); - if (!m) - D_RETURN_(4); + return; i = feh_menu_find_selected(m); if (i) { @@ -337,12 +326,11 @@ void feh_menu_deselect_selected(feh_menu * m) m->updates = imlib_update_append_rect(m->updates, i->x, i->y, i->w, i->h); m->needs_redraw = 1; } - D_RETURN_(4); + return; } void feh_menu_select(feh_menu * m, feh_menu_item * i) { - D_ENTER(4); MENU_ITEM_SET_SELECTED(i); m->updates = imlib_update_append_rect(m->updates, i->x, i->y, i->w, i->h); m->needs_redraw = 1; @@ -360,13 +348,11 @@ void feh_menu_select(feh_menu * m, feh_menu_item * i) else if (i->func_gen_sub) feh_menu_show_at_submenu(i->func_gen_sub(m), m, i); } - D_RETURN_(4); + return; } void feh_menu_show_at(feh_menu * m, int x, int y) { - D_ENTER(4); - if (m->calc) feh_menu_calc_size(m); if (!menu_cover) { @@ -397,15 +383,13 @@ void feh_menu_show_at(feh_menu * m, int x, int y) XRaiseWindow(disp, m->win); feh_menu_redraw(m); XMapWindow(disp, m->win); - D_RETURN_(4); + return; } void feh_menu_show_at_xy(feh_menu * m, winwidget winwid, int x, int y) { - D_ENTER(4); - if (!m) - D_RETURN_(4); + return; if (m->calc) feh_menu_calc_size(m); @@ -433,17 +417,15 @@ void feh_menu_show_at_xy(feh_menu * m, winwidget winwid, int x, int y) y = 0; feh_menu_move(m, x, y); feh_menu_show(m); - D_RETURN_(4); + return; } void feh_menu_show_at_submenu(feh_menu * m, feh_menu * parent_m, feh_menu_item * i) { int mx, my; - D_ENTER(4); - if (!m) - D_RETURN_(4); + return; if (m->calc) feh_menu_calc_size(m); @@ -454,24 +436,22 @@ void feh_menu_show_at_submenu(feh_menu * m, feh_menu * parent_m, feh_menu_item * m->prev = parent_m; feh_menu_move(m, mx, my); feh_menu_show(m); - D_RETURN_(4); + return; } void feh_menu_move(feh_menu * m, int x, int y) { int dx, dy; - D_ENTER(4); - if (!m) - D_RETURN_(4); + return; dx = x - m->x; dy = y - m->y; if (m->visible) XMoveWindow(disp, m->win, x, y); m->x = x; m->y = y; - D_RETURN_(4); + return; } void feh_menu_slide_all_menus_relative(int dx, int dy) @@ -482,7 +462,6 @@ void feh_menu_slide_all_menus_relative(int dx, int dy) int stepx = 0; int stepy = 0; - D_ENTER(4); vector_len = sqrt(dx * dx + dy * dy); if (vector_len) { if (dx) @@ -500,15 +479,13 @@ void feh_menu_slide_all_menus_relative(int dx, int dy) } XWarpPointer(disp, None, None, 0, 0, 0, 0, stepx, stepy); } - D_RETURN_(4); + return; } void feh_menu_hide(feh_menu * m, int func_free) { - D_ENTER(4); - if (!m->visible) - D_RETURN_(4); + return; if (m->next) { m->next->prev = NULL; feh_menu_hide(m->next, func_free); @@ -528,16 +505,15 @@ void feh_menu_hide(feh_menu * m, int func_free) m->func_free(m); else feh_menu_deselect_selected(m); - D_RETURN_(4); + return; } void feh_menu_show(feh_menu * m) { - D_ENTER(4); if (!m) - D_RETURN_(4); + return; feh_menu_show_at(m, m->x, m->y); - D_RETURN_(4); + return; } feh_menu_item *feh_menu_add_toggle_entry(feh_menu * m, char *text, @@ -546,11 +522,10 @@ feh_menu_item *feh_menu_add_toggle_entry(feh_menu * m, char *text, { feh_menu_item *mi; - D_ENTER(4); mi = feh_menu_add_entry(m, text, icon, submenu, action, data, func_free); mi->is_toggle = TRUE; MENU_ITEM_TOGGLE_SET(mi, setting); - D_RETURN(4, mi); + return(mi); } feh_menu_item *feh_menu_add_entry(feh_menu * m, char *text, Imlib_Image icon, @@ -558,7 +533,6 @@ feh_menu_item *feh_menu_add_entry(feh_menu * m, char *text, Imlib_Image icon, { feh_menu_item *mi, *ptr; - D_ENTER(4); mi = (feh_menu_item *) emalloc(sizeof(feh_menu_item)); mi->state = MENU_ITEM_STATE_NORMAL; @@ -591,15 +565,13 @@ feh_menu_item *feh_menu_add_entry(feh_menu * m, char *text, Imlib_Image icon, } } m->calc = 1; - D_RETURN(4, mi); + return(mi); } void feh_menu_entry_get_size(feh_menu * m, feh_menu_item * i, int *w, int *h) { int tw, th; - D_ENTER(4); - if (i->text) { gib_imlib_get_text_size(opt.menu_fn, i->text, opt.menu_style_l, &tw, &th, IMLIB_TEXT_TO_RIGHT); *w = tw + FEH_MENUITEM_PAD_LEFT + FEH_MENUITEM_PAD_RIGHT; @@ -609,7 +581,7 @@ void feh_menu_entry_get_size(feh_menu * m, feh_menu_item * i, int *w, int *h) *h = FEH_MENUITEM_PAD_TOP + FEH_MENUITEM_PAD_BOTTOM; } - D_RETURN_(4); + return; m = NULL; } @@ -620,8 +592,6 @@ void feh_menu_calc_size(feh_menu * m) int j = 0, count = 0, max_w = 0, max_h = 0, icon_w = 0, next_w = 0; int toggle_w = 0; - D_ENTER(4); - prev_w = m->w; prev_h = m->h; m->calc = 0; @@ -716,13 +686,11 @@ void feh_menu_calc_size(feh_menu * m) } } - D_RETURN_(4); + return; } void feh_menu_draw_item(feh_menu * m, feh_menu_item * i, Imlib_Image im, int ox, int oy) { - D_ENTER(5); - D(5, ("drawing item %p (text %s) on menu %p (name %s)\n", i, i->text, m, m->name)); if (i->text) { @@ -801,18 +769,15 @@ void feh_menu_draw_item(feh_menu * m, feh_menu_item * i, Imlib_Image im, int ox, D(5, ("separator item\n")); feh_menu_draw_separator_at(i->x, i->y, i->w, i->h, im, ox, oy); } - D_RETURN_(5); - m = NULL; + return; } void feh_menu_redraw(feh_menu * m) { Imlib_Updates u, uu; - D_ENTER(5); - if ((!m->needs_redraw) || (!m->visible) || (!m->updates)) - D_RETURN_(5); + return; m->needs_redraw = 0; if (!m->pmap) m->pmap = XCreatePixmap(disp, m->win, m->w, m->h, depth); @@ -839,19 +804,18 @@ void feh_menu_redraw(feh_menu * m) } imlib_updates_free(uu); } - D_RETURN_(5); + return; } feh_menu *feh_menu_find(char *name) { feh_menu_list *l; - D_ENTER(4); for (l = menus; l; l = l->next) { if ((l->menu->name) && (!strcmp(l->menu->name, name))) - D_RETURN(4, l->menu); + return(l->menu); } - D_RETURN(4, NULL); + return(NULL); } void feh_menu_draw_to_buf(feh_menu * m, Imlib_Image im, int ox, int oy) @@ -859,7 +823,6 @@ void feh_menu_draw_to_buf(feh_menu * m, Imlib_Image im, int ox, int oy) feh_menu_item *i; int w, h; - D_ENTER(5); w = gib_imlib_image_get_width(im); h = gib_imlib_image_get_height(im); @@ -869,15 +832,13 @@ void feh_menu_draw_to_buf(feh_menu * m, Imlib_Image im, int ox, int oy) if (RECTS_INTERSECT(i->x, i->y, i->w, i->h, ox, oy, w, h)) feh_menu_draw_item(m, i, im, ox, oy); } - D_RETURN_(5); + return; } void feh_menu_draw_menu_bg(feh_menu * m, Imlib_Image im, int ox, int oy) { int w, h; - D_ENTER(5); - w = gib_imlib_image_get_width(im); h = gib_imlib_image_get_height(im); @@ -886,27 +847,24 @@ void feh_menu_draw_menu_bg(feh_menu * m, Imlib_Image im, int ox, int oy) else gib_imlib_image_fill_rectangle(im, 0, 0, w, h, 205, 203, 176, 255); - D_RETURN_(5); + return; } void feh_menu_draw_toggle_at(int x, int y, int w, int h, Imlib_Image dst, int ox, int oy, int on) { - D_ENTER(5); x -= ox; y -= oy; if (on) gib_imlib_image_fill_rectangle(dst, x, y, w, h, 0, 0, 0, 255); else gib_imlib_image_draw_rectangle(dst, x, y, w, h, 0, 0, 0, 255); - D_RETURN_(5); + return; } void feh_menu_draw_submenu_at(int x, int y, Imlib_Image dst, int ox, int oy, int selected) { ImlibPolygon poly; - D_ENTER(5); - x -= ox; y -= oy; @@ -927,62 +885,54 @@ void feh_menu_draw_submenu_at(int x, int y, Imlib_Image dst, int ox, int oy, int imlib_image_fill_polygon(poly); imlib_polygon_free(poly); - D_RETURN_(5); - selected = 0; + return; } void feh_menu_draw_separator_at(int x, int y, int w, int h, Imlib_Image dst, int ox, int oy) { - D_ENTER(5); gib_imlib_image_fill_rectangle(dst, x - ox + 2, y - oy + 2, w - 4, h - 4, 0, 0, 0, 255); - D_RETURN_(5); + return; } void feh_menu_item_draw_at(int x, int y, int w, int h, Imlib_Image dst, int ox, int oy, int selected) { - D_ENTER(5); imlib_context_set_image(dst); if (selected) gib_imlib_image_fill_rectangle(dst, x - ox, y - oy, w, h, 255, 255, 255, 178); - D_RETURN_(5); + return; } void feh_raise_all_menus(void) { feh_menu_list *l; - D_ENTER(5); - for (l = menus; l; l = l->next) { if (l->menu->visible) XRaiseWindow(disp, l->menu->win); } - D_RETURN_(5); + return; } void feh_redraw_menus(void) { feh_menu_list *l; - D_ENTER(5); - for (l = menus; l; l = l->next) { if (l->menu->needs_redraw) feh_menu_redraw(l->menu); } - D_RETURN_(5); + return; } feh_menu *feh_menu_get_from_window(Window win) { feh_menu_list *l; - D_ENTER(5); for (l = menus; l; l = l->next) if (l->menu->win == win) - D_RETURN(5, l->menu); - D_RETURN(5, NULL); + return(l->menu); + return(NULL); } void feh_menu_init_main(void) @@ -990,7 +940,6 @@ void feh_menu_init_main(void) feh_menu *m; feh_menu_item *mi; - D_ENTER(4); if (!common_menus) feh_menu_init_common(); @@ -1026,7 +975,7 @@ void feh_menu_init_main(void) feh_menu_add_entry(m, "Hide", NULL, NULL, CB_REMOVE, NULL, NULL); feh_menu_add_entry(m, "Delete", NULL, "CONFIRM", 0, NULL, NULL); - D_RETURN_(4); + return; } void feh_menu_init_common() @@ -1035,8 +984,6 @@ void feh_menu_init_common() char buf[30]; feh_menu *m; - D_ENTER(4); - if (!opt.menu_fn) { opt.menu_fn = gib_imlib_load_font(opt.menu_font); if (!opt.menu_fn) @@ -1168,20 +1115,18 @@ void feh_menu_init_common() } common_menus = 1; - D_RETURN_(4); + return; } void feh_menu_init_about_win(void) { - D_ENTER(4); - menu_about_win = feh_menu_new(); menu_about_win->name = estrdup("ABOUTWIN"); feh_menu_add_entry(menu_about_win, "Close", NULL, NULL, CB_CLOSE, NULL, NULL); feh_menu_add_entry(menu_about_win, "Exit", NULL, NULL, CB_EXIT, NULL, NULL); - D_RETURN_(4); + return; } void feh_menu_init_single_win(void) @@ -1189,7 +1134,6 @@ void feh_menu_init_single_win(void) feh_menu *m; feh_menu_item *mi; - D_ENTER(4); if (!common_menus) feh_menu_init_common(); @@ -1222,7 +1166,7 @@ void feh_menu_init_single_win(void) 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); - D_RETURN_(4); + return; } void feh_menu_init_thumbnail_win(void) @@ -1230,7 +1174,6 @@ void feh_menu_init_thumbnail_win(void) feh_menu *m; feh_menu_item *mi; - D_ENTER(4); if (!common_menus) feh_menu_init_common(); @@ -1252,7 +1195,7 @@ void feh_menu_init_thumbnail_win(void) CB_ABOUT, NULL, NULL); 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); - D_RETURN_(4); + return; } void feh_menu_init_thumbnail_viewer(void) @@ -1260,7 +1203,6 @@ void feh_menu_init_thumbnail_viewer(void) feh_menu *m; feh_menu_item *mi; - D_ENTER(4); if (!common_menus) feh_menu_init_common(); @@ -1295,7 +1237,7 @@ void feh_menu_init_thumbnail_viewer(void) m = feh_menu_new(); m->name = estrdup("THUMBVIEW_CONFIRM"); feh_menu_add_entry(m, "Confirm", NULL, NULL, CB_DELETE_THUMB, NULL, NULL); - D_RETURN_(4); + return; } void feh_menu_cb_opt_fullscreen(feh_menu * m, feh_menu_item * i) @@ -1356,8 +1298,6 @@ void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, void *data) Imlib_Image im; winwidget winwid; - D_ENTER(4); - switch (action) { case CB_BG_TILED: path = feh_absolute_path(FEH_FILE(m->fehwin->file->data)->filename); @@ -1517,7 +1457,7 @@ void feh_menu_cb(feh_menu * m, feh_menu_item * i, int action, void *data) winwidget_rerender_all(1, 1); break; } - D_RETURN_(4); + return; } static feh_menu *feh_menu_func_gen_info(feh_menu * m) @@ -1527,13 +1467,12 @@ static feh_menu *feh_menu_func_gen_info(feh_menu * m) feh_file *file; char buffer[400]; - D_ENTER(4); if (!m->fehwin->file) - D_RETURN(4, NULL); + return(NULL); file = FEH_FILE(m->fehwin->file->data); im = m->fehwin->im; if (!im) - D_RETURN(4, NULL); + return(NULL); mm = feh_menu_new(); mm->name = estrdup("INFO"); snprintf(buffer, sizeof(buffer), "Filename: %s", file->name); @@ -1550,21 +1489,19 @@ static feh_menu *feh_menu_func_gen_info(feh_menu * m) } mm->func_free = feh_menu_func_free_info; - D_RETURN(4, mm); + return(mm); } static void feh_menu_func_free_info(feh_menu * m) { - D_ENTER(4); feh_menu_free(m); - D_RETURN_(4); + return; } static feh_menu *feh_menu_func_gen_options(feh_menu * m) { feh_menu *mm; - D_ENTER(4); mm = feh_menu_new(); mm->name = estrdup("OPTIONS"); mm->fehwin = m->fehwin; @@ -1583,12 +1520,11 @@ static feh_menu *feh_menu_func_gen_options(feh_menu * m) feh_menu_add_toggle_entry(mm, "Keep HTTP Files", NULL, NULL, CB_OPT_KEEP_HTTP, NULL, NULL, opt.keep_http); mm->func_free = feh_menu_func_free_options; - D_RETURN(4, mm); + return(mm); } static void feh_menu_func_free_options(feh_menu * m) { - D_ENTER(4); feh_menu_free(m); - D_RETURN_(4); + return; } diff --git a/src/multiwindow.c b/src/multiwindow.c index cd4e82c..4fab4ee 100644 --- a/src/multiwindow.c +++ b/src/multiwindow.c @@ -35,8 +35,6 @@ void init_multiwindow_mode(void) gib_list *l; feh_file *file = NULL; - D_ENTER(2); - mode = "multiwindow"; for (l = filelist; l; l = l->next) { @@ -65,5 +63,5 @@ void init_multiwindow_mode(void) } free(s); } - D_RETURN_(2); + return; } diff --git a/src/options.c b/src/options.c index be020bf..b7deb12 100644 --- a/src/options.c +++ b/src/options.c @@ -42,8 +42,6 @@ fehoptions opt; void init_parse_options(int argc, char **argv) { - D_ENTER(4); - /* For setting the command hint on X windows */ cmdargc = argc; cmdargv = argv; @@ -111,7 +109,7 @@ void init_parse_options(int argc, char **argv) D(4, ("Options parsed\n")); if (opt.bgmode) - D_RETURN_(4); + return; filelist_len = gib_list_length(filelist); if (!filelist_len) @@ -120,12 +118,11 @@ void init_parse_options(int argc, char **argv) check_options(); feh_prepare_filelist(); - D_RETURN_(4); + return; } static void feh_check_theme_options(int arg, char **argv) { - D_ENTER(4); if (!theme) { /* This prevents screw up when running src/feh or ./feh */ char *pos = strrchr(argv[0], '/'); @@ -140,7 +137,7 @@ static void feh_check_theme_options(int arg, char **argv) feh_load_options_for_theme(theme); free(theme); - D_RETURN_(4); + return; arg = 0; } @@ -151,12 +148,10 @@ static void feh_load_options_for_theme(char *theme) char *rcpath = NULL; char s[1024], s1[1024], s2[1024]; - D_ENTER(4); - if (opt.rcfile) { if ((fp = fopen(opt.rcfile, "r")) == NULL) { weprintf("couldn't load the specified rcfile %s\n", opt.rcfile); - D_RETURN_(4); + return; } } else { home = getenv("HOME"); @@ -171,7 +166,7 @@ static void feh_load_options_for_theme(char *theme) feh_create_default_config(rcpath); if ((fp = fopen(rcpath, "r")) == NULL) - D_RETURN_(4); + return; } free(rcpath); @@ -192,17 +187,15 @@ static void feh_load_options_for_theme(char *theme) } } fclose(fp); - D_RETURN_(4); + return; } static void feh_parse_environment_options(void) { char *opts; - D_ENTER(4); - if ((opts = getenv("FEH_OPTIONS")) == NULL) - D_RETURN_(4); + return; weprintf ("The FEH_OPTIONS configuration method is depreciated and will soon die.\n" @@ -210,7 +203,7 @@ static void feh_parse_environment_options(void) /* We definitely have some options to parse */ feh_parse_options_from_string(opts); - D_RETURN_(4); + return; } /* FIXME This function is a crufty bitch ;) */ @@ -224,8 +217,6 @@ static void feh_parse_options_from_string(char *opts) int inquote = 0; int i = 0; - D_ENTER(4); - /* So we don't reinvent the wheel (not again, anyway), we use the getopt_long function to do this parsing as well. This means it has to look like the real argv ;) */ @@ -260,7 +251,7 @@ static void feh_parse_options_from_string(char *opts) free(list[i]); if (list) free(list); - D_RETURN_(4); + return; } char *feh_string_normalize(char *str) @@ -270,7 +261,6 @@ char *feh_string_normalize(char *str) int i = 0; char last = 0; - D_ENTER(4); D(4, ("normalizing %s\n", str)); ret[0] = '\0'; @@ -293,7 +283,7 @@ char *feh_string_normalize(char *str) ret[i] = '\0'; D(4, ("normalized to %s\n", ret)); - D_RETURN(4, estrdup(ret)); + return(estrdup(ret)); } static void feh_parse_option_array(int argc, char **argv) @@ -404,8 +394,6 @@ static void feh_parse_option_array(int argc, char **argv) }; int optch = 0, cmdx = 0; - D_ENTER(4); - /* Now to pass some optionarinos */ while ((optch = getopt_long(argc, argv, stropts, lopts, &cmdx)) != EOF) { D(5, ("Got option, getopt calls it %d, or %c\n", optch, optch)); @@ -769,12 +757,11 @@ static void feh_parse_option_array(int argc, char **argv) /* So that we can safely be called again */ optind = 1; - D_RETURN_(4); + return; } static void check_options(void) { - D_ENTER(4); if ((opt.index + opt.collage) > 1) { weprintf("you can't use collage mode and index mode together.\n" " I'm going with index"); @@ -813,7 +800,7 @@ static void check_options(void) opt.thumb_title = NULL; } - D_RETURN_(4); + return; } static void show_version(void) @@ -1167,11 +1154,9 @@ static void feh_create_default_config(char *rcfile) { FILE *fp; - D_ENTER(4); - if ((fp = fopen(rcfile, "w")) == NULL) { weprintf("Unable to create default config file %s\n", rcfile); - D_RETURN_(4); + return; } fprintf(fp, @@ -1253,5 +1238,5 @@ PREFIX "/share/feh/images/menubg_black.png" PREFIX "/share/feh/fonts/black.style\n"); fclose(fp); - D_RETURN_(4); + return; } diff --git a/src/signals.c b/src/signals.c index eca77e6..73c3aa8 100644 --- a/src/signals.c +++ b/src/signals.c @@ -32,15 +32,13 @@ void setup_signal_handlers() { struct sigaction feh_sh; sigset_t feh_ss; - D_ENTER(4); - if ( (sigemptyset(&feh_ss) == -1) || (sigaddset(&feh_ss, SIGUSR1) == -1) || (sigaddset(&feh_ss, SIGUSR2) == -1)) { weprintf("Failed to set up signal mask, SIGUSR1/2 won't work"); - D_RETURN_(4); + return; } feh_sh.sa_handler = feh_handle_signal; @@ -51,15 +49,14 @@ void setup_signal_handlers() (sigaction(SIGUSR2, &feh_sh, NULL) == -1)) { weprintf("Failed to set up signal handler, SIGUSR1/2 won't work"); - D_RETURN_(4); + return; } - D_RETURN_(4); + return; } void feh_handle_signal(int signo) { - D_ENTER(4); winwidget winwid = winwidget_get_first_window_of_type(WIN_TYPE_SLIDESHOW); @@ -70,5 +67,5 @@ void feh_handle_signal(int signo) slideshow_change_image(winwid, SLIDE_PREV); } - D_RETURN_(4); + return; } diff --git a/src/slideshow.c b/src/slideshow.c index d4cc1b4..255e7d6 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -38,8 +38,6 @@ void init_slideshow_mode(void) gib_list *l = filelist, *last = NULL; feh_file *file = NULL; - D_ENTER(3); - for (l = filelist; l && opt.start_list_at; l = l->next) { if (!strcmp(opt.start_list_at, FEH_FILE(l->data)->filename)) { opt.start_list_at = NULL; @@ -79,24 +77,22 @@ void init_slideshow_mode(void) setup_signal_handlers(); - D_RETURN_(3); + return; } void cb_slide_timer(void *data) { - D_ENTER(4); slideshow_change_image((winwidget) data, SLIDE_NEXT); - D_RETURN_(4); + return; } void cb_reload_timer(void *data) { winwidget w = (winwidget) data; - D_ENTER(4); feh_reload_image(w, 0, 0); feh_add_unique_timer(cb_reload_timer, w, opt.reload); - D_RETURN_(4); + return; } void feh_reload_image(winwidget w, int resize, int force_new) @@ -105,11 +101,9 @@ void feh_reload_image(winwidget w, int resize, int force_new) int len; Imlib_Image tmp; - D_ENTER(4); - if (!w->file) { weprintf("couldn't reload, this image has no file associated with it."); - D_RETURN_(4); + return; } free(FEH_FILE(w->file->data)->caption); @@ -137,7 +131,7 @@ void feh_reload_image(winwidget w, int resize, int force_new) free(title); free(new_title); filelist = feh_file_remove_from_list(filelist, w->file); - D_RETURN_(4); + return; } if (force_new) { w->im = tmp; @@ -174,7 +168,7 @@ void feh_reload_image(winwidget w, int resize, int force_new) free(title); free(new_title); - D_RETURN_(4); + return; } void slideshow_change_image(winwidget winwid, int change) @@ -185,12 +179,10 @@ void slideshow_change_image(winwidget winwid, int change) int jmp = 1; char *s; - D_ENTER(4); - /* Without this, clicking a one-image slideshow reloads it. Not very * intelligent behaviour :-) */ if (filelist_len < 2 && opt.cycle_once == 0) - D_RETURN_(4); + return; /* Ok. I do this in such an odd way to ensure that if the last or first * image is not loadable, it will go through in the right direction to * @@ -284,7 +276,7 @@ void slideshow_change_image(winwidget winwid, int change) if (opt.slideshow_delay > 0.0) feh_add_timer(cb_slide_timer, winwid, opt.slideshow_delay, "SLIDE_CHANGE"); - D_RETURN_(4); + return; } void slideshow_pause_toggle(winwidget w) @@ -303,8 +295,6 @@ char *slideshow_create_name(feh_file * file) char *s = NULL; int len = 0; - D_ENTER(4); - if (!opt.title) { len = strlen(PACKAGE " [slideshow mode] - ") + strlen(file->filename) + 1; s = emalloc(len); @@ -314,12 +304,11 @@ char *slideshow_create_name(feh_file * file) s = estrdup(feh_printf(opt.title, file)); } - D_RETURN(4, s); + return(s); } void feh_action_run(feh_file * file, char *action) { - D_ENTER(4); if (action) { char *sys; D(3, ("Running action %s\n", action)); @@ -329,7 +318,7 @@ void feh_action_run(feh_file * file, char *action) fprintf(stderr, "Running action -->%s<--\n", sys); system(sys); } - D_RETURN_(4); + return; } char *feh_printf(char *str, feh_file * file) @@ -338,8 +327,6 @@ char *feh_printf(char *str, feh_file * file) char buf[20]; static char ret[4096]; - D_ENTER(4); - ret[0] = '\0'; for (c = str; *c != '\0'; c++) { @@ -429,7 +416,7 @@ char *feh_printf(char *str, feh_file * file) } else strncat(ret, c, 1); } - D_RETURN(4, ret); + return(ret); } void feh_filelist_image_remove(winwidget winwid, char do_delete) @@ -467,7 +454,6 @@ void slideshow_save_image(winwidget win) char *tmpname; Imlib_Load_Error err; - D_ENTER(4); if (win->file) { tmpname = feh_unique_filename("", FEH_FILE(win->file->data)->name); } else if (mode) { @@ -487,7 +473,7 @@ void slideshow_save_image(winwidget win) weprintf("Can't save image %s:", tmpname); free(tmpname); - D_RETURN_(4); + return; } gib_list *feh_list_jump(gib_list * root, gib_list * l, int direction, int num) diff --git a/src/support.c b/src/support.c index 4688d6f..004e3d3 100644 --- a/src/support.c +++ b/src/support.c @@ -81,8 +81,6 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, char bgfil[4096]; char sendbuf[4096]; - D_ENTER(4); - snprintf(bgname, sizeof(bgname), "FEHBG_%d", num); if (!fil) { @@ -306,15 +304,13 @@ void feh_wm_set_bg(char *fil, Imlib_Image im, int centered, int scaled, XSetCloseDownMode(disp2, RetainPermanent); XCloseDisplay(disp2); } - D_RETURN_(4); + return; } signed char feh_wm_get_wm_is_e(void) { static signed char e = -1; - D_ENTER(4); - /* check if E is actually running */ if (e == -1) { /* XXX: This only covers E17 prior to 6/22/05 */ @@ -327,7 +323,7 @@ signed char feh_wm_get_wm_is_e(void) e = 0; } } - D_RETURN(4, e); + return(e); } int feh_wm_get_num_desks(void) @@ -335,21 +331,20 @@ int feh_wm_get_num_desks(void) char *buf, *ptr; int desks; - D_ENTER(4); - if (!feh_wm_get_wm_is_e()) - D_RETURN(4, -1); + return(-1); buf = enl_send_and_wait("num_desks ?"); if (buf == IPC_FAKE) /* Fake E17 IPC */ - D_RETURN(4, -1); + return(-1); D(3, ("Got from E IPC: %s\n", buf)); ptr = buf; while (ptr && !isdigit(*ptr)) ptr++; desks = atoi(ptr); -D_RETURN(4, desks)} + return(desks); +} Window enl_ipc_get_win(void) { @@ -362,8 +357,6 @@ Window enl_ipc_get_win(void) int dummy_int; unsigned int dummy_uint; - D_ENTER(4); - D(3, ("Searching for IPC window.\n")); /* @@ -371,19 +364,19 @@ Window enl_ipc_get_win(void) * if we already know it's an e17 fake */ if (e17_fake_ipc) - D_RETURN(4, ipc_win) + return(ipc_win); prop = XInternAtom(disp, "ENLIGHTENMENT_COMMS", True); if (prop == None) { D(3, ("Enlightenment is not running.\n")); - D_RETURN(4, None); + return(None); } else { /* XXX: This will only work with E17 prior to 6/22/2005 */ ever = XInternAtom(disp, "ENLIGHTENMENT_VERSION", True); if (ever == None) { /* This is an E without ENLIGHTENMENT_VERSION */ D(3, ("E16 IPC Protocol not supported")); - D_RETURN(4, None); + return(None); } } XGetWindowProperty(disp, root, prop, 0, 14, False, AnyPropertyType, &prop2, &format, &num, &after, &str); @@ -426,7 +419,7 @@ Window enl_ipc_get_win(void) D(3, (" -> Found a fake E17 IPC window, ignoring")); ipc_win = None; e17_fake_ipc = 1; - D_RETURN(4, ipc_win); + return(ipc_win); } D(3, @@ -441,7 +434,7 @@ Window enl_ipc_get_win(void) if (my_ipc_win == None) { my_ipc_win = XCreateSimpleWindow(disp, root, -2, -2, 1, 1, 0, 0, 0); } - D_RETURN(4, ipc_win); + return(ipc_win); } void enl_ipc_send(char *str) @@ -454,7 +447,6 @@ void enl_ipc_send(char *str) unsigned short len; XEvent ev; - D_ENTER(4); if (str == NULL) { if (last_msg == NULL) eprintf("eeek"); @@ -470,14 +462,14 @@ void enl_ipc_send(char *str) if (ipc_win == None) { if ((ipc_win = enl_ipc_get_win()) == None) { D(3, ("Hrm. Enlightenment doesn't seem to be running. No IPC window, no IPC.\n")); - D_RETURN_(4); + return; } } len = strlen(str); ipc_atom = XInternAtom(disp, "ENL_MSG", False); if (ipc_atom == None) { D(3, ("IPC error: Unable to find/create ENL_MSG atom.\n")); - D_RETURN_(4); + return; } for (; XCheckTypedWindowEvent(disp, my_ipc_win, ClientMessage, &ev);); /* Discard any out-of-sync messages */ ev.xclient.type = ClientMessage; @@ -501,13 +493,13 @@ void enl_ipc_send(char *str) } XSendEvent(disp, ipc_win, False, 0, (XEvent *) & ev); } - D_RETURN_(4); + return; } static sighandler_t *enl_ipc_timeout(int sig) { timeout = 1; - D_RETURN(4, (sighandler_t *) sig); + return((sighandler_t *) sig); sig = 0; } @@ -518,19 +510,17 @@ char *enl_wait_for_reply(void) static char msg_buffer[20]; register unsigned char i; - D_ENTER(4); - alarm(2); for (; !XCheckTypedWindowEvent(disp, my_ipc_win, ClientMessage, &ev) && !timeout;); alarm(0); if (ev.xany.type != ClientMessage) { - D_RETURN(4, IPC_TIMEOUT); + return(IPC_TIMEOUT); } for (i = 0; i < 20; i++) { msg_buffer[i] = ev.xclient.data.b[i]; } - D_RETURN(4, msg_buffer + 8); + return(msg_buffer + 8); } char *enl_ipc_get(const char *msg_data) @@ -542,10 +532,8 @@ char *enl_ipc_get(const char *msg_data) register unsigned char i; unsigned char blen; - D_ENTER(4); - if (msg_data == IPC_TIMEOUT) { - D_RETURN(4, IPC_TIMEOUT); + return(IPC_TIMEOUT); } for (i = 0; i < 12; i++) { buff[i] = msg_data[i]; @@ -566,7 +554,7 @@ char *enl_ipc_get(const char *msg_data) message = NULL; D(4, ("Received complete reply: \"%s\"\n", ret_msg)); } - D_RETURN(4, ret_msg); + return(ret_msg); } char *enl_send_and_wait(char *msg) @@ -574,8 +562,6 @@ char *enl_send_and_wait(char *msg) char *reply = IPC_TIMEOUT; sighandler_t old_alrm; - D_ENTER(4); - /* * Shortcut this func and return IPC_FAKE * If the IPC Window is the E17 fake @@ -606,5 +592,5 @@ char *enl_send_and_wait(char *msg) } } signal(SIGALRM, old_alrm); - D_RETURN(4, reply); + return(reply); } diff --git a/src/thumbnail.c b/src/thumbnail.c index aa45688..c104cb8 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -90,8 +90,6 @@ void init_thumbnail_mode(void) td.vertical = 0; td.max_column_w = 0; - D_ENTER(3); - mode = "thumbnail"; td.font_main = gib_imlib_load_font(opt.font); @@ -404,7 +402,7 @@ void init_thumbnail_mode(void) gib_imlib_free_image_and_decache(td.im_main); free(s); - D_RETURN_(3); + return; } static char *create_index_size_string(char *file) @@ -414,7 +412,6 @@ static char *create_index_size_string(char *file) double kbs = 0.0; struct stat st; - D_ENTER(4); if (stat(file, &st)) kbs = 0.0; else { @@ -423,33 +420,29 @@ static char *create_index_size_string(char *file) } snprintf(str, sizeof(str), "%.2fKb", kbs); - D_RETURN(4, str); + return(str); } static char *create_index_dimension_string(int w, int h) { static char str[50]; - D_ENTER(4); snprintf(str, sizeof(str), "%dx%d", w, h); - D_RETURN(4, str); + return(str); } static char *create_index_title_string(int num, int w, int h) { static char str[50]; - D_ENTER(4); snprintf(str, sizeof(str), PACKAGE " index - %d thumbnails, %d by %d pixels", num, w, h); - D_RETURN(4, str); + return(str); } feh_thumbnail *feh_thumbnail_new(feh_file * file, int x, int y, int w, int h) { feh_thumbnail *thumb; - D_ENTER(4); - thumb = (feh_thumbnail *) emalloc(sizeof(feh_thumbnail)); thumb->x = x; thumb->y = y; @@ -458,7 +451,7 @@ feh_thumbnail *feh_thumbnail_new(feh_file * file, int x, int y, int w, int h) thumb->file = file; thumb->exists = 1; - D_RETURN(4, thumb); + return(thumb); } feh_file *feh_thumbnail_get_file_from_coords(int x, int y) @@ -466,18 +459,16 @@ feh_file *feh_thumbnail_get_file_from_coords(int x, int y) gib_list *l; feh_thumbnail *thumb; - D_ENTER(4); - for (l = thumbnails; l; l = l->next) { thumb = FEH_THUMB(l->data); if (XY_IN_RECT(x, y, thumb->x, thumb->y, thumb->w, thumb->h)) { if (thumb->exists) { - D_RETURN(4, thumb->file); + return(thumb->file); } } } D(4, ("No matching %d %d\n", x, y)); - D_RETURN(4, NULL); + return(NULL); } feh_thumbnail *feh_thumbnail_get_thumbnail_from_coords(int x, int y) @@ -485,18 +476,16 @@ feh_thumbnail *feh_thumbnail_get_thumbnail_from_coords(int x, int y) gib_list *l; feh_thumbnail *thumb; - D_ENTER(4); - for (l = thumbnails; l; l = l->next) { thumb = FEH_THUMB(l->data); if (XY_IN_RECT(x, y, thumb->x, thumb->y, thumb->w, thumb->h)) { if (thumb->exists) { - D_RETURN(4, thumb); + return(thumb); } } } D(4, ("No matching %d %d\n", x, y)); - D_RETURN(4, NULL); + return(NULL); } feh_thumbnail *feh_thumbnail_get_from_file(feh_file * file) @@ -504,18 +493,16 @@ feh_thumbnail *feh_thumbnail_get_from_file(feh_file * file) gib_list *l; feh_thumbnail *thumb; - D_ENTER(4); - for (l = thumbnails; l; l = l->next) { thumb = FEH_THUMB(l->data); if (thumb->file == file) { if (thumb->exists) { - D_RETURN(4, thumb); + return(thumb); } } } D(4, ("No match\n")); - D_RETURN(4, NULL); + return(NULL); } void feh_thumbnail_mark_removed(feh_file * file, int deleted) @@ -523,8 +510,6 @@ void feh_thumbnail_mark_removed(feh_file * file, int deleted) feh_thumbnail *thumb; winwidget w; - D_ENTER(4); - thumb = feh_thumbnail_get_from_file(file); if (thumb) { w = winwidget_get_first_window_of_type(WIN_TYPE_THUMBNAIL); @@ -551,7 +536,7 @@ void feh_thumbnail_mark_removed(feh_file * file, int deleted) } thumb->exists = 0; } - D_RETURN_(4); + return; } void feh_thumbnail_calculate_geometry(void) diff --git a/src/timers.c b/src/timers.c index 710d2ab..578b7d9 100644 --- a/src/timers.c +++ b/src/timers.c @@ -33,10 +33,9 @@ void feh_handle_timer(void) { fehtimer ft; - D_ENTER(4); if (!first_timer) { D(3, ("No timer to handle, returning\n")); - D_RETURN_(4); + return; } ft = first_timer; first_timer = first_timer->next; @@ -47,23 +46,21 @@ void feh_handle_timer(void) free(ft->name); if (ft) free(ft); - D_RETURN_(4); + return; } double feh_get_time(void) { struct timeval timev; - D_ENTER(4); gettimeofday(&timev, NULL); - D_RETURN(4, (double) timev.tv_sec + (((double) timev.tv_usec) / 1000000)); + return((double) timev.tv_sec + (((double) timev.tv_usec) / 1000000)); } void feh_remove_timer(char *name) { fehtimer ft, ptr, pptr; - D_ENTER(4); D(3, ("removing %s\n", name)); pptr = NULL; ptr = first_timer; @@ -82,12 +79,12 @@ void feh_remove_timer(char *name) free(ft->name); if (ft) free(ft); - D_RETURN_(4); + return; } pptr = ptr; ptr = ptr->next; } - D_RETURN_(4); + return; } void feh_add_timer(void (*func) (void *data), void *data, double in, char *name) @@ -95,7 +92,6 @@ void feh_add_timer(void (*func) (void *data), void *data, double in, char *name) fehtimer ft, ptr, pptr; double tally; - D_ENTER(4); D(3, ("adding timer %s for %f seconds time\n", name, in)); feh_remove_timer(name); ft = malloc(sizeof(_fehtimer)); @@ -127,7 +123,7 @@ void feh_add_timer(void (*func) (void *data), void *data, double in, char *name) ft->in -= tally; if (ft->next) ft->next->in -= ft->in; - D_RETURN_(4); + return; } pptr = ptr; ptr = ptr->next; @@ -139,7 +135,7 @@ void feh_add_timer(void (*func) (void *data), void *data, double in, char *name) ft->in -= tally; } D(3, ("ft->in = %f\n", ft->in)); - D_RETURN_(4); + return; } void feh_add_unique_timer(void (*func) (void *data), void *data, double in) @@ -147,7 +143,6 @@ void feh_add_unique_timer(void (*func) (void *data), void *data, double in) static long i = 0; char evname[20]; - D_ENTER(4); snprintf(evname, sizeof(evname), "T_%ld", i); D(4, ("adding timer with unique name %s\n", evname)); feh_add_timer(func, data, in, evname); @@ -155,5 +150,5 @@ void feh_add_unique_timer(void (*func) (void *data), void *data, double in) /* Mega paranoia ;) */ if (i > 1000000) i = 0; - D_RETURN_(4); + return; } diff --git a/src/utils.c b/src/utils.c index b74bc8c..5259af8 100644 --- a/src/utils.c +++ b/src/utils.c @@ -168,7 +168,6 @@ char *feh_unique_filename(char *path, char *basename) struct stat st; pid_t ppid; - D_ENTER(4); /* Massive paranoia ;) */ if (i > 999998) i = 1; @@ -182,7 +181,7 @@ char *feh_unique_filename(char *path, char *basename) tmpname = estrjoin("", path, "feh_", cppid, "_", num, "_", basename, NULL); } while (stat(tmpname, &st) == 0); - D_RETURN(4, tmpname); + return(tmpname); } /* reads file into a string, but limits o 4095 chars and ensures a \0 */ diff --git a/src/winwidget.c b/src/winwidget.c index 8993a15..27af21b 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -40,7 +40,6 @@ static winwidget winwidget_allocate(void) { winwidget ret = NULL; - D_ENTER(4); ret = emalloc(sizeof(_winwidget)); ret->win = 0; @@ -74,17 +73,15 @@ static winwidget winwidget_allocate(void) ret->click_offset_y = 0; ret->has_rotated = 0; - D_RETURN(4, ret); + return(ret); } winwidget winwidget_create_from_image(Imlib_Image im, char *name, char type) { winwidget ret = NULL; - D_ENTER(4); - if (im == NULL) - D_RETURN(4, NULL); + return(NULL); ret = winwidget_allocate(); ret->type = type; @@ -103,7 +100,7 @@ winwidget winwidget_create_from_image(Imlib_Image im, char *name, char type) winwidget_create_window(ret, ret->w, ret->h); winwidget_render_image(ret, 1, 1); - D_RETURN(4, ret); + return(ret); } winwidget winwidget_create_from_file(gib_list * list, char *name, char type) @@ -111,10 +108,8 @@ winwidget winwidget_create_from_file(gib_list * list, char *name, char type) winwidget ret = NULL; feh_file *file = FEH_FILE(list->data); - D_ENTER(4); - if (!file || !file->filename) - D_RETURN(4, NULL); + return(NULL); ret = winwidget_allocate(); ret->file = list; @@ -126,7 +121,7 @@ winwidget winwidget_create_from_file(gib_list * list, char *name, char type) if (winwidget_loadimage(ret, file) == 0) { winwidget_destroy(ret); - D_RETURN(4, NULL); + return(NULL); } if (!ret->win) { @@ -139,7 +134,7 @@ winwidget winwidget_create_from_file(gib_list * list, char *name, char type) winwidget_render_image(ret, 1, 1); } - D_RETURN(4, ret); + return(ret); } void winwidget_create_window(winwidget ret, int w, int h) @@ -152,8 +147,6 @@ void winwidget_create_window(winwidget ret, int w, int h) int x = 0; int y = 0; - D_ENTER(4); - if (ret->full_screen) { w = scr->width; h = scr->height; @@ -288,26 +281,23 @@ void winwidget_create_window(winwidget ret, int w, int h) XSetCommand(disp, ret->win, cmdargv, cmdargc); winwidget_register(ret); - D_RETURN_(4); + return; } void winwidget_update_title(winwidget ret) { char *name; - D_ENTER(4); D(4, ("winwid->name = %s\n", ret->name)); name = ret->name ? ret->name : "feh"; XStoreName(disp, ret->win, name); XSetIconName(disp, ret->win, name); /* XFlush(disp); */ - D_RETURN_(4); + return; } void winwidget_setup_pixmaps(winwidget winwid) { - D_ENTER(4); - if (winwid->full_screen) { if (!(winwid->bg_pmap)) { if (winwid->gc == None) { @@ -333,7 +323,7 @@ void winwidget_setup_pixmaps(winwidget winwid) winwid->had_resize = 0; } } - D_RETURN_(4); + return; } void winwidget_render_image(winwidget winwid, int resize, int alias) @@ -341,8 +331,6 @@ void winwidget_render_image(winwidget winwid, int resize, int alias) int sx, sy, sw, sh, dx, dy, dw, dh; int calc_w, calc_h; - D_ENTER(4); - if (!winwid->full_screen && resize) { winwidget_resize(winwid, winwid->im_w, winwid->im_h); winwidget_reset_image(winwid); @@ -530,7 +518,7 @@ void winwidget_render_image(winwidget winwid, int resize, int alias) feh_draw_zoom(winwid); XSetWindowBackgroundPixmap(disp, winwid->win, winwid->bg_pmap); XClearWindow(disp, winwid->win); - D_RETURN_(4); + return; } void winwidget_render_image_cached(winwidget winwid) @@ -556,8 +544,6 @@ double feh_calc_needed_zoom(double *zoom, int orig_w, int orig_h, int dest_w, in { double ratio = 0.0; - D_ENTER(4); - ratio = ((double) orig_w / orig_h) / ((double) dest_w / dest_h); if (ratio > 1.0) @@ -565,7 +551,7 @@ double feh_calc_needed_zoom(double *zoom, int orig_w, int orig_h, int dest_w, in else *zoom = ((double) dest_h / orig_h); - D_RETURN(4, ratio); + return(ratio); } Pixmap feh_create_checks(void) @@ -573,7 +559,6 @@ Pixmap feh_create_checks(void) static Pixmap checks_pmap = None; Imlib_Image checks = NULL; - D_ENTER(4); if (checks_pmap == None) { int onoff, x, y; @@ -605,15 +590,14 @@ Pixmap feh_create_checks(void) gib_imlib_render_image_on_drawable(checks_pmap, checks, 0, 0, 1, 0, 0); gib_imlib_free_image_and_decache(checks); } - D_RETURN(4, checks_pmap); + return(checks_pmap); } void winwidget_clear_background(winwidget w) { - D_ENTER(4); XSetWindowBackgroundPixmap(disp, w->win, feh_create_checks()); /* XClearWindow(disp, w->win); */ - D_RETURN_(4); + return; } void feh_draw_checks(winwidget win) @@ -621,19 +605,17 @@ void feh_draw_checks(winwidget win) static GC gc = None; XGCValues gcval; - D_ENTER(4); if (gc == None) { gcval.tile = feh_create_checks(); gcval.fill_style = FillTiled; gc = XCreateGC(disp, win->win, GCTile | GCFillStyle, &gcval); } XFillRectangle(disp, win->bg_pmap, gc, 0, 0, win->w, win->h); - D_RETURN_(4); + return; } void winwidget_destroy_xwin(winwidget winwid) { - D_ENTER(4); if (winwid->win) { winwidget_unregister(winwid); XDestroyWindow(disp, winwid->win); @@ -642,12 +624,11 @@ void winwidget_destroy_xwin(winwidget winwid) XFreePixmap(disp, winwid->bg_pmap); winwid->bg_pmap = None; } - D_RETURN_(4); + return; } void winwidget_destroy(winwidget winwid) { - D_ENTER(4); winwidget_destroy_xwin(winwid); if (winwid->name) free(winwid->name); @@ -660,55 +641,49 @@ void winwidget_destroy(winwidget winwid) if (winwid->im) gib_imlib_free_image_and_decache(winwid->im); free(winwid); - D_RETURN_(4); + return; } void winwidget_destroy_all(void) { int i; - D_ENTER(4); /* Have to DESCEND the list here, 'cos of the way _unregister works */ for (i = window_num - 1; i >= 0; i--) winwidget_destroy(windows[i]); - D_RETURN_(4); + return; } void winwidget_rerender_all(int resize, int alias) { int i; - D_ENTER(4); /* Have to DESCEND the list here, 'cos of the way _unregister works */ for (i = window_num - 1; i >= 0; i--) winwidget_render_image(windows[i], resize, alias); - D_RETURN_(4); + return; } winwidget winwidget_get_first_window_of_type(unsigned int type) { int i; - D_ENTER(4); for (i = 0; i < window_num; i++) if (windows[i]->type == type) - D_RETURN(4, windows[i]); - D_RETURN(4, NULL); + return(windows[i]); + return(NULL); } int winwidget_loadimage(winwidget winwid, feh_file * file) { - D_ENTER(4); D(4, ("filename %s\n", file->filename)); - D_RETURN(4, feh_load_image(&(winwid->im), file)); + return(feh_load_image(&(winwid->im), file)); } void winwidget_show(winwidget winwid) { XEvent ev; - D_ENTER(4); - /* feh_debug_print_winwid(winwid); */ if (!winwid->visible) { XMapWindow(disp, winwid->win); @@ -720,18 +695,16 @@ void winwidget_show(winwidget winwid) D(4, ("Window mapped\n")); winwid->visible = 1; } - D_RETURN_(4); + return; } int winwidget_count(void) { - D_ENTER(4); - D_RETURN(4, window_num); + return(window_num); } void winwidget_move(winwidget winwid, int x, int y) { - D_ENTER(4); if (winwid && ((winwid->x != x) || (winwid->y != y))) { winwid->x = x; winwid->y = y; @@ -742,7 +715,7 @@ void winwidget_move(winwidget winwid, int x, int y) } else { D(4, ("No move actually needed\n")); } - D_RETURN_(4); + return; } void winwidget_resize(winwidget winwid, int w, int h) @@ -751,7 +724,6 @@ void winwidget_resize(winwidget winwid, int w, int h) XWindowAttributes attributes; int tc_x, tc_y; - D_ENTER(4); if (opt.geom_flags) { winwid->had_resize = 1; return; @@ -798,20 +770,18 @@ void winwidget_resize(winwidget winwid, int w, int h) D(4, ("No resize actually needed\n")); } - D_RETURN_(4); + return; } void winwidget_hide(winwidget winwid) { - D_ENTER(4); XUnmapWindow(disp, winwid->win); winwid->visible = 0; - D_RETURN_(4); + return; } static void winwidget_register(winwidget win) { - D_ENTER(4); D(5, ("window %p\n", win)); window_num++; if (windows) @@ -821,14 +791,13 @@ static void winwidget_register(winwidget win) windows[window_num - 1] = win; XSaveContext(disp, win->win, xid_context, (XPointer) win); - D_RETURN_(4); + return; } static void winwidget_unregister(winwidget win) { int i, j; - D_ENTER(4); for (i = 0; i < window_num; i++) { if (windows[i] == win) { for (j = i; j < window_num - 1; j++) @@ -843,17 +812,16 @@ static void winwidget_unregister(winwidget win) } } XDeleteContext(disp, win->win, xid_context); - D_RETURN_(4); + return; } winwidget winwidget_get_from_window(Window win) { winwidget ret = NULL; - D_ENTER(4); if (XFindContext(disp, win, xid_context, (XPointer *) & ret) != XCNOENT) - D_RETURN(4, ret); - D_RETURN(4, NULL); + return(ret); + return(NULL); } void winwidget_rename(winwidget winwid, char *newname) @@ -861,7 +829,6 @@ void winwidget_rename(winwidget winwid, char *newname) /* newname == NULL -> update current title */ char *p_str; - D_ENTER(4); if (newname == NULL) newname = estrdup(winwid->name ? winwid->name : ""); if (winwid->name) @@ -881,18 +848,17 @@ void winwidget_rename(winwidget winwid, char *newname) *p_str = '\0'; winwidget_update_title(winwid); - D_RETURN_(4); + return; } void winwidget_free_image(winwidget w) { - D_ENTER(4); if (w->im) gib_imlib_free_image_and_decache(w->im); w->im = NULL; w->im_w = 0; w->im_h = 0; - D_RETURN_(4); + return; } void feh_debug_print_winwid(winwidget w) @@ -912,13 +878,12 @@ void feh_debug_print_winwid(winwidget w) void winwidget_reset_image(winwidget winwid) { - D_ENTER(4); winwid->zoom = 1.0; winwid->im_x = 0; winwid->im_y = 0; winwid->im_angle = 0.0; winwid->has_rotated = 0; - D_RETURN_(4); + return; } void winwidget_sanitise_offsets(winwidget winwid) @@ -926,8 +891,6 @@ void winwidget_sanitise_offsets(winwidget winwid) int far_left, far_top; int min_x, max_x, max_y, min_y; - D_ENTER(4); - far_left = winwid->w - (winwid->im_w * winwid->zoom); far_top = winwid->h - (winwid->im_h * winwid->zoom); @@ -954,16 +917,15 @@ void winwidget_sanitise_offsets(winwidget winwid) if (winwid->im_y < min_y) winwid->im_y = min_y; - D_RETURN_(4); + return; } void winwidget_size_to_image(winwidget winwid) { - D_ENTER(4); winwidget_resize(winwid, winwid->im_w * winwid->zoom, winwid->im_h * winwid->zoom); winwid->im_x = winwid->im_y = 0; winwidget_render_image(winwid, 0, 1); - D_RETURN_(4); + return; } void winwidget_set_pointer(winwidget winwid, int visible) @@ -987,24 +949,21 @@ void winwidget_set_pointer(winwidget winwid, int visible) int winwidget_get_width(winwidget winwid) { int rect[4]; - D_ENTER(4); winwidget_get_geometry(winwid, rect); - D_RETURN(4, rect[2]); + return(rect[2]); } int winwidget_get_height(winwidget winwid) { int rect[4]; - D_ENTER(4); winwidget_get_geometry(winwid, rect); - D_RETURN(4, rect[3]); + return(rect[3]); } void winwidget_get_geometry(winwidget winwid, int *rect) { unsigned int bw, bp; Window child; - D_ENTER(4); if (!rect) return; @@ -1018,7 +977,7 @@ void winwidget_get_geometry(winwidget winwid, int *rect) winwid->y = rect[1]; winwid->w = rect[2]; winwid->h = rect[3]; - D_RETURN_(4); + return; } void winwidget_show_menu(winwidget winwid) |