NetSurf
Macros | Functions | Variables
window.c File Reference

Main browser window handling for windows win32 frontend. More...

#include "utils/config.h"
#include <stdbool.h>
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include "utils/errors.h"
#include "utils/log.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
#include "utils/nsurl.h"
#include "utils/messages.h"
#include "content/content.h"
#include "netsurf/browser_window.h"
#include "netsurf/window.h"
#include "netsurf/keypress.h"
#include "desktop/browser_history.h"
#include "windows/gui.h"
#include "windows/pointers.h"
#include "windows/about.h"
#include "windows/resourceid.h"
#include "windows/findfile.h"
#include "windows/windbg.h"
#include "windows/drawable.h"
#include "windows/font.h"
#include "windows/prefs.h"
#include "windows/local_history.h"
#include "windows/hotlist.h"
#include "windows/cookies.h"
#include "windows/global_history.h"
#include "windows/window.h"
Include dependency graph for window.c:

Go to the source code of this file.

Macros

#define NSWS_THROBBER_WIDTH   24
 width of the throbber element More...
 
#define NSWS_URLBAR_HEIGHT   23
 height of the url entry box More...
 
#define NSW32_PGIBUTTON_HEIGHT   16
 height of the Page Information bitmap button More...
 

Functions

static void nsws_window_set_accels (struct gui_window *gw)
 create and attach accelerator table to main window More...
 
static HWND nsws_window_create (HINSTANCE hInstance, struct gui_window *gw)
 creation of a new full browser window More...
 
static LRESULT nsws_window_toolbar_command (struct gui_window *gw, int notification_code, int identifier, HWND ctrl_window)
 toolbar command message handler More...
 
static void urlbar_dimensions (HWND hWndParent, int toolbuttonsize, int buttonc, int *x, int *y, int *width, int *height)
 calculate the dimensions of the url bar relative to the parent toolbar More...
 
