diff --git a/frontends/framebuffer/Makefile b/frontends/framebuffer/Makefile index 6d2acb079..760e85b25 100644 --- a/frontends/framebuffer/Makefile +++ b/frontends/framebuffer/Makefile @@ -146,7 +146,7 @@ $(eval $(foreach V,$(filter FB_FONT_$(NETSURF_FB_FONTLIB)_%,$(.VARIABLES)),$(cal # S_FRONTEND are sources purely for the framebuffer build S_FRONTEND := gui.c framebuffer.c schedule.c bitmap.c fetch.c \ - findfile.c localhistory.c clipboard.c + findfile.c corewindow.c local_history.c clipboard.c # toolkit sources S_FRAMEBUFFER_FBTK := fbtk.c event.c fill.c bitmap.c user.c window.c \ diff --git a/frontends/framebuffer/corewindow.c b/frontends/framebuffer/corewindow.c new file mode 100644 index 000000000..bde488a25 --- /dev/null +++ b/frontends/framebuffer/corewindow.c @@ -0,0 +1,261 @@ +/* + * Copyright 2017 Vincent Sanders + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file + * 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. + */ + +#include +#include +#include +#include + +#include +#include +#include + +#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" + + +/* toolkit event handlers that do generic things and call internal callbacks */ + + +static int +fb_cw_mouse_press_event(fbtk_widget_t *widget, fbtk_callback_info *cbi) +{ + struct fb_corewindow *fb_cw = (struct fb_corewindow *)cbi->context; + browser_mouse_state state; + + /** \todo frambuffer corewindow mouse event handling needs improving */ + if (cbi->event->type != NSFB_EVENT_KEY_UP) { + state = BROWSER_MOUSE_HOVER; + } else { + state = BROWSER_MOUSE_PRESS_1; + } + + fb_cw->mouse(fb_cw, state, cbi->x, cbi->y); + + return 1; +} + +/* +static bool +fb_cw_input_event(toolkit_widget *widget, void *ctx) +{ + struct fb_corewindow *fb_cw = (struct fb_corewindow *)ctx; + + fb_cw->key(fb_cw, keycode); + + return true; +} +*/ + +/** + * handler for toolkit window redraw event + */ +static int fb_cw_draw_event(fbtk_widget_t *widget, fbtk_callback_info *cbi) +{ + struct fb_corewindow *fb_cw; + nsfb_bbox_t rbox; + struct rect clip; + + fb_cw = (struct fb_corewindow *)cbi->context; + + rbox.x0 = fbtk_get_absx(widget); + rbox.y0 = fbtk_get_absy(widget); + + rbox.x1 = rbox.x0 + fbtk_get_width(widget); + rbox.y1 = rbox.y0 + fbtk_get_height(widget); + + nsfb_claim(fbtk_get_nsfb(widget), &rbox); + + clip.x0 = fb_cw->scrollx; + clip.y0 = fb_cw->scrolly; + clip.x1 = fbtk_get_width(widget) + fb_cw->scrollx; + clip.y1 = fbtk_get_height(widget) + fb_cw->scrolly; + + fb_cw->draw(fb_cw, &clip); + + nsfb_update(fbtk_get_nsfb(widget), &rbox); + + return 0; +} + + +/** + * callback from core to request a redraw + */ +static nserror +fb_cw_invalidate(struct core_window *cw, const struct rect *r) +{ +/* struct fb_corewindow *fb_cw = (struct fb_corewindow *)cw; + + toolkit_widget_queue_draw_area(fb_cw->widget, + r->x0, r->y0, + r->x1 - r->x0, r->y1 - r->y0); +*/ + return NSERROR_OK; +} + + +static void +fb_cw_update_size(struct core_window *cw, int width, int height) +{ +/* struct fb_corewindow *fb_cw = (struct fb_corewindow *)cw; + + toolkit_widget_set_size_request(FB_WIDGET(fb_cw->drawing_area), + width, height); +*/ +} + + +static void +fb_cw_scroll_visible(struct core_window *cw, const struct rect *r) +{ +/* struct fb_corewindow *fb_cw = (struct fb_corewindow *)cw; + + toolkit_scroll_widget(fb_cw->widget, r); +*/ +} + + +static void +fb_cw_get_window_dimensions(struct core_window *cw, int *width, int *height) +{ + struct fb_corewindow *fb_cw = (struct fb_corewindow *)cw; + + *width = fbtk_get_width(fb_cw->drawable); + *height = fbtk_get_height(fb_cw->drawable); +} + + +static void +fb_cw_drag_status(struct core_window *cw, core_window_drag_status ds) +{ + struct fb_corewindow *fb_cw = (struct fb_corewindow *)cw; + fb_cw->drag_staus = ds; +} + + +struct core_window_callback_table fb_cw_cb_table = { + .invalidate = fb_cw_invalidate, + .update_size = fb_cw_update_size, + .scroll_visible = fb_cw_scroll_visible, + .get_window_dimensions = fb_cw_get_window_dimensions, + .drag_status = fb_cw_drag_status +}; + +/* exported function documented fb/corewindow.h */ +nserror fb_corewindow_init(fbtk_widget_t *parent, struct fb_corewindow *fb_cw) +{ + int furniture_width; + + furniture_width = nsoption_int(fb_furniture_size); + + /* setup the core window callback table */ + fb_cw->cb_table = &fb_cw_cb_table; + + /* container window */ + fb_cw->wnd = fbtk_create_window(parent, 0, 0, 0, 0, 0); + + fb_cw->drawable = fbtk_create_user(fb_cw->wnd, + 0, 0, + -furniture_width, -furniture_width, + fb_cw); + + fbtk_set_handler(fb_cw->drawable, + FBTK_CBT_REDRAW, + fb_cw_draw_event, + fb_cw); + + fbtk_set_handler(fb_cw->drawable, + FBTK_CBT_CLICK, + fb_cw_mouse_press_event, + fb_cw); +/* + fbtk_set_handler(fb_cw->drawable, + FBTK_CBT_INPUT, + fb_cw_input_event, + fb_cw); + + fbtk_set_handler(fb_cw->drawable, + FBTK_CBT_POINTERMOVE, + fb_cw_move_event, + fb_cw); +*/ + + /* create horizontal scrollbar */ + fb_cw->hscroll = fbtk_create_hscroll(fb_cw->wnd, + 0, + fbtk_get_height(fb_cw->wnd) - furniture_width, + fbtk_get_width(fb_cw->wnd) - furniture_width, + furniture_width, + FB_SCROLL_COLOUR, + FB_FRAME_COLOUR, + NULL, + NULL); + + fb_cw->vscroll = fbtk_create_vscroll(fb_cw->wnd, + fbtk_get_width(fb_cw->wnd) - furniture_width, + 0, + furniture_width, + fbtk_get_height(fb_cw->wnd) - furniture_width, + FB_SCROLL_COLOUR, + FB_FRAME_COLOUR, + NULL, + NULL); + + fbtk_create_fill(fb_cw->wnd, + fbtk_get_width(fb_cw->wnd) - furniture_width, + fbtk_get_height(fb_cw->wnd) - furniture_width, + furniture_width, + furniture_width, + FB_FRAME_COLOUR); + + + return NSERROR_OK; +} + +/* exported interface documented in fb/corewindow.h */ +nserror fb_corewindow_fini(struct fb_corewindow *fb_cw) +{ + return NSERROR_OK; +} diff --git a/frontends/framebuffer/corewindow.h b/frontends/framebuffer/corewindow.h new file mode 100644 index 000000000..ce15c7473 --- /dev/null +++ b/frontends/framebuffer/corewindow.h @@ -0,0 +1,107 @@ +/* + * Copyright 2017 Vincent Sanders + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef FB_COREWINDOW_H +#define FB_COREWINDOW_H + +#include "netsurf/core_window.h" + +/** + * fb core window state + */ +struct fb_corewindow { + + /** + * framebuffer toolkit window. + */ + struct fbtk_widget_s *wnd; + /** + * framebuffer toolkit horizontal scrollbar. + */ + struct fbtk_widget_s *hscroll; + /** + * framebuffer toolkit vertical scrollbar. + */ + struct fbtk_widget_s *vscroll; + /** + * framebuffer toolkit user drawable widget. + */ + struct fbtk_widget_s *drawable; + + int scrollx, scrolly; /**< scroll offsets. */ + + + /** drag status set by core */ + core_window_drag_status drag_staus; + + /** table of callbacks for core window operations */ + struct core_window_callback_table *cb_table; + + /** + * callback to draw on drawable area of fb core window + * + * \param fb_cw The fb core window structure. + * \param r The rectangle of the window that needs updating. + * \return NSERROR_OK on success otherwise apropriate error code + */ + nserror (*draw)(struct fb_corewindow *fb_cw, struct rect *r); + + /** + * callback for keypress on fb core window + * + * \param fb_cw The fb core window structure. + * \param nskey The netsurf key code. + * \return NSERROR_OK if key processed, + * NSERROR_NOT_IMPLEMENTED if key not processed + * otherwise apropriate error code + */ + nserror (*key)(struct fb_corewindow *fb_cw, uint32_t nskey); + + /** + * callback for mouse event on fb core window + * + * \param fb_cw The fb core window structure. + * \param mouse_state mouse state + * \param x location of event + * \param y location of event + * \return NSERROR_OK on sucess otherwise apropriate error code. + */ + nserror (*mouse)(struct fb_corewindow *fb_cw, browser_mouse_state mouse_state, int x, int y); +}; + + +/** + * initialise elements of fb core window. + * + * As a pre-requisite the draw, key and mouse callbacks must be defined + * + * \param fb_cw A fb core window structure to initialise + * \return NSERROR_OK on successful initialisation otherwise error code. + */ +nserror fb_corewindow_init(fbtk_widget_t *parent, struct fb_corewindow *fb_cw); + + +/** + * finalise elements of fb core window. + * + * \param fb_cw A fb core window structure to initialise + * \return NSERROR_OK on successful finalisation otherwise error code. + */ +nserror fb_corewindow_fini(struct fb_corewindow *fb_cw); + +#endif diff --git a/frontends/framebuffer/gui.c b/frontends/framebuffer/gui.c index 062cb5659..1460c77f6 100644 --- a/frontends/framebuffer/gui.c +++ b/frontends/framebuffer/gui.c @@ -54,6 +54,7 @@ #include "framebuffer/clipboard.h" #include "framebuffer/fetch.h" #include "framebuffer/bitmap.h" +#include "framebuffer/local_history.h" #define NSFB_TOOLBAR_DEFAULT_LAYOUT "blfsrutc" @@ -1150,7 +1151,7 @@ fb_localhistory_btn_clik(fbtk_widget_t *widget, fbtk_callback_info *cbi) if (cbi->event->type != NSFB_EVENT_KEY_UP) return 0; - fb_localhistory_map(gw->localhistory); + fb_local_history_present(fbtk, gw->bw); return 0; } @@ -1782,7 +1783,6 @@ gui_window_create(struct browser_window *bw, gw->bw = bw; create_normal_browser_window(gw, nsoption_int(fb_furniture_size)); - gw->localhistory = fb_create_localhistory(bw, fbtk, nsoption_int(fb_furniture_size)); /* map and request redraw of gui window */ fbtk_set_mapping(gw->window, true); diff --git a/frontends/framebuffer/gui.h b/frontends/framebuffer/gui.h index 0de1add69..abb27c4bb 100644 --- a/frontends/framebuffer/gui.h +++ b/frontends/framebuffer/gui.h @@ -27,17 +27,6 @@ typedef struct fb_cursor_s fb_cursor_t; /* bounding box */ typedef struct nsfb_bbox_s bbox_t; -struct gui_localhistory { - struct browser_window *bw; - - struct fbtk_widget_s *window; - struct fbtk_widget_s *hscroll; - struct fbtk_widget_s *vscroll; - struct fbtk_widget_s *history; - - int scrollx, scrolly; /**< scroll offsets. */ -}; - struct gui_window { struct browser_window *bw; @@ -59,8 +48,6 @@ struct gui_window { int throbber_index; - struct gui_localhistory *localhistory; - struct gui_window *next; struct gui_window *prev; }; @@ -68,13 +55,8 @@ struct gui_window { extern struct gui_window *window_list; -struct gui_localhistory *fb_create_localhistory(struct browser_window *bw, - struct fbtk_widget_s *parent, int furniture_width); -void fb_localhistory_map(struct gui_localhistory * glh); - void gui_resize(struct fbtk_widget_s *root, int width, int height); - #endif /* NETSURF_FB_GUI_H */ /* diff --git a/frontends/framebuffer/local_history.c b/frontends/framebuffer/local_history.c new file mode 100644 index 000000000..520129852 --- /dev/null +++ b/frontends/framebuffer/local_history.c @@ -0,0 +1,248 @@ +/* + * Copyright 2017 Vincent Sanders + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file + * Implementation of framebuffer local history manager. + */ + +#include +#include +#include +#include + +#include +#include +#include + +#include "utils/log.h" +#include "netsurf/keypress.h" +#include "netsurf/plotters.h" +#include "desktop/local_history.h" + +#include "framebuffer/gui.h" +#include "framebuffer/fbtk.h" +#include "framebuffer/framebuffer.h" +#include "framebuffer/corewindow.h" +#include "framebuffer/local_history.h" + +struct fb_local_history_window { + struct fb_corewindow core; + + struct local_history_session *session; +}; + +static struct fb_local_history_window *local_history_window = NULL; + + +/** + * callback for mouse action on local history window + * + * \param fb_cw The fb core window structure. + * \param mouse_state netsurf mouse state on event + * \param x location of event + * \param y location of event + * \return NSERROR_OK on success otherwise apropriate error code + */ +static nserror +fb_local_history_mouse(struct fb_corewindow *fb_cw, + browser_mouse_state mouse_state, + int x, int y) +{ + struct fb_local_history_window *lhw; + /* technically degenerate container of */ + lhw = (struct fb_local_history_window *)fb_cw; + + local_history_mouse_action(lhw->session, mouse_state, x, y); + + if (mouse_state != BROWSER_MOUSE_HOVER) { + fbtk_set_mapping(lhw->core.wnd, false); + } + + return NSERROR_OK; +} + + +/** + * callback for keypress on local history window + * + * \param fb_cw The fb core window structure. + * \param nskey The netsurf key code + * \return NSERROR_OK on success otherwise apropriate error code + */ +static nserror +fb_local_history_key(struct fb_corewindow *fb_cw, uint32_t nskey) +{ + struct fb_local_history_window *lhw; + /* technically degenerate container of */ + lhw = (struct fb_local_history_window *)fb_cw; + + if (local_history_keypress(lhw->session, nskey)) { + return NSERROR_OK; + } + return NSERROR_NOT_IMPLEMENTED; +} + + +/** + * callback on draw event for local history window + * + * \param fb_cw The fb core window structure. + * \param r The rectangle of the window that needs updating. + * \return NSERROR_OK on success otherwise apropriate error code + */ +static nserror +fb_local_history_draw(struct fb_corewindow *fb_cw, struct rect *r) +{ + struct redraw_context ctx = { + .interactive = true, + .background_images = true, + .plot = &fb_plotters + }; + struct fb_local_history_window *lhw; + + /* technically degenerate container of */ + lhw = (struct fb_local_history_window *)fb_cw; + + local_history_redraw(lhw->session, 0, 0, r, &ctx); + + return NSERROR_OK; +} + +/** + * Creates the window for the local history view. + * + * \return NSERROR_OK on success else appropriate error code on faliure. + */ +static nserror +fb_local_history_init(fbtk_widget_t *parent, + struct browser_window *bw, + struct fb_local_history_window **win_out) +{ + struct fb_local_history_window *ncwin; + nserror res; + + /* memoise window so it can be represented when necessary + * instead of recreating every time. + */ + if ((*win_out) != NULL) { + res = local_history_set((*win_out)->session, bw); + return res; + } + + ncwin = malloc(sizeof(struct fb_local_history_window)); + if (ncwin == NULL) { + return NSERROR_NOMEM; + } + + ncwin->core.draw = fb_local_history_draw; + ncwin->core.key = fb_local_history_key; + ncwin->core.mouse = fb_local_history_mouse; + + res = fb_corewindow_init(parent, &ncwin->core); + if (res != NSERROR_OK) { + free(ncwin); + return res; + } + + res = local_history_init(ncwin->core.cb_table, + (struct core_window *)ncwin, + bw, + &ncwin->session); + if (res != NSERROR_OK) { + free(ncwin); + return res; + } + + *win_out = ncwin; + + return NSERROR_OK; +} + + +/* exported function documented gtk/history.h */ +nserror fb_local_history_present(fbtk_widget_t *parent, + struct browser_window *bw) +{ + nserror res; + int prnt_width, prnt_height; + int width, height; + + res = fb_local_history_init(parent, bw, &local_history_window); + if (res == NSERROR_OK) { + + prnt_width = fbtk_get_width(parent); + prnt_height = fbtk_get_height(parent); + + /* resize history widget ensureing the drawing area is + * no larger than parent window + */ + res = local_history_get_size(local_history_window->session, + &width, + &height); + if (width > prnt_width) { + width = prnt_width; + } + if (height > prnt_height) { + height = prnt_height; + } + /* should update scroll area with contents */ + + fbtk_set_zorder(local_history_window->core.wnd, INT_MIN); + fbtk_set_mapping(local_history_window->core.wnd, true); + } + + return res; +} + + +/* exported function documented gtk/history.h */ +nserror fb_local_history_hide(void) +{ + nserror res = NSERROR_OK; + + if (local_history_window != NULL) { + fbtk_set_mapping(local_history_window->core.wnd, false); + + res = local_history_set(local_history_window->session, NULL); + } + + return res; +} + + +/* exported function documented gtk/history.h */ +nserror fb_local_history_destroy(void) +{ + nserror res; + + if (local_history_window == NULL) { + return NSERROR_OK; + } + + res = local_history_fini(local_history_window->session); + if (res == NSERROR_OK) { + res = fb_corewindow_fini(&local_history_window->core); + //gtk_widget_destroy(GTK_WIDGET(local_history_window->wnd)); + free(local_history_window); + local_history_window = NULL; + } + + return res; + +} diff --git a/frontends/framebuffer/local_history.h b/frontends/framebuffer/local_history.h new file mode 100644 index 000000000..929eeacd8 --- /dev/null +++ b/frontends/framebuffer/local_history.h @@ -0,0 +1,49 @@ +/* + * Copyright 2017 Vincent Sanders + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file + * Interface to framebuffer local history manager + */ + +#ifndef FB_LOCAL_HISTORY_H +#define FB_LOCAL_HISTORY_H + +struct browser_window; + +/** + * make the local history window visible. + * + * \return NSERROR_OK on success else appropriate error code on faliure. + */ +nserror fb_local_history_present(fbtk_widget_t *parent, struct browser_window *bw); + +/** + * hide the local history window from being visible. + * + * \return NSERROR_OK on success else appropriate error code on faliure. + */ +nserror fb_local_history_hide(void); + +/** + * Destroys the local history window and performs any other necessary cleanup + * actions. + */ +nserror fb_local_history_destroy(void); + +#endif diff --git a/frontends/framebuffer/localhistory.c b/frontends/framebuffer/localhistory.c deleted file mode 100644 index b91c9470b..000000000 --- a/frontends/framebuffer/localhistory.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2010 Vincent Sanders - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include - -#include -#include -#include - -#include "desktop/browser_history.h" -#include "netsurf/plotters.h" - -#include "framebuffer/gui.h" -#include "framebuffer/fbtk.h" -#include "framebuffer/framebuffer.h" - -static int -localhistory_redraw(fbtk_widget_t *widget, fbtk_callback_info *cbi) -{ - struct gui_localhistory *glh = cbi->context; - nsfb_bbox_t rbox; - struct rect clip; - - struct redraw_context ctx = { - .interactive = true, - .background_images = true, - .plot = &fb_plotters - }; - - rbox.x0 = fbtk_get_absx(widget); - rbox.y0 = fbtk_get_absy(widget); - - rbox.x1 = rbox.x0 + fbtk_get_width(widget); - rbox.y1 = rbox.y0 + fbtk_get_height(widget); - - nsfb_claim(fbtk_get_nsfb(widget), &rbox); - - nsfb_plot_rectangle_fill(fbtk_get_nsfb(widget), &rbox, 0xffffffff); - - clip.x0 = glh->scrollx; - clip.y0 = glh->scrolly; - clip.x1 = fbtk_get_width(widget) + glh->scrollx; - clip.y0 = fbtk_get_height(widget) + glh->scrolly; - - browser_window_history_redraw_rectangle(glh->bw, - &clip, 0, 0, &ctx); - - nsfb_update(fbtk_get_nsfb(widget), &rbox); - - return 0; -} - -static int -localhistory_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) -{ - struct gui_localhistory *glh = cbi->context; - - if (cbi->event->type != NSFB_EVENT_KEY_UP) - return 0; - - browser_window_history_click(glh->bw, cbi->x, cbi->y, false); - - fbtk_set_mapping(glh->window, false); - - return 1; -} - -struct gui_localhistory * -fb_create_localhistory(struct browser_window *bw, - fbtk_widget_t *parent, - int furniture_width) -{ - struct gui_localhistory *glh; - glh = calloc(1, sizeof(struct gui_localhistory)); - - if (glh == NULL) - return NULL; - - glh->bw = bw; - - /* container window */ - glh->window = fbtk_create_window(parent, 0, 0, 0, 0, 0); - - glh->history = fbtk_create_user(glh->window, 0, 0, -furniture_width, -furniture_width, glh); - - fbtk_set_handler(glh->history, FBTK_CBT_REDRAW, localhistory_redraw, glh); - fbtk_set_handler(glh->history, FBTK_CBT_CLICK, localhistory_click, glh); - /* - fbtk_set_handler(gw->localhistory, FBTK_CBT_INPUT, fb_browser_window_input, gw); - fbtk_set_handler(gw->localhistory, FBTK_CBT_POINTERMOVE, fb_browser_window_move, bw); - */ - - /* create horizontal scrollbar */ - glh->hscroll = fbtk_create_hscroll(glh->window, - 0, - fbtk_get_height(glh->window) - furniture_width, - fbtk_get_width(glh->window) - furniture_width, - furniture_width, - FB_SCROLL_COLOUR, - FB_FRAME_COLOUR, - NULL, - NULL); - - glh->vscroll = fbtk_create_vscroll(glh->window, - fbtk_get_width(glh->window) - furniture_width, - 0, - furniture_width, - fbtk_get_height(glh->window) - furniture_width, - FB_SCROLL_COLOUR, - FB_FRAME_COLOUR, - NULL, - NULL); - - fbtk_create_fill(glh->window, - fbtk_get_width(glh->window) - furniture_width, - fbtk_get_height(glh->window) - furniture_width, - furniture_width, - furniture_width, - FB_FRAME_COLOUR); - - return glh; -} - -void -fb_localhistory_map(struct gui_localhistory * glh) -{ - fbtk_set_zorder(glh->window, INT_MIN); - fbtk_set_mapping(glh->window, true); -}