marco 1.29.1
Window manager
Loading...
Searching...
No Matches
effects.c File Reference
View source

"Special effects" other than compositor effects. More...

#include <config.h>
#include "effects.h"
#include "display-private.h"
#include "ui.h"
#include "window-private.h"
#include "prefs.h"
#include <string.h>
Include dependency graph for effects.c:

Data Structures

struct  BoxAnimationContext
 
struct  MetaMinimizeEffect
 Information we need to know during a maximise or minimise effect. More...
 
struct  MetaEffectPriv
 
struct  MetaEffect
 

Macros

#define META_MINIMIZE_ANIMATION_LENGTH   0.25
 
#define META_SHADE_ANIMATION_LENGTH   0.2
 
#define LINE_WIDTH   META_WIREFRAME_XOR_LINE_WIDTH
 

Typedefs

typedef struct MetaEffect MetaEffect
 
typedef struct MetaEffectPriv MetaEffectPriv
 
typedef struct MetaMinimizeEffect MetaUnminimizeEffect
 

Functions

static void run_default_effect_handler (MetaEffect *effect)
 
static void run_handler (MetaEffect *effect)
 
static void effect_free (MetaEffect *effect)
 Destroys an effect.
 
static MetaEffect * create_effect (MetaEffectType type, MetaWindow *window, MetaEffectFinished finished, gpointer finished_data)
 Creates an effect.
 
static void draw_box_animation (MetaScreen *screen, MetaRectangle *initial_rect, MetaRectangle *destination_rect, double seconds_duration)
 
void meta_effect_run_focus (MetaWindow *window, MetaEffectFinished finished, gpointer data)
 Performs the focus effect.
 
void meta_effect_run_minimize (MetaWindow *window, MetaRectangle *window_rect, MetaRectangle *icon_rect, MetaEffectFinished finished, gpointer data)
 Performs the minimize effect.
 
void meta_effect_run_unminimize (MetaWindow *window, MetaRectangle *window_rect, MetaRectangle *icon_rect, MetaEffectFinished finished, gpointer data)
 Performs the unminimize effect.
 
void meta_effect_run_close (MetaWindow *window, MetaEffectFinished finished, gpointer data)
 Performs the close effect.
 
static gboolean effects_draw_box_animation_timeout (BoxAnimationContext *context)
 
void meta_effects_begin_wireframe (MetaScreen *screen, const MetaRectangle *rect, int width, int height)
 Grabs the server and paints a wireframe rectangle on the screen.
 
static void draw_xor_rect (MetaScreen *screen, const MetaRectangle *rect, int width, int height)
 
void meta_effects_update_wireframe (MetaScreen *screen, const MetaRectangle *old_rect, int old_width, int old_height, const MetaRectangle *new_rect, int new_width, int new_height)
 Moves a wireframe rectangle around after its creation by meta_effects_begin_wireframe().
 
void meta_effects_end_wireframe (MetaScreen *screen, const MetaRectangle *old_rect, int old_width, int old_height)
 Removes a wireframe rectangle from the screen and ends the grab started by meta_effects_begin_wireframe().
 

Detailed Description

"Special effects" other than compositor effects.

Before we had a serious compositor, we supported swooping rectangles for minimising and so on. These are still supported today, even when the compositor is enabled. The file contains two parts:

1) A set of functions, each of which implements a special effect. (Only the minimize function does anything interesting; we should probably get rid of the rest.)

2) A set of functions for moving a highlighted wireframe box around the screen, optionally with height and width shown in the middle. This is used for moving and resizing when reduced_resources is set.

There was formerly a system which allowed callers to drop in their own handlers for various things; it was never used (people who want their own handlers can just modify this file, after all) and it added a good deal of extra complexity, so it has been removed. If you want it, it can be found in svn r3769.

Once upon a time there were three different ways of drawing the box animation: window wireframe, window opaque, and root. People who had the shape extension theoretically had the choice of all three, and people who didn't weren't given the choice of the wireframe option. In practice, though, the opaque animation was never perfect, so it came down to the wireframe option for those who had the extension and the root option for those who didn't; there was actually no way of choosing any other option anyway. Work on the opaque animation stopped in 2002; anyone who wants something like that these days will be using the compositor anyway.

In svn r3769 this was made explicit.

Macro Definition Documentation

◆ LINE_WIDTH

#define LINE_WIDTH   META_WIREFRAME_XOR_LINE_WIDTH

◆ META_MINIMIZE_ANIMATION_LENGTH

#define META_MINIMIZE_ANIMATION_LENGTH   0.25

◆ META_SHADE_ANIMATION_LENGTH

#define META_SHADE_ANIMATION_LENGTH   0.2

Typedef Documentation

◆ MetaEffect

typedef struct MetaEffect MetaEffect

◆ MetaEffectPriv

◆ MetaUnminimizeEffect

Function Documentation

◆ create_effect()

◆ draw_box_animation()

◆ draw_xor_rect()

static void draw_xor_rect ( MetaScreen *  screen,
const MetaRectangle *  rect,
int  width,
int  height 
)
static

◆ effect_free()

static void effect_free ( MetaEffect *  effect)
static

Destroys an effect.

If the effect has a "finished" hook, it will be called before cleanup.

Parameters
effectThe effect.

References MetaEffectPriv::finished, MetaEffectPriv::finished_data, and MetaEffect::priv.

Referenced by run_handler().

◆ effects_draw_box_animation_timeout()

◆ meta_effect_run_close()

void meta_effect_run_close ( MetaWindow *  window,
MetaEffectFinished  finished,
gpointer  data 
)

