r5423 dsilvers - in /trunk/netsurf: ./ content/ css/ desktop/ framebuffer/ render/ utils/

netsurf at semichrome.net netsurf at semichrome.net
Tue Sep 23 15:00:40 BST 2008


Author: dsilvers
Date: Tue Sep 23 09:00:40 2008
New Revision: 5423

URL: http://source.netsurf-browser.org?rev=5423&view=rev
Log:
Merged revisions 5309-5406,5409-5422 via svnmerge from 
svn://svn.netsurf-browser.org/branches/vince/netsurf-fb

........
  r5309 | vince | 2008-09-13 10:59:10 +0100 (Sat, 13 Sep 2008) | 2 lines
  
  first stab at framebuffer frontend
........
  r5313 | vince | 2008-09-14 15:08:52 +0100 (Sun, 14 Sep 2008) | 2 lines
  
  add line plotters
........
  r5314 | vince | 2008-09-14 15:28:12 +0100 (Sun, 14 Sep 2008) | 2 lines
  
  add rectangle plot to 16bpp plotters
........
  r5315 | vince | 2008-09-14 19:58:57 +0100 (Sun, 14 Sep 2008) | 2 lines
  
  improve 16bpp image plot
........
  r5316 | vince | 2008-09-15 00:35:32 +0100 (Mon, 15 Sep 2008) | 2 lines
  
  abstract the os specific framebuffer init
........
  r5317 | vince | 2008-09-15 11:18:51 +0100 (Mon, 15 Sep 2008) | 2 lines
  
  first cut of linux frontend
........
  r5318 | vince | 2008-09-15 12:01:00 +0100 (Mon, 15 Sep 2008) | 2 lines
  
  remove junk includes
........
  r5319 | vince | 2008-09-15 12:09:02 +0100 (Mon, 15 Sep 2008) | 2 lines
  
  make plotters OS agnostic again
........
  r5322 | vince | 2008-09-15 15:55:01 +0100 (Mon, 15 Sep 2008) | 2 lines
  
  Linux frontend operates
........
  r5323 | vince | 2008-09-15 16:32:47 +0100 (Mon, 15 Sep 2008) | 2 lines
  
  abstract out OS specific input
........
  r5326 | vince | 2008-09-15 19:21:01 +0100 (Mon, 15 Sep 2008) | 2 lines
  
  Improve linux mode setting
........
  r5329 | vince | 2008-09-15 21:13:33 +0100 (Mon, 15 Sep 2008) | 2 lines
  
  improve text clipping
........
  r5339 | vince | 2008-09-16 00:07:57 +0100 (Tue, 16 Sep 2008) | 2 lines
  
  possibly fix text clipping issue
........
  r5342 | vince | 2008-09-16 00:39:36 +0100 (Tue, 16 Sep 2008) | 2 lines
  
  consolidate polygon plotters
........
  r5344 | dsilvers | 2008-09-16 10:21:06 +0100 (Tue, 16 Sep 2008) | 1 line
  
  Fix up the framebuffer target makefile a bit more, add some config options for it
........
  r5345 | dsilvers | 2008-09-16 10:22:19 +0100 (Tue, 16 Sep 2008) | 1 line
  
  Ensure the appropriate frontend is selected when building framebuffer
........
  r5346 | dsilvers | 2008-09-16 10:27:16 +0100 (Tue, 16 Sep 2008) | 1 line
  
  Update build system to support targetting separate framebuffer frontends in different build trees, update executable to be nsfb-blah
........
  r5350 | vince | 2008-09-16 17:15:04 +0100 (Tue, 16 Sep 2008) | 1 line
  
  Add -g to provide symbols for framebuffer link
........
  r5351 | vince | 2008-09-16 17:17:09 +0100 (Tue, 16 Sep 2008) | 1 line
  
  framebuffer scheduler now works, plotters tweaked, gui tracks window redraw requirements better, keypresses not duplicated under linux fb
........
  r5352 | dsilvers | 2008-09-16 17:38:53 +0100 (Tue, 16 Sep 2008) | 1 line
  
  Ensure we only allow one fetcher at a time
........
  r5361 | vince | 2008-09-17 11:48:44 +0100 (Wed, 17 Sep 2008) | 2 lines
  
  initial cursor support
........
  r5362 | vince | 2008-09-17 13:56:47 +0100 (Wed, 17 Sep 2008) | 2 lines
  
  add mouse handling
........
  r5363 | vince | 2008-09-17 14:14:44 +0100 (Wed, 17 Sep 2008) | 2 lines
  
  add framebuffer resources
........
  r5364 | vince | 2008-09-17 17:12:21 +0100 (Wed, 17 Sep 2008) | 2 lines
  
  add reasonable pointer
........
  r5366 | vince | 2008-09-17 17:17:25 +0100 (Wed, 17 Sep 2008) | 2 lines
  
  fix pointer alpha
........
  r5370 | vince | 2008-09-18 13:43:53 +0100 (Thu, 18 Sep 2008) | 2 lines
  
  warning squash and cleanup ready for trunk merge
........
  r5375 | vince | 2008-09-19 14:58:43 +0100 (Fri, 19 Sep 2008) | 2 lines
  
  Working mouse navigation
........
  r5377 | vince | 2008-09-20 14:06:22 +0100 (Sat, 20 Sep 2008) | 2 lines
  
  Improve scrolling
