Xterm driver can now resize the terminal when a mode change is

detected.
This commit is contained in:
Joseph Pranevich 1999-01-03 16:15:39 +00:00 committed by Alexandre Julliard
parent d87fa94c09
commit bef93c04fe
2 changed files with 39 additions and 4 deletions

View File

@ -197,8 +197,23 @@ void CONSOLE_ResizeScreen(int x, int y)
void CONSOLE_NotifyResizeScreen(int x, int y)
{
if (driver.resizeScreen)
driver.resizeScreen(x, y);
if (driver.notifyResizeScreen)
driver.notifyResizeScreen(x, y);
}
void CONSOLE_WriteRawString(char *str)
{
/* This is a special function that is only for internal use and
does not actually call any of the console drivers. It's
primary purpose is to provide a way for higher-level drivers
to write directly to the underlying terminal without worry that
there will be any retranslation done by the assorted drivers. Care
should be taken to ensure that this only gets called when the thing
written does not actually produce any output or a CONSOLE_Redraw()
is called immediately afterwards.
CONSOLE_Redraw() is not yet implemented.
*/
fprintf(driver.console_out, "%s", str);
}
/* Utility functions... */

View File

@ -19,6 +19,8 @@
#include "console.h"
#include "debug.h"
#define ESC '\x1b'
static BOOL32 wine_create_console(FILE **master, FILE **slave, int *pid);
static FILE *wine_openpty(FILE **master, FILE **slave, char *name,
struct termios *term, struct winsize *winsize);
@ -30,7 +32,7 @@ static FILE *wine_openpty(FILE **master, FILE **slave, char *name,
typedef struct _XTERM_CONSOLE {
FILE *master; /* xterm side of pty */
FILE *slave; /* wine side of pty */
int pid; /* xterm's pid, -1 if no xterm */
int pid; /* xterm's pid, -1 if no xterm */
} XTERM_CONSOLE;
static XTERM_CONSOLE xterm_console;
@ -47,6 +49,9 @@ void XTERM_Start()
chain.close = driver.close;
driver.close = XTERM_Close;
chain.resizeScreen = driver.resizeScreen;
driver.resizeScreen = XTERM_ResizeScreen;
}
void XTERM_Init()
@ -80,6 +85,20 @@ void XTERM_Close()
}
}
void XTERM_ResizeScreen(int x, int y)
{
char temp[100];
/* Call the chain first, there shoudln't be any... */
if (chain.resizeScreen)
chain.resizeScreen(x, y);
sprintf(temp, "\x1b[8;%d;%dt", y, x);
CONSOLE_WriteRawString(temp);
CONSOLE_NotifyResizeScreen(x, y);
}
/**
* It looks like the openpty that comes with glibc in RedHat 5.0
* is buggy (second call returns what looks like a dup of 0 and 1
@ -145,7 +164,8 @@ static BOOL32 wine_create_console(FILE **master, FILE **slave, int *pid)
if ((*pid=fork()) == 0) {
tcsetattr(fileno(*slave), TCSADRAIN, &term);
sprintf(buf, "-Sxx%d", fileno(*master));
execlp("xterm", "xterm", buf, NULL);
execlp(CONSOLE_XTERM_PROG, CONSOLE_XTERM_PROG, buf, "-fg",
"white", "-bg", "black", NULL);
ERR(console, "error creating xterm\n");
exit(1);
}