mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-29 18:18:39 +00:00
Fixed GCC 4.7.0 issues, double buffering
Signed-off-by: Brenden Matthews <brenden@diddyinc.com>
This commit is contained in:
parent
cf7610cf42
commit
bf7248ecd6
@ -105,7 +105,7 @@ option(BUILD_X11 "Build X11 support" true)
|
|||||||
if(BUILD_X11)
|
if(BUILD_X11)
|
||||||
option(OWN_WINDOW "Enable own_window support" true)
|
option(OWN_WINDOW "Enable own_window support" true)
|
||||||
option(BUILD_XDAMAGE "Build Xdamage support" true)
|
option(BUILD_XDAMAGE "Build Xdamage support" true)
|
||||||
option(BUILD_XDBE "Build Xdbe (double-buffer) support" true)
|
option(BUILD_XDBE "Build Xdbe (double-buffer) support" false)
|
||||||
option(BUILD_XFT "Build Xft (freetype fonts) support" true)
|
option(BUILD_XFT "Build Xft (freetype fonts) support" true)
|
||||||
option(BUILD_IMLIB2 "Enable Imlib2 support" false)
|
option(BUILD_IMLIB2 "Enable Imlib2 support" false)
|
||||||
else(BUILD_X11)
|
else(BUILD_X11)
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "c++wrap.hh"
|
#include "c++wrap.hh"
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if !defined(HAVE_PIPE2) || !defined(HAVE_O_CLOEXEC)
|
#if !defined(HAVE_PIPE2) || !defined(HAVE_O_CLOEXEC)
|
||||||
|
68
src/conky.cc
68
src/conky.cc
@ -236,10 +236,11 @@ static void reload_config(void);
|
|||||||
|
|
||||||
static void print_version(void)
|
static void print_version(void)
|
||||||
{
|
{
|
||||||
std::cout << _(PACKAGE_NAME" "VERSION" compiled "BUILD_DATE" for "BUILD_ARCH"\n"
|
// std::cout << _(PACKAGE_NAME" "VERSION" compiled "BUILD_DATE" for "BUILD_ARCH"\n"
|
||||||
|
std::cout << _(PACKAGE_NAME" " VERSION" compiled for " BUILD_ARCH"\n"
|
||||||
"\nCompiled in features:\n\n"
|
"\nCompiled in features:\n\n"
|
||||||
"System config file: "SYSTEM_CONFIG_FILE"\n"
|
"System config file: " SYSTEM_CONFIG_FILE"\n"
|
||||||
"Package library path: "PACKAGE_LIBDIR"\n\n")
|
"Package library path: " PACKAGE_LIBDIR"\n\n")
|
||||||
<< _("\n General:\n")
|
<< _("\n General:\n")
|
||||||
#ifdef HAVE_OPENMP
|
#ifdef HAVE_OPENMP
|
||||||
<< _(" * OpenMP\n")
|
<< _(" * OpenMP\n")
|
||||||
@ -362,10 +363,10 @@ static void print_version(void)
|
|||||||
<< _(" * XMMS2\n")
|
<< _(" * XMMS2\n")
|
||||||
#endif /* BUILD_XMMS2 */
|
#endif /* BUILD_XMMS2 */
|
||||||
<< _("\n Default values:\n")
|
<< _("\n Default values:\n")
|
||||||
<< " * Netdevice: "DEFAULTNETDEV"\n"
|
<< " * Netdevice: " DEFAULTNETDEV"\n"
|
||||||
<< " * Local configfile: "CONFIG_FILE"\n"
|
<< " * Local configfile: " CONFIG_FILE"\n"
|
||||||
#ifdef BUILD_I18N
|
#ifdef BUILD_I18N
|
||||||
<< " * Localedir: "LOCALE_DIR"\n"
|
<< " * Localedir: " LOCALE_DIR"\n"
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUILD_HTTP
|
#ifdef BUILD_HTTP
|
||||||
<< " * HTTP-port: " << HTTPPORT << "\n"
|
<< " * HTTP-port: " << HTTPPORT << "\n"
|
||||||
@ -1959,10 +1960,16 @@ static void draw_stuff(void)
|
|||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_X11 */
|
||||||
draw_mode = FG;
|
draw_mode = FG;
|
||||||
draw_text();
|
draw_text();
|
||||||
#if defined(BUILD_X11) && defined(BUILD_XDBE)
|
#if defined(BUILD_X11)
|
||||||
|
#if defined(BUILD_XDBE)
|
||||||
if (out_to_x.get(*state)) {
|
if (out_to_x.get(*state)) {
|
||||||
xdbe_swap_buffers();
|
xdbe_swap_buffers();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (out_to_x.get(*state)) {
|
||||||
|
xpmdb_swap_buffers();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif /* BUILD_X11 && BUILD_XDBE */
|
#endif /* BUILD_X11 && BUILD_XDBE */
|
||||||
if(overwrite_fpointer) {
|
if(overwrite_fpointer) {
|
||||||
fclose(overwrite_fpointer);
|
fclose(overwrite_fpointer);
|
||||||
@ -1982,6 +1989,10 @@ static void clear_text(int exposures)
|
|||||||
/* The swap action is XdbeBackground, which clears */
|
/* The swap action is XdbeBackground, which clears */
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
|
#else
|
||||||
|
if (use_xpmdb.get(*state)) {
|
||||||
|
return;
|
||||||
|
} else
|
||||||
#endif
|
#endif
|
||||||
if (display && window.window) { // make sure these are !null
|
if (display && window.window) { // make sure these are !null
|
||||||
/* there is some extra space for borders and outlines */
|
/* there is some extra space for borders and outlines */
|
||||||
@ -2116,6 +2127,22 @@ static void main_loop(void)
|
|||||||
#ifdef BUILD_XDBE
|
#ifdef BUILD_XDBE
|
||||||
/* swap buffers */
|
/* swap buffers */
|
||||||
xdbe_swap_buffers();
|
xdbe_swap_buffers();
|
||||||
|
#else
|
||||||
|
if (use_xpmdb.get(*state)) {
|
||||||
|
|
||||||
|
XFreePixmap(display, window.back_buffer);
|
||||||
|
window.back_buffer = XCreatePixmap(display,
|
||||||
|
window.window, window.width, window.height, DefaultDepth(display, screen));
|
||||||
|
|
||||||
|
if (window.back_buffer != None) {
|
||||||
|
window.drawable = window.back_buffer;
|
||||||
|
} else {
|
||||||
|
// this is probably reallllly bad
|
||||||
|
NORM_ERR("Failed to allocate back buffer");
|
||||||
|
}
|
||||||
|
XSetForeground(display, window.gc, 0);
|
||||||
|
XFillRectangle(display, window.drawable, window.gc, 0, 0, window.width, window.height);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
changed++;
|
changed++;
|
||||||
@ -2172,8 +2199,11 @@ static void main_loop(void)
|
|||||||
|
|
||||||
clear_text(1);
|
clear_text(1);
|
||||||
|
|
||||||
#ifdef BUILD_XDBE
|
#if defined(BUILD_XDBE)
|
||||||
if (use_xdbe.get(*state)) {
|
if (use_xdbe.get(*state)) {
|
||||||
|
#else
|
||||||
|
if (use_xpmdb.get(*state)) {
|
||||||
|
#endif
|
||||||
XRectangle r;
|
XRectangle r;
|
||||||
int border_total = get_border_total();
|
int border_total = get_border_total();
|
||||||
|
|
||||||
@ -2183,7 +2213,6 @@ static void main_loop(void)
|
|||||||
r.height = text_height + 2*border_total;
|
r.height = text_height + 2*border_total;
|
||||||
XUnionRectWithRegion(&r, x11_stuff.region, x11_stuff.region);
|
XUnionRectWithRegion(&r, x11_stuff.region, x11_stuff.region);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* handle X events */
|
/* handle X events */
|
||||||
@ -2334,8 +2363,11 @@ static void main_loop(void)
|
|||||||
* all, then no swap happens and we can safely do nothing. */
|
* all, then no swap happens and we can safely do nothing. */
|
||||||
|
|
||||||
if (!XEmptyRegion(x11_stuff.region)) {
|
if (!XEmptyRegion(x11_stuff.region)) {
|
||||||
#ifdef BUILD_XDBE
|
#if defined(BUILD_XDBE)
|
||||||
if (use_xdbe.get(*state)) {
|
if (use_xdbe.get(*state)) {
|
||||||
|
#else
|
||||||
|
if (use_xpmdb.get(*state)) {
|
||||||
|
#endif
|
||||||
XRectangle r;
|
XRectangle r;
|
||||||
int border_total = get_border_total();
|
int border_total = get_border_total();
|
||||||
|
|
||||||
@ -2345,7 +2377,6 @@ static void main_loop(void)
|
|||||||
r.height = text_height + 2*border_total;
|
r.height = text_height + 2*border_total;
|
||||||
XUnionRectWithRegion(&r, x11_stuff.region, x11_stuff.region);
|
XUnionRectWithRegion(&r, x11_stuff.region, x11_stuff.region);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
XSetRegion(display, window.gc, x11_stuff.region);
|
XSetRegion(display, window.gc, x11_stuff.region);
|
||||||
#ifdef BUILD_XFT
|
#ifdef BUILD_XFT
|
||||||
if (use_xft.get(*state)) {
|
if (use_xft.get(*state)) {
|
||||||
@ -2715,7 +2746,7 @@ void load_config_file()
|
|||||||
|
|
||||||
static void print_help(const char *prog_name) {
|
static void print_help(const char *prog_name) {
|
||||||
printf("Usage: %s [OPTION]...\n"
|
printf("Usage: %s [OPTION]...\n"
|
||||||
PACKAGE_NAME" is a system monitor that renders text on desktop or to own transparent\n"
|
PACKAGE_NAME " is a system monitor that renders text on desktop or to own transparent\n"
|
||||||
"window. Command line options will override configurations defined in config\n"
|
"window. Command line options will override configurations defined in config\n"
|
||||||
"file.\n"
|
"file.\n"
|
||||||
" -v, --version version\n"
|
" -v, --version version\n"
|
||||||
@ -2735,16 +2766,14 @@ static void print_help(const char *prog_name) {
|
|||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
" -o, --own-window create own window to draw\n"
|
" -o, --own-window create own window to draw\n"
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUILD_XDBE
|
|
||||||
" -b, --double-buffer double buffer (prevents flickering)\n"
|
" -b, --double-buffer double buffer (prevents flickering)\n"
|
||||||
#endif
|
|
||||||
" -w, --window-id=WIN_ID window id to draw\n"
|
" -w, --window-id=WIN_ID window id to draw\n"
|
||||||
" -x X x position\n"
|
" -x X x position\n"
|
||||||
" -y Y y position\n"
|
" -y Y y position\n"
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_X11 */
|
||||||
" -t, --text=TEXT text to render, remember single quotes, like -t '$uptime'\n"
|
" -t, --text=TEXT text to render, remember single quotes, like -t '$uptime'\n"
|
||||||
" -u, --interval=SECS update interval\n"
|
" -u, --interval=SECS update interval\n"
|
||||||
" -i COUNT number of times to update "PACKAGE_NAME" (and quit)\n"
|
" -i COUNT number of times to update " PACKAGE_NAME " (and quit)\n"
|
||||||
" -p, --pause=SECS pause for SECS seconds at startup before doing anything\n",
|
" -p, --pause=SECS pause for SECS seconds at startup before doing anything\n",
|
||||||
prog_name
|
prog_name
|
||||||
);
|
);
|
||||||
@ -2766,9 +2795,7 @@ static const char *getopt_string = "vVqdDSs:t:u:i:hc:p:"
|
|||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
"o"
|
"o"
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUILD_XDBE
|
|
||||||
"b"
|
"b"
|
||||||
#endif
|
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_X11 */
|
||||||
#ifdef BUILD_BUILTIN_CONFIG
|
#ifdef BUILD_BUILTIN_CONFIG
|
||||||
"C"
|
"C"
|
||||||
@ -2792,9 +2819,7 @@ static const struct option longopts[] = {
|
|||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
{ "own-window", 0, NULL, 'o' },
|
{ "own-window", 0, NULL, 'o' },
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUILD_XDBE
|
|
||||||
{ "double-buffer", 0, NULL, 'b' },
|
{ "double-buffer", 0, NULL, 'b' },
|
||||||
#endif
|
|
||||||
{ "window-id", 1, NULL, 'w' },
|
{ "window-id", 1, NULL, 'w' },
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_X11 */
|
||||||
{ "text", 1, NULL, 't' },
|
{ "text", 1, NULL, 't' },
|
||||||
@ -2891,6 +2916,11 @@ void initialisation(int argc, char **argv) {
|
|||||||
state->pushboolean(true);
|
state->pushboolean(true);
|
||||||
use_xdbe.lua_set(*state);
|
use_xdbe.lua_set(*state);
|
||||||
break;
|
break;
|
||||||
|
#else
|
||||||
|
case 'b':
|
||||||
|
state->pushboolean(true);
|
||||||
|
use_xpmdb.lua_set(*state);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
#endif /* BUILD_X11 */
|
#endif /* BUILD_X11 */
|
||||||
case 't':
|
case 't':
|
||||||
|
@ -101,7 +101,7 @@ void get_ibm_acpi_fan(struct text_object *obj, char *p, int p_max_size)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CRIT_ERR(NULL, NULL, "can't open '%s': %s\nYou are not using the IBM ACPI. Remove "
|
CRIT_ERR(NULL, NULL, "can't open '%s': %s\nYou are not using the IBM ACPI. Remove "
|
||||||
"ibm* from your "PACKAGE_NAME" config file.", fan, strerror(errno));
|
"ibm* from your " PACKAGE_NAME" config file.", fan, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -154,7 +154,7 @@ int get_ibm_acpi_temps(void)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CRIT_ERR(NULL, NULL, "can't open '%s': %s\nYou are not using the IBM ACPI. Remove "
|
CRIT_ERR(NULL, NULL, "can't open '%s': %s\nYou are not using the IBM ACPI. Remove "
|
||||||
"ibm* from your "PACKAGE_NAME" config file.", thermal, strerror(errno));
|
"ibm* from your " PACKAGE_NAME" config file.", thermal, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -205,7 +205,7 @@ void get_ibm_acpi_volume(struct text_object *obj, char *p, int p_max_size)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CRIT_ERR(NULL, NULL, "can't open '%s': %s\nYou are not using the IBM ACPI. Remove "
|
CRIT_ERR(NULL, NULL, "can't open '%s': %s\nYou are not using the IBM ACPI. Remove "
|
||||||
"ibm* from your "PACKAGE_NAME" config file.", volume, strerror(errno));
|
"ibm* from your " PACKAGE_NAME" config file.", volume, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -253,7 +253,7 @@ void get_ibm_acpi_brightness(struct text_object *obj, char *p, int p_max_size)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CRIT_ERR(NULL, NULL, "can't open '%s': %s\nYou are not using the IBM ACPI. Remove "
|
CRIT_ERR(NULL, NULL, "can't open '%s': %s\nYou are not using the IBM ACPI. Remove "
|
||||||
"ibm* from your "PACKAGE_NAME" config file.", filename, strerror(errno));
|
"ibm* from your " PACKAGE_NAME" config file.", filename, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
@ -176,6 +176,11 @@ static void cimlib_draw_image(struct image_list_s *cur, int *clip_x, int
|
|||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
static int rep = 0;
|
static int rep = 0;
|
||||||
|
|
||||||
|
if (imlib_context_get_drawable() != window.drawable) {
|
||||||
|
imlib_context_set_drawable(window.drawable);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
image = imlib_load_image(cur->name);
|
image = imlib_load_image(cur->name);
|
||||||
if (!image) {
|
if (!image) {
|
||||||
if (!rep)
|
if (!rep)
|
||||||
|
@ -1050,7 +1050,7 @@ static int open_sysfs_sensor(const char *dir, const char *dev, const char *type,
|
|||||||
fd = open(path, O_RDONLY);
|
fd = open(path, O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
NORM_ERR("can't open '%s': %s\nplease check your device or remove this "
|
NORM_ERR("can't open '%s': %s\nplease check your device or remove this "
|
||||||
"var from "PACKAGE_NAME, path, strerror(errno));
|
"var from " PACKAGE_NAME, path, strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ void llua_init(void)
|
|||||||
free(old_path);
|
free(old_path);
|
||||||
free(new_path);
|
free(new_path);
|
||||||
|
|
||||||
lua_pushstring(lua_L, PACKAGE_NAME" "VERSION" compiled "BUILD_DATE" for "BUILD_ARCH);
|
lua_pushstring(lua_L, PACKAGE_NAME" " VERSION" compiled " BUILD_DATE" for " BUILD_ARCH);
|
||||||
lua_setglobal(lua_L, "conky_build_info");
|
lua_setglobal(lua_L, "conky_build_info");
|
||||||
|
|
||||||
lua_pushstring(lua_L, VERSION);
|
lua_pushstring(lua_L, VERSION);
|
||||||
|
@ -78,7 +78,7 @@ void parse_tcp_ping_arg(struct text_object *obj, const char *arg, void *free_at_
|
|||||||
obj->data.opaque = addr;
|
obj->data.opaque = addr;
|
||||||
memset(addr, 0, sizeof(struct sockaddr_in));
|
memset(addr, 0, sizeof(struct sockaddr_in));
|
||||||
hostname = (char *) malloc(strlen(arg)+1);
|
hostname = (char *) malloc(strlen(arg)+1);
|
||||||
switch( sscanf(arg, "%s %"SCNu16, hostname, &(addr->sin_port)) ) {
|
switch( sscanf(arg, "%s %" SCNu16, hostname, &(addr->sin_port)) ) {
|
||||||
case 1:
|
case 1:
|
||||||
addr->sin_port = DEFAULT_TCP_PING_PORT;
|
addr->sin_port = DEFAULT_TCP_PING_PORT;
|
||||||
break;
|
break;
|
||||||
|
@ -72,7 +72,7 @@ void get_sony_fanspeed(struct text_object *obj, char *p_client_buffer, int clien
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CRIT_ERR(NULL, NULL, "can't open '%s': %s\nEnable sony support or remove "
|
CRIT_ERR(NULL, NULL, "can't open '%s': %s\nEnable sony support or remove "
|
||||||
"sony* from your "PACKAGE_NAME" config file.",
|
"sony* from your " PACKAGE_NAME" config file.",
|
||||||
fan, strerror(errno));
|
fan, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,10 +193,10 @@ char *scan_graph(struct text_object *obj, const char *args, double defscale)
|
|||||||
g->scale = defscale;
|
g->scale = defscale;
|
||||||
g->tempgrad = FALSE;
|
g->tempgrad = FALSE;
|
||||||
if (args) {
|
if (args) {
|
||||||
if (strstr(args, " "TEMPGRAD) || strncmp(args, TEMPGRAD, strlen(TEMPGRAD)) == 0) {
|
if (strstr(args, " " TEMPGRAD) || strncmp(args, TEMPGRAD, strlen(TEMPGRAD)) == 0) {
|
||||||
g->tempgrad = TRUE;
|
g->tempgrad = TRUE;
|
||||||
}
|
}
|
||||||
if (strstr(args, " "LOGGRAPH) || strncmp(args, LOGGRAPH, strlen(LOGGRAPH)) == 0) {
|
if (strstr(args, " " LOGGRAPH) || strncmp(args, LOGGRAPH, strlen(LOGGRAPH)) == 0) {
|
||||||
g->flags |= SF_SHOWLOG;
|
g->flags |= SF_SHOWLOG;
|
||||||
}
|
}
|
||||||
if (sscanf(args, "%d,%d %x %x %lf", &g->height, &g->width, &g->first_colour, &g->last_colour, &g->scale) == 5) {
|
if (sscanf(args, "%d,%d %x %x %lf", &g->height, &g->width, &g->first_colour, &g->last_colour, &g->scale) == 5) {
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "update-cb.hh"
|
#include "update-cb.hh"
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
namespace conky {
|
namespace conky {
|
||||||
|
@ -27,9 +27,12 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
// the following probably requires a is-gcc-4.7.0 check
|
||||||
|
#include <mutex>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "c++wrap.hh"
|
#include "c++wrap.hh"
|
||||||
|
54
src/x11.cc
54
src/x11.cc
@ -170,6 +170,48 @@ namespace priv {
|
|||||||
|
|
||||||
++s;
|
++s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
bool use_xpmdb_setting::set_up(lua::state &l)
|
||||||
|
{
|
||||||
|
// double_buffer makes no sense when not drawing to X
|
||||||
|
if(not out_to_x.get(l))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
window.back_buffer = XCreatePixmap(display,
|
||||||
|
window.window, window.width+1, window.height+1, DefaultDepth(display, screen));
|
||||||
|
if (window.back_buffer != None) {
|
||||||
|
window.drawable = window.back_buffer;
|
||||||
|
} else {
|
||||||
|
NORM_ERR("Failed to allocate back buffer");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
XFlush(display);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void use_xpmdb_setting::lua_setter(lua::state &l, bool init)
|
||||||
|
{
|
||||||
|
lua::stack_sentry s(l, -2);
|
||||||
|
|
||||||
|
Base::lua_setter(l, init);
|
||||||
|
|
||||||
|
if(init && do_convert(l, -1).first) {
|
||||||
|
if(not set_up(l)) {
|
||||||
|
l.pop();
|
||||||
|
l.pushboolean(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, PACKAGE_NAME": drawing to %s buffer\n",
|
||||||
|
do_convert(l, -1).first?"double":"single");
|
||||||
|
}
|
||||||
|
|
||||||
|
++s;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void colour_setting::lua_setter(lua::state &l, bool init)
|
void colour_setting::lua_setter(lua::state &l, bool init)
|
||||||
@ -316,6 +358,8 @@ priv::own_window_setting own_window;
|
|||||||
|
|
||||||
#ifdef BUILD_XDBE
|
#ifdef BUILD_XDBE
|
||||||
priv::use_xdbe_setting use_xdbe;
|
priv::use_xdbe_setting use_xdbe;
|
||||||
|
#else
|
||||||
|
priv::use_xpmdb_setting use_xpmdb;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BUILD_IMLIB2
|
#ifdef BUILD_IMLIB2
|
||||||
@ -1176,4 +1220,14 @@ void xdbe_swap_buffers(void)
|
|||||||
XdbeSwapBuffers(display, &swap, 1);
|
XdbeSwapBuffers(display, &swap, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
void xpmdb_swap_buffers(void)
|
||||||
|
{
|
||||||
|
if (use_xpmdb.get(*state)) {
|
||||||
|
XCopyArea(display, window.back_buffer, window.window, window.gc, 0, 0, window.width, window.height, 0, 0);
|
||||||
|
XSetForeground(display, window.gc, 0);
|
||||||
|
XFillRectangle(display, window.drawable, window.gc, 0, 0, window.width, window.height);
|
||||||
|
XFlush(display);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif /* BUILD_XDBE */
|
#endif /* BUILD_XDBE */
|
||||||
|
20
src/x11.h
20
src/x11.h
@ -74,6 +74,8 @@ struct conky_window {
|
|||||||
|
|
||||||
#ifdef BUILD_XDBE
|
#ifdef BUILD_XDBE
|
||||||
XdbeBackBuffer back_buffer;
|
XdbeBackBuffer back_buffer;
|
||||||
|
#else
|
||||||
|
Pixmap back_buffer;
|
||||||
#endif
|
#endif
|
||||||
#ifdef BUILD_XFT
|
#ifdef BUILD_XFT
|
||||||
XftDraw *xftdraw;
|
XftDraw *xftdraw;
|
||||||
@ -116,6 +118,8 @@ void print_desktop_name(struct text_object *, char *, int);
|
|||||||
|
|
||||||
#ifdef BUILD_XDBE
|
#ifdef BUILD_XDBE
|
||||||
void xdbe_swap_buffers(void);
|
void xdbe_swap_buffers(void);
|
||||||
|
#else
|
||||||
|
void xpmdb_swap_buffers(void);
|
||||||
#endif /* BUILD_XDBE */
|
#endif /* BUILD_XDBE */
|
||||||
|
|
||||||
/* alignments */
|
/* alignments */
|
||||||
@ -173,6 +177,20 @@ namespace priv {
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class use_xpmdb_setting: public conky::simple_config_setting<bool> {
|
||||||
|
typedef conky::simple_config_setting<bool> Base;
|
||||||
|
|
||||||
|
bool set_up(lua::state &l);
|
||||||
|
protected:
|
||||||
|
virtual void lua_setter(lua::state &l, bool init);
|
||||||
|
|
||||||
|
public:
|
||||||
|
use_xpmdb_setting()
|
||||||
|
: Base("double_buffer", false, false)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct colour_traits {
|
struct colour_traits {
|
||||||
static const lua::Type type = lua::TSTRING;
|
static const lua::Type type = lua::TSTRING;
|
||||||
typedef unsigned long Type;
|
typedef unsigned long Type;
|
||||||
@ -235,6 +253,8 @@ extern priv::own_window_setting own_window;
|
|||||||
|
|
||||||
#ifdef BUILD_XDBE
|
#ifdef BUILD_XDBE
|
||||||
extern priv::use_xdbe_setting use_xdbe;
|
extern priv::use_xdbe_setting use_xdbe;
|
||||||
|
#else
|
||||||
|
extern priv::use_xpmdb_setting use_xpmdb;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /*X11_H_*/
|
#endif /*X11_H_*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user