Dunst
Lightweight notification daemon
Loading...
Searching...
No Matches
screen.c File Reference
#include <assert.h>
#include <glib.h>
#include <locale.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/extensions/randr.h>
#include <X11/extensions/Xinerama.h>
#include <X11/extensions/Xrandr.h>
#include <X11/Xatom.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xresource.h>
#include "../log.h"
#include "../settings.h"
#include "../utils.h"
#include "x.h"
#include "screen.h"
+ Include dependency graph for screen.c:

Go to the source code of this file.

Functions

void randr_init (void)
 
void randr_update (void)
 
void xinerama_update (void)
 
void screen_update_fallback (void)
 
static void x_follow_setup_error_handler (void)
 
static int x_follow_tear_down_error_handler (void)
 
static int FollowXErrorHandler (Display *display, XErrorEvent *e)
 
static Window get_focused_window (void)
 
void screen_dpi_xft_cache_purge (void)
 
static double screen_dpi_get_from_xft (void)
 
static double screen_dpi_get_from_monitor (const struct screen_info *scr)
 
double screen_dpi_get (const struct screen_info *scr)
 
void init_screens (void)
 
void free_screen_ar (struct screen_info *scr, int len)
 
void alloc_screen_ar (int n)
 
bool screen_check_event (XEvent *ev)
 
bool have_fullscreen_window (void)
 Find the currently focused window and check if it's in fullscreen mode.
 
static int XErrorHandlerFullscreen (Display *display, XErrorEvent *e)
 X11 ErrorHandler to mainly discard BadWindow parameter error.
 
bool window_is_fullscreen (Window window)
 Check if window is in fullscreen mode.
 
static int get_screen_by_name (const char *name, int defval)
 
const struct screen_infoget_active_screen (void)
 

Variables

struct screen_infoscreens
 
int screens_len
 
bool dunst_follow_errored = false
 
static int randr_major_version = 0
 
static int randr_minor_version = 0
 
double screen_dpi_xft_cache = -DBL_MAX
 A cache variable to cache the Xft.dpi xrdb values.
 

Detailed Description

License
BSD-3-Clause

Definition in file screen.c.

Function Documentation

◆ alloc_screen_ar()

void alloc_screen_ar ( int n)

Definition at line 124 of file screen.c.

◆ FollowXErrorHandler()

static int FollowXErrorHandler ( Display * display,
XErrorEvent * e )
static

Definition at line 454 of file screen.c.

◆ free_screen_ar()

void free_screen_ar ( struct screen_info * scr,
int len )

Definition at line 113 of file screen.c.

◆ get_active_screen()

const struct screen_info * get_active_screen ( void )

Definition at line 338 of file screen.c.

◆ get_focused_window()

static Window get_focused_window ( void )
static

Definition at line 426 of file screen.c.

◆ get_screen_by_name()

static int get_screen_by_name ( const char * name,
int defval )
static

Definition at line 323 of file screen.c.

◆ have_fullscreen_window()

bool have_fullscreen_window ( void )

Find the currently focused window and check if it's in fullscreen mode.

See also
window_is_fullscreen()
get_focused_window()
Return values
trueif the focused window is in fullscreen mode
falseotherwise

Definition at line 238 of file screen.c.

◆ init_screens()

void init_screens ( void )

Definition at line 103 of file screen.c.

◆ randr_init()

void randr_init ( void )

Definition at line 132 of file screen.c.

◆ randr_update()

void randr_update ( void )

Definition at line 144 of file screen.c.

◆ screen_check_event()

bool screen_check_event ( XEvent * ev)

Definition at line 185 of file screen.c.

◆ screen_dpi_get()

double screen_dpi_get ( const struct screen_info * scr)

Definition at line 84 of file screen.c.

◆ screen_dpi_get_from_monitor()

static double screen_dpi_get_from_monitor ( const struct screen_info * scr)
static

Definition at line 79 of file screen.c.

◆ screen_dpi_get_from_xft()

static double screen_dpi_get_from_xft ( void )
static

Definition at line 64 of file screen.c.

◆ screen_dpi_xft_cache_purge()

void screen_dpi_xft_cache_purge ( void )

Definition at line 59 of file screen.c.

◆ screen_update_fallback()

void screen_update_fallback ( void )

Definition at line 221 of file screen.c.

◆ window_is_fullscreen()

bool window_is_fullscreen ( Window window)

Check if window is in fullscreen mode.

Parameters
windowthe x11 window object
Return values
trueif window is in fullscreen mode
falseotherwise

Definition at line 262 of file screen.c.

◆ x_follow_setup_error_handler()

static void x_follow_setup_error_handler ( void )
static

Definition at line 438 of file screen.c.

◆ x_follow_tear_down_error_handler()

static int x_follow_tear_down_error_handler ( void )
static

Definition at line 446 of file screen.c.

◆ XErrorHandlerFullscreen()

static int XErrorHandlerFullscreen ( Display * display,
XErrorEvent * e )
static

X11 ErrorHandler to mainly discard BadWindow parameter error.

Definition at line 246 of file screen.c.

◆ xinerama_update()

void xinerama_update ( void )

Definition at line 196 of file screen.c.

Variable Documentation

◆ dunst_follow_errored

bool dunst_follow_errored = false

Definition at line 33 of file screen.c.

◆ randr_major_version

int randr_major_version = 0
static

Definition at line 35 of file screen.c.

◆ randr_minor_version

int randr_minor_version = 0
static

Definition at line 36 of file screen.c.

◆ screen_dpi_xft_cache

double screen_dpi_xft_cache = -DBL_MAX

A cache variable to cache the Xft.dpi xrdb values.

We do not expect to change xrdb often, but there's much overhead to query it once.

Return values
-DBL_MAXuncached
<=0Invalid and unusable value
>0valid

Definition at line 57 of file screen.c.

◆ screens

struct screen_info* screens

Definition at line 30 of file screen.c.

◆ screens_len

int screens_len

Definition at line 31 of file screen.c.