27#include <libnsfb_plot.h>
28#include <libnsfb_plot_util.h>
29#include <libnsfb_event.h>
30#include <libnsfb_cursor.h>
52 input =
root->u.root.input;
54 NSLOG(netsurf, INFO,
"No widget has input focus.");
73 nsfb_cursor_loc_get(
root->u.root.fb, &cloc);
87 NSLOG(netsurf, DEEPDEBUG,
"clicked %p at %d,%d", clicked, x, y);
102 if (
root->u.root.grabbed == widget) {
104 root->u.root.grabbed = NULL;
106 }
else if (
root->u.root.grabbed == NULL) {
108 root->u.root.grabbed = widget;
127 nsfb_cursor_loc_get(
root->u.root.fb, &cloc);
136 if (cloc.x0 <
root->x)
138 if (cloc.x0 >= (
root->x +
root->width))
139 cloc.x0 = (
root->x +
root->width) - 1;
140 if (cloc.y0 <
root->y)
142 if (cloc.y0 >= (
root->y +
root->height))
143 cloc.y0 = (
root->y +
root->height) - 1;
145 if (
root->u.root.grabbed == NULL) {
147 nsfb_cursor_loc_set(
root->u.root.fb, &cloc);
155 if (moved !=
root->u.root.prev) {
157 root->u.root.prev = moved;
162 moved =
root->u.root.grabbed;
172 if (cloc.x0 > (x + moved->
width))
173 cloc.x0 = (x + moved->
width);
174 if (cloc.y0 > (y + moved->
height))
175 cloc.y0 = (y + moved->
height);
178 nsfb_cursor_loc_set(
root->u.root.fb, &cloc);
192 bool move_pointer =
false;
198 if (nsfb_event(
root->u.root.fb, event, timeout) ==
false) {
205 if (move_pointer && event->type != NSFB_EVENT_MOVE_RELATIVE &&
206 event->type != NSFB_EVENT_MOVE_ABSOLUTE) {
210 }
else if (!move_pointer &&
211 event->type == NSFB_EVENT_MOVE_RELATIVE) {
213 nsfb_cursor_loc_get(
root->u.root.fb, &cloc);
216 switch (event->type) {
217 case NSFB_EVENT_KEY_DOWN:
218 case NSFB_EVENT_KEY_UP:
219 if ((event->value.keycode >= NSFB_KEY_MOUSE_1) &&
220 (event->value.keycode <= NSFB_KEY_MOUSE_5)) {
227 case NSFB_EVENT_CONTROL:
231 case NSFB_EVENT_MOVE_RELATIVE:
235 cloc.x0 +=
event->value.vector.x;
236 cloc.y0 +=
event->value.vector.y;
240 case NSFB_EVENT_MOVE_ABSOLUTE:
244 cloc.x0 =
event->value.vector.x;
245 cloc.y0 =
event->value.vector.y;
249 case NSFB_EVENT_RESIZE:
252 event->value.resize.w,
253 event->value.resize.h);
259 }
while (event->type == NSFB_EVENT_MOVE_RELATIVE ||
260 event->type == NSFB_EVENT_MOVE_ABSOLUTE);
266 -1, -1, -1, -1, -1, -1, -1, -1, 8, 9,
267 -1, -1, -1, 13, -1, -1, -1, -1, -1, -1,
268 -1, -1, -1, -1, -1, -1, -1, 27, -1, -1,
269 -1, -1,
' ',
'!',
'"',
'#',
'$', -1,
'&',
'\'',
270 '(',
')',
'*',
'+',
',',
'-',
'.',
'/',
'0',
'1',
271 '2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
':',
';',
272 '<',
'=',
'>',
'?',
'@', -1, -1, -1, -1, -1,
273 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
274 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
275 -1,
'[',
'\\',
']',
'~',
'_',
'`',
'a',
'b',
'c',
276 'd',
'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',
'm',
277 'n',
'o',
'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
278 'x',
'y',
'z', -1, -1, -1, -1, -1, -1, -1,
283 -1, -1, -1, -1, -1, -1, -1, -1, 8, 9,
284 -1, -1, -1, 13, -1, -1, -1, -1, -1, -1,
285 -1, -1, -1, -1, -1, -1, -1, 27, -1, -1,
286 -1, -1,
' ',
'!',
'"',
'~',
'$', -1,
'&',
'@',
287 '(',
')',
'*',
'+',
'<',
'_',
'>',
'?',
')',
'!',
288 '"', 243,
'$',
'%',
'^',
'&',
'*',
'(',
';',
':',
289 '<',
'+',
'>',
'?',
'@', -1, -1, -1, -1, -1,
290 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
291 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
292 -1,
'{',
'|',
'}',
'~',
'_', 254,
'A',
'B',
'C',
293 'D',
'E',
'F',
'G',
'H',
'I',
'J',
'K',
'L',
'M',
294 'N',
'O',
'P',
'Q',
'R',
'S',
'T',
'U',
'V',
'W',
295 'X',
'Y',
'Z', -1, -1, -1, -1, -1, -1, -1,
Browser window creation and manipulation interface.
void fbtk_warp_pointer(fbtk_widget_t *widget, int x, int y, bool relative)
Move pointer.
bool fbtk_tgrab_pointer(fbtk_widget_t *widget)
Toggle pointer grab.
void fbtk_click(fbtk_widget_t *widget, nsfb_event_t *event)
Insert mouse button press into toolkit.
bool fbtk_event(fbtk_widget_t *root, nsfb_event_t *event, int timeout)
Retrive events from the framebuffer input.
int fbtk_keycode_to_ucs4(int code, fbtk_modifier_type mods)
Convert a framebuffer keycode to ucs4.
void fbtk_input(fbtk_widget_t *root, nsfb_event_t *event)
Insert input into toolkit.
fbtk_widget_t * fbtk_get_root_widget(fbtk_widget_t *widget)
find the root widget from any widget in the toolkit hierarchy.
fbtk_widget_t * fbtk_get_widget_at(fbtk_widget_t *widget, int x, int y)
Obtain the widget at a point on screen.
int fbtk_get_absx(fbtk_widget_t *widget)
Get a widget's absolute horizontal screen co-ordinate.
fbtk_callback fbtk_get_handler(fbtk_widget_t *widget, fbtk_callback_type cbt)
Get a callback handler.
fbtk_modifier_type
Key modifier status.
void fbtk_set_focus(fbtk_widget_t *widget)
Give widget input focus.
int fbtk_post_callback(fbtk_widget_t *widget, fbtk_callback_type cbt,...)
Helper function to allow simple calling of callbacks with parameters.
int fbtk_get_absy(fbtk_widget_t *widget)
Get a widget's absolute vertical screen co-ordinate.
static struct directory * root
void gui_resize(fbtk_widget_t *root, int width, int height)
#define NOF_ELEMENTS(array)
Interface to key press operations.
#define NSLOG(catname, level, logmsg, args...)
Interface to utility string handling.
Interface to a number of general purpose functionality.