........
  r5378 | vince | 2008-09-20 14:46:46 +0100 (Sat, 20 Sep 2008) | 2 lines
  
  fix redraw issues with scrolling
........
  r5380 | vince | 2008-09-20 17:08:43 +0100 (Sat, 20 Sep 2008) | 3 lines
  
  Alter panning to use its own flag so it doesnt cause invalid redraw 
  operations 
........
  r5381 | vince | 2008-09-20 21:52:45 +0100 (Sat, 20 Sep 2008) | 2 lines
  
  add dummy framebuffer
........
  r5383 | vince | 2008-09-21 00:00:15 +0100 (Sun, 21 Sep 2008) | 2 lines
  
  fix segfault when cursor is off teh bottom of teh screen
........
  r5384 | vince | 2008-09-21 00:06:08 +0100 (Sun, 21 Sep 2008) | 2 lines
  
  fix off by one in pointer fix
........
  r5385 | vince | 2008-09-21 00:25:09 +0100 (Sun, 21 Sep 2008) | 2 lines
  
  when fixing bloody silly off by one errors remember to fix *both* references
........
  r5387 | vince | 2008-09-21 00:38:13 +0100 (Sun, 21 Sep 2008) | 2 lines
  
  last try at stopping the pointer segfault
........
  r5388 | vince | 2008-09-21 16:24:18 +0100 (Sun, 21 Sep 2008) | 2 lines
  
  improve vertical text clipping
........
  r5392 | vince | 2008-09-21 23:11:51 +0100 (Sun, 21 Sep 2008) | 2 lines
  
  Improve text plotters
........
  r5393 | vince | 2008-09-21 23:34:38 +0100 (Sun, 21 Sep 2008) | 2 lines
  
  fix 32bpp line plotting
........
  r5394 | vince | 2008-09-22 00:00:03 +0100 (Mon, 22 Sep 2008) | 2 lines
  
  Fix off by one error in line plotting clipping
........
  r5397 | vince | 2008-09-22 13:46:22 +0100 (Mon, 22 Sep 2008) | 2 lines
  
  Fix bitmap tileing
........
  r5398 | vince | 2008-09-22 17:46:02 +0100 (Mon, 22 Sep 2008) | 2 lines
  
  enable knockout renderer
........
  r5399 | vince | 2008-09-22 18:43:48 +0100 (Mon, 22 Sep 2008) | 2 lines
  
  ensure clipping region lies within window, caused by knockout renderer
........
  r5400 | vince | 2008-09-22 19:20:25 +0100 (Mon, 22 Sep 2008) | 2 lines
  
  update cursor to one swiped from X windows
........
  r5405 | vince | 2008-09-23 09:09:05 +0100 (Tue, 23 Sep 2008) | 2 lines
  
  fix vertical scroll limit
........
  r5412 | dsilvers | 2008-09-23 10:53:14 +0100 (Tue, 23 Sep 2008) | 1 line
  
  Revert noisy fetcher patch
........
  r5413 | dsilvers | 2008-09-23 10:58:00 +0100 (Tue, 23 Sep 2008) | 1 line
  
  Add header guards
........
  r5414 | dsilvers | 2008-09-23 11:31:31 +0100 (Tue, 23 Sep 2008) | 1 line
  
  Tidy the region clipping slightly
........
  r5416 | dsilvers | 2008-09-23 12:05:00 +0100 (Tue, 23 Sep 2008) | 1 line
  
  Rationalise how the framebuffer frontend finds resources and options
........
  r5418 | dsilvers | 2008-09-23 13:59:00 +0100 (Tue, 23 Sep 2008) | 1 line
  
  Ensure options are overridden after load, and squash an fb_gui.c warning
........
  r5419 | dsilvers | 2008-09-23 14:20:07 +0100 (Tue, 23 Sep 2008) | 1 line
  
  Support fb_mode and fb_device options
........
  r5420 | dsilvers | 2008-09-23 14:21:48 +0100 (Tue, 23 Sep 2008) | 1 line
  
  Support option_fb_device in the able frontend
........
  r5421 | dsilvers | 2008-09-23 14:25:17 +0100 (Tue, 23 Sep 2008) | 1 line
  
  Ensure target_blank is disabled
........
  r5422 | dsilvers | 2008-09-23 14:39:00 +0100 (Tue, 23 Sep 2008) | 1 line
  
  Rework linux fb frontend to support scanning and opening all event devices for input
........

Added:
    trunk/netsurf/framebuffer/
      - copied from r5405, branches/vince/netsurf-fb/framebuffer/
    trunk/netsurf/framebuffer/fb_findfile.c
      - copied unchanged from r5422, branches/vince/netsurf-fb/framebuffer/fb_findfile.c
    trunk/netsurf/framebuffer/fb_findfile.h
      - copied unchanged from r5422, branches/vince/netsurf-fb/framebuffer/fb_findfile.h
    trunk/netsurf/framebuffer/fb_options.h
      - copied unchanged from r5422, branches/vince/netsurf-fb/framebuffer/fb_options.h
