-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add move_window_* and fix the prefix-number parsing.
- Loading branch information
Showing
13 changed files
with
210 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
#include "move_win.hpp" | ||
|
||
#include "core/settable.hpp" | ||
#include "util/debug.hpp" | ||
#include "util/screen_metrics.hpp" | ||
#include "util/winwrap.hpp" | ||
|
||
#include <algorithm> | ||
|
||
|
||
namespace vind | ||
{ | ||
namespace bind | ||
{ | ||
MoveWindowLeft::MoveWindowLeft() | ||
: BindedFuncVoid("move_window_left") | ||
{} | ||
|
||
void MoveWindowLeft::sprocess( | ||
std::uint16_t count, | ||
const std::string& UNUSED(args)) { | ||
auto hwnd = util::get_foreground_window() ; | ||
if(!hwnd) { | ||
return ; | ||
} | ||
|
||
auto delta = core::SetTable::get_instance().get("window_velocity").get<long>() ; | ||
delta *= static_cast<long>(count) ; | ||
|
||
auto rect = util::get_window_rect(hwnd) ; | ||
auto cb_rect = util::get_combined_metrics() ; | ||
|
||
auto left = (std::max)(rect.left() - delta, cb_rect.left()) ; | ||
auto top = rect.top() ; | ||
auto width = rect.width() ; | ||
auto height = rect.height() ; | ||
|
||
util::move_window(hwnd, left, top, width, height) ; | ||
} | ||
|
||
MoveWindowRight::MoveWindowRight() | ||
: BindedFuncVoid("move_window_right") | ||
{} | ||
|
||
void MoveWindowRight::sprocess( | ||
std::uint16_t count, | ||
const std::string& UNUSED(args)) { | ||
auto hwnd = util::get_foreground_window() ; | ||
if(!hwnd) { | ||
return ; | ||
} | ||
|
||
auto delta = core::SetTable::get_instance().get("window_velocity").get<long>() ; | ||
delta *= static_cast<long>(count) ; | ||
|
||
auto rect = util::get_window_rect(hwnd) ; | ||
auto width = rect.width() ; | ||
auto height = rect.height() ; | ||
|
||
auto cb_rect = util::get_combined_metrics() ; | ||
auto max_x = (std::max)(cb_rect.right() - width, static_cast<long>(0)) ; | ||
|
||
auto left = (std::min)(rect.left() + delta, max_x) ; | ||
auto top = rect.top() ; | ||
|
||
util::move_window(hwnd, left, top, width, height) ; | ||
} | ||
|
||
MoveWindowUp::MoveWindowUp() | ||
: BindedFuncVoid("move_window_up") | ||
{} | ||
|
||
void MoveWindowUp::sprocess( | ||
std::uint16_t count, | ||
const std::string& UNUSED(args)) { | ||
auto hwnd = util::get_foreground_window() ; | ||
if(!hwnd) { | ||
return ; | ||
} | ||
|
||
auto delta = core::SetTable::get_instance().get("window_velocity").get<long>() ; | ||
delta *= static_cast<long>(count) ; | ||
|
||
auto rect = util::get_window_rect(hwnd) ; | ||
auto cb_rect = util::get_combined_metrics() ; | ||
|
||
auto left = rect.left() ; | ||
auto top = (std::max)(rect.top() - delta, cb_rect.top()) ; | ||
auto width = rect.width() ; | ||
auto height = rect.height() ; | ||
|
||
util::move_window(hwnd, left, top, width, height) ; | ||
} | ||
|
||
MoveWindowDown::MoveWindowDown() | ||
: BindedFuncVoid("move_window_down") | ||
{} | ||
|
||
void MoveWindowDown::sprocess( | ||
std::uint16_t count, | ||
const std::string& UNUSED(args)) { | ||
auto hwnd = util::get_foreground_window() ; | ||
if(!hwnd) { | ||
return ; | ||
} | ||
|
||
auto delta = core::SetTable::get_instance().get("window_velocity").get<long>() ; | ||
delta *= static_cast<long>(count) ; | ||
|
||
auto rect = util::get_window_rect(hwnd) ; | ||
auto width = rect.width() ; | ||
auto height = rect.height() ; | ||
|
||
auto cb_rect = util::get_combined_metrics() ; | ||
auto max_y = (std::max)(cb_rect.bottom() - height, static_cast<long>(0)) ; | ||
|
||
auto left = rect.left() ; | ||
auto top = (std::min)(rect.top() + delta, max_y) ; | ||
|
||
util::move_window(hwnd, left, top, width, height) ; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef _MOVEWINDOW_HPP | ||
#define _MOVEWINDOW_HPP | ||
|
||
#include "bind/bindedfunc.hpp" | ||
|
||
namespace vind | ||
{ | ||
namespace bind | ||
{ | ||
struct MoveWindowLeft : public BindedFuncVoid<MoveWindowLeft> { | ||
explicit MoveWindowLeft() ; | ||
static void sprocess( | ||
std::uint16_t count, const std::string& args) ; | ||
} ; | ||
|
||
struct MoveWindowRight : public BindedFuncVoid<MoveWindowRight> { | ||
explicit MoveWindowRight() ; | ||
static void sprocess( | ||
std::uint16_t count, const std::string& args) ; | ||
} ; | ||
|
||
struct MoveWindowUp : public BindedFuncVoid<MoveWindowUp> { | ||
explicit MoveWindowUp() ; | ||
static void sprocess( | ||
std::uint16_t count, const std::string& args) ; | ||
} ; | ||
|
||
struct MoveWindowDown : public BindedFuncVoid<MoveWindowDown> { | ||
explicit MoveWindowDown() ; | ||
static void sprocess( | ||
std::uint16_t count, const std::string& args) ; | ||
} ; | ||
} | ||
} | ||
|
||
#endif |
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#ifndef _VERSION_HPP | ||
#define _VERSION_HPP | ||
|
||
#define WIN_VIND_VERSION "5.5.2.0" | ||
#define WIN_VIND_VERSION "5.6.0.1" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters