From: Raphael Gosselin Date: Wed, 12 Feb 2020 23:01:38 +0000 (-0500) Subject: fix conditional xembed compilation X-Git-Url: https://git.owens.tech///git?a=commitdiff_plain;h=600ebbfbd96ed614f12c138edd8fe05f959d837c;p=vimb.git fix conditional xembed compilation --- diff --git a/doc/vimb.1 b/doc/vimb.1 index 5d70b0f..9305f45 100644 --- a/doc/vimb.1 +++ b/doc/vimb.1 @@ -960,7 +960,7 @@ Contains the pid of the running Vimb instance. .TP .B VIMB_XID Holds the X-Window id of the Vimb window or of the embedding window if Vimb is -started with the -e option. +compiled with XEMBED and started with the -e option. .EE .RE .TP diff --git a/src/config.def.h b/src/config.def.h index 5d36c4b..3cfe23a 100644 --- a/src/config.def.h +++ b/src/config.def.h @@ -26,6 +26,8 @@ #define FEATURE_TITLE_IN_COMPLETION /* enable the read it later queue */ #define FEATURE_QUEUE +/* disable X window embedding */ +//#define FEATURE_NO_XEMBED #ifdef FEATURE_WGET_PROGRESS_BAR /* chars to use for the progressbar */ diff --git a/src/main.c b/src/main.c index e0313a1..9fdae1a 100644 --- a/src/main.c +++ b/src/main.c @@ -17,9 +17,12 @@ * along with this program. If not, see http://www.gnu.org/licenses/. */ -#include +#include "config.h" #include +#ifndef FEATURE_NO_XEMBED +#include #include +#endif #include #include #include @@ -32,7 +35,6 @@ #include "ascii.h" #include "command.h" #include "completion.h" -#include "config.h" #include "ex.h" #include "ext-proxy.h" #include "handler.h" @@ -767,7 +769,9 @@ 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); @@ -817,6 +821,7 @@ static void client_show(WebKitWebView *webview, Client *c) setting_init(c); gtk_widget_show_all(c->window); +#ifndef FEATURE_NO_XEMBED if (vb.embed) { xid = g_strdup_printf("%d", (int)vb.embed); } else { @@ -826,6 +831,7 @@ static void client_show(WebKitWebView *webview, Client *c) /* set the x window id to env */ g_setenv("VIMB_XID", xid, TRUE); g_free(xid); +#endif /* start client in normal mode */ vb_enter(c, 'n'); @@ -840,16 +846,20 @@ static GtkWidget *create_window(Client *c) { GtkWidget *window; +#ifndef FEATURE_NO_XEMBED if (vb.embed) { window = gtk_plug_new(vb.embed); } else { +#endif window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_role(GTK_WINDOW(window), PROJECT_UCFIRST); gtk_window_set_default_size(GTK_WINDOW(window), WIN_WIDTH, WIN_HEIGHT); if (!vb.no_maximize) { gtk_window_maximize(GTK_WINDOW(window)); } +#ifndef FEATURE_NO_XEMBED } +#endif g_object_connect( G_OBJECT(window), @@ -2105,13 +2115,18 @@ int main(int argc, char* argv[]) { Client *c; GError *err = NULL; - char *pidstr, *winid = NULL; + char *pidstr; +#ifndef FEATURE_NO_XEMBED + char *winid = NULL; +#endif gboolean ver = FALSE, buginfo = FALSE; GOptionEntry opts[] = { {"cmd", 'C', 0, G_OPTION_ARG_CALLBACK, (GOptionArgFunc*)autocmdOptionArgFunc, "Ex command run before first page is loaded", NULL}, {"config", 'c', 0, G_OPTION_ARG_FILENAME, &vb.configfile, "Custom configuration file", NULL}, +#ifndef FEATURE_NO_XEMBED {"embed", 'e', 0, G_OPTION_ARG_STRING, &winid, "Reparents to window specified by xid", NULL}, +#endif {"incognito", 'i', 0, G_OPTION_ARG_NONE, &vb.incognito, "Run with user data read-only", NULL}, {"profile", 'p', 0, G_OPTION_ARG_CALLBACK, (GOptionArgFunc*)profileOptionArgFunc, "Profile name", NULL}, {"version", 'v', 0, G_OPTION_ARG_NONE, &ver, "Print version", NULL}, @@ -2175,9 +2190,11 @@ int main(int argc, char* argv[]) vimb_setup(); +#ifndef FEATURE_NO_XEMBED if (winid) { vb.embed = strtol(winid, NULL, 0); } +#endif c = client_new(NULL); client_show(NULL, c); diff --git a/src/main.h b/src/main.h index dee3f77..1c04e3a 100644 --- a/src/main.h +++ b/src/main.h @@ -21,14 +21,16 @@ #define _MAIN_H #include +#include "config.h" +#ifndef FEATURE_NO_XEMBED #include +#endif #include #include #include "shortcut.h" #include "handler.h" #include "file-storage.h" -#include "config.h" #define LENGTH(x) (sizeof x / sizeof x[0]) #define OVERWRITE_STRING(t, s) {if (t) g_free(t); t = g_strdup(s);} @@ -271,7 +273,9 @@ struct Client { struct Vimb { char *argv0; Client *clients; +#ifndef FEATURE_NO_XEMBED Window embed; +#endif GHashTable *modes; /* all available browser main modes */ char *configfile; /* config file given as option on startup */ char *files[FILES_LAST];