static void __CDECL menu_open_url(short item, short title, void *data) { struct gui_window * gw; struct browser_window * bw ; LOG(("%s", __FUNCTION__)); gw = input_window; if( gw == NULL ) { browser_window_create(BROWSER_WINDOW_VERIFIABLE | BROWSER_WINDOW_HISTORY, NULL, NULL, NULL, &bw); gw = bw->window; } /* Loose focus: */ window_set_focus(gw->root, WIDGET_NONE, NULL ); /* trigger on-focus event (select all text): */ window_set_focus(gw->root, URL_WIDGET, NULL); /* delete selection: */ toolbar_key_input(gw->root->toolbar, NK_DEL); }
/** * Create and open a gui window for a browsing context. * * \param bw bw to create gui_window for * \param existing an existing gui_window, may be NULL * \param flags flags for gui window creation * \return gui window, or NULL on error * * If GW_CREATE_CLONE flag is set existing is non-NULL. * * The created gui_window must include a reference to the browser * window passed in the bw param. */ static struct gui_window * gui_window_create(struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags) { struct gui_window *gw=NULL; LOG("gw: %p, BW: %p, existing %p, flags: %d\n", gw, bw, existing, (int)flags); gw = calloc(1, sizeof(struct gui_window)); if (gw == NULL) return NULL; LOG("new window: %p, bw: %p\n", gw, bw); window_create(gw, bw, existing, WIDGET_STATUSBAR|WIDGET_TOOLBAR|WIDGET_RESIZE\ |WIDGET_SCROLL); if (gw->root->win) { GRECT pos = { option_window_x, option_window_y, option_window_width, option_window_height }; gui_window_set_url(gw, corestring_nsurl_about_blank); gui_window_set_pointer(gw, BROWSER_POINTER_DEFAULT); gui_set_input_gui_window(gw); window_open(gw->root, gw, pos); } /* add the window to the window list: */ if( window_list == NULL ) { window_list = gw; gw->next = NULL; gw->prev = NULL; } else { struct gui_window * tmp = window_list; while( tmp->next != NULL ) { tmp = tmp->next; } tmp->next = gw; gw->prev = tmp; gw->next = NULL; } /* Loose focus: */ window_set_focus(gw->root, WIDGET_NONE, NULL ); /* trigger on-focus event (select all text): */ window_set_focus(gw->root, URL_WIDGET, NULL); /* delete selection: */ toolbar_key_input(gw->root->toolbar, NK_DEL); return( gw ); }