Dunst
Lightweight notification daemon
Loading...
Searching...
No Matches
x.c File Reference
#include "x.h"
#include <assert.h>
#include <cairo.h>
#include <cairo-xlib.h>
#include <glib-object.h>
#include <locale.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <X11/extensions/shape.h>
#include <X11/Xatom.h>
#include <X11/X.h>
#include <X11/XKBlib.h>
#include <X11/Xlib.h>
#include <X11/Xresource.h>
#include <X11/Xutil.h>
#include "../dbus.h"
#include "../draw.h"
#include "../dunst.h"
#include "../log.h"
#include "../markup.h"
#include "../menu.h"
#include "../notification.h"
#include "../queues.h"
#include "../settings.h"
#include "../utils.h"
#include "../input.h"
+ Include dependency graph for x.c:

Go to the source code of this file.

Data Structures

struct  window_x11
 
struct  x11_source
 

Macros

#define BTN_LEFT   (0x110)
 
#define BTN_RIGHT   (0x111)
 
#define BTN_MIDDLE   (0x112)
 
#define BTN_TOUCH   (0x14a)
 
#define WIDTH   400
 
#define HEIGHT   400
 

Functions

static void XRM_update_db (void)
 
static void x_shortcut_init (struct keyboard_shortcut *ks)
 
static int x_shortcut_grab (struct keyboard_shortcut *ks)
 
static void x_shortcut_ungrab (struct keyboard_shortcut *ks)
 
static void x_shortcut_setup_error_handler (void)
 
static int x_shortcut_tear_down_error_handler (void)
 
static void setopacity (Window win, unsigned long opacity)
 
static void x_handle_click (XEvent ev)
 
static void x_win_move (window winptr, int x, int y, int width, int height)
 
static void x_win_corners_shape (struct window_x11 *win, const int rad)
 
static void x_win_corners_unshape (window winptr)
 
static bool x_win_composited (struct window_x11 *win)
 
void x_display_surface (cairo_surface_t *srf, window winptr, const struct dimensions *dim)
 
cairo_t * x_win_get_context (window winptr)
 
static KeySym x_numlock_mod (void)
 
gboolean x_mainloop_fd_prepare (GSource *source, gint *timeout)
 
gboolean x_mainloop_fd_check (GSource *source)
 
gboolean x_mainloop_fd_dispatch (GSource *source, GSourceFunc callback, gpointer user_data)
 
bool x_is_idle (void)
 
static unsigned int x_mouse_button_to_linux_event_code (unsigned int x_button)
 
void x_free (void)
 
static int XErrorHandlerDB (Display *display, XErrorEvent *e)
 
bool x_setup (void)
 
static void x_set_wm (Window win)
 
GSource * x_win_reg_source (struct window_x11 *win)
 
window x_win_create (void)
 
void x_win_destroy (window winptr)
 
void x_win_show (window winptr)
 
void x_win_hide (window winptr)
 
KeySym x_shortcut_string_to_mask (const char *str)
 
static int GrabXErrorHandler (Display *display, XErrorEvent *e)
 
double x_get_scale (void)
 

Variables

struct x_context xctx
 
bool dunst_grab_errored = false
 
static bool fullscreen_last = false
 

Detailed Description

License
BSD-3-Clause

Definition in file x.c.

Macro Definition Documentation

◆ BTN_LEFT

#define BTN_LEFT   (0x110)

Definition at line 33 of file x.c.

◆ BTN_MIDDLE

#define BTN_MIDDLE   (0x112)

Definition at line 35 of file x.c.

◆ BTN_RIGHT

#define BTN_RIGHT   (0x111)

Definition at line 34 of file x.c.

◆ BTN_TOUCH

#define BTN_TOUCH   (0x14a)

Definition at line 36 of file x.c.

◆ HEIGHT

#define HEIGHT   400

Definition at line 52 of file x.c.

◆ WIDTH

#define WIDTH   400

Definition at line 51 of file x.c.

Function Documentation

◆ GrabXErrorHandler()

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

Definition at line 815 of file x.c.

◆ setopacity()

static void setopacity ( Window win,
unsigned long opacity )
static

Definition at line 206 of file x.c.

