diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-03-01 06:07:57 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-03-01 06:07:57 +0800 |
commit | 7aa3b8355acf5d8eec0634980699c32ff69116fb (patch) | |
tree | af4f4951cef45a32a271b66d730767e7b0feacaf /src | |
parent | 783485ff724884f6969f5650b2f73dbd2d37a0fa (diff) | |
download | gsoc2013-epiphany-7aa3b8355acf5d8eec0634980699c32ff69116fb.tar gsoc2013-epiphany-7aa3b8355acf5d8eec0634980699c32ff69116fb.tar.gz gsoc2013-epiphany-7aa3b8355acf5d8eec0634980699c32ff69116fb.tar.bz2 gsoc2013-epiphany-7aa3b8355acf5d8eec0634980699c32ff69116fb.tar.lz gsoc2013-epiphany-7aa3b8355acf5d8eec0634980699c32ff69116fb.tar.xz gsoc2013-epiphany-7aa3b8355acf5d8eec0634980699c32ff69116fb.tar.zst gsoc2013-epiphany-7aa3b8355acf5d8eec0634980699c32ff69116fb.zip |
NULL check. Fixes bug #165999.
2005-02-28 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/MozDownload.cpp:
NULL check. Fixes bug #165999.
* src/ephy-main.c: (slowly_and_stupidly_obtain_timestamp), (main):
Try to get an approximation to the launch time if DESKTOP_STARTUP_ID
is not set. Fixes bug #168820, patch by Elijah Newren.
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-main.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/ephy-main.c b/src/ephy-main.c index 5a62232ca..71b542a1a 100644 --- a/src/ephy-main.c +++ b/src/ephy-main.c @@ -32,6 +32,7 @@ #include <gtk/gtkaboutdialog.h> #include <gtk/gtkmain.h> #include <gtk/gtkmessagedialog.h> +#include <gdk/gdkx.h> #include <libgnome/gnome-program.h> #include <bonobo/bonobo-main.h> #include <glib/gi18n.h> @@ -39,6 +40,7 @@ #include <libgnomevfs/gnome-vfs-utils.h> #include <libxml/xmlversion.h> #include <errno.h> +#include <string.h> static gboolean open_in_existing = FALSE; static gboolean open_in_new_tab = FALSE; @@ -140,6 +142,57 @@ idle_unref (GObject *object) return FALSE; } +/* Copied from libnautilus/nautilus-program-choosing.c; Needed in case + * we have no DESKTOP_STARTUP_ID (with its accompanying timestamp). + */ +static Time +slowly_and_stupidly_obtain_timestamp (Display *xdisplay) +{ + Window xwindow; + XEvent event; + + { + XSetWindowAttributes attrs; + Atom atom_name; + Atom atom_type; + char* name; + + attrs.override_redirect = True; + attrs.event_mask = PropertyChangeMask | StructureNotifyMask; + + xwindow = + XCreateWindow (xdisplay, + RootWindow (xdisplay, 0), + -100, -100, 1, 1, + 0, + CopyFromParent, + CopyFromParent, + CopyFromParent, + CWOverrideRedirect | CWEventMask, + &attrs); + + atom_name = XInternAtom (xdisplay, "WM_NAME", TRUE); + g_assert (atom_name != None); + atom_type = XInternAtom (xdisplay, "STRING", TRUE); + g_assert (atom_type != None); + + name = "Fake Window"; + XChangeProperty (xdisplay, + xwindow, atom_name, + atom_type, + 8, PropModeReplace, name, strlen (name)); + } + + XWindowEvent (xdisplay, + xwindow, + PropertyChangeMask, + &event); + + XDestroyWindow(xdisplay, xwindow); + + return event.xproperty.time; +} + int main (int argc, char *argv[]) { @@ -174,6 +227,10 @@ main (int argc, char *argv[]) GNOME_PARAM_APP_DATADIR, DATADIR, NULL); + /* Get a timestamp manually if need be */ + if (user_time == 0) + user_time = slowly_and_stupidly_obtain_timestamp (gdk_display); + g_set_application_name (_("Epiphany Web Browser")); /* Set default window icon */ |