From 351a06655bdd7d440780b5bc5b255081c888044b Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 29 Jun 2002 23:50:04 +0000 Subject: Configureable button mappings! --- src/Screen.cc | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'src/Screen.cc') diff --git a/src/Screen.cc b/src/Screen.cc index 73dfeaf1..88cba673 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -88,6 +88,7 @@ using std::string; #include "Workspace.hh" #include "Workspacemenu.hh" #include "XAtom.hh" +#include "Input.hh" #ifndef FONT_ELEMENT_SIZE #define FONT_ELEMENT_SIZE 50 @@ -313,6 +314,7 @@ BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(bb, scrn) { // call this again just in case a window we found updates the Strut list updateAvailableArea(); + updateFocusModel(); } @@ -2170,9 +2172,10 @@ void BScreen::toggleFocusModel(FocusModel model) { if (model == SloppyFocus) { saveSloppyFocus(True); } else { + // we're cheating here to save writing the config file 3 times + resource.auto_raise = False; + resource.click_raise = False; saveSloppyFocus(False); - saveAutoRaise(False); - saveClickRaise(False); } updateFocusModel(); @@ -2181,8 +2184,31 @@ void BScreen::toggleFocusModel(FocusModel model) { void BScreen::updateFocusModel() { - std::for_each(workspacesList.begin(), workspacesList.end(), - std::mem_fun(&Workspace::updateFocusModel)); + std::for_each(iconList.begin(), iconList.end(), + std::mem_fun(&BlackboxWindow::ungrabButtons)); + std::for_each(windowList.begin(), windowList.end(), + std::mem_fun(&BlackboxWindow::ungrabButtons)); + + if (! resource.sloppy_focus) { + blackbox->getInput()->add(Button1, 0, BInput::WindowClientPress, + BInput::Raise); + blackbox->getInput()->add(Button1, 0, BInput::WindowClientPress, + BInput::Focus); + } else { + if (resource.click_raise) + blackbox->getInput()->add(Button1, 0, BInput::WindowClientPress, + BInput::Raise); + else + blackbox->getInput()->remove(Button1, 0, BInput::WindowClientPress, + BInput::Raise); + blackbox->getInput()->remove(Button1, 0, BInput::WindowClientPress, + BInput::Focus); + } + + std::for_each(iconList.begin(), iconList.end(), + std::mem_fun(&BlackboxWindow::grabButtons)); + std::for_each(windowList.begin(), windowList.end(), + std::mem_fun(&BlackboxWindow::grabButtons)); } -- cgit v1.2.3