Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(screen): multiple small fixes in screen module behavior. #273

Merged
merged 2 commits into from
Feb 26, 2023

Conversation

FedeDP
Copy link
Owner

@FedeDP FedeDP commented Feb 25, 2023

No description provided.

@@ -7,7 +7,7 @@ static void receive_waiting_state(const msg_t *msg, UNUSED const void *userdata)
static int parse_bus_reply(sd_bus_message *reply, const char *member, void *userdata);
static int get_screen_brightness(void);
static void timeout_callback(int old_val, bool reset);
static void pause_screen(bool pause, enum mod_pause type);
static void pause_screen(bool pause, enum mod_pause type, bool reset_screen_br);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enforce the state.screen_br resetting when needed, even if screen was already paused.
Fix issues like:

  • system going to sleep -> previous code skipped resetting screen br
  • while system is sleeping, AC cable is disconnected -> since screen is already paused, screen_br is not resetted

get_screen_brightness();
pause_screen(state.ambient_br < conf.bl_conf.shutter_threshold, CLOGGED, false);
if (!paused_state) {
get_screen_brightness();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to get screen brightness if we are paused/clogged.

@@ -101,18 +103,18 @@ static void receive(const msg_t *msg, UNUSED const void *userdata) {
break;
}
case DISPLAY_UPD:
pause_screen(state.display_state, DISPLAY);
pause_screen(state.display_state, DISPLAY, false);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to reset screen_br on display upd (ie: dimming/dpms).

break;
case LID_UPD:
if (conf.bl_conf.pause_on_lid_closed) {
pause_screen(state.lid_state, LID);
pause_screen(state.lid_state, LID, false);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to reset screen_br on lid closed.

}
break;
case SUSPEND_UPD:
pause_screen(state.suspended, SUSPEND);
pause_screen(state.suspended, SUSPEND, false);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to reset screen_br on system suspend.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
@FedeDP FedeDP merged commit f01b245 into master Feb 26, 2023
@FedeDP FedeDP deleted the fix/screen_issues branch February 26, 2023 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant