1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00

Richard B's patch to add WINDOWID support to pterm.

[originally from svn r2912]
This commit is contained in:
Simon Tatham 2003-03-06 12:57:37 +00:00
parent 5376d94b96
commit 83da92826e
3 changed files with 16 additions and 0 deletions

View File

@ -1978,6 +1978,13 @@ char *get_x_display(void *frontend)
return gdk_get_display(); return gdk_get_display();
} }
long get_windowid(void *frontend)
{
Terminal *term = (Terminal *)frontend;
struct gui_data *inst = (struct gui_data *)(term->frontend);
return (long)GDK_WINDOW_XWINDOW(inst->area->window);
}
static void help(FILE *fp) { static void help(FILE *fp) {
if(fprintf(fp, if(fprintf(fp,
"pterm option summary:\n" "pterm option summary:\n"

View File

@ -394,6 +394,7 @@ static char *pty_init(void *frontend, void **backend_handle, Config *cfg,
{ {
int slavefd; int slavefd;
pid_t pid, pgrp; pid_t pid, pgrp;
long windowid;
pty_frontend = frontend; pty_frontend = frontend;
*backend_handle = NULL; /* we can't sensibly use this, sadly */ *backend_handle = NULL; /* we can't sensibly use this, sadly */
@ -435,6 +436,8 @@ static char *pty_init(void *frontend, void **backend_handle, Config *cfg,
} }
} }
windowid = get_windowid(pty_frontend);
/* /*
* Fork and execute the command. * Fork and execute the command.
*/ */
@ -476,6 +479,11 @@ static char *pty_init(void *frontend, void **backend_handle, Config *cfg,
sprintf(term_env_var, "TERM=%s", cfg->termtype); sprintf(term_env_var, "TERM=%s", cfg->termtype);
putenv(term_env_var); putenv(term_env_var);
} }
{
char windowid_env_var[40];
sprintf(windowid_env_var, "WINDOWID=%ld", windowid);
putenv(windowid_env_var);
}
/* /*
* SIGINT and SIGQUIT may have been set to ignored by our * SIGINT and SIGQUIT may have been set to ignored by our
* parent, particularly by things like sh -c 'pterm &' and * parent, particularly by things like sh -c 'pterm &' and

View File

@ -47,6 +47,7 @@ GLOBAL void *logctx;
/* Things pty.c needs from pterm.c */ /* Things pty.c needs from pterm.c */
char *get_x_display(void *frontend); char *get_x_display(void *frontend);
int font_dimension(void *frontend, int which);/* 0 for width, 1 for height */ int font_dimension(void *frontend, int which);/* 0 for width, 1 for height */
long get_windowid(void *frontend);
/* Things uxstore.c needs from pterm.c */ /* Things uxstore.c needs from pterm.c */
char *x_get_default(const char *key); char *x_get_default(const char *key);