aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Shape.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/Shape.hh')
-rw-r--r--src/FbTk/Shape.hh87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/FbTk/Shape.hh b/src/FbTk/Shape.hh
new file mode 100644
index 0000000..be49652
--- /dev/null
+++ b/src/FbTk/Shape.hh
@@ -0,0 +1,87 @@
1// Shape.hh
2// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22#ifndef SHAPE_HH
23#define SHAPE_HH
24
25#include "FbPixmap.hh"
26
27#include <X11/Xlib.h>
28#include <memory>
29#include <vector>
30
31namespace FbTk {
32class FbWindow;
33
34/// creates round corners on windows
35class Shape {
36public:
37 enum ShapePlace {
38 NONE = 0,
39 BOTTOMRIGHT = 0x01,
40 TOPRIGHT = 0x02,
41 BOTTOMLEFT = 0x04,
42 TOPLEFT = 0x08
43 };
44
45 Shape(FbWindow &win, int shapeplaces);
46 ~Shape();
47 /// set new shape places
48 void setPlaces(int shapeplaces);
49 /// update our shape
50 void update();
51 /// assign a new window
52 void setWindow(FbWindow &win);
53 /// Assign a window to merge our shape with.
54 /// (note that this is currently specific to frames)
55 void setShapeSource(FbWindow *win, int xoff, int yoff, bool always_update);
56 void setShapeOffsets(int xoff, int yoff);
57 unsigned int width() const;
58 unsigned int height() const;
59 unsigned int clipWidth() const;
60 unsigned int clipHeight() const;
61 // sets shape notify mask
62 static void setShapeNotify(const FbWindow &win);
63 /// @return true if window has shape
64 static bool isShaped(const FbWindow &win);
65private:
66 FbWindow *m_win; ///< window to be shaped
67 FbWindow *m_shapesource; ///< window to pull shape from
68 int m_shapesource_xoff, m_shapesource_yoff;
69
70 void initCorners(int screen_num);
71
72 struct CornerPixmaps {
73 FbPixmap topleft;
74 FbPixmap topright;
75 FbPixmap botleft;
76 FbPixmap botright;
77 };
78
79 // unfortunately, we need a separate pixmap per screen
80 static std::vector<CornerPixmaps> s_corners;
81 int m_shapeplaces; ///< places to shape
82
83};
84
85}; // end namespace FbTk
86
87#endif // SHAPE_HH