NetSurf
Functions | Variables
event.c File Reference
#include <sys/types.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include <libnsfb.h>
#include <libnsfb_plot.h>
#include <libnsfb_plot_util.h>
#include <libnsfb_event.h>
#include <libnsfb_cursor.h>
#include "utils/utils.h"
#include "utils/log.h"
#include "netsurf/browser_window.h"
#include "netsurf/keypress.h"
#include "framebuffer/gui.h"
#include "framebuffer/fbtk.h"
#include "framebuffer/image_data.h"
#include "widget.h"
Include dependency graph for event.c:

Go to the source code of this file.

Functions

void fbtk_input (fbtk_widget_t *root, nsfb_event_t *event)
 Insert input into toolkit. More...
 
void fbtk_click (fbtk_widget_t *widget, nsfb_event_t *event)
 Insert mouse button press into toolkit. More...
 
bool fbtk_tgrab_pointer (fbtk_widget_t *widget)
 Toggle pointer grab. More...
 
void fbtk_warp_pointer (fbtk_widget_t *widget, int x, int y, bool relative)
 Move pointer. More...
 
bool fbtk_event (fbtk_widget_t *root, nsfb_event_t *event, int timeout)
 Retrive events from the framebuffer input. More...
 
int fbtk_keycode_to_ucs4 (int code, fbtk_modifier_type mods)
 Convert a framebuffer keycode to ucs4. More...
 

Variables

static int keymap []
 
static int sh_keymap []
 

Function Documentation

◆ fbtk_click()

void fbtk_click ( fbtk_widget_t widget,
nsfb_event_t *  event 
)

Insert mouse button press into toolkit.

Definition at line 63 of file event.c.

References FBTK_CBT_CLICK, FBTK_CBT_INPUT, fbtk_get_absx(), fbtk_get_absy(), fbtk_get_handler(), fbtk_get_root_widget(), fbtk_get_widget_at(), fbtk_post_callback(), fbtk_set_focus(), NSLOG, and root.

Referenced by fbtk_event().

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

◆ fbtk_event()

bool fbtk_event ( fbtk_widget_t root,
nsfb_event_t *  event,
int  timeout 
)

Retrive events from the framebuffer input.

Obtain events from the framebuffer input system with a timeout. Some events may be used by the toolkit instead of being returned to the caller.

Parameters
rootAn fbtk widget.
eventan event structure to update.
timeoutThe number of miliseconds to wait for an event. 0 means do not wait and -1 means wait foreevr.
Returns
wether event has been updated.

Definition at line 188 of file event.c.

References fbtk_click(), fbtk_get_root_widget(), fbtk_input(), fbtk_warp_pointer(), gui_resize(), and root.

Referenced by framebuffer_run().

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

◆ fbtk_input()

void fbtk_input ( fbtk_widget_t root,
nsfb_event_t *  event 
)

Insert input into toolkit.

Definition at line 45 of file event.c.

References FBTK_CBT_INPUT, fbtk_get_root_widget(), fbtk_post_callback(), NSLOG, and root.

Referenced by fbtk_event(), and osk_click().

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

◆ fbtk_keycode_to_ucs4()

int fbtk_keycode_to_ucs4 ( int  code,
fbtk_modifier_type  mods 
)

Convert a framebuffer keycode to ucs4.

Character mapping between keycode with modifier state and ucs-4.

Definition at line 301 of file event.c.

References FBTK_MOD_CLEAR, FBTK_MOD_LCTRL, FBTK_MOD_LSHIFT, FBTK_MOD_RCTRL, FBTK_MOD_RSHIFT, keymap, NOF_ELEMENTS, NS_KEY_CLEAR_SELECTION, NS_KEY_COPY_SELECTION, NS_KEY_CUT_SELECTION, NS_KEY_DELETE_LINE, NS_KEY_PASTE, NS_KEY_SELECT_ALL, and sh_keymap.

Referenced by fb_browser_window_input(), and text_input().

Here is the caller graph for this function:

◆ fbtk_tgrab_pointer()

bool fbtk_tgrab_pointer ( fbtk_widget_t widget)

Toggle pointer grab.

Toggles the movement grab for a widget.

Parameters
widgetThe widget trying to grab the movement.
Returns
true if the grab was ok, false if the grab failed (already grabbed).

Definition at line 95 of file event.c.

References fbtk_get_root_widget(), and root.

Referenced by fb_browser_window_click(), fb_browser_window_move(), hscrollarea_click(), and vscrollarea_click().

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

◆ fbtk_warp_pointer()

void fbtk_warp_pointer ( fbtk_widget_t widget,
int  x,
int  y,
bool  relative 
)

Move pointer.

Move the pointer cursor to a given location.

Parameters
widgetany tookit widget.
xmovement in horizontal plane.
ymovement in vertical plane.
relativeWheter the /a x and /a y should be considered relative to current pointer position.

Definition at line 117 of file event.c.

References FBTK_CBT_POINTERENTER, FBTK_CBT_POINTERLEAVE, FBTK_CBT_POINTERMOVE, fbtk_get_absx(), fbtk_get_absy(), fbtk_get_root_widget(), fbtk_get_widget_at(), fbtk_post_callback(), fbtk_widget_s::height, root, and fbtk_widget_s::width.

Referenced by fbtk_event().

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

Variable Documentation

◆ keymap

int keymap[]
static
Initial value:
= {
-1, -1, -1, -1, -1, -1, -1, -1, 8, 9,
-1, -1, -1, 13, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 27, -1, -1,
-1, -1, ' ', '!', '"', '#', '$', -1, '&','\'',
'(', ')', '*', '+', ',', '-', '.', '/', '0', '1',
'2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
'<', '=', '>', '?', '@', -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, '[','\\', ']', '~', '_', '`', 'a', 'b', 'c',
'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', -1, -1, -1, -1, -1, -1, -1,
}

Definition at line 264 of file event.c.

Referenced by fbtk_keycode_to_ucs4().

◆ sh_keymap

int sh_keymap[]
static
Initial value:
= {
-1, -1, -1, -1, -1, -1, -1, -1, 8, 9,
-1, -1, -1, 13, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 27, -1, -1,
-1, -1, ' ', '!', '"', '~', '$', -1, '&', '@',
'(', ')', '*', '+', '<', '_', '>', '?', ')', '!',
'"', 243, '$', '%', '^', '&', '*', '(', ';', ':',
'<', '+', '>', '?', '@', -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, '{', '|', '}', '~', '_', 254, 'A', 'B', 'C',
'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', -1, -1, -1, -1, -1, -1, -1,
}

Definition at line 281 of file event.c.

Referenced by fbtk_keycode_to_ucs4().