Encapsulate a curses function to reduce dependencies.
bool multiple, char ***files, int *numfiles)
{
int ret;
- int x;
+ int col;
struct EnterState *es = mutt_enter_state_new();
mutt_window_addstr(field);
mutt_curses_set_color(MT_COLOR_NORMAL);
mutt_refresh();
- mutt_window_getxy(MuttMessageWindow, &x, NULL);
- ret = mutt_enter_string_full(buf, buflen, x, complete, multiple, files, numfiles, es);
+ mutt_window_get_coords(MuttMessageWindow, NULL, &col);
+ ret = mutt_enter_string_full(buf, buflen, col, complete, multiple, files, numfiles, es);
} while (ret == 1);
mutt_window_clearline(MuttMessageWindow, 0);
mutt_enter_state_free(&es);
}
/**
- * mutt_window_getxy - Get the cursor position in the Window
+ * mutt_window_get_coords - Get the cursor position in the Window
* @param[in] win Window
- * @param[out] x X-Coordinate
- * @param[out] y Y-Coordinate
+ * @param[out] row Row in Window
+ * @param[out] col Column in Window
*
* Assumes the current position is inside the window. Otherwise it will
* happily return negative or values outside the window boundaries
*/
-void mutt_window_getxy(struct MuttWindow *win, int *x, int *y)
+void mutt_window_get_coords(struct MuttWindow *win, int *row, int *col)
{
- int row = 0;
- int col = 0;
-
- getyx(stdscr, row, col);
- if (x)
- *x = col - win->col_offset;
- if (y)
- *y = row - win->row_offset;
+ int x = 0;
+ int y = 0;
+
+ getyx(stdscr, y, x);
+ if (col)
+ *col = x - win->col_offset;
+ if (row)
+ *row = y - win->row_offset;
}
/**
void mutt_window_copy_size (const struct MuttWindow *win_src, struct MuttWindow *win_dst);
void mutt_window_free (struct MuttWindow **ptr);
void mutt_window_free_all (void);
-void mutt_window_getxy (struct MuttWindow *win, int *x, int *y);
+void mutt_window_get_coords (struct MuttWindow *win, int *col, int *row);
void mutt_window_init (void);
struct MuttWindow *mutt_window_new (void);
void mutt_window_reflow (void);
if (!C_SidebarVisible)
return;
-#ifdef USE_SLANG_CURSES
- int x = SLsmg_get_column();
- int y = SLsmg_get_row();
-#else
- int x = getcurx(stdscr);
- int y = getcury(stdscr);
-#endif
+ int row = 0, col = 0;
+ mutt_window_get_coords(MuttSidebarWindow, &row, &col);
int num_rows = MuttSidebarWindow->rows;
int num_cols = MuttSidebarWindow->cols;
}
draw_sidebar(num_rows, num_cols, div_width);
- mutt_window_move_abs(y, x);
+ mutt_window_move(MuttSidebarWindow, row, col);
}
/**