Here's the structs for my window(s):
Within my main Windownode, I found the need to have another derived window within it, so I'm trying to add that derived window with this...Code:struct _display { int top_limit; int bottom_limit; int current; int max_y; int max_x; int total; }; typedef struct _sub_window { WINDOW *win; struct _display *display; } Sub_window; typedef struct _wnode { WINDOW *win; struct _sub_window sub_window; struct _display *display; struct _wnode *next; struct _wnode *prev; } Windownode;
In main, I'm calling the function like this...Code:int init_sub_window(Windownode **node, int sub_rows, int sub_cols, int start_y, int start_x) { WINDOW *derived_window; struct _display *local_display; Sub_window *temp; temp = safemalloc(sizeof(Sub_window)); local_display = safemalloc(sizeof(struct _display)); /* TODO: Safe malloc for derived windows. */ derived_window = derwin((*node)->win, (*node)->display->max_y - sub_rows, (*node)->display->max_x - sub_cols, \ start_y, start_x); if(!derived_window) { fprintf(stderr, "Error in derived window allocation!"); exit(1); } temp->win = derived_window; temp->display = local_display; getmaxyx(temp->win, temp->display->max_y, temp->display->max_x); temp->display->top_limit = 0; temp->display->bottom_limit = temp->display->max_y; temp->display->current = 0; temp->display->total = 0; (*node)->sub_window = temp; }
But, the error I'm getting for this setup is...Code:init_sub_window(&win_parent[MAIN], 4, 2, 1, 1);
Line 81 is that last line, (*node)->sub_window = temp;. Within the function, I've tried *node->sub_window, (*node)->sub_window, and *(node)->sub_window, but no success. Where I get the derived window part of the function, where I have (*node)->win and all, I don't get any errors, but that was after tinkering with the parentheses and asterisk. I don't think I understand why those take but the (*node)->sub_window at the bottom doesn't. What I had thought about doing was passing the parent window's Sub_window AND the entire parent window's structure so that I could get it's max_y and max_x, but that seems to be overkill. What am I doing wrong? Thanks.Code:gcc -g3 -c main.c gcc -g3 -c color.c gcc -g3 -c print.c gcc -g3 -c tree.c gcc -g3 -c window.c window.c: In function 'init_sub_window': window.c:81: error: incompatible types in assignment make: *** [window.o] Error 1



LinkBack URL
About LinkBacks


