aboutsummaryrefslogtreecommitdiff
path: root/include/wlr
diff options
context:
space:
mode:
Diffstat (limited to 'include/wlr')
-rw-r--r--include/wlr/interfaces/wlr_output.h4
-rw-r--r--include/wlr/types/wlr_output.h48
2 files changed, 42 insertions, 10 deletions
diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h
index a9a89c34..8d4a3fd8 100644
--- a/include/wlr/interfaces/wlr_output.h
+++ b/include/wlr/interfaces/wlr_output.h
@@ -15,10 +15,6 @@
#include <wlr/types/wlr_output.h>
struct wlr_output_impl {
- bool (*enable)(struct wlr_output *output, bool enable);
- bool (*set_mode)(struct wlr_output *output, struct wlr_output_mode *mode);
- bool (*set_custom_mode)(struct wlr_output *output, int32_t width,
- int32_t height, int32_t refresh);
bool (*set_cursor)(struct wlr_output *output, struct wlr_texture *texture,
int32_t scale, enum wl_output_transform transform,
int32_t hotspot_x, int32_t hotspot_y, bool update_texture);
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index 281f7daf..be04ec3b 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -49,6 +49,10 @@ struct wlr_output_cursor {
enum wlr_output_state_field {
WLR_OUTPUT_STATE_BUFFER = 1 << 0,
WLR_OUTPUT_STATE_DAMAGE = 1 << 1,
+ WLR_OUTPUT_STATE_MODE = 1 << 2,
+ WLR_OUTPUT_STATE_ENABLED = 1 << 3,
+ WLR_OUTPUT_STATE_SCALE = 1 << 4,
+ WLR_OUTPUT_STATE_TRANSFORM = 1 << 5,
};
enum wlr_output_state_buffer_type {
@@ -56,16 +60,32 @@ enum wlr_output_state_buffer_type {
WLR_OUTPUT_STATE_BUFFER_SCANOUT,
};
+enum wlr_output_state_mode_type {
+ WLR_OUTPUT_STATE_MODE_FIXED,
+ WLR_OUTPUT_STATE_MODE_CUSTOM,
+};
+
/**
* Holds the double-buffered output state.
*/
struct wlr_output_state {
uint32_t committed; // enum wlr_output_state_field
pixman_region32_t damage; // output-buffer-local coordinates
+ bool enabled;
+ float scale;
+ enum wl_output_transform transform;
// only valid if WLR_OUTPUT_STATE_BUFFER
enum wlr_output_state_buffer_type buffer_type;
struct wlr_buffer *buffer; // if WLR_OUTPUT_STATE_BUFFER_SCANOUT
+
+ // only valid if WLR_OUTPUT_STATE_MODE
+ enum wlr_output_state_mode_type mode_type;
+ struct wlr_output_mode *mode;
+ struct {
+ int32_t width, height;
+ int32_t refresh; // mHz, may be zero
+ } custom_mode;
};
struct wlr_output_impl;
@@ -183,8 +203,11 @@ struct wlr_surface;
/**
* Enables or disables the output. A disabled output is turned off and doesn't
* emit `frame` events.
+ *
+ * Whether an output is enabled is double-buffered state, see
+ * `wlr_output_commit`.
*/
-bool wlr_output_enable(struct wlr_output *output, bool enable);
+void wlr_output_enable(struct wlr_output *output, bool enable);
void wlr_output_create_global(struct wlr_output *output);
void wlr_output_destroy_global(struct wlr_output *output);
/**
@@ -194,17 +217,31 @@ void wlr_output_destroy_global(struct wlr_output *output);
struct wlr_output_mode *wlr_output_preferred_mode(struct wlr_output *output);
/**
* Sets the output mode. Enables the output if it's currently disabled.
+ *
+ * Mode is double-buffered state, see `wlr_output_commit`.
*/
-bool wlr_output_set_mode(struct wlr_output *output,
+void wlr_output_set_mode(struct wlr_output *output,
struct wlr_output_mode *mode);
/**
* Sets a custom mode on the output. If modes are available, they are preferred.
* Setting `refresh` to zero lets the backend pick a preferred value.
+ *
+ * Custom mode is double-buffered state, see `wlr_output_commit`.
*/
-bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
+void wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
int32_t height, int32_t refresh);
+/**
+ * Sets a transform for the output.
+ *
+ * Transform is double-buffered state, see `wlr_output_commit`.
+ */
void wlr_output_set_transform(struct wlr_output *output,
enum wl_output_transform transform);
+/**
+ * Sets a scale for the output.
+ *
+ * Scale is double-buffered state, see `wlr_output_commit`.
+ */
void wlr_output_set_scale(struct wlr_output *output, float scale);
void wlr_output_set_subpixel(struct wlr_output *output,
enum wl_output_subpixel subpixel);
@@ -262,9 +299,8 @@ void wlr_output_set_damage(struct wlr_output *output,
pixman_region32_t *damage);
/**
* Commit the pending output state. If `wlr_output_attach_render` has been
- * called, the pending frame will be submitted for display.
- *
- * This function schedules a `frame` event.
+ * called, the pending frame will be submitted for display and a `frame` event
+ * will be scheduled.
*/
bool wlr_output_commit(struct wlr_output *output);
/**