keyrouter: Fix wrong validity check
[platform/core/uifw/libds-tizen.git] / src / libds / surface / surface-private.h
1 #ifndef DS_SURFACE_PRIVATE_H
2 #define DS_SURFACE_PRIVATE_H
3
4 #include <stdint.h>
5
6 #include <pixman.h>
7 #include <wayland-server.h>
8
9 #include "addon.h"
10 #include "buffer.h"
11 #include "surface.h"
12
13 enum ds_surface_state_field
14 {
15     DS_SURFACE_STATE_BUFFER = 1 << 0,
16     DS_SURFACE_STATE_SURFACE_DAMAGE = 1 << 1,
17     DS_SURFACE_STATE_BUFFER_DAMAGE = 1 << 2,
18     DS_SURFACE_STATE_OPAQUE_REGION = 1 << 3,
19     DS_SURFACE_STATE_INPUT_REGION = 1 << 4,
20     DS_SURFACE_STATE_TRANSFORM = 1 << 5,
21     DS_SURFACE_STATE_SCALE = 1 << 6,
22     DS_SURFACE_STATE_FRAME_CALLBACK_LIST = 1 << 7,
23     DS_SURFACE_STATE_VIEWPORT = 1 << 8,
24 };
25
26 struct ds_surface_state
27 {
28     enum ds_surface_state_field committed;
29
30     struct ds_buffer *buffer;
31     int32_t dx, dy;
32     pixman_region32_t surface_damage, buffer_damage;
33     pixman_region32_t opaque, input;
34     enum wl_output_transform transform;
35     int32_t scale;
36     struct wl_list frame_callback_list;
37
38     int width, height;
39     int buffer_width, buffer_height;
40
41     struct wl_list subsurfaces_below;
42     struct wl_list subsurfaces_above;
43
44     // TODO viewport
45 };
46
47 struct ds_surface
48 {
49     struct wl_resource *resource;
50
51     struct ds_buffer *buffer;
52
53     pixman_region32_t buffer_damage;
54     pixman_region32_t opaque_region;
55     pixman_region32_t input_region;
56
57     struct ds_surface_state current, pending;
58
59     const struct ds_surface_role *role;
60     void *role_data;
61
62     int sx, sy;
63
64     struct {
65         struct wl_signal commit;
66         struct wl_signal new_subsurface;
67         struct wl_signal destroy;
68     } events;
69
70     struct ds_addon_set addons;
71 };
72
73 struct ds_subsurface_parent_state
74 {
75     int32_t x, y;
76     struct wl_list link;
77 };
78
79 struct ds_subsurface
80 {
81     struct wl_resource *resource;
82     struct ds_surface *surface;
83     struct ds_surface *parent;
84
85     struct ds_subsurface_parent_state current, pending;
86
87     struct {
88         struct wl_signal destroy;
89     } events;
90
91     struct {
92         struct wl_listener surface_destroy;
93         struct wl_listener parent_destroy;
94     } listener;
95
96     bool synchronized;
97     bool reordered;
98     bool mapped;
99 };
100
101 struct ds_surface *
102 ds_surface_get_root_surface(struct ds_surface *surface);
103
104 struct ds_subsurface *
105 ds_subsurface_from_ds_surface(struct ds_surface *surface);
106
107 struct ds_surface *
108 ds_subsurface_get_parent(struct ds_subsurface *subsurface);
109
110 #endif