/* * browser_core - the shared half of minibrowser and bigbrowser * * Everything both binaries have in common lives here: window, URL bar, * toast, zoom, downloads, profiles, clipboard, history and the key * handling. A front-end supplies a BrowserApp and calls browser_main(). * * minibrowser adds nothing. bigbrowser adds the camera / streaming layer. */ #ifndef BROWSER_CORE_H #define BROWSER_CORE_H #include #include #include #include /* Modifiers we consider "significant" when matching a shortcut. * Shift is deliberately absent: it is part of the key, not the combo. */ #define MOD_MASK_ALL (GDK_CONTROL_MASK | GDK_ALT_MASK | GDK_SUPER_MASK | GDK_META_MASK) #define ZOOM_STEP 1.1 #define ZOOM_MIN 0.25 #define ZOOM_MAX 5.0 #define URL_TOAST_SECONDS 4 #define DL_HISTORY_SECONDS 8 /* Per-window state. Owned by the GtkWindow (see window_new). */ /* what the popup is doing right now */ typedef enum { OMNI_URL, OMNI_HISTORY, OMNI_FIND, OMNI_DLDIR, OMNI_SEARCH } OmniMode; typedef struct { GtkWidget *win; WebKitWebView *view; GtkWidget *omni; /* the centered popup, hidden by default */ GtkWidget *omnientry; /* its input line */ GtkWidget *omnilist; /* history matches under the input */ GtkWidget *omniscroll; GtkWidget *omnihint; /* match count while finding */ GtkWidget *omniscope; /* page / site / everything, in the dir popup */ GtkWidget *omnialways; /* "always replace existing files" */ GtkWidget *omnibuttons; /* the confirm row, so Enter is not the only way */ GtkWidget *omnisave; GtkWidget *omnicancel; GtkWidget *urltoast; /* the address, top left, on a new page */ GtkWidget *loadbar; /* a thin line across the top while loading */ double load_frac; guint urltoast_id; GtkWidget *keys; /* key reference, hidden by default */ GtkWidget *perm; /* "this site wants your camera" prompt */ GtkWidget *permlabel; GPtrArray *permqueue; /* requests waiting on the prompt's answer */ char *permhost; GtkWidget *topright; /* box holding the toast and the downloads */ GtkWidget *toast; /* GtkLabel, hidden by default */ GtkWidget *dlpanel; /* download overlay, rebuilt on refresh */ guint toast_id; gboolean dl_history; /* +D list is showing */ guint dl_history_id; gboolean primary; gint64 dl_reveal_us; /* a download just appeared; do not fade */ gint64 error_until_us; /* an error toast is up; do not fade */ /* stored-history walk, see history.c section in browser_core.c */ gboolean hist_walk; /* past the end of the session list */ gboolean hist_loading; /* a load we started ourselves */ int hist_pos; /* cursor into the stored history */ gboolean load_failed; /* current load did not come up */ guint hist_id; /* debounce before the entry is written */ /* omni popup state */ OmniMode omni_mode; gboolean omni_list; /* the match list is showing */ gboolean omni_setting; /* we are writing to the input ourselves */ char *omni_needle; /* what the user actually typed */ /* the download-directory popup, while it is asking about a clash */ gboolean dl_conflict; char *dl_pending_dir; int dl_pending_scope; /* media mode: the frame that says it is on, and what is under the * pointer, so a +click on an image can go to the image viewer */ GtkWidget *mediaframe; char *hover_link; /* link address under the pointer, or NULL */ char *hover_image; /* image address under the pointer, or NULL */ char *hover_media; /*