rofi 2.1.0
display.c File Reference
#include <config.h>
#include <cairo-xcb.h>
#include <cairo.h>
#include <glib.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <xcb/randr.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_cursor.h>
#include <xcb/xcb_ewmh.h>
#include <xcb/xinerama.h>
#include <xcb/xkb.h>
#include <xcb/xproto.h>
#include <xkbcommon/xkbcommon-x11.h>
#include <xkbcommon/xkbcommon.h>
#include "display-internal.h"
#include "display.h"
#include "helper.h"
#include "rofi-types.h"
#include "settings.h"
#include "timings.h"
#include "xcb-internal.h"
#include "xcb.h"
#include <libsn/sn.h>
#include <stdbool.h>
#include "mode.h"
#include "modes/window.h"
#include <rofi.h>
Include dependency graph for display.c:

Go to the source code of this file.

Data Structures

struct  [struct].cursor_names

Macros

#define G_LOG_DOMAIN   "X11Helper"
#define SN_API_NOT_YET_FROZEN
#define sn_launcher_context_set_application_id   sn_launcher_set_application_id
#define RANDR_PREF_MAJOR_VERSION   1
#define RANDR_PREF_MINOR_VERSION   5
#define INTERSECT(x, y, x1, y1, w1, h1)

Functions

static xcb_visualtype_t * lookup_visual (xcb_screen_t *s, xcb_visualid_t vis)
static uint32_t * create_kernel (int radius, double deviation, uint32_t *sum2)
void cairo_image_surface_blur (cairo_surface_t *surface, int radius, double deviation)
cairo_surface_t * x11_helper_get_screenshot_surface_window (xcb_window_t window, int size)
cairo_surface_t * x11_helper_get_screenshot_surface (void)
static xcb_pixmap_t get_root_pixmap (xcb_connection_t *c, xcb_screen_t *screen, xcb_atom_t atom)
cairo_surface_t * x11_helper_get_bg_surface (void)
char * window_get_text_prop (xcb_window_t w, xcb_atom_t atom)
void window_set_atom_prop (xcb_window_t w, xcb_atom_t prop, xcb_atom_t *atoms, int count)
static void x11_monitor_free (workarea *m)
static void x11_monitors_free (void)
static void x11_workarea_fix_rotation (workarea *w)
static workarea * x11_get_monitor_from_output (xcb_randr_output_t out)
static int x11_is_extension_present (const char *extension)
static void x11_build_monitor_layout_xinerama (void)
static void x11_build_monitor_layout (void)
static void xcb_display_dump_monitor_layout (void)
static void xcb_display_startup_notification (RofiHelperExecuteContext *context, GSpawnChildSetupFunc *child_setup, gpointer *user_data)
static int monitor_get_dimension (int monitor_id, workarea *mon)
static void monitor_dimensions (int x, int y, workarea *mon)
static int pointer_get (xcb_window_t root, int *x, int *y)
static int monitor_active_from_winid (xcb_drawable_t id, workarea *mon)
static int monitor_active_from_id_focused (int mon_id, workarea *mon)
static int monitor_active_from_id (int mon_id, workarea *mon)
static int xcb_display_monitor_active (workarea *mon)
static bool get_atom_name (xcb_connection_t *conn, xcb_atom_t atom, char **out)
static void rofi_view_paste (RofiViewState *state, xcb_selection_notify_event_t *xse)
static gboolean x11_button_to_nk_bindings_button (guint32 x11_button, NkBindingsMouseButton *button)
static gboolean x11_button_to_nk_bindings_scroll (guint32 x11_button, NkBindingsScrollAxis *axis, gint32 *steps)
static void rofi_key_press_event_handler (xcb_key_press_event_t *xkpe, RofiViewState *state)
static void rofi_key_release_event_handler (xcb_key_release_event_t *xkre, G_GNUC_UNUSED RofiViewState *state)
static void main_loop_x11_event_handler_view (xcb_generic_event_t *event)
static gboolean main_loop_x11_event_handler (xcb_generic_event_t *ev, G_GNUC_UNUSED gpointer user_data)
static int take_pointer (xcb_window_t w, int iters)
static int take_keyboard (xcb_window_t w, int iters)
static void release_keyboard (void)
static void release_pointer (void)
static void error_trap_push (G_GNUC_UNUSED SnDisplay *display, G_GNUC_UNUSED xcb_connection_t *xdisplay)
static void error_trap_pop (G_GNUC_UNUSED SnDisplay *display, xcb_connection_t *xdisplay)
static void x11_create_frequently_used_atoms (void)
char * x11_helper_get_window_manager (void)
static void x11_helper_discover_window_manager (void)
static gboolean xcb_display_setup (GMainLoop *main_loop, NkBindings *bindings)
static void x11_create_visual_and_colormap (void)
static void x11_lookup_cursors (void)
static gboolean lazy_grab_pointer (G_GNUC_UNUSED gpointer data)
static gboolean lazy_grab_keyboard (G_GNUC_UNUSED gpointer data)
static gboolean xcb_display_late_setup (void)
xcb_window_t xcb_stuff_get_root_window (void)
static void xcb_display_early_cleanup (void)
static void xcb_display_cleanup (void)
void x11_disable_decoration (xcb_window_t window)
void x11_set_cursor (xcb_window_t window, X11CursorType type)
void xcb_stuff_set_clipboard (char *data)
static void xcb_display_set_input_focus (guint w)
static void xcb_display_revert_input_focus (void)
static guint xcb_display_scale (void)
static const struct _view_proxy * xcb_display_view_proxy (void)

Variables

WindowManagerQuirk current_window_manager = WM_EWHM
struct _xcb_stuff xcb_int
xcb_stuff * xcb = &xcb_int
xcb_depth_t * depth = NULL
xcb_visualtype_t * visual = NULL
xcb_colormap_t map = XCB_COLORMAP_NONE
static xcb_visualtype_t * root_visual = NULL
xcb_atom_t netatoms [NUM_NETATOMS]
const char * netatom_names [] = {EWMH_ATOMS(ATOM_CHAR)}
xcb_cursor_t cursors [NUM_CURSORS]
const struct  cursor_names []
gboolean mon_set = FALSE
workarea mon_cache
static int error_trap_depth = 0
unsigned int lazy_grab_retry_count_kb = 0
unsigned int lazy_grab_retry_count_pt = 0
static display_proxy display_
display_proxy *const xcb_proxy = &display_

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "X11Helper"

Log domain for this module

Definition at line 30 of file display.c.

◆ INTERSECT

#define INTERSECT ( x,
y,
x1,
y1,
w1,
h1 )
Value:
((((x) >= (x1)) && ((x) < (x1 + w1))) && (((y) >= (y1)) && ((y) < (y1 + h1))))

Checks if the if x and y is inside rectangle.

Definition at line 84 of file display.c.

Referenced by monitor_dimensions().

◆ RANDR_PREF_MAJOR_VERSION

#define RANDR_PREF_MAJOR_VERSION   1

Minimal randr preferred for running rofi (1.5) (Major version number)

Definition at line 79 of file display.c.

Referenced by x11_build_monitor_layout().

◆ RANDR_PREF_MINOR_VERSION

#define RANDR_PREF_MINOR_VERSION   5

Minimal randr preferred for running rofi (1.5) (Minor version number)

Definition at line 81 of file display.c.

Referenced by x11_build_monitor_layout().

◆ SN_API_NOT_YET_FROZEN

#define SN_API_NOT_YET_FROZEN

Indicate that we know the startup notification api is not yet stable.

Definition at line 58 of file display.c.

◆ sn_launcher_context_set_application_id

#define sn_launcher_context_set_application_id   sn_launcher_set_application_id

This function is declared as sn_launcher_context_set_application_id but implemented as sn_launcher_set_application_id. Quick Fix.

Definition at line 61 of file display.c.

Referenced by xcb_display_startup_notification().

Function Documentation

◆ cairo_image_surface_blur()

void cairo_image_surface_blur ( cairo_surface_t * surface,
int radius,
double deviation )
Parameters
surface
radius
deviation

Blur the content of the surface with radius and deviation.

Definition at line 178 of file display.c.

References cairo_image_surface_blur(), create_kernel(), TICK, and TICK_N.

Referenced by cairo_image_surface_blur(), and xcb_rofi_view_setup_fake_transparency().

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

◆ create_kernel()

uint32_t * create_kernel ( int radius,
double deviation,
uint32_t * sum2 )
static

Definition at line 151 of file display.c.

References create_kernel().

Referenced by cairo_image_surface_blur(), and create_kernel().

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

◆ error_trap_pop()

void error_trap_pop ( G_GNUC_UNUSED SnDisplay * display,
xcb_connection_t * xdisplay )
static

Definition at line 1573 of file display.c.

References error_trap_depth, and error_trap_pop().

Referenced by error_trap_pop(), and xcb_display_setup().

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

◆ error_trap_push()

void error_trap_push ( G_GNUC_UNUSED SnDisplay * display,
G_GNUC_UNUSED xcb_connection_t * xdisplay )
static

Definition at line 1568 of file display.c.

References error_trap_depth, and error_trap_push().

Referenced by error_trap_push(), and xcb_display_setup().

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

◆ get_atom_name()

bool get_atom_name ( xcb_connection_t * conn,
xcb_atom_t atom,
char ** out )
static

Definition at line 1083 of file display.c.

References get_atom_name().

Referenced by get_atom_name(), and rofi_view_paste().

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

◆ get_root_pixmap()

xcb_pixmap_t get_root_pixmap ( xcb_connection_t * c,
xcb_screen_t * screen,
xcb_atom_t atom )
static

Definition at line 363 of file display.c.

References get_root_pixmap().

Referenced by get_root_pixmap(), and x11_helper_get_bg_surface().

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

◆ lazy_grab_keyboard()

gboolean lazy_grab_keyboard ( G_GNUC_UNUSED gpointer data)
static

Definition at line 1875 of file display.c.

References lazy_grab_keyboard(), lazy_grab_retry_count_kb, _xcb_stuff::main_loop, take_keyboard(), xcb, and xcb_stuff_get_root_window().

Referenced by lazy_grab_keyboard(), and xcb_display_late_setup().

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

◆ lazy_grab_pointer()

gboolean lazy_grab_pointer ( G_GNUC_UNUSED gpointer data)
static

Definition at line 1862 of file display.c.

References lazy_grab_pointer(), lazy_grab_retry_count_pt, take_pointer(), and xcb_stuff_get_root_window().

Referenced by lazy_grab_pointer(), and xcb_display_late_setup().

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

◆ lookup_visual()

xcb_visualtype_t * lookup_visual ( xcb_screen_t * s,
xcb_visualid_t vis )
static

Definition at line 133 of file display.c.

References lookup_visual().

Referenced by lookup_visual(), and x11_helper_get_screenshot_surface_window().

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

◆ main_loop_x11_event_handler()

gboolean main_loop_x11_event_handler ( xcb_generic_event_t * ev,
G_GNUC_UNUSED gpointer user_data )
static

◆ main_loop_x11_event_handler_view()

◆ monitor_active_from_id()

int monitor_active_from_id ( int mon_id,
workarea * mon )
static

Definition at line 931 of file display.c.

References _xcb_stuff::ewmh, _workarea::h, monitor_active_from_id(), monitor_active_from_id_focused(), monitor_dimensions(), pointer_get(), _xcb_stuff::screen, _xcb_stuff::screen_nbr, _workarea::w, _workarea::x, xcb, and _workarea::y.

Referenced by monitor_active_from_id(), and xcb_display_monitor_active().

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

◆ monitor_active_from_id_focused()

int monitor_active_from_id_focused ( int mon_id,
workarea * mon )
static

Definition at line 860 of file display.c.

References _xcb_stuff::connection, _xcb_stuff::ewmh, _workarea::h, monitor_active_from_id_focused(), monitor_dimensions(), _xcb_stuff::screen_nbr, _workarea::w, _workarea::x, xcb, and _workarea::y.

Referenced by monitor_active_from_id(), and monitor_active_from_id_focused().

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

◆ monitor_active_from_winid()

int monitor_active_from_winid ( xcb_drawable_t id,
workarea * mon )
static

Definition at line 830 of file display.c.

References _xcb_stuff::connection, _workarea::h, monitor_active_from_winid(), _xcb_stuff::screen, _workarea::w, _workarea::x, xcb, and _workarea::y.

Referenced by monitor_active_from_winid(), and xcb_display_monitor_active().

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

◆ monitor_dimensions()

void monitor_dimensions ( int x,
int y,
workarea * mon )
static

Definition at line 788 of file display.c.

References _workarea::h, INTERSECT, monitor_dimensions(), _xcb_stuff::monitors, _workarea::next, _xcb_stuff::screen, _workarea::w, and xcb.

Referenced by monitor_active_from_id(), monitor_active_from_id_focused(), monitor_dimensions(), and xcb_display_monitor_active().

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

◆ monitor_get_dimension()

int monitor_get_dimension ( int monitor_id,
workarea * mon )
static

Definition at line 773 of file display.c.

References _workarea::h, monitor_get_dimension(), _workarea::monitor_id, _xcb_stuff::monitors, _workarea::next, _xcb_stuff::screen, _workarea::w, and xcb.

Referenced by monitor_get_dimension(), and xcb_display_monitor_active().

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

◆ pointer_get()

int pointer_get ( xcb_window_t root,
int * x,
int * y )
static
Parameters
rootThe X11 window used to find the pointer position. Usually the root window.
xThe x position of the mouse [out]
yThe y position of the mouse [out]

