aboutsummaryrefslogtreecommitdiff
path: root/src/FocusControl.cc
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2009-09-30 19:02:24 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2009-09-30 19:02:24 (GMT)
commit884db973bb7d11252581e7bc10ce172892986b67 (patch)
tree1888ba4418451c784af232d4526aab0cee3e4e74 /src/FocusControl.cc
parent4663a9591e08b554f82366cdd8e9075b0a6fbe55 (diff)
downloadfluxbox-884db973bb7d11252581e7bc10ce172892986b67.zip
fluxbox-884db973bb7d11252581e7bc10ce172892986b67.tar.bz2
cosmetic fixes: removed redundant ';' + some whitespaces
Diffstat (limited to 'src/FocusControl.cc')
-rw-r--r--src/FocusControl.cc64
1 files changed, 33 insertions, 31 deletions
diff --git a/src/FocusControl.cc b/src/FocusControl.cc
index 701373b..bf79d3e 100644
--- a/src/FocusControl.cc
+++ b/src/FocusControl.cc
@@ -62,20 +62,20 @@ bool doSkipWindow(const Focusable &win, const ClientPattern *pat) {
62 return false; // else don't skip 62 return false; // else don't skip
63} 63}
64 64
65}; // end anonymous namespace 65} // end anonymous namespace
66 66
67FocusControl::FocusControl(BScreen &screen): 67FocusControl::FocusControl(BScreen &screen):
68 m_screen(screen), 68 m_screen(screen),
69 m_focus_model(screen.resourceManager(), 69 m_focus_model(screen.resourceManager(),
70 CLICKFOCUS, 70 CLICKFOCUS,
71 screen.name()+".focusModel", 71 screen.name()+".focusModel",
72 screen.altName()+".FocusModel"), 72 screen.altName()+".FocusModel"),
73 m_tab_focus_model(screen.resourceManager(), 73 m_tab_focus_model(screen.resourceManager(),
74 CLICKTABFOCUS, 74 CLICKTABFOCUS,
75 screen.name()+".tabFocusModel", 75 screen.name()+".tabFocusModel",
76 screen.altName()+".TabFocusModel"), 76 screen.altName()+".TabFocusModel"),
77 m_focus_new(screen.resourceManager(), true, 77 m_focus_new(screen.resourceManager(), true,
78 screen.name()+".focusNewWindows", 78 screen.name()+".focusNewWindows",
79 screen.altName()+".FocusNewWindows"), 79 screen.altName()+".FocusNewWindows"),
80 m_focused_list(screen), m_creation_order_list(screen), 80 m_focused_list(screen), m_creation_order_list(screen),
81 m_focused_win_list(screen), m_creation_order_win_list(screen), 81 m_focused_win_list(screen), m_creation_order_win_list(screen),
@@ -85,7 +85,7 @@ FocusControl::FocusControl(BScreen &screen):
85 m_ignore_mouse_x(-1), m_ignore_mouse_y(-1) { 85 m_ignore_mouse_x(-1), m_ignore_mouse_y(-1) {
86 86
87 m_cycling_window = m_focused_list.clientList().end(); 87 m_cycling_window = m_focused_list.clientList().end();
88 88
89} 89}
90 90
91void FocusControl::cycleFocus(const FocusableList &window_list, 91void FocusControl::cycleFocus(const FocusableList &window_list,
@@ -252,7 +252,7 @@ Focusable *FocusControl::lastFocusedWindow(int workspace) {
252 if (workspace < 0 || workspace >= (int) m_screen.numberOfWorkspaces()) 252 if (workspace < 0 || workspace >= (int) m_screen.numberOfWorkspaces())
253 return m_focused_list.clientList().front(); 253 return m_focused_list.clientList().front();
254 254
255 Focusables::iterator it = m_focused_list.clientList().begin(); 255 Focusables::iterator it = m_focused_list.clientList().begin();
256 Focusables::iterator it_end = m_focused_list.clientList().end(); 256 Focusables::iterator it_end = m_focused_list.clientList().end();
257 for (; it != it_end; ++it) { 257 for (; it != it_end; ++it) {
258 if ((*it)->fbwindow() && (*it)->acceptsFocus() && 258 if ((*it)->fbwindow() && (*it)->acceptsFocus() &&
@@ -307,11 +307,11 @@ void FocusControl::dirFocus(FluxboxWindow &win, FocusDir dir) {
307 307
308 // we scan through the list looking for the window that is "closest" 308 // we scan through the list looking for the window that is "closest"
309 // in the given direction 309 // in the given direction
310 310
311 FluxboxWindow *foundwin = 0; 311 FluxboxWindow *foundwin = 0;
312 int weight = 999999, exposure = 0; // extreme values 312 int weight = 999999, exposure = 0; // extreme values
313 int borderW = win.frame().window().borderWidth(), 313 int borderW = win.frame().window().borderWidth(),
314 top = win.y() + borderW, 314 top = win.y() + borderW,
315 bottom = win.y() + win.height() + borderW, 315 bottom = win.y() + win.height() + borderW,
316 left = win.x() + borderW, 316 left = win.x() + borderW,
317 right = win.x() + win.width() + borderW; 317 right = win.x() + win.width() + borderW;
@@ -319,17 +319,17 @@ void FocusControl::dirFocus(FluxboxWindow &win, FocusDir dir) {
319 Workspace::Windows &wins = m_screen.currentWorkspace()->windowList(); 319 Workspace::Windows &wins = m_screen.currentWorkspace()->windowList();
320 Workspace::Windows::iterator it = wins.begin(); 320 Workspace::Windows::iterator it = wins.begin();
321 for (; it != wins.end(); ++it) { 321 for (; it != wins.end(); ++it) {
322 if ((*it) == &win 322 if ((*it) == &win
323 || (*it)->isIconic() 323 || (*it)->isIconic()
324 || (*it)->isFocusHidden() 324 || (*it)->isFocusHidden()
325 || !(*it)->acceptsFocus()) 325 || !(*it)->acceptsFocus())
326 continue; // skip self 326 continue; // skip self
327 327
328 // we check things against an edge, and within the bounds (draw a picture) 328 // we check things against an edge, and within the bounds (draw a picture)
329 int edge=0, upper=0, lower=0, oedge=0, oupper=0, olower=0; 329 int edge=0, upper=0, lower=0, oedge=0, oupper=0, olower=0;
330 330
331 int otop = (*it)->y() + borderW, 331 int otop = (*it)->y() + borderW,
332 // 2 * border = border on each side 332 // 2 * border = border on each side
333 obottom = (*it)->y() + (*it)->height() + borderW, 333 obottom = (*it)->y() + (*it)->height() + borderW,
334 oleft = (*it)->x() + borderW, 334 oleft = (*it)->x() + borderW,
335 // 2 * border = border on each side 335 // 2 * border = border on each side
@@ -371,7 +371,7 @@ void FocusControl::dirFocus(FluxboxWindow &win, FocusDir dir) {
371 break; 371 break;
372 } 372 }
373 373
374 if (oedge < edge) 374 if (oedge < edge)
375 continue; // not in the right direction 375 continue; // not in the right direction
376 376
377 if (olower <= upper || oupper >= lower) { 377 if (olower <= upper || oupper >= lower) {
@@ -396,7 +396,7 @@ void FocusControl::dirFocus(FluxboxWindow &win, FocusDir dir) {
396 } // else not improvement 396 } // else not improvement
397 } 397 }
398 398
399 if (foundwin) 399 if (foundwin)
400 foundwin->focus(); 400 foundwin->focus();
401 401
402} 402}
@@ -516,7 +516,7 @@ void FocusControl::revertFocus(BScreen &screen) {
516 * assumption: client has focus 516 * assumption: client has focus
517 */ 517 */
518void FocusControl::unfocusWindow(WinClient &client, 518void FocusControl::unfocusWindow(WinClient &client,
519 bool full_revert, 519 bool full_revert,
520 bool unfocus_frame) { 520 bool unfocus_frame) {
521 // go up the transient tree looking for a focusable window 521 // go up the transient tree looking for a focusable window
522 522
@@ -547,8 +547,8 @@ void FocusControl::setFocusedWindow(WinClient *client) {
547 return; 547 return;
548 548
549 BScreen *screen = client ? &client->screen() : 0; 549 BScreen *screen = client ? &client->screen() : 0;
550 BScreen *old_screen = 550 BScreen *old_screen =
551 FocusControl::focusedWindow() ? 551 FocusControl::focusedWindow() ?
552 &FocusControl::focusedWindow()->screen() : 0; 552 &FocusControl::focusedWindow()->screen() : 0;
553 553
554#ifdef DEBUG 554#ifdef DEBUG
@@ -567,10 +567,10 @@ void FocusControl::setFocusedWindow(WinClient *client) {
567 567
568 if (client && client->fbwindow() && !client->fbwindow()->isIconic()) { 568 if (client && client->fbwindow() && !client->fbwindow()->isIconic()) {
569 // screen should be ok 569 // screen should be ok
570 s_focused_fbwindow = client->fbwindow(); 570 s_focused_fbwindow = client->fbwindow();
571 s_focused_window = client; // update focused window 571 s_focused_window = client; // update focused window
572 s_expecting_focus = 0; 572 s_expecting_focus = 0;
573 s_focused_fbwindow->setCurrentClient(*client, 573 s_focused_fbwindow->setCurrentClient(*client,
574 false); // don't set inputfocus 574 false); // don't set inputfocus
575 s_focused_fbwindow->setFocusFlag(true); // set focus flag 575 s_focused_fbwindow->setFocusFlag(true); // set focus flag
576 576
@@ -604,9 +604,9 @@ std::string FbTk::Resource<FocusControl::FocusModel>::getString() const {
604template<> 604template<>
605void FbTk::Resource<FocusControl::FocusModel>:: 605void FbTk::Resource<FocusControl::FocusModel>::
606setFromString(char const *strval) { 606setFromString(char const *strval) {
607 if (strcasecmp(strval, "MouseFocus") == 0) 607 if (strcasecmp(strval, "MouseFocus") == 0)
608 m_value = FocusControl::MOUSEFOCUS; 608 m_value = FocusControl::MOUSEFOCUS;
609 else if (strcasecmp(strval, "ClickToFocus") == 0) 609 else if (strcasecmp(strval, "ClickToFocus") == 0)
610 m_value = FocusControl::CLICKFOCUS; 610 m_value = FocusControl::CLICKFOCUS;
611 else 611 else
612 setDefaultValue(); 612 setDefaultValue();
@@ -630,9 +630,11 @@ setFromString(char const *strval) {
630 630
631 if (strcasecmp(strval, "SloppyTabFocus") == 0 ) 631 if (strcasecmp(strval, "SloppyTabFocus") == 0 )
632 m_value = FocusControl::MOUSETABFOCUS; 632 m_value = FocusControl::MOUSETABFOCUS;
633 else if (strcasecmp(strval, "ClickToTabFocus") == 0) 633 else if (strcasecmp(strval, "ClickToTabFocus") == 0)
634 m_value = FocusControl::CLICKTABFOCUS; 634 m_value = FocusControl::CLICKTABFOCUS;
635 else 635 else
636 setDefaultValue(); 636 setDefaultValue();
637} 637}
638
638} // end namespace FbTk 639} // end namespace FbTk
640