Modified:
    trunk/netsurf/   (props changed)
    trunk/netsurf/Makefile
    trunk/netsurf/Makefile.config
    trunk/netsurf/Makefile.sources
    trunk/netsurf/content/fetchcache.c
    trunk/netsurf/css/css.h
    trunk/netsurf/desktop/options.c
    trunk/netsurf/framebuffer/fb_font.h
    trunk/netsurf/framebuffer/fb_frontend.h
    trunk/netsurf/framebuffer/fb_frontend_ablefb.c
    trunk/netsurf/framebuffer/fb_frontend_linuxfb.c
    trunk/netsurf/framebuffer/fb_gui.c
    trunk/netsurf/framebuffer/fb_gui.h
    trunk/netsurf/framebuffer/fb_plotters.c
    trunk/netsurf/render/directory.c
    trunk/netsurf/utils/filename.c
    trunk/netsurf/utils/url.c

Propchange: trunk/netsurf/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Sep 23 09:00:40 2008
@@ -1,5 +1,6 @@
 codedocs
 nsgtk
+nsfb-*
 build-*
 nsdebug
 Makefile.config.override

Propchange: trunk/netsurf/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Sep 23 09:00:40 2008
@@ -1,1 +1,1 @@
-/branches/adamblokus/netsurf:1-5155 /branches/dynis/netsurf:1-4310,4345-4486 /branches/mikeL/netsurf:1-4272,4275-4285,4287-5188 /branches/takkaria/netsurf-hubbub:1-5018 /branches/vince/netsurf-fb:1-5308
+/branches/adamblokus/netsurf:1-5155 /branches/dynis/netsurf:1-4310,4345-4486 /branches/mikeL/netsurf:1-4272,4275-4285,4287-5188 /branches/takkaria/netsurf-hubbub:1-5018 /branches/vince/netsurf-fb:1-5422

Modified: trunk/netsurf/Makefile
URL: http://source.netsurf-browser.org/trunk/netsurf/Makefile?rev=5423&r1=5422&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/Makefile (original)
+++ trunk/netsurf/Makefile Tue Sep 23 09:00:40 2008
@@ -94,7 +94,9 @@
     ifneq ($(TARGET),beos)
       ifneq ($(TARGET),debug)
         ifneq ($(TARGET),amiga)
-          $(error Unknown TARGET "$(TARGET)", should either be "riscos", "gtk", "beos", "amiga" or "debug")
+          ifneq ($(TARGET),framebuffer)
+            $(error Unknown TARGET "$(TARGET)", should either be "riscos", "gtk", "beos", "amiga", "debug" or "framebuffer")
+          endif
         endif
       endif
     endif
@@ -156,7 +158,7 @@
   endif
 endif
 
-OBJROOT := build-$(HOST)-$(TARGET)$(SUBTARGET)
+OBJROOT = build-$(HOST)-$(TARGET)$(SUBTARGET)
 
 # ----------------------------------------------------------------------------
 # General flag setup
@@ -437,6 +439,71 @@
 
   CFLAGS += -mcrt=newlib -D__USE_INLINE__ -std=c99 -I . -Dnsamiga
   LDFLAGS += -lxml2 -lcurl -lm -lsocket -lpthread -lregex -lauto -lraauto -lssl -lcrypto -lamisslauto -mcrt=newlib
+endif
+
+# ----------------------------------------------------------------------------
+# Framebuffer target setup
+# ----------------------------------------------------------------------------
+
+ifeq ($(TARGET),framebuffer)
+  $(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,PNG support))
+
+  # define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here
+  NETSURF_FEATURE_RSVG_CFLAGS := -DWITH_RSVG
+  NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
+  NETSURF_FEATURE_HUBBUB_CFLAGS := -DWITH_HUBBUB
+  NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
+  NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
+
+  CFLAGS += '-DNETSURF_FB_RESPATH="$(NETSURF_FB_RESPATH_$(NETSURF_FB_FRONTEND))"'
+  CFLAGS += '-DNETSURF_FB_HOMEPATH="$(NETSURF_FB_HOMEPATH_$(NETSURF_FB_FRONTEND))"'
+  CFLAGS += -Dnsfb
+
+  ifeq ($(NETSURF_FB_FRONTEND),linux)
+    $(eval $(call pkg_config_find_and_add,RSVG,librsvg-2.0,SVG rendering))
+    $(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,RISC OS sprite rendering))
+    $(eval $(call pkg_config_find_and_add,HUBBUB,libhubbub,Hubbub HTML parser))
+    $(eval $(call pkg_config_find_and_add,BMP,libnsbmp,NetSurf BMP decoder))
+    $(eval $(call pkg_config_find_and_add,GIF,libnsgif,NetSurf GIF decoder))
+
+
+    CFLAGS += -std=c99 -g -I. -Dsmall $(WARNFLAGS) \
+	 	 $(shell xml2-config --cflags) \
+		 -D_BSD_SOURCE \
+		 -D_XOPEN_SOURCE=600 \
+		 -D_POSIX_C_SOURCE=200112L 
+
+    LDFLAGS += -lxml2 -lz -ljpeg -lcurl -lm 
+    LDFLAGS += $(shell $(PKG_CONFIG) --libs libxml-2.0 libcurl openssl)
+    SUBTARGET := -linux
+  endif
+
+  ifeq ($(NETSURF_FB_FRONTEND),able)
+    $(eval $(call feature_enabled,GIF,-DWITH_GIF,-lnsgif,NetSurf GIF decoder))
+    CC=arm-able-gcc
+    CFLAGS += -std=c99 -I. -I/usr/lib/able/include -Dsmall $(WARNFLAGS)
+    LDFLAGS += -lxml2 -lz -ljpeg -lcurl -lm 
+    SUBTARGET := -able
+  endif
+
+  ifeq ($(NETSURF_FB_FRONTEND),dummy)
+    $(eval $(call pkg_config_find_and_add,RSVG,librsvg-2.0,SVG rendering))
+    $(eval $(call pkg_config_find_and_add,ROSPRITE,librosprite,RISC OS sprite rendering))
+    $(eval $(call pkg_config_find_and_add,HUBBUB,libhubbub,Hubbub HTML parser))
+    $(eval $(call pkg_config_find_and_add,BMP,libnsbmp,NetSurf BMP decoder))
+    $(eval $(call pkg_config_find_and_add,GIF,libnsgif,NetSurf GIF decoder))
+
+
+    CFLAGS += -std=c99 -g -I. $(WARNFLAGS) \
+	 	 $(shell xml2-config --cflags) \
+		 -D_BSD_SOURCE \
+		 -D_XOPEN_SOURCE=600 \
+		 -D_POSIX_C_SOURCE=200112L 
+
+    LDFLAGS += -lxml2 -lz -ljpeg -lcurl -lm 
+    LDFLAGS += $(shell $(PKG_CONFIG) --libs libxml-2.0 libcurl openssl)
+    SUBTARGET := -dummy
+  endif
 endif
 
 # ----------------------------------------------------------------------------

