some window confusions

This commit is contained in:
David Rose 2009-07-28 19:11:40 +00:00
parent 6aaf1a6bdc
commit bf179efd76
5 changed files with 31 additions and 10 deletions

View File

@ -201,9 +201,8 @@ set_wparams(const P3DWindowParams &wparams) {
if (!_instance_window_opened && _got_fparams) {
if (_splash_window == NULL) {
make_splash_window();
} else {
_splash_window->set_wparams(_wparams);
}
_splash_window->set_wparams(_wparams);
}
// Update the instance in the sub-process.

View File

@ -1026,10 +1026,11 @@ setup_window(P3DCInstance *inst, TiXmlElement *xwparams) {
}
#elif defined(HAVE_X11)
// Bad! Casting to int loses precision.
int xwindow;
if (xwparams->Attribute("parent_xwindow", &xwindow)) {
parent_window_handle = (long)xwindow;
// Use stringstream to decode the "long" attribute.
const char *parent_cstr = xwparams->Attribute("parent_xwindow");
if (parent_cstr != NULL) {
istringstream strm(parent_cstr);
strm >> parent_window_handle;
}
#endif

View File

@ -84,7 +84,13 @@ make_xml() {
// The subprocess_window setting is applied by the caller.
#elif defined(HAVE_X11)
xwparams->SetAttribute("parent_xwindow", (unsigned long)_parent_window._xwindow);
// TinyXml doesn't support a "long" attribute. We'll use
// stringstream to do it ourselves.
{
ostringstream strm;
strm << _parent_window._xwindow;
xwparams->SetAttribute("parent_xwindow", strm.str());
}
#endif
break;

View File

@ -62,8 +62,6 @@ P3DX11SplashWindow(P3DInstance *inst) :
_image_filename_temp = false;
_install_label_changed = false;
_install_progress = 0.0;
start_subprocess();
}
////////////////////////////////////////////////////////////////////
@ -76,6 +74,22 @@ P3DX11SplashWindow::
stop_subprocess();
}
////////////////////////////////////////////////////////////////////
// Function: P3DX11SplashWindow::set_wparams
// Access: Public, Virtual
// Description: Changes the window parameters, e.g. to resize or
// reposition the window; or sets the parameters for the
// first time, creating the initial window.
////////////////////////////////////////////////////////////////////
void P3DX11SplashWindow::
set_wparams(const P3DWindowParams &wparams) {
P3DSplashWindow::set_wparams(wparams);
if (_subprocess_pid == -1) {
start_subprocess();
}
}
////////////////////////////////////////////////////////////////////
// Function: P3DX11SplashWindow::set_image_filename
// Access: Public, Virtual
@ -402,7 +416,7 @@ subprocess_run() {
////////////////////////////////////////////////////////////////////
void P3DX11SplashWindow::
receive_command() {
TiXmlDocument *doc = read_xml(_pipe_read, cerr);
TiXmlDocument *doc = read_xml(_pipe_read, nout);
if (doc == NULL) {
// Pipe closed or something.
_subprocess_continue = false;

View File

@ -35,6 +35,7 @@ public:
P3DX11SplashWindow(P3DInstance *inst);
virtual ~P3DX11SplashWindow();
virtual void set_wparams(const P3DWindowParams &wparams);
virtual void set_image_filename(const string &image_filename,
bool image_filename_temp);
virtual void set_install_label(const string &install_label);