effects.c File Reference

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

Go to the source code of this file.

Data Structures

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

Defines

#define META_MINIMIZE_ANIMATION_LENGTH   0.25
#define META_SHADE_ANIMATION_LENGTH   0.2
#define OUTLINE_WIDTH   3
#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 MetaEffectcreate_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 void update_wireframe_window (MetaDisplay *display, Window xwindow, const MetaRectangle *rect)
static void graphics_sync (BoxAnimationContext *context)
 A hack to force the X server to synchronize with the graphics hardware.
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.

Definition in file effects.c.


Define Documentation

#define LINE_WIDTH   META_WIREFRAME_XOR_LINE_WIDTH

Referenced by draw_xor_rect().

#define META_MINIMIZE_ANIMATION_LENGTH   0.25

Definition at line 69 of file effects.c.

Referenced by run_default_effect_handler().

#define META_SHADE_ANIMATION_LENGTH   0.2

Definition at line 70 of file effects.c.

#define OUTLINE_WIDTH   3


Typedef Documentation

typedef struct MetaEffect MetaEffect

Definition at line 74 of file effects.c.

Definition at line 75 of file effects.c.


Function Documentation

static MetaEffect * create_effect ( MetaEffectType  type,
MetaWindow window,
MetaEffectFinished  finished,
gpointer  finished_data 
) [static]

void draw_box_animation ( MetaScreen screen,
MetaRectangle initial_rect,
MetaRectangle destination_rect,
double  seconds_duration 
) [static]

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

static void effect_free ( MetaEffect effect  )  [static]

Destroys an effect.

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

Parameters:
effect The effect.

Definition at line 182 of file effects.c.

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

Referenced by run_handler().

static gboolean effects_draw_box_animation_timeout ( BoxAnimationContext context  )  [static]

static void graphics_sync ( BoxAnimationContext context  )  [static]

A hack to force the X server to synchronize with the graphics hardware.

Definition at line 322 of file effects.c.

References _MetaScreen::display, BoxAnimationContext::screen, _MetaDisplay::xdisplay, and _MetaScreen::xroot.

Referenced by effects_draw_box_animation_timeout().

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

Performs the close effect.

There is no such effect. FIXME: delete this.

Parameters:
window The window we're moving
finished Callback for when it's finished
data Data for callback

Definition at line 246 of file effects.c.

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

Referenced by event_callback().

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

Performs the focus effect.

There is no such effect. FIXME: delete this.

Parameters:
window The window we're moving
finished Callback for when it's finished
data Data for callback

Definition at line 192 of file effects.c.

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

Referenced by meta_window_focus().

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

Performs the minimize effect.

Parameters:
window The window we're moving
window_rect Its current state
target Where it should end up
finished Callback for when it's finished
data Data for callback

Definition at line 206 of file effects.c.

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

Referenced by implement_showing().

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:
window The window we're moving
icon_rect Its current state
window_rect Where it should end up
finished Callback for when it's finished
data Data for callback

Definition at line 226 of file effects.c.

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().

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:
screen The screen to draw the rectangle on.
rect The size of the rectangle to draw.
width The width to display in the middle (or 0 not to)
height The width to display in the middle (or 0 not to)

Definition at line 517 of file effects.c.

References _MetaScreen::display, meta_display_grab(), meta_effects_update_wireframe(), meta_ui_push_delay_exposes(), NULL, and _MetaScreen::ui.

Referenced by meta_window_begin_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_rect Where the rectangle is now
old_width The width that was displayed on it (or 0 if there wasn't)
old_height The height that was displayed on it (or 0 if there wasn't)

Definition at line 698 of file effects.c.

References _MetaScreen::display, meta_display_ungrab(), meta_effects_update_wireframe(), meta_ui_pop_delay_exposes(), NULL, and _MetaScreen::ui.

Referenced by meta_window_end_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_rect Where the rectangle is now
old_width The width that was displayed on it (or 0 if there wasn't)
old_height The height that was displayed on it (or 0 if there wasn't)
new_rect Where the rectangle is going
new_width The width that will be displayed on it (or 0 not to)
new_height The height that will be displayed on it (or 0 not to)

Definition at line 680 of file effects.c.

References _MetaScreen::display, draw_xor_rect(), and _MetaDisplay::xdisplay.

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

static void run_default_effect_handler ( MetaEffect effect  )  [static]

static void run_handler ( MetaEffect effect  )  [static]

static void update_wireframe_window ( MetaDisplay display,
Window  xwindow,
const MetaRectangle rect 
) [static]


Generated on Sat Aug 23 22:04:20 2008 for metacity by  doxygen 1.5.5