Files
autoconfig
cgi
cross_compile
flex
gdb_pretty_print
linking
.gitignore
1st_day_of_month.cpp
JJbY.cpp
Makefile
Tp6G.cpp
alternatice_bracket.c
ascii_injection.py
ascii_nn_input_helper.py
bind_test.sh
blumba.html
bootrap.html
brython_hw.html
c.php
c_old_argument_notation.c
cnn.c
comp.c
conditional_const.c
const.c
cpp_regex_error.cpp
current_year.cpp
dda2.cpp
dog.jpg
dog2.jpg
dpt.py
dropdown.html
else_while.c
example.m4
extension_cut.Makefile
fddl.js
fizzbuzz.f90
for_ctags.cpp
format.py
free_null.c
gcc_include_next.c
gdb_graph.c
getopt_test.c
gnu_decimals.c
gnu_history.c
gnu_regex.c
gnu_regex2.c
graph.py
group.py
guards.hs
header.h
index_in_initializer_list_compiler_extension.c
initials_test.html
int_memory.ctype.py
int_memory.py.py
knr.c
levenshtein_dist_-_usage.cpp
map_initialization.cpp
menu.vim
ncurses_labels.c
ncurses_mv_win.cpp
ncurses_plus_readline.cpp
ncurses_resize2.cpp
ncurses_resize_hello_world.cpp
ncurses_resize_test.c
ncurses_scroll.c
nf.c
null_printf.c
null_printf.cpp
otest.py
portable_namespace.c
portable_namespace.h
pta.c
python.html
scoping_showcase.c
screen_size_(without_curses).c
sdl_render_to_texture.cpp
sentinel_pack.c
setjmp_test.cpp
spring.html
strdup.c
table_abusing.html
tcc_int.c
test.c
test.html
test.info
test.texi
test.vim
tkinter_filepicker_test.py
torus.py
typedef.c
unctrl.c
undefined_reference.c
tests/ncurses_resize_test.c
2024-03-10 15:57:36 +01:00

115 lines
2.3 KiB
C

#include <signal.h>
#include <ncurses.h>
void handle_winch(int sig)
{
endwin();
refresh();
clear();
}
int main() {
initscr();
cbreak();
noecho();
curs_set(0);
signal(SIGWINCH, handle_winch);
while(true){
mvprintw(LINES-2, 0, "Hello, world! %d:%d\n", LINES, COLS);
refresh();
}
endwin();
return 0;
}
//#include <signal.h>
//#include <ncurses.h>
//
//void sigwinch_handler(int sig) {
// // Tell ncurses to update its internal screen size data
// endwin();
// refresh();
//}
//
//int main() {
// // Initialize ncurses
// initscr();
// cbreak();
// noecho();
// curs_set(0);
//
// // Register the SIGWINCH signal handler
// signal(SIGWINCH, sigwinch_handler);
//
// // Set the initial screen color and print a message
// start_color();
// init_pair(1, COLOR_BLUE, COLOR_TRANSPARENT);
// bkgd(COLOR_PAIR(1));
// printw("Hello, world!\n");
//
// // Wait for user input
// refresh();
// getch();
//
// // Resize the screen
// endwin();
// refresh();
// int new_rows, new_cols;
// getmaxyx(stdscr, new_rows, new_cols);
// resizeterm(new_rows, new_cols);
//
// // Update the screen color and print another message
// init_pair(2, COLOR_RED, COLOR_TRANSPARENT);
// bkgd(COLOR_PAIR(2));
// printw("Goodbye!\n");
//
// // Wait for user input
// refresh();
// getch();
//
// // Clean up and exit
// endwin();
// return 0;
//}
//#include <signal.h>
//#include <ncurses.h>
//
//void sigwinch_handler(int sig) {
// // Resize the terminal to the new size
// endwin();
// refresh();
// resize_term(LINES, COLS);
//}
//
//int main() {
// // Initialize ncurses
// initscr();
// cbreak();
// noecho();
//
// // Register the SIGWINCH signal handler
// signal(SIGWINCH, sigwinch_handler);
//
// // Print the initial size of the screen
// printw("Initial screen size: %d rows, %d columns\n", LINES, COLS);
//
// // Wait for user input
// refresh();
// getch();
//
// // Resize the screen
// resize_term(40, 80);
//
// // Print the new size of the screen
// printw("New screen size: %d rows, %d columns\n", LINES, COLS);
//
// // Wait for user input
// refresh();
// getch();
//
// // Clean up and exit
// endwin();
// return 0;
//}