aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c')
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c658
1 files changed, 0 insertions, 658 deletions
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c
deleted file mode 100644
index 71718cf..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c
+++ /dev/null
@@ -1,658 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <stdlib.h>
6
7#include "Ecore.h"
8#include "ecore_x_private.h"
9#include "Ecore_X.h"
10
11/**
12 * @defgroup Ecore_X_Window_Shape X Window Shape Functions
13 *
14 * These functions use the shape extension of the X server to change
15 * shape of given windows.
16 */
17
18/**
19 * Sets the shape of the given window to that given by the pixmap @p mask.
20 * @param win The given window.
21 * @param mask A 2-bit depth pixmap that provides the new shape of the
22 * window.
23 * @ingroup Ecore_X_Window_Shape
24 */
25EAPI void
26ecore_x_window_shape_mask_set(Ecore_X_Window win,
27 Ecore_X_Pixmap mask)
28{
29 LOGFN(__FILE__, __LINE__, __FUNCTION__);
30 XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet);
31}
32
33/**
34 * Sets the input shape of the given window to that given by the pixmap @p mask.
35 * @param win The given window.
36 * @param mask A 1-bit depth pixmap that provides the new input shape of the
37 * window.
38 * @ingroup Ecore_X_Window_Shape
39 */
40EAPI void
41ecore_x_window_shape_input_mask_set(Ecore_X_Window win,
42 Ecore_X_Pixmap mask)
43{
44 LOGFN(__FILE__, __LINE__, __FUNCTION__);
45#ifdef ShapeInput
46 XShapeCombineMask(_ecore_x_disp, win, ShapeInput, 0, 0, mask, ShapeSet);
47#else /* ifdef ShapeInput */
48 return;
49 win = mask = 0;
50#endif /* ifdef ShapeInput */
51}
52
53EAPI void
54ecore_x_window_shape_window_set(Ecore_X_Window win,
55 Ecore_X_Window shape_win)
56{
57 LOGFN(__FILE__, __LINE__, __FUNCTION__);
58 XShapeCombineShape(_ecore_x_disp,
59 win,
60 ShapeBounding,
61 0,
62 0,
63 shape_win,
64 ShapeBounding,
65 ShapeSet);
66}
67
68EAPI void
69ecore_x_window_shape_input_window_set(Ecore_X_Window win,
70 Ecore_X_Window shape_win)
71{
72#ifdef ShapeInput
73 LOGFN(__FILE__, __LINE__, __FUNCTION__);
74 XShapeCombineShape(_ecore_x_disp,
75 win,
76 ShapeInput,
77 0,
78 0,
79 shape_win,
80 ShapeInput,
81 ShapeSet);
82#else
83 return;
84 win = shape_win = 0;
85#endif
86}
87
88EAPI void
89ecore_x_window_shape_window_set_xy(Ecore_X_Window win,
90 Ecore_X_Window shape_win,
91 int x,
92 int y)
93{
94 LOGFN(__FILE__, __LINE__, __FUNCTION__);
95 XShapeCombineShape(_ecore_x_disp,
96 win,
97 ShapeBounding,
98 x,
99 y,
100 shape_win,
101 ShapeBounding,
102 ShapeSet);
103}
104
105EAPI void
106ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win,
107 Ecore_X_Window shape_win,
108 int x,
109 int y)
110{
111#ifdef ShapeInput
112 LOGFN(__FILE__, __LINE__, __FUNCTION__);
113 XShapeCombineShape(_ecore_x_disp,
114 win,
115 ShapeInput,
116 x,
117 y,
118 shape_win,
119 ShapeInput,
120 ShapeSet);
121#else
122 return;
123 win = shape_win = x = y = 0;
124#endif
125}
126
127EAPI void
128ecore_x_window_shape_rectangle_set(Ecore_X_Window win,
129 int x,
130 int y,
131 int w,
132 int h)
133{
134 XRectangle rect;
135
136 LOGFN(__FILE__, __LINE__, __FUNCTION__);
137 rect.x = x;
138 rect.y = y;
139 rect.width = w;
140 rect.height = h;
141 XShapeCombineRectangles(_ecore_x_disp,
142 win,
143 ShapeBounding,
144 0,
145 0,
146 &rect,
147 1,
148 ShapeSet,
149 Unsorted);
150}
151
152EAPI void
153ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win,
154 int x,
155 int y,
156 int w,
157 int h)
158{
159#ifdef ShapeInput
160 XRectangle rect;
161
162 LOGFN(__FILE__, __LINE__, __FUNCTION__);
163 rect.x = x;
164 rect.y = y;
165 rect.width = w;
166 rect.height = h;
167 XShapeCombineRectangles(_ecore_x_disp,
168 win,
169 ShapeInput,
170 0,
171 0,
172 &rect,
173 1,
174 ShapeSet,
175 Unsorted);
176#else
177 return;
178 win = x = y = w = h = 0;
179#endif
180}
181
182EAPI void
183ecore_x_window_shape_rectangles_set(Ecore_X_Window win,
184 Ecore_X_Rectangle *rects,
185 int num)
186{
187#ifdef ShapeInput
188 XRectangle *rect = NULL;
189 int i;
190
191 LOGFN(__FILE__, __LINE__, __FUNCTION__);
192 if (!rects) return;
193 if (num > 0)
194 {
195 rect = malloc(sizeof(XRectangle) * num);
196 if (!rect) return;
197 for (i = 0; i < num; i++)
198 {
199 rect[i].x = rects[i].x;
200 rect[i].y = rects[i].y;
201 rect[i].width = rects[i].width;
202 rect[i].height = rects[i].height;
203 }
204 }
205 XShapeCombineRectangles(_ecore_x_disp,
206 win,
207 ShapeBounding,
208 0,
209 0,
210 rect,
211 num,
212 ShapeSet,
213 Unsorted);
214 if (rect) free(rect);
215#else
216 return;
217 win = rects = num = 0;
218#endif
219}
220
221EAPI void
222ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win,
223 Ecore_X_Rectangle *rects,
224 int num)
225{
226#ifdef ShapeInput
227 XRectangle *rect = NULL;
228 int i;
229
230 LOGFN(__FILE__, __LINE__, __FUNCTION__);
231 if (!rects) return;
232 if (num > 0)
233 {
234 rect = malloc(sizeof(XRectangle) * num);
235 if (!rect) return;
236 for (i = 0; i < num; i++)
237 {
238 rect[i].x = rects[i].x;
239 rect[i].y = rects[i].y;
240 rect[i].width = rects[i].width;
241 rect[i].height = rects[i].height;
242 }
243 }
244 XShapeCombineRectangles(_ecore_x_disp,
245 win,
246 ShapeInput,
247 0,
248 0,
249 rect,
250 num,
251 ShapeSet,
252 Unsorted);
253 if (rect) free(rect);
254#else
255 return;
256 win = rects = num = 0;
257#endif
258}
259
260EAPI void
261ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win,
262 int x,
263 int y,
264 int w,
265 int h)
266{
267 XRectangle rect;
268
269 LOGFN(__FILE__, __LINE__, __FUNCTION__);
270 rect.x = x;
271 rect.y = y;
272 rect.width = w;
273 rect.height = h;
274 XShapeCombineRectangles(_ecore_x_disp,
275 win,
276 ShapeBounding,
277 0,
278 0,
279 &rect,
280 1,
281 ShapeSubtract,
282 Unsorted);
283}
284
285EAPI void
286ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win,
287 int x,
288 int y,
289 int w,
290 int h)
291{
292#ifdef ShapeInput
293 XRectangle rect;
294
295 LOGFN(__FILE__, __LINE__, __FUNCTION__);
296 rect.x = x;
297 rect.y = y;
298 rect.width = w;
299 rect.height = h;
300 XShapeCombineRectangles(_ecore_x_disp,
301 win,
302 ShapeInput,
303 0,
304 0,
305 &rect,
306 1,
307 ShapeSubtract,
308 Unsorted);
309#else
310 return;
311 win = x = y = w = h = 0;
312#endif
313}
314
315EAPI void
316ecore_x_window_shape_window_add(Ecore_X_Window win,
317 Ecore_X_Window shape_win)
318{
319 LOGFN(__FILE__, __LINE__, __FUNCTION__);
320 XShapeCombineShape(_ecore_x_disp,
321 win,
322 ShapeBounding,
323 0,
324 0,
325 shape_win,
326 ShapeBounding,
327 ShapeUnion);
328}
329
330EAPI void
331ecore_x_window_shape_window_add_xy(Ecore_X_Window win,
332 Ecore_X_Window shape_win,
333 int x,
334 int y)
335{
336 LOGFN(__FILE__, __LINE__, __FUNCTION__);
337 XShapeCombineShape(_ecore_x_disp,
338 win,
339 ShapeBounding,
340 x,
341 y,
342 shape_win,
343 ShapeBounding,
344 ShapeUnion);
345}
346
347EAPI void
348ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win,
349 Ecore_X_Window shape_win,
350 int x,
351 int y)
352{
353#ifdef ShapeInput
354 LOGFN(__FILE__, __LINE__, __FUNCTION__);
355 XShapeCombineShape(_ecore_x_disp,
356 win,
357 ShapeInput,
358 x,
359 y,
360 shape_win,
361 ShapeInput,
362 ShapeUnion);
363#else
364 return;
365 win = shape_win = x = y = 0;
366#endif
367}
368
369EAPI void
370ecore_x_window_shape_rectangle_add(Ecore_X_Window win,
371 int x,
372 int y,
373 int w,
374 int h)
375{
376 XRectangle rect;
377
378 LOGFN(__FILE__, __LINE__, __FUNCTION__);
379 rect.x = x;
380 rect.y = y;
381 rect.width = w;
382 rect.height = h;
383 XShapeCombineRectangles(_ecore_x_disp,
384 win,
385 ShapeBounding,
386 0,
387 0,
388 &rect,
389 1,
390 ShapeUnion,
391 Unsorted);
392}
393
394EAPI void
395ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win,
396 int x,
397 int y,
398 int w,
399 int h)
400{
401#ifdef ShapeInput
402 XRectangle rect;
403
404 LOGFN(__FILE__, __LINE__, __FUNCTION__);
405 rect.x = x;
406 rect.y = y;
407 rect.width = w;
408 rect.height = h;
409 XShapeCombineRectangles(_ecore_x_disp,
410 win,
411 ShapeInput,
412 0,
413 0,
414 &rect,
415 1,
416 ShapeUnion,
417 Unsorted);
418#else
419 return;
420 win = x = y = w = h = 0;
421#endif
422}
423
424EAPI void
425ecore_x_window_shape_rectangle_clip(Ecore_X_Window win,
426 int x,
427 int y,
428 int w,
429 int h)
430{
431 XRectangle rect;
432
433 LOGFN(__FILE__, __LINE__, __FUNCTION__);
434 rect.x = x;
435 rect.y = y;
436 rect.width = w;
437 rect.height = h;
438 XShapeCombineRectangles(_ecore_x_disp,
439 win,
440 ShapeBounding,
441 0,
442 0,
443 &rect,
444 1,
445 ShapeIntersect,
446 Unsorted);
447}
448
449EAPI void
450ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win,
451 int x,
452 int y,
453 int w,
454 int h)
455{
456#ifdef ShapeInput
457 XRectangle rect;
458
459 LOGFN(__FILE__, __LINE__, __FUNCTION__);
460 rect.x = x;
461 rect.y = y;
462 rect.width = w;
463 rect.height = h;
464 XShapeCombineRectangles(_ecore_x_disp,
465 win,
466 ShapeInput,
467 0,
468 0,
469 &rect,
470 1,
471 ShapeIntersect,
472 Unsorted);
473#else
474 return;
475 win = x = y = w = h = 0;
476#endif
477}
478
479EAPI void
480ecore_x_window_shape_rectangles_add(Ecore_X_Window win,
481 Ecore_X_Rectangle *rects,
482 int num)
483{
484 XRectangle *rect = NULL;
485 int i;
486
487 LOGFN(__FILE__, __LINE__, __FUNCTION__);
488 if (num > 0)
489 {
490 rect = malloc(sizeof(XRectangle) * num);
491 if (!rect) return;
492 for (i = 0; i < num; i++)
493 {
494 rect[i].x = rects[i].x;
495 rect[i].y = rects[i].y;
496 rect[i].width = rects[i].width;
497 rect[i].height = rects[i].height;
498 }
499 }
500
501 XShapeCombineRectangles(_ecore_x_disp,
502 win,
503 ShapeBounding,
504 0,
505 0,
506 rect,
507 num,
508 ShapeUnion,
509 Unsorted);
510 if (rect) free(rect);
511}
512
513EAPI void
514ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win,
515 Ecore_X_Rectangle *rects,
516 int num)
517{
518#ifdef ShapeInput
519 XRectangle *rect = NULL;
520 int i;
521
522 LOGFN(__FILE__, __LINE__, __FUNCTION__);
523 if (num > 0)
524 {
525 rect = malloc(sizeof(XRectangle) * num);
526 if (!rect) return;
527 for (i = 0; i < num; i++)
528 {
529 rect[i].x = rects[i].x;
530 rect[i].y = rects[i].y;
531 rect[i].width = rects[i].width;
532 rect[i].height = rects[i].height;
533 }
534 }
535
536 XShapeCombineRectangles(_ecore_x_disp,
537 win,
538 ShapeInput,
539 0,
540 0,
541 rect,
542 num,
543 ShapeUnion,
544 Unsorted);
545 if (rect) free(rect);
546#else
547 return;
548 win = rects = num = 0;
549#endif
550}
551
552EAPI Ecore_X_Rectangle *
553ecore_x_window_shape_rectangles_get(Ecore_X_Window win,
554 int *num_ret)
555{
556 XRectangle *rect;
557 Ecore_X_Rectangle *rects = NULL;
558 int i, num = 0, ord;
559
560 LOGFN(__FILE__, __LINE__, __FUNCTION__);
561 rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeBounding, &num, &ord);
562 if (rect)
563 {
564 if (num < 1)
565 {
566 XFree(rect);
567 if (num_ret) *num_ret = 0;
568 return NULL;
569 }
570 rects = malloc(sizeof(Ecore_X_Rectangle) * num);
571 if (!rects)
572 {
573 XFree(rect);
574 if (num_ret) *num_ret = 0;
575 return NULL;
576 }
577 for (i = 0; i < num; i++)
578 {
579 rects[i].x = rect[i].x;
580 rects[i].y = rect[i].y;
581 rects[i].width = rect[i].width;
582 rects[i].height = rect[i].height;
583 }
584 XFree(rect);
585 }
586 if (num_ret) *num_ret = num;
587 return rects;
588}
589
590EAPI Ecore_X_Rectangle *
591ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win,
592 int *num_ret)
593{
594 Ecore_X_Rectangle *rects = NULL;
595#ifdef ShapeInput
596 XRectangle *rect;
597 int i, num = 0, ord;
598
599 LOGFN(__FILE__, __LINE__, __FUNCTION__);
600 rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeInput, &num, &ord);
601 if (rect)
602 {
603 if (num < 1)
604 {
605 XFree(rect);
606 if (num_ret) *num_ret = 0;
607 return NULL;
608 }
609 rects = malloc(sizeof(Ecore_X_Rectangle) * num);
610 if (!rects)
611 {
612 XFree(rect);
613 if (num_ret) *num_ret = 0;
614 return NULL;
615 }
616 for (i = 0; i < num; i++)
617 {
618 rects[i].x = rect[i].x;
619 rects[i].y = rect[i].y;
620 rects[i].width = rect[i].width;
621 rects[i].height = rect[i].height;
622 }
623 XFree(rect);
624 }
625 if (num_ret) *num_ret = num;
626 return rects;
627#else
628 // have to return fake shape input rect of size of window
629 Window dw;
630 unsigned int di;
631
632 if (num_ret) *num_ret = 0;
633 rects = malloc(sizeof(Ecore_X_Rectangle));
634 if (!rects) return NULL;
635 if (!XGetGeometry(_ecore_x_disp, win, &dw,
636 &(rects[0].x), &(rects[0].y),
637 &(rects[0].width), &(rects[0].height),
638 &di, &di))
639 {
640 free(rects);
641 return NULL;
642 }
643 if (num_ret) *num_ret = 1;
644 return rects;
645#endif
646}
647
648EAPI void
649ecore_x_window_shape_events_select(Ecore_X_Window win,
650 Eina_Bool on)
651{
652 LOGFN(__FILE__, __LINE__, __FUNCTION__);
653 if (on)
654 XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
655 else
656 XShapeSelectInput(_ecore_x_disp, win, 0);
657}
658