r13202 mono - in /trunk/netsurf/atari/plot: plotter.h plotter_vdi.c
by netsurf@semichrome.net
Author: mono
Date: Tue Nov 29 15:19:26 2011
New Revision: 13202
URL: http://source.netsurf-browser.org?rev=13202&view=rev
Log:
make use of non-blocking request for screen lock.
Modified:
trunk/netsurf/atari/plot/plotter.h
trunk/netsurf/atari/plot/plotter_vdi.c
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 Nov 29 15:19:26 2011
@@ -58,7 +58,7 @@
#define PLOT_FLAG_TRANS 0x08 /* true if the plotter supports transparent operations */
/* Flags for init_mfdb function: */
-#define MFDB_FLAG_STAND 0x01
+#define MFDB_FLAG_STAND 0x01
#define MFDB_FLAG_ZEROMEM 0x02
#define MFDB_FLAG_NOALLOC 0x04
@@ -91,7 +91,7 @@
typedef int (*_fpmf_pixel_pos)( FONT_PLOTTER self, const plot_font_style_t *fstyle,
const char *string, size_t length,
int x, size_t *char_offset, int *actual_x);
-typedef int (*_fpmf_text)( FONT_PLOTTER self, int x, int y, const char *text,
+typedef int (*_fpmf_text)( FONT_PLOTTER self, int x, int y, const char *text,
size_t length, const plot_font_style_t *fstyle);
typedef int (*_fpmf_dtor)( FONT_PLOTTER self );
@@ -156,9 +156,9 @@
/* declaration of plotter member functions ( _pmf_ prefix )*/
typedef int (*_pmf_resize)(GEM_PLOTTER self, int w, int h);
typedef int (*_pmf_move)(GEM_PLOTTER self, short x, short y );
-typedef void * (*_pmf_lock)(GEM_PLOTTER self);
typedef void * (*_pmf_create_framebuffer)(GEM_PLOTTER self);
-typedef void * (*_pmf_switch_to_framebuffer)(GEM_PLOTTER self);
+typedef void * (*_pmf_switch_to_framebuffer)(GEM_PLOTTER self);
+typedef int (*_pmf_lock)(GEM_PLOTTER self);
typedef int (*_pmf_unlock)(GEM_PLOTTER self);
typedef int (*_pmf_update_region)(GEM_PLOTTER self, GRECT region);
typedef int (*_pmf_update_screen_region)( GEM_PLOTTER self, GRECT region );
@@ -189,11 +189,11 @@
struct s_vdi_sysinfo * scr;
void * priv_data;
/* bit depth of framebuffers: */
- int bpp_virt;
+ int bpp_virt;
struct rect clipping;
struct s_frame_buf fbuf[MAX_FRAMEBUFS];
/* current framebuffer index: */
- int cfbi;
+ int cfbi;
FONT_PLOTTER font_plotter;
/* set new dimensions (realloc memory): */
@@ -310,19 +310,19 @@
short rgb_to_666_index(unsigned char r, unsigned char g, unsigned char b);
/*
- setup an MFDB struct and allocate memory for it when it is needed.
+ setup an MFDB struct and allocate memory for it when it is needed.
If bpp == 0, this function assumes that the MFDB shall point to the screen
- and will not allocate any memory (mfdb.fd_addr == 0).
- The function will return 0 when the memory allocation fails
+ and will not allocate any memory (mfdb.fd_addr == 0).
+ The function will return 0 when the memory allocation fails
( out of memory), otherwise it returns the size of the mfdb.fd_addr
- as number of bytes.
+ as number of bytes.
*/
int init_mfdb(int bpp, int w, int h, uint32_t flags, MFDB * out );
/* shared / static methods follows */
/*
- Get clipping for current framebuffer
+ Get clipping for current framebuffer
*/
int plotter_get_clip( GEM_PLOTTER self, struct rect * out );
@@ -332,7 +332,7 @@
void plotter_get_clip_grect( GEM_PLOTTER self, GRECT * out );
/*
- Get current visible coords
+ Get current visible coords
*/
void plotter_get_visible_grect( GEM_PLOTTER self, GRECT * out );
@@ -343,7 +343,7 @@
/*
- convert framebuffer clipping to vdi clipping and activates it
+ convert framebuffer clipping to vdi clipping and activates it
*/
void plotter_vdi_clip( GEM_PLOTTER self, bool set);
@@ -359,20 +359,20 @@
/* some Well known indexes into the VDI palette */
/* common indexes into the VDI palette */
/* (only used when running with 256 colors or less ) */
-#define OFFSET_WEB_PAL 16
+#define OFFSET_WEB_PAL 16
#define OFFSET_CUST_PAL 232
#define OFFSET_CUSTOM_COLOR 255 /* this one is used by the TC renderer */
#define RGB_TO_VDI(c) rgb_to_666_index( (c&0xFF),(c&0xFF00)>>8,(c&0xFF0000)>>16)+OFFSET_WEB_PAL
-#define ABGR_TO_RGB(c) ( ((c&0xFF)<<16) | (c&0xFF00) | ((c&0xFF0000)>>16) ) << 8
+#define ABGR_TO_RGB(c) ( ((c&0xFF)<<16) | (c&0xFF00) | ((c&0xFF0000)>>16) ) << 8
/* calculate MFDB compatible rowstride (in number of bits) */
#define MFDB_STRIDE( w ) (((w & 15) != 0) ? (w | 15)+1 : w)
-/*
+/*
Calculate size of an mfdb, params:
- Bits per pixel,
- Word aligned rowstride (width) as returned by MFDB_STRIDE,
- height in pixels
+ Bits per pixel,
+ Word aligned rowstride (width) as returned by MFDB_STRIDE,
+ height in pixels
*/
#define MFDB_SIZE( bpp, stride, h ) ( ((stride >> 3) * h) * bpp )
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 Nov 29 15:19:26 2011
@@ -49,7 +49,7 @@
static int dtor( GEM_PLOTTER self );
static int resize( GEM_PLOTTER self, int w, int h );
static int move( GEM_PLOTTER self, short x, short y );
-static void * lock( GEM_PLOTTER self );
+static int lock( GEM_PLOTTER self );
static int unlock( GEM_PLOTTER self );
static int update_region( GEM_PLOTTER self, GRECT region );
static int update_screen_region( GEM_PLOTTER self, GRECT region );
@@ -307,19 +307,25 @@
}
-static void * lock( GEM_PLOTTER self )
-{
- LOG(("%s: %s\n", (char*)__FILE__, __FUNCTION__));
+static int lock( GEM_PLOTTER self )
+{
+ LOG(("%s: %s\n", (char*)__FILE__, __FUNCTION__));
+ if( (self->flags & PLOT_FLAG_LOCKED) != 0 )
+ return(1);
self->flags |= PLOT_FLAG_LOCKED;
- wind_update(BEG_UPDATE);
- wind_update(BEG_MCTRL);
+ if( !wind_update(BEG_UPDATE|0x100) )
+ return(0);
+ if( !wind_update(BEG_MCTRL|0x100) )
+ return(0);
graf_mouse(M_OFF, NULL);
- return( NULL );
+ return( 1 );
}
static int unlock( GEM_PLOTTER self )
{
- LOG(("%s: %s\n", (char*)__FILE__, __FUNCTION__));
+ LOG(("%s: %s\n", (char*)__FILE__, __FUNCTION__));
+ if( (self->flags & PLOT_FLAG_LOCKED) == 0 )
+ return(1);
self->flags &= ~PLOT_FLAG_LOCKED;
wind_update(END_MCTRL);
wind_update(END_UPDATE);
11 years, 6 months
r13201 chris_y - /trunk/netsurf/amiga/gui.c
by netsurf@semichrome.net
Author: chris_y
Date: Tue Nov 29 14:58:57 2011
New Revision: 13201
URL: http://source.netsurf-browser.org?rev=13201&view=rev
Log:
Pass mouse scrollwheel events to the core first
Modified:
trunk/netsurf/amiga/gui.c
Modified: trunk/netsurf/amiga/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/gui.c?rev=13201&r1=...
==============================================================================
--- trunk/netsurf/amiga/gui.c (original)
+++ trunk/netsurf/amiga/gui.c Tue Nov 29 14:58:57 2011
@@ -984,6 +984,36 @@
{
gwin->key_state |= BROWSER_MOUSE_MOD_3;
}
+}
+
+bool ami_mouse_to_ns_coords(struct gui_window_2 *gwin, int *x, int *y)
+{
+ int xs, ys;
+ int ns_x, ns_y;
+ struct IBox *bbox;
+
+ GetAttr(SPACE_AreaBox, (Object *)gwin->objects[GID_BROWSER],
+ (ULONG *)&bbox);
+
+ ns_x = (ULONG)(gwin->win->MouseX - bbox->Left);
+ ns_y = (ULONG)(gwin->win->MouseY - bbox->Top);
+
+ if((ns_x < 0) || (ns_x > bbox->Width) || (ns_y < 0) || (ns_y > bbox->Height))
+ return false;
+
+ ns_x /= gwin->bw->scale;
+ ns_y /= gwin->bw->scale;
+
+ ami_get_hscroll_pos(gwin, (ULONG *)&xs);
+ ami_get_vscroll_pos(gwin, (ULONG *)&ys);
+
+ ns_x += xs;
+ ns_y += ys;
+
+ *x = ns_x;
+ *y = ns_y;
+
+ return true;
}
void ami_handle_msg(void)
@@ -3853,7 +3883,8 @@
void ami_scroller_hook(struct Hook *hook,Object *object,struct IntuiMessage *msg)
{
- ULONG gid,x,y;
+ ULONG gid;
+ int x, y;
struct gui_window_2 *gwin = hook->h_Data;
struct IntuiWheelData *wheel;
Object *reqrefresh = NULL;
@@ -3866,21 +3897,11 @@
case IDCMP_IDCMPUPDATE:
gid = GetTagData( GA_ID, 0, msg->IAddress );
-/*
- if(reqrefresh = GetTagData( LAYOUT_RequestRefresh, 0, msg->IAddress ))
- {
- printf("LAYOUT_RequestRefresh\n");
- }
-*/
-
switch( gid )
{
case GID_HSCROLL:
case OID_HSCROLL:
case OID_VSCROLL:
-// history_set_current_scroll(gwin->bw->history,
-// gwin->bw->window->scrollx,gwin->bw->window->scrolly);
-
if(option_faster_scroll == true) gwin->redraw_scroll = true;
else gwin->redraw_scroll = false;
@@ -3894,9 +3915,16 @@
{
wheel = (struct IntuiWheelData *)msg->IAddress;
- gui_window_set_scroll(gwin->bw->window,
- gwin->bw->window->scrollx + (wheel->WheelX * 50),
- gwin->bw->window->scrolly + (wheel->WheelY * 50));
+ if(ami_mouse_to_ns_coords(gwin, &x, &y) == true)
+ {
+ if(browser_window_scroll_at_point(gwin->bw, x, y,
+ wheel->WheelX * 50, wheel->WheelY * 50) == false)
+ {
+ gui_window_set_scroll(gwin->bw->window,
+ gwin->bw->window->scrollx + (wheel->WheelX * 50),
+ gwin->bw->window->scrolly + (wheel->WheelY * 50));
+ }
+ }
}
break;
11 years, 6 months
r13200 tlsa - in /trunk/netsurf: content/content.c content/content.h content/content_protected.h desktop/browser.c render/html.c
by netsurf@semichrome.net
Author: tlsa
Date: Tue Nov 29 11:47:29 2011
New Revision: 13200
URL: http://source.netsurf-browser.org?rev=13200&view=rev
Log:
Pass scroll wheel action into contents. Handle scrolling of box scrollbars and iframes.
Modified:
trunk/netsurf/content/content.c
trunk/netsurf/content/content.h
trunk/netsurf/content/content_protected.h
trunk/netsurf/desktop/browser.c
trunk/netsurf/render/html.c
Modified: trunk/netsurf/content/content.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content.c?rev=132...
==============================================================================
--- trunk/netsurf/content/content.c (original)
+++ trunk/netsurf/content/content.c Tue Nov 29 11:47:29 2011
@@ -733,6 +733,19 @@
}
+bool content_scroll_at_point(struct hlcache_handle *h,
+ int x, int y, int scrx, int scry)
+{
+ struct content *c = hlcache_handle_get_content(h);
+ assert(c != 0);
+
+ if (c->handler->scroll_at_point != NULL)
+ return c->handler->scroll_at_point(c, x, y, scrx, scry);
+
+ return false;
+}
+
+
void content_add_error(struct content *c, const char *token,
unsigned int line)
{
Modified: trunk/netsurf/content/content.h
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content.h?rev=132...
==============================================================================
--- trunk/netsurf/content/content.h (original)
+++ trunk/netsurf/content/content.h Tue Nov 29 11:47:29 2011
@@ -175,6 +175,8 @@
struct selection *content_get_selection(struct hlcache_handle *h);
void content_get_contextual_content(struct hlcache_handle *h,
int x, int y, struct contextual_content *data);
+bool content_scroll_at_point(struct hlcache_handle *h,
+ int x, int y, int scrx, int scry);
struct content_rfc5988_link *content_find_rfc5988_link(struct hlcache_handle *c,
lwc_string *rel);
Modified: trunk/netsurf/content/content_protected.h
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content_protected...
==============================================================================
--- trunk/netsurf/content/content_protected.h (original)
+++ trunk/netsurf/content/content_protected.h Tue Nov 29 11:47:29 2011
@@ -68,7 +68,9 @@
void (*close)(struct content *c);
struct selection * (*get_selection)(struct content *c);
void (*get_contextual_content)(struct content *c, int x, int y,
- struct contextual_content *data);
+ struct contextual_content *data);
+ bool (*scroll_at_point)(struct content *c, int x, int y,
+ int scrx, int scry);
nserror (*clone)(const struct content *old, struct content **newc);
bool (*matches_quirks)(const struct content *c, bool quirks);
content_type (*type)(void);
Modified: trunk/netsurf/desktop/browser.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.c?rev=132...
==============================================================================
--- trunk/netsurf/desktop/browser.c (original)
+++ trunk/netsurf/desktop/browser.c Tue Nov 29 11:47:29 2011
@@ -557,8 +557,11 @@
}
}
- /* TODO:
- * Pass scroll to content to try scrolling something at this point */
+ /* Try to scroll any current content */
+ if (bw->current_content != NULL && content_scroll_at_point(
+ bw->current_content, x, y, scrx, scry) == true)
+ /* Scroll handled by current content */
+ return true;
/* Try to scroll this window, if scroll not already handled */
if (handled_scroll == false) {
Modified: trunk/netsurf/render/html.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/html.c?rev=13200&r...
==============================================================================
--- trunk/netsurf/render/html.c (original)
+++ trunk/netsurf/render/html.c Tue Nov 29 11:47:29 2011
@@ -34,6 +34,7 @@
#include "desktop/browser.h"
#include "desktop/options.h"
#include "desktop/selection.h"
+#include "desktop/scrollbar.h"
#include "image/bitmap.h"
#include "render/box.h"
#include "render/font.h"
@@ -78,6 +79,8 @@
struct selection *html_get_selection(struct content *c);
static void html_get_contextual_content(struct content *c,
int x, int y, struct contextual_content *data);
+static bool html_scroll_at_point(struct content *c,
+ int x, int y, int scrx, int scry);
struct search_context *html_get_search(struct content *c);
static nserror html_clone(const struct content *old, struct content **newc);
static content_type html_content_type(void);
@@ -124,6 +127,7 @@
.close = html_close,
.get_selection = html_get_selection,
.get_contextual_content = html_get_contextual_content,
+ .scroll_at_point = html_scroll_at_point,
.clone = html_clone,
.type = html_content_type,
.no_share = true,
@@ -2264,6 +2268,56 @@
/**
+ * Scroll deepest thing within the content which can be scrolled at given point
+ *
+ * \param c html content to look inside
+ * \param x x-coordinate of point of interest
+ * \param y y-coordinate of point of interest
+ * \param scrx x-coordinate of point of interest
+ * \param scry y-coordinate of point of interest
+ * \return true iff scroll was consumed by something in the content
+ */
+bool html_scroll_at_point(struct content *c, int x, int y, int scrx, int scry)
+{
+ html_content *html = (html_content *) c;
+
+ struct box *box = html->layout;
+ struct box *next;
+ int box_x = 0, box_y = 0;
+ hlcache_handle *containing_content = NULL;
+ bool handled_scroll = false;
+
+ /* TODO: invert order; visit deepest box first */
+
+ while ((next = box_at_point(box, x, y, &box_x, &box_y,
+ &containing_content)) != NULL) {
+ box = next;
+
+ if (box->style && css_computed_visibility(box->style) ==
+ CSS_VISIBILITY_HIDDEN)
+ continue;
+
+ /* Pass into iframe */
+ if (box->iframe && browser_window_scroll_at_point(box->iframe,
+ x - box_x, y - box_y, scrx, scry) == true)
+ return true;
+
+ /* Handle box scrollbars */
+ if (box->scroll_y && scrollbar_scroll(box->scroll_y, scry))
+ handled_scroll = true;
+
+ if (box->scroll_x && scrollbar_scroll(box->scroll_x, scrx))
+ handled_scroll = true;
+
+ if (handled_scroll == true)
+ return true;
+ }
+
+ return false;
+}
+
+
+/**
* Set an HTML content's search context
*
* \param c content of type html
11 years, 6 months
r13199 tlsa - /trunk/netsurf/gtk/window.c
by netsurf@semichrome.net
Author: tlsa
Date: Tue Nov 29 09:17:35 2011
New Revision: 13199
URL: http://source.netsurf-browser.org?rev=13199&view=rev
Log:
Call core to see if handles scroll wheel event first.
Modified:
trunk/netsurf/gtk/window.c
Modified: trunk/netsurf/gtk/window.c
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/window.c?rev=13199&r1...
==============================================================================
--- trunk/netsurf/gtk/window.c (original)
+++ trunk/netsurf/gtk/window.c Tue Nov 29 09:17:35 2011
@@ -322,6 +322,13 @@
switch (event->direction) {
case GDK_SCROLL_LEFT:
+ if (browser_window_scroll_at_point(g->bw,
+ event->x / g->bw->scale,
+ event->y / g->bw->scale,
+ -100, 0) == true)
+ /* Core handled it */
+ return TRUE;
+
scroll = hscroll;
value = gtk_adjustment_get_value(scroll) -
(scroll->step_increment * 2);
@@ -330,6 +337,13 @@
break;
case GDK_SCROLL_UP:
+ if (browser_window_scroll_at_point(g->bw,
+ event->x / g->bw->scale,
+ event->y / g->bw->scale,
+ 0, -100) == true)
+ /* Core handled it */
+ return TRUE;
+
scroll = vscroll;
value = gtk_adjustment_get_value(scroll) -
(scroll->step_increment * 2);
@@ -338,6 +352,13 @@
break;
case GDK_SCROLL_RIGHT:
+ if (browser_window_scroll_at_point(g->bw,
+ event->x / g->bw->scale,
+ event->y / g->bw->scale,
+ 100, 0) == true)
+ /* Core handled it */
+ return TRUE;
+
scroll = hscroll;
value = gtk_adjustment_get_value(scroll) +
(scroll->step_increment * 2);
@@ -346,12 +367,20 @@
break;
case GDK_SCROLL_DOWN:
+ if (browser_window_scroll_at_point(g->bw,
+ event->x / g->bw->scale,
+ event->y / g->bw->scale,
+ 0, 100) == true)
+ /* Core handled it */
+ return TRUE;
+
scroll = vscroll;
value = gtk_adjustment_get_value(scroll) +
(scroll->step_increment * 2);
if (value > scroll->upper - alloc->height)
value = scroll->upper - alloc->height;
break;
+
default:
return TRUE;
}
11 years, 6 months
r13198 tlsa - /trunk/netsurf/framebuffer/gui.c
by netsurf@semichrome.net
Author: tlsa
Date: Tue Nov 29 08:22:08 2011
New Revision: 13198
URL: http://source.netsurf-browser.org?rev=13198&view=rev
Log:
Call core to see if handles scroll wheel event first.
Modified:
trunk/netsurf/framebuffer/gui.c
Modified: trunk/netsurf/framebuffer/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/gui.c?rev=131...
==============================================================================
--- trunk/netsurf/framebuffer/gui.c (original)
+++ trunk/netsurf/framebuffer/gui.c Tue Nov 29 08:22:08 2011
@@ -585,12 +585,22 @@
case NSFB_KEY_MOUSE_4:
/* scroll up */
- widget_scroll_y(gw, -100, false);
+ scale = gw->bw->scale;
+ if (browser_window_scroll_at_point(gw->bw,
+ (cbi->x + bwidget->scrollx) / scale,
+ (cbi->y + bwidget->scrolly) / scale,
+ 0, -100) == false)
+ widget_scroll_y(gw, -100, false);
break;
case NSFB_KEY_MOUSE_5:
/* scroll down */
- widget_scroll_y(gw, 100, false);
+ scale = gw->bw->scale;
+ if (browser_window_scroll_at_point(gw->bw,
+ (cbi->x + bwidget->scrollx) / scale,
+ (cbi->y + bwidget->scrolly) / scale,
+ 0, 100) == false)
+ widget_scroll_y(gw, 100, false);
break;
default:
11 years, 6 months
r13197 tlsa - in /trunk/netsurf/desktop: browser.c browser.h
by netsurf@semichrome.net
Author: tlsa
Date: Tue Nov 29 08:20:25 2011
New Revision: 13197
URL: http://source.netsurf-browser.org?rev=13197&view=rev
Log:
New function for sending a scroll request into a core browser window at a given coordinate. Currently handles frames only. TODO: iframes and css overflow scrollable boxes. Front ends should call this to pass scroll wheel actions to the core.
Modified:
trunk/netsurf/desktop/browser.c
trunk/netsurf/desktop/browser.h
Modified: trunk/netsurf/desktop/browser.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.c?rev=131...
==============================================================================
--- trunk/netsurf/desktop/browser.c (original)
+++ trunk/netsurf/desktop/browser.c Tue Nov 29 08:20:25 2011
@@ -524,6 +524,52 @@
data->main = NULL;
browser_window__get_contextual_content(bw, x, y, data);
+}
+
+/* exported interface, documented in browser.h */
+bool browser_window_scroll_at_point(struct browser_window *bw,
+ int x, int y, int scrx, int scry)
+{
+ bool handled_scroll = false;
+ assert(bw != NULL);
+
+ if (bw->children) {
+ /* Browser window has children, so pass request on to
+ * appropriate child */
+ struct browser_window *bwc;
+ int cur_child;
+ int children = bw->rows * bw->cols;
+
+ /* Loop through all children of bw */
+ for (cur_child = 0; cur_child < children; cur_child++) {
+ /* Set current child */
+ bwc = &bw->children[cur_child];
+
+ /* Skip this frame if (x, y) coord lies outside */
+ if (x < bwc->x || bwc->x + bwc->width < x ||
+ y < bwc->y || bwc->y + bwc->height < y)
+ continue;
+
+ /* Pass request into this child */
+ return browser_window_scroll_at_point(bwc,
+ (x - bwc->x), (y - bwc->y),
+ scrx, scry);
+ }
+ }
+
+ /* TODO:
+ * Pass scroll to content to try scrolling something at this point */
+
+ /* Try to scroll this window, if scroll not already handled */
+ if (handled_scroll == false) {
+ if (bw->scroll_y && scrollbar_scroll(bw->scroll_y, scry))
+ handled_scroll = true;
+
+ if (bw->scroll_x && scrollbar_scroll(bw->scroll_x, scrx))
+ handled_scroll = true;
+ }
+
+ return handled_scroll;
}
Modified: trunk/netsurf/desktop/browser.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.h?rev=131...
==============================================================================
--- trunk/netsurf/desktop/browser.h (original)
+++ trunk/netsurf/desktop/browser.h Tue Nov 29 08:20:25 2011
@@ -249,6 +249,21 @@
void browser_window_get_contextual_content(struct browser_window *bw,
int x, int y, struct contextual_content *data);
+/**
+ * Send a scroll request to a browser window at a particular point. The
+ * 'deepest' scrollable object which can be scrolled in the requested
+ * direction at the given point will consume the scroll.
+ *
+ * \param bw browser window to look inside
+ * \param x x-coordinate of point of interest
+ * \param y y-coordinate of point of interest
+ * \param scrx number of px try to scroll something in x direction
+ * \param scry number of px try to scroll something in y direction
+ * \return true iff scroll request has been consumed
+ */
+bool browser_window_scroll_at_point(struct browser_window *bw,
+ int x, int y, int scrx, int scry);
+
void browser_window_refresh_url_bar(struct browser_window *bw, nsurl *url,
lwc_string *frag);
11 years, 6 months
r13196 tlsa - in /trunk/netsurf/desktop: scrollbar.c scrollbar.h
by netsurf@semichrome.net
Author: tlsa
Date: Tue Nov 29 08:16:26 2011
New Revision: 13196
URL: http://source.netsurf-browser.org?rev=13196&view=rev
Log:
New function for applying a change in offset to a scrollbar.
Modified:
trunk/netsurf/desktop/scrollbar.c
trunk/netsurf/desktop/scrollbar.h
Modified: trunk/netsurf/desktop/scrollbar.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/scrollbar.c?rev=1...
==============================================================================
--- trunk/netsurf/desktop/scrollbar.c (original)
+++ trunk/netsurf/desktop/scrollbar.c Tue Nov 29 08:16:26 2011
@@ -451,6 +451,53 @@
/*
* Exported function. Documented in scrollbar.h
*/
+bool scrollbar_scroll(struct scrollbar *s, int change)
+{
+ int well_length;
+ int old_offset = s->offset;
+ struct scrollbar_msg_data msg;
+
+ if (change == 0 || s->full_size <= s->visible_size)
+ /* zero scroll step, or unscrollable */
+ return false;
+
+ if (s->offset + change > s->full_size - s->visible_size)
+ s->offset = s->full_size - s->visible_size;
+ else if (s->offset + change < 0)
+ s->offset = 0;
+ else
+ s->offset += change;
+
+ if (s->offset == old_offset)
+ /* Nothing happened */
+ return false;
+
+ well_length = s->length - 2 * SCROLLBAR_WIDTH;
+ s->bar_pos = (s->full_size < 1) ? 0 :
+ ((well_length * s->offset) / s->full_size);
+
+ msg.scrollbar = s;
+ msg.msg = SCROLLBAR_MSG_MOVED;
+ msg.scroll_offset = s->offset;
+ s->client_callback(s->client_data, &msg);
+
+ msg.msg = SCROLLBAR_MSG_REDRAW;
+ msg.x0 = s->horizontal ? SCROLLBAR_WIDTH - 1 : 0;
+ msg.y0 = s->horizontal ? 0 : SCROLLBAR_WIDTH - 1;
+ msg.x1 = (s->horizontal ? s->length - SCROLLBAR_WIDTH + 1 :
+ SCROLLBAR_WIDTH);
+ msg.y1 = (s->horizontal ? SCROLLBAR_WIDTH :
+ s->length - SCROLLBAR_WIDTH + 1);
+
+ s->client_callback(s->client_data, &msg);
+
+ return true;
+}
+
+
+/*
+ * Exported function. Documented in scrollbar.h
+ */
int scrollbar_get_offset(struct scrollbar *s)
{
if (s == NULL)
Modified: trunk/netsurf/desktop/scrollbar.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/scrollbar.h?rev=1...
==============================================================================
--- trunk/netsurf/desktop/scrollbar.h (original)
+++ trunk/netsurf/desktop/scrollbar.h Tue Nov 29 08:16:26 2011
@@ -111,6 +111,15 @@
void scrollbar_set(struct scrollbar *s, int value, bool bar_pos);
/**
+ * Scroll the scrollbar by given amount.
+ *
+ * \param s the scrollbar to be scrolled
+ * \param change the change in scroll offset required (in px)
+ * \return true iff the scrollbar was moved.
+ */
+bool scrollbar_scroll(struct scrollbar *s, int change);
+
+/**
* Get the current scroll offset to the visible part of the full area.
*
* \param s the scrollbar to get the scroll offset value from
11 years, 6 months
r13195 vince - /branches/vince/netsurf-cairo/image/gif.c
by netsurf@semichrome.net
Author: vince
Date: Tue Nov 29 05:10:24 2011
New Revision: 13195
URL: http://source.netsurf-browser.org?rev=13195&view=rev
Log:
revert incorrect changes to gif bitmap_modified code
Modified:
branches/vince/netsurf-cairo/image/gif.c
Modified: branches/vince/netsurf-cairo/image/gif.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-cairo/image/gif....
==============================================================================
--- branches/vince/netsurf-cairo/image/gif.c (original)
+++ branches/vince/netsurf-cairo/image/gif.c Tue Nov 29 05:10:24 2011
@@ -297,8 +297,6 @@
bitmap_set_suspendable(gif->gif->frame_image, gif->gif,
nsgif_invalidate);
- bitmap_modified(gif->gif->frame_image);
-
/* Exit as a success */
content_set_ready(c);
content_set_done(c);
@@ -330,7 +328,6 @@
for (frame = previous_frame; frame <= current_frame; frame++) {
res = gif_decode_frame(gif->gif, frame);
- bitmap_modified(gif->gif->frame_image);
}
return res;
11 years, 6 months
r13193 tlsa - /trunk/netsurf/desktop/textarea.c
by netsurf@semichrome.net
Author: tlsa
Date: Tue Nov 29 04:40:30 2011
New Revision: 13193
URL: http://source.netsurf-browser.org?rev=13193&view=rev
Log:
Fix caret position after deleting selection. Thanks to Ole Loots.
Modified:
trunk/netsurf/desktop/textarea.c
Modified: trunk/netsurf/desktop/textarea.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/textarea.c?rev=13...
==============================================================================
--- trunk/netsurf/desktop/textarea.c (original)
+++ trunk/netsurf/desktop/textarea.c Tue Nov 29 04:40:30 2011
@@ -66,7 +66,7 @@
};
struct text_area {
-
+
int scroll_x, scroll_y; /**< scroll offsets of the textarea
* content
*/
@@ -726,7 +726,7 @@
* \param y1 bottom Y coordinate of redraw area
* \param ctx current redraw context
*/
-void textarea_redraw(struct text_area *ta, int x, int y,
+void textarea_redraw(struct text_area *ta, int x, int y,
const struct rect *clip, const struct redraw_context *ctx)
{
const struct plotter_table *plot = ctx->plot;
@@ -961,6 +961,8 @@
ta->selection_start,
ta->selection_end, ""))
return false;
+
+ caret = ta->selection_start;
ta->selection_start = ta->selection_end = -1;
redraw = true;
} else {
@@ -1124,6 +1126,7 @@
ta->selection_end, ""))
return false;
+ caret = ta->selection_start;
ta->selection_start = ta->selection_end = -1;
redraw = true;
} else {
@@ -1446,7 +1449,7 @@
}
/**
- * Set the dimensions of a textarea, causing a reflow and
+ * Set the dimensions of a textarea, causing a reflow and
* emitting a redraw request.
*
* \param width the new width of the textarea
11 years, 6 months