Add new env VIMB_WIN_ID to hold the gtk window id.

Fixes #658.
linenumbers
Daniel Carl 2 years ago
parent 1255049e51
commit 55fb9cc58a
  1. 1
      CHANGELOG.md
  2. 3
      doc/vimb.1
  3. 18
      src/main.c

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
* Allow to push link url to queue by `<S-LeftMouse>` #610.
* Allow to decide if html5 notfication are allowed #651. New setting
'notification=[ask,always,never]' added.
* Add new env `VIMB_WIN_ID` var for `:shellcmd` which holds the own window id.
### Changed
* Modes some files from `$XDG_CONFIG_HOME/vimb` into `$XDG_DATA_HOME/vimb` #582.
Following files are affected `bookmark`, `closed`, `command`, `config`,

@ -969,6 +969,9 @@ Contains the title of the current opened page.
.B VIMB_PID
Contains the pid of the running Vimb instance.
.TP
.B VIMB_WIN_ID
Holds the X-Window id of the Vimb window.
.TP
.B VIMB_XID
Holds the X-Window id of the Vimb window or of the embedding window if Vimb is
compiled with XEMBED and started with the -e option.

@ -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');

Loading…
Cancel
Save