rofi 1.7.9
view.c File Reference
#include "config.h"
#include <locale.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <xcb/xcb_ewmh.h>
#include <xcb/xcb_icccm.h>
#include <xcb/xkb.h>
#include <xkbcommon/xkbcommon-x11.h>
#include <cairo-xcb.h>
#include <cairo.h>
#include <gio/gio.h>
#include "rofi.h"
#include <libsn/sn.h>
#include "settings.h"
#include "timings.h"
#include "display.h"
#include "helper-theme.h"
#include "helper.h"
#include "mode.h"
#include "modes/modes.h"
#include "xcb-internal.h"
#include "view-internal.h"
#include "view.h"
#include "theme.h"
#include "xcb.h"
Include dependency graph for view.c:

Go to the source code of this file.

Data Structures

struct  EntryHistoryIndex
 
struct  _thread_state_view
 

Macros

#define G_LOG_DOMAIN   "View"
 
#define SN_API_NOT_YET_FROZEN
 

Typedefs

typedef struct _thread_state_view thread_state_view
 

Functions

void rofi_view_update (RofiViewState *state, gboolean qr)
 
static int rofi_view_calculate_height (RofiViewState *state)
 
void rofi_view_get_current_monitor (int *width, int *height)
 
static char * get_matching_state (RofiViewState *state)
 
static int lev_sort (const void *p1, const void *p2, void *arg)
 
static void screenshot_taken_user_callback (const char *path)
 
void rofi_capture_screenshot (void)
 
static gboolean bench_update (void)
 
static gboolean rofi_view_repaint (G_GNUC_UNUSED void *data)
 
static void rofi_view_update_prompt (RofiViewState *state)
 
static void rofi_view_calculate_window_position (RofiViewState *state)
 
static void rofi_view_window_update_size (RofiViewState *state)
 
static void rofi_view_reload_message_bar (RofiViewState *state)
 
static gboolean rofi_view_reload_idle (G_GNUC_UNUSED gpointer data)
 
static void rofi_view_take_action (const char *name)
 
static gboolean rofi_view_user_timeout (G_GNUC_UNUSED gpointer data)
 
static void rofi_view_set_user_timeout (G_GNUC_UNUSED gpointer data)
 
void rofi_view_reload (void)
 
void rofi_view_queue_redraw (void)
 
void rofi_view_restart (RofiViewState *state)
 
RofiViewStaterofi_view_get_active (void)
 
void rofi_view_remove_active (RofiViewState *state)
 
void rofi_view_set_active (RofiViewState *state)
 
void rofi_view_set_selected_line (RofiViewState *state, unsigned int selected_line)
 
void rofi_view_free (RofiViewState *state)
 
MenuReturn rofi_view_get_return_value (const RofiViewState *state)
 
unsigned int rofi_view_get_selected_line (const RofiViewState *state)
 
unsigned int rofi_view_get_next_position (const RofiViewState *state)
 
unsigned int rofi_view_get_completed (const RofiViewState *state)
 
const char * rofi_view_get_user_input (const RofiViewState *state)
 
static RofiViewState__rofi_view_state_create (void)
 
static void rofi_view_call_thread (gpointer data, gpointer user_data)
 
static void filter_elements (thread_state *ts, G_GNUC_UNUSED gpointer user_data)
 
static void rofi_view_setup_fake_transparency (widget *win, const char *const fake_background)
 
static void input_history_initialize (void)
 
static void input_history_save (void)
 
void __create_window (MenuFlags menu_flags)
 
static void rofi_view_calculate_window_width (RofiViewState *state)
 
static void rofi_view_nav_row_tab (RofiViewState *state)
 
static void rofi_view_nav_row_select (RofiViewState *state)
 
static void rofi_view_nav_first (RofiViewState *state)
 
static void rofi_view_nav_last (RofiViewState *state)
 
static void selection_changed_user_callback (unsigned int index, RofiViewState *state)
 
static void selection_changed_callback (G_GNUC_UNUSED listview *lv, unsigned int index, void *udata)
 
static void update_callback (textbox *t, icon *ico, unsigned int index, void *udata, TextBoxFontType *type, gboolean full)
 
static void page_changed_callback (void)
 
static void _rofi_view_reload_row (RofiViewState *state)
 
static gboolean rofi_view_refilter_real (RofiViewState *state)
 
static void rofi_view_refilter (RofiViewState *state)
 
static void rofi_view_refilter_force (RofiViewState *state)
 
void process_result (RofiViewState *state)
 
void rofi_view_finalize (RofiViewState *state)
 
static void rofi_view_input_changed (void)
 
static void rofi_view_trigger_global_action (KeyBindingAction action)
 
gboolean rofi_view_check_action (RofiViewState *state, BindingsScope scope, guint action)
 
void rofi_view_trigger_action (RofiViewState *state, BindingsScope scope, guint action)
 
void rofi_view_handle_text (RofiViewState *state, char *text)
 
static X11CursorType rofi_cursor_type_to_x11_cursor_type (RofiCursorType type)
 
static RofiCursorType rofi_view_resolve_cursor (RofiViewState *state, gint x, gint y)
 
static void rofi_view_set_cursor (RofiCursorType type)
 
void rofi_view_handle_mouse_motion (RofiViewState *state, gint x, gint y, gboolean find_mouse_target)
 
static void rofi_quit_user_callback (RofiViewState *state)
 
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)
 
WidgetTriggerActionResult textbox_button_trigger_action (widget *wid, MouseBindingMouseDefaultAction action, G_GNUC_UNUSED gint x, G_GNUC_UNUSED gint y, G_GNUC_UNUSED void *user_data)
 
static WidgetTriggerActionResult textbox_sidebar_modes_trigger_action (widget *wid, MouseBindingMouseDefaultAction action, G_GNUC_UNUSED gint x, G_GNUC_UNUSED gint y, G_GNUC_UNUSED void *user_data)
 
static void rofi_view_listview_mouse_activated_cb (listview *lv, gboolean custom, void *udata)
 
static void rofi_view_add_widget (RofiViewState *state, widget *parent_widget, const char *name)
 
static void rofi_view_ping_mouse (RofiViewState *state)
 
RofiViewStaterofi_view_create (Mode *sw, const char *input, MenuFlags menu_flags, void(*finalize)(RofiViewState *))
 
static void rofi_error_user_callback (const char *msg)
 
int rofi_view_error_dialog (const char *msg, int markup)
 
void rofi_view_hide (void)
 
void rofi_view_cleanup (void)
 
static int rofi_thread_workers_sort (gconstpointer a, gconstpointer b, gpointer data G_GNUC_UNUSED)
 
static void rofi_thread_pool_state_free (gpointer data)
 
void rofi_view_workers_initialize (void)
 
void rofi_view_workers_finalize (void)
 
Moderofi_view_get_mode (RofiViewState *state)
 
static gboolean rofi_view_overlay_timeout (G_GNUC_UNUSED gpointer user_data)
 
void rofi_view_set_overlay_timeout (RofiViewState *state, const char *text)
 
void rofi_view_set_overlay (RofiViewState *state, const char *text)
 
void rofi_view_clear_input (RofiViewState *state)
 
void rofi_view_ellipsize_listview (RofiViewState *state, PangoEllipsizeMode mode)
 
void rofi_view_switch_mode (RofiViewState *state, Mode *mode)
 
xcb_window_t rofi_view_get_window (void)
 
void rofi_view_set_window_title (const char *title)
 

Variables

GThreadPool * tpool = NULL
 
RofiViewStatecurrent_active_menu = NULL
 
struct { 
 
   xcb_window_t   main_window 
 
   cairo_surface_t *   fake_bg 
 
   xcb_gcontext_t   gc 
 
   xcb_pixmap_t   edit_pixmap 
 
   cairo_surface_t *   edit_surf 
 
   cairo_t *   edit_draw 
 
   int   fake_bgrel 
 
   MenuFlags   flags 
 
   GQueue   views 
 
   workarea   mon 
 
   guint   idle_timeout 
 
   guint   refilter_timeout 
 
   guint   refilter_timeout_count 
 
   double   max_refilter_time 
 
   gboolean   delayed_mode 
 
   guint   user_timeout 
 
   guint   overlay_timeout 
 
   unsigned long long   count 
 
   guint   repaint_source 
 
   gboolean   fullscreen 
 
   X11CursorType   cursor_type 
 
   gboolean   entry_history_enable 
 
   EntryHistoryIndex *   entry_history 
 
   gssize   entry_history_length 
 
   gssize   entry_history_index 
 
CacheState 
 
struct { 
 
   GTimer *   time 
 
   uint64_t   draws 
 
   double   last_ts 
 
   double   min 
 
BenchMark = {.time = NULL, .draws = 0, .last_ts = 0.0, .min = G_MAXDOUBLE} 
 
static const int loc_transtable [9]
 
GList * list_of_warning_msgs
 

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "View"

The Rofi View log domain

Definition at line 29 of file view.c.

◆ SN_API_NOT_YET_FROZEN

#define SN_API_NOT_YET_FROZEN

Indicated we understand the startup notification api is not yet stable.

Definition at line 53 of file view.c.

Typedef Documentation

◆ thread_state_view

Thread state for workers started for the view.

Function Documentation

◆ __rofi_view_state_create()

static RofiViewState * __rofi_view_state_create ( void  )
static

Create a new, 0 initialized RofiViewState structure.

Returns
a new 0 initialized RofiViewState

Definition at line 725 of file view.c.

Referenced by rofi_view_create(), and rofi_view_error_dialog().

Here is the caller graph for this function:

◆ _rofi_view_reload_row()

static void _rofi_view_reload_row ( RofiViewState state)
static

Definition at line 1459 of file view.c.

References RofiViewState::distance, RofiViewState::line_map, RofiViewState::list_view, listview_set_max_lines(), mode_get_num_entries(), RofiViewState::num_lines, rofi_view_reload_message_bar(), and RofiViewState::sw.

Referenced by rofi_view_refilter_real().

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

◆ bench_update()

static gboolean bench_update ( void  )
static

Definition at line 315 of file view.c.

References BenchMark, Settings::benchmark_ui, and config.

Referenced by rofi_view_repaint().

Here is the caller graph for this function:

◆ filter_elements()

◆ get_matching_state()

static char * get_matching_state ( RofiViewState state)
static

Definition at line 194 of file view.c.

References RofiViewState::case_sensitive, config, and Settings::sort.

Referenced by rofi_view_add_widget(), rofi_view_refilter_real(), and rofi_view_trigger_global_action().

Here is the caller graph for this function:

◆ input_history_initialize()

static void input_history_initialize ( void  )
static

Definition at line 938 of file view.c.

References cache_dir, and CacheState.

Referenced by __create_window().

Here is the caller graph for this function:

◆ input_history_save()

static void input_history_save ( void  )
static

Definition at line 981 of file view.c.

References cache_dir, CacheState, _PropertyValue::i, P_INTEGER, rofi_config_find_widget(), rofi_theme_find_property(), Property::type, and Property::value.

Referenced by rofi_view_cleanup().

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

◆ lev_sort()

static int lev_sort ( const void *  p1,
const void *  p2,
void *  arg 
)
static

Levenshtein Sorting.

Definition at line 210 of file view.c.

Referenced by rofi_view_refilter_real().

Here is the caller graph for this function:

◆ page_changed_callback()

static void page_changed_callback ( void  )
static

Definition at line 1410 of file view.c.

References rofi_view_workers_finalize(), and rofi_view_workers_initialize().

Referenced by rofi_view_add_widget().

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

◆ process_result()

void process_result ( RofiViewState state)
Parameters
stateThe Menu Handle

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

Load in the new mode.

Definition at line 233 of file rofi.c.

References curr_mode, MODE_EXIT, mode_result(), modes, NEXT_DIALOG, num_modes, PREVIOUS_DIALOG, RELOAD_DIALOG, RESET_DIALOG, rofi_view_clear_input(), rofi_view_free(), rofi_view_get_return_value(), rofi_view_get_selected_line(), rofi_view_get_user_input(), rofi_view_remove_active(), rofi_view_switch_mode(), RofiViewState::sw, RofiViewState::text, textbox_cursor_end(), and textbox_text().

Referenced by rofi_view_error_dialog(), and run_mode_index().

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

◆ rofi_cursor_type_to_x11_cursor_type()

static X11CursorType rofi_cursor_type_to_x11_cursor_type ( RofiCursorType  type)
static

Definition at line 2081 of file view.c.

References CURSOR_DEFAULT, CURSOR_POINTER, CURSOR_TEXT, ROFI_CURSOR_DEFAULT, ROFI_CURSOR_POINTER, and ROFI_CURSOR_TEXT.

Referenced by rofi_view_set_cursor().

Here is the caller graph for this function:

◆ rofi_error_user_callback()

static void rofi_error_user_callback ( const char *  msg)
static

Definition at line 2663 of file view.c.

References config, helper_execute(), helper_parse_setup(), and Settings::on_menu_error.

Referenced by rofi_view_error_dialog().

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

◆ rofi_quit_user_callback()

◆ rofi_thread_pool_state_free()

static void rofi_thread_pool_state_free ( gpointer  data)
static

Definition at line 2791 of file view.c.

References _thread_state::free.

Referenced by rofi_view_workers_initialize().

Here is the caller graph for this function:

◆ rofi_thread_workers_sort()

static int rofi_thread_workers_sort ( gconstpointer  a,
gconstpointer  b,
gpointer data  G_GNUC_UNUSED 
)
static

Definition at line 2783 of file view.c.

References _thread_state::priority.

Referenced by rofi_view_workers_initialize().

Here is the caller graph for this function:

◆ rofi_view_add_widget()

static void rofi_view_add_widget ( RofiViewState state,
widget parent_widget,
const char *  name 
)
static

MAINBOX

INPUTBAR

PROMPT

CASE INDICATOR

ENTRY BOX

MESSAGE

LISTVIEW

MODE SWITCHER

Definition at line 2344 of file view.c.

References box_add(), box_create(), RofiViewState::case_indicator, config, container_add(), container_create(), Settings::element_height, get_matching_state(), HIGHLIGHT, icon_create(), RofiViewState::icon_current_entry, RofiViewState::list_view, listview_create(), listview_set_max_lines(), listview_set_mouse_activated_cb(), listview_set_scroll_type(), listview_set_selection_changed_callback(), RofiViewState::menu_flags, MENU_PASSWORD, RofiViewState::mesg_box, RofiViewState::mesg_tb, mode_get_display_name(), RofiViewState::modes, NORMAL, RofiViewState::num_modes, RofiViewState::overlay, page_changed_callback(), RofiViewState::prompt, rofi_get_mode(), rofi_get_num_enabled_modes(), ROFI_ORIENTATION_HORIZONTAL, ROFI_ORIENTATION_VERTICAL, rofi_theme_get_list_strings(), rofi_theme_get_string(), rofi_view_add_widget(), rofi_view_listview_mouse_activated_cb(), rofi_view_reload_message_bar(), rofi_view_update_prompt(), Settings::scroll_method, selection_changed_callback(), RofiViewState::sidebar_bar, Settings::sidebar_mode, RofiViewState::sw, TB_AUTOHEIGHT, TB_AUTOWIDTH, RofiViewState::tb_current_entry, TB_EDITABLE, RofiViewState::tb_filtered_rows, TB_MARKUP, TB_PASSWORD, RofiViewState::tb_total_rows, TB_WRAP, RofiViewState::text, textbox_button_trigger_action(), textbox_create(), textbox_sidebar_modes_trigger_action(), textbox_text(), update_callback(), URGENT, WIDGET, widget_disable(), widget_set_trigger_action_handler(), WIDGET_TYPE_EDITBOX, WIDGET_TYPE_MODE_SWITCHER, and WIDGET_TYPE_TEXTBOX_TEXT.

Referenced by rofi_view_add_widget(), and rofi_view_create().

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

◆ rofi_view_calculate_height()

static int rofi_view_calculate_height ( RofiViewState state)
static

Definition at line 2256 of file view.c.

References CacheState, distance_get_pixel(), RofiViewState::main_window, main_window, ROFI_ORIENTATION_VERTICAL, rofi_theme_get_distance(), WIDGET, widget_get_desired_height(), and RofiViewState::width.

Referenced by rofi_view_create(), rofi_view_error_dialog(), and rofi_view_refilter_real().

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

◆ rofi_view_calculate_window_position()

◆ rofi_view_calculate_window_width()

static void rofi_view_calculate_window_width ( RofiViewState state)
static
Parameters
stateInternal state of the menu.

Calculate the width of the window and the width of an element.

Definition at line 1222 of file view.c.

References CacheState, DEFAULT_MENU_WIDTH, distance_get_pixel(), RofiViewState::main_window, ROFI_ORIENTATION_HORIZONTAL, rofi_theme_get_distance(), WIDGET, and RofiViewState::width.

Referenced by rofi_view_create(), and rofi_view_error_dialog().

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

◆ rofi_view_call_thread()

static void rofi_view_call_thread ( gpointer  data,
gpointer  user_data 
)
static
Parameters
dataA thread_state object.
user_dataUser data to pass to thread_state callback

Small wrapper function that is internally used to pass a job to a worker.

Definition at line 763 of file view.c.

References _thread_state::callback.

Referenced by rofi_view_refilter_real(), and rofi_view_workers_initialize().

Here is the caller graph for this function:

◆ rofi_view_input_changed()

static void rofi_view_input_changed ( void  )
static

This function should be called when the input of the entry is changed. TODO: Evaluate if this needs to be a 'signal' on textbox?

Definition at line 1666 of file view.c.

References CacheState, current_active_menu, rofi_view_take_action(), RofiViewState::text, textbox_get_cursor(), and textbox_get_text().

Referenced by rofi_view_handle_text(), and rofi_view_trigger_global_action().

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

◆ rofi_view_listview_mouse_activated_cb()

static void rofi_view_listview_mouse_activated_cb ( listview lv,
gboolean  custom,
void *  udata 
)
static

Definition at line 2331 of file view.c.

References RofiViewState::line_map, listview_get_selected(), MENU_CUSTOM_ACTION, MENU_OK, RofiViewState::quit, RofiViewState::retv, RofiViewState::selected_line, and RofiViewState::skip_absorb.

Referenced by rofi_view_add_widget().

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

◆ rofi_view_nav_first()

static void rofi_view_nav_first ( RofiViewState state)
inlinestatic
Parameters
stateThe current RofiViewState

Move the selection to first row.

Definition at line 1288 of file view.c.

References RofiViewState::list_view, and listview_set_selected().

Referenced by rofi_view_trigger_global_action().

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

◆ rofi_view_nav_last()

static void rofi_view_nav_last ( RofiViewState state)
inlinestatic
Parameters
stateThe current RofiViewState

Move the selection to last row.

Definition at line 1298 of file view.c.

References RofiViewState::filtered_lines, RofiViewState::list_view, and listview_set_selected().

Referenced by rofi_view_trigger_global_action().

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

◆ rofi_view_nav_row_select()

static void rofi_view_nav_row_select ( RofiViewState state)
inlinestatic
Parameters
stateThe current RofiViewState

complete current row.

Definition at line 1268 of file view.c.

References RofiViewState::line_map, RofiViewState::list_view, listview_get_selected(), mode_get_completion(), MOVE_END, RofiViewState::refilter, RofiViewState::sw, RofiViewState::text, textbox_keybinding(), and textbox_text().

Referenced by rofi_view_trigger_global_action().

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

◆ rofi_view_nav_row_tab()

static void rofi_view_nav_row_tab ( RofiViewState state)
static

Nav helper functions, to avoid duplicate code.

Parameters
stateThe current RofiViewState

Tab handling.

Definition at line 1244 of file view.c.

References RofiViewState::filtered_lines, RofiViewState::line_map, RofiViewState::list_view, listview_get_selected(), listview_nav_down(), MENU_NEXT, MENU_OK, RofiViewState::prev_action, RofiViewState::quit, RofiViewState::retv, ROW_TAB, and RofiViewState::selected_line.

Referenced by rofi_view_trigger_global_action().

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

◆ rofi_view_overlay_timeout()

static gboolean rofi_view_overlay_timeout ( G_GNUC_UNUSED gpointer  user_data)
static

Definition at line 2847 of file view.c.

References CacheState, RofiViewState::overlay, rofi_view_get_active(), rofi_view_queue_redraw(), WIDGET, and widget_disable().

Referenced by rofi_view_set_overlay_timeout().

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

◆ rofi_view_ping_mouse()

static void rofi_view_ping_mouse ( RofiViewState state)
static

Definition at line 2549 of file view.c.

References CacheState, config, _xcb_stuff::connection, Settings::hover_select, rofi_view_handle_mouse_motion(), and xcb.

Referenced by rofi_view_create().

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

◆ rofi_view_refilter()

static void rofi_view_refilter ( RofiViewState state)
static

Definition at line 1611 of file view.c.

References CacheState, config, Settings::refilter_timeout_limit, rofi_view_refilter_real(), RofiViewState::text, and textbox::text.

Referenced by rofi_view_create(), rofi_view_maybe_update(), and rofi_view_trigger_global_action().

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

◆ rofi_view_refilter_force()

static void rofi_view_refilter_force ( RofiViewState state)
static

Definition at line 1641 of file view.c.

References CacheState, RofiViewState::refilter, and rofi_view_refilter_real().

Referenced by rofi_view_switch_mode(), and rofi_view_trigger_global_action().

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

◆ rofi_view_refilter_real()

static gboolean rofi_view_refilter_real ( RofiViewState state)
static

On long lists it can be beneficial to parallelize. If number of threads is 1, no thread is spawn. If number of threads > 1 and there are enough (> 1000) items, spawn jobs for the thread pool. For large lists with 8 threads I see a factor three speedup of the whole function.

Definition at line 1469 of file view.c.

References _rofi_view_reload_row(), _thread_state_view::acount, Settings::auto_select, CacheState, _thread_state::callback, RofiViewState::case_indicator, RofiViewState::case_sensitive, Settings::case_smart, _thread_state_view::cond, config, count, _thread_state_view::count, RofiViewState::distance, filter_elements(), RofiViewState::filtered_lines, _thread_state::free, get_matching_state(), RofiViewState::height, helper_tokenize(), helper_tokenize_free(), lev_sort(), RofiViewState::line_map, RofiViewState::list_view, listview_get_selected(), listview_set_filtered(), listview_set_num_elements(), MENU_OK, mode_preprocess_input(), _thread_state_view::mutex, RofiViewState::num_lines, parse_case_sensitivity(), _thread_state_view::pattern, _thread_state_view::plen, _thread_state::priority, RofiViewState::quit, RofiViewState::refilter, RofiViewState::reload, RofiViewState::retv, rofi_view_calculate_height(), rofi_view_calculate_window_position(), rofi_view_call_thread(), rofi_view_update(), rofi_view_window_update_size(), RofiViewState::selected_line, Settings::sort, _thread_state_view::st, _thread_state_view::start, _thread_state_view::state, _thread_state_view::stop, RofiViewState::sw, RofiViewState::tb_filtered_rows, RofiViewState::tb_total_rows, RofiViewState::text, textbox::text, textbox_text(), Settings::threads, TICK_N, RofiViewState::tokens, and tpool.

Referenced by rofi_view_refilter(), and rofi_view_refilter_force().

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

◆ rofi_view_reload_idle()

static gboolean rofi_view_reload_idle ( G_GNUC_UNUSED gpointer  data)
static

Definition at line 536 of file view.c.

References CacheState, current_active_menu, mode_get_num_entries(), RofiViewState::refilter, RofiViewState::reload, rofi_view_queue_redraw(), RofiViewState::sw, RofiViewState::tb_total_rows, and textbox_text().

Referenced by rofi_view_reload().

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

◆ rofi_view_reload_message_bar()

static void rofi_view_reload_message_bar ( RofiViewState state)
static

we want to popin warning here.

Definition at line 499 of file view.c.

References list_of_warning_msgs, RofiViewState::mesg_box, RofiViewState::mesg_tb, mode_get_message(), RofiViewState::sw, textbox_text(), WIDGET, widget_disable(), and widget_enable().

Referenced by _rofi_view_reload_row(), and rofi_view_add_widget().

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

◆ rofi_view_repaint()

static gboolean rofi_view_repaint ( G_GNUC_UNUSED void *  data)
static

Definition at line 339 of file view.c.

References bench_update(), CacheState, _xcb_stuff::connection, current_active_menu, RofiViewState::height, rofi_view_update(), TICK_N, RofiViewState::width, and xcb.

Referenced by rofi_view_frame_callback(), and rofi_view_queue_redraw().

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

◆ rofi_view_resolve_cursor()

static RofiCursorType rofi_view_resolve_cursor ( RofiViewState state,
gint  x,
gint  y 
)
static

Definition at line 2096 of file view.c.

References _widget::cursor_type, RofiViewState::main_window, ROFI_CURSOR_DEFAULT, WIDGET, widget_find_mouse_target(), and WIDGET_TYPE_UNKNOWN.

Referenced by rofi_view_handle_mouse_motion().

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

◆ rofi_view_set_cursor()

static void rofi_view_set_cursor ( RofiCursorType  type)
static

Definition at line 2104 of file view.c.

References CacheState, rofi_cursor_type_to_x11_cursor_type(), and x11_set_cursor().

Referenced by rofi_view_handle_mouse_motion().

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

◆ rofi_view_set_user_timeout()

static void rofi_view_set_user_timeout ( G_GNUC_UNUSED gpointer  data)
static

Find the widget

Check string property

Definition at line 575 of file view.c.

References CacheState, _PropertyValue::f, _PropertyValue::i, P_DOUBLE, P_INTEGER, rofi_config_find_widget(), rofi_theme_find_property(), rofi_view_user_timeout(), Property::type, and Property::value.

Referenced by rofi_view_create(), and rofi_view_trigger_action().

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

◆ rofi_view_setup_fake_transparency()

static void rofi_view_setup_fake_transparency ( widget win,
const char *const  fake_background 
)
static

Select Background to use for fake transparency. Current options: 'real', 'screenshot','background'

Definition at line 805 of file view.c.

References CacheState, cairo_image_surface_blur(), rofi_expand_path(), rofi_theme_get_integer(), TICK_N, WIDGET, x11_helper_get_bg_surface(), and x11_helper_get_screenshot_surface().

Referenced by __create_window().

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

◆ rofi_view_take_action()

static void rofi_view_take_action ( const char *  name)
static

Check string property

Definition at line 553 of file view.c.

References key_binding_get_action_from_name(), P_STRING, rofi_config_find_widget(), rofi_theme_find_property(), rofi_view_get_active(), rofi_view_trigger_action(), _PropertyValue::s, SCOPE_GLOBAL, Property::type, and Property::value.

Referenced by rofi_view_input_changed(), and rofi_view_user_timeout().

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

◆ rofi_view_trigger_global_action()

static void rofi_view_trigger_global_action ( KeyBindingAction  action)
static

Definition at line 1682 of file view.c.

References ACCEPT_ALT, ACCEPT_CUSTOM, ACCEPT_CUSTOM_ALT, ACCEPT_ENTRY, CacheState, CANCEL, RofiViewState::case_indicator, Settings::case_sensitive, CHANGE_ELLIPSIZE, CLEAR_LINE, config, _xcb_stuff::connection, COPY_SECONDARY, CUSTOM_1, CUSTOM_10, CUSTOM_11, CUSTOM_12, CUSTOM_13, CUSTOM_14, CUSTOM_15, CUSTOM_16, CUSTOM_17, CUSTOM_18, CUSTOM_19, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8, CUSTOM_9, DELETE_ENTRY, ELEMENT_NEXT, ELEMENT_PREV, ENTRY_HISTORY_DOWN, ENTRY_HISTORY_UP, _xcb_stuff::ewmh, get_matching_state(), helper_get_matching_mode_str(), helper_select_next_matching_mode(), helper_select_previous_matching_mode(), RofiViewState::line_map, RofiViewState::list_view, listview_get_selected(), listview_nav_down(), listview_nav_left(), listview_nav_next(), listview_nav_page_next(), listview_nav_page_prev(), listview_nav_prev(), listview_nav_right(), listview_nav_up(), listview_toggle_ellipsizing(), MATCHER_DOWN, MATCHER_UP, MENU_CANCEL, MENU_COMPLETE, MENU_CUSTOM_ACTION, MENU_CUSTOM_COMMAND, MENU_CUSTOM_INPUT, MENU_ENTRY_DELETE, MENU_LOWER_MASK, MENU_NEXT, MENU_OK, MENU_PREVIOUS, MODE_COMPLETE, mode_get_completion(), MODE_NEXT, MODE_PREVIOUS, MOVE_CHAR_BACK, MOVE_CHAR_FORWARD, MOVE_END, MOVE_FRONT, MOVE_WORD_BACK, MOVE_WORD_FORWARD, netatoms, PAGE_NEXT, PAGE_PREV, PASTE_PRIMARY, PASTE_SECONDARY, RofiViewState::quit, RofiViewState::refilter, REMOVE_CHAR_BACK, REMOVE_CHAR_FORWARD, REMOVE_TO_EOL, REMOVE_TO_SOL, REMOVE_WORD_BACK, REMOVE_WORD_FORWARD, RofiViewState::retv, rofi_capture_screenshot(), rofi_view_get_active(), rofi_view_input_changed(), rofi_view_nav_first(), rofi_view_nav_last(), rofi_view_nav_row_select(), rofi_view_nav_row_tab(), rofi_view_refilter(), rofi_view_refilter_force(), rofi_view_set_overlay_timeout(), ROW_DOWN, ROW_FIRST, ROW_LAST, ROW_LEFT, ROW_RIGHT, ROW_SELECT, ROW_TAB, ROW_UP, SCREENSHOT, SELECT_ELEMENT_1, SELECT_ELEMENT_10, SELECT_ELEMENT_2, SELECT_ELEMENT_3, SELECT_ELEMENT_4, SELECT_ELEMENT_5, SELECT_ELEMENT_6, SELECT_ELEMENT_7, SELECT_ELEMENT_8, SELECT_ELEMENT_9, RofiViewState::selected_line, Settings::sort, RofiViewState::sw, RofiViewState::text, textbox::text, textbox_cursor(), textbox_get_cursor(), textbox_get_text(), textbox_keybinding(), textbox_text(), TOGGLE_CASE_SENSITIVITY, TOGGLE_SORT, xcb, and xcb_stuff_set_clipboard().

Referenced by rofi_view_trigger_action(), and textbox_button_trigger_action().

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

◆ rofi_view_update()

void rofi_view_update ( RofiViewState state,
gboolean  qr 
)
Parameters
stateThe handle to the view
qrIndicate if queue_redraw should be called on changes.

Update the state of the view. This involves filter state.

Definition at line 1415 of file view.c.

References CacheState, config, Settings::enable_imdkit, RofiViewState::main_window, rofi_set_im_window_pos(), rofi_view_queue_redraw(), RofiViewState::text, textbox_get_cursor_x_pos(), TICK, TICK_N, textbox::widget, WIDGET, widget_draw(), widget_get_height(), widget_get_x_pos(), widget_get_y_pos(), widget_need_redraw(), RofiViewState::x, and RofiViewState::y.

Referenced by rofi_view_create(), rofi_view_maybe_update(), rofi_view_refilter_real(), rofi_view_repaint(), and rofi_view_switch_mode().

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

◆ rofi_view_update_prompt()

static void rofi_view_update_prompt ( RofiViewState state)
static

Definition at line 359 of file view.c.

References mode_get_display_name(), RofiViewState::prompt, RofiViewState::sw, and textbox_text().

Referenced by rofi_view_add_widget(), and rofi_view_switch_mode().

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

◆ rofi_view_user_timeout()

static gboolean rofi_view_user_timeout ( G_GNUC_UNUSED gpointer  data)
static

Definition at line 569 of file view.c.

References CacheState, and rofi_view_take_action().

Referenced by rofi_view_set_user_timeout().

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

◆ rofi_view_window_update_size()

static void rofi_view_window_update_size ( RofiViewState state)
static

Definition at line 469 of file view.c.

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

Referenced by rofi_view_create(), rofi_view_error_dialog(), rofi_view_refilter_real(), and rofi_view_set_active().

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

◆ screenshot_taken_user_callback()

static void screenshot_taken_user_callback ( const char *  path)
static

Definition at line 218 of file view.c.

References config, helper_execute(), helper_parse_setup(), and Settings::on_screenshot_taken.

Referenced by rofi_capture_screenshot().

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

◆ selection_changed_callback()

static void selection_changed_callback ( G_GNUC_UNUSED listview lv,
unsigned int  index,
void *  udata 
)
static

◆ selection_changed_user_callback()

static void selection_changed_user_callback ( unsigned int  index,
RofiViewState state 
)
static

Definition at line 1306 of file view.c.

References config, helper_execute(), helper_parse_setup(), RofiViewState::line_map, mode_get_display_value(), Settings::on_selection_changed, and RofiViewState::sw.

Referenced by selection_changed_callback().

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

◆ textbox_sidebar_modes_trigger_action()

static WidgetTriggerActionResult textbox_sidebar_modes_trigger_action ( widget wid,
MouseBindingMouseDefaultAction  action,
G_GNUC_UNUSED gint  x,
G_GNUC_UNUSED gint  y,
G_GNUC_UNUSED void *  user_data 
)
static

◆ update_callback()

static void update_callback ( textbox t,
icon ico,
unsigned int  index,
void *  udata,
TextBoxFontType type,
gboolean  full 
)
static

Variable Documentation

◆ [struct]

struct { ... } BenchMark

Internal structure that hold benchmarking information.

Referenced by bench_update().

◆ [struct]

struct { ... } CacheState
Initial value:
= {.main_window = XCB_WINDOW_NONE,
.fake_bg = NULL,
.edit_surf = NULL,
.edit_draw = NULL,
.fake_bgrel = FALSE,
.flags = MENU_NORMAL,
.views = G_QUEUE_INIT,
.idle_timeout = 0,
.refilter_timeout = 0,
.refilter_timeout_count = 0,
.max_refilter_time = 0.0,
.delayed_mode = FALSE,
.user_timeout = 0,
.overlay_timeout = 0,
.count = 0L,
.repaint_source = 0,
.fullscreen = FALSE,
.entry_history_enable = TRUE,
.entry_history = NULL,
.entry_history_length = 0,
.entry_history_index = 0}
@ MENU_NORMAL
Definition view.h:52

Structure holding cached state.

Referenced by __create_window(), input_history_initialize(), input_history_save(), rofi_view_calculate_height(), rofi_view_calculate_window_position(), rofi_view_calculate_window_width(), rofi_view_cleanup(), rofi_view_create(), rofi_view_error_dialog(), rofi_view_frame_callback(), rofi_view_get_current_monitor(), rofi_view_get_window(), rofi_view_hide(), rofi_view_input_changed(), rofi_view_overlay_timeout(), rofi_view_ping_mouse(), rofi_view_queue_redraw(), rofi_view_refilter(), rofi_view_refilter_force(), rofi_view_refilter_real(), rofi_view_reload(), rofi_view_reload_idle(), rofi_view_remove_active(), rofi_view_repaint(), rofi_view_set_active(), rofi_view_set_cursor(), rofi_view_set_overlay(), rofi_view_set_overlay_timeout(), rofi_view_set_selected_line(), rofi_view_set_user_timeout(), rofi_view_set_window_title(), rofi_view_setup_fake_transparency(), rofi_view_temp_click_to_exit(), rofi_view_temp_configure_notify(), rofi_view_trigger_global_action(), rofi_view_update(), rofi_view_user_timeout(), and rofi_view_window_update_size().

◆ count

unsigned long long count

◆ current_active_menu

◆ cursor_type

X11CursorType cursor_type

Cursor type

Definition at line 155 of file view.c.

Referenced by rofi_view_handle_mouse_motion().

◆ delayed_mode

gboolean delayed_mode

enable the reduced refilter mode.

Definition at line 143 of file view.c.

◆ draws

uint64_t draws

number of draws done.

Definition at line 308 of file view.c.

◆ edit_draw

cairo_t* edit_draw

Drawable context for edit_surf

Definition at line 123 of file view.c.

◆ edit_pixmap

xcb_pixmap_t edit_pixmap

Main X11 side pixmap to draw on.

Definition at line 119 of file view.c.

◆ edit_surf

cairo_surface_t* edit_surf

Cairo Surface for edit_pixmap

Definition at line 121 of file view.c.

◆ entry_history

EntryHistoryIndex* entry_history

Array with history entriy input.

Definition at line 159 of file view.c.

◆ entry_history_enable

gboolean entry_history_enable

Entry box

Definition at line 157 of file view.c.

◆ entry_history_index

gssize entry_history_index

The current index being viewed.

Definition at line 163 of file view.c.

◆ entry_history_length

gssize entry_history_length

Length of the array

Definition at line 161 of file view.c.

◆ fake_bg

cairo_surface_t* fake_bg

surface containing the fake background.

Definition at line 115 of file view.c.

◆ fake_bgrel

int fake_bgrel

Indicate that fake background should be drawn relative to the window

Definition at line 125 of file view.c.

◆ flags

MenuFlags flags

Main flags

Definition at line 127 of file view.c.

Referenced by create_pid_file(), textbox_create(), and x11_disable_decoration().

◆ fullscreen

gboolean fullscreen

Window fullscreen

Definition at line 153 of file view.c.

◆ gc

xcb_gcontext_t gc

Draw context for main window

Definition at line 117 of file view.c.

◆ idle_timeout

guint idle_timeout

timeout for reloading

Definition at line 133 of file view.c.

◆ last_ts

double last_ts

previous timestamp

Definition at line 310 of file view.c.

◆ list_of_warning_msgs

GList* list_of_warning_msgs
extern

List of warning messages for the user.

Definition at line 88 of file rofi.c.

Referenced by rofi_add_warning_message(), rofi_clear_warning_messages(), rofi_theme_rasi_validate(), rofi_view_reload_message_bar(), and startup().

◆ loc_transtable

const int loc_transtable[9]
static
Initial value:

Calculates the window position Convert the old location to the new location type. 123 804 765

nw n ne w c e sw s se

Definition at line 378 of file view.c.

Referenced by rofi_view_calculate_window_position().

◆ main_window

xcb_window_t main_window

main x11 windows

Definition at line 113 of file view.c.

Referenced by rofi_view_calculate_height().

◆ max_refilter_time

double max_refilter_time

if filtering takes longer then this time, reduce the amount of refilters.

Definition at line 141 of file view.c.

◆ min

double min

minimum draw time.

Definition at line 312 of file view.c.

◆ mon

◆ overlay_timeout

guint overlay_timeout

timeout overlay

Definition at line 147 of file view.c.

◆ refilter_timeout

guint refilter_timeout

timeout for reloading

Definition at line 135 of file view.c.

◆ refilter_timeout_count

guint refilter_timeout_count

amount of time refiltering delay got reset

Definition at line 137 of file view.c.

◆ repaint_source

guint repaint_source

redraw idle time.

Definition at line 151 of file view.c.

◆ time

GTimer* time

timer used for timestamping.

Definition at line 306 of file view.c.

Referenced by main_loop_x11_event_handler_view().

◆ tpool

GThreadPool* tpool = NULL

◆ user_timeout

guint user_timeout

timeout handling

Definition at line 145 of file view.c.

◆ views

GQueue views

List of stacked views

Definition at line 129 of file view.c.