kiss-repo

personal package repository
git clone git://bvnf.space/kiss-repo.git
Log | Files | Refs | README | LICENSE

commit 7c0fdd09df0bc4bf5bb079a3b9834e8546fefb8f
parent 5530f690149341f53fb8d167902da2338b437f6e
Author: aabacchus <ben@bvnf.space>
Date:   Mon, 20 Jun 2022 00:41:59 +0100

herbe: add vertical stacking patch (herbe#19)

Diffstat:
Mherbe/build | 4++++
Mherbe/checksums | 1+
Mherbe/manifest | 2++
Aherbe/patches/vertical_stacking.patch | 100+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mherbe/sources | 1+
Mherbe/version | 2+-
6 files changed, 109 insertions(+), 1 deletion(-)

diff --git a/herbe/build b/herbe/build @@ -1,4 +1,8 @@ #!/bin/sh -e +for p in *.patch; do + patch -p1 < "$p" +done + make make PREFIX="/usr" DESTDIR="$1" install diff --git a/herbe/checksums b/herbe/checksums @@ -1,2 +1,3 @@ 78e454159050c86e030fb5a6cf997ac914345210cdf5a4ca4d7600c5296b7f76 e3446acae851f974c7b81dbd4e5473be6dd946884712f5a5c20921b5dbdb54fb +bfb9e2c2f964c357058d15eafde38ab2ff90aefa11eb45c254136ef177e3caa7 diff --git a/herbe/manifest b/herbe/manifest @@ -1,5 +1,7 @@ /var/db/kiss/installed/herbe/version /var/db/kiss/installed/herbe/sources +/var/db/kiss/installed/herbe/patches/vertical_stacking.patch +/var/db/kiss/installed/herbe/patches/ /var/db/kiss/installed/herbe/manifest /var/db/kiss/installed/herbe/files/config.def.h /var/db/kiss/installed/herbe/files/ diff --git a/herbe/patches/vertical_stacking.patch b/herbe/patches/vertical_stacking.patch @@ -0,0 +1,100 @@ +diff --git a/herbe.c b/herbe.c +index 51d3990..8bfdbc1 100644 +--- a/herbe.c ++++ b/herbe.c +@@ -7,7 +7,8 @@ + #include <string.h> + #include <stdarg.h> + #include <fcntl.h> +-#include <semaphore.h> ++#include <sys/ipc.h> ++#include <sys/shm.h> + + #include "config.h" + +@@ -79,13 +80,23 @@ void expire(int sig) + XFlush(display); + } + ++void read_y_offset(unsigned int **offset, int *id) { ++ int shm_id = shmget(8432, sizeof(unsigned int), IPC_CREAT | 0660); ++ if (shm_id == -1) die("shmget failed"); ++ ++ *offset = (unsigned int *)shmat(shm_id, 0, 0); ++ if (*offset == (unsigned int *)-1) die("shmat failed\n"); ++ *id = shm_id; ++} ++ ++void free_y_offset(int id) { ++ shmctl(id, IPC_RMID, NULL); ++} ++ + int main(int argc, char *argv[]) + { + if (argc == 1) +- { +- sem_unlink("/herbe"); +- die("Usage: %s body", argv[0]); +- } ++ die("Usage: %s body", argv[0]); + + struct sigaction act_expire, act_ignore; + +@@ -151,16 +162,22 @@ int main(int argc, char *argv[]) + } + } + +- unsigned int x = pos_x; +- unsigned int y = pos_y; ++ int y_offset_id; ++ unsigned int *y_offset; ++ read_y_offset(&y_offset, &y_offset_id); ++ + unsigned int text_height = font->ascent - font->descent; + unsigned int height = (num_of_lines - 1) * line_spacing + num_of_lines * text_height + 2 * padding; ++ unsigned int x = pos_x; ++ unsigned int y = pos_y + *y_offset; ++ ++ unsigned int used_y_offset = (*y_offset) += height + padding; + + if (corner == TOP_RIGHT || corner == BOTTOM_RIGHT) +- x = screen_width - width - border_size * 2 - pos_x; ++ x = screen_width - width - border_size * 2 - x; + + if (corner == BOTTOM_LEFT || corner == BOTTOM_RIGHT) +- y = screen_height - height - border_size * 2 - pos_y; ++ y = screen_height - height - border_size * 2 - y; + + window = XCreateWindow(display, RootWindow(display, screen), x, y, width, height, border_size, DefaultDepth(display, screen), + CopyFromParent, visual, CWOverrideRedirect | CWBackPixel | CWBorderPixel, &attributes); +@@ -171,9 +188,6 @@ int main(int argc, char *argv[]) + XSelectInput(display, window, ExposureMask | ButtonPress); + XMapWindow(display, window); + +- sem_t *mutex = sem_open("/herbe", O_CREAT, 0644, 1); +- sem_wait(mutex); +- + sigaction(SIGUSR1, &act_expire, 0); + sigaction(SIGUSR2, &act_expire, 0); + +@@ -204,12 +218,11 @@ int main(int argc, char *argv[]) + } + } + +- sem_post(mutex); +- sem_close(mutex); + + for (int i = 0; i < num_of_lines; i++) + free(lines[i]); + ++ if (used_y_offset == *y_offset) free_y_offset(y_offset_id); + free(lines); + XftDrawDestroy(draw); + XftColorFree(display, visual, colormap, &color); +@@ -217,4 +230,4 @@ int main(int argc, char *argv[]) + XCloseDisplay(display); + + return exit_code; +-} +\ No newline at end of file ++} diff --git a/herbe/sources b/herbe/sources @@ -1,2 +1,3 @@ https://github.com/dudik/herbe/archive/1.0.0.tar.gz files/config.def.h +patches/vertical_stacking.patch diff --git a/herbe/version b/herbe/version @@ -1 +1 @@ -1.0.0 1 +1.0.0 2