diff options
Diffstat (limited to 'frontends/beos')
-rw-r--r-- | frontends/beos/Makefile | 4 | ||||
-rw-r--r-- | frontends/beos/Makefile.tools | 14 | ||||
-rw-r--r-- | frontends/beos/bitmap.cpp | 76 | ||||
-rw-r--r-- | frontends/beos/gui.cpp | 11 | ||||
-rw-r--r-- | frontends/beos/options.h | 5 | ||||
l--------- | frontends/beos/res/en/maps.html | 1 | ||||
l--------- | frontends/beos/res/maps.html | 1 | ||||
-rw-r--r-- | frontends/beos/window.cpp | 201 | ||||
-rw-r--r-- | frontends/beos/window.h | 2 |
9 files changed, 137 insertions, 178 deletions
diff --git a/frontends/beos/Makefile b/frontends/beos/Makefile index 97fa84810..81c9326ee 100644 --- a/frontends/beos/Makefile +++ b/frontends/beos/Makefile @@ -110,7 +110,7 @@ RDEF_IMP_BEOS := $(addprefix $(OBJROOT)/,$(subst /,_,$(RDEF_IMP_BEOS))) RDEP_BEOS := \ adblock.css beosdefault.css default.css internal.css quirks.css \ netsurf.png favicon.png ca-bundle.txt \ - credits.html licence.html welcome.html maps.html SearchEngines + credits.html licence.html welcome.html SearchEngines RDEP_BEOS := $(addprefix $(FRONTEND_RESOURCES_DIR)/,$(RDEP_BEOS)) \ $(wildcard $(FRONTEND_RESOURCES_DIR)/icons/*.png) \ @@ -151,7 +151,7 @@ install-beos: package-beos: $(PKGNAME) $(VQ)echo Creating $(PKGNAME) -$(PKGNAME): $(EXETARGET) +$(PKGNAME): $(EXETARGET) $(POSTEXES) $(Q)rm -rf $(HAIKU_TARGET_DIR) $(Q)rm -rf $(PKGNAME) $(Q)$(MKDIR) $(HAIKU_TARGET_DIR) diff --git a/frontends/beos/Makefile.tools b/frontends/beos/Makefile.tools new file mode 100644 index 000000000..0324a2825 --- /dev/null +++ b/frontends/beos/Makefile.tools @@ -0,0 +1,14 @@ +# -*- mode: makefile-gmake -*- +## +## BeOS target tool setup +## + +# Building for BeOS/Haiku +#ifeq ($(HOST),beos) + # Build for BeOS on BeOS + GCCSDK_INSTALL_ENV := /boot/develop + CC := gcc + CXX := g++ + EXEEXT := + PKG_CONFIG := pkg-config +#endif diff --git a/frontends/beos/bitmap.cpp b/frontends/beos/bitmap.cpp index c4b008755..f7e8fa032 100644 --- a/frontends/beos/bitmap.cpp +++ b/frontends/beos/bitmap.cpp @@ -114,28 +114,28 @@ static inline void nsbeos_rgba_to_bgra(void *src, * Create a bitmap. * * \param width width of image in pixels - * \param height width of image in pixels - * \param state a flag word indicating the initial state + * \param height height of image in pixels + * \param bflags flags for bitmap creation * \return an opaque struct bitmap, or NULL on memory exhaustion */ -static void *bitmap_create(int width, int height, unsigned int state) +static void *bitmap_create(int width, int height, enum gui_bitmap_flags flags) { struct bitmap *bmp = (struct bitmap *)malloc(sizeof(struct bitmap)); if (bmp == NULL) return NULL; - int32 flags = 0; - if (state & BITMAP_CLEAR_MEMORY) - flags |= B_BITMAP_CLEAR_TO_WHITE; + int32 Bflags = 0; + if (flags & BITMAP_CLEAR) + Bflags |= B_BITMAP_CLEAR_TO_WHITE; BRect frame(0, 0, width - 1, height - 1); //XXX: bytes per row ? - bmp->primary = new BBitmap(frame, flags, B_RGBA32); - bmp->shadow = new BBitmap(frame, flags, B_RGBA32); + bmp->primary = new BBitmap(frame, Bflags, B_RGBA32); + bmp->shadow = new BBitmap(frame, Bflags, B_RGBA32); bmp->pretile_x = bmp->pretile_y = bmp->pretile_xy = NULL; - bmp->opaque = (state & BITMAP_OPAQUE) != 0; + bmp->opaque = (flags & BITMAP_OPAQUE) != 0; return bmp; } @@ -156,21 +156,6 @@ static void bitmap_set_opaque(void *vbitmap, bool opaque) /** - * Tests whether a bitmap has an opaque alpha channel - * - * \param vbitmap a bitmap, as returned by bitmap_create() - * \return whether the bitmap is opaque - */ -static bool bitmap_test_opaque(void *vbitmap) -{ - struct bitmap *bitmap = (struct bitmap *)vbitmap; - assert(bitmap); - /* todo: test if bitmap is opaque */ - return false; -} - - -/** * Gets whether a bitmap should be plotted opaque * * \param vbitmap a bitmap, as returned by bitmap_create() @@ -216,20 +201,6 @@ static size_t bitmap_get_rowstride(void *vbitmap) /** - * Find the bytes per pixels of a bitmap. - * - * \param vbitmap a bitmap, as returned by bitmap_create() - * \return bytes per pixels of the bitmap - */ -static size_t bitmap_get_bpp(void *vbitmap) -{ - struct bitmap *bitmap = (struct bitmap *)vbitmap; - assert(bitmap); - return 4; -} - - -/** * Free pretiles of a bitmap. * * \param bitmap The bitmap to free the pretiles of. @@ -261,32 +232,6 @@ static void bitmap_destroy(void *vbitmap) /** - * Save a bitmap in the platform's native format. - * - * \param vbitmap a bitmap, as returned by bitmap_create() - * \param path pathname for file - * \param flags modify the behaviour of the save - * \return true on success, false on error and error reported - */ -static bool bitmap_save(void *vbitmap, const char *path, unsigned flags) -{ - struct bitmap *bitmap = (struct bitmap *)vbitmap; - BTranslatorRoster *roster = BTranslatorRoster::Default(); - BBitmapStream stream(bitmap->primary); - BFile file(path, B_WRITE_ONLY | B_CREATE_FILE); - uint32 type = B_PNG_FORMAT; - - if (file.InitCheck() < B_OK) - return false; - - if (roster->Translate(&stream, NULL, NULL, &file, type) < B_OK) - return false; - - return true; -} - - -/** * The bitmap image has changed, so flush any persistant cache. * * \param vbitmap a bitmap, as returned by bitmap_create() @@ -543,13 +488,10 @@ static struct gui_bitmap_table bitmap_table = { /*.destroy =*/ bitmap_destroy, /*.set_opaque =*/ bitmap_set_opaque, /*.get_opaque =*/ bitmap_get_opaque, - /*.test_opaque =*/ bitmap_test_opaque, /*.get_buffer =*/ bitmap_get_buffer, /*.get_rowstride =*/ bitmap_get_rowstride, /*.get_width =*/ bitmap_get_width, /*.get_height =*/ bitmap_get_height, - /*.get_bpp =*/ bitmap_get_bpp, - /*.save =*/ bitmap_save, /*.modified =*/ bitmap_modified, /*.render =*/ bitmap_render, }; diff --git a/frontends/beos/gui.cpp b/frontends/beos/gui.cpp index c83bf3f24..cbfe352c8 100644 --- a/frontends/beos/gui.cpp +++ b/frontends/beos/gui.cpp @@ -750,12 +750,12 @@ void nsbeos_gui_poll(void) unsigned int fd_count = 0; bigtime_t next_schedule = 0; - /* get any active fetcher fd */ - fetch_fdset(&read_fd_set, &write_fd_set, &exc_fd_set, &max_fd); - /* run the scheduler */ schedule_run(); + /* get any active fetcher fd */ + fetch_fdset(&read_fd_set, &write_fd_set, &exc_fd_set, &max_fd); + // our own event pipe FD_SET(sEventPipe[0], &read_fd_set); @@ -993,12 +993,11 @@ static struct gui_fetch_table beos_fetch_table = { static struct gui_misc_table beos_misc_table = { beos_schedule, - beos_warn_user, gui_quit, gui_launch_url, - NULL, //cert_verify - gui_401login_open, + NULL, //401login NULL, // pdf_password (if we have Haru support) + NULL, // present_cookies }; diff --git a/frontends/beos/options.h b/frontends/beos/options.h index 40d23a3bc..f959442f7 100644 --- a/frontends/beos/options.h +++ b/frontends/beos/options.h @@ -18,13 +18,12 @@ */ -#ifndef _NETSURF_BEOS_OPTIONS_H_ -#define _NETSURF_BEOS_OPTIONS_H_ +#ifndef NETSURF_BEOS_OPTIONS_H_ +#define NETSURF_BEOS_OPTIONS_H_ /* currently nothing here */ #endif -NSOPTION_BOOL(render_resample, false) NSOPTION_STRING(url_file, NULL) diff --git a/frontends/beos/res/en/maps.html b/frontends/beos/res/en/maps.html deleted file mode 120000 index 507a4b248..000000000 --- a/frontends/beos/res/en/maps.html +++ /dev/null @@ -1 +0,0 @@ -../../../../resources/en/maps.html
\ No newline at end of file diff --git a/frontends/beos/res/maps.html b/frontends/beos/res/maps.html deleted file mode 120000 index a32f725fb..000000000 --- a/frontends/beos/res/maps.html +++ /dev/null @@ -1 +0,0 @@ -en/maps.html
\ No newline at end of file diff --git a/frontends/beos/window.cpp b/frontends/beos/window.cpp index 49d049c28..b97be0f07 100644 --- a/frontends/beos/window.cpp +++ b/frontends/beos/window.cpp @@ -92,8 +92,6 @@ struct gui_window { /* Keep gui_windows in a list for cleanup later */ struct gui_window *next, *prev; - - float scale; }; @@ -336,11 +334,6 @@ struct browser_window *nsbeos_get_browser_for_gui(struct gui_window *g) return g->bw; } -float nsbeos_get_scale_for_gui(struct gui_window *g) -{ - return g->scale; -} - /* Create a gui_window */ static struct gui_window *gui_window_create(struct browser_window *bw, struct gui_window *existing, @@ -360,7 +353,6 @@ static struct gui_window *gui_window_create(struct browser_window *bw, g->bw = bw; g->mouse.state = 0; g->current_pointer = GUI_POINTER_DEFAULT; - g->scale = browser_window_get_scale(bw); g->careth = 0; g->pending_resizes = 0; @@ -518,9 +510,10 @@ void nsbeos_dispatch_event(BMessage *message) if (gui->mouse.state & BROWSER_MOUSE_MOD_2 && !ctrl) gui->mouse.state ^= BROWSER_MOUSE_MOD_2; - browser_window_mouse_track(gui->bw, (browser_mouse_state)gui->mouse.state, - (int)(where.x / gui->scale), - (int)(where.y / gui->scale)); + browser_window_mouse_track(gui->bw, + (browser_mouse_state)gui->mouse.state, + (int)(where.x), + (int)(where.y)); gui->last_x = (int)where.x; gui->last_y = (int)where.y; @@ -562,8 +555,8 @@ void nsbeos_dispatch_event(BMessage *message) if (mods & B_CONTROL_KEY) gui->mouse.state |= BROWSER_MOUSE_MOD_2; - gui->mouse.pressed_x = where.x / gui->scale; - gui->mouse.pressed_y = where.y / gui->scale; + gui->mouse.pressed_x = where.x; + gui->mouse.pressed_y = where.y; // make sure the view is in focus if (view && view->LockLooper()) { @@ -624,8 +617,8 @@ void nsbeos_dispatch_event(BMessage *message) if (gui->mouse.state & (BROWSER_MOUSE_CLICK_1|BROWSER_MOUSE_CLICK_2)) browser_window_mouse_click(gui->bw, (browser_mouse_state)gui->mouse.state, - where.x / gui->scale, - where.y / gui->scale); + where.x, + where.y); else browser_window_mouse_track(gui->bw, (browser_mouse_state)0, where.x, where.y); @@ -686,7 +679,6 @@ void nsbeos_dispatch_event(BMessage *message) void nsbeos_window_expose_event(BView *view, gui_window *g, BMessage *message) { BRect updateRect; - //float scale = g->scale; struct rect clip; struct redraw_context ctx = { true, true, &nsbeos_plotters }; @@ -1116,93 +1108,79 @@ static void gui_window_update_extent(struct gui_window *g) g->view->UnlockLooper(); } -/* some cursors like those in Firefox */ -// XXX: move to separate file or resource ? +static BCursorID gui_haiku_pointer(gui_pointer_shape shape) +{ + switch (shape) { + case GUI_POINTER_POINT: /* link */ + return B_CURSOR_ID_FOLLOW_LINK; -const uint8 kLinkCursorBits[] = { - 16, /* cursor size */ - 1, /* bits per pixel */ - 2, /* vertical hot spot */ - 2, /* horizontal hot spot */ + case GUI_POINTER_CARET: /* input */ + return B_CURSOR_ID_I_BEAM; - /* data */ - 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x24, 0x00, 0x24, 0x00, 0x13, 0xe0, 0x12, 0x5c, 0x09, 0x2a, - 0x08, 0x01, 0x3c, 0x21, 0x4c, 0x71, 0x42, 0x71, 0x30, 0xf9, 0x0c, 0xf9, 0x02, 0x02, 0x01, 0x00, + case GUI_POINTER_MENU: + return B_CURSOR_ID_CONTEXT_MENU; - /* mask */ - 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x1f, 0xe0, 0x1f, 0xfc, 0x0f, 0xfe, - 0x0f, 0xff, 0x3f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x3f, 0xff, 0x0f, 0xff, 0x03, 0xfc, 0x01, 0xe0 -}; + case GUI_POINTER_UP: + return B_CURSOR_ID_RESIZE_NORTH; -const uint8 kWatchCursorBits[] = { - 16, /* cursor size */ - 1, /* bits per pixel */ - 0, /* vertical hot spot */ - 1, /* horizontal hot spot */ + case GUI_POINTER_DOWN: + return B_CURSOR_ID_RESIZE_SOUTH; - /* data */ - 0x70, 0x00, 0x48, 0x00, 0x48, 0x00, 0x27, 0xc0, 0x24, 0xb8, 0x12, 0x54, 0x10, 0x02, 0x78, 0x02, - 0x98, 0x02, 0x84, 0x02, 0x60, 0x3a, 0x18, 0x46, 0x04, 0x8a, 0x02, 0x92, 0x01, 0x82, 0x00, 0x45, + case GUI_POINTER_LEFT: + return B_CURSOR_ID_RESIZE_WEST; - /* mask */ - 0x70, 0x00, 0x78, 0x00, 0x78, 0x00, 0x3f, 0xc0, 0x3f, 0xf8, 0x1f, 0xfc, 0x1f, 0xfe, 0x7f, 0xfe, - 0xff, 0xfe, 0xff, 0xfe, 0x7f, 0xfe, 0x1f, 0xfe, 0x07, 0xfe, 0x03, 0xfe, 0x01, 0xfe, 0x00, 0x7f -}; + case GUI_POINTER_RIGHT: + return B_CURSOR_ID_RESIZE_EAST; -const uint8 kWatch2CursorBits[] = { - 16, /* cursor size */ - 1, /* bits per pixel */ - 0, /* vertical hot spot */ - 1, /* horizontal hot spot */ + case GUI_POINTER_RU: + return B_CURSOR_ID_RESIZE_NORTH_EAST; - /* data */ - 0x70, 0x00, 0x48, 0x00, 0x48, 0x00, 0x27, 0xc0, 0x24, 0xb8, 0x12, 0x54, 0x10, 0x02, 0x78, 0x02, - 0x98, 0x02, 0x84, 0x02, 0x60, 0x3a, 0x18, 0x46, 0x04, 0xa2, 0x02, 0x92, 0x01, 0xa2, 0x00, 0x45, + case GUI_POINTER_LD: + return B_CURSOR_ID_RESIZE_SOUTH_WEST; - /* mask */ - 0x70, 0x00, 0x78, 0x00, 0x78, 0x00, 0x3f, 0xc0, 0x3f, 0xf8, 0x1f, 0xfc, 0x1f, 0xfe, 0x7f, 0xfe, - 0xff, 0xfe, 0xff, 0xfe, 0x7f, 0xfe, 0x1f, 0xfe, 0x07, 0xfe, 0x03, 0xfe, 0x01, 0xfe, 0x00, 0x7f -}; + case GUI_POINTER_LU: + return B_CURSOR_ID_RESIZE_NORTH_WEST; + + case GUI_POINTER_RD: + return B_CURSOR_ID_RESIZE_SOUTH_EAST; + + case GUI_POINTER_CROSS: + return B_CURSOR_ID_CROSS_HAIR; + + case GUI_POINTER_MOVE: + return B_CURSOR_ID_MOVE; + + case GUI_POINTER_WAIT: + case GUI_POINTER_PROGRESS: + return B_CURSOR_ID_PROGRESS; + case GUI_POINTER_NO_DROP: + case GUI_POINTER_NOT_ALLOWED: + return B_CURSOR_ID_NOT_ALLOWED; + + case GUI_POINTER_HELP: + return B_CURSOR_ID_HELP; + + case GUI_POINTER_DEFAULT: + default: + break; + } + return B_CURSOR_ID_SYSTEM_DEFAULT; +} static void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape) { - BCursor *cursor = NULL; - bool allocated = false; - if (g->current_pointer == shape) return; g->current_pointer = shape; - switch (shape) { - case GUI_POINTER_POINT: - cursor = new BCursor(kLinkCursorBits); - allocated = true; - break; - case GUI_POINTER_CARET: - cursor = (BCursor *)B_CURSOR_I_BEAM; - break; - case GUI_POINTER_WAIT: - cursor = new BCursor(kWatchCursorBits); - allocated = true; - break; - case GUI_POINTER_PROGRESS: - cursor = new BCursor(kWatch2CursorBits); - allocated = true; - break; - default: - cursor = (BCursor *)B_CURSOR_SYSTEM_DEFAULT; - allocated = false; - } + BCursor cursor(gui_haiku_pointer(shape)); if (g->view && g->view->LockLooper()) { - g->view->SetViewCursor(cursor); + g->view->SetViewCursor(&cursor); g->view->UnlockLooper(); } - - if (allocated) - delete cursor; } static void gui_window_place_caret(struct gui_window *g, int x, int y, int height, @@ -1341,28 +1319,64 @@ struct gui_clipboard_table *beos_clipboard_table = &clipboard_table; * \param g The gui window to measure content area of. * \param width receives width of window * \param height receives height of window - * \param scaled whether to return scaled values * \return NSERROR_OK on sucess and width and height updated * else error code. */ static nserror -gui_window_get_dimensions(struct gui_window *g, int *width, int *height, - bool scaled) +gui_window_get_dimensions(struct gui_window *g, int *width, int *height) { if (g->view && g->view->LockLooper()) { *width = g->view->Bounds().Width() + 1; *height = g->view->Bounds().Height() + 1; g->view->UnlockLooper(); - - if (scaled) { - *width /= g->scale; - *height /= g->scale; - } } return NSERROR_OK; } + +/** + * process miscellaneous window events + * + * \param gw The window receiving the event. + * \param event The event code. + * \return NSERROR_OK when processed ok + */ +static nserror +gui_window_event(struct gui_window *gw, enum gui_window_event event) +{ + switch (event) { + case GW_EVENT_UPDATE_EXTENT: + gui_window_update_extent(gw); + break; + + case GW_EVENT_REMOVE_CARET: + gui_window_remove_caret(gw); + break; + + case GW_EVENT_NEW_CONTENT: + gui_window_new_content(gw); + break; + + case GW_EVENT_START_SELECTION: + gui_start_selection(gw); + break; + + case GW_EVENT_START_THROBBER: + gui_window_start_throbber(gw); + break; + + case GW_EVENT_STOP_THROBBER: + gui_window_stop_throbber(gw); + break; + + default: + break; + } + return NSERROR_OK; +} + + static struct gui_window_table window_table = { gui_window_create, gui_window_destroy, @@ -1370,7 +1384,7 @@ static struct gui_window_table window_table = { gui_window_get_scroll, gui_window_set_scroll, gui_window_get_dimensions, - gui_window_update_extent, + gui_window_event, /* from scaffold */ gui_window_set_title, @@ -1379,18 +1393,13 @@ static struct gui_window_table window_table = { gui_window_set_status, gui_window_set_pointer, gui_window_place_caret, - gui_window_remove_caret, - gui_window_start_throbber, - gui_window_stop_throbber, NULL, //drag_start NULL, //save_link - NULL, //scroll_start - gui_window_new_content, NULL, //create_form_select_menu NULL, //file_gadget_open NULL, //drag_save_object NULL, //drag_save_selection - gui_start_selection + NULL //console_log }; struct gui_window_table *beos_window_table = &window_table; diff --git a/frontends/beos/window.h b/frontends/beos/window.h index 928acca22..f8726a887 100644 --- a/frontends/beos/window.h +++ b/frontends/beos/window.h @@ -72,8 +72,6 @@ struct beos_scaffolding *nsbeos_get_scaffold(struct gui_window *g); struct browser_window *nsbeos_get_browser_for_gui(struct gui_window *g); -float nsbeos_get_scale_for_gui(struct gui_window *g); - int nsbeos_gui_window_update_targets(struct gui_window *g); void nsbeos_window_destroy_browser(struct gui_window *g); |