find mouse pointer location

Returns
TRUE when found, FALSE otherwise

Definition at line 815 of file display.c.

References _xcb_stuff::connection, pointer_get(), and xcb.

Referenced by monitor_active_from_id(), and pointer_get().

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

◆ release_keyboard()

void release_keyboard ( void )
static

Definition at line 1559 of file display.c.

References _xcb_stuff::connection, release_keyboard(), and xcb.

Referenced by release_keyboard(), and xcb_display_early_cleanup().

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

◆ release_pointer()

void release_pointer ( void )
static

Definition at line 1562 of file display.c.

References _xcb_stuff::connection, release_pointer(), and xcb.

Referenced by release_pointer(), and xcb_display_early_cleanup().

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

◆ rofi_key_press_event_handler()

void rofi_key_press_event_handler ( xcb_key_press_event_t * xkpe,
RofiViewState * state )
static

Definition at line 1199 of file display.c.

References _xcb_stuff::bindings_seat, config, _xcb_stuff::last_timestamp, rofi_key_press_event_handler(), rofi_view_handle_text(), xcb, and Settings::xserver_i300_workaround.

Referenced by main_loop_x11_event_handler_view(), and rofi_key_press_event_handler().

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

◆ rofi_key_release_event_handler()

void rofi_key_release_event_handler ( xcb_key_release_event_t * xkre,
G_GNUC_UNUSED RofiViewState * state )
static

Definition at line 1219 of file display.c.

References _xcb_stuff::bindings_seat, _xcb_stuff::last_timestamp, rofi_key_release_event_handler(), and xcb.

Referenced by main_loop_x11_event_handler_view(), and rofi_key_release_event_handler().

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

◆ rofi_view_paste()

void rofi_view_paste ( RofiViewState * state,
xcb_selection_notify_event_t * xse )
static
Parameters
stateInternal state of the menu.
xseX selection event.

Handle paste event.

Definition at line 1118 of file display.c.

References _xcb_stuff::connection, _xcb_stuff::ewmh, get_atom_name(), rofi_view_handle_text(), rofi_view_paste(), window_get_text_prop(), and xcb.

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:

◆ take_keyboard()

int take_keyboard ( xcb_window_t w,
int iters )
static

Definition at line 1531 of file display.c.

References _xcb_stuff::connection, take_keyboard(), and xcb.

Referenced by lazy_grab_keyboard(), take_keyboard(), and xcb_display_late_setup().

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

◆ take_pointer()

int take_pointer ( xcb_window_t w,
int iters )
static

Definition at line 1502 of file display.c.

References _xcb_stuff::connection, take_pointer(), and xcb.

Referenced by lazy_grab_pointer(), take_pointer(), and xcb_display_late_setup().

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

◆ window_get_text_prop()

char * window_get_text_prop ( xcb_window_t w,
xcb_atom_t atom )
Parameters
wThe xcb_window_t to read property from.
atomThe property identifier

Get text property defined by atom from window. Support utf8.

Returns
a newly allocated string with the result or NULL

Definition at line 397 of file display.c.

References _xcb_stuff::connection, netatoms, rofi_force_utf8(), rofi_latin_to_utf8_strdup(), window_get_text_prop(), and xcb.

Referenced by rofi_view_paste(), and window_get_text_prop().

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

◆ window_set_atom_prop()

void window_set_atom_prop ( xcb_window_t w,
xcb_atom_t prop,
xcb_atom_t * atoms,
int count )
Parameters
wThe xcb_window_t to set property on
propAtom of the property to change
atomsList of atoms to change the property too
countThe length of the atoms list.

Set property on window.

Definition at line 423 of file display.c.

References _xcb_stuff::connection, window_set_atom_prop(), and xcb.

Referenced by window_set_atom_prop(), and xcb___create_window().

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

◆ x11_build_monitor_layout()

void x11_build_monitor_layout ( void )
static

◆ x11_build_monitor_layout_xinerama()

void x11_build_monitor_layout_xinerama ( void )
static

Definition at line 573 of file display.c.

References _xcb_stuff::connection, _workarea::h, _xcb_stuff::monitors, _workarea::next, _workarea::w, _workarea::x, x11_build_monitor_layout_xinerama(), xcb, and _workarea::y.

Referenced by x11_build_monitor_layout(), and x11_build_monitor_layout_xinerama().

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

◆ x11_button_to_nk_bindings_button()

gboolean x11_button_to_nk_bindings_button ( guint32 x11_button,
NkBindingsMouseButton * button )
static

Definition at line 1147 of file display.c.

References x11_button_to_nk_bindings_button().

Referenced by main_loop_x11_event_handler_view(), and x11_button_to_nk_bindings_button().

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

◆ x11_button_to_nk_bindings_scroll()

gboolean x11_button_to_nk_bindings_scroll ( guint32 x11_button,
NkBindingsScrollAxis * axis,
gint32 * steps )
static

Definition at line 1176 of file display.c.

References rofi_fallthrough, and x11_button_to_nk_bindings_scroll().

Referenced by main_loop_x11_event_handler_view(), and x11_button_to_nk_bindings_scroll().

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

◆ x11_create_frequently_used_atoms()

void x11_create_frequently_used_atoms ( void )
static

Fill in the list of frequently used X11 Atoms.

Definition at line 1587 of file display.c.

References _xcb_stuff::connection, netatom_names, netatoms, NUM_NETATOMS, x11_create_frequently_used_atoms(), and xcb.

Referenced by x11_create_frequently_used_atoms(), and xcb_display_setup().

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

◆ x11_create_visual_and_colormap()

void x11_create_visual_and_colormap ( void )
static

Definition at line 1796 of file display.c.

References _xcb_stuff::connection, depth, map, root_visual, _xcb_stuff::screen, visual, x11_create_visual_and_colormap(), and xcb.

Referenced by x11_create_visual_and_colormap(), and xcb_display_late_setup().

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

◆ x11_disable_decoration()

void x11_disable_decoration ( xcb_window_t window)
Parameters
windowThe X11 window to modify

Set the right hints to disable the window decoration. (Set MOTIF_WM_HINTS, decoration field)

Definition at line 1965 of file display.c.

References _xcb_stuff::connection, netatoms, x11_disable_decoration(), and xcb.

Referenced by x11_disable_decoration(), and xcb___create_window().

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

◆ x11_get_monitor_from_output()

workarea * x11_get_monitor_from_output ( xcb_randr_output_t out)
static

Create monitor based on output id

Definition at line 469 of file display.c.

References _xcb_stuff::connection, _workarea::h, _workarea::mh, _workarea::mw, _workarea::name, _workarea::w, _workarea::x, x11_get_monitor_from_output(), x11_workarea_fix_rotation(), xcb, and _workarea::y.

Referenced by x11_build_monitor_layout(), and x11_get_monitor_from_output().

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

◆ x11_helper_discover_window_manager()

void x11_helper_discover_window_manager ( void )
static

Definition at line 1621 of file display.c.

References current_window_manager, _xcb_stuff::ewmh, WM_DO_NOT_CHANGE_CURRENT_DESKTOP, WM_PANGO_WORKSPACE_NAMES, x11_helper_discover_window_manager(), xcb, and xcb_stuff_get_root_window().

Referenced by x11_helper_discover_window_manager(), and xcb_display_setup().

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

◆ x11_helper_get_bg_surface()

cairo_surface_t * x11_helper_get_bg_surface ( void )

Gets a surface containing the background image of the desktop.

Returns
a cairo surface with the background image of the desktop.

Definition at line 383 of file display.c.

References _xcb_stuff::connection, get_root_pixmap(), netatoms, root_visual, _xcb_stuff::screen, x11_helper_get_bg_surface(), and xcb.

Referenced by x11_helper_get_bg_surface(), and xcb_rofi_view_setup_fake_transparency().

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

◆ x11_helper_get_screenshot_surface()

cairo_surface_t * x11_helper_get_screenshot_surface ( void )

Holds for each supported modifier the possible modifier mask. Check x11_mod_masks[MODIFIER]&mask != 0 to see if MODIFIER is activated.

Gets a surface for the root window of the desktop.

Can be used to take screenshot.

Returns
a cairo surface for the root window of the desktop.

Definition at line 357 of file display.c.

References _xcb_stuff::connection, root_visual, _xcb_stuff::screen, x11_helper_get_screenshot_surface(), xcb, and xcb_stuff_get_root_window().

Referenced by x11_helper_get_screenshot_surface(), and xcb_rofi_view_setup_fake_transparency().

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

◆ x11_helper_get_screenshot_surface_window()

cairo_surface_t * x11_helper_get_screenshot_surface_window ( xcb_window_t window,
int size )
Parameters
windowthe window the screenshot
sizeSize of the thumbnail

Creates a thumbnail of the window.

Returns
NULL if window was not found, or unmapped, otherwise returns a cairo_surface.

Definition at line 296 of file display.c.

References _xcb_stuff::connection, lookup_visual(), _xcb_stuff::screen, x11_helper_get_screenshot_surface_window(), and xcb.

Referenced by x11_helper_get_screenshot_surface_window().

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

◆ x11_helper_get_window_manager()

char * x11_helper_get_window_manager ( void )

Get the currently detected window manager.

Returns
NULL when non found, otherwise a string (free with g_free)

Definition at line 1601 of file display.c.

References _xcb_stuff::ewmh, x11_helper_get_window_manager(), xcb, and xcb_stuff_get_root_window().

Referenced by help(), and x11_helper_get_window_manager().

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

◆ x11_is_extension_present()

int x11_is_extension_present ( const char * extension)
static

Definition at line 559 of file display.c.

References _xcb_stuff::connection, x11_is_extension_present(), and xcb.

Referenced by x11_build_monitor_layout(), and x11_is_extension_present().

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

◆ x11_lookup_cursors()

void x11_lookup_cursors ( void )
static

Definition at line 1839 of file display.c.

References _xcb_stuff::connection, cursor_names, cursors, NUM_CURSORS, _xcb_stuff::screen, x11_lookup_cursors(), and xcb.

Referenced by x11_lookup_cursors(), and xcb_display_late_setup().

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

◆ x11_monitor_free()

void x11_monitor_free ( workarea * m)
static

Free monitor structure.

Definition at line 436 of file display.c.

References _workarea::name, and x11_monitor_free().

Referenced by x11_monitor_free(), and x11_monitors_free().

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

◆ x11_monitors_free()

void x11_monitors_free ( void )
static

Definition at line 441 of file display.c.

References _xcb_stuff::monitors, _workarea::next, x11_monitor_free(), x11_monitors_free(), and xcb.

Referenced by x11_monitors_free(), and xcb_display_cleanup().

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

◆ x11_set_cursor()

void x11_set_cursor ( xcb_window_t window,
X11CursorType type )
Parameters
window
type

Change mouse cursor

Definition at line 1989 of file display.c.

References _xcb_stuff::connection, cursors, NUM_CURSORS, x11_set_cursor(), and xcb.

Referenced by x11_set_cursor(), and xcb_rofi_view_set_cursor().

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

◆ x11_workarea_fix_rotation()

void x11_workarea_fix_rotation ( workarea * w)
static

Quick function that tries to fix the size (for dpi calculation) when monitor is rotate. This assumes the density is kinda equal in both X/Y direction.

Definition at line 454 of file display.c.

References _workarea::h, _workarea::mh, _workarea::mw, _workarea::w, and x11_workarea_fix_rotation().

Referenced by x11_get_monitor_from_output(), and x11_workarea_fix_rotation().

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

◆ xcb_display_cleanup()

void xcb_display_cleanup ( void )
static

◆ xcb_display_dump_monitor_layout()

void xcb_display_dump_monitor_layout ( void )
static

Definition at line 705 of file display.c.

References color_bold, color_reset, _xcb_stuff::monitors, _workarea::next, xcb, and xcb_display_dump_monitor_layout().

Referenced by xcb_display_dump_monitor_layout().

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

◆ xcb_display_early_cleanup()

void xcb_display_early_cleanup ( void )
static

Definition at line 1925 of file display.c.

References _xcb_stuff::connection, release_keyboard(), release_pointer(), xcb, and xcb_display_early_cleanup().

Referenced by xcb_display_early_cleanup().

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

◆ xcb_display_late_setup()

gboolean xcb_display_late_setup ( void )
static

Create window (without showing)

Definition at line 1890 of file display.c.

References find_arg(), lazy_grab_keyboard(), lazy_grab_pointer(), take_keyboard(), take_pointer(), x11_create_visual_and_colormap(), x11_lookup_cursors(), xcb_display_late_setup(), and xcb_stuff_get_root_window().

Referenced by xcb_display_late_setup().

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

◆ xcb_display_monitor_active()

int xcb_display_monitor_active ( workarea * mon)
static

Definition at line 1012 of file display.c.

References config, mon_cache, mon_set, Settings::monitor, monitor_active_from_id(), monitor_active_from_winid(), monitor_dimensions(), monitor_get_dimension(), _xcb_stuff::monitors, _workarea::next, xcb, and xcb_display_monitor_active().

Referenced by xcb_display_monitor_active().

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

◆ xcb_display_revert_input_focus()

void xcb_display_revert_input_focus ( void )
static

Definition at line 2029 of file display.c.

References _xcb_stuff::connection, _xcb_stuff::focus_revert, xcb, and xcb_display_revert_input_focus().

Referenced by xcb_display_revert_input_focus().

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

◆ xcb_display_scale()

guint xcb_display_scale ( void )
static

Definition at line 2039 of file display.c.

References xcb_display_scale().

Referenced by xcb_display_scale().

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

◆ xcb_display_set_input_focus()

void xcb_display_set_input_focus ( guint w)
static

Definition at line 2006 of file display.c.

References config, _xcb_stuff::connection, _xcb_stuff::focus_revert, Settings::steal_focus, xcb, and xcb_display_set_input_focus().

Referenced by xcb_display_set_input_focus().

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

◆ xcb_display_setup()

◆ xcb_display_startup_notification()

◆ xcb_display_view_proxy()

const struct _view_proxy * xcb_display_view_proxy ( void )
static

Definition at line 2041 of file display.c.

References xcb_display_view_proxy(), and xcb_view_proxy.

Referenced by xcb_display_view_proxy().

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

◆ xcb_stuff_get_root_window()

xcb_window_t xcb_stuff_get_root_window ( void )

Get the root window.

Returns
the root window.

Definition at line 1923 of file display.c.

References _xcb_stuff::screen, xcb, and xcb_stuff_get_root_window().

Referenced by lazy_grab_keyboard(), lazy_grab_pointer(), x11_helper_discover_window_manager(), x11_helper_get_screenshot_surface(), x11_helper_get_window_manager(), xcb___create_window(), xcb_display_late_setup(), xcb_display_setup(), and xcb_stuff_get_root_window().

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

◆ xcb_stuff_set_clipboard()

void xcb_stuff_set_clipboard ( char * data)
Parameters
dataString to copy to clipboard.

copies string to clipboard.

Definition at line 2001 of file display.c.

References _xcb_stuff::clipboard, xcb, and xcb_stuff_set_clipboard().

Referenced by main_loop_x11_event_handler_view(), rofi_view_trigger_global_action(), xcb_rofi_view_cleanup(), and xcb_stuff_set_clipboard().

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

Variable Documentation

◆ current_window_manager

WindowManagerQuirk current_window_manager = WM_EWHM

Indicates the current window manager. This is used for work-arounds.

Definition at line 87 of file display.c.

Referenced by x11_helper_discover_window_manager().

◆ cursor_names

const struct [struct].cursor_names cursor_names[]
Initial value:
= {
{"default", "left_ptr"}, {"pointer", "hand"}, {"text", "xterm"}}

Referenced by x11_lookup_cursors().

◆ cursors

xcb_cursor_t cursors[NUM_CURSORS]
Initial value:
= {XCB_CURSOR_NONE, XCB_CURSOR_NONE,
XCB_CURSOR_NONE}

Cached X11 cursors.

Definition at line 121 of file display.c.

Referenced by x11_lookup_cursors(), and x11_set_cursor().

◆ depth

xcb_depth_t* depth = NULL

Depth of root window.

Depth of visual

Definition at line 108 of file display.c.

Referenced by x11_create_visual_and_colormap(), xcb___create_window(), xcb_rofi_view_temp_configure_notify(), and xcb_rofi_view_window_update_size().

◆ display_

display_proxy display_
static
Initial value:
= {
.late_setup = xcb_display_late_setup,
.early_cleanup = xcb_display_early_cleanup,
.cleanup = xcb_display_cleanup,
.dump_monitor_layout = xcb_display_dump_monitor_layout,
.startup_notification = xcb_display_startup_notification,
.monitor_active = xcb_display_monitor_active,
.set_input_focus = xcb_display_set_input_focus,
.revert_input_focus = xcb_display_revert_input_focus,
}
static int xcb_display_monitor_active(workarea *mon)
Definition display.c:1012
static gboolean xcb_display_setup(GMainLoop *main_loop, NkBindings *bindings)
Definition display.c:1646
static void xcb_display_set_input_focus(guint w)
Definition display.c:2006
static const struct _view_proxy * xcb_display_view_proxy(void)
Definition display.c:2041
static void xcb_display_dump_monitor_layout(void)
Definition display.c:705
static gboolean xcb_display_late_setup(void)
Definition display.c:1890
static void xcb_display_startup_notification(RofiHelperExecuteContext *context, GSpawnChildSetupFunc *child_setup, gpointer *user_data)
Definition display.c:731
static guint xcb_display_scale(void)
Definition display.c:2039
static void xcb_display_cleanup(void)
Definition display.c:1931
static void xcb_display_early_cleanup(void)
Definition display.c:1925
static void xcb_display_revert_input_focus(void)
Definition display.c:2029

Definition at line 2045 of file display.c.