static LRESULT CALLBACK nsws_window_toolbar_callback (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 callback for toolbar events More...
 
static void set_urlbar_edit_size (HWND hwnd)
 
static LRESULT CALLBACK nsws_window_urlbar_callback (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 callback for url bar events More...
 
static HWND nsws_window_urlbar_create (HINSTANCE hInstance, HWND hWndParent, struct gui_window *gw)
 create a urlbar and message handler More...
 
static HWND nsws_window_throbber_create (HINSTANCE hInstance, HWND hWndParent, struct gui_window *gw)
 creation of throbber More...
 
static HIMAGELIST get_imagelist (HINSTANCE hInstance, int resid, int bsize, int bcnt)
 create a win32 image list for the toolbar. More...
 
static HWND nsws_window_create_toolbar (HINSTANCE hInstance, HWND hWndParent, struct gui_window *gw)
 create win32 main window toolbar and add controls and message handler More...
 
static HWND nsws_window_create_statusbar (HINSTANCE hInstance, HWND hWndParent, struct gui_window *gw)
 creation of status bar More...
 
static void nsws_update_edit (struct gui_window *w)
 Update popup context menu editing functionality. More...
 
static bool nsws_ctx_menu (struct gui_window *gw, HWND hwnd, int x, int y)
 Handle win32 context menu message. More...
 
static void nsws_window_update_forward_back (struct gui_window *w)
 update state of forward/back buttons/menu items when page changes More...
 
static nserror win32_window_invalidate_area (struct gui_window *gw, const struct rect *rect)
 Invalidate an area of a win32 browser window. More...
 
static nserror win32_open_new_window (struct gui_window *gw)
 Create a new window due to menu selection. More...
 
static LRESULT nsws_window_command (HWND hwnd, struct gui_window *gw, int notification_code, int identifier, HWND ctrl_window)
 handle command message on main browser window More...
 
static bool win32_window_get_scroll (struct gui_window *gw, int *sx, int *sy)
 Get the scroll position of a win32 browser window. More...
 
static LRESULT nsws_window_resize (struct gui_window *gw, HWND hwnd, WPARAM wparam, LPARAM lparam)
 handle WM_SIZE message on main browser window More...
 
static LRESULT CALLBACK nsws_window_event_callback (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 callback for browser window win32 events More...
 
static void destroy_page_info_bitmaps (struct gui_window *gw)
 
static void load_page_info_bitmaps (HINSTANCE hInstance, struct gui_window *gw)
 
static struct gui_windowwin32_window_create (struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
 create a new gui_window to contain a browser_window. More...
 
static void win32_window_destroy (struct gui_window *w)
 Destroy previously created win32 window. More...
 
static nserror win32_window_get_dimensions (struct gui_window *gw, int *width, int *height)
 Find the current dimensions of a win32 browser window's content area. More...
 
static void win32_window_update_extent (struct gui_window *gw)
 Update the extent of the inside of a browser window to that of the current content. More...
 
static void win32_window_set_title (struct gui_window *w, const char *title)
 set win32 browser window title More...
 
static nserror win32_window_set_url (struct gui_window *gw, nsurl *url)
 Set the navigation url in a win32 browser window. More...
 
static void win32_window_set_status (struct gui_window *w, const char *text)
 Set the status bar of a win32 browser window. More...
 
static void win32_window_set_pointer (struct gui_window *w, gui_pointer_shape shape)
 Change the win32 mouse pointer shape. More...
 
static void win32_window_place_caret (struct gui_window *w, int x, int y, int height, const struct rect *clip)
 Give the win32 input focus to a window. More...
 
static void win32_window_remove_caret (struct gui_window *gw)
 Remove the win32 input focus from window. More...
 
static void win32_window_start_throbber (struct gui_window *w)
 start a win32 navigation throbber. More...
 
static void win32_window_stop_throbber (struct gui_window *w)
 stop a win32 navigation throbber. More...
 
static void win32_window_page_info_change (struct gui_window *gw)
 win32 page info change. More...
 
static nserror win32_window_event (struct gui_window *gw, enum gui_window_event event)
 process miscellaneous window events More...
 
struct gui_windownsws_get_gui_window (HWND hwnd)
 Obtain gui window structure from window handle. More...
 
bool nsws_window_go (HWND hwnd, const char *urltxt)
 Cause a browser window to navigate to a url. More...
 
nserror win32_window_set_scroll (struct gui_window *gw, const struct rect *rect)
 Set the scroll position of a win32 browser window. More...
 
nserror nsws_create_main_class (HINSTANCE hinstance)
 Create the main browser window class. More...
 
HWND gui_window_main_window (struct gui_window *w)
 Get the main win32 window handle from a gui window. More...
 

Variables

static struct gui_windowwindow_list = NULL
 List of all gui windows. More...
 
static const LPCWSTR windowclassname_main = L"nswsmainwindow"
 The main window class name. More...
 
static int open_windows = 0
 Number of open windows. More...
 
static struct gui_window_table window_table
 win32 frontend browser window handling operation table More...
 
struct gui_window_tablewin32_window_table = &window_table
 The window operation function table for win32. More...
 

Detailed Description

Main browser window handling for windows win32 frontend.

Definition in file window.c.

Macro Definition Documentation

◆ NSW32_PGIBUTTON_HEIGHT

#define NSW32_PGIBUTTON_HEIGHT   16

height of the Page Information bitmap button

Definition at line 81 of file window.c.

◆ NSWS_THROBBER_WIDTH

#define NSWS_THROBBER_WIDTH   24

width of the throbber element

Definition at line 71 of file window.c.

◆ NSWS_URLBAR_HEIGHT

#define NSWS_URLBAR_HEIGHT   23

height of the url entry box

Definition at line 76 of file window.c.

Function Documentation

◆ destroy_page_info_bitmaps()

static void destroy_page_info_bitmaps ( struct gui_window gw)
static

Definition at line 1461 of file window.c.

References gui_window::hPageInfo, PAGE_STATE_INSECURE, PAGE_STATE_INTERNAL, PAGE_STATE_LOCAL, PAGE_STATE_SECURE, PAGE_STATE_SECURE_ISSUES, PAGE_STATE_SECURE_OVERRIDE, and PAGE_STATE_UNKNOWN.

Referenced by win32_window_destroy().

Here is the caller graph for this function:

◆ get_imagelist()

static HIMAGELIST get_imagelist ( HINSTANCE  hInstance,
int  resid,
int  bsize,
int  bcnt 
)
static

create a win32 image list for the toolbar.

Parameters
hInstanceThe application instance handle.
residThe resource ID of the image.
bsizeThe size of the image to load.
bcntThe number of bitmaps to load into the list.
Returns
The image list or NULL on error.

Definition at line 607 of file window.c.

References NSLOG, and win_perror().

Referenced by nsws_window_create_toolbar().

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

◆ gui_window_main_window()

HWND gui_window_main_window ( struct gui_window w)

Get the main win32 window handle from a gui window.

Definition at line 2112 of file window.c.

References gui_window::main.

Referenced by nsws_download_window_up().

Here is the caller graph for this function:

◆ load_page_info_bitmaps()

static void load_page_info_bitmaps ( HINSTANCE  hInstance,
struct gui_window gw 
)
static

Definition at line 1472 of file window.c.

References gui_window::hPageInfo, IDB_PAGEINFO_INSECURE, IDB_PAGEINFO_INTERNAL, IDB_PAGEINFO_LOCAL, IDB_PAGEINFO_SECURE, IDB_PAGEINFO_WARNING, PAGE_STATE_INSECURE, PAGE_STATE_INTERNAL, PAGE_STATE_LOCAL, PAGE_STATE_SECURE, PAGE_STATE_SECURE_ISSUES, PAGE_STATE_SECURE_OVERRIDE, and PAGE_STATE_UNKNOWN.

Referenced by win32_window_create().

Here is the caller graph for this function:

◆ nsws_create_main_class()

nserror nsws_create_main_class ( HINSTANCE  hinstance)

Create the main browser window class.

Parameters
hinstanceThe application instance
Returns
NSERROR_OK on success or NSERROR_INIT_FAILED if the class creation failed.

Definition at line 2083 of file window.c.

References IDR_NETSURF_ICON, NSERROR_INIT_FAILED, NSERROR_OK, nsws_window_event_callback(), win_perror(), and windowclassname_main.

Referenced by WinMain().

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

◆ nsws_ctx_menu()

static bool nsws_ctx_menu ( struct gui_window gw,
HWND  hwnd,
int  x,
int  y 
)
static

Handle win32 context menu message.

Parameters
gwwin32 frontends graphical window.
hwndThe win32 window handle
xThe x coordinate of the event.
ythe y coordinate of the event.
Returns
true if menu displayed else false

Definition at line 857 of file window.c.

References nsws_update_edit(), and gui_window::rclick.

Referenced by nsws_window_event_callback().

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

◆ nsws_get_gui_window()

struct gui_window * nsws_get_gui_window ( HWND  hwnd)

Obtain gui window structure from window handle.

Parameters
hwndThe window handle.
Returns
The gui window associated with the window handle.

Definition at line 1925 of file window.c.

Referenced by nsws_window_drawable_event_callback(), nsws_window_event_callback(), nsws_window_go(), nsws_window_toolbar_callback(), and nsws_window_urlbar_callback().

Here is the caller graph for this function:

◆ nsws_update_edit()

static void nsws_update_edit ( struct gui_window w)
static

Update popup context menu editing functionality.

Parameters
wwin32 frontends window context.

Definition at line 794 of file window.c.

References browser_window_get_editor_flags(), gui_window::bw, BW_EDITOR_CAN_COPY, BW_EDITOR_CAN_CUT, BW_EDITOR_CAN_PASTE, BW_EDITOR_NONE, IDM_EDIT_COPY, IDM_EDIT_CUT, IDM_EDIT_DELETE, IDM_EDIT_PASTE, gui_window::mainmenu, gui_window::rclick, and gui_window::urlbar.

Referenced by nsws_ctx_menu().

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

◆ nsws_window_command()

static LRESULT nsws_window_command ( HWND  hwnd,
struct gui_window gw,
int  notification_code,
int  identifier,
HWND  ctrl_window 
)
static

handle command message on main browser window

Parameters
hwndThe win32 window handle
gwwin32 gui window
notification_codenotification code
identifiernotification identifier
ctrl_windowThe win32 control window handle
Returns
appropriate response for command

Definition at line 1002 of file window.c.

References browser_window_debug(), browser_window_history_back(), browser_window_history_back_available(), browser_window_history_forward(), browser_window_history_forward_available(), browser_window_key_press(), browser_window_navigate(), browser_window_reload(), browser_window_schedule_reformat(), browser_window_set_scale(), browser_window_stop(), gui_window::bw, BW_NAVIGATE_HISTORY, CONTENT_DEBUG_REDRAW, gui_window::drawingarea, gui_window::fullscreen, hinst, IDC_MAIN_LAUNCH_URL, IDM_EDIT_COPY, IDM_EDIT_CUT, IDM_EDIT_DELETE, IDM_EDIT_PASTE, IDM_EDIT_PREFERENCES, IDM_EDIT_SEARCH, IDM_EDIT_SELECT_ALL, IDM_FILE_CLOSE_WINDOW, IDM_FILE_OPEN_LOCATION, IDM_FILE_OPEN_WINDOW, IDM_FILE_PRINT, IDM_FILE_PRINT_PREVIEW, IDM_FILE_QUIT, IDM_FILE_SAVE_PAGE, IDM_FILE_SAVEAS_PDF, IDM_FILE_SAVEAS_POSTSCRIPT, IDM_FILE_SAVEAS_TEXT, IDM_HELP_ABOUT, IDM_HELP_CONTENTS, IDM_HELP_GUIDE, IDM_HELP_INFO, IDM_NAV_BACK, IDM_NAV_BOOKMARKS, IDM_NAV_FORWARD, IDM_NAV_GLOBALHISTORY, IDM_NAV_HOME, IDM_NAV_LOCALHISTORY, IDM_NAV_RELOAD, IDM_NAV_STOP, IDM_TOOLS_COOKIES, IDM_TOOLS_DOWNLOADS, IDM_VIEW_DEBUGGING_SAVE_BOXTREE, IDM_VIEW_DEBUGGING_SAVE_DOMTREE, IDM_VIEW_FULLSCREEN, IDM_VIEW_SAVE_WIN_METRICS, IDM_VIEW_SOURCE, IDM_VIEW_TOGGLE_DEBUG_RENDERING, IDM_VIEW_ZOOMMINUS, IDM_VIEW_ZOOMNORMAL, IDM_VIEW_ZOOMPLUS, gui_window::main, messages_get_errorcode(), gui_window::next, NS_KEY_SELECT_ALL, NSERROR_OK, NSLOG, nsoption_charp, nsoption_set_int, nsurl_create(), nsurl_unref(), nsw32_about_dialog_init(), nsw32_cookies_present(), nsw32_global_history_present(), nsw32_hotlist_present(), nsw32_local_history_present(), nsws_prefs_dialog_init(), nsws_prefs_save(), nsws_window_go(), nsws_window_update_forward_back(), gui_window::url, gui_window::urlbar, win32_open_new_window(), win32_report_nserror(), win32_warning(), and window_list.

Referenced by nsws_window_event_callback().

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

◆ nsws_window_create()

static HWND nsws_window_create ( HINSTANCE  hInstance,
struct gui_window gw 
)
static

creation of a new full browser window

Parameters
hInstanceThe application instance handle.
gwgui window context.
Returns
The newly created window instance.

Definition at line 143 of file window.c.

References height, IDR_MENU_CONTEXT, IDR_MENU_MAIN, gui_window::mainmenu, NSLOG, nsoption_int, nsws_window_set_accels(), gui_window::rclick, width, and windowclassname_main.

Referenced by win32_window_create().

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

◆ nsws_window_create_statusbar()

static HWND nsws_window_create_statusbar ( HINSTANCE  hInstance,
HWND  hWndParent,
struct gui_window gw 
)
static

creation of status bar

Parameters
hInstanceThe application instance handle.
hWndParentThe containing window.
gwwin32 frontends window context.

Definition at line 768 of file window.c.

References IDC_MAIN_STATUSBAR.

Referenced by win32_window_create().

Here is the caller graph for this function:

◆ nsws_window_create_toolbar()

static HWND nsws_window_create_toolbar ( HINSTANCE  hInstance,
HWND  hWndParent,
struct gui_window gw 
)
static

create win32 main window toolbar and add controls and message handler

Toolbar has buttons on the left, url entry space in the middle and activity throbber on the right.

Parameters
hInstanceThe application instance handle.
hWndParentThe containing window.
gwwin32 frontends window context.
Returns
win32 window handle of created window or NULL on error.

Definition at line 656 of file window.c.

References get_imagelist(), IDM_NAV_BACK, IDM_NAV_FORWARD, IDM_NAV_HOME, IDM_NAV_RELOAD, IDM_NAV_STOP, IDR_TOOLBAR_BITMAP, IDR_TOOLBAR_BITMAP_GREY, IDR_TOOLBAR_BITMAP_HOT, nsws_window_throbber_create(), nsws_window_toolbar_callback(), nsws_window_urlbar_create(), ShowWindow, gui_window::throbber, gui_window::toolbuttonc, gui_window::toolbuttonsize, and gui_window::urlbar.

Referenced by win32_window_create().

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

◆ nsws_window_event_callback()

static LRESULT CALLBACK nsws_window_event_callback ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

callback for browser window win32 events

Parameters
hwndThe win32 window handle
msgThe win32 message identifier
wparamThe w win32 parameter
lparamThe l win32 parameter

Definition at line 1390 of file window.c.

References browser_window_destroy(), gui_window::bw, LOG_WIN_MSG, NSLOG, nsw32_local_history_hide(), nsws_ctx_menu(), nsws_get_gui_window(), nsws_window_command(), nsws_window_resize(), open_windows, and win32_set_quit().

Referenced by nsws_create_main_class().

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

◆ nsws_window_go()

bool nsws_window_go ( HWND  hwnd,
const char *  urltxt 
)

Cause a browser window to navigate to a url.

Parameters
hwndThe win32 handle to the browser window or one of its decendants.
urltxtThe URL to navigate to.

Definition at line 1954 of file window.c.

References browser_window_navigate(), gui_window::bw, BW_NAVIGATE_HISTORY, NSERROR_OK, nsurl_create(), nsurl_unref(), nsws_get_gui_window(), gui_window::url, and win32_report_nserror().

Referenced by nsws_about_event_callback(), and nsws_window_command().

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

◆ nsws_window_resize()

static LRESULT nsws_window_resize ( struct gui_window gw,
HWND  hwnd,
WPARAM  wparam,
LPARAM  lparam 
)
static

handle WM_SIZE message on main browser window

Parameters
gwwin32 gui window
hwndThe win32 window handle
wparamThe w win32 parameter
lparamThe l win32 parameter
Returns
appropriate response for resize

Definition at line 1341 of file window.c.

References gui_window::drawingarea, gui_window::height, IDM_NAV_STOP, nsws_window_update_forward_back(), gui_window::statusbar, gui_window::toolbar, gui_window::urlbar, and gui_window::width.

Referenced by nsws_window_event_callback().

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

◆ nsws_window_set_accels()

static void nsws_window_set_accels ( struct gui_window gw)
static

create and attach accelerator table to main window

Parameters
gwgui window context.

Definition at line 94 of file window.c.

References gui_window::acceltable, IDC_MAIN_LAUNCH_URL, IDM_EDIT_SELECT_ALL, IDM_FILE_CLOSE_WINDOW, IDM_FILE_OPEN_LOCATION, IDM_FILE_OPEN_WINDOW, IDM_FILE_QUIT, IDM_NAV_BACK, IDM_NAV_FORWARD, IDM_NAV_HOME, IDM_NAV_RELOAD, IDM_NAV_STOP, IDM_VIEW_FULLSCREEN, and IDM_VIEW_SOURCE.

Referenced by nsws_window_create().

Here is the caller graph for this function:

◆ nsws_window_throbber_create()

static HWND nsws_window_throbber_create ( HINSTANCE  hInstance,
HWND  hWndParent,
struct gui_window gw 
)
static

creation of throbber

Parameters
hInstanceThe application instance handle.
hWndParentThe containing window.
gwwin32 frontends window context.
Returns
win32 window handle of created window or NULL on error.

Definition at line 560 of file window.c.

References IDC_MAIN_THROBBER, IDR_THROBBER_AVI, NSWS_THROBBER_WIDTH, ShowWindow, gui_window::throbbing, gui_window::toolbuttonc, gui_window::toolbuttonsize, urlbar_dimensions(), and gui_window::width.

Referenced by nsws_window_create_toolbar().

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

◆ nsws_window_toolbar_callback()

static LRESULT CALLBACK nsws_window_toolbar_callback ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

callback for toolbar events

subclass message handler for toolbar window

Parameters
hwndwin32 window handle message arrived for
msgThe message ID
wparamThe w parameter of the message.
lparamThe l parameter of the message.

Definition at line 315 of file window.c.

References LOG_WIN_MSG, nsws_get_gui_window(), NSWS_THROBBER_WIDTH, nsws_window_toolbar_command(), gui_window::throbber, gui_window::toolbuttonc, gui_window::toolbuttonsize, gui_window::urlbar, and urlbar_dimensions().

Referenced by nsws_window_create_toolbar().

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

◆ nsws_window_toolbar_command()

static LRESULT nsws_window_toolbar_command ( struct gui_window gw,
int  notification_code,
int  identifier,
HWND  ctrl_window 
)
static

toolbar command message handler

Todo:
This entire command handler appears superfluous.
Parameters
gwThe graphical window context
notification_codeThe notification code of the message
identifierThe identifier the command was delivered for
ctrl_windowThe controlling window.

Definition at line 212 of file window.c.

References IDC_MAIN_URLBAR, and NSLOG.

Referenced by nsws_window_toolbar_callback().

Here is the caller graph for this function:

◆ nsws_window_update_forward_back()

static void nsws_window_update_forward_back ( struct gui_window w)
static

update state of forward/back buttons/menu items when page changes

Parameters
wwin32 frontends graphical window.

Definition at line 893 of file window.c.

References gui_window::back, browser_window_history_back_available(), browser_window_history_forward_available(), gui_window::bw, gui_window::forward, IDM_NAV_BACK, IDM_NAV_FORWARD, gui_window::mainmenu, nsw32_local_history_hide(), gui_window::rclick, and gui_window::toolbar.

Referenced by nsws_window_command(), nsws_window_resize(), win32_window_start_throbber(), and win32_window_stop_throbber().

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

◆ nsws_window_urlbar_callback()

static LRESULT CALLBACK nsws_window_urlbar_callback ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

callback for url bar events

subclass message handler for urlbar window

Parameters
hwndwin32 window handle message arrived for
msgThe message ID
wparamThe w parameter of the message.
lparamThe l parameter of the message.

Definition at line 401 of file window.c.

References fallthrough, IDC_MAIN_LAUNCH_URL, LOG_WIN_MSG, gui_window::main, NSLOG, nsws_get_gui_window(), result, and set_urlbar_edit_size().

Referenced by nsws_window_urlbar_create().

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

◆ nsws_window_urlbar_create()

static HWND nsws_window_urlbar_create ( HINSTANCE  hInstance,
HWND  hWndParent,
struct gui_window gw 
)
static

create a urlbar and message handler

Create an Edit control for entering urls

Parameters
hInstanceThe application instance handle.
hWndParentThe containing window.
gwwin32 frontends window context.
Returns
win32 window handle of created window or NULL on error.

Definition at line 467 of file window.c.

References gui_window::hPageInfo, IDC_MAIN_URLBAR, IDC_PAGEINFO, NSLOG, NSW32_PGIBUTTON_HEIGHT, NSWS_URLBAR_HEIGHT, nsws_window_urlbar_callback(), PAGE_STATE_UNKNOWN, set_urlbar_edit_size(), gui_window::toolbuttonc, gui_window::toolbuttonsize, and urlbar_dimensions().

Referenced by nsws_window_create_toolbar().

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

◆ set_urlbar_edit_size()

static void set_urlbar_edit_size ( HWND  hwnd)
static

Definition at line 379 of file window.c.

References NSLOG, and NSW32_PGIBUTTON_HEIGHT.

Referenced by nsws_window_urlbar_callback(), and nsws_window_urlbar_create().

Here is the caller graph for this function:

◆ urlbar_dimensions()

static void urlbar_dimensions ( HWND  hWndParent,
int  toolbuttonsize,
int  buttonc,
int *  x,
int *  y,
int *  width,
int *  height 
)
static

calculate the dimensions of the url bar relative to the parent toolbar

Parameters
hWndParentThe parent window of the url bar
toolbuttonsizesize of the buttons
buttoncThe number of buttons
[out]xThe calculated x location
[out]yThe calculated y location
[out]widthThe calculated width
[out]heightThe calculated height

Definition at line 285 of file window.c.

References height, NSWS_THROBBER_WIDTH, NSWS_URLBAR_HEIGHT, gui_window::toolbuttonsize, and width.

Referenced by nsws_window_throbber_create(), nsws_window_toolbar_callback(), and nsws_window_urlbar_create().

Here is the caller graph for this function:

◆ win32_open_new_window()

static nserror win32_open_new_window ( struct gui_window gw)
static

Create a new window due to menu selection.

Parameters
gwfrontends graphical window.
Returns
NSERROR_OK on success else appropriate error code.

Definition at line 965 of file window.c.

References browser_window_create(), gui_window::bw, BW_CREATE_HISTORY, NSERROR_OK, nsoption_charp, nsurl_create(), nsurl_unref(), and gui_window::url.

Referenced by nsws_window_command().

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

◆ win32_window_create()

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

create a new gui_window to contain a browser_window.

Parameters
bwthe browser_window to connect to the new gui_window
existingAn existing window.
flagsThe flags controlling the construction.
Returns
The new win32 gui window or NULL on error.

Definition at line 1528 of file window.c.

References gui_window::bw, gui_window::drawingarea, font_hwnd, gui_window::gui, gui_window::height, hinst, load_page_info_bitmaps(), gui_window::localhistory, gui_window::main, gui_window::mouse, gui_window::next, NSLOG, nsws_window_create(), nsws_window_create_drawable(), nsws_window_create_statusbar(), nsws_window_create_toolbar(), open_windows, gui_window::pressed_x, gui_window::pressed_y, gui_window::prev, gui_window::requestscrollx, gui_window::requestscrolly, ShowWindow, gui_window::state, gui_window::statusbar, gui_window::toolbar, gui_window::toolbuttonsize, gui_window::width, and window_list.

Here is the call graph for this function:

◆ win32_window_destroy()

static void win32_window_destroy ( struct gui_window w)
static

Destroy previously created win32 window.

Parameters
wThe gui window to destroy.

Definition at line 1596 of file window.c.

References gui_window::acceltable, destroy_page_info_bitmaps(), gui_window::next, gui_window::prev, and window_list.

Here is the call graph for this function:

◆ win32_window_event()

static nserror win32_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 1873 of file window.c.

References GW_EVENT_PAGE_INFO_CHANGE, GW_EVENT_REMOVE_CARET, GW_EVENT_START_THROBBER, GW_EVENT_STOP_THROBBER, GW_EVENT_UPDATE_EXTENT, NSERROR_OK, win32_window_page_info_change(), win32_window_remove_caret(), win32_window_start_throbber(), win32_window_stop_throbber(), and win32_window_update_extent().

Here is the call graph for this function:

◆ win32_window_get_dimensions()

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

Find the current dimensions of a win32 browser window's content area.

Parameters
gwgui_window to measure
widthreceives width of window
heightreceives height of window
Returns
NSERROR_OK and width and height updated

Definition at line 1627 of file window.c.

References gui_window::height, height, NSERROR_OK, NSLOG, gui_window::width, and width.

◆ win32_window_get_scroll()

static bool win32_window_get_scroll ( struct gui_window gw,
int *  sx,
int *  sy 
)
static

Get the scroll position of a win32 browser window.

Parameters
gwgui_window
sxreceives x ordinate of point at top-left of window
syreceives y ordinate of point at top-left of window
Returns
true iff successful

Definition at line 1318 of file window.c.

References NSLOG, gui_window::scrollx, and gui_window::scrolly.

◆ win32_window_invalidate_area()

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

Invalidate an area of a win32 browser window.

Parameters
gwThe netsurf window being invalidated.
rectarea to redraw or NULL for entrire window area.
Returns
NSERROR_OK or appropriate error code.

Definition at line 934 of file window.c.

References gui_window::drawingarea, NSERROR_OK, gui_window::scrollx, gui_window::scrolly, rect::x0, rect::x1, rect::y0, and rect::y1.

◆ win32_window_page_info_change()

static void win32_window_page_info_change ( struct gui_window gw)
static

win32 page info change.

Parameters
gwwindow to chnage info on

Definition at line 1851 of file window.c.

References browser_window_get_page_info_state(), gui_window::bw, gui_window::hPageInfo, and gui_window::toolbar.

Referenced by win32_window_event().

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

◆ win32_window_place_caret()

static void win32_window_place_caret ( struct gui_window w,
int  x,
int  y,
int  height,
const struct rect clip 
)
static

Give the win32 input focus to a window.

Parameters
wwindow with caret
xcoordinates of caret
ycoordinates of caret
heightheight of caret
cliprectangle to clip caret or NULL if none

Definition at line 1754 of file window.c.

References gui_window::drawingarea, height, gui_window::scrollx, and gui_window::scrolly.

◆ win32_window_remove_caret()

static void win32_window_remove_caret ( struct gui_window gw)
static

Remove the win32 input focus from window.

Parameters
gwwindow with caret

Definition at line 1772 of file window.c.

References gui_window::drawingarea.

Referenced by win32_window_event().

Here is the caller graph for this function:

◆ win32_window_set_pointer()

static void win32_window_set_pointer ( struct gui_window w,
gui_pointer_shape  shape 
)
static

Change the win32 mouse pointer shape.

Parameters
wThe gui window to change pointer shape in.
shapeThe new shape to change to.

Definition at line 1738 of file window.c.

References nsws_get_pointer().

Here is the call graph for this function:

◆ win32_window_set_scroll()

nserror win32_window_set_scroll ( struct gui_window gw,
const struct rect rect 
)

Set the scroll position of a win32 browser window.

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

Parameters
gwThe win32 gui window to scroll.
rectThe rectangle to ensure is shown.
Returns
NSERROR_OK on success or apropriate error code.

Definition at line 1983 of file window.c.

References browser_window_get_extents(), gui_window::bw, gui_window::drawingarea, gui_window::height, height, max, min, NSERROR_BAD_PARAMETER, NSERROR_OK, NSLOG, gui_window::redraw, gui_window::requestscrollx, gui_window::requestscrolly, gui_window::scrollx, gui_window::scrolly, gui_window::width, width, point_s::x, rect::x0, point_s::y, and rect::y0.

Referenced by nsws_drawable_hscroll(), nsws_drawable_vscroll(), and win32_window_update_extent().

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

◆ win32_window_set_status()

static void win32_window_set_status ( struct gui_window w,
const char *  text 
)
static

Set the status bar of a win32 browser window.

Parameters
wgui_window to update
textnew status text

Definition at line 1722 of file window.c.

References gui_window::statusbar, and text().

Here is the call graph for this function:

◆ win32_window_set_title()

static void win32_window_set_title ( struct gui_window w,
const char *  title 
)
static

set win32 browser window title

Parameters
wthe win32 gui window.
titleto set on window

Definition at line 1659 of file window.c.

References gui_window::main, messages_get_errorcode(), NSERROR_NOMEM, NSLOG, and SLEN.

Here is the call graph for this function:

◆ win32_window_set_url()

static nserror win32_window_set_url ( struct gui_window gw,
nsurl url 
)
static

Set the navigation url in a win32 browser window.

Parameters
gwwindow to update.
urlThe url to use as icon.

Definition at line 1708 of file window.c.

References NSERROR_OK, nsurl_access(), and gui_window::urlbar.

Here is the call graph for this function:

◆ win32_window_start_throbber()

static void win32_window_start_throbber ( struct gui_window w)
static

start a win32 navigation throbber.

Parameters
wwindow in which to start throbber.

Definition at line 1785 of file window.c.

References IDM_NAV_RELOAD, IDM_NAV_STOP, gui_window::mainmenu, nsws_window_update_forward_back(), gui_window::rclick, gui_window::throbber, gui_window::throbbing, and gui_window::toolbar.

Referenced by win32_window_event().

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

◆ win32_window_stop_throbber()

static void win32_window_stop_throbber ( struct gui_window w)
static

stop a win32 navigation throbber.

Parameters
wwindow with throbber to stop

Definition at line 1816 of file window.c.

References IDM_NAV_RELOAD, IDM_NAV_STOP, gui_window::mainmenu, nsws_window_update_forward_back(), gui_window::rclick, gui_window::throbber, gui_window::throbbing, and gui_window::toolbar.

Referenced by win32_window_event().

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

◆ win32_window_update_extent()

static void win32_window_update_extent ( struct gui_window gw)
static

Update the extent of the inside of a browser window to that of the current content.

Parameters
wgui_window to update the extent of

Definition at line 1644 of file window.c.

References gui_window::scrollx, gui_window::scrolly, win32_window_set_scroll(), rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by win32_window_event().

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

Variable Documentation

◆ open_windows

int open_windows = 0
static

Number of open windows.

Definition at line 86 of file window.c.

Referenced by nsws_window_event_callback(), and win32_window_create().

◆ win32_window_table

struct gui_window_table* win32_window_table = &window_table

The window operation function table for win32.

Definition at line 1921 of file window.c.

Referenced by WinMain().

◆ window_list

struct gui_window* window_list = NULL
static

List of all gui windows.

Definition at line 61 of file window.c.

◆ window_table

struct gui_window_table window_table
static
Initial value:
= {
.get_scroll = win32_window_get_scroll,
.set_scroll = win32_window_set_scroll,
.get_dimensions = win32_window_get_dimensions,
.set_title = win32_window_set_title,
.set_status = win32_window_set_status,
.set_pointer = win32_window_set_pointer,
.place_caret = win32_window_place_caret,
}
static void win32_window_set_title(struct gui_window *w, const char *title)
set win32 browser window title
Definition: window.c:1659
static void win32_window_set_pointer(struct gui_window *w, gui_pointer_shape shape)
Change the win32 mouse pointer shape.
Definition: window.c:1738
static bool win32_window_get_scroll(struct gui_window *gw, int *sx, int *sy)
Get the scroll position of a win32 browser window.
Definition: window.c:1318
static nserror win32_window_event(struct gui_window *gw, enum gui_window_event event)
process miscellaneous window events
Definition: window.c:1873
static void win32_window_set_status(struct gui_window *w, const char *text)
Set the status bar of a win32 browser window.
Definition: window.c:1722
static struct gui_window * win32_window_create(struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
create a new gui_window to contain a browser_window.
Definition: window.c:1528
static nserror win32_window_invalidate_area(struct gui_window *gw, const struct rect *rect)
Invalidate an area of a win32 browser window.
Definition: window.c:934
static nserror win32_window_set_url(struct gui_window *gw, nsurl *url)
Set the navigation url in a win32 browser window.
Definition: window.c:1708
static nserror win32_window_get_dimensions(struct gui_window *gw, int *width, int *height)
Find the current dimensions of a win32 browser window's content area.
Definition: window.c:1627
nserror win32_window_set_scroll(struct gui_window *gw, const struct rect *rect)
Set the scroll position of a win32 browser window.
Definition: window.c:1983
static void win32_window_place_caret(struct gui_window *w, int x, int y, int height, const struct rect *clip)
Give the win32 input focus to a window.
Definition: window.c:1754
static void win32_window_destroy(struct gui_window *w)
Destroy previously created win32 window.
Definition: window.c:1596

win32 frontend browser window handling operation table

Definition at line 1905 of file window.c.

◆ windowclassname_main

const LPCWSTR windowclassname_main = L"nswsmainwindow"
static

The main window class name.

Definition at line 66 of file window.c.

Referenced by nsws_create_main_class(), and nsws_window_create().