You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

82 lines
3.0 KiB

  1. #pragma once
  2. #include <stdbool.h>
  3. #include <wayland-client.h>
  4. #include "terminal.h"
  5. extern const struct wl_data_device_listener data_device_listener;
  6. extern const struct zwp_primary_selection_device_v1_listener primary_selection_device_listener;
  7. bool selection_enabled(const struct terminal *term, struct seat *seat);
  8. void selection_start(
  9. struct terminal *term, int col, int row, enum selection_kind kind);
  10. void selection_update(struct terminal *term, int col, int row);
  11. void selection_finalize(
  12. struct seat *seat, struct terminal *term, uint32_t serial);
  13. void selection_dirty_cells(struct terminal *term);
  14. void selection_cancel(struct terminal *term);
  15. void selection_extend( struct seat *seat, struct terminal *term,
  16. int col, int row, uint32_t serial);
  17. bool selection_on_rows(const struct terminal *term, int start, int end);
  18. void selection_view_up(struct terminal *term, int new_view);
  19. void selection_view_down(struct terminal *term, int new_view);
  20. void selection_mark_word(
  21. struct seat *seat, struct terminal *term, int col, int row,
  22. bool spaces_only, uint32_t serial);
  23. void selection_mark_row(
  24. struct seat *seat, struct terminal *term, int row, uint32_t serial);
  25. void selection_clipboard_unset(struct seat *seat);
  26. void selection_primary_unset(struct seat *seat);
  27. bool selection_clipboard_has_data(const struct seat *seat);
  28. bool selection_primary_has_data(const struct seat *seat);
  29. char *selection_to_text(const struct terminal *term);
  30. void selection_to_clipboard(
  31. struct seat *seat, struct terminal *term, uint32_t serial);
  32. void selection_from_clipboard(
  33. struct seat *seat, struct terminal *term, uint32_t serial);
  34. void selection_to_primary(
  35. struct seat *seat, struct terminal *term, uint32_t serial);
  36. void selection_from_primary(struct seat *seat, struct terminal *term);
  37. /* Copy text *to* primary/clipboard */
  38. bool text_to_clipboard(
  39. struct seat *seat, struct terminal *term, char *text, uint32_t serial);
  40. bool text_to_primary(
  41. struct seat *seat, struct terminal *term, char *text, uint32_t serial);
  42. /*
  43. * Copy text *from* primary/clipboard
  44. *
  45. * Note that these are asynchronous; they *will* return
  46. * immediately. The 'cb' callback will be called 0..n times with
  47. * clipboard data. When done (or on error), the 'done' callback is
  48. * called.
  49. *
  50. * As such, keep this in mind:
  51. * - The 'user' context must not be stack allocated
  52. * - Don't expect clipboard data to have been received when these
  53. * functions return (it will *never* have been received at this
  54. * point).
  55. */
  56. void text_from_clipboard(
  57. struct seat *seat, struct terminal *term,
  58. void (*cb)(const char *data, size_t size, void *user),
  59. void (*done)(void *user), void *user);
  60. void text_from_primary(
  61. struct seat *seat, struct terminal *term,
  62. void (*cb)(const char *data, size_t size, void *user),
  63. void (*dont)(void *user), void *user);
  64. void selection_start_scroll_timer(
  65. struct terminal *term, int interval_ns,
  66. enum selection_scroll_direction direction, int col);
  67. void selection_stop_scroll_timer(struct terminal *term);