r10560 vince - in /branches/vince/netsurf-fbtk-rework/framebuffer: fbtk/fbtk.c fbtk/text.c gui.c

netsurf at semichrome.net netsurf at semichrome.net
Thu Jun 3 16:32:03 BST 2010


Author: vince
Date: Thu Jun  3 10:32:03 2010
New Revision: 10560

URL: http://source.netsurf-browser.org?rev=10560&view=rev
Log:
works pretty much teh same as when teh refactor started

Modified:
    branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/fbtk.c
    branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/text.c
    branches/vince/netsurf-fbtk-rework/framebuffer/gui.c

Modified: branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/fbtk.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/fbtk.c?rev=10560&r1=10559&r2=10560&view=diff
==============================================================================
--- branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/fbtk.c (original)
+++ branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/fbtk.c Thu Jun  3 10:32:03 2010
@@ -51,16 +51,23 @@
 fbtk_request_redraw(fbtk_widget_t *widget)
 {
 	fbtk_widget_t *cwidget;
+	fbtk_widget_t *pwidget;
 
 	/* if widget not mapped do not try to redraw it */
-        if (widget->mapped == false)
-                return;
+	pwidget = widget;
+	while (pwidget != NULL) {
+		if (pwidget->mapped == false)
+			return;
+		pwidget = pwidget->parent;
+	}
 
         widget->redraw.needed = true;
-        widget->redraw.x = widget->x;
-        widget->redraw.y = widget->y;
+        widget->redraw.x = 0;
+        widget->redraw.y = 0;
         widget->redraw.width = widget->width;
-        widget->redraw.height = widget->width;
+        widget->redraw.height = widget->height;
+
+	LOG(("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) {
@@ -78,10 +85,10 @@
 
 /* exported function documented in fbtk.h */
 int
-fbtk_set_mapping(fbtk_widget_t *widget, bool mapped)
-{
-	widget->mapped = mapped;
-	if (mapped) {
+fbtk_set_mapping(fbtk_widget_t *widget, bool map)
+{
+	widget->mapped = map;
+	if (map) {
 		//set_widget_zorder(widget, 0);
 		fbtk_request_redraw(widget);
 	} else {
@@ -304,12 +311,13 @@
         bbox->x1 = widget->x + widget->width;
         bbox->y1 = widget->y + widget->height;
 
-        while (widget->parent != NULL) {
-                widget = widget->parent;
+	widget = widget->parent;
+        while (widget != NULL) {
                 bbox->x0 += widget->x;
                 bbox->y0 += widget->y;
                 bbox->x1 += widget->x;
                 bbox->y1 += widget->y;
+		widget = widget->parent;
         }
 
         return true;
@@ -326,8 +334,8 @@
 
 	while (nwid != NULL) {
 		if ((nwid->mapped) &&
-		    (x > nwid->x) &&
-		    (y > nwid->y) &&
+		    (x >= nwid->x) &&
+		    (y >= nwid->y) &&
 		    (x < nwid->x + nwid->width) &&
 		    (y < nwid->y + nwid->height)) {
 			widget = nwid;
@@ -380,6 +388,8 @@
                 height = parent->height - y;
         }
 
+
+	LOG(("creating %p %d,%d %d,%d", neww, x,y,width,height));
         /* set values */
         neww->type = type;
 	neww->x = x;
@@ -425,7 +435,7 @@
  * children of a node should be considered.
  */
 static int
-do_redraw(fbtk_widget_t *root, fbtk_widget_t *widget)
+do_redraw(nsfb_t *nsfb, fbtk_widget_t *widget)
 {
 	nsfb_bbox_t plot_ctx;
 	fbtk_widget_t *cwidget; /* child widget */
@@ -437,18 +447,18 @@
 		plot_ctx.x1 = plot_ctx.x0 + widget->redraw.width;
 		plot_ctx.y1 = plot_ctx.y0 + widget->redraw.height;
 		
-		nsfb_plot_set_clip(root->u.root.fb, &plot_ctx);
-
-		fbtk_post_callback(widget, FBTK_CBT_REDRAW);
-		
-		root->redraw.needed = false;
+		LOG(("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);
+		}
+		widget->redraw.needed = false;
 	}
 
 	/* walk the widgets children if child flag is set */
 	if (widget->redraw.child) {
 		cwidget = widget->last_child;
 		while (cwidget != NULL) {
-			do_redraw(root, cwidget);
+			do_redraw(nsfb, cwidget);
 			cwidget = cwidget->prev;
 		}
 		widget->redraw.child = false;
@@ -466,7 +476,7 @@
         /* ensure we have the root widget */
         root = fbtk_get_root_widget(widget);
 
-	return do_redraw(root, root);
+	return do_redraw(root->u.root.fb, root);
 }
 
 /* exported function documented in fbtk.h */

Modified: branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/text.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/text.c?rev=10560&r1=10559&r2=10560&view=diff
==============================================================================
--- branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/text.c (original)
+++ branches/vince/netsurf-fbtk-rework/framebuffer/fbtk/text.c Thu Jun  3 10:32:03 2010
@@ -63,7 +63,7 @@
                 nsfb_plot_rectangle_fill(root->u.root.fb, &bbox, widget->bg);
         }
 
-
+	LOG(("Filling %p at %d,%d %d,%d",widget, bbox.x0,bbox.y0,bbox.x1,bbox.y1));
         if (widget->u.text.outline) {
                 rect.x1--;
                 rect.y1--;

Modified: branches/vince/netsurf-fbtk-rework/framebuffer/gui.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-fbtk-rework/framebuffer/gui.c?rev=10560&r1=10559&r2=10560&view=diff
==============================================================================
--- branches/vince/netsurf-fbtk-rework/framebuffer/gui.c (original)
+++ branches/vince/netsurf-fbtk-rework/framebuffer/gui.c Thu Jun  3 10:32:03 2010
@@ -912,14 +912,15 @@
 
 
                 /* status bar */
-                xpos = 0;
                 gw->status = fbtk_create_text(gw->window,
-				xpos,
+				0,
 				fbtk_get_height(gw->window) - furniture_width,
 				statusbar_width, furniture_width,
 				FB_FRAME_COLOUR, FB_COLOUR_BLACK,
 				false);
 		fbtk_set_handler(gw->status, FBTK_CBT_POINTERMOVE, set_ptr_default_move, bw);
+
+		LOG(("status bar %p at %d,%d", gw->status, fbtk_get_absx(gw->status), fbtk_get_absy(gw->status)));
 
                 /* create horizontal scrollbar */
                 gw->hscroll = fbtk_create_hscroll(gw->window,




More information about the netsurf-commits mailing list