From 863551a932e21f3d4315c0ceb51005929acc9f20 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sun, 29 May 2011 18:46:11 +0200 Subject: [PATCH] fix #142: initial window position Be (at least a bit) smarter with initial x/y position Also some minor type/comment issues. --- src/Main/WindowBuilder.cxx | 17 +++++++++-------- src/Main/options.cxx | 2 +- src/Main/viewmgr.cxx | 2 +- src/MultiPlayer/mpmessages.hxx | 2 +- src/Sound/sample_queue.cxx | 2 +- src/Time/light.cxx | 4 ++-- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/Main/WindowBuilder.cxx b/src/Main/WindowBuilder.cxx index 740671cd5..52f09011d 100644 --- a/src/Main/WindowBuilder.cxx +++ b/src/Main/WindowBuilder.cxx @@ -69,9 +69,9 @@ WindowBuilder::makeDefaultTraits(bool stencil) traits->red = traits->green = traits->blue = cbits; traits->depth = zbits; if (alpha) - traits->alpha = 8; + traits->alpha = 8; if (stencil) - traits->stencil = 8; + traits->stencil = 8; traits->doubleBuffer = true; traits->mipMapGeneration = true; traits->windowName = "FlightGear"; @@ -83,20 +83,21 @@ WindowBuilder::makeDefaultTraits(bool stencil) unsigned width = 0; unsigned height = 0; wsi->getScreenResolution(*traits, width, height); - traits->windowDecoration = false; + traits->windowDecoration = false; traits->width = width; traits->height = height; traits->supportsResize = false; } else { - traits->windowDecoration = true; + traits->windowDecoration = true; traits->width = w; traits->height = h; -#if defined(WIN32) || defined(__APPLE__) + unsigned screenwidth = 0; + unsigned screenheight = 0; + wsi->getScreenResolution(*traits, screenwidth, screenheight); // Ugly Hack, why does CW_USEDEFAULT works like phase of the moon? // Mac also needs this to show window frame, menubar and Docks - traits->x = 100; - traits->y = 100; -#endif + traits->x = (w>screenwidth) ? 0 : (screenwidth-w)/3; + traits->y = (h>screenheight) ? 0 : (screenheight-h)/3; traits->supportsResize = true; } return traits; diff --git a/src/Main/options.cxx b/src/Main/options.cxx index df50b344c..01f1e4438 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -1838,7 +1838,7 @@ fgUsage (bool verbose) while ( t_str.size() > 47 ) { - unsigned int m = t_str.rfind(' ', 47); + string::size_type m = t_str.rfind(' ', 47); msg += t_str.substr(0, m) + '\n'; msg.append( 32, ' '); diff --git a/src/Main/viewmgr.cxx b/src/Main/viewmgr.cxx index 955529189..ea9fcd7a6 100644 --- a/src/Main/viewmgr.cxx +++ b/src/Main/viewmgr.cxx @@ -356,7 +356,7 @@ FGViewMgr::update (double dt) abs_viewer_position = loop_view->getViewPosition(); // update audio listener values - // set the viewer posotion in Cartesian coordinates in meters + // set the viewer position in Cartesian coordinates in meters smgr->set_position( abs_viewer_position, loop_view->getPosition() ); smgr->set_orientation( current_view_orientation ); diff --git a/src/MultiPlayer/mpmessages.hxx b/src/MultiPlayer/mpmessages.hxx index f5b89eb82..38e7fea58 100644 --- a/src/MultiPlayer/mpmessages.hxx +++ b/src/MultiPlayer/mpmessages.hxx @@ -164,7 +164,7 @@ struct FGExternalMotionData { // the earth centered frame SGVec3f angularAccel; - // The set of properties recieved for this timeslot + // The set of properties received for this timeslot std::vector properties; ~FGExternalMotionData() diff --git a/src/Sound/sample_queue.cxx b/src/Sound/sample_queue.cxx index e5c2293a6..ac56c9b25 100644 --- a/src/Sound/sample_queue.cxx +++ b/src/Sound/sample_queue.cxx @@ -80,7 +80,7 @@ FGSampleQueue::update (double dt) last_volume = volume; } - // process mesage queue + // process message queue const string msgid = "Sequential Audio Message"; bool now_playing = false; if ( exists( msgid ) ) { diff --git a/src/Time/light.cxx b/src/Time/light.cxx index 348bd524d..79259c03c 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -345,7 +345,7 @@ void FGLight::update_adj_fog_color () { else hor_rotation = fmod(hor_rotation, SGD_2PI); - // revert to unmodified values before usign them. + // revert to unmodified values before using them. // SGVec4f color = thesky->get_scene_color(); @@ -359,7 +359,7 @@ void FGLight::update_adj_fog_color () { float s_green = color[1]*color[1]*color[1]; float s_blue = color[2]*color[2]; - // interpolate beween the sunrise/sunset color and the color + // interpolate between the sunrise/sunset color and the color // at the opposite direction of this effect. Take in account // the current visibility. //