… | |
… | |
6 | * Copyright (c) 2003-2011 Marc Lehmann <schmorp@schmorp.de> |
6 | * Copyright (c) 2003-2011 Marc Lehmann <schmorp@schmorp.de> |
7 | * Copyright (c) 2011 Emanuele Giaquinta <e.giaquinta@glauco.it> |
7 | * Copyright (c) 2011 Emanuele Giaquinta <e.giaquinta@glauco.it> |
8 | * |
8 | * |
9 | * This program is free software; you can redistribute it and/or modify |
9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by |
10 | * it under the terms of the GNU General Public License as published by |
11 | * the Free Software Foundation; either version 2 of the License, or |
11 | * the Free Software Foundation; either version 3 of the License, or |
12 | * (at your option) any later version. |
12 | * (at your option) any later version. |
13 | * |
13 | * |
14 | * This program is distributed in the hope that it will be useful, |
14 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
… | |
… | |
66 | #endif |
66 | #endif |
67 | #if USE_XIM |
67 | #if USE_XIM |
68 | "WM_LOCALE_NAME", |
68 | "WM_LOCALE_NAME", |
69 | "XIM_SERVERS", |
69 | "XIM_SERVERS", |
70 | #endif |
70 | #endif |
71 | #if ENABLE_TRANSPARENCY |
71 | #if HAVE_IMG || ENABLE_PERL |
72 | "_XROOTPMAP_ID", |
72 | "_XROOTPMAP_ID", |
73 | "ESETROOT_PMAP_ID", |
73 | "ESETROOT_PMAP_ID", |
74 | #endif |
74 | #endif |
75 | #if ENABLE_XEMBED |
75 | #if ENABLE_XEMBED |
76 | "_XEMBED", |
76 | "_XEMBED", |
… | |
… | |
260 | depth = DefaultDepthOfScreen (screen); |
260 | depth = DefaultDepthOfScreen (screen); |
261 | visual = DefaultVisualOfScreen (screen); |
261 | visual = DefaultVisualOfScreen (screen); |
262 | cmap = DefaultColormapOfScreen (screen); |
262 | cmap = DefaultColormapOfScreen (screen); |
263 | } |
263 | } |
264 | |
264 | |
|
|
265 | #if ENABLE_FRILLS |
|
|
266 | |
265 | void |
267 | void |
266 | rxvt_screen::select_visual (int bitdepth) |
268 | rxvt_screen::select_visual (int id) |
267 | { |
269 | { |
268 | #if XFT |
|
|
269 | XVisualInfo vinfo; |
270 | XVisualInfo vinfo; |
|
|
271 | vinfo.visualid = id; |
|
|
272 | int n; |
|
|
273 | |
|
|
274 | if (XVisualInfo *vi = XGetVisualInfo (dpy, VisualIDMask, &vinfo, &n)) |
|
|
275 | { |
|
|
276 | depth = vi->depth; |
|
|
277 | visual = vi->visual; |
|
|
278 | |
|
|
279 | XFree (vi); |
|
|
280 | |
|
|
281 | cmap = XCreateColormap (dpy, display->root, visual, AllocNone); |
|
|
282 | } |
|
|
283 | else |
|
|
284 | rxvt_warn ("no visual found for requested id 0x%02x, using default visual.\n", id); |
|
|
285 | } |
|
|
286 | |
|
|
287 | void |
|
|
288 | rxvt_screen::select_depth (int bitdepth) |
|
|
289 | { |
|
|
290 | XVisualInfo vinfo; |
270 | |
291 | |
271 | if (XMatchVisualInfo (dpy, display->screen, bitdepth, TrueColor, &vinfo)) |
292 | if (XMatchVisualInfo (dpy, display->screen, bitdepth, TrueColor, &vinfo)) |
272 | { |
|
|
273 | depth = bitdepth; |
|
|
274 | visual = vinfo.visual; |
293 | select_visual (vinfo.visualid); |
275 | cmap = XCreateColormap (dpy, display->root, visual, AllocNone); |
294 | else |
276 | } |
295 | rxvt_warn ("no visual found for requested depth %d, using default visual.\n", bitdepth); |
277 | #endif |
|
|
278 | } |
296 | } |
|
|
297 | |
|
|
298 | #endif |
279 | |
299 | |
280 | void |
300 | void |
281 | rxvt_screen::clear () |
301 | rxvt_screen::clear () |
282 | { |
302 | { |
283 | #if XFT |
303 | #if XFT |
… | |
… | |
470 | |
490 | |
471 | flags = 0; |
491 | flags = 0; |
472 | #if XRENDER |
492 | #if XRENDER |
473 | int major, minor; |
493 | int major, minor; |
474 | if (XRenderQueryVersion (dpy, &major, &minor)) |
494 | if (XRenderQueryVersion (dpy, &major, &minor)) |
475 | { |
|
|
476 | flags |= DISPLAY_HAS_RENDER; |
|
|
477 | |
|
|
478 | if (major > 0 || (major == 0 && minor >= 10)) |
|
|
479 | flags |= DISPLAY_HAS_RENDER_10; |
|
|
480 | |
|
|
481 | if (major > 0 || (major == 0 && minor >= 11)) |
495 | if (major > 0 || (major == 0 && minor >= 11)) |
|
|
496 | { |
482 | flags |= DISPLAY_HAS_RENDER_MUL; |
497 | flags |= DISPLAY_HAS_RENDER; |
483 | |
498 | |
484 | XFilters *filters = XRenderQueryFilters (dpy, root); |
499 | if (XFilters *filters = XRenderQueryFilters (dpy, root)) |
485 | if (filters) |
|
|
486 | { |
500 | { |
487 | for (int i = 0; i < filters->nfilter; i++) |
501 | for (int i = 0; i < filters->nfilter; i++) |
488 | if (!strcmp (filters->filter[i], FilterConvolution)) |
502 | if (!strcmp (filters->filter [i], FilterConvolution)) |
489 | flags |= DISPLAY_HAS_RENDER_CONV; |
503 | flags |= DISPLAY_HAS_RENDER_CONV; |
490 | |
504 | |
491 | XFree (filters); |
505 | XFree (filters); |
492 | } |
506 | } |
493 | } |
507 | } |
494 | #endif |
508 | #endif |
495 | |
509 | |
496 | int fd = XConnectionNumber (dpy); |
510 | int fd = XConnectionNumber (dpy); |
497 | |
511 | |
498 | // try to detect whether we have a local connection. |
512 | // try to detect whether we have a local connection. |