#ifdef XFT
#include <X11/Xft/Xft.h>
-int use_xft = 0;
+int use_xft;
#endif
#ifdef HAVE_XDBE
} else {
#endif /* USE_ARGB */
// pseudo transparency
-
+
if (set_transparent) {
Window parent = win;
unsigned int i;
XVisualInfo visual_template;
XVisualInfo *visual_list;
int nxvisuals = 0, i;
-
+
visual_template.screen = screen;
visual_list = XGetVisualInfo (display, VisualScreenMask,
&visual_template, &nxvisuals);
if(window.gc) {
XFreeGC(display, window.gc);
}
+ if(window.gc_back) {
+ XFreeGC(display, window.gc_back);
+ }
+ if(window.back_buffer != None) {
+ XFreePixmap(display, window.back_buffer);
+ }
memset(&window, 0, sizeof(struct conky_window));
colour_set = -1;
}
if (own_window) {
int depth = 0, flags;
Visual *visual = NULL;
-
+
if (!find_desktop_window(&window.root, &window.desktop)) {
return;
}
-
+
#ifdef USE_ARGB
if (use_argb_visual && get_argb_visual(&visual, &depth)) {
have_argb_visual = 1;
XClassHint classHint;
XWMHints wmHint;
Atom xa;
-
+
#ifdef USE_ARGB
if (have_argb_visual) {
attrs.colormap = window.colourmap;
window.x = window.y = 0;
}
/* Parent is root window so WM can take control */
+
+ fprintf(stderr, PACKAGE_NAME": creating window of %d x %d x %d\n",w,h,depth);
window.window = XCreateWindow(display, window.root, window.x,
window.y, w, h, 0, depth, InputOutput, visual,
flags, &attrs);
}
/* Skip pager */
- if (TEST_HINT(window.hints, HINT_SKIP_PAGER)) {
- /* fprintf(stderr, PACKAGE_NAME": hint - skip_pager\n");
- fflush(stderr); */
+ if (TEST_HINT(window.hints, HINT_FULLSCREEN)) {
+ fprintf(stderr, PACKAGE_NAME": hint - fullscreen\n");
+ fflush(stderr);
xa = ATOM(_NET_WM_STATE);
if (xa != None) {
- Atom xa_prop = ATOM(_NET_WM_STATE_SKIP_PAGER);
+ Atom xa_prop = ATOM(_NET_WM_STATE_FULLSCREEN);
XChangeProperty(display, window.window, xa, XA_ATOM, 32,
PropModeAppend, (unsigned char *) &xa_prop, 1);
} else
#endif /* OWN_WINDOW */
{
- XWindowAttributes attrs;
-
if (!window.window) {
window.window = find_desktop_window(&window.root, &window.desktop);
}
window.visual = DefaultVisual(display, screen);
window.colourmap = DefaultColormap(display, screen);
+ fprintf(stderr, PACKAGE_NAME": drawing to desktop window\n");
+ }
+
+ {
+ fprintf(stderr, PACKAGE_NAME": getting window attrs\n");
+ XWindowAttributes attrs;
if (XGetWindowAttributes(display, window.window, &attrs)) {
window.width = attrs.width;
window.height = attrs.height;
+ window.depth = attrs.depth;
}
-
- fprintf(stderr, PACKAGE_NAME": drawing to desktop window\n");
}
/* Drawable is same as window. This may be changed by double buffering. */
#ifdef HAVE_XDBE
if (use_xdbe) {
- int major, minor;
-
- if (!XdbeQueryExtension(display, &major, &minor)) {
- use_xdbe = 0;
- } else {
- window.back_buffer = XdbeAllocateBackBufferName(display,
- window.window, XdbeBackground);
+ {
+ window.back_buffer = XCreatePixmap(display, window.window,
+ window.width, window.height, window.depth);
if (window.back_buffer != None) {
window.drawable = window.back_buffer;
- fprintf(stderr, PACKAGE_NAME": drawing to double buffer\n");
+ fprintf(stderr, PACKAGE_NAME": created %d x %d x %d back buffer\n",window.width, window.height, window.depth);
} else {
use_xdbe = 0;
}
values.function = GXcopy;
window.gc = XCreateGC(display, window.drawable,
GCFunction | GCGraphicsExposures, &values);
+ window.gc_back = XCreateGC(display, window.drawable,
+ GCFunction | GCGraphicsExposures, &values);
}
//Get current desktop number
}
}
-void update_x11info(void)
+int update_x11info(void)
{
struct information *current_info = &info;
- if (!x_initialised == YES)
- return;
+ if (x_initialised != YES)
+ return 0;
current_info->x11.monitor.number = XScreenCount(display);
current_info->x11.monitor.current = XDefaultScreen(display);
+ return 0;
}
#ifdef OWN_WINDOW
void xdbe_swap_buffers(void)
{
if (use_xdbe) {
- XdbeSwapInfo swap;
-
- swap.swap_window = window.window;
- swap.swap_action = XdbeBackground;
- XdbeSwapBuffers(display, &swap, 1);
+ //XWindowAttributes dest;//leaks
+ //XGetWindowAttributes(display, window.window, &dest);
+ //unsigned int src_height, src_width, src_depth = 0;
+ //XGetGeometry(display, window.back_buffer, NULL, NULL, NULL,src_width,src_height, NULL, src_depth);
+// fprintf(stderr, PACKAGE_NAME": copy from %d x %d x %d to %d x %d x %d\n",src_width, src_height, src_depth, dest.width, dest.height, dest.depth);
+ XCopyArea(display, window.drawable, window.window,
+ window.gc_back, 0, 0, window.width, window.height, 0, 0);
+ /* FIXME should fill w/ window background */
+// XFillRectangle(display, window.back_buffer, window.gc,
+// 0, 0, window.width, window.height);
}
}
#endif /* HAVE_XDBE */