◆ x_display_surface()

void x_display_surface ( cairo_surface_t * srf,
window winptr,
const struct dimensions * dim )

Definition at line 174 of file x.c.

◆ x_free()

void x_free ( void )

Definition at line 468 of file x.c.

◆ x_get_scale()

double x_get_scale ( void )

Definition at line 952 of file x.c.

◆ x_handle_click()

static void x_handle_click ( XEvent ev)
static

Definition at line 446 of file x.c.

◆ x_is_idle()

bool x_is_idle ( void )

Definition at line 413 of file x.c.

◆ x_mainloop_fd_check()

gboolean x_mainloop_fd_check ( GSource * source)

Definition at line 288 of file x.c.

◆ x_mainloop_fd_dispatch()

gboolean x_mainloop_fd_dispatch ( GSource * source,
GSourceFunc callback,
gpointer user_data )

Definition at line 296 of file x.c.

◆ x_mainloop_fd_prepare()

gboolean x_mainloop_fd_prepare ( GSource * source,
gint * timeout )

Definition at line 277 of file x.c.

◆ x_mouse_button_to_linux_event_code()

static unsigned int x_mouse_button_to_linux_event_code ( unsigned int x_button)
static

Definition at line 427 of file x.c.

◆ x_numlock_mod()

static KeySym x_numlock_mod ( void )
static

Definition at line 223 of file x.c.

◆ x_set_wm()

static void x_set_wm ( Window win)
static

Definition at line 564 of file x.c.

◆ x_setup()

bool x_setup ( void )

Definition at line 528 of file x.c.

◆ x_shortcut_grab()

static int x_shortcut_grab ( struct keyboard_shortcut * ks)
static

Definition at line 855 of file x.c.

◆ x_shortcut_init()

static void x_shortcut_init ( struct keyboard_shortcut * ks)
static

Definition at line 904 of file x.c.

◆ x_shortcut_setup_error_handler()

static void x_shortcut_setup_error_handler ( void )
static

Definition at line 833 of file x.c.

◆ x_shortcut_string_to_mask()

KeySym x_shortcut_string_to_mask ( const char * str)

Definition at line 792 of file x.c.

◆ x_shortcut_tear_down_error_handler()

static int x_shortcut_tear_down_error_handler ( void )
static

Definition at line 844 of file x.c.

◆ x_shortcut_ungrab()

static void x_shortcut_ungrab ( struct keyboard_shortcut * ks)
static

Definition at line 891 of file x.c.

◆ x_win_composited()

static bool x_win_composited ( struct window_x11 * win)
static

Definition at line 159 of file x.c.

◆ x_win_corners_shape()

static void x_win_corners_shape ( struct window_x11 * win,
const int rad )
static

Definition at line 105 of file x.c.

◆ x_win_corners_unshape()

static void x_win_corners_unshape ( window winptr)
static

Definition at line 146 of file x.c.

◆ x_win_create()

window x_win_create ( void )

Definition at line 644 of file x.c.

◆ x_win_destroy()

void x_win_destroy ( window winptr)

Definition at line 719 of file x.c.

◆ x_win_get_context()

cairo_t * x_win_get_context ( window winptr)

Definition at line 201 of file x.c.

◆ x_win_hide()

void x_win_hide ( window winptr)

Definition at line 773 of file x.c.

◆ x_win_move()

static void x_win_move ( window winptr,
int x,
int y,
int width,
int height )
static

Definition at line 85 of file x.c.

◆ x_win_reg_source()

GSource * x_win_reg_source ( struct window_x11 * win)

Definition at line 616 of file x.c.

◆ x_win_show()

void x_win_show ( window winptr)

Definition at line 736 of file x.c.

◆ XErrorHandlerDB()

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

Definition at line 477 of file x.c.

◆ XRM_update_db()

static void XRM_update_db ( void )
static

Definition at line 485 of file x.c.

Variable Documentation

◆ dunst_grab_errored

bool dunst_grab_errored = false

Definition at line 70 of file x.c.

◆ fullscreen_last

bool fullscreen_last = false
static

Definition at line 72 of file x.c.

◆ xctx

struct x_context xctx

Definition at line 69 of file x.c.