aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-11-12 22:04:16 (GMT)
committerfluxgen <fluxgen>2002-11-12 22:04:16 (GMT)
commit2446ed4861be407a198ac301e7af8117e1a742ae (patch)
tree7d5618c96d787d458a375cbfee55f5695bf88d78
parent4897fc22888c52ba28af48e9bc57465a86ea3d2e (diff)
downloadfluxbox-2446ed4861be407a198ac301e7af8117e1a742ae.zip
fluxbox-2446ed4861be407a198ac301e7af8117e1a742ae.tar.bz2
restored label alignment
-rw-r--r--src/Window.cc56
1 files changed, 39 insertions, 17 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 38ac8eb..0d99738 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.cc,v 1.97 2002/11/12 14:54:45 rathnor Exp $ 25// $Id: Window.cc,v 1.98 2002/11/12 22:04:16 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -225,12 +225,12 @@ tab(0) {
225 setGravityOffsets(); 225 setGravityOffsets();
226 226
227 if (! fluxbox->isStartup()) { 227 if (! fluxbox->isStartup()) {
228 #ifdef XINERAMA 228#ifdef XINERAMA
229 unsigned int head = 0; 229 unsigned int head = 0;
230 if (screen->hasXinerama()) { 230 if (screen->hasXinerama()) {
231 head = screen->getHead(frame.x, frame.y); 231 head = screen->getHead(frame.x, frame.y);
232 } 232 }
233 #endif // XINERAMA 233#endif // XINERAMA
234 234
235 int real_x = frame.x; 235 int real_x = frame.x;
236 int real_y = frame.y; 236 int real_y = frame.y;
@@ -245,7 +245,7 @@ tab(0) {
245 } 245 }
246 } 246 }
247 247
248 #ifdef XINERAMA 248#ifdef XINERAMA
249 // check is within the current head, so it won't overlap heads 249 // check is within the current head, so it won't overlap heads
250 if (real_x >= screen->getHeadX(head) && 250 if (real_x >= screen->getHeadX(head) &&
251 real_y + frame.y_border >= screen->getHeadY(head) && 251 real_y + frame.y_border >= screen->getHeadY(head) &&
@@ -254,13 +254,13 @@ tab(0) {
254 (real_y + frame.height) <= 254 (real_y + frame.height) <=
255 (screen->getHeadY(head) + screen->getHeadHeight(head)) ) 255 (screen->getHeadY(head) + screen->getHeadHeight(head)) )
256 place_window = false; 256 place_window = false;
257 #else // !XINERAMA 257#else // !XINERAMA
258 if (real_x >= 0 && 258 if (real_x >= 0 &&
259 real_y + frame.y_border >= 0 && 259 real_y + frame.y_border >= 0 &&
260 real_x <= (signed) screen->getWidth() && 260 real_x <= (signed) screen->getWidth() &&
261 real_y <= (signed) screen->getHeight()) 261 real_y <= (signed) screen->getHeight())
262 place_window = false; 262 place_window = false;
263 #endif // XIENRAMA 263#endif // XIENRAMA
264 264
265 } else 265 } else
266 place_window = false; 266 place_window = false;
@@ -1168,7 +1168,7 @@ void FluxboxWindow::getWMHints() {
1168 } else { 1168 } else {
1169 client.wm_hint_flags = wmhint->flags; 1169 client.wm_hint_flags = wmhint->flags;
1170 if (wmhint->flags & InputHint) { 1170 if (wmhint->flags & InputHint) {
1171 if (wmhint->input == true) { 1171 if (wmhint->input) {
1172 if (send_focus_message) 1172 if (send_focus_message)
1173 focus_mode = F_LOCALLYACTIVE; 1173 focus_mode = F_LOCALLYACTIVE;
1174 else 1174 else
@@ -1504,6 +1504,7 @@ bool FluxboxWindow::setInputFocus() {
1504 } else { 1504 } else {
1505 return false; 1505 return false;
1506 } 1506 }
1507
1507 Fluxbox *fb = Fluxbox::instance(); 1508 Fluxbox *fb = Fluxbox::instance();
1508 fb->setFocusedWindow(this); 1509 fb->setFocusedWindow(this);
1509 1510
@@ -2423,12 +2424,32 @@ void FluxboxWindow::redrawLabel() {
2423 if (getTitle().size() != 0) { 2424 if (getTitle().size() != 0) {
2424 GC gc = ((focused) ? screen->getWindowStyle()->l_text_focus_gc : 2425 GC gc = ((focused) ? screen->getWindowStyle()->l_text_focus_gc :
2425 screen->getWindowStyle()->l_text_unfocus_gc); 2426 screen->getWindowStyle()->l_text_unfocus_gc);
2426 screen->getWindowStyle()->font.drawText( 2427 unsigned int l = client.title_text_w;
2428 int dlen = getTitle().size();
2429 int dx = frame.bevel_w;
2430 FbTk::Font &font = screen->getWindowStyle()->font;
2431 if (l > frame.label_w) {
2432 for (; dlen >= 0; dlen--) {
2433 l = font.textWidth(getTitle().c_str(), dlen) + frame.bevel_w*4;
2434 if (l < frame.label_w)
2435 break;
2436 }
2437 }
2438 switch (screen->getWindowStyle()->justify) {
2439 case DrawUtil::Font::RIGHT:
2440 dx += frame.label_w - l;
2441 break;
2442 case DrawUtil::Font::CENTER:
2443 dx += (frame.label_w - l)/2;
2444 break;
2445 }
2446
2447 font.drawText(
2427 frame.label, 2448 frame.label,
2428 screen->getScreenNumber(), 2449 screen->getScreenNumber(),
2429 gc, 2450 gc,
2430 getTitle().c_str(), getTitle().size(), 2451 getTitle().c_str(), getTitle().size(),
2431 frame.bevel_w, frame.bevel_w/2 + screen->getWindowStyle()->font.ascent()); 2452 dx, screen->getWindowStyle()->font.ascent() + 1);
2432 } 2453 }
2433} 2454}
2434 2455
@@ -2441,15 +2462,16 @@ void FluxboxWindow::redrawAllButtons() {
2441} 2462}
2442 2463
2443void FluxboxWindow::mapRequestEvent(XMapRequestEvent *re) { 2464void FluxboxWindow::mapRequestEvent(XMapRequestEvent *re) {
2444 if (re->window != client.window)
2445 return;
2446#ifdef DEBUG 2465#ifdef DEBUG
2447 fprintf(stderr, 2466 fprintf(stderr,
2448 I18n::instance()->getMessage( 2467 I18n::instance()->getMessage(
2449 FBNLS::WindowSet, FBNLS::WindowMapRequest, 2468 FBNLS::WindowSet, FBNLS::WindowMapRequest,
2450 "FluxboxWindow::mapRequestEvent() for 0x%lx\n"), 2469 "FluxboxWindow::mapRequestEvent() for 0x%lx\n"),
2451 client.window); 2470 client.window);
2452#endif // DEBUG 2471#endif // DEBUG
2472 if (re->window != client.window)
2473 return;
2474
2453 Fluxbox *fluxbox = Fluxbox::instance(); 2475 Fluxbox *fluxbox = Fluxbox::instance();
2454 fluxbox->grab(); 2476 fluxbox->grab();
2455 if (! validateClient()) 2477 if (! validateClient())
@@ -2787,7 +2809,7 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent *be) {
2787 if (be->window == buttonlist[i].win && buttonlist[i].draw) 2809 if (be->window == buttonlist[i].win && buttonlist[i].draw)
2788 buttonlist[i].draw(this, be->window, true); 2810 buttonlist[i].draw(this, be->window, true);
2789 } 2811 }
2790 2812
2791 if (frame.plate == be->window) { 2813 if (frame.plate == be->window) {
2792 2814
2793 if (m_windowmenu.get() && m_windowmenu->isVisible()) //hide menu if its visible 2815 if (m_windowmenu.get() && m_windowmenu->isVisible()) //hide menu if its visible