mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-07-04 00:07:04 -04:00
opt: rename some func name
This commit is contained in:
parent
0182e24bc5
commit
aabaa61906
3 changed files with 61 additions and 66 deletions
|
|
@ -148,7 +148,7 @@ static void add_workspace_by_tag(int32_t tag, Monitor *m) {
|
|||
wlr_ext_workspace_handle_v1_set_name(workspace->ext_workspace, name);
|
||||
}
|
||||
|
||||
void dwl_ext_workspace_printstatus(Monitor *m) {
|
||||
void mango_ext_workspace_printstatus(Monitor *m) {
|
||||
struct workspace *w;
|
||||
uint32_t tag_status = 0;
|
||||
|
||||
|
|
@ -199,7 +199,7 @@ void refresh_monitors_workspaces_status(Monitor *m) {
|
|||
}
|
||||
}
|
||||
|
||||
dwl_ext_workspace_printstatus(m);
|
||||
mango_ext_workspace_printstatus(m);
|
||||
}
|
||||
|
||||
void workspaces_init() {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include <wlr/types/wlr_input_method_v2.h>
|
||||
#include <wlr/types/wlr_text_input_v3.h>
|
||||
|
||||
struct dwl_input_method_relay {
|
||||
struct mango_input_method_relay {
|
||||
struct wl_list text_inputs;
|
||||
struct wlr_input_method_v2 *input_method;
|
||||
struct wlr_surface *focused_surface;
|
||||
|
|
@ -26,12 +26,12 @@ struct dwl_input_method_relay {
|
|||
struct wl_listener focused_surface_destroy;
|
||||
};
|
||||
|
||||
struct dwl_input_method_popup {
|
||||
struct mango_input_method_popup {
|
||||
uint32_t type; // must at first in struct
|
||||
struct wlr_input_popup_surface_v2 *popup_surface;
|
||||
struct wlr_scene_tree *tree;
|
||||
struct wlr_scene_tree *scene_surface;
|
||||
struct dwl_input_method_relay *relay;
|
||||
struct mango_input_method_relay *relay;
|
||||
struct wl_list link;
|
||||
|
||||
struct wl_listener destroy;
|
||||
|
|
@ -39,7 +39,7 @@ struct dwl_input_method_popup {
|
|||
};
|
||||
|
||||
struct text_input {
|
||||
struct dwl_input_method_relay *relay;
|
||||
struct mango_input_method_relay *relay;
|
||||
struct wlr_text_input_v3 *input;
|
||||
struct wl_list link;
|
||||
|
||||
|
|
@ -51,20 +51,20 @@ struct text_input {
|
|||
|
||||
struct wlr_input_method_manager_v2 *input_method_manager;
|
||||
struct wlr_text_input_manager_v3 *text_input_manager;
|
||||
struct dwl_input_method_relay *dwl_input_method_relay;
|
||||
struct mango_input_method_relay *mango_input_method_relay;
|
||||
|
||||
/*-------------------封装给外部调用-------------------------------*/
|
||||
bool dwl_im_keyboard_grab_forward_key(KeyboardGroup *keyboard,
|
||||
struct wlr_keyboard_key_event *event);
|
||||
bool mango_im_keyboard_grab_forward_key(KeyboardGroup *keyboard,
|
||||
struct wlr_keyboard_key_event *event);
|
||||
|
||||
bool dwl_im_keyboard_grab_forward_modifiers(KeyboardGroup *keyboard);
|
||||
bool mango_im_keyboard_grab_forward_modifiers(KeyboardGroup *keyboard);
|
||||
|
||||
struct dwl_input_method_relay *dwl_im_relay_create();
|
||||
struct mango_input_method_relay *mango_im_relay_create();
|
||||
|
||||
void dwl_im_relay_finish(struct dwl_input_method_relay *relay);
|
||||
void mango_im_relay_finish(struct mango_input_method_relay *relay);
|
||||
|
||||
void dwl_im_relay_set_focus(struct dwl_input_method_relay *relay,
|
||||
struct wlr_surface *surface);
|
||||
void mango_im_relay_set_focus(struct mango_input_method_relay *relay,
|
||||
struct wlr_surface *surface);
|
||||
/*----------------------------------------------------------*/
|
||||
|
||||
/*------------------协议内部代码------------------------------*/
|
||||
|
|
@ -98,7 +98,7 @@ is_keyboard_emulated_by_input_method(struct wlr_keyboard *keyboard,
|
|||
static struct wlr_input_method_keyboard_grab_v2 *
|
||||
get_keyboard_grab(KeyboardGroup *keyboard) {
|
||||
struct wlr_input_method_v2 *input_method =
|
||||
dwl_input_method_relay->input_method;
|
||||
mango_input_method_relay->input_method;
|
||||
if (!input_method || !input_method->keyboard_grab) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -115,7 +115,7 @@ get_keyboard_grab(KeyboardGroup *keyboard) {
|
|||
return input_method->keyboard_grab;
|
||||
}
|
||||
|
||||
bool dwl_im_keyboard_grab_forward_modifiers(KeyboardGroup *keyboard) {
|
||||
bool mango_im_keyboard_grab_forward_modifiers(KeyboardGroup *keyboard) {
|
||||
struct wlr_input_method_keyboard_grab_v2 *keyboard_grab =
|
||||
get_keyboard_grab(keyboard);
|
||||
|
||||
|
|
@ -133,8 +133,8 @@ bool dwl_im_keyboard_grab_forward_modifiers(KeyboardGroup *keyboard) {
|
|||
}
|
||||
}
|
||||
|
||||
bool dwl_im_keyboard_grab_forward_key(KeyboardGroup *keyboard,
|
||||
struct wlr_keyboard_key_event *event) {
|
||||
bool mango_im_keyboard_grab_forward_key(KeyboardGroup *keyboard,
|
||||
struct wlr_keyboard_key_event *event) {
|
||||
|
||||
struct wlr_input_method_keyboard_grab_v2 *keyboard_grab =
|
||||
get_keyboard_grab(keyboard);
|
||||
|
|
@ -150,7 +150,7 @@ bool dwl_im_keyboard_grab_forward_key(KeyboardGroup *keyboard,
|
|||
}
|
||||
|
||||
static struct text_input *
|
||||
get_active_text_input(struct dwl_input_method_relay *relay) {
|
||||
get_active_text_input(struct mango_input_method_relay *relay) {
|
||||
struct text_input *text_input;
|
||||
|
||||
if (!relay->input_method) {
|
||||
|
|
@ -165,7 +165,7 @@ get_active_text_input(struct dwl_input_method_relay *relay) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void update_active_text_input(struct dwl_input_method_relay *relay) {
|
||||
static void update_active_text_input(struct mango_input_method_relay *relay) {
|
||||
struct text_input *active_text_input = get_active_text_input(relay);
|
||||
|
||||
if (relay->input_method && relay->active_text_input != active_text_input) {
|
||||
|
|
@ -181,7 +181,7 @@ static void update_active_text_input(struct dwl_input_method_relay *relay) {
|
|||
}
|
||||
|
||||
static void
|
||||
update_text_inputs_focused_surface(struct dwl_input_method_relay *relay) {
|
||||
update_text_inputs_focused_surface(struct mango_input_method_relay *relay) {
|
||||
struct text_input *text_input;
|
||||
wl_list_for_each(text_input, &relay->text_inputs, link) {
|
||||
struct wlr_text_input_v3 *input = text_input->input;
|
||||
|
|
@ -207,8 +207,8 @@ update_text_inputs_focused_surface(struct dwl_input_method_relay *relay) {
|
|||
}
|
||||
}
|
||||
|
||||
static void update_popup_position(struct dwl_input_method_popup *popup) {
|
||||
struct dwl_input_method_relay *relay = popup->relay;
|
||||
static void update_popup_position(struct mango_input_method_popup *popup) {
|
||||
struct mango_input_method_relay *relay = popup->relay;
|
||||
struct text_input *text_input = relay->active_text_input;
|
||||
struct wlr_box cursor_rect;
|
||||
struct wlr_xdg_surface *xdg_surface;
|
||||
|
|
@ -282,8 +282,8 @@ static void update_popup_position(struct dwl_input_method_popup *popup) {
|
|||
});
|
||||
}
|
||||
|
||||
static void update_popups_position(struct dwl_input_method_relay *relay) {
|
||||
struct dwl_input_method_popup *popup;
|
||||
static void update_popups_position(struct mango_input_method_relay *relay) {
|
||||
struct mango_input_method_popup *popup;
|
||||
wl_list_for_each(popup, &relay->popups, link) {
|
||||
update_popup_position(popup);
|
||||
}
|
||||
|
|
@ -291,7 +291,7 @@ static void update_popups_position(struct dwl_input_method_relay *relay) {
|
|||
|
||||
static void handle_input_method_commit(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct dwl_input_method_relay *relay =
|
||||
struct mango_input_method_relay *relay =
|
||||
wl_container_of(listener, relay, input_method_commit);
|
||||
struct text_input *text_input;
|
||||
struct wlr_input_method_v2 *input_method = relay->input_method;
|
||||
|
|
@ -322,7 +322,7 @@ static void handle_input_method_commit(struct wl_listener *listener,
|
|||
|
||||
static void handle_keyboard_grab_destroy(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct dwl_input_method_relay *relay =
|
||||
struct mango_input_method_relay *relay =
|
||||
wl_container_of(listener, relay, keyboard_grab_destroy);
|
||||
struct wlr_input_method_keyboard_grab_v2 *keyboard_grab =
|
||||
relay->input_method->keyboard_grab;
|
||||
|
|
@ -336,7 +336,7 @@ static void handle_keyboard_grab_destroy(struct wl_listener *listener,
|
|||
|
||||
static void handle_input_method_grab_keyboard(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct dwl_input_method_relay *relay =
|
||||
struct mango_input_method_relay *relay =
|
||||
wl_container_of(listener, relay, input_method_grab_keyboard);
|
||||
struct wlr_input_method_keyboard_grab_v2 *keyboard_grab = data;
|
||||
|
||||
|
|
@ -355,7 +355,7 @@ static void handle_input_method_grab_keyboard(struct wl_listener *listener,
|
|||
|
||||
static void handle_input_method_destroy(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct dwl_input_method_relay *relay =
|
||||
struct mango_input_method_relay *relay =
|
||||
wl_container_of(listener, relay, input_method_destroy);
|
||||
wl_list_remove(&relay->input_method_commit.link);
|
||||
wl_list_remove(&relay->input_method_grab_keyboard.link);
|
||||
|
|
@ -369,7 +369,7 @@ static void handle_input_method_destroy(struct wl_listener *listener,
|
|||
|
||||
static void handle_popup_surface_destroy(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct dwl_input_method_popup *popup =
|
||||
struct mango_input_method_popup *popup =
|
||||
wl_container_of(listener, popup, destroy);
|
||||
wlr_scene_node_destroy(&popup->tree->node);
|
||||
wl_list_remove(&popup->destroy.link);
|
||||
|
|
@ -380,18 +380,18 @@ static void handle_popup_surface_destroy(struct wl_listener *listener,
|
|||
|
||||
static void handle_popup_surface_commit(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct dwl_input_method_popup *popup =
|
||||
struct mango_input_method_popup *popup =
|
||||
wl_container_of(listener, popup, commit);
|
||||
update_popup_position(popup);
|
||||
}
|
||||
|
||||
static void handle_input_method_new_popup_surface(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct dwl_input_method_relay *relay =
|
||||
struct mango_input_method_relay *relay =
|
||||
wl_container_of(listener, relay, input_method_new_popup_surface);
|
||||
|
||||
struct dwl_input_method_popup *popup =
|
||||
ecalloc(1, sizeof(struct dwl_input_method_popup));
|
||||
struct mango_input_method_popup *popup =
|
||||
ecalloc(1, sizeof(struct mango_input_method_popup));
|
||||
popup->popup_surface = data;
|
||||
popup->relay = relay;
|
||||
|
||||
|
|
@ -415,7 +415,7 @@ static void handle_input_method_new_popup_surface(struct wl_listener *listener,
|
|||
}
|
||||
|
||||
static void handle_new_input_method(struct wl_listener *listener, void *data) {
|
||||
struct dwl_input_method_relay *relay =
|
||||
struct mango_input_method_relay *relay =
|
||||
wl_container_of(listener, relay, new_input_method);
|
||||
struct wlr_input_method_v2 *input_method = data;
|
||||
if (seat != input_method->seat) {
|
||||
|
|
@ -451,7 +451,7 @@ static void handle_new_input_method(struct wl_listener *listener, void *data) {
|
|||
update_active_text_input(relay);
|
||||
}
|
||||
|
||||
static void send_state_to_input_method(struct dwl_input_method_relay *relay) {
|
||||
static void send_state_to_input_method(struct mango_input_method_relay *relay) {
|
||||
|
||||
struct wlr_input_method_v2 *input_method = relay->input_method;
|
||||
struct wlr_text_input_v3 *input = relay->active_text_input->input;
|
||||
|
|
@ -476,7 +476,7 @@ static void send_state_to_input_method(struct dwl_input_method_relay *relay) {
|
|||
static void handle_text_input_enable(struct wl_listener *listener, void *data) {
|
||||
struct text_input *text_input =
|
||||
wl_container_of(listener, text_input, enable);
|
||||
struct dwl_input_method_relay *relay = text_input->relay;
|
||||
struct mango_input_method_relay *relay = text_input->relay;
|
||||
|
||||
update_active_text_input(relay);
|
||||
if (relay->active_text_input == text_input) {
|
||||
|
|
@ -497,7 +497,7 @@ static void handle_text_input_disable(struct wl_listener *listener,
|
|||
static void handle_text_input_commit(struct wl_listener *listener, void *data) {
|
||||
struct text_input *text_input =
|
||||
wl_container_of(listener, text_input, commit);
|
||||
struct dwl_input_method_relay *relay = text_input->relay;
|
||||
struct mango_input_method_relay *relay = text_input->relay;
|
||||
|
||||
if (relay->active_text_input == text_input) {
|
||||
update_popups_position(relay);
|
||||
|
|
@ -519,7 +519,7 @@ static void handle_text_input_destroy(struct wl_listener *listener,
|
|||
}
|
||||
|
||||
static void handle_new_text_input(struct wl_listener *listener, void *data) {
|
||||
struct dwl_input_method_relay *relay =
|
||||
struct mango_input_method_relay *relay =
|
||||
wl_container_of(listener, relay, new_text_input);
|
||||
struct wlr_text_input_v3 *wlr_text_input = data;
|
||||
struct text_input *text_input = ecalloc(1, sizeof(struct text_input));
|
||||
|
|
@ -549,16 +549,16 @@ static void handle_new_text_input(struct wl_listener *listener, void *data) {
|
|||
|
||||
static void handle_focused_surface_destroy(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct dwl_input_method_relay *relay =
|
||||
struct mango_input_method_relay *relay =
|
||||
wl_container_of(listener, relay, focused_surface_destroy);
|
||||
assert(relay->focused_surface == data);
|
||||
|
||||
dwl_im_relay_set_focus(relay, NULL);
|
||||
mango_im_relay_set_focus(relay, NULL);
|
||||
}
|
||||
|
||||
struct dwl_input_method_relay *dwl_im_relay_create() {
|
||||
struct dwl_input_method_relay *relay =
|
||||
ecalloc(1, sizeof(struct dwl_input_method_relay));
|
||||
struct mango_input_method_relay *mango_im_relay_create() {
|
||||
struct mango_input_method_relay *relay =
|
||||
ecalloc(1, sizeof(struct mango_input_method_relay));
|
||||
wl_list_init(&relay->text_inputs);
|
||||
wl_list_init(&relay->popups);
|
||||
relay->popup_tree = wlr_scene_tree_create(&scene->tree);
|
||||
|
|
@ -576,14 +576,14 @@ struct dwl_input_method_relay *dwl_im_relay_create() {
|
|||
return relay;
|
||||
}
|
||||
|
||||
void dwl_im_relay_finish(struct dwl_input_method_relay *relay) {
|
||||
void mango_im_relay_finish(struct mango_input_method_relay *relay) {
|
||||
wl_list_remove(&relay->new_text_input.link);
|
||||
wl_list_remove(&relay->new_input_method.link);
|
||||
free(relay);
|
||||
}
|
||||
|
||||
void dwl_im_relay_set_focus(struct dwl_input_method_relay *relay,
|
||||
struct wlr_surface *surface) {
|
||||
void mango_im_relay_set_focus(struct mango_input_method_relay *relay,
|
||||
struct wlr_surface *surface) {
|
||||
if (relay->focused_surface == surface) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
33
src/mango.c
33
src/mango.c
|
|
@ -295,7 +295,7 @@ typedef struct {
|
|||
InputDevice *input_dev;
|
||||
} Switch;
|
||||
|
||||
struct dwl_animation {
|
||||
struct mango_animation {
|
||||
bool should_animate;
|
||||
bool running;
|
||||
bool tagining;
|
||||
|
|
@ -311,7 +311,7 @@ struct dwl_animation {
|
|||
int32_t action;
|
||||
};
|
||||
|
||||
struct dwl_opacity_animation {
|
||||
struct mango_opacity_animation {
|
||||
bool running;
|
||||
float current_opacity;
|
||||
float target_opacity;
|
||||
|
|
@ -429,8 +429,8 @@ struct Client {
|
|||
float stack_proportion;
|
||||
float old_stack_proportion;
|
||||
bool need_output_flush;
|
||||
struct dwl_animation animation;
|
||||
struct dwl_opacity_animation opacity_animation;
|
||||
struct mango_animation animation;
|
||||
struct mango_opacity_animation opacity_animation;
|
||||
int32_t isterm, noswallow;
|
||||
int32_t allow_csd;
|
||||
int32_t force_fakemaximize;
|
||||
|
|
@ -480,12 +480,6 @@ struct Client {
|
|||
bool is_logic_hide;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct wl_list link;
|
||||
struct wl_resource *resource;
|
||||
Monitor *mon;
|
||||
} DwlIpcOutput;
|
||||
|
||||
typedef struct {
|
||||
uint32_t mod;
|
||||
xkb_keysym_t keysym;
|
||||
|
|
@ -536,7 +530,7 @@ typedef struct {
|
|||
struct wl_listener unmap;
|
||||
struct wl_listener surface_commit;
|
||||
|
||||
struct dwl_animation animation;
|
||||
struct mango_animation animation;
|
||||
bool dirty;
|
||||
int32_t noblur;
|
||||
int32_t noanim;
|
||||
|
|
@ -2020,7 +2014,8 @@ void apply_window_snap(Client *c) {
|
|||
|
||||
void focuslayer(LayerSurface *l) {
|
||||
focusclient(NULL, 0);
|
||||
dwl_im_relay_set_focus(dwl_input_method_relay, l->layer_surface->surface);
|
||||
mango_im_relay_set_focus(mango_input_method_relay,
|
||||
l->layer_surface->surface);
|
||||
client_notify_enter(l->layer_surface->surface, wlr_seat_get_keyboard(seat));
|
||||
}
|
||||
|
||||
|
|
@ -2651,7 +2646,7 @@ void cleanup(void) {
|
|||
|
||||
destroykeyboardgroup(&kb_group->destroy, NULL);
|
||||
|
||||
dwl_im_relay_finish(dwl_input_method_relay);
|
||||
mango_im_relay_finish(mango_input_method_relay);
|
||||
|
||||
/* If it's not destroyed manually it will cause a use-after-free of
|
||||
* wlr_seat. Destroy it until it's fixed in the wlroots side */
|
||||
|
|
@ -4067,7 +4062,7 @@ void focusclient(Client *c, int32_t lift) {
|
|||
selmon->sel = NULL;
|
||||
|
||||
// clear text input focus state
|
||||
dwl_im_relay_set_focus(dwl_input_method_relay, NULL);
|
||||
mango_im_relay_set_focus(mango_input_method_relay, NULL);
|
||||
wlr_seat_keyboard_notify_clear_focus(seat);
|
||||
check_vrr_enable(c);
|
||||
if (active_constraint) {
|
||||
|
|
@ -4082,7 +4077,7 @@ void focusclient(Client *c, int32_t lift) {
|
|||
// set text input focus
|
||||
// must before client_notify_enter,
|
||||
// otherwise the position of text_input will be wrong.
|
||||
dwl_im_relay_set_focus(dwl_input_method_relay, client_surface(c));
|
||||
mango_im_relay_set_focus(mango_input_method_relay, client_surface(c));
|
||||
|
||||
/* Have a client, so focus its top-level wlr_surface */
|
||||
client_notify_enter(client_surface(c), wlr_seat_get_keyboard(seat));
|
||||
|
|
@ -4446,7 +4441,7 @@ void keypress(struct wl_listener *listener, void *data) {
|
|||
if (hit_global) {
|
||||
return;
|
||||
}
|
||||
if (!dwl_im_keyboard_grab_forward_key(group, event)) {
|
||||
if (!mango_im_keyboard_grab_forward_key(group, event)) {
|
||||
wlr_seat_set_keyboard(seat, &group->wlr_group->keyboard);
|
||||
/* Pass unhandled keycodes along to the client. */
|
||||
wlr_seat_keyboard_notify_key(seat, event->time_msec, event->keycode,
|
||||
|
|
@ -4459,7 +4454,7 @@ void keypressmod(struct wl_listener *listener, void *data) {
|
|||
* pressed. We simply communicate this to the client. */
|
||||
KeyboardGroup *group = wl_container_of(listener, group, modifiers);
|
||||
|
||||
if (!dwl_im_keyboard_grab_forward_modifiers(group)) {
|
||||
if (!mango_im_keyboard_grab_forward_modifiers(group)) {
|
||||
|
||||
wlr_seat_set_keyboard(seat, &group->wlr_group->keyboard);
|
||||
/* Send modifiers to the client. */
|
||||
|
|
@ -6101,7 +6096,7 @@ void handle_print_status(struct wl_listener *listener, void *data) {
|
|||
ipc_notify_last_surface_ws_name(m);
|
||||
}
|
||||
|
||||
dwl_ext_workspace_printstatus(m);
|
||||
mango_ext_workspace_printstatus(m);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6456,7 +6451,7 @@ void setup(void) {
|
|||
input_method_manager = wlr_input_method_manager_v2_create(dpy);
|
||||
text_input_manager = wlr_text_input_manager_v3_create(dpy);
|
||||
|
||||
dwl_input_method_relay = dwl_im_relay_create();
|
||||
mango_input_method_relay = mango_im_relay_create();
|
||||
|
||||
drm_lease_manager = wlr_drm_lease_v1_manager_create(dpy, backend);
|
||||
if (drm_lease_manager) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue