* structs Win, WinMeta
*/
#include "yx_uint16.h" /* for yx_uint16 struct */
-#include "main.h" /* for Wins struct */
+#include "main.h" /* for world global */
#include "readwrite.h" /* for get_linemax(), try_fopen(), try_fclose(),
* try_fgets(), try_fclose_unlink_rename(), try_fwrite()
*/
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);
}
{
continue;
}
- struct Win * win = get_win_by_id(win_order[i]);
- toggle_window(world.wmeta, win);
+ toggle_window(win_order[i]);
if (a == (uint8_t) win_order[i])
{
- world.wmeta->active = win;
+ world.wmeta->active = get_win_by_id(win_order[i]);
}
}
}
-extern uint8_t toggle_window(struct WinMeta * win_meta, struct Win * win)
+extern void toggle_window(char id)
{
- if (0 == win->prev && win_meta->chain_start != win) /* Win outside chain. */
- {
- return append_win(win_meta, win);
+ struct Win * win = get_win_by_id(id);
+ if (0 == win->prev && world.wmeta->chain_start != win) /* Win struct is */
+ { /* outside chain. */
+ append_win(win);
}
else
{
- return suspend_win(win_meta, win);
+ suspend_win(win);
}
}
-extern void toggle_winconfig(struct Win * win)
+extern void toggle_winconfig()
{
- struct WinConf * wcp = get_winconf_by_win(win);
+ struct Win * win = world.wmeta->active;
+ struct WinConf * wcp = get_winconf_by_win(win);
if (0 == wcp->view)
{
win->draw = draw_winconf_geometry;
-extern void toggle_win_height_type(struct Win * win)
+extern void toggle_win_height_type()
{
+ struct Win * win = world.wmeta->active;
struct WinConf * wcp = get_winconf_by_win(win);
if (0 == wcp->height_type)
{
-extern void toggle_win_width_type(struct Win * win)
+extern void toggle_win_width_type()
{
+ struct Win * win = world.wmeta->active;
struct WinConf * wcp = get_winconf_by_win(win);
if (0 == wcp->width_type && win->framesize.x <= world.wmeta->padsize.x)
{
-extern void scroll_pad(struct WinMeta * win_meta, char dir)
+extern void scroll_pad(char dir)
{
if ('+' == dir)
{
- reset_pad_offset(win_meta, win_meta->pad_offset + 1);
+ reset_pad_offset(world.wmeta->pad_offset + 1);
}
else if ('-' == dir)
{
- reset_pad_offset(win_meta, win_meta->pad_offset - 1);
+ reset_pad_offset(world.wmeta->pad_offset - 1);
}
}
-extern uint8_t growshrink_active_window(char change)
+extern void growshrink_active_window(char change)
{
if (0 != world.wmeta->active)
{
{
size.x++;
}
- uint8_t x = resize_active_win(world.wmeta, size);
+ 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)
wcp->width_type = 0;
}
set_winconf_geometry(wcp->id);
- return x;
}
- return 0;
}