Skip to content

Commit

Permalink
fix(sinspui): don't use macros
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <[email protected]>
  • Loading branch information
therealbobo committed Dec 5, 2024
1 parent 6d34339 commit 6d6058c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions userspace/sinspui/cursescomponents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ void curses_textbox::print_no_data()
m_parent->m_screenw / 2 - wstr.size() / 2,
"%s", wstr.c_str());

refresh();
wrefresh(stdscr);
}

void curses_textbox::process_event_spy(sinsp_evt* evt, int32_t next_res)
Expand Down Expand Up @@ -1065,15 +1065,15 @@ void curses_textbox::populate_sidemenu()

void curses_textbox::render_header()
{
move(2, 0);
wmove(stdscr,(2),(0));
attrset(m_parent->m_colors[sinsp_cursesui::FUNCTION_BAR]);

for(uint32_t j = 0; j < m_parent->m_screenw; j++)
{
addch(' ');
}

refresh();
wrefresh(stdscr);
}

void curses_textbox::render()
Expand Down Expand Up @@ -1208,7 +1208,7 @@ chisel_table_action curses_textbox::handle_input(int ch)
m_sidemenu = new curses_table_sidemenu(curses_table_sidemenu::ST_VIEWS,
this->m_parent, 0, VIEW_SIDEMENU_WIDTH);
populate_sidemenu();
clear();
wclear(stdscr);
wresize(m_win, m_parent->m_screenh - 4, m_parent->m_screenw - 20);
mvwin(m_win, TABLE_Y_START + 1, 20);
wrefresh(m_win);
Expand Down
4 changes: 2 additions & 2 deletions userspace/sinspui/cursesspectro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ curses_spectro::curses_spectro(sinsp_cursesui* parent, sinsp* inspector)
//
// Create the table window
//
refresh();
wrefresh(stdscr);
m_tblwin = newwin(2, m_w, m_parent->m_screenh - 3, 0);

//
Expand Down Expand Up @@ -434,7 +434,7 @@ chisel_table_action curses_spectro::handle_input(int ch)
switch(ch)
{
case KEY_F(2):
clear();
wclear(stdscr);
return STA_PARENT_HANDLE;
case KEY_ENTER:
return STA_DRILLDOWN;
Expand Down
4 changes: 2 additions & 2 deletions userspace/sinspui/cursestable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ curses_table::curses_table(sinsp_cursesui* parent, sinsp* inspector, chisel_tabl
//
// Create the table window
//
refresh();
wrefresh(stdscr);
m_tblwin = newwin(m_h, m_w, m_table_y_start, 0);
}

Expand Down Expand Up @@ -548,7 +548,7 @@ void curses_table::render(bool data_changed)

wrefresh(m_tblwin);
m_parent->render();
refresh();
wrefresh(stdscr);
}

string curses_table::get_field_val(string fldname)
Expand Down
26 changes: 13 additions & 13 deletions userspace/sinspui/cursesui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ void sinsp_cursesui::render_header()
// Show the 'viewing' line
//
attrset(m_colors[HELP_BOLD]);
move(0, 0);
wmove(stdscr,(0),(0));
for(j = 0; j < m_screenw; j++)
{
addch(' ');
Expand Down Expand Up @@ -831,7 +831,7 @@ void sinsp_cursesui::render_header()
//
attrset(m_colors[HELP_BOLD]);

move(1, 0);
wmove(stdscr,(1),(0));
for(uint32_t j = 0; j < m_screenw; j++)
{
addch(' ');
Expand Down Expand Up @@ -926,7 +926,7 @@ void sinsp_cursesui::draw_bottom_menu(vector<sinsp_menuitem_info>* items, bool i
//
// Clear the line
//
move(m_screenh - 1, 0);
wmove(stdscr,(m_screenh - 1),(0));
for(uint32_t j = 0; j < m_screenw; j++)
{
addch(' ');
Expand Down Expand Up @@ -1032,7 +1032,7 @@ void sinsp_cursesui::render_filtersearch_main_menu()
//
if(m_cursor_pos == 0)
{
move(m_screenh - 1, 0);
wmove(stdscr,(m_screenh - 1),(0));
for(uint32_t j = 0; j < m_screenw; j++)
{
addch(' ');
Expand Down Expand Up @@ -1127,7 +1127,7 @@ void sinsp_cursesui::render_filtersearch_main_menu()
m_cursor_pos += str->size();
}

move(m_screenh - 1, m_cursor_pos);
wmove(stdscr,(m_screenh - 1),(m_cursor_pos));
}

void sinsp_cursesui::render_position_info()
Expand All @@ -1149,7 +1149,7 @@ void sinsp_cursesui::render_position_info()

attrset(m_colors[sinsp_cursesui::PROCESS_MEGABYTES]);

move(m_screenh - 1, m_screenw - csize);
wmove(stdscr,(m_screenh - 1),(m_screenw - csize));
for(uint32_t k = 0; k < csize; k++)
{
addch(' ');
Expand Down Expand Up @@ -1615,7 +1615,7 @@ void sinsp_cursesui::switch_view(bool is_spy_switch)
//
// Clear the screen to make sure all the crap is removed
//
clear();
wclear(stdscr);

//
// If we're currently visualizing the spy box, reset it and return immediately
Expand Down Expand Up @@ -1935,7 +1935,7 @@ bool sinsp_cursesui::do_drilldown(string field, string val,
}

#ifndef NOCURSESUI
clear();
wclear(stdscr);
populate_view_sidemenu(field, &m_sidemenu_viewlist);
populate_action_sidemenu();

Expand Down Expand Up @@ -2128,7 +2128,7 @@ bool sinsp_cursesui::drillup()
m_datatable->set_freetext_filter(m_manual_filter);
}

clear();
wclear(stdscr);
if(m_viz)
{
m_viz->render(true);
Expand Down Expand Up @@ -2186,7 +2186,7 @@ void sinsp_cursesui::print_progress(double progress)
m_screenw / 2 - wstr.size() / 2,
"%s", wstr.c_str());

refresh();
wrefresh(stdscr);
}

chisel_table_action sinsp_cursesui::handle_textbox_input(int ch)
Expand Down Expand Up @@ -2299,7 +2299,7 @@ chisel_table_action sinsp_cursesui::handle_textbox_input(int ch)
// Restore the cursor
//
attrset(m_colors[PANEL_HIGHLIGHT_FOCUS]);
move(cy, cx);
wmove(stdscr,(cy),(cx));
curs_set(1);
closing = false;
break;
Expand All @@ -2314,9 +2314,9 @@ chisel_table_action sinsp_cursesui::handle_textbox_input(int ch)
if(str->size() > 0)
{
m_cursor_pos--;
move(m_screenh - 1, m_cursor_pos);
wmove(stdscr,(m_screenh - 1),(m_cursor_pos));
addch(' ');
move(m_screenh - 1, m_cursor_pos);
wmove(stdscr,(m_screenh - 1),(m_cursor_pos));
*str = str->substr(0, str->size() - 1);

if(str->size() < 2)
Expand Down

0 comments on commit 6d6058c

Please sign in to comment.