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

Data Structures

struct  _MateBGCrossfadePrivate
 

Macros

#define MATE_DESKTOP_USE_UNSTABLE_API
 

Enumerations

enum  { PROP_0 , PROP_WIDTH , PROP_HEIGHT }
 
enum  { FINISHED , NUMBER_OF_SIGNALS }
 

Functions

static void mate_bg_crossfade_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 
static void mate_bg_crossfade_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 
static void mate_bg_crossfade_finalize (GObject *object)
 
static void mate_bg_crossfade_class_init (MateBGCrossfadeClass *fade_class)
 
static void mate_bg_crossfade_init (MateBGCrossfade *fade)
 
MateBGCrossfade * mate_bg_crossfade_new (int width, int height)
 mate_bg_crossfade_new: @width: The width of the crossfading window @height: The height of the crossfading window
 
static cairo_surface_t * tile_surface (cairo_surface_t *surface, int width, int height)
 
gboolean mate_bg_crossfade_set_start_surface (MateBGCrossfade *fade, cairo_surface_t *surface)
 mate_bg_crossfade_set_start_surface: @fade: a MateBGCrossfade @surface: The cairo surface to fade from
 
static gdouble get_current_time (void)
 
gboolean mate_bg_crossfade_set_end_surface (MateBGCrossfade *fade, cairo_surface_t *surface)
 mate_bg_crossfade_set_end_surface: @fade: a MateBGCrossfade @surface: The cairo surface to fade to
 
static gboolean animations_are_disabled (MateBGCrossfade *fade)
 
static void send_root_property_change_notification (MateBGCrossfade *fade)
 
static void draw_background (MateBGCrossfade *fade)
 
static gboolean on_widget_draw (GtkWidget *widget, cairo_t *cr, MateBGCrossfade *fade)
 
static gboolean on_tick (MateBGCrossfade *fade)
 
static void on_finished (MateBGCrossfade *fade)
 
static cairo_surface_t * get_root_pixmap_id_surface (GdkDisplay *display)
 
void mate_bg_crossfade_start (MateBGCrossfade *fade, GdkWindow *window)
 mate_bg_crossfade_start: @fade: a MateBGCrossfade @window: The #GdkWindow to draw crossfade on
 
void mate_bg_crossfade_start_widget (MateBGCrossfade *fade, GtkWidget *widget)
 mate_bg_crossfade_start_widget: @fade: a MateBGCrossfade @widget: The #GtkWidget to draw crossfade on
 
gboolean mate_bg_crossfade_is_started (MateBGCrossfade *fade)
 mate_bg_crossfade_is_started: @fade: a MateBGCrossfade
 
void mate_bg_crossfade_stop (MateBGCrossfade *fade)
 mate_bg_crossfade_stop: @fade: a MateBGCrossfade
 

Variables

static guint signals [NUMBER_OF_SIGNALS] = { 0 }
 

Macro Definition Documentation

◆ MATE_DESKTOP_USE_UNSTABLE_API

#define MATE_DESKTOP_USE_UNSTABLE_API

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PROP_0 
PROP_WIDTH 
PROP_HEIGHT 

◆ anonymous enum

anonymous enum
Enumerator
FINISHED 
NUMBER_OF_SIGNALS 

Function Documentation

◆ animations_are_disabled()

static gboolean animations_are_disabled ( MateBGCrossfade *  fade)
static

◆ draw_background()

static void draw_background ( MateBGCrossfade *  fade)
static

References _MateBGCrossfadePrivate::fading_surface, _MateBGCrossfade::priv, send_root_property_change_notification(), _MateBGCrossfadePrivate::widget, and _MateBGCrossfadePrivate::window.

Referenced by mate_bg_crossfade_start(), mate_bg_set_draw_background(), on_finished(), and on_tick().

Here is the call graph for this function:

◆ get_current_time()

static gdouble get_current_time ( void  )
static

References now().

Referenced by mate_bg_crossfade_set_end_surface(), mate_bg_crossfade_start(), and on_tick().

Here is the call graph for this function:

◆ get_root_pixmap_id_surface()

static cairo_surface_t * get_root_pixmap_id_surface ( GdkDisplay *  display)
static

Referenced by mate_bg_crossfade_start().

◆ mate_bg_crossfade_class_init()

static void mate_bg_crossfade_class_init ( MateBGCrossfadeClass *  fade_class)
static

MateBGCrossfade:width:

When a crossfade is running, this is width of the fading surface.

MateBGCrossfade:height:

When a crossfade is running, this is height of the fading surface.

MateBGCrossfade::finished: @fade: the MateBGCrossfade that received the signal @window: the #GdkWindow the crossfade happend on.

When a crossfade finishes, @window will have a copy of the end surface as its background, and this signal will get emitted.

References FINISHED, mate_bg_crossfade_finalize(), mate_bg_crossfade_get_property(), mate_bg_crossfade_set_property(), PROP_HEIGHT, PROP_WIDTH, and signals.

Here is the call graph for this function:

◆ mate_bg_crossfade_finalize()

static void mate_bg_crossfade_finalize ( GObject *  object)
static

References _MateBGCrossfadePrivate::end_surface, _MateBGCrossfadePrivate::fading_surface, MATE_BG_CROSSFADE, mate_bg_crossfade_stop(), _MateBGCrossfade::priv, and _MateBGCrossfadePrivate::start_surface.

Referenced by mate_bg_crossfade_class_init().

Here is the call graph for this function:

◆ mate_bg_crossfade_get_property()

static void mate_bg_crossfade_get_property ( GObject *  object,
guint  property_id,
GValue *  value,
GParamSpec *  pspec 
)
static

◆ mate_bg_crossfade_init()

◆ mate_bg_crossfade_is_started()

gboolean mate_bg_crossfade_is_started ( MateBGCrossfade *  fade)

mate_bg_crossfade_is_started: @fade: a MateBGCrossfade

This function reveals whether or not @fade is currently running on a window. See mate_bg_crossfade_start() for information on how to initiate a crossfade.

Return value: TRUE if fading, or FALSE if not fading

References MATE_IS_BG_CROSSFADE, _MateBGCrossfade::priv, and _MateBGCrossfadePrivate::timeout_id.

Referenced by mate_bg_crossfade_start(), and mate_bg_crossfade_stop().

◆ mate_bg_crossfade_new()

MateBGCrossfade * mate_bg_crossfade_new ( int  width,
int  height 
)

mate_bg_crossfade_new: @width: The width of the crossfading window @height: The height of the crossfading window

Creates a new object to manage crossfading a window background between two #cairo_surface_ts.

Return value: the new MateBGCrossfade

References MATE_TYPE_BG_CROSSFADE.

Referenced by mate_bg_set_surface_as_root_with_crossfade().

◆ mate_bg_crossfade_set_end_surface()

gboolean mate_bg_crossfade_set_end_surface ( MateBGCrossfade *  fade,
cairo_surface_t *  surface 
)

mate_bg_crossfade_set_end_surface: @fade: a MateBGCrossfade @surface: The cairo surface to fade to

Before initiating a crossfade with mate_bg_crossfade_start() a start and end surface have to be set. This function sets the surface shown at the end of the crossfade effect.

Return value: TRUE if successful, or FALSE if the surface could not be copied.

References _MateBGCrossfadePrivate::end_surface, get_current_time(), _MateBGCrossfadePrivate::height, MATE_IS_BG_CROSSFADE, _MateBGCrossfade::priv, _MateBGCrossfadePrivate::start_time, tile_surface(), and _MateBGCrossfadePrivate::width.

Referenced by mate_bg_set_surface_as_root_with_crossfade().

Here is the call graph for this function:

◆ mate_bg_crossfade_set_property()

static void mate_bg_crossfade_set_property ( GObject *  object,
guint  property_id,
const GValue *  value,
GParamSpec *  pspec 
)
static

◆ mate_bg_crossfade_set_start_surface()

gboolean mate_bg_crossfade_set_start_surface ( MateBGCrossfade *  fade,
cairo_surface_t *  surface 
)

mate_bg_crossfade_set_start_surface: @fade: a MateBGCrossfade @surface: The cairo surface to fade from

Before initiating a crossfade with mate_bg_crossfade_start() a start and end surface have to be set. This function sets the surface shown at the beginning of the crossfade effect.

Return value: TRUE if successful, or FALSE if the surface could not be copied.

References _MateBGCrossfadePrivate::height, MATE_IS_BG_CROSSFADE, _MateBGCrossfade::priv, _MateBGCrossfadePrivate::start_surface, tile_surface(), and _MateBGCrossfadePrivate::width.

Referenced by mate_bg_set_surface_as_root_with_crossfade().

Here is the call graph for this function:

◆ mate_bg_crossfade_start()

void mate_bg_crossfade_start ( MateBGCrossfade *  fade,
GdkWindow *  window 
)

mate_bg_crossfade_start: @fade: a MateBGCrossfade @window: The #GdkWindow to draw crossfade on

This function initiates a quick crossfade between two surfaces on the background of @window. Before initiating the crossfade both mate_bg_crossfade_set_start_surface() and mate_bg_crossfade_set_end_surface() need to be called. If animations are disabled, the crossfade is skipped, and the window background is set immediately to the end surface.

References draw_background(), _MateBGCrossfadePrivate::end_surface, _MateBGCrossfadePrivate::fading_surface, get_current_time(), get_root_pixmap_id_surface(), _MateBGCrossfadePrivate::height, _MateBGCrossfadePrivate::is_first_frame, mate_bg_crossfade_is_started(), MATE_IS_BG_CROSSFADE, on_finished(), on_tick(), on_widget_draw(), _MateBGCrossfade::priv, _MateBGCrossfadePrivate::start_surface, _MateBGCrossfadePrivate::start_time, tile_surface(), _MateBGCrossfadePrivate::timeout_id, _MateBGCrossfadePrivate::total_duration, _MateBGCrossfadePrivate::widget, _MateBGCrossfadePrivate::width, and _MateBGCrossfadePrivate::window.

Referenced by mate_bg_crossfade_start_widget(), and mate_bg_set_surface_as_root_with_crossfade().

Here is the call graph for this function:

◆ mate_bg_crossfade_start_widget()

void mate_bg_crossfade_start_widget ( MateBGCrossfade *  fade,
GtkWidget *  widget 
)

mate_bg_crossfade_start_widget: @fade: a MateBGCrossfade @widget: The #GtkWidget to draw crossfade on

This function initiates a quick crossfade between two surfaces on the background of @widget. Before initiating the crossfade both mate_bg_crossfade_set_start_surface() and mate_bg_crossfade_set_end_surface() need to be called. If animations are disabled, the crossfade is skipped, and the window background is set immediately to the end surface.

References mate_bg_crossfade_start(), MATE_IS_BG_CROSSFADE, _MateBGCrossfade::priv, and _MateBGCrossfadePrivate::widget.

Here is the call graph for this function:

◆ mate_bg_crossfade_stop()

void mate_bg_crossfade_stop ( MateBGCrossfade *  fade)

mate_bg_crossfade_stop: @fade: a MateBGCrossfade

This function stops any in progress crossfades that may be happening. It's harmless to call this function if @fade is already stopped.

References mate_bg_crossfade_is_started(), MATE_IS_BG_CROSSFADE, _MateBGCrossfade::priv, and _MateBGCrossfadePrivate::timeout_id.

Referenced by mate_bg_crossfade_finalize().

Here is the call graph for this function:

◆ on_finished()

static void on_finished ( MateBGCrossfade *  fade)
static

◆ on_tick()

static gboolean on_tick ( MateBGCrossfade *  fade)
static

◆ on_widget_draw()

static gboolean on_widget_draw ( GtkWidget *  widget,
cairo_t *  cr,
MateBGCrossfade *  fade 
)
static

◆ send_root_property_change_notification()

static void send_root_property_change_notification ( MateBGCrossfade *  fade)
static

◆ tile_surface()

static cairo_surface_t * tile_surface ( cairo_surface_t *  surface,
int  width,
int  height 
)
static

Variable Documentation

◆ signals

guint signals[NUMBER_OF_SIGNALS] = { 0 }
static