mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-29 05:40:21 -04:00
opt: optimize code struct
This commit is contained in:
parent
6b02283f6d
commit
50fcb5ed68
1 changed files with 14 additions and 14 deletions
28
src/mango.c
28
src/mango.c
|
|
@ -1806,7 +1806,7 @@ buttonpress(struct wl_listener *listener, void *data) {
|
|||
struct wlr_surface *surface;
|
||||
Client *tmpc;
|
||||
int ji;
|
||||
const MouseBinding *b;
|
||||
const MouseBinding *m;
|
||||
struct wlr_surface *old_pointer_focus_surface =
|
||||
seat->pointer_state.focused_surface;
|
||||
|
||||
|
|
@ -1858,16 +1858,16 @@ buttonpress(struct wl_listener *listener, void *data) {
|
|||
for (ji = 0; ji < config.mouse_bindings_count; ji++) {
|
||||
if (config.mouse_bindings_count < 1)
|
||||
break;
|
||||
b = &config.mouse_bindings[ji];
|
||||
if (CLEANMASK(mods) == CLEANMASK(b->mod) &&
|
||||
event->button == b->button && b->func &&
|
||||
(selmon->isoverview == 1 || b->button == BTN_MIDDLE) && c) {
|
||||
b->func(&b->arg);
|
||||
m = &config.mouse_bindings[ji];
|
||||
if (CLEANMASK(mods) == CLEANMASK(m->mod) &&
|
||||
event->button == m->button && m->func &&
|
||||
(selmon->isoverview == 1 || m->button == BTN_MIDDLE) && c) {
|
||||
m->func(&m->arg);
|
||||
return;
|
||||
} else if (CLEANMASK(mods) == CLEANMASK(b->mod) &&
|
||||
event->button == b->button && b->func &&
|
||||
CLEANMASK(b->mod) != 0) {
|
||||
b->func(&b->arg);
|
||||
} else if (CLEANMASK(mods) == CLEANMASK(m->mod) &&
|
||||
event->button == m->button && m->func &&
|
||||
CLEANMASK(m->mod) != 0) {
|
||||
m->func(&m->arg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -2777,15 +2777,15 @@ void switch_toggle(struct wl_listener *listener, void *data) {
|
|||
|
||||
// 处理切换事件
|
||||
struct wlr_switch_toggle_event *event = data;
|
||||
SwitchBinding *a;
|
||||
SwitchBinding *s;
|
||||
int ji;
|
||||
|
||||
for (ji = 0; ji < config.switch_bindings_count; ji++) {
|
||||
if (config.switch_bindings_count < 1)
|
||||
break;
|
||||
a = &config.switch_bindings[ji];
|
||||
if (event->switch_state == a->fold && a->func) {
|
||||
a->func(&a->arg);
|
||||
s = &config.switch_bindings[ji];
|
||||
if (event->switch_state == s->fold && s->func) {
|
||||
s->func(&s->arg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue