summaryrefslogtreecommitdiff
path: root/framebuffer/fb_gui.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2009-02-24 12:32:28 +0000
committerVincent Sanders <vince@netsurf-browser.org>2009-02-24 12:32:28 +0000
commitb6c4a4589f8147ea7f5ee2882fa1dd99715d579c (patch)
treee601f718254f14f2dd6854ab8d8650b2fd7ccc37 /framebuffer/fb_gui.c
parent5d2c6f8ad90084584831c7f489d6ef89a8779120 (diff)
downloadnetsurf-b6c4a4589f8147ea7f5ee2882fa1dd99715d579c.tar.gz
netsurf-b6c4a4589f8147ea7f5ee2882fa1dd99715d579c.tar.bz2
Fix horizontal panning
Fix linux fb keymap svn path=/trunk/netsurf/; revision=6613
Diffstat (limited to 'framebuffer/fb_gui.c')
-rw-r--r--framebuffer/fb_gui.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/framebuffer/fb_gui.c b/framebuffer/fb_gui.c
index d871efa38..cb88a7b7f 100644
--- a/framebuffer/fb_gui.c
+++ b/framebuffer/fb_gui.c
@@ -85,6 +85,14 @@ static void fb_pan(struct gui_window *g)
if ((g->scrolly + g->pany) > (c->height - g->height))
g->pany = (c->height - g->height) - g->scrolly;
+ /* dont pan off the left */
+ if ((g->scrollx + g->panx) < 0)
+ g->panx = - g->scrollx;
+
+ /* do not pan off the right of the content */
+ if ((g->scrollx + g->panx) > (c->width - g->width))
+ g->panx = (c->width - g->width) - g->scrollx;
+
LOG(("panning %d, %d",g->panx, g->pany));
/* pump up the volume. dance, dance! lets do it */
@@ -117,6 +125,36 @@ static void fb_pan(struct gui_window *g)
g->width, g->height);
}
+ if (g->panx < 0) {
+ /* we cannot pan more than a window width at a time */
+ if (g->panx < -g->width)
+ g->panx = -g->width;
+
+ LOG(("panning left %d", g->panx));
+
+ fb_plotters_move_block(g->x, g->y,
+ g->width + g->panx, g->height ,
+ g->x - g->panx, g->y );
+ g->scrollx += g->panx;
+ fb_queue_redraw(g, 0, 0,
+ - g->panx, g->height);
+ }
+
+ if (g->panx > 0) {
+ /* we cannot pan more than a window width at a time */
+ if (g->panx > g->width)
+ g->panx = g->width;
+
+ LOG(("panning right %d", g->panx));
+
+ fb_plotters_move_block(g->x + g->panx, g->y,
+ g->width - g->panx, g->height,
+ g->x, g->y);
+ g->scrollx += g->panx;
+ fb_queue_redraw(g, g->width - g->panx, 0,
+ g->width, g->height);
+ }
+
g->pan_required = false;
g->panx = 0;
g->pany = 0;
@@ -270,7 +308,9 @@ void gui_poll(bool active)
if (redraws_pending == true) {
struct gui_window *g;
- fb_cursor_move(framebuffer, fb_cursor_x(framebuffer), fb_cursor_y(framebuffer));
+ fb_cursor_move(framebuffer,
+ fb_cursor_x(framebuffer),
+ fb_cursor_y(framebuffer));
redraws_pending = false;