diff options
author | rathnor <rathnor> | 2004-04-28 13:04:06 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2004-04-28 13:04:06 (GMT) |
commit | bb779745f45c917099fde31c4cea8bb6d6bc6f7d (patch) | |
tree | 89eb15166c04426e451481ff8c206a773ad089e6 /src/FbTk/FbWindow.cc | |
parent | 161aad980acb4cccb5945a29eed2f1d490eb28c4 (diff) | |
download | fluxbox_pavel-bb779745f45c917099fde31c4cea8bb6d6bc6f7d.zip fluxbox_pavel-bb779745f45c917099fde31c4cea8bb6d6bc6f7d.tar.bz2 |
add apps file matching on role. Includes new textProperty property on
FbWindow.
Diffstat (limited to 'src/FbTk/FbWindow.cc')
-rw-r--r-- | src/FbTk/FbWindow.cc | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc index 195eeea..47e1399 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.31 2004/01/21 20:07:41 fluxgen Exp $ | 22 | // $Id: FbWindow.cc,v 1.32 2004/04/28 13:04:06 rathnor Exp $ |
23 | 23 | ||
24 | #include "FbWindow.hh" | 24 | #include "FbWindow.hh" |
25 | 25 | ||
@@ -32,6 +32,7 @@ | |||
32 | #include "config.h" | 32 | #include "config.h" |
33 | #endif // HAVE_CONFIG_H | 33 | #endif // HAVE_CONFIG_H |
34 | 34 | ||
35 | #include <X11/Xutil.h> | ||
35 | #include <X11/Xatom.h> | 36 | #include <X11/Xatom.h> |
36 | 37 | ||
37 | #include <cassert> | 38 | #include <cassert> |
@@ -342,6 +343,33 @@ void FbWindow::reparent(const FbWindow &parent, int x, int y) { | |||
342 | updateGeometry(); | 343 | updateGeometry(); |
343 | } | 344 | } |
344 | 345 | ||
346 | std::string FbWindow::textProperty(Atom property) const { | ||
347 | XTextProperty text_prop; | ||
348 | char ** stringlist; | ||
349 | int count; | ||
350 | std::string ret; | ||
351 | |||
352 | if (XGetTextProperty(s_display, window(), &text_prop, property) == 0) | ||
353 | return ""; | ||
354 | |||
355 | if (text_prop.value == 0 || text_prop.nitems == 0) | ||
356 | return ""; | ||
357 | |||
358 | if (text_prop.encoding != XA_STRING) { | ||
359 | // still returns a "StringList" despite the different name | ||
360 | if (XmbTextPropertyToTextList(s_display, &text_prop, &stringlist, &count) == 0 || count == 0) | ||
361 | return ""; | ||
362 | } else { | ||
363 | if (XTextPropertyToStringList(&text_prop, &stringlist, &count) == 0 || count == 0) | ||
364 | return ""; | ||
365 | |||
366 | } | ||
367 | |||
368 | ret = stringlist[0]; | ||
369 | XFreeStringList(stringlist); | ||
370 | return ret; | ||
371 | } | ||
372 | |||
345 | bool FbWindow::property(Atom property, | 373 | bool FbWindow::property(Atom property, |
346 | long long_offset, long long_length, | 374 | long long_offset, long long_length, |
347 | bool do_delete, | 375 | bool do_delete, |