|
@@ -191,6 +191,7 @@ set_p3d_filename(const string &p3d_filename) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
void P3DInstance::
|
|
void P3DInstance::
|
|
|
set_wparams(const P3DWindowParams &wparams) {
|
|
set_wparams(const P3DWindowParams &wparams) {
|
|
|
|
|
+ nout << "set_wparams, _session = " << _session << "\n";
|
|
|
_got_wparams = true;
|
|
_got_wparams = true;
|
|
|
_wparams = wparams;
|
|
_wparams = wparams;
|
|
|
|
|
|
|
@@ -202,46 +203,47 @@ set_wparams(const P3DWindowParams &wparams) {
|
|
|
_splash_window->set_wparams(_wparams);
|
|
_splash_window->set_wparams(_wparams);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Update the instance in the sub-process.
|
|
|
|
|
- if (_session != NULL) {
|
|
|
|
|
- TiXmlDocument *doc = new TiXmlDocument;
|
|
|
|
|
- TiXmlElement *xcommand = new TiXmlElement("command");
|
|
|
|
|
- xcommand->SetAttribute("cmd", "setup_window");
|
|
|
|
|
- xcommand->SetAttribute("instance_id", get_instance_id());
|
|
|
|
|
- TiXmlElement *xwparams = _wparams.make_xml();
|
|
|
|
|
-
|
|
|
|
|
#ifdef __APPLE__
|
|
#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();
|
|
|
|
|
- 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()];
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 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) {
|
|
if (_swbuffer != NULL) {
|
|
|
- xwparams->SetAttribute("subprocess_window", _shared_filename);
|
|
|
|
|
|
|
+ _reversed_buffer = new char[_swbuffer->get_framebuffer_size()];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (_swbuffer == NULL) {
|
|
|
|
|
+ nout << "Could not open swbuffer\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
#endif // __APPLE__
|
|
#endif // __APPLE__
|
|
|
|
|
+
|
|
|
|
|
+ // Update the instance in the sub-process.
|
|
|
|
|
+ if (_session != NULL) {
|
|
|
|
|
+ TiXmlDocument *doc = new TiXmlDocument;
|
|
|
|
|
+ TiXmlElement *xcommand = new TiXmlElement("command");
|
|
|
|
|
+ xcommand->SetAttribute("cmd", "setup_window");
|
|
|
|
|
+ xcommand->SetAttribute("instance_id", get_instance_id());
|
|
|
|
|
+ TiXmlElement *xwparams = _wparams.make_xml(this);
|
|
|
|
|
|
|
|
doc->LinkEndChild(xcommand);
|
|
doc->LinkEndChild(xcommand);
|
|
|
xcommand->LinkEndChild(xwparams);
|
|
xcommand->LinkEndChild(xwparams);
|
|
@@ -674,7 +676,7 @@ make_xml() {
|
|
|
xinstance->LinkEndChild(xfparams);
|
|
xinstance->LinkEndChild(xfparams);
|
|
|
|
|
|
|
|
if (_got_wparams) {
|
|
if (_got_wparams) {
|
|
|
- TiXmlElement *xwparams = _wparams.make_xml();
|
|
|
|
|
|
|
+ TiXmlElement *xwparams = _wparams.make_xml(this);
|
|
|
xinstance->LinkEndChild(xwparams);
|
|
xinstance->LinkEndChild(xwparams);
|
|
|
}
|
|
}
|
|
|
|
|
|