mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
expernimental code to get window resizing working
This commit is contained in:
parent
ad4f29c6a8
commit
df330f33fd
3 changed files with 28 additions and 1 deletions
|
@ -45,6 +45,10 @@ int con_linewidth; // characters across screen
|
|||
|
||||
static plugin_t *con_module;
|
||||
|
||||
static void (*const complete)(inputline_t *) = Con_BasicCompleteCommandLine;
|
||||
static inputline_t *(*const create)(int, int, char) = Con_CreateInputLine;
|
||||
static void (*const display)(const char **, int) = Con_DisplayList;
|
||||
|
||||
void
|
||||
Con_Init (const char *plugin_name)
|
||||
{
|
||||
|
|
|
@ -45,6 +45,9 @@
|
|||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "QF/cmd.h"
|
||||
|
@ -104,6 +107,13 @@ C_ExecLine (const char *line)
|
|||
line++;
|
||||
Cbuf_AddText (line);
|
||||
}
|
||||
|
||||
static void
|
||||
sigwinch (int sig)
|
||||
{
|
||||
ungetch (KEY_RESIZE);
|
||||
signal (SIGWINCH, sigwinch);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -115,6 +125,8 @@ C_Init (void)
|
|||
"set to 0 to disable curses server console");
|
||||
use_curses = curses->int_val;
|
||||
if (use_curses) {
|
||||
signal (SIGWINCH, sigwinch);
|
||||
|
||||
initscr ();
|
||||
start_color ();
|
||||
cbreak ();
|
||||
|
@ -220,6 +232,16 @@ C_ProcessInput (void)
|
|||
const char *text;
|
||||
|
||||
switch (ch) {
|
||||
case KEY_RESIZE:
|
||||
{
|
||||
struct winsize size;
|
||||
|
||||
if (ioctl (fileno (stdout), TIOCGWINSZ, &size) == 0) {
|
||||
resizeterm (size.ws_row, size.ws_col);
|
||||
wrefresh (curscr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KEY_ENTER:
|
||||
case '\n':
|
||||
case '\r':
|
||||
|
|
|
@ -149,7 +149,8 @@ main (int argc, const char *argv[])
|
|||
if (svs.num_clients || !sys_dead_sleep->int_val)
|
||||
timeout = &_timeout;
|
||||
|
||||
if (select (net_socket + 1, &fdset, NULL, NULL, timeout) == -1)
|
||||
if (select (net_socket + 1, &fdset, NULL, NULL, timeout) == -1
|
||||
&& errno != EINTR)
|
||||
continue;
|
||||
stdin_ready = FD_ISSET (0, &fdset);
|
||||
|
||||
|
|
Loading…
Reference in a new issue