output: add helper to check whether output is awake
If we have only an output but not the related compositor we currently cannot figure out whether this output is awake. This adds such a helper function. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
0f44dfdde8
commit
068591e395
11
src/output.c
11
src/output.c
@ -489,6 +489,17 @@ static int kmscon_output_connect(struct kmscon_output *output, drmModeRes *res,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if the output is active and the related compositor is awake.
|
||||
*/
|
||||
bool kmscon_output_is_awake(struct kmscon_output *output)
|
||||
{
|
||||
if (!output)
|
||||
return NULL;
|
||||
|
||||
return output->active && !kmscon_compositor_is_asleep(output->comp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the next output in the list. If there is no next output or the
|
||||
* output is not bound to any compositor, then it returns NULL.
|
||||
|
@ -81,6 +81,7 @@ int kmscon_output_new(struct kmscon_output **out);
|
||||
void kmscon_output_ref(struct kmscon_output *output);
|
||||
void kmscon_output_unref(struct kmscon_output *output);
|
||||
|
||||
bool kmscon_output_is_awake(struct kmscon_output *output);
|
||||
struct kmscon_output *kmscon_output_next(struct kmscon_output *output);
|
||||
struct kmscon_mode *kmscon_output_get_modes(struct kmscon_output *output);
|
||||
struct kmscon_mode *kmscon_output_get_current(struct kmscon_output *output);
|
||||
|
Loading…
x
Reference in New Issue
Block a user