set_mode(*i->desktop_mode, false);
}
-const VideoMode *Display::find_matching_mode(const VideoMode &mode) const
+const VideoMode *Display::find_mode(const VideoMode &mode) const
{
for(list<VideoMode>::const_iterator i=modes.begin(); i!=modes.end(); ++i)
{
return 0;
}
+const VideoMode *Display::find_mode(unsigned width, unsigned height) const
+{
+ return find_mode(VideoMode(width, height));
+}
+
void Display::tick()
{
check_error();
const VideoMode &get_desktop_mode() const;
void set_mode(const VideoMode &, bool = false);
void restore_mode();
-private:
- const VideoMode *find_matching_mode(const VideoMode &) const;
+ const VideoMode *find_mode(const VideoMode &) const;
+ const VideoMode *find_mode(unsigned, unsigned) const;
-public:
void tick();
private:
bool process_events();
mode.index = modes.size();
mode.monitor = &monitor;
mode.rate = info.dmDisplayFrequency;
- if(find_matching_mode(mode))
+ if(find_mode(mode))
continue;
modes.push_back(mode);
void Display::set_mode(const VideoMode &requested_mode, bool)
{
- const VideoMode *mode = find_matching_mode(requested_mode);
+ const VideoMode *mode = find_mode(requested_mode);
if(!mode)
throw unsupported_video_mode(requested_mode);
mode.index = modes.size();
mode.monitor = &monitor;
mode.rate = info->dotClock/(info->hTotal*info->vTotal);
- if(find_matching_mode(mode))
+ if(find_mode(mode))
continue;
modes.push_back(mode);
void Display::set_mode(const VideoMode &requested_mode, bool exclusive)
{
#ifdef WITH_XRANDR
- const VideoMode *mode = find_matching_mode(requested_mode);
+ const VideoMode *mode = find_mode(requested_mode);
if(!mode)
throw unsupported_video_mode(requested_mode);