NetSurf
Functions | Variables
corewindow.c File Reference

framebuffer generic core window interface. More...

#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <limits.h>
#include <libnsfb.h>
#include <libnsfb_plot.h>
#include <libnsfb_event.h>
#include "utils/log.h"
#include "utils/utils.h"
#include "utils/messages.h"
#include "utils/utf8.h"
#include "utils/nsoption.h"
#include "netsurf/keypress.h"
#include "netsurf/mouse.h"
#include "netsurf/plot_style.h"
#include "framebuffer/gui.h"
#include "framebuffer/fbtk.h"
#include "framebuffer/corewindow.h"
Include dependency graph for corewindow.c:

Go to the source code of this file.

Functions

static int fb_cw_mouse_press_event (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 
static int fb_cw_draw_event (fbtk_widget_t *widget, fbtk_callback_info *cbi)
 handler for toolkit window redraw event More...
 
static nserror fb_cw_invalidate (struct core_window *cw, const struct rect *r)
 callback from core to request a redraw More...
 
static nserror fb_cw_update_size (struct core_window *cw, int width, int height)
 
static nserror fb_cw_set_scroll (struct core_window *cw, int x, int y)
 
static nserror fb_cw_get_scroll (const struct core_window *cw, int *x, int *y)
 
static nserror fb_cw_get_window_dimensions (const struct core_window *cw, int *width, int *height)
 
static nserror fb_cw_drag_status (struct core_window *cw, core_window_drag_status ds)
 
nserror fb_corewindow_init (fbtk_widget_t *parent, struct fb_corewindow *fb_cw)
 initialise elements of fb core window. More...
 
nserror fb_corewindow_fini (struct fb_corewindow *fb_cw)
 finalise elements of fb core window. More...
 

Variables

struct core_window_callback_table fb_cw_cb_table
 

Detailed Description

framebuffer generic core window interface.

Provides interface for core renderers to the framebufefr toolkit drawable area.

This module is an object that must be encapsulated. Client users should embed a struct fb_corewindow at the beginning of their context for this display surface, fill in relevant data and then call fb_corewindow_init()

The fb core window structure requires the callback for draw, key and mouse operations.

Definition in file corewindow.c.

Function Documentation

◆ fb_corewindow_fini()

nserror fb_corewindow_fini ( struct fb_corewindow fb_cw)

finalise elements of fb core window.

Parameters
fb_cwA fb core window structure to initialise
Returns
NSERROR_OK on successful finalisation otherwise error code.

Definition at line 277 of file corewindow.c.

References NSERROR_OK.

Referenced by fb_local_history_destroy().

Here is the caller graph for this function:

◆ fb_corewindow_init()

nserror fb_corewindow_init ( fbtk_widget_t parent,
struct fb_corewindow fb_cw 
)

initialise elements of fb core window.

As a pre-requisite the draw, key and mouse callbacks must be defined

Parameters
fb_cwA fb core window structure to initialise
Returns
NSERROR_OK on successful initialisation otherwise error code.

Definition at line 205 of file corewindow.c.

References fb_corewindow::cb_table, CORE_WINDOW_DRAG_NONE, fb_corewindow::drag_status, fb_corewindow::drawable, fb_cw_cb_table, fb_cw_draw_event(), fb_cw_mouse_press_event(), FB_FRAME_COLOUR, FB_SCROLL_COLOUR, FBTK_CBT_CLICK, FBTK_CBT_REDRAW, fbtk_create_fill(), fbtk_create_hscroll(), fbtk_create_user(), fbtk_create_vscroll(), fbtk_create_window(), fbtk_get_height(), fbtk_get_width(), fbtk_set_handler(), fb_corewindow::hscroll, NSERROR_OK, nsoption_int, parent, fb_corewindow::vscroll, and fb_corewindow::wnd.

Referenced by fb_local_history_init().

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

◆ fb_cw_drag_status()

static nserror fb_cw_drag_status ( struct core_window *  cw,
core_window_drag_status  ds 
)
static

Definition at line 186 of file corewindow.c.

References fb_corewindow::drag_status, and NSERROR_OK.

◆ fb_cw_draw_event()

static int fb_cw_draw_event ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static

handler for toolkit window redraw event

Definition at line 94 of file corewindow.c.

References clip(), fbtk_callback_info::context, fb_corewindow::draw, fbtk_get_absx(), fbtk_get_absy(), fbtk_get_height(), fbtk_get_nsfb(), fbtk_get_width(), fb_corewindow::scrollx, and fb_corewindow::scrolly.

Referenced by fb_corewindow_init().

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

◆ fb_cw_get_scroll()

static nserror fb_cw_get_scroll ( const struct core_window *  cw,
int *  x,
int *  y 
)
static

Definition at line 163 of file corewindow.c.

References NSERROR_NOT_IMPLEMENTED.

◆ fb_cw_get_window_dimensions()

static nserror fb_cw_get_window_dimensions ( const struct core_window *  cw,
int *  width,
int *  height 
)
static

Definition at line 174 of file corewindow.c.

References fb_corewindow::drawable, fbtk_get_height(), fbtk_get_width(), height, NSERROR_OK, and width.

Here is the call graph for this function:

◆ fb_cw_invalidate()

static nserror fb_cw_invalidate ( struct core_window *  cw,
const struct rect r 
)
static

callback from core to request a redraw

Definition at line 127 of file corewindow.c.

References NSERROR_OK.

◆ fb_cw_mouse_press_event()

static int fb_cw_mouse_press_event ( fbtk_widget_t widget,
fbtk_callback_info cbi 
)
static
Todo:
frambuffer corewindow mouse event handling needs improving

Definition at line 62 of file corewindow.c.

References BROWSER_MOUSE_HOVER, BROWSER_MOUSE_PRESS_1, fbtk_callback_info::context, fbtk_callback_info::event, fb_corewindow::mouse, fbtk_callback_info::x, and fbtk_callback_info::y.

Referenced by fb_corewindow_init().

Here is the caller graph for this function:

◆ fb_cw_set_scroll()

static nserror fb_cw_set_scroll ( struct core_window *  cw,
int  x,
int  y 
)
static

Definition at line 152 of file corewindow.c.

References NSERROR_OK.

◆ fb_cw_update_size()

static nserror fb_cw_update_size ( struct core_window *  cw,
int  width,
int  height 
)
static

Definition at line 140 of file corewindow.c.

References NSERROR_OK.

Variable Documentation

◆ fb_cw_cb_table

struct core_window_callback_table fb_cw_cb_table
Initial value:
= {
.invalidate = fb_cw_invalidate,
.update_size = fb_cw_update_size,
.set_scroll = fb_cw_set_scroll,
.get_scroll = fb_cw_get_scroll,
.get_window_dimensions = fb_cw_get_window_dimensions,
.drag_status = fb_cw_drag_status
}
static nserror fb_cw_drag_status(struct core_window *cw, core_window_drag_status ds)
Definition: corewindow.c:186
static nserror fb_cw_set_scroll(struct core_window *cw, int x, int y)
Definition: corewindow.c:152
static nserror fb_cw_invalidate(struct core_window *cw, const struct rect *r)
callback from core to request a redraw
Definition: corewindow.c:127
static nserror fb_cw_get_window_dimensions(const struct core_window *cw, int *width, int *height)
Definition: corewindow.c:174
static nserror fb_cw_update_size(struct core_window *cw, int width, int height)
Definition: corewindow.c:140
static nserror fb_cw_get_scroll(const struct core_window *cw, int *x, int *y)
Definition: corewindow.c:163

Definition at line 195 of file corewindow.c.

Referenced by fb_corewindow_init().