char *argv0;
#define LENGTH(x) (sizeof x / sizeof x[0])
-#define CLEANMASK(mask) (mask & (MODKEY|GDK_SHIFT_MASK))
+#define CLEANMASK(mask) (mask & (MODKEY|GDK_SHIFT_MASK))
#define COOKIEJAR_TYPE (cookiejar_get_type ())
#define COOKIEJAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COOKIEJAR_TYPE, CookieJar))
static Client *newclient(void);
static void newwindow(Client *c, const Arg *arg, gboolean noembed);
static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d);
-static void populatepopup(WebKitWebView *web, GtkMenu *menu, Client *c);
-static void popupactivate(GtkMenuItem *menu, Client *);
+static gboolean contextmenu(WebKitWebView *view, GtkWidget *menu,
+ WebKitHitTestResult *target, gboolean keyboard, Client *c);
+static void menuactivate(GtkMenuItem *item, Client *c);
static void print(Client *c, const Arg *arg);
static GdkFilterReturn processx(GdkXEvent *xevent, GdkEvent *event,
gpointer d);
static void source(Client *c, const Arg *arg);
static void spawn(Client *c, const Arg *arg);
static void stop(Client *c, const Arg *arg);
-static void titlechange(WebKitWebView *v, WebKitWebFrame *frame,
- const char *title, Client *c);
+static void titlechange(WebKitWebView *view, GParamSpec *pspec, Client *c);
static void toggle(Client *c, const Arg *arg);
static void togglecookiepolicy(Client *c, const Arg *arg);
static void togglegeolocation(Client *c, const Arg *arg);
static void
loaduri(Client *c, const Arg *arg) {
- char *u, *rp;
+ char *u = NULL, *rp;
const char *uri = (char *)arg->v;
Arg a = { .b = FALSE };
struct stat st;
webkit_web_view_load_uri(c->view, u);
c->progress = 0;
c->title = copystr(&c->title, u);
- g_free(u);
updatetitle(c);
}
+ g_free(u);
}
static void
c->view = WEBKIT_WEB_VIEW(webkit_web_view_new());
g_signal_connect(G_OBJECT(c->view),
- "title-changed",
+ "notify::title",
G_CALLBACK(titlechange), c);
g_signal_connect(G_OBJECT(c->view),
"hovering-over-link",
"button-release-event",
G_CALLBACK(buttonrelease), c);
g_signal_connect(G_OBJECT(c->view),
- "populate-popup",
- G_CALLBACK(populatepopup), c);
+ "context-menu",
+ G_CALLBACK(contextmenu), c);
g_signal_connect(G_OBJECT(c->view),
"resource-request-starting",
G_CALLBACK(beforerequest), c);
kioskmode ^ 1, NULL);
g_object_set(G_OBJECT(settings), "default-font-size",
defaultfontsize, NULL);
+ g_object_set(G_OBJECT(settings), "resizable-text-areas",
+ 1, NULL);
/*
* While stupid, CSS specifies that a pixel represents 1/96 of an inch.
spawn(NULL, &a);
}
-static void
-populatepopup(WebKitWebView *web, GtkMenu *menu, Client *c) {
- GList *items = gtk_container_get_children(GTK_CONTAINER(menu));
+static gboolean
+contextmenu(WebKitWebView *view, GtkWidget *menu, WebKitHitTestResult *target,
+ gboolean keyboard, Client *c) {
+ GList *items = gtk_container_get_children(GTK_CONTAINER(GTK_MENU(menu)));
for(GList *l = items; l; l = l->next) {
- g_signal_connect(l->data, "activate", G_CALLBACK(popupactivate), c);
+ g_signal_connect(l->data, "activate", G_CALLBACK(menuactivate), c);
}
g_list_free(items);
+ return FALSE;
}
static void
-popupactivate(GtkMenuItem *menu, Client *c) {
+menuactivate(GtkMenuItem *item, Client *c) {
/*
* context-menu-action-2000 open link
* context-menu-action-1 open link in window
const char *name;
GtkClipboard *prisel;
- a = gtk_activatable_get_related_action(GTK_ACTIVATABLE(menu));
+ a = gtk_activatable_get_related_action(GTK_ACTIVATABLE(item));
if(a == NULL)
return;
}
static void
-titlechange(WebKitWebView *v, WebKitWebFrame *f, const char *t, Client *c) {
- c->title = copystr(&c->title, t);
- updatetitle(c);
+titlechange(WebKitWebView *view, GParamSpec *pspec, Client *c) {
+ const gchar *t = webkit_web_view_get_title(view);
+ if (t) {
+ c->title = copystr(&c->title, t);
+ updatetitle(c);
+ }
}
static void