Performs the close effect.

There is no such effect. FIXME: delete this.

Parameters
windowThe window we're moving
finishedCallback for when it's finished
dataData for callback

References create_effect(), META_EFFECT_CLOSE, NULL, and run_handler().

Referenced by event_callback().

Here is the call graph for this function:

◆ meta_effect_run_focus()

void meta_effect_run_focus ( MetaWindow *  window,
MetaEffectFinished  finished,
gpointer  data 
)

Performs the focus effect.

There is no such effect. FIXME: delete this.

Parameters
windowThe window we're moving
finishedCallback for when it's finished
dataData for callback

References create_effect(), META_EFFECT_FOCUS, NULL, and run_handler().

Referenced by meta_window_focus().

Here is the call graph for this function:

◆ meta_effect_run_minimize()

void meta_effect_run_minimize ( MetaWindow *  window,
MetaRectangle *  window_rect,
MetaRectangle *  target,
MetaEffectFinished  finished,
gpointer  data 
)

Performs the minimize effect.

Parameters
windowThe window we're moving
window_rectIts current state
targetWhere it should end up
finishedCallback for when it's finished
dataData for callback

References create_effect(), MetaMinimizeEffect::icon_rect, META_EFFECT_MINIMIZE, MetaEffect::minimize, NULL, run_handler(), MetaEffect::u, and MetaMinimizeEffect::window_rect.

Referenced by implement_showing().

Here is the call graph for this function:

◆ meta_effect_run_unminimize()

void meta_effect_run_unminimize ( MetaWindow *  window,
MetaRectangle *  window_rect,
MetaRectangle *  icon_rect,
MetaEffectFinished  finished,
gpointer  data 
)

Performs the unminimize effect.

There is no such effect. FIXME: delete this.

Parameters
windowThe window we're moving
icon_rectIts current state
window_rectWhere it should end up
finishedCallback for when it's finished
dataData for callback

References create_effect(), MetaMinimizeEffect::icon_rect, META_EFFECT_UNMINIMIZE, MetaEffect::minimize, NULL, run_handler(), MetaEffect::u, and MetaMinimizeEffect::window_rect.

Referenced by meta_window_show().

Here is the call graph for this function:

◆ meta_effects_begin_wireframe()

void meta_effects_begin_wireframe ( MetaScreen *  screen,
const MetaRectangle *  rect,
int  width,
int  height 
)

Grabs the server and paints a wireframe rectangle on the screen.

Since this involves starting a grab, please be considerate of other users and don't keep the grab for long. You may move the wireframe around using meta_effects_update_wireframe() and remove it, and undo the grab, using meta_effects_end_wireframe().

Parameters
screenThe screen to draw the rectangle on.
rectThe size of the rectangle to draw.
widthThe width to display in the middle (or 0 not to)
heightThe width to display in the middle (or 0 not to)

References meta_display_grab(), meta_effects_update_wireframe(), meta_ui_push_delay_exposes(), NULL, and screen.

Referenced by meta_window_begin_wireframe().

Here is the call graph for this function:

◆ meta_effects_end_wireframe()

void meta_effects_end_wireframe ( MetaScreen *  screen,
const MetaRectangle *  old_rect,
int  width,
int  height 
)

Removes a wireframe rectangle from the screen and ends the grab started by meta_effects_begin_wireframe().

Parameters
old_rectWhere the rectangle is now
old_widthThe width that was displayed on it (or 0 if there wasn't)
old_heightThe height that was displayed on it (or 0 if there wasn't)

References meta_display_ungrab(), meta_effects_update_wireframe(), meta_ui_pop_delay_exposes(), NULL, and screen.

Referenced by meta_window_end_wireframe().

Here is the call graph for this function:

◆ meta_effects_update_wireframe()

void meta_effects_update_wireframe ( MetaScreen *  screen,
const MetaRectangle *  old_rect,
int  old_width,
int  old_height,
const MetaRectangle *  new_rect,
int  new_width,
int  new_height 
)

Moves a wireframe rectangle around after its creation by meta_effects_begin_wireframe().

(Perhaps we ought to remember the old positions and not require people to pass them in?)

Parameters
old_rectWhere the rectangle is now
old_widthThe width that was displayed on it (or 0 if there wasn't)
old_heightThe height that was displayed on it (or 0 if there wasn't)
new_rectWhere the rectangle is going
new_widthThe width that will be displayed on it (or 0 not to)
new_heightThe height that will be displayed on it (or 0 not to)

References draw_xor_rect(), and screen.

Referenced by meta_effects_begin_wireframe(), meta_effects_end_wireframe(), and meta_window_update_wireframe().

Here is the call graph for this function:

◆ run_default_effect_handler()

static void run_default_effect_handler ( MetaEffect *  effect)
static

References draw_box_animation(), MetaMinimizeEffect::icon_rect, META_EFFECT_MINIMIZE, META_MINIMIZE_ANIMATION_LENGTH, MetaEffect::minimize, _MetaWindow::screen, MetaEffect::type, MetaEffect::u, MetaEffect::window, and MetaMinimizeEffect::window_rect.

Referenced by run_handler().

Here is the call graph for this function:

◆ run_handler()

static void run_handler ( MetaEffect *  effect)
static

References effect_free(), meta_prefs_get_mate_animations(), and run_default_effect_handler().

Referenced by meta_effect_run_close(), meta_effect_run_focus(), meta_effect_run_minimize(), and meta_effect_run_unminimize().

Here is the call graph for this function: