diff options
author | Adam Borowski <kilobyte@angband.pl> | 2010-10-15 02:12:34 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2010-10-15 02:12:34 +0200 |
commit | e7572d74b30900124d9a896843f42b1c957d20c2 (patch) | |
tree | 4498d0d55dd643ae021e93e38d74dafce960bfd9 /crawl-ref/source/windowmanager-sdl.cc | |
parent | 634ab294f302c98be55389a97e94cd7205860310 (diff) | |
parent | acf5187334f2cfb983a1a8de07d1e77f73e4283a (diff) | |
download | crawl-ref-e7572d74b30900124d9a896843f42b1c957d20c2.tar.gz crawl-ref-e7572d74b30900124d9a896843f42b1c957d20c2.zip |
Merge branch 'master' into unicode
Diffstat (limited to 'crawl-ref/source/windowmanager-sdl.cc')
-rw-r--r-- | crawl-ref/source/windowmanager-sdl.cc | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/crawl-ref/source/windowmanager-sdl.cc b/crawl-ref/source/windowmanager-sdl.cc index 2dbe497b59..1c6dbabf25 100644 --- a/crawl-ref/source/windowmanager-sdl.cc +++ b/crawl-ref/source/windowmanager-sdl.cc @@ -246,6 +246,8 @@ int SDLWrapper::init(coord_def *m_windowsz) video_info = SDL_GetVideoInfo(); + _desktop_width = video_info->current_w; + SDL_EnableUNICODE(true); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); @@ -276,12 +278,7 @@ int SDLWrapper::init(coord_def *m_windowsz) flags |= SDL_FULLSCREEN; } - if (Options.tile_window_width && Options.tile_window_height) - { - m_windowsz->x = Options.tile_window_width; - m_windowsz->y = Options.tile_window_height; - } - else if (flags & SDL_FULLSCREEN) + if (flags & SDL_FULLSCREEN) { // By default, fill the whole screen. m_windowsz->x = video_info->current_w; @@ -289,8 +286,12 @@ int SDLWrapper::init(coord_def *m_windowsz) } else { - m_windowsz->x = std::max(800, video_info->current_w - 90); - m_windowsz->y = std::max(480, video_info->current_h - 90); + int x = Options.tile_window_width; + int y = Options.tile_window_height; + x = (x > 0) ? x : video_info->current_w + x; + y = (y > 0) ? y : video_info->current_h + y; + m_windowsz->x = std::max(800, x); + m_windowsz->y = std::max(480, y); } m_context = SDL_SetVideoMode(m_windowsz->x, m_windowsz->y, 0, flags); @@ -313,6 +314,11 @@ int SDLWrapper::screen_height() const return (video_info->current_h); } +int SDLWrapper::desktop_width() const +{ + return (_desktop_width); +} + void SDLWrapper::set_window_title(const char *title) { SDL_WM_SetCaption(title, CRAWL); |