2 * Copyright © 2008 Kristian Høgsberg
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial
14 * portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 #include <wayland-client.h>
33 #include <wayland-util.h>
36 surface_flush_device(cairo_surface_t *surface);
39 render_shadow(cairo_t *cr, cairo_surface_t *surface,
40 int x, int y, int width, int height, int margin, int top_margin);
43 tile_source(cairo_t *cr, cairo_surface_t *surface,
44 int x, int y, int width, int height, int margin, int top_margin);
47 rounded_rect(cairo_t *cr, int x0, int y0, int x1, int y1, int radius);
50 load_cairo_surface(const char *filename);
53 cairo_surface_t *active_frame;
54 cairo_surface_t *inactive_frame;
55 cairo_surface_t *shadow;
65 theme_destroy(struct theme *t);
68 THEME_FRAME_ACTIVE = 1,
69 THEME_FRAME_MAXIMIZED = 2,
70 THEME_FRAME_NO_TITLE = 4
74 theme_set_background_source(struct theme *t, cairo_t *cr, uint32_t flags);
76 theme_render_frame(struct theme *t,
77 cairo_t *cr, int width, int height,
78 const char *title, cairo_rectangle_int_t *title_rect,
79 struct wl_list *buttons, uint32_t flags);
82 THEME_LOCATION_INTERIOR = 0,
83 THEME_LOCATION_RESIZING_TOP = 1,
84 THEME_LOCATION_RESIZING_BOTTOM = 2,
85 THEME_LOCATION_RESIZING_LEFT = 4,
86 THEME_LOCATION_RESIZING_TOP_LEFT = 5,
87 THEME_LOCATION_RESIZING_BOTTOM_LEFT = 6,
88 THEME_LOCATION_RESIZING_RIGHT = 8,
89 THEME_LOCATION_RESIZING_TOP_RIGHT = 9,
90 THEME_LOCATION_RESIZING_BOTTOM_RIGHT = 10,
91 THEME_LOCATION_RESIZING_MASK = 15,
92 THEME_LOCATION_EXTERIOR = 16,
93 THEME_LOCATION_TITLEBAR = 17,
94 THEME_LOCATION_CLIENT_AREA = 18,
98 theme_get_location(struct theme *t, int x, int y, int width, int height, int flags);
103 FRAME_STATUS_NONE = 0,
104 FRAME_STATUS_REPAINT = 0x1,
105 FRAME_STATUS_MINIMIZE = 0x2,
106 FRAME_STATUS_MAXIMIZE = 0x4,
107 FRAME_STATUS_CLOSE = 0x8,
108 FRAME_STATUS_MENU = 0x10,
109 FRAME_STATUS_RESIZE = 0x20,
110 FRAME_STATUS_MOVE = 0x40,
111 FRAME_STATUS_ALL = 0x7f
115 FRAME_FLAG_ACTIVE = 0x1,
116 FRAME_FLAG_MAXIMIZED = 0x2
120 FRAME_BUTTON_NONE = 0,
121 FRAME_BUTTON_CLOSE = 0x1,
122 FRAME_BUTTON_MAXIMIZE = 0x2,
123 FRAME_BUTTON_MINIMIZE = 0x4,
124 FRAME_BUTTON_ALL = 0x7
128 frame_create(struct theme *t, int32_t width, int32_t height, uint32_t buttons,
129 const char *title, cairo_surface_t *icon);
132 frame_destroy(struct frame *frame);
134 /* May set FRAME_STATUS_REPAINT */
136 frame_set_title(struct frame *frame, const char *title);
138 /* May set FRAME_STATUS_REPAINT */
140 frame_set_icon(struct frame *frame, cairo_surface_t *icon);
142 /* May set FRAME_STATUS_REPAINT */
144 frame_set_flag(struct frame *frame, enum frame_flag flag);
146 /* May set FRAME_STATUS_REPAINT */
148 frame_unset_flag(struct frame *frame, enum frame_flag flag);
150 /* May set FRAME_STATUS_REPAINT */
152 frame_resize(struct frame *frame, int32_t width, int32_t height);
154 /* May set FRAME_STATUS_REPAINT */
156 frame_resize_inside(struct frame *frame, int32_t width, int32_t height);
159 frame_width(struct frame *frame);
162 frame_height(struct frame *frame);
165 frame_interior(struct frame *frame, int32_t *x, int32_t *y,
166 int32_t *width, int32_t *height);
168 frame_input_rect(struct frame *frame, int32_t *x, int32_t *y,
169 int32_t *width, int32_t *height);
171 frame_opaque_rect(struct frame *frame, int32_t *x, int32_t *y,
172 int32_t *width, int32_t *height);
175 frame_get_shadow_margin(struct frame *frame);
178 frame_status(struct frame *frame);
181 frame_status_clear(struct frame *frame, enum frame_status status);
183 /* May set FRAME_STATUS_REPAINT */
185 frame_pointer_enter(struct frame *frame, void *pointer, int x, int y);
187 /* May set FRAME_STATUS_REPAINT */
189 frame_pointer_motion(struct frame *frame, void *pointer, int x, int y);
191 /* May set FRAME_STATUS_REPAINT */
193 frame_pointer_leave(struct frame *frame, void *pointer);
195 /* Call to indicate that a button has been pressed/released. The return
196 * value for a button release will be the same as for the corresponding
197 * press. This allows you to more easily track grabs. If you want the
198 * actual location, simply keep the location from the last
199 * frame_pointer_motion call.
202 * FRAME_STATUS_MINIMIZE
203 * FRAME_STATUS_MAXIMIZE
206 * FRAME_STATUS_RESIZE
210 frame_pointer_button(struct frame *frame, void *pointer,
211 uint32_t button, enum wl_pointer_button_state state);
214 frame_touch_down(struct frame *frame, void *data, int32_t id, int x, int y);
217 frame_touch_up(struct frame *frame, void *data, int32_t id);
220 frame_double_click(struct frame *frame, void *pointer,
221 uint32_t button, enum wl_pointer_button_state state);
224 frame_double_touch_down(struct frame *frame, void *data, int32_t id,
228 frame_double_touch_up(struct frame *frame, void *data, int32_t id);
231 frame_repaint(struct frame *frame, cairo_t *cr);