1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
4 # include "../config.h"
5 #endif // HAVE_CONFIG_H
9 #include "screeninfo.hh"
12 #include <X11/Xutil.h>
17 Surface::Surface(int screen)
27 Surface::Surface(int screen, const Point &size)
42 void Surface::createObjects()
44 assert(!_im); assert(_pm == None); assert(!_xftdraw);
46 const ScreenInfo *info = display->screenInfo(_screen);
48 _im = XCreateImage(**display, info->visual(), info->depth(),
49 ZPixmap, 0, NULL, _size.x(), _size.y(), 32, 0);
51 _pm = XCreatePixmap(**display, info->rootWindow(), _size.x(), _size.y(),
54 _xftdraw = XftDrawCreate(**display, _pm, info->visual(), info->colormap());
57 void Surface::destroyObjects()
59 assert(_im); assert(_pm != None); assert(_xftdraw);
61 XftDrawDestroy(_xftdraw);
64 XFreePixmap(**display, _pm);
67 // do the delete ourselves cuz we alloc it with new not malloc
74 void Surface::setSize(int w, int h)
76 if (w == _size.x() && h == _size.y()) return; // no change