The first casualty of code pruning; specific code for window

centering has been removed (SDL2 provides this natively).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2831 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-09-27 20:59:23 +00:00
parent 01f7c2c2f3
commit 40f9da7839
9 changed files with 8 additions and 107 deletions

16
configure vendored
View File

@ -759,20 +759,6 @@ case $_host_os in
DEFINES="$DEFINES -DBSPF_UNIX -DHAVE_GETTIMEOFDAY -DHAVE_INTTYPES"
MODULES="$MODULES $SRC/unix"
INCLUDES="$INCLUDES -I$SRC/unix"
#
# Check for X11
#
_x11=no
cat > $TMPC << EOF
#include <X11/Xutil.h>
int main(void) { return 0; }
EOF
cc_check $LDFLAGS $CXXFLAGS -lX11 && _x11=yes
if test "$_x11" = yes ; then
DEFINES="$DEFINES -DHAVE_X11"
LIBS="$LIBS -lX11"
fi
;;
win32)
DEFINES="$DEFINES -DBSPF_WINDOWS -DHAVE_GETTIMEOFDAY -DHAVE_INTTYPES"
@ -781,7 +767,7 @@ EOF
LIBS="$LIBS -lmingw32 -lwinmm"
;;
*)
echo "WARNING: host system not currenty supported"
echo "WARNING: host system not currently supported"
exit
;;
esac

View File

@ -1091,6 +1091,8 @@ FrameBuffer::VideoMode FrameBuffer::getSavedVidMode()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::centerAppWindow(const VideoMode& mode)
{
// FIXSDL
#if 0
// Attempt to center the application window in non-fullscreen mode
if(!fullScreen() && myOSystem->settings().getBool("center"))
{
@ -1098,8 +1100,8 @@ void FrameBuffer::centerAppWindow(const VideoMode& mode)
((myOSystem->desktopWidth() - mode.screen_w) >> 1);
int y = mode.screen_h >= myOSystem->desktopHeight() ? 0 :
((myOSystem->desktopHeight() - mode.screen_h) >> 1);
myOSystem->setAppWindowPos(x, y, mode.screen_w, mode.screen_h);
}
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -512,14 +512,6 @@ class OSystem
virtual string defaultSnapSaveDir() { return "~" BSPF_PATH_SEPARATOR; }
virtual string defaultSnapLoadDir() { return "~" BSPF_PATH_SEPARATOR; }
/**
Set the position of the application window, generally using
platform-specific code. Note that this method is only ever
called for windowed mode, so no provisions need be made
for fullscreen mode.
*/
virtual void setAppWindowPos(int x, int y, int w, int h) { };
protected:
/**
Query the OSystem video hardware for resolution information.

View File

@ -383,7 +383,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
myFullscreenCheckbox->clearFlags(WIDGET_ENABLED);
myCenterCheckbox->clearFlags(WIDGET_ENABLED);
#endif
#if !(defined(BSPF_WINDOWS) || (defined(BSPF_UNIX) && defined(HAVE_X11)))
#if !(defined(BSPF_WINDOWS) || defined(BSPF_UNIX))
myCenterCheckbox->clearFlags(WIDGET_ENABLED);
#endif
}

View File

@ -17,13 +17,6 @@
// $Id$
//============================================================================
#if defined(HAVE_X11)
#include <SDL_syswm.h>
#include <X11/Xutil.h>
#endif
#include "bspf.hxx"
#include "OSystem.hxx"
#include "OSystemUNIX.hxx"
/**
@ -48,35 +41,3 @@ OSystemUNIX::OSystemUNIX()
OSystemUNIX::~OSystemUNIX()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemUNIX::setAppWindowPos(int x, int y, int, int)
{
#if defined(HAVE_X11)
// TODO: This functionality is deprecated, since the x/y fields
// of XSizeHints are obsolete. SDL2 will provide native methods
// for app centering (which is all this is currently used for).
SDL_SysWMinfo sdl_info;
memset(&sdl_info, 0, sizeof(sdl_info));
SDL_VERSION (&sdl_info.version);
if(SDL_GetWMInfo(&sdl_info) > 0 && sdl_info.subsystem == SDL_SYSWM_X11)
{
Display* display = sdl_info.info.x11.display;
Window window = sdl_info.info.x11.wmwindow;
XSizeHints hints;
long supplied_return;
XGetWMNormalHints(display, window, &hints, &supplied_return);
// Change X/Y position
hints.x = x;
hints.y = y;
XMoveWindow(display, window, hints.x, hints.y);
// Flush the resize event so we don't catch it later
XSync(display, True);
XSetWMNormalHints(display, window, &hints);
}
#endif
}

View File

@ -20,7 +20,7 @@
#ifndef OSYSTEM_UNIX_HXX
#define OSYSTEM_UNIX_HXX
#include "bspf.hxx"
#include "OSystem.hxx"
/**
This class defines UNIX-like OS's (Linux) system specific settings.
@ -40,13 +40,6 @@ class OSystemUNIX : public OSystem
Destructor
*/
virtual ~OSystemUNIX();
public:
/**
Move X11 window to given position. Width and height are not
used (or modified).
*/
void setAppWindowPos(int x, int y, /* not used*/ int, int);
};
#endif

View File

@ -66,8 +66,7 @@ export CXXFLAGS=$RPM_OPT_FLAGS
--enable-shared \
%endif
--force-builtin-libpng --force-builtin-zlib \
--docdir=%{_docdir}/stella \
--x-libraries=%{_prefix}/X11R6/%{_lib}
--docdir=%{_docdir}/stella
%make

View File

@ -17,13 +17,12 @@
// $Id$
//============================================================================
#include <SDL_syswm.h>
#include <fstream>
#include "bspf.hxx"
#include "FSNode.hxx"
#include "HomeFinder.hxx"
#include "OSystem.hxx"
#include "OSystemWINDOWS.hxx"
/**
@ -103,26 +102,3 @@ string OSystemWINDOWS::defaultSnapLoadDir()
{
return defaultSnapSaveDir();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystemWINDOWS::setAppWindowPos(int x, int y, int w, int h)
{
SDL_SysWMinfo sdl_info;
memset(&sdl_info, 0, sizeof(sdl_info));
SDL_VERSION (&sdl_info.version);
if(SDL_GetWMInfo(&sdl_info) <= 0)
return;
// The following mostly comes from SDL_dx5video.c
HWND window = sdl_info.window;
RECT bounds;
bounds.left = x;
bounds.top = y;
bounds.right = x + w;
bounds.bottom = y + h;
AdjustWindowRectEx(&bounds, GetWindowLong(window, GWL_STYLE), (GetMenu(window) != NULL), 0);
SetWindowPos(window, HWND_NOTOPMOST, x, y, bounds.right-bounds.left,
bounds.bottom-bounds.top, SWP_NOCOPYBITS | SWP_SHOWWINDOW);
}

View File

@ -21,7 +21,6 @@
#define OSYSTEM_WINDOWS_HXX
#include "OSystem.hxx"
#include "bspf.hxx"
/**
This class defines Windows system specific settings.
@ -48,13 +47,6 @@ class OSystemWINDOWS : public OSystem
*/
string defaultSnapSaveDir();
string defaultSnapLoadDir();
/**
Move window to given position. The width and height are also
required for the underlying function, but the window size itself
absolutely must not be changed.
*/
void setAppWindowPos(int x, int y, int w, int h);
};
#endif