Introduction
Introduction Statistics Contact Development Disclaimer Help
tAdd closeview() for JavaScript window closing - surf - customized build of sur…
git clone git://src.adamsgaard.dk/surf
Log
Files
Refs
README
LICENSE
---
commit 2e1fb873613b3917b97c954f0c085ea05016bdce
parent 04d46d1791f1ff3b82a665fbc5b574f4e2a70c97
Author: Quentin Rameau <[email protected]>
Date: Thu, 19 Nov 2015 14:25:29 +0100
Add closeview() for JavaScript window closing
Simply call gtk_widget_destroy() on the window. Then GtkWindow closing
process will take care of the rest.
Diffstat:
M surf.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/surf.c b/surf.c
t@@ -120,6 +120,7 @@ static gboolean decidepolicy(WebKitWebView *v, WebKitPolic…
static void decidenavigation(WebKitPolicyDecision *d, Client *c);
static void decidenewwindow(WebKitPolicyDecision *d, Client *c);
static void decideresource(WebKitPolicyDecision *d, Client *c);
+static void closeview(WebKitWebView *v, Client *c);
static void destroyclient(Client *c);
static void destroywin(GtkWidget* w, Client *c);
static void die(const char *errstr, ...);
t@@ -551,10 +552,9 @@ destroyclient(Client *c)
Client *p;
webkit_web_view_stop_loading(c->view);
- gtk_widget_destroy(GTK_WIDGET(c->view));
- gtk_widget_destroy(c->scroll);
- gtk_widget_destroy(c->vbox);
+ /* Not needed, has already been called
gtk_widget_destroy(c->win);
+ */
for (p = clients; p && p->next != c; p = p->next)
;
t@@ -563,14 +563,20 @@ destroyclient(Client *c)
else
clients = c->next;
free(c);
- if (clients == NULL)
- gtk_main_quit();
+}
+
+void
+closeview(WebKitWebView *v, Client *c)
+{
+ gtk_widget_destroy(c->win);
}
void
destroywin(GtkWidget* w, Client *c)
{
destroyclient(c);
+ if (clients == NULL)
+ gtk_main_quit();
}
void
t@@ -998,6 +1004,8 @@ newview(Client *c, WebKitWebView *rv)
g_signal_connect(G_OBJECT(v),
"button-release-event",
G_CALLBACK(buttonreleased), c);
+ g_signal_connect(G_OBJECT(v), "close",
+ G_CALLBACK(closeview), c);
return v;
}
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.