summaryrefslogtreecommitdiff
path: root/frontends/framebuffer/fbtk
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/framebuffer/fbtk')
-rw-r--r--frontends/framebuffer/fbtk/event.c4
-rw-r--r--frontends/framebuffer/fbtk/fbtk.c46
-rw-r--r--frontends/framebuffer/fbtk/scroll.c4
-rw-r--r--frontends/framebuffer/fbtk/text.c16
4 files changed, 47 insertions, 23 deletions
diff --git a/frontends/framebuffer/fbtk/event.c b/frontends/framebuffer/fbtk/event.c
index a48e63809..84c6c3791 100644
--- a/frontends/framebuffer/fbtk/event.c
+++ b/frontends/framebuffer/fbtk/event.c
@@ -51,7 +51,7 @@ fbtk_input(fbtk_widget_t *root, nsfb_event_t *event)
/* obtain widget with input focus */
input = root->u.root.input;
if (input == NULL) {
- LOG("No widget has input focus.");
+ NSLOG(netsurf, INFO, "No widget has input focus.");
return; /* no widget with input */
}
@@ -84,7 +84,7 @@ fbtk_click(fbtk_widget_t *widget, nsfb_event_t *event)
x = fbtk_get_absx(clicked);
y = fbtk_get_absy(clicked);
- LOG("clicked %p at %d,%d", clicked, x, y);
+ NSLOG(netsurf, INFO, "clicked %p at %d,%d", clicked, x, y);
/* post the click */
fbtk_post_callback(clicked, FBTK_CBT_CLICK, event, cloc.x0 - x, cloc.y0 - y);
diff --git a/frontends/framebuffer/fbtk/fbtk.c b/frontends/framebuffer/fbtk/fbtk.c
index c63a6d8c9..91f6e2570 100644
--- a/frontends/framebuffer/fbtk/fbtk.c
+++ b/frontends/framebuffer/fbtk/fbtk.c
@@ -53,7 +53,7 @@ dump_tk_tree(fbtk_widget_t *widget)
int indent = 0;
while (widget != NULL) {
- LOG("%*s%p", indent, "", widget);
+ NSLOG(fbtk, DEBUG, "%*s%p", indent, "", widget);
if (widget->first_child != NULL) {
widget = widget->first_child;
indent += 6;
@@ -100,9 +100,13 @@ fbtk_request_redraw(fbtk_widget_t *widget)
widget->redraw.width = widget->width;
widget->redraw.height = widget->height;
-#ifdef FBTK_LOGGING
- LOG("redrawing %p %d,%d %d,%d", widget, widget->redraw.x, widget->redraw.y, widget->redraw.width, widget->redraw.height);
-#endif
+ NSLOG(fbtk, DEBUG,
+ "redrawing %p %d,%d %d,%d",
+ widget,
+ widget->redraw.x,
+ widget->redraw.y,
+ widget->redraw.width,
+ widget->redraw.height);
cwidget = widget->last_child;
while (cwidget != NULL) {
@@ -122,7 +126,7 @@ fbtk_request_redraw(fbtk_widget_t *widget)
int
fbtk_set_mapping(fbtk_widget_t *widget, bool map)
{
- LOG("setting mapping on %p to %d", widget, map);
+ NSLOG(netsurf, INFO, "setting mapping on %p to %d", widget, map);
widget->mapped = map;
if (map) {
fbtk_request_redraw(widget);
@@ -132,9 +136,11 @@ fbtk_set_mapping(fbtk_widget_t *widget, bool map)
return 0;
}
-/** swap the widget given with the next sibling.
- *
+
+/**
* Swap a sibling widget with the next deepest in the hierachy
+ *
+ * \param lw The widget to swap
*/
static void
swap_siblings(fbtk_widget_t *lw)
@@ -145,7 +151,7 @@ swap_siblings(fbtk_widget_t *lw)
assert(rw != NULL);
- LOG("Swapping %p with %p", lw, rw);
+ NSLOG(netsurf, INFO, "Swapping %p with %p", lw, rw);
before = lw->prev;
after = rw->next;
@@ -401,7 +407,6 @@ fbtk_set_ptr(fbtk_widget_t *widget, fbtk_callback_info *cbi)
}
-
/* internally exported function documented in widget.h */
fbtk_widget_t *
fbtk_get_root_widget(fbtk_widget_t *widget)
@@ -411,7 +416,8 @@ fbtk_get_root_widget(fbtk_widget_t *widget)
/* check root widget was found */
if (widget->type != FB_WIDGET_TYPE_ROOT) {
- LOG("Widget with null parent that is not the root widget!");
+ NSLOG(netsurf, INFO,
+ "Widget with null parent that is not the root widget!");
return NULL;
}
@@ -433,6 +439,7 @@ fbtk_get_absx(fbtk_widget_t *widget)
return x;
}
+
/* exported function documented in fbtk.h */
int
fbtk_get_absy(fbtk_widget_t *widget)
@@ -447,6 +454,7 @@ fbtk_get_absy(fbtk_widget_t *widget)
return y;
}
+
/* exported function documented in fbtk.h */
int
fbtk_get_height(fbtk_widget_t *widget)
@@ -551,9 +559,7 @@ fbtk_widget_new(fbtk_widget_t *parent,
if (neww == NULL)
return NULL;
-#ifdef FBTK_LOGGING
- LOG("creating %p %d,%d %d,%d", neww, x, y, width, height);
-#endif
+ NSLOG(fbtk, DEBUG, "creating %p %d,%d %d,%d", neww, x, y, width, height);
/* make new window fit inside parent */
if (width == 0) {
@@ -574,9 +580,8 @@ fbtk_widget_new(fbtk_widget_t *parent,
height = parent->height - y;
}
-#ifdef FBTK_LOGGING
- LOG("using %p %d,%d %d,%d", neww, x, y, width, height);
-#endif
+ NSLOG(fbtk, DEBUG, "using %p %d,%d %d,%d", neww, x, y, width, height);
+
/* set values */
neww->type = type;
neww->x = x;
@@ -634,9 +639,12 @@ do_redraw(nsfb_t *nsfb, fbtk_widget_t *widget)
plot_ctx.x1 = plot_ctx.x0 + widget->redraw.width;
plot_ctx.y1 = plot_ctx.y0 + widget->redraw.height;
-#ifdef FBTK_LOGGING
- LOG("clipping %p %d,%d %d,%d", widget, plot_ctx.x0, plot_ctx.y0, plot_ctx.x1, plot_ctx.y1);
-#endif
+ NSLOG(fbtk, DEBUG,
+ "clipping %p %d,%d %d,%d",
+ widget,
+ plot_ctx.x0, plot_ctx.y0,
+ plot_ctx.x1, plot_ctx.y1);
+
if (nsfb_plot_set_clip(nsfb, &plot_ctx) == true) {
fbtk_post_callback(widget, FBTK_CBT_REDRAW);
}
diff --git a/frontends/framebuffer/fbtk/scroll.c b/frontends/framebuffer/fbtk/scroll.c
index cc98fb2dd..b056ac81f 100644
--- a/frontends/framebuffer/fbtk/scroll.c
+++ b/frontends/framebuffer/fbtk/scroll.c
@@ -334,7 +334,7 @@ hscroll_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi)
hpos = 0;
}
- LOG("hscroll %d", hscroll);
+ NSLOG(netsurf, INFO, "hscroll %d", hscroll);
rect.x0 = bbox.x0 + 3 + hpos;
rect.y0 = bbox.y0 + 5;
@@ -362,7 +362,7 @@ hscrolll_click(fbtk_widget_t *widget, fbtk_callback_info *cbi)
newpos = scrollw->u.scroll.minimum;
if (newpos == scrollw->u.scroll.position) {
- LOG("horiz scroll was the same %d", newpos);
+ NSLOG(netsurf, INFO, "horiz scroll was the same %d", newpos);
return 0;
}
diff --git a/frontends/framebuffer/fbtk/text.c b/frontends/framebuffer/fbtk/text.c
index 31417c2e0..4f3a2385d 100644
--- a/frontends/framebuffer/fbtk/text.c
+++ b/frontends/framebuffer/fbtk/text.c
@@ -388,6 +388,22 @@ text_input(fbtk_widget_t *widget, fbtk_callback_info *cbi)
}
break;
+ case NSFB_KEY_HOME:
+ if (widget->u.text.idx > 0) {
+ widget->u.text.idx = 0;
+
+ caret_moved = true;
+ }
+ break;
+
+ case NSFB_KEY_END:
+ if (widget->u.text.idx < widget->u.text.len) {
+ widget->u.text.idx = widget->u.text.len;
+
+ caret_moved = true;
+ }
+ break;
+
case NSFB_KEY_PAGEUP:
case NSFB_KEY_PAGEDOWN:
case NSFB_KEY_UP: