29#define G_LOG_DOMAIN "View"
77 unsigned long long count;
122 *width =
WlState.monitor_width;
125 *height =
WlState.monitor_height;
138 return G_SOURCE_REMOVE;
174 int offset_x,
int offset_y) {
175 int screen_width = 0;
176 int screen_height = 0;
181 if (screen_width <= 0 || screen_height <= 0) {
182 screen_width = state->
width;
183 screen_height = state->
height;
186 WlState.surface_width = screen_width;
187 WlState.surface_height = screen_height;
268 state->
width = width;
278 *width = state->
width;
303 return G_SOURCE_REMOVE;
308 if (
WlState.idle_timeout == 0) {
315 if (state &&
WlState.repaint_source == 0) {
317 g_debug(
"redraw %llu",
WlState.count);
321 WlState.repaint_source = g_idle_add_full(
330 TICK_N(
"create cairo surface");
331 PangoContext *p = pango_context_new();
332 pango_context_set_font_map(p, pango_cairo_font_map_get_default());
333 TICK_N(
"pango cairo font setup");
338 PangoFontMap *font_map = pango_cairo_font_map_get_default();
340 pango_cairo_font_map_set_resolution((PangoCairoFontMap *)font_map,
349 pango_cairo_font_map_set_resolution((PangoCairoFontMap *)font_map, dpi);
352 "DPI auto-detect failed, the output is not known yet or does not "
353 "provide a physical size");
355 pango_cairo_font_map_get_resolution((PangoCairoFontMap *)font_map);
360 pango_cairo_font_map_get_resolution((PangoCairoFontMap *)font_map);
368 PangoFontDescription *pfd = pango_font_description_from_string(font);
370 pango_context_set_font_description(p, pfd);
372 pango_font_description_free(pfd);
374 PangoLanguage *l = pango_language_get_default();
375 pango_context_set_language(p, l);
400 int screen_width = 1920;
403 if (
WlState.fullscreen == TRUE) {
404 state->
width = screen_width;
412 "width", state->
width);
420 g_debug(
"Redraw view");
423 int buffer_width = state->
width;
424 int buffer_height = state->
height;
427 buffer_width =
WlState.surface_width;
428 buffer_height =
WlState.surface_height;
431 if (state->pool == NULL) {
436 if (surface == NULL) {
441 cairo_t *d = cairo_create(surface);
442 cairo_set_operator(d, CAIRO_OPERATOR_SOURCE);
445 cairo_set_source_rgba(d, 0, 0, 0, 0);
447 cairo_surface_set_device_scale(surface, scale, scale);
452 cairo_set_operator(d, CAIRO_OPERATOR_OVER);
455 g_debug(
"draw capture mode: surface=%dx%d menu=%dx%d pos=(%d,%d)",
460 g_debug(
"draw normal mode: surface=%dx%d", buffer_width, buffer_height);
475 if (
WlState.repaint_source == 0) {
476 WlState.repaint_source = g_idle_add_full(
482 if (
WlState.fullscreen == TRUE) {
505 if (
WlState.idle_timeout > 0) {
506 g_source_remove(
WlState.idle_timeout);
521 if (
WlState.repaint_source > 0) {
522 g_source_remove(
WlState.repaint_source);
555 .temp_configure_notify = NULL,
556 .temp_click_to_exit = NULL,
void display_early_cleanup(void)
guint display_scale(void)
void display_set_fullscreen_mode(void)
gboolean helper_validate_font(PangoFontDescription *pfd, const char *font)
unsigned int mode_get_num_entries(const Mode *mode)
void textbox_set_pango_context(const char *font, PangoContext *p)
void textbox_text(textbox *tb, const char *text)
RofiViewState * rofi_view_get_active(void)
void rofi_view_maybe_update(RofiViewState *state)
void input_history_save(void)
void input_history_initialize(void)
void rofi_view_pool_refresh(void)
box * box_create(widget *parent, const char *name, RofiOrientation type)
@ ROFI_ORIENTATION_HORIZONTAL
@ ROFI_ORIENTATION_VERTICAL
void process_result(RofiViewState *state)
#define DEFAULT_MENU_WIDTH
int rofi_theme_get_position(const widget *wid, const char *property, int def)
int distance_get_pixel(RofiDistance d, RofiOrientation ori)
int rofi_theme_get_boolean(const widget *wid, const char *property, int def)
RofiDistance rofi_theme_get_distance(const widget *wid, const char *property, int def)
const char * rofi_theme_get_string(const widget *wid, const char *property, const char *def)
struct _view_proxy view_proxy
struct _rofi_view_cache_state CacheState
double wayland_get_dpi_estimation(void)
void display_surface_commit(cairo_surface_t *surface)
cairo_surface_t * display_buffer_pool_get_next_buffer(wayland_buffer_pool *pool)
gboolean display_get_surface_dimensions(int *width, int *height)
void wayland_display_set_cursor_type(RofiCursorType type)
void display_buffer_pool_free(wayland_buffer_pool *self)
void display_set_surface_dimensions(int width, int height, int x_margin, int y_margin, int loc)
wayland_buffer_pool * display_buffer_pool_new(gint width, gint height)
static int rofi_get_offset_px(RofiViewState *state, RofiOrientation ori)
static void wayland_rofi_view_get_size(RofiViewState *state, gint *width, gint *height)
const view_proxy * wayland_view_proxy
static int rofi_get_location(RofiViewState *state)
static gboolean wayland_rofi_view_reload_idle(G_GNUC_UNUSED gpointer data)
static void wayland_rofi_view_get_menu_rect(int *x, int *y, int *w, int *h)
static void wayland_rofi_view_hide(void)
static void wayland_rofi_view_set_window_title(G_GNUC_UNUSED const char *title)
static void wayland_rofi_view_calculate_window_width(RofiViewState *state)
static void wayland_rofi_view_calculate_window_position(G_GNUC_UNUSED RofiViewState *state)
static void wayland_rofi_view_reload(void)
static int wayland_rofi_view_calculate_window_height(RofiViewState *state)
static void wayland_rofi_view_set_size(RofiViewState *state, gint width, gint height)
static struct @303345143117023230245122030172270246040000354217 WlState
static const int loc_transtable[9]
static void wayland_rofi_view_cleanup(void)
static void wayland_rofi_view_frame_callback(void)
static void wayland_rofi_view_get_current_monitor(int *width, int *height)
static void wayland_rofi_view_ping_mouse(RofiViewState *state)
static void wayland_rofi_view_window_update_size(RofiViewState *state)
static void wayland___create_window(MenuFlags menu_flags)
static void wayland_rofi_view_queue_redraw(void)
static gboolean wayland_rofi_view_repaint(G_GNUC_UNUSED void *data)
static void wayland_rofi_view_update(RofiViewState *state, gboolean qr)
static void wayland_rofi_view_pool_refresh(void)
static void window_update_size_with_outside_click(RofiViewState *state, int offset_x, int offset_y)
static void window_update_size_normal(RofiViewState *state, int offset_x, int offset_y)