#include <screeninfo.hh>
Collaboration diagram for otk::ScreenInfo:
Public Methods | |
ScreenInfo (unsigned int num) | |
Visual * | visual () const |
Window | rootWindow () const |
Colormap | colormap () const |
int | depth () const |
unsigned int | screen () const |
const Rect & | rect () const |
unsigned int | width () const |
unsigned int | height () const |
const std::string & | displayString () const |
Private Attributes | |
Visual * | _visual |
Window | _root_window |
Colormap | _colormap |
int | _depth |
unsigned int | _screen |
std::string | _display_string |
Rect | _rect |
|
Definition at line 20 of file screeninfo.cc. References _colormap, _depth, _display_string, _rect, _root_window, _screen, _visual, otk::itostring(), and otk::Rect::setSize().
00020 { 00021 _screen = num; 00022 00023 _root_window = RootWindow(**display, _screen); 00024 00025 _rect.setSize(WidthOfScreen(ScreenOfDisplay(**display, 00026 _screen)), 00027 HeightOfScreen(ScreenOfDisplay(**display, 00028 _screen))); 00029 /* 00030 If the default depth is at least 8 we will use that, 00031 otherwise we try to find the largest TrueColor visual. 00032 Preference is given to 24 bit over larger depths if 24 bit is an option. 00033 */ 00034 00035 _depth = DefaultDepth(**display, _screen); 00036 _visual = DefaultVisual(**display, _screen); 00037 _colormap = DefaultColormap(**display, _screen); 00038 00039 if (_depth < 8) { 00040 // search for a TrueColor Visual... if we can't find one... 00041 // we will use the default visual for the screen 00042 XVisualInfo vinfo_template, *vinfo_return; 00043 int vinfo_nitems; 00044 int best = -1; 00045 00046 vinfo_template.screen = _screen; 00047 vinfo_template.c_class = TrueColor; 00048 00049 vinfo_return = XGetVisualInfo(**display, 00050 VisualScreenMask | VisualClassMask, 00051 &vinfo_template, &vinfo_nitems); 00052 if (vinfo_return) { 00053 int max_depth = 1; 00054 for (int i = 0; i < vinfo_nitems; ++i) { 00055 if (vinfo_return[i].depth > max_depth) { 00056 if (max_depth == 24 && vinfo_return[i].depth > 24) 00057 break; // prefer 24 bit over 32 00058 max_depth = vinfo_return[i].depth; 00059 best = i; 00060 } 00061 } 00062 if (max_depth < _depth) best = -1; 00063 } 00064 00065 if (best != -1) { 00066 _depth = vinfo_return[best].depth; 00067 _visual = vinfo_return[best].visual; 00068 _colormap = XCreateColormap(**display, _root_window, _visual, 00069 AllocNone); 00070 } 00071 00072 XFree(vinfo_return); 00073 } 00074 00075 // get the default display string and strip the screen number 00076 string default_string = DisplayString(**display); 00077 const string::size_type pos = default_string.rfind("."); 00078 if (pos != string::npos) 00079 default_string.resize(pos); 00080 00081 _display_string = string("DISPLAY=") + default_string + '.' + 00082 itostring(static_cast<unsigned long>(_screen)); 00083 00084 #if 0 //def XINERAMA 00085 _xinerama_active = False; 00086 00087 if (d->hasXineramaExtensions()) { 00088 if (d->getXineramaMajorVersion() == 1) { 00089 // we know the version 1(.1?) protocol 00090 00091 /* 00092 in this version of Xinerama, we can't query on a per-screen basis, but 00093 in future versions we should be able, so the 'activeness' is checked 00094 on a pre-screen basis anyways. 00095 */ 00096 if (XineramaIsActive(**display)) { 00097 /* 00098 If Xinerama is being used, there there is only going to be one screen 00099 present. We still, of course, want to use the screen class, but that 00100 is why no screen number is used in this function call. There should 00101 never be more than one screen present with Xinerama active. 00102 */ 00103 int num; 00104 XineramaScreenInfo *info = XineramaQueryScreens(**display, &num); 00105 if (num > 0 && info) { 00106 _xinerama_areas.reserve(num); 00107 for (int i = 0; i < num; ++i) { 00108 _xinerama_areas.push_back(Rect(info[i].x_org, info[i].y_org, 00109 info[i].width, info[i].height)); 00110 } 00111 XFree(info); 00112 00113 // if we can't find any xinerama regions, then we act as if it is not 00114 // active, even though it said it was 00115 _xinerama_active = True; 00116 } 00117 } 00118 } 00119 } 00120 #endif // XINERAMA 00121 } |
|
Definition at line 35 of file screeninfo.hh. Referenced by otk::Widget::create(), otk::RenderColor::create(), otk::Surface::createObjects(), and ob::Screen::installColormap().
00035 { return _colormap; } |
|
Definition at line 36 of file screeninfo.hh. Referenced by otk::Widget::create(), otk::Surface::createObjects(), otk::TrueRenderControl::drawGradientBackground(), ob::Screen::Screen(), and otk::TrueRenderControl::TrueRenderControl().
00036 { return _depth; } |
|
Definition at line 41 of file screeninfo.hh.
00041 { return _display_string; } |
|
Definition at line 40 of file screeninfo.hh. References otk::Rect::height(). Referenced by ob::Screen::calcArea(), ob::Client::fullscreen(), and ob::Screen::Screen().
00040 { return _rect.height(); } |
|
Definition at line 38 of file screeninfo.hh.
00038 { return _rect; } |
|
|
Definition at line 37 of file screeninfo.hh.
00037 { return _screen; } |
|
Definition at line 33 of file screeninfo.hh. Referenced by otk::Widget::create(), otk::Surface::createObjects(), otk::TrueRenderControl::drawGradientBackground(), otk::RenderControl::getRenderControl(), ob::Screen::Screen(), and otk::TrueRenderControl::TrueRenderControl().
00033 { return _visual; } |
|
Definition at line 39 of file screeninfo.hh. References otk::Rect::width(). Referenced by ob::Screen::calcArea(), ob::Client::fullscreen(), and ob::Screen::Screen().
00039 { return _rect.width(); } |
|
Definition at line 19 of file screeninfo.hh. Referenced by ScreenInfo(). |
|
Definition at line 21 of file screeninfo.hh. Referenced by ScreenInfo(). |
|
Definition at line 23 of file screeninfo.hh. Referenced by ScreenInfo(). |
|
Definition at line 24 of file screeninfo.hh. Referenced by ScreenInfo(). |
|
Definition at line 18 of file screeninfo.hh. Referenced by ScreenInfo(). |
|
Definition at line 22 of file screeninfo.hh. Referenced by ScreenInfo(). |
|
Definition at line 17 of file screeninfo.hh. Referenced by ScreenInfo(). |