处理焦点相关事件
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <xcb/xproto.h>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
@@ -21,6 +22,24 @@ typedef enum event_type_t {
|
||||
EVENT_TYPE_CLIENT_MESSAGE,
|
||||
} event_type_t;
|
||||
|
||||
typedef enum notify_mode_t {
|
||||
notify_mode_normal = 0,
|
||||
notify_mode_grab = 1,
|
||||
notify_mode_ungrab = 2,
|
||||
notify_mode_while_grabbed = 3
|
||||
} notify_mode_t;
|
||||
|
||||
typedef enum notify_detail_t {
|
||||
notify_detail_ancestor = 0,
|
||||
notify_detail_virtual = 1,
|
||||
notify_detail_inferior = 2,
|
||||
notify_detail_nonlinear = 3,
|
||||
notify_detail_nonlinear_virtual = 4,
|
||||
notify_detail_pointer = 5,
|
||||
notify_detail_pointer_root = 6,
|
||||
notify_detail_none = 7,
|
||||
} notify_detail_t;
|
||||
|
||||
typedef struct mapping_notify_event_t {
|
||||
event_type_t type;
|
||||
} mapping_notify_event_t;
|
||||
@@ -81,10 +100,14 @@ typedef struct motion_notify_event_t {
|
||||
|
||||
typedef struct enter_notify_event_t {
|
||||
event_type_t type;
|
||||
xcb_window_t window;
|
||||
notify_mode_t mode;
|
||||
notify_detail_t detail;
|
||||
} enter_notify_event_t;
|
||||
|
||||
typedef struct focus_in_event_t {
|
||||
event_type_t type;
|
||||
xcb_window_t window;
|
||||
} focus_in_event_t;
|
||||
|
||||
typedef struct property_notify_event_t {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "types.h"
|
||||
@@ -18,6 +19,14 @@ void *ecalloc(size_t number_of_member, size_t member_size);
|
||||
|
||||
bool file_exist(const char *path);
|
||||
|
||||
#if defined(RELEASE)
|
||||
#define logger(fmt, ...)
|
||||
#elif defined(LOG_FILE)
|
||||
void logger(const char *fmt, ...);
|
||||
#else
|
||||
#define logger(fmt, ...) printf(fmt, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief 将 16 进制的颜色配置转换成 uint32 格式的 rgba数据
|
||||
*
|
||||
|
||||
@@ -48,6 +48,7 @@ void map_window(xcb_window_t window);
|
||||
char *get_window_name(xcb_window_t window);
|
||||
void init_window_event_mask(xcb_window_t window);
|
||||
void change_window_border_color(xcb_window_t window, uint32_t argb);
|
||||
void focus_window(xcb_window_t window);
|
||||
|
||||
typedef struct bar_cairo_params_t {
|
||||
xcb_connection_t *conn;
|
||||
@@ -95,3 +96,12 @@ 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);
|
||||
|
||||
typedef enum atom_t {
|
||||
atom_wm_protocols,
|
||||
atom_wm_delete,
|
||||
atom_wm_take_focus,
|
||||
} atom_t;
|
||||
bool send_event(xcb_window_t window, atom_t atom);
|
||||
|
||||
bool get_pointer_position(int32_t *x, int32_t *y);
|
||||
|
||||
Reference in New Issue
Block a user