From 246ab6d9ff7504cdc7bf88efe1d4aca987b5c095 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 3 May 2016 19:45:25 +0100 Subject: [PATCH] allow beos frontend to make clipboard functions private. reduces the unecessary export of clipboard functions in beos frontend and also removes inclusion of unecessary headers. --- beos/gui.cpp | 6 +----- beos/window.cpp | 13 +++++++++--- beos/window.h | 54 ++++++++++++++++++++++++++++++------------------- 3 files changed, 44 insertions(+), 29 deletions(-) diff --git a/beos/gui.cpp b/beos/gui.cpp index 4fd2ecf2c..95b159774 100644 --- a/beos/gui.cpp +++ b/beos/gui.cpp @@ -948,10 +948,6 @@ void die(const char * const error) exit(EXIT_FAILURE); } -static struct gui_clipboard_table beos_clipboard_table = { - gui_get_clipboard, - gui_set_clipboard, -}; static struct gui_fetch_table beos_fetch_table = { fetch_filetype, @@ -981,7 +977,7 @@ int main(int argc, char** argv) &beos_misc_table, beos_window_table, beos_download_table, - &beos_clipboard_table, + beos_clipboard_table, &beos_fetch_table, NULL, /* use POSIX file */ NULL, /* default utf8 */ diff --git a/beos/window.cpp b/beos/window.cpp index ed6abcb60..89fb7819c 100644 --- a/beos/window.cpp +++ b/beos/window.cpp @@ -407,7 +407,7 @@ static struct gui_window *gui_window_create(struct browser_window *bw, return g; } - +/* exported interface documented in beos/window.h */ void nsbeos_dispatch_event(BMessage *message) { struct gui_window *gui = NULL; @@ -1266,7 +1266,7 @@ static void gui_start_selection(struct gui_window *g) g->view->UnlockLooper(); } -void gui_get_clipboard(char **buffer, size_t *length) +static void gui_get_clipboard(char **buffer, size_t *length) { BMessage *clip; *length = 0; @@ -1288,7 +1288,7 @@ void gui_get_clipboard(char **buffer, size_t *length) } } -void gui_set_clipboard(const char *buffer, size_t length, +static void gui_set_clipboard(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles) { BMessage *clip; @@ -1320,6 +1320,13 @@ void gui_set_clipboard(const char *buffer, size_t length, } } +static struct gui_clipboard_table clipboard_table = { + gui_get_clipboard, + gui_set_clipboard, +}; + +struct gui_clipboard_table *beos_clipboard_table = &clipboard_table; + static void gui_window_get_dimensions(struct gui_window *g, int *width, int *height, bool scaled) { diff --git a/beos/window.h b/beos/window.h index 0aec92ff1..e00b37926 100644 --- a/beos/window.h +++ b/beos/window.h @@ -19,49 +19,61 @@ #ifndef NETSURF_BEOS_WINDOW_H #define NETSURF_BEOS_WINDOW_H 1 -extern "C" { -#include "content/content.h" -#include "desktop/browser.h" -} -#include "beos/scaffolding.h" - extern struct gui_window_table *beos_window_table; +extern struct gui_clipboard_table *beos_clipboard_table; + +struct gui_window; +struct browser_window; +struct beos_scaffolding; class NSBrowserFrameView : public BView { public: - NSBrowserFrameView(BRect frame, struct gui_window *gui); -virtual ~NSBrowserFrameView(); + NSBrowserFrameView(BRect frame, struct gui_window *gui); + virtual ~NSBrowserFrameView(); -virtual void MessageReceived(BMessage *message); -virtual void Draw(BRect updateRect); + virtual void MessageReceived(BMessage *message); + virtual void Draw(BRect updateRect); -//virtual void FrameMoved(BPoint new_location); -virtual void FrameResized(float new_width, float new_height); + //virtual void FrameMoved(BPoint new_location); + virtual void FrameResized(float new_width, float new_height); -virtual void KeyDown(const char *bytes, int32 numBytes); -virtual void MouseDown(BPoint where); -virtual void MouseUp(BPoint where); -virtual void MouseMoved(BPoint where, uint32 transit, const BMessage *msg); + virtual void KeyDown(const char *bytes, int32 numBytes); + virtual void MouseDown(BPoint where); + virtual void MouseUp(BPoint where); + virtual void MouseMoved(BPoint where, uint32 transit, const BMessage *msg); private: struct gui_window *fGuiWindow; }; +/** + * Process beos messages into browser operations. + * + * \param message The beos message to process. + */ void nsbeos_dispatch_event(BMessage *message); - +/** + * Cause all windows to be reflowed. + */ void nsbeos_reflow_all_windows(void); -nsbeos_scaffolding *nsbeos_get_scaffold(struct gui_window *g); +/** + * Get containing scaffold of a beos gui window + * + * \param g gui window to find scaffold of. + * \return The containing scaffold. + */ +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); struct browser_window *nsbeos_get_browser_window(struct gui_window *g); -void gui_get_clipboard(char **buffer, size_t *length); -void gui_set_clipboard(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles); - #endif /* NETSURF_BEOS_WINDOW_H */