commit - 002b074d60872b777f91911a890220a16a274a2b
commit + a37d1a1c5a31a55446ae3f647aa2dfd9d27babd4
blob - 9aae5b14987ea75fa46c4e7429b368fad0180a0d
blob + a3369803052b9b1054d382f1d6e4c8c5f05f72bc
--- telescope.c
+++ telescope.c
};
static const char *opts = "Cc:hnT:v";
+
+/*
+ * Used to know when we're finished loading.
+ */
+static int operating;
static struct imsgev *iev_fs, *iev_net;
erase_buffer(&tab->buffer);
}
+void
+load_url_in_tab(struct tab *tab, const char *url, const char *base, int nohist)
+{
+ if (!operating) {
+ load_url(tab, url, base, nohist);
+ return;
+ }
+
+ autosave_hook();
+
+ message("Loading %s...", url);
+ start_loading_anim(tab);
+ load_url(tab, url, base, nohist);
+}
+
int
load_previous_page(struct tab *tab)
{
return 1;
}
+void
+switch_to_tab(struct tab *tab)
+{
+ current_tab = tab;
+ tab->flags &= ~TAB_URGENT;
+
+ if (operating && tab->flags & TAB_LAZY)
+ load_url_in_tab(tab, tab->hist_cur->h, NULL, 0);
+}
+
+unsigned int
+tab_new_id(void)
+{
+ static uint32_t tab_counter;
+
+ return tab_counter++;
+}
+
+struct tab *
+new_tab(const char *url, const char *base, struct tab *after)
+{
+ struct tab *tab;
+
+ autosave_hook();
+
+ if ((tab = calloc(1, sizeof(*tab))) == NULL) {
+ event_loopbreak();
+ return NULL;
+ }
+ tab->fd = -1;
+
+ TAILQ_INIT(&tab->hist.head);
+
+ TAILQ_INIT(&tab->buffer.head);
+ TAILQ_INIT(&tab->buffer.page.head);
+
+ tab->id = tab_new_id();
+ if (!operating)
+ tab->flags |= TAB_LAZY;
+ switch_to_tab(tab);
+
+ if (after != NULL)
+ TAILQ_INSERT_AFTER(&tabshead, after, tab, tabs);
+ else
+ TAILQ_INSERT_TAIL(&tabshead, tab, tabs);
+
+ load_url_in_tab(tab, url, base, 0);
+ return tab;
+}
+
/*
* Free every resource linked to the tab, including the tab itself.
* Removes the tab from the tablist, but doesn't update the
new_tab(url, NULL, NULL);
sandbox_ui_process();
+ operating = 1;
ui_main_loop();
ui_end();
}
blob - 756a7092d2927d064b0bb4d658654e5f5159672b
blob + 0d27078306404e67cb153ed72bd19478b4d061c0
--- telescope.h
+++ telescope.h
/* telescope.c */
void gopher_send_search_req(struct tab *, const char *);
void load_url(struct tab *, const char *, const char *, int);
+void load_url_in_tab(struct tab *, const char *, const char *, int);
int load_previous_page(struct tab*);
int load_next_page(struct tab*);
+void switch_to_tab(struct tab *);
+unsigned int tab_new_id(void);
+struct tab *new_tab(const char *, const char *base, struct tab *);
void free_tab(struct tab *);
void stop_tab(struct tab*);
void add_to_bookmarks(const char*);
blob - ebcc415e867d3b10c2b2694c98be3b531c923019
blob + 878802ee8a3c2c9cfb3f230b6213df55d25d10e3
--- ui.c
+++ ui.c
static void update_loading_anim(int, short, void*);
static void stop_loading_anim(struct tab*);
-/*
- * Used to know when we're finished loading.
- */
-static int operating;
-
static int should_rearrange_windows;
static int too_small;
static int x_offset;
static struct timeval loadingev_timer = { 0, 250000 };
-static uint32_t tab_counter;
-
static char keybuf[64];
/* XXX: don't forget to init these in main() */
wrefresh(body);
if (in_minibuffer)
wrefresh(echoarea);
-}
-
-void
-load_url_in_tab(struct tab *tab, const char *url, const char *base, int nohist)
-{
- if (!operating) {
- load_url(tab, url, base, nohist);
- return;
- }
-
- autosave_hook();
-
- message("Loading %s...", url);
- start_loading_anim(tab);
- load_url(tab, url, base, nohist);
-
- redraw_tab(tab);
}
-void
-switch_to_tab(struct tab *tab)
-{
- current_tab = tab;
- tab->flags &= ~TAB_URGENT;
-
- if (operating && tab->flags & TAB_LAZY)
- load_url_in_tab(tab, tab->hist_cur->h, NULL, 0);
-}
-
-unsigned int
-tab_new_id(void)
-{
- return tab_counter++;
-}
-
-struct tab *
-new_tab(const char *url, const char *base, struct tab *after)
-{
- struct tab *tab;
-
- autosave_hook();
-
- if ((tab = calloc(1, sizeof(*tab))) == NULL) {
- event_loopbreak();
- return NULL;
- }
- tab->fd = -1;
-
- TAILQ_INIT(&tab->hist.head);
-
- TAILQ_INIT(&tab->buffer.head);
- TAILQ_INIT(&tab->buffer.page.head);
-
- tab->id = tab_new_id();
- if (!operating)
- tab->flags |= TAB_LAZY;
- switch_to_tab(tab);
-
- if (after != NULL)
- TAILQ_INSERT_AFTER(&tabshead, after, tab, tabs);
- else
- TAILQ_INSERT_TAIL(&tabshead, tab, tabs);
-
- load_url_in_tab(tab, url, base, 0);
- return tab;
-}
-
int
ui_print_colors(void)
{
void
ui_main_loop(void)
{
- operating = 1;
switch_to_tab(current_tab);
redraw_tab(current_tab);
blob - 0d4ad22b7005186c29b924d57b2036c982d33765
blob + b479a930f7959a6047d0fa987c10bde159356ce7
--- ui.h
+++ ui.h
void global_key_unbound(void);
struct vline *adjust_line(struct vline *, struct buffer *);
void start_loading_anim(struct tab *);
-void load_url_in_tab(struct tab *, const char *, const char *, int);
-void switch_to_tab(struct tab *);
struct buffer *current_buffer(void);
-struct tab *new_tab(const char *, const char *base, struct tab *);
-unsigned int tab_new_id(void);
int ui_print_colors(void);
int ui_init(void);