From c6a2605d76927eed881e4ff9df58a9ec600bf4a2 Mon Sep 17 00:00:00 2001 From: markt Date: Mon, 22 Oct 2007 17:45:39 +0000 Subject: [PATCH] replaced ModKey with new key commands StartMoving and StartResizing --- ChangeLog | 9 ++++ data/init.in | 2 +- data/keys | 3 ++ doc/asciidoc/fluxbox.txt | 11 ----- src/CurrentWindowCmd.cc | 20 +++++++++ src/CurrentWindowCmd.hh | 21 +++++++++- src/FbCommandFactory.cc | 45 +++++++++++++++----- src/FbCommands.cc | 9 ---- src/FbCommands.hh | 8 ---- src/Screen.cc | 1 - src/Screen.hh | 11 ----- src/ScreenResources.cc | 27 ------------ src/Window.cc | 77 ++++++++++++++-------------------- src/Window.hh | 18 ++++++++ src/fluxbox.cc | 22 +--------- src/fluxbox.hh | 4 -- util/fluxbox-update_configs.cc | 32 ++++++++++++++ 17 files changed, 169 insertions(+), 151 deletions(-) diff --git a/ChangeLog b/ChangeLog index 646720bb..0644aad6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ (Format: Year/Month/Day) Changes for 1.0.1: +*07/10/22: + * Replaced modKey with new commands StartMoving and StartResizing (Mark) + - your keys file should be updated automatically + - they must be used with a mouse button, or they won't work + - StartResizing takes one or none of the following arguments: + NearestCorner, Center, TopLeft, TopRight, BottomLeft, BottomRight + Window.cc/hh CurrentWindowCmd.cc/hh FbCommandFactory.cc Screen.cc/hh + fluxbox.cc/hh ScreenResources.cc FbCommands.cc/hh + util/fluxbox-update_configs.cc *07/10/21: * Allow decorations bitmask to be specified using '0x' (Mark) Window.cc diff --git a/data/init.in b/data/init.in index 5ad9aa3d..10727c30 100644 --- a/data/init.in +++ b/data/init.in @@ -31,4 +31,4 @@ session.colorsPerChannel: 4 session.doubleClickInterval: 250 session.cacheMax: 200 session.imageDither: True -session.configVersion: 3 +session.configVersion: 4 diff --git a/data/keys b/data/keys index 603e15c0..85d1f719 100644 --- a/data/keys +++ b/data/keys @@ -7,6 +7,9 @@ OnDesktop Mouse5 :PrevWorkspace OnToolbar Mouse4 :NextWorkspace OnToolbar Mouse5 :PrevWorkspace +OnWindow Mod1 Mouse1 :StartMoving +OnWindow Mod1 Mouse3 :StartResizing + Mod1 Tab :NextWindow Mod1 Shift Tab :PrevWindow Mod1 F1 :Workspace 1 diff --git a/doc/asciidoc/fluxbox.txt b/doc/asciidoc/fluxbox.txt index 0b11dad5..5e4cf071 100644 --- a/doc/asciidoc/fluxbox.txt +++ b/doc/asciidoc/fluxbox.txt @@ -848,11 +848,6 @@ session.screen0.followModel: be focused. `Ignore' does nothing, and `Follow' uses the setting in session.screen0.userFollowModel. Default: Ignore -session.screen0.resizeMode: Bottom|Quadrant|Center - Setting this resource to `Quadrant' makes resizing by using the modkey - grab the corner closest to the mouse pointer instead of the bottom right - corner. `Center' resizes all corners at the same time. Default: Bottom - session.screen0.focusModel: ClickToFocus|MouseFocus This controls how windows gain focus via the mouse. With `ClickToFocus', the user must click on the window. With `MouseFocus', windows gain focus @@ -1018,11 +1013,6 @@ session.titlebar.right: Minimize Maximize Close The icons to place in the titlebar of decorated windows. The available options are Close, Maximize, MenuIcon, Minimize, Shade, and Stick. -session.modKey: - This specifies a modifier to use to drag and resize windows without - clicking on the border or titlebar. For example, Alt + Left click will - move windows, and Alt + Right click will resize. Default: Mod1 - ................................................................................ @@ -1163,7 +1153,6 @@ Special Commands - SetResourceValue value - BindKey : - KeyMode -- SetModKey Couple of things ~~~~~~~~~~~~~~~~ diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index 01b8de7e..885f4b0c 100644 --- a/src/CurrentWindowCmd.cc +++ b/src/CurrentWindowCmd.cc @@ -115,6 +115,26 @@ void GoToTabCmd::real_execute() { (*it)->focus(); } +void StartMovingCmd::real_execute() { + const XEvent &last = Fluxbox::instance()->lastEvent(); + if (last.type == ButtonPress) { + const XButtonEvent &be = last.xbutton; + fbwindow().startMoving(be.x_root, be.y_root); + } +} + +void StartResizingCmd::real_execute() { + const XEvent &last = Fluxbox::instance()->lastEvent(); + if (last.type == ButtonPress) { + const XButtonEvent &be = last.xbutton; + int x = be.x_root - fbwindow().x() + - fbwindow().frame().window().borderWidth(); + int y = be.y_root - fbwindow().y() + - fbwindow().frame().window().borderWidth(); + fbwindow().startResizing(x, y, fbwindow().getResizeDirection(x, y, m_mode)); + } +} + MoveCmd::MoveCmd(const int step_size_x, const int step_size_y) : m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh index da929d58..53dc7b8b 100644 --- a/src/CurrentWindowCmd.hh +++ b/src/CurrentWindowCmd.hh @@ -26,8 +26,7 @@ #define CURRENTWINDOWCMD_HH #include "Command.hh" - -class FluxboxWindow; +#include "Window.hh" /// helper class for window commands /// calls real_execute if there's a focused window or a window in button press/release window @@ -131,6 +130,24 @@ private: const int m_tab_num; }; +// begin moving with mouse +class StartMovingCmd: public WindowHelperCmd { +public: + StartMovingCmd() { } +protected: + void real_execute(); +}; + +// begin resizing with mouse +class StartResizingCmd: public WindowHelperCmd { +public: + explicit StartResizingCmd(FluxboxWindow::ResizeModel mode):m_mode(mode) { } +protected: + void real_execute(); +private: + const FluxboxWindow::ResizeModel m_mode; +}; + // move cmd, relative position class MoveCmd: public WindowHelperCmd { public: diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc index bf008ad8..be37403c 100644 --- a/src/FbCommandFactory.cc +++ b/src/FbCommandFactory.cc @@ -158,7 +158,6 @@ FbCommandFactory::FbCommandFactory() { "setalpha", "setenv", "sethead", - "setmodkey", "setstyle", "setworkspacename", "setworkspacenamedialog", @@ -167,6 +166,8 @@ FbCommandFactory::FbCommandFactory() { "shade", "shadewindow", "showdesktop", + "startmoving", + "startresizing", "stick", "stickwindow", "tab", @@ -235,15 +236,7 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, string value = name.substr(pos + 1); name = name.substr(0, pos); return new ExportCmd(name, value); - } - else if (command == "setmodkey") { - string modkey(arguments); - FbTk::StringUtil::removeFirstWhitespace(modkey); - FbTk::StringUtil::removeTrailingWhitespace(modkey); - - return new SetModKeyCmd(modkey); - } - else if (command == "commanddialog") // run specified fluxbox command + } else if (command == "commanddialog") // run specified fluxbox command return new CommandDialogCmd(); else if (command == "bindkey" && trusted) return new BindKeyCmd(arguments); @@ -307,6 +300,38 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, pat = arguments.c_str() + pos; return new WindowListCmd(FbTk::RefCount(new SetAlphaCmd(focused, relative, unfocused, un_rel)), pat); + } else if (command == "startmoving") + return new StartMovingCmd(); + else if (command == "startresizing") { + FluxboxWindow::ResizeModel mode = FluxboxWindow::DEFAULTRESIZE; + vector tokens; + FbTk::StringUtil::stringtok >(tokens, arguments); + if (!tokens.empty()) { + string arg = FbTk::StringUtil::toLower(tokens[0]); + if (arg == "nearestcorner") + mode = FluxboxWindow::QUADRANTRESIZE; + else if (arg == "nearestedge") + mode = FluxboxWindow::NEARESTEDGERESIZE; + else if (arg == "center") + mode = FluxboxWindow::CENTERRESIZE; + else if (arg == "topleft") + mode = FluxboxWindow::TOPLEFTRESIZE; + else if (arg == "top") + mode = FluxboxWindow::TOPRESIZE; + else if (arg == "topright") + mode = FluxboxWindow::TOPRIGHTRESIZE; + else if (arg == "left") + mode = FluxboxWindow::LEFTRESIZE; + else if (arg == "right") + mode = FluxboxWindow::RIGHTRESIZE; + else if (arg == "bottomleft") + mode = FluxboxWindow::BOTTOMLEFTRESIZE; + else if (arg == "bottom") + mode = FluxboxWindow::BOTTOMRESIZE; + else if (arg == "bottomright") + mode = FluxboxWindow::BOTTOMRIGHTRESIZE; + } + return new StartResizingCmd(mode); } else if (command == "resize" || command == "resizeto" || command == "resizehorizontal" || command == "resizevertical") { FbTk_istringstream is(arguments.c_str()); diff --git a/src/FbCommands.cc b/src/FbCommands.cc index f536fd8e..1d063e73 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.cc @@ -169,15 +169,6 @@ int ExecuteCmd::run() { return pid; // compiler happy -> we are happy ;) } -SetModKeyCmd::SetModKeyCmd(const string& modkey) : m_modkey(modkey) { } - -void SetModKeyCmd::execute() { - Fluxbox::instance()->setModKey(m_modkey.c_str()); - Fluxbox::instance()->save_rc(); - // TODO: we need a better way to do this ... - Fluxbox::instance()->reconfigure(); -} - ExportCmd::ExportCmd(const string& name, const string& value) : m_name(name), m_value(value) { } diff --git a/src/FbCommands.hh b/src/FbCommands.hh index a049a7ce..c563899e 100644 --- a/src/FbCommands.hh +++ b/src/FbCommands.hh @@ -101,14 +101,6 @@ private: std::string m_filename; }; -class SetModKeyCmd: public FbTk::Command { -public: - explicit SetModKeyCmd(const std::string& modkey); - void execute(); -private: - std::string m_modkey; -}; - class KeyModeCmd: public FbTk::Command { public: explicit KeyModeCmd(const std::string &arguments); diff --git a/src/Screen.cc b/src/Screen.cc index 5549ca58..e6681e68 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -297,7 +297,6 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm, decorate_transient(rm, true, scrname+".decorateTransient", altscrname+".DecorateTransient"), default_deco(rm, "NORMAL", scrname+".defaultDeco", altscrname+".DefaultDeco"), rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"), - resize_model(rm, BOTTOMRESIZE, scrname+".resizeMode", altscrname+".ResizeMode"), tab_placement(rm, FbWinFrame::TOPLEFT, scrname+".tab.placement", altscrname+".Tab.Placement"), windowmenufile(rm, "", scrname+".windowMenu", altscrname+".WindowMenu"), typing_delay(rm, 0, scrname+".noFocusWhileTypingDelay", altscrname+".NoFocusWhileTypingDelay"), diff --git a/src/Screen.hh b/src/Screen.hh index a094bac1..09865e61 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -92,14 +92,6 @@ public: FETCH_ACTIVE_WINDOW ///< put that window to the current workspace }; - /// Different resize modes when resizing a window - enum ResizeModel { - BOTTOMRESIZE = 0, ///< resizes from the bottom right corner - QUADRANTRESIZE, ///< resizes from one quadrant - CENTERRESIZE, ///< resizes from center - DEFAULTRESIZE = BOTTOMRESIZE ///< default resize mode is bottom - }; - typedef std::list Icons; @@ -142,8 +134,6 @@ public: FbWinFrame::TabPlacement getTabPlacement() const { return *resource.tab_placement; } - ResizeModel getResizeModel() const { return *resource.resize_model; } - inline unsigned int noFocusWhileTypingDelay() const { return *resource.typing_delay; } inline FollowModel getFollowModel() const { return *resource.follow_model; } inline FollowModel getUserFollowModel() const { return *resource.user_follow_model; } @@ -561,7 +551,6 @@ private: decorate_transient; FbTk::Resource default_deco; FbTk::Resource rootcommand; - FbTk::Resource resize_model; FbTk::Resource tab_placement; FbTk::Resource windowmenufile; FbTk::Resource typing_delay; diff --git a/src/ScreenResources.cc b/src/ScreenResources.cc index e4d712a7..c346c128 100644 --- a/src/ScreenResources.cc +++ b/src/ScreenResources.cc @@ -58,33 +58,6 @@ void FbTk::Resource::setFromString(const char *str) { setDefaultValue(); } -template <> -string FbTk::Resource::getString() const { - switch (m_value) { - case BScreen::QUADRANTRESIZE: - return string("Quadrant"); - case BScreen::BOTTOMRESIZE: - return string("Bottom"); - case BScreen::CENTERRESIZE: - return string("Center"); - } - - return string("Default"); -} - -template<> -void FbTk::Resource:: -setFromString(char const *strval) { - if (strcasecmp(strval, "Bottom") == 0) { - m_value = BScreen::BOTTOMRESIZE; - } else if (strcasecmp(strval, "Quadrant") == 0) { - m_value = BScreen::QUADRANTRESIZE; - } else if (strcasecmp(strval, "Center") == 0) { - m_value = BScreen::CENTERRESIZE; - } else - m_value = BScreen::DEFAULTRESIZE; -} - template<> string FbTk::Resource::getString() const { switch (m_value) { diff --git a/src/Window.cc b/src/Window.cc index 9a3d3671..dbd945f7 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -1039,20 +1039,6 @@ void FluxboxWindow::grabButtons() { XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame().window().window()); - unsigned int modkey = Fluxbox::instance()->getModKey(); - - if (modkey) { - //----grab with "all" modifiers - FbTk::KeyUtil::grabButton(Button1, modkey, frame().window().window(), - ButtonReleaseMask | ButtonMotionMask, frame().theme().moveCursor()); - - XGrabButton(display, Button2, modkey, frame().window().window(), True, - ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None); - - //---grab with "all" modifiers - FbTk::KeyUtil::grabButton(Button3, modkey, frame().window().window(), - ButtonReleaseMask | ButtonMotionMask); - } } @@ -2592,8 +2578,7 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { // check frame events first frame().buttonPressEvent(be); - if (be.button == 1 || (be.button == 3 && - be.state == Fluxbox::instance()->getModKey())) { + if (be.button == 1) { if (!m_focused) //check focus focus(); @@ -2618,28 +2603,14 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) { - if ((re.button == 1) && (re.state & Fluxbox::instance()->getModKey()) - && !screen().clickRaises()) { - - if (!isMoving()) - raise(); - - } - if (isMoving()) stopMoving(); else if (isResizing()) stopResizing(); else if (m_attaching_tab) attachTo(re.x_root, re.y_root); - else if (re.window == frame().window()) { - if (re.button == 2 && re.state == Fluxbox::instance()->getModKey()) - ungrabPointer(CurrentTime); - else - frame().buttonReleaseEvent(re); - } else { + else frame().buttonReleaseEvent(re); - } } @@ -2654,9 +2625,8 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { || frame().handle() == me.window || frame().window() == me.window); - if (Fluxbox::instance()->getIgnoreBorder() - && !(me.state & Fluxbox::instance()->getModKey()) // really should check for exact matches - && !(isMoving() || isResizing() || m_attaching_tab != 0)) { + if (Fluxbox::instance()->getIgnoreBorder() && m_attaching_tab == 0 + && !(isMoving() || isResizing())) { int borderw = frame().window().borderWidth(); //!! TODO(tabs): the below test ought to be in FbWinFrame // if mouse is currently on the window border, ignore it @@ -2787,23 +2757,13 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { if (! resizing) { - int cx = frame().width() / 2; - int cy = frame().height() / 2; ResizeDirection resize_corner = RIGHTBOTTOM; if (me.window == frame().gripRight()) resize_corner = RIGHTBOTTOM; else if (me.window == frame().gripLeft()) resize_corner = LEFTBOTTOM; - else if (screen().getResizeModel() != BScreen::QUADRANTRESIZE) { - if (screen().getResizeModel() == BScreen::CENTERRESIZE) - resize_corner = ALLCORNERS; - else - resize_corner = RIGHTBOTTOM; - } else if (me.x < cx) - resize_corner = (me.y < cy) ? LEFTTOP : LEFTBOTTOM; - else - resize_corner = (me.y < cy) ? RIGHTTOP : RIGHTBOTTOM; - + else // dragging border of window, so choose nearest corner + resize_corner = getResizeDirection(me.x, me.y, QUADRANTRESIZE); // We are grabbing frame window in startResizing // we need to translate coordinates to it. @@ -3404,6 +3364,31 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) { } +FluxboxWindow::ResizeDirection FluxboxWindow::getResizeDirection(int x, int y, + ResizeModel model) { + int cx = frame().width() / 2; + int cy = frame().height() / 2; + if (model == CENTERRESIZE) + return ALLCORNERS; + if (model == NEARESTEDGERESIZE) { + if (abs(cy - abs(y - cy)) > abs(cx - abs(x - cx))) // y is nearest + return (y > cy) ? BOTTOM : TOP; + return (x > cx) ? RIGHT : LEFT; + } + if (model == QUADRANTRESIZE) { + if (x < cx) + return (y < cy) ? LEFTTOP : LEFTBOTTOM; + return (y < cy) ? RIGHTTOP : RIGHTBOTTOM; + } + if (model == TOPLEFTRESIZE) return LEFTTOP; + if (model == TOPRESIZE) return TOP; + if (model == TOPRIGHTRESIZE) return RIGHTTOP; + if (model == LEFTRESIZE) return LEFT; + if (model == RIGHTRESIZE) return RIGHT; + if (model == BOTTOMLEFTRESIZE) return LEFTBOTTOM; + if (model == BOTTOMRESIZE) return BOTTOM; + return RIGHTBOTTOM; +} void FluxboxWindow::startResizing(int x, int y, ResizeDirection dir) { diff --git a/src/Window.hh b/src/Window.hh index 3a87463c..6fb258a1 100644 --- a/src/Window.hh +++ b/src/Window.hh @@ -137,6 +137,22 @@ public: DECOR_TAB = DECORM_BORDER|DECORM_MENU|DECORM_TAB }; + /// Different resize modes when resizing a window + enum ResizeModel { + QUADRANTRESIZE, ///< resizes from one quadrant + CENTERRESIZE, ///< resizes from center + NEARESTEDGERESIZE, ///< resizes the nearest edge + TOPLEFTRESIZE, ///< resizes top left corner + TOPRESIZE, ///< resizes top edge + TOPRIGHTRESIZE, ///< resizes top right corner + LEFTRESIZE, ///< resizes left edge + RIGHTRESIZE, ///< resizes right edge + BOTTOMLEFTRESIZE, ///< resizes bottom left corner + BOTTOMRESIZE, ///< resizes bottom edge + BOTTOMRIGHTRESIZE, ///< resizes bottom right corner + DEFAULTRESIZE = BOTTOMRIGHTRESIZE ///< default resize mode + }; + /** * Resize direction while resizing */ @@ -369,6 +385,8 @@ public: * @param dir the resize direction */ void startResizing(int x, int y, ResizeDirection dir); + /// determine which edge or corner to resize + ResizeDirection getResizeDirection(int x, int y, ResizeModel model); /// stops the resizing void stopResizing(bool interrupted = false); diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 80d055b9..058c858b 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -211,7 +211,6 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"), m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"), m_rc_auto_raise_delay(m_resourcemanager, 250, "session.autoRaiseDelay", "Session.AutoRaiseDelay"), - m_rc_mod_key(m_resourcemanager, "Mod1", "session.modKey", "Session.ModKey"), m_masked_window(0), m_mousescreen(0), m_keyscreen(0), @@ -643,7 +642,7 @@ void Fluxbox::setupConfigFiles() { if (create_init) FbTk::FileUtil::copyFile(DEFAULT_INITFILE, init_file.c_str()); -#define CONFIG_VERSION 3 +#define CONFIG_VERSION 4 FbTk::Resource config_version(m_resourcemanager, 0, "session.configVersion", "Session.ConfigVersion"); if (*config_version < CONFIG_VERSION) { @@ -1707,22 +1706,3 @@ void Fluxbox::updateFrameExtents(FluxboxWindow &win) { (*it).first->updateFrameExtents(win); } } - -unsigned int Fluxbox::getModKey() const { - if (!(m_rc_mod_key->c_str())) - return 0; - else - return FbTk::KeyUtil::instance().getModifier(m_rc_mod_key->c_str()); -} - -void Fluxbox::setModKey(const char* modkeyname) { - - if (!modkeyname) - return; - - unsigned int modkey = FbTk::KeyUtil::instance().getModifier(modkeyname); - - if (modkey > 0) { - m_rc_mod_key = modkeyname; - } -} diff --git a/src/fluxbox.hh b/src/fluxbox.hh index 625a9062..82ff76d5 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh @@ -135,9 +135,6 @@ public: unsigned int getCacheMax() const { return *m_rc_cache_max; } - unsigned int getModKey() const; - void setModKey(const char*); - void maskWindowEvents(Window w, FluxboxWindow *bw) { m_masked = w; m_masked_window = bw; } @@ -246,7 +243,6 @@ private: FbTk::Resource m_rc_tabs_attach_area; FbTk::Resource m_rc_cache_life, m_rc_cache_max; FbTk::Resource m_rc_auto_raise_delay; - FbTk::Resource m_rc_mod_key; typedef std::map WinClientMap; WinClientMap m_window_search; diff --git a/util/fluxbox-update_configs.cc b/util/fluxbox-update_configs.cc index 2dc5eb69..27c8b48d 100644 --- a/util/fluxbox-update_configs.cc +++ b/util/fluxbox-update_configs.cc @@ -182,6 +182,38 @@ int run_updates(int old_version, FbTk::ResourceManager rm) { new_version = 3; } + if (old_version < 4) { // move modkey to keys file + string whole_keyfile = read_file(keyfilename); + string new_keyfile = ""; + // let's put our new keybindings first, so they're easy to find + new_keyfile += "!mouse actions added by fluxbox-update_configs\n"; + + // need to match user's resize model + FbTk::Resource rc_mode(rm, "Bottom", + "session.screen0.resizeMode", + "Session.Screen0.ResizeMode"); + FbTk::Resource rc_modkey(rm, "Mod1", + "session.modKey", + "Session.ModKey"); + + new_keyfile += "OnWindow " + *rc_modkey + " Mouse1 :StartMoving\n"; + if (strcasecmp((*rc_mode).c_str(), "Quadrant") == 0) { + new_keyfile += "OnWindow " + *rc_modkey + + " Mouse3 :StartResizing NearestCorner\n"; + } else if (strcasecmp((*rc_mode).c_str(), "Center") == 0) { + new_keyfile += "OnWindow " + *rc_modkey + + " Mouse3 :StartResizing Center\n"; + } else { + new_keyfile += "OnWindow " + *rc_modkey + + "StartResizing BottomRight\n"; + } + new_keyfile += "\n"; // just for good looks + new_keyfile += whole_keyfile; // don't forget user's old keybindings + + write_file(keyfilename, new_keyfile); + new_version = 4; + } + return new_version; }