X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=src%2Fwincontrol.c;h=7830636543232ba047a0c5f24fbbd4036a3642fa;hb=6ed13cec71fa9b348f609707c2fc02978609b249;hp=2798455f9e7a3abd290a45e11af5664cf13fab54;hpb=c01d4595cbde0eaae357490b8b3305953293108c;p=plomrogue diff --git a/src/wincontrol.c b/src/wincontrol.c index 2798455..7830636 100644 --- a/src/wincontrol.c +++ b/src/wincontrol.c @@ -33,8 +33,6 @@ /* Return string "prefix" + "id"; malloc()'s string, remember to call free()! */ static char * string_prefixed_id(char * prefix, char id); - - /* Create Winconf, init ->view/height_type/width_type to 0, ->id to "id". */ static void create_winconf(char id, struct WinConf * wcp); @@ -50,15 +48,11 @@ static void save_win_config(char id); /* Free data pointed to inside WinConf struct. */ static void free_winconf_data(char id); - - /* Write geometry of a window to its WinConf, as positive or negative values * (dependent on state ofWinConf->height_type / WinConf->width_type). */ static void set_winconf_geometry(char id); - - /* Get WinConf by "id"; get id of WinConf mothering "win". */ static struct WinConf * get_winconf_by_id(char id); @@ -157,17 +151,11 @@ static void init_winconf_from_file(char id) static void init_win_from_winconf(char id) { - char * tmp = "Trouble in init_win_from_file() with init_win() (win id: _)."; - char * err = try_malloc(strlen(tmp) + 1, "init_win_from_file()"); - memcpy(err, tmp, strlen(tmp) + 1); - err[strlen(tmp) - 3] = id; + char * err = "get_drawfunc_by_char() returns NULL to init_win_from_file()."; struct WinConf * winconf = get_winconf_by_id(id); void * f = get_drawfunc_by_char(winconf->draw); exit_err(NULL == f, err); - uint8_t test = init_win(world.wmeta, &winconf->win, winconf->title, - winconf->height, winconf->width, f); - exit_err(test, err); - free(err); + init_win(&winconf->win, winconf->title, winconf->height, winconf->width, f); } @@ -278,7 +266,7 @@ static void * get_drawfunc_by_char(char c) { return draw_win_inventory; } - if ('i' == c) + else if ('i' == c) { return draw_win_info; } @@ -499,15 +487,14 @@ extern void save_win_configs() extern void toggle_window(char id) { - char * err = "Trouble with toggle_window()."; struct Win * win = get_win_by_id(id); - if (0 == win->prev && world.wmeta->chain_start != win) /* Win outside chain. */ - { - exit_err(append_win(world.wmeta, win), err); + if (0 == win->prev && world.wmeta->chain_start != win) /* Win struct is */ + { /* outside chain. */ + append_win(win); } else { - exit_err(suspend_win(world.wmeta, win), err); + suspend_win(win); } } @@ -579,11 +566,11 @@ extern void scroll_pad(char dir) { if ('+' == dir) { - reset_pad_offset(world.wmeta, world.wmeta->pad_offset + 1); + reset_pad_offset(world.wmeta->pad_offset + 1); } else if ('-' == dir) { - reset_pad_offset(world.wmeta, world.wmeta->pad_offset - 1); + reset_pad_offset(world.wmeta->pad_offset - 1); } } @@ -591,8 +578,6 @@ extern void scroll_pad(char dir) extern void growshrink_active_window(char change) { - char * err = "Trouble with resize_active_win() in " - "growshink_active_window()."; if (0 != world.wmeta->active) { struct yx_uint16 size = world.wmeta->active->framesize; @@ -612,7 +597,7 @@ extern void growshrink_active_window(char change) { size.x++; } - exit_err(resize_active_win(world.wmeta, size), err); + resize_active_win(size); struct WinConf * wcp = get_winconf_by_win(world.wmeta->active); if ( 1 == wcp->width_type && world.wmeta->active->framesize.x > world.wmeta->padsize.x)