X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=surf.c;h=5043d33c63da44d6c47c356ae87df20af8a518a0;hb=7c24c61ab22990ce8dd8158706f11ae7cba77bf0;hp=d8a2ef6f92c55bb71be862ed51e246707e0dca94;hpb=6e68af115d24a11ca4135b7a620b68743eff2aa7;p=surf.git diff --git a/surf.c b/surf.c index d8a2ef6..5043d33 100644 --- a/surf.c +++ b/surf.c @@ -211,7 +211,7 @@ die(const char *errstr, ...) va_start(ap, errstr); vfprintf(stderr, errstr, ap); va_end(ap); - exit(EXIT_FAILURE); + exit(1); } void @@ -259,7 +259,8 @@ sigchld(int unused) { if (signal(SIGCHLD, sigchld) == SIG_ERR) die("Can't install SIGCHLD handler"); - while (0 < waitpid(-1, NULL, WNOHANG)); + while (waitpid(-1, NULL, WNOHANG) > 0) + ; } char * @@ -394,9 +395,9 @@ loaduri(Client *c, const Arg *a) const char * geturi(Client *c) { - char *uri; + const char *uri; - if (!(uri = (char *)webkit_web_view_get_uri(c->view))) + if (!(uri = webkit_web_view_get_uri(c->view))) uri = "about:blank"; return uri; } @@ -406,8 +407,8 @@ setatom(Client *c, int a, const char *v) { XSync(dpy, False); XChangeProperty(dpy, c->xid, - atoms[a], XA_STRING, 8, PropModeReplace, - (unsigned char *)v, strlen(v) + 1); + atoms[a], XA_STRING, 8, PropModeReplace, + (unsigned char *)v, strlen(v) + 1); } const char * @@ -905,7 +906,6 @@ winevent(GtkWidget *w, GdkEvent *e, Client *c) void showview(WebKitWebView *v, Client *c) { - GdkGeometry hints = { 1, 1 }; GdkRGBA bgcolor = { 0 }; GdkWindow *gwin; @@ -916,8 +916,6 @@ showview(WebKitWebView *v, Client *c) c->win = createwindow(c); gtk_container_add(GTK_CONTAINER(c->win), GTK_WIDGET(c->view)); - gtk_window_set_geometry_hints(GTK_WINDOW(c->win), NULL, &hints, - GDK_HINT_MIN_SIZE); gtk_widget_show_all(c->win); gtk_widget_grab_focus(GTK_WIDGET(c->view)); @@ -951,6 +949,7 @@ showview(WebKitWebView *v, Client *c) GtkWidget * createwindow(Client *c) { + char *wmstr; GtkWidget *w; if (embed) { @@ -958,19 +957,14 @@ createwindow(Client *c) } else { w = gtk_window_new(GTK_WINDOW_TOPLEVEL); - /* TA: 20091214: Despite what the GNOME docs say, the ICCCM - * is always correct, so we should still call this function. - * But when doing so, we *must* differentiate between a - * WM_CLASS and a resource on the window. By convention, the - * window class (WM_CLASS) is capped, while the resource is in - * lowercase. Both these values come as a pair. - */ - gtk_window_set_wmclass(GTK_WINDOW(w), "surf", "Surf"); + wmstr = g_path_get_basename(argv0); + gtk_window_set_wmclass(GTK_WINDOW(w), wmstr, "Surf"); + g_free(wmstr); - /* TA: 20091214: And set the role here as well -- so that - * sessions can pick this up. - */ - gtk_window_set_role(GTK_WINDOW(w), "Surf"); + wmstr = g_strdup_printf("%s[%lu]", "Surf", + webkit_web_view_get_page_id(c->view)); + gtk_window_set_role(GTK_WINDOW(w), wmstr); + g_free(wmstr); gtk_window_set_default_size(GTK_WINDOW(w), 800, 600); } @@ -1562,5 +1556,5 @@ main(int argc, char *argv[]) gtk_main(); cleanup(); - return EXIT_SUCCESS; + return 0; }