summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-12-20 15:33:58 +0000
committerDana Jansens <danakj@orodu.net>2002-12-20 15:33:58 +0000
commit06de24ec6666578759eff2b348e50f5e8e20f3bd (patch)
tree96dca3fb0fe9efa083d0030f712b1235dfbd4cef
parent723739dafe91a156fef527f3b53a483195695cf1 (diff)
more api cleanups
-rw-r--r--otk/color.cc6
-rw-r--r--otk/focuslabel.cc4
-rw-r--r--otk/gccache.cc2
-rw-r--r--otk/image.cc2
-rw-r--r--otk/image.hh2
-rw-r--r--otk/imagecontrol.cc8
-rw-r--r--otk/label.cc4
-rw-r--r--otk/screeninfo.cc44
-rw-r--r--otk/screeninfo.hh44
-rw-r--r--otk/style.cc6
-rw-r--r--otk/style.hh2
-rw-r--r--otk/widget.cc8
12 files changed, 65 insertions, 67 deletions
diff --git a/otk/color.cc b/otk/color.cc
index b50c29d9..f150082c 100644
--- a/otk/color.cc
+++ b/otk/color.cc
@@ -75,7 +75,7 @@ void BColor::parseColorName(void) {
if (scrn == ~(0u))
scrn = DefaultScreen(OBDisplay::display);
- Colormap colormap = OBDisplay::screenInfo(scrn)->getColormap();
+ Colormap colormap = OBDisplay::screenInfo(scrn)->colormap();
// get rgb values from colorname
XColor xcol;
@@ -98,7 +98,7 @@ void BColor::parseColorName(void) {
void BColor::allocate(void) {
if (scrn == ~(0u)) scrn = DefaultScreen(OBDisplay::display);
- Colormap colormap = OBDisplay::screenInfo(scrn)->getColormap();
+ Colormap colormap = OBDisplay::screenInfo(scrn)->colormap();
if (! isValid()) {
if (colorname.empty()) {
@@ -205,7 +205,7 @@ void BColor::doCacheCleanup(void) {
if (count > 0)
XFreeColors(OBDisplay::display,
- OBDisplay::screenInfo(i)->getColormap(),
+ OBDisplay::screenInfo(i)->colormap(),
pixels, count, 0);
}
diff --git a/otk/focuslabel.cc b/otk/focuslabel.cc
index 5b9fcb30..136eb742 100644
--- a/otk/focuslabel.cc
+++ b/otk/focuslabel.cc
@@ -14,8 +14,8 @@ OtkFocusLabel::OtkFocusLabel(OtkWidget *parent)
: OtkFocusWidget(parent), _text("")
{
const ScreenInfo *info = OBDisplay::screenInfo(screen());
- _xftdraw = XftDrawCreate(OBDisplay::display, window(), info->getVisual(),
- info->getColormap());
+ _xftdraw = XftDrawCreate(OBDisplay::display, window(), info->visual(),
+ info->colormap());
}
OtkFocusLabel::~OtkFocusLabel()
diff --git a/otk/gccache.cc b/otk/gccache.cc
index f971129e..e7f58756 100644
--- a/otk/gccache.cc
+++ b/otk/gccache.cc
@@ -86,7 +86,7 @@ BGCCache::~BGCCache(void) {
BGCCacheContext *BGCCache::nextContext(unsigned int scr) {
- Window hd = OBDisplay::screenInfo(scr)->getRootWindow();
+ Window hd = OBDisplay::screenInfo(scr)->rootWindow();
BGCCacheContext *c;
diff --git a/otk/image.cc b/otk/image.cc
index 8b4e8ede..bd8d0ea7 100644
--- a/otk/image.cc
+++ b/otk/image.cc
@@ -562,7 +562,7 @@ Pixmap BImage::renderPixmap(void) {
XPutImage(OBDisplay::display, pixmap,
DefaultGC(OBDisplay::display,
- control->getScreenInfo()->getScreenNumber()),
+ control->getScreenInfo()->screen()),
image, 0, 0, 0, 0, width, height);
if (image->data) {
diff --git a/otk/image.hh b/otk/image.hh
index ed99e124..5407e522 100644
--- a/otk/image.hh
+++ b/otk/image.hh
@@ -88,7 +88,7 @@ public:
inline Window getDrawable(void) const { return window; }
- inline Visual *getVisual(void) { return screeninfo->getVisual(); }
+ inline Visual *getVisual(void) { return screeninfo->visual(); }
inline int getBitsPerPixel(void) const { return bits_per_pixel; }
inline int getDepth(void) const { return screen_depth; }
diff --git a/otk/imagecontrol.cc b/otk/imagecontrol.cc
index 07b1132c..09823b8e 100644
--- a/otk/imagecontrol.cc
+++ b/otk/imagecontrol.cc
@@ -69,10 +69,10 @@ BImageControl::BImageControl(OBTimerQueueManager *timermanager,
sqrt_table = (unsigned long *) 0;
- screen_depth = screeninfo->getDepth();
- window = screeninfo->getRootWindow();
- screen_number = screeninfo->getScreenNumber();
- colormap = screeninfo->getColormap();
+ screen_depth = screeninfo->depth();
+ window = screeninfo->rootWindow();
+ screen_number = screeninfo->screen();
+ colormap = screeninfo->colormap();
int count;
XPixmapFormatValues *pmv = XListPixmapFormats(OBDisplay::display,
diff --git a/otk/label.cc b/otk/label.cc
index bbc8a6b7..cc67a316 100644
--- a/otk/label.cc
+++ b/otk/label.cc
@@ -12,8 +12,8 @@ OtkLabel::OtkLabel(OtkWidget *parent)
: OtkWidget(parent), _text("")
{
const ScreenInfo *info = OBDisplay::screenInfo(screen());
- _xftdraw = XftDrawCreate(OBDisplay::display, window(), info->getVisual(),
- info->getColormap());
+ _xftdraw = XftDrawCreate(OBDisplay::display, window(), info->visual(),
+ info->colormap());
}
OtkLabel::~OtkLabel()
diff --git a/otk/screeninfo.cc b/otk/screeninfo.cc
index 14faf0c0..a5fafc5a 100644
--- a/otk/screeninfo.cc
+++ b/otk/screeninfo.cc
@@ -18,32 +18,32 @@ using std::string;
namespace otk {
ScreenInfo::ScreenInfo(unsigned int num) {
- screen_number = num;
+ _screen = num;
- root_window = RootWindow(OBDisplay::display, screen_number);
+ _root_window = RootWindow(OBDisplay::display, _screen);
- rect.setSize(WidthOfScreen(ScreenOfDisplay(OBDisplay::display,
- screen_number)),
+ _rect.setSize(WidthOfScreen(ScreenOfDisplay(OBDisplay::display,
+ _screen)),
HeightOfScreen(ScreenOfDisplay(OBDisplay::display,
- screen_number)));
+ _screen)));
/*
If the default depth is at least 8 we will use that,
otherwise we try to find the largest TrueColor visual.
Preference is given to 24 bit over larger depths if 24 bit is an option.
*/
- depth = DefaultDepth(OBDisplay::display, screen_number);
- visual = DefaultVisual(OBDisplay::display, screen_number);
- colormap = DefaultColormap(OBDisplay::display, screen_number);
+ _depth = DefaultDepth(OBDisplay::display, _screen);
+ _visual = DefaultVisual(OBDisplay::display, _screen);
+ _colormap = DefaultColormap(OBDisplay::display, _screen);
- if (depth < 8) {
+ if (_depth < 8) {
// search for a TrueColor Visual... if we can't find one...
// we will use the default visual for the screen
XVisualInfo vinfo_template, *vinfo_return;
int vinfo_nitems;
int best = -1;
- vinfo_template.screen = screen_number;
+ vinfo_template.screen = _screen;
vinfo_template.c_class = TrueColor;
vinfo_return = XGetVisualInfo(OBDisplay::display,
@@ -59,14 +59,14 @@ ScreenInfo::ScreenInfo(unsigned int num) {
best = i;
}
}
- if (max_depth < depth) best = -1;
+ if (max_depth < _depth) best = -1;
}
if (best != -1) {
- depth = vinfo_return[best].depth;
- visual = vinfo_return[best].visual;
- colormap = XCreateColormap(OBDisplay::display, root_window, visual,
- AllocNone);
+ _depth = vinfo_return[best].depth;
+ _visual = vinfo_return[best].visual;
+ _colormap = XCreateColormap(OBDisplay::display, _root_window, _visual,
+ AllocNone);
}
XFree(vinfo_return);
@@ -78,11 +78,11 @@ ScreenInfo::ScreenInfo(unsigned int num) {
if (pos != string::npos)
default_string.resize(pos);
- display_string = string("DISPLAY=") + default_string + '.' +
- otk::itostring(static_cast<unsigned long>(screen_number));
+ _display_string = string("DISPLAY=") + default_string + '.' +
+ otk::itostring(static_cast<unsigned long>(_screen));
#ifdef XINERAMA
- xinerama_active = False;
+ _xinerama_active = False;
if (d->hasXineramaExtensions()) {
if (d->getXineramaMajorVersion() == 1) {
@@ -104,16 +104,16 @@ ScreenInfo::ScreenInfo(unsigned int num) {
XineramaScreenInfo *info = XineramaQueryScreens(OBDisplay::display,
&num);
if (num > 0 && info) {
- xinerama_areas.reserve(num);
+ _xinerama_areas.reserve(num);
for (int i = 0; i < num; ++i) {
- xinerama_areas.push_back(Rect(info[i].x_org, info[i].y_org,
- info[i].width, info[i].height));
+ _xinerama_areas.push_back(Rect(info[i].x_org, info[i].y_org,
+ info[i].width, info[i].height));
}
XFree(info);
// if we can't find any xinerama regions, then we act as if it is not
// active, even though it said it was
- xinerama_active = True;
+ _xinerama_active = True;
}
}
}
diff --git a/otk/screeninfo.hh b/otk/screeninfo.hh
index 3bb5605f..314527ab 100644
--- a/otk/screeninfo.hh
+++ b/otk/screeninfo.hh
@@ -14,36 +14,34 @@ namespace otk {
class ScreenInfo {
private:
- Visual *visual;
- Window root_window;
- Colormap colormap;
-
- int depth;
- unsigned int screen_number;
- std::string display_string;
- Rect rect;
+ Visual *_visual;
+ Window _root_window;
+ Colormap _colormap;
+
+ int _depth;
+ unsigned int _screen;
+ std::string _display_string;
+ Rect _rect;
#ifdef XINERAMA
- RectList xinerama_areas;
- bool xinerama_active;
+ RectList _xinerama_areas;
+ bool _xinerama_active;
#endif
public:
ScreenInfo(unsigned int num);
- inline Visual *getVisual(void) const { return visual; }
- inline Window getRootWindow(void) const { return root_window; }
- inline Colormap getColormap(void) const { return colormap; }
- inline int getDepth(void) const { return depth; }
- inline unsigned int getScreenNumber(void) const
- { return screen_number; }
- inline const Rect& getRect(void) const { return rect; }
- inline unsigned int getWidth(void) const { return rect.width(); }
- inline unsigned int getHeight(void) const { return rect.height(); }
- inline const std::string& displayString(void) const
- { return display_string; }
+ inline Visual *visual() const { return _visual; }
+ inline Window rootWindow() const { return _root_window; }
+ inline Colormap colormap() const { return _colormap; }
+ inline int depth() const { return _depth; }
+ inline unsigned int screen() const { return _screen; }
+ inline const Rect& rect() const { return _rect; }
+ inline unsigned int width() const { return _rect.width(); }
+ inline unsigned int height() const { return _rect.height(); }
+ inline const std::string& displayString() const { return _display_string; }
#ifdef XINERAMA
- inline const RectList &getXineramaAreas(void) const { return xinerama_areas; }
- inline bool isXineramaActive(void) const { return xinerama_active; }
+ inline const RectList &xineramaAreas() const { return _xinerama_areas; }
+ inline bool isXineramaActive() const { return _xinerama_active; }
#endif
};
diff --git a/otk/style.cc b/otk/style.cc
index a2f362ec..5aeef434 100644
--- a/otk/style.cc
+++ b/otk/style.cc
@@ -19,7 +19,7 @@ Style::Style() : font(NULL)
Style::Style(BImageControl *ctrl)
: image_control(ctrl), font(0),
- screen_number(ctrl->getScreenInfo()->getScreenNumber())
+ screen_number(ctrl->getScreenInfo()->screen())
{
}
@@ -136,7 +136,7 @@ void Style::load(const Configuration &style) {
// load bevel, border and handle widths
const ScreenInfo *s_info = OBDisplay::screenInfo(screen_number);
- unsigned int width = s_info->getRect().width();
+ unsigned int width = s_info->rect().width();
if (! style.getValue("handleWidth", handle_width) ||
handle_width > width/2 || handle_width == 0)
@@ -160,7 +160,7 @@ void Style::load(const Configuration &style) {
void Style::readDatabaseMask(const std::string &rname, PixmapMask &pixmapMask,
const Configuration &style) {
- Window root_window = OBDisplay::screenInfo(screen_number)->getRootWindow();
+ Window root_window = OBDisplay::screenInfo(screen_number)->rootWindow();
std::string s;
int hx, hy; //ignored
int ret = BitmapOpenFailed; //default to failure.
diff --git a/otk/style.hh b/otk/style.hh
index c024ade9..c0e0bbd9 100644
--- a/otk/style.hh
+++ b/otk/style.hh
@@ -137,7 +137,7 @@ public:
inline void setImageControl(BImageControl *c) {
image_control = c;
- screen_number = c->getScreenInfo()->getScreenNumber();
+ screen_number = c->getScreenInfo()->screen();
}
inline unsigned int getScreen(void) { return screen_number; }
diff --git a/otk/widget.cc b/otk/widget.cc
index f303c3e4..07122bc6 100644
--- a/otk/widget.cc
+++ b/otk/widget.cc
@@ -70,7 +70,7 @@ OtkWidget::~OtkWidget()
void OtkWidget::create(void)
{
const ScreenInfo *scr_info = otk::OBDisplay::screenInfo(_screen);
- Window p_window = _parent ? _parent->window() : scr_info->getRootWindow();
+ Window p_window = _parent ? _parent->window() : scr_info->rootWindow();
_rect.setRect(0, 0, 1, 1); // just some initial values
@@ -78,7 +78,7 @@ void OtkWidget::create(void)
unsigned long create_mask = CWBackPixmap | CWBorderPixel | CWEventMask;
attrib_create.background_pixmap = None;
- attrib_create.colormap = scr_info->getColormap();
+ attrib_create.colormap = scr_info->colormap();
attrib_create.event_mask = ButtonPressMask | ButtonReleaseMask |
ButtonMotionMask | ExposureMask | StructureNotifyMask;
@@ -89,8 +89,8 @@ void OtkWidget::create(void)
_window = XCreateWindow(otk::OBDisplay::display, p_window, _rect.x(),
_rect.y(), _rect.width(), _rect.height(), 0,
- scr_info->getDepth(), InputOutput,
- scr_info->getVisual(), create_mask, &attrib_create);
+ scr_info->depth(), InputOutput,
+ scr_info->visual(), create_mask, &attrib_create);
_ignore_config++;
}