2016-03-25 14:06:27 +01:00
|
|
|
#ifndef _SWAYLOCK_H
|
|
|
|
#define _SWAYLOCK_H
|
2018-04-03 05:14:37 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <wayland-client.h>
|
|
|
|
#include "background-image.h"
|
|
|
|
#include "cairo.h"
|
|
|
|
#include "pool-buffer.h"
|
|
|
|
#include "swaylock/seat.h"
|
|
|
|
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
|
|
|
|
2018-04-03 21:04:31 +02:00
|
|
|
enum auth_state {
|
|
|
|
AUTH_STATE_IDLE,
|
|
|
|
AUTH_STATE_INPUT,
|
|
|
|
AUTH_STATE_BACKSPACE,
|
|
|
|
AUTH_STATE_VALIDATING,
|
|
|
|
AUTH_STATE_INVALID,
|
|
|
|
};
|
|
|
|
|
2018-04-03 05:14:37 +02:00
|
|
|
struct swaylock_args {
|
2017-02-21 20:49:22 +01:00
|
|
|
uint32_t color;
|
2018-04-03 05:14:37 +02:00
|
|
|
enum background_mode mode;
|
|
|
|
bool show_indicator;
|
2016-03-25 14:06:27 +01:00
|
|
|
};
|
|
|
|
|
2018-04-03 20:31:30 +02:00
|
|
|
struct swaylock_password {
|
|
|
|
size_t size;
|
|
|
|
size_t len;
|
|
|
|
char *buffer;
|
|
|
|
};
|
|
|
|
|
2018-04-03 05:14:37 +02:00
|
|
|
struct swaylock_state {
|
|
|
|
struct wl_display *display;
|
|
|
|
struct wl_compositor *compositor;
|
|
|
|
struct zwlr_layer_shell_v1 *layer_shell;
|
2018-04-03 23:03:29 +02:00
|
|
|
struct zwlr_input_inhibit_manager_v1 *input_inhibit_manager;
|
2018-04-03 05:14:37 +02:00
|
|
|
struct wl_shm *shm;
|
2018-04-03 20:31:30 +02:00
|
|
|
struct wl_list surfaces;
|
2018-04-03 05:14:37 +02:00
|
|
|
struct swaylock_args args;
|
2018-04-03 20:31:30 +02:00
|
|
|
struct swaylock_password password;
|
2018-04-03 05:14:37 +02:00
|
|
|
struct swaylock_xkb xkb;
|
2018-04-03 21:04:31 +02:00
|
|
|
enum auth_state auth_state;
|
2018-04-03 05:14:37 +02:00
|
|
|
bool run_display;
|
2017-02-21 20:49:22 +01:00
|
|
|
};
|
|
|
|
|
2018-04-03 20:31:30 +02:00
|
|
|
struct swaylock_surface {
|
2018-04-03 05:14:37 +02:00
|
|
|
cairo_surface_t *image;
|
|
|
|
struct swaylock_state *state;
|
|
|
|
struct wl_output *output;
|
|
|
|
struct wl_surface *surface;
|
|
|
|
struct zwlr_layer_surface_v1 *layer_surface;
|
|
|
|
struct pool_buffer buffers[2];
|
|
|
|
struct pool_buffer *current_buffer;
|
|
|
|
uint32_t width, height;
|
|
|
|
struct wl_list link;
|
2017-02-21 20:49:22 +01:00
|
|
|
};
|
|
|
|
|
2018-04-03 20:31:30 +02:00
|
|
|
void swaylock_handle_key(struct swaylock_state *state,
|
|
|
|
xkb_keysym_t keysym, uint32_t codepoint);
|
|
|
|
void render_frame(struct swaylock_surface *surface);
|
2018-04-03 21:04:31 +02:00
|
|
|
void render_frames(struct swaylock_state *state);
|
2018-04-03 20:31:30 +02:00
|
|
|
|
2016-03-25 14:06:27 +01:00
|
|
|
#endif
|