aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authornacitar sevaht <nacitar@ubercpp.com>2011-05-08 02:38:13 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2011-05-08 05:48:03 (GMT)
commit1dacf57d2064e7128a8d725d8bbaad6b8dc9fded (patch)
tree66921aa92df61365f4ba1dde552f9d44da7de24a /src/Screen.cc
parent2f166eb4aeb5d77407e9380d644215cd5e94d592 (diff)
downloadfluxbox-1dacf57d2064e7128a8d725d8bbaad6b8dc9fded.zip
fluxbox-1dacf57d2064e7128a8d725d8bbaad6b8dc9fded.tar.bz2
Can check CARDINAL properties in CLIENT PATTERNS
Introduces a new member function, FbWindow::cardinalProperty() This change also changes other code that previously used FbWindow::property() to do the same thing as the new function; this reduces code duplication. There are still some bits of code (Ewmh.cc, extractNetWmIcon()) that use FbWindow::property() to retrieve XA_CARDINAL values, but as the new method is designed for getting a _single_ property, and that code uses FbWindow::property() to retrieve the number of values present, and then grab all of them; it's a different use case. I opted to not try to make cardinalProperty() into some monolithic all-purpose cardinal method; FbWindow::property() works just fine for that. This change also adds an optional (default=NULL) boolean to FbWindow::textProperty and friends that allows the caller to determine whether or not a value was actually retrieved. This was necessary for integrating FbWindow::cardinalProperty with the codebase, and it seemed to fit with FbWindow::textProperty as well. Prior to this change, if you got a return value of "", you wouldn't know if you successfully retrieved the value which happened to be blank, or if you failed to retrieve the value. Now, you can pass the address of a boolean if you so choose in order to differentiate these situations; the same applies to the new FbWindow::cardinalProperty().
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index bf131fb..a8eca72 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -477,12 +477,11 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
477 unsigned int first_desktop = 0; 477 unsigned int first_desktop = 0;
478 if (m_restart) { 478 if (m_restart) {
479 Atom net_desktop = XInternAtom(disp, "_NET_CURRENT_DESKTOP", False); 479 Atom net_desktop = XInternAtom(disp, "_NET_CURRENT_DESKTOP", False);
480 if (rootWindow().property(net_desktop, 0l, 1l, 480 bool exists;
481 False, XA_CARDINAL, &xa_ret_type, &ret_format, &ret_nitems, 481 unsigned int ret=static_cast<unsigned int>(rootWindow().cardinalProperty(net_desktop, &exists));
482 &ret_bytes_after, &ret_prop) == Success) { 482 if (exists) {
483 if (ret_prop && static_cast<unsigned int>(*ret_prop) < static_cast<unsigned int>(nr_ws)) 483 if (ret < static_cast<unsigned int>(nr_ws))
484 first_desktop = static_cast<unsigned int>(*ret_prop); 484 first_desktop = ret;
485 XFree(ret_prop);
486 } 485 }
487 } 486 }
488 487