NetSurf
Macros | Functions | Variables
window.h File Reference

Browser window handling (interface). More...

#include <stdbool.h>
Include dependency graph for window.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ro_gui_window_close_all   ro_gui_window_quit
 Close all browser windows. More...
 

Functions

void ro_gui_window_initialise (void)
 Initialise the browser window module and its menus. More...
 
bool ro_gui_window_check_menu (wimp_menu *menu)
 Check if a particular menu handle is a browser window menu. More...
 
nserror ro_gui_window_set_url (struct gui_window *g, struct nsurl *url)
 Set the contents of a window's address bar. More...
 
nserror ro_gui_window_invalidate_area (struct gui_window *g, const struct rect *rect)
 Cause an area of a window to be invalidated. More...
 
void ro_gui_window_set_scale (struct gui_window *g, float scale)
 Set a gui_window's scale. More...
 
bool ro_gui_window_dataload (struct gui_window *g, wimp_message *message)
 Handle Message_DataLoad (file dragged in) for a window. More...
 
void ro_gui_window_mouse_at (wimp_pointer *pointer, void *data)
 Handle pointer movements in a browser window. More...
 
void ro_gui_window_iconise (struct gui_window *g, wimp_full_message_window_info *wi)
 Window is being iconised. More...
 
bool ro_gui_toolbar_dataload (struct gui_window *g, wimp_message *message)
 Handle Message_DataLoad (file dragged in) for a toolbar. More...
 
void ro_gui_window_redraw_all (void)
 Redraws the content for all windows. More...
 
void ro_gui_window_update_boxes (void)
 Redraw any pending update boxes. More...
 
void ro_gui_window_quit (void)
 Destroy all browser windows. More...
 
void ro_gui_throb (void)
 Animate the "throbbers" of all browser windows. More...
 
void ro_gui_window_default_options (struct gui_window *gui)
 Makes a browser window's options the default. More...
 
struct gui_windowro_gui_window_lookup (wimp_w window)
 Convert a RISC OS window handle to a gui_window. More...
 
struct gui_windowro_gui_toolbar_lookup (wimp_w window)
 Convert a toolbar RISC OS window handle to a gui_window. More...
 
bool ro_gui_window_to_window_pos (struct gui_window *g, int x, int y, os_coord *pos)
 Convert x,y screen co-ordinates into window co-ordinates. More...
 
enum browser_mouse_state ro_gui_mouse_click_state (wimp_mouse_state buttons, wimp_icon_flags type)
 Returns the state of the mouse buttons and modifiers keys for a mouse action, suitable for passing to the OS-independent browser window/ treeview/ etc code. More...
 
enum browser_mouse_state ro_gui_mouse_drag_state (wimp_mouse_state buttons, wimp_icon_flags type)
 Returns the state of the mouse buttons and modifiers keys whilst dragging, for passing to the OS-independent browser window/ treeview/ etc code. More...
 
bool ro_gui_shift_pressed (void)
 Returns true iff one or more Shift keys is held down. More...
 
bool ro_gui_ctrl_pressed (void)
 Returns true iff one or more Ctrl keys is held down. More...
 
bool ro_gui_alt_pressed (void)
 Returns true iff one or more Alt keys is held down. More...
 
void gui_window_set_pointer (struct gui_window *g, enum gui_pointer_shape shape)
 Change mouse pointer shape. More...
 

Variables

struct gui_window_tableriscos_window_table
 

Detailed Description

Browser window handling (interface).

Definition in file window.h.

Macro Definition Documentation

◆ ro_gui_window_close_all

#define ro_gui_window_close_all   ro_gui_window_quit

Close all browser windows.

no need for a separate fn same operation as quit

Definition at line 148 of file window.h.

Function Documentation

◆ gui_window_set_pointer()

void gui_window_set_pointer ( struct gui_window g,
gui_pointer_shape  shape 
)

Change mouse pointer shape.

Change mouse pointer shape.

Definition at line 216 of file theme.c.

