mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 22:23:03 +01:00
fixed cursor
This commit is contained in:
parent
6405632b49
commit
5aea1c8c15
21
main.c
21
main.c
@ -280,6 +280,26 @@ void prepare_window(WINDOW* w) {
|
|||||||
wresize(w, LINES-2, COLS);
|
wresize(w, LINES-2, COLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Draws cursor relative to input on prompt window.
|
||||||
|
* Removes cursor on friends window and chat windows.
|
||||||
|
*
|
||||||
|
* TODO: Make it work for chat windows
|
||||||
|
*/
|
||||||
|
void position_cursor(WINDOW* w, char* title)
|
||||||
|
{
|
||||||
|
curs_set(1);
|
||||||
|
if (strcmp(title, "[prompt]") == 0) { // main/prompt window
|
||||||
|
int x, y;
|
||||||
|
getyx(w, y, x);
|
||||||
|
move(y, x);
|
||||||
|
}
|
||||||
|
else if (strcmp(title, "[friends]") == 0) // friends window
|
||||||
|
curs_set(0);
|
||||||
|
else // any other window (i.e chat)
|
||||||
|
curs_set(0);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
int ch;
|
int ch;
|
||||||
ToxWindow* a;
|
ToxWindow* a;
|
||||||
@ -299,6 +319,7 @@ int main(int argc, char* argv[]) {
|
|||||||
a->blink = false;
|
a->blink = false;
|
||||||
a->onDraw(a);
|
a->onDraw(a);
|
||||||
draw_bar();
|
draw_bar();
|
||||||
|
position_cursor(a->window, a->title);
|
||||||
|
|
||||||
// Handle input.
|
// Handle input.
|
||||||
ch = getch();
|
ch = getch();
|
||||||
|
Loading…
Reference in New Issue
Block a user