mirror of
https://github.com/Raymo111/i3lock-color.git
synced 2024-11-11 13:50:52 -05:00
Extract if(dpms) calls to wrapper functions
This commit is contained in:
parent
6c34f6aa40
commit
d91fdc368e
1 changed files with 14 additions and 6 deletions
20
i3lock.c
20
i3lock.c
|
@ -73,6 +73,16 @@ void u8_dec(char *s, int *i) {
|
||||||
(void)(isutf(s[--(*i)]) || isutf(s[--(*i)]) || isutf(s[--(*i)]) || --(*i));
|
(void)(isutf(s[--(*i)]) || isutf(s[--(*i)]) || isutf(s[--(*i)]) || --(*i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void turn_monitors_on(void) {
|
||||||
|
if (dpms)
|
||||||
|
dpms_set_mode(conn, XCB_DPMS_DPMS_MODE_ON);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void turn_monitors_off(void) {
|
||||||
|
if (dpms)
|
||||||
|
dpms_set_mode(conn, XCB_DPMS_DPMS_MODE_OFF);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loads the XKB keymap from the X11 server and feeds it to xkbcommon.
|
* Loads the XKB keymap from the X11 server and feeds it to xkbcommon.
|
||||||
* Necessary so that we can properly let xkbcommon track the keyboard state and
|
* Necessary so that we can properly let xkbcommon track the keyboard state and
|
||||||
|
@ -214,8 +224,7 @@ static void input_done(void) {
|
||||||
clear_password_memory();
|
clear_password_memory();
|
||||||
/* Turn the screen on, as it may have been turned off
|
/* Turn the screen on, as it may have been turned off
|
||||||
* on release of the 'enter' key. */
|
* on release of the 'enter' key. */
|
||||||
if (dpms)
|
turn_monitors_on();
|
||||||
dpms_set_mode(conn, XCB_DPMS_DPMS_MODE_ON);
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,8 +509,8 @@ static void xcb_check_cb(EV_P_ ev_check *w, int revents) {
|
||||||
|
|
||||||
/* If this was the backspace or escape key we are back at an
|
/* If this was the backspace or escape key we are back at an
|
||||||
* empty input, so turn off the screen if DPMS is enabled */
|
* empty input, so turn off the screen if DPMS is enabled */
|
||||||
if (dpms && input_position == 0)
|
if (input_position == 0)
|
||||||
dpms_set_mode(conn, XCB_DPMS_DPMS_MODE_OFF);
|
turn_monitors_off();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -774,8 +783,7 @@ int main(int argc, char *argv[]) {
|
||||||
* keyboard. */
|
* keyboard. */
|
||||||
(void)load_keymap();
|
(void)load_keymap();
|
||||||
|
|
||||||
if (dpms)
|
turn_monitors_off();
|
||||||
dpms_set_mode(conn, XCB_DPMS_DPMS_MODE_OFF);
|
|
||||||
|
|
||||||
/* Initialize the libev event loop. */
|
/* Initialize the libev event loop. */
|
||||||
main_loop = EV_DEFAULT;
|
main_loop = EV_DEFAULT;
|
||||||
|
|
Loading…
Reference in a new issue