From 53a37dc91305c704304c6306bdc6817686468e71 Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Sat, 16 Sep 2017 19:34:11 +0200 Subject: Reconcile differences for fb frontend --- frontends/kolibrios/Makefile | 2 +- frontends/kolibrios/fb/Makefile | 2 +- frontends/kolibrios/fb/gui.c | 14 ++-- frontends/kolibrios/fb/gui.h | 18 ----- frontends/kolibrios/fb/localhistory.c | 144 ---------------------------------- utils/log.h | 1 + 6 files changed, 9 insertions(+), 172 deletions(-) delete mode 100644 frontends/kolibrios/fb/localhistory.c diff --git a/frontends/kolibrios/Makefile b/frontends/kolibrios/Makefile index b4aa11672..428613a95 100644 --- a/frontends/kolibrios/Makefile +++ b/frontends/kolibrios/Makefile @@ -113,7 +113,7 @@ $(eval $(foreach V,$(filter KOLIBRI_IMAGE_%,$(.VARIABLES)),$(call convert_image, #S_KOLIBRIOS := main.c kolibri_misc.c kolibri_debug.c kolibri_filesystem.c kolibri_regex.c S_KOLIBRIOS := kolibri_http.c kolibri_os.c -S_FRAMEBUFFER := gui.c framebuffer.c schedule.c bitmap.c fetch.c findfile.c localhistory.c clipboard.c font_freetype.c +S_FRAMEBUFFER := gui.c framebuffer.c schedule.c bitmap.c fetch.c findfile.c local_history.c corewindow.c clipboard.c font_freetype.c S_FRAMEBUFFER_FBTK := fbtk.c event.c fill.c bitmap.c user.c window.c text.c scroll.c osk.c S_FRAMEBUFFER := $(addprefix fb/,$(S_FRAMEBUFFER)) diff --git a/frontends/kolibrios/fb/Makefile b/frontends/kolibrios/fb/Makefile index 589a73d3c..2e228a264 100644 --- a/frontends/kolibrios/fb/Makefile +++ b/frontends/kolibrios/fb/Makefile @@ -146,7 +146,7 @@ S_FONTS := # 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/kolibrios/fb/gui.c b/frontends/kolibrios/fb/gui.c index 15bb97ae3..6fbfd3d07 100644 --- a/frontends/kolibrios/fb/gui.c +++ b/frontends/kolibrios/fb/gui.c @@ -1160,7 +1160,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; } @@ -1209,7 +1209,7 @@ create_toolbar(struct gui_window *gw, toolbar_layout = NSFB_TOOLBAR_DEFAULT_LAYOUT; } - LOG("Using toolbar layout %s", toolbar_layout); + NSLOG(netsurf, INFO, "Using toolbar layout %s", toolbar_layout); itmtype = toolbar_layout; @@ -1243,6 +1243,9 @@ create_toolbar(struct gui_window *gw, (*itmtype != 0) && (xdir !=0)) { + NSLOG(netsurf, INFO, "toolbar adding %c", *itmtype); + + switch (*itmtype) { case 'b': /* back */ @@ -1646,7 +1649,6 @@ create_normal_browser_window(struct gui_window *gw, int furniture_width) /* fill bottom right area */ if (nsoption_bool(fb_osk) == true) { - widget = fbtk_create_text_button(gw->window, fbtk_get_width(gw->window) - furniture_width, fbtk_get_height(gw->window) - furniture_width, @@ -1655,7 +1657,6 @@ create_normal_browser_window(struct gui_window *gw, int furniture_width) FB_FRAME_COLOUR, FB_COLOUR_BLACK, fb_osk_click, NULL); - widget = fbtk_create_button(gw->window, fbtk_get_width(gw->window) - furniture_width, fbtk_get_height(gw->window) - furniture_width, @@ -1665,9 +1666,7 @@ create_normal_browser_window(struct gui_window *gw, int furniture_width) &osk_image, fb_osk_click, NULL); - } else { - widget = fbtk_create_fill(gw->window, fbtk_get_width(gw->window) - furniture_width, fbtk_get_height(gw->window) - furniture_width, @@ -1681,7 +1680,6 @@ create_normal_browser_window(struct gui_window *gw, int furniture_width) gw->bottom_right = widget; /* create vertical scrollbar */ - gw->vscroll = fbtk_create_vscroll(gw->window, fbtk_get_width(gw->window) - furniture_width, toolbar_height, @@ -1792,7 +1790,7 @@ 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/kolibrios/fb/gui.h b/frontends/kolibrios/fb/gui.h index 0de1add69..abb27c4bb 100644 --- a/frontends/kolibrios/fb/gui.h +++ b/frontends/kolibrios/fb/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/kolibrios/fb/localhistory.c b/frontends/kolibrios/fb/localhistory.c deleted file mode 100644 index e305aad4e..000000000 --- a/frontends/kolibrios/fb/localhistory.c +++ /dev/null @@ -1,144 +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 "kolibrios/fb/gui.h" -#include "kolibrios/fb/fbtk.h" -#include "kolibrios/fb/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 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); - - browser_window_history_redraw_rectangle(glh->bw, - glh->scrollx, - glh->scrolly, - fbtk_get_width(widget) + glh->scrollx, - fbtk_get_height(widget) + glh->scrolly, - 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); -} diff --git a/utils/log.h b/utils/log.h index b773ec4a2..27f43230f 100644 --- a/utils/log.h +++ b/utils/log.h @@ -119,4 +119,5 @@ extern void nslog_log(const char *file, const char *func, int ln, const char *fo #endif /* WITH_NSLOG */ +#define LOG(format, args...) NSLOG(netsurf, INFO, format , ##args) #endif -- cgit v1.2.3