aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/pty-unix.c6
-rw-r--r--src/term.c9
-rw-r--r--src/window-xlib.c7
-rw-r--r--src/window-xlib.h1
4 files changed, 15 insertions, 8 deletions
diff --git a/src/pty-unix.c b/src/pty-unix.c
index 33b33f1..dc72972 100644
--- a/src/pty-unix.c
+++ b/src/pty-unix.c
@@ -25,7 +25,7 @@ void runes_pty_backend_spawn_subprocess(RunesTerm *t)
pty->slave = -1;
}
else {
- char *cmd;
+ char *cmd, window_id[32];
int old_stderr_fd;
FILE *old_stderr;
@@ -61,6 +61,10 @@ void runes_pty_backend_spawn_subprocess(RunesTerm *t)
* databases are much more reliable than they were 10 years ago */
unsetenv("COLORTERM");
+ /* this is used by, for instance, w3m */
+ sprintf(window_id, "%lu", runes_window_backend_get_window_id(t));
+ setenv("WINDOWID", window_id, 1);
+
unsetenv("LINES");
unsetenv("COLUMNS");
diff --git a/src/term.c b/src/term.c
index 7bf8c98..70b0df6 100644
--- a/src/term.c
+++ b/src/term.c
@@ -5,15 +5,10 @@
void runes_term_init(RunesTerm *t, int argc, char *argv[])
{
runes_config_init(t, argc, argv);
-
- /* doing most of the pty initialization right at the beginning, because
- * libuv will set up a bunch of state (including potentially things like
- * spawning threads) when that is initialized, and i'm not really sure how
- * that interacts with forking */
- runes_pty_backend_spawn_subprocess(t);
-
runes_display_init(t);
+
runes_window_backend_create_window(t, argc, argv);
+ runes_pty_backend_spawn_subprocess(t);
runes_display_set_window_size(t);
diff --git a/src/window-xlib.c b/src/window-xlib.c
index c9a82bd..b19e9d1 100644
--- a/src/window-xlib.c
+++ b/src/window-xlib.c
@@ -273,6 +273,13 @@ void runes_window_backend_request_close(RunesTerm *t)
XUnlockDisplay(t->w.dpy);
}
+unsigned long runes_window_backend_get_window_id(RunesTerm *t)
+{
+ RunesWindowBackend *w = &t->w;
+
+ return (unsigned long)w->w;
+}
+
void runes_window_backend_get_size(RunesTerm *t, int *xpixel, int *ypixel)
{
cairo_surface_t *surface;
diff --git a/src/window-xlib.h b/src/window-xlib.h
index c7b8960..c1cfe96 100644
--- a/src/window-xlib.h
+++ b/src/window-xlib.h
@@ -37,6 +37,7 @@ void runes_window_backend_request_flush(RunesTerm *t);
void runes_window_backend_request_visual_bell(RunesTerm *t);
void runes_window_backend_request_audible_bell(RunesTerm *t);
void runes_window_backend_request_close(RunesTerm *t);
+unsigned long runes_window_backend_get_window_id(RunesTerm *t);
void runes_window_backend_get_size(RunesTerm *t, int *xpixel, int *ypixel);
void runes_window_backend_set_icon_name(RunesTerm *t, char *name, size_t len);
void runes_window_backend_set_window_title(