From 55fb9cc58a1c8fc675b2df4a10e0f99b264f4a40 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Mon, 25 Jan 2021 22:51:40 +0100 Subject: Add new env VIMB_WIN_ID to hold the gtk window id. Fixes #658. --- src/main.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 07620b3..da81026 100644 --- a/src/main.c +++ b/src/main.c @@ -770,9 +770,6 @@ static Client *client_new(WebKitWebView *webview) static void client_show(WebKitWebView *webview, Client *c) { GtkWidget *box; -#ifndef FEATURE_NO_XEMBED - char *xid; -#endif c->window = create_window(c); @@ -822,17 +819,22 @@ static void client_show(WebKitWebView *webview, Client *c) setting_init(c); gtk_widget_show_all(c->window); + + char *wid; + wid = g_strdup_printf("%d", (int)GDK_WINDOW_XID(gtk_widget_get_window(c->window))); + g_setenv("VIMB_WIN_ID", wid, TRUE); #ifndef FEATURE_NO_XEMBED + /* set the x window id to env */ if (vb.embed) { + char *xid; xid = g_strdup_printf("%d", (int)vb.embed); + g_setenv("VIMB_XID", xid, TRUE); + g_free(xid); } else { - xid = g_strdup_printf("%d", (int)GDK_WINDOW_XID(gtk_widget_get_window(c->window))); + g_setenv("VIMB_XID", wid, TRUE); } - - /* set the x window id to env */ - g_setenv("VIMB_XID", xid, TRUE); - g_free(xid); #endif + g_free(wid); /* start client in normal mode */ vb_enter(c, 'n'); -- cgit v1.2.3