Modified: trunk/netsurf/Makefile.config
URL: http://source.netsurf-browser.org/trunk/netsurf/Makefile.config?rev=5423&r1=5422&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/Makefile.config (original)
+++ trunk/netsurf/Makefile.config Tue Sep 23 09:00:40 2008
@@ -182,6 +182,33 @@
 
 endif
 
+# ----------------------------------------------------------------------------
+# Framebuffer-target-specific options
+# ----------------------------------------------------------------------------
+ifeq ($(TARGET),framebuffer)
+  # Optimisation levels
+  CFLAGS += -O2 -Wuninitialized
+
+  # Framebuffer frontend.
+  # Valid values are: linux, able
+  NETSURF_FB_FRONTEND := linux
+
+  # Use libharu to enable PDF export and GTK printing support.
+  # Valid options: YES, NO
+  NETSURF_USE_HARU_PDF := NO
+
+  # Framebuffer frontends may have differing root paths for resources
+  # As such, these specify the resource path and config path.
+  NETSURF_FB_RESPATH_linux := /usr/share/netsurf/
+  NETSURF_FB_RESPATH_able := (tftpboot)/
+  NETSURF_FB_RESPATH_dummy := ./
+
+  NETSURF_FB_HOMEPATH_linux := ~/.netsurf/
+  NETSURF_FB_HOMEPATH_able := (tftpboot)/
+  NETSURF_FB_HOMEPATH_dummy := ./
+
+endif
+
 # Include any local overrides
 -include Makefile.config.override
 

Modified: trunk/netsurf/Makefile.sources
URL: http://source.netsurf-browser.org/trunk/netsurf/Makefile.sources?rev=5423&r1=5422&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/Makefile.sources (original)
+++ trunk/netsurf/Makefile.sources Tue Sep 23 09:00:40 2008
@@ -91,6 +91,26 @@
 	plotters.c object.c menu.c save_pdf.c
 S_AMIGA := $(addprefix amiga/,$(S_AMIGA))
 
+# S_FRAMEBUFFER are sources purely for the framebuffer build
+S_FRAMEBUFFER := fb_gui.c tree.c history.c hotlist.c fb_schedule.c	\
+	thumbnail.c misc.c fb_bitmap.c fb_font.c font_8x16.c		\
+	fb_filetype.c login.c fb_cursor.c fb_plotters.c			\
+	fb_8bpp_plotters.c fb_16bpp_plotters.c fb_32bpp_plotters.c \
+	fb_findfile.c
+#	fb_1bpp_plotters.c
+
+ifeq ($(NETSURF_FB_FRONTEND),linux)
+S_FRAMEBUFFER += fb_frontend_linuxfb.c
+endif
+ifeq ($(NETSURF_FB_FRONTEND),able)
+S_FRAMEBUFFER += fb_frontend_ablefb.c
+endif
+ifeq ($(NETSURF_FB_FRONTEND),dummy)
+S_FRAMEBUFFER += fb_frontend_dummy.c
+endif
+
+S_FRAMEBUFFER := $(addprefix framebuffer/,$(S_FRAMEBUFFER))
+
 # Some extra rules for building the scanner etc.
 css/css_enum.c css/css_enum.h: css/css_enums css/makeenum
 	$(VQ)echo "MAKEENUM: css"
@@ -163,6 +183,11 @@
 EXETARGET := NetSurf
 endif
 
+ifeq ($(TARGET),framebuffer)
+SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_FRAMEBUFFER)
+EXETARGET := nsfb$(SUBTARGET)
+endif
+
 ifeq ($(SOURCES),)
 $(error Unable to build NetSurf, could not determine set of sources to build)
 endif

Modified: trunk/netsurf/content/fetchcache.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/fetchcache.c?rev=5423&r1=5422&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/content/fetchcache.c (original)
+++ trunk/netsurf/content/fetchcache.c Tue Sep 23 09:00:40 2008
@@ -31,6 +31,7 @@
 #include <sys/types.h>
 #include <regex.h>
 #include <time.h>
