Skip to content
Myr

wayland.h

This file

Path

wayland.h

128 lines · 3.2 KiB · C

Last changed by

wayland: implement text-input-unstable-v3 for IME supportMark Stosbergbefore adoption43caf1d

History of this file

Take it

1#pragma once23#include <stdbool.h>4#include <stdint.h>56struct zwp_text_input_v3;  /* text-input-unstable-v3 */78#include <fcft/fcft.h>910#include "clipboard.h"11#include "config.h"12#include "dmenu.h"13#include "fdm.h"14#include "key-binding.h"15#include "match.h"16#include "prompt.h"17#include "render.h"1819struct wayland;2021struct repeat {22    int fd;23    int32_t delay;24    int32_t rate;2526    bool dont_re_repeat;27    uint32_t key;28};2930struct seat {31    struct fdm *fdm;32    struct wayland *wayl;33    struct wl_seat *wl_seat;34    uint32_t wl_name;35    char *name;3637    struct wl_keyboard *wl_keyboard;38    struct {39        uint32_t serial;40        struct xkb_context *xkb;41        struct xkb_keymap *xkb_keymap;42        struct xkb_state *xkb_state;43        struct xkb_compose_table *xkb_compose_table;44        struct xkb_compose_state *xkb_compose_state;45        struct repeat repeat;46    } kbd;4748    struct wl_pointer *wl_pointer;49    struct {50        uint32_t serial;5152        int x;53        int y;5455        struct wl_surface *surface;56        struct wp_viewport *viewport;57        struct wl_cursor_theme *theme;58        struct wl_cursor *cursor;59        float scale;6061        bool discrete_used;62        double accumulated_scroll;63    } pointer;6465    struct wl_touch *wl_touch;66    struct {67        uint32_t serial;68        struct {69            int id;70            double start_x, start_y;71            double current_x, current_y;72            double last_y;73            bool scrolling;74            bool is_tap;75            uint32_t start_time;76            double accumulated_scroll;77        } active_touch;78    } touch;7980    struct wl_data_device *data_device;81    struct zwp_primary_selection_device_v1 *primary_selection_device;8283    bool is_pasting;84    struct wl_clipboard clipboard;85    struct wl_primary primary;8687    struct zwp_text_input_v3 *text_input;88    struct {89        uint32_t serial;             /* incremented on each commit() */90        struct {91            char *text;              /* pending preedit UTF-8, NULL if none */92            int32_t cursor_begin;    /* byte offset within preedit */93            int32_t cursor_end;      /* byte offset within preedit */94        } preedit_pending;95        char *commit_pending;        /* pending commit UTF-8, NULL if none */96        struct {97            int x, y, w, h;          /* last sent cursor rect (surface coords) */98        } cursor_rect;99    } ime;100};101102103typedef void (*font_reloaded_t)(104    struct wayland *wayl, struct fcft_font *font, void *data);105106struct wayland *wayl_init(107    const struct config *conf, struct fdm *fdm,108    struct kb_manager *kb_manager, struct render *render,109    struct prompt *prompt, struct matches *matches,110    font_reloaded_t font_reloaded_cb, void *data);111112void wayl_destroy(struct wayland *wayl);113114void wayl_refresh(struct wayland *wayl);115void wayl_flush(struct wayland *wayl);116void wayl_ready_to_display(struct wayland *wayl);117118int wayl_exit_code(const struct wayland *wayl);119bool wayl_update_cache(const struct wayland *wayl);120121void wayl_clipboard_data(struct wayland *wayl, char *data, size_t size);122void wayl_clipboard_done(struct wayland *wayl);123124bool wayl_do_linear_blending(const struct wayland *wayl);125126void wayl_resized(struct wayland *wayl);127128bool wayl_check_auto_select(struct wayland *wayl);