r11877 tlsa - in /trunk/netsurf: desktop/textinput.c render/box.h render/box_construct.c render/html.h render/html_redraw.c render/layout.c render/textplain.c
by netsurf@semichrome.net
Author: tlsa
Date: Tue Mar 1 14:00:41 2011
New Revision: 11877
URL: http://source.netsurf-browser.org?rev=11877&view=rev
Log:
Cache space widths.
Modified:
trunk/netsurf/desktop/textinput.c
trunk/netsurf/render/box.h
trunk/netsurf/render/box_construct.c
trunk/netsurf/render/html.h
trunk/netsurf/render/html_redraw.c
trunk/netsurf/render/layout.c
trunk/netsurf/render/textplain.c
Modified: trunk/netsurf/desktop/textinput.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/textinput.c?rev=1...
==============================================================================
--- trunk/netsurf/desktop/textinput.c (original)
+++ trunk/netsurf/desktop/textinput.c Tue Mar 1 14:00:41 2011
@@ -44,7 +44,6 @@
#include "utils/talloc.h"
#include "utils/utf8.h"
#include "utils/utils.h"
-
/** ghost caret used to indicate the insertion point when dragging text
into a textarea/input field */
@@ -95,6 +94,8 @@
size_t *pchars);
static bool ensure_caret_visible(struct browser_window *bw,
struct box *textarea);
+
+#define SPACE_LEN(b) ((b->space == 0) ? 0 : 1)
/**
* Remove the given text caret from the window by invalidating it
@@ -424,11 +425,11 @@
selection_clear(bw->sel, false);
if (end_box != text_box ||
- char_offset < text_box->length + text_box->space) {
+ char_offset < text_box->length + SPACE_LEN(text_box)) {
/* there's something at the end of the line to delete */
- textarea_cut(bw, text_box, char_offset,
- end_box, end_box->length + end_box->space,
- false);
+ textarea_cut(bw, text_box, char_offset, end_box,
+ end_box->length + SPACE_LEN(end_box),
+ false);
reflow = true;
break;
}
@@ -753,11 +754,11 @@
if (reflow)
textarea_reflow(bw, textarea, inline_container);
- if (text_box->length + text_box->space <= char_offset) {
+ if (text_box->length + SPACE_LEN(text_box) <= char_offset) {
if (text_box->next && text_box->next->type == BOX_TEXT) {
/* the text box has been split when reflowing and
the caret is in the second part */
- char_offset -= (text_box->length + text_box->space);
+ char_offset -= (text_box->length + SPACE_LEN(text_box));
text_box = text_box->next;
assert(text_box);
assert(char_offset <= text_box->length);
@@ -771,7 +772,7 @@
(text_box->next &&
text_box->next->type == BOX_BR));
- char_offset = text_box->length + text_box->space;
+ char_offset = text_box->length + SPACE_LEN(text_box);
}
}
@@ -1376,13 +1377,13 @@
char_offset = textarea->gadget->caret_box_offset;
text_box = textarea->gadget->caret_text_box;
- while ((char_offset > text_box->length + text_box->space) &&
+ while ((char_offset > text_box->length + SPACE_LEN(text_box)) &&
(text_box->next) &&
(text_box->next->type == BOX_TEXT)) {
LOG(("Caret out of range: Was %d in boxlen %d "
"space %d", char_offset,
- text_box->length, text_box->space));
- char_offset -= text_box->length + text_box->space;
+ text_box->length, SPACE_LEN(text_box)));
+ char_offset -= text_box->length + SPACE_LEN(text_box);
text_box = text_box->next;
}
@@ -1716,15 +1717,15 @@
/* insert in text box */
text = talloc_realloc(current_content, text_box->text,
char,
- text_box->length + text_box->space + utf8_len + 1);
+ text_box->length + SPACE_LEN(text_box) + utf8_len + 1);
if (!text) {
warn_user("NoMemory", 0);
return false;
}
text_box->text = text;
- if (text_box->space &&
- char_offset == text_box->length + text_box->space) {
+ if (text_box->space != 0 &&
+ char_offset == text_box->length + SPACE_LEN(text_box)) {
if (hide)
text_box->space = 0;
else {
@@ -1798,18 +1799,18 @@
}
/* delete from visible textbox */
- if (next_offset <= text_box->length + text_box->space) {
+ if (next_offset <= text_box->length + SPACE_LEN(text_box)) {
/* handle removal of trailing space */
- if (text_box->space && next_offset > text_box->length) {
+ if (text_box->space != 0 && next_offset > text_box->length) {
if (char_offset > 0) {
/* is the trailing character still a space? */
int tmp = utf8_prev(text_box->text, char_offset);
if (isspace(text_box->text[tmp]))
char_offset = tmp;
else
- text_box->space = false;
+ text_box->space = 0;
} else {
- text_box->space = false;
+ text_box->space = 0;
}
text_box->length = char_offset;
@@ -1846,7 +1847,7 @@
bool delete_handler(struct browser_window *bw, struct box *b,
int offset, size_t length)
{
- size_t text_length = b->length + b->space;
+ size_t text_length = b->length + SPACE_LEN(b);
/* only remove if its not the first box */
if (offset <= 0 && length >= text_length && b->prev != NULL) {
@@ -2053,21 +2054,23 @@
/* append box text to clipboard and then delete it */
if (clipboard &&
!gui_add_to_clipboard(box->text + start_idx,
- box->length - start_idx, box->space)) {
+ box->length - start_idx,
+ SPACE_LEN(box))) {
gui_commit_clipboard();
return false;
}
if (del) {
if (!delete_handler(bw, box, start_idx,
- (box->length + box->space) -
+ (box->length + SPACE_LEN(box)) -
start_idx) && clipboard) {
gui_commit_clipboard();
return false;
}
} else {
textbox_delete(bw, box, start_idx,
- (box->length + box->space) - start_idx);
+ (box->length + SPACE_LEN(box)) -
+ start_idx);
}
}
Modified: trunk/netsurf/render/box.h
URL: http://source.netsurf-browser.org/trunk/netsurf/render/box.h?rev=11877&r1...
==============================================================================
--- trunk/netsurf/render/box.h (original)
+++ trunk/netsurf/render/box.h Tue Mar 1 14:00:41 2011
@@ -99,6 +99,10 @@
struct column;
struct object_params;
struct object_param;
+
+
+#define UNKNOWN_WIDTH INT_MAX
+#define UNKNOWN_MAX_WIDTH INT_MAX
/** Type of a struct box. */
@@ -187,8 +191,8 @@
char *text; /**< Text, or 0 if none. Unterminated. */
size_t length; /**< Length of text. */
- /** Text is followed by a space. */
- unsigned int space : 1;
+ /** Width of space after current text (depends on font and size). */
+ int space;
/** This box is a continuation of the previous box (eg from line
* breaking). */
unsigned int clone : 1;
@@ -293,8 +297,6 @@
extern const char *TARGET_BLANK;
-#define UNKNOWN_WIDTH INT_MAX
-#define UNKNOWN_MAX_WIDTH INT_MAX
void *box_style_alloc(void *ptr, size_t len, void *pw);
struct box * box_create(css_select_results *styles, css_computed_style *style,
Modified: trunk/netsurf/render/box_construct.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/box_construct.c?re...
==============================================================================
--- trunk/netsurf/render/box_construct.c (original)
+++ trunk/netsurf/render/box_construct.c Tue Mar 1 14:00:41 2011
@@ -718,7 +718,8 @@
assert((*inline_container)->last != 0);
- (*inline_container)->last->space = 1;
+ (*inline_container)->last->space =
+ UNKNOWN_WIDTH;
}
free(text);
@@ -759,7 +760,7 @@
/* strip ending space char off */
if (box->length > 1 && box->text[box->length - 1] == ' ') {
- box->space = 1;
+ box->space = UNKNOWN_WIDTH;
box->length--;
}
@@ -797,7 +798,7 @@
memmove(box->text, &box->text[1], box->length);
if (box->prev != NULL)
- box->prev->space = 1;
+ box->prev->space = UNKNOWN_WIDTH;
}
} else {
Modified: trunk/netsurf/render/html.h
URL: http://source.netsurf-browser.org/trunk/netsurf/render/html.h?rev=11877&r...
==============================================================================
--- trunk/netsurf/render/html.h (original)
+++ trunk/netsurf/render/html.h Tue Mar 1 14:00:41 2011
@@ -225,7 +225,7 @@
browser_mouse_state mouse, int x, int y, int dir);
bool text_redraw(const char *utf8_text, size_t utf8_len,
- size_t offset, bool space,
+ size_t offset, int space,
const plot_font_style_t *fstyle,
int x, int y,
const struct rect *clip,
Modified: trunk/netsurf/render/html_redraw.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/html_redraw.c?rev=...
==============================================================================
--- trunk/netsurf/render/html_redraw.c (original)
+++ trunk/netsurf/render/html_redraw.c Tue Mar 1 14:00:41 2011
@@ -820,7 +820,7 @@
* \param utf8_text pointer to UTF-8 text string
* \param utf8_len length of string, in bytes
* \param offset byte offset within textual representation
- * \param space indicates whether string is followed by a space
+ * \param space width of space that follows string (0 = no space)
* \param fstyle text style to use
* \param x x ordinate at which to plot text
* \param y y ordinate at which to plot text
@@ -832,7 +832,7 @@
*/
bool text_redraw(const char *utf8_text, size_t utf8_len,
- size_t offset, bool space, const plot_font_style_t *fstyle,
+ size_t offset, int space, const plot_font_style_t *fstyle,
int x, int y, const struct rect *clip, int height,
float scale, bool excluded)
{
@@ -891,12 +891,7 @@
/* is there a trailing space that should be highlighted
* as well? */
if (end_idx > utf8_len) {
- int spc_width;
- /* \todo is there a more elegant/efficient
- * solution? */
- if (nsfont.font_width(fstyle, " ", 1,
- &spc_width))
- endx += spc_width;
+ endx += space;
}
if (scale != 1.0) {
Modified: trunk/netsurf/render/layout.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/layout.c?rev=11877...
==============================================================================
--- trunk/netsurf/render/layout.c (original)
+++ trunk/netsurf/render/layout.c Tue Mar 1 14:00:41 2011
@@ -1922,6 +1922,11 @@
struct box *c2;
const struct font_functions *font_func = content->data.html.font_func;
+ if (split_box->space == 0 || split_box->space == UNKNOWN_WIDTH) {
+ font_func->font_width(fstyle, " ", 1, &split_box->space);
+ }
+ space_width = split_box->space;
+
/* Create clone of split_box, c2 */
c2 = talloc_memdup(content, split_box, sizeof *c2);
if (!c2)
@@ -1935,14 +1940,12 @@
return false;
/* Set c2 according to the remaining text */
- font_func->font_width(fstyle, " ", 1, &space_width);
c2->width -= new_width + space_width;
c2->length = split_box->length - (new_length + 1);
/* Update split_box for its reduced text */
split_box->length = new_length;
split_box->width = new_width;
- split_box->space = 1;
/* Insert c2 into box list */
c2->next = split_box->next;
@@ -2100,13 +2103,13 @@
}
} else if (b->type == BOX_INLINE_END) {
b->width = 0;
- if (b->space) {
- /** \todo optimize out */
+ if (b->space == UNKNOWN_WIDTH) {
font_func->font_width(&fstyle, " ", 1,
- &space_after);
- } else {
- space_after = 0;
- }
+ &b->space);
+ /** \todo handle errors */
+ }
+ space_after = b->space;
+
x += b->padding[RIGHT] + b->border[RIGHT].width +
b->margin[RIGHT];
continue;
@@ -2153,18 +2156,17 @@
b->width += SCROLLBAR_WIDTH;
} else {
font_func->font_width(&fstyle, b->text,
- b->length, &b->width);
+ b->length, &b->width);
}
}
x += b->width;
- if (b->space)
- /** \todo optimize out */
+ if (b->space == UNKNOWN_WIDTH) {
font_func->font_width(&fstyle, " ", 1,
- &space_after);
- else
- space_after = 0;
-
+ &b->space);
+ /** \todo handle errors */
+ }
+ space_after = b->space;
continue;
}
@@ -2285,16 +2287,17 @@
if (b->object)
space_after = 0;
else if (b->text || b->type == BOX_INLINE_END) {
- space_after = 0;
- if (b->space) {
+ if (b->space == UNKNOWN_WIDTH) {
font_plot_style_from_css(b->style,
&fstyle);
- /** \todo handle errors, optimize */
+ /** \todo handle errors */
font_func->font_width(&fstyle, " ", 1,
- &space_after);
+ &b->space);
}
- } else
+ space_after = b->space;
+ } else {
space_after = 0;
+ }
split_box = b;
move_y = true;
inline_count++;
@@ -2726,9 +2729,10 @@
&fixed, &frac);
if (0 < fixed)
max += fixed;
- if (b->next && b->space) {
- font_func->font_width(&fstyle, " ", 1, &width);
- max += width;
+ if (b->next && b->space == UNKNOWN_WIDTH) {
+ font_func->font_width(&fstyle, " ", 1,
+ &b->space);
+ max += b->space;
}
continue;
}
@@ -2772,9 +2776,10 @@
}
}
max += b->width;
- if (b->next && b->space) {
- font_func->font_width(&fstyle, " ", 1, &width);
- max += width;
+ if (b->next && b->space == UNKNOWN_WIDTH) {
+ font_func->font_width(&fstyle, " ", 1,
+ &b->space);
+ max += b->space;
}
/* min = widest word */
Modified: trunk/netsurf/render/textplain.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/textplain.c?rev=11...
==============================================================================
--- trunk/netsurf/render/textplain.c (original)
+++ trunk/netsurf/render/textplain.c Tue Mar 1 14:00:41 2011
@@ -612,7 +612,7 @@
next_offset = utf8_next(text, length, next_offset);
if (!text_redraw(text + offset, next_offset - offset,
- line[lineno].start + offset, false,
+ line[lineno].start + offset, 0,
&textplain_style,
tx, y + (lineno * scaled_line_height),
clip, line_height, scale, false))
12 years, 3 months
r11876 mono - /trunk/netsurf/atari/plot.c
by netsurf@semichrome.net
Author: mono
Date: Tue Mar 1 13:31:28 2011
New Revision: 11876
URL: http://source.netsurf-browser.org?rev=11876&view=rev
Log:
Fixed missing draw of tiled bitmap which are completly outside of the clipping rectangle ,
adjusted clipping rect changes for atari frontend
Modified:
trunk/netsurf/atari/plot.c
Modified: trunk/netsurf/atari/plot.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/plot.c?rev=11876&r1...
==============================================================================
--- trunk/netsurf/atari/plot.c (original)
+++ trunk/netsurf/atari/plot.c Tue Mar 1 13:31:28 2011
@@ -161,7 +161,7 @@
if ( repeat_x || repeat_y ) {
plotter_get_clip( plotter, &clip );
- if( repeat_x && width == 1 && repeat_y && height == 1 ){
+ if( repeat_x && width == 1 && repeat_y && height == 1 ){
width = MAX( width, clip.x1 - x );
height = MAX( height, clip.y1 - y );
}
@@ -181,8 +181,10 @@
}
/* out of memory? */
- if( bm == NULL )
+ if( bm == NULL ) {
+ printf("plot: out of memory!");
return( true );
+ }
if (!(repeat_x || repeat_y)) {
plotter->bitmap( plotter, bm, x, y, bg, flags );
@@ -190,14 +192,19 @@
int xf,yf;
int xoff = x;
int yoff = y;
+
+ if (yoff > clip.y0 )
+ yoff = (clip.y0 - height) + ((yoff - clip.y0) % height);
+ if (xoff > clip.x0 )
+ xoff = (clip.x0 - width) + ((xoff - clip.x0) % width);
/* for now, repeating just works in the rigth / down direction */
/*
if( repeat_x == true )
xoff = clip.x0;
if(repeat_y == true )
yoff = clip.y0;
- */
-
+ */
+
for( xf = xoff; xf < clip.x1; xf += width ) {
for( yf = yoff; yf < clip.y1; yf += height ) {
plotter->bitmap( plotter, bm, xf, yf, bg, flags );
12 years, 3 months
r11875 mono - in /trunk/netsurf/atari/plot: plotter.c plotter.h plotter_vdi.c
by netsurf@semichrome.net
Author: mono
Date: Tue Mar 1 13:29:40 2011
New Revision: 11875
URL: http://source.netsurf-browser.org?rev=11875&view=rev
Log:
Adjusted clipping rect changes for atari fronted.
Modified:
trunk/netsurf/atari/plot/plotter.c
trunk/netsurf/atari/plot/plotter.h
trunk/netsurf/atari/plot/plotter_vdi.c
Modified: trunk/netsurf/atari/plot/plotter.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/plot/plotter.c?rev=...
==============================================================================
--- trunk/netsurf/atari/plot/plotter.c (original)
+++ trunk/netsurf/atari/plot/plotter.c Tue Mar 1 13:29:40 2011
@@ -683,7 +683,7 @@
}
/* Shared (static in object oriented slang) plotter functions: */
-int plotter_get_clip( GEM_PLOTTER self, struct s_clipping * out )
+int plotter_get_clip( GEM_PLOTTER self, struct rect * out )
{
out->x0 = self->clipping.x0;
out->y0 = self->clipping.y0;
@@ -692,12 +692,12 @@
return( 1 );
}
-int plotter_std_clip(GEM_PLOTTER self,int x0, int y0, int x1, int y1)
-{
- self->clipping.x0 = x0;
- self->clipping.y0 = y0;
- self->clipping.x1 = x1;
- self->clipping.y1 = y1;
+int plotter_std_clip(GEM_PLOTTER self, const struct rect * clip)
+{
+ self->clipping.x0 = clip->x0;
+ self->clipping.y0 = clip->y0;
+ self->clipping.x1 = clip->x1;
+ self->clipping.y1 = clip->y1;
return ( 1 );
}
@@ -706,7 +706,7 @@
{
return;
if( set == true ) {
- struct s_clipping * c = &self->clipping;
+ struct rect * c = &self->clipping;
short vdiflags[58];
short newclip[4];
vq_extnd( self->vdi_handle, 1, (short*)&vdiflags);
Modified: trunk/netsurf/atari/plot/plotter.h
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/plot/plotter.h?rev=...
==============================================================================
--- trunk/netsurf/atari/plot/plotter.h (original)
+++ trunk/netsurf/atari/plot/plotter.h Tue Mar 1 13:29:40 2011
@@ -25,6 +25,7 @@
#include <string.h>
#include <windom.h>
+#include "desktop/plotters.h"
#include "desktop/plot_style.h"
#include "image/bitmap.h"
#include "atari/bitmap.h"
@@ -103,12 +104,7 @@
};
-struct s_clipping {
- short x0;
- short y0;
- short x1;
- short y1;
-};
+struct rect;
struct s_vdi_sysinfo {
short vdi_handle; /* vdi handle */
@@ -162,7 +158,7 @@
typedef int (*_pmf_update_screen)(GEM_PLOTTER self);
typedef int (*_pmf_put_pixel)(GEM_PLOTTER self, int x, int y, int color );
typedef int (*_pmf_copy_rect)(GEM_PLOTTER self, GRECT src, GRECT dst );
-typedef int (*_pmf_clip)(GEM_PLOTTER self, int x0, int y0, int x1, int y1);
+typedef int (*_pmf_clip)(GEM_PLOTTER self, const struct rect * clip );
typedef int (*_pmf_arc)(GEM_PLOTTER self, int x, int y, int radius, int angle1, int angle2, const plot_style_t * pstyle);
typedef int (*_pmf_disc)(GEM_PLOTTER self, int x, int y, int radius, const plot_style_t * pstyle);
typedef int (*_pmf_line)(GEM_PLOTTER self, int x0, int y0, int x1, int y1, const plot_style_t * pstyle);
@@ -185,7 +181,7 @@
struct s_vdi_sysinfo * scr;
void * priv_data;
int bpp_virt; /* bit depth of framebuffer */
- struct s_clipping clipping;
+ struct rect clipping;
struct s_frame_buf fbuf[MAX_FRAMEBUFS];
int cfbi; /* current framebuffer index */
@@ -296,8 +292,8 @@
short rgb_to_666_index(unsigned char r, unsigned char g, unsigned char b);
/* shared / static methods ... */
-int plotter_get_clip( GEM_PLOTTER self, struct s_clipping * out );
-int plotter_std_clip(GEM_PLOTTER self,int x0, int y0, int x1, int y1);
+int plotter_get_clip( GEM_PLOTTER self, struct rect * out );
+int plotter_std_clip(GEM_PLOTTER self, const struct rect * clip);
void plotter_vdi_clip( GEM_PLOTTER self, bool set);
#define PLOTTER_IS_LOCKED(plotter) ( plotter->private_flags & PLOTTER_FLAG_LOCKED )
Modified: trunk/netsurf/atari/plot/plotter_vdi.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/plot/plotter_vdi.c?...
==============================================================================
--- trunk/netsurf/atari/plot/plotter_vdi.c (original)
+++ trunk/netsurf/atari/plot/plotter_vdi.c Tue Mar 1 13:29:40 2011
@@ -122,6 +122,8 @@
{
int retval = 0;
int i;
+ struct rect clip;
+
self->dtor = dtor;
self->resize= resize;
self->move = move;
@@ -167,7 +169,12 @@
/* offscreen: FIRSTFB(self).mem = malloc( FIRSTFB(self).size ); */
FIRSTFB(self).mem = NULL;
update_visible_rect( self );
- self->clip( self, 0, 0, FIRSTFB(self).w, FIRSTFB(self).h );
+
+ clip.x0 = 0;
+ clip.y0 = 0;
+ clip.x1 = FIRSTFB(self).w;
+ clip.y1 = FIRSTFB(self).h;
+ self->clip( self, &clip );
/* store system palette & setup the new (web) palette: */
i = 0;
if( app.nplanes <= 8 ){
@@ -601,7 +608,7 @@
unsigned int i=0;
short d[4];
if( vdi_sysinfo.maxpolycoords > 0 )
- assert( n < vdi_sysinfo.maxpolycoords );
+ assert( (signed int)n < vdi_sysinfo.maxpolycoords );
/*
Does this double check make sense?
else
@@ -1041,11 +1048,8 @@
static int text(GEM_PLOTTER self, int x, int y, const char *text, size_t length, const plot_font_style_t *fstyle)
{
- self->font_plotter->text( self->font_plotter,
- x,
- y,
- text, length,
- fstyle
+ self->font_plotter->text( self->font_plotter, x, y,
+ text, length, fstyle
);
return ( 1 );
}
12 years, 3 months
r11874 mono - /trunk/netsurf/atari/browser.c
by netsurf@semichrome.net
Author: mono
Date: Tue Mar 1 13:28:12 2011
New Revision: 11874
URL: http://source.netsurf-browser.org?rev=11874&view=rev
Log:
cosmetic
Modified:
trunk/netsurf/atari/browser.c
Modified: trunk/netsurf/atari/browser.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/browser.c?rev=11874...
==============================================================================
--- trunk/netsurf/atari/browser.c (original)
+++ trunk/netsurf/atari/browser.c Tue Mar 1 13:28:12 2011
@@ -909,7 +909,7 @@
clip.x0 = caret.g_x - 1;
clip.y0 = caret.g_y - 1;
clip.x1 = caret.g_x + caret.g_w + 1;
- clip.y1 = caret.g_y + caret.g_h + 1;
+ clip.y1 = caret.g_y + caret.g_h + 1;
/* store old clip before adjusting it: */
plot_get_clip( &old_clip );
/* clip to cursor: */
@@ -933,12 +933,9 @@
short todo[4];
struct rect clip;
- if( b->attached == false ) {
+ if( b->attached == false || b->bw->current_content == NULL ) {
return;
}
-
- if( b->bw->current_content == NULL )
- return;
browser_get_rect(gw, BR_CONTENT, &bwrect);
12 years, 3 months
r11873 mono - in /trunk/netsurf/atari: findfile.c osspec.c osspec.h plot/font_vdi.c
by netsurf@semichrome.net
Author: mono
Date: Tue Mar 1 13:27:34 2011
New Revision: 11873
URL: http://source.netsurf-browser.org?rev=11873&view=rev
Log:
Implemented OS detection routines provided by GS
Modified:
trunk/netsurf/atari/findfile.c
trunk/netsurf/atari/osspec.c
trunk/netsurf/atari/osspec.h
trunk/netsurf/atari/plot/font_vdi.c
Modified: trunk/netsurf/atari/findfile.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/findfile.c?rev=1187...
==============================================================================
--- trunk/netsurf/atari/findfile.c (original)
+++ trunk/netsurf/atari/findfile.c Tue Mar 1 13:27:34 2011
@@ -55,18 +55,24 @@
char *path;
/* return the absolute path including leading / */
- if( atari_sysinfo.gdosversion > TOS4VER ) {
+ if( sys_type() & SYS_MINT ) {
path = strdup(url_path + (FILE_SCHEME_PREFIX_LEN - 1));
} else {
/* do not include / within url_path */
- path = strdup(url_path + (FILE_SCHEME_PREFIX_LEN));
- int l = strlen(path);
- int i;
- for( i = 0; i<l-1; i++){
+ char * drive = url_path + (FILE_SCHEME_PREFIX_LEN);
+ path = malloc( strlen(drive) + 4 );
+ int i=0;
+ path[i++] = drive[0];
+ path[i++] = ':';
+ path[i++] = 0x5C;
+ while( drive[i-1] != 0){
+ path[i] = drive[i-1];
if( path[i] == '/' ){
path[i] = 0x5C;
}
+ i++;
}
+ path[i] = 0;
LOG(("%s", path));
}
curl_free(url_path);
Modified: trunk/netsurf/atari/osspec.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/osspec.c?rev=11873&...
==============================================================================
--- trunk/netsurf/atari/osspec.c (original)
+++ trunk/netsurf/atari/osspec.c Tue Mar 1 13:27:34 2011
@@ -13,11 +13,52 @@
NS_ATARI_SYSINFO atari_sysinfo;
+unsigned short _systype_v;
+unsigned short _systype (void)
+{
+_systype_v = (_systype_v & ~0xF) | SYS_MINT | SYS_XAAES;
+ return _systype_v;
+
+ int32_t * cptr = NULL;
+ _systype_v = SYS_TOS;
+
+ cptr = Setexc(0x0168, -1L);
+ if (cptr == NULL ) {
+ return _systype_v; /* stone old TOS without any cookie support */
+ }
+ while (*cptr) {
+ if (*cptr == C_MgMc || *cptr == C_MgMx ) {
+ _systype_v = (_systype_v & ~0xF) | SYS_MAGIC;
+ } else if (*cptr == C_MiNT ) {
+ _systype_v = (_systype_v & ~0xF) | SYS_MINT;
+ } else if (*cptr == C_Gnva/*Gnva*/) {
+ _systype_v |= SYS_GENEVA;
+ } else if (*cptr == C_nAES/*nAES*/) {
+ _systype_v |= SYS_NAES;
+ }
+ cptr += 2;
+ }
+ if (_systype_v & SYS_MINT) { /* check for XaAES */
+ short out = 0, u;
+ if (wind_get (0, (((short)'X') <<8)|'A', &out, &u,&u,&u) && out) {
+ _systype_v |= SYS_XAAES;
+ }
+ }
+ return _systype_v;
+}
void init_os_info(void)
{
int16_t out[4];
- atari_sysinfo.gdosversion = Sversion();
+ unsigned long cookie_FSMC = 0;
+
+ atari_sysinfo.gemdos_version = Sversion();
+
+ if( tos_getcookie (C_FSMC, &cookie_FSMC ) == C_FOUND ) {
+ atari_sysinfo.gdos_FSMC = 1;
+ } else {
+ atari_sysinfo.gdos_FSMC = 0;
+ }
atari_sysinfo.large_sfont_pxh = 13;
atari_sysinfo.medium_sfont_pxh = 6;
atari_sysinfo.small_sfont_pxh = 4;
@@ -28,6 +69,15 @@
}
if( appl_xgetinfo(AES_SMALLFONT, &out[0], &out[1], &out[2], &out[3] ) > 0 ){
atari_sysinfo.small_sfont_pxh = out[0];
+ }
+ atari_sysinfo.aes_max_win_title_len = 79;
+ if (sys_type() & (SYS_MAGIC|SYS_NAES|SYS_XAAES)) {
+ if (sys_NAES()) {
+ atari_sysinfo.aes_max_win_title_len = 127;
+ }
+ if (sys_XAAES()) {
+ atari_sysinfo.aes_max_win_title_len = 200;
+ }
}
}
@@ -36,7 +86,7 @@
COOKIE * cptr;
long oldsp;
- if( atari_sysinfo.gdosversion > TOS4VER ){
+ if( atari_sysinfo.gemdos_version > TOS4VER ){
return( Getcookie(tag, value) );
}
@@ -45,7 +95,9 @@
do {
if( cptr->c == tag ){
if(cptr->v != 0 ){
- *value = cptr->v;
+ if( value != NULL ){
+ *value = cptr->v;
+ }
return( C_FOUND );
}
}
@@ -86,7 +138,7 @@
if( rpath == NULL ){
return( NULL );
}
- if( atari_sysinfo.gdosversion > TOS4VER ){
+ if( sys_type() & SYS_MINT ){
return( realpath(path, rpath) );
}
Modified: trunk/netsurf/atari/osspec.h
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/osspec.h?rev=11873&...
==============================================================================
--- trunk/netsurf/atari/osspec.h (original)
+++ trunk/netsurf/atari/osspec.h Tue Mar 1 13:27:34 2011
@@ -24,20 +24,39 @@
long v;
} COOKIE;
+/* System type detection added by [GS] */
+#define SYS_TOS 0x0001
+#define SYS_MAGIC 0x0002
+#define SYS_MINT 0x0004
+#define SYS_GENEVA 0x0010
+#define SYS_NAES 0x0020
+#define SYS_XAAES 0x0040
+/* detect the system type, AES + kernel */
+#define sys_type() (_systype_v ? _systype_v : _systype())
+#define sys_MAGIC() ((sys_type() & SYS_MAGIC) != 0)
+#define sys_NAES() ((sys_type() & SYS_NAES) != 0)
+#define sys_XAAES() ((sys_type() & SYS_XAAES) != 0)
+
+
typedef struct {
- unsigned short gdosversion;
+ unsigned short gemdos_version;
+ unsigned short gdos_FSMC;
+ unsigned short systype;
unsigned short small_sfont_pxh;
unsigned short medium_sfont_pxh;
unsigned short large_sfont_pxh;
bool sfont_monospaced;
+ short aes_max_win_title_len;
} NS_ATARI_SYSINFO;
extern NS_ATARI_SYSINFO atari_sysinfo;
+extern unsigned short _systype_v;
-#define TOS4VER 0x03000 /* this is assumed to be the last single tasking OS */
+#define TOS4VER 0x03300 /* this is assumed to be the last single tasking OS */
void init_os_info(void);
int tos_getcookie( long tag, long * value );
void fix_path(char * path);
char * gdos_realpath(const char * path, char * rpath);
+unsigned short _systype (void);
#endif
Modified: trunk/netsurf/atari/plot/font_vdi.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/plot/font_vdi.c?rev...
==============================================================================
--- trunk/netsurf/atari/plot/font_vdi.c (original)
+++ trunk/netsurf/atari/plot/font_vdi.c Tue Mar 1 13:27:34 2011
@@ -210,7 +210,8 @@
} else {
vst_color( self->vdi_handle, BLACK );
}
- if( atari_sysinfo.gdosversion > 0x03000 ){
+
+ if( atari_sysinfo.gdos_FSMC ){
v_ftext( self->vdi_handle, x, y, (char*)&textcpy );
} else {
v_gtext( self->vdi_handle, x, y, (char*)&textcpy );
12 years, 3 months
r11872 chris_y - in /trunk/netsurf/amiga: gui.c menu.c
by netsurf@semichrome.net
Author: chris_y
Date: Tue Mar 1 13:09:57 2011
New Revision: 11872
URL: http://source.netsurf-browser.org?rev=11872&view=rev
Log:
Brand new windows should not be cloning an existing browser_window or they pick up old
local history.
Brand new tabs should not either but that appears to be unavoidable at present.
Modified:
trunk/netsurf/amiga/gui.c
trunk/netsurf/amiga/menu.c
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=11872&r1=...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Tue Mar 1 13:09:57 2011
@@ -1339,15 +1339,15 @@
case 'n':
if((option_kiosk_mode == false) &&
(gwin->bw->browser_window_type == BROWSER_WINDOW_NORMAL))
- browser_window_create(NULL, gwin->bw,
+ browser_window_create(option_homepage_url, NULL,
0, true, false);
break;
case 't':
if((option_kiosk_mode == false) &&
(gwin->bw->browser_window_type == BROWSER_WINDOW_NORMAL))
- browser_window_create(NULL, gwin->bw,
- 0, true, true);
+ browser_window_create(option_homepage_url,
+ gwin->bw, 0, true, true);
break;
case 'k':
Modified: trunk/netsurf/amiga/menu.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/menu.c?rev=11872&r1...
==============================================================================
--- trunk/netsurf/amiga/menu.c (original)
+++ trunk/netsurf/amiga/menu.c Tue Mar 1 13:09:57 2011
@@ -490,7 +490,7 @@
switch(itemnum)
{
case 0: // new window
- bw = browser_window_create(option_homepage_url, gwin->bw, 0, true, openwin);
+ bw = browser_window_create(option_homepage_url, NULL, 0, true, openwin);
break;
case 1: // new tab
12 years, 3 months
r11871 tlsa - in /trunk/netsurf/Docs: BUILDING-AmigaOS BUILDING-Framebuffer BUILDING-GTK
by netsurf@semichrome.net
Author: tlsa
Date: Tue Mar 1 09:40:30 2011
New Revision: 11871
URL: http://source.netsurf-browser.org?rev=11871&view=rev
Log:
Update Haru info.
Modified:
trunk/netsurf/Docs/BUILDING-AmigaOS
trunk/netsurf/Docs/BUILDING-Framebuffer
trunk/netsurf/Docs/BUILDING-GTK
Modified: trunk/netsurf/Docs/BUILDING-AmigaOS
URL: http://source.netsurf-browser.org/trunk/netsurf/Docs/BUILDING-AmigaOS?rev...
==============================================================================
--- trunk/netsurf/Docs/BUILDING-AmigaOS (original)
+++ trunk/netsurf/Docs/BUILDING-AmigaOS Tue Mar 1 09:40:30 2011
@@ -137,19 +137,14 @@
1> makelink sdk:local/newlib/lib/libcrypto.so sobjs:libssl-0.9.8.so soft
- Libhpdf
+ Libharu
---------
- NetSurf can use Haru PDF to enable PDF export and printing in GTK. This
- is currently enabled by default, and cannot be auto-detected by the Makefile.
- If you wish to disable it, do so by creating a Makefile.config.
+ NetSurf can use Haru PDF to enable PDF export. Haru PDF can be obtained
+ from http://libharu.org/. We require libharu 2.2 or later.
- Haru PDF can be obtained from http://libharu.sourceforge.net/, although we
- currently depend on features that the official version does not have. You
- can obtain our patched version from the following Subversion address until
- the patches are accepted upstream;
-
- svn://svn.netsurf-browser.org/trunk/libhpdf
+ | Note: libharu cannot be auto-detected by the Makefile. If you wish to
+ | enable it, do so by creating a Makefile.config file.
libregex
Modified: trunk/netsurf/Docs/BUILDING-Framebuffer
URL: http://source.netsurf-browser.org/trunk/netsurf/Docs/BUILDING-Framebuffer...
==============================================================================
--- trunk/netsurf/Docs/BUILDING-Framebuffer (original)
+++ trunk/netsurf/Docs/BUILDING-Framebuffer Tue Mar 1 09:40:30 2011
@@ -279,22 +279,6 @@
|
| For more information, consult the libparserutils README file.
- Libhpdf
----------
-
- NetSurf can use Haru PDF to enable PDF export and printing in GTK. This
- is currently enabled by default, and cannot be auto-detected by the Makefile.
- If you wish to disable it, do so by creating a Makefile.config file.
-
- Haru PDF can be obtained from http://libharu.org/, although we currently
- depend on features that none of the official released versions does have.
- The current development versions of libharu are fine and we anticipate
- the libharu 2.2 release will be fine for NetSurf usage.
- A recently taken snapshot of one of those libharu development versions can
- be found at:
-
- svn://svn.netsurf-browser.org/trunk/libharu
-
General requirements
----------------------
Modified: trunk/netsurf/Docs/BUILDING-GTK
URL: http://source.netsurf-browser.org/trunk/netsurf/Docs/BUILDING-GTK?rev=118...
==============================================================================
--- trunk/netsurf/Docs/BUILDING-GTK (original)
+++ trunk/netsurf/Docs/BUILDING-GTK Tue Mar 1 09:40:30 2011
@@ -127,21 +127,14 @@
|
| For more information, consult the libparserutils README file.
- Libhpdf
+ Libharu
---------
- NetSurf can use Haru PDF to enable PDF export and printing in GTK. This
- is currently enabled by default, and cannot be auto-detected by the Makefile.
- If you wish to disable it, do so by creating a Makefile.config file.
+ NetSurf can use Haru PDF to enable PDF export. Haru PDF can be obtained
+ from http://libharu.org/. We require libharu 2.2 or later.
- Haru PDF can be obtained from http://libharu.org/, although we currently
- depend on features that none of the official released versions does have.
- The current development versions of libharu are fine and we anticipate
- the libharu 2.2 release will be fine for NetSurf usage.
- A recently taken snapshot of one of those libharu development versions can
- be found at:
-
- svn://svn.netsurf-browser.org/trunk/libharu
+ | Note: libharu cannot be auto-detected by the Makefile. If you wish to
+ | enable it, do so by creating a Makefile.config file.
General requirements
----------------------
12 years, 3 months
r11870 vince - in /trunk/netsurf: amiga/context_menu.c amiga/gui.c atari/browser_win.c atari/gui.c desktop/gui.h framebuffer/gui.c gtk/window.c riscos/window.c windows/gui.c
by netsurf@semichrome.net
Author: vince
Date: Tue Mar 1 08:31:54 2011
New Revision: 11870
URL: http://source.netsurf-browser.org?rev=11870&view=rev
Log:
remove obsolete, unused gui_window_redraw API
Modified:
trunk/netsurf/amiga/context_menu.c
trunk/netsurf/amiga/gui.c
trunk/netsurf/atari/browser_win.c
trunk/netsurf/atari/gui.c
trunk/netsurf/desktop/gui.h
trunk/netsurf/framebuffer/gui.c
trunk/netsurf/gtk/window.c
trunk/netsurf/riscos/window.c
trunk/netsurf/windows/gui.c
Modified: trunk/netsurf/amiga/context_menu.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/context_menu.c?rev=...
==============================================================================
--- trunk/netsurf/amiga/context_menu.c (original)
+++ trunk/netsurf/amiga/context_menu.c Tue Mar 1 08:31:54 2011
@@ -420,7 +420,9 @@
box->gadget->value = utf8_fn;
box_coords(box, (int *)&x, (int *)&y);
- gui_window_redraw(gwin->bw->window,x,y,
+ ami_do_redraw_limits(gwin->bw->window,
+ gwin->bw->window->shared->bw,
+ x,y,
x + box->width,
y + box->height);
}
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=11870&r1=...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Tue Mar 1 08:31:54 2011
@@ -1747,7 +1747,8 @@
file_box->gadget->value = utf8_fn;
box_coords(file_box, (int *)&x, (int *)&y);
- gui_window_redraw(gwin->bw->window,x,y,
+ ami_do_redraw_limits(gwin->bw->window,
+ gwin->bw->window->shared->bw, x, y,
x + file_box->width,
y + file_box->height);
}
@@ -3152,18 +3153,6 @@
current_redraw_browser = NULL;
}
-void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
-{
- ULONG sx,sy;
- struct browser_window *bw;
-
- if(!g) return;
-
- bw = g->shared->bw;
-
- ami_do_redraw_limits(g, bw, x0, y0, x1, y1);
-}
-
void gui_window_redraw_window(struct gui_window *g)
{
ULONG cur_tab = 0;
Modified: trunk/netsurf/atari/browser_win.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/browser_win.c?rev=1...
==============================================================================
--- trunk/netsurf/atari/browser_win.c (original)
+++ trunk/netsurf/atari/browser_win.c Tue Mar 1 08:31:54 2011
@@ -451,7 +451,7 @@
file_box->gadget->value = utf8_fn;
/* Redraw box. */
box_coords(file_box, &posx, &posy);
- gui_window_redraw(bw->window,
+ browser_schedule_redraw(bw->window,
posx - gw->browser->scroll.current.x,
posy - gw->browser->scroll.current.y,
posx - gw->browser->scroll.current.x + file_box->width,
Modified: trunk/netsurf/atari/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/gui.c?rev=11870&r1=...
==============================================================================
--- trunk/netsurf/atari/gui.c (original)
+++ trunk/netsurf/atari/gui.c Tue Mar 1 08:31:54 2011
@@ -363,13 +363,6 @@
window_set_stauts( w , (char*)text );
}
-void gui_window_redraw(struct gui_window *gw, int x0, int y0, int x1, int y1)
-{
- if (gw == NULL)
- return;
- browser_schedule_redraw( gw, x0, y0, x1, y1 );
-}
-
void gui_window_redraw_window(struct gui_window *gw)
{
CMP_BROWSER b;
Modified: trunk/netsurf/desktop/gui.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/gui.h?rev=11870&r...
==============================================================================
--- trunk/netsurf/desktop/gui.h (original)
+++ trunk/netsurf/desktop/gui.h Tue Mar 1 08:31:54 2011
@@ -77,7 +77,6 @@
struct browser_window *gui_window_get_browser_window(struct gui_window *g);
void gui_window_destroy(struct gui_window *g);
void gui_window_set_title(struct gui_window *g, const char *title);
-void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1);
void gui_window_redraw_window(struct gui_window *g);
void gui_window_update_box(struct gui_window *g,
const union content_msg_data *data);
Modified: trunk/netsurf/framebuffer/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/gui.c?rev=118...
==============================================================================
--- trunk/netsurf/framebuffer/gui.c (original)
+++ trunk/netsurf/framebuffer/gui.c Tue Mar 1 08:31:54 2011
@@ -1302,12 +1302,6 @@
}
void
-gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
-{
- fb_queue_redraw(g->browser, x0, y0, x1, y1);
-}
-
-void
gui_window_redraw_window(struct gui_window *g)
{
fb_queue_redraw(g->browser, 0, 0, fbtk_get_width(g->browser), fbtk_get_height(g->browser) );
Modified: trunk/netsurf/gtk/window.c
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/window.c?rev=11870&r1...
==============================================================================
--- trunk/netsurf/gtk/window.c (original)
+++ trunk/netsurf/gtk/window.c Tue Mar 1 08:31:54 2011
@@ -798,23 +798,36 @@
}
+
static void nsgtk_redraw_caret(struct gui_window *g)
{
+ int sx, sy;
+
if (g->careth == 0)
return;
- gui_window_redraw(g, g->caretx, g->carety,
- g->caretx, g->carety + g->careth);
-}
-
-void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
+ gui_window_get_scroll(g, &sx, &sy);
+
+ gtk_widget_queue_draw_area(GTK_WIDGET(g->layout),
+ g->caretx - sx, g->carety - sy, 1, g->careth + 1);
+
+}
+
+void gui_window_remove_caret(struct gui_window *g)
{
int sx, sy;
+ int oh = g->careth;
+
+ if (oh == 0)
+ return;
+
+ g->careth = 0;
gui_window_get_scroll(g, &sx, &sy);
gtk_widget_queue_draw_area(GTK_WIDGET(g->layout),
- x0 - sx, y0 - sy, x1-x0+1, y1-y0+1);
+ g->caretx - sx, g->carety - sy, 1, oh + 1);
+
}
void gui_window_redraw_window(struct gui_window *g)
@@ -1049,19 +1062,6 @@
gtk_widget_grab_focus(GTK_WIDGET(g->layout));
}
-void gui_window_remove_caret(struct gui_window *g)
-{
- int oh = g->careth;
-
- if (oh == 0)
- return;
-
- g->careth = 0;
-
- gui_window_redraw(g, g->caretx, g->carety,
- g->caretx, g->carety + oh);
-}
-
void gui_window_new_content(struct gui_window *g)
{
Modified: trunk/netsurf/riscos/window.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/window.c?rev=11870...
==============================================================================
--- trunk/netsurf/riscos/window.c (original)
+++ trunk/netsurf/riscos/window.c Tue Mar 1 08:31:54 2011
@@ -716,31 +716,6 @@
/**
- * Force a redraw of part of the contents of a browser window.
- *
- * \param g gui_window to redraw
- * \param x0 rectangle to redraw
- * \param y0 rectangle to redraw
- * \param x1 rectangle to redraw
- * \param y1 rectangle to redraw
- */
-
-void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
-{
- os_error *error;
-
- assert(g);
-
- error = xwimp_force_redraw(g->window, x0 * 2, -y1 * 2, x1 * 2, -y0 * 2);
- if (error) {
- LOG(("xwimp_force_redraw: 0x%x: %s",
- error->errnum, error->errmess));
- warn_user("WimpError", error->errmess);
- }
-}
-
-
-/**
* Force a redraw of the entire contents of a browser window.
*
* \param g gui_window to redraw
@@ -3444,9 +3419,15 @@
/* Redraw box. */
box_coords(file_box, &pos.x, &pos.y);
- gui_window_redraw(bw->window, pos.x, pos.y,
- pos.x + file_box->width,
- pos.y + file_box->height);
+
+ error = xwimp_force_redraw(bw->window->window,
+ pos.x * 2, -(pos.y + file_box->height) * 2,
+ (pos.x + file_box->width) * 2, -pos.y * 2);
+ if (error) {
+ LOG(("xwimp_force_redraw: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ }
} else {
const char *filename = message->data.data_xfer.file_name;
Modified: trunk/netsurf/windows/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/windows/gui.c?rev=11870&r...
==============================================================================
--- trunk/netsurf/windows/gui.c (original)
+++ trunk/netsurf/windows/gui.c Tue Mar 1 08:31:54 2011
@@ -883,9 +883,12 @@
struct rect clip;
PAINTSTRUCT ps;
- plot_hdc = BeginPaint(hwnd, &ps);
+ BeginPaint(hwnd, &ps);
if (gw != NULL) {
+
+ plot_hdc = ps.hdc;
+
clip.x0 = ps.rcPaint.left;
clip.y0 = ps.rcPaint.top;
clip.x1 = ps.rcPaint.right;
@@ -2044,30 +2047,11 @@
}
/**
- * redraw a rectangle of the window
- */
-void gui_window_redraw(struct gui_window *w, int x0, int y0, int x1, int y1)
-{
- RECT redrawrect;
-
- LOG(("redraw %p %d,%d %d,%d", w, x0, y0, x1, y1));
- if (w == NULL)
- return;
-
- redrawrect.left = x0;
- redrawrect.top = y0;
- redrawrect.right = x1;
- redrawrect.bottom = y1;
-
- RedrawWindow(w->drawingarea, &redrawrect, NULL, RDW_INVALIDATE | RDW_NOERASE);
-}
-
-/**
* redraw the whole window
*/
void gui_window_redraw_window(struct gui_window *gw)
{
- LOG(("redraw window %p", gw));
+ /* LOG(("gw:%p", gw)); */
if (gw == NULL)
return;
@@ -2077,13 +2061,15 @@
void gui_window_update_box(struct gui_window *gw,
const union content_msg_data *data)
{
+ /* LOG(("gw:%p %f,%f %f,%f", gw, data->redraw.x, data->redraw.y, data->redraw.width, data->redraw.height)); */
+
if (gw == NULL)
return;
RECT redrawrect;
- redrawrect.left = (long)data->redraw.x;
- redrawrect.top = (long)data->redraw.y;
+ redrawrect.left = (long)data->redraw.x - (gw->scrollx / gw->bw->scale);
+ redrawrect.top = (long)data->redraw.y - (gw->scrolly / gw->bw->scale);
redrawrect.right =(long)(data->redraw.x + data->redraw.width);
redrawrect.bottom = (long)(data->redraw.y + data->redraw.height);
12 years, 3 months
r11869 tlsa - /trunk/netsurf/render/layout.c
by netsurf@semichrome.net
Author: tlsa
Date: Tue Mar 1 07:42:27 2011
New Revision: 11869
URL: http://source.netsurf-browser.org?rev=11869&view=rev
Log:
Split splitting out into layout_text_box_split().
Modified:
trunk/netsurf/render/layout.c
Modified: trunk/netsurf/render/layout.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/layout.c?rev=11869...
==============================================================================
--- trunk/netsurf/render/layout.c (original)
+++ trunk/netsurf/render/layout.c Tue Mar 1 07:42:27 2011
@@ -1901,6 +1901,63 @@
/**
+ * Split a text box.
+ *
+ * \param content memory pool for any new boxes
+ * \param fstyle style for text in text box
+ * \param split_box box with text to split
+ * \param new_length new length for text in split_box, after splitting
+ * \param new_width new width for text in split_box, after splitting
+ * \return true on success, false on memory exhaustion
+ *
+ * A new box is created and inserted into the box tree after split_box,
+ * containing the text after new_length excluding the initial space character.
+ */
+
+static bool layout_text_box_split(struct content *content,
+ plot_font_style_t *fstyle, struct box *split_box,
+ size_t new_length, int new_width)
+{
+ int space_width;
+ struct box *c2;
+ const struct font_functions *font_func = content->data.html.font_func;
+
+ /* Create clone of split_box, c2 */
+ c2 = talloc_memdup(content, split_box, sizeof *c2);
+ if (!c2)
+ return false;
+ c2->clone = 1;
+
+ /* Add copy of the split text to c2 */
+ c2->text = talloc_strndup(content, split_box->text + new_length + 1,
+ split_box->length - (new_length + 1));
+ if (!c2->text)
+ return false;
+
+ /* Set c2 according to the remaining text */
+ font_func->font_width(fstyle, " ", 1, &space_width);
+ c2->width -= new_width + space_width;
+ c2->length = split_box->length - (new_length + 1);
+
+ /* Update split_box for its reduced text */
+ split_box->length = new_length;
+ split_box->width = new_width;
+ split_box->space = 1;
+
+ /* Insert c2 into box list */
+ c2->next = split_box->next;
+ split_box->next = c2;
+ c2->prev = split_box;
+ if (c2->next)
+ c2->next->prev = c2;
+ else
+ c2->parent->last = c2;
+
+ return true;
+}
+
+
+/**
* Position a line of boxes in inline formatting context.
*
* \param first box at start of line
@@ -2362,7 +2419,6 @@
unsigned int i;
size_t space = 0;
int w;
- struct box * c2;
x = x_previous;
@@ -2409,42 +2465,10 @@
b = split_box->next;
} else {
/* cut off first word for this line */
- int space_width;
-
- /* Create clone of split_box, c2 */
- c2 = talloc_memdup(content, split_box,
- sizeof *c2);
- if (!c2)
+ if (!layout_text_box_split(content, &fstyle,
+ split_box, space, w))
return false;
- c2->clone = 1;
-
- /* Add copy of the split text to c2 */
- c2->text = talloc_strndup(content,
- split_box->text + space + 1,
- split_box->length -(space + 1));
- if (!c2->text)
- return false;
-
- /* Set c2 according to the remaining text */
- font_func->font_width(&fstyle, " ", 1,
- &space_width);
- c2->width -= w + space_width;
- c2->length = split_box->length - (space + 1);
-
- /* Update split_box for its reduced text */
- split_box->length = space;
- split_box->width = w;
- split_box->space = 1;
-
- /* Insert c2 into box list */
- c2->next = split_box->next;
- split_box->next = c2;
- c2->prev = split_box;
- if (c2->next)
- c2->next->prev = c2;
- else
- c2->parent->last = c2;
- b = c2;
+ b = split_box->next;
}
x += space_before + w;
LOG(("forcing"));
@@ -2484,42 +2508,10 @@
if (space == 0)
space = 1;
if (space != split_box->length) {
- int space_width;
-
- /* Create clone of split_box, c2 */
- c2 = talloc_memdup(content, split_box,
- sizeof *c2);
- if (!c2)
+ if (!layout_text_box_split(content, &fstyle,
+ split_box, space, w))
return false;
- c2->clone = 1;
-
- /* Add copy of the split text to c2 */
- c2->text = talloc_strndup(content,
- split_box->text + space + 1,
- split_box->length -(space + 1));
- if (!c2->text)
- return false;
-
- /* Set c2 according to the remaining text */
- font_func->font_width(&fstyle, " ", 1,
- &space_width);
- c2->width -= w + space_width;
- c2->length = split_box->length - (space + 1);
-
- /* Update split_box for its reduced text */
- split_box->length = space;
- split_box->width = w;
- split_box->space = 1;
-
- /* Insert c2 into box list */
- c2->next = split_box->next;
- split_box->next = c2;
- c2->prev = split_box;
- if (c2->next)
- c2->next->prev = c2;
- else
- c2->parent->last = c2;
- b = c2;
+ b = split_box->next;
}
x += space_before + w;
LOG(("fitting words"));
12 years, 3 months