NetSurf
Data Structures | Macros | Functions | Variables
gui.c File Reference
#include <stdint.h>
#include <limits.h>
#include <getopt.h>
#include <assert.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <nsutils/time.h>
#include <libnsfb.h>
#include <libnsfb_plot.h>
#include <libnsfb_event.h>
#include "utils/utils.h"
#include "utils/nsoption.h"
#include "utils/filepath.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "netsurf/browser_window.h"
#include "netsurf/keypress.h"
#include "desktop/browser_history.h"
#include "netsurf/plotters.h"
#include "netsurf/window.h"
#include "netsurf/misc.h"
#include "netsurf/netsurf.h"
#include "netsurf/cookie_db.h"
#include "content/fetch.h"
#include "framebuffer/gui.h"
#include "framebuffer/fbtk.h"
#include "framebuffer/framebuffer.h"
#include "framebuffer/schedule.h"
#include "framebuffer/findfile.h"
#include "framebuffer/image_data.h"
#include "framebuffer/font.h"
#include "framebuffer/clipboard.h"
#include "framebuffer/fetch.h"
#include "framebuffer/bitmap.h"
#include "framebuffer/local_history.h"
#include "framebuffer/corewindow.h"
Include dependency graph for gui.c:

Go to the source code of this file.

Data Structures

struct  browser_widget_s
 
struct  gui_drag
 

Macros

#define NSFB_TOOLBAR_DEFAULT_LAYOUT   "blfsrutc"
 

Functions

static void die (const char *error)
 Cause an abnormal program termination. More...
 
static nserror fb_warn_user (const char *warning, const char *detail)
 Warn the user of an event. More...
 
static void fb_queue_redraw (struct fbtk_widget_s *widget, int x0, int y0, int x1, int y1)
 
static void widget_scroll_y (struct gui_window *gw, int y, bool abs)
 
static void widget_scroll_x (struct gui_window *gw, int x, bool abs)
 
static void fb_pan (fbtk_widget_t *widget, struct browser_widget_s *bwidget, struct browser_window *bw)
 
static void fb_redraw (fbtk_widget_t *widget, struct browser_widget_s *bwidget, struct browser_window *bw)
 
