yutani_int.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. #pragma once
  2. #include <toaru/yutani.h>
  3. #include <toaru/list.h>
  4. #include <toaru/hashmap.h>
  5. #include <toaru/graphics.h>
  6. #include <toaru/kbd.h>
  7. #define MOUSE_SCALE 3
  8. #define MOUSE_OFFSET_X 26
  9. #define MOUSE_OFFSET_Y 26
  10. #define YUTANI_BYTE_DEPTH 4
  11. #define YUTANI_SCREENSHOT_FULL 1
  12. #define YUTANI_SCREENSHOT_WINDOW 2
  13. typedef enum {
  14. YUTANI_EFFECT_NONE,
  15. YUTANI_EFFECT_FADE_IN,
  16. YUTANI_EFFECT_FADE_OUT,
  17. YUTANI_EFFECT_MINIMIZE,
  18. YUTANI_EFFECT_UNMINIMIZE,
  19. } yutani_effect;
  20. static int yutani_animation_lengths[] = {
  21. 0,
  22. 200,
  23. 200,
  24. 0,
  25. 0,
  26. };
  27. typedef struct {
  28. yutani_wid_t wid;
  29. signed long x;
  30. signed long y;
  31. unsigned short z;
  32. int32_t width;
  33. int32_t height;
  34. uint8_t * buffer;
  35. uint32_t bufid;
  36. uint32_t owner;
  37. int16_t rotation;
  38. uint32_t newbufid;
  39. uint8_t * newbuffer;
  40. uint32_t client_flags;
  41. uint16_t client_offsets[5];
  42. uint32_t client_length;
  43. char * client_strings;
  44. int anim_mode;
  45. uint32_t anim_start;
  46. int alpha_threshold;
  47. int show_mouse;
  48. int tiled;
  49. int32_t untiled_width;
  50. int32_t untiled_height;
  51. int default_mouse;
  52. uint32_t server_flags;
  53. int opacity;
  54. } yutani_server_window_t;
  55. typedef struct {
  56. /* XXX multiple displays */
  57. unsigned int width;
  58. unsigned int height;
  59. void * backend_framebuffer;
  60. gfx_context_t * backend_ctx;
  61. signed int mouse_x;
  62. signed int mouse_y;
  63. signed int last_mouse_x;
  64. signed int last_mouse_y;
  65. list_t * windows;
  66. hashmap_t * wids_to_windows;
  67. yutani_server_window_t * bottom_z;
  68. list_t * mid_zs;
  69. yutani_server_window_t * top_z;
  70. list_t * update_list;
  71. volatile int update_list_lock;
  72. sprite_t mouse_sprite;
  73. char * server_ident;
  74. yutani_server_window_t * focused_window;
  75. FILE * server;
  76. int mouse_state;
  77. yutani_server_window_t * mouse_window;
  78. int mouse_win_x;
  79. int mouse_win_y;
  80. int mouse_init_x;
  81. int mouse_init_y;
  82. int mouse_init_r;
  83. int mouse_drag_button;
  84. int mouse_moved;
  85. int32_t mouse_click_x;
  86. int32_t mouse_click_y;
  87. key_event_state_t kbd_state;
  88. yutani_server_window_t * resizing_window;
  89. int32_t resizing_w;
  90. int32_t resizing_h;
  91. list_t * window_subscribers;
  92. uint32_t start_time;
  93. volatile int redraw_lock;
  94. yutani_server_window_t * old_hover_window;
  95. hashmap_t * key_binds;
  96. list_t * windows_to_remove;
  97. yutani_t * host_context;
  98. yutani_window_t * host_window;
  99. hashmap_t * clients_to_windows;
  100. int debug_bounds;
  101. int debug_shapes;
  102. int screenshot_frame;
  103. uint32_t start_subtime;
  104. yutani_scale_direction_t resizing_direction;
  105. int32_t resizing_offset_x;
  106. int32_t resizing_offset_y;
  107. int resizing_button;
  108. sprite_t mouse_sprite_drag;
  109. sprite_t mouse_sprite_resize_v;
  110. sprite_t mouse_sprite_resize_h;
  111. sprite_t mouse_sprite_resize_da;
  112. sprite_t mouse_sprite_resize_db;
  113. int current_cursor;
  114. int resize_on_next;
  115. uint32_t timer_precison;
  116. list_t * timer_subscribers;
  117. uint32_t last_mouse_buttons;
  118. uint32_t stride;
  119. int32_t mouse_click_x_orig;
  120. int32_t mouse_click_y_orig;
  121. } yutani_globals_t;
  122. struct key_bind {
  123. unsigned int owner;
  124. int response;
  125. };
  126. static void mark_window(yutani_globals_t * yg, yutani_server_window_t * window);
  127. static void window_actually_close(yutani_globals_t * yg, yutani_server_window_t * w);
  128. static void notify_subscribers(yutani_globals_t * yg);