Turn output power on when starting capture
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>pull/199/head
parent
3cba374172
commit
6b44a6648e
|
@ -69,6 +69,7 @@ void output_set_xdg_output(struct output* output,
|
|||
struct zxdg_output_v1* xdg_output);
|
||||
void output_set_wlr_output_power(struct output* output,
|
||||
struct zwlr_output_power_v1* wlr_output_power);
|
||||
int output_set_power_state(struct output* output, enum output_power_state state);
|
||||
void output_list_destroy(struct wl_list* list);
|
||||
struct output* output_find_by_id(struct wl_list* list, uint32_t id);
|
||||
struct output* output_find_by_name(struct wl_list* list, const char* name);
|
||||
|
|
|
@ -750,8 +750,10 @@ int wayvnc_start_capture_immediate(struct wayvnc* self)
|
|||
return 0;
|
||||
|
||||
if (self->selected_output->power == OUTPUT_POWER_OFF) {
|
||||
nvnc_log(NVNC_LOG_WARNING, "Output is in powersaving mode. Delaying capture until it turns on.");
|
||||
// TODO: Attempt to turn it on?
|
||||
nvnc_log(NVNC_LOG_WARNING, "Selected output is in powersaving mode. Delaying capture until it turns on.");
|
||||
if (output_set_power_state(self->selected_output, OUTPUT_POWER_ON)
|
||||
== 0)
|
||||
nvnc_log(NVNC_LOG_WARNING, "Requested power ON.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
17
src/output.c
17
src/output.c
|
@ -19,6 +19,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <wayland-client-protocol.h>
|
||||
#include <wayland-client.h>
|
||||
#include <neatvnc.h>
|
||||
|
@ -315,6 +317,21 @@ void output_set_wlr_output_power(struct output* self,
|
|||
&wlr_output_power_listener, self);
|
||||
}
|
||||
|
||||
int output_set_power_state(struct output* output, enum output_power_state state)
|
||||
{
|
||||
assert(state != OUTPUT_POWER_UNKNOWN);
|
||||
if (!output->wlr_output_power) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
nvnc_log(NVNC_LOG_TRACE, "Output %s requesting power %s", output->name,
|
||||
output_power_state_name(state));
|
||||
int mode = (state == OUTPUT_POWER_ON) ? ZWLR_OUTPUT_POWER_V1_MODE_ON :
|
||||
ZWLR_OUTPUT_POWER_V1_MODE_OFF;
|
||||
zwlr_output_power_v1_set_mode(output->wlr_output_power, mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct output* output_find_by_id(struct wl_list* list, uint32_t id)
|
||||
{
|
||||
struct output* output;
|
||||
|
|
Loading…
Reference in New Issue