rofi  1.7.0
ViewHandle
Collaboration diagram for ViewHandle:

Data Structures

struct  RofiViewState
 

Typedefs

typedef struct RofiViewState RofiViewState
 

Enumerations

enum  MenuFlags {
  MENU_NORMAL = 0 , MENU_PASSWORD = 1 , MENU_NORMAL_WINDOW = 2 , MENU_ERROR_DIALOG = 4 ,
  MENU_INDICATOR = 8
}
 

Functions

RofiViewStaterofi_view_create (Mode *sw, const char *input, MenuFlags menu_flags, void(*finalize)(RofiViewState *))
 
void rofi_view_finalize (RofiViewState *state)
 
MenuReturn rofi_view_get_return_value (const RofiViewState *state)
 
unsigned int rofi_view_get_next_position (const RofiViewState *state)
 
void rofi_view_handle_text (RofiViewState *state, char *text)
 
void rofi_view_handle_mouse_motion (RofiViewState *state, gint x, gint y, gboolean find_mouse_target)
 
void rofi_view_maybe_update (RofiViewState *state)
 
void rofi_view_temp_configure_notify (RofiViewState *state, xcb_configure_notify_event_t *xce)
 
void rofi_view_temp_click_to_exit (RofiViewState *state, xcb_window_t target)
 
void rofi_view_frame_callback (void)
 
unsigned int rofi_view_get_completed (const RofiViewState *state)
 
const char * rofi_view_get_user_input (const RofiViewState *state)
 
void rofi_view_set_selected_line (RofiViewState *state, unsigned int selected_line)
 
unsigned int rofi_view_get_selected_line (const RofiViewState *state)
 
void rofi_view_restart (RofiViewState *state)
 
gboolean rofi_view_trigger_action (RofiViewState *state, BindingsScope scope, guint action)
 
void rofi_view_free (RofiViewState *state)
 

Detailed Description

Typedef Documentation

◆ RofiViewState

typedef struct RofiViewState RofiViewState

Definition at line 1 of file view.h.

Enumeration Type Documentation

◆ MenuFlags

enum MenuFlags
Enumerator
MENU_NORMAL 

Create a menu for entering text

MENU_PASSWORD 

Create a menu for entering passwords

MENU_NORMAL_WINDOW 

Create amanaged window.

MENU_ERROR_DIALOG 

ERROR dialog

MENU_INDICATOR 

INDICATOR

Definition at line 48 of file view.h.

Function Documentation

◆ rofi_view_create()

RofiViewState* rofi_view_create ( Mode sw,
const char *  input,
MenuFlags  menu_flags,
void(*)(RofiViewState *)  finalize 
)
Parameters
swthe Mode to show.
inputA pointer to a string where the inputted data is placed.
menu_flagsFlags indicating state of the menu.
finalizethe finalize callback

Main menu callback.

Returns
The command issued (see MenuReturn)

Definition at line 1932 of file view.c.

References __rofi_view_state_create(), box_create(), CacheState, _xcb_stuff::connection, RofiViewState::distance, RofiViewState::finalize, RofiViewState::height, RofiViewState::line_map, RofiViewState::list_view, listview_set_fixed_num_lines(), RofiViewState::main_window, MENU_CANCEL, RofiViewState::menu_flags, MENU_NORMAL_WINDOW, mode_get_display_name(), mode_get_num_entries(), RofiViewState::mouse_seen, RofiViewState::num_lines, RofiViewState::quit, RofiViewState::refilter, RofiViewState::retv, ROFI_ORIENTATION_VERTICAL, rofi_theme_get_list(), rofi_view_add_widget(), rofi_view_calculate_height(), rofi_view_calculate_window_position(), rofi_view_calculate_window_width(), rofi_view_ping_mouse(), rofi_view_refilter(), rofi_view_set_user_timeout(), rofi_view_set_window_title(), rofi_view_update(), rofi_view_window_update_size(), rofi_xcb_set_input_focus(), RofiViewState::selected_line, RofiViewState::skip_absorb, _xcb_stuff::sncontext, RofiViewState::sw, RofiViewState::text, textbox_cursor_end(), textbox_text(), TICK, TICK_N, WIDGET, widget_queue_redraw(), widget_resize(), RofiViewState::width, and xcb.

Referenced by dmenu_switcher_dialog(), and run_switcher().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rofi_view_finalize()

void rofi_view_finalize ( RofiViewState state)
Parameters
stateThe Menu Handle

Check if a finalize function is set, and if sets executes it.

Definition at line 1226 of file view.c.

References RofiViewState::finalize.

Referenced by rofi_view_maybe_update().

Here is the caller graph for this function:

◆ rofi_view_frame_callback()

void rofi_view_frame_callback ( void  )

Update the state if needed.

Definition at line 1637 of file view.c.

References CacheState, and rofi_view_repaint().

Referenced by main_loop_x11_event_handler_view().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rofi_view_free()

void rofi_view_free ( RofiViewState state)
Parameters
stateThe handle to the view

Free's the memory allocated for this handle. After a call to this function, state is invalid and can no longer be used.

Definition at line 568 of file view.c.

References RofiViewState::distance, helper_tokenize_free(), RofiViewState::line_map, RofiViewState::main_window, RofiViewState::modi, RofiViewState::num_modi, RofiViewState::tokens, WIDGET, and widget_free().

Referenced by dmenu_finish(), and process_result().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rofi_view_get_completed()

unsigned int rofi_view_get_completed ( const RofiViewState state)
Parameters
statethe Menu handle
Returns
returns if this state is completed.

Definition at line 603 of file view.c.

References RofiViewState::quit.

Referenced by rofi_view_maybe_update().

Here is the caller graph for this function:

◆ rofi_view_get_next_position()

unsigned int rofi_view_get_next_position ( const RofiViewState state)
Parameters
statethe Menu handle

Returns the index of the next visible position.

Returns
the next position.

Definition at line 594 of file view.c.

References RofiViewState::line_map, RofiViewState::list_view, listview_get_selected(), RofiViewState::num_lines, and RofiViewState::selected_line.

Referenced by dmenu_finalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rofi_view_get_return_value()

MenuReturn rofi_view_get_return_value ( const RofiViewState state)
Parameters
statethe Menu handle

Get the return value associated to the users action.

Returns
the return value

Definition at line 586 of file view.c.

References RofiViewState::retv.

Referenced by dmenu_finalize(), and process_result().

Here is the caller graph for this function:

◆ rofi_view_get_selected_line()

unsigned int rofi_view_get_selected_line ( const RofiViewState state)
Parameters
stateThe Menu Handle

Get the selected line.

Returns
the selected line or UINT32_MAX if none selected.

Definition at line 590 of file view.c.

References RofiViewState::selected_line.

Referenced by dmenu_finalize(), and process_result().

Here is the caller graph for this function:

◆ rofi_view_get_user_input()

const char* rofi_view_get_user_input ( const RofiViewState state)
Parameters
statethe Menu handle
Returns
the raw user input.

Definition at line 607 of file view.c.

References RofiViewState::text, and textbox::text.

Referenced by dmenu_finalize(), and process_result().

Here is the caller graph for this function:

◆ rofi_view_handle_mouse_motion()

void rofi_view_handle_mouse_motion ( RofiViewState state,
gint  x,
gint  y,
gboolean  find_mouse_target 
)
Parameters
statethe Menu handle
xThe X coordinates of the motion
yThe Y coordinates of the motion
find_mouse_targetif we should handle pure mouse motion

Update the state if needed.

Definition at line 1540 of file view.c.

References cursor_type, RofiViewState::main_window, RofiViewState::motion_target, RofiViewState::mouse, rofi_view_resolve_cursor(), rofi_view_set_cursor(), WIDGET, widget_find_mouse_target(), widget_motion_notify(), WIDGET_TYPE_LISTVIEW_ELEMENT, widget_xy_to_relative(), RofiViewState::x, and RofiViewState::y.

Referenced by main_loop_x11_event_handler_view(), and rofi_view_ping_mouse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rofi_view_handle_text()

void rofi_view_handle_text ( RofiViewState state,
char *  text 
)
Parameters
statethe Menu handle
textThe text to add to the input box

Update the state if needed.

Definition at line 1499 of file view.c.

References RofiViewState::refilter, RofiViewState::text, and textbox_append_text().

Referenced by main_loop_x11_event_handler_view(), and rofi_view_paste().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rofi_view_maybe_update()

void rofi_view_maybe_update ( RofiViewState state)
Parameters
statethe Menu handle

Update the state if needed.

Definition at line 1568 of file view.c.

References RofiViewState::refilter, rofi_quit_main_loop(), rofi_view_finalize(), rofi_view_get_active(), rofi_view_get_completed(), rofi_view_refilter(), and rofi_view_update().

Referenced by main_loop_x11_event_handler(), and main_loop_x11_event_handler_view().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rofi_view_restart()

void rofi_view_restart ( RofiViewState state)
Parameters
stateThe Menu Handle

Restart the menu so it can be displayed again. Resets RofiViewState::quit and RofiViewState::retv.

Definition at line 513 of file view.c.

References MENU_CANCEL, RofiViewState::quit, and RofiViewState::retv.

Referenced by dmenu_finalize(), and rofi_view_switch_mode().

Here is the caller graph for this function:

◆ rofi_view_set_selected_line()

void rofi_view_set_selected_line ( RofiViewState state,
unsigned int  selected_line 
)
Parameters
stateThe Menu Handle
selected_lineThe line to select.

Select a line.

Definition at line 550 of file view.c.

References CacheState, _xcb_stuff::connection, RofiViewState::filtered_lines, RofiViewState::line_map, RofiViewState::list_view, listview_set_selected(), RofiViewState::selected_line, and xcb.

Referenced by dmenu_finalize(), dmenu_switcher_dialog(), rofi_view_clear_input(), and run_switcher().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rofi_view_temp_click_to_exit()

void rofi_view_temp_click_to_exit ( RofiViewState state,
xcb_window_t  target 
)

Quit rofi on click (outside of view )

Definition at line 1628 of file view.c.

References CacheState, MENU_CANCEL, MENU_NORMAL_WINDOW, RofiViewState::quit, and RofiViewState::retv.

Referenced by main_loop_x11_event_handler_view().

Here is the caller graph for this function:

◆ rofi_view_temp_configure_notify()

void rofi_view_temp_configure_notify ( RofiViewState state,
xcb_configure_notify_event_t *  xce 
)

Handle window configure event. Handles resizes.

Definition at line 1594 of file view.c.

References CacheState, _xcb_stuff::connection, depth, RofiViewState::height, RofiViewState::main_window, visual, WIDGET, widget_queue_redraw(), widget_resize(), RofiViewState::width, RofiViewState::x, xcb, and RofiViewState::y.

Referenced by main_loop_x11_event_handler_view().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rofi_view_trigger_action()