1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-16 01:57:09 +00:00

Modify CI and Nix flake

Code tweaks

Signed-off-by: Tin <tin.svagelj@live.com>
This commit is contained in:
Tin 2023-11-09 14:05:27 +01:00 committed by Brenden Matthews
parent a4ac632db7
commit a591228b71
No known key found for this signature in database
GPG Key ID: 137B7AC2BDFD8DF0
5 changed files with 22 additions and 17 deletions

View File

@ -37,6 +37,7 @@ jobs:
libxft \
libxinerama \
libxfixes \
libxi \
lua \
ninja \
pkg-config

View File

@ -77,6 +77,9 @@
xorg.libXfixes
xorg.libXft
xorg.libXinerama
xorg.libXi
xorg.libxcb
xorg.xcbutilerrors
]
++ lib.optional stdenv.isDarwin darwin.libobjc;
};

View File

@ -391,13 +391,10 @@ bool display_output_x11::main_loop_wait(double t) {
// XQueryPointer returns wrong results because conky is a weird window
Window query_result = query_x11_window_at_pos(display, data->root_x, data->root_y);
//printf("over: %#x w:%#x d:%#x r:%#x\n", query_result, window.window, window.desktop, window.root);
static bool cursor_inside = false;
if ((query_result != 0 && query_result == window.window) ||
((query_result == window.desktop || query_result == window.root || query_result == 0) && data->root_x >= window.x && data->root_x < (window.x + window.width) &&
data->root_y >= window.y && data->root_y < (window.y + window.height))) {
//puts("over self");
if (!cursor_inside) {
llua_mouse_hook(mouse_crossing_event(
mouse_event_t::AREA_ENTER,
@ -407,15 +404,12 @@ bool display_output_x11::main_loop_wait(double t) {
}
cursor_inside = true;
} else if (cursor_inside) {
//puts("left");
llua_mouse_hook(mouse_crossing_event(
mouse_event_t::AREA_LEAVE,
data->root_x - window.x, data->root_y - window.x,
data->root_x, data->root_y
));
cursor_inside = false;
} else {
//printf("not over self\n");
}
}
XFreeEventData(display, &ev.xcookie);

View File

@ -172,6 +172,9 @@ static void print_version() {
#ifdef BUILD_XFT
<< _(" * Xft\n")
#endif /* BUILD_XFT */
#ifdef BUILD_XINPUT
<< _(" * Xinput\n")
#endif /* BUILD_XINPUT */
#ifdef BUILD_ARGB
<< _(" * ARGB visual\n")
#endif /* BUILD_ARGB */
@ -180,13 +183,13 @@ static void print_version() {
#endif
#ifdef BUILD_MOUSE_EVENTS
<< _(" * Mouse events\n")
#endif
#endif /* BUILD_MOUSE_EVENTS */
#endif /* BUILD_X11 */
#ifdef BUILD_WAYLAND
<< _(" Wayland:\n")
#ifdef BUILD_MOUSE_EVENTS
<< _(" * Mouse events\n")
#endif
#endif /* BUILD_MOUSE_EVENTS */
#endif /* BUILD_WAYLAND */
#if defined BUILD_AUDACIOUS || defined BUILD_CMUS || defined BUILD_MPD || \
defined BUILD_MOC || defined BUILD_XMMS2

View File

@ -38,8 +38,9 @@
#include <cstddef>
#include <cstdio>
#include <cstring>
#include <string>
#include <cstdlib>
#include <string>
#include <array>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wvariadic-macros"
@ -250,8 +251,9 @@ x11_error_handler(Display *d, XErrorEvent *err) {
const char *extension;
const char *base_name = xcb_errors_get_name_for_error(xcb_errors_ctx, err->error_code, &extension);
if (extension != nullptr) {
error_name = new char(strlen(base_name) + strlen(extension) + 4);
sprintf(error_name, "%s (%s)", base_name, extension);
const size_t size = strlen(base_name) + strlen(extension) + 4;
error_name = new char(size);
snprintf(error_name, size, "%s (%s)", base_name, extension);
name_allocated = true;
} else {
error_name = const_cast<char*>(base_name);
@ -260,8 +262,9 @@ x11_error_handler(Display *d, XErrorEvent *err) {
const char *major = xcb_errors_get_name_for_major_code(xcb_errors_ctx, err->request_code);
const char *minor = xcb_errors_get_name_for_minor_code(xcb_errors_ctx, err->request_code, err->minor_code);
if (minor != nullptr) {
code_description = new char(strlen(base_name) + strlen(extension) + 4);
sprintf(code_description, "%s - %s", major, minor);
const size_t size = strlen(base_name) + strlen(extension) + 4;
code_description = new char(size);
snprintf(code_description, size, "%s - %s", major, minor);
code_allocated = true;
} else {
code_description = const_cast<char*>(major);
@ -280,16 +283,17 @@ x11_error_handler(Display *d, XErrorEvent *err) {
} else {
static char code_name_buffer[3];
error_name = reinterpret_cast<char*>(&code_name_buffer);
sprintf(error_name, "%d", err->error_code);
snprintf(error_name, 3, "%d", err->error_code);
}
}
if (code_description == nullptr) {
code_description = new char(30 + 6 + 1);
sprintf(code_description, "error code: [major: %i, minor: %i]", err->request_code, err->minor_code);
const size_t size = 37;
code_description = new char(size);
snprintf(code_description, size, "error code: [major: %i, minor: %i]", err->request_code, err->minor_code);
code_allocated = true;
}
NORM_ERR(
DBGP(
"X %s Error:\n"
"Display: %lx, XID: %li, Serial: %lu\n"
"%s",