+#include <unistd.h>
 #include <curl/curl.h>  /* for curl_getdate() */
 #include "utils/config.h"
 #include "content/content.h"

Modified: trunk/netsurf/css/css.h
URL: http://source.netsurf-browser.org/trunk/netsurf/css/css.h?rev=5423&r1=5422&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/css/css.h (original)
+++ trunk/netsurf/css/css.h Tue Sep 23 09:00:40 2008
@@ -35,12 +35,13 @@
 #ifndef _NETSURF_CSS_CSS_H_
 #define _NETSURF_CSS_CSS_H_
 
+#include <stdint.h>
 #include <stdbool.h>
 #include <libxml/HTMLparser.h>
 #include "css/css_enum.h"
 
 
-typedef unsigned long colour;  /* 0xbbggrr */
+typedef uint32_t colour;  /* 0xbbggrr */
 #define TRANSPARENT 0x1000000
 #define CSS_COLOR_INHERIT 0x2000000
 #define CSS_COLOR_NONE 0x3000000

Modified: trunk/netsurf/desktop/options.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/options.c?rev=5423&r1=5422&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/desktop/options.c (original)
+++ trunk/netsurf/desktop/options.c Tue Sep 23 09:00:40 2008
@@ -49,6 +49,8 @@
 #include "beos/options.h"
 #elif defined(nsamiga)
 #include "amiga/options.h"
+#elif defined(nsfb)
+#include "framebuffer/fb_options.h"
 #else
 #define EXTRA_OPTION_DEFINE
 #define EXTRA_OPTION_TABLE

Modified: trunk/netsurf/framebuffer/fb_font.h
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fb_font.h?rev=5423&r1=5405&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/framebuffer/fb_font.h (original)
+++ trunk/netsurf/framebuffer/fb_font.h Tue Sep 23 09:00:40 2008
@@ -16,6 +16,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef NETSURF_FB_FONT_H
+#define NETSURF_FB_FONT_H
 
 struct fb_font_desc {
     const char *name;
@@ -32,3 +34,6 @@
 				       const char *string, 
 				       size_t len,
 				       char **result);
+
+#endif /* NETSURF_FB_FONT_H */
+

Modified: trunk/netsurf/framebuffer/fb_frontend.h
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fb_frontend.h?rev=5423&r1=5405&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/framebuffer/fb_frontend.h (original)
+++ trunk/netsurf/framebuffer/fb_frontend.h Tue Sep 23 09:00:40 2008
@@ -16,6 +16,12 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef NETSURF_FB_FRONTEND_H
+#define NETSURF_FB_FRONTEND_H
+
 extern framebuffer_t *fb_os_init(int argc, char** argv);
 extern void fb_os_quit(framebuffer_t *fb);
 extern void fb_os_input(struct gui_window *g);
+extern void fb_os_option_override(void);
+
+#endif /* NETSURF_FB_FRONTEND_H */

Modified: trunk/netsurf/framebuffer/fb_frontend_ablefb.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fb_frontend_ablefb.c?rev=5423&r1=5405&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/framebuffer/fb_frontend_ablefb.c (original)
+++ trunk/netsurf/framebuffer/fb_frontend_ablefb.c Tue Sep 23 09:00:40 2008
@@ -48,7 +48,7 @@
         int res;
 
         /* open display device */
-        devfd = open(fbdevname, O_RDWR);
+        devfd = open(option_fb_device ? option_fb_device : fbdevname, O_RDWR);
         if (devfd < 0) {
                 LOG(("Error opening output device %s", fbdevname));
                 return NULL;
@@ -91,22 +91,6 @@
         /* set stdin to nonblocking */
         fcntl(0, F_SETFL, O_NONBLOCK);
 
-//#define FILE_PFX "(cd0)/res/"
-#define FILE_PFX "(tftpboot)/"
-
-        /* load browser messages */
-        messages_load(FILE_PFX "messages");
-
-        /* load browser options */        
-	options_read(FILE_PFX "Options");
-
-        /* override some options */
-        option_max_cached_fetch_handles = 1;
-        option_max_fetchers = option_max_fetchers_per_host = 1;
-
-        default_stylesheet_url = strdup("file://" FILE_PFX "default.css");
-        //default_stylesheet_url = strdup("http://jennifer.kyllikki.org/~vince/res/default.css");
-
         return newfb;
 }
 
@@ -142,6 +126,14 @@
 
 }
 
+void
+fb_os_option_override(void)
+{
+        /* override some options */
+        option_max_cached_fetch_handles = 1;
+        option_max_fetchers = option_max_fetchers_per_host = 1;
+}
+
 /*
  * Local Variables:
  * c-basic-offset:8

Modified: trunk/netsurf/framebuffer/fb_frontend_linuxfb.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fb_frontend_linuxfb.c?rev=5423&r1=5405&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/framebuffer/fb_frontend_linuxfb.c (original)
+++ trunk/netsurf/framebuffer/fb_frontend_linuxfb.c Tue Sep 23 09:00:40 2008
@@ -31,6 +31,8 @@
 #include <sys/mman.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
+#include <dirent.h>
+#include <fnmatch.h>
 
 #include <linux/kd.h>
 #include <linux/vt.h>
@@ -40,13 +42,13 @@
 
 #include "css/css.h"
 #include "desktop/browser.h"
-#include "desktop/options.h"
 #include "desktop/gui.h"
 #include "framebuffer/fb_gui.h"
 #include "framebuffer/fb_plotters.h"
 #include "framebuffer/fb_schedule.h"
 #include "framebuffer/fb_cursor.h"
 #include "framebuffer/fb_frontend.h"
+#include "framebuffer/fb_options.h"
 
 #include "utils/log.h"
 #include "utils/messages.h"
@@ -75,8 +77,12 @@
 static unsigned short            ored[256], ogreen[256], oblue[256], otransp[256];
 static struct fb_cmap            ocmap = { 0, 256, ored, ogreen, oblue, otransp };
 
-int keyboardfd;
-int mousefd;
+typedef struct _input_dev {
+        struct _input_dev *next;
+        int fd;
+} fb_input_dev;
+
+static fb_input_dev *inputdevs = 0;
 
 /* -------------------------------------------------------------------- */
 /* devices                                                              */
