Skip to content

Commit

Permalink
fix placeholder for process input box
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice committed Jul 5, 2022
1 parent f566a3e commit d7ab214
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ FetchContent_Declare(minhook
set(BUILD_TESTS OFF CACHE BOOL "")
FetchContent_Declare(protopuf
GIT_REPOSITORY https://github.com/PragmaTwice/protopuf
GIT_TAG 6b795c2cafef4cdf85854158a25356c6055ab635
GIT_TAG v2.2.0
)

FetchContent_Declare(argparse
Expand Down Expand Up @@ -69,7 +69,7 @@ if(NOT PROXINJECTEE_ONLY)
set(ELEMENTS_BUILD_EXAMPLES OFF CACHE BOOL "")
FetchContent_Declare(elements
GIT_REPOSITORY https://github.com/PragmaTwice/elements
GIT_TAG b2a4b570a691c7461f7d09ea52a01cf9bb721c81
GIT_TAG 0d603d169702428a2fa23c757e141da2cd7d228c
GIT_SUBMODULES_RECURSE ON
)

Expand Down
15 changes: 11 additions & 4 deletions src/injector/injector_gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,20 @@ auto make_tip_below_r(T &&element, const std::string &tip) {
return res;
}

std::map<std::string_view, std::string_view> input_tip_text{
{"pid", "process ID"}, {"name", "process name"}, {"exec", "command line"}};

auto make_controls(injector_server &server, ce::view &view,
process_vector &process_vec) {
using namespace ce;

auto [process_input, process_input_ptr] = input_box();
auto [input_select, input_select_ptr] =
selection_menu([](auto &&) {}, {"pid", "name", "exec"});
auto [process_input, process_input_ptr] =
input_box(std::string(input_tip_text["pid"]));
auto [input_select, input_select_ptr] = selection_menu(
[process_input_ptr](auto str) {
process_input_ptr->_placeholder = input_tip_text[str];
},
{"pid", "name", "exec"});

auto inject_click = [input_select_ptr, process_input_ptr]<typename F>(F &&f) {
auto text = trim_copy(process_input_ptr->get_text());
Expand Down Expand Up @@ -166,7 +173,7 @@ auto make_controls(injector_server &server, ce::view &view,
return share(align_center(label("unknown")));
})));

auto [addr_input, addr_input_ptr] = input_box("ip address");
auto [addr_input, addr_input_ptr] = input_box("IP address");
auto [port_input, port_input_ptr] = input_box("port");

auto proxy_toggle = share(toggle_icon_button(icons::power, 1.2, brblue));
Expand Down

0 comments on commit d7ab214

Please sign in to comment.