mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 14:45:58 +01:00
Merge pull request #1241 from emersion/output-enable-error-checking
output: make wlr_output_enable return a bool
This commit is contained in:
commit
df991a55ab
5 changed files with 16 additions and 10 deletions
|
@ -342,17 +342,17 @@ static void drm_connector_start_renderer(struct wlr_drm_connector *conn) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void enable_drm_connector(struct wlr_output *output, bool enable) {
|
bool enable_drm_connector(struct wlr_output *output, bool enable) {
|
||||||
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
|
struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
|
||||||
if (conn->state != WLR_DRM_CONN_CONNECTED
|
if (conn->state != WLR_DRM_CONN_CONNECTED
|
||||||
&& conn->state != WLR_DRM_CONN_NEEDS_MODESET) {
|
&& conn->state != WLR_DRM_CONN_NEEDS_MODESET) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
|
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend;
|
||||||
bool ok = drm->iface->conn_enable(drm, conn, enable);
|
bool ok = drm->iface->conn_enable(drm, conn, enable);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
|
@ -360,6 +360,7 @@ void enable_drm_connector(struct wlr_output *output, bool enable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_output_update_enabled(&conn->output, enable);
|
wlr_output_update_enabled(&conn->output, enable);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in,
|
static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in,
|
||||||
|
|
|
@ -143,6 +143,6 @@ void finish_drm_resources(struct wlr_drm_backend *drm);
|
||||||
void restore_drm_outputs(struct wlr_drm_backend *drm);
|
void restore_drm_outputs(struct wlr_drm_backend *drm);
|
||||||
void scan_drm_connectors(struct wlr_drm_backend *state);
|
void scan_drm_connectors(struct wlr_drm_backend *state);
|
||||||
int handle_drm_event(int fd, uint32_t mask, void *data);
|
int handle_drm_event(int fd, uint32_t mask, void *data);
|
||||||
void enable_drm_connector(struct wlr_output *output, bool enable);
|
bool enable_drm_connector(struct wlr_output *output, bool enable);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
|
|
||||||
struct wlr_output_impl {
|
struct wlr_output_impl {
|
||||||
void (*enable)(struct wlr_output *output, bool enable);
|
bool (*enable)(struct wlr_output *output, bool enable);
|
||||||
bool (*set_mode)(struct wlr_output *output, struct wlr_output_mode *mode);
|
bool (*set_mode)(struct wlr_output *output, struct wlr_output_mode *mode);
|
||||||
bool (*set_custom_mode)(struct wlr_output *output, int32_t width,
|
bool (*set_custom_mode)(struct wlr_output *output, int32_t width,
|
||||||
int32_t height, int32_t refresh);
|
int32_t height, int32_t refresh);
|
||||||
|
|
|
@ -124,11 +124,15 @@ struct wlr_output_event_swap_buffers {
|
||||||
|
|
||||||
struct wlr_surface;
|
struct wlr_surface;
|
||||||
|
|
||||||
void wlr_output_enable(struct wlr_output *output, bool enable);
|
/**
|
||||||
|
* Enables or disables the output. A disabled output is turned off and doesn't
|
||||||
|
* emit `frame` events.
|
||||||
|
*/
|
||||||
|
bool wlr_output_enable(struct wlr_output *output, bool enable);
|
||||||
void wlr_output_create_global(struct wlr_output *output);
|
void wlr_output_create_global(struct wlr_output *output);
|
||||||
void wlr_output_destroy_global(struct wlr_output *output);
|
void wlr_output_destroy_global(struct wlr_output *output);
|
||||||
/**
|
/**
|
||||||
* Sets the output mode.
|
* Sets the output mode. Enables the output if it's currently disabled.
|
||||||
*/
|
*/
|
||||||
bool wlr_output_set_mode(struct wlr_output *output,
|
bool wlr_output_set_mode(struct wlr_output *output,
|
||||||
struct wlr_output_mode *mode);
|
struct wlr_output_mode *mode);
|
||||||
|
|
|
@ -142,14 +142,15 @@ static void output_update_matrix(struct wlr_output *output) {
|
||||||
output->height, output->transform);
|
output->height, output->transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_output_enable(struct wlr_output *output, bool enable) {
|
bool wlr_output_enable(struct wlr_output *output, bool enable) {
|
||||||
if (output->enabled == enable) {
|
if (output->enabled == enable) {
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (output->impl->enable) {
|
if (output->impl->enable) {
|
||||||
output->impl->enable(output, enable);
|
return output->impl->enable(output, enable);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wlr_output_set_mode(struct wlr_output *output,
|
bool wlr_output_set_mode(struct wlr_output *output,
|
||||||
|
|
Loading…
Reference in a new issue