mate-desktop 1.29.2
Library with common API for various MATE modules
Loading...
Searching...
No Matches
mate-bg.c File Reference
View source
#include <string.h>
#include <math.h>
#include <stdarg.h>
#include <stdlib.h>
#include <glib/gstdio.h>
#include <gio/gio.h>
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <cairo.h>
#include <mate-bg.h>
#include <mate-bg-crossfade.h>
#include <cairo-xlib.h>
Include dependency graph for mate-bg.c:

Data Structures

struct  _Slide
 
struct  _FileSize
 
struct  _MateBG
 
struct  _MateBGClass
 
struct  _SlideShow
 
struct  FileCacheEntry
 

Macros

#define MATE_DESKTOP_USE_UNSTABLE_API
 
#define MATE_BG_CACHE_DIR   "mate/background"
 
#define KEEP_EXPENSIVE_CACHE_SECS   60
 
#define THUMBNAIL_SIZE   256
 
#define CACHE_SIZE   4
 

Typedefs

typedef struct _SlideShow SlideShow
 
typedef struct _Slide Slide
 
typedef struct _FileSize FileSize
 
typedef struct FileCacheEntry FileCacheEntry
 

Enumerations

enum  { CHANGED , TRANSITIONED , N_SIGNALS }
 
enum  FileType { PIXBUF , SLIDESHOW , THUMBNAIL }
 

Functions

static cairo_surface_t * make_root_pixmap (GdkWindow *window, gint width, gint height)
 
static void pixbuf_average_value (GdkPixbuf *pixbuf, GdkRGBA *result)
 
static GdkPixbuf * pixbuf_scale_to_fit (GdkPixbuf *src, int max_width, int max_height)
 
static GdkPixbuf * pixbuf_scale_to_min (GdkPixbuf *src, int min_width, int min_height)
 
static void pixbuf_draw_gradient (GdkPixbuf *pixbuf, gboolean horizontal, GdkRGBA *c1, GdkRGBA *c2, GdkRectangle *rect)
 
static void pixbuf_tile (GdkPixbuf *src, GdkPixbuf *dest)
 
static void pixbuf_blend (GdkPixbuf *src, GdkPixbuf *dest, int src_x, int src_y, int width, int height, int dest_x, int dest_y, double alpha)
 
static GdkPixbuf * create_thumbnail_for_filename (MateDesktopThumbnailFactory *factory, const char *filename)
 
static gboolean get_thumb_annotations (GdkPixbuf *thumb, int *orig_width, int *orig_height)
 
static GdkPixbuf * get_pixbuf_for_size (MateBG *bg, gint num_monitor, int width, int height)
 
static void clear_cache (MateBG *bg)
 
static gboolean is_different (MateBG *bg, const char *filename)
 
static gint64 get_mtime (const char *filename)
 
static GdkPixbuf * create_img_thumbnail (MateBG *bg, MateDesktopThumbnailFactory *factory, GdkScreen *screen, int dest_width, int dest_height, int frame_num)
 
static SlideShow * get_as_slideshow (MateBG *bg, const char *filename)
 
static Slide * get_current_slide (SlideShow *show, double *alpha)
 
static gboolean slideshow_has_multiple_sizes (SlideShow *show)
 
static SlideShow * read_slideshow_file (const char *filename, GError **err)
 
static SlideShow * slideshow_ref (SlideShow *show)
 
static void slideshow_unref (SlideShow *show)
 
static FileSize * find_best_size (GSList *sizes, gint width, gint height)
 
static void color_from_string (const char *string, GdkRGBA *colorp)
 
static char * color_to_string (const GdkRGBA *color)
 
static gboolean do_changed (MateBG *bg)
 
static void queue_changed (MateBG *bg)
 
static gboolean do_transitioned (MateBG *bg)
 
static void queue_transitioned (MateBG *bg)
 
void mate_bg_load_from_preferences (MateBG *bg)
 
void mate_bg_load_from_system_preferences (MateBG *bg)
 
void mate_bg_load_from_system_gsettings (MateBG *bg, GSettings *settings, gboolean reset_apply)
 
void mate_bg_load_from_gsettings (MateBG *bg, GSettings *settings)
 
void mate_bg_save_to_preferences (MateBG *bg)
 
void mate_bg_save_to_gsettings (MateBG *bg, GSettings *settings)
 
static void mate_bg_init (MateBG *bg)
 
static void mate_bg_dispose (GObject *object)
 
static void mate_bg_finalize (GObject *object)
 
static void mate_bg_class_init (MateBGClass *klass)
 
MateBG * mate_bg_new (void)
 
void mate_bg_set_color (MateBG *bg, MateBGColorType type, GdkRGBA *primary, GdkRGBA *secondary)
 
void mate_bg_set_placement (MateBG *bg, MateBGPlacement placement)
 
MateBGPlacement mate_bg_get_placement (MateBG *bg)
 
void mate_bg_get_color (MateBG *bg, MateBGColorType *type, GdkRGBA *primary, GdkRGBA *secondary)
 
void mate_bg_set_draw_background (MateBG *bg, gboolean draw_background)
 
gboolean mate_bg_get_draw_background (MateBG *bg)
 
const gchar * mate_bg_get_filename (MateBG *bg)
 
static gchar * get_wallpaper_cache_dir (void)
 
static gchar * get_wallpaper_cache_prefix_name (gint num_monitor, MateBGPlacement placement, gint width, gint height)
 
static char * get_wallpaper_cache_filename (const char *filename, gint num_monitor, MateBGPlacement placement, gint width, gint height)
 
static void cleanup_cache_for_monitor (gchar *cache_dir, gint num_monitor)
 
static gboolean cache_file_is_valid (const char *filename, const char *cache_filename)
 
static void refresh_cache_file (MateBG *bg, GdkPixbuf *new_pixbuf, gint num_monitor, gint width, gint height)
 
static void file_changed (GFileMonitor *file_monitor, GFile *child, GFile *other_file, GFileMonitorEvent event_type, gpointer user_data)
 
void mate_bg_set_filename (MateBG *bg, const char *filename)
 
static void draw_color_area (MateBG *bg, GdkPixbuf *dest, GdkRectangle *rect)
 
static void draw_color (MateBG *bg, GdkPixbuf *dest)
 
static void draw_color_each_monitor (MateBG *bg, GdkPixbuf *dest, GdkScreen *screen)
 
static GdkPixbuf * pixbuf_clip_to_fit (GdkPixbuf *src, int max_width, int max_height)
 
static GdkPixbuf * get_scaled_pixbuf (MateBGPlacement placement, GdkPixbuf *pixbuf, int width, int height, int *x, int *y, int *w, int *h)
 
static void draw_image_area (MateBG *bg, gint num_monitor, GdkPixbuf *pixbuf, GdkPixbuf *dest, GdkRectangle *area)
 
static void draw_image_for_thumb (MateBG *bg, GdkPixbuf *pixbuf, GdkPixbuf *dest)
 
static void draw_once (MateBG *bg, GdkPixbuf *dest, gboolean is_root)
 
static void draw_each_monitor (MateBG *bg, GdkPixbuf *dest, GdkScreen *screen)
 
void mate_bg_draw (MateBG *bg, GdkPixbuf *dest, GdkScreen *screen, gboolean is_root)
 
gboolean mate_bg_has_multiple_sizes (MateBG *bg)
 
static void mate_bg_get_pixmap_size (MateBG *bg, int width, int height, int *pixmap_width, int *pixmap_height)
 
cairo_surface_t * mate_bg_create_surface (MateBG *bg, GdkWindow *window, int width, int height, gboolean root)
 mate_bg_create_surface: @bg: MateBG @window: @width: @height: @root:
 
cairo_surface_t * mate_bg_create_surface_scale (MateBG *bg, GdkWindow *window, int width, int height, int scale, gboolean root)
 mate_bg_create_surface_scale: @bg: MateBG @window: @width: @height: @scale: @root:
 
gboolean mate_bg_is_dark (MateBG *bg, int width, int height)
 
static gboolean get_original_size (const char *filename, int *orig_width, int *orig_height)
 
static const char * get_filename_for_size (MateBG *bg, gint best_width, gint best_height)
 
gboolean mate_bg_get_image_size (MateBG *bg, MateDesktopThumbnailFactory *factory, int best_width, int best_height, int *width, int *height)
 
static double fit_factor (int from_width, int from_height, int to_width, int to_height)
 
GdkPixbuf * mate_bg_create_thumbnail (MateBG *bg, MateDesktopThumbnailFactory *factory, GdkScreen *screen, int dest_width, int dest_height)
 mate_bg_create_thumbnail:
 
cairo_surface_t * mate_bg_get_surface_from_root (GdkScreen *screen)
 mate_bg_get_surface_from_root: @screen: a #GdkScreen
 
static void mate_bg_set_root_pixmap_id (GdkScreen *screen, Display *display, Pixmap xpixmap)
 
void mate_bg_set_surface_as_root (GdkScreen *screen, cairo_surface_t *surface)
 mate_bg_set_surface_as_root: @screen: the #GdkScreen to change root background on @surface: the #cairo_surface_t to set root background from.
 
MateBGCrossfade * mate_bg_set_surface_as_root_with_crossfade (GdkScreen *screen, cairo_surface_t *surface)
 mate_bg_set_surface_as_root_with_crossfade: @screen: the #GdkScreen to change root background on @surface: the cairo xlib surface to set root background from
 
static double now (void)
 
static GdkPixbuf * blend (GdkPixbuf *p1, GdkPixbuf *p2, double alpha)
 
static void file_cache_entry_delete (FileCacheEntry *ent)
 
static void bound_cache (MateBG *bg)
 
static const FileCacheEntry * file_cache_lookup (MateBG *bg, FileType type, const char *filename)
 
static FileCacheEntry * file_cache_entry_new (MateBG *bg, FileType type, const char *filename)
 
static void file_cache_add_pixbuf (MateBG *bg, const char *filename, GdkPixbuf *pixbuf)
 
static void file_cache_add_thumbnail (MateBG *bg, const char *filename, GdkPixbuf *pixbuf)
 
static void file_cache_add_slide_show (MateBG *bg, const char *filename, SlideShow *show)
 
static GdkPixbuf * load_from_cache_file (MateBG *bg, const char *filename, gint num_monitor, gint best_width, gint best_height)
 
static GdkPixbuf * get_as_pixbuf_for_size (MateBG *bg, const char *filename, gint monitor, gint best_width, gint best_height)
 
static GdkPixbuf * get_as_thumbnail (MateBG *bg, MateDesktopThumbnailFactory *factory, const char *filename)
 
static gboolean blow_expensive_caches (gpointer data)
 
static void blow_expensive_caches_in_idle (MateBG *bg)
 
static gboolean on_timeout (gpointer data)
 
static double get_slide_timeout (Slide *slide)
 
static void ensure_timeout (MateBG *bg, Slide *slide)
 
static GdkPixbuf * scale_thumbnail (MateBGPlacement placement, const char *filename, GdkPixbuf *thumb, GdkScreen *screen, int dest_width, int dest_height)
 
static GdkPixbuf * get_pixbuf_for_size (MateBG *bg, gint monitor, gint best_width, gint best_height)
 
