Xterm driver can now resize the terminal when a mode change is
detected.
This commit is contained in:
parent
d87fa94c09
commit
bef93c04fe
|
@ -197,8 +197,23 @@ void CONSOLE_ResizeScreen(int x, int y)
|
||||||
|
|
||||||
void CONSOLE_NotifyResizeScreen(int x, int y)
|
void CONSOLE_NotifyResizeScreen(int x, int y)
|
||||||
{
|
{
|
||||||
if (driver.resizeScreen)
|
if (driver.notifyResizeScreen)
|
||||||
driver.resizeScreen(x, y);
|
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... */
|
/* Utility functions... */
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
#define ESC '\x1b'
|
||||||
|
|
||||||
static BOOL32 wine_create_console(FILE **master, FILE **slave, int *pid);
|
static BOOL32 wine_create_console(FILE **master, FILE **slave, int *pid);
|
||||||
static FILE *wine_openpty(FILE **master, FILE **slave, char *name,
|
static FILE *wine_openpty(FILE **master, FILE **slave, char *name,
|
||||||
struct termios *term, struct winsize *winsize);
|
struct termios *term, struct winsize *winsize);
|
||||||
|
@ -30,7 +32,7 @@ static FILE *wine_openpty(FILE **master, FILE **slave, char *name,
|
||||||
typedef struct _XTERM_CONSOLE {
|
typedef struct _XTERM_CONSOLE {
|
||||||
FILE *master; /* xterm side of pty */
|
FILE *master; /* xterm side of pty */
|
||||||
FILE *slave; /* wine 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;
|
} XTERM_CONSOLE;
|
||||||
|
|
||||||
static XTERM_CONSOLE xterm_console;
|
static XTERM_CONSOLE xterm_console;
|
||||||
|
@ -47,6 +49,9 @@ void XTERM_Start()
|
||||||
|
|
||||||
chain.close = driver.close;
|
chain.close = driver.close;
|
||||||
driver.close = XTERM_Close;
|
driver.close = XTERM_Close;
|
||||||
|
|
||||||
|
chain.resizeScreen = driver.resizeScreen;
|
||||||
|
driver.resizeScreen = XTERM_ResizeScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XTERM_Init()
|
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
|
* 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
|
* 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) {
|
if ((*pid=fork()) == 0) {
|
||||||
tcsetattr(fileno(*slave), TCSADRAIN, &term);
|
tcsetattr(fileno(*slave), TCSADRAIN, &term);
|
||||||
sprintf(buf, "-Sxx%d", fileno(*master));
|
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");
|
ERR(console, "error creating xterm\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue