NetSurf
|
Implements the NetSurf Browser window, or passed functionality to the appropriate widget's. More...
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <limits.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
#include <math.h>
#include <osbind.h>
#include <mt_gem.h>
#include "utils/log.h"
#include "utils/nsurl.h"
#include "netsurf/browser_window.h"
#include "netsurf/mouse.h"
#include "netsurf/plotters.h"
#include "netsurf/keypress.h"
#include "atari/res/netsurf.rsh"
#include "atari/gemtk/gemtk.h"
#include "atari/ctxmenu.h"
#include "atari/gui.h"
#include "atari/rootwin.h"
#include "atari/misc.h"
#include "atari/plot/plot.h"
#include "atari/toolbar.h"
#include "atari/statusbar.h"
#include "atari/search.h"
#include "atari/osspec.h"
#include "atari/encoding.h"
#include "atari/redrawslots.h"
#include "atari/findfile.h"
#include "atari/bitmap.h"
Go to the source code of this file.
Data Structures | |
struct | rootwin_data_s |
Functions | |
static void | on_redraw (ROOTWIN *rootwin, short msg[8]) |
static void | on_resized (ROOTWIN *rootwin) |
static void | on_file_dropped (ROOTWIN *rootwin, short msg[8]) |
static short | on_window_key_input (ROOTWIN *rootwin, unsigned short nkc) |
static void | on_content_mouse_click (ROOTWIN *rootwin) |
static void | on_content_mouse_move (ROOTWIN *rootwin, GRECT *content_area) |
static void | toolbar_redraw_cb (GUIWIN *win, uint16_t msg, GRECT *clip) |
bool | gui_window_get_scroll (struct gui_window *w, int *sx, int *sy) |
static short | handle_event (GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) |
int | window_create (struct gui_window *gw, struct browser_window *bw, struct gui_window *existing, unsigned long inflags) |
void | window_unref_gui_window (ROOTWIN *rootwin, struct gui_window *gw) |
int | window_destroy (ROOTWIN *rootwin) |
void | window_open (ROOTWIN *rootwin, struct gui_window *gw, GRECT pos) |
show the window at specified position and make gw the active tab. More... | |
void | window_restore_active_gui_window (ROOTWIN *rootwin) |
void | window_update_back_forward (struct s_gui_win_root *rootwin) |
void | window_set_stauts (struct s_gui_win_root *rootwin, char *text) |
void | window_set_title (struct s_gui_win_root *rootwin, char *title) |
void | window_scroll_by (ROOTWIN *root, int sx, int sy) |
void | window_set_content_size (ROOTWIN *rootwin, int width, int height) |
Set the dimensions of the scrollable content. More... | |
void | window_set_focus (struct s_gui_win_root *rootwin, enum focus_element_type type, void *element) |
bool | window_url_widget_has_focus (struct s_gui_win_root *rootwin) |
bool | window_widget_has_focus (struct s_gui_win_root *rootwin, enum focus_element_type t, void *element) |
void | window_set_icon (ROOTWIN *rootwin, struct bitmap *bmp) |
void | window_set_active_gui_window (ROOTWIN *rootwin, struct gui_window *gw) |
struct gui_window * | window_get_active_gui_window (ROOTWIN *rootwin) |
void | window_get_scroll (ROOTWIN *rootwin, int *x, int *y) |
void | window_get_grect (ROOTWIN *rootwin, enum browser_area_e which, GRECT *d) |
void | window_open_search (ROOTWIN *rootwin, bool reformat) |
void | window_close_search (ROOTWIN *rootwin) |
void | window_redraw_favicon (ROOTWIN *rootwin, GRECT *clip_ro) |
Redraw the favicon. More... | |
void | window_schedule_redraw_grect (ROOTWIN *rootwin, GRECT *area) |
static void | window_redraw_content (ROOTWIN *rootwin, GRECT *content_area, GRECT *clip, struct gemtk_wm_scroll_info_s *slid, struct browser_window *bw) |
void | window_place_caret (ROOTWIN *rootwin, short mode, int content_x, int content_y, int h, GRECT *work) |
void | window_process_redraws (ROOTWIN *rootwin) |
static bool | on_content_keypress (struct gui_window *gw, unsigned short nkc) |
Variables | |
struct gui_window * | input_window |
EVMULT_OUT | aes_event_out |
GRECT | desk_area |
static bool | redraw_active = false |
static const struct redraw_context | rootwin_rdrw_ctx |
Implements the NetSurf Browser window, or passed functionality to the appropriate widget's.
Definition in file rootwin.c.
bool gui_window_get_scroll | ( | struct gui_window * | w, |
int * | sx, | ||
int * | sy | ||
) |
Definition at line 414 of file gui.c.
Referenced by on_file_dropped().
|
static |
Definition at line 93 of file rootwin.c.
References s_gui_win_root::active_gui_window, s_gui_win_root::aes_handle, gui_window::browser, BROWSER_AREA_CONTENT, BROWSER_AREA_URL_INPUT, browser_window_destroy(), s_browser::bw, gui_window::cursor, gem_cursors, gem_set_cursor(), gui_set_input_gui_window(), s_gem_cursors::ibeam, gui_window::next, NSLOG, on_content_mouse_click(), on_content_mouse_move(), on_file_dropped(), on_redraw(), on_resized(), on_window_key_input(), gui_window::root, rootwin_data_s::rootwin, s_gui_win_root::toolbar, toolbar_mouse_input(), s_gui_win_root::win, window_get_active_gui_window(), window_get_grect(), and window_list.
Referenced by window_create().
|
static |
Definition at line 1276 of file rootwin.c.
References gui_window::browser, BROWSER_AREA_CONTENT, browser_window_key_press(), s_browser::bw, nkc_to_input_key(), NS_KEY_DOWN, NS_KEY_LEFT, NS_KEY_LINE_END, NS_KEY_LINE_START, NS_KEY_PAGE_DOWN, NS_KEY_PAGE_UP, NS_KEY_RIGHT, NS_KEY_TEXT_START, NS_KEY_UP, gui_window::root, s_gui_win_root::win, window_get_grect(), and window_scroll_by().
Referenced by on_window_key_input().
|
static |
Definition at line 1160 of file rootwin.c.
References aes_event_out, s_redrw_slots::areas_used, BROWSER, gui_window::browser, BROWSER_AREA_CONTENT, BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_DRAG_1, BROWSER_MOUSE_DRAG_ON, BROWSER_MOUSE_MOD_1, BROWSER_MOUSE_MOD_2, BROWSER_MOUSE_MOD_3, BROWSER_MOUSE_PRESS_1, browser_window_mouse_click(), browser_window_mouse_track(), s_browser::bw, context_popup(), gui_set_input_gui_window(), input_window, s_gui_win_root::redraw_slots, gui_window::root, s_gui_win_root::win, window_get_active_gui_window(), window_get_grect(), window_process_redraws(), and window_set_focus().
Referenced by handle_event().
|
static |
Definition at line 1138 of file rootwin.c.
References aes_event_out, gui_window::browser, browser_window_mouse_track(), browser_window::bw, s_browser::bw, s_gui_win_root::win, and window_get_active_gui_window().
Referenced by handle_event().
|
static |
Definition at line 1438 of file rootwin.c.
References gui_window::browser, BROWSER_AREA_CONTENT, browser_window_drop_file_at_point(), browser_window_navigate(), s_browser::bw, BW_NAVIGATE_HISTORY, gui_window_get_scroll(), local_file_to_url(), NSERROR_BAD_ENCODING, NSERROR_OK, NSLOG, nsurl_create(), nsurl_unref(), PATH_MAX, utf8_from_local_encoding(), s_gui_win_root::win, window_get_active_gui_window(), and window_get_grect().
Referenced by handle_event().
|
static |
Definition at line 1390 of file rootwin.c.
References clip(), s_gui_win_root::win, window_redraw_favicon(), and window_schedule_redraw_grect().
Referenced by handle_event().
|
static |
Definition at line 1404 of file rootwin.c.
References s_gui_win_root::aes_handle, gui_window::browser, browser_window_has_content(), browser_window_reformat(), s_browser::bw, s_gui_win_root::loc, s_gui_win_root::toolbar, toolbar_set_origin(), toolbar_set_width(), s_gui_win_root::win, and window_get_active_gui_window().
Referenced by handle_event().
|
static |
Definition at line 1359 of file rootwin.c.
References BROWSER, gui_window::browser, input_window, on_content_keypress(), gui_window::root, SEARCH_INPUT, s_gui_win_root::toolbar, toolbar_get_form(), toolbar_key_input(), window_get_active_gui_window(), window_schedule_redraw_grect(), window_url_widget_has_focus(), and window_widget_has_focus().
Referenced by handle_event().
|
static |
Definition at line 1547 of file rootwin.c.
References clip(), rootwin_data_s::rootwin, s_gui_win_root::toolbar, and toolbar_redraw().
Referenced by window_create().
void window_close_search | ( | ROOTWIN * | rootwin | ) |
Definition at line 680 of file rootwin.c.
References s_gui_win_root::active_gui_window, gui_window::browser, BROWSER_AREA_CONTENT, BROWSER_AREA_TOOLBAR, browser_window_reformat(), browser_window::bw, gui_window::bw, s_browser::bw, nsatari_search_session_destroy(), gui_window::search, s_gui_win_root::toolbar, toolbar_set_visible(), s_gui_win_root::win, and window_get_grect().
Referenced by menu_find(), toolbar_mouse_input(), and window_open().
int window_create | ( | struct gui_window * | gw, |
struct browser_window * | bw, | ||
struct gui_window * | existing, | ||
unsigned long | inflags | ||
) |
Definition at line 225 of file rootwin.c.
References s_gui_win_root::aes_handle, NS_ATARI_SYSINFO::aes_max_win_title_len, atari_sysinfo, BROWSER, gui_window::browser, s_browser::bw, desk_area, s_toolbar::form, handle_event(), s_gui_win_root::redraw_slots, redraw_slots_init(), gui_window::root, rootwin_data_s::rootwin, sb_create(), s_gui_win_root::statusbar, s_gui_win_root::title, s_gui_win_root::toolbar, toolbar_create(), toolbar_redraw_cb(), WIDGET_RESIZE, WIDGET_SCROLL, WIDGET_STATUSBAR, WIDGET_TOOLBAR, s_gui_win_root::win, WIN_TOP, and window_set_focus().
Referenced by gui_window_create().
int window_destroy | ( | ROOTWIN * | rootwin | ) |
Definition at line 336 of file rootwin.c.
References s_gui_win_root::aes_handle, gui_window::next, NSLOG, gui_window::root, sb_destroy(), s_gui_win_root::statusbar, s_gui_win_root::title, s_gui_win_root::toolbar, toolbar_destroy(), s_gui_win_root::win, and window_list.
Referenced by window_unref_gui_window().
struct gui_window * window_get_active_gui_window | ( | ROOTWIN * | rootwin | ) |
Definition at line 586 of file rootwin.c.
References s_gui_win_root::active_gui_window.
Referenced by gui_window_update_extent(), handle_event(), on_content_mouse_click(), on_content_mouse_move(), on_file_dropped(), on_resized(), on_window_key_input(), toolbar_back_click(), toolbar_forward_click(), toolbar_home_click(), toolbar_key_input(), toolbar_mouse_input(), toolbar_reload_click(), toolbar_set_url(), and toolbar_stop_click().
void window_get_grect | ( | ROOTWIN * | rootwin, |
enum browser_area_e | which, | ||
GRECT * | d | ||
) |
Definition at line 601 of file rootwin.c.
References BROWSER_AREA_CONTENT, BROWSER_AREA_SEARCH, BROWSER_AREA_TOOLBAR, BROWSER_AREA_URL_INPUT, s_gui_win_root::toolbar, toolbar_get_grect(), and s_gui_win_root::win.
Referenced by atari_window_invalidate_area(), get_context_info(), gui_window_get_dimensions(), gui_window_update_extent(), handle_event(), menu_debug_render(), nsatari_search_set_back_state(), nsatari_search_set_forward_state(), on_content_keypress(), on_content_mouse_click(), on_file_dropped(), window_close_search(), window_open_search(), window_place_caret(), window_process_redraws(), and window_set_content_size().
void window_get_scroll | ( | ROOTWIN * | rootwin, |
int * | x, | ||
int * | y | ||
) |
Definition at line 591 of file rootwin.c.
References s_gui_win_root::win.
Referenced by gui_window_get_scroll().
void window_open | ( | ROOTWIN * | rootwin, |
struct gui_window * | gw, | ||
GRECT | pos | ||
) |
show the window at specified position and make gw the active tab.
Definition at line 375 of file rootwin.c.
References s_gui_win_root::active_gui_window, s_gui_win_root::aes_handle, s_browser::attached, BROWSER, gui_window::browser, sb_attach(), s_gui_win_root::statusbar, s_gui_win_root::toolbar, toolbar_set_attached(), toolbar_set_dimensions(), s_gui_win_root::win, window_close_search(), window_set_focus(), and window_update_back_forward().
Referenced by gui_window_create().
void window_open_search | ( | ROOTWIN * | rootwin, |
bool | reformat | ||
) |
Definition at line 649 of file rootwin.c.
References s_gui_win_root::active_gui_window, gui_window::browser, BROWSER_AREA_CONTENT, BROWSER_AREA_SEARCH, BROWSER_AREA_TOOLBAR, browser_window_reformat(), browser_window::bw, gui_window::bw, s_browser::bw, nsatari_search_session_create(), NSLOG, gui_window::search, SEARCH_INPUT, s_gui_win_root::toolbar, toolbar_get_form(), toolbar_set_visible(), s_gui_win_root::win, window_get_grect(), window_process_redraws(), window_schedule_redraw_grect(), and window_set_focus().
Referenced by menu_find().
void window_place_caret | ( | ROOTWIN * | rootwin, |
short | mode, | ||
int | content_x, | ||
int | content_y, | ||
int | h, | ||
GRECT * | work | ||
) |
Definition at line 875 of file rootwin.c.
References BROWSER_AREA_CONTENT, s_gui_win_root::caret, CARET_STATE_VISIBLE, s_caret::dimensions, s_caret::fd_size, init_mfdb(), MFDB_FLAG_NOALLOC, MFDB_FLAG_ZEROMEM, mode, redraw_active, s_caret::state, s_caret::symbol, s_gui_win_root::win, and window_get_grect().
Referenced by gui_window_place_caret(), gui_window_remove_caret(), and window_process_redraws().
void window_process_redraws | ( | ROOTWIN * | rootwin | ) |
Definition at line 1015 of file rootwin.c.
References s_gui_win_root::active_gui_window, s_gui_win_root::aes_handle, s_redrw_slots::areas, s_redrw_slots::areas_used, gui_window::browser, BROWSER_AREA_CONTENT, BROWSER_AREA_TOOLBAR, s_browser::bw, s_gui_win_root::caret, CARET_STATE_ENABLED, s_caret::dimensions, plot_lock(), plot_set_abs_clipping(), plot_unlock(), redraw_active, s_gui_win_root::redraw_slots, s_caret::state, s_gui_win_root::toolbar, toolbar_redraw(), s_gui_win_root::win, window_get_grect(), window_place_caret(), window_redraw_content(), rect::x0, rect::x1, rect::y0, and rect::y1.
Referenced by atari_poll(), on_content_mouse_click(), toolbar_mouse_input(), and window_open_search().
|
static |
Definition at line 823 of file rootwin.c.
References s_gui_win_root::active_gui_window, gui_window::browser, browser_window_get_scale(), browser_window_redraw(), s_browser::bw, clip(), plotter_table::clip, redraw_context::plot, plot_set_dimensions(), plot_set_scale(), rootwin_rdrw_ctx, rect::x0, rect::x1, rect::y0, and rect::y1.
Referenced by window_process_redraws().
void window_redraw_favicon | ( | ROOTWIN * | rootwin, |
GRECT * | clip_ro | ||
) |
Redraw the favicon.
Definition at line 707 of file rootwin.c.
References s_gui_win_root::aes_handle, plotter_table::bitmap, clip(), s_gui_win_root::icon, redraw_context::plot, plot_get_vdi_handle(), plot_set_dimensions(), rootwin_rdrw_ctx, and s_gui_win_root::win.
Referenced by on_redraw(), and window_set_icon().
void window_restore_active_gui_window | ( | ROOTWIN * | rootwin | ) |
Definition at line 404 of file rootwin.c.
References s_gui_win_root::active_gui_window, gui_window::icon, NSLOG, gui_window::search, gui_window::status, gui_window::title, s_gui_win_root::toolbar, toolbar_get_grect(), toolbar_set_url(), gui_window::url, s_gui_win_root::win, window_set_icon(), window_set_stauts(), window_set_title(), and window_update_back_forward().
Referenced by window_set_active_gui_window().
void window_schedule_redraw_grect | ( | ROOTWIN * | rootwin, |
GRECT * | area | ||
) |
Definition at line 807 of file rootwin.c.
References redraw_active, redraw_slot_schedule_grect(), s_gui_win_root::redraw_slots, and s_gui_win_root::win.
Referenced by atari_window_invalidate_area(), gui_window_update_extent(), nsatari_search_set_back_state(), nsatari_search_set_forward_state(), on_redraw(), on_window_key_input(), tb_txt_request_redraw(), toolbar_mouse_input(), toolbar_set_throbber_state(), toolbar_set_url(), toolbar_throbber_progress(), toolbar_update_buttons(), and window_open_search().
void window_scroll_by | ( | ROOTWIN * | root, |
int | sx, | ||
int | sy | ||
) |
Definition at line 459 of file rootwin.c.
References root.
Referenced by gui_window_set_scroll(), and on_content_keypress().
void window_set_active_gui_window | ( | ROOTWIN * | rootwin, |
struct gui_window * | gw | ||
) |
Definition at line 564 of file rootwin.c.
References s_gui_win_root::active_gui_window, NSLOG, and window_restore_active_gui_window().
void window_set_content_size | ( | ROOTWIN * | rootwin, |
int | width, | ||
int | height | ||
) |
Set the dimensions of the scrollable content.
Definition at line 481 of file rootwin.c.
References BROWSER_AREA_CONTENT, height, width, s_gui_win_root::win, and window_get_grect().
Referenced by gui_window_update_extent().
void window_set_focus | ( | struct s_gui_win_root * | rootwin, |
enum focus_element_type | type, | ||
void * | element | ||
) |
Definition at line 498 of file rootwin.c.
References s_focus_info::element, s_gui_win_root::focus, NSLOG, SEARCH_INPUT, s_gui_win_root::toolbar, toolbar_key_input(), s_focus_info::type, type, URL_WIDGET, and s_gui_win_root::win.
Referenced by gui_window_create(), on_content_mouse_click(), toolbar_key_input(), toolbar_mouse_input(), window_create(), window_open(), and window_open_search().
Definition at line 553 of file rootwin.c.
References s_gui_win_root::icon, s_gui_win_root::win, and window_redraw_favicon().
Referenced by gui_window_set_icon(), and window_restore_active_gui_window().
void window_set_stauts | ( | struct s_gui_win_root * | rootwin, |
char * | text | ||
) |
Definition at line 439 of file rootwin.c.
References sb_set_text(), s_gui_win_root::statusbar, and text().
Referenced by atari_window_set_status(), and window_restore_active_gui_window().
void window_set_title | ( | struct s_gui_win_root * | rootwin, |
char * | title | ||
) |
Definition at line 454 of file rootwin.c.
References s_gui_win_root::aes_handle, and gui_window::title.
Referenced by gui_window_set_title(), and window_restore_active_gui_window().
void window_unref_gui_window | ( | ROOTWIN * | rootwin, |
struct gui_window * | gw | ||
) |
Definition at line 312 of file rootwin.c.
References gui_set_input_gui_window(), input_window, gui_window::next, NSLOG, s_gui_win_root::redraw_slots, redraw_slots_free(), gui_window::root, window_destroy(), and window_list.
Referenced by gui_window_destroy().
void window_update_back_forward | ( | struct s_gui_win_root * | rootwin | ) |
Definition at line 433 of file rootwin.c.
References s_gui_win_root::active_gui_window, gui_window::browser, s_browser::bw, s_gui_win_root::toolbar, and toolbar_update_buttons().
Referenced by gui_window_update_extent(), window_open(), and window_restore_active_gui_window().
bool window_url_widget_has_focus | ( | struct s_gui_win_root * | rootwin | ) |
Definition at line 531 of file rootwin.c.
References s_gui_win_root::focus, s_focus_info::type, and URL_WIDGET.
Referenced by on_window_key_input(), and toolbar_mouse_input().
bool window_widget_has_focus | ( | struct s_gui_win_root * | rootwin, |
enum focus_element_type | t, | ||
void * | element | ||
) |
Definition at line 542 of file rootwin.c.
References s_focus_info::element, s_gui_win_root::focus, and s_focus_info::type.
Referenced by on_window_key_input().
|
extern |
Definition at line 105 of file gui.c.
Referenced by on_content_mouse_click(), and on_content_mouse_move().
|
extern |
Definition at line 79 of file gui.c.
Referenced by window_create().
|
extern |
Definition at line 74 of file gui.c.
Referenced by on_content_mouse_click(), on_window_key_input(), and window_unref_gui_window().
|
static |
Definition at line 85 of file rootwin.c.
Referenced by window_place_caret(), window_process_redraws(), and window_schedule_redraw_grect().
|
static |
Definition at line 87 of file rootwin.c.
Referenced by window_redraw_content(), and window_redraw_favicon().