References ami_gui_get_gui_window_2(), ami_set_pointer(), s_gem_cursors::appstarting, s_gem_cursors::arrow, s_gem_cursors::cross, gui_window::cursor, s_gem_cursors::deny, gem_cursors, gem_set_cursor(), GUI_POINTER_CARET, GUI_POINTER_CROSS, GUI_POINTER_DEFAULT, GUI_POINTER_DOWN, GUI_POINTER_HELP, GUI_POINTER_LD, GUI_POINTER_LEFT, GUI_POINTER_LU, GUI_POINTER_MENU, GUI_POINTER_MOVE, GUI_POINTER_NO_DROP, GUI_POINTER_NOT_ALLOWED, GUI_POINTER_POINT, GUI_POINTER_PROGRESS, GUI_POINTER_RD, GUI_POINTER_RIGHT, GUI_POINTER_RU, GUI_POINTER_UP, GUI_POINTER_WAIT, gui_sprites, s_gem_cursors::hand, s_gem_cursors::help, s_gem_cursors::ibeam, input_window, s_gem_cursors::menu, s_gem_cursors::nodrop, NSLOG, ro_gui_pointer_table, ro_warn_user(), s_gem_cursors::sizeall, s_gem_cursors::sizenesw, s_gem_cursors::sizens, s_gem_cursors::sizenwse, s_gem_cursors::sizewe, ro_gui_pointer_entry::sprite_name, s_gem_cursors::wait, ro_gui_pointer_entry::wimp_area, ro_gui_pointer_entry::xactive, and ro_gui_pointer_entry::yactive.

Referenced by gui_window_create(), nsatari_search_set_hourglass(), ro_gui_selection_drag_claim(), ro_gui_window_handle_local_keypress(), and ro_gui_window_track_end().

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

◆ ro_gui_alt_pressed()

bool ro_gui_alt_pressed ( void  )

Returns true iff one or more Alt keys is held down.

Definition at line 5042 of file window.c.

Referenced by ro_gui_close_window_request(), ro_gui_mouse_click_state(), and ro_gui_mouse_drag_state().

Here is the caller graph for this function:

◆ ro_gui_ctrl_pressed()

bool ro_gui_ctrl_pressed ( void  )

Returns true iff one or more Ctrl keys is held down.

Definition at line 5033 of file window.c.

Referenced by ro_cw_keypress(), ro_gui_mouse_click_state(), ro_gui_mouse_drag_state(), ro_gui_window_keypress(), and ro_gui_window_open().

Here is the caller graph for this function:

◆ ro_gui_mouse_click_state()

enum browser_mouse_state ro_gui_mouse_click_state ( wimp_mouse_state  buttons,
wimp_icon_flags  type 
)

Returns the state of the mouse buttons and modifiers keys for a mouse action, suitable for passing to the OS-independent browser window/ treeview/ etc code.

Parameters
buttonsWimp button state.
typeWimp work-area/icon type for decoding.
Returns
NetSurf core button state.

Definition at line 4878 of file window.c.

References BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_CLICK_2, BROWSER_MOUSE_DOUBLE_CLICK, BROWSER_MOUSE_DRAG_1, BROWSER_MOUSE_DRAG_2, BROWSER_MOUSE_MOD_1, BROWSER_MOUSE_MOD_2, BROWSER_MOUSE_MOD_3, BROWSER_MOUSE_PRESS_1, BROWSER_MOUSE_PRESS_2, BROWSER_MOUSE_TRIPLE_CLICK, mouse_drag_adjust, mouse_drag_select, ro_gui_alt_pressed(), ro_gui_ctrl_pressed(), ro_gui_shift_pressed(), and type.

Referenced by ro_cw_mouse_click(), and ro_gui_window_click().

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

◆ ro_gui_mouse_drag_state()

enum browser_mouse_state ro_gui_mouse_drag_state ( wimp_mouse_state  buttons,
wimp_icon_flags  type 
)

Returns the state of the mouse buttons and modifiers keys whilst dragging, for passing to the OS-independent browser window/ treeview/ etc code.

Parameters
buttonsWimp button state.
typeWimp work-area/icon type for decoding.
Returns
NetSurf core button state.

Definition at line 4995 of file window.c.

References BROWSER_MOUSE_DRAG_ON, BROWSER_MOUSE_HOLDING_1, BROWSER_MOUSE_HOLDING_2, BROWSER_MOUSE_MOD_1, BROWSER_MOUSE_MOD_2, BROWSER_MOUSE_MOD_3, mouse_drag_adjust, mouse_drag_select, ro_gui_alt_pressed(), ro_gui_ctrl_pressed(), and ro_gui_shift_pressed().

Referenced by ro_cw_mouse_at(), and ro_gui_window_mouse_at().

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

◆ ro_gui_shift_pressed()

bool ro_gui_shift_pressed ( void  )

Returns true iff one or more Shift keys is held down.

Definition at line 5024 of file window.c.

Referenced by handle_local_keypress_scale(), ro_gui_mouse_click_state(), ro_gui_mouse_drag_state(), ro_gui_window_close(), ro_gui_window_scroll(), and ro_gui_window_toolbar_click().

Here is the caller graph for this function:

◆ ro_gui_throb()

void ro_gui_throb ( void  )

Animate the "throbbers" of all browser windows.

Definition at line 4778 of file window.c.

References gui_window::active, gui_window::next, ro_toolbar_throb(), gui_window::toolbar, and window_list.

Referenced by ro_gui_handle_event().

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

◆ ro_gui_toolbar_dataload()

bool ro_gui_toolbar_dataload ( struct gui_window g,
wimp_message *  message 
)

Handle Message_DataLoad (file dragged in) for a toolbar.

Todo:
This belongs in the toolbar module, and should be moved there once the module is able to usefully handle its own events.
Parameters
gwindow
messageMessage_DataLoad block
Returns
true if the load was processed

Definition at line 4657 of file window.c.

References NSLOG, ro_gui_window_import_text(), and ro_warn_user().

Referenced by ro_msg_dataload().

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

◆ ro_gui_toolbar_lookup()

struct gui_window * ro_gui_toolbar_lookup ( wimp_w  window)

Convert a toolbar RISC OS window handle to a gui_window.

Parameters
windowRISC OS window handle of a toolbar
Returns
pointer to a structure if found, NULL otherwise

Definition at line 4836 of file window.c.

References parent, ro_gui_window_lookup(), ro_toolbar_get_parent_window(), and ro_toolbar_window_lookup().

Referenced by ro_gui_url_bar_menu_select(), ro_gui_url_bar_page_info_change(), and ro_msg_dataload().

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

◆ ro_gui_window_check_menu()

bool ro_gui_window_check_menu ( wimp_menu *  menu)

Check if a particular menu handle is a browser window menu.

Parameters
menuThe menu in question.
Returns
true if this menu is a browser window menu

Definition at line 4683 of file window.c.

References ro_gui_browser_window_menu.

Referenced by ro_gui_interactive_help_request().

Here is the caller graph for this function:

◆ ro_gui_window_dataload()

bool ro_gui_window_dataload ( struct gui_window g,
wimp_message *  message 
)

Handle Message_DataLoad (file dragged in) for a window.

If the file was dragged into a form file input, it is used as the value.

Parameters
gwindow
messageMessage_DataLoad block
Returns
true if the load was processed

Definition at line 4481 of file window.c.

References browser_window_drop_file_at_point(), gui_window::bw, update_box::g, NSLOG, ro_gui_window_to_window_pos(), ro_warn_user(), and browser_window::x.

Referenced by ro_msg_dataload().

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

◆ ro_gui_window_default_options()

void ro_gui_window_default_options ( struct gui_window gui)

Makes a browser window's options the default.

Parameters
guiThe riscos gui window to set default options in.

Definition at line 4792 of file window.c.

References browser_window_get_scale(), gui_window::buffer_animations, gui_window::buffer_everything, gui_window::bw, gui_window::gui, nsoption_set_bool, nsoption_set_int, gui_window::option, ro_gui_status_bar_get_width(), ro_toolbar_get_display_buttons(), ro_toolbar_get_display_throbber(), ro_toolbar_get_display_url(), gui_window::scale, gui_window::status_bar, and gui_window::toolbar.

Referenced by ro_gui_window_menu_select().

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

◆ ro_gui_window_iconise()

void ro_gui_window_iconise ( struct gui_window g,
wimp_full_message_window_info *  wi 
)

Window is being iconised.

Create a suitable thumbnail sprite (which, sadly, must be in the Wimp sprite pool), and return the sprite name and truncated title to the iconiser

Parameters
gthe gui window being iconised
withe WindowInfo message from the iconiser

Definition at line 4531 of file window.c.

References bitmap(), BITMAP_CLEAR, BITMAP_OPAQUE, browser_window_get_content(), browser_window::bw, gui_window::bw, height, gui_window::iconise_icon, iconise_next, iconise_used, NOF_ELEMENTS, NSLOG, riscos_bitmap_convert_8bpp(), riscos_bitmap_create(), riscos_bitmap_destroy(), riscos_bitmap_overlay_sprite(), riscos_bitmap_render(), ro_gui_wimp_get_sprite(), ro_warn_user(), sprite_bpp(), gui_window::title, and width.

