diff options
author | mathias <mathias> | 2004-12-21 16:12:28 (GMT) |
---|---|---|
committer | mathias <mathias> | 2004-12-21 16:12:28 (GMT) |
commit | a88d3b39ad76182bf120b8c69b80104f7b61cba8 (patch) | |
tree | df3c80f7b7fa42ec7b9a9c2d3f8f4a6cf30ab212 /src/FbTk | |
parent | 37c6602f07bece414e3a9b6287b5c0691635919d (diff) | |
download | fluxbox_lack-a88d3b39ad76182bf120b8c69b80104f7b61cba8.zip fluxbox_lack-a88d3b39ad76182bf120b8c69b80104f7b61cba8.tar.bz2 |
added deleteProperty to FbWindow
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/FbWindow.cc | 76 | ||||
-rw-r--r-- | src/FbTk/FbWindow.hh | 2 |
2 files changed, 42 insertions, 36 deletions
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc index e0a0a4a..6f07b45 100644 --- a/src/FbTk/FbWindow.cc +++ b/src/FbTk/FbWindow.cc | |||
@@ -44,26 +44,26 @@ | |||
44 | 44 | ||
45 | namespace FbTk { | 45 | namespace FbTk { |
46 | 46 | ||
47 | FbWindow::FbWindow():FbDrawable(), m_parent(0), m_screen_num(0), m_window(0), m_x(0), m_y(0), | 47 | FbWindow::FbWindow():FbDrawable(), m_parent(0), m_screen_num(0), m_window(0), m_x(0), m_y(0), |
48 | m_width(0), m_height(0), m_border_width(0), m_depth(0), m_destroy(true), | 48 | m_width(0), m_height(0), m_border_width(0), m_depth(0), m_destroy(true), |
49 | m_buffer_pm(0){ | 49 | m_buffer_pm(0){ |
50 | 50 | ||
51 | } | 51 | } |
52 | 52 | ||
53 | FbWindow::FbWindow(const FbWindow& the_copy):m_parent(the_copy.parent()), | 53 | FbWindow::FbWindow(const FbWindow& the_copy):m_parent(the_copy.parent()), |
54 | m_screen_num(the_copy.screenNumber()), m_window(the_copy.window()), | 54 | m_screen_num(the_copy.screenNumber()), m_window(the_copy.window()), |
55 | m_x(the_copy.x()), m_y(the_copy.y()), | 55 | m_x(the_copy.x()), m_y(the_copy.y()), |
56 | m_width(the_copy.width()), m_height(the_copy.height()), | 56 | m_width(the_copy.width()), m_height(the_copy.height()), |
57 | m_border_width(the_copy.borderWidth()), | 57 | m_border_width(the_copy.borderWidth()), |
58 | m_depth(the_copy.depth()), m_destroy(true), | 58 | m_depth(the_copy.depth()), m_destroy(true), |
59 | m_buffer_pm(0) { | 59 | m_buffer_pm(0) { |
60 | the_copy.m_window = 0; | 60 | the_copy.m_window = 0; |
61 | } | 61 | } |
62 | 62 | ||
63 | FbWindow::FbWindow(int screen_num, | 63 | FbWindow::FbWindow(int screen_num, |
64 | int x, int y, | 64 | int x, int y, |
65 | unsigned int width, unsigned int height, | 65 | unsigned int width, unsigned int height, |
66 | long eventmask, | 66 | long eventmask, |
67 | bool override_redirect, | 67 | bool override_redirect, |
68 | bool save_unders, | 68 | bool save_unders, |
69 | int depth, | 69 | int depth, |
@@ -73,30 +73,30 @@ FbWindow::FbWindow(int screen_num, | |||
73 | m_screen_num(screen_num), | 73 | m_screen_num(screen_num), |
74 | m_destroy(true), | 74 | m_destroy(true), |
75 | m_buffer_pm(0) { | 75 | m_buffer_pm(0) { |
76 | 76 | ||
77 | create(RootWindow(display(), screen_num), | 77 | create(RootWindow(display(), screen_num), |
78 | x, y, width, height, eventmask, | 78 | x, y, width, height, eventmask, |
79 | override_redirect, save_unders, depth, class_type); | 79 | override_redirect, save_unders, depth, class_type); |
80 | }; | 80 | }; |
81 | 81 | ||
82 | FbWindow::FbWindow(const FbWindow &parent, | 82 | FbWindow::FbWindow(const FbWindow &parent, |
83 | int x, int y, unsigned int width, unsigned int height, | 83 | int x, int y, unsigned int width, unsigned int height, |
84 | long eventmask, | 84 | long eventmask, |
85 | bool override_redirect, | 85 | bool override_redirect, |
86 | bool save_unders, | 86 | bool save_unders, |
87 | int depth, int class_type): | 87 | int depth, int class_type): |
88 | m_parent(&parent), | 88 | m_parent(&parent), |
89 | m_screen_num(parent.screenNumber()), | 89 | m_screen_num(parent.screenNumber()), |
90 | m_destroy(true), | 90 | m_destroy(true), |
91 | m_buffer_pm(0) { | 91 | m_buffer_pm(0) { |
92 | 92 | ||
93 | create(parent.window(), x, y, width, height, eventmask, | 93 | create(parent.window(), x, y, width, height, eventmask, |
94 | override_redirect, save_unders, depth, class_type); | 94 | override_redirect, save_unders, depth, class_type); |
95 | 95 | ||
96 | 96 | ||
97 | }; | 97 | }; |
98 | 98 | ||
99 | FbWindow::FbWindow(Window client):FbDrawable(), m_parent(0), | 99 | FbWindow::FbWindow(Window client):FbDrawable(), m_parent(0), |
100 | m_screen_num(0), | 100 | m_screen_num(0), |
101 | m_window(0), | 101 | m_window(0), |
102 | m_x(0), m_y(0), | 102 | m_x(0), m_y(0), |
@@ -117,9 +117,9 @@ FbWindow::~FbWindow() { | |||
117 | 117 | ||
118 | if (m_window != 0) { | 118 | if (m_window != 0) { |
119 | // so we don't get any dangling eventhandler for this window | 119 | // so we don't get any dangling eventhandler for this window |
120 | FbTk::EventManager::instance()->remove(m_window); | 120 | FbTk::EventManager::instance()->remove(m_window); |
121 | if (m_destroy) | 121 | if (m_destroy) |
122 | XDestroyWindow(display(), m_window); | 122 | XDestroyWindow(display(), m_window); |
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
@@ -136,7 +136,7 @@ void FbWindow::setBorderColor(const FbTk::Color &border_color) { | |||
136 | XSetWindowBorder(display(), m_window, border_color.pixel()); | 136 | XSetWindowBorder(display(), m_window, border_color.pixel()); |
137 | } | 137 | } |
138 | 138 | ||
139 | void FbWindow::setBorderWidth(unsigned int size) { | 139 | void FbWindow::setBorderWidth(unsigned int size) { |
140 | XSetWindowBorderWidth(display(), m_window, size); | 140 | XSetWindowBorderWidth(display(), m_window, size); |
141 | m_border_width = size; | 141 | m_border_width = size; |
142 | } | 142 | } |
@@ -153,8 +153,8 @@ void FbWindow::clear() { | |||
153 | XClearWindow(display(), m_window); | 153 | XClearWindow(display(), m_window); |
154 | } | 154 | } |
155 | 155 | ||
156 | void FbWindow::clearArea(int x, int y, | 156 | void FbWindow::clearArea(int x, int y, |
157 | unsigned int width, unsigned int height, | 157 | unsigned int width, unsigned int height, |
158 | bool exposures) { | 158 | bool exposures) { |
159 | XClearArea(display(), window(), x, y, width, height, exposures); | 159 | XClearArea(display(), window(), x, y, width, height, exposures); |
160 | } | 160 | } |
@@ -254,7 +254,7 @@ FbWindow &FbWindow::operator = (const FbWindow &win) { | |||
254 | } | 254 | } |
255 | 255 | ||
256 | FbWindow &FbWindow::operator = (Window win) { | 256 | FbWindow &FbWindow::operator = (Window win) { |
257 | setNew(win); | 257 | setNew(win); |
258 | return *this; | 258 | return *this; |
259 | } | 259 | } |
260 | 260 | ||
@@ -289,7 +289,7 @@ void FbWindow::setNew(Window win) { | |||
289 | m_depth = attr.depth; | 289 | m_depth = attr.depth; |
290 | m_border_width = attr.border_width; | 290 | m_border_width = attr.border_width; |
291 | } | 291 | } |
292 | 292 | ||
293 | } | 293 | } |
294 | } | 294 | } |
295 | 295 | ||
@@ -318,7 +318,7 @@ void FbWindow::setInputFocus(int revert_to, int time) { | |||
318 | } | 318 | } |
319 | 319 | ||
320 | void FbWindow::setCursor(Cursor cur) { | 320 | void FbWindow::setCursor(Cursor cur) { |
321 | XDefineCursor(display(), window(), cur); | 321 | XDefineCursor(display(), window(), cur); |
322 | } | 322 | } |
323 | 323 | ||
324 | void FbWindow::unsetCursor() { | 324 | void FbWindow::unsetCursor() { |
@@ -368,8 +368,8 @@ bool FbWindow::property(Atom property, | |||
368 | unsigned long *nitems_return, | 368 | unsigned long *nitems_return, |
369 | unsigned long *bytes_after_return, | 369 | unsigned long *bytes_after_return, |
370 | unsigned char **prop_return) const { | 370 | unsigned char **prop_return) const { |
371 | if (XGetWindowProperty(display(), window(), | 371 | if (XGetWindowProperty(display(), window(), |
372 | property, long_offset, long_length, do_delete, | 372 | property, long_offset, long_length, do_delete, |
373 | req_type, actual_type_return, | 373 | req_type, actual_type_return, |
374 | actual_format_return, nitems_return, | 374 | actual_format_return, nitems_return, |
375 | bytes_after_return, prop_return) == Success) | 375 | bytes_after_return, prop_return) == Success) |
@@ -383,19 +383,23 @@ void FbWindow::changeProperty(Atom property, Atom type, | |||
383 | int mode, | 383 | int mode, |
384 | unsigned char *data, | 384 | unsigned char *data, |
385 | int nelements) { | 385 | int nelements) { |
386 | 386 | ||
387 | XChangeProperty(display(), m_window, property, type, | 387 | XChangeProperty(display(), m_window, property, type, |
388 | format, mode, | 388 | format, mode, |
389 | data, nelements); | 389 | data, nelements); |
390 | } | 390 | } |
391 | 391 | ||
392 | void FbWindow::deleteProperty(Atom property) { | ||
393 | XDeleteProperty(display(), m_window, property); | ||
394 | } | ||
395 | |||
392 | int FbWindow::screenNumber() const { | 396 | int FbWindow::screenNumber() const { |
393 | return m_screen_num; | 397 | return m_screen_num; |
394 | } | 398 | } |
395 | 399 | ||
396 | long FbWindow::eventMask() const { | 400 | long FbWindow::eventMask() const { |
397 | XWindowAttributes attrib; | 401 | XWindowAttributes attrib; |
398 | XGetWindowAttributes(display(), window(), | 402 | XGetWindowAttributes(display(), window(), |
399 | &attrib); | 403 | &attrib); |
400 | return attrib.your_event_mask; | 404 | return attrib.your_event_mask; |
401 | 405 | ||
@@ -420,16 +424,16 @@ void FbWindow::updateGeometry() { | |||
420 | Window root; | 424 | Window root; |
421 | unsigned int border_width, depth; | 425 | unsigned int border_width, depth; |
422 | XGetGeometry(display(), m_window, &root, &m_x, &m_y, | 426 | XGetGeometry(display(), m_window, &root, &m_x, &m_y, |
423 | (unsigned int *)&m_width, (unsigned int *)&m_height, | 427 | (unsigned int *)&m_width, (unsigned int *)&m_height, |
424 | &border_width, &depth); | 428 | &border_width, &depth); |
425 | m_depth = depth; | 429 | m_depth = depth; |
426 | } | 430 | } |
427 | 431 | ||
428 | void FbWindow::create(Window parent, int x, int y, | 432 | void FbWindow::create(Window parent, int x, int y, |
429 | unsigned int width, unsigned int height, | 433 | unsigned int width, unsigned int height, |
430 | long eventmask, bool override_redirect, | 434 | long eventmask, bool override_redirect, |
431 | bool save_unders, int depth, int class_type) { | 435 | bool save_unders, int depth, int class_type) { |
432 | 436 | ||
433 | 437 | ||
434 | m_border_width = 0; | 438 | m_border_width = 0; |
435 | 439 | ||
@@ -437,7 +441,7 @@ void FbWindow::create(Window parent, int x, int y, | |||
437 | XSetWindowAttributes values; | 441 | XSetWindowAttributes values; |
438 | values.event_mask = eventmask; | 442 | values.event_mask = eventmask; |
439 | 443 | ||
440 | if (override_redirect) { | 444 | if (override_redirect) { |
441 | valmask |= CWOverrideRedirect; | 445 | valmask |= CWOverrideRedirect; |
442 | values.override_redirect = True; | 446 | values.override_redirect = True; |
443 | } | 447 | } |
@@ -448,13 +452,13 @@ void FbWindow::create(Window parent, int x, int y, | |||
448 | } | 452 | } |
449 | 453 | ||
450 | m_window = XCreateWindow(display(), parent, x, y, width, height, | 454 | m_window = XCreateWindow(display(), parent, x, y, width, height, |
451 | 0, // border width | 455 | 0, // border width |
452 | depth, // depth | 456 | depth, // depth |
453 | class_type, // class | 457 | class_type, // class |
454 | CopyFromParent, // visual | 458 | CopyFromParent, // visual |
455 | valmask, // create mask | 459 | valmask, // create mask |
456 | &values); // create atrribs | 460 | &values); // create atrribs |
457 | 461 | ||
458 | assert(m_window); | 462 | assert(m_window); |
459 | 463 | ||
460 | updateGeometry(); | 464 | updateGeometry(); |
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh index 6e11789..6fbe913 100644 --- a/src/FbTk/FbWindow.hh +++ b/src/FbTk/FbWindow.hh | |||
@@ -137,6 +137,8 @@ public: | |||
137 | unsigned char *data, | 137 | unsigned char *data, |
138 | int nelements); | 138 | int nelements); |
139 | 139 | ||
140 | void deleteProperty(Atom property); | ||
141 | |||
140 | void setBufferPixmap(Pixmap pm); | 142 | void setBufferPixmap(Pixmap pm); |
141 | 143 | ||
142 | std::string textProperty(Atom property) const; | 144 | std::string textProperty(Atom property) const; |