aboutsummaryrefslogtreecommitdiff
path: root/src/Shape.cc
diff options
context:
space:
mode:
authormathias <mathias>2006-10-27 06:57:43 (GMT)
committermathias <mathias>2006-10-27 06:57:43 (GMT)
commit10082d821d6691f42a8d8ad6fa2e42e5b3f44edd (patch)
tree99c94a6105cf35612307e307be343eda2aea8baf /src/Shape.cc
parent34b7f7ddfc3e914238fd0d30ff50c4f37c2a6dd8 (diff)
downloadfluxbox-10082d821d6691f42a8d8ad6fa2e42e5b3f44edd.zip
fluxbox-10082d821d6691f42a8d8ad6fa2e42e5b3f44edd.tar.bz2
cosmetic patch from slava semushin, removes whitespaces and
uses only those things from "namespace std" what we really need.
Diffstat (limited to 'src/Shape.cc')
-rw-r--r--src/Shape.cc36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/Shape.cc b/src/Shape.cc
index b1accc4..66691b4 100644
--- a/src/Shape.cc
+++ b/src/Shape.cc
@@ -1,6 +1,6 @@
1// Shape.cc 1// Shape.cc
2// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org) 2// Copyright (c) 2003 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
3// 3//
4// Permission is hereby granted, free of charge, to any person obtaining a 4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"), 5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation 6// to deal in the Software without restriction, including without limitation
@@ -28,6 +28,10 @@
28#include "FbTk/GContext.hh" 28#include "FbTk/GContext.hh"
29#include "FbTk/FbPixmap.hh" 29#include "FbTk/FbPixmap.hh"
30 30
31#ifdef HAVE_CONFIG_H
32#include "config.h"
33#endif // HAVE_CONFIG_H
34
31#ifdef HAVE_CSTRING 35#ifdef HAVE_CSTRING
32 #include <cstring> 36 #include <cstring>
33#else 37#else
@@ -35,9 +39,6 @@
35#endif 39#endif
36 40
37#include <X11/Xutil.h> 41#include <X11/Xutil.h>
38#ifdef HAVE_CONFIG_H
39#include "config.h"
40#endif // HAVE_CONFIG_H
41 42
42#ifdef SHAPE 43#ifdef SHAPE
43#include <X11/extensions/shape.h> 44#include <X11/extensions/shape.h>
@@ -45,15 +46,16 @@
45 46
46#include <iostream> 47#include <iostream>
47#include <algorithm> 48#include <algorithm>
48using namespace std; 49
50using std::min;
49 51
50namespace { 52namespace {
51 53
52FbTk::FbPixmap *createShape(const FbTk::FbWindow &win, int place) { 54FbTk::FbPixmap *createShape(const FbTk::FbWindow &win, int place) {
53 if (win.window() == 0 || place == 0 || 55 if (win.window() == 0 || place == 0 ||
54 win.width() < 3 || win.height() < 3) 56 win.width() < 3 || win.height() < 3)
55 return 0; 57 return 0;
56 58
57 static char left_bits[] = { 0xc0, 0xf8, 0xfc, 0xfe, 0xfe, 0xfe, 0xff, 0xff }; 59 static char left_bits[] = { 0xc0, 0xf8, 0xfc, 0xfe, 0xfe, 0xfe, 0xff, 0xff };
58 static char right_bits[] = { 0x03, 0x1f, 0x3f, 0x7f, 0x7f, 0x7f, 0xff, 0xff}; 60 static char right_bits[] = { 0x03, 0x1f, 0x3f, 0x7f, 0x7f, 0x7f, 0xff, 0xff};
59 static char bottom_left_bits[] = { 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfc, 0xf8, 0xc0 }; 61 static char bottom_left_bits[] = { 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfc, 0xf8, 0xc0 };
@@ -74,7 +76,7 @@ FbTk::FbPixmap *createShape(const FbTk::FbWindow &win, int place) {
74 return 0; 76 return 0;
75 77
76 memset(data, 0xFF, data_size); 78 memset(data, 0xFF, data_size);
77 79
78 XImage *ximage = XCreateImage(disp, 80 XImage *ximage = XCreateImage(disp,
79 DefaultVisual(disp, win.screenNumber()), 81 DefaultVisual(disp, win.screenNumber()),
80 1, 82 1,
@@ -96,20 +98,20 @@ FbTk::FbPixmap *createShape(const FbTk::FbWindow &win, int place) {
96 } 98 }
97 } 99 }
98 } 100 }
99 101
100 if (place & Shape::TOPRIGHT) { 102 if (place & Shape::TOPRIGHT) {
101 for (int y=0; y<pixmap_height; y++) { 103 for (int y=0; y<pixmap_height; y++) {
102 for (int x=0; x<pixmap_width; x++) { 104 for (int x=0; x<pixmap_width; x++) {
103 XPutPixel(ximage, x + win_width - pixmap_width, y, 105 XPutPixel(ximage, x + win_width - pixmap_width, y,
104 (right_bits[y] & (0x01 << x)) ? 1 : 0); 106 (right_bits[y] & (0x01 << x)) ? 1 : 0);
105 } 107 }
106 } 108 }
107 } 109 }
108 110
109 if (place & Shape::BOTTOMLEFT) { 111 if (place & Shape::BOTTOMLEFT) {
110 for (int y=0; y<pixmap_height; y++) { 112 for (int y=0; y<pixmap_height; y++) {
111 for (int x=0; x<pixmap_width; x++) { 113 for (int x=0; x<pixmap_width; x++) {
112 XPutPixel(ximage, x, y + win_height - pixmap_height, 114 XPutPixel(ximage, x, y + win_height - pixmap_height,
113 (bottom_left_bits[y] & (0x01 << x)) ? 1 : 0); 115 (bottom_left_bits[y] & (0x01 << x)) ? 1 : 0);
114 } 116 }
115 } 117 }
@@ -128,7 +130,7 @@ FbTk::FbPixmap *createShape(const FbTk::FbWindow &win, int place) {
128 130
129 131
130 FbTk::GContext gc(*pm); 132 FbTk::GContext gc(*pm);
131 133
132 XPutImage(disp, pm->drawable(), gc.gc(), ximage, 0, 0, 0, 0, 134 XPutImage(disp, pm->drawable(), gc.gc(), ximage, 0, 0, 0, 0,
133 win_width, win_height); 135 win_width, win_height);
134 136
@@ -177,7 +179,7 @@ void Shape::update() {
177 } 179 }
178 180
179 // the m_shape can be = 0 which will just reset the shape mask 181 // the m_shape can be = 0 which will just reset the shape mask
180 // and make the window normal 182 // and make the window normal
181 XShapeCombineMask(FbTk::App::instance()->display(), 183 XShapeCombineMask(FbTk::App::instance()->display(),
182 m_win->window(), 184 m_win->window(),
183 ShapeBounding, 185 ShapeBounding,
@@ -197,7 +199,7 @@ void Shape::setWindow(FbTk::FbWindow &win) {
197 199
198void Shape::setShapeNotify(const FbTk::FbWindow &win) { 200void Shape::setShapeNotify(const FbTk::FbWindow &win) {
199#ifdef SHAPE 201#ifdef SHAPE
200 XShapeSelectInput(FbTk::App::instance()->display(), 202 XShapeSelectInput(FbTk::App::instance()->display(),
201 win.window(), ShapeNotifyMask); 203 win.window(), ShapeNotifyMask);
202#endif // SHAPE 204#endif // SHAPE
203} 205}
@@ -209,7 +211,7 @@ bool Shape::isShaped(const FbTk::FbWindow &win) {
209 int not_used; 211 int not_used;
210 unsigned int not_used2; 212 unsigned int not_used2;
211 XShapeQueryExtents(FbTk::App::instance()->display(), 213 XShapeQueryExtents(FbTk::App::instance()->display(),
212 win.window(), 214 win.window(),
213 &shaped, /// bShaped 215 &shaped, /// bShaped
214 &not_used, &not_used, // xbs, ybs 216 &not_used, &not_used, // xbs, ybs
215 &not_used2, &not_used2, // wbs, hbs 217 &not_used2, &not_used2, // wbs, hbs