2 * Copyright © 2008 Kristian Høgsberg
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
29 #include <wayland-util.h>
32 surface_flush_device(cairo_surface_t *surface);
35 tile_mask(cairo_t *cr, cairo_surface_t *surface,
36 int x, int y, int width, int height, int margin, int top_margin);
39 tile_source(cairo_t *cr, cairo_surface_t *surface,
40 int x, int y, int width, int height, int margin, int top_margin);
43 rounded_rect(cairo_t *cr, int x0, int y0, int x1, int y1, int radius);
46 load_cairo_surface(const char *filename);
49 cairo_surface_t *active_frame;
50 cairo_surface_t *inactive_frame;
51 cairo_surface_t *shadow;
61 theme_destroy(struct theme *t);
64 THEME_FRAME_ACTIVE = 1,
65 THEME_FRAME_MAXIMIZED = 2,
66 THEME_FRAME_NO_TITLE = 4
70 theme_set_background_source(struct theme *t, cairo_t *cr, uint32_t flags);
72 theme_render_frame(struct theme *t,
73 cairo_t *cr, int width, int height,
74 const char *title, struct wl_list *buttons,
78 THEME_LOCATION_INTERIOR = 0,
79 THEME_LOCATION_RESIZING_TOP = 1,
80 THEME_LOCATION_RESIZING_BOTTOM = 2,
81 THEME_LOCATION_RESIZING_LEFT = 4,
82 THEME_LOCATION_RESIZING_TOP_LEFT = 5,
83 THEME_LOCATION_RESIZING_BOTTOM_LEFT = 6,
84 THEME_LOCATION_RESIZING_RIGHT = 8,
85 THEME_LOCATION_RESIZING_TOP_RIGHT = 9,
86 THEME_LOCATION_RESIZING_BOTTOM_RIGHT = 10,
87 THEME_LOCATION_RESIZING_MASK = 15,
88 THEME_LOCATION_EXTERIOR = 16,
89 THEME_LOCATION_TITLEBAR = 17,
90 THEME_LOCATION_CLIENT_AREA = 18,
94 theme_get_location(struct theme *t, int x, int y, int width, int height, int flags);
99 FRAME_STATUS_NONE = 0,
100 FRAME_STATUS_REPAINT = 0x1,
101 FRAME_STATUS_MINIMIZE = 0x2,
102 FRAME_STATUS_MAXIMIZE = 0x4,
103 FRAME_STATUS_CLOSE = 0x8,
104 FRAME_STATUS_MENU = 0x10,
105 FRAME_STATUS_RESIZE = 0x20,
106 FRAME_STATUS_MOVE = 0x40,
107 FRAME_STATUS_ALL = 0x7f
111 FRAME_FLAG_ACTIVE = 0x1,
112 FRAME_FLAG_MAXIMIZED = 0x2
116 FRAME_BUTTON_NONE = 0,
117 FRAME_BUTTON_CLOSE = 0x1,
118 FRAME_BUTTON_MAXIMIZE = 0x2,
119 FRAME_BUTTON_MINIMIZE = 0x4,
120 FRAME_BUTTON_ALL = 0x7
123 enum frame_button_state {
124 FRAME_BUTTON_RELEASED = 0,
125 FRAME_BUTTON_PRESSED = 1
129 frame_create(struct theme *t, int32_t width, int32_t height, uint32_t buttons,
133 frame_destroy(struct frame *frame);
135 /* May set FRAME_STATUS_REPAINT */
137 frame_set_title(struct frame *frame, const char *title);
139 /* May set FRAME_STATUS_REPAINT */
141 frame_set_flag(struct frame *frame, enum frame_flag flag);
143 /* May set FRAME_STATUS_REPAINT */
145 frame_unset_flag(struct frame *frame, enum frame_flag flag);
147 /* May set FRAME_STATUS_REPAINT */
149 frame_resize(struct frame *frame, int32_t width, int32_t height);
151 /* May set FRAME_STATUS_REPAINT */
153 frame_resize_inside(struct frame *frame, int32_t width, int32_t height);
156 frame_width(struct frame *frame);
159 frame_height(struct frame *frame);
162 frame_interior(struct frame *frame, int32_t *x, int32_t *y,
163 int32_t *width, int32_t *height);
165 frame_input_rect(struct frame *frame, int32_t *x, int32_t *y,
166 int32_t *width, int32_t *height);
168 frame_opaque_rect(struct frame *frame, int32_t *x, int32_t *y,
169 int32_t *width, int32_t *height);
172 frame_get_shadow_margin(struct frame *frame);
175 frame_status(struct frame *frame);
178 frame_status_clear(struct frame *frame, enum frame_status status);
180 /* May set FRAME_STATUS_REPAINT */
182 frame_pointer_enter(struct frame *frame, void *pointer, int x, int y);
184 /* May set FRAME_STATUS_REPAINT */
186 frame_pointer_motion(struct frame *frame, void *pointer, int x, int y);
188 /* May set FRAME_STATUS_REPAINT */
190 frame_pointer_leave(struct frame *frame, void *pointer);
192 /* Call to indicate that a button has been pressed/released. The return
193 * value for a button release will be the same as for the corresponding
194 * press. This allows you to more easily track grabs. If you want the
195 * actual location, simply keep the location from the last
196 * frame_pointer_motion call.
199 * FRAME_STATUS_MINIMIZE
200 * FRAME_STATUS_MAXIMIZE
203 * FRAME_STATUS_RESIZE
207 frame_pointer_button(struct frame *frame, void *pointer,
208 uint32_t button, enum frame_button_state state);
211 frame_touch_down(struct frame *frame, void *data, int32_t id, int x, int y);
214 frame_touch_up(struct frame *frame, void *data, int32_t id);
217 frame_double_click(struct frame *frame, void *pointer,
218 uint32_t button, enum frame_button_state state);
221 frame_repaint(struct frame *frame, cairo_t *cr);