X-Git-Url: https://git.danieliu.xyz/?p=surf.git;a=blobdiff_plain;f=surf.c;h=93a1629d14950f89bd8c26cc2d8fefa09d303c5c;hp=cd0a13c261f580125a00866fbf29a7a7a31e7f2a;hb=7e02344a615a61246ccce1c7f770e88fbd57756e;hpb=1abb2ebe7a90eea6e82415a07e0f2ea6e3475e5f diff --git a/surf.c b/surf.c index cd0a13c..93a1629 100644 --- a/surf.c +++ b/surf.c @@ -271,18 +271,20 @@ setup(void) if (signal(SIGHUP, sighup) == SIG_ERR) die("Can't install SIGHUP handler"); - gtk_init(NULL, NULL); - - gdpy = gdk_display_get_default(); - dpy = GDK_DISPLAY_XDISPLAY(gdpy); - - curconfig = defconfig; + if (!(dpy = XOpenDisplay(NULL))) + die("Can't open default display"); /* atoms */ atoms[AtomFind] = XInternAtom(dpy, "_SURF_FIND", False); atoms[AtomGo] = XInternAtom(dpy, "_SURF_GO", False); atoms[AtomUri] = XInternAtom(dpy, "_SURF_URI", False); + gtk_init(NULL, NULL); + + gdpy = gdk_display_get_default(); + + curconfig = defconfig; + /* dirs and files */ cookiefile = buildfile(cookiefile); scriptfile = buildfile(scriptfile); @@ -901,6 +903,7 @@ cleanup(void) g_free(scriptfile); g_free(stylefile); g_free(cachedir); + XCloseDisplay(dpy); } WebKitWebView *