1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

#1995: Disable history in password mode, move disabling into create_view.

This commit is contained in:
Dave Davenport 2024-07-07 20:34:24 +02:00
parent 3b0f2b43f9
commit 8f06e0a370

View file

@ -1002,10 +1002,6 @@ static void input_history_save(void) {
} }
void __create_window(MenuFlags menu_flags) { void __create_window(MenuFlags menu_flags) {
// In password mode, disable the entry history.
if ((menu_flags & MENU_PASSWORD) == MENU_PASSWORD) {
CacheState.entry_history_enable = FALSE;
}
input_history_initialize(); input_history_initialize();
uint32_t selmask = XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | uint32_t selmask = XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL |
@ -1133,10 +1129,11 @@ void __create_window(MenuFlags menu_flags) {
xcb_get_property_cookie_t awc; xcb_get_property_cookie_t awc;
awc = xcb_ewmh_get_active_window(&xcb->ewmh, xcb->screen_nbr); awc = xcb_ewmh_get_active_window(&xcb->ewmh, xcb->screen_nbr);
if (xcb_ewmh_get_active_window_reply(&xcb->ewmh, awc, &active_window, NULL)) { if (xcb_ewmh_get_active_window_reply(&xcb->ewmh, awc, &active_window,
NULL)) {
xcb_change_property(xcb->connection, XCB_PROP_MODE_REPLACE, box_window, xcb_change_property(xcb->connection, XCB_PROP_MODE_REPLACE, box_window,
XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32, XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32, 1,
1, &active_window); &active_window);
} }
} else if (((menu_flags & MENU_NORMAL_WINDOW) == 0)) { } else if (((menu_flags & MENU_NORMAL_WINDOW) == 0)) {
window_set_atom_prop(box_window, xcb->ewmh._NET_WM_STATE, window_set_atom_prop(box_window, xcb->ewmh._NET_WM_STATE,
@ -1371,8 +1368,7 @@ static void update_callback(textbox *t, icon *ico, unsigned int index,
textbox_font(t, *type); textbox_font(t, *type);
} }
} }
static void page_changed_callback() static void page_changed_callback() {
{
rofi_view_workers_finalize(); rofi_view_workers_finalize();
rofi_view_workers_initialize(); rofi_view_workers_initialize();
} }
@ -2376,9 +2372,9 @@ static void rofi_view_add_widget(RofiViewState *state, widget *parent_widget,
g_error("Listview widget can only be added once to the layout."); g_error("Listview widget can only be added once to the layout.");
return; return;
} }
state->list_view = listview_create(parent_widget, name, update_callback, state->list_view =
page_changed_callback, state, listview_create(parent_widget, name, update_callback,
config.element_height, 0); page_changed_callback, state, config.element_height, 0);
listview_set_selection_changed_callback( listview_set_selection_changed_callback(
state->list_view, selection_changed_callback, (void *)state); state->list_view, selection_changed_callback, (void *)state);
box_add((box *)parent_widget, WIDGET(state->list_view), TRUE); box_add((box *)parent_widget, WIDGET(state->list_view), TRUE);
@ -2495,6 +2491,15 @@ RofiViewState *rofi_view_create(Mode *sw, const char *input,
state->finalize = finalize; state->finalize = finalize;
state->mouse_seen = FALSE; state->mouse_seen = FALSE;
// In password mode, disable the entry history.
if ((menu_flags & MENU_PASSWORD) == MENU_PASSWORD) {
CacheState.entry_history_enable = FALSE;
g_debug("Disable entry history, because password setup.");
}
if (config.disable_history) {
CacheState.entry_history_enable = FALSE;
g_debug("Disable entry history, because history disable flag.");
}
// Request the lines to show. // Request the lines to show.
state->num_lines = mode_get_num_entries(sw); state->num_lines = mode_get_num_entries(sw);