… | |
… | |
201 | |
201 | |
202 | #endif |
202 | #endif |
203 | |
203 | |
204 | ///////////////////////////////////////////////////////////////////////////// |
204 | ///////////////////////////////////////////////////////////////////////////// |
205 | |
205 | |
|
|
206 | #if XFT |
|
|
207 | rxvt_drawable::~rxvt_drawable () |
|
|
208 | { |
|
|
209 | if (xftdrawable) |
|
|
210 | XftDrawDestroy (xftdrawable); |
|
|
211 | } |
|
|
212 | |
|
|
213 | rxvt_drawable::operator XftDraw *() |
|
|
214 | { |
|
|
215 | if (!xftdrawable) |
|
|
216 | xftdrawable = XftDrawCreate (screen->dpy, drawable, screen->visual, screen->cmap); |
|
|
217 | |
|
|
218 | return xftdrawable; |
|
|
219 | } |
|
|
220 | #endif |
|
|
221 | |
|
|
222 | ///////////////////////////////////////////////////////////////////////////// |
|
|
223 | |
|
|
224 | #if XFT |
|
|
225 | |
|
|
226 | // not strictly necessary as it is only used with superclass of zero_initialised |
|
|
227 | rxvt_screen::rxvt_screen () |
|
|
228 | : scratch_area (0) |
|
|
229 | { |
|
|
230 | } |
|
|
231 | |
|
|
232 | rxvt_drawable &rxvt_screen::scratch_drawable (int w, int h) |
|
|
233 | { |
|
|
234 | // it's actually faster to re-allocate every time. don't ask me |
|
|
235 | // why, but its likely no big deal there are no roundtrips |
|
|
236 | // (I think/hope). |
|
|
237 | if (!scratch_area || w > scratch_w || h > scratch_h || 1/*D*/) |
|
|
238 | { |
|
|
239 | if (scratch_area) |
|
|
240 | { |
|
|
241 | XFreePixmap (dpy, scratch_area->drawable); |
|
|
242 | delete scratch_area; |
|
|
243 | } |
|
|
244 | |
|
|
245 | Pixmap pm = XCreatePixmap (dpy, RootWindowOfScreen (ScreenOfDisplay (dpy, display->screen)), |
|
|
246 | scratch_w = w, scratch_h = h, depth); |
|
|
247 | |
|
|
248 | scratch_area = new rxvt_drawable (this, pm); |
|
|
249 | } |
|
|
250 | |
|
|
251 | return *scratch_area; |
|
|
252 | } |
|
|
253 | |
|
|
254 | #endif |
|
|
255 | |
206 | void |
256 | void |
207 | rxvt_screen::set (rxvt_display *disp) |
257 | rxvt_screen::set (rxvt_display *disp) |
208 | { |
258 | { |
209 | display = disp; |
259 | display = disp; |
210 | dpy = disp->dpy; |
260 | dpy = disp->dpy; |
… | |
… | |
234 | } |
284 | } |
235 | |
285 | |
236 | void |
286 | void |
237 | rxvt_screen::clear () |
287 | rxvt_screen::clear () |
238 | { |
288 | { |
|
|
289 | #if XFT |
|
|
290 | if (scratch_area) |
|
|
291 | { |
|
|
292 | XFreePixmap (dpy, scratch_area->drawable); |
|
|
293 | delete scratch_area; |
|
|
294 | } |
|
|
295 | #endif |
|
|
296 | |
239 | if (cmap != DefaultColormapOfScreen (ScreenOfDisplay (dpy, display->screen))) |
297 | if (cmap != DefaultColormapOfScreen (ScreenOfDisplay (dpy, display->screen))) |
240 | XFreeColormap (dpy, cmap); |
298 | XFreeColormap (dpy, cmap); |
241 | } |
299 | } |
242 | |
300 | |
243 | ///////////////////////////////////////////////////////////////////////////// |
301 | ///////////////////////////////////////////////////////////////////////////// |