@@ -110,6 +116,45 @@
                 devices = &devs_devfs;
         else
                 devices = &devs_default;
+}
+
+static char *
+fconcat(const char *base, const char *leaf)
+{
+        static char buffer[PATH_MAX];
+        snprintf(buffer, PATH_MAX, "%s/%s", base, leaf);
+        return buffer;
+}
+
+/* Input device opening */
+static void
+fb_open_input_devices(void)
+{
+        DIR *dir;
+        fb_input_dev *d;
+        struct dirent *de;
+        const char *basepath = option_fb_input_devpath ? option_fb_input_devpath : "/dev/input";
+        
+        dir = opendir(basepath);
+        
+        if (dir == NULL)
+                return;
+        
+        while ((de = readdir(dir)) != NULL) {
+                if (fnmatch(option_fb_input_glob ? option_fb_input_glob : "event*",
+                            de->d_name, 0) == 0) {
+                        char *cc = fconcat(basepath, de->d_name);
+                        int fd = open(cc, O_RDONLY | O_NONBLOCK);
+                        if (fd >= 0) {
+                                d = calloc(1, sizeof(fb_input_dev));
+                                d->next = inputdevs;
+                                inputdevs = d;
+                                d->fd = fd;
+                        }
+                }
+        }
+        
+        closedir(dir);
 }
 
 /* -------------------------------------------------------------------- */
@@ -514,7 +559,7 @@
         framebuffer_t *newfb;
         int ploop;
 
-        fb_init("/dev/fb0", "800x600-70", 16, 1);
+        fb_init(option_fb_device, option_fb_mode ? option_fb_mode : "800x600-70", 16, 1);
         fb_switch_init();
         fb_catch_exit_signals();
 
@@ -536,26 +581,8 @@
         }
 
 
-
-        keyboardfd = open("/dev/input/event0", O_RDONLY | O_NONBLOCK);
-        if (keyboardfd < 0) {
-                fprintf(stderr, "Unable to open /dev/input/event0 no keyboard\n");                
-        } 
-        mousefd = open("/dev/input/event2", O_RDONLY | O_NONBLOCK);
-        if (mousefd < 0) {
-                fprintf(stderr, "Unable to open /dev/input/event2 no mouse\n");                
-        } 
-
-#define FILE_PFX "/home/vince/netsurf/netsurf-fb/framebuffer/res/"
-
-        /* load browser messages */
-        messages_load(FILE_PFX "messages");
-
-        /* load browser options */        
-	options_read(FILE_PFX "Options");
-
-        default_stylesheet_url = strdup("file://"FILE_PFX"/default.css");
-
+        fb_open_input_devices();
+        
         return newfb;
 }
 
@@ -568,76 +595,55 @@
 {
         ssize_t amt;
         struct input_event event;       
-
-        if (keyboardfd >= 0) {
-
-                amt = read(keyboardfd, &event, sizeof(struct input_event));
-
+        fb_input_dev *d;
+        
+        for (d = inputdevs; d != NULL; d = d->next) {
+                amt = read(d->fd, &event, sizeof(struct input_event));
+                
                 if (amt > 0) {
-                        if (event.type != EV_KEY)
-                                return;
-
-                        if (event.value == 0)
-                                return;
-
-                        switch (event.code) {
-                        case KEY_J:
-				fb_window_scroll(g, 0, 100);
-                                break;
-
-                        case KEY_K:
-				fb_window_scroll(g, 0, -100);
-                                break;
-
-                        case KEY_Q:
-                                browser_window_destroy(g->bw);
-                                break;
-
-                        case KEY_D:
-                                list_schedule();
-                                break;
-
-                        case KEY_UP:
-                                fb_cursor_move(framebuffer, 0, -1);
-                                break;
-
-                        case KEY_DOWN:
-                                fb_cursor_move(framebuffer, 0, 1);
-                                break;
-
-                        case KEY_LEFT:
-                                fb_cursor_move(framebuffer, -1, 0);
-                                break;
-
-                        case KEY_RIGHT:
-                                fb_cursor_move(framebuffer, 1, 0);
-                                break;
-                        }
-                }
-        }
-
-        if (mousefd >= 0) {
-
-                while((amt = read(mousefd, 
-                                  &event, 
-                                  sizeof(struct input_event))) > 0) {
-
-                        switch (event.type) {
-                        case EV_KEY:
-                                if (event.value != 0)
-                                        break;
-
+                        if (event.type == EV_KEY) {
+                                if (event.value == 0)
+                                        return;
+                                
                                 switch (event.code) {
+                                case KEY_J:
+                                        fb_window_scroll(g, 0, 100);
+                                        break;
+                                        
+                                case KEY_K:
+                                        fb_window_scroll(g, 0, -100);
+                                        break;
+                                        
+                                case KEY_Q:
+                                        browser_window_destroy(g->bw);
+                                        break;
+                                        
+                                case KEY_D:
+                                        list_schedule();
+                                        break;
+                                        
+                                case KEY_UP:
+                                        fb_cursor_move(framebuffer, 0, -1);
+                                        break;
+                                        
+                                case KEY_DOWN:
+                                        fb_cursor_move(framebuffer, 0, 1);
+                                        break;
+                                        
+                                case KEY_LEFT:
+                                        fb_cursor_move(framebuffer, -1, 0);
+                                        break;
+                                        
+                                case KEY_RIGHT:
+                                        fb_cursor_move(framebuffer, 1, 0);
+                                        break;
                                 case BTN_LEFT:
                                         fb_cursor_click(framebuffer,
                                                         g, 
                                                         BROWSER_MOUSE_CLICK_1);
                                         break;
                                 }
-                                break;
-
-                        case EV_REL:
-				
+                        } else if (event.type == EV_REL) {
                                 switch (event.code) {
 				case 0:
                                         fb_cursor_move(framebuffer, 
@@ -655,12 +661,17 @@
 					fb_window_scroll(g, 0, event.value * -100);
 					break;
                                 }
-                                break;
                         }
-                }
-        }
-
-}
+                        
+                }
+        }
+}
+
+void
+fb_os_option_override(void)
+{
+}
+
 
 /*
  * Local Variables:

Modified: trunk/netsurf/framebuffer/fb_gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fb_gui.c?rev=5423&r1=5405&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/framebuffer/fb_gui.c (original)
+++ trunk/netsurf/framebuffer/fb_gui.c Tue Sep 23 09:00:40 2008
@@ -27,6 +27,7 @@
 #include "desktop/netsurf.h"
 #include "desktop/options.h"
 #include "utils/log.h"
+#include "utils/messages.h"
 
 #include "framebuffer/fb_bitmap.h"
 #include "framebuffer/fb_gui.h"
@@ -34,6 +35,8 @@
 #include "framebuffer/fb_plotters.h"
 #include "framebuffer/fb_schedule.h"
 #include "framebuffer/fb_cursor.h"
+#include "framebuffer/fb_findfile.h"
+
 #include "content/urldb.h"
 #include "desktop/history_core.h"
 #include "content/fetch.h"
@@ -135,8 +138,20 @@
 {
         LOG(("argc %d, argv %p", argc, argv));
 
+        /* load browser messages */
+        messages_load(fb_findfile("messages"));
+
+        /* load browser options */        
+	options_read(fb_findfile("Options"));
+
+        default_stylesheet_url = fb_findfile_asurl("default.css");
+        
         framebuffer = fb_os_init(argc, argv);
-
+        
+        fb_os_option_override();
+        
+        option_target_blank = false;
+        
         switch (framebuffer->bpp) {
                 /*        case 1:
                 plot = framebuffer_1bpp_plot;

Modified: trunk/netsurf/framebuffer/fb_gui.h
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fb_gui.h?rev=5423&r1=5405&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/framebuffer/fb_gui.h (original)
+++ trunk/netsurf/framebuffer/fb_gui.h Tue Sep 23 09:00:40 2008
@@ -15,6 +15,9 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
+
+#ifndef NETSURF_FB_GUI_H
+#define NETSURF_FB_GUI_H
 
 typedef struct fb_cursor_s fb_cursor_t;
 
@@ -63,8 +66,12 @@
 /* scroll a window */
 void fb_window_scroll(struct gui_window *g, int x, int y);
 
+#endif /* NETSURF_FB_GUI_H */
+
 /*
  * Local Variables:
  * c-basic-offset:8
  * End:
  */
+
+

Modified: trunk/netsurf/framebuffer/fb_plotters.c
URL: http://source.netsurf-browser.org/trunk/netsurf/framebuffer/fb_plotters.c?rev=5423&r1=5405&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/framebuffer/fb_plotters.c (original)
+++ trunk/netsurf/framebuffer/fb_plotters.c Tue Sep 23 09:00:40 2008
@@ -36,10 +36,17 @@
 /* Current plotting context */
 bbox_t fb_plot_ctx;
 
-#define REGION(x,y,cx1,cx2,cy1,cy2) ( ( (y) > (cy2) ? 8 : 0) |  \
-                                      ( (y) < (cy1) ? 4 : 0) |  \
-                                      ( (x) > (cx2) ? 2 : 0) |  \
-                                      ( (x) < (cx1) ? 1 : 0) )
+enum {
+        POINT_LEFTOF_REGION = 1,
+        POINT_RIGHTOF_REGION = 2,
+        POINT_ABOVE_REGION = 4,
+        POINT_BELOW_REGION = 8,
+};
+
+#define REGION(x,y,cx1,cx2,cy1,cy2) ( ( (y) > (cy2) ? POINT_BELOW_REGION : 0) |  \
+                                      ( (y) < (cy1) ? POINT_ABOVE_REGION : 0) |  \
+                                      ( (x) > (cx2) ? POINT_RIGHTOF_REGION : 0) |  \
+                                      ( (x) < (cx1) ? POINT_LEFTOF_REGION : 0) )
 
 #define SWAP(a, b) do { int t; t=(a); (a)=(b); (b)=t;  } while(0) 
 
@@ -107,24 +114,24 @@
 
                 if (region1) {
                         /* first point */
-                        if (region1 & 8) { 
+                        if (region1 & POINT_BELOW_REGION) { 
                                 /* divide line at bottom */
-                                *x0 = (*x0 + (*x1-*x0) *
+                                *x0 = (*x0 + (*x1 - *x0) *
                                        (clip->y1 - 1 - *y0) / (*y1-*y0));
                                 *y0 = clip->y1 - 1;
-                        } else if (region1 & 4) { 
+                        } else if (region1 & POINT_ABOVE_REGION) { 
                                 /* divide line at top */
-                                *x0 = (*x0 + (*x1-*x0) *
+                                *x0 = (*x0 + (*x1 - *x0) *
                                        (clip->y0 - *y0) / (*y1-*y0));
                                 *y0 = clip->y0;
-                        } else if (region1 & 2) { 
+                        } else if (region1 & POINT_RIGHTOF_REGION) { 
                                 /* divide line at right */
-                                *y0 = (*y0 +(*y1-*y0) *
+                                *y0 = (*y0 + (*y1 - *y0) *
                                        (clip->x1  - 1 - *x0) / (*x1-*x0));
                                 *x0 = clip->x1 - 1;
-                        } else if (region1 & 1) { 
+                        } else if (region1 & POINT_LEFTOF_REGION) { 
                                 /* divide line at right */
-                                *y0 = (*y0 +(*y1-*y0) *
+                                *y0 = (*y0 + (*y1 - *y0) *
                                        (clip->x0 - *x0) / (*x1-*x0));
                                 *x0 = clip->x0;
                         }
@@ -133,24 +140,24 @@
                                          clip->x0, clip->x1 - 1, clip->y0, clip->y1 - 1);
                 } else {
                         /* second point */
-                        if (region2 & 8) {  
+                        if (region2 & POINT_BELOW_REGION) {  
                                 /* divide line at bottom*/
-                                *x1 = (*x0 + (*x1-*x0) *
+                                *x1 = (*x0 + (*x1 - *x0) *
                                        (clip->y1  - 1 - *y0) / (*y1-*y0));
                                 *y1 = clip->y1 - 1;
-                        } else if (region2 & 4) { 
+                        } else if (region2 & POINT_ABOVE_REGION) { 
                                 /* divide line at top*/
-                                *x1 = (*x0 +(*x1-*x0) *
+                                *x1 = (*x0 + (*x1 - *x0) *
                                        (clip->y0 - *y0) / (*y1-*y0));
                                 *y1 = clip->y0;
-                        } else if (region2 & 2) { 
+                        } else if (region2 & POINT_RIGHTOF_REGION) { 
                                 /* divide line at right*/
-                                *y1 = (*y0 +(*y1-*y0) *
+                                *y1 = (*y0 + (*y1 - *y0) *
                                        (clip->x1  - 1 - *x0) / (*x1 - *x0));
                                 *x1 = clip->x1 - 1;
-                        } else if (region2 & 1) { 
+                        } else if (region2 & POINT_LEFTOF_REGION) { 
                                 /* divide line at right*/
-                                *y1 = (*y0 +(*y1-*y0) *
+                                *y1 = (*y0 + (*y1 - *y0) *
                                        (clip->x0 - *x0) / (*x1 - *x0));
                                 *x1 = clip->x0;
                         }
@@ -176,7 +183,7 @@
 
         g = window_list;
 
-        //LOG(("x0 %d, y0 %d, x1 %d, y1 %d", x0, y0, x1, y1));
+        /* 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);

Modified: trunk/netsurf/render/directory.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/directory.c?rev=5423&r1=5422&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/render/directory.c (original)
+++ trunk/netsurf/render/directory.c Tue Sep 23 09:00:40 2008
@@ -20,6 +20,7 @@
  * Content for directory listings (implementation).
  */
 
+#include <sys/types.h>
 #include <dirent.h>
 #include <stdbool.h>
 #include <string.h>

Modified: trunk/netsurf/utils/filename.c
URL: http://source.netsurf-browser.org/trunk/netsurf/utils/filename.c?rev=5423&r1=5422&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/utils/filename.c (original)
+++ trunk/netsurf/utils/filename.c Tue Sep 23 09:00:40 2008
@@ -22,13 +22,13 @@
  * A maximum of 2^24 files can be allocated at any point in time.
  */
 
+#include <sys/types.h>
 #include <dirent.h>
 #include <stdbool.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include "utils/filename.h"

Modified: trunk/netsurf/utils/url.c
URL: http://source.netsurf-browser.org/trunk/netsurf/utils/url.c?rev=5423&r1=5422&r2=5423&view=diff
==============================================================================
--- trunk/netsurf/utils/url.c (original)
+++ trunk/netsurf/utils/url.c Tue Sep 23 09:00:40 2008
@@ -22,14 +22,15 @@
  * URL parsing and joining (implementation).
  */
 
+#include <sys/types.h>
 #include <assert.h>
 #include <ctype.h>
 #include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 #include <strings.h>
-#include <sys/types.h>
 #include <regex.h>
+#include <unistd.h>
 #include "curl/curl.h"
 #include "utils/log.h"
 #include "utils/url.h"




More information about the netsurf-commits mailing list