summaryrefslogtreecommitdiff
path: root/beos
diff options
context:
space:
mode:
authorFran├žois Revel <mmu_man@netsurf-browser.org>2008-10-09 01:22:14 +0000
committerFran├žois Revel <mmu_man@netsurf-browser.org>2008-10-09 01:22:14 +0000
commit8710d3a8144f33501d73d589f2babedbaf1b53b0 (patch)
tree8637e503d2ec8acf66f283b48d7ac1b91df76cb9 /beos
parentea205ecf23c1d2b4eb1c2bec6f9f14751106b5be (diff)
downloadnetsurf-8710d3a8144f33501d73d589f2babedbaf1b53b0.tar.gz
netsurf-8710d3a8144f33501d73d589f2babedbaf1b53b0.tar.bz2
- fix for copying selection to clipboard
- fix some leaks - prepare for about box (use about html from rsrc: but it's broken yet) - if more than 1 refs received at the same time, open the extra ones in a new window. svn path=/trunk/netsurf/; revision=5511
Diffstat (limited to 'beos')
-rw-r--r--beos/beos_gui.cpp14
-rw-r--r--beos/beos_gui.h1
-rw-r--r--beos/beos_res.rdef3
-rw-r--r--beos/beos_scaffolding.cpp73
-rw-r--r--beos/beos_window.cpp17
5 files changed, 76 insertions, 32 deletions
diff --git a/beos/beos_gui.cpp b/beos/beos_gui.cpp
index 0e05235a6..f762afe82 100644
--- a/beos/beos_gui.cpp
+++ b/beos/beos_gui.cpp
@@ -173,6 +173,13 @@ void
NSBrowserApplication::ArgvReceived(int32 argc, char **argv)
{
CALLED();
+ NSBrowserWindow *win = nsbeos_find_last_window();
+ if (!win) {
+ return;
+ }
+ win->Unlock();
+ BMessage *message = DetachCurrentMessage();
+ nsbeos_pipe_message_top(message, win, win->Scaffolding());
}
@@ -191,6 +198,13 @@ NSBrowserApplication::RefsReceived(BMessage *message)
}
+void
+NSBrowserApplication::AboutRequested()
+{
+ nsbeos_pipe_message(new BMessage(B_ABOUT_REQUESTED), NULL, NULL);
+}
+
+
bool
NSBrowserApplication::QuitRequested()
{
diff --git a/beos/beos_gui.h b/beos/beos_gui.h
index 8e49b8665..c6d2fdef6 100644
--- a/beos/beos_gui.h
+++ b/beos/beos_gui.h
@@ -40,6 +40,7 @@ virtual void MessageReceived(BMessage *message);
virtual void RefsReceived(BMessage *message);
virtual void ArgvReceived(int32 argc, char **argv);
+virtual void AboutRequested();
virtual bool QuitRequested();
};
diff --git a/beos/beos_res.rdef b/beos/beos_res.rdef
index 8726625e7..02d4f9a44 100644
--- a/beos/beos_res.rdef
+++ b/beos/beos_res.rdef
@@ -35,7 +35,8 @@ resource(202, "adblock.css") #'data' import "res/adblock.css";
resource(203, "ca-bundle.txt") #'data' import "res/ca-bundle.txt";
resource(204, "messages") #'data' import "res/messages";
resource(205, "Aliases") #'data' import "res/Aliases";
-/* resource(206, "netsurf.xpm") #'data' import "res/netsurf.xpm"; */
+/* resource(206, "about.en.html") #'data' import "res/about.en.html"; */
+/* resource(210, "netsurf.xpm") #'data' import "res/netsurf.xpm"; */
/* throbber */
resource(400, "throbber0.png") #'data' import "res/throbber/throbber0.png";
diff --git a/beos/beos_scaffolding.cpp b/beos/beos_scaffolding.cpp
index 1e132e15f..ad1d873cb 100644
--- a/beos/beos_scaffolding.cpp
+++ b/beos/beos_scaffolding.cpp
@@ -327,6 +327,7 @@ void
NSBrowserWindow::MessageReceived(BMessage *message)
{
switch (message->what) {
+ case B_ARGV_RECEIVED:
case B_REFS_RECEIVED:
DetachCurrentMessage();
nsbeos_pipe_message_top(message, this, fScaffolding);
@@ -393,41 +394,53 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
}
case B_REFS_RECEIVED:
{
+ int32 i;
entry_ref ref;
- if (message->FindRef("refs", &ref) < B_OK)
- break;
-
- BString url("file://");
- BPath path(&ref);
- if (path.InitCheck() < B_OK)
- break;
-
- BNode node(path.Path());
- if (node.InitCheck() < B_OK)
- break;
- if (node.IsSymLink()) {
- // dereference the symlink
- BEntry entry(path.Path(), true);
- if (entry.InitCheck() < B_OK)
- break;
- if (entry.GetPath(&path) < B_OK)
- break;
- if (node.SetTo(path.Path()) < B_OK)
+ for (i = 0; message->FindRef("refs", i, &ref) >= B_OK; i++) {
+ BString url("file://");
+ BPath path(&ref);
+ if (path.InitCheck() < B_OK)
break;
- }
- attr_info ai;
- if (node.GetAttrInfo("META:url", &ai) >= B_OK) {
- char data[(size_t)ai.size + 1];
- memset(data, 0, (size_t)ai.size + 1);
- if (node.ReadAttr("META:url", B_STRING_TYPE, 0LL, data, (size_t)ai.size) < 4)
+ BNode node(path.Path());
+ if (node.InitCheck() < B_OK)
break;
- url = data;
- } else
- url << path.Path();
-
- browser_window_go(bw, url.String(), 0, true);
+ if (node.IsSymLink()) {
+ // dereference the symlink
+ BEntry entry(path.Path(), true);
+ if (entry.InitCheck() < B_OK)
+ break;
+ if (entry.GetPath(&path) < B_OK)
+ break;
+ if (node.SetTo(path.Path()) < B_OK)
+ break;
+ }
+
+ attr_info ai;
+ if (node.GetAttrInfo("META:url", &ai) >= B_OK) {
+ char data[(size_t)ai.size + 1];
+ memset(data, 0, (size_t)ai.size + 1);
+ if (node.ReadAttr("META:url", B_STRING_TYPE, 0LL, data, (size_t)ai.size) < 4)
+ break;
+ url = data;
+ } else
+ url << path.Path();
+
+ if (/*message->WasDropped() &&*/ i == 0)
+ browser_window_go(bw, url.String(), 0, true);
+ else
+ browser_window_create(url.String(), bw, NULL, false, false);
+ }
+ break;
+ }
+ case B_ARGV_RECEIVED:
+ {
+ int32 i;
+ BString url;
+ for (i = 1; message->FindString("argv", i, &url) >= B_OK; i++) {
+ browser_window_create(url.String(), bw, NULL, false, false);
+ }
break;
}
case B_COPY:
diff --git a/beos/beos_window.cpp b/beos/beos_window.cpp
index 30611edb7..f51b5253b 100644
--- a/beos/beos_window.cpp
+++ b/beos/beos_window.cpp
@@ -140,6 +140,7 @@ NSBrowserFrameView::MessageReceived(BMessage *message)
{
switch (message->what) {
case B_SIMPLE_DATA:
+ case B_ARGV_RECEIVED:
case B_REFS_RECEIVED:
case B_COPY:
case B_CUT:
@@ -650,10 +651,12 @@ void nsbeos_dispatch_event(BMessage *message)
if (gui && gui != z) {
LOG(("discarding event for destroyed gui_window"));
+ delete message;
return;
}
if (scaffold && (!y || scaffold != y->scaffold)) {
LOG(("discarding event for destroyed scaffolding"));
+ delete message;
return;
}
@@ -671,6 +674,16 @@ void nsbeos_dispatch_event(BMessage *message)
// from the BApplication
netsurf_quit = true;
break;
+ case B_ABOUT_REQUESTED:
+ {
+ //BAlert *alert;
+ //XXX: i18n-ize
+ /* XXX: doesn't work yet! bug in rsrc:/
+ BString url("rsrc:/about.en.html,text/html");
+ browser_window_create(url.String(), NULL, NULL, true, false);
+ */
+ break;
+ }
case _UPDATE_:
if (gui && view)
nsbeos_window_expose_event(view, gui, message);
@@ -1765,7 +1778,9 @@ bool gui_empty_clipboard(void)
bool gui_add_to_clipboard(const char *text, size_t length, bool space)
{
- current_selection << text;
+ BString s;
+ s.SetTo(text, length);
+ current_selection << s;
if (space)
current_selection << " ";
return true;