NetSurf
Functions | Variables
drawable.c File Reference

win32 implementation of drawable window showing browser context More...

#include <stdbool.h>
#include <stdint.h>
#include "utils/config.h"
#include <windows.h>
#include <windowsx.h>
#include "utils/errors.h"
#include "utils/log.h"
#include "netsurf/browser_window.h"
#include "netsurf/plotters.h"
#include "netsurf/keypress.h"
#include "windows/windbg.h"
#include "windows/plot.h"
#include "windows/window.h"
#include "windows/local_history.h"
#include "windows/drawable.h"
Include dependency graph for drawable.c:

Go to the source code of this file.

Functions

static LRESULT nsws_drawable_wheel (struct gui_window *gw, HWND hwnd, WPARAM wparam)
 Handle wheel scroll messages. More...
 
static LRESULT nsws_drawable_vscroll (struct gui_window *gw, HWND hwnd, WPARAM wparam)
 Handle vertical scroll messages. More...
 
static LRESULT nsws_drawable_hscroll (struct gui_window *gw, HWND hwnd, WPARAM wparam)
 Handle horizontal scroll messages. More...
 
static LRESULT nsws_drawable_resize (struct gui_window *gw)
 Handle resize events. More...
 
static LRESULT nsws_drawable_unichar (struct gui_window *gw, HWND hwnd, WPARAM wparam)
 Handle unicode character messages. More...
 
static LRESULT nsws_drawable_char (struct gui_window *gw, HWND hwnd, WPARAM wparam)
 Handle character messages. More...
 
static LRESULT nsws_drawable_keydown (struct gui_window *gw, HWND hwnd, WPARAM wparam)
 Handle keydown messages. More...
 
static LRESULT nsws_drawable_paint (struct gui_window *gw, HWND hwnd)
 Handle paint messages. More...
 
static LRESULT nsws_drawable_mouseup (struct gui_window *gw, int x, int y, browser_mouse_state press, browser_mouse_state click)
 Handle mouse button up messages. More...
 
static LRESULT nsws_drawable_mousedown (struct gui_window *gw, int x, int y, browser_mouse_state button)
 Handle mouse button down messages. More...
 
static LRESULT nsws_drawable_mousemove (struct gui_window *gw, int x, int y)
 Handle mouse movement messages. More...
 
static LRESULT CALLBACK nsws_window_drawable_event_callback (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 Called when activity occours within the drawable window. More...
 
HWND nsws_window_create_drawable (HINSTANCE hinstance, HWND hparent, struct gui_window *gw)
 Create a drawable window. More...
 
nserror nsws_create_drawable_class (HINSTANCE hinstance)
 Create the drawable window class. More...
 

Variables

static const wchar_t * windowclassname_drawable = L"nswsdrawablewindow"
 

Detailed Description

win32 implementation of drawable window showing browser context

Definition in file drawable.c.

Function Documentation

◆ nsws_create_drawable_class()

nserror nsws_create_drawable_class ( HINSTANCE  hinstance)

Create the drawable window class.

Definition at line 707 of file drawable.c.

References NSERROR_INIT_FAILED, NSERROR_OK, nsws_window_drawable_event_callback(), win_perror(), and windowclassname_drawable.

Referenced by WinMain().

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

◆ nsws_drawable_char()

static LRESULT nsws_drawable_char ( struct gui_window gw,
HWND  hwnd,
WPARAM  wparam 
)
static

Handle character messages.

WM_CHAR is generated when WM_KEYDOWN message are passed to TranslateMessage; wParam is UTF-16. If the codepoint is 4 bytes, there are 2 WM_CHAR message, one with the high surrogate and one with the low surrogate.

Definition at line 252 of file drawable.c.

References browser_window_key_press(), and gui_window::bw.

Referenced by nsws_window_drawable_event_callback().

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

◆ nsws_drawable_hscroll()

static LRESULT nsws_drawable_hscroll ( struct gui_window gw,
HWND  hwnd,
WPARAM  wparam 
)
static

Handle horizontal scroll messages.

Definition at line 154 of file drawable.c.

References browser_window_get_extents(), gui_window::bw, height, max, min, NSERROR_OK, NSLOG, gui_window::requestscrollx, gui_window::scrollx, gui_window::scrolly, gui_window::width, width, win32_window_set_scroll(), rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by nsws_window_drawable_event_callback().

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

◆ nsws_drawable_keydown()

static LRESULT nsws_drawable_keydown ( struct gui_window gw,
HWND  hwnd,
WPARAM  wparam 
)
static

Handle keydown messages.

Definition at line 287 of file drawable.c.

References browser_window_key_press(), gui_window::bw, NS_KEY_DELETE_RIGHT, NS_KEY_DOWN, NS_KEY_LEFT, NS_KEY_LINE_END, NS_KEY_LINE_START, NS_KEY_RIGHT, and NS_KEY_UP.

Referenced by nsws_window_drawable_event_callback().

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

◆ nsws_drawable_mousedown()

static LRESULT nsws_drawable_mousedown ( struct gui_window gw,
int  x,
int  y,
browser_mouse_state  button 
)
static

Handle mouse button down messages.

Definition at line 459 of file drawable.c.

References BROWSER_MOUSE_MOD_1, BROWSER_MOUSE_MOD_2, BROWSER_MOUSE_MOD_3, browser_window_mouse_click(), gui_window::bw, gui_window::mouse, NSLOG, nsw32_local_history_hide(), gui_window::pressed_x, gui_window::pressed_y, gui_window::scrollx, gui_window::scrolly, and gui_window::state.

Referenced by nsws_window_drawable_event_callback().

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

◆ nsws_drawable_mousemove()

static LRESULT nsws_drawable_mousemove ( struct gui_window gw,
int  x,
int  y 
)
static

Handle mouse movement messages.

Definition at line 500 of file drawable.c.

References BROWSER_MOUSE_DRAG_1, BROWSER_MOUSE_DRAG_2, BROWSER_MOUSE_DRAG_ON, BROWSER_MOUSE_HOLDING_1, BROWSER_MOUSE_HOLDING_2, BROWSER_MOUSE_MOD_1, BROWSER_MOUSE_MOD_2, BROWSER_MOUSE_MOD_3, BROWSER_MOUSE_PRESS_1, BROWSER_MOUSE_PRESS_2, browser_window_mouse_click(), browser_window_mouse_track(), gui_window::bw, gui_window::mouse, NSLOG, gui_window::pressed_x, gui_window::pressed_y, gui_window::scrollx, gui_window::scrolly, and gui_window::state.

Referenced by nsws_window_drawable_event_callback().

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

◆ nsws_drawable_mouseup()

static LRESULT nsws_drawable_mouseup ( struct gui_window gw,
int  x,
int  y,
browser_mouse_state  press,
browser_mouse_state  click 
)
static

Handle mouse button up messages.

Definition at line 402 of file drawable.c.

References BROWSER_MOUSE_MOD_1, BROWSER_MOUSE_MOD_2, BROWSER_MOUSE_MOD_3, browser_window_mouse_click(), browser_window_mouse_track(), gui_window::bw, gui_window::mouse, NSLOG, gui_window::scrollx, gui_window::scrolly, and gui_window::state.

Referenced by nsws_window_drawable_event_callback().

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

◆ nsws_drawable_paint()

static LRESULT nsws_drawable_paint ( struct gui_window gw,
HWND  hwnd 
)
static

Handle paint messages.

Todo:
work out why the heck scroll needs scaling

Definition at line 361 of file drawable.c.

References browser_window_redraw(), gui_window::bw, clip(), redraw_context::interactive, plot_hdc, gui_window::scrollx, gui_window::scrolly, and win_plotters.

Referenced by nsws_window_drawable_event_callback().

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

◆ nsws_drawable_resize()

static LRESULT nsws_drawable_resize ( struct gui_window gw)
static

Handle resize events.

Definition at line 220 of file drawable.c.

References browser_window_schedule_reformat(), and gui_window::bw.

Referenced by nsws_window_drawable_event_callback().

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

◆ nsws_drawable_unichar()

static LRESULT nsws_drawable_unichar ( struct gui_window gw,
HWND  hwnd,
WPARAM  wparam 
)
static

Handle unicode character messages.

Definition at line 230 of file drawable.c.

References browser_window_key_press(), and gui_window::bw.

Referenced by nsws_window_drawable_event_callback().

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

◆ nsws_drawable_vscroll()

static LRESULT nsws_drawable_vscroll ( struct gui_window gw,
HWND  hwnd,
WPARAM  wparam 
)
static

Handle vertical scroll messages.

Definition at line 80 of file drawable.c.

References browser_window_get_extents(), gui_window::bw, gui_window::height, height, max, min, NSERROR_OK, NSLOG, gui_window::requestscrolly, gui_window::scrollx, gui_window::scrolly, width, win32_window_set_scroll(), rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by nsws_window_drawable_event_callback().

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

◆ nsws_drawable_wheel()

static LRESULT nsws_drawable_wheel ( struct gui_window gw,
HWND  hwnd,
WPARAM  wparam 
)
static

Handle wheel scroll messages.

Definition at line 51 of file drawable.c.

Referenced by nsws_window_drawable_event_callback().

Here is the caller graph for this function:

◆ nsws_window_create_drawable()

HWND nsws_window_create_drawable ( HINSTANCE  hinstance,
HWND  hparent,
struct gui_window gw 
)

Create a drawable window.

Definition at line 674 of file drawable.c.

References NSLOG, win_perror(), and windowclassname_drawable.

Referenced by win32_window_create().

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

◆ nsws_window_drawable_event_callback()

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

Called when activity occours within the drawable window.

Todo:
win32 clear operation deletes the contents of the selection but ns clear selection only removes the highlight.

Definition at line 558 of file drawable.c.

References BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_CLICK_2, BROWSER_MOUSE_PRESS_1, BROWSER_MOUSE_PRESS_2, browser_window_key_press(), gui_window::bw, LOG_WIN_MSG, NS_KEY_CLEAR_SELECTION, NS_KEY_COPY_SELECTION, NS_KEY_CUT_SELECTION, NS_KEY_PASTE, NSLOG, nsw32_local_history_hide(), nsws_drawable_char(), nsws_drawable_hscroll(), nsws_drawable_keydown(), nsws_drawable_mousedown(), nsws_drawable_mousemove(), nsws_drawable_mouseup(), nsws_drawable_paint(), nsws_drawable_resize(), nsws_drawable_unichar(), nsws_drawable_vscroll(), nsws_drawable_wheel(), and nsws_get_gui_window().

Referenced by nsws_create_drawable_class().

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

Variable Documentation

◆ windowclassname_drawable

const wchar_t* windowclassname_drawable = L"nswsdrawablewindow"
static

Definition at line 44 of file drawable.c.

Referenced by nsws_create_drawable_class(), and nsws_window_create_drawable().