summaryrefslogtreecommitdiff
path: root/beos/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'beos/window.cpp')
-rw-r--r--beos/window.cpp76
1 files changed, 58 insertions, 18 deletions
diff --git a/beos/window.cpp b/beos/window.cpp
index 253b5d1c0..f26ba9191 100644
--- a/beos/window.cpp
+++ b/beos/window.cpp
@@ -131,7 +131,7 @@ static GdkCursor *nsbeos_create_menu_cursor(void);
NSBrowserFrameView::NSBrowserFrameView(BRect frame, struct gui_window *gui)
: BView(frame, "NSBrowserFrameView", B_FOLLOW_ALL_SIDES,
- B_WILL_DRAW | B_NAVIGABLE | B_FRAME_EVENTS /*| B_SUBPIXEL_PRECISE*/),
+ B_WILL_DRAW | B_NAVIGABLE | B_FRAME_EVENTS ),
fGuiWindow(gui)
{
}
@@ -250,7 +250,7 @@ NSBrowserFrameView::MessageReceived(BMessage *message)
nsbeos_pipe_message_top(message, NULL, fGuiWindow->scaffold);
break;
default:
- message->PrintToStream();
+ //message->PrintToStream();
BView::MessageReceived(message);
}
}
@@ -756,18 +756,25 @@ void nsbeos_dispatch_event(BMessage *message)
break;
case 'nsLO': // login
{
- BString url;
+ nsurl* url;
BString realm;
BString auth;
- if (message->FindString("URL", &url) < B_OK)
+ void* cbpw;
+ nserror (*cb)(bool proceed, void* pw);
+
+ if (message->FindPointer("URL", (void**)&url) < B_OK)
break;
if (message->FindString("Realm", &realm) < B_OK)
break;
if (message->FindString("Auth", &auth) < B_OK)
break;
+ if (message->FindPointer("callback", (void**)&cb) < B_OK)
+ break;
+ if (message->FindPointer("callback_pw", (void**)&cbpw) < B_OK)
+ break;
//printf("login to '%s' with '%s'\n", url.String(), auth.String());
- urldb_set_auth_details(url.String(), realm.String(), auth.String());
- browser_window_go(gui->bw, url.String(), 0, true);
+ urldb_set_auth_details(url, realm.String(), auth.String());
+ cb(true, cbpw);
break;
}
default:
@@ -926,11 +933,44 @@ void nsbeos_window_keypress_event(BView *view, gui_window *g, BMessage *event)
nskey = utf8_to_ucs4(bytes, numbytes);
}
- bool done = browser_window_key_press(g->bw, nskey);
- LOG(("nskey %d %d", nskey, done));
- //if (browser_window_key_press(g->bw, nskey))
+ if(browser_window_key_press(g->bw, nskey))
return;
-
+
+ // Remaining events are for scrolling the page around
+ float hdelta = 0.0f, vdelta = 0.0f;
+ g->view->LockLooper();
+ BRect size = g->view->Bounds();
+ switch (byte) {
+ case B_HOME:
+ g->view->ScrollTo(0.0f, 0.0f);
+ break;
+ case B_END:
+ {
+ // TODO
+ break;
+ }
+ case B_PAGE_UP:
+ vdelta = -size.Height();
+ break;
+ case B_PAGE_DOWN:
+ vdelta = size.Height();
+ break;
+ case B_LEFT_ARROW:
+ hdelta = -10;
+ break;
+ case B_RIGHT_ARROW:
+ hdelta = 10;
+ break;
+ case B_UP_ARROW:
+ vdelta = -10;
+ break;
+ case B_DOWN_ARROW:
+ vdelta = 10;
+ break;
+ }
+
+ g->view->ScrollBy(hdelta, vdelta);
+ g->view->UnlockLooper();
}
#warning WRITEME
@@ -1038,7 +1078,7 @@ gboolean nsbeos_window_keypress_event(GtkWidget *widget, GdkEventKey *event,
void nsbeos_window_resize_event(BView *view, gui_window *g, BMessage *event)
{
- CALLED();
+ //CALLED();
int32 width;
int32 height;
@@ -1088,7 +1128,7 @@ void nsbeos_window_resize_event(BView *view, gui_window *g, BMessage *event)
void nsbeos_window_moved_event(BView *view, gui_window *g, BMessage *event)
{
- CALLED();
+ //CALLED();
#warning XXX: Invalidate ?
if (!view || !view->LockLooper())
@@ -1272,7 +1312,7 @@ void gui_window_update_box(struct gui_window *g, const struct rect *rect)
bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
{
- CALLED();
+ //CALLED();
if (g->view == NULL)
return false;
if (!g->view->LockLooper())
@@ -1302,7 +1342,7 @@ bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
{
- CALLED();
+ //CALLED();
if (g->view == NULL)
return;
if (!g->view->LockLooper())
@@ -1344,7 +1384,7 @@ void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
void gui_window_update_extent(struct gui_window *g)
{
- CALLED();
+ //CALLED();
if (!g->bw->current_content)
return;
@@ -1359,7 +1399,7 @@ void gui_window_update_extent(struct gui_window *g)
float y_prop = g->view->Bounds().Height() / y_max;
x_max -= g->view->Bounds().Width() + 1;
y_max -= g->view->Bounds().Height() + 1;
-printf("x_max = %f y_max = %f x_prop = %f y_prop = %f\n", x_max, y_max, x_prop, y_prop);
+ LOG(("x_max = %f y_max = %f x_prop = %f y_prop = %f\n", x_max, y_max, x_prop, y_prop));
if (g->view->ScrollBar(B_HORIZONTAL)) {
g->view->ScrollBar(B_HORIZONTAL)->SetRange(0, x_max);
g->view->ScrollBar(B_HORIZONTAL)->SetProportion(x_prop);
@@ -1542,7 +1582,7 @@ void gui_window_hide_pointer(struct gui_window *g)
void gui_window_place_caret(struct gui_window *g, int x, int y, int height)
{
- CALLED();
+ //CALLED();
if (g->view == NULL)
return;
if (!g->view->LockLooper())
@@ -1674,7 +1714,7 @@ bool gui_add_to_clipboard(const char *text, size_t length, bool space,
BFont font;
text_run *run = new text_run;
- nsbeos_style_to_font(font, &fstyle);
+ nsbeos_style_to_font(font, fstyle);
run->offset = current_selection.Length();
run->font = font;
run->color = nsbeos_rgb_colour(fstyle->foreground);