static guchar * create_gradient (const GdkRGBA *primary, const GdkRGBA *secondary, int n_pixels)
 
static gboolean stack_is (SlideShow *parser, const char *s1,...)
 
static void handle_start_element (GMarkupParseContext *context, const gchar *name, const gchar **attr_names, const gchar **attr_values, gpointer user_data, GError **err)
 
static void handle_end_element (GMarkupParseContext *context, const gchar *name, gpointer user_data, GError **err)
 
static int parse_int (const char *text)
 
static void handle_text (GMarkupParseContext *context, const gchar *text, gsize text_len, gpointer user_data, GError **err)
 
static void dump_bg (SlideShow *show)
 
static void threadsafe_localtime (time_t time, struct tm *tm)
 
gboolean mate_bg_changes_with_time (MateBG *bg)
 
GdkPixbuf * mate_bg_create_frame_thumbnail (MateBG *bg, MateDesktopThumbnailFactory *factory, GdkScreen *screen, int dest_width, int dest_height, int frame_num)
 mate_bg_create_frame_thumbnail:
 

Variables

static guint signals [N_SIGNALS] = {0}
 

Macro Definition Documentation

◆ CACHE_SIZE

#define CACHE_SIZE   4

◆ KEEP_EXPENSIVE_CACHE_SECS

#define KEEP_EXPENSIVE_CACHE_SECS   60

◆ MATE_BG_CACHE_DIR

#define MATE_BG_CACHE_DIR   "mate/background"

◆ MATE_DESKTOP_USE_UNSTABLE_API

#define MATE_DESKTOP_USE_UNSTABLE_API

◆ THUMBNAIL_SIZE

#define THUMBNAIL_SIZE   256

Typedef Documentation

◆ FileCacheEntry

◆ FileSize

typedef struct _FileSize FileSize

◆ Slide

typedef struct _Slide Slide

◆ SlideShow

typedef struct _SlideShow SlideShow

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CHANGED 
TRANSITIONED 
N_SIGNALS 

◆ FileType

enum FileType
Enumerator
PIXBUF 
SLIDESHOW 
THUMBNAIL 

Function Documentation

◆ blend()

static GdkPixbuf * blend ( GdkPixbuf *  p1,
GdkPixbuf *  p2,
double  alpha 
)
static

References pixbuf_blend().

Referenced by create_img_thumbnail(), and get_pixbuf_for_size().

Here is the call graph for this function:

◆ blow_expensive_caches()

static gboolean blow_expensive_caches ( gpointer  data)
static

References _MateBG::blow_caches_id, _MateBG::file_cache, file_cache_entry_delete(), PIXBUF, _MateBG::pixbuf_cache, and FileCacheEntry::type.

Referenced by blow_expensive_caches_in_idle().

Here is the call graph for this function:

◆ blow_expensive_caches_in_idle()

static void blow_expensive_caches_in_idle ( MateBG *  bg)
static

References _MateBG::blow_caches_id, and blow_expensive_caches().

Referenced by get_pixbuf_for_size().

Here is the call graph for this function:

◆ bound_cache()

static void bound_cache ( MateBG *  bg)
static

References CACHE_SIZE, _MateBG::file_cache, and file_cache_entry_delete().

Referenced by file_cache_entry_new().

Here is the call graph for this function:

◆ cache_file_is_valid()

static gboolean cache_file_is_valid ( const char *  filename,
const char *  cache_filename 
)
static

References get_mtime().

Referenced by load_from_cache_file(), and refresh_cache_file().

Here is the call graph for this function:

◆ cleanup_cache_for_monitor()

static void cleanup_cache_for_monitor ( gchar *  cache_dir,
gint  num_monitor 
)
static

Referenced by refresh_cache_file().

◆ clear_cache()

static void clear_cache ( MateBG *  bg)
static

References _MateBG::file_cache, file_cache_entry_delete(), _MateBG::pixbuf_cache, and _MateBG::timeout_id.

Referenced by file_changed(), mate_bg_dispose(), and mate_bg_set_filename().

Here is the call graph for this function:

◆ color_from_string()

static void color_from_string ( const char *  string,
GdkRGBA *  colorp 
)
static

◆ color_to_string()

static char * color_to_string ( const GdkRGBA *  color)
static

◆ create_gradient()

static guchar * create_gradient ( const GdkRGBA *  primary,
const GdkRGBA *  secondary,
int  n_pixels 
)
static

Referenced by pixbuf_draw_gradient().

◆ create_img_thumbnail()

static GdkPixbuf * create_img_thumbnail ( MateBG *  bg,
MateDesktopThumbnailFactory *  factory,
GdkScreen *  screen,
int  dest_width,
int  dest_height,
int  frame_num 
)
static

References blend(), ensure_timeout(), _FileSize::file, _Slide::file1, _Slide::file2, _MateBG::filename, find_best_size(), _Slide::fixed, get_as_slideshow(), get_as_thumbnail(), get_current_slide(), _MateBG::placement, scale_thumbnail(), _SlideShow::slides, and slideshow_unref().

Referenced by mate_bg_create_frame_thumbnail(), and mate_bg_create_thumbnail().

Here is the call graph for this function:

◆ create_thumbnail_for_filename()

static GdkPixbuf * create_thumbnail_for_filename ( MateDesktopThumbnailFactory *  factory,
const char *  filename 
)
static

References get_mtime(), mate_desktop_thumbnail_factory_create_failed_thumbnail(), mate_desktop_thumbnail_factory_lookup(), mate_desktop_thumbnail_factory_save_thumbnail(), pixbuf_scale_to_fit(), and THUMBNAIL_SIZE.

Referenced by get_as_thumbnail(), and mate_bg_get_image_size().

Here is the call graph for this function:

◆ do_changed()

static gboolean do_changed ( MateBG *  bg)
static

References CHANGED, _MateBG::changed_id, and signals.

Referenced by queue_changed().

◆ do_transitioned()

static gboolean do_transitioned ( MateBG *  bg)
static

◆ draw_color()

static void draw_color ( MateBG *  bg,
GdkPixbuf *  dest 
)
static

References draw_color_area().

Referenced by mate_bg_create_frame_thumbnail(), mate_bg_create_thumbnail(), and mate_bg_draw().

Here is the call graph for this function:

◆ draw_color_area()

static void draw_color_area ( MateBG *  bg,
GdkPixbuf *  dest,
GdkRectangle *  rect 
)
static

References _MateBG::color_type, MATE_BG_COLOR_H_GRADIENT, MATE_BG_COLOR_SOLID, MATE_BG_COLOR_V_GRADIENT, pixbuf_draw_gradient(), _MateBG::primary, and _MateBG::secondary.

Referenced by draw_color(), and draw_color_each_monitor().

Here is the call graph for this function:

◆ draw_color_each_monitor()

static void draw_color_each_monitor ( MateBG *  bg,
GdkPixbuf *  dest,
GdkScreen *  screen 
)
static

References draw_color_area().

Referenced by mate_bg_draw().

Here is the call graph for this function:

◆ draw_each_monitor()

static void draw_each_monitor ( MateBG *  bg,
GdkPixbuf *  dest,
GdkScreen *  screen 
)
static

References draw_image_area(), and get_pixbuf_for_size().

Referenced by mate_bg_draw().

Here is the call graph for this function:

◆ draw_image_area()

static void draw_image_area ( MateBG *  bg,
gint  num_monitor,
GdkPixbuf *  pixbuf,
GdkPixbuf *  dest,
GdkRectangle *  area 
)
static

References get_scaled_pixbuf(), MATE_BG_PLACEMENT_CENTERED, MATE_BG_PLACEMENT_FILL_SCREEN, MATE_BG_PLACEMENT_SCALED, MATE_BG_PLACEMENT_SPANNED, MATE_BG_PLACEMENT_TILED, MATE_BG_PLACEMENT_ZOOMED, pixbuf_blend(), pixbuf_tile(), _MateBG::placement, and refresh_cache_file().

Referenced by draw_each_monitor(), draw_image_for_thumb(), and draw_once().

Here is the call graph for this function:

◆ draw_image_for_thumb()

static void draw_image_for_thumb ( MateBG *  bg,
GdkPixbuf *  pixbuf,
GdkPixbuf *  dest 
)
static

References draw_image_area().

Referenced by mate_bg_create_frame_thumbnail(), and mate_bg_create_thumbnail().

Here is the call graph for this function:

◆ draw_once()

static void draw_once ( MateBG *  bg,
GdkPixbuf *  dest,
gboolean  is_root 
)
static

References draw_image_area(), and get_pixbuf_for_size().

Referenced by mate_bg_draw().

Here is the call graph for this function:

◆ dump_bg()

◆ ensure_timeout()

static void ensure_timeout ( MateBG *  bg,
Slide *  slide 
)
static

References get_slide_timeout(), on_timeout(), and _MateBG::timeout_id.

Referenced by create_img_thumbnail(), and get_pixbuf_for_size().

Here is the call graph for this function:

◆ file_cache_add_pixbuf()

static void file_cache_add_pixbuf ( MateBG *  bg,
const char *  filename,
GdkPixbuf *  pixbuf 
)
static

References file_cache_entry_new(), PIXBUF, FileCacheEntry::pixbuf, and FileCacheEntry::u.

Referenced by get_as_pixbuf_for_size().

Here is the call graph for this function:

◆ file_cache_add_slide_show()

static void file_cache_add_slide_show ( MateBG *  bg,
const char *  filename,
SlideShow *  show 
)
static

References file_cache_entry_new(), SLIDESHOW, FileCacheEntry::slideshow, slideshow_ref(), and FileCacheEntry::u.

Referenced by get_as_slideshow().

Here is the call graph for this function:

◆ file_cache_add_thumbnail()

static void file_cache_add_thumbnail ( MateBG *  bg,
const char *  filename,
GdkPixbuf *  pixbuf 
)
static

References file_cache_entry_new(), THUMBNAIL, FileCacheEntry::thumbnail, and FileCacheEntry::u.

Referenced by get_as_thumbnail().

Here is the call graph for this function:

◆ file_cache_entry_delete()

static void file_cache_entry_delete ( FileCacheEntry *  ent)
static

References FileCacheEntry::filename, PIXBUF, FileCacheEntry::pixbuf, SLIDESHOW, FileCacheEntry::slideshow, slideshow_unref(), THUMBNAIL, FileCacheEntry::thumbnail, FileCacheEntry::type, and FileCacheEntry::u.

Referenced by blow_expensive_caches(), bound_cache(), and clear_cache().

Here is the call graph for this function:

◆ file_cache_entry_new()

static FileCacheEntry * file_cache_entry_new ( MateBG *  bg,
FileType  type,
const char *  filename 
)
static

References bound_cache(), _MateBG::file_cache, file_cache_lookup(), FileCacheEntry::filename, and FileCacheEntry::type.

Referenced by file_cache_add_pixbuf(), file_cache_add_slide_show(), and file_cache_add_thumbnail().

Here is the call graph for this function:

◆ file_cache_lookup()

static const FileCacheEntry * file_cache_lookup ( MateBG *  bg,
FileType  type,
const char *  filename 
)
static

◆ file_changed()

static void file_changed ( GFileMonitor *  file_monitor,
GFile *  child,
GFile *  other_file,
GFileMonitorEvent  event_type,
gpointer  user_data 
)
static

References clear_cache(), MATE_BG, and queue_changed().

Referenced by mate_bg_set_filename().

Here is the call graph for this function:

◆ find_best_size()

static FileSize * find_best_size ( GSList *  sizes,
gint  width,
gint  height 
)
static

◆ fit_factor()

static double fit_factor ( int  from_width,
int  from_height,
int  to_width,
int  to_height 
)
static

Referenced by scale_thumbnail().

◆ get_as_pixbuf_for_size()

static GdkPixbuf * get_as_pixbuf_for_size ( MateBG *  bg,
const char *  filename,
gint  monitor,
gint  best_width,
gint  best_height 
)
static

References file_cache_add_pixbuf(), file_cache_lookup(), load_from_cache_file(), MATE_BG_PLACEMENT_FILL_SCREEN, MATE_BG_PLACEMENT_SCALED, MATE_BG_PLACEMENT_ZOOMED, PIXBUF, FileCacheEntry::pixbuf, _MateBG::placement, and FileCacheEntry::u.

Referenced by get_pixbuf_for_size().

Here is the call graph for this function:

◆ get_as_slideshow()

static SlideShow * get_as_slideshow ( MateBG *  bg,
const char *  filename 
)
static

References file_cache_add_slide_show(), file_cache_lookup(), read_slideshow_file(), SLIDESHOW, FileCacheEntry::slideshow, slideshow_ref(), and FileCacheEntry::u.

Referenced by create_img_thumbnail(), get_filename_for_size(), get_pixbuf_for_size(), mate_bg_changes_with_time(), mate_bg_create_frame_thumbnail(), and mate_bg_has_multiple_sizes().

Here is the call graph for this function:

◆ get_as_thumbnail()

static GdkPixbuf * get_as_thumbnail ( MateBG *  bg,
MateDesktopThumbnailFactory *  factory,
const char *  filename 
)
static

References create_thumbnail_for_filename(), file_cache_add_thumbnail(), file_cache_lookup(), THUMBNAIL, FileCacheEntry::thumbnail, and FileCacheEntry::u.

Referenced by create_img_thumbnail().

Here is the call graph for this function:

◆ get_current_slide()

static Slide * get_current_slide ( SlideShow *  show,
double *  alpha 
)
static

References _Slide::duration, now(), _SlideShow::slides, _SlideShow::start_time, and _SlideShow::total_duration.

Referenced by create_img_thumbnail(), get_filename_for_size(), and get_pixbuf_for_size().

Here is the call graph for this function:

◆ get_filename_for_size()

static const char * get_filename_for_size ( MateBG *  bg,
gint  best_width,
gint  best_height 
)
static

References _FileSize::file, _Slide::file1, _MateBG::filename, find_best_size(), get_as_slideshow(), get_current_slide(), and slideshow_unref().

Referenced by mate_bg_get_image_size().

Here is the call graph for this function:

◆ get_mtime()

static gint64 get_mtime ( const char *  filename)
static

◆ get_original_size()

static gboolean get_original_size ( const char *  filename,
int *  orig_width,
int *  orig_height 
)
static

◆ get_pixbuf_for_size() [1/2]

static GdkPixbuf * get_pixbuf_for_size ( MateBG *  bg,
gint  monitor,
gint  best_width,
gint  best_height 
)
static

◆ get_pixbuf_for_size() [2/2]

static GdkPixbuf * get_pixbuf_for_size ( MateBG *  bg,
gint  num_monitor,
int  width,
int  height 
)
static

◆ get_scaled_pixbuf()

static GdkPixbuf * get_scaled_pixbuf ( MateBGPlacement  placement,
GdkPixbuf *  pixbuf,
int  width,
int  height,
int *  x,
int *  y,
int *  w,
int *  h 
)
static

References MATE_BG_PLACEMENT_CENTERED, MATE_BG_PLACEMENT_FILL_SCREEN, MATE_BG_PLACEMENT_SCALED, MATE_BG_PLACEMENT_SPANNED, MATE_BG_PLACEMENT_TILED, MATE_BG_PLACEMENT_ZOOMED, pixbuf_clip_to_fit(), pixbuf_scale_to_fit(), and pixbuf_scale_to_min().

Referenced by draw_image_area().

Here is the call graph for this function:

◆ get_slide_timeout()

static double get_slide_timeout ( Slide *  slide)
static

◆ get_thumb_annotations()

static gboolean get_thumb_annotations ( GdkPixbuf *  thumb,
int *  orig_width,
int *  orig_height 
)
static

◆ get_wallpaper_cache_dir()

static gchar * get_wallpaper_cache_dir ( void  )
inlinestatic

◆ get_wallpaper_cache_filename()

static char * get_wallpaper_cache_filename ( const char *  filename,
gint  num_monitor,
MateBGPlacement  placement,
gint  width,
gint  height 
)
static

References get_wallpaper_cache_dir(), and get_wallpaper_cache_prefix_name().

Referenced by load_from_cache_file(), and refresh_cache_file().

Here is the call graph for this function:

◆ get_wallpaper_cache_prefix_name()

static gchar * get_wallpaper_cache_prefix_name ( gint  num_monitor,
MateBGPlacement  placement,
gint  width,
gint  height 
)
inlinestatic

◆ handle_end_element()

static void handle_end_element ( GMarkupParseContext *  context,
const gchar *  name,
gpointer  user_data,
GError **  err 
)
static

References _SlideShow::stack.

Referenced by read_slideshow_file().

◆ handle_start_element()

static void handle_start_element ( GMarkupParseContext *  context,
const gchar *  name,
const gchar **  attr_names,
const gchar **  attr_values,
gpointer  user_data,
GError **  err 
)
static

◆ handle_text()

static void handle_text ( GMarkupParseContext *  context,
const gchar *  text,
gsize  text_len,
gpointer  user_data,
GError **  err 
)
static

References _Slide::duration, _FileSize::file, _Slide::file1, _Slide::file2, _SlideShow::has_multiple_sizes, _FileSize::height, parse_int(), _SlideShow::slides, stack_is(), _SlideShow::start_tm, _SlideShow::total_duration, and _FileSize::width.

Referenced by read_slideshow_file().

Here is the call graph for this function:

◆ is_different()

static gboolean is_different ( MateBG *  bg,
const char *  filename 
)
static

References _MateBG::file_mtime, _MateBG::filename, and get_mtime().

Referenced by mate_bg_set_filename().

Here is the call graph for this function:

◆ load_from_cache_file()

static GdkPixbuf * load_from_cache_file ( MateBG *  bg,
const char *  filename,
gint  num_monitor,
gint  best_width,
gint  best_height 
)
static

References cache_file_is_valid(), get_wallpaper_cache_filename(), and _MateBG::placement.

Referenced by get_as_pixbuf_for_size().

Here is the call graph for this function:

◆ make_root_pixmap()

static cairo_surface_t * make_root_pixmap ( GdkWindow *  window,
gint  width,
gint  height 
)
static

◆ mate_bg_changes_with_time()

gboolean mate_bg_changes_with_time ( MateBG *  bg)

References _MateBG::filename, get_as_slideshow(), _SlideShow::slides, and slideshow_unref().

Here is the call graph for this function:

◆ mate_bg_class_init()

static void mate_bg_class_init ( MateBGClass *  klass)
static

References CHANGED, mate_bg_dispose(), mate_bg_finalize(), signals, and TRANSITIONED.

Here is the call graph for this function:

◆ mate_bg_create_frame_thumbnail()

GdkPixbuf * mate_bg_create_frame_thumbnail ( MateBG *  bg,
MateDesktopThumbnailFactory *  factory,
GdkScreen *  screen,
int  dest_width,
int  dest_height,
int  frame_num 
)

mate_bg_create_frame_thumbnail:

Creates a thumbnail for a certain frame, where 'frame' is somewhat vaguely defined as 'suitable point to show while single-stepping through the slideshow'.

Returns: (transfer full): the newly created thumbnail or or NULL if frame_num is out of bounds.

References create_img_thumbnail(), draw_color(), draw_image_for_thumb(), _MateBG::filename, _Slide::fixed, get_as_slideshow(), and _SlideShow::slides.

Here is the call graph for this function:

◆ mate_bg_create_surface()

cairo_surface_t * mate_bg_create_surface ( MateBG *  bg,
GdkWindow *  window,
int  width,
int  height,
gboolean  root 
)

mate_bg_create_surface: @bg: MateBG @window: @width: @height: @root:

Create a surface that can be set as background for @window. If @root is TRUE, the surface created will be created by a temporary X server connection so that if someone calls XKillClient on it, it won't affect the application who created it.

References mate_bg_create_surface_scale().

Here is the call graph for this function:

◆ mate_bg_create_surface_scale()

cairo_surface_t * mate_bg_create_surface_scale ( MateBG *  bg,
GdkWindow *  window,
int  width,
int  height,
int  scale,
gboolean  root 
)

mate_bg_create_surface_scale: @bg: MateBG @window: @width: @height: @scale: @root:

Create a scaled surface that can be set as background for @window. If @root is TRUE, the surface created will be created by a temporary X server connection so that if someone calls XKillClient on it, it won't affect the application who created it.

References _MateBG::color_type, _MateBG::filename, make_root_pixmap(), MATE_BG_COLOR_SOLID, mate_bg_draw(), mate_bg_get_pixmap_size(), _MateBG::pixbuf_cache, and _MateBG::primary.

Referenced by mate_bg_create_surface().

Here is the call graph for this function:

◆ mate_bg_create_thumbnail()

GdkPixbuf * mate_bg_create_thumbnail ( MateBG *  bg,
MateDesktopThumbnailFactory *  factory,
GdkScreen *  screen,
int  dest_width,
int  dest_height 
)

mate_bg_create_thumbnail:

Returns: (transfer full): a #GdkPixbuf showing the background as a thumbnail

References create_img_thumbnail(), draw_color(), draw_image_for_thumb(), and _MateBG::filename.

Here is the call graph for this function:

◆ mate_bg_dispose()

static void mate_bg_dispose ( GObject *  object)
static

References clear_cache(), _MateBG::file_monitor, and MATE_BG.

Referenced by mate_bg_class_init().

Here is the call graph for this function:

◆ mate_bg_draw()

void mate_bg_draw ( MateBG *  bg,
GdkPixbuf *  dest,
GdkScreen *  screen,
gboolean  is_root 
)

References draw_color(), draw_color_each_monitor(), draw_each_monitor(), draw_once(), _MateBG::filename, MATE_BG_PLACEMENT_SPANNED, and _MateBG::placement.

Referenced by mate_bg_create_surface_scale().

Here is the call graph for this function:

◆ mate_bg_finalize()

static void mate_bg_finalize ( GObject *  object)
static

◆ mate_bg_get_color()

void mate_bg_get_color ( MateBG *  bg,
MateBGColorType *  type,
GdkRGBA *  primary,
GdkRGBA *  secondary 
)

◆ mate_bg_get_draw_background()

gboolean mate_bg_get_draw_background ( MateBG *  bg)

References _MateBG::is_enabled.

