hidden plugins

This commit is contained in:
David Rose 2009-08-04 23:29:40 +00:00
parent 8db00b4f74
commit f3751431b5
5 changed files with 64 additions and 41 deletions

View File

@ -16,7 +16,7 @@
#include <sstream>
static const bool debug_xml_output = false;
static const bool debug_xml_output = true;
#define DO_BINARY_XML 1

View File

@ -184,48 +184,51 @@ set_wparams(const P3DWindowParams &wparams) {
nout << "set_wparams, _session = " << _session << "\n";
_got_wparams = true;
_wparams = wparams;
nout << "set window_type = " << _wparams.get_window_type() << "\n";
// Update or create the splash window.
if (!_instance_window_opened) {
if (_splash_window == NULL) {
make_splash_window();
}
_splash_window->set_wparams(_wparams);
}
#ifdef __APPLE__
// On Mac, we have to communicate the results of the rendering
// back via shared memory, instead of directly parenting windows
// to the browser. Set up this mechanism.
int x_size = _wparams.get_win_width();
int y_size = _wparams.get_win_height();
nout << "x_size, y_size = " << x_size << ", " << y_size << "\n";
if (x_size != 0 && y_size != 0) {
if (_swbuffer == NULL || _swbuffer->get_x_size() != x_size ||
_swbuffer->get_y_size() != y_size) {
// We need to open a new shared buffer.
if (_swbuffer != NULL) {
SubprocessWindowBuffer::destroy_buffer(_shared_fd, _shared_mmap_size,
_shared_filename, _swbuffer);
_swbuffer = NULL;
}
if (_reversed_buffer != NULL) {
delete[] _reversed_buffer;
_reversed_buffer = NULL;
}
_swbuffer = SubprocessWindowBuffer::new_buffer
(_shared_fd, _shared_mmap_size, _shared_filename, x_size, y_size);
if (_swbuffer != NULL) {
_reversed_buffer = new char[_swbuffer->get_framebuffer_size()];
if (_wparams.get_window_type() != P3D_WT_hidden) {
// Update or create the splash window.
if (!_instance_window_opened) {
if (_splash_window == NULL) {
make_splash_window();
}
_splash_window->set_wparams(_wparams);
}
if (_swbuffer == NULL) {
nout << "Could not open swbuffer\n";
#ifdef __APPLE__
// On Mac, we have to communicate the results of the rendering
// back via shared memory, instead of directly parenting windows
// to the browser. Set up this mechanism.
int x_size = _wparams.get_win_width();
int y_size = _wparams.get_win_height();
nout << "x_size, y_size = " << x_size << ", " << y_size << "\n";
if (x_size != 0 && y_size != 0) {
if (_swbuffer == NULL || _swbuffer->get_x_size() != x_size ||
_swbuffer->get_y_size() != y_size) {
// We need to open a new shared buffer.
if (_swbuffer != NULL) {
SubprocessWindowBuffer::destroy_buffer(_shared_fd, _shared_mmap_size,
_shared_filename, _swbuffer);
_swbuffer = NULL;
}
if (_reversed_buffer != NULL) {
delete[] _reversed_buffer;
_reversed_buffer = NULL;
}
_swbuffer = SubprocessWindowBuffer::new_buffer
(_shared_fd, _shared_mmap_size, _shared_filename, x_size, y_size);
if (_swbuffer != NULL) {
_reversed_buffer = new char[_swbuffer->get_framebuffer_size()];
}
}
if (_swbuffer == NULL) {
nout << "Could not open swbuffer\n";
}
}
}
#endif // __APPLE__
}
// Update the instance in the sub-process.
if (_session != NULL) {

View File

@ -257,10 +257,10 @@ paint_window() {
PaintRect(&rdone);
EraseRect(&rneed);
RGBColor black = { 0, 0, 0 };
RGBForeColor(&black);
if (!_install_label.empty()) {
RGBColor black = { 0, 0, 0 };
RGBForeColor(&black);
TextFont(0);
TextFace(bold);
TextMode(srcOr);

View File

@ -1064,8 +1064,18 @@ send_window() {
}
#endif
P3D_window_type window_type = P3D_WT_embedded;
if (_window.window == NULL) {
// No parent window: it must be a hidden window.
window_type = P3D_WT_hidden;
} else if (_window.width == 0 || _window.height == 0) {
// No size: hidden.
window_type = P3D_WT_hidden;
}
nout << "window_type = " << window_type << "\n";
P3D_instance_setup_window
(_p3d_inst, P3D_WT_embedded,
(_p3d_inst, window_type,
x, y, _window.width, _window.height,
parent_window);
}

View File

@ -20,6 +20,10 @@
#include <malloc.h>
#endif
#ifdef __APPLE__
#include <signal.h>
#endif
static ofstream logfile;
ostream *nout_stream = &logfile;
@ -129,6 +133,12 @@ NP_Initialize(NPNetscapeFuncs *browserFuncs,
}
#endif
#ifdef __APPLE__
// On Mac, we'd better ignore SIGPIPE, or this signal will shut down
// the application if the plugin exits unexpectedly.
signal(SIGPIPE, SIG_IGN);
#endif // __APPLE__
return NPERR_NO_ERROR;
}