mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-06-17 06:32:21 +00:00
Fix DependentOptions splitting arguments on spaces
Fix broken x11.cc Signed-off-by: Tin <tin.svagelj@live.com>
This commit is contained in:
parent
f6d42c5a69
commit
cbebe44707
|
@ -109,8 +109,9 @@ cmake_dependent_option(BUILD_HDDTEMP "Support for hddtemp" true
|
|||
cmake_dependent_option(BUILD_IPV6 "Enable if you want IPv6 support" true
|
||||
"OS_LINUX" false)
|
||||
# nvidia may also work on FreeBSD, not sure
|
||||
cmake_dependent_option(BUILD_NVIDIA "Enable nvidia support" false
|
||||
"OS_LINUX" false)
|
||||
dependent_option(BUILD_NVIDIA "Enable Nvidia stat support on Linux" false
|
||||
"OS_LINUX;BUILD_X11" false
|
||||
"Nvidia stat supports only Linux and requires X11")
|
||||
|
||||
# macOS Only
|
||||
cmake_dependent_option(
|
||||
|
@ -165,6 +166,9 @@ else()
|
|||
"Xfixes support requires X11")
|
||||
endif(OS_DARWIN)
|
||||
|
||||
dependent_option(BUILD_ARGB "Build ARGB (real transparency) support" true
|
||||
"OWN_WINDOW" false
|
||||
"ARGB support requires OWN_WINDOW enabled")
|
||||
dependent_option(BUILD_XINERAMA "Build Xinerama support" true
|
||||
"BUILD_X11" false
|
||||
"Xinerama support requires X11")
|
||||
|
@ -180,6 +184,9 @@ dependent_option(BUILD_IMLIB2 "Enable Imlib2 support" true
|
|||
dependent_option(BUILD_XSHAPE "Enable Xshape support" true
|
||||
"BUILD_X11" false
|
||||
"Xshape support requires X11")
|
||||
dependent_option(BUILD_XINPUT "Build Xinput 2 support" true
|
||||
"BUILD_X11;BUILD_MOUSE_EVENTS" false
|
||||
"Xinput 2 support requires X11 and BUILD_MOUSE_EVENTS enabled")
|
||||
|
||||
# if we build with any GUI support
|
||||
if(BUILD_X11)
|
||||
|
@ -192,13 +199,6 @@ endif(BUILD_WAYLAND)
|
|||
dependent_option(BUILD_MOUSE_EVENTS "Enable mouse event support" true
|
||||
"BUILD_WAYLAND OR OWN_WINDOW" false
|
||||
"Mouse event support requires Wayland or OWN_WINDOW enabled")
|
||||
dependent_option(BUILD_XINPUT "Build Xinput 2 support" true
|
||||
"BUILD_X11;BUILD_MOUSE_EVENTS" false
|
||||
"Xinput 2 support requires X11 and BUILD_MOUSE_EVENTS enabled")
|
||||
|
||||
dependent_option(BUILD_ARGB "Build ARGB (real transparency) support" true
|
||||
"OWN_WINDOW" false
|
||||
"ARGB support requires OWN_WINDOW enabled")
|
||||
|
||||
# Lua library options
|
||||
option(BUILD_LUA_CAIRO "Build cairo bindings for Lua" false)
|
||||
|
@ -247,6 +247,8 @@ option(BUILD_PULSEAUDIO
|
|||
option(BUILD_INTEL_BACKLIGHT
|
||||
"Enable support for Intel backlight" false)
|
||||
|
||||
run_dependency_checks()
|
||||
|
||||
message(STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS})
|
||||
message(STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS})
|
||||
|
||||
|
|
|
@ -9,28 +9,52 @@ https://github.com/Kitware/CMake/blob/master/Modules/CMakeDependentOption.cmake
|
|||
|
||||
Modified to so it produces warnings instead of hiding an option completely and
|
||||
sets a default value.
|
||||
Difference is that `depends` argument is ALWAYS a semicolon separated list of
|
||||
<expr> tokens.
|
||||
|
||||
Argument meaning and order are the same, and there's an additional (warn)
|
||||
argument which is the message printed if the end-user enabled a feature which
|
||||
isn't "possible".
|
||||
|
||||
Actual checks are deferred until RUN_DEPENDENCY_CHECKS() is called in order to
|
||||
allow out of order declaration of dependencies and dependecy graph cycles.
|
||||
As the checks can affect each other they're run in a loop until the graph settles.
|
||||
That means CMake can end up in an infinite loop, though it shouldn't happen with
|
||||
normal use... (i.e. disable A if B not present)
|
||||
#]=======================================================================]
|
||||
|
||||
set(__DEPENDENT_OPTIONS_CHANGE_HAPPENED true)
|
||||
set(__DEPENDENT_OPTIONS_LATER_INVOKED_CODE "")
|
||||
|
||||
macro(DEPENDENT_OPTION option doc default depends else warn)
|
||||
option(${option} "${doc}" "${default}")
|
||||
|
||||
string(APPEND __DEPENDENT_OPTIONS_LATER_INVOKED_CODE "
|
||||
set(${option}_POSSIBLE 1)
|
||||
foreach(d ${depends})
|
||||
cmake_language(EVAL CODE "
|
||||
if (${d})
|
||||
string(REGEX MATCHALL \"[^;]+\" __${option}_TOKENS \"${depends}\")
|
||||
foreach(it \${__${option}_TOKENS})
|
||||
cmake_language(EVAL CODE \"
|
||||
if (\${it})
|
||||
else()
|
||||
set(${option}_POSSIBLE 0)
|
||||
endif()"
|
||||
)
|
||||
endif()\")
|
||||
endforeach()
|
||||
option(${option} "${doc}" "${default}")
|
||||
unset(__${option}_TOKENS)
|
||||
if(NOT ${option}_POSSIBLE)
|
||||
if(NOT ${option} MATCHES ${else})
|
||||
message(NOTICE "${warn}; setting to '${else}'.")
|
||||
if(NOT \"\${${option}}\" STREQUAL \"${else}\")
|
||||
message(NOTICE \"${warn}; setting to '${else}'.\")
|
||||
set(${option} ${else} CACHE BOOL \"${doc}\" FORCE)
|
||||
set(__DEPENDENT_OPTIONS_CHANGE_HAPPENED true)
|
||||
endif()
|
||||
set(${option} ${else} CACHE BOOL "${doc}" FORCE)
|
||||
endif()
|
||||
unset(${option}_POSSIBLE)
|
||||
unset(${option}_POSSIBLE)")
|
||||
endmacro()
|
||||
|
||||
macro(RUN_DEPENDENCY_CHECKS)
|
||||
while(__DEPENDENT_OPTIONS_CHANGE_HAPPENED)
|
||||
set(__DEPENDENT_OPTIONS_CHANGE_HAPPENED false)
|
||||
cmake_language(EVAL CODE "${__DEPENDENT_OPTIONS_LATER_INVOKED_CODE}")
|
||||
endwhile()
|
||||
set(__DEPENDENT_OPTIONS_CHANGE_HAPPENED true)
|
||||
set(__DEPENDENT_OPTIONS_LATER_INVOKED_CODE "")
|
||||
endmacro()
|
47
src/x11.cc
47
src/x11.cc
|
@ -93,7 +93,7 @@ xcb_errors_context_t *xcb_errors_ctx;
|
|||
struct conky_x11_window window;
|
||||
|
||||
#ifdef BUILD_ARGB
|
||||
bool have_argb_visual = false;
|
||||
bool have_argb_visual;
|
||||
#endif /* BUILD_ARGB */
|
||||
|
||||
conky::simple_config_setting<std::string> display_name("display", std::string(),
|
||||
|
@ -696,7 +696,7 @@ void x11_init_window(lua::state &l, bool own) {
|
|||
attrs.colormap = window.colourmap;
|
||||
flags &= ~CWBackPixel;
|
||||
flags |= CWBorderPixel | CWColormap;
|
||||
} else {
|
||||
}
|
||||
#endif /* BUILD_ARGB */
|
||||
|
||||
if (own_window_type.get(l) == TYPE_DOCK) { window.x = window.y = 0; }
|
||||
|
@ -724,8 +724,7 @@ void x11_init_window(lua::state &l, bool own) {
|
|||
/* allow only decorated windows to be given mouse input */
|
||||
int major_version;
|
||||
int minor_version;
|
||||
if (XShapeQueryVersion(display, &major_version, &minor_version) ==
|
||||
0) {
|
||||
if (XShapeQueryVersion(display, &major_version, &minor_version) == 0) {
|
||||
NORM_ERR("Input shapes are not supported");
|
||||
} else {
|
||||
if (own_window.get(*state) &&
|
||||
|
@ -912,8 +911,7 @@ void x11_init_window(lua::state &l, bool own) {
|
|||
fflush(stderr);
|
||||
|
||||
XMapWindow(display, window.window);
|
||||
}
|
||||
else
|
||||
} else
|
||||
#endif /* OWN_WINDOW */
|
||||
{
|
||||
XWindowAttributes attrs;
|
||||
|
@ -1012,8 +1010,7 @@ void x11_init_window(lua::state &l, bool own) {
|
|||
/* Window must be mapped and same size as display or
|
||||
* work space */
|
||||
if (attrs.map_state != 0 &&
|
||||
((attrs.width == display_width &&
|
||||
attrs.height == display_height) ||
|
||||
((attrs.width == display_width && attrs.height == display_height) ||
|
||||
(attrs.width == w && attrs.height == h))) {
|
||||
win = children[j];
|
||||
break;
|
||||
|
@ -1052,16 +1049,15 @@ void x11_init_window(lua::state &l, bool own) {
|
|||
if ((XGetWindowProperty(current_display, root, atom, 0, 1L, False,
|
||||
XA_CARDINAL, &actual_type, &actual_format, &nitems,
|
||||
&bytes_after, &prop) == Success) &&
|
||||
(actual_type == XA_CARDINAL) && (nitems == 1L) &&
|
||||
(actual_format == 32)) {
|
||||
(actual_type == XA_CARDINAL) && (nitems == 1L) && (actual_format == 32)) {
|
||||
current_info->x11.desktop.current = prop[0] + 1;
|
||||
}
|
||||
if (prop != nullptr) { XFree(prop); }
|
||||
}
|
||||
|
||||
// Get total number of available desktops
|
||||
static inline void get_x11_desktop_number(Display * current_display,
|
||||
Window root, Atom atom) {
|
||||
static inline void get_x11_desktop_number(Display *current_display, Window root,
|
||||
Atom atom) {
|
||||
Atom actual_type;
|
||||
int actual_format;
|
||||
unsigned long nitems;
|
||||
|
@ -1074,16 +1070,15 @@ void x11_init_window(lua::state &l, bool own) {
|
|||
if ((XGetWindowProperty(current_display, root, atom, 0, 1L, False,
|
||||
XA_CARDINAL, &actual_type, &actual_format, &nitems,
|
||||
&bytes_after, &prop) == Success) &&
|
||||
(actual_type == XA_CARDINAL) && (nitems == 1L) &&
|
||||
(actual_format == 32)) {
|
||||
(actual_type == XA_CARDINAL) && (nitems == 1L) && (actual_format == 32)) {
|
||||
current_info->x11.desktop.number = prop[0];
|
||||
}
|
||||
if (prop != nullptr) { XFree(prop); }
|
||||
}
|
||||
|
||||
// Get all desktop names
|
||||
static inline void get_x11_desktop_names(Display * current_display,
|
||||
Window root, Atom atom) {
|
||||
static inline void get_x11_desktop_names(Display *current_display, Window root,
|
||||
Atom atom) {
|
||||
Atom actual_type;
|
||||
int actual_format;
|
||||
unsigned long nitems;
|
||||
|
@ -1132,8 +1127,7 @@ void x11_init_window(lua::state &l, bool own) {
|
|||
/* Check if we initialise else retrieve changed property */
|
||||
if (atom == 0) {
|
||||
atom_current = XInternAtom(current_display, "_NET_CURRENT_DESKTOP", True);
|
||||
atom_number =
|
||||
XInternAtom(current_display, "_NET_NUMBER_OF_DESKTOPS", True);
|
||||
atom_number = XInternAtom(current_display, "_NET_NUMBER_OF_DESKTOPS", True);
|
||||
atom_names = XInternAtom(current_display, "_NET_DESKTOP_NAMES", True);
|
||||
get_x11_desktop_current(current_display, root, atom_current);
|
||||
get_x11_desktop_number(current_display, root, atom_number);
|
||||
|
@ -1164,8 +1158,7 @@ void x11_init_window(lua::state &l, bool own) {
|
|||
|
||||
static const char NOT_IN_X[] = "Not running in X";
|
||||
|
||||
void print_monitor(struct text_object * obj, char *p,
|
||||
unsigned int p_max_size) {
|
||||
void print_monitor(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||
(void)obj;
|
||||
|
||||
if (!out_to_x.get(*state)) {
|
||||
|
@ -1186,8 +1179,7 @@ void x11_init_window(lua::state &l, bool own) {
|
|||
snprintf(p, p_max_size, "%d", XScreenCount(display));
|
||||
}
|
||||
|
||||
void print_desktop(struct text_object * obj, char *p,
|
||||
unsigned int p_max_size) {
|
||||
void print_desktop(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||
(void)obj;
|
||||
|
||||
if (!out_to_x.get(*state)) {
|
||||
|
@ -1271,8 +1263,8 @@ void x11_init_window(lua::state &l, bool own) {
|
|||
}
|
||||
|
||||
XChangeProperty(display, window.window, strut, XA_CARDINAL, 32,
|
||||
PropModeReplace,
|
||||
reinterpret_cast<unsigned char *>(&sizes), 4);
|
||||
PropModeReplace, reinterpret_cast<unsigned char *>(&sizes),
|
||||
4);
|
||||
|
||||
if ((strut = ATOM(_NET_WM_STRUT_PARTIAL)) != None) {
|
||||
XChangeProperty(display, window.window, strut, XA_CARDINAL, 32,
|
||||
|
@ -1358,10 +1350,9 @@ void xpmdb_swap_buffers(void) {
|
|||
}
|
||||
|
||||
InputEvent *xev_as_input_event(XEvent &ev) {
|
||||
if (ev.type == KeyPress || ev.type == KeyRelease ||
|
||||
ev.type == ButtonPress || ev.type == ButtonRelease ||
|
||||
ev.type == MotionNotify || ev.type == EnterNotify ||
|
||||
ev.type == LeaveNotify) {
|
||||
if (ev.type == KeyPress || ev.type == KeyRelease || ev.type == ButtonPress ||
|
||||
ev.type == ButtonRelease || ev.type == MotionNotify ||
|
||||
ev.type == EnterNotify || ev.type == LeaveNotify) {
|
||||
return reinterpret_cast<InputEvent *>(&ev);
|
||||
} else {
|
||||
return nullptr;
|
||||
|
|
Loading…
Reference in New Issue
Block a user