mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-02-09 10:07:13 -05:00
fix: crash when focusmon to invalid monitor
This commit is contained in:
parent
814fd950e7
commit
481ccb534b
1 changed files with 5 additions and 3 deletions
|
|
@ -174,15 +174,17 @@ int toggle_trackpad_enable(const Arg *arg) {
|
|||
int focusmon(const Arg *arg) {
|
||||
Client *c = NULL;
|
||||
Monitor *m = NULL;
|
||||
Monitor *tm = NULL;
|
||||
|
||||
if (arg->i != UNDIR) {
|
||||
m = dirtomon(arg->i);
|
||||
tm = dirtomon(arg->i);
|
||||
} else if (arg->v) {
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (!m->wlr_output->enabled) {
|
||||
continue;
|
||||
}
|
||||
if (regex_match(arg->v, m->wlr_output->name)) {
|
||||
tm = m;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -190,10 +192,10 @@ int focusmon(const Arg *arg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!m || !m->wlr_output->enabled || m == selmon)
|
||||
if (!tm || !tm->wlr_output->enabled || tm == selmon)
|
||||
return 0;
|
||||
|
||||
selmon = m;
|
||||
selmon = tm;
|
||||
if (warpcursor) {
|
||||
warp_cursor_to_selmon(selmon);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue