diff options
Diffstat (limited to 'src/Workspace.cc')
-rw-r--r-- | src/Workspace.cc | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc index 48b0d67..676c907 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "Window.hh" | 40 | #include "Window.hh" |
41 | #include "Workspace.hh" | 41 | #include "Workspace.hh" |
42 | #include "Windowmenu.hh" | 42 | #include "Windowmenu.hh" |
43 | #include "StringUtil.hh" | ||
43 | 44 | ||
44 | #ifdef HAVE_STDIO_H | 45 | #ifdef HAVE_STDIO_H |
45 | # include <stdio.h> | 46 | # include <stdio.h> |
@@ -49,10 +50,6 @@ | |||
49 | # include <string.h> | 50 | # include <string.h> |
50 | #endif // STDC_HEADERS | 51 | #endif // STDC_HEADERS |
51 | 52 | ||
52 | #define MIN(x,y) ((x < y) ? x : y) | ||
53 | #define MAX(x,y) ((x > y) ? x : y) | ||
54 | |||
55 | |||
56 | Workspace::Workspace(BScreen *scrn, int i) { | 53 | Workspace::Workspace(BScreen *scrn, int i) { |
57 | screen = scrn; | 54 | screen = scrn; |
58 | 55 | ||
@@ -309,7 +306,7 @@ void Workspace::setName(char *new_name) { | |||
309 | delete [] name; | 306 | delete [] name; |
310 | 307 | ||
311 | if (new_name) { | 308 | if (new_name) { |
312 | name = bstrdup(new_name); | 309 | name = StringUtil::strdup(new_name); |
313 | } else { | 310 | } else { |
314 | name = new char[128]; | 311 | name = new char[128]; |
315 | sprintf(name, I18n::instance()-> | 312 | sprintf(name, I18n::instance()-> |
@@ -358,27 +355,27 @@ void Workspace::placeWindow(FluxboxWindow *win) { | |||
358 | (screen->getBorderWidth2x() * 2), | 355 | (screen->getBorderWidth2x() * 2), |
359 | place_x = 0, place_y = 0, change_x = 1, change_y = 1; | 356 | place_x = 0, place_y = 0, change_x = 1, change_y = 1; |
360 | 357 | ||
361 | if (screen->getColPlacementDirection() == BScreen::BottomTop) | 358 | if (screen->getColPlacementDirection() == BScreen::BOTTOMTOP) |
362 | change_y = -1; | 359 | change_y = -1; |
363 | if (screen->getRowPlacementDirection() == BScreen::RightLeft) | 360 | if (screen->getRowPlacementDirection() == BScreen::RIGHTLEFT) |
364 | change_x = -1; | 361 | change_x = -1; |
365 | 362 | ||
366 | register int test_x, test_y, curr_w, curr_h; | 363 | register int test_x, test_y, curr_w, curr_h; |
367 | 364 | ||
368 | switch (screen->getPlacementPolicy()) { | 365 | switch (screen->getPlacementPolicy()) { |
369 | case BScreen::RowSmartPlacement: { | 366 | case BScreen::ROWSMARTPLACEMENT: { |
370 | test_y = screen->getBorderWidth() + screen->getEdgeSnapThreshold(); | 367 | test_y = screen->getBorderWidth() + screen->getEdgeSnapThreshold(); |
371 | if (screen->getColPlacementDirection() == BScreen::BottomTop) | 368 | if (screen->getColPlacementDirection() == BScreen::BOTTOMTOP) |
372 | test_y = screen->getHeight() - win_h - test_y; | 369 | test_y = screen->getHeight() - win_h - test_y; |
373 | 370 | ||
374 | while (((screen->getColPlacementDirection() == BScreen::BottomTop) ? | 371 | while (((screen->getColPlacementDirection() == BScreen::BOTTOMTOP) ? |
375 | test_y > 0 : test_y + win_h < (signed) screen->getHeight()) && | 372 | test_y > 0 : test_y + win_h < (signed) screen->getHeight()) && |
376 | ! placed) { | 373 | ! placed) { |
377 | test_x = screen->getBorderWidth() + screen->getEdgeSnapThreshold(); | 374 | test_x = screen->getBorderWidth() + screen->getEdgeSnapThreshold(); |
378 | if (screen->getRowPlacementDirection() == BScreen::RightLeft) | 375 | if (screen->getRowPlacementDirection() == BScreen::RIGHTLEFT) |
379 | test_x = screen->getWidth() - win_w - test_x; | 376 | test_x = screen->getWidth() - win_w - test_x; |
380 | 377 | ||
381 | while (((screen->getRowPlacementDirection() == BScreen::RightLeft) ? | 378 | while (((screen->getRowPlacementDirection() == BScreen::RIGHTLEFT) ? |
382 | test_x > 0 : test_x + win_w < (signed) screen->getWidth()) && | 379 | test_x > 0 : test_x + win_w < (signed) screen->getWidth()) && |
383 | ! placed) { | 380 | ! placed) { |
384 | placed = True; | 381 | placed = True; |
@@ -428,19 +425,19 @@ void Workspace::placeWindow(FluxboxWindow *win) { | |||
428 | 425 | ||
429 | break; } | 426 | break; } |
430 | 427 | ||
431 | case BScreen::ColSmartPlacement: { | 428 | case BScreen::COLSMARTPLACEMENT: { |
432 | test_x = screen->getBorderWidth() + screen->getEdgeSnapThreshold(); | 429 | test_x = screen->getBorderWidth() + screen->getEdgeSnapThreshold(); |
433 | if (screen->getRowPlacementDirection() == BScreen::RightLeft) | 430 | if (screen->getRowPlacementDirection() == BScreen::RIGHTLEFT) |
434 | test_x = screen->getWidth() - win_w - test_x; | 431 | test_x = screen->getWidth() - win_w - test_x; |
435 | 432 | ||
436 | while (((screen->getRowPlacementDirection() == BScreen::RightLeft) ? | 433 | while (((screen->getRowPlacementDirection() == BScreen::RIGHTLEFT) ? |
437 | test_x > 0 : test_x + win_w < (signed) screen->getWidth()) && | 434 | test_x > 0 : test_x + win_w < (signed) screen->getWidth()) && |
438 | ! placed) { | 435 | ! placed) { |
439 | test_y = screen->getBorderWidth() + screen->getEdgeSnapThreshold(); | 436 | test_y = screen->getBorderWidth() + screen->getEdgeSnapThreshold(); |
440 | if (screen->getColPlacementDirection() == BScreen::BottomTop) | 437 | if (screen->getColPlacementDirection() == BScreen::BOTTOMTOP) |
441 | test_y = screen->getHeight() - win_h - test_y; | 438 | test_y = screen->getHeight() - win_h - test_y; |
442 | 439 | ||
443 | while (((screen->getColPlacementDirection() == BScreen::BottomTop) ? | 440 | while (((screen->getColPlacementDirection() == BScreen::BOTTOMTOP) ? |
444 | test_y > 0 : test_y + win_h < (signed) screen->getHeight()) && | 441 | test_y > 0 : test_y + win_h < (signed) screen->getHeight()) && |
445 | ! placed) { | 442 | ! placed) { |
446 | placed = True; | 443 | placed = True; |