Referenced by ro_msg_window_info().

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

◆ ro_gui_window_initialise()

void ro_gui_window_initialise ( void  )

Initialise the browser window module and its menus.

Definition at line 4262 of file window.c.

References BROWSER_BUFFER_ALL, BROWSER_BUFFER_ANIMS, BROWSER_EXPORT_DRAW, BROWSER_EXPORT_PDF, BROWSER_EXPORT_TEXT, BROWSER_FIND_TEXT, BROWSER_IMAGES_BACKGROUND, BROWSER_IMAGES_FOREGROUND, BROWSER_LINK_DOWNLOAD, BROWSER_LINK_NEW_WINDOW, BROWSER_LINK_SAVE, BROWSER_LINK_SAVE_TEXT, BROWSER_LINK_SAVE_URI, BROWSER_LINK_SAVE_URL, BROWSER_NAVIGATE_BACK, BROWSER_NAVIGATE_FORWARD, BROWSER_NAVIGATE_HOME, BROWSER_NAVIGATE_RELOAD_ALL, BROWSER_NAVIGATE_STOP, BROWSER_NAVIGATE_UP, BROWSER_NEW_WINDOW, BROWSER_OBJECT, BROWSER_OBJECT_EXPORT, BROWSER_OBJECT_EXPORT_DRAW, BROWSER_OBJECT_EXPORT_SPRITE, BROWSER_OBJECT_INFO, BROWSER_OBJECT_LINK, BROWSER_OBJECT_OBJECT, BROWSER_OBJECT_PRINT, BROWSER_OBJECT_RELOAD, BROWSER_OBJECT_SAVE, BROWSER_OBJECT_SAVE_URL_TEXT, BROWSER_OBJECT_SAVE_URL_URI, BROWSER_OBJECT_SAVE_URL_URL, BROWSER_PAGE, BROWSER_PAGE_INFO, BROWSER_PRINT, BROWSER_SAVE, BROWSER_SAVE_COMPLETE, BROWSER_SAVE_URL_TEXT, BROWSER_SAVE_URL_URI, BROWSER_SAVE_URL_URL, BROWSER_SAVE_VIEW, BROWSER_SCALE_VIEW, BROWSER_SELECTION, BROWSER_SELECTION_ALL, BROWSER_SELECTION_CLEAR, BROWSER_SELECTION_COPY, BROWSER_SELECTION_CUT, BROWSER_SELECTION_PASTE, BROWSER_SELECTION_SAVE, BROWSER_VIEW_SOURCE, BROWSER_WINDOW_COPY, BROWSER_WINDOW_DEFAULT, BROWSER_WINDOW_RESET, BROWSER_WINDOW_STAGGER, COOKIES_DELETE, COOKIES_SHOW, dialog_objinfo, dialog_pageinfo, dialog_print, dialog_saveas, dialog_search, dialog_zoom, HELP_LAUNCH_INTERACTIVE, HELP_OPEN_CONTENTS, HELP_OPEN_CREDITS, HELP_OPEN_GUIDE, HELP_OPEN_INFORMATION, HELP_OPEN_LICENCE, HISTORY_SHOW_GLOBAL, HISTORY_SHOW_LOCAL, HOTLIST_ADD_URL, HOTLIST_SHOW, NO_ACTION, ro_gui_browser_window_menu, ro_gui_menu_define_menu(), TOOLBAR_ADDRESS_BAR, TOOLBAR_BUTTONS, TOOLBAR_EDIT, and TOOLBAR_THROBBER.

Referenced by gui_init().

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

◆ ro_gui_window_invalidate_area()

nserror ro_gui_window_invalidate_area ( struct gui_window g,
const struct rect rect 
)

Cause an area of a window to be invalidated.

The specified area of the window should now be considered out of date. If the entire window is invalidated this simply calls wimp_force_redraw() otherwise the area is added to a queue of pending updates which will be processed from a wimp poll allowing multiple invalidation requests to be agregated.

Parameters
gThe window to update
rectThe area of the window to update or NULL to redraw entire contents.

Definition at line 4371 of file window.c.

References gui_window::buffer_animations, gui_window::buffer_everything, update_box::g, MARGIN, max, min, update_box::next, NSERROR_INVALID, NSERROR_NOMEM, NSERROR_OK, NSLOG, gui_window::option, pending_updates, ro_warn_user(), update_box::use_buffer, gui_window::window, update_box::x0, rect::x0, update_box::x1, rect::x1, update_box::y0, rect::y0, update_box::y1, and rect::y1.

