X-Git-Url: https://git.webkit.org/?p=WebKit.git;a=blobdiff_plain;f=WebKitTools%2FGdkLauncher%2Fmain.cpp;h=23689af5df25d5439e8f513b28e4eda43cb0309a;hp=f2b8862da07aadcafd0c8c9e7e969a9795102f43;hb=1dc19f48288ac294249e3ee20ad452708a75ab72;hpb=3298a26419864d0fa7217abb2414bef76471e770 diff --git a/WebKitTools/GdkLauncher/main.cpp b/WebKitTools/GdkLauncher/main.cpp index f2b8862da07a..23689af5df25 100644 --- a/WebKitTools/GdkLauncher/main.cpp +++ b/WebKitTools/GdkLauncher/main.cpp @@ -10,11 +10,9 @@ #include "Document.h" #include "DocLoader.h" #include "DOMImplementation.h" -//#include "HTMLDocument.h" #include "Cache.h" #include "EventNames.h" -//#include "htmlnames.h" #if SVG_SUPPORT #include "SVGNames.h" @@ -22,58 +20,80 @@ #include "SVGDocumentExtensions.h" #endif -//painting #include "RenderObject.h" #include "GraphicsContext.h" using namespace WebCore; -static FrameGdk *frame; +class LauncherFrameGdk : public FrameGdk +{ +public: + LauncherFrameGdk(Page* page, Element* element) : FrameGdk(page, element), m_exitAfterLoading(false) {} + LauncherFrameGdk(GdkDrawable* drawable) : FrameGdk(drawable), m_exitAfterLoading(false) {} + virtual void handledOnloadEvents(); + void setExitAfterLoading(bool exitAfterLoading) { m_exitAfterLoading = exitAfterLoading; } +private: + bool m_exitAfterLoading; +}; + +void LauncherFrameGdk::handledOnloadEvents() +{ + if (m_exitAfterLoading) + gtk_main_quit(); +} + +static LauncherFrameGdk *frame; static GdkWindow *win; static void handle_event(GdkEvent *event) { - if (GDK_DELETE == event->type) { - gtk_main_quit(); - return; - } - frame->handleGdkEvent(event); + if (GDK_DELETE == event->type) { + gtk_main_quit(); + return; + } + frame->handleGdkEvent(event); } int main(int argc, char *argv[]) { - GdkWindowAttr attr; - char *url; - gdk_init(&argc,&argv); - gdk_event_handler_set ((GdkEventFunc)handle_event, NULL, NULL); - - attr.width = 800; - attr.height = 600; - attr.window_type = GDK_WINDOW_TOPLEVEL; - attr.wclass = GDK_INPUT_OUTPUT; - //see how where we handle motion here need to do the hint stuff - attr.event_mask = ((GDK_ALL_EVENTS_MASK^GDK_POINTER_MOTION_HINT_MASK)); - win = gdk_window_new(NULL,&attr,0); - frame = new FrameGdk(win); - gdk_window_show(win); - char *pg = " Google

2006 Google Hello bigworld from mike

"; - url = "http://www.google.com"; - if (argc >= 2) - url = argv[1]; + GdkWindowAttr attr; + char *url; + gdk_init(&argc,&argv); + gdk_event_handler_set ((GdkEventFunc)handle_event, NULL, NULL); - if (url) { - printf("OPENING URL == %s \n", url); - frame->openURL(url); - } else { -/* - frame->createEmptyDocument(); - frame->document()->open(); - frame->write(pg,strlen(pg)); - frame->document()->close(); -*/ - } - - gtk_main(); - delete frame; - return 0; + attr.width = 800; + attr.height = 600; + attr.window_type = GDK_WINDOW_TOPLEVEL; + attr.wclass = GDK_INPUT_OUTPUT; + //see how where we handle motion here need to do the hint stuff + attr.event_mask = ((GDK_ALL_EVENTS_MASK^GDK_POINTER_MOTION_HINT_MASK)); + win = gdk_window_new(NULL,&attr,0); + frame = new LauncherFrameGdk(win); + gdk_window_show(win); + url = "http://www.google.com"; + bool exitAfterLoading = false; + for (int argPos = 1; argPos < argc; ++argPos) { + if (0 == strcmp(argv[argPos], "-exit-after-loading")) + exitAfterLoading = true; + else + url = argv[argPos]; + } + frame->setExitAfterLoading(exitAfterLoading); + if (url) { + printf("OPENING URL == %s \n", url); + frame->openURL(url); + } else { +#if 0 + char *pg = " Google

2006 Google Hello bigworld from mike

"; + frame->createEmptyDocument(); + frame->document()->open(); + frame->write(pg,strlen(pg)); + frame->document()->close(); +#endif + } + + gtk_main(); + delete frame; + gdk_window_destroy(win); + return 0; }