mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-31 00:30:57 +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 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
|
void
|
||||||
Con_Init (const char *plugin_name)
|
Con_Init (const char *plugin_name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,6 +45,9 @@
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <termios.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "QF/cmd.h"
|
#include "QF/cmd.h"
|
||||||
|
@ -104,6 +107,13 @@ C_ExecLine (const char *line)
|
||||||
line++;
|
line++;
|
||||||
Cbuf_AddText (line);
|
Cbuf_AddText (line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sigwinch (int sig)
|
||||||
|
{
|
||||||
|
ungetch (KEY_RESIZE);
|
||||||
|
signal (SIGWINCH, sigwinch);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,6 +125,8 @@ C_Init (void)
|
||||||
"set to 0 to disable curses server console");
|
"set to 0 to disable curses server console");
|
||||||
use_curses = curses->int_val;
|
use_curses = curses->int_val;
|
||||||
if (use_curses) {
|
if (use_curses) {
|
||||||
|
signal (SIGWINCH, sigwinch);
|
||||||
|
|
||||||
initscr ();
|
initscr ();
|
||||||
start_color ();
|
start_color ();
|
||||||
cbreak ();
|
cbreak ();
|
||||||
|
@ -220,6 +232,16 @@ C_ProcessInput (void)
|
||||||
const char *text;
|
const char *text;
|
||||||
|
|
||||||
switch (ch) {
|
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 KEY_ENTER:
|
||||||
case '\n':
|
case '\n':
|
||||||
case '\r':
|
case '\r':
|
||||||
|
|
|
@ -149,7 +149,8 @@ main (int argc, const char *argv[])
|
||||||
if (svs.num_clients || !sys_dead_sleep->int_val)
|
if (svs.num_clients || !sys_dead_sleep->int_val)
|
||||||
timeout = &_timeout;
|
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;
|
continue;
|
||||||
stdin_ready = FD_ISSET (0, &fdset);
|
stdin_ready = FD_ISSET (0, &fdset);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue