mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-18 06:47:31 -04:00
output: add output_state_get_cursor_layer() helper
This commit is contained in:
parent
a863b82bdb
commit
4157715e26
2 changed files with 20 additions and 0 deletions
|
|
@ -18,4 +18,7 @@ bool output_cursor_set_texture(struct wlr_output_cursor *cursor,
|
||||||
struct wlr_texture *texture, bool own_texture, float scale,
|
struct wlr_texture *texture, bool own_texture, float scale,
|
||||||
enum wl_output_transform transform, int32_t hotspot_x, int32_t hotspot_y);
|
enum wl_output_transform transform, int32_t hotspot_x, int32_t hotspot_y);
|
||||||
|
|
||||||
|
struct wlr_output_layer_state *output_state_get_cursor_layer(
|
||||||
|
const struct wlr_output_state *state);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
#include <wlr/types/wlr_output_layer.h>
|
||||||
#include "types/wlr_output.h"
|
#include "types/wlr_output.h"
|
||||||
|
|
||||||
void wlr_output_state_init(struct wlr_output_state *state) {
|
void wlr_output_state_init(struct wlr_output_state *state) {
|
||||||
|
|
@ -150,3 +151,19 @@ err:
|
||||||
wlr_output_state_finish(©);
|
wlr_output_state_finish(©);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wlr_output_layer_state *output_state_get_cursor_layer(
|
||||||
|
const struct wlr_output_state *state) {
|
||||||
|
if (!(state->committed & WLR_OUTPUT_STATE_LAYERS)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (state->layers_len == 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct wlr_output_layer_state *layer_state = &state->layers[state->layers_len - 1];
|
||||||
|
if (!layer_state->layer->cursor) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return layer_state;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue