summaryrefslogtreecommitdiff
path: root/framebuffer
diff options
context:
space:
mode:
Diffstat (limited to 'framebuffer')
-rw-r--r--framebuffer/fb_cursor.c14
-rw-r--r--framebuffer/fb_findfile.c7
-rw-r--r--framebuffer/fb_frontend_ablefb.c1
-rw-r--r--framebuffer/fb_frontend_sdl.c35
-rw-r--r--framebuffer/fb_gui.c42
-rw-r--r--framebuffer/fb_plotters.c9
-rw-r--r--framebuffer/fb_rootwindow.c55
-rw-r--r--framebuffer/fb_rootwindow.h19
8 files changed, 159 insertions, 23 deletions
diff --git a/framebuffer/fb_cursor.c b/framebuffer/fb_cursor.c
index e2c066be7..cc6a30d42 100644
--- a/framebuffer/fb_cursor.c
+++ b/framebuffer/fb_cursor.c
@@ -35,6 +35,7 @@
#include "framebuffer/fb_bitmap.h"
#include "framebuffer/fb_cursor.h"
#include "framebuffer/fb_frontend.h"
+#include "framebuffer/fb_rootwindow.h"
struct fb_cursor_s {
int x;
@@ -262,11 +263,18 @@ fb_cursor_click(framebuffer_t *fb,
struct gui_window *g,
browser_mouse_state st)
{
+ /* check click lies within window */
+ if ((fb->cursor->x > g->x) &&
+ (fb->cursor->y > g->y) &&
+ (fb->cursor->x < g->x + g->width) &&
+ (fb->cursor->y < g->y + g->height)) {
browser_window_mouse_click(g->bw,
st,
- fb->cursor->x,
- fb->cursor->y + g->scrolly);
-
+ fb->cursor->x - g->x + g->scrollx,
+ fb->cursor->y - g->y + g->scrolly);
+ } else {
+ fb_rootwindow_click(st, fb->cursor->x, fb->cursor->y);
+ }
}
/*
diff --git a/framebuffer/fb_findfile.c b/framebuffer/fb_findfile.c
index 87e6d6f7e..2e0397e15 100644
--- a/framebuffer/fb_findfile.c
+++ b/framebuffer/fb_findfile.c
@@ -67,7 +67,12 @@ char *
fb_findfile_asurl(const char *filename)
{
static char buffer[PATH_MAX];
- char *f = fb_findfile(filename);
+ char *f;
+
+ if (strncmp(filename, "http://", 5) == 0)
+ return strdup(filename);
+
+ f = fb_findfile(filename);
if (f == NULL)
return NULL;
diff --git a/framebuffer/fb_frontend_ablefb.c b/framebuffer/fb_frontend_ablefb.c
index 865e02b19..0a489adf6 100644
--- a/framebuffer/fb_frontend_ablefb.c
+++ b/framebuffer/fb_frontend_ablefb.c
@@ -33,6 +33,7 @@
#include "framebuffer/fb_gui.h"
#include "framebuffer/fb_plotters.h"
#include "framebuffer/fb_frontend.h"
+#include "framebuffer/fb_options.h"
#include "utils/log.h"
diff --git a/framebuffer/fb_frontend_sdl.c b/framebuffer/fb_frontend_sdl.c
index cc78aae8b..98593929c 100644
--- a/framebuffer/fb_frontend_sdl.c
+++ b/framebuffer/fb_frontend_sdl.c
@@ -99,6 +99,14 @@ void fb_os_input(struct gui_window *g, bool active)
switch (event.key.keysym.sym) {
+ case SDLK_PAGEDOWN:
+ fb_window_scroll(g, 0, g->height);
+ break;
+
+ case SDLK_PAGEUP:
+ fb_window_scroll(g, 0, -g->height);
+ break;
+
case SDLK_j:
fb_window_scroll(g, 0, 100);
break;
@@ -135,9 +143,30 @@ void fb_os_input(struct gui_window *g, bool active)
break;
case SDL_MOUSEBUTTONDOWN:
- fb_cursor_click(framebuffer, g, BROWSER_MOUSE_CLICK_1);
- /* printf("Mouse button %d pressed at (%d,%d)\n",
- event.button.button, event.button.x, event.button.y);*/
+ switch (event.button.button) {
+
+ case SDL_BUTTON_LEFT:
+ fb_cursor_click(framebuffer, g, BROWSER_MOUSE_CLICK_1);
+ break;
+
+ case SDL_BUTTON_RIGHT:
+ fb_cursor_click(framebuffer, g, BROWSER_MOUSE_CLICK_2);
+ break;
+
+ case SDL_BUTTON_WHEELUP:
+ fb_window_scroll(g, 0, -100);
+ break;
+
+ case SDL_BUTTON_WHEELDOWN:
+ fb_window_scroll(g, 0, 100);
+ break;
+
+ case SDL_BUTTON_MIDDLE:
+ default:
+ printf("Mouse button %d pressed at (%d,%d)\n",
+ event.button.button, event.button.x, event.button.y);
+
+ }
break;
case SDL_QUIT:
diff --git a/framebuffer/fb_gui.c b/framebuffer/fb_gui.c
index e2feecf93..734e78ada 100644
--- a/framebuffer/fb_gui.c
+++ b/framebuffer/fb_gui.c
@@ -71,10 +71,11 @@ static void fb_pan(struct gui_window *g)
if (!c) return;
if (c->locked) return;
- LOG(("panning %d, %d from %d, %d in content %d,%d",g->panx, g->pany,g->scrollx,g->scrolly,c->width, c->height));
+ LOG(("panning %d, %d from %d, %d in content %d,%d",
+ g->panx, g->pany,g->scrollx,g->scrolly,c->width, c->height));
/* dont pan off the top */
if ((g->scrolly + g->pany) < 0)
- g->pany = -g->scrolly;
+ g->pany = - g->scrolly;
/* do not pan off the bottom of the content */
if ((g->scrolly + g->pany) > (c->height - g->height))
@@ -94,8 +95,8 @@ static void fb_pan(struct gui_window *g)
g->width, g->height + g->pany,
g->x, g->y - g->pany);
g->scrolly += g->pany;
- fb_queue_redraw(g, g->x, g->y,
- g->x + g->width, g->y - g->pany);
+ fb_queue_redraw(g, 0, 0,
+ g->width, - g->pany);
}
if (g->pany > 0) {
/* we cannot pan more than a window height at a time */
@@ -104,10 +105,12 @@ static void fb_pan(struct gui_window *g)
LOG(("panning down %d", g->pany));
- fb_plotters_move_block(g->x, g->y + g->pany, g->width, g->height - g->pany, g->x, g->y);
+ fb_plotters_move_block(g->x, g->y + g->pany,
+ g->width, g->height - g->pany,
+ g->x, g->y);
g->scrolly += g->pany;
- fb_queue_redraw(g, g->x, g->y + g->height - g->pany,
- g->x + g->width, g->y + g->height);
+ fb_queue_redraw(g, 0, g->height - g->pany,
+ g->width, g->height);
}
g->pan_required = false;
@@ -127,7 +130,18 @@ static void fb_redraw(struct gui_window *g)
if (!c) return;
if (c->locked) return;
- content_redraw(c, 0, -g->scrolly, g->width, g->height,
+ /* adjust clipping co-ordinates according to window location */
+ g->redraw_box.y0 += g->y;
+ g->redraw_box.y1 += g->y;
+ g->redraw_box.x0 += g->x;
+ g->redraw_box.x1 += g->x;
+
+ /* redraw bounding box is relative to window */
+ content_redraw(c,
+ g->x - g->scrollx,
+ g->y - g->scrolly ,
+ g->width,
+ g->height,
g->redraw_box.x0, g->redraw_box.y0,
g->redraw_box.x1, g->redraw_box.y1,
g->bw->scale, 0xFFFFFF);
@@ -165,7 +179,7 @@ void gui_init(int argc, char** argv)
/* load browser options */
options_read(fb_findfile("Options"));
- default_stylesheet_url = fb_findfile_asurl("default.css");
+ default_stylesheet_url = fb_findfile_asurl("http://jennifer.kyllikki.org/~vince/res/default.css");
framebuffer = fb_os_init(argc, argv);
@@ -228,7 +242,7 @@ void gui_poll(bool active)
fetch_poll();
//LOG(("enter schedule run"));
- active = schedule_run() | active;
+ active = schedule_run() | active | redraws_pending;
fb_os_input(input_window, active);
@@ -275,9 +289,9 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
return NULL;
g->x = 0;
- g->y = 0;
+ g->y = 30;
g->width = framebuffer->width;
- g->height = framebuffer->height;
+ g->height = framebuffer->height - 60;
g->bw = bw;
if (window_list == NULL) {
@@ -323,7 +337,9 @@ void gui_window_set_title(struct gui_window *g, const char *title)
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif
-static void fb_queue_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
+/* queue a redraw operation, co-ordinates are relative to the window */
+static void
+fb_queue_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
{
if (!g) return;
diff --git a/framebuffer/fb_plotters.c b/framebuffer/fb_plotters.c
index a7bbfc28a..72e892b8a 100644
--- a/framebuffer/fb_plotters.c
+++ b/framebuffer/fb_plotters.c
@@ -184,15 +184,13 @@ bool fb_clip(int x0, int y0, int x1, int y1)
g = window_list;
- /* LOG(("x0 %d, y0 %d, x1 %d, y1 %d", x0, y0, x1, y1)); */
-
if (x1 < x0) SWAP(x0, x1);
if (y1 < y0) SWAP(y0, y1);
clip.x0 = g->x;
clip.y0 = g->y;
clip.x1 = g->x + g->width;
- clip.y1 = g->x + g->height;
+ clip.y1 = g->y + g->height;
if (fb_plotters_clip_rect(&clip, &x0, &y0, &x1, &y1)) {
/* new clipping region is inside the root window */
@@ -201,6 +199,11 @@ bool fb_clip(int x0, int y0, int x1, int y1)
fb_plot_ctx.x1 = x1;
fb_plot_ctx.y1 = y1;
}
+
+ LOG(("%d, %d - %d, %d clipped to %d, %d - %d, %d",
+ x0,y0,x1,y1,
+ fb_plot_ctx.x0, fb_plot_ctx.y0, fb_plot_ctx.x1, fb_plot_ctx.y1));
+
return true;
}
diff --git a/framebuffer/fb_rootwindow.c b/framebuffer/fb_rootwindow.c
new file mode 100644
index 000000000..5a7465dd0
--- /dev/null
+++ b/framebuffer/fb_rootwindow.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 Vincent Sanders <vince@simtec.co.uk>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <limits.h>
+#include <unistd.h>
+
+#ifdef WITH_HUBBUB
+#include <hubbub/hubbub.h>
+#endif
+
+#include "desktop/gui.h"
+#include "desktop/plotters.h"
+#include "desktop/netsurf.h"
+#include "desktop/options.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/utils.h"
+
+#include "framebuffer/fb_bitmap.h"
+#include "framebuffer/fb_gui.h"
+#include "framebuffer/fb_frontend.h"
+#include "framebuffer/fb_plotters.h"
+#include "framebuffer/fb_schedule.h"
+#include "framebuffer/fb_cursor.h"
+#include "framebuffer/fb_rootwindow.h"
+
+void fb_rootwindow_click(browser_mouse_state st , int x, int y)
+{
+ LOG(("Click in root window"));
+}
+
+/*
+ * Local Variables:
+ * c-basic-offset:8
+ * End:
+ */
diff --git a/framebuffer/fb_rootwindow.h b/framebuffer/fb_rootwindow.h
new file mode 100644
index 000000000..801c7cb52
--- /dev/null
+++ b/framebuffer/fb_rootwindow.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2008 Vincent Sanders <vince@simtec.co.uk>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+void fb_rootwindow_click(browser_mouse_state st , int x, int y);