29#define G_LOG_DOMAIN "View"
68 unsigned long long count;
113 *width =
WlState.monitor_width;
116 *height =
WlState.monitor_height;
129 return G_SOURCE_REMOVE;
165 int offset_x,
int offset_y) {
166 int screen_width = 0;
167 int screen_height = 0;
172 if (screen_width <= 0 || screen_height <= 0) {
173 screen_width = state->
width;
174 screen_height = state->
height;
177 WlState.surface_width = screen_width;
178 WlState.surface_height = screen_height;
259 state->
width = width;
269 *width = state->
width;
294 return G_SOURCE_REMOVE;
299 if (
WlState.idle_timeout == 0) {
306 if (state &&
WlState.repaint_source == 0) {
308 g_debug(
"redraw %llu",
WlState.count);
312 WlState.repaint_source = g_idle_add_full(
321 TICK_N(
"create cairo surface");
322 PangoContext *p = pango_context_new();
323 pango_context_set_font_map(p, pango_cairo_font_map_get_default());
324 TICK_N(
"pango cairo font setup");
329 PangoFontMap *font_map = pango_cairo_font_map_get_default();
331 pango_cairo_font_map_set_resolution((PangoCairoFontMap *)font_map,
340 pango_cairo_font_map_set_resolution((PangoCairoFontMap *)font_map, dpi);
343 "DPI auto-detect failed, the output is not known yet or does not "
344 "provide a physical size");
346 pango_cairo_font_map_get_resolution((PangoCairoFontMap *)font_map);
351 pango_cairo_font_map_get_resolution((PangoCairoFontMap *)font_map);
359 PangoFontDescription *pfd = pango_font_description_from_string(font);
361 pango_context_set_font_description(p, pfd);
363 pango_font_description_free(pfd);
365 PangoLanguage *l = pango_language_get_default();
366 pango_context_set_language(p, l);
391 int screen_width = 1920;
394 if (
WlState.fullscreen == TRUE) {
395 state->
width = screen_width;
403 "width", state->
width);
411 g_debug(
"Redraw view");
414 int buffer_width = state->
width;
415 int buffer_height = state->
height;
418 buffer_width =
WlState.surface_width;
419 buffer_height =
WlState.surface_height;
422 if (state->pool == NULL) {
424 if (state->pool == NULL) {
430 if (surface == NULL) {
435 cairo_t *d = cairo_create(surface);
436 cairo_set_operator(d, CAIRO_OPERATOR_SOURCE);
439 cairo_set_source_rgba(d, 0, 0, 0, 0);
441 cairo_surface_set_device_scale(surface, scale, scale);
446 cairo_set_operator(d, CAIRO_OPERATOR_OVER);
449 g_debug(
"draw capture mode: surface=%dx%d menu=%dx%d pos=(%d,%d)",
454 g_debug(
"draw normal mode: surface=%dx%d", buffer_width, buffer_height);
469 if (
WlState.repaint_source == 0) {
470 WlState.repaint_source = g_idle_add_full(
476 if (
WlState.fullscreen == TRUE) {
499 if (
WlState.idle_timeout > 0) {
500 g_source_remove(
WlState.idle_timeout);
515 if (
WlState.repaint_source > 0) {
516 g_source_remove(
WlState.repaint_source);
549 .temp_configure_notify = NULL,
550 .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 struct @205261147150251365057026313374050053065255232215 WlState
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 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)