aboutsummaryrefslogtreecommitdiff
path: root/src/Gnome.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/Gnome.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/Gnome.cc')
-rw-r--r--src/Gnome.cc30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/Gnome.cc b/src/Gnome.cc
index 91a0aef..0c3b6f1 100644
--- a/src/Gnome.cc
+++ b/src/Gnome.cc
@@ -98,40 +98,30 @@ void Gnome::initForScreen(BScreen &screen) {
98 98
99void Gnome::setupFrame(FluxboxWindow &win) { 99void Gnome::setupFrame(FluxboxWindow &win) {
100 // load gnome state (take queues from the main window of the frame) 100 // load gnome state (take queues from the main window of the frame)
101 Atom ret_type; 101 long flags;
102 int fmt; 102 bool exists;
103 unsigned long nitems, bytes_after; 103 flags=win.winClient().cardinalProperty(m_gnome_wm_win_state,&exists);
104 long flags, *data = 0; 104 if (exists) {
105
106 if (win.winClient().property(m_gnome_wm_win_state, 0, 1, False, XA_CARDINAL,
107 &ret_type, &fmt, &nitems, &bytes_after,
108 (unsigned char **) &data) && data) {
109 flags = *data;
110 setState(&win, flags); 105 setState(&win, flags);
111 XFree (data);
112 } else { 106 } else {
113 updateState(win); 107 updateState(win);
114 } 108 }
115 109
116 // load gnome layer atom 110 // load gnome layer atom
117 if (win.winClient().property(m_gnome_wm_win_layer, 0, 1, False, XA_CARDINAL, 111 flags=win.winClient().cardinalProperty(m_gnome_wm_win_layer,&exists);
118 &ret_type, &fmt, &nitems, &bytes_after, 112 if (exists) {
119 (unsigned char **) &data) && data) {
120 flags = *data;
121 setLayer(&win, flags); 113 setLayer(&win, flags);
122 XFree (data);
123 } else { 114 } else {
124 updateLayer(win); 115 updateLayer(win);
125 } 116 }
126 117
127 // load gnome workspace atom 118 // load gnome workspace atom
128 if (win.winClient().property(m_gnome_wm_win_workspace, 0, 1, False, XA_CARDINAL, 119 flags=win.winClient().cardinalProperty(m_gnome_wm_win_workspace,&exists);
129 &ret_type, &fmt, &nitems, &bytes_after, 120 if (exists)
130 (unsigned char **) &data) && data) { 121 {
131 unsigned int workspace_num = *data; 122 unsigned int workspace_num = flags;
132 if (win.workspaceNumber() != workspace_num) 123 if (win.workspaceNumber() != workspace_num)
133 win.setWorkspace(workspace_num); 124 win.setWorkspace(workspace_num);
134 XFree (data);
135 } else { 125 } else {
136 updateWorkspace(win); 126 updateWorkspace(win);
137 } 127 }