aboutsummaryrefslogtreecommitdiff
path: root/src/fluxbox.cc
diff options
context:
space:
mode:
authormarkt <markt>2007-02-09 18:13:01 (GMT)
committermarkt <markt>2007-02-09 18:13:01 (GMT)
commit6fdda1a31d2417c23f5f222114d30ce6abec8b40 (patch)
tree929a0c0a5ffac232568011ef055934354f4367da /src/fluxbox.cc
parent93d8310c0c51fe1edcdfa5240f724ab6306ce92a (diff)
downloadfluxbox-6fdda1a31d2417c23f5f222114d30ce6abec8b40.zip
fluxbox-6fdda1a31d2417c23f5f222114d30ce6abec8b40.tar.bz2
added mouse bindings to the keys file
Diffstat (limited to 'src/fluxbox.cc')
-rw-r--r--src/fluxbox.cc98
1 files changed, 45 insertions, 53 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 89b37fe..7958a27 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -649,6 +649,28 @@ void Fluxbox::setupConfigFiles() {
649 if (create_init) 649 if (create_init)
650 FbTk::FileUtil::copyFile(DEFAULT_INITFILE, init_file.c_str()); 650 FbTk::FileUtil::copyFile(DEFAULT_INITFILE, init_file.c_str());
651 651
652#define CONFIG_VERSION 1
653 FbTk::Resource<int> config_version(m_resourcemanager, 0,
654 "session.configVersion", "Session.ConfigVersion");
655 if (*config_version < CONFIG_VERSION) {
656 // configs are out of date, so run fluxbox-update_configs
657
658 string commandargs = "fluxbox-update_configs -rc ";
659 commandargs += init_file;
660
661#ifdef HAVE_GETPID
662 // add the fluxbox pid so fbuc can have us reload rc if necessary
663 pid_t bpid = getpid();
664 char intbuff[64];
665 sprintf(intbuff, "%d", bpid);
666 commandargs += " -pid ";
667 commandargs += intbuff;
668#endif // HAVE_GETPID
669
670 FbCommands::ExecuteCmd fbuc(commandargs, 0);
671 fbuc.execute();
672 }
673
652} 674}
653 675
654void Fluxbox::handleEvent(XEvent * const e) { 676void Fluxbox::handleEvent(XEvent * const e) {
@@ -936,59 +958,28 @@ void Fluxbox::handleEvent(XEvent * const e) {
936} 958}
937 959
938void Fluxbox::handleButtonEvent(XButtonEvent &be) { 960void Fluxbox::handleButtonEvent(XButtonEvent &be) {
961 m_last_time = be.time;
939 962
940 switch (be.type) { 963 BScreen *screen = searchScreen(be.window);
941 case ButtonPress: { 964 if (be.type == ButtonRelease || !screen)
942 m_last_time = be.time; 965 // no bindings for this type yet
943 966 return;
944 BScreen *screen = searchScreen(be.window);
945 if (screen == 0)
946 break; // end case
947
948 screen->hideMenus();
949 967
950 // strip num/caps/scroll-lock and 968 if (be.button == 1 && !screen->isRootColormapInstalled())
951 // see if we're using any other modifier, 969 screen->imageControl().installRootColormap();
952 // if we're we shouldn't show the root menu
953 // this could happen if we're resizing aterm for instance
954 if (FbTk::KeyUtil::instance().cleanMods(be.state) != 0)
955 return;
956 970
957 if (be.button == 1) { 971 // see if we need to keep watching for key releases
958 if (! screen->isRootColormapInstalled()) 972 BScreen *old_watching_screen = m_watching_screen;
959 screen->imageControl().installRootColormap(); 973 m_watching_screen = 0;
960 // hide menus 974 if (!m_key->doAction(be.type, be.state, be.button))
961 if (screen->rootMenu().isVisible()) 975 // no command run, so could still be cycling
962 screen->rootMenu().hide(); 976 m_watching_screen = old_watching_screen;
963 if (screen->workspaceMenu().isVisible()) 977 else if (old_watching_screen &&
964 screen->workspaceMenu().hide(); 978 m_watching_screen != old_watching_screen) {
965 979 // no longer need to watch old screen, so stop cycling
966 } else if (be.button == 2) { 980 old_watching_screen->notifyReleasedKeys();
967 FbCommands::ShowWorkspaceMenuCmd cmd; 981 if (!m_watching_screen)
968 cmd.execute(); 982 XUngrabKeyboard(FbTk::App::instance()->display(), CurrentTime);
969 } else if (be.button == 3) {
970 FbCommands::ShowRootMenuCmd cmd;
971 cmd.execute();
972 } else if (screen->isDesktopWheeling() && be.button == 4) {
973 if(screen->isReverseWheeling()) {
974 screen->prevWorkspace(1);
975 } else {
976 screen->nextWorkspace(1);
977 }
978 } else if (screen->isDesktopWheeling() && be.button == 5) {
979 if(screen->isReverseWheeling()) {
980 screen->nextWorkspace(1);
981 } else {
982 screen->prevWorkspace(1);
983 }
984 }
985
986 } break;
987 case ButtonRelease:
988 m_last_time = be.time;
989 break;
990 default:
991 break;
992 } 983 }
993} 984}
994 985
@@ -1126,11 +1117,12 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
1126 case KeyPress: 1117 case KeyPress:
1127 // see if we need to keep watching for key releases 1118 // see if we need to keep watching for key releases
1128 m_watching_screen = 0; 1119 m_watching_screen = 0;
1129 if (!m_key->doAction(ke)) // could still be cycling 1120 if (!m_key->doAction(ke.type, ke.state, ke.keycode))
1121 // no command run, so could still be cycling
1130 m_watching_screen = old_watching_screen; 1122 m_watching_screen = old_watching_screen;
1131 else if (old_watching_screen && 1123 else if (old_watching_screen &&
1132 m_watching_screen != old_watching_screen) { 1124 m_watching_screen != old_watching_screen) {
1133 old_watching_screen->notifyReleasedKeys(ke); 1125 old_watching_screen->notifyReleasedKeys();
1134 if (!m_watching_screen) 1126 if (!m_watching_screen)
1135 XUngrabKeyboard(FbTk::App::instance()->display(), CurrentTime); 1127 XUngrabKeyboard(FbTk::App::instance()->display(), CurrentTime);
1136 } 1128 }
@@ -1148,7 +1140,7 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
1148 1140
1149 if ((m_watch_keyrelease & state) == 0) { 1141 if ((m_watch_keyrelease & state) == 0) {
1150 1142
1151 m_watching_screen->notifyReleasedKeys(ke); 1143 m_watching_screen->notifyReleasedKeys();
1152 XUngrabKeyboard(FbTk::App::instance()->display(), CurrentTime); 1144 XUngrabKeyboard(FbTk::App::instance()->display(), CurrentTime);
1153 1145
1154 // once they are released, we drop the watch 1146 // once they are released, we drop the watch