File: vidmode.h

package info (click to toggle)
gvidm 0.8-13
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 416 kB
  • sloc: cpp: 1,049; sh: 153; python: 104; makefile: 65
file content (86 lines) | stat: -rw-r--r-- 2,831 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
    vidmode.h - abstract handling of vidmode changing for gvidm
    Copyright (C) 2001-2004 Matthew Mueller <donut AT dakotacom DOT net>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
#ifndef __VIDMODE_H__
#define __VIDMODE_H__

#include "gvid.h"

struct VidMode {
	bool iscurmode;
	int width, height, refresh;
	string info;
	void *data;

	VidMode(bool cur, int w, int h, int r, const string &i, void *d)
		: iscurmode(cur), width(w), height(h), refresh(r), info(i), data(d)
		{ };
	string str() const;
	string pretty_str() const;
};

typedef vector<VidMode*> mode_list_t;
typedef vector<mode_list_t> screen_mode_list_t;


int parse_mode(int &w, int &h, int &r, const string &arg);
int parse_arg(screen_list_t &screens, int &w, int &h, int &r, const string &arg, int num_screens, int cur_screen);
int find_mode(mode_list_t &modes, int screen, int w, int h, int r, const screen_mode_list_t &available_modes);
int parse_arg_mode(screen_mode_list_t &arg_modes, const char *arg, const screen_mode_list_t &available_modes, int cur_screen);
int parse_arg_modes(screen_mode_list_t &arg_modes, char const*const*arg0, char const*const*argend, const screen_mode_list_t &available_modes, int cur_screen);


class AbstractVidModeHandler : public Handler {
	protected:
		int cur_screen;
		screen_mode_list_t available_modes;
		int list(const screen_list_t &screens, bool onlycur) const;

	public:
		AbstractVidModeHandler();
		virtual ~AbstractVidModeHandler();

		virtual int set(const char *const* argbegin, const char *const* argend);
		virtual int list(const char *const* argbegin, const char *const* argend) const;
		virtual int list_current(const char *const* argbegin, const char *const* argend) const;
};

#ifdef HAVE_LIBXXF86VM
class XVidModeHandler : public AbstractVidModeHandler {
	public:
		XVidModeHandler();
		virtual ~XVidModeHandler();

		virtual int doevent(gpointer data);
};
#endif

#ifdef HAVE_LIBXRANDR
class XRandRHandler : public AbstractVidModeHandler {
	private:
		XRRScreenConfiguration ** screenconfigs;
		int num_screens;
	public:
		XRandRHandler();
		virtual ~XRandRHandler();

		virtual int doevent(gpointer data);
};
#endif

#endif