◆ mate_bg_get_filename()

const gchar * mate_bg_get_filename ( MateBG *  bg)

References _MateBG::filename.

◆ mate_bg_get_image_size()

gboolean mate_bg_get_image_size ( MateBG *  bg,
MateDesktopThumbnailFactory *  factory,
int  best_width,
int  best_height,
int *  width,
int *  height 
)

References create_thumbnail_for_filename(), _MateBG::filename, get_filename_for_size(), get_original_size(), and get_thumb_annotations().

Here is the call graph for this function:

◆ mate_bg_get_pixmap_size()

static void mate_bg_get_pixmap_size ( MateBG *  bg,
int  width,
int  height,
int *  pixmap_width,
int *  pixmap_height 
)
static

◆ mate_bg_get_placement()

MateBGPlacement mate_bg_get_placement ( MateBG *  bg)

References _MateBG::placement.

◆ mate_bg_get_surface_from_root()

cairo_surface_t * mate_bg_get_surface_from_root ( GdkScreen *  screen)

mate_bg_get_surface_from_root: @screen: a #GdkScreen

This function queries the _XROOTPMAP_ID property from the root window associated with @screen to determine the current root window background surface and returns a copy of it. If the _XROOTPMAP_ID is not set, then a black surface is returned.

Return value: a #cairo_surface_t if successful or NULL

Referenced by mate_bg_set_surface_as_root_with_crossfade().

◆ mate_bg_has_multiple_sizes()

gboolean mate_bg_has_multiple_sizes ( MateBG *  bg)

References _MateBG::filename, get_as_slideshow(), slideshow_has_multiple_sizes(), and slideshow_unref().

Here is the call graph for this function:

◆ mate_bg_init()

static void mate_bg_init ( MateBG *  bg)
static

◆ mate_bg_is_dark()

gboolean mate_bg_is_dark ( MateBG *  bg,
int  width,
int  height 
)

References _MateBG::color_type, get_pixbuf_for_size(), MATE_BG_COLOR_SOLID, pixbuf_average_value(), _MateBG::primary, and _MateBG::secondary.

Here is the call graph for this function:

◆ mate_bg_load_from_gsettings()

void mate_bg_load_from_gsettings ( MateBG *  bg,
GSettings *  settings 
)

◆ mate_bg_load_from_preferences()

void mate_bg_load_from_preferences ( MateBG *  bg)

References mate_bg_load_from_gsettings(), MATE_BG_SCHEMA, and queue_changed().

Here is the call graph for this function:

◆ mate_bg_load_from_system_gsettings()

void mate_bg_load_from_system_gsettings ( MateBG *  bg,
GSettings *  settings,
gboolean  reset_apply 
)

References mate_bg_load_from_gsettings(), and MATE_IS_BG.

Referenced by mate_bg_load_from_system_preferences().

Here is the call graph for this function:

◆ mate_bg_load_from_system_preferences()

void mate_bg_load_from_system_preferences ( MateBG *  bg)

References mate_bg_load_from_system_gsettings(), and MATE_BG_SCHEMA.

Here is the call graph for this function:

◆ mate_bg_new()

MateBG * mate_bg_new ( void  )

References MATE_TYPE_BG.

◆ mate_bg_save_to_gsettings()

void mate_bg_save_to_gsettings ( MateBG *  bg,
GSettings *  settings 
)

◆ mate_bg_save_to_preferences()

void mate_bg_save_to_preferences ( MateBG *  bg)

References mate_bg_save_to_gsettings(), and MATE_BG_SCHEMA.

Here is the call graph for this function:

◆ mate_bg_set_color()

void mate_bg_set_color ( MateBG *  bg,
MateBGColorType  type,
GdkRGBA *  primary,
GdkRGBA *  secondary 
)

References _MateBG::color_type, _MateBG::primary, queue_changed(), and _MateBG::secondary.

Referenced by mate_bg_load_from_gsettings().

Here is the call graph for this function:

◆ mate_bg_set_draw_background()

void mate_bg_set_draw_background ( MateBG *  bg,
gboolean  draw_background 
)

References draw_background(), _MateBG::is_enabled, and queue_changed().

Here is the call graph for this function:

◆ mate_bg_set_filename()

void mate_bg_set_filename ( MateBG *  bg,
const char *  filename 
)

References clear_cache(), file_changed(), _MateBG::file_monitor, _MateBG::file_mtime, _MateBG::filename, get_mtime(), is_different(), and queue_changed().

Referenced by mate_bg_load_from_gsettings().

Here is the call graph for this function:

◆ mate_bg_set_placement()

void mate_bg_set_placement ( MateBG *  bg,
MateBGPlacement  placement 
)

References _MateBG::placement, and queue_changed().

Referenced by mate_bg_load_from_gsettings().

Here is the call graph for this function:

◆ mate_bg_set_root_pixmap_id()

static void mate_bg_set_root_pixmap_id ( GdkScreen *  screen,
Display *  display,
Pixmap  xpixmap 
)
static

◆ mate_bg_set_surface_as_root()

void mate_bg_set_surface_as_root ( GdkScreen *  screen,
cairo_surface_t *  surface 
)

mate_bg_set_surface_as_root: @screen: the #GdkScreen to change root background on @surface: the #cairo_surface_t to set root background from.

Must be an xlib surface backing a pixmap.

Set the root pixmap, and properties pointing to it. We do this atomically with a server grab to make sure that we won't leak the pixmap if somebody else it setting it at the same time. (This assumes that they follow the same conventions we do). @surface should come from a call to mate_bg_create_surface().

References mate_bg_set_root_pixmap_id().

Referenced by mate_bg_set_surface_as_root_with_crossfade().

Here is the call graph for this function:

◆ mate_bg_set_surface_as_root_with_crossfade()

MateBGCrossfade * mate_bg_set_surface_as_root_with_crossfade ( GdkScreen *  screen,
cairo_surface_t *  surface 
)

mate_bg_set_surface_as_root_with_crossfade: @screen: the #GdkScreen to change root background on @surface: the cairo xlib surface to set root background from

Set the root pixmap, and properties pointing to it. This function differs from mate_bg_set_surface_as_root() in that it adds a subtle crossfade animation from the current root pixmap to the new one.

Return value: (transfer full): a MateBGCrossfade object

References mate_bg_crossfade_new(), mate_bg_crossfade_set_end_surface(), mate_bg_crossfade_set_start_surface(), mate_bg_crossfade_start(), mate_bg_get_surface_from_root(), and mate_bg_set_surface_as_root().

Here is the call graph for this function:

◆ now()

static double now ( void  )
static

◆ on_timeout()

static gboolean on_timeout ( gpointer  data)
static

References queue_transitioned(), and _MateBG::timeout_id.

Referenced by ensure_timeout().

Here is the call graph for this function:

◆ parse_int()

static int parse_int ( const char *  text)
static

Referenced by handle_text().

◆ pixbuf_average_value()

static void pixbuf_average_value ( GdkPixbuf *  pixbuf,
GdkRGBA *  result 
)
static

Referenced by mate_bg_is_dark().

◆ pixbuf_blend()

static void pixbuf_blend ( GdkPixbuf *  src,
GdkPixbuf *  dest,
int  src_x,
int  src_y,
int  width,
int  height,
int  dest_x,
int  dest_y,
double  alpha 
)
static

Referenced by blend(), draw_image_area(), and pixbuf_tile().

◆ pixbuf_clip_to_fit()

static GdkPixbuf * pixbuf_clip_to_fit ( GdkPixbuf *  src,
int  max_width,
int  max_height 
)
static

Referenced by get_scaled_pixbuf().

◆ pixbuf_draw_gradient()

static void pixbuf_draw_gradient ( GdkPixbuf *  pixbuf,
gboolean  horizontal,
GdkRGBA *  c1,
GdkRGBA *  c2,
GdkRectangle *  rect 
)
static

References create_gradient().

Referenced by draw_color_area().

Here is the call graph for this function:

◆ pixbuf_scale_to_fit()

static GdkPixbuf * pixbuf_scale_to_fit ( GdkPixbuf *  src,
int  max_width,
int  max_height 
)
static

◆ pixbuf_scale_to_min()

static GdkPixbuf * pixbuf_scale_to_min ( GdkPixbuf *  src,
int  min_width,
int  min_height 
)
static

Referenced by get_scaled_pixbuf().

◆ pixbuf_tile()

static void pixbuf_tile ( GdkPixbuf *  src,
GdkPixbuf *  dest 
)
static

References pixbuf_blend().

Referenced by draw_image_area().

Here is the call graph for this function:

◆ queue_changed()

static void queue_changed ( MateBG *  bg)
static

References _MateBG::changed_id, and do_changed().

Referenced by file_changed(), mate_bg_load_from_preferences(), mate_bg_set_color(), mate_bg_set_draw_background(), mate_bg_set_filename(), and mate_bg_set_placement().

Here is the call graph for this function:

◆ queue_transitioned()

static void queue_transitioned ( MateBG *  bg)
static

References do_transitioned(), and _MateBG::transitioned_id.

Referenced by on_timeout().

Here is the call graph for this function:

◆ read_slideshow_file()

static SlideShow * read_slideshow_file ( const char *  filename,
GError **  err 
)
static

References dump_bg(), _Slide::duration, handle_end_element(), handle_start_element(), handle_text(), _SlideShow::ref_count, _SlideShow::slides, slideshow_unref(), _SlideShow::stack, _SlideShow::start_time, _SlideShow::start_tm, threadsafe_localtime(), and _SlideShow::total_duration.

Referenced by get_as_slideshow().

Here is the call graph for this function:

◆ refresh_cache_file()

static void refresh_cache_file ( MateBG *  bg,
GdkPixbuf *  new_pixbuf,
gint  num_monitor,
gint  width,
gint  height 
)
static

References cache_file_is_valid(), cleanup_cache_for_monitor(), _MateBG::filename, get_wallpaper_cache_dir(), get_wallpaper_cache_filename(), and _MateBG::placement.

Referenced by draw_image_area().

Here is the call graph for this function:

◆ scale_thumbnail()

static GdkPixbuf * scale_thumbnail ( MateBGPlacement  placement,
const char *  filename,
GdkPixbuf *  thumb,
GdkScreen *  screen,
int  dest_width,
int  dest_height 
)
static

References fit_factor(), get_original_size(), get_thumb_annotations(), MATE_BG_PLACEMENT_CENTERED, and MATE_BG_PLACEMENT_TILED.

Referenced by create_img_thumbnail().

Here is the call graph for this function:

◆ slideshow_has_multiple_sizes()

static gboolean slideshow_has_multiple_sizes ( SlideShow *  show)
static

◆ slideshow_ref()

static SlideShow * slideshow_ref ( SlideShow *  show)
static

◆ slideshow_unref()

◆ stack_is()

static gboolean stack_is ( SlideShow *  parser,
const char *  s1,
  ... 
)
static

References _SlideShow::stack.

Referenced by handle_text().

◆ threadsafe_localtime()

static void threadsafe_localtime ( time_t  time,
struct tm *  tm 
)
static

Referenced by read_slideshow_file().

Variable Documentation

◆ signals

guint signals[N_SIGNALS] = {0}
static