66 lines
1.8 KiB
C
66 lines
1.8 KiB
C
#pragma once
|
|
|
|
#include <X11/cursorfont.h>
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <xcb/xproto.h>
|
|
#include "types.h"
|
|
|
|
bool has_other_wm_running(void);
|
|
int get_xcb_connection_fd(void);
|
|
void flush_xcb_connection(void);
|
|
|
|
typedef enum cursor_t {
|
|
cursor_normal = XC_left_ptr,
|
|
cursor_resize = XC_bottom_right_corner,
|
|
cursor_move = XC_fleur,
|
|
} cursor_t;
|
|
void change_window_cursor(xcb_window_t window, cursor_t cursor);
|
|
void set_root_cursor(cursor_t cursor);
|
|
|
|
typedef struct bar_cairo_params_t {
|
|
xcb_connection_t *conn;
|
|
xcb_window_t window;
|
|
xcb_visualtype_t *visual;
|
|
} bar_cairo_params_t;
|
|
/**
|
|
* @brief 创建每个屏幕的 bar 窗口
|
|
* @returns 返回创建 cairo surface 需要的参数,使用完记得使用 free 释放内存
|
|
*/
|
|
bar_cairo_params_t *create_bar_window(int16_t x, int16_t y, uint16_t width,
|
|
uint16_t height, uint32_t background_argb,
|
|
cursor_t cursor);
|
|
void destroy_window(xcb_window_t window);
|
|
|
|
typedef struct monitor_rect_t monitor_rect_t;
|
|
struct monitor_rect_t {
|
|
int32_t x;
|
|
int32_t y;
|
|
uint32_t width;
|
|
uint32_t height;
|
|
monitor_rect_t *next;
|
|
};
|
|
monitor_rect_t *detect_monitor_rect(void);
|
|
|
|
typedef struct rect_size_t {
|
|
uint32_t width;
|
|
uint32_t height;
|
|
} rect_size_t;
|
|
rect_size_t *get_screen_size(void);
|
|
void set_wallpaper(uint32_t *wallpaper_data);
|
|
|
|
typedef struct window_list_t {
|
|
uint32_t count;
|
|
xcb_window_t *list;
|
|
} window_list_t;
|
|
window_list_t *scan_window_list(void);
|
|
void free_window_list(window_list_t *window_list);
|
|
void clean_xcb(void);
|
|
|
|
void grab_keybindings(const keybinding_t *keys, const size_t length);
|
|
|
|
bool get_xresource_uint32(const char *name, uint32_t *value);
|
|
void get_xresource_string(const char *name, char **value, const char *fallback);
|
|
void clean_xresource(void);
|