aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-10-31 19:32:40 (GMT)
committerrathnor <rathnor>2003-10-31 19:32:40 (GMT)
commitaf7deab37956a180996f4420144c484fa7cdb5ed (patch)
treee31cd5e0231c8cff359a9bc799e57059109bd55c /src
parentb88f9b2a9e6a08cfb663b7177a9c037250d48fea (diff)
downloadfluxbox-af7deab37956a180996f4420144c484fa7cdb5ed.zip
fluxbox-af7deab37956a180996f4420144c484fa7cdb5ed.tar.bz2
tweak winbutton icon drawing, plus a little fix to icon changes
Diffstat (limited to 'src')
-rw-r--r--src/IconButton.cc14
-rw-r--r--src/WinButton.cc22
2 files changed, 24 insertions, 12 deletions
diff --git a/src/IconButton.cc b/src/IconButton.cc
index 2f68ecf..093298e 100644
--- a/src/IconButton.cc
+++ b/src/IconButton.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: IconButton.cc,v 1.9 2003/10/31 10:37:09 rathnor Exp $ 23// $Id: IconButton.cc,v 1.10 2003/10/31 19:32:39 rathnor Exp $
24 24
25#include "IconButton.hh" 25#include "IconButton.hh"
26 26
@@ -144,14 +144,14 @@ void IconButton::update(FbTk::Subject *subj) {
144 if (hints->flags & IconPixmapHint && hints->icon_pixmap != 0) { 144 if (hints->flags & IconPixmapHint && hints->icon_pixmap != 0) {
145 // setup icon window 145 // setup icon window
146 m_icon_window.show(); 146 m_icon_window.show();
147 int new_height = height() - m_icon_window.y(); 147 int new_height = height() - 2*m_icon_window.y(); // equally padded
148 int new_width = height(); 148 int new_width = new_height;
149 m_icon_window.resize(new_width ? new_width : 1, new_height ? new_height : 1); 149 m_icon_window.resize((new_width>0) ? new_width : 1, (new_height>0) ? new_height : 1);
150 150
151 m_icon_pixmap.copy(hints->icon_pixmap); 151 m_icon_pixmap.copy(hints->icon_pixmap);
152 m_icon_pixmap.scale(m_icon_window.height(), m_icon_window.height()); 152 m_icon_pixmap.scale(m_icon_window.width(), m_icon_window.height());
153 153
154 setBackgroundPixmap(m_icon_pixmap.drawable()); 154 m_icon_window.setBackgroundPixmap(m_icon_pixmap.drawable());
155 } else { 155 } else {
156 // no icon pixmap 156 // no icon pixmap
157 m_icon_window.move(0, 0); 157 m_icon_window.move(0, 0);
@@ -186,6 +186,8 @@ void IconButton::update(FbTk::Subject *subj) {
186 186
187void IconButton::setupWindow() { 187void IconButton::setupWindow() {
188 188
189 m_icon_window.clear();
190
189 if (!m_win.clientList().empty()) { 191 if (!m_win.clientList().empty()) {
190 setText(m_win.winClient().title()); 192 setText(m_win.winClient().title());
191 // draw with x offset and y offset 193 // draw with x offset and y offset
diff --git a/src/WinButton.cc b/src/WinButton.cc
index 48ce31c..900d23e 100644
--- a/src/WinButton.cc
+++ b/src/WinButton.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: WinButton.cc,v 1.15 2003/09/22 12:07:00 rathnor Exp $ 22/// $Id: WinButton.cc,v 1.16 2003/10/31 19:32:40 rathnor Exp $
23 23
24#include "WinButton.hh" 24#include "WinButton.hh"
25#include "App.hh" 25#include "App.hh"
@@ -50,6 +50,10 @@ void WinButton::buttonReleaseEvent(XButtonEvent &event) {
50void WinButton::drawType() { 50void WinButton::drawType() {
51 bool used = false; 51 bool used = false;
52 52
53 // if it's odd and we're centring, we need to add one
54 int oddW = width()%2;
55 int oddH = height()%2;
56
53 switch (m_type) { 57 switch (m_type) {
54 case MAXIMIZE: 58 case MAXIMIZE:
55 59
@@ -177,14 +181,15 @@ void WinButton::drawType() {
177 if (used) 181 if (used)
178 FbTk::FbWindow::clear(); 182 FbTk::FbWindow::clear();
179 else if (gc() != 0) { 183 else if (gc() != 0) {
184 // width/4 != width/2, so we use /4*2 so that it's properly centred
180 if (m_listen_to.isStuck()) { 185 if (m_listen_to.isStuck()) {
181 fillRectangle(gc(), 186 fillRectangle(gc(),
182 width()/2 - width()/4, height()/2 - height()/4, 187 width()/2 - width()/4, height()/2 - height()/4,
183 width()/2, height()/2); 188 width()/4*2 + oddW, height()/4*2 + oddH);
184 } else { 189 } else {
185 fillRectangle(gc(), 190 fillRectangle(gc(),
186 width()/2 - width()/10, height()/2 - height()/10, 191 width()/2 - width()/10, height()/2 - height()/10,
187 width()/5, height()/5); 192 width()/10*2 + oddW, height()/10*2 + oddH);
188 } 193 }
189 } 194 }
190 break; 195 break;
@@ -222,10 +227,15 @@ void WinButton::drawType() {
222 227
223 drawLine(gc(), 228 drawLine(gc(),
224 2, 2, 229 2, 2,
225 width() - 3, height() - 3); 230 width() - 2, height() - 2);
231 // I can't figure out why this second one needs a y offset of 1?????
232 // but it does - at least on my box:
233 // XFree86 Version 4.2.1.1 (Debian 4.2.1-12.1 20031003005825)
234 // (protocol Version 11, revision 0, vendor release 6600)
235
226 drawLine(gc(), 236 drawLine(gc(),
227 2, width() - 3, 237 2, height() - 3,
228 height() - 3, 2); 238 width() - 2, 1);
229 } 239 }
230 break; 240 break;
231 case SHADE: 241 case SHADE: