[curses] Add some resize functionality (2/4)
Peter Berg Larsen
pebl at math.ku.dk
Tue Oct 7 23:12:01 CDT 2003
Changelog:
- Add callback function and signal function for resize events
-------------- next part --------------
diff -b -u wine-20030911/programs/wineconsole/curses.c wine-my/programs/wineconsole/curses.c
--- wine-20030911/programs/wineconsole/curses.c 2003-09-07 07:08:14.000000000 +0200
+++ wine-my/programs/wineconsole/curses.c 2003-09-13 02:52:09.000000000 +0200
@@ -41,6 +41,7 @@
#ifdef HAVE_NCURSES_H
#include <ncurses.h>
#endif
+#include <signal.h>
#undef KEY_EVENT /* avoid redefinition warning */
#include <unistd.h>
#include <windef.h>
@@ -215,6 +216,45 @@
#define wgetch p_wgetch
/******************************************************************
+ * WCCURSES_SignalResize
+ *
+ * Signal handler (setup in Initbackend) to deal with xterm resizing.
+ *
+ */
+void WCCURSES_SignalResize(int signal)
+{
+ endwin();
+ initscr();
+ /* Some systems need this: */
+ /* signal(SIGWINCH,WCCURSES_SignalResize); */
+ WINE_FIXME("User resizing not properly propagated to the program\n");
+}
+
+
+/******************************************************************
+ * WCCURSES_ConsoleResized
+ *
+ *
+ */
+static unsigned WCCURSES_ConsoleResized(INPUT_RECORD* ir)
+{
+ int x,y;
+
+ endwin();
+ initscr();
+ getmaxyx(stdscr,y,x);
+
+ ir[0].EventType = WINDOW_BUFFER_SIZE_EVENT;
+ ir[0].Event.WindowBufferSizeEvent.dwSize.X = x;
+ ir[0].Event.WindowBufferSizeEvent.dwSize.Y = y;
+
+ WINE_FIXME("Console resized by user\n");
+
+ return 1;
+}
+
+
+/******************************************************************
* WCCURSES_ResizeScreenBuffer
*
*
@@ -713,7 +753,11 @@
case KEY_REFERENCE:
case KEY_REFRESH:
case KEY_REPLACE:
- case KEY_RESIZE:
+ goto notFound;
+
+ case KEY_RESIZE: /* xterm resized */
+ numEvent = WCCURSES_ConsoleResized(ir);
+ break;
case KEY_RESTART:
case KEY_RESUME:
case KEY_SAVE:
@@ -936,6 +980,9 @@
mousemask(0, &PRIVATE(data)->initial_mouse_mask);
}
+ /* Setup userresize of xterm */
+ signal(SIGWINCH,WCCURSES_SignalResize);
+
return init_success;
}
More information about the wine-patches
mailing list