Referenced by print_document(), ro_gui_window_handle_local_keypress(), and ro_gui_window_redraw_all().

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

◆ ro_gui_window_lookup()

struct gui_window * ro_gui_window_lookup ( wimp_w  window)

Convert a RISC OS window handle to a gui_window.

Parameters
windowRISC OS window handle.
Returns
A pointer to a riscos gui window if found or NULL.

Definition at line 4823 of file window.c.

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

Referenced by ro_gui_interactive_help_request(), ro_gui_save_drag_end(), ro_gui_selection_dragging(), ro_gui_toolbar_lookup(), ro_gui_url_complete_click(), ro_gui_window_pointer_entering(), ro_gui_window_scroll(), ro_msg_dataload(), and ro_msg_window_info().

Here is the caller graph for this function:

◆ ro_gui_window_mouse_at()

void ro_gui_window_mouse_at ( wimp_pointer *  pointer,
void *  data 
)

Handle pointer movements in a browser window.

Parameters
pointernew mouse position
databrowser window that the pointer is in

Definition at line 4513 of file window.c.

References browser_window_mouse_track(), gui_window::bw, ro_gui_mouse_drag_state(), and ro_gui_window_to_window_pos().

Referenced by gui_start_selection(), gui_window_drag_start(), gui_window_scroll_start(), and ro_gui_window_pointer_entering().

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

◆ ro_gui_window_quit()

void ro_gui_window_quit ( void  )

Destroy all browser windows.

Definition at line 4766 of file window.c.

References browser_window_destroy(), gui_window::bw, gui_window::next, and window_list.

Referenced by gui_quit().

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

◆ ro_gui_window_redraw_all()

void ro_gui_window_redraw_all ( void  )

Redraws the content for all windows.

Definition at line 4690 of file window.c.

References gui_window::next, ro_gui_window_invalidate_area(), and window_list.

Here is the call graph for this function:

◆ ro_gui_window_set_scale()

void ro_gui_window_set_scale ( struct gui_window g,
float  scale 
)

Set a gui_window's scale.

Definition at line 4474 of file window.c.

References browser_window_set_scale(), gui_window::bw, and update_box::g.

Referenced by handle_local_keypress_scale(), ro_gui_dialog_zoom_apply(), ro_gui_window_open(), and ro_gui_window_scroll().

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

◆ ro_gui_window_set_url()

nserror ro_gui_window_set_url ( struct gui_window g,
struct nsurl url 
)

Set the contents of a window's address bar.

Parameters
ggui_window to update
urlnew url for address bar

Definition at line 4450 of file window.c.

References update_box::g, NSERROR_OK, nsoption_bool, nsurl_access(), nsurl_get_utf8(), ro_gui_url_complete_start(), ro_toolbar_set_url(), and gui_window::toolbar.

Referenced by ro_gui_url_bar_menu_select(), and ro_gui_window_launch_url().

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

◆ ro_gui_window_to_window_pos()

bool ro_gui_window_to_window_pos ( struct gui_window g,
int  x,
int  y,
os_coord *  pos 
)

Convert x,y screen co-ordinates into window co-ordinates.

Parameters
ggui window
xx ordinate
yy ordinate
posreceives position in window co-ordinatates
Returns
true iff conversion successful

Definition at line 4855 of file window.c.

References NSLOG, ro_warn_user(), and gui_window::window.

Referenced by ro_gui_save_drag_end(), ro_gui_selection_drag_end(), ro_gui_selection_dragging(), ro_gui_window_click(), ro_gui_window_dataload(), ro_gui_window_handle_local_keypress(), ro_gui_window_menu_prepare(), ro_gui_window_mouse_at(), ro_gui_window_scroll_action(), and ro_gui_window_scroll_end().

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

◆ ro_gui_window_update_boxes()

void ro_gui_window_update_boxes ( void  )

Redraw any pending update boxes.

Definition at line 4699 of file window.c.

References update_box::g, update_box::next, NSLOG, pending_updates, ro_gui_current_redraw_gui, ro_gui_window__redraw_rect(), ro_warn_user(), update_box::use_buffer, gui_window::window, update_box::x0, update_box::x1, update_box::y0, and update_box::y1.

Referenced by riscos_poll().

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

Variable Documentation

◆ riscos_window_table

struct gui_window_table* riscos_window_table
extern

Definition at line 4258 of file window.c.

Referenced by main().