Initial commit.

This commit is contained in:
Storm Dragon
2026-06-02 17:29:55 -04:00
commit db522d7d66
33 changed files with 4017 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
#ifndef _ACCESSIBILITY_FEEDBACK_H
#define _ACCESSIBILITY_FEEDBACK_H
typedef enum {
ACCESSIBILITY_SCREEN_LOCKED = 0,
ACCESSIBILITY_ENTER_PASSWORD,
ACCESSIBILITY_CHARACTER_TYPED,
ACCESSIBILITY_CHARACTER_ERASED,
ACCESSIBILITY_NOTHING_TO_ERASE,
ACCESSIBILITY_PASSWORD_CLEARED,
ACCESSIBILITY_VERIFYING,
ACCESSIBILITY_AUTHENTICATED,
ACCESSIBILITY_INCORRECT_PASSWORD,
ACCESSIBILITY_CAPS_LOCK_ON,
ACCESSIBILITY_CAPS_LOCK_OFF,
ACCESSIBILITY_NUM_LOCK_ON,
ACCESSIBILITY_NUM_LOCK_OFF,
} accessibility_feedback_t;
void accessibility_feedback_start(int inherited_xcb_fd);
void accessibility_feedback_notify(accessibility_feedback_t feedback);
#endif
+8
View File
@@ -0,0 +1,8 @@
#ifndef _CURSORS_H
#define _CURSORS_H
#define CURS_NONE 0
#define CURS_WIN 1
#define CURS_DEFAULT 2
#endif
+22
View File
@@ -0,0 +1,22 @@
#pragma once
/**
* Initialize the DPI setting.
* This will use the 'Xft.dpi' X resource if available and fall back to
* guessing the correct value otherwise.
*/
void init_dpi(void);
/**
* This function returns the value of the DPI setting.
*
*/
long get_dpi_value(void);
/**
* Convert a logical amount of pixels (e.g. 2 pixels on a “standard” 96 DPI
* screen) to a corresponding amount of physical pixels on a standard or retina
* screen, e.g. 5 pixels on a 227 DPI MacBook Pro 13" Retina screen.
*
*/
int logical_px(const int logical);
+15
View File
@@ -0,0 +1,15 @@
#ifndef _I3LOCK_H
#define _I3LOCK_H
/* This macro will only print debug output when started with --debug.
* This is important because xautolock (for example) closes stdout/stderr by
* default, so just printing something to stdout will lead to the data ending
* up on the X11 socket (!). */
#define DEBUG(fmt, ...) \
do { \
if (debug_mode) { \
fprintf(stderr, "[i38lock-debug] " fmt, ##__VA_ARGS__); \
} \
} while (0)
#endif
+17
View File
@@ -0,0 +1,17 @@
#ifndef _XINERAMA_H
#define _XINERAMA_H
typedef struct Rect {
int16_t x;
int16_t y;
uint16_t width;
uint16_t height;
} Rect;
extern int xr_screens;
extern Rect *xr_resolutions;
void randr_init(int *event_base, xcb_window_t root);
void randr_query(xcb_window_t root);
#endif
+29
View File
@@ -0,0 +1,29 @@
#ifndef _UNLOCK_INDICATOR_H
#define _UNLOCK_INDICATOR_H
#include <xcb/xcb.h>
typedef enum {
STATE_STARTED = 0, /* default state */
STATE_KEY_PRESSED = 1, /* key was pressed, show unlock indicator */
STATE_KEY_ACTIVE = 2, /* a key was pressed recently, highlight part
of the unlock indicator. */
STATE_BACKSPACE_ACTIVE = 3, /* backspace was pressed recently, highlight
part of the unlock indicator in red. */
STATE_NOTHING_TO_DELETE = 4, /* backspace was pressed, but there is nothing to delete. */
} unlock_state_t;
typedef enum {
STATE_AUTH_IDLE = 0, /* no authenticator interaction at the moment */
STATE_AUTH_VERIFY = 1, /* currently verifying the password via authenticator */
STATE_AUTH_LOCK = 2, /* currently locking the screen */
STATE_AUTH_WRONG = 3, /* the password was wrong */
STATE_I38LOCK_LOCK_FAILED = 4, /* I38Lock failed to load */
} auth_state_t;
void free_bg_pixmap(void);
void draw_image(xcb_pixmap_t bg_pixmap, uint32_t *resolution);
void redraw_screen(void);
void clear_indicator(void);
#endif
+17
View File
@@ -0,0 +1,17 @@
#ifndef _XCB_H
#define _XCB_H
#include <xcb/xcb.h>
extern xcb_connection_t *conn;
extern xcb_screen_t *screen;
xcb_visualtype_t *get_root_visual_type(xcb_screen_t *s);
xcb_pixmap_t create_bg_pixmap(xcb_connection_t *conn, xcb_screen_t *scr, u_int32_t *resolution, char *color);
xcb_window_t open_fullscreen_window(xcb_connection_t *conn, xcb_screen_t *scr, char *color, xcb_pixmap_t pixmap);
bool grab_pointer_and_keyboard(xcb_connection_t *conn, xcb_screen_t *screen, xcb_cursor_t cursor, int tries);
xcb_cursor_t create_cursor(xcb_connection_t *conn, xcb_screen_t *screen, xcb_window_t win, int choice);
xcb_window_t find_focused_window(xcb_connection_t *conn, const xcb_window_t root);
void set_focused_window(xcb_connection_t *conn, const xcb_window_t root, const xcb_window_t window);
#endif