static int fb_browser_window_redraw (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int fb_browser_window_destroy (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static void framebuffer_surface_iterator (void *ctx, const char *name, enum nsfb_type_e type)
 
static void framebuffer_pick_default_fename (void *ctx, const char *name, enum nsfb_type_e type)
 
static bool process_cmdline (int argc, char **argv)
 
static nserror set_defaults (struct nsoption_s *defaults)
 Set option defaults for framebuffer frontend. More...
 
static bool nslog_stream_configure (FILE *fptr)
 Ensures output logging stream is correctly configured. More...
 
static void framebuffer_run (void)
 
static void gui_quit (void)
 
static int fb_browser_window_click (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int fb_browser_window_move (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int fb_browser_window_input (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static void fb_update_back_forward (struct gui_window *gw)
 
static int fb_leftarrow_click (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int fb_rightarrow_click (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int fb_reload_click (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int fb_stop_click (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int fb_osk_click (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int fb_close_click (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int fb_scroll_callback (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int fb_url_enter (void *pw, char *text)
 
static int fb_url_move (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int set_ptr_default_move (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int fb_localhistory_btn_clik (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static fbtk_widget_tcreate_toolbar (struct gui_window *gw, int toolbar_height, int padding, colour frame_col, const char *toolbar_layout)
 Create a toolbar window and populate it with buttons. More...
 
static void resize_toolbar (struct gui_window *gw, int toolbar_height, int padding, const char *toolbar_layout)
 Resize a toolbar. More...
 
static int fb_browser_window_strip_focus (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 Routine called when "stripped of focus" event occours for browser widget. More...
 
static void create_browser_widget (struct gui_window *gw, int toolbar_height, int furniture_width)
 
static void resize_browser_widget (struct gui_window *gw, int x, int y, int width, int height)
 
static void create_normal_browser_window (struct gui_window *gw, int furniture_width)
 
static void resize_normal_browser_window (struct gui_window *gw, int furniture_width)
 
static void gui_window_add_to_window_list (struct gui_window *gw)
 
static void gui_window_remove_from_window_list (struct gui_window *gw)
 
static struct gui_windowgui_window_create (struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
 
static void gui_window_destroy (struct gui_window *gw)
 
static nserror fb_window_invalidate_area (struct gui_window *g, const struct rect *rect)
 Invalidates an area of a framebuffer browser window. More...
 
static bool gui_window_get_scroll (struct gui_window *g, int *sx, int *sy)
 
static nserror gui_window_set_scroll (struct gui_window *gw, const struct rect *rect)
 Set the scroll position of a framebuffer browser window. More...
 
static nserror gui_window_get_dimensions (struct gui_window *gw, int *width, int *height)
 Find the current dimensions of a framebuffer browser window content area. More...
 
static void gui_window_update_extent (struct gui_window *gw)
 
static void gui_window_set_status (struct gui_window *g, const char *text)
 
static void gui_window_set_pointer (struct gui_window *g, gui_pointer_shape shape)
 
static nserror gui_window_set_url (struct gui_window *g, nsurl *url)
 
static void throbber_advance (void *pw)
 
static void gui_window_start_throbber (struct gui_window *g)
 
static void gui_window_stop_throbber (struct gui_window *gw)
 
static void gui_window_remove_caret_cb (fbtk_widget_t *widget)
 
static void gui_window_place_caret (struct gui_window *g, int x, int y, int height, const struct rect *clip)
 
static void gui_window_remove_caret (struct gui_window *g)
 
static nserror gui_window_event (struct gui_window *gw, enum gui_window_event event)
 process miscellaneous window events More...
 
int main (int argc, char **argv)
 Entry point from OS. More...
 
void gui_resize (fbtk_widget_t *root, int width, int height)
 

Variables

fbtk_widget_tfbtk
 
static bool fb_complete = false
 
struct gui_windowinput_window = NULL
 
struct gui_windowsearch_current_window
 
struct gui_windowwindow_list = NULL
 
static struct gui_drag gui_drag
 
static enum nsfb_type_e fetype = NSFB_SURFACE_COUNT
 
static const char * fename
 
static int febpp
 
static int fewidth
 
static int feheight
 
static const char * feurl
 
static struct gui_window_table framebuffer_window_table
 
static struct gui_misc_table framebuffer_misc_table
 

Macro Definition Documentation

◆ NSFB_TOOLBAR_DEFAULT_LAYOUT

#define NSFB_TOOLBAR_DEFAULT_LAYOUT   "blfsrutc"

Definition at line 61 of file gui.c.

Function Documentation

◆ create_browser_widget()

static void create_browser_widget ( struct gui_window gw,
int  toolbar_height,
int  furniture_width 
)
static

Definition at line 1615 of file gui.c.

References gui_window::browser, fb_browser_window_click(), fb_browser_window_destroy(), fb_browser_window_input(), fb_browser_window_move(), fb_browser_window_redraw(), fb_browser_window_strip_focus(), FBTK_CBT_CLICK, FBTK_CBT_DESTROY, FBTK_CBT_INPUT, FBTK_CBT_POINTERMOVE, FBTK_CBT_REDRAW, FBTK_CBT_STRIP_FOCUS, fbtk_create_user(), fbtk_set_handler(), and gui_window::window.

Referenced by create_normal_browser_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_normal_browser_window()

static void create_normal_browser_window ( struct gui_window gw,
int  furniture_width 
)
static

Definition at line 1644 of file gui.c.

References gui_window::bottom_right, gui_window::browser, create_browser_widget(), create_toolbar(), FB_COLOUR_BLACK, FB_FRAME_COLOUR, fb_osk_click(), fb_scroll_callback(), FB_SCROLL_COLOUR, fbtk, FBTK_CBT_POINTERENTER, fbtk_create_button(), fbtk_create_fill(), fbtk_create_hscroll(), fbtk_create_text(), fbtk_create_text_button(), fbtk_create_vscroll(), fbtk_create_window(), fbtk_get_absx(), fbtk_get_absy(), fbtk_get_height(), fbtk_get_width(), fbtk_set_focus(), fbtk_set_handler(), gui_window::hscroll, NSLOG, nsoption_bool, nsoption_charp, nsoption_int, osk_image, set_ptr_default_move(), gui_window::status, gui_window::toolbar, gui_window::vscroll, and gui_window::window.

Referenced by gui_window_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_toolbar()

static fbtk_widget_t * create_toolbar ( struct gui_window gw,
int  toolbar_height,
int  padding,
colour  frame_col,
const char *  toolbar_layout 
)
static

Create a toolbar window and populate it with buttons.

The toolbar layout uses a character to define buttons type and position: b - back l - local history f - forward s - stop r - refresh u - url bar expands to fit remaining space t - throbber/activity indicator c - close the current window

The default layout is "blfsrut" there should be no more than a single url bar entry or behaviour will be undefined.

Parameters
gwParent window
toolbar_heightThe height in pixels of the toolbar
paddingThe padding in pixels round each element of the toolbar
frame_colFrame colour.
toolbar_layoutA string defining which buttons and controls should be added to the toolbar. May be empty string to disable the bar..

Definition at line 1236 of file gui.c.

References gui_window::back, gui_window::bw, gui_window::close, fb_close_click(), FB_COLOUR_BLACK, FB_COLOUR_WHITE, fb_leftarrow_click(), fb_localhistory_btn_clik(), fb_reload_click(), fb_rightarrow_click(), fb_stop_click(), fb_url_enter(), fb_url_move(), FBTK_CBT_POINTERENTER, fbtk_create_bitmap(), fbtk_create_button(), fbtk_create_window(), fbtk_create_writable_text(), fbtk_get_width(), fbtk_set_handler(), fbtk_set_mapping(), gui_window::forward, gui_window::history, history_image, left_arrow, NSFB_TOOLBAR_DEFAULT_LAYOUT, NSLOG, gui_window::reload, reload, right_arrow, set_ptr_default_move(), gui_window::stop, stop_image, stop_image_g, gui_window::throbber, throbber0, gui_window::toolbar, gui_window::url, fbtk_bitmap::width, and gui_window::window.

Referenced by create_normal_browser_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ die()

static void die ( const char *  error)
static

Cause an abnormal program termination.

Note
This never returns and is intended to terminate without any cleanup.
Parameters
errorThe message to display to the user.

Definition at line 107 of file gui.c.

Referenced by main().

Here is the caller graph for this function:

◆ fb_browser_window_click()

static int fb_browser_window_click ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 653 of file gui.c.

References BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_CLICK_2, BROWSER_MOUSE_DOUBLE_CLICK, BROWSER_MOUSE_PRESS_1, BROWSER_MOUSE_PRESS_2, BROWSER_MOUSE_TRIPLE_CLICK, browser_window_mouse_click(), browser_window_mouse_track(), browser_window_scroll_at_point(), gui_drag::button, gui_window::bw, fbtk_callback_info::context, fbtk_callback_info::event, fbtk_get_userpw(), fbtk_tgrab_pointer(), gui_drag::grabbed_pointer, GUI_DRAG_NONE, NSLOG, browser_widget_s::scrollx, browser_widget_s::scrolly, type, widget_scroll_y(), fbtk_callback_info::x, gui_drag::x, fbtk_callback_info::y, and gui_drag::y.

Referenced by create_browser_widget().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_browser_window_destroy()

static int fb_browser_window_destroy ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 438 of file gui.c.

References fbtk_get_userpw().

Referenced by create_browser_widget().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_browser_window_input()

static int fb_browser_window_input ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 851 of file gui.c.

References gui_window::browser, browser_window_key_press(), browser_window_set_scale(), gui_window::bw, fbtk_callback_info::context, fbtk_callback_info::event, fallthrough, fbtk_get_height(), fbtk_get_width(), fbtk_keycode_to_ucs4(), FBTK_MOD_CLEAR, FBTK_MOD_LCTRL, FBTK_MOD_LSHIFT, FBTK_MOD_RCTRL, FBTK_MOD_RSHIFT, NS_KEY_DELETE_RIGHT, NS_KEY_DOWN, NS_KEY_LEFT, NS_KEY_LINE_END, NS_KEY_LINE_START, NS_KEY_PAGE_DOWN, NS_KEY_PAGE_UP, NS_KEY_REDO, NS_KEY_RIGHT, NS_KEY_UNDO, NS_KEY_UP, NS_KEY_WORD_LEFT, NS_KEY_WORD_RIGHT, NSLOG, widget_scroll_x(), and widget_scroll_y().

Referenced by create_browser_widget().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_browser_window_move()

static int fb_browser_window_move ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 809 of file gui.c.

References BROWSER_MOUSE_DRAG_1, BROWSER_MOUSE_DRAG_2, BROWSER_MOUSE_DRAG_ON, BROWSER_MOUSE_HOLDING_1, BROWSER_MOUSE_HOLDING_2, browser_window_mouse_click(), browser_window_mouse_track(), gui_drag::button, gui_window::bw, fbtk_callback_info::context, fbtk_get_userpw(), fbtk_tgrab_pointer(), gui_drag::grabbed_pointer, browser_widget_s::scrollx, browser_widget_s::scrolly, fbtk_callback_info::x, gui_drag::x, fbtk_callback_info::y, and gui_drag::y.

Referenced by create_browser_widget().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_browser_window_redraw()

static int fb_browser_window_redraw ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 410 of file gui.c.

References gui_window::bw, fbtk_callback_info::context, fb_pan(), fb_redraw(), fbtk_get_height(), fbtk_get_userpw(), fbtk_get_width(), NSLOG, browser_widget_s::pan_required, browser_widget_s::redraw_box, and browser_widget_s::redraw_required.

Referenced by create_browser_widget().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_browser_window_strip_focus()

static int fb_browser_window_strip_focus ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Routine called when "stripped of focus" event occours for browser widget.

Parameters
widgetThe widget reciving "stripped of focus" event.
cbiThe callback parameters.
Returns
The callback result.

Definition at line 1607 of file gui.c.

References fbtk_set_caret().

Referenced by create_browser_widget().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_close_click()

static int fb_close_click ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 1134 of file gui.c.

References fbtk_callback_info::event, and fb_complete.

Referenced by create_toolbar().

Here is the caller graph for this function:

◆ fb_leftarrow_click()

static int fb_leftarrow_click ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 1060 of file gui.c.

References browser_window_back_available(), browser_window_history_back(), browser_window::bw, gui_window::bw, fbtk_callback_info::context, fbtk_callback_info::event, and fb_update_back_forward().

Referenced by create_toolbar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_localhistory_btn_clik()

static int fb_localhistory_btn_clik ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 1198 of file gui.c.

References gui_window::bw, fbtk_callback_info::context, fbtk_callback_info::event, fb_local_history_present(), and fbtk.

Referenced by create_toolbar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_osk_click()

static int fb_osk_click ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 1121 of file gui.c.

References fbtk_callback_info::event, and map_osk().

Referenced by create_normal_browser_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_pan()

static void fb_pan ( fbtk_widget_t widget,
struct browser_widget_s bwidget,
struct browser_window bw 
)
static

Definition at line 225 of file gui.c.

References fb_queue_redraw(), fbtk_get_absx(), fbtk_get_absy(), fbtk_get_height(), fbtk_get_nsfb(), fbtk_get_width(), height, nsfb, NSLOG, browser_widget_s::pan_required, browser_widget_s::panx, browser_widget_s::pany, browser_widget_s::scrollx, browser_widget_s::scrolly, and width.

Referenced by fb_browser_window_redraw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_queue_redraw()

static void fb_queue_redraw ( struct fbtk_widget_s widget,
int  x0,
int  y0,
int  x1,
int  y1 
)
static

Definition at line 130 of file gui.c.

References fbtk_clip_to_widget(), fbtk_get_userpw(), fbtk_request_redraw(), max, min, browser_widget_s::redraw_box, and browser_widget_s::redraw_required.

Referenced by fb_pan(), fb_window_invalidate_area(), gui_window_place_caret(), and gui_window_remove_caret_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_redraw()

static void fb_redraw ( fbtk_widget_t widget,
struct browser_widget_s bwidget,
struct browser_window bw 
)
static

Definition at line 348 of file gui.c.

References browser_window_redraw(), clip(), fb_plotters, fbtk_get_absx(), fbtk_get_absy(), fbtk_get_caret(), fbtk_get_nsfb(), redraw_context::interactive, line(), nsfb, browser_widget_s::redraw_box, browser_widget_s::redraw_required, browser_widget_s::scrollx, and browser_widget_s::scrolly.

Referenced by fb_browser_window_redraw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_reload_click()

static int fb_reload_click ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 1096 of file gui.c.

References browser_window_reload(), browser_window::bw, fbtk_callback_info::context, and fbtk_callback_info::event.

Referenced by create_toolbar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_rightarrow_click()

static int fb_rightarrow_click ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 1078 of file gui.c.

References browser_window_forward_available(), browser_window_history_forward(), browser_window::bw, gui_window::bw, fbtk_callback_info::context, fbtk_callback_info::event, and fb_update_back_forward().

Referenced by create_toolbar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_scroll_callback()

static int fb_scroll_callback ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 1145 of file gui.c.

References fbtk_callback_info::context, FBTK_CBT_SCROLLX, FBTK_CBT_SCROLLY, fbtk_callback_info::type, widget_scroll_x(), widget_scroll_y(), fbtk_callback_info::x, and fbtk_callback_info::y.

Referenced by create_normal_browser_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_stop_click()

static int fb_stop_click ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 1109 of file gui.c.

References browser_window_stop(), browser_window::bw, fbtk_callback_info::context, and fbtk_callback_info::event.

Referenced by create_toolbar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_update_back_forward()

static void fb_update_back_forward ( struct gui_window gw)
static

Definition at line 1046 of file gui.c.

References gui_window::back, browser_window_back_available(), browser_window_forward_available(), browser_window::bw, gui_window::bw, fbtk_set_bitmap(), gui_window::forward, left_arrow, left_arrow_g, right_arrow, and right_arrow_g.

Referenced by fb_leftarrow_click(), fb_rightarrow_click(), and gui_window_stop_throbber().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_url_enter()

static int fb_url_enter ( void *  pw,
char *  text 
)
static

Definition at line 1165 of file gui.c.

References browser_window_navigate(), browser_window::bw, BW_NAVIGATE_HISTORY, fb_warn_user(), messages_get_errorcode(), NSERROR_OK, nsurl_create(), nsurl_unref(), and text().

Referenced by create_toolbar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_url_move()

static int fb_url_move ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 1184 of file gui.c.

References caret_image, and framebuffer_set_cursor().

Referenced by create_toolbar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fb_warn_user()

static nserror fb_warn_user ( const char *  warning,
const char *  detail 
)
static

Warn the user of an event.

Parameters
[in]warningA warning looked up in the message translation table
[in]detailAdditional text to be displayed or NULL.
Returns
NSERROR_OK on success or error code if there was a faliure displaying the message to the user.

Definition at line 122 of file gui.c.

References NSERROR_OK, and NSLOG.

Referenced by fb_url_enter(), and main().

Here is the caller graph for this function:

◆ fb_window_invalidate_area()

static nserror fb_window_invalidate_area ( struct gui_window g,
const struct rect rect 
)
static

Invalidates an area of a framebuffer browser window.

Parameters
gThe netsurf window being invalidated.
rectarea to redraw or NULL for the entire window area
Returns
NSERROR_OK on success or appropriate error code

Definition at line 1869 of file gui.c.

References gui_window::browser, fb_queue_redraw(), fbtk_get_height(), fbtk_get_userpw(), fbtk_get_width(), NSERROR_OK, browser_widget_s::scrollx, browser_widget_s::scrolly, rect::x0, rect::x1, rect::y0, and rect::y1.

Here is the call graph for this function:

◆ framebuffer_pick_default_fename()

static void framebuffer_pick_default_fename ( void *  ctx,
const char *  name,
enum nsfb_type_e  type 
)
static

Definition at line 470 of file gui.c.

References fename, fetype, and type.

Referenced by process_cmdline().

Here is the caller graph for this function:

◆ framebuffer_run()

static void framebuffer_run ( void  )
static

Definition at line 615 of file gui.c.

References fb_complete, fbtk, fbtk_event(), fbtk_get_redraw_pending(), fbtk_redraw(), and schedule_run().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ framebuffer_surface_iterator()

static void framebuffer_surface_iterator ( void *  ctx,
const char *  name,
enum nsfb_type_e  type 
)
static

Definition at line 455 of file gui.c.

Referenced by process_cmdline().

Here is the caller graph for this function:

◆ gui_quit()

static void gui_quit ( void  )
static

Definition at line 642 of file gui.c.

References framebuffer_finalise(), NSLOG, nsoption_charp, and urldb_save_cookies().

Here is the call graph for this function:

◆ gui_resize()

void gui_resize ( fbtk_widget_t root,
int  width,
int  height 
)

Definition at line 2292 of file gui.c.

References fbtk_get_nsfb(), fbtk_request_redraw(), fbtk_set_pos_and_size(), febpp, feheight, fewidth, framebuffer_resize(), height, gui_window::next, nsfb, nsoption_int, resize_normal_browser_window(), root, width, and window_list.

Referenced by fbtk_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_window_add_to_window_list()

static void gui_window_add_to_window_list ( struct gui_window gw)
static

Definition at line 1786 of file gui.c.

References gui_window::next, gui_window::prev, and window_list.

Referenced by gui_window_create().

Here is the caller graph for this function:

◆ gui_window_create()

static struct gui_window * gui_window_create ( struct browser_window bw,
struct gui_window existing,
gui_window_create_flags  flags 
)
static

Definition at line 1824 of file gui.c.

References gui_window::bw, create_normal_browser_window(), fbtk_set_mapping(), gui_window_add_to_window_list(), nsoption_int, and gui_window::window.

Here is the call graph for this function:

◆ gui_window_destroy()

static void gui_window_destroy ( struct gui_window gw)
static

Definition at line 1851 of file gui.c.

References fbtk_destroy_widget(), gui_window_remove_from_window_list(), and gui_window::window.

Here is the call graph for this function:

◆ gui_window_event()

static nserror gui_window_event ( struct gui_window gw,
enum gui_window_event  event 
)
static

process miscellaneous window events

Parameters
gwThe window receiving the event.
eventThe event code.
Returns
NSERROR_OK when processed ok

Definition at line 2126 of file gui.c.

References gui_window_remove_caret(), gui_window_start_throbber(), gui_window_stop_throbber(), gui_window_update_extent(), GW_EVENT_REMOVE_CARET, GW_EVENT_START_THROBBER, GW_EVENT_STOP_THROBBER, GW_EVENT_UPDATE_EXTENT, and NSERROR_OK.

Here is the call graph for this function:

◆ gui_window_get_dimensions()

static nserror gui_window_get_dimensions ( struct gui_window gw,
int *  width,
int *  height 
)
static

Find the current dimensions of a framebuffer browser window content area.

Parameters
gwThe gui window to measure content area of.
widthreceives width of window
heightreceives height of window
Returns
NSERROR_OK on sucess and width and height updated.

Definition at line 1934 of file gui.c.

References gui_window::browser, fbtk_get_height(), fbtk_get_width(), height, NSERROR_OK, and width.

Here is the call graph for this function:

◆ gui_window_get_scroll()

static bool gui_window_get_scroll ( struct gui_window g,
int *  sx,
int *  sy 
)
static

Definition at line 1890 of file gui.c.

References gui_window::browser, fbtk_get_userpw(), browser_widget_s::scrollx, and browser_widget_s::scrolly.

Here is the call graph for this function:

◆ gui_window_place_caret()

static void gui_window_place_caret ( struct gui_window g,
int  x,
int  y,
int  height,
const struct rect clip 
)
static

Definition at line 2090 of file gui.c.

References gui_window::browser, fb_queue_redraw(), fbtk_get_userpw(), fbtk_set_caret(), gui_window_remove_caret_cb(), height, browser_widget_s::scrollx, and browser_widget_s::scrolly.

Here is the call graph for this function:

◆ gui_window_remove_caret()

static void gui_window_remove_caret ( struct gui_window g)
static

Definition at line 2108 of file gui.c.

References gui_window::browser, fbtk_get_caret(), and fbtk_set_caret().

Referenced by gui_window_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_window_remove_caret_cb()

static void gui_window_remove_caret_cb ( fbtk_widget_t widget)
static

Definition at line 2073 of file gui.c.

References fb_queue_redraw(), fbtk_get_caret(), fbtk_get_userpw(), browser_widget_s::scrollx, and browser_widget_s::scrolly.

Referenced by gui_window_place_caret().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_window_remove_from_window_list()

static void gui_window_remove_from_window_list ( struct gui_window gw)
static

Definition at line 1800 of file gui.c.

References gui_window::next, gui_window::prev, and window_list.

Referenced by gui_window_destroy().

Here is the caller graph for this function:

◆ gui_window_set_pointer()

static void gui_window_set_pointer ( struct gui_window g,
gui_pointer_shape  shape 
)
static

Definition at line 1962 of file gui.c.

References caret_image, framebuffer_set_cursor(), GUI_POINTER_CARET, GUI_POINTER_MENU, GUI_POINTER_MOVE, GUI_POINTER_POINT, GUI_POINTER_PROGRESS, hand_image, menu_image, move_image, pointer_image, and progress_image.

Here is the call graph for this function:

◆ gui_window_set_scroll()

static nserror gui_window_set_scroll ( struct gui_window gw,
const struct rect rect 
)
static

Set the scroll position of a framebuffer browser window.

Scrolls the viewport to ensure the specified rectangle of the content is shown. The framebuffer implementation scrolls the contents so the specified point in the content is at the top of the viewport.

Parameters
gwgui_window to scroll
rectThe rectangle to ensure is shown.
Returns
NSERROR_OK on success or apropriate error code.

Definition at line 1912 of file gui.c.

References gui_window::browser, fbtk_get_userpw(), NSERROR_OK, widget_scroll_x(), widget_scroll_y(), rect::x0, and rect::y0.

Here is the call graph for this function:

◆ gui_window_set_status()

static void gui_window_set_status ( struct gui_window g,
const char *  text 
)
static

Definition at line 1956 of file gui.c.

References fbtk_set_text(), gui_window::status, and text().

Here is the call graph for this function:

◆ gui_window_set_url()

static nserror gui_window_set_url ( struct gui_window g,
nsurl url 
)
static

Definition at line 1992 of file gui.c.

References fbtk_set_text(), NSERROR_OK, nsurl_access(), and gui_window::url.

Here is the call graph for this function:

◆ gui_window_start_throbber()

static void gui_window_start_throbber ( struct gui_window g)
static

Definition at line 2056 of file gui.c.

References framebuffer_schedule(), throbber_advance(), and gui_window::throbber_index.

Referenced by gui_window_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_window_stop_throbber()

static void gui_window_stop_throbber ( struct gui_window gw)
static

Definition at line 2063 of file gui.c.

References fb_update_back_forward(), fbtk_set_bitmap(), gui_window::throbber, throbber0, and gui_window::throbber_index.

Referenced by gui_window_destroy(), and gui_window_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_window_update_extent()

static void gui_window_update_extent ( struct gui_window gw)
static

Definition at line 1943 of file gui.c.

References gui_window::browser, browser_window_get_extents(), gui_window::bw, fbtk_get_height(), fbtk_get_width(), fbtk_set_scroll_parameters(), gui_window::hscroll, and gui_window::vscroll.

Referenced by gui_window_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

◆ nslog_stream_configure()

static bool nslog_stream_configure ( FILE *  fptr)
static

Ensures output logging stream is correctly configured.

Definition at line 607 of file gui.c.

Referenced by main().

Here is the caller graph for this function:

◆ process_cmdline()

static bool process_cmdline ( int  argc,
char **  argv 
)
static

Definition at line 478 of file gui.c.

References febpp, feheight, fename, feurl, fewidth, framebuffer_pick_default_fename(), framebuffer_surface_iterator(), NSLOG, nsoption_charp, and nsoption_int.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize_browser_widget()

static void resize_browser_widget ( struct gui_window gw,
int  x,
int  y,
int  width,
int  height 
)
static

Definition at line 1636 of file gui.c.

References gui_window::browser, browser_window_schedule_reformat(), gui_window::bw, fbtk_set_pos_and_size(), height, and width.

Referenced by resize_normal_browser_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize_normal_browser_window()

static void resize_normal_browser_window ( struct gui_window gw,
int  furniture_width 
)
static

Definition at line 1748 of file gui.c.

References gui_window::bottom_right, fbtk_get_height(), fbtk_get_width(), fbtk_reposition_hscroll(), fbtk_reposition_vscroll(), fbtk_set_pos_and_size(), height, gui_window::hscroll, nsoption_charp, nsoption_int, resize_browser_widget(), resize_toolbar(), gui_window::status, gui_window::toolbar, gui_window::vscroll, width, and gui_window::window.

Referenced by gui_resize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize_toolbar()

static void resize_toolbar ( struct gui_window gw,
int  toolbar_height,
int  padding,
const char *  toolbar_layout 
)
static

Resize a toolbar.

Parameters
gwParent window
toolbar_heightThe height in pixels of the toolbar
paddingThe padding in pixels round each element of the toolbar
toolbar_layoutA string defining which buttons and controls should be added to the toolbar. May be empty string to disable the bar.

Definition at line 1462 of file gui.c.

References gui_window::back, gui_window::close, fbtk_get_width(), fbtk_set_pos_and_size(), gui_window::forward, gui_window::history, history_image, left_arrow, NSFB_TOOLBAR_DEFAULT_LAYOUT, gui_window::reload, reload, right_arrow, gui_window::stop, stop_image, stop_image_g, gui_window::throbber, throbber0, gui_window::toolbar, gui_window::url, and fbtk_bitmap::width.

Referenced by resize_normal_browser_window().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_defaults()

static nserror set_defaults ( struct nsoption_s defaults)
static

Set option defaults for framebuffer frontend.

Parameters
defaultsThe option table to update.
Returns
error status.

Definition at line 558 of file gui.c.

References NSERROR_BAD_PARAMETER, NSERROR_OK, NSLOG, nsoption_charp, nsoption_set_colour, and nsoption_setnull_charp.

Referenced by main().

Here is the caller graph for this function:

◆ set_ptr_default_move()

static int set_ptr_default_move ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

Definition at line 1191 of file gui.c.

References framebuffer_set_cursor(), and pointer_image.

Referenced by create_normal_browser_window(), and create_toolbar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ throbber_advance()

static void throbber_advance ( void *  pw)
static

Definition at line 1999 of file gui.c.

References fbtk_set_bitmap(), framebuffer_schedule(), gui_window::throbber, throbber1, throbber2, throbber3, throbber4, throbber5, throbber6, throbber7, throbber8, throbber_advance(), and gui_window::throbber_index.

Referenced by gui_window_start_throbber(), and throbber_advance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ widget_scroll_x()

static void widget_scroll_x ( struct gui_window gw,
int  x,
bool  abs 
)
static

Definition at line 189 of file gui.c.

References gui_window::browser, browser_window_get_extents(), gui_window::bw, fbtk_get_userpw(), fbtk_get_width(), fbtk_request_redraw(), fbtk_set_scroll_position(), gui_window::hscroll, browser_widget_s::pan_required, browser_widget_s::panx, browser_widget_s::scrollx, and width.

Referenced by fb_browser_window_input(), fb_scroll_callback(), and gui_window_set_scroll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ widget_scroll_y()

static void widget_scroll_y ( struct gui_window gw,
int  y,
bool  abs 
)
static

Definition at line 151 of file gui.c.

References gui_window::browser, browser_window_get_extents(), gui_window::bw, fbtk_get_height(), fbtk_get_userpw(), fbtk_request_redraw(), fbtk_set_scroll_position(), height, NSLOG, browser_widget_s::pan_required, browser_widget_s::pany, browser_widget_s::scrolly, and gui_window::vscroll.

Referenced by fb_browser_window_click(), fb_browser_window_input(), fb_scroll_callback(), and gui_window_set_scroll().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ fb_complete

bool fb_complete = false
static

Definition at line 65 of file gui.c.

Referenced by fb_close_click(), and framebuffer_run().

◆ fbtk

◆ febpp

int febpp
static

Definition at line 464 of file gui.c.

Referenced by gui_resize(), main(), and process_cmdline().

◆ feheight

int feheight
static

Definition at line 466 of file gui.c.

Referenced by gui_resize(), main(), and process_cmdline().

◆ fename

const char* fename
static

◆ fetype

enum nsfb_type_e fetype = NSFB_SURFACE_COUNT
static

Definition at line 462 of file gui.c.

Referenced by framebuffer_pick_default_fename().

◆ feurl

const char* feurl
static

Definition at line 467 of file gui.c.

Referenced by main(), and process_cmdline().

◆ fewidth

int fewidth
static

Definition at line 465 of file gui.c.

Referenced by gui_resize(), main(), and process_cmdline().

◆ framebuffer_misc_table

struct gui_misc_table framebuffer_misc_table
static
Initial value:
= {
.schedule = framebuffer_schedule,
.quit = gui_quit,
}
static void gui_quit(void)
Definition: gui.c:642
nserror framebuffer_schedule(int tival, void(*callback)(void *p), void *p)
Schedule a callback.
Definition: schedule.c:95

Definition at line 2167 of file gui.c.

Referenced by main().

◆ framebuffer_window_table

struct gui_window_table framebuffer_window_table
static
Initial value:
= {
.create = gui_window_create,
.destroy = gui_window_destroy,
.get_scroll = gui_window_get_scroll,
.set_scroll = gui_window_set_scroll,
.get_dimensions = gui_window_get_dimensions,
.event = gui_window_event,
.set_url = gui_window_set_url,
.set_status = gui_window_set_status,
.set_pointer = gui_window_set_pointer,
.place_caret = gui_window_place_caret,
}
void gui_window_destroy(struct gui_window *gw)
Destroy previously created gui window.
Definition: gui.c:252
void gui_window_set_pointer(struct gui_window *gw, gui_pointer_shape shape)
set the pointer shape
Definition: gui.c:482
bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy)
Definition: gui.c:414
static nserror gui_window_set_scroll(struct gui_window *gw, const struct rect *rect)
Set the scroll position of a framebuffer browser window.
Definition: gui.c:1912
static void gui_window_set_status(struct gui_window *g, const char *text)
Definition: gui.c:1956
static nserror gui_window_event(struct gui_window *gw, enum gui_window_event event)
process miscellaneous window events
Definition: gui.c:2126
static nserror gui_window_get_dimensions(struct gui_window *gw, int *width, int *height)
Find the current dimensions of a framebuffer browser window content area.
Definition: gui.c:1934
static struct gui_window * gui_window_create(struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
Definition: gui.c:1824
static nserror gui_window_set_url(struct gui_window *g, nsurl *url)
Definition: gui.c:1992
static void gui_window_place_caret(struct gui_window *g, int x, int y, int height, const struct rect *clip)
Definition: gui.c:2090
static nserror fb_window_invalidate_area(struct gui_window *g, const struct rect *rect)
Invalidates an area of a framebuffer browser window.
Definition: gui.c:1869

Definition at line 2151 of file gui.c.

Referenced by main().

◆ gui_drag

struct gui_drag gui_drag
static

◆ input_window

struct gui_window* input_window = NULL

◆ search_current_window

struct gui_window* search_current_window

Definition at line 68 of file gui.c.

◆ window_list

struct gui_window* window_list = NULL

Definition at line 69 of file gui.c.