rofi 2.0.0
view.c File Reference
#include <config.h>
#include <errno.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 <cairo.h>
#include "rofi.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 "view-internal.h"
#include "view.h"
#include "theme.h"
Include dependency graph for view.c:

Go to the source code of this file.

Macros

#define G_LOG_DOMAIN   "View"

Functions

static void wayland_rofi_view_update (RofiViewState *state, gboolean qr)
static void wayland_rofi_view_get_current_monitor (int *width, int *height)
static gboolean wayland_rofi_view_repaint (G_GNUC_UNUSED void *data)
static void wayland_rofi_view_calculate_window_position (G_GNUC_UNUSED RofiViewState *state)
static int rofi_get_location (RofiViewState *state)
static int rofi_get_offset_px (RofiViewState *state, RofiOrientation ori)
static void wayland_rofi_view_window_update_size (RofiViewState *state)
static void wayland_rofi_view_set_size (RofiViewState *state, gint width, gint height)
static void wayland_rofi_view_get_size (RofiViewState *state, gint *width, gint *height)
static void wayland_rofi_view_ping_mouse (RofiViewState *state)
static gboolean wayland_rofi_view_reload_idle (G_GNUC_UNUSED gpointer data)
static void wayland_rofi_view_reload (void)
static void wayland_rofi_view_queue_redraw (void)
static void wayland___create_window (MenuFlags menu_flags)
static void wayland_rofi_view_calculate_window_width (RofiViewState *state)
void process_result (RofiViewState *state)
static void wayland_rofi_view_frame_callback (void)
static int wayland_rofi_view_calculate_window_height (RofiViewState *state)
static void wayland_rofi_view_hide (void)
static void wayland_rofi_view_cleanup (void)
static void wayland_rofi_view_set_window_title (G_GNUC_UNUSED const char *title)
static void wayland_rofi_view_pool_refresh (void)

Variables

struct { 
   MenuFlags   flags 
   guint   idle_timeout 
   unsigned long long   count 
   guint   repaint_source 
   gboolean   fullscreen 
   int   monitor_width 
   int   monitor_height 
WlState
static const int loc_transtable [9]
static view_proxy view_
const view_proxywayland_view_proxy = &view_

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "View"

The Rofi View log domain

Definition at line 29 of file view.c.

Function Documentation

◆ 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 238 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_get_location()

int rofi_get_location ( RofiViewState * state)
static

Definition at line 129 of file view.c.

References config, loc_transtable, RofiViewState::main_window, rofi_theme_get_position(), and WIDGET.

Referenced by wayland_rofi_view_window_update_size().

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

◆ rofi_get_offset_px()

int rofi_get_offset_px ( RofiViewState * state,
RofiOrientation ori )
static

Definition at line 134 of file view.c.

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

Referenced by wayland_rofi_view_window_update_size().

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

◆ wayland___create_window()

◆ wayland_rofi_view_calculate_window_height()

int wayland_rofi_view_calculate_window_height ( RofiViewState * state)
static

◆ wayland_rofi_view_calculate_window_position()

void wayland_rofi_view_calculate_window_position ( G_GNUC_UNUSED RofiViewState * state)
static

Definition at line 126 of file view.c.

◆ wayland_rofi_view_calculate_window_width()

void wayland_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 285 of file view.c.

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

Here is the call graph for this function:

◆ wayland_rofi_view_cleanup()

void wayland_rofi_view_cleanup ( void )
static

Definition at line 374 of file view.c.

References CacheState, input_history_save(), and WlState.

Here is the call graph for this function:

◆ wayland_rofi_view_frame_callback()

void wayland_rofi_view_frame_callback ( void )
static

Definition at line 345 of file view.c.

References wayland_rofi_view_repaint(), and WlState.

Here is the call graph for this function:

◆ wayland_rofi_view_get_current_monitor()

void wayland_rofi_view_get_current_monitor ( int * width,
int * height )
static

Definition at line 94 of file view.c.

References display_get_surface_dimensions(), and WlState.

Here is the call graph for this function:

◆ wayland_rofi_view_get_size()

void wayland_rofi_view_get_size ( RofiViewState * state,
gint * width,
gint * height )
static

Definition at line 166 of file view.c.

References RofiViewState::height, and RofiViewState::width.

◆ wayland_rofi_view_hide()

void wayland_rofi_view_hide ( void )
static

Definition at line 372 of file view.c.

References display_early_cleanup().

Here is the call graph for this function:

◆ wayland_rofi_view_ping_mouse()

void wayland_rofi_view_ping_mouse ( RofiViewState * state)
static

Definition at line 172 of file view.c.

◆ wayland_rofi_view_pool_refresh()

void wayland_rofi_view_pool_refresh ( void )
static

Definition at line 403 of file view.c.

References display_buffer_pool_free(), rofi_view_get_active(), and wayland_rofi_view_update().

Here is the call graph for this function:

◆ wayland_rofi_view_queue_redraw()

void wayland_rofi_view_queue_redraw ( void )
static

Definition at line 200 of file view.c.

References RofiViewState::main_window, rofi_view_get_active(), wayland_rofi_view_repaint(), WIDGET, widget_queue_redraw(), and WlState.

Referenced by wayland_rofi_view_update().

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

◆ wayland_rofi_view_reload()

void wayland_rofi_view_reload ( void )
static

Definition at line 193 of file view.c.

References wayland_rofi_view_reload_idle(), and WlState.

Here is the call graph for this function:

◆ wayland_rofi_view_reload_idle()

gboolean wayland_rofi_view_reload_idle ( G_GNUC_UNUSED gpointer data)
static

Definition at line 174 of file view.c.

References mode_get_num_entries(), RofiViewState::refilter, RofiViewState::reload, rofi_view_get_active(), rofi_view_maybe_update(), RofiViewState::sw, RofiViewState::tb_total_rows, textbox_text(), and WlState.

Referenced by wayland_rofi_view_reload().

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

◆ wayland_rofi_view_repaint()

gboolean wayland_rofi_view_repaint ( G_GNUC_UNUSED void * data)
static

Definition at line 109 of file view.c.

References rofi_view_get_active(), rofi_view_maybe_update(), and WlState.

Referenced by wayland_rofi_view_frame_callback(), and wayland_rofi_view_queue_redraw().

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

◆ wayland_rofi_view_set_size()

void wayland_rofi_view_set_size ( RofiViewState * state,
gint width,
gint height )
static

Definition at line 155 of file view.c.

References RofiViewState::height, wayland_rofi_view_window_update_size(), and RofiViewState::width.

Here is the call graph for this function:

◆ wayland_rofi_view_set_window_title()

void wayland_rofi_view_set_window_title ( G_GNUC_UNUSED const char * title)
static

Definition at line 401 of file view.c.

◆ wayland_rofi_view_update()

void wayland_rofi_view_update ( RofiViewState * state,
gboolean qr )
static
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 302 of file view.c.

References display_buffer_pool_get_next_buffer(), display_buffer_pool_new(), display_scale(), display_surface_commit(), RofiViewState::height, RofiViewState::main_window, TICK, TICK_N, wayland_rofi_view_queue_redraw(), WIDGET, widget_draw(), widget_need_redraw(), and RofiViewState::width.

Referenced by wayland_rofi_view_pool_refresh().

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

◆ wayland_rofi_view_window_update_size()

void wayland_rofi_view_window_update_size ( RofiViewState * state)
static

Variable Documentation

◆ count

◆ flags

MenuFlags flags

Main flags

Definition at line 72 of file view.c.

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

◆ fullscreen

gboolean fullscreen

Window fullscreen

Definition at line 80 of file view.c.

◆ idle_timeout

guint idle_timeout

timeout for reloading

Definition at line 74 of file view.c.

◆ loc_transtable

const int loc_transtable[9]
static
Initial value:

Definition at line 121 of file view.c.

Referenced by rofi_get_location(), and xcb_rofi_view_calculate_window_position().

◆ monitor_height

int monitor_height

Definition at line 83 of file view.c.

◆ monitor_width

int monitor_width

Definition at line 82 of file view.c.

◆ repaint_source

guint repaint_source

redraw idle time.

Definition at line 78 of file view.c.

◆ view_

view_proxy view_
static
Initial value:
= {
.temp_configure_notify = NULL,
.temp_click_to_exit = NULL,
.calculate_window_position = wayland_rofi_view_calculate_window_position,
.calculate_window_height = wayland_rofi_view_calculate_window_height,
.calculate_window_width = wayland_rofi_view_calculate_window_width,
.window_update_size = wayland_rofi_view_window_update_size,
.__create_window = wayland___create_window,
.get_window = NULL,
.get_current_monitor = wayland_rofi_view_get_current_monitor,
}
void wayland_display_set_cursor_type(RofiCursorType type)
Definition display.c:746
static void wayland_rofi_view_get_size(RofiViewState *state, gint *width, gint *height)
Definition view.c:166
static void wayland_rofi_view_hide(void)
Definition view.c:372
static void wayland_rofi_view_set_window_title(G_GNUC_UNUSED const char *title)
Definition view.c:401
static void wayland_rofi_view_calculate_window_width(RofiViewState *state)
Definition view.c:285
static void wayland_rofi_view_calculate_window_position(G_GNUC_UNUSED RofiViewState *state)
Definition view.c:126
static void wayland_rofi_view_reload(void)
Definition view.c:193
static int wayland_rofi_view_calculate_window_height(RofiViewState *state)
Definition view.c:352
static void wayland_rofi_view_set_size(RofiViewState *state, gint width, gint height)
Definition view.c:155
static void wayland_rofi_view_cleanup(void)
Definition view.c:374
static void wayland_rofi_view_frame_callback(void)
Definition view.c:345
static void wayland_rofi_view_get_current_monitor(int *width, int *height)
Definition view.c:94
static void wayland_rofi_view_ping_mouse(RofiViewState *state)
Definition view.c:172
static void wayland_rofi_view_window_update_size(RofiViewState *state)
Definition view.c:142
static void wayland___create_window(MenuFlags menu_flags)
Definition view.c:213
static void wayland_rofi_view_queue_redraw(void)
Definition view.c:200
static void wayland_rofi_view_update(RofiViewState *state, gboolean qr)
Definition view.c:302
static void wayland_rofi_view_pool_refresh(void)
Definition view.c:403

Definition at line 413 of file view.c.

◆ wayland_view_proxy

const view_proxy* wayland_view_proxy = &view_

Definition at line 442 of file view.c.

Referenced by wayland_display_view_proxy().

◆ [struct]

struct { ... } WlState
Initial value:
= {
.flags = MENU_NORMAL,
.idle_timeout = 0,
.count = 0L,
.repaint_source = 0,
.fullscreen = FALSE,
.monitor_width = 0,
.monitor_height = 0,
}
@ MENU_NORMAL
Definition view.h:56

Structure holding some state

Referenced by wayland___create_window(), wayland_rofi_view_calculate_window_height(), wayland_rofi_view_calculate_window_width(), wayland_rofi_view_cleanup(), wayland_rofi_view_frame_callback(), wayland_rofi_view_get_current_monitor(), wayland_rofi_view_queue_redraw(), wayland_rofi_view_reload(), wayland_rofi_view_reload_idle(), and wayland_rofi_view_repaint().