28 |
#include "thost.h" |
#include "thost.h" |
29 |
#include "surface.h" |
#include "surface.h" |
30 |
#include "layer.h" |
#include "layer.h" |
31 |
|
#include "input-mouse.h" |
32 |
|
|
33 |
struct port_class *portclass_surface; |
struct port_class *portclass_surface; |
34 |
|
|
161 |
} |
} |
162 |
|
|
163 |
error_t |
error_t |
164 |
|
crust_S_surface_unmap (struct responder *rsurface) |
165 |
|
{ |
166 |
|
struct surface *surface; |
167 |
|
bool was_visible; |
168 |
|
|
169 |
|
if (! rsurface) |
170 |
|
return EOPNOTSUPP; |
171 |
|
surface = RESPONDER_OBJECT (rsurface); |
172 |
|
|
173 |
|
if (! surface->layer) |
174 |
|
{ |
175 |
|
printf ("surface map: no layer\n"); |
176 |
|
return EINVAL; |
177 |
|
} |
178 |
|
|
179 |
|
was_visible = surface->map_count == 0; |
180 |
|
surface->map_count++; |
181 |
|
|
182 |
|
if (was_visible) |
183 |
|
flush_surface (surface->layer, surface); |
184 |
|
return 0; |
185 |
|
} |
186 |
|
|
187 |
|
error_t |
188 |
|
crust_S_surface_update (struct responder *rsurface, int x, int y, int width, |
189 |
|
int height) |
190 |
|
{ |
191 |
|
struct surface *surface; |
192 |
|
|
193 |
|
if (! rsurface) |
194 |
|
return EOPNOTSUPP; |
195 |
|
surface = RESPONDER_OBJECT (rsurface); |
196 |
|
|
197 |
|
if (! surface->layer) |
198 |
|
{ |
199 |
|
printf ("surface map: no layer\n"); |
200 |
|
return EINVAL; |
201 |
|
} |
202 |
|
|
203 |
|
if (surface->layer->map_count == 0 && surface->map_count == 0) |
204 |
|
update_surface (surface->layer, surface, x, y, width, height); |
205 |
|
return 0; |
206 |
|
} |
207 |
|
|
208 |
|
error_t |
209 |
crust_S_surface_set_opaque (struct responder *rsurface, double opaque) |
crust_S_surface_set_opaque (struct responder *rsurface, double opaque) |
210 |
{ |
{ |
211 |
struct surface *surface; |
struct surface *surface; |
248 |
responder_set_event_info (rsurface, port, mask); |
responder_set_event_info (rsurface, port, mask); |
249 |
return 0; |
return 0; |
250 |
} |
} |
251 |
|
|
252 |
|
error_t |
253 |
|
crust_S_surface_cursor_grab (struct responder *rsurface) |
254 |
|
{ |
255 |
|
struct surface *surface; |
256 |
|
|
257 |
|
if (! rsurface) |
258 |
|
return EOPNOTSUPP; |
259 |
|
surface = RESPONDER_OBJECT (rsurface); |
260 |
|
|
261 |
|
if (surface_event_cursor) |
262 |
|
return EINVAL; |
263 |
|
surface_event_cursor = surface; |
264 |
|
return 0; |
265 |
|
} |
266 |
|
|
267 |
|
error_t |
268 |
|
crust_S_surface_cursor_ungrab (struct responder *rsurface) |
269 |
|
{ |
270 |
|
struct surface *surface; |
271 |
|
|
272 |
|
if (! rsurface) |
273 |
|
return EOPNOTSUPP; |
274 |
|
surface = RESPONDER_OBJECT (rsurface); |
275 |
|
|
276 |
|
if (surface != surface_event_cursor) |
277 |
|
printf ("Someone tries to ungrab with invalid surface\n"); |
278 |
|
surface_event_cursor = 0; |
279 |
|
return 0; |
280 |
|
} |