diff options
| author | auric <104602845+ihateamongus@users.noreply.github.com> | 2025-09-08 21:19:14 -0500 |
|---|---|---|
| committer | auric <104602845+ihateamongus@users.noreply.github.com> | 2025-09-08 21:19:14 -0500 |
| commit | e61da07522a060da98fa3a56db3d0360469b26cf (patch) | |
| tree | c72d276bffa4dafe22ae0e4f694acfadb40b8ca1 /oldresources/breathing-exo-daemon/display | |
| parent | d11aec86841f77edd6eba3e07aa1e7e591e9da2a (diff) | |
organize repository layout
Diffstat (limited to 'oldresources/breathing-exo-daemon/display')
| -rwxr-xr-x | oldresources/breathing-exo-daemon/display/display | bin | 15688 -> 0 bytes | |||
| -rw-r--r-- | oldresources/breathing-exo-daemon/display/display-shm-x.c | 94 | ||||
| -rw-r--r-- | oldresources/breathing-exo-daemon/display/display-shm.c | 40 | ||||
| -rwxr-xr-x | oldresources/breathing-exo-daemon/display/display-x | bin | 16304 -> 0 bytes |
4 files changed, 0 insertions, 134 deletions
diff --git a/oldresources/breathing-exo-daemon/display/display b/oldresources/breathing-exo-daemon/display/display Binary files differdeleted file mode 100755 index b181258..0000000 --- a/oldresources/breathing-exo-daemon/display/display +++ /dev/null diff --git a/oldresources/breathing-exo-daemon/display/display-shm-x.c b/oldresources/breathing-exo-daemon/display/display-shm-x.c deleted file mode 100644 index 2695fd0..0000000 --- a/oldresources/breathing-exo-daemon/display/display-shm-x.c +++ /dev/null @@ -1,94 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/mman.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <X11/Xlib.h> - -#define SHM_NAME "/breathing_color_shm" // Shared memory name (same as in exo.c) -#define COLOR_SIZE 8 // Size for one color (e.g., #RRGGBB) - -int main() { - // Open shared memory object - int shm_fd = shm_open(SHM_NAME, O_RDONLY, 0666); - if (shm_fd == -1) { - perror("Failed to open shared memory"); - return 1; - } - - // Map shared memory into the process's address space - char *shm_ptr = mmap(NULL, COLOR_SIZE, PROT_READ, MAP_SHARED, shm_fd, 0); - if (shm_ptr == MAP_FAILED) { - perror("Failed to map shared memory"); - close(shm_fd); - return 1; - } - - // Initialize X11 - Display *display = XOpenDisplay(NULL); - if (display == NULL) { - perror("Unable to open X display"); - munmap(shm_ptr, COLOR_SIZE); - close(shm_fd); - return 1; - } - - // Create a window - int screen = DefaultScreen(display); - Window window = XCreateSimpleWindow(display, RootWindow(display, screen), 0, 0, 400, 400, 1, BlackPixel(display, screen), BlackPixel(display, screen)); - - // Set window properties - XStoreName(display, window, "Breathing Color Display"); - XMapWindow(display, window); - - // Set the window's background color initially - XFlush(display); - - // Start reading colors and updating the window - while (1) { - // Read the current color from shared memory - XColor color; - if (XParseColor(display, DefaultColormap(display, screen), shm_ptr, &color) == 0) { - fprintf(stderr, "Invalid color in shared memory: %s\n", shm_ptr); - continue; - } - - // Allocate the color in the X server - if (XAllocColor(display, DefaultColormap(display, screen), &color) == 0) { - fprintf(stderr, "Failed to allocate color: %s\n", shm_ptr); - continue; - } - - // Change the background color of the window - XSetWindowBackground(display, window, color.pixel); - XClearWindow(display, window); - - // Process X events - XEvent event; - while (XPending(display)) { - XNextEvent(display, &event); - if (event.type == ClientMessage) { - // Exit on close event (or any client message) - XDestroyWindow(display, window); - XCloseDisplay(display); - munmap(shm_ptr, COLOR_SIZE); - close(shm_fd); - return 0; - } - } - - // Sleep a little before checking for the next color update - usleep(100000); // 0.1 seconds - } - - // Clean up - XDestroyWindow(display, window); - XCloseDisplay(display); - munmap(shm_ptr, COLOR_SIZE); - close(shm_fd); - - return 0; -} - diff --git a/oldresources/breathing-exo-daemon/display/display-shm.c b/oldresources/breathing-exo-daemon/display/display-shm.c deleted file mode 100644 index 435077a..0000000 --- a/oldresources/breathing-exo-daemon/display/display-shm.c +++ /dev/null @@ -1,40 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/mman.h> -#include <fcntl.h> -#include <sys/stat.h> - -#define SHM_NAME "/breathing_color_shm" // Shared memory name (same as in exo.c) -#define COLOR_SIZE 8 // Size for one color (e.g., #RRGGBB) - -int main() { - int shm_fd; - char *shm_ptr; - - // Open shared memory object - shm_fd = shm_open(SHM_NAME, O_RDONLY, 0666); - if (shm_fd == -1) { - perror("Failed to open shared memory"); - return 1; - } - - // Map shared memory into the process's address space - shm_ptr = mmap(NULL, COLOR_SIZE, PROT_READ, MAP_SHARED, shm_fd, 0); - if (shm_ptr == MAP_FAILED) { - perror("Failed to map shared memory"); - close(shm_fd); - return 1; - } - - // Read the color from shared memory and print it - printf("Breathing color: %s\n", shm_ptr); - - // Clean up - munmap(shm_ptr, COLOR_SIZE); - close(shm_fd); - - return 0; -} - diff --git a/oldresources/breathing-exo-daemon/display/display-x b/oldresources/breathing-exo-daemon/display/display-x Binary files differdeleted file mode 100755 index 87622d2..0000000 --- a/oldresources/breathing-exo-daemon/display/display-x +++ /dev/null |