◆ error_trap_depth

int error_trap_depth = 0
static

X server error depth. to handle nested errors.

Definition at line 1567 of file display.c.

Referenced by error_trap_pop(), and error_trap_push().

◆ lazy_grab_retry_count_kb

unsigned int lazy_grab_retry_count_kb = 0

Retry count of grabbing keyboard.

Definition at line 1859 of file display.c.

Referenced by lazy_grab_keyboard().

◆ lazy_grab_retry_count_pt

unsigned int lazy_grab_retry_count_pt = 0

Retry count of grabbing pointer.

Definition at line 1861 of file display.c.

Referenced by lazy_grab_pointer().

◆ map

xcb_colormap_t map = XCB_COLORMAP_NONE

Color map to use for creating window

Definition at line 110 of file display.c.

Referenced by x11_create_visual_and_colormap(), xcb___create_window(), and xcb_rofi_view_cleanup().

◆ mon_cache

workarea mon_cache
Initial value:
= {
0,
}

cached monitor cache, to avoid multiple roundtrips to fetch this.

Definition at line 1009 of file display.c.

Referenced by xcb_display_monitor_active().

◆ mon_set

gboolean mon_set = FALSE

The cached monitor setup (mon_cache) is populated

Definition at line 1007 of file display.c.

Referenced by xcb_display_monitor_active().

◆ netatom_names

const char* netatom_names[] = {EWMH_ATOMS(ATOM_CHAR)}

atoms as string

Definition at line 116 of file display.c.

Referenced by x11_create_frequently_used_atoms().

◆ netatoms

◆ root_visual

xcb_visualtype_t* root_visual = NULL
static

Visual of the root window.

Definition at line 114 of file display.c.

Referenced by x11_create_visual_and_colormap(), x11_helper_get_bg_surface(), and x11_helper_get_screenshot_surface().

◆ visual

xcb_visualtype_t* visual = NULL

Visual to use for creating window

Definition at line 109 of file display.c.

Referenced by x11_create_visual_and_colormap(), xcb___create_window(), xcb_rofi_view_temp_configure_notify(), and xcb_rofi_view_window_update_size().

◆ xcb

xcb_stuff* xcb = &xcb_int

Global pointer to xcb_stuff instance.

Definition at line 103 of file display.c.

Referenced by lazy_grab_keyboard(), main_loop_x11_event_handler(), main_loop_x11_event_handler_view(), monitor_active_from_id(), monitor_active_from_id_focused(), monitor_active_from_winid(), monitor_dimensions(), monitor_get_dimension(), pointer_get(), release_keyboard(), release_pointer(), rofi_key_press_event_handler(), rofi_key_release_event_handler(), rofi_view_create(), rofi_view_error_dialog(), rofi_view_paste(), rofi_view_set_selected_line(), rofi_view_trigger_global_action(), take_keyboard(), take_pointer(), window_get_text_prop(), window_set_atom_prop(), x11_build_monitor_layout(), x11_build_monitor_layout_xinerama(), x11_create_frequently_used_atoms(), x11_create_visual_and_colormap(), x11_disable_decoration(), x11_get_monitor_from_output(), x11_helper_discover_window_manager(), x11_helper_get_bg_surface(), x11_helper_get_screenshot_surface(), x11_helper_get_screenshot_surface_window(), x11_helper_get_window_manager(), x11_is_extension_present(), x11_lookup_cursors(), x11_monitors_free(), x11_set_cursor(), xcb___create_window(), xcb_display_cleanup(), xcb_display_dump_monitor_layout(), xcb_display_early_cleanup(), xcb_display_monitor_active(), xcb_display_revert_input_focus(), xcb_display_set_input_focus(), xcb_display_setup(), xcb_display_startup_notification(), xcb_rofi_view_cleanup(), xcb_rofi_view_hide(), xcb_rofi_view_ping_mouse(), xcb_rofi_view_repaint(), xcb_rofi_view_set_window_title(), xcb_rofi_view_temp_configure_notify(), xcb_rofi_view_window_update_size(), xcb_stuff_get_root_window(), and xcb_stuff_set_clipboard().

◆ xcb_int

struct _xcb_stuff xcb_int
Initial value:
= {.connection = NULL,
.screen = NULL,
.screen_nbr = -1,
.sndisplay = NULL,
.sncontext = NULL,
.monitors = NULL,
.clipboard = NULL}

Structure holding xcb objects needed to function.

Definition at line 92 of file display.c.

◆ xcb_proxy

display_proxy* const xcb_proxy = &display_

Definition at line 2060 of file display.c.

Referenced by main().