1 /*
2  *  SPDX-License-Identifier: GPL-2.0-or-later
3  *
4  *  SPDX-FileCopyrightText: 2002 Michael v.Ostheim <MvOstheim@web.de>
5  */
6 
7 #ifndef XVIDEXTWRAP_H
8 #define XVIDEXTWRAP_H
9 
10 #include <X11/Xutil.h>
11 
12 /**A wrapper for XF86VidMode Extension
13  *@author Michael v.Ostheim
14  */
15 
16 class XVidExtWrap
17 {
18 public:
19     enum GammaChannel { Value = 0, Red = 1, Green = 2, Blue = 3 };
20     explicit XVidExtWrap(bool *OK, const char *displayname = nullptr);
21     ~XVidExtWrap();
22 
23     /** Returns the default screen */
24     int _DefaultScreen();
25     /** Returns the number of screens (extracted from XF86Config) */
26     int _ScreenCount();
27     /** Returns the displayname */
28     const char *DisplayName();
29     /** Sets the screen actions are take effect */
setScreen(int scrn)30     void setScreen(int scrn)
31     {
32         screen = scrn;
33     }
34     /** Returns the current screen */
getScreen()35     int getScreen()
36     {
37         return screen;
38     }
39     /** Sets the gamma value on the current screen */
40     void setGamma(int channel, float gam, bool *OK = nullptr);
41     /** Gets the gamma value of the current screen */
42     float getGamma(int channel, bool *OK = nullptr);
43     /** Limits the possible gamma values (default 0.1-10.0) */
44     void setGammaLimits(float min, float max);
45 
46 private:
47     float mingamma, maxgamma;
48     int screen;
49     Display *dpy;
50 };
51 
52 #endif
53