aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/FbWindow.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-04-14 12:13:36 (GMT)
committerfluxgen <fluxgen>2003-04-14 12:13:36 (GMT)
commitf4ce449632eeb85aaeae63f32a7165d71047cde0 (patch)
tree22c3cf8815c69cf4397d0567fd07327e988f9981 /src/FbTk/FbWindow.cc
parent0c895209d2d1425389100e6be734b960475c6883 (diff)
downloadfluxbox-f4ce449632eeb85aaeae63f32a7165d71047cde0.zip
fluxbox-f4ce449632eeb85aaeae63f32a7165d71047cde0.tar.bz2
merged with embedded-tab-branch
Diffstat (limited to 'src/FbTk/FbWindow.cc')
-rw-r--r--src/FbTk/FbWindow.cc29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc
index 5c0b2d2..e92c3d2 100644
--- a/src/FbTk/FbWindow.cc
+++ b/src/FbTk/FbWindow.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: FbWindow.cc,v 1.7 2003/02/23 16:52:16 fluxgen Exp $ 22// $Id: FbWindow.cc,v 1.8 2003/04/14 12:06:25 fluxgen Exp $
23 23
24#include "FbWindow.hh" 24#include "FbWindow.hh"
25 25
@@ -33,7 +33,7 @@ namespace FbTk {
33Display *FbWindow::s_display = 0; 33Display *FbWindow::s_display = 0;
34 34
35FbWindow::FbWindow():m_parent(0), m_screen_num(0), m_window(0), m_x(0), m_y(0), 35FbWindow::FbWindow():m_parent(0), m_screen_num(0), m_window(0), m_x(0), m_y(0),
36 m_width(0), m_height(0), m_border_width(0) { 36 m_width(0), m_height(0), m_border_width(0), m_destroy(true) {
37 37
38 if (s_display == 0) 38 if (s_display == 0)
39 s_display = App::instance()->display(); 39 s_display = App::instance()->display();
@@ -45,7 +45,7 @@ FbWindow::FbWindow(int screen_num,
45 int depth, 45 int depth,
46 int class_type): 46 int class_type):
47 m_screen_num(screen_num), 47 m_screen_num(screen_num),
48 m_parent(0) { 48 m_parent(0), m_destroy(true) {
49 49
50 create(RootWindow(FbTk::App::instance()->display(), screen_num), 50 create(RootWindow(FbTk::App::instance()->display(), screen_num),
51 x, y, width, height, eventmask, 51 x, y, width, height, eventmask,
@@ -53,11 +53,12 @@ FbWindow::FbWindow(int screen_num,
53}; 53};
54 54
55FbWindow::FbWindow(const FbWindow &parent, 55FbWindow::FbWindow(const FbWindow &parent,
56 int x, int y, size_t width, size_t height, long eventmask, 56 int x, int y, unsigned int width, unsigned int height,
57 long eventmask,
57 bool override_redirect, 58 bool override_redirect,
58 int depth, int class_type): 59 int depth, int class_type):
59 m_parent(&parent), 60 m_parent(&parent),
60 m_screen_num(parent.screenNumber()) { 61 m_screen_num(parent.screenNumber()), m_destroy(true) {
61 62
62 create(parent.window(), x, y, width, height, eventmask, 63 create(parent.window(), x, y, width, height, eventmask,
63 override_redirect, depth, class_type); 64 override_redirect, depth, class_type);
@@ -65,8 +66,13 @@ FbWindow::FbWindow(const FbWindow &parent,
65 66
66}; 67};
67 68
69FbWindow::FbWindow(Window client):m_parent(0), m_window(client),
70 m_destroy(false) { // don't destroy this window
71 updateGeometry();
72}
73
68FbWindow::~FbWindow() { 74FbWindow::~FbWindow() {
69 if (m_window != 0) 75 if (m_window != 0 && m_destroy)
70 XDestroyWindow(s_display, m_window); 76 XDestroyWindow(s_display, m_window);
71} 77}
72 78
@@ -82,7 +88,7 @@ void FbWindow::setBackgroundPixmap(Pixmap bg_pixmap) {
82void FbWindow::setBorderColor(const FbTk::Color &border_color) { 88void FbWindow::setBorderColor(const FbTk::Color &border_color) {
83 XSetWindowBorder(s_display, m_window, border_color.pixel()); 89 XSetWindowBorder(s_display, m_window, border_color.pixel());
84} 90}
85void FbWindow::setBorderWidth(size_t size) { 91void FbWindow::setBorderWidth(unsigned int size) {
86 XSetWindowBorderWidth(s_display, m_window, size); 92 XSetWindowBorderWidth(s_display, m_window, size);
87 m_border_width = size; 93 m_border_width = size;
88} 94}
@@ -100,7 +106,7 @@ void FbWindow::clear() {
100} 106}
101 107
102FbWindow &FbWindow::operator = (Window win) { 108FbWindow &FbWindow::operator = (Window win) {
103 if (m_window != 0) 109 if (m_window != 0 && m_destroy)
104 XDestroyWindow(s_display, m_window); 110 XDestroyWindow(s_display, m_window);
105 m_window = win; 111 m_window = win;
106 if (m_window != 0) 112 if (m_window != 0)
@@ -127,13 +133,13 @@ void FbWindow::move(int x, int y) {
127 m_y = y; 133 m_y = y;
128} 134}
129 135
130void FbWindow::resize(size_t width, size_t height) { 136void FbWindow::resize(unsigned int width, unsigned int height) {
131 XResizeWindow(s_display, m_window, width, height); 137 XResizeWindow(s_display, m_window, width, height);
132 m_width = width; 138 m_width = width;
133 m_height = height; 139 m_height = height;
134} 140}
135 141
136void FbWindow::moveResize(int x, int y, size_t width, size_t height) { 142void FbWindow::moveResize(int x, int y, unsigned int width, unsigned int height) {
137 XMoveResizeWindow(s_display, m_window, x, y, width, height); 143 XMoveResizeWindow(s_display, m_window, x, y, width, height);
138 m_x = x; 144 m_x = x;
139 m_y = y; 145 m_y = y;
@@ -152,6 +158,7 @@ void FbWindow::raise() {
152int FbWindow::screenNumber() const { 158int FbWindow::screenNumber() const {
153 return m_screen_num; 159 return m_screen_num;
154} 160}
161
155void FbWindow::updateGeometry() { 162void FbWindow::updateGeometry() {
156 if (m_window == 0) 163 if (m_window == 0)
157 return; 164 return;
@@ -164,7 +171,7 @@ void FbWindow::updateGeometry() {
164} 171}
165 172
166void FbWindow::create(Window parent, int x, int y, 173void FbWindow::create(Window parent, int x, int y,
167 size_t width, size_t height, 174 unsigned int width, unsigned int height,
168 long eventmask, bool override_redirect, 175 long eventmask, bool override_redirect,
169 int depth, int class_type) { 176 int depth, int class_type) {
170 177