mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-06-25 13:14:13 -04:00
opt: Reconstruct the output commit logic
This commit is contained in:
parent
a7838855a8
commit
444e0decea
6 changed files with 112 additions and 103 deletions
|
|
@ -1945,11 +1945,11 @@ int32_t togglejump(const Arg *arg) {
|
|||
|
||||
int32_t disable_monitor(const Arg *arg) {
|
||||
Monitor *m = NULL;
|
||||
struct wlr_output_state state = {0};
|
||||
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (match_monitor_spec(arg->v, m)) {
|
||||
wlr_output_state_set_enabled(&state, false);
|
||||
wlr_output_commit_state(m->wlr_output, &state);
|
||||
wlr_output_state_set_enabled(&m->pending, false);
|
||||
mango_output_commit(m);
|
||||
m->asleep = 1;
|
||||
updatemons(NULL, NULL);
|
||||
break;
|
||||
|
|
@ -1960,11 +1960,10 @@ int32_t disable_monitor(const Arg *arg) {
|
|||
|
||||
int32_t enable_monitor(const Arg *arg) {
|
||||
Monitor *m = NULL;
|
||||
struct wlr_output_state state = {0};
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (match_monitor_spec(arg->v, m)) {
|
||||
wlr_output_state_set_enabled(&state, true);
|
||||
wlr_output_commit_state(m->wlr_output, &state);
|
||||
wlr_output_state_set_enabled(&m->pending, true);
|
||||
mango_output_commit(m);
|
||||
m->asleep = 0;
|
||||
updatemons(NULL, NULL);
|
||||
break;
|
||||
|
|
@ -1975,11 +1974,10 @@ int32_t enable_monitor(const Arg *arg) {
|
|||
|
||||
int32_t toggle_monitor(const Arg *arg) {
|
||||
Monitor *m = NULL;
|
||||
struct wlr_output_state state = {0};
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (match_monitor_spec(arg->v, m)) {
|
||||
wlr_output_state_set_enabled(&state, !m->wlr_output->enabled);
|
||||
wlr_output_commit_state(m->wlr_output, &state);
|
||||
wlr_output_state_set_enabled(&m->pending, !m->wlr_output->enabled);
|
||||
mango_output_commit(m);
|
||||
m->asleep = !m->wlr_output->enabled;
|
||||
updatemons(NULL, NULL);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue