summaryrefslogtreecommitdiff
path: root/beos
diff options
context:
space:
mode:
Diffstat (limited to 'beos')
-rw-r--r--beos/Makefile.target2
-rw-r--r--beos/fetch_rsrc.cpp21
-rw-r--r--beos/gui.cpp100
-rw-r--r--beos/plotters.cpp1
-rw-r--r--beos/scaffolding.cpp9
-rw-r--r--beos/window.cpp54
-rw-r--r--beos/window.h1
7 files changed, 83 insertions, 105 deletions
diff --git a/beos/Makefile.target b/beos/Makefile.target
index a1259d644..bbeb0be22 100644
--- a/beos/Makefile.target
+++ b/beos/Makefile.target
@@ -38,7 +38,7 @@ ifeq ($(HOST),beos)
ifneq ($(wildcard /boot/develop/lib/*/libzeta.so),)
LDFLAGS += -lzeta
endif
- ifneq ($(wildcard /boot/develop/lib/*/libnetwork.so),)
+ ifneq ($(wildcard /boot/system/develop/lib/*/libnetwork.so),)
# Haiku
CFLAGS += -I/boot/common/include \
-I/boot/common/include/hubbub \
diff --git a/beos/fetch_rsrc.cpp b/beos/fetch_rsrc.cpp
index 887be7960..9461f5c79 100644
--- a/beos/fetch_rsrc.cpp
+++ b/beos/fetch_rsrc.cpp
@@ -33,6 +33,7 @@
extern "C" {
#include "utils/config.h"
#include "content/fetch.h"
+#include "content/fetchers.h"
#include "content/urldb.h"
#include "desktop/netsurf.h"
#include "utils/nsoption.h"
@@ -358,6 +359,16 @@ void fetch_rsrc_register(void)
{
lwc_string *scheme;
int err;
+ const struct fetcher_operation_table fetcher_ops_rsrc = {
+ fetch_rsrc_initialise,
+ fetch_rsrc_can_fetch,
+ fetch_rsrc_setup,
+ fetch_rsrc_start,
+ fetch_rsrc_abort,
+ fetch_rsrc_free,
+ fetch_rsrc_poll,
+ fetch_rsrc_finalise
+ };
err = find_app_resources();
@@ -371,15 +382,7 @@ void fetch_rsrc_register(void)
"(couldn't intern \"rsrc\").");
}
- fetch_add_fetcher(scheme,
- fetch_rsrc_initialise,
- fetch_rsrc_can_fetch,
- fetch_rsrc_setup,
- fetch_rsrc_start,
- fetch_rsrc_abort,
- fetch_rsrc_free,
- fetch_rsrc_poll,
- fetch_rsrc_finalise);
+ fetcher_add(scheme, &fetcher_ops_rsrc);
}
void fetch_rsrc_unregister(void)
diff --git a/beos/gui.cpp b/beos/gui.cpp
index db4374512..cb7effead 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -37,6 +37,7 @@
#include <FindDirectory.h>
#include <Mime.h>
#include <Path.h>
+#include <PathFinder.h>
#include <Roster.h>
#include <Screen.h>
#include <String.h>
@@ -46,7 +47,7 @@ extern "C" {
#include "content/content.h"
#include "content/content_protected.h"
#include "content/fetch.h"
-#include "content/fetchers/curl.h"
+#include "content/fetchers.h"
#include "content/fetchers/resource.h"
#include "content/hlcache.h"
#include "content/urldb.h"
@@ -79,9 +80,6 @@ extern "C" {
static void *myrealloc(void *ptr, size_t len, void *pw);
-/* Where to search for shared resources. Must have trailing / */
-#define RESPATH "/boot/apps/netsurf/res/"
-
//TODO: use resources
// enable using resources instead of files
#define USE_RESOURCES 1
@@ -297,20 +295,32 @@ static char *find_resource(char *buf, const char *filename, const char *def)
return buf;
}
- strcpy(t, RESPATH);
- strcat(t, filename);
- realpath(t, buf);
- if (access(buf, R_OK) == 0)
- return buf;
+
+ BPathFinder f((void*)find_resource);
+
+ BPath p;
+ if (f.FindPath(B_FIND_PATH_APPS_DIRECTORY, "netsurf/res", p) == B_OK) {
+ strcpy(t, p.Path());
+ strcat(t, filename);
+ realpath(t, buf);
+ if (access(buf, R_OK) == 0)
+ return buf;
+ }
if (def[0] == '%') {
snprintf(t, PATH_MAX, "%s%s", path.Path(), def + 1);
- realpath(t, buf);
+ if (realpath(t, buf) == NULL) {
+ strcpy(buf, t);
+ }
} else if (def[0] == '~') {
snprintf(t, PATH_MAX, "%s%s", getenv("HOME"), def + 1);
- realpath(t, buf);
+ if (realpath(t, buf) == NULL) {
+ strcpy(buf, t);
+ }
} else {
- realpath(def, buf);
+ if (realpath(def, buf) == NULL) {
+ strcpy(buf, def);
+ }
}
return buf;
@@ -488,7 +498,10 @@ static bool nslog_stream_configure(FILE *fptr)
static BPath get_messages_path()
{
- BPath p("/boot/apps/netsurf/res");
+ BPathFinder f((void*)get_messages_path);
+
+ BPath p;
+ f.FindPath(B_FIND_PATH_APPS_DIRECTORY, "netsurf/res", p);
// TODO: use Haiku's BLocale stuff
BString lang(getenv("LC_MESSAGES"));
lang.Truncate(2);
@@ -702,60 +715,41 @@ void nsbeos_pipe_message_top(BMessage *message, BWindow *_this, struct beos_scaf
static void gui_poll(bool active)
{
- CURLMcode code;
fd_set read_fd_set, write_fd_set, exc_fd_set;
- int max_fd = 0;
+ int max_fd;
struct timeval timeout;
unsigned int fd_count = 0;
- bool block = true;
bigtime_t next_schedule = 0;
- // handle early deadlines
- schedule_run();
+ /* get any active fetcher fd */
+ fetcher_fdset(&read_fd_set, &write_fd_set, &exc_fd_set, &max_fd);
- FD_ZERO(&read_fd_set);
- FD_ZERO(&write_fd_set);
- FD_ZERO(&exc_fd_set);
-
- if (active) {
- code = curl_multi_fdset(fetch_curl_multi,
- &read_fd_set,
- &write_fd_set,
- &exc_fd_set,
- &max_fd);
- assert(code == CURLM_OK);
- }
+ /* run the scheduler */
+ schedule_run();
// our own event pipe
FD_SET(sEventPipe[0], &read_fd_set);
- max_fd = MAX(max_fd, sEventPipe[0] + 1);
- // If there are pending events elsewhere, we should not be blocking
- if (!browser_reformat_pending) {
- if (earliest_callback_timeout != B_INFINITE_TIMEOUT) {
- next_schedule = earliest_callback_timeout - system_time();
- block = false;
- }
+ // max of all the fds in the set, plus one for select()
+ max_fd = MAX(max_fd, sEventPipe[0]) + 1;
- // we're quite late already...
- if (next_schedule < 0)
- next_schedule = 0;
-
- } else //we're not allowed to sleep, there is other activity going on.
- block = false;
+ // compute schedule timeout
+ if (earliest_callback_timeout != B_INFINITE_TIMEOUT) {
+ next_schedule = earliest_callback_timeout - system_time();
+ } else {
+ next_schedule = earliest_callback_timeout;
+ }
- /*
- LOG(("gui_poll: browser_reformat_pending:%d earliest_callback_timeout:%Ld"
- " next_schedule:%Ld block:%d ", browser_reformat_pending,
- earliest_callback_timeout, next_schedule, block));
- */
+ // we're quite late already...
+ if (next_schedule < 0)
+ next_schedule = 0;
timeout.tv_sec = (long)(next_schedule / 1000000LL);
timeout.tv_usec = (long)(next_schedule % 1000000LL);
//LOG(("gui_poll: select(%d, ..., %Ldus", max_fd, next_schedule));
fd_count = select(max_fd, &read_fd_set, &write_fd_set, &exc_fd_set,
- block ? NULL : &timeout);
+ &timeout);
//LOG(("select: %d\n", fd_count));
if (fd_count > 0 && FD_ISSET(sEventPipe[0], &read_fd_set)) {
@@ -767,11 +761,6 @@ static void gui_poll(bool active)
nsbeos_dispatch_event(message);
}
}
-
- schedule_run();
-
- if (browser_reformat_pending)
- nsbeos_window_process_reformats();
}
@@ -990,9 +979,8 @@ static struct gui_fetch_table beos_fetch_table = {
static struct gui_browser_table beos_browser_table = {
gui_poll,
- beos_schedule,
+ beos_schedule,
gui_quit,
- NULL, //set_search_ico
gui_launch_url,
NULL, //create_form_select_menu
NULL, //cert_verify
diff --git a/beos/plotters.cpp b/beos/plotters.cpp
index c2a99fea0..52ab4ec21 100644
--- a/beos/plotters.cpp
+++ b/beos/plotters.cpp
@@ -36,6 +36,7 @@ extern "C" {
#include "utils/log.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
+#include "utils/nsurl.h"
}
#include "beos/font.h"
#include "beos/gui.h"
diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp
index 35153b33d..0f87420a5 100644
--- a/beos/scaffolding.cpp
+++ b/beos/scaffolding.cpp
@@ -196,12 +196,11 @@ NSIconTextControl::NSIconTextControl(BRect frame, const char* name,
fIconBitmap(NULL)
{
BRect r(Bounds());
- BRect frame = r;
- frame.right = frame.left + ICON_WIDTH - 1;
- frame.bottom = frame.top + ICON_WIDTH - 1;
- frame.OffsetBy((int32)((r.IntegerHeight() - ICON_WIDTH + 3) / 2),
+ fIconFrame = r;
+ fIconFrame.right = fIconFrame.left + ICON_WIDTH - 1;
+ fIconFrame.bottom = fIconFrame.top + ICON_WIDTH - 1;
+ fIconFrame.OffsetBy((int32)((r.IntegerHeight() - ICON_WIDTH + 3) / 2),
(int32)((r.IntegerHeight() - ICON_WIDTH + 1) / 2));
- fIconFrame = frame;
FixupTextRect();
}
diff --git a/beos/window.cpp b/beos/window.cpp
index 8975c1871..d27bca758 100644
--- a/beos/window.cpp
+++ b/beos/window.cpp
@@ -883,9 +883,7 @@ void nsbeos_window_resize_event(BView *view, gui_window *g, BMessage *event)
width++;
height++;
-
- g->bw->reformat_pending = true;
- browser_reformat_pending = true;
+ browser_window_schedule_reformat(g->bw);
return;
}
@@ -901,51 +899,40 @@ void nsbeos_window_moved_event(BView *view, gui_window *g, BMessage *event)
//view->Invalidate(view->Bounds());
view->UnlockLooper();
- //g->bw->reformat_pending = true;
- //browser_reformat_pending = true;
-
-
return;
}
void nsbeos_reflow_all_windows(void)
{
- for (struct gui_window *g = window_list; g; g = g->next)
- g->bw->reformat_pending = true;
-
- browser_reformat_pending = true;
+ for (struct gui_window *g = window_list; g; g = g->next) {
+ browser_window_schedule_reformat(g->bw);
+ }
}
+
/**
- * Process pending reformats
+ * callback from core to reformat a window.
*/
-
-void nsbeos_window_process_reformats(void)
+static void beos_window_reformat(struct gui_window *g)
{
- struct gui_window *g;
-
- browser_reformat_pending = false;
- for (g = window_list; g; g = g->next) {
- NSBrowserFrameView *view = g->view;
- if (!g->bw->reformat_pending)
- continue;
- if (!view || !view->LockLooper())
- continue;
- g->bw->reformat_pending = false;
- BRect bounds = view->Bounds();
- view->UnlockLooper();
+ if (g == NULL) {
+ return;
+ }
+
+ NSBrowserFrameView *view = g->view;
+ if (view && view->LockLooper()) {
+ BRect bounds = view->Bounds();
+ view->UnlockLooper();
#warning XXX why - 1 & - 2 !???
- browser_window_reformat(g->bw,
- false,
- bounds.Width() + 1 /* - 2*/,
- bounds.Height() + 1);
- }
-
+ browser_window_reformat(g->bw,
+ false,
+ bounds.Width() + 1 /* - 2*/,
+ bounds.Height() + 1);
+ }
}
-
void nsbeos_window_destroy_browser(struct gui_window *g)
{
browser_window_destroy(g->bw);
@@ -1356,6 +1343,7 @@ static struct gui_window_table window_table = {
gui_window_set_scroll,
gui_window_get_dimensions,
gui_window_update_extent,
+ beos_window_reformat,
/* from scaffold */
gui_window_set_title,
diff --git a/beos/window.h b/beos/window.h
index fb67517d2..0e38d88ed 100644
--- a/beos/window.h
+++ b/beos/window.h
@@ -51,7 +51,6 @@ void nsbeos_dispatch_event(BMessage *message);
void nsbeos_reflow_all_windows(void);
-void nsbeos_window_process_reformats(void);
nsbeos_scaffolding *nsbeos_get_scaffold(struct gui_window *g);
struct browser_window *nsbeos_get_browser_for_gui(struct gui_window *g);