r10063 MarkieB - in /branches/MarkieB/javafront: Makefile Makefile.sources content/fetch.h desktop/browser.h desktop/gui.h desktop/history_core.c desktop/history_core.h java/thumbnail.c

netsurf at semichrome.net netsurf at semichrome.net
Mon Feb 15 13:58:43 GMT 2010


Author: MarkieB
Date: Mon Feb 15 07:58:42 2010
New Revision: 10063

URL: http://source.netsurf-browser.org?rev=10063&view=rev
Log:
Makefile category for java; some core functions called from the java-front code

Added:
    branches/MarkieB/javafront/java/thumbnail.c
Modified:
    branches/MarkieB/javafront/Makefile
    branches/MarkieB/javafront/Makefile.sources
    branches/MarkieB/javafront/content/fetch.h
    branches/MarkieB/javafront/desktop/browser.h
    branches/MarkieB/javafront/desktop/gui.h
    branches/MarkieB/javafront/desktop/history_core.c
    branches/MarkieB/javafront/desktop/history_core.h

Modified: branches/MarkieB/javafront/Makefile
URL: http://source.netsurf-browser.org/branches/MarkieB/javafront/Makefile?rev=10063&r1=10062&r2=10063&view=diff
==============================================================================
--- branches/MarkieB/javafront/Makefile (original)
+++ branches/MarkieB/javafront/Makefile Mon Feb 15 07:58:42 2010
@@ -3,6 +3,7 @@
 #
 # Copyright 2007 Daniel Silverstone <dsilvers at netsurf-browser.org>
 # Copyright 2008 Rob Kendrick <rjek at netsurf-browser.org>
+# Copyright 2009 Mark Benjamin <netsurf-browser.org.MarkBenjamin at dfgh.net>
 #
 # Trivially, invoke as:
 #   make
@@ -94,7 +95,9 @@
       ifneq ($(TARGET),amiga)
         ifneq ($(TARGET),framebuffer)
           ifneq ($(TARGET),windows)
-            $(error Unknown TARGET "$(TARGET)", should either be "riscos", "gtk", "beos", "amiga", "framebuffer" or "windows")
+            ifneq ($(TARGET),java)
+              $(error Unknown TARGET "$(TARGET)", should either be "riscos", "gtk", "beos", "amiga", "framebuffer", "windows" or "java")
+            endif
           endif
         endif
       endif
@@ -175,7 +178,7 @@
         PKG_CONFIG := $(MINGW_INSTALL_ENV)/bin/pkg-config
       endif
     else
-      # Building for GTK, Amiga, Framebuffer
+      # Building for GTK, Amiga, Framebuffer, Java
       PKG_CONFIG := pkg-config
     endif
   endif
@@ -485,6 +488,53 @@
 	libxml-2.0) -g
   CFLAGS += $(WSCFLAGS)
   LDFLAGS += $(WSCFLAGS)
+endif
+
+# ----------------------------------------------------------------------------
+# Java target setup
+# ----------------------------------------------------------------------------
+ifeq ($(TARGET),java)
+  LDFLAGS += $(shell $(PKG_CONFIG) --libs libxml-2.0 libcurl libhubbub openssl)
+  LDFLAGS += $(shell $(PKG_CONFIG) --libs libcss)
+
+  # 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_BMP_CFLAGS := -DWITH_BMP
+  NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
+  NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
+  $(eval $(call feature_enabled,BMP,-DWITH_BMP,-lnsbmp,NetSurf BMP decoder))
+  $(eval $(call feature_enabled,GIF,-DWITH_GIF,-lnsgif,NetSurf GIF decoder))
+  $(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG support))
+  $(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 feature_enabled,MNG,,-llcms -ljpeg,MNG additional support))
+# java include paths are currently standard i386 java 1.6 paths 
+# [as in ubuntu]; some automation of paths is needed
+  JAVACFLAGS := -shared -m32 -std=c99 -D_BSD_SOURCE \
+    -D_XOPEN_SOURCE=600 \
+    -D_POSIX_C_SOURCE=200112L \
+    -D_NETBSD_SOURCE \
+	-DNSJAVA \
+    $(WARNFLAGS) -I. -g \
+    $(shell $(PKG_CONFIG) --cflags libhubbub libcurl openssl) \
+    $(shell xml2-config --cflags) \
+	-I/usr/lib/jvm/java-6-sun/include \
+	-I/usr/lib/jvm/java-6-sun/include/linux
+  JAVALDFLAGS := -shared -m32 -fPIC -L/usr/lib/jni \
+    -L/usr/lib/jvm/java-6-sun/lib \
+	/usr/lib/jvm/java-6-sun/jre/lib/i386/libjava.so \
+	/usr/lib/jvm/java-6-sun/jre/lib/i386/libverify.so \
+	/usr/lib/jvm/java-6-sun/jre/lib/i386/server/libjvm.so
+#	/usr/lib/jvm/java-6-sun/jre/lib/i386/client/libjvm.so \
+#	-L/usr/lib/jvm/java-6-sun/include \
+#	-L/usr/lib/jvm/java-6-sun/include/linux \
+#	-L/usr/lib/jvm/java-6-sun/jre/lib/i386 \
+#	-L/usr/lib/jvm/java-6-sun/jre/lib/i386/client -ljni -ljava -lverify -ljvm
+   CFLAGS += $(JAVACFLAGS)
+  LDFLAGS += $(shell $(PKG_CONFIG) --cflags --libs lcms) $(WARNFLAGS) \
+    $(JAVALDFLAGS)
+
 endif
 
 # ----------------------------------------------------------------------------

Modified: branches/MarkieB/javafront/Makefile.sources
URL: http://source.netsurf-browser.org/branches/MarkieB/javafront/Makefile.sources?rev=10063&r1=10062&r2=10063&view=diff
==============================================================================
--- branches/MarkieB/javafront/Makefile.sources (original)
+++ branches/MarkieB/javafront/Makefile.sources Mon Feb 15 07:58:42 2010
@@ -71,6 +71,13 @@
 	gui.c history.c hotlist.c localhistory.c login.c misc.c plot.c	\
 	prefs.c schedule.c thumbnail.c tree.c
 S_WINDOWS := $(addprefix windows/,$(S_WINDOWS)) 
+
+# S_JAVA are sources purely for the windows build
+S_JAVA := about.c bitmap.c download.c filetype.c findfile.c font.c 	\
+	gui.c history.c hotlist.c localhistory.c login.c misc.c netsurfjava.c \
+	plot.c prefs.c schedule.c thumbnail.c tree.c
+	
+S_JAVA := $(addprefix java/,$(S_JAVA))
 
 # S_BEOS are sources purely for the BeOS build
 S_BEOS := beos_about.cpp beos_bitmap.cpp beos_fetch_rsrc.cpp		\
@@ -174,6 +181,11 @@
 EXETARGET := NetSurf.exe
 endif
 
+ifeq ($(TARGET),java)
+SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_JAVA)
+EXETARGET := NetSurfLib.so
+endif
+
 ifeq ($(SOURCES),)
 $(error Unable to build NetSurf, could not determine set of sources to build)
 endif

Modified: branches/MarkieB/javafront/content/fetch.h
URL: http://source.netsurf-browser.org/branches/MarkieB/javafront/content/fetch.h?rev=10063&r1=10062&r2=10063&view=diff
==============================================================================
--- branches/MarkieB/javafront/content/fetch.h (original)
+++ branches/MarkieB/javafront/content/fetch.h Mon Feb 15 07:58:42 2010
@@ -38,6 +38,20 @@
               FETCH_AUTH,
               FETCH_CERT_ERR,
 } fetch_msg;
+typedef enum {
+	DOWNLOAD_NONE,
+	DOWNLOAD_WORKING,
+	DOWNLOAD_ERROR,
+	DOWNLOAD_COMPLETE,
+	DOWNLOAD_CANCELED
+} download_status;
+
+typedef enum {
+	DOWNLOAD_PAUSE 	= 1 << 0,
+	DOWNLOAD_RESUME	= 1 << 1,
+	DOWNLOAD_CANCEL = 1 << 2,
+	DOWNLOAD_CLEAR 	= 1 << 3
+} download_actions;
 
 typedef enum {
 	FETCH_ERROR_NO_ERROR,

Modified: branches/MarkieB/javafront/desktop/browser.h
URL: http://source.netsurf-browser.org/branches/MarkieB/javafront/desktop/browser.h?rev=10063&r1=10062&r2=10063&view=diff
==============================================================================
--- branches/MarkieB/javafront/desktop/browser.h (original)
+++ branches/MarkieB/javafront/desktop/browser.h Mon Feb 15 07:58:42 2010
@@ -220,6 +220,16 @@
 	BROWSER_MOUSE_MOD_3     = 4096	/* secondary modifier key pressed
 					 * (eg. Alt) */
 } browser_mouse_state;
+
+struct browser_mouse {
+	struct gui_window *gui;
+	struct box *box;
+	
+	double pressed_x;
+	double pressed_y;
+	bool waiting;
+	browser_mouse_state state;
+};
 
 struct browser_scroll_data {
 	struct browser_window *bw;

Modified: branches/MarkieB/javafront/desktop/gui.h
URL: http://source.netsurf-browser.org/branches/MarkieB/javafront/desktop/gui.h?rev=10063&r1=10062&r2=10063&view=diff
==============================================================================
--- branches/MarkieB/javafront/desktop/gui.h (original)
+++ branches/MarkieB/javafront/desktop/gui.h Mon Feb 15 07:58:42 2010
@@ -67,7 +67,7 @@
 
 struct gui_window *gui_create_browser_window(struct browser_window *bw,
 		struct browser_window *clone, bool new_tab);
-struct browser_window *gui_window_get_browser_window(struct gui_window *g);
+struct browser_window *gui_window_browser_window(struct gui_window *);
 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);

Modified: branches/MarkieB/javafront/desktop/history_core.c
URL: http://source.netsurf-browser.org/branches/MarkieB/javafront/desktop/history_core.c?rev=10063&r1=10062&r2=10063&view=diff
==============================================================================
--- branches/MarkieB/javafront/desktop/history_core.c (original)
+++ branches/MarkieB/javafront/desktop/history_core.c Mon Feb 15 07:58:42 2010
@@ -716,6 +716,24 @@
 	return true;
 }
 
+/**
+ * Handle mouse hover - pointer type - in history
+ * \param history history window mouse is hovering above
+ * \param x click coordinate
+ * \param y click coordinate
+ * \param p pointer to return to history_gui_set_pointer()
+ */
+
+void history_hover(struct history *history, int x, int y, void *p)
+{
+	struct history_entry *entry;
+	entry = history_find_position(history->start, x, y);
+	if ((entry == NULL) || (entry == history->current))
+		history_gui_set_pointer(GUI_POINTER_DEFAULT, p);
+	else
+		history_gui_set_pointer(GUI_POINTER_POINT, p);
+}
+
 
 /**
  * Determine the URL of the entry at a position.

Modified: branches/MarkieB/javafront/desktop/history_core.h
URL: http://source.netsurf-browser.org/branches/MarkieB/javafront/desktop/history_core.h?rev=10063&r1=10062&r2=10063&view=diff
==============================================================================
--- branches/MarkieB/javafront/desktop/history_core.h (original)
+++ branches/MarkieB/javafront/desktop/history_core.h Mon Feb 15 07:58:42 2010
@@ -24,6 +24,9 @@
 #define _NETSURF_DESKTOP_HISTORY_H_
 
 #include <stdbool.h>
+#include "desktop/browser.h"
+#include "desktop/gui.h"
+#include "content/content.h"
 
 struct content;
 struct history;
@@ -45,6 +48,8 @@
 	int x0, int y0, int x1, int y1, int x, int y);
 bool history_click(struct browser_window *bw, struct history *history,
 		int x, int y, bool new_window);
+void history_hover(struct history *history, int x, int y, void *p);
 const char *history_position_url(struct history *history, int x, int y);
+void history_gui_set_pointer(gui_pointer_shape, void *);
 
 #endif

Added: branches/MarkieB/javafront/java/thumbnail.c
URL: http://source.netsurf-browser.org/branches/MarkieB/javafront/java/thumbnail.c?rev=10063&view=auto
==============================================================================
--- branches/MarkieB/javafront/java/thumbnail.c (added)
+++ branches/MarkieB/javafront/java/thumbnail.c Mon Feb 15 07:58:42 2010
@@ -1,0 +1,46 @@
+/*
+ * Copyright 2009 Mark Benjamin <netsurf-browser.org.MarkBenjamin at dfgh.net>
+ *
+ * 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 "content/urldb.h"
+#include "desktop/browser.h"
+#include "utils/log.h"
+#include "java/bitmap.h"
+#include "java/gui.h"
+#include "java/plot.h"
+
+#ifndef MIN
+#define MIN(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+
+#ifndef MAX
+#define MAX(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+
+bool thumbnail_create(struct content *content, struct bitmap *bitmap,
+		const char *url)
+{
+	LOG(("creating thumbnail %p for url %s content %p", bitmap, url, 
+			content));
+	int width = MIN(content->width, 1024);
+	int height = MIN(content->height, 768);
+	int i;
+	uint8_t *pixdata;
+	pixdata += i;
+	i = width * height;
+	return true;
+}




More information about the netsurf-commits mailing list