aboutsummaryrefslogtreecommitdiff
path: root/src/Shape.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-10-06 06:22:43 (GMT)
committerrathnor <rathnor>2003-10-06 06:22:43 (GMT)
commitdda34421a3d586e6efd70a4a672266267dda7474 (patch)
treead2dcb5335a03081542a91a6c8617cf89586304a /src/Shape.cc
parent9a155ea7b5cf1b76aa7b9864aa3c1a7342f1f67c (diff)
downloadfluxbox-dda34421a3d586e6efd70a4a672266267dda7474.zip
fluxbox-dda34421a3d586e6efd70a4a672266267dda7474.tar.bz2
fix shape - all menus shaped, and some weird shape bugs
Diffstat (limited to 'src/Shape.cc')
-rw-r--r--src/Shape.cc20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/Shape.cc b/src/Shape.cc
index 1f531e0..b4ac635 100644
--- a/src/Shape.cc
+++ b/src/Shape.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Shape.cc,v 1.6 2003/09/17 14:16:53 fluxgen Exp $ 22// $Id: Shape.cc,v 1.7 2003/10/06 06:22:42 rathnor Exp $
23 23
24#include "Shape.hh" 24#include "Shape.hh"
25#include "FbTk/FbWindow.hh" 25#include "FbTk/FbWindow.hh"
@@ -49,8 +49,9 @@ Pixmap createShape(FbTk::FbWindow &win, int place) {
49 static char bottom_left_bits[] = { 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfc, 0xf8, 0xc0 }; 49 static char bottom_left_bits[] = { 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfc, 0xf8, 0xc0 };
50 static char bottom_right_bits[] = { 0xff, 0xff, 0x7f, 0x7f, 0x7f, 0x3f, 0x1f, 0x03 }; 50 static char bottom_right_bits[] = { 0xff, 0xff, 0x7f, 0x7f, 0x7f, 0x3f, 0x1f, 0x03 };
51 51
52 const int win_width = win.width() + 2*win.borderWidth() + 1; 52 const int borderw = win.borderWidth();
53 const int win_height = win.height() + 2*win.borderWidth(); 53 const int win_width = win.width() + 2*borderw;
54 const int win_height = win.height() + 2*borderw;
54 const int pixmap_width = min(8, win_width); 55 const int pixmap_width = min(8, win_width);
55 const int pixmap_height = min(8, win_height); 56 const int pixmap_height = min(8, win_height);
56 57
@@ -60,7 +61,7 @@ Pixmap createShape(FbTk::FbWindow &win, int place) {
60 memset(data, 0xFF, data_size); 61 memset(data, 0xFF, data_size);
61 62
62 XImage *ximage = XCreateImage(disp, 63 XImage *ximage = XCreateImage(disp,
63 DefaultVisual(disp, DefaultScreen(disp)), 64 DefaultVisual(disp, win.screenNumber()),
64 1, 65 1,
65 XYPixmap, 0, 66 XYPixmap, 0,
66 data, 67 data,
@@ -76,7 +77,7 @@ Pixmap createShape(FbTk::FbWindow &win, int place) {
76 if (place & Shape::TOPLEFT) { 77 if (place & Shape::TOPLEFT) {
77 for (int y=0; y<pixmap_height; y++) { 78 for (int y=0; y<pixmap_height; y++) {
78 for (int x=0; x<pixmap_width; x++) { 79 for (int x=0; x<pixmap_width; x++) {
79 XPutPixel(ximage, x + 1, y, (left_bits[y] & (0x01 << x)) ? 1 : 0); 80 XPutPixel(ximage, x, y, (left_bits[y] & (0x01 << x)) ? 1 : 0);
80 } 81 }
81 } 82 }
82 } 83 }
@@ -93,7 +94,7 @@ Pixmap createShape(FbTk::FbWindow &win, int place) {
93 if (place & Shape::BOTTOMLEFT) { 94 if (place & Shape::BOTTOMLEFT) {
94 for (int y=0; y<pixmap_height; y++) { 95 for (int y=0; y<pixmap_height; y++) {
95 for (int x=0; x<pixmap_width; x++) { 96 for (int x=0; x<pixmap_width; x++) {
96 XPutPixel(ximage, x + 1, y + win_height - pixmap_height, 97 XPutPixel(ximage, x, y + win_height - pixmap_height,
97 (bottom_left_bits[y] & (0x01 << x)) ? 1 : 0); 98 (bottom_left_bits[y] & (0x01 << x)) ? 1 : 0);
98 } 99 }
99 } 100 }
@@ -108,11 +109,6 @@ Pixmap createShape(FbTk::FbWindow &win, int place) {
108 } 109 }
109 } 110 }
110 111
111 for (int y = 0; y<pixmap_height; ++y) {
112 XPutPixel(ximage, 0, y, 1);
113 }
114
115
116 Pixmap pm = XCreatePixmap(disp, win.window(), win_width, win_height, 1); 112 Pixmap pm = XCreatePixmap(disp, win.window(), win_width, win_height, 1);
117 113
118 FbTk::GContext gc(pm); 114 FbTk::GContext gc(pm);
@@ -179,7 +175,7 @@ void Shape::update() {
179 XShapeCombineMask(FbTk::App::instance()->display(), 175 XShapeCombineMask(FbTk::App::instance()->display(),
180 m_win->window(), 176 m_win->window(),
181 ShapeBounding, 177 ShapeBounding,
182 -2, 0, 178 -m_win->borderWidth(), -m_win->borderWidth(),
183 m_shape, 179 m_shape,
184 ShapeSet); 180 ShapeSet);
185 181