aboutsummaryrefslogtreecommitdiff
path: root/src/Ewmh.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/Ewmh.cc
parent2f166eb4aeb5d77407e9380d644215cd5e94d592 (diff)
downloadfluxbox_pavel-1dacf57d2064e7128a8d725d8bbaad6b8dc9fded.zip
fluxbox_pavel-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/Ewmh.cc')
-rw-r--r--src/Ewmh.cc15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index bab543b..52568a1 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -695,22 +695,13 @@ void Ewmh::setupClient(WinClient &winclient) {
695 695
696void Ewmh::setupFrame(FluxboxWindow &win) { 696void Ewmh::setupFrame(FluxboxWindow &win) {
697 setupState(win); 697 setupState(win);
698 698 bool exists;
699 Atom ret_type; 699 unsigned int desktop=static_cast<unsigned int>(win.winClient().cardinalProperty(m_net->wm_desktop, &exists));
700 int fmt; 700 if (exists) {
701 unsigned long nitems, bytes_after;
702 unsigned char *data = 0;
703
704 if (win.winClient().property(m_net->wm_desktop, 0, 1, False, XA_CARDINAL,
705 &ret_type, &fmt, &nitems, &bytes_after,
706 (unsigned char **) &data) && data) {
707 unsigned int desktop = static_cast<long>(*data);
708 if (desktop == (unsigned int)(-1) && !win.isStuck()) 701 if (desktop == (unsigned int)(-1) && !win.isStuck())
709 win.stick(); 702 win.stick();
710 else 703 else
711 win.setWorkspace(desktop); 704 win.setWorkspace(desktop);
712
713 XFree(data);
714 } else { 705 } else {
715 updateWorkspace(win); 706 updateWorkspace(win);
716 } 707 }