[project @ 2004-08-13 00:55:59 by jmb]

Rewrite of plugin handling. This is now much nicer than before although it has about the same amount of functionality.
Note: This is now configurable via an option (defaults to OFF)
This has only really been tested with the Flash plugin and seems to work reasonably.

svn path=/import/netsurf/; revision=1216
This commit is contained in:
John Mark Bell 2004-08-13 00:55:59 +00:00
parent 0a93f2d264
commit d7627ceceb
6 changed files with 1234 additions and 1356 deletions

View File

@ -200,7 +200,7 @@ static const struct handler_entry handler_map[] = {
#endif
#ifdef WITH_PLUGIN
{plugin_create, 0, plugin_convert,
0, plugin_destroy, 0, plugin_redraw,
plugin_reformat, plugin_destroy, 0, plugin_redraw,
plugin_open, plugin_close,
true},
#endif

View File

@ -102,16 +102,9 @@ struct object_params {
char* codebase;
char* classid;
struct plugin_params* params;
/* not a parameter, but stored here for convenience */
/* not a parameter but stored here for convenience */
char* basehref;
char* filename;
bool repeated;
unsigned int browser;
unsigned int plugin;
unsigned int browser_stream;
unsigned int plugin_stream;
unsigned int plugin_task;
unsigned int consumed;
};
struct plugin_params {

View File

@ -1001,24 +1001,47 @@ void ro_gui_user_message(wimp_event_no event, wimp_message *message)
#endif
#ifdef WITH_PLUGIN
case message_PLUG_IN_OPENING:
plugin_opening(message);
break;
case message_PLUG_IN_CLOSED:
plugin_closed(message);
break;
case message_PLUG_IN_RESHAPE_REQUEST:
plugin_reshape_request(message);
break;
case message_PLUG_IN_FOCUS:
break;
case message_PLUG_IN_URL_ACCESS:
plugin_url_access(message);
break;
case message_PLUG_IN_STATUS:
plugin_status(message);
break;
case message_PLUG_IN_BUSY:
break;
case message_PLUG_IN_STREAM_NEW:
plugin_stream_new(message);
break;
case message_PLUG_IN_STREAM_WRITE:
break;
case message_PLUG_IN_STREAM_WRITTEN:
plugin_stream_written(message);
break;
case message_PLUG_IN_STREAM_DESTROY:
break;
case message_PLUG_IN_OPEN:
if (event == wimp_USER_MESSAGE_ACKNOWLEDGE)
plugin_open_msg(message);
break;
case message_PLUG_IN_CLOSE:
if (event == wimp_USER_MESSAGE_ACKNOWLEDGE)
plugin_close_msg(message);
break;
case message_PLUG_IN_RESHAPE:
case message_PLUG_IN_STREAM_AS_FILE:
case message_PLUG_IN_NOTIFY:
case message_PLUG_IN_ABORT:
case message_PLUG_IN_ACTION:
plugin_msg_parse(message, event == wimp_USER_MESSAGE_ACKNOWLEDGE);
break;
#endif
#ifdef WITH_PRINT

View File

@ -47,6 +47,7 @@ extern bool option_buffer_animations;
extern bool option_buffer_everything;
extern char *option_homepage_url;
extern bool option_open_browser_at_startup;
extern bool option_plugins;
#define EXTRA_OPTION_DEFINE \
bool option_use_mouse_gestures = false;\
@ -79,7 +80,8 @@ bool option_background_blending = true; \
bool option_buffer_animations = true; \
bool option_buffer_everything = false; \
char *option_homepage_url = 0; \
bool option_open_browser_at_startup = false;
bool option_open_browser_at_startup = false; \
bool option_plugins = false;
#define EXTRA_OPTION_TABLE \
{ "use_mouse_gestures", OPTION_BOOL, &option_use_mouse_gestures },\
@ -112,5 +114,6 @@ bool option_open_browser_at_startup = false;
{ "buffer_animations", OPTION_BOOL, &option_buffer_animations }, \
{ "buffer_everything", OPTION_BOOL, &option_buffer_everything }, \
{ "homepage_url", OPTION_STRING, &option_homepage_url }, \
{ "open_browser_at_startup",OPTION_BOOL, &option_open_browser_at_startup }
{ "open_browser_at_startup",OPTION_BOOL, &option_open_browser_at_startup }, \
{ "plugins", OPTION_BOOL, &option_plugins }
#endif

File diff suppressed because it is too large Load Diff

View File

@ -18,60 +18,30 @@ struct content;
struct object_params;
struct content_plugin_data {
char *data; /* object data */
unsigned long length; /* object length */
char *sysvar; /* system variable set by plugin */
};
struct plugin_state {
int dummy;
};
struct plugin_message {
int poll;
plugin_b browser;
plugin_p plugin;
wimp_message *m;
struct plugin_message *reply;
struct plugin_message *next;
struct plugin_message *prev;
};
struct plugin_list {
struct content *c;
struct browser_window *bw;
struct content *page;
struct box *box;
struct object_params *params;
void **state;
struct plugin_list *next;
struct plugin_list *prev;
};
struct plugin_param_item {
int type;
int rsize;
int nsize;
char *name;
int npad;
int vsize;
char *value;
int vpad;
int msize;
char *mime_type;
int mpad;
struct plugin_param_item *next;
struct browser_window *bw; /* window containing this content */
struct content *page; /* parent content */
struct box *box; /* box containing this content */
char *taskname; /* plugin task to launch */
char *filename; /* filename of parameters file */
char *datafile; /* filename of filestreamed file */
bool opened; /* has this plugin been opened? */
int repeated; /* indication of opening state */
unsigned int browser; /* browser handle */
unsigned int plugin; /* plugin handle */
unsigned int browser_stream; /* browser stream handle */
unsigned int plugin_stream; /* plugin stream handle */
unsigned int plugin_task; /* plugin task handle */
unsigned int consumed; /* size of data consumed by plugin */
bool reformat_pending; /* is a reformat pending? */
int width, height; /* reformat width & height */
bool stream_waiting; /* waiting to stream a datastream */
bool file_stream_waiting; /* waiting to stream as file */
};
/* function definitions */
bool plugin_handleable(const char *mime_type);
void plugin_msg_parse(wimp_message *message, int ack);
bool plugin_create(struct content *c, const char *params[]);
bool plugin_process_data(struct content *c, char *data, unsigned int size);
bool plugin_convert(struct content *c, int width, int height);
void plugin_reformat(struct content *c, int width, int height);
void plugin_destroy(struct content *c);
@ -84,5 +54,17 @@ void plugin_open(struct content *c, struct browser_window *bw,
struct object_params *params);
void plugin_close(struct content *c);
/* message handlers */
void plugin_open_msg(wimp_message *message);
void plugin_opening(wimp_message *message);
void plugin_close_msg(wimp_message *message);
void plugin_closed(wimp_message *message);
void plugin_reshape_request(wimp_message *message);
void plugin_status(wimp_message *message);
void plugin_stream_new(wimp_message *message);
void plugin_stream_written(wimp_message *message);
void plugin_url_access(wimp_message *message);
#endif