summaryrefslogtreecommitdiff
path: root/src/compositor
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/clutter-utils.c41
-rw-r--r--src/compositor/cogl-utils.c21
-rw-r--r--src/compositor/compositor.c254
-rw-r--r--src/compositor/meta-background-actor.c174
-rw-r--r--src/compositor/meta-background-group.c6
-rw-r--r--src/compositor/meta-background-image.c12
-rw-r--r--src/compositor/meta-background.c210
-rw-r--r--src/compositor/meta-cullable.c10
-rw-r--r--src/compositor/meta-dnd-actor.c14
-rw-r--r--src/compositor/meta-dnd.c48
-rw-r--r--src/compositor/meta-feedback-actor.c29
-rw-r--r--src/compositor/meta-module.c47
-rw-r--r--src/compositor/meta-plugin-manager.c50
-rw-r--r--src/compositor/meta-plugin.c13
-rw-r--r--src/compositor/meta-shadow-factory.c181
-rw-r--r--src/compositor/meta-shaped-texture.c44
-rw-r--r--src/compositor/meta-surface-actor-wayland.c41
-rw-r--r--src/compositor/meta-surface-actor-x11.c100
-rw-r--r--src/compositor/meta-surface-actor.c23
-rw-r--r--src/compositor/meta-sync-ring.c127
-rw-r--r--src/compositor/meta-texture-rectangle.c2
-rw-r--r--src/compositor/meta-texture-tower.c122
-rw-r--r--src/compositor/meta-window-actor.c510
-rw-r--r--src/compositor/meta-window-group.c6
-rw-r--r--src/compositor/meta-window-shape.c9
-rw-r--r--src/compositor/plugins/default.c217
-rw-r--r--src/compositor/region-utils.c56
27 files changed, 1373 insertions, 994 deletions
diff --git a/src/compositor/clutter-utils.c b/src/compositor/clutter-utils.c
index 33357c7a5..3ca878512 100644
--- a/src/compositor/clutter-utils.c
+++ b/src/compositor/clutter-utils.c
@@ -57,8 +57,11 @@ round_to_fixed (float x)
/* Help macros to scale from OpenGL <-1,1> coordinates system to
* window coordinates ranging [0,window-size]. Borrowed from clutter-utils.c
*/
-#define MTX_GL_SCALE_X(x,w,v1,v2) ((((((x) / (w)) + 1.0f) / 2.0f) * (v1)) + (v2))
-#define MTX_GL_SCALE_Y(y,w,v1,v2) ((v1) - (((((y) / (w)) + 1.0f) / 2.0f) * (v1)) + (v2))
+#define MTX_GL_SCALE_X(x, w, v1, \
+ v2) ((((((x) / (w)) + 1.0f) / 2.0f) * (v1)) + (v2))
+#define MTX_GL_SCALE_Y(y, w, v1, \
+ v2) ((v1) - (((((y) / (w)) + 1.0f) / 2.0f) * (v1)) + \
+ (v2))
/* This helper function checks if (according to our fixed point precision)
* the vertices @verts form a box of width @widthf and height @heightf
@@ -76,12 +79,17 @@ meta_actor_vertices_are_untransformed (ClutterVertex *verts,
int v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y;
int x, y;
- width = round_to_fixed (widthf); height = round_to_fixed (heightf);
+ width = round_to_fixed (widthf);
+ height = round_to_fixed (heightf);
- v0x = round_to_fixed (verts[0].x); v0y = round_to_fixed (verts[0].y);
- v1x = round_to_fixed (verts[1].x); v1y = round_to_fixed (verts[1].y);
- v2x = round_to_fixed (verts[2].x); v2y = round_to_fixed (verts[2].y);
- v3x = round_to_fixed (verts[3].x); v3y = round_to_fixed (verts[3].y);
+ v0x = round_to_fixed (verts[0].x);
+ v0y = round_to_fixed (verts[0].y);
+ v1x = round_to_fixed (verts[1].x);
+ v1y = round_to_fixed (verts[1].y);
+ v2x = round_to_fixed (verts[2].x);
+ v2y = round_to_fixed (verts[2].y);
+ v3x = round_to_fixed (verts[3].x);
+ v3y = round_to_fixed (verts[3].y);
/* Using shifting for converting fixed => int, gets things right for
* negative values. / 256. wouldn't do the same
@@ -124,7 +132,8 @@ meta_actor_is_untransformed (ClutterActor *actor,
clutter_actor_get_size (actor, &widthf, &heightf);
clutter_actor_get_abs_allocation_vertices (actor, verts);
- return meta_actor_vertices_are_untransformed (verts, widthf, heightf, x_origin, y_origin);
+ return meta_actor_vertices_are_untransformed (verts, widthf, heightf,
+ x_origin, y_origin);
}
/**
@@ -146,10 +155,10 @@ meta_actor_is_untransformed (ClutterActor *actor,
* transform.
*/
gboolean
-meta_actor_painting_untransformed (int paint_width,
- int paint_height,
- int *x_origin,
- int *y_origin)
+meta_actor_painting_untransformed (int paint_width,
+ int paint_height,
+ int *x_origin,
+ int *y_origin)
{
CoglMatrix modelview, projection, modelview_projection;
ClutterVertex vertices[4];
@@ -181,13 +190,15 @@ meta_actor_painting_untransformed (int paint_width,
for (i = 0; i < 4; i++)
{
float w = 1;
- cogl_matrix_transform_point (&modelview_projection, &vertices[i].x, &vertices[i].y, &vertices[i].z, &w);
+ cogl_matrix_transform_point (&modelview_projection, &vertices[i].x,
+ &vertices[i].y, &vertices[i].z, &w);
vertices[i].x = MTX_GL_SCALE_X (vertices[i].x, w,
viewport[2], viewport[0]);
vertices[i].y = MTX_GL_SCALE_Y (vertices[i].y, w,
viewport[3], viewport[1]);
}
- return meta_actor_vertices_are_untransformed (vertices, paint_width, paint_height, x_origin, y_origin);
+ return meta_actor_vertices_are_untransformed (vertices, paint_width,
+ paint_height, x_origin,
+ y_origin);
}
-
diff --git a/src/compositor/cogl-utils.c b/src/compositor/cogl-utils.c
index aed5208fe..d9dd34f72 100644
--- a/src/compositor/cogl-utils.c
+++ b/src/compositor/cogl-utils.c
@@ -43,11 +43,11 @@ meta_create_texture_pipeline (CoglTexture *src_texture)
CoglPipeline *pipeline;
/* The only state used in the pipeline that would affect the shader
- generation is the texture type on the layer. Therefore we create
- a template pipeline which sets this state and all texture
- pipelines are created as a copy of this. That way Cogl can find
- the shader state for the pipeline more quickly by looking at the
- pipeline ancestry instead of resorting to the shader cache. */
+ * generation is the texture type on the layer. Therefore we create
+ * a template pipeline which sets this state and all texture
+ * pipelines are created as a copy of this. That way Cogl can find
+ * the shader state for the pipeline more quickly by looking at the
+ * pipeline ancestry instead of resorting to the shader cache. */
if (G_UNLIKELY (texture_pipeline_template == NULL))
{
CoglContext *ctx =
@@ -119,14 +119,16 @@ meta_create_texture (int width,
}
if (should_use_rectangle)
- texture = COGL_TEXTURE (cogl_texture_rectangle_new_with_size (ctx, width, height));
+ texture =
+ COGL_TEXTURE (cogl_texture_rectangle_new_with_size (ctx, width, height));
else
texture = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, width, height));
cogl_texture_set_components (texture, components);
if ((flags & META_TEXTURE_ALLOW_SLICING) != 0)
{
- /* To find out if we need to slice the texture, we have to go ahead and force storage
+ /* To find out if we need to slice the texture, we have to go ahead and
+ * force storage
* to be allocated
*/
CoglError *catch_error = NULL;
@@ -134,7 +136,10 @@ meta_create_texture (int width,
{
cogl_error_free (catch_error);
cogl_object_unref (texture);
- texture = COGL_TEXTURE (cogl_texture_2d_sliced_new_with_size (ctx, width, height, COGL_TEXTURE_MAX_WASTE));
+ texture =
+ COGL_TEXTURE (cogl_texture_2d_sliced_new_with_size (ctx, width,
+ height,
+ COGL_TEXTURE_MAX_WASTE));
cogl_texture_set_components (texture, components);
}
}
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index a378ed805..c5accdab9 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -39,7 +39,8 @@
*
* # Containers #
*
- * There's two containers in the stage that are used to place window actors, here
+ * There's two containers in the stage that are used to place window actors,
+ *here
* are listed in the order in which they are painted:
*
* - window group, accessible with meta_get_window_group_for_display()
@@ -141,7 +142,8 @@ process_damage (MetaCompositor *compositor,
XDamageNotifyEvent *event,
MetaWindow *window)
{
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
+ MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
+ window));
meta_window_actor_process_x11_damage (window_actor, event);
compositor->frame_has_updated_xsurfaces = TRUE;
@@ -210,7 +212,8 @@ meta_get_feedback_group_for_display (MetaDisplay *display)
* meta_get_window_actors:
* @display: a #MetaDisplay
*
- * Returns: (transfer none) (element-type Clutter.Actor): The set of #MetaWindowActor on @display
+ * Returns: (transfer none) (element-type Clutter.Actor): The set of
+ *#MetaWindowActor on @display
*/
GList *
meta_get_window_actors (MetaDisplay *display)
@@ -232,23 +235,29 @@ meta_set_stage_input_region (MetaDisplay *display,
{
MetaCompositor *compositor = display->compositor;
Display *xdpy = meta_x11_display_get_xdisplay (display->x11_display);
- Window xstage = clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage));
+ Window xstage =
+ clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage));
XFixesSetWindowShapeRegion (xdpy, xstage, ShapeInput, 0, 0, region);
- /* It's generally a good heuristic that when a crossing event is generated because
- * we reshape the overlay, we don't want it to affect focus-follows-mouse focus -
- * it's not the user doing something, it's the environment changing under the user.
+ /* It's generally a good heuristic that when a crossing event is generated
+ * because
+ * we reshape the overlay, we don't want it to affect focus-follows-mouse
+ *focus -
+ * it's not the user doing something, it's the environment changing under
+ *the user.
*/
meta_display_add_ignored_crossing_serial (display, XNextRequest (xdpy));
- XFixesSetWindowShapeRegion (xdpy, compositor->output, ShapeInput, 0, 0, region);
+ XFixesSetWindowShapeRegion (xdpy, compositor->output, ShapeInput, 0, 0,
+ region);
}
}
void
meta_empty_stage_input_region (MetaDisplay *display)
{
- /* Using a static region here is a bit hacky, but Metacity never opens more than
+ /* Using a static region here is a bit hacky, but Metacity never opens more
+ * than
* one XDisplay, so it works fine. */
static XserverRegion region = None;
@@ -304,8 +313,8 @@ meta_stage_is_focused (MetaDisplay *display)
}
static gboolean
-grab_devices (MetaModalOptions options,
- guint32 timestamp)
+grab_devices (MetaModalOptions options,
+ guint32 timestamp)
{
MetaBackend *backend = META_BACKEND (meta_get_backend ());
gboolean pointer_grabbed = FALSE;
@@ -313,7 +322,8 @@ grab_devices (MetaModalOptions options,
if ((options & META_MODAL_POINTER_ALREADY_GRABBED) == 0)
{
- if (!meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp))
+ if (!meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID,
+ timestamp))
goto fail;
pointer_grabbed = TRUE;
@@ -321,7 +331,8 @@ grab_devices (MetaModalOptions options,
if ((options & META_MODAL_KEYBOARD_ALREADY_GRABBED) == 0)
{
- if (!meta_backend_grab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID, timestamp))
+ if (!meta_backend_grab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID,
+ timestamp))
goto fail;
keyboard_grabbed = TRUE;
@@ -329,23 +340,27 @@ grab_devices (MetaModalOptions options,
return TRUE;
- fail:
+fail:
if (pointer_grabbed)
- meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp);
+ meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID,
+ timestamp);
if (keyboard_grabbed)
- meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID, timestamp);
+ meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID,
+ timestamp);
return FALSE;
}
gboolean
-meta_begin_modal_for_plugin (MetaCompositor *compositor,
- MetaPlugin *plugin,
- MetaModalOptions options,
- guint32 timestamp)
+meta_begin_modal_for_plugin (MetaCompositor *compositor,
+ MetaPlugin *plugin,
+ MetaModalOptions options,
+ guint32 timestamp)
{
- /* To some extent this duplicates code in meta_display_begin_grab_op(), but there
- * are significant differences in how we handle grabs that make it difficult to
+ /* To some extent this duplicates code in meta_display_begin_grab_op(), but
+ * there
+ * are significant differences in how we handle grabs that make it difficult
+ *to
* merge the two.
*/
MetaDisplay *display = compositor->display;
@@ -417,7 +432,8 @@ meta_end_modal_for_plugin (MetaCompositor *compositor,
display->grab_have_keyboard = FALSE;
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp);
- meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID, timestamp);
+ meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID,
+ timestamp);
#ifdef HAVE_WAYLAND
if (meta_is_wayland_compositor ())
@@ -440,7 +456,8 @@ after_stage_paint (ClutterStage *stage,
#ifdef HAVE_WAYLAND
if (meta_is_wayland_compositor ())
- meta_wayland_compositor_paint_finished (meta_wayland_compositor_get_default ());
+ meta_wayland_compositor_paint_finished (
+ meta_wayland_compositor_get_default ());
#endif
}
@@ -460,7 +477,8 @@ redirect_windows (MetaX11Display *x11_display)
n_retries = 0;
- /* Some compositors (like old versions of Mutter) might not properly unredirect
+ /* Some compositors (like old versions of Mutter) might not properly
+ * unredirect
* subwindows before destroying the WM selection window; so we wait a while
* for such a compositor to exit before giving up.
*/
@@ -475,9 +493,11 @@ redirect_windows (MetaX11Display *x11_display)
if (n_retries == max_retries)
{
- /* This probably means that a non-WM compositor like xcompmgr is running;
+ /* This probably means that a non-WM compositor like xcompmgr is
+ * running;
* we have no way to get it to exit */
- meta_fatal (_("Another compositing manager is already running on screen %i on display ā€œ%sā€."),
+ meta_fatal (_(
+ "Another compositing manager is already running on screen %i on display ā€œ%sā€."),
screen_number, x11_display->name);
}
@@ -516,7 +536,8 @@ meta_compositor_manage (MetaCompositor *compositor)
g_signal_connect_after (CLUTTER_STAGE (compositor->stage), "after-paint",
G_CALLBACK (after_stage_paint), compositor);
- clutter_stage_set_sync_delay (CLUTTER_STAGE (compositor->stage), META_SYNC_DELAY);
+ clutter_stage_set_sync_delay (CLUTTER_STAGE (
+ compositor->stage), META_SYNC_DELAY);
compositor->window_group = meta_window_group_new (display);
compositor->top_window_group = meta_window_group_new (display);
@@ -553,9 +574,11 @@ meta_compositor_manage (MetaCompositor *compositor)
* because the X server will destroy the overlay window
* when the last client using it exits.
*/
- XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding, 0, 0, None);
+ XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding,
+ 0, 0, None);
- /* Map overlay window before redirecting windows offscreen so we catch their
+ /* Map overlay window before redirecting windows offscreen so we catch
+ * their
* contents until we show the stage.
*/
XMapWindow (xdisplay, compositor->output);
@@ -598,13 +621,14 @@ meta_compositor_unmanage (MetaCompositor *compositor)
*/
static void
meta_shape_cow_for_window (MetaCompositor *compositor,
- MetaWindow *window)
+ MetaWindow *window)
{
MetaDisplay *display = compositor->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
if (window == NULL)
- XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding, 0, 0, None);
+ XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding, 0,
+ 0, None);
else
{
XserverRegion output_region;
@@ -628,7 +652,8 @@ meta_shape_cow_for_window (MetaCompositor *compositor,
output_region = XFixesCreateRegion (xdisplay, &window_bounds, 1);
XFixesInvertRegion (xdisplay, output_region, &screen_rect, output_region);
- XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding, 0, 0, output_region);
+ XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding,
+ 0, 0, output_region);
XFixesDestroyRegion (xdisplay, output_region);
}
}
@@ -642,7 +667,9 @@ set_unredirected_window (MetaCompositor *compositor,
if (compositor->unredirected_window != NULL)
{
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (compositor->unredirected_window));
+ MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
+ compositor->
+ unredirected_window));
meta_window_actor_set_unredirected (window_actor, FALSE);
}
@@ -651,14 +678,16 @@ set_unredirected_window (MetaCompositor *compositor,
if (compositor->unredirected_window != NULL)
{
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (compositor->unredirected_window));
+ MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
+ compositor->
+ unredirected_window));
meta_window_actor_set_unredirected (window_actor, TRUE);
}
}
void
-meta_compositor_add_window (MetaCompositor *compositor,
- MetaWindow *window)
+meta_compositor_add_window (MetaCompositor *compositor,
+ MetaWindow *window)
{
MetaDisplay *display = compositor->display;
@@ -674,7 +703,8 @@ void
meta_compositor_remove_window (MetaCompositor *compositor,
MetaWindow *window)
{
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
+ MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
+ window));
if (compositor->unredirected_window == window)
set_unredirected_window (compositor, NULL);
@@ -686,7 +716,8 @@ void
meta_compositor_sync_updates_frozen (MetaCompositor *compositor,
MetaWindow *window)
{
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
+ MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
+ window));
meta_window_actor_sync_updates_frozen (window_actor);
}
@@ -695,7 +726,8 @@ meta_compositor_queue_frame_drawn (MetaCompositor *compositor,
MetaWindow *window,
gboolean no_delay_frame)
{
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
+ MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
+ window));
meta_window_actor_queue_frame_drawn (window_actor, no_delay_frame);
}
@@ -704,7 +736,8 @@ meta_compositor_window_shape_changed (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor;
- window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
+ window_actor =
+ META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
if (!window_actor)
return;
@@ -716,7 +749,8 @@ meta_compositor_window_opacity_changed (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor;
- window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
+ window_actor =
+ META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
if (!window_actor)
return;
@@ -728,7 +762,8 @@ meta_compositor_window_surface_changed (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor;
- window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
+ window_actor =
+ META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
if (!window_actor)
return;
@@ -750,9 +785,11 @@ meta_compositor_process_event (MetaCompositor *compositor,
MetaX11Display *x11_display = compositor->display->x11_display;
if (!meta_is_wayland_compositor () &&
- event->type == meta_x11_display_get_damage_event_base (x11_display) + XDamageNotify)
+ event->type ==
+ meta_x11_display_get_damage_event_base (x11_display) + XDamageNotify)
{
- /* Core code doesn't handle damage events, so we need to extract the MetaWindow
+ /* Core code doesn't handle damage events, so we need to extract the
+ * MetaWindow
* ourselves
*/
if (window == NULL)
@@ -769,13 +806,14 @@ meta_compositor_process_event (MetaCompositor *compositor,
meta_sync_ring_handle_event (event);
/* Clutter needs to know about MapNotify events otherwise it will
- think the stage is invisible */
+ * think the stage is invisible */
if (!meta_is_wayland_compositor () && event->type == MapNotify)
clutter_x11_handle_event (event);
/* The above handling is basically just "observing" the events, so we return
* FALSE to indicate that the event should not be filtered out; if we have
- * GTK+ windows in the same process, GTK+ needs the ConfigureNotify event, for example.
+ * GTK+ windows in the same process, GTK+ needs the ConfigureNotify event, for
+ *example.
*/
return FALSE;
}
@@ -784,16 +822,18 @@ gboolean
meta_compositor_filter_keybinding (MetaCompositor *compositor,
MetaKeyBinding *binding)
{
- return meta_plugin_manager_filter_keybinding (compositor->plugin_mgr, binding);
+ return meta_plugin_manager_filter_keybinding (compositor->plugin_mgr,
+ binding);
}
void
meta_compositor_show_window (MetaCompositor *compositor,
- MetaWindow *window,
+ MetaWindow *window,
MetaCompEffect effect)
{
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
- meta_window_actor_show (window_actor, effect);
+ MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
+ window));
+ meta_window_actor_show (window_actor, effect);
}
void
@@ -801,20 +841,23 @@ meta_compositor_hide_window (MetaCompositor *compositor,
MetaWindow *window,
MetaCompEffect effect)
{
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
+ MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
+ window));
meta_window_actor_hide (window_actor, effect);
meta_stack_tracker_queue_sync_stack (compositor->display->stack_tracker);
}
void
-meta_compositor_size_change_window (MetaCompositor *compositor,
- MetaWindow *window,
- MetaSizeChange which_change,
- MetaRectangle *old_frame_rect,
- MetaRectangle *old_buffer_rect)
+meta_compositor_size_change_window (MetaCompositor *compositor,
+ MetaWindow *window,
+ MetaSizeChange which_change,
+ MetaRectangle *old_frame_rect,
+ MetaRectangle *old_buffer_rect)
{
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
- meta_window_actor_size_change (window_actor, which_change, old_frame_rect, old_buffer_rect);
+ MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
+ window));
+ meta_window_actor_size_change (window_actor, which_change, old_frame_rect,
+ old_buffer_rect);
}
void
@@ -825,7 +868,7 @@ meta_compositor_switch_workspace (MetaCompositor *compositor,
{
gint to_indx, from_indx;
- to_indx = meta_workspace_index (to);
+ to_indx = meta_workspace_index (to);
from_indx = meta_workspace_index (from);
compositor->switch_workspace_in_progress++;
@@ -892,7 +935,8 @@ sync_actor_stacking (MetaCompositor *compositor)
{
has_windows = TRUE;
- if (expected_window_node != NULL && actor == expected_window_node->data)
+ if (expected_window_node != NULL &&
+ actor == expected_window_node->data)
expected_window_node = expected_window_node->next;
else
reordered = TRUE;
@@ -976,8 +1020,8 @@ on_top_window_actor_destroyed (MetaWindowActor *window_actor,
}
void
-meta_compositor_sync_stack (MetaCompositor *compositor,
- GList *stack)
+meta_compositor_sync_stack (MetaCompositor *compositor,
+ GList *stack)
{
GList *old_stack;
@@ -989,7 +1033,8 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
/* Sources: first window is the highest */
stack = g_list_copy (stack); /* The new stack of MetaWindow */
- old_stack = g_list_reverse (compositor->windows); /* The old stack of MetaWindowActor */
+ old_stack = g_list_reverse (compositor->windows); /* The old stack of
+ * MetaWindowActor */
compositor->windows = NULL;
while (TRUE)
@@ -1018,11 +1063,13 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
while (stack)
{
stack_window = stack->data;
- stack_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (stack_window));
+ stack_actor =
+ META_WINDOW_ACTOR (meta_window_get_compositor_private (stack_window));
if (!stack_actor)
{
meta_verbose ("Failed to find corresponding MetaWindowActor "
- "for window %s\n", meta_window_get_description (stack_window));
+ "for window %s\n",
+ meta_window_get_description (stack_window));
stack = g_list_delete_link (stack, stack);
}
else
@@ -1077,10 +1124,11 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
void
meta_compositor_sync_window_geometry (MetaCompositor *compositor,
- MetaWindow *window,
- gboolean did_placement)
+ MetaWindow *window,
+ gboolean did_placement)
{
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
+ MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
+ window));
meta_window_actor_sync_actor_geometry (window_actor, did_placement);
meta_plugin_manager_event_size_changed (compositor->plugin_mgr, window_actor);
}
@@ -1104,7 +1152,8 @@ on_presented (ClutterStage *stage,
* guaranteed to be in nanoseconds but with no specified base. The
* normal case with the open source GPU drivers on Linux 3.8 and
* newer is that the base of cogl_get_clock_time() is that of
- * clock_gettime(CLOCK_MONOTONIC), so the same as g_get_monotonic_time),
+ * clock_gettime(CLOCK_MONOTONIC), so the same as
+ *g_get_monotonic_time),
* but there's no exposure of that through the API. clock_gettime()
* is fairly fast, so calling it twice and subtracting to get a
* nearly-zero number is acceptable, if a litle ugly.
@@ -1113,7 +1162,8 @@ on_presented (ClutterStage *stage,
gint64 current_monotonic_time = g_get_monotonic_time ();
presentation_time =
- current_monotonic_time + (presentation_time_cogl - current_cogl_time) / 1000;
+ current_monotonic_time +
+ (presentation_time_cogl - current_cogl_time) / 1000;
}
else
{
@@ -1121,7 +1171,8 @@ on_presented (ClutterStage *stage,
}
for (l = compositor->windows; l; l = l->next)
- meta_window_actor_frame_complete (l->data, frame_info, presentation_time);
+ meta_window_actor_frame_complete (l->data, frame_info,
+ presentation_time);
}
}
@@ -1213,11 +1264,11 @@ meta_post_paint_func (gpointer data)
default:
/* The ARB_robustness spec says that, on error, the application
- should destroy the old context and create a new one. Since we
- don't have the necessary plumbing to do this we'll simply
- restart the process. Obviously we can't do this when we are
- a wayland compositor but in that case we shouldn't get here
- since we don't enable robustness in that case. */
+ * should destroy the old context and create a new one. Since we
+ * don't have the necessary plumbing to do this we'll simply
+ * restart the process. Obviously we can't do this when we are
+ * a wayland compositor but in that case we shouldn't get here
+ * since we don't enable robustness in that case. */
g_assert (!meta_is_wayland_compositor ());
meta_restart (NULL);
break;
@@ -1309,7 +1360,8 @@ meta_enable_unredirect_for_display (MetaDisplay *display)
{
MetaCompositor *compositor = get_compositor_for_display (display);
if (compositor->disable_unredirect_count == 0)
- g_warning ("Called enable_unredirect_for_display while unredirection is enabled.");
+ g_warning (
+ "Called enable_unredirect_for_display while unredirection is enabled.");
if (compositor->disable_unredirect_count > 0)
compositor->disable_unredirect_count--;
}
@@ -1422,10 +1474,13 @@ meta_compositor_monotonic_time_to_server_time (MetaDisplay *display,
if (compositor->server_time_query_time == 0 ||
(!compositor->server_time_is_monotonic_time &&
- monotonic_time > compositor->server_time_query_time + 10*1000*1000)) /* 10 seconds */
+ monotonic_time > compositor->server_time_query_time + 10 * 1000 * 1000)) /*
+ * 10
+ * seconds
+ * */
{
guint32 server_time = meta_display_get_current_time_roundtrip (display);
- gint64 server_time_usec = (gint64)server_time * 1000;
+ gint64 server_time_usec = (gint64) server_time * 1000;
gint64 current_monotonic_time = g_get_monotonic_time ();
compositor->server_time_query_time = current_monotonic_time;
@@ -1435,11 +1490,12 @@ meta_compositor_monotonic_time_to_server_time (MetaDisplay *display,
* is under load and our processing of the server response is
* delayed.
*/
- if (server_time_usec > current_monotonic_time - 1000*1000 &&
- server_time_usec < current_monotonic_time + 1000*1000)
+ if (server_time_usec > current_monotonic_time - 1000 * 1000 &&
+ server_time_usec < current_monotonic_time + 1000 * 1000)
compositor->server_time_is_monotonic_time = TRUE;
- compositor->server_time_offset = server_time_usec - current_monotonic_time;
+ compositor->server_time_offset = server_time_usec -
+ current_monotonic_time;
}
if (compositor->server_time_is_monotonic_time)
@@ -1455,7 +1511,8 @@ meta_compositor_show_tile_preview (MetaCompositor *compositor,
int tile_monitor_number)
{
meta_plugin_manager_show_tile_preview (compositor->plugin_mgr,
- window, tile_rect, tile_monitor_number);
+ window, tile_rect,
+ tile_monitor_number);
}
void
@@ -1465,22 +1522,24 @@ meta_compositor_hide_tile_preview (MetaCompositor *compositor)
}
void
-meta_compositor_show_window_menu (MetaCompositor *compositor,
- MetaWindow *window,
- MetaWindowMenuType menu,
- int x,
- int y)
+meta_compositor_show_window_menu (MetaCompositor *compositor,
+ MetaWindow *window,
+ MetaWindowMenuType menu,
+ int x,
+ int y)
{
- meta_plugin_manager_show_window_menu (compositor->plugin_mgr, window, menu, x, y);
+ meta_plugin_manager_show_window_menu (compositor->plugin_mgr, window, menu, x,
+ y);
}
void
-meta_compositor_show_window_menu_for_rect (MetaCompositor *compositor,
- MetaWindow *window,
- MetaWindowMenuType menu,
- MetaRectangle *rect)
+meta_compositor_show_window_menu_for_rect (MetaCompositor *compositor,
+ MetaWindow *window,
+ MetaWindowMenuType menu,
+ MetaRectangle *rect)
{
- meta_plugin_manager_show_window_menu_for_rect (compositor->plugin_mgr, window, menu, rect);
+ meta_plugin_manager_show_window_menu_for_rect (compositor->plugin_mgr, window,
+ menu, rect);
}
MetaCloseDialog *
@@ -1495,6 +1554,7 @@ MetaInhibitShortcutsDialog *
meta_compositor_create_inhibit_shortcuts_dialog (MetaCompositor *compositor,
MetaWindow *window)
{
- return meta_plugin_manager_create_inhibit_shortcuts_dialog (compositor->plugin_mgr,
- window);
+ return meta_plugin_manager_create_inhibit_shortcuts_dialog (
+ compositor->plugin_mgr,
+ window);
}
diff --git a/src/compositor/meta-background-actor.c b/src/compositor/meta-background-actor.c
index 2b619eb27..50dd7d6d3 100644
--- a/src/compositor/meta-background-actor.c
+++ b/src/compositor/meta-background-actor.c
@@ -97,7 +97,8 @@ enum
PROP_VIGNETTE_BRIGHTNESS
};
-typedef enum {
+typedef enum
+{
CHANGED_BACKGROUND = 1 << 0,
CHANGED_EFFECTS = 1 << 2,
CHANGED_VIGNETTE_PARAMETERS = 1 << 3,
@@ -106,44 +107,45 @@ typedef enum {
} ChangedFlags;
#define GRADIENT_VERTEX_SHADER_DECLARATIONS \
-"uniform vec2 scale;\n" \
-"varying vec2 position;\n" \
+ "uniform vec2 scale;\n" \
+ "varying vec2 position;\n" \
#define GRADIENT_VERTEX_SHADER_CODE \
-"position = cogl_tex_coord0_in.xy * scale;\n" \
+ "position = cogl_tex_coord0_in.xy * scale;\n" \
#define GRADIENT_FRAGMENT_SHADER_DECLARATIONS \
-"uniform float gradient_height_perc;\n" \
-"uniform float gradient_max_darkness;\n" \
-"varying vec2 position;\n" \
+ "uniform float gradient_height_perc;\n" \
+ "uniform float gradient_max_darkness;\n" \
+ "varying vec2 position;\n" \
#define GRADIENT_FRAGMENT_SHADER_CODE \
-"float min_brightness = 1.0 - gradient_max_darkness;\n" \
-"float gradient_y_pos = min(position.y, gradient_height_perc) / gradient_height_perc;\n" \
-"float pixel_brightness = (1.0 - min_brightness) * gradient_y_pos + min_brightness;\n" \
-"cogl_color_out.rgb = cogl_color_out.rgb * pixel_brightness;\n" \
+ "float min_brightness = 1.0 - gradient_max_darkness;\n" \
+ "float gradient_y_pos = min(position.y, gradient_height_perc) / gradient_height_perc;\n" \
+ "float pixel_brightness = (1.0 - min_brightness) * gradient_y_pos + min_brightness;\n" \
+ "cogl_color_out.rgb = cogl_color_out.rgb * pixel_brightness;\n" \
#define VIGNETTE_VERTEX_SHADER_DECLARATIONS \
-"uniform vec2 scale;\n" \
-"uniform vec2 offset;\n" \
-"varying vec2 position;\n" \
+ "uniform vec2 scale;\n" \
+ "uniform vec2 offset;\n" \
+ "varying vec2 position;\n" \
#define VIGNETTE_VERTEX_SHADER_CODE \
-"position = cogl_tex_coord0_in.xy * scale + offset;\n" \
+ "position = cogl_tex_coord0_in.xy * scale + offset;\n" \
#define VIGNETTE_FRAGMENT_SHADER_DECLARATIONS \
-"uniform float vignette_sharpness;\n" \
-"varying vec2 position;\n" \
+ "uniform float vignette_sharpness;\n" \
+ "varying vec2 position;\n" \
#define VIGNETTE_FRAGMENT_SHADER_CODE \
-"float t = 2.0 * length(position);\n" \
-"t = min(t, 1.0);\n" \
-"float pixel_brightness = 1.0 - t * vignette_sharpness;\n" \
-"cogl_color_out.rgb = cogl_color_out.rgb * pixel_brightness;\n" \
+ "float t = 2.0 * length(position);\n" \
+ "t = min(t, 1.0);\n" \
+ "float pixel_brightness = 1.0 - t * vignette_sharpness;\n" \
+ "cogl_color_out.rgb = cogl_color_out.rgb * pixel_brightness;\n" \
typedef struct _MetaBackgroundLayer MetaBackgroundLayer;
-typedef enum {
+typedef enum
+{
PIPELINE_VIGNETTE = (1 << 0),
PIPELINE_BLEND = (1 << 1),
PIPELINE_GRADIENT = (1 << 2),
@@ -175,9 +177,11 @@ struct _MetaBackgroundActorPrivate
static void cullable_iface_init (MetaCullableInterface *iface);
-G_DEFINE_TYPE_WITH_CODE (MetaBackgroundActor, meta_background_actor, CLUTTER_TYPE_ACTOR,
+G_DEFINE_TYPE_WITH_CODE (MetaBackgroundActor, meta_background_actor,
+ CLUTTER_TYPE_ACTOR,
G_ADD_PRIVATE (MetaBackgroundActor)
- G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
+ G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE,
+ cullable_iface_init));
static void
set_clip_region (MetaBackgroundActor *self,
@@ -280,16 +284,18 @@ make_pipeline (PipelineFlags pipeline_flags)
static CoglSnippet *vignette_fragment_snippet;
if (!vignette_vertex_snippet)
- vignette_vertex_snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX,
- VIGNETTE_VERTEX_SHADER_DECLARATIONS,
- VIGNETTE_VERTEX_SHADER_CODE);
+ vignette_vertex_snippet = cogl_snippet_new (
+ COGL_SNIPPET_HOOK_VERTEX,
+ VIGNETTE_VERTEX_SHADER_DECLARATIONS,
+ VIGNETTE_VERTEX_SHADER_CODE);
cogl_pipeline_add_snippet (*templatep, vignette_vertex_snippet);
if (!vignette_fragment_snippet)
- vignette_fragment_snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
- VIGNETTE_FRAGMENT_SHADER_DECLARATIONS,
- VIGNETTE_FRAGMENT_SHADER_CODE);
+ vignette_fragment_snippet = cogl_snippet_new (
+ COGL_SNIPPET_HOOK_FRAGMENT,
+ VIGNETTE_FRAGMENT_SHADER_DECLARATIONS,
+ VIGNETTE_FRAGMENT_SHADER_CODE);
cogl_pipeline_add_snippet (*templatep, vignette_fragment_snippet);
}
@@ -300,16 +306,18 @@ make_pipeline (PipelineFlags pipeline_flags)
static CoglSnippet *gradient_fragment_snippet;
if (!gradient_vertex_snippet)
- gradient_vertex_snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX,
- GRADIENT_VERTEX_SHADER_DECLARATIONS,
- GRADIENT_VERTEX_SHADER_CODE);
+ gradient_vertex_snippet = cogl_snippet_new (
+ COGL_SNIPPET_HOOK_VERTEX,
+ GRADIENT_VERTEX_SHADER_DECLARATIONS,
+ GRADIENT_VERTEX_SHADER_CODE);
cogl_pipeline_add_snippet (*templatep, gradient_vertex_snippet);
if (!gradient_fragment_snippet)
- gradient_fragment_snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
- GRADIENT_FRAGMENT_SHADER_DECLARATIONS,
- GRADIENT_FRAGMENT_SHADER_CODE);
+ gradient_fragment_snippet = cogl_snippet_new (
+ COGL_SNIPPET_HOOK_FRAGMENT,
+ GRADIENT_FRAGMENT_SHADER_DECLARATIONS,
+ GRADIENT_FRAGMENT_SHADER_CODE);
cogl_pipeline_add_snippet (*templatep, gradient_fragment_snippet);
}
@@ -334,9 +342,11 @@ setup_pipeline (MetaBackgroundActor *self,
opacity = clutter_actor_get_paint_opacity (CLUTTER_ACTOR (self));
if (opacity < 255)
pipeline_flags |= PIPELINE_BLEND;
- if (priv->vignette && clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
+ if (priv->vignette &&
+ clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
pipeline_flags |= PIPELINE_VIGNETTE;
- if (priv->gradient && clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
+ if (priv->gradient &&
+ clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
pipeline_flags |= PIPELINE_GRADIENT;
if (priv->pipeline &&
@@ -361,8 +371,10 @@ setup_pipeline (MetaBackgroundActor *self,
&priv->texture_area,
&wrap_mode);
priv->force_bilinear = texture &&
- (priv->texture_area.width != (int)cogl_texture_get_width (texture) ||
- priv->texture_area.height != (int)cogl_texture_get_height (texture));
+ (priv->texture_area.width !=
+ (int) cogl_texture_get_width (texture) ||
+ priv->texture_area.height !=
+ (int) cogl_texture_get_height (texture));
cogl_pipeline_set_layer_texture (priv->pipeline, 0, texture);
cogl_pipeline_set_layer_wrap_mode (priv->pipeline, 0, wrap_mode);
@@ -373,7 +385,8 @@ setup_pipeline (MetaBackgroundActor *self,
if ((priv->changed & CHANGED_VIGNETTE_PARAMETERS) != 0)
{
cogl_pipeline_set_uniform_1f (priv->pipeline,
- cogl_pipeline_get_uniform_location (priv->pipeline,
+ cogl_pipeline_get_uniform_location (priv->
+ pipeline,
"vignette_sharpness"),
priv->vignette_sharpness);
@@ -387,13 +400,17 @@ setup_pipeline (MetaBackgroundActor *self,
meta_display_get_monitor_geometry (priv->display,
priv->monitor, &monitor_geometry);
- gradient_height_perc = MAX (0.0001, priv->gradient_height / (float)monitor_geometry.height);
+ gradient_height_perc = MAX (0.0001,
+ priv->gradient_height /
+ (float) monitor_geometry.height);
cogl_pipeline_set_uniform_1f (priv->pipeline,
- cogl_pipeline_get_uniform_location (priv->pipeline,
+ cogl_pipeline_get_uniform_location (priv->
+ pipeline,
"gradient_height_perc"),
gradient_height_perc);
cogl_pipeline_set_uniform_1f (priv->pipeline,
- cogl_pipeline_get_uniform_location (priv->pipeline,
+ cogl_pipeline_get_uniform_location (priv->
+ pipeline,
"gradient_max_darkness"),
priv->gradient_max_darkness);
@@ -423,7 +440,8 @@ setup_pipeline (MetaBackgroundActor *self,
opacity / 255.);
if (!priv->force_bilinear &&
- meta_actor_painting_untransformed (actor_pixel_rect->width, actor_pixel_rect->height, NULL, NULL))
+ meta_actor_painting_untransformed (actor_pixel_rect->width,
+ actor_pixel_rect->height, NULL, NULL))
filter = COGL_PIPELINE_FILTER_NEAREST;
else
filter = COGL_PIPELINE_FILTER_LINEAR;
@@ -442,18 +460,20 @@ set_glsl_parameters (MetaBackgroundActor *self,
/* Compute a scale and offset for transforming texture coordinates to the
* coordinate system from [-0.5 to 0.5] across the area of the actor
*/
- scale[0] = priv->texture_area.width / (float)actor_pixel_rect->width;
- scale[1] = priv->texture_area.height / (float)actor_pixel_rect->height;
- offset[0] = priv->texture_area.x / (float)actor_pixel_rect->width - 0.5;
- offset[1] = priv->texture_area.y / (float)actor_pixel_rect->height - 0.5;
+ scale[0] = priv->texture_area.width / (float) actor_pixel_rect->width;
+ scale[1] = priv->texture_area.height / (float) actor_pixel_rect->height;
+ offset[0] = priv->texture_area.x / (float) actor_pixel_rect->width - 0.5;
+ offset[1] = priv->texture_area.y / (float) actor_pixel_rect->height - 0.5;
cogl_pipeline_set_uniform_float (priv->pipeline,
- cogl_pipeline_get_uniform_location (priv->pipeline,
+ cogl_pipeline_get_uniform_location (priv->
+ pipeline,
"scale"),
2, 1, scale);
cogl_pipeline_set_uniform_float (priv->pipeline,
- cogl_pipeline_get_uniform_location (priv->pipeline,
+ cogl_pipeline_get_uniform_location (priv->
+ pipeline,
"offset"),
2, 1, offset);
}
@@ -524,22 +544,24 @@ meta_background_actor_paint (ClutterActor *actor)
int n_rects = cairo_region_num_rectangles (priv->clip_region);
if (n_rects <= MAX_RECTS)
{
- for (i = 0; i < n_rects; i++)
- {
- cairo_rectangle_int_t rect;
- cairo_region_get_rectangle (priv->clip_region, i, &rect);
+ for (i = 0; i < n_rects; i++)
+ {
+ cairo_rectangle_int_t rect;
+ cairo_region_get_rectangle (priv->clip_region, i, &rect);
- if (!gdk_rectangle_intersect (&actor_pixel_rect, &rect, &rect))
- continue;
+ if (!gdk_rectangle_intersect (&actor_pixel_rect, &rect, &rect))
+ continue;
- paint_clipped_rectangle (fb, priv->pipeline, &rect, &priv->texture_area);
- }
+ paint_clipped_rectangle (fb, priv->pipeline, &rect,
+ &priv->texture_area);
+ }
- return;
+ return;
}
}
- paint_clipped_rectangle (fb, priv->pipeline, &actor_pixel_rect, &priv->texture_area);
+ paint_clipped_rectangle (fb, priv->pipeline, &actor_pixel_rect,
+ &priv->texture_area);
}
static void
@@ -605,10 +627,10 @@ meta_background_actor_set_property (GObject *object,
}
static void
-meta_background_actor_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+meta_background_actor_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
MetaBackgroundActorPrivate *priv = META_BACKGROUND_ACTOR (object)->priv;
@@ -659,7 +681,8 @@ meta_background_actor_class_init (MetaBackgroundActorClass *klass)
object_class->get_property = meta_background_actor_get_property;
actor_class->get_preferred_width = meta_background_actor_get_preferred_width;
- actor_class->get_preferred_height = meta_background_actor_get_preferred_height;
+ actor_class->get_preferred_height =
+ meta_background_actor_get_preferred_height;
actor_class->get_paint_volume = meta_background_actor_get_paint_volume;
actor_class->paint = meta_background_actor_paint;
@@ -716,8 +739,8 @@ meta_background_actor_class_init (MetaBackgroundActorClass *klass)
param_spec = g_param_spec_double ("gradient-max-darkness",
"Gradient Max Darkness",
"How dark is the gradient initially",
- 0.0, 1.0, 0.0,
- G_PARAM_READWRITE);
+ 0.0, 1.0, 0.0,
+ G_PARAM_READWRITE);
g_object_class_install_property (object_class,
PROP_GRADIENT_MAX_DARKNESS,
@@ -866,7 +889,7 @@ meta_background_actor_set_background (MetaBackgroundActor *self,
if (priv->background)
{
g_signal_handlers_disconnect_by_func (priv->background,
- (gpointer)on_background_changed,
+ (gpointer) on_background_changed,
self);
g_object_unref (priv->background);
priv->background = NULL;
@@ -907,7 +930,8 @@ meta_background_actor_set_gradient (MetaBackgroundActor *self,
changed = TRUE;
}
- if (height != priv->gradient_height || max_darkness != priv->gradient_max_darkness)
+ if (height != priv->gradient_height ||
+ max_darkness != priv->gradient_max_darkness)
{
priv->gradient_height = height;
priv->gradient_max_darkness = max_darkness;
@@ -929,12 +953,13 @@ meta_background_actor_set_monitor (MetaBackgroundActor *self,
MetaDisplay *display = priv->display;
if(priv->monitor == monitor)
- return;
+ return;
- meta_display_get_monitor_geometry (display, priv->monitor, &old_monitor_geometry);
+ meta_display_get_monitor_geometry (display, priv->monitor,
+ &old_monitor_geometry);
meta_display_get_monitor_geometry (display, monitor, &new_monitor_geometry);
if(old_monitor_geometry.height != new_monitor_geometry.height)
- invalidate_pipeline (self, CHANGED_GRADIENT_PARAMETERS);
+ invalidate_pipeline (self, CHANGED_GRADIENT_PARAMETERS);
priv->monitor = monitor;
}
@@ -963,7 +988,8 @@ meta_background_actor_set_vignette (MetaBackgroundActor *self,
changed = TRUE;
}
- if (brightness != priv->vignette_brightness || sharpness != priv->vignette_sharpness)
+ if (brightness != priv->vignette_brightness ||
+ sharpness != priv->vignette_sharpness)
{
priv->vignette_brightness = brightness;
priv->vignette_sharpness = sharpness;
diff --git a/src/compositor/meta-background-group.c b/src/compositor/meta-background-group.c
index e30b8af4c..c730bf4fe 100644
--- a/src/compositor/meta-background-group.c
+++ b/src/compositor/meta-background-group.c
@@ -21,8 +21,10 @@
static void cullable_iface_init (MetaCullableInterface *iface);
-G_DEFINE_TYPE_WITH_CODE (MetaBackgroundGroup, meta_background_group, CLUTTER_TYPE_ACTOR,
- G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
+G_DEFINE_TYPE_WITH_CODE (MetaBackgroundGroup, meta_background_group,
+ CLUTTER_TYPE_ACTOR,
+ G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE,
+ cullable_iface_init));
static void
meta_background_group_class_init (MetaBackgroundGroupClass *klass)
diff --git a/src/compositor/meta-background-image.c b/src/compositor/meta-background-image.c
index 802c10c76..371888384 100644
--- a/src/compositor/meta-background-image.c
+++ b/src/compositor/meta-background-image.c
@@ -19,7 +19,8 @@
/**
* SECTION:meta-background-image
* @title: MetaBackgroundImage
- * @short_description: objects holding images loaded from files, used for backgrounds
+ * @short_description: objects holding images loaded from files, used for
+ *backgrounds
*/
#include "config.h"
@@ -67,7 +68,8 @@ struct _MetaBackgroundImageClass
GObjectClass parent_class;
};
-G_DEFINE_TYPE (MetaBackgroundImageCache, meta_background_image_cache, G_TYPE_OBJECT);
+G_DEFINE_TYPE (MetaBackgroundImageCache, meta_background_image_cache,
+ G_TYPE_OBJECT);
static void
meta_background_image_cache_init (MetaBackgroundImageCache *cache)
@@ -193,7 +195,8 @@ file_loaded (GObject *source_object,
META_TEXTURE_ALLOW_SLICING);
if (!cogl_texture_set_data (texture,
- has_alpha ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888,
+ has_alpha ? COGL_PIXEL_FORMAT_RGBA_8888 :
+ COGL_PIXEL_FORMAT_RGB_888,
row_stride,
pixels, 0,
&catch_error))
@@ -226,7 +229,8 @@ out:
* signal will be emitted exactly once. The 'loaded' state means that the
* loading process finished, whether it succeeded or failed.
*
- * Return value: (transfer full): a #MetaBackgroundImage to dereference to get the loaded texture
+ * Return value: (transfer full): a #MetaBackgroundImage to dereference to get
+ *the loaded texture
*/
MetaBackgroundImage *
meta_background_image_cache_load (MetaBackgroundImageCache *cache,
diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c
index 0fb20d569..83d10c050 100644
--- a/src/compositor/meta-background.c
+++ b/src/compositor/meta-background.c
@@ -53,10 +53,10 @@ struct _MetaBackgroundPrivate
MetaBackgroundMonitor *monitors;
int n_monitors;
- GDesktopBackgroundStyle style;
+ GDesktopBackgroundStyle style;
GDesktopBackgroundShading shading_direction;
- ClutterColor color;
- ClutterColor second_color;
+ ClutterColor color;
+ ClutterColor second_color;
GFile *file1;
MetaBackgroundImage *background_image1;
@@ -189,10 +189,10 @@ meta_background_set_property (GObject *object,
}
static void
-meta_background_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+meta_background_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
MetaBackgroundPrivate *priv = META_BACKGROUND (object)->priv;
@@ -211,8 +211,12 @@ static gboolean
need_prerender (MetaBackground *self)
{
MetaBackgroundPrivate *priv = self->priv;
- CoglTexture *texture1 = priv->background_image1 ? meta_background_image_get_texture (priv->background_image1) : NULL;
- CoglTexture *texture2 = priv->background_image2 ? meta_background_image_get_texture (priv->background_image2) : NULL;
+ CoglTexture *texture1 =
+ priv->background_image1 ? meta_background_image_get_texture (
+ priv->background_image1) : NULL;
+ CoglTexture *texture2 =
+ priv->background_image2 ? meta_background_image_get_texture (
+ priv->background_image2) : NULL;
if (texture1 == NULL && texture2 == NULL)
return FALSE;
@@ -271,7 +275,7 @@ set_file (MetaBackground *self,
if (*imagep)
{
g_signal_handlers_disconnect_by_func (*imagep,
- (gpointer)on_background_loaded,
+ (gpointer) on_background_loaded,
self);
g_object_unref (*imagep);
*imagep = NULL;
@@ -279,7 +283,8 @@ set_file (MetaBackground *self,
if (file)
{
- MetaBackgroundImageCache *cache = meta_background_image_cache_get_default ();
+ MetaBackgroundImageCache *cache =
+ meta_background_image_cache_get_default ();
*filep = g_object_ref (file);
*imagep = meta_background_image_cache_load (cache, file);
@@ -292,7 +297,7 @@ set_file (MetaBackground *self,
static void
meta_background_dispose (GObject *object)
{
- MetaBackground *self = META_BACKGROUND (object);
+ MetaBackground *self = META_BACKGROUND (object);
MetaBackgroundPrivate *priv = self->priv;
free_color_texture (self);
@@ -317,14 +322,15 @@ meta_background_finalize (GObject *object)
static void
meta_background_constructed (GObject *object)
{
- MetaBackground *self = META_BACKGROUND (object);
+ MetaBackground *self = META_BACKGROUND (object);
MetaBackgroundPrivate *priv = self->priv;
MetaMonitorManager *monitor_manager = meta_monitor_manager_get ();
G_OBJECT_CLASS (meta_background_parent_class)->constructed (object);
g_signal_connect_object (priv->display, "gl-video-memory-purged",
- G_CALLBACK (mark_changed), object, G_CONNECT_SWAPPED);
+ G_CALLBACK (mark_changed), object,
+ G_CONNECT_SWAPPED);
g_signal_connect_object (monitor_manager, "monitors-changed",
G_CALLBACK (on_monitors_changed), self,
@@ -360,7 +366,6 @@ meta_background_class_init (MetaBackgroundClass *klass)
g_object_class_install_property (object_class,
PROP_META_DISPLAY,
param_spec);
-
}
static void
@@ -383,10 +388,10 @@ set_texture_area_from_monitor_area (cairo_rectangle_int_t *monitor_area,
}
static void
-get_texture_area (MetaBackground *self,
- cairo_rectangle_int_t *monitor_rect,
- CoglTexture *texture,
- cairo_rectangle_int_t *texture_area)
+get_texture_area (MetaBackground *self,
+ cairo_rectangle_int_t *monitor_rect,
+ CoglTexture *texture,
+ cairo_rectangle_int_t *texture_area)
{
MetaBackgroundPrivate *priv = self->priv;
cairo_rectangle_int_t image_area;
@@ -472,23 +477,23 @@ get_texture_area (MetaBackground *self,
break;
case G_DESKTOP_BACKGROUND_STYLE_SPANNED:
- {
- /* paint region is the union of all monitors, with the origin
- * of the region set to align with monitor associated with the background.
- */
- meta_display_get_size (priv->display, &screen_width, &screen_height);
-
- /* unclipped texture area is whole screen */
- image_area.width = screen_width;
- image_area.height = screen_height;
-
- /* But make (0,0) line up with the appropriate monitor */
- image_area.x = -monitor_rect->x;
- image_area.y = -monitor_rect->y;
-
- *texture_area = image_area;
- break;
- }
+ {
+ /* paint region is the union of all monitors, with the origin
+ * of the region set to align with monitor associated with the background.
+ */
+ meta_display_get_size (priv->display, &screen_width, &screen_height);
+
+ /* unclipped texture area is whole screen */
+ image_area.width = screen_width;
+ image_area.height = screen_height;
+
+ /* But make (0,0) line up with the appropriate monitor */
+ image_area.x = -monitor_rect->x;
+ image_area.y = -monitor_rect->y;
+
+ *texture_area = image_area;
+ break;
+ }
}
}
@@ -518,10 +523,13 @@ draw_texture (MetaBackground *self,
0,
monitor_area->width,
monitor_area->height,
- - texture_area.x / (float)texture_area.width,
- - texture_area.y / (float)texture_area.height,
- (monitor_area->width - texture_area.x) / (float)texture_area.width,
- (monitor_area->height - texture_area.y) / (float)texture_area.height);
+ -texture_area.x / (float) texture_area.width,
+ -texture_area.y / (float) texture_area.height,
+ (monitor_area->width -
+ texture_area.x) / (float) texture_area.width,
+ (monitor_area->height -
+ texture_area.y) /
+ (float) texture_area.height);
bare_region_visible = texture_has_alpha (texture);
@@ -535,13 +543,14 @@ draw_texture (MetaBackground *self,
texture_area.x + texture_area.width,
texture_area.y + texture_area.height,
0, 0, 1.0, 1.0);
- bare_region_visible = texture_has_alpha (texture) || memcmp (&texture_area, monitor_area, sizeof (cairo_rectangle_int_t)) != 0;
+ bare_region_visible = texture_has_alpha (texture) || memcmp (
+ &texture_area, monitor_area, sizeof (cairo_rectangle_int_t)) != 0;
break;
case G_DESKTOP_BACKGROUND_STYLE_NONE:
bare_region_visible = TRUE;
break;
default:
- g_return_val_if_reached(FALSE);
+ g_return_val_if_reached (FALSE);
}
return bare_region_visible;
@@ -593,21 +602,25 @@ ensure_color_texture (MetaBackground *self)
pixels[5] = priv->second_color.blue;
}
- priv->color_texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width, height,
- COGL_PIXEL_FORMAT_RGB_888,
- width * 3,
- pixels,
- &error));
+ priv->color_texture =
+ COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width, height,
+ COGL_PIXEL_FORMAT_RGB_888,
+ width *
+ 3,
+ pixels,
+ &error));
if (error != NULL)
{
- meta_warning ("Failed to allocate color texture: %s\n", error->message);
+ meta_warning ("Failed to allocate color texture: %s\n",
+ error->message);
cogl_error_free (error);
}
}
}
-typedef enum {
+typedef enum
+{
PIPELINE_REPLACE,
PIPELINE_ADD,
PIPELINE_OVER_REVERSE,
@@ -616,10 +629,12 @@ typedef enum {
static CoglPipeline *
create_pipeline (PipelineType type)
{
- const char * const blend_strings[3] = {
+ const char * const blend_strings[3] =
+ {
[PIPELINE_REPLACE] = "RGBA = ADD (SRC_COLOR, 0)",
[PIPELINE_ADD] = "RGBA = ADD (SRC_COLOR, DST_COLOR)",
- [PIPELINE_OVER_REVERSE] = "RGBA = ADD (SRC_COLOR * (1 - DST_COLOR[A]), DST_COLOR)",
+ [PIPELINE_OVER_REVERSE] =
+ "RGBA = ADD (SRC_COLOR * (1 - DST_COLOR[A]), DST_COLOR)",
};
static CoglPipeline *templates[3];
@@ -675,7 +690,8 @@ ensure_wallpaper_texture (MetaBackground *self,
if (!cogl_framebuffer_allocate (fbo, &catch_error))
{
- /* This probably means that the size of the wallpapered texture is larger
+ /* This probably means that the size of the wallpapered texture is
+ * larger
* than the maximum texture size; we treat it as permanent until the
* background is changed again.
*/
@@ -694,7 +710,8 @@ ensure_wallpaper_texture (MetaBackground *self,
pipeline = create_pipeline (PIPELINE_REPLACE);
cogl_pipeline_set_layer_texture (pipeline, 0, texture);
- cogl_framebuffer_draw_textured_rectangle (fbo, pipeline, 0, 0, width, height,
+ cogl_framebuffer_draw_textured_rectangle (fbo, pipeline, 0, 0, width,
+ height,
0., 0., 1., 1.);
cogl_object_unref (pipeline);
@@ -719,24 +736,24 @@ get_wrap_mode (GDesktopBackgroundStyle style)
{
switch (style)
{
- case G_DESKTOP_BACKGROUND_STYLE_WALLPAPER:
- return COGL_PIPELINE_WRAP_MODE_REPEAT;
- case G_DESKTOP_BACKGROUND_STYLE_NONE:
- case G_DESKTOP_BACKGROUND_STYLE_STRETCHED:
- case G_DESKTOP_BACKGROUND_STYLE_CENTERED:
- case G_DESKTOP_BACKGROUND_STYLE_SCALED:
- case G_DESKTOP_BACKGROUND_STYLE_ZOOM:
- case G_DESKTOP_BACKGROUND_STYLE_SPANNED:
- default:
- return COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE;
+ case G_DESKTOP_BACKGROUND_STYLE_WALLPAPER:
+ return COGL_PIPELINE_WRAP_MODE_REPEAT;
+ case G_DESKTOP_BACKGROUND_STYLE_NONE:
+ case G_DESKTOP_BACKGROUND_STYLE_STRETCHED:
+ case G_DESKTOP_BACKGROUND_STYLE_CENTERED:
+ case G_DESKTOP_BACKGROUND_STYLE_SCALED:
+ case G_DESKTOP_BACKGROUND_STYLE_ZOOM:
+ case G_DESKTOP_BACKGROUND_STYLE_SPANNED:
+ default:
+ return COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE;
}
}
CoglTexture *
-meta_background_get_texture (MetaBackground *self,
- int monitor_index,
- cairo_rectangle_int_t *texture_area,
- CoglPipelineWrapMode *wrap_mode)
+meta_background_get_texture (MetaBackground *self,
+ int monitor_index,
+ cairo_rectangle_int_t *texture_area,
+ CoglPipelineWrapMode *wrap_mode)
{
MetaBackgroundPrivate *priv;
MetaBackgroundMonitor *monitor;
@@ -746,7 +763,8 @@ meta_background_get_texture (MetaBackground *self,
g_return_val_if_fail (META_IS_BACKGROUND (self), NULL);
priv = self->priv;
- g_return_val_if_fail (monitor_index >= 0 && monitor_index < priv->n_monitors, NULL);
+ g_return_val_if_fail (monitor_index >= 0 && monitor_index < priv->n_monitors,
+ NULL);
monitor = &priv->monitors[monitor_index];
@@ -756,8 +774,10 @@ meta_background_get_texture (MetaBackground *self,
monitor_area.width = geometry.width;
monitor_area.height = geometry.height;
- texture1 = priv->background_image1 ? meta_background_image_get_texture (priv->background_image1) : NULL;
- texture2 = priv->background_image2 ? meta_background_image_get_texture (priv->background_image2) : NULL;
+ texture1 = priv->background_image1 ? meta_background_image_get_texture (
+ priv->background_image1) : NULL;
+ texture2 = priv->background_image2 ? meta_background_image_get_texture (
+ priv->background_image2) : NULL;
if (texture1 == NULL && texture2 == NULL)
{
@@ -790,7 +810,8 @@ meta_background_get_texture (MetaBackground *self,
{
CoglOffscreen *offscreen;
- monitor->texture = meta_create_texture (monitor_area.width, monitor_area.height,
+ monitor->texture = meta_create_texture (monitor_area.width,
+ monitor_area.height,
COGL_TEXTURE_COMPONENTS_RGBA,
META_TEXTURE_FLAGS_NONE);
offscreen = cogl_offscreen_new_with_texture (monitor->texture);
@@ -799,7 +820,8 @@ meta_background_get_texture (MetaBackground *self,
if (!cogl_framebuffer_allocate (monitor->fbo, &catch_error))
{
- /* Texture or framebuffer allocation failed; it's unclear why this happened;
+ /* Texture or framebuffer allocation failed; it's unclear why this
+ * happened;
* we'll try again the next time this is called. (MetaBackgroundActor
* caches the result, so user might be left without a background.)
*/
@@ -813,15 +835,18 @@ meta_background_get_texture (MetaBackground *self,
}
cogl_framebuffer_orthographic (monitor->fbo, 0, 0,
- monitor_area.width, monitor_area.height, -1., 1.);
+ monitor_area.width, monitor_area.height,
+ -1., 1.);
if (texture2 != NULL && priv->blend_factor != 0.0)
{
CoglPipeline *pipeline = create_pipeline (PIPELINE_REPLACE);
cogl_pipeline_set_color4f (pipeline,
- priv->blend_factor, priv->blend_factor, priv->blend_factor, priv->blend_factor);
+ priv->blend_factor, priv->blend_factor,
+ priv->blend_factor, priv->blend_factor);
cogl_pipeline_set_layer_texture (pipeline, 0, texture2);
- cogl_pipeline_set_layer_wrap_mode (pipeline, 0, get_wrap_mode (priv->style));
+ cogl_pipeline_set_layer_wrap_mode (pipeline, 0,
+ get_wrap_mode (priv->style));
bare_region_visible = draw_texture (self,
monitor->fbo, pipeline,
@@ -843,13 +868,15 @@ meta_background_get_texture (MetaBackground *self,
(1 - priv->blend_factor),
(1 - priv->blend_factor),
(1 - priv->blend_factor),
- (1 - priv->blend_factor));;
+ (1 - priv->blend_factor));
cogl_pipeline_set_layer_texture (pipeline, 0, texture1);
- cogl_pipeline_set_layer_wrap_mode (pipeline, 0, get_wrap_mode (priv->style));
+ cogl_pipeline_set_layer_wrap_mode (pipeline, 0,
+ get_wrap_mode (priv->style));
bare_region_visible = bare_region_visible || draw_texture (self,
monitor->fbo, pipeline,
- texture1, &monitor_area);
+ texture1,
+ &monitor_area);
cogl_object_unref (pipeline);
}
@@ -863,7 +890,8 @@ meta_background_get_texture (MetaBackground *self,
cogl_framebuffer_draw_rectangle (monitor->fbo,
pipeline,
0, 0,
- monitor_area.width, monitor_area.height);
+ monitor_area.width,
+ monitor_area.height);
cogl_object_unref (pipeline);
}
@@ -901,10 +929,10 @@ meta_background_set_color (MetaBackground *self,
}
void
-meta_background_set_gradient (MetaBackground *self,
- GDesktopBackgroundShading shading_direction,
- ClutterColor *color,
- ClutterColor *second_color)
+meta_background_set_gradient (MetaBackground *self,
+ GDesktopBackgroundShading shading_direction,
+ ClutterColor *color,
+ ClutterColor *second_color)
{
MetaBackgroundPrivate *priv;
@@ -924,9 +952,9 @@ meta_background_set_gradient (MetaBackground *self,
}
void
-meta_background_set_file (MetaBackground *self,
- GFile *file,
- GDesktopBackgroundStyle style)
+meta_background_set_file (MetaBackground *self,
+ GFile *file,
+ GDesktopBackgroundStyle style)
{
g_return_if_fail (META_IS_BACKGROUND (self));
@@ -934,11 +962,11 @@ meta_background_set_file (MetaBackground *self,
}
void
-meta_background_set_blend (MetaBackground *self,
- GFile *file1,
- GFile *file2,
- double blend_factor,
- GDesktopBackgroundStyle style)
+meta_background_set_blend (MetaBackground *self,
+ GFile *file1,
+ GFile *file2,
+ double blend_factor,
+ GDesktopBackgroundStyle style)
{
MetaBackgroundPrivate *priv;
diff --git a/src/compositor/meta-cullable.c b/src/compositor/meta-cullable.c
index 5cdc03a6d..2e9913874 100644
--- a/src/compositor/meta-cullable.c
+++ b/src/compositor/meta-cullable.c
@@ -108,10 +108,11 @@ meta_cullable_cull_out_children (MetaCullable *cullable,
clutter_actor_get_position (child, &x, &y);
/* Temporarily move to the coordinate system of the actor */
- cairo_region_translate (unobscured_region, - x, - y);
- cairo_region_translate (clip_region, - x, - y);
+ cairo_region_translate (unobscured_region, -x, -y);
+ cairo_region_translate (clip_region, -x, -y);
- meta_cullable_cull_out (META_CULLABLE (child), unobscured_region, clip_region);
+ meta_cullable_cull_out (META_CULLABLE (
+ child), unobscured_region, clip_region);
cairo_region_translate (unobscured_region, x, y);
cairo_region_translate (clip_region, x, y);
@@ -183,7 +184,8 @@ meta_cullable_cull_out (MetaCullable *cullable,
cairo_region_t *unobscured_region,
cairo_region_t *clip_region)
{
- META_CULLABLE_GET_IFACE (cullable)->cull_out (cullable, unobscured_region, clip_region);
+ META_CULLABLE_GET_IFACE (cullable)->cull_out (cullable, unobscured_region,
+ clip_region);
}
/**
diff --git a/src/compositor/meta-dnd-actor.c b/src/compositor/meta-dnd-actor.c
index 24f578be1..9d9ef43b4 100644
--- a/src/compositor/meta-dnd-actor.c
+++ b/src/compositor/meta-dnd-actor.c
@@ -33,7 +33,8 @@
#define DRAG_FAILED_DURATION 500
-enum {
+enum
+{
PROP_DRAG_ORIGIN = 1,
PROP_DRAG_START_X,
PROP_DRAG_START_Y
@@ -48,7 +49,8 @@ struct _MetaDnDActorPrivate
int drag_start_y;
};
-G_DEFINE_TYPE_WITH_PRIVATE (MetaDnDActor, meta_dnd_actor, META_TYPE_FEEDBACK_ACTOR)
+G_DEFINE_TYPE_WITH_PRIVATE (MetaDnDActor, meta_dnd_actor,
+ META_TYPE_FEEDBACK_ACTOR)
static void
meta_dnd_actor_set_property (GObject *object,
@@ -77,10 +79,10 @@ meta_dnd_actor_set_property (GObject *object,
}
static void
-meta_dnd_actor_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+meta_dnd_actor_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
MetaDnDActor *self = META_DND_ACTOR (object);
MetaDnDActorPrivate *priv = meta_dnd_actor_get_instance_private (self);
diff --git a/src/compositor/meta-dnd.c b/src/compositor/meta-dnd.c
index 467aec347..2de034d04 100644
--- a/src/compositor/meta-dnd.c
+++ b/src/compositor/meta-dnd.c
@@ -49,7 +49,8 @@ struct _MetaDndPrivate
MetaCompositor *compositor;
MetaWaylandCompositor *wl_compositor;
#else
- /* to avoid warnings (g_type_class_add_private: assertion `private_size > 0' failed) */
+ /* to avoid warnings (g_type_class_add_private: assertion `private_size > 0'
+ * failed) */
gchar dummy;
#endif
};
@@ -117,8 +118,8 @@ meta_dnd_notify_dnd_enter (MetaDnd *dnd)
static void
meta_dnd_notify_dnd_position_change (MetaDnd *dnd,
- int x,
- int y)
+ int x,
+ int y)
{
g_signal_emit (dnd, signals[POSITION_CHANGE], 0, x, y);
}
@@ -150,7 +151,8 @@ meta_dnd_handle_xdnd_event (MetaBackend *backend,
return FALSE;
if (xev->xany.window != output_window &&
- xev->xany.window != clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage)))
+ xev->xany.window !=
+ clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage)))
return FALSE;
if (xev->xclient.message_type == XInternAtom (xdisplay, "XdndPosition", TRUE))
@@ -158,39 +160,43 @@ meta_dnd_handle_xdnd_event (MetaBackend *backend,
XEvent xevent;
Window src = xev->xclient.data.l[0];
- memset (&xevent, 0, sizeof(xevent));
+ memset (&xevent, 0, sizeof (xevent));
xevent.xany.type = ClientMessage;
xevent.xany.display = xdisplay;
xevent.xclient.window = src;
xevent.xclient.message_type = XInternAtom (xdisplay, "XdndStatus", TRUE);
xevent.xclient.format = 32;
xevent.xclient.data.l[0] = output_window;
- /* flags: bit 0: will we accept the drop? bit 1: do we want more position messages */
+ /* flags: bit 0: will we accept the drop? bit 1: do we want more position
+ * messages */
xevent.xclient.data.l[1] = 2;
xevent.xclient.data.l[4] = None;
XSendEvent (xdisplay, src, False, 0, &xevent);
meta_dnd_notify_dnd_position_change (dnd,
- (int)(xev->xclient.data.l[2] >> 16),
- (int)(xev->xclient.data.l[2] & 0xFFFF));
+ (int) (xev->xclient.data.l[2] >> 16),
+ (int) (xev->xclient.data.l[2] &
+ 0xFFFF));
return TRUE;
}
- else if (xev->xclient.message_type == XInternAtom (xdisplay, "XdndLeave", TRUE))
+ else if (xev->xclient.message_type ==
+ XInternAtom (xdisplay, "XdndLeave", TRUE))
{
meta_dnd_notify_dnd_leave (dnd);
return TRUE;
}
- else if (xev->xclient.message_type == XInternAtom (xdisplay, "XdndEnter", TRUE))
+ else if (xev->xclient.message_type ==
+ XInternAtom (xdisplay, "XdndEnter", TRUE))
{
meta_dnd_notify_dnd_enter (dnd);
return TRUE;
}
- return FALSE;
+ return FALSE;
}
#ifdef HAVE_WAYLAND
@@ -206,9 +212,10 @@ meta_dnd_wayland_on_motion_event (ClutterActor *actor,
g_return_if_fail (event != NULL);
clutter_event_get_coords (event, &event_x, &event_y);
- meta_dnd_notify_dnd_position_change (dnd, (int)event_x, (int)event_y);
+ meta_dnd_notify_dnd_position_change (dnd, (int) event_x, (int) event_y);
- current_grab = meta_wayland_data_device_get_current_grab (&priv->wl_compositor->seat->data_device);
+ current_grab = meta_wayland_data_device_get_current_grab (
+ &priv->wl_compositor->seat->data_device);
if (current_grab)
meta_wayland_drag_grab_update_feedback_actor (current_grab, event);
}
@@ -253,24 +260,28 @@ meta_dnd_wayland_handle_begin_modal (MetaCompositor *compositor)
MetaDndPrivate *priv = meta_dnd_get_instance_private (dnd);
if (priv->handler_id[0] == 0 &&
- meta_wayland_data_device_get_current_grab (&wl_compositor->seat->data_device) != NULL)
+ meta_wayland_data_device_get_current_grab (&wl_compositor->seat->
+ data_device) != NULL)
{
priv->compositor = compositor;
priv->wl_compositor = wl_compositor;
priv->handler_id[0] = g_signal_connect (compositor->stage,
"motion-event",
- G_CALLBACK (meta_dnd_wayland_on_motion_event),
+ G_CALLBACK (
+ meta_dnd_wayland_on_motion_event),
dnd);
priv->handler_id[1] = g_signal_connect (compositor->stage,
"button-release-event",
- G_CALLBACK (meta_dnd_wayland_on_button_released),
+ G_CALLBACK (
+ meta_dnd_wayland_on_button_released),
dnd);
priv->handler_id[2] = g_signal_connect (compositor->stage,
"key-press-event",
- G_CALLBACK (meta_dnd_wayland_on_key_pressed),
+ G_CALLBACK (
+ meta_dnd_wayland_on_key_pressed),
dnd);
meta_dnd_notify_dnd_enter (dnd);
@@ -289,7 +300,8 @@ meta_dnd_wayland_handle_end_modal (MetaCompositor *compositor)
for (i = 0; i < G_N_ELEMENTS (priv->handler_id); i++)
{
- g_signal_handler_disconnect (priv->compositor->stage, priv->handler_id[i]);
+ g_signal_handler_disconnect (priv->compositor->stage,
+ priv->handler_id[i]);
priv->handler_id[i] = 0;
}
diff --git a/src/compositor/meta-feedback-actor.c b/src/compositor/meta-feedback-actor.c
index 0e98faba7..abac817a8 100644
--- a/src/compositor/meta-feedback-actor.c
+++ b/src/compositor/meta-feedback-actor.c
@@ -30,7 +30,8 @@
#include "compositor/meta-feedback-actor-private.h"
#include "core/display-private.h"
-enum {
+enum
+{
PROP_ANCHOR_X = 1,
PROP_ANCHOR_Y
};
@@ -45,7 +46,8 @@ struct _MetaFeedbackActorPrivate
int pos_y;
};
-G_DEFINE_TYPE_WITH_PRIVATE (MetaFeedbackActor, meta_feedback_actor, CLUTTER_TYPE_ACTOR)
+G_DEFINE_TYPE_WITH_PRIVATE (MetaFeedbackActor, meta_feedback_actor,
+ CLUTTER_TYPE_ACTOR)
static void
meta_feedback_actor_constructed (GObject *object)
@@ -60,7 +62,8 @@ meta_feedback_actor_constructed (GObject *object)
static void
meta_feedback_actor_update_position (MetaFeedbackActor *self)
{
- MetaFeedbackActorPrivate *priv = meta_feedback_actor_get_instance_private (self);
+ MetaFeedbackActorPrivate *priv = meta_feedback_actor_get_instance_private (
+ self);
clutter_actor_set_position (CLUTTER_ACTOR (self),
priv->pos_x - priv->anchor_x,
@@ -74,7 +77,8 @@ meta_feedback_actor_set_property (GObject *object,
GParamSpec *pspec)
{
MetaFeedbackActor *self = META_FEEDBACK_ACTOR (object);
- MetaFeedbackActorPrivate *priv = meta_feedback_actor_get_instance_private (self);
+ MetaFeedbackActorPrivate *priv = meta_feedback_actor_get_instance_private (
+ self);
switch (prop_id)
{
@@ -93,13 +97,14 @@ meta_feedback_actor_set_property (GObject *object,
}
static void
-meta_feedback_actor_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+meta_feedback_actor_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
MetaFeedbackActor *self = META_FEEDBACK_ACTOR (object);
- MetaFeedbackActorPrivate *priv = meta_feedback_actor_get_instance_private (self);
+ MetaFeedbackActorPrivate *priv = meta_feedback_actor_get_instance_private (
+ self);
switch (prop_id)
{
@@ -220,9 +225,9 @@ meta_feedback_actor_get_anchor (MetaFeedbackActor *self,
}
void
-meta_feedback_actor_set_position (MetaFeedbackActor *self,
- int x,
- int y)
+meta_feedback_actor_set_position (MetaFeedbackActor *self,
+ int x,
+ int y)
{
MetaFeedbackActorPrivate *priv;
diff --git a/src/compositor/meta-module.c b/src/compositor/meta-module.c
index 0283b4a9a..67afed65f 100644
--- a/src/compositor/meta-module.c
+++ b/src/compositor/meta-module.c
@@ -36,22 +36,22 @@ enum
struct _MetaModulePrivate
{
- GModule *lib;
- gchar *path;
- GType plugin_type;
+ GModule *lib;
+ gchar *path;
+ GType plugin_type;
};
#define META_MODULE_GET_PRIVATE(obj) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_MODULE, MetaModulePrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_MODULE, MetaModulePrivate))
G_DEFINE_TYPE_WITH_PRIVATE (MetaModule, meta_module, G_TYPE_TYPE_MODULE);
static gboolean
meta_module_load (GTypeModule *gmodule)
{
- MetaModulePrivate *priv = META_MODULE (gmodule)->priv;
- MetaPluginVersion *info = NULL;
- GType (*register_type) (GTypeModule *) = NULL;
+ MetaModulePrivate *priv = META_MODULE (gmodule)->priv;
+ MetaPluginVersion *info = NULL;
+ GType (*register_type) (GTypeModule *) = NULL;
if (priv->lib && priv->plugin_type)
return TRUE;
@@ -67,13 +67,13 @@ meta_module_load (GTypeModule *gmodule)
}
if (g_module_symbol (priv->lib, "meta_plugin_version",
- (gpointer *)(void *)&info) &&
+ (gpointer *) (void *) &info) &&
g_module_symbol (priv->lib, "meta_plugin_register_type",
- (gpointer *)(void *)&register_type) &&
+ (gpointer *) (void *) &register_type) &&
info && register_type)
{
if (info->version_api != META_PLUGIN_API_VERSION)
- g_warning ("Plugin API mismatch for [%s]", priv->path);
+ g_warning ("Plugin API mismatch for [%s]", priv->path);
else
{
GType plugin_type;
@@ -86,7 +86,7 @@ meta_module_load (GTypeModule *gmodule)
}
else
{
- priv->plugin_type = plugin_type;
+ priv->plugin_type = plugin_type;
}
return TRUE;
@@ -168,25 +168,25 @@ meta_module_get_property (GObject *object,
static void
meta_module_class_init (MetaModuleClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GTypeModuleClass *gmodule_class = G_TYPE_MODULE_CLASS (klass);
- gobject_class->finalize = meta_module_finalize;
- gobject_class->dispose = meta_module_dispose;
+ gobject_class->finalize = meta_module_finalize;
+ gobject_class->dispose = meta_module_dispose;
gobject_class->set_property = meta_module_set_property;
gobject_class->get_property = meta_module_get_property;
- gmodule_class->load = meta_module_load;
- gmodule_class->unload = meta_module_unload;
+ gmodule_class->load = meta_module_load;
+ gmodule_class->unload = meta_module_unload;
g_object_class_install_property (gobject_class,
- PROP_PATH,
- g_param_spec_string ("path",
- "Path",
- "Load path",
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
+ PROP_PATH,
+ g_param_spec_string ("path",
+ "Path",
+ "Load path",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
}
static void
@@ -202,4 +202,3 @@ meta_module_get_plugin_type (MetaModule *module)
return priv->plugin_type;
}
-
diff --git a/src/compositor/meta-plugin-manager.c b/src/compositor/meta-plugin-manager.c
index 236b6b1d3..798ec08de 100644
--- a/src/compositor/meta-plugin-manager.c
+++ b/src/compositor/meta-plugin-manager.c
@@ -57,11 +57,11 @@ meta_plugin_manager_set_plugin_type (GType gtype)
* Loads the given plugin.
*/
void
-meta_plugin_manager_load (const gchar *plugin_name)
+meta_plugin_manager_load (const gchar *plugin_name)
{
const gchar *dpath = MUTTER_PLUGIN_DIR "/";
- gchar *path;
- MetaModule *module;
+ gchar *path;
+ MetaModule *module;
if (g_path_is_absolute (plugin_name))
path = g_strdup (plugin_name);
@@ -76,7 +76,7 @@ meta_plugin_manager_load (const gchar *plugin_name)
* our untimely exit.
*/
g_printerr ("Unable to load plugin module [%s]: %s",
- path, g_module_error());
+ path, g_module_error ());
exit (1);
}
@@ -123,8 +123,8 @@ static void
meta_plugin_manager_kill_window_effects (MetaPluginManager *plugin_mgr,
MetaWindowActor *actor)
{
- MetaPlugin *plugin = plugin_mgr->plugin;
- MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
+ MetaPlugin *plugin = plugin_mgr->plugin;
+ MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
if (klass->kill_window_effects)
klass->kill_window_effects (plugin, actor);
@@ -133,8 +133,8 @@ meta_plugin_manager_kill_window_effects (MetaPluginManager *plugin_mgr,
static void
meta_plugin_manager_kill_switch_workspace (MetaPluginManager *plugin_mgr)
{
- MetaPlugin *plugin = plugin_mgr->plugin;
- MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
+ MetaPlugin *plugin = plugin_mgr->plugin;
+ MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
if (klass->kill_switch_workspace)
klass->kill_switch_workspace (plugin);
@@ -234,7 +234,8 @@ meta_plugin_manager_event_size_change (MetaPluginManager *plugin_mgr,
return FALSE;
meta_plugin_manager_kill_window_effects (plugin_mgr, actor);
- klass->size_change (plugin, actor, which_change, old_frame_rect, old_buffer_rect);
+ klass->size_change (plugin, actor, which_change, old_frame_rect,
+ old_buffer_rect);
return TRUE;
}
@@ -247,10 +248,10 @@ meta_plugin_manager_event_size_change (MetaPluginManager *plugin_mgr,
* appropriate post-effect cleanup is carried out.
*/
gboolean
-meta_plugin_manager_switch_workspace (MetaPluginManager *plugin_mgr,
- gint from,
- gint to,
- MetaMotionDirection direction)
+meta_plugin_manager_switch_workspace (MetaPluginManager *plugin_mgr,
+ gint from,
+ gint to,
+ MetaMotionDirection direction)
{
MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
@@ -346,11 +347,11 @@ meta_plugin_manager_hide_tile_preview (MetaPluginManager *plugin_mgr)
}
void
-meta_plugin_manager_show_window_menu (MetaPluginManager *plugin_mgr,
- MetaWindow *window,
- MetaWindowMenuType menu,
- int x,
- int y)
+meta_plugin_manager_show_window_menu (MetaPluginManager *plugin_mgr,
+ MetaWindow *window,
+ MetaWindowMenuType menu,
+ int x,
+ int y)
{
MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
@@ -364,10 +365,10 @@ meta_plugin_manager_show_window_menu (MetaPluginManager *plugin_mgr,
}
void
-meta_plugin_manager_show_window_menu_for_rect (MetaPluginManager *plugin_mgr,
- MetaWindow *window,
- MetaWindowMenuType menu,
- MetaRectangle *rect)
+meta_plugin_manager_show_window_menu_for_rect (MetaPluginManager *plugin_mgr,
+ MetaWindow *window,
+ MetaWindowMenuType menu,
+ MetaRectangle *rect)
{
MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
@@ -394,8 +395,9 @@ meta_plugin_manager_create_close_dialog (MetaPluginManager *plugin_mgr,
}
MetaInhibitShortcutsDialog *
-meta_plugin_manager_create_inhibit_shortcuts_dialog (MetaPluginManager *plugin_mgr,
- MetaWindow *window)
+meta_plugin_manager_create_inhibit_shortcuts_dialog (
+ MetaPluginManager *plugin_mgr,
+ MetaWindow *window)
{
MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
diff --git a/src/compositor/meta-plugin.c b/src/compositor/meta-plugin.c
index b787652bc..9fe17cc87 100644
--- a/src/compositor/meta-plugin.c
+++ b/src/compositor/meta-plugin.c
@@ -51,7 +51,7 @@ struct _MetaPluginPrivate
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MetaPlugin, meta_plugin, G_TYPE_OBJECT);
#define META_PLUGIN_GET_PRIVATE(obj) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_PLUGIN, MetaPluginPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_PLUGIN, MetaPluginPrivate))
static void
meta_plugin_class_init (MetaPluginClass *klass)
@@ -67,7 +67,7 @@ meta_plugin_init (MetaPlugin *self)
const MetaPluginInfo *
meta_plugin_get_info (MetaPlugin *plugin)
{
- MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
+ MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
if (klass && klass->plugin_info)
return klass->plugin_info (plugin);
@@ -150,7 +150,8 @@ meta_plugin_destroy_completed (MetaPlugin *plugin,
* passive X grabs in Meta can trigger but not be handled by the normal
* keybinding handling code.) However, the plugin can establish the keyboard
* and/or mouse grabs ahead of time and pass in the
- * %META_MODAL_POINTER_ALREADY_GRABBED and/or %META_MODAL_KEYBOARD_ALREADY_GRABBED
+ * %META_MODAL_POINTER_ALREADY_GRABBED and/or
+ *%META_MODAL_KEYBOARD_ALREADY_GRABBED
* options. This facility is provided for two reasons: first to allow using
* this function to establish modality after a passive grab, and second to
* allow using obscure features of XGrabPointer() and XGrabKeyboard() without
@@ -160,9 +161,9 @@ meta_plugin_destroy_completed (MetaPlugin *plugin,
* mouse and made the plugin modal.
*/
gboolean
-meta_plugin_begin_modal (MetaPlugin *plugin,
- MetaModalOptions options,
- guint32 timestamp)
+meta_plugin_begin_modal (MetaPlugin *plugin,
+ MetaModalOptions options,
+ guint32 timestamp)
{
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
diff --git a/src/compositor/meta-shadow-factory.c b/src/compositor/meta-shadow-factory.c
index 38594aebd..94a669ce3 100644
--- a/src/compositor/meta-shadow-factory.c
+++ b/src/compositor/meta-shadow-factory.c
@@ -19,7 +19,8 @@
/**
* SECTION:meta-shadow-factory
* @title: MetaShadowFactory
- * @short_description: Create and cache shadow textures for abritrary window shapes
+ * @short_description: Create and cache shadow textures for abritrary window
+ *shapes
*/
#include "config.h"
@@ -52,7 +53,7 @@
* - We approximate the 1D gaussian blur as 3 successive box filters.
*/
-typedef struct _MetaShadowCacheKey MetaShadowCacheKey;
+typedef struct _MetaShadowCacheKey MetaShadowCacheKey;
typedef struct _MetaShadowClassInfo MetaShadowClassInfo;
struct _MetaShadowCacheKey
@@ -122,18 +123,19 @@ static guint signals[LAST_SIGNAL] = { 0 };
/* The first element in this array also defines the default parameters
* for newly created classes */
-MetaShadowClassInfo default_shadow_classes[] = {
- { "normal", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
- { "dialog", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
+MetaShadowClassInfo default_shadow_classes[] =
+{
+ { "normal", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
+ { "dialog", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
{ "modal_dialog", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
- { "utility", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
- { "border", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
- { "menu", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
+ { "utility", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
+ { "border", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
+ { "menu", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
- { "popup-menu", { 1, -1, 0, 0, 128 }, { 1, -1, 0, 0, 128 } },
+ { "popup-menu", { 1, -1, 0, 0, 128 }, { 1, -1, 0, 0, 128 } },
{ "dropdown-menu", { 1, -1, 0, 0, 128 }, { 1, -1, 0, 0, 128 } },
- { "attached", { 0, -1, 0, 0, 0 }, { 0, -1, 0, 0, 0 } }
+ { "attached", { 0, -1, 0, 0, 0 }, { 0, -1, 0, 0, 0 } }
};
G_DEFINE_TYPE (MetaShadowFactory, meta_shadow_factory, G_TYPE_OBJECT);
@@ -143,7 +145,8 @@ meta_shadow_cache_key_hash (gconstpointer val)
{
const MetaShadowCacheKey *key = val;
- return 59 * key->radius + 67 * key->top_fade + 73 * meta_window_shape_hash (key->shape);
+ return 59 * key->radius + 67 * key->top_fade + 73 * meta_window_shape_hash (
+ key->shape);
}
static gboolean
@@ -153,7 +156,8 @@ meta_shadow_cache_key_equal (gconstpointer a,
const MetaShadowCacheKey *key_a = a;
const MetaShadowCacheKey *key_b = b;
- return (key_a->radius == key_b->radius && key_a->top_fade == key_b->top_fade &&
+ return (key_a->radius == key_b->radius &&
+ key_a->top_fade == key_b->top_fade &&
meta_window_shape_equal (key_a->shape, key_b->shape));
}
@@ -231,8 +235,12 @@ meta_shadow_paint (MetaShadow *shadow,
n_x = 3;
src_x[0] = 0.0;
- src_x[1] = (shadow->inner_border_left + shadow->outer_border_left) / texture_width;
- src_x[2] = (texture_width - (shadow->inner_border_right + shadow->outer_border_right)) / texture_width;
+ src_x[1] = (shadow->inner_border_left + shadow->outer_border_left) /
+ texture_width;
+ src_x[2] =
+ (texture_width -
+ (shadow->inner_border_right + shadow->outer_border_right)) /
+ texture_width;
src_x[3] = 1.0;
dest_x[0] = window_x - shadow->outer_border_left;
@@ -256,8 +264,12 @@ meta_shadow_paint (MetaShadow *shadow,
n_y = 3;
src_y[0] = 0.0;
- src_y[1] = (shadow->inner_border_top + shadow->outer_border_top) / texture_height;
- src_y[2] = (texture_height - (shadow->inner_border_bottom + shadow->outer_border_bottom)) / texture_height;
+ src_y[1] = (shadow->inner_border_top + shadow->outer_border_top) /
+ texture_height;
+ src_y[2] =
+ (texture_height -
+ (shadow->inner_border_bottom + shadow->outer_border_bottom)) /
+ texture_height;
src_y[3] = 1.0;
dest_y[0] = window_y - shadow->outer_border_top;
@@ -330,22 +342,35 @@ meta_shadow_paint (MetaShadow *shadow,
cairo_region_get_rectangle (intersection, k, &rect);
- /* Separately linear interpolate X and Y coordinates in the source
+ /* Separately linear interpolate X and Y coordinates in the
+ * source
* based on the destination X and Y coordinates */
- src_x1 = (src_x[i] * (dest_rect.x + dest_rect.width - rect.x) +
- src_x[i + 1] * (rect.x - dest_rect.x)) / dest_rect.width;
- src_x2 = (src_x[i] * (dest_rect.x + dest_rect.width - (rect.x + rect.width)) +
- src_x[i + 1] * (rect.x + rect.width - dest_rect.x)) / dest_rect.width;
-
- src_y1 = (src_y[j] * (dest_rect.y + dest_rect.height - rect.y) +
- src_y[j + 1] * (rect.y - dest_rect.y)) / dest_rect.height;
- src_y2 = (src_y[j] * (dest_rect.y + dest_rect.height - (rect.y + rect.height)) +
- src_y[j + 1] * (rect.y + rect.height - dest_rect.y)) / dest_rect.height;
+ src_x1 =
+ (src_x[i] * (dest_rect.x + dest_rect.width - rect.x) +
+ src_x[i + 1] * (rect.x - dest_rect.x)) /
+ dest_rect.width;
+ src_x2 =
+ (src_x[i] *
+ (dest_rect.x + dest_rect.width - (rect.x + rect.width)) +
+ src_x[i + 1] *
+ (rect.x + rect.width - dest_rect.x)) / dest_rect.width;
+
+ src_y1 =
+ (src_y[j] * (dest_rect.y + dest_rect.height - rect.y) +
+ src_y[j + 1] * (rect.y - dest_rect.y)) /
+ dest_rect.height;
+ src_y2 =
+ (src_y[j] *
+ (dest_rect.y + dest_rect.height - (rect.y + rect.height)) +
+ src_y[j + 1] *
+ (rect.y + rect.height - dest_rect.y)) / dest_rect.height;
cogl_rectangle_with_texture_coords (rect.x, rect.y,
- rect.x + rect.width, rect.y + rect.height,
- src_x1, src_y1, src_x2, src_y2);
+ rect.x + rect.width,
+ rect.y + rect.height,
+ src_x1, src_y1, src_x2,
+ src_y2);
}
cairo_region_destroy (intersection);
@@ -375,14 +400,16 @@ meta_shadow_get_bounds (MetaShadow *shadow,
{
bounds->x = window_x - shadow->outer_border_left;
bounds->y = window_y - shadow->outer_border_top;
- bounds->width = window_width + shadow->outer_border_left + shadow->outer_border_right;
- bounds->height = window_height + shadow->outer_border_top + shadow->outer_border_bottom;
+ bounds->width = window_width + shadow->outer_border_left +
+ shadow->outer_border_right;
+ bounds->height = window_height + shadow->outer_border_top +
+ shadow->outer_border_bottom;
}
static void
meta_shadow_class_info_free (MetaShadowClassInfo *class_info)
{
- g_free ((char *)class_info->name);
+ g_free ((char *) class_info->name);
g_slice_free (MetaShadowClassInfo, class_info);
}
@@ -397,7 +424,7 @@ meta_shadow_factory_init (MetaShadowFactory *factory)
factory->shadow_classes = g_hash_table_new_full (g_str_hash,
g_str_equal,
NULL,
- (GDestroyNotify)meta_shadow_class_info_free);
+ (GDestroyNotify) meta_shadow_class_info_free);
for (i = 0; i < G_N_ELEMENTS (default_shadow_classes); i++)
{
@@ -407,7 +434,7 @@ meta_shadow_factory_init (MetaShadowFactory *factory)
class_info->name = g_strdup (class_info->name);
g_hash_table_insert (factory->shadow_classes,
- (char *)class_info->name, class_info);
+ (char *) class_info->name, class_info);
}
}
@@ -487,7 +514,7 @@ meta_shadow_factory_get_default (void)
static int
get_box_filter_size (int radius)
{
- return (int)(0.5 + radius * (0.75 * sqrt(2*M_PI)));
+ return (int) (0.5 + radius * (0.75 * sqrt (2 * M_PI)));
}
/* The "spread" of the filter is the number of pixels from an original
@@ -566,13 +593,13 @@ blur_xspan (guchar *row,
}
static void
-blur_rows (cairo_region_t *convolve_region,
- int x_offset,
- int y_offset,
- guchar *buffer,
- int buffer_width,
- int buffer_height,
- int d)
+blur_rows (cairo_region_t *convolve_region,
+ int x_offset,
+ int y_offset,
+ guchar *buffer,
+ int buffer_width,
+ int buffer_height,
+ int d)
{
int i, j;
int n_rectangles;
@@ -650,8 +677,8 @@ flip_buffer (guchar *buffer,
for (j0 = 0; j0 < height; j0 += BLOCK_SIZE)
for (i0 = 0; i0 <= j0; i0 += BLOCK_SIZE)
{
- int max_j = MIN(j0 + BLOCK_SIZE, height);
- int max_i = MIN(i0 + BLOCK_SIZE, width);
+ int max_j = MIN (j0 + BLOCK_SIZE, height);
+ int max_i = MIN (i0 + BLOCK_SIZE, width);
int i, j;
if (i0 == j0)
@@ -686,8 +713,8 @@ flip_buffer (guchar *buffer,
for (i0 = 0; i0 < width; i0 += BLOCK_SIZE)
for (j0 = 0; j0 < height; j0 += BLOCK_SIZE)
{
- int max_j = MIN(j0 + BLOCK_SIZE, height);
- int max_i = MIN(i0 + BLOCK_SIZE, width);
+ int max_j = MIN (j0 + BLOCK_SIZE, height);
+ int max_i = MIN (i0 + BLOCK_SIZE, width);
int i, j;
for (i = i0; i < max_i; i++)
@@ -790,22 +817,45 @@ make_shadow (MetaShadow *shadow,
/* Step 6: fade out the top, if applicable */
if (shadow->key.top_fade >= 0)
{
- for (j = y_offset; j < y_offset + MIN (shadow->key.top_fade, extents.height + shadow->outer_border_bottom); j++)
- fade_bytes(buffer + j * buffer_width, buffer_width, j - y_offset, shadow->key.top_fade);
+ for (j = y_offset;
+ j <
+ y_offset +
+ MIN (shadow->key.top_fade,
+ extents.height + shadow->outer_border_bottom);
+ j++)
+ fade_bytes (buffer + j * buffer_width, buffer_width, j - y_offset,
+ shadow->key.top_fade);
}
- /* We offset the passed in pixels to crop off the extra area we allocated at the top
- * in the case of top_fade >= 0. We also account for padding at the left for symmetry
+ /* We offset the passed in pixels to crop off the extra area we allocated at
+ * the top
+ * in the case of top_fade >= 0. We also account for padding at the left for
+ *symmetry
* though that doesn't currently occur.
*/
shadow->texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx,
- shadow->outer_border_left + extents.width + shadow->outer_border_right,
- shadow->outer_border_top + extents.height + shadow->outer_border_bottom,
+ shadow->
+ outer_border_left
+ + extents.width
+ + shadow->
+ outer_border_right,
+ shadow->
+ outer_border_top
+ + extents.
+ height +
+ shadow->
+ outer_border_bottom,
COGL_PIXEL_FORMAT_A_8,
buffer_width,
(buffer +
- (y_offset - shadow->outer_border_top) * buffer_width +
- (x_offset - shadow->outer_border_left)),
+ (y_offset -
+ shadow->
+ outer_border_top)
+ * buffer_width
+ +
+ (x_offset -
+ shadow->
+ outer_border_left)),
&error));
if (error)
@@ -827,8 +877,9 @@ get_shadow_params (MetaShadowFactory *factory,
gboolean focused,
gboolean create)
{
- MetaShadowClassInfo *class_info = g_hash_table_lookup (factory->shadow_classes,
- class_name);
+ MetaShadowClassInfo *class_info = g_hash_table_lookup (
+ factory->shadow_classes,
+ class_name);
if (class_info == NULL)
{
if (create)
@@ -838,7 +889,7 @@ get_shadow_params (MetaShadowFactory *factory,
class_info->name = g_strdup (class_info->name);
g_hash_table_insert (factory->shadow_classes,
- (char *)class_info->name, class_info);
+ (char *) class_info->name, class_info);
}
else
{
@@ -883,9 +934,12 @@ meta_shadow_factory_get_shadow (MetaShadowFactory *factory,
MetaShadow *shadow;
cairo_region_t *region;
int spread;
- int shape_border_top, shape_border_right, shape_border_bottom, shape_border_left;
- int inner_border_top, inner_border_right, inner_border_bottom, inner_border_left;
- int outer_border_top, outer_border_right, outer_border_bottom, outer_border_left;
+ int shape_border_top, shape_border_right, shape_border_bottom,
+ shape_border_left;
+ int inner_border_top, inner_border_right, inner_border_bottom,
+ inner_border_left;
+ int outer_border_top, outer_border_right, outer_border_bottom,
+ outer_border_left;
gboolean scale_width, scale_height;
gboolean cacheable;
int center_width, center_height;
@@ -969,13 +1023,15 @@ meta_shadow_factory_get_shadow (MetaShadowFactory *factory,
shadow->scale_width = scale_width;
if (scale_width)
- center_width = inner_border_left + inner_border_right - (shape_border_left + shape_border_right);
+ center_width = inner_border_left + inner_border_right -
+ (shape_border_left + shape_border_right);
else
center_width = width - (shape_border_left + shape_border_right);
shadow->scale_height = scale_height;
if (scale_height)
- center_height = inner_border_top + inner_border_bottom - (shape_border_top + shape_border_bottom);
+ center_height = inner_border_top + inner_border_bottom -
+ (shape_border_top + shape_border_bottom);
else
center_height = height - (shape_border_top + shape_border_bottom);
@@ -1034,7 +1090,8 @@ meta_shadow_factory_set_params (MetaShadowFactory *factory,
* @factory: a #MetaShadowFactory
* @class_name: name of the class of shadow to get the params for
* @focused: whether the shadow is for a focused window
- * @params: (out caller-allocates): location to store the current parameter values
+ * @params: (out caller-allocates): location to store the current parameter
+ *values
*
* Gets the shadow parameters for a particular class of shadows
* for either the focused or unfocused state. If the class name
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index 919e7a9b5..077d3ee72 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -52,9 +52,9 @@
*/
#define MIN_FAST_UPDATES_BEFORE_UNMIPMAP 20
-static void meta_shaped_texture_dispose (GObject *object);
+static void meta_shaped_texture_dispose (GObject *object);
-static void meta_shaped_texture_paint (ClutterActor *actor);
+static void meta_shaped_texture_paint (ClutterActor *actor);
static void meta_shaped_texture_get_preferred_width (ClutterActor *self,
gfloat for_height,
@@ -66,7 +66,8 @@ static void meta_shaped_texture_get_preferred_height (ClutterActor *self,
gfloat *min_height_p,
gfloat *natural_height_p);
-static gboolean meta_shaped_texture_get_paint_volume (ClutterActor *self, ClutterPaintVolume *volume);
+static gboolean meta_shaped_texture_get_paint_volume (ClutterActor *self,
+ ClutterPaintVolume *volume);
static void cullable_iface_init (MetaCullableInterface *iface);
@@ -74,7 +75,8 @@ static void cullable_iface_init (MetaCullableInterface *iface);
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_SHAPED_TEXTURE, \
MetaShapedTexturePrivate))
-enum {
+enum
+{
SIZE_CHANGED,
LAST_SIGNAL,
@@ -114,9 +116,11 @@ struct _MetaShapedTexturePrivate
guint create_mipmaps : 1;
};
-G_DEFINE_TYPE_WITH_CODE (MetaShapedTexture, meta_shaped_texture, CLUTTER_TYPE_ACTOR,
+G_DEFINE_TYPE_WITH_CODE (MetaShapedTexture, meta_shaped_texture,
+ CLUTTER_TYPE_ACTOR,
G_ADD_PRIVATE (MetaShapedTexture)
- G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
+ G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE,
+ cullable_iface_init));
static void
meta_shaped_texture_class_init (MetaShapedTextureClass *klass)
@@ -488,7 +492,9 @@ meta_shaped_texture_paint (ClutterActor *actor)
if (tex_width == 0 || tex_height == 0) /* no contents yet */
return;
- tex_rect = (cairo_rectangle_int_t) { 0, 0, tex_width, tex_height };
+ tex_rect = (cairo_rectangle_int_t) {
+ 0, 0, tex_width, tex_height
+ };
/* Use nearest-pixel interpolation if the texture is unscaled. This
* improves performance, especially with software rendering.
@@ -621,7 +627,8 @@ meta_shaped_texture_paint (ClutterActor *actor)
else
{
blended_pipeline = get_masked_pipeline (stex, ctx);
- cogl_pipeline_set_layer_texture (blended_pipeline, 1, priv->mask_texture);
+ cogl_pipeline_set_layer_texture (blended_pipeline, 1,
+ priv->mask_texture);
cogl_pipeline_set_layer_filters (blended_pipeline, 1, filter, filter);
}
@@ -724,7 +731,7 @@ effective_unobscured_region (MetaShapedTexture *self)
}
static gboolean
-meta_shaped_texture_get_paint_volume (ClutterActor *actor,
+meta_shaped_texture_get_paint_volume (ClutterActor *actor,
ClutterPaintVolume *volume)
{
return clutter_paint_volume_set_from_allocation (volume, actor);
@@ -732,7 +739,7 @@ meta_shaped_texture_get_paint_volume (ClutterActor *actor,
void
meta_shaped_texture_set_create_mipmaps (MetaShapedTexture *stex,
- gboolean create_mipmaps)
+ gboolean create_mipmaps)
{
MetaShapedTexturePrivate *priv;
@@ -798,10 +805,10 @@ meta_shaped_texture_is_obscured (MetaShapedTexture *self)
*/
gboolean
meta_shaped_texture_update_area (MetaShapedTexture *stex,
- int x,
- int y,
- int width,
- int height)
+ int x,
+ int y,
+ int width,
+ int height)
{
MetaShapedTexturePrivate *priv;
cairo_region_t *unobscured_region;
@@ -843,7 +850,8 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
{
cairo_rectangle_int_t damage_rect;
cairo_region_get_extents (intersection, &damage_rect);
- clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stex), &damage_rect);
+ clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (
+ stex), &damage_rect);
cairo_region_destroy (intersection);
return TRUE;
}
@@ -1032,8 +1040,10 @@ meta_shaped_texture_get_image (MetaShapedTexture *stex,
clip->height);
mask_surface = cairo_image_surface_create (CAIRO_FORMAT_A8,
- cogl_texture_get_width (mask_texture),
- cogl_texture_get_height (mask_texture));
+ cogl_texture_get_width (
+ mask_texture),
+ cogl_texture_get_height (
+ mask_texture));
cogl_texture_get_data (mask_texture, COGL_PIXEL_FORMAT_A_8,
cairo_image_surface_get_stride (mask_surface),
diff --git a/src/compositor/meta-surface-actor-wayland.c b/src/compositor/meta-surface-actor-wayland.c
index a099cef72..d8505f045 100644
--- a/src/compositor/meta-surface-actor-wayland.c
+++ b/src/compositor/meta-surface-actor-wayland.c
@@ -91,9 +91,10 @@ meta_surface_actor_wayland_is_unredirected (MetaSurfaceActor *actor)
void
meta_surface_actor_wayland_add_frame_callbacks (MetaSurfaceActorWayland *self,
- struct wl_list *frame_callbacks)
+ struct wl_list *frame_callbacks)
{
- MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
+ MetaSurfaceActorWaylandPrivate *priv =
+ meta_surface_actor_wayland_get_instance_private (self);
wl_list_insert_list (&priv->frame_callback_list, frame_callbacks);
}
@@ -128,7 +129,7 @@ meta_surface_actor_wayland_get_preferred_width (ClutterActor *actor,
natural_width_p);
if (min_width_p)
- *min_width_p *= scale;
+ *min_width_p *= scale;
if (natural_width_p)
*natural_width_p *= scale;
@@ -152,7 +153,7 @@ meta_surface_actor_wayland_get_preferred_height (ClutterActor *actor,
natural_height_p);
if (min_height_p)
- *min_height_p *= scale;
+ *min_height_p *= scale;
if (natural_height_p)
*natural_height_p *= scale;
@@ -169,7 +170,8 @@ meta_surface_actor_wayland_paint (ClutterActor *actor)
{
MetaWaylandCompositor *compositor = priv->surface->compositor;
- wl_list_insert_list (&compositor->frame_callbacks, &priv->frame_callback_list);
+ wl_list_insert_list (&compositor->frame_callbacks,
+ &priv->frame_callback_list);
wl_list_init (&priv->frame_callback_list);
}
@@ -195,7 +197,7 @@ meta_surface_actor_wayland_dispose (GObject *object)
}
wl_list_for_each_safe (cb, next, &priv->frame_callback_list, link)
- wl_resource_destroy (cb->resource);
+ wl_resource_destroy (cb->resource);
G_OBJECT_CLASS (meta_surface_actor_wayland_parent_class)->dispose (object);
}
@@ -207,17 +209,23 @@ meta_surface_actor_wayland_class_init (MetaSurfaceActorWaylandClass *klass)
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- actor_class->get_preferred_width = meta_surface_actor_wayland_get_preferred_width;
- actor_class->get_preferred_height = meta_surface_actor_wayland_get_preferred_height;
+ actor_class->get_preferred_width =
+ meta_surface_actor_wayland_get_preferred_width;
+ actor_class->get_preferred_height =
+ meta_surface_actor_wayland_get_preferred_height;
actor_class->paint = meta_surface_actor_wayland_paint;
- surface_actor_class->process_damage = meta_surface_actor_wayland_process_damage;
+ surface_actor_class->process_damage =
+ meta_surface_actor_wayland_process_damage;
surface_actor_class->pre_paint = meta_surface_actor_wayland_pre_paint;
surface_actor_class->is_visible = meta_surface_actor_wayland_is_visible;
- surface_actor_class->should_unredirect = meta_surface_actor_wayland_should_unredirect;
- surface_actor_class->set_unredirected = meta_surface_actor_wayland_set_unredirected;
- surface_actor_class->is_unredirected = meta_surface_actor_wayland_is_unredirected;
+ surface_actor_class->should_unredirect =
+ meta_surface_actor_wayland_should_unredirect;
+ surface_actor_class->set_unredirected =
+ meta_surface_actor_wayland_set_unredirected;
+ surface_actor_class->is_unredirected =
+ meta_surface_actor_wayland_is_unredirected;
surface_actor_class->get_window = meta_surface_actor_wayland_get_window;
@@ -232,8 +240,10 @@ meta_surface_actor_wayland_init (MetaSurfaceActorWayland *self)
MetaSurfaceActor *
meta_surface_actor_wayland_new (MetaWaylandSurface *surface)
{
- MetaSurfaceActorWayland *self = g_object_new (META_TYPE_SURFACE_ACTOR_WAYLAND, NULL);
- MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
+ MetaSurfaceActorWayland *self = g_object_new (META_TYPE_SURFACE_ACTOR_WAYLAND,
+ NULL);
+ MetaSurfaceActorWaylandPrivate *priv =
+ meta_surface_actor_wayland_get_instance_private (self);
g_assert (meta_is_wayland_compositor ());
@@ -248,6 +258,7 @@ meta_surface_actor_wayland_new (MetaWaylandSurface *surface)
MetaWaylandSurface *
meta_surface_actor_wayland_get_surface (MetaSurfaceActorWayland *self)
{
- MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
+ MetaSurfaceActorWaylandPrivate *priv =
+ meta_surface_actor_wayland_get_instance_private (self);
return priv->surface;
}
diff --git a/src/compositor/meta-surface-actor-x11.c b/src/compositor/meta-surface-actor-x11.c
index 1f897be3f..adaa61777 100644
--- a/src/compositor/meta-surface-actor-x11.c
+++ b/src/compositor/meta-surface-actor-x11.c
@@ -62,12 +62,14 @@ struct _MetaSurfaceActorX11Private
};
typedef struct _MetaSurfaceActorX11Private MetaSurfaceActorX11Private;
-G_DEFINE_TYPE_WITH_PRIVATE (MetaSurfaceActorX11, meta_surface_actor_x11, META_TYPE_SURFACE_ACTOR)
+G_DEFINE_TYPE_WITH_PRIVATE (MetaSurfaceActorX11, meta_surface_actor_x11,
+ META_TYPE_SURFACE_ACTOR)
static void
free_damage (MetaSurfaceActorX11 *self)
{
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
@@ -83,16 +85,20 @@ free_damage (MetaSurfaceActorX11 *self)
static void
detach_pixmap (MetaSurfaceActorX11 *self)
{
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
- MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
+ MetaShapedTexture *stex =
+ meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
if (priv->pixmap == None)
return;
- /* Get rid of all references to the pixmap before freeing it; it's unclear whether
- * you are supposed to be able to free a GLXPixmap after freeing the underlying
+ /* Get rid of all references to the pixmap before freeing it; it's unclear
+ * whether
+ * you are supposed to be able to free a GLXPixmap after freeing the
+ *underlying
* pixmap, but it certainly doesn't work with current DRI/Mesa
*/
meta_shaped_texture_set_texture (stex, NULL);
@@ -110,24 +116,30 @@ static void
set_pixmap (MetaSurfaceActorX11 *self,
Pixmap pixmap)
{
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
- CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
- MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
+ CoglContext *ctx = clutter_backend_get_cogl_context (
+ clutter_get_default_backend ());
+ MetaShapedTexture *stex =
+ meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
CoglError *error = NULL;
CoglTexture *texture;
g_assert (priv->pixmap == None);
priv->pixmap = pixmap;
- texture = COGL_TEXTURE (cogl_texture_pixmap_x11_new (ctx, priv->pixmap, FALSE, &error));
+ texture =
+ COGL_TEXTURE (cogl_texture_pixmap_x11_new (ctx, priv->pixmap, FALSE,
+ &error));
if (error != NULL)
{
g_warning ("Failed to allocate stex texture: %s", error->message);
cogl_error_free (error);
}
- else if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (COGL_TEXTURE_PIXMAP_X11 (texture))))
+ else if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (
+ COGL_TEXTURE_PIXMAP_X11 (texture))))
g_warning ("NOTE: Not using GLX TFP!\n");
priv->texture = texture;
@@ -137,7 +149,8 @@ set_pixmap (MetaSurfaceActorX11 *self,
static void
update_pixmap (MetaSurfaceActorX11 *self)
{
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
@@ -181,7 +194,8 @@ update_pixmap (MetaSurfaceActorX11 *self)
static gboolean
is_visible (MetaSurfaceActorX11 *self)
{
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
return (priv->pixmap != None) && !priv->unredirected;
}
@@ -190,11 +204,13 @@ meta_surface_actor_x11_process_damage (MetaSurfaceActor *actor,
int x, int y, int width, int height)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
priv->received_damage = TRUE;
- if (meta_window_is_fullscreen (priv->window) && !priv->unredirected && !priv->does_full_damage)
+ if (meta_window_is_fullscreen (priv->window) && !priv->unredirected &&
+ !priv->does_full_damage)
{
MetaRectangle window_rect;
meta_window_get_frame_rect (priv->window, &window_rect);
@@ -222,7 +238,8 @@ static void
meta_surface_actor_x11_pre_paint (MetaSurfaceActor *actor)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
@@ -249,7 +266,8 @@ static gboolean
meta_surface_actor_x11_is_opaque (MetaSurfaceActor *actor)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
/* If we're not ARGB32, then we're opaque. */
if (!meta_surface_actor_is_argb32 (actor))
@@ -266,7 +284,8 @@ meta_surface_actor_x11_is_opaque (MetaSurfaceActor *actor)
meta_window_get_client_area_rect (window, &client_area);
/* Otherwise, check if our opaque region covers our entire surface. */
- if (cairo_region_contains_rectangle (opaque_region, &client_area) == CAIRO_REGION_OVERLAP_IN)
+ if (cairo_region_contains_rectangle (opaque_region,
+ &client_area) == CAIRO_REGION_OVERLAP_IN)
return TRUE;
return FALSE;
@@ -276,7 +295,8 @@ static gboolean
meta_surface_actor_x11_should_unredirect (MetaSurfaceActor *actor)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
MetaWindow *window = priv->window;
@@ -310,7 +330,8 @@ meta_surface_actor_x11_should_unredirect (MetaSurfaceActor *actor)
static void
sync_unredirected (MetaSurfaceActorX11 *self)
{
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
Window xwindow = meta_window_x11_get_toplevel_xwindow (priv->window);
@@ -335,7 +356,8 @@ meta_surface_actor_x11_set_unredirected (MetaSurfaceActor *actor,
gboolean unredirected)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
if (priv->unredirected == unredirected)
return;
@@ -348,7 +370,8 @@ static gboolean
meta_surface_actor_x11_is_unredirected (MetaSurfaceActor *actor)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
return priv->unredirected;
}
@@ -367,7 +390,8 @@ meta_surface_actor_x11_dispose (GObject *object)
static MetaWindow *
meta_surface_actor_x11_get_window (MetaSurfaceActor *actor)
{
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (META_SURFACE_ACTOR_X11 (actor));
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (META_SURFACE_ACTOR_X11 (actor));
return priv->window;
}
@@ -384,8 +408,10 @@ meta_surface_actor_x11_class_init (MetaSurfaceActorX11Class *klass)
surface_actor_class->pre_paint = meta_surface_actor_x11_pre_paint;
surface_actor_class->is_visible = meta_surface_actor_x11_is_visible;
- surface_actor_class->should_unredirect = meta_surface_actor_x11_should_unredirect;
- surface_actor_class->set_unredirected = meta_surface_actor_x11_set_unredirected;
+ surface_actor_class->should_unredirect =
+ meta_surface_actor_x11_should_unredirect;
+ surface_actor_class->set_unredirected =
+ meta_surface_actor_x11_set_unredirected;
surface_actor_class->is_unredirected = meta_surface_actor_x11_is_unredirected;
surface_actor_class->get_window = meta_surface_actor_x11_get_window;
@@ -394,7 +420,8 @@ meta_surface_actor_x11_class_init (MetaSurfaceActorX11Class *klass)
static void
meta_surface_actor_x11_init (MetaSurfaceActorX11 *self)
{
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
priv->last_width = -1;
priv->last_height = -1;
@@ -403,8 +430,10 @@ meta_surface_actor_x11_init (MetaSurfaceActorX11 *self)
static void
create_damage (MetaSurfaceActorX11 *self)
{
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
- Display *xdisplay = meta_x11_display_get_xdisplay (priv->display->x11_display);
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
+ Display *xdisplay =
+ meta_x11_display_get_xdisplay (priv->display->x11_display);
Window xwindow = meta_window_x11_get_toplevel_xwindow (priv->window);
priv->damage = XDamageCreate (xdisplay, xwindow, XDamageReportBoundingBox);
@@ -425,8 +454,10 @@ window_decorated_notify (MetaWindow *window,
static void
reset_texture (MetaSurfaceActorX11 *self)
{
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
- MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
+ MetaShapedTexture *stex =
+ meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
if (!priv->texture)
return;
@@ -442,7 +473,8 @@ MetaSurfaceActor *
meta_surface_actor_x11_new (MetaWindow *window)
{
MetaSurfaceActorX11 *self = g_object_new (META_TYPE_SURFACE_ACTOR_X11, NULL);
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = meta_window_get_display (window);
g_assert (!meta_is_wayland_compositor ());
@@ -468,8 +500,10 @@ void
meta_surface_actor_x11_set_size (MetaSurfaceActorX11 *self,
int width, int height)
{
- MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
- MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
+ MetaSurfaceActorX11Private *priv =
+ meta_surface_actor_x11_get_instance_private (self);
+ MetaShapedTexture *stex =
+ meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
if (priv->last_width == width &&
priv->last_height == height)
diff --git a/src/compositor/meta-surface-actor.c b/src/compositor/meta-surface-actor.c
index 256215373..67ae5e61a 100644
--- a/src/compositor/meta-surface-actor.c
+++ b/src/compositor/meta-surface-actor.c
@@ -31,11 +31,14 @@ struct _MetaSurfaceActorPrivate
static void cullable_iface_init (MetaCullableInterface *iface);
-G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaSurfaceActor, meta_surface_actor, CLUTTER_TYPE_ACTOR,
+G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaSurfaceActor, meta_surface_actor,
+ CLUTTER_TYPE_ACTOR,
G_ADD_PRIVATE (MetaSurfaceActor)
- G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
+ G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE,
+ cullable_iface_init));
-enum {
+enum
+{
REPAINT_SCHEDULED,
SIZE_CHANGED,
@@ -88,7 +91,8 @@ meta_surface_actor_pick (ClutterActor *actor,
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
fb = cogl_get_draw_framebuffer ();
- cogl_color_init_from_4ub (&cogl_color, color->red, color->green, color->blue, color->alpha);
+ cogl_color_init_from_4ub (&cogl_color, color->red, color->green,
+ color->blue, color->alpha);
pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_color (pipeline, &cogl_color);
@@ -277,7 +281,10 @@ meta_surface_actor_process_damage (MetaSurfaceActor *self,
* any drawing done to the window is always immediately reflected in the
* texture regardless of damage event handling.
*/
- cairo_rectangle_int_t rect = { .x = x, .y = y, .width = width, .height = height };
+ cairo_rectangle_int_t rect =
+ {
+ .x = x, .y = y, .width = width, .height = height
+ };
if (!priv->pending_damage)
priv->pending_damage = cairo_region_create_rectangle (&rect);
@@ -286,7 +293,8 @@ meta_surface_actor_process_damage (MetaSurfaceActor *self,
return;
}
- META_SURFACE_ACTOR_GET_CLASS (self)->process_damage (self, x, y, width, height);
+ META_SURFACE_ACTOR_GET_CLASS (self)->process_damage (self, x, y, width,
+ height);
if (meta_surface_actor_is_visible (self))
meta_surface_actor_update_area (self, x, y, width, height);
@@ -348,7 +356,8 @@ meta_surface_actor_set_frozen (MetaSurfaceActor *self,
int i, n_rects = cairo_region_num_rectangles (priv->pending_damage);
cairo_rectangle_int_t rect;
- /* Since we ignore damage events while a window is frozen for certain effects
+ /* Since we ignore damage events while a window is frozen for certain
+ * effects
* we need to apply the tracked damage now. */
for (i = 0; i < n_rects; i++)
diff --git a/src/compositor/meta-sync-ring.c b/src/compositor/meta-sync-ring.c
index c354992cf..7cd3e827f 100644
--- a/src/compositor/meta-sync-ring.c
+++ b/src/compositor/meta-sync-ring.c
@@ -104,23 +104,23 @@ static MetaSyncRing meta_sync_ring = { 0 };
static XSyncValue SYNC_VALUE_ZERO;
static XSyncValue SYNC_VALUE_ONE;
-static const char* (*meta_gl_get_string) (GLenum name);
-static void (*meta_gl_get_integerv) (GLenum pname,
- GLint *params);
-static const char* (*meta_gl_get_stringi) (GLenum name,
- GLuint index);
-static void (*meta_gl_delete_sync) (GLsync sync);
-static GLenum (*meta_gl_client_wait_sync) (GLsync sync,
- GLbitfield flags,
- GLuint64 timeout);
-static void (*meta_gl_wait_sync) (GLsync sync,
- GLbitfield flags,
- GLuint64 timeout);
-static GLsync (*meta_gl_import_sync) (GLenum external_sync_type,
- GLintptr external_sync,
- GLbitfield flags);
-static GLsync (*meta_gl_fence_sync) (GLenum condition,
- GLbitfield flags);
+static const char * (*meta_gl_get_string) (GLenum name);
+static void (*meta_gl_get_integerv) (GLenum pname,
+ GLint *params);
+static const char * (*meta_gl_get_stringi) (GLenum name,
+ GLuint index);
+static void (*meta_gl_delete_sync) (GLsync sync);
+static GLenum (*meta_gl_client_wait_sync) (GLsync sync,
+ GLbitfield flags,
+ GLuint64 timeout);
+static void (*meta_gl_wait_sync) (GLsync sync,
+ GLbitfield flags,
+ GLuint64 timeout);
+static GLsync (*meta_gl_import_sync) (GLenum external_sync_type,
+ GLintptr external_sync,
+ GLbitfield flags);
+static GLsync (*meta_gl_fence_sync) (GLenum condition,
+ GLbitfield flags);
static MetaSyncRing *
meta_sync_ring_get (void)
@@ -132,13 +132,14 @@ meta_sync_ring_get (void)
}
static gboolean
-load_gl_symbol (const char *name,
- void **func)
+load_gl_symbol (const char *name,
+ void **func)
{
*func = cogl_get_proc_address (name);
if (!*func)
{
- meta_verbose ("MetaSyncRing: failed to resolve required GL symbol \"%s\"\n", name);
+ meta_verbose (
+ "MetaSyncRing: failed to resolve required GL symbol \"%s\"\n", name);
return FALSE;
}
return TRUE;
@@ -160,32 +161,32 @@ check_gl_extensions (void)
switch (cogl_renderer_get_driver (cogl_renderer))
{
case COGL_DRIVER_GL3:
- {
- int num_extensions, i;
- gboolean arb_sync = FALSE;
- gboolean x11_sync_object = FALSE;
+ {
+ int num_extensions, i;
+ gboolean arb_sync = FALSE;
+ gboolean x11_sync_object = FALSE;
- meta_gl_get_integerv (GL_NUM_EXTENSIONS, &num_extensions);
+ meta_gl_get_integerv (GL_NUM_EXTENSIONS, &num_extensions);
- for (i = 0; i < num_extensions; ++i)
- {
- const char *ext = meta_gl_get_stringi (GL_EXTENSIONS, i);
+ for (i = 0; i < num_extensions; ++i)
+ {
+ const char *ext = meta_gl_get_stringi (GL_EXTENSIONS, i);
- if (g_strcmp0 ("GL_ARB_sync", ext) == 0)
- arb_sync = TRUE;
- else if (g_strcmp0 ("GL_EXT_x11_sync_object", ext) == 0)
- x11_sync_object = TRUE;
- }
+ if (g_strcmp0 ("GL_ARB_sync", ext) == 0)
+ arb_sync = TRUE;
+ else if (g_strcmp0 ("GL_EXT_x11_sync_object", ext) == 0)
+ x11_sync_object = TRUE;
+ }
- return arb_sync && x11_sync_object;
- }
+ return arb_sync && x11_sync_object;
+ }
case COGL_DRIVER_GL:
- {
- const char *extensions = meta_gl_get_string (GL_EXTENSIONS);
- return (extensions != NULL &&
- strstr (extensions, "GL_ARB_sync") != NULL &&
- strstr (extensions, "GL_EXT_x11_sync_object") != NULL);
- }
+ {
+ const char *extensions = meta_gl_get_string (GL_EXTENSIONS);
+ return (extensions != NULL &&
+ strstr (extensions, "GL_ARB_sync") != NULL &&
+ strstr (extensions, "GL_EXT_x11_sync_object") != NULL);
+ }
default:
break;
}
@@ -231,7 +232,7 @@ load_required_symbols (void)
goto out;
success = TRUE;
- out:
+out:
return success;
}
@@ -321,7 +322,8 @@ meta_sync_new (Display *xdisplay)
self->xdisplay = xdisplay;
- self->xfence = XSyncCreateFence (xdisplay, DefaultRootWindow (xdisplay), FALSE);
+ self->xfence =
+ XSyncCreateFence (xdisplay, DefaultRootWindow (xdisplay), FALSE);
self->gl_x11_sync = 0;
self->gpu_fence = 0;
@@ -351,13 +353,14 @@ static void
meta_sync_import (MetaSync *self)
{
g_return_if_fail (self->gl_x11_sync == 0);
- self->gl_x11_sync = meta_gl_import_sync (GL_SYNC_X11_FENCE_EXT, self->xfence, 0);
+ self->gl_x11_sync = meta_gl_import_sync (GL_SYNC_X11_FENCE_EXT, self->xfence,
+ 0);
}
static Bool
-alarm_event_predicate (Display *dpy,
- XEvent *event,
- XPointer data)
+alarm_event_predicate (Display *dpy,
+ XEvent *event,
+ XPointer data)
{
MetaSyncRing *ring = meta_sync_ring_get ();
@@ -366,7 +369,8 @@ alarm_event_predicate (Display *dpy,
if (event->type == ring->xsync_event_base + XSyncAlarmNotify)
{
- if (((MetaSync *) data)->xalarm == ((XSyncAlarmNotifyEvent *) event)->alarm)
+ if (((MetaSync *) data)->xalarm ==
+ ((XSyncAlarmNotifyEvent *) event)->alarm)
return True;
}
return False;
@@ -389,12 +393,12 @@ meta_sync_free (MetaSync *self)
/* nothing to do */
break;
case META_SYNC_STATE_RESET_PENDING:
- {
- XEvent event;
- XIfEvent (self->xdisplay, &event, alarm_event_predicate, (XPointer) self);
- meta_sync_handle_event (self, (XSyncAlarmNotifyEvent *) &event);
- }
- /* fall through */
+ {
+ XEvent event;
+ XIfEvent (self->xdisplay, &event, alarm_event_predicate, (XPointer) self);
+ meta_sync_handle_event (self, (XSyncAlarmNotifyEvent *) &event);
+ }
+ /* fall through */
case META_SYNC_STATE_READY:
XSyncTriggerFence (self->xdisplay, self->xfence);
XFlush (self->xdisplay);
@@ -427,7 +431,8 @@ meta_sync_ring_init (Display *xdisplay)
if (!load_required_symbols ())
return FALSE;
- if (!XSyncQueryExtension (xdisplay, &ring->xsync_event_base, &ring->xsync_error_base) ||
+ if (!XSyncQueryExtension (xdisplay, &ring->xsync_event_base,
+ &ring->xsync_error_base) ||
!XSyncInitialize (xdisplay, &major, &minor))
return FALSE;
@@ -516,14 +521,17 @@ meta_sync_ring_after_frame (void)
if (ring->warmup_syncs >= NUM_SYNCS / 2)
{
- guint reset_sync_idx = (ring->current_sync_idx + NUM_SYNCS - (NUM_SYNCS / 2)) % NUM_SYNCS;
+ guint reset_sync_idx =
+ (ring->current_sync_idx + NUM_SYNCS - (NUM_SYNCS / 2)) % NUM_SYNCS;
MetaSync *sync_to_reset = ring->syncs_array[reset_sync_idx];
GLenum status = meta_sync_check_update_finished (sync_to_reset, 0);
if (status == GL_TIMEOUT_EXPIRED)
{
- meta_warning ("MetaSyncRing: We should never wait for a sync -- add more syncs?\n");
- status = meta_sync_check_update_finished (sync_to_reset, MAX_SYNC_WAIT_TIME);
+ meta_warning (
+ "MetaSyncRing: We should never wait for a sync -- add more syncs?\n");
+ status = meta_sync_check_update_finished (sync_to_reset,
+ MAX_SYNC_WAIT_TIME);
}
if (status != GL_ALREADY_SIGNALED && status != GL_CONDITION_SATISFIED)
@@ -559,7 +567,8 @@ meta_sync_ring_insert_wait (void)
if (ring->current_sync->state != META_SYNC_STATE_READY)
{
- meta_warning ("MetaSyncRing: Sync object is not ready -- were events handled properly?\n");
+ meta_warning (
+ "MetaSyncRing: Sync object is not ready -- were events handled properly?\n");
if (!meta_sync_ring_reboot (ring->xdisplay))
return FALSE;
}
diff --git a/src/compositor/meta-texture-rectangle.c b/src/compositor/meta-texture-rectangle.c
index 6a01ed002..cf962898f 100644
--- a/src/compositor/meta-texture-rectangle.c
+++ b/src/compositor/meta-texture-rectangle.c
@@ -30,7 +30,7 @@ static void
texture_rectangle_check_cb (CoglTexture *sub_texture,
const float *sub_texture_coords,
const float *meta_coords,
- void *user_data)
+ void *user_data)
{
gboolean *result = user_data;
diff --git a/src/compositor/meta-texture-tower.c b/src/compositor/meta-texture-tower.c
index a41cdc89d..df084dc4c 100644
--- a/src/compositor/meta-texture-tower.c
+++ b/src/compositor/meta-texture-tower.c
@@ -154,8 +154,10 @@ meta_texture_tower_set_base_texture (MetaTextureTower *tower,
width = cogl_texture_get_width (tower->textures[0]);
height = cogl_texture_get_height (tower->textures[0]);
- tower->n_levels = 1 + MAX ((int)(M_LOG2E * log (width)), (int)(M_LOG2E * log (height)));
- tower->n_levels = MIN(tower->n_levels, MAX_TEXTURE_LEVELS);
+ tower->n_levels = 1 +
+ MAX ((int) (M_LOG2E * log (width)),
+ (int) (M_LOG2E * log (height)));
+ tower->n_levels = MIN (tower->n_levels, MAX_TEXTURE_LEVELS);
meta_texture_tower_update_area (tower, 0, 0, width, height);
}
@@ -290,41 +292,42 @@ get_paint_level (int width, int height)
/* We'll simplify the equations below for a bit of micro-optimization.
* The commented out code is the unsimplified version.
-
- // Partial derivates of window coordinates:
- //
- // x_w = 0.5 * viewport_width * x_c / w_c + viewport_center_x
- // y_w = 0.5 * viewport_height * y_c / w_c + viewport_center_y
- //
- // with respect to u, v, using
- // d(a/b)/dx = da/dx * (1/b) - a * db/dx / (b^2)
-
- dxdu = 0.5 * viewport_width * (pm.xx - pm.wx * (xc/wc)) / wc;
- dxdv = 0.5 * viewport_width * (pm.xy - pm.wy * (xc/wc)) / wc;
- dydu = 0.5 * viewport_height * (pm.yx - pm.wx * (yc/wc)) / wc;
- dydv = 0.5 * viewport_height * (pm.yy - pm.wy * (yc/wc)) / wc;
-
- // Compute the inverse partials as the matrix inverse
- det = dxdu * dydv - dxdv * dydu;
-
- dudx = dydv / det;
- dudy = - dxdv / det;
- dvdx = - dydu / det;
- dvdy = dvdu / det;
-
- // Scale factor; maximum of the distance in texels for a change of 1 pixel
- // in the X direction or 1 pixel in the Y direction
- rho = MAX (sqrt (dudx * dudx + dvdx * dvdx), sqrt(dudy * dudy + dvdy * dvdy));
-
- // Level of detail
- lambda = log2 (rho) + LOD_BIAS;
- */
+ *
+ * // Partial derivates of window coordinates:
+ * //
+ * // x_w = 0.5 * viewport_width * x_c / w_c + viewport_center_x
+ * // y_w = 0.5 * viewport_height * y_c / w_c + viewport_center_y
+ * //
+ * // with respect to u, v, using
+ * // d(a/b)/dx = da/dx * (1/b) - a * db/dx / (b^2)
+ *
+ * dxdu = 0.5 * viewport_width * (pm.xx - pm.wx * (xc/wc)) / wc;
+ * dxdv = 0.5 * viewport_width * (pm.xy - pm.wy * (xc/wc)) / wc;
+ * dydu = 0.5 * viewport_height * (pm.yx - pm.wx * (yc/wc)) / wc;
+ * dydv = 0.5 * viewport_height * (pm.yy - pm.wy * (yc/wc)) / wc;
+ *
+ * // Compute the inverse partials as the matrix inverse
+ * det = dxdu * dydv - dxdv * dydu;
+ *
+ * dudx = dydv / det;
+ * dudy = - dxdv / det;
+ * dvdx = - dydu / det;
+ * dvdy = dvdu / det;
+ *
+ * // Scale factor; maximum of the distance in texels for a change of 1 pixel
+ * // in the X direction or 1 pixel in the Y direction
+ * rho = MAX (sqrt (dudx * dudx + dvdx * dvdx), sqrt(dudy * dudy + dvdy *
+ *dvdy));
+ *
+ * // Level of detail
+ * lambda = log2 (rho) + LOD_BIAS;
+ */
/* dxdu * wc, etc */
- dxdu_ = 0.5 * viewport_width * (pm.xx - pm.wx * (xc/wc));
- dxdv_ = 0.5 * viewport_width * (pm.xy - pm.wy * (xc/wc));
- dydu_ = 0.5 * viewport_height * (pm.yx - pm.wx * (yc/wc));
- dydv_ = 0.5 * viewport_height * (pm.yy - pm.wy * (yc/wc));
+ dxdu_ = 0.5 * viewport_width * (pm.xx - pm.wx * (xc / wc));
+ dxdv_ = 0.5 * viewport_width * (pm.xy - pm.wy * (xc / wc));
+ dydu_ = 0.5 * viewport_height * (pm.yx - pm.wx * (yc / wc));
+ dydv_ = 0.5 * viewport_height * (pm.yy - pm.wy * (yc / wc));
/* det * wc^2 */
det_ = dxdu_ * dydv_ - dxdv_ * dydu_;
@@ -337,13 +340,14 @@ get_paint_level (int width, int height)
lambda = 0.5 * M_LOG2E * log (rho_sq * wc * wc / det_sq) + LOD_BIAS;
#if 0
- g_print ("%g %g %g\n", 0.5 * viewport_width * pm.xx / pm.ww, 0.5 * viewport_height * pm.yy / pm.ww, lambda);
+ g_print ("%g %g %g\n", 0.5 * viewport_width * pm.xx / pm.ww,
+ 0.5 * viewport_height * pm.yy / pm.ww, lambda);
#endif
if (lambda <= 0.)
return 0;
else
- return (int)(0.5 + lambda);
+ return (int) (0.5 + lambda);
}
static gboolean
@@ -365,7 +369,8 @@ texture_tower_create_texture (MetaTextureTower *tower,
CoglContext *context = clutter_backend_get_cogl_context (backend);
CoglTextureRectangle *texture_rectangle;
- texture_rectangle = cogl_texture_rectangle_new_with_size (context, width, height);
+ texture_rectangle = cogl_texture_rectangle_new_with_size (context, width,
+ height);
tower->textures[level] = COGL_TEXTURE (texture_rectangle);
}
else
@@ -407,14 +412,16 @@ texture_tower_revalidate (MetaTextureTower *tower,
return;
}
- cogl_framebuffer_orthographic (fb, 0, 0, dest_texture_width, dest_texture_height, -1., 1.);
+ cogl_framebuffer_orthographic (fb, 0, 0, dest_texture_width,
+ dest_texture_height, -1., 1.);
if (!tower->pipeline_template)
{
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
tower->pipeline_template = cogl_pipeline_new (ctx);
- cogl_pipeline_set_blend (tower->pipeline_template, "RGBA = ADD (SRC_COLOR, 0)", NULL);
+ cogl_pipeline_set_blend (tower->pipeline_template,
+ "RGBA = ADD (SRC_COLOR, 0)", NULL);
}
pipeline = cogl_pipeline_copy (tower->pipeline_template);
@@ -426,7 +433,8 @@ texture_tower_revalidate (MetaTextureTower *tower,
(2. * invalid->x1) / source_texture_width,
(2. * invalid->y1) / source_texture_height,
(2. * invalid->x2) / source_texture_width,
- (2. * invalid->y2) / source_texture_height);
+ (2. * invalid->y2) /
+ source_texture_height);
cogl_object_unref (pipeline);
@@ -461,7 +469,7 @@ meta_texture_tower_get_paint_texture (MetaTextureTower *tower)
texture_width = cogl_texture_get_width (tower->textures[0]);
texture_height = cogl_texture_get_height (tower->textures[0]);
- level = get_paint_level(texture_width, texture_height);
+ level = get_paint_level (texture_width, texture_height);
if (level < 0) /* singular paint matrix, scaled to nothing */
return NULL;
level = MIN (level, tower->n_levels - 1);
@@ -473,22 +481,24 @@ meta_texture_tower_get_paint_texture (MetaTextureTower *tower)
int i;
for (i = 1; i <= level; i++)
- {
- /* Use "floor" convention here to be consistent with the NPOT texture extension */
- texture_width = MAX (1, texture_width / 2);
- texture_height = MAX (1, texture_height / 2);
-
- if (tower->textures[i] == NULL)
- texture_tower_create_texture (tower, i, texture_width, texture_height);
- }
+ {
+ /* Use "floor" convention here to be consistent with the NPOT texture
+ * extension */
+ texture_width = MAX (1, texture_width / 2);
+ texture_height = MAX (1, texture_height / 2);
+
+ if (tower->textures[i] == NULL)
+ texture_tower_create_texture (tower, i, texture_width,
+ texture_height);
+ }
for (i = 1; i <= level; i++)
- {
- if (tower->invalid[level].x2 != tower->invalid[level].x1 &&
- tower->invalid[level].y2 != tower->invalid[level].y1)
- texture_tower_revalidate (tower, i);
- }
- }
+ {
+ if (tower->invalid[level].x2 != tower->invalid[level].x1 &&
+ tower->invalid[level].y2 != tower->invalid[level].y1)
+ texture_tower_revalidate (tower, i);
+ }
+ }
return tower->textures[level];
}
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 219226b19..ed58b5175 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -3,7 +3,8 @@
/**
* SECTION:meta-window-actor
* @title: MetaWindowActor
- * @short_description: An actor representing a top-level window in the scene graph
+ * @short_description: An actor representing a top-level window in the scene
+ *graph
*/
#include "config.h"
@@ -40,7 +41,8 @@
#include "wayland/meta-wayland-surface.h"
#endif
-typedef enum {
+typedef enum
+{
INITIALLY_FROZEN,
DRAWING_FIRST_FRAME,
EMITTED_FIRST_FRAME
@@ -64,68 +66,70 @@ struct _MetaWindowActorPrivate
* size-invariant window shape, we'll often find that the new shadow
* is the same as the old shadow.
*/
- MetaShadow *focused_shadow;
- MetaShadow *unfocused_shadow;
+ MetaShadow *focused_shadow;
+ MetaShadow *unfocused_shadow;
/* A region that matches the shape of the window, including frame bounds */
- cairo_region_t *shape_region;
+ cairo_region_t *shape_region;
/* The region we should clip to when painting the shadow */
- cairo_region_t *shadow_clip;
+ cairo_region_t *shadow_clip;
/* Extracted size-invariant shape used for shadows */
- MetaWindowShape *shadow_shape;
- char * shadow_class;
+ MetaWindowShape *shadow_shape;
+ char *shadow_class;
- MetaShadowMode shadow_mode;
+ MetaShadowMode shadow_mode;
- guint send_frame_messages_timer;
- gint64 frame_drawn_time;
+ guint send_frame_messages_timer;
+ gint64 frame_drawn_time;
- guint repaint_scheduled_id;
- guint size_changed_id;
+ guint repaint_scheduled_id;
+ guint size_changed_id;
/*
* These need to be counters rather than flags, since more plugins
* can implement same effect; the practicality of stacking effects
* might be dubious, but we have to at least handle it correctly.
*/
- gint minimize_in_progress;
- gint unminimize_in_progress;
- gint size_change_in_progress;
- gint map_in_progress;
- gint destroy_in_progress;
+ gint minimize_in_progress;
+ gint unminimize_in_progress;
+ gint size_change_in_progress;
+ gint map_in_progress;
+ gint destroy_in_progress;
/* List of FrameData for recent frames */
- GList *frames;
- guint freeze_count;
+ GList *frames;
+ guint freeze_count;
- guint visible : 1;
- guint disposed : 1;
+ guint visible : 1;
+ guint disposed : 1;
/* If set, the client needs to be sent a _NET_WM_FRAME_DRAWN
* client message for one or more messages in ->frames */
- guint needs_frame_drawn : 1;
- guint repaint_scheduled : 1;
+ guint needs_frame_drawn : 1;
+ guint repaint_scheduled : 1;
- guint needs_reshape : 1;
- guint recompute_focused_shadow : 1;
- guint recompute_unfocused_shadow : 1;
+ guint needs_reshape : 1;
+ guint recompute_focused_shadow : 1;
+ guint recompute_unfocused_shadow : 1;
- guint needs_destroy : 1;
+ guint needs_destroy : 1;
- guint updates_frozen : 1;
- guint first_frame_state : 2; /* FirstFrameState */
+ guint updates_frozen : 1;
+ guint first_frame_state : 2; /* FirstFrameState */
};
typedef struct _FrameData FrameData;
-/* Each time the application updates the sync request counter to a new even value
+/* Each time the application updates the sync request counter to a new even
+ * value
* value, we queue a frame into the windows list of frames. Once we're painting
* an update "in response" to the window, we fill in frame_counter with the
* Cogl counter for that frame, and send _NET_WM_FRAME_DRAWN at the end of the
* frame. _NET_WM_FRAME_TIMINGS is sent when we get a frame_complete callback.
*
- * As an exception, if a window is completely obscured, we try to throttle drawning
+ * As an exception, if a window is completely obscured, we try to throttle
+ *drawning
* to a slower frame rate. In this case, frame_counter stays -1 until
* send_frame_message_timeout() runs, at which point we send both the
* _NET_WM_FRAME_DRAWN and _NET_WM_FRAME_TIMINGS messages.
@@ -154,17 +158,17 @@ enum
PROP_SHADOW_CLASS
};
-static void meta_window_actor_dispose (GObject *object);
-static void meta_window_actor_finalize (GObject *object);
+static void meta_window_actor_dispose (GObject *object);
+static void meta_window_actor_finalize (GObject *object);
static void meta_window_actor_constructed (GObject *object);
-static void meta_window_actor_set_property (GObject *object,
+static void meta_window_actor_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
-static void meta_window_actor_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
+static void meta_window_actor_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
static void meta_window_actor_paint (ClutterActor *actor);
@@ -179,8 +183,8 @@ static void meta_window_actor_handle_updates (MetaWindowActor *self);
static void check_needs_reshape (MetaWindowActor *self);
static void do_send_frame_drawn (MetaWindowActor *self, FrameData *frame);
-static void do_send_frame_timings (MetaWindowActor *self,
- FrameData *frame,
+static void do_send_frame_timings (MetaWindowActor *self,
+ FrameData *frame,
gint refresh_interval,
gint64 presentation_time);
@@ -188,7 +192,8 @@ static void cullable_iface_init (MetaCullableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaWindowActor, meta_window_actor, CLUTTER_TYPE_ACTOR,
G_ADD_PRIVATE (MetaWindowActor)
- G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
+ G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE,
+ cullable_iface_init));
static void
frame_data_free (FrameData *frame)
@@ -201,13 +206,13 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
- GParamSpec *pspec;
+ GParamSpec *pspec;
- object_class->dispose = meta_window_actor_dispose;
- object_class->finalize = meta_window_actor_finalize;
+ object_class->dispose = meta_window_actor_dispose;
+ object_class->finalize = meta_window_actor_finalize;
object_class->set_property = meta_window_actor_set_property;
object_class->get_property = meta_window_actor_get_property;
- object_class->constructed = meta_window_actor_constructed;
+ object_class->constructed = meta_window_actor_constructed;
actor_class->paint = meta_window_actor_paint;
actor_class->get_paint_volume = meta_window_actor_get_paint_volume;
@@ -290,8 +295,8 @@ meta_window_actor_init (MetaWindowActor *self)
MetaWindowActorPrivate *priv;
priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
- META_TYPE_WINDOW_ACTOR,
- MetaWindowActorPrivate);
+ META_TYPE_WINDOW_ACTOR,
+ MetaWindowActorPrivate);
priv->shadow_class = NULL;
}
@@ -328,9 +333,9 @@ is_argb32 (MetaWindowActor *self)
MetaWindowActorPrivate *priv = self->priv;
/* assume we're argb until we get the window (because
- in practice we're drawing nothing, so we're fully
- transparent)
- */
+ * in practice we're drawing nothing, so we're fully
+ * transparent)
+ */
if (priv->surface)
return meta_surface_actor_is_argb32 (priv->surface);
else
@@ -362,7 +367,7 @@ meta_window_actor_freeze (MetaWindowActor *self)
if (priv->freeze_count == 0 && priv->surface)
meta_surface_actor_set_frozen (priv->surface, TRUE);
- priv->freeze_count ++;
+ priv->freeze_count++;
}
static void
@@ -414,7 +419,8 @@ set_surface (MetaWindowActor *self,
g_signal_handler_disconnect (priv->surface, priv->repaint_scheduled_id);
g_signal_handler_disconnect (priv->surface, priv->size_changed_id);
priv->repaint_scheduled_id = 0;
- clutter_actor_remove_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));
+ clutter_actor_remove_child (CLUTTER_ACTOR (self),
+ CLUTTER_ACTOR (priv->surface));
g_object_unref (priv->surface);
}
@@ -423,11 +429,16 @@ set_surface (MetaWindowActor *self,
if (priv->surface)
{
g_object_ref_sink (priv->surface);
- priv->repaint_scheduled_id = g_signal_connect (priv->surface, "repaint-scheduled",
- G_CALLBACK (surface_repaint_scheduled), self);
+ priv->repaint_scheduled_id = g_signal_connect (priv->surface,
+ "repaint-scheduled",
+ G_CALLBACK (
+ surface_repaint_scheduled),
+ self);
priv->size_changed_id = g_signal_connect (priv->surface, "size-changed",
- G_CALLBACK (surface_size_changed), self);
- clutter_actor_add_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));
+ G_CALLBACK (
+ surface_size_changed), self);
+ clutter_actor_add_child (CLUTTER_ACTOR (self),
+ CLUTTER_ACTOR (priv->surface));
meta_window_actor_update_shape (self);
@@ -502,7 +513,8 @@ meta_window_actor_dispose (GObject *object)
g_clear_pointer (&priv->unfocused_shadow, meta_shadow_unref);
g_clear_pointer (&priv->shadow_shape, meta_window_shape_unref);
- compositor->windows = g_list_remove (compositor->windows, (gconstpointer) self);
+ compositor->windows =
+ g_list_remove (compositor->windows, (gconstpointer) self);
g_clear_object (&priv->window);
@@ -514,7 +526,7 @@ meta_window_actor_dispose (GObject *object)
static void
meta_window_actor_finalize (GObject *object)
{
- MetaWindowActor *self = META_WINDOW_ACTOR (object);
+ MetaWindowActor *self = META_WINDOW_ACTOR (object);
MetaWindowActorPrivate *priv = self->priv;
g_list_free_full (priv->frames, (GDestroyNotify) frame_data_free);
@@ -528,7 +540,7 @@ meta_window_actor_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- MetaWindowActor *self = META_WINDOW_ACTOR (object);
+ MetaWindowActor *self = META_WINDOW_ACTOR (object);
MetaWindowActorPrivate *priv = self->priv;
switch (prop_id)
@@ -536,33 +548,34 @@ meta_window_actor_set_property (GObject *object,
case PROP_META_WINDOW:
priv->window = g_value_dup_object (value);
g_signal_connect_object (priv->window, "notify::appears-focused",
- G_CALLBACK (window_appears_focused_notify), self, 0);
+ G_CALLBACK (
+ window_appears_focused_notify), self, 0);
break;
case PROP_SHADOW_MODE:
- {
- MetaShadowMode newv = g_value_get_enum (value);
+ {
+ MetaShadowMode newv = g_value_get_enum (value);
- if (newv == priv->shadow_mode)
- return;
+ if (newv == priv->shadow_mode)
+ return;
- priv->shadow_mode = newv;
+ priv->shadow_mode = newv;
- meta_window_actor_invalidate_shadow (self);
- }
- break;
+ meta_window_actor_invalidate_shadow (self);
+ }
+ break;
case PROP_SHADOW_CLASS:
- {
- const char *newv = g_value_get_string (value);
+ {
+ const char *newv = g_value_get_string (value);
- if (g_strcmp0 (newv, priv->shadow_class) == 0)
- return;
+ if (g_strcmp0 (newv, priv->shadow_class) == 0)
+ return;
- g_free (priv->shadow_class);
- priv->shadow_class = g_strdup (newv);
+ g_free (priv->shadow_class);
+ priv->shadow_class = g_strdup (newv);
- meta_window_actor_invalidate_shadow (self);
- }
- break;
+ meta_window_actor_invalidate_shadow (self);
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -570,10 +583,10 @@ meta_window_actor_set_property (GObject *object,
}
static void
-meta_window_actor_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+meta_window_actor_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
MetaWindowActorPrivate *priv = META_WINDOW_ACTOR (object)->priv;
@@ -613,10 +626,10 @@ meta_window_actor_get_shadow_class (MetaWindowActor *self)
case META_WINDOW_POPUP_MENU:
return "popup-menu";
default:
- {
- MetaFrameType frame_type = meta_window_get_frame_type (priv->window);
- return meta_frame_type_to_string (frame_type);
- }
+ {
+ MetaFrameType frame_type = meta_window_get_frame_type (priv->window);
+ return meta_frame_type_to_string (frame_type);
+ }
}
}
}
@@ -648,7 +661,8 @@ meta_window_actor_get_shadow_bounds (MetaWindowActor *self,
cairo_rectangle_int_t *bounds)
{
MetaWindowActorPrivate *priv = self->priv;
- MetaShadow *shadow = appears_focused ? priv->focused_shadow : priv->unfocused_shadow;
+ MetaShadow *shadow =
+ appears_focused ? priv->focused_shadow : priv->unfocused_shadow;
cairo_rectangle_int_t shape_bounds;
MetaShadowParams params;
@@ -712,12 +726,13 @@ meta_window_actor_paint (ClutterActor *actor)
MetaWindowActor *self = META_WINDOW_ACTOR (actor);
MetaWindowActorPrivate *priv = self->priv;
gboolean appears_focused = meta_window_appears_focused (priv->window);
- MetaShadow *shadow = appears_focused ? priv->focused_shadow : priv->unfocused_shadow;
+ MetaShadow *shadow =
+ appears_focused ? priv->focused_shadow : priv->unfocused_shadow;
- /* This window got damage when obscured; we set up a timer
- * to send frame completion events, but since we're drawing
- * the window now (for some other reason) cancel the timer
- * and send the completion events normally */
+ /* This window got damage when obscured; we set up a timer
+ * to send frame completion events, but since we're drawing
+ * the window now (for some other reason) cancel the timer
+ * and send the completion events normally */
if (priv->send_frame_messages_timer != 0)
{
g_source_remove (priv->send_frame_messages_timer);
@@ -741,7 +756,8 @@ meta_window_actor_paint (ClutterActor *actor)
*/
if (!clip && clip_shadow_under_window (self))
{
- cairo_region_t *frame_bounds = meta_window_get_frame_bounds (priv->window);
+ cairo_region_t *frame_bounds = meta_window_get_frame_bounds (
+ priv->window);
cairo_rectangle_int_t bounds;
meta_window_actor_get_shadow_bounds (self, appears_focused, &bounds);
@@ -755,9 +771,12 @@ meta_window_actor_paint (ClutterActor *actor)
params.y_offset + shape_bounds.y,
shape_bounds.width,
shape_bounds.height,
- (clutter_actor_get_paint_opacity (actor) * params.opacity * window->opacity) / (255 * 255),
+ (clutter_actor_get_paint_opacity (actor) *
+ params.opacity * window->opacity) / (255 * 255),
clip,
- clip_shadow_under_window (self)); /* clip_strictly - not just as an optimization */
+ clip_shadow_under_window (self)); /* clip_strictly -
+ * not just as an
+ * optimization */
if (clip && clip != priv->shadow_clip)
cairo_region_destroy (clip);
@@ -790,7 +809,8 @@ meta_window_actor_get_paint_volume (ClutterActor *actor,
* at all.
*/
- meta_window_actor_get_shadow_bounds (self, appears_focused, &shadow_bounds);
+ meta_window_actor_get_shadow_bounds (self, appears_focused,
+ &shadow_bounds);
shadow_box.x1 = shadow_bounds.x;
shadow_box.x2 = shadow_bounds.x + shadow_bounds.width;
shadow_box.y1 = shadow_bounds.y;
@@ -803,7 +823,9 @@ meta_window_actor_get_paint_volume (ClutterActor *actor,
{
const ClutterPaintVolume *child_volume;
- child_volume = clutter_actor_get_transformed_paint_volume (CLUTTER_ACTOR (priv->surface), actor);
+ child_volume =
+ clutter_actor_get_transformed_paint_volume (CLUTTER_ACTOR (
+ priv->surface), actor);
if (!child_volume)
return FALSE;
@@ -989,15 +1011,21 @@ queue_send_frame_messages_timeout (MetaWindowActor *self)
current_time =
meta_compositor_monotonic_time_to_server_time (display,
g_get_monotonic_time ());
- interval = (int)(1000000 / refresh_rate) * 6;
+ interval = (int) (1000000 / refresh_rate) * 6;
offset = MAX (0, priv->frame_drawn_time + interval - current_time) / 1000;
- /* The clutter master clock source has already been added with META_PRIORITY_REDRAW,
- * so the timer will run *after* the clutter frame handling, if a frame is ready
- * to be drawn when the timer expires.
- */
- priv->send_frame_messages_timer = g_timeout_add_full (META_PRIORITY_REDRAW, offset, send_frame_messages_timeout, self, NULL);
- g_source_set_name_by_id (priv->send_frame_messages_timer, "[mutter] send_frame_messages_timeout");
+ /* The clutter master clock source has already been added with
+ * META_PRIORITY_REDRAW,
+ * so the timer will run *after* the clutter frame handling, if a frame is
+ *ready
+ * to be drawn when the timer expires.
+ */
+ priv->send_frame_messages_timer = g_timeout_add_full (META_PRIORITY_REDRAW,
+ offset,
+ send_frame_messages_timeout, self,
+ NULL);
+ g_source_set_name_by_id (priv->send_frame_messages_timer,
+ "[mutter] send_frame_messages_timeout");
}
void
@@ -1051,7 +1079,8 @@ meta_window_actor_queue_frame_drawn (MetaWindowActor *self,
if (priv->surface)
{
const cairo_rectangle_int_t clip = { 0, 0, 1, 1 };
- clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (priv->surface), &clip);
+ clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (
+ priv->surface), &clip);
priv->repaint_scheduled = TRUE;
}
}
@@ -1062,28 +1091,28 @@ gboolean
meta_window_actor_effect_in_progress (MetaWindowActor *self)
{
return (self->priv->minimize_in_progress ||
- self->priv->size_change_in_progress ||
- self->priv->map_in_progress ||
- self->priv->destroy_in_progress);
+ self->priv->size_change_in_progress ||
+ self->priv->map_in_progress ||
+ self->priv->destroy_in_progress);
}
static gboolean
is_freeze_thaw_effect (MetaPluginEffect event)
{
switch (event)
- {
- case META_PLUGIN_DESTROY:
- case META_PLUGIN_SIZE_CHANGE:
- return TRUE;
- break;
- default:
- return FALSE;
- }
+ {
+ case META_PLUGIN_DESTROY:
+ case META_PLUGIN_SIZE_CHANGE:
+ return TRUE;
+ break;
+ default:
+ return FALSE;
+ }
}
static gboolean
-start_simple_effect (MetaWindowActor *self,
- MetaPluginEffect event)
+start_simple_effect (MetaWindowActor *self,
+ MetaPluginEffect event)
{
MetaWindowActorPrivate *priv = self->priv;
MetaCompositor *compositor = priv->compositor;
@@ -1093,26 +1122,26 @@ start_simple_effect (MetaWindowActor *self,
g_assert (compositor->plugin_mgr != NULL);
switch (event)
- {
- case META_PLUGIN_NONE:
- return FALSE;
- case META_PLUGIN_MINIMIZE:
- counter = &priv->minimize_in_progress;
- break;
- case META_PLUGIN_UNMINIMIZE:
- counter = &priv->unminimize_in_progress;
- break;
- case META_PLUGIN_MAP:
- counter = &priv->map_in_progress;
- break;
- case META_PLUGIN_DESTROY:
- counter = &priv->destroy_in_progress;
- break;
- case META_PLUGIN_SIZE_CHANGE:
- case META_PLUGIN_SWITCH_WORKSPACE:
- g_assert_not_reached ();
- break;
- }
+ {
+ case META_PLUGIN_NONE:
+ return FALSE;
+ case META_PLUGIN_MINIMIZE:
+ counter = &priv->minimize_in_progress;
+ break;
+ case META_PLUGIN_UNMINIMIZE:
+ counter = &priv->unminimize_in_progress;
+ break;
+ case META_PLUGIN_MAP:
+ counter = &priv->map_in_progress;
+ break;
+ case META_PLUGIN_DESTROY:
+ counter = &priv->destroy_in_progress;
+ break;
+ case META_PLUGIN_SIZE_CHANGE:
+ case META_PLUGIN_SWITCH_WORKSPACE:
+ g_assert_not_reached ();
+ break;
+ }
g_assert (counter);
@@ -1151,10 +1180,10 @@ meta_window_actor_after_effects (MetaWindowActor *self)
}
void
-meta_window_actor_effect_completed (MetaWindowActor *self,
- MetaPluginEffect event)
+meta_window_actor_effect_completed (MetaWindowActor *self,
+ MetaPluginEffect event)
{
- MetaWindowActorPrivate *priv = self->priv;
+ MetaWindowActorPrivate *priv = self->priv;
gboolean inconsistent = FALSE;
/* NB: Keep in mind that when effects get completed it possible
@@ -1162,68 +1191,68 @@ meta_window_actor_effect_completed (MetaWindowActor *self,
* In this case priv->window will == NULL */
switch (event)
- {
- case META_PLUGIN_NONE:
- break;
- case META_PLUGIN_MINIMIZE:
+ {
+ case META_PLUGIN_NONE:
+ break;
+ case META_PLUGIN_MINIMIZE:
{
priv->minimize_in_progress--;
if (priv->minimize_in_progress < 0)
- {
- g_warning ("Error in minimize accounting.");
- priv->minimize_in_progress = 0;
+ {
+ g_warning ("Error in minimize accounting.");
+ priv->minimize_in_progress = 0;
inconsistent = TRUE;
- }
+ }
}
break;
- case META_PLUGIN_UNMINIMIZE:
+ case META_PLUGIN_UNMINIMIZE:
{
priv->unminimize_in_progress--;
if (priv->unminimize_in_progress < 0)
- {
- g_warning ("Error in unminimize accounting.");
- priv->unminimize_in_progress = 0;
- inconsistent = TRUE;
- }
+ {
+ g_warning ("Error in unminimize accounting.");
+ priv->unminimize_in_progress = 0;
+ inconsistent = TRUE;
+ }
}
break;
- case META_PLUGIN_MAP:
- /*
- * Make sure that the actor is at the correct place in case
- * the plugin fscked.
- */
- priv->map_in_progress--;
-
- if (priv->map_in_progress < 0)
- {
- g_warning ("Error in map accounting.");
- priv->map_in_progress = 0;
- inconsistent = TRUE;
- }
- break;
- case META_PLUGIN_DESTROY:
- priv->destroy_in_progress--;
-
- if (priv->destroy_in_progress < 0)
- {
- g_warning ("Error in destroy accounting.");
- priv->destroy_in_progress = 0;
- inconsistent = TRUE;
- }
- break;
- case META_PLUGIN_SIZE_CHANGE:
- priv->size_change_in_progress--;
- if (priv->size_change_in_progress < 0)
- {
- g_warning ("Error in size change accounting.");
- priv->size_change_in_progress = 0;
- inconsistent = TRUE;
- }
- break;
- case META_PLUGIN_SWITCH_WORKSPACE:
- g_assert_not_reached ();
- break;
- }
+ case META_PLUGIN_MAP:
+ /*
+ * Make sure that the actor is at the correct place in case
+ * the plugin fscked.
+ */
+ priv->map_in_progress--;
+
+ if (priv->map_in_progress < 0)
+ {
+ g_warning ("Error in map accounting.");
+ priv->map_in_progress = 0;
+ inconsistent = TRUE;
+ }
+ break;
+ case META_PLUGIN_DESTROY:
+ priv->destroy_in_progress--;
+
+ if (priv->destroy_in_progress < 0)
+ {
+ g_warning ("Error in destroy accounting.");
+ priv->destroy_in_progress = 0;
+ inconsistent = TRUE;
+ }
+ break;
+ case META_PLUGIN_SIZE_CHANGE:
+ priv->size_change_in_progress--;
+ if (priv->size_change_in_progress < 0)
+ {
+ g_warning ("Error in size change accounting.");
+ priv->size_change_in_progress = 0;
+ inconsistent = TRUE;
+ }
+ break;
+ case META_PLUGIN_SWITCH_WORKSPACE:
+ g_assert_not_reached ();
+ break;
+ }
if (is_freeze_thaw_effect (event) && !inconsistent)
meta_window_actor_thaw (self);
@@ -1248,7 +1277,7 @@ meta_window_actor_set_unredirected (MetaWindowActor *self,
{
MetaWindowActorPrivate *priv = self->priv;
- g_assert(priv->surface); /* because otherwise should_unredirect() is FALSE */
+ g_assert (priv->surface); /* because otherwise should_unredirect() is FALSE */
meta_surface_actor_set_unredirected (priv->surface, unredirected);
}
@@ -1323,8 +1352,8 @@ meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
}
void
-meta_window_actor_show (MetaWindowActor *self,
- MetaCompEffect effect)
+meta_window_actor_show (MetaWindowActor *self,
+ MetaCompEffect effect)
{
MetaWindowActorPrivate *priv = self->priv;
MetaCompositor *compositor = priv->compositor;
@@ -1346,7 +1375,7 @@ meta_window_actor_show (MetaWindowActor *self,
event = META_PLUGIN_NONE;
break;
default:
- g_assert_not_reached();
+ g_assert_not_reached ();
}
if (compositor->switch_workspace_in_progress ||
@@ -1387,7 +1416,7 @@ meta_window_actor_hide (MetaWindowActor *self,
event = META_PLUGIN_NONE;
break;
default:
- g_assert_not_reached();
+ g_assert_not_reached ();
}
if (!start_simple_effect (self, event))
@@ -1395,10 +1424,10 @@ meta_window_actor_hide (MetaWindowActor *self,
}
void
-meta_window_actor_size_change (MetaWindowActor *self,
- MetaSizeChange which_change,
- MetaRectangle *old_frame_rect,
- MetaRectangle *old_buffer_rect)
+meta_window_actor_size_change (MetaWindowActor *self,
+ MetaSizeChange which_change,
+ MetaRectangle *old_frame_rect,
+ MetaRectangle *old_buffer_rect)
{
MetaWindowActorPrivate *priv = self->priv;
MetaCompositor *compositor = priv->compositor;
@@ -1407,7 +1436,8 @@ meta_window_actor_size_change (MetaWindowActor *self,
meta_window_actor_freeze (self);
if (!meta_plugin_manager_event_size_change (compositor->plugin_mgr, self,
- which_change, old_frame_rect, old_buffer_rect))
+ which_change, old_frame_rect,
+ old_buffer_rect))
{
self->priv->size_change_in_progress--;
meta_window_actor_thaw (self);
@@ -1419,9 +1449,9 @@ meta_window_actor_new (MetaWindow *window)
{
MetaDisplay *display = meta_window_get_display (window);
MetaCompositor *compositor = display->compositor;
- MetaWindowActor *self;
+ MetaWindowActor *self;
MetaWindowActorPrivate *priv;
- ClutterActor *window_group;
+ ClutterActor *window_group;
self = g_object_new (META_TYPE_WINDOW_ACTOR,
"meta-window", window,
@@ -1493,7 +1523,8 @@ see_region (cairo_region_t *region,
int height,
char *filename)
{
- cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height);
+ cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_A8, width,
+ height);
cairo_t *cr = cairo_create (surface);
gdk_cairo_region (cr, region);
@@ -1534,7 +1565,8 @@ meta_window_actor_set_clip_region_beneath (MetaWindowActor *self,
if (clip_shadow_under_window (self))
{
- cairo_region_t *frame_bounds = meta_window_get_frame_bounds (priv->window);
+ cairo_region_t *frame_bounds = meta_window_get_frame_bounds (
+ priv->window);
cairo_region_subtract (priv->shadow_clip, frame_bounds);
}
}
@@ -1626,8 +1658,10 @@ check_needs_shadow (MetaWindowActor *self)
meta_window_actor_get_shape_bounds (self, &shape_bounds);
*shadow_location = meta_shadow_factory_get_shadow (factory,
priv->shadow_shape,
- shape_bounds.width, shape_bounds.height,
- shadow_class, appears_focused);
+ shape_bounds.width,
+ shape_bounds.height,
+ shadow_class,
+ appears_focused);
}
if (old_shadow != NULL)
@@ -1684,7 +1718,8 @@ scan_visible_region (guchar *mask_data,
for (x = rect.x; x < (rect.x + rect.width); x++)
{
int x2 = x;
- while (mask_data[y * stride + x2] == 255 && x2 < (rect.x + rect.width))
+ while (mask_data[y * stride + x2] == 255 &&
+ x2 < (rect.x + rect.width))
x2++;
if (x2 > x)
@@ -1757,7 +1792,8 @@ build_and_scan_frame_mask (MetaWindowActor *self,
meta_frame_get_mask (priv->window->frame, cr);
cairo_surface_flush (surface);
- scanned_region = scan_visible_region (mask_data, stride, frame_paint_region);
+ scanned_region = scan_visible_region (mask_data, stride,
+ frame_paint_region);
cairo_region_union (shape_region, scanned_region);
cairo_region_destroy (scanned_region);
cairo_region_destroy (frame_paint_region);
@@ -1768,7 +1804,9 @@ build_and_scan_frame_mask (MetaWindowActor *self,
if (meta_texture_rectangle_check (paint_tex))
{
- mask_texture = COGL_TEXTURE (cogl_texture_rectangle_new_with_size (ctx, tex_width, tex_height));
+ mask_texture =
+ COGL_TEXTURE (cogl_texture_rectangle_new_with_size (ctx, tex_width,
+ tex_height));
cogl_texture_set_components (mask_texture, COGL_TEXTURE_COMPONENTS_A);
cogl_texture_set_region (mask_texture,
0, 0, /* src_x/y */
@@ -1782,9 +1820,11 @@ build_and_scan_frame_mask (MetaWindowActor *self,
{
CoglError *error = NULL;
- mask_texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, tex_width, tex_height,
- COGL_PIXEL_FORMAT_A_8,
- stride, mask_data, &error));
+ mask_texture =
+ COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, tex_width, tex_height,
+ COGL_PIXEL_FORMAT_A_8,
+ stride,
+ mask_data, &error));
if (error)
{
@@ -1972,21 +2012,22 @@ do_send_frame_drawn (MetaWindowActor *self, FrameData *frame)
XClientMessageEvent ev = { 0, };
- frame->frame_drawn_time = meta_compositor_monotonic_time_to_server_time (display,
- g_get_monotonic_time ());
+ frame->frame_drawn_time = meta_compositor_monotonic_time_to_server_time (
+ display,
+ g_get_monotonic_time ());
priv->frame_drawn_time = frame->frame_drawn_time;
ev.type = ClientMessage;
ev.window = meta_window_get_xwindow (priv->window);
ev.message_type = display->x11_display->atom__NET_WM_FRAME_DRAWN;
ev.format = 32;
- ev.data.l[0] = frame->sync_request_serial & G_GUINT64_CONSTANT(0xffffffff);
+ ev.data.l[0] = frame->sync_request_serial & G_GUINT64_CONSTANT (0xffffffff);
ev.data.l[1] = frame->sync_request_serial >> 32;
- ev.data.l[2] = frame->frame_drawn_time & G_GUINT64_CONSTANT(0xffffffff);
+ ev.data.l[2] = frame->frame_drawn_time & G_GUINT64_CONSTANT (0xffffffff);
ev.data.l[3] = frame->frame_drawn_time >> 32;
meta_x11_error_trap_push (display->x11_display);
- XSendEvent (xdisplay, ev.window, False, 0, (XEvent*) &ev);
+ XSendEvent (xdisplay, ev.window, False, 0, (XEvent *) &ev);
XFlush (xdisplay);
meta_x11_error_trap_pop (display->x11_display);
}
@@ -2029,8 +2070,8 @@ meta_window_actor_post_paint (MetaWindowActor *self)
}
static void
-do_send_frame_timings (MetaWindowActor *self,
- FrameData *frame,
+do_send_frame_timings (MetaWindowActor *self,
+ FrameData *frame,
gint refresh_interval,
gint64 presentation_time)
{
@@ -2044,18 +2085,20 @@ do_send_frame_timings (MetaWindowActor *self,
ev.window = meta_window_get_xwindow (priv->window);
ev.message_type = display->x11_display->atom__NET_WM_FRAME_TIMINGS;
ev.format = 32;
- ev.data.l[0] = frame->sync_request_serial & G_GUINT64_CONSTANT(0xffffffff);
+ ev.data.l[0] = frame->sync_request_serial & G_GUINT64_CONSTANT (0xffffffff);
ev.data.l[1] = frame->sync_request_serial >> 32;
if (presentation_time != 0)
{
- gint64 presentation_time_server = meta_compositor_monotonic_time_to_server_time (display,
- presentation_time);
- gint64 presentation_time_offset = presentation_time_server - frame->frame_drawn_time;
+ gint64 presentation_time_server =
+ meta_compositor_monotonic_time_to_server_time (display,
+ presentation_time);
+ gint64 presentation_time_offset = presentation_time_server -
+ frame->frame_drawn_time;
if (presentation_time_offset == 0)
presentation_time_offset = 1;
- if ((gint32)presentation_time_offset == presentation_time_offset)
+ if ((gint32) presentation_time_offset == presentation_time_offset)
ev.data.l[2] = presentation_time_offset;
}
@@ -2063,7 +2106,7 @@ do_send_frame_timings (MetaWindowActor *self,
ev.data.l[4] = 1000 * META_SYNC_DELAY;
meta_x11_error_trap_push (display->x11_display);
- XSendEvent (xdisplay, ev.window, False, 0, (XEvent*) &ev);
+ XSendEvent (xdisplay, ev.window, False, 0, (XEvent *) &ev);
XFlush (xdisplay);
meta_x11_error_trap_pop (display->x11_display);
}
@@ -2107,11 +2150,13 @@ meta_window_actor_frame_complete (MetaWindowActor *self,
if (frame->frame_counter != -1 && frame->frame_counter <= frame_counter)
{
if (G_UNLIKELY (frame->frame_drawn_time == 0))
- g_warning ("%s: Frame has assigned frame counter but no frame drawn time",
- priv->window->desc);
+ g_warning (
+ "%s: Frame has assigned frame counter but no frame drawn time",
+ priv->window->desc);
if (G_UNLIKELY (frame->frame_counter < frame_counter))
- g_warning ("%s: frame_complete callback never occurred for frame %" G_GINT64_FORMAT,
- priv->window->desc, frame->frame_counter);
+ g_warning (
+ "%s: frame_complete callback never occurred for frame %" G_GINT64_FORMAT,
+ priv->window->desc, frame->frame_counter);
priv->frames = g_list_delete_link (priv->frames, l);
send_frame_timings (self, frame, frame_info, presentation_time);
@@ -2170,7 +2215,8 @@ meta_window_actor_sync_updates_frozen (MetaWindowActor *self)
MetaWindowActorPrivate *priv = self->priv;
MetaWindow *window = priv->window;
- meta_window_actor_set_updates_frozen (self, meta_window_updates_are_frozen (window));
+ meta_window_actor_set_updates_frozen (self,
+ meta_window_updates_are_frozen (window));
}
MetaWindowActor *
diff --git a/src/compositor/meta-window-group.c b/src/compositor/meta-window-group.c
index 44058feea..ef5ae9b27 100644
--- a/src/compositor/meta-window-group.c
+++ b/src/compositor/meta-window-group.c
@@ -28,7 +28,8 @@ struct _MetaWindowGroup
static void cullable_iface_init (MetaCullableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaWindowGroup, meta_window_group, CLUTTER_TYPE_ACTOR,
- G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
+ G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE,
+ cullable_iface_init));
static void
meta_window_group_cull_out (MetaCullable *cullable,
@@ -115,7 +116,8 @@ meta_window_group_paint (ClutterActor *actor)
cairo_region_translate (clip_region, -paint_x_origin, -paint_y_origin);
- meta_cullable_cull_out (META_CULLABLE (window_group), unobscured_region, clip_region);
+ meta_cullable_cull_out (META_CULLABLE (
+ window_group), unobscured_region, clip_region);
cairo_region_destroy (unobscured_region);
cairo_region_destroy (clip_region);
diff --git a/src/compositor/meta-window-shape.c b/src/compositor/meta-window-shape.c
index 1b4767567..5710ed8a0 100644
--- a/src/compositor/meta-window-shape.c
+++ b/src/compositor/meta-window-shape.c
@@ -144,9 +144,11 @@ meta_window_shape_new (cairo_region_t *region)
#if 0
g_print ("%d: +%d+%dx%dx%d => +%d+%dx%dx%d\n",
- iter.i, iter.rectangle.x, iter.rectangle.y, iter.rectangle.width, iter.rectangle.height,
+ iter.i, iter.rectangle.x, iter.rectangle.y, iter.rectangle.width,
+ iter.rectangle.height,
shape->rectangles[iter.i].x, shape->rectangles[iter.i].y,
- hape->rectangles[iter.i].width, shape->rectangles[iter.i].height);
+ hape->rectangles[iter.i].width,
+ shape->rectangles[iter.i].height);
#endif
hash = hash * 31 + x1 * 17 + x2 * 27 + y1 * 37 + y2 * 43;
@@ -155,7 +157,8 @@ meta_window_shape_new (cairo_region_t *region)
shape->hash = hash;
#if 0
- g_print ("%d %d %d %d: %#x\n\n", shape->top, shape->right, shape->bottom, shape->left, shape->hash);
+ g_print ("%d %d %d %d: %#x\n\n", shape->top, shape->right, shape->bottom,
+ shape->left, shape->hash);
#endif
return shape;
diff --git a/src/compositor/plugins/default.c b/src/compositor/plugins/default.c
index 3dd0b07ec..5526f4a9a 100644
--- a/src/compositor/plugins/default.c
+++ b/src/compositor/plugins/default.c
@@ -44,17 +44,26 @@
#define DISPLAY_TILE_PREVIEW_DATA_KEY "MCCP-Default-display-tile-preview-data"
#define META_TYPE_DEFAULT_PLUGIN (meta_default_plugin_get_type ())
-#define META_DEFAULT_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_DEFAULT_PLUGIN, MetaDefaultPlugin))
-#define META_DEFAULT_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_DEFAULT_PLUGIN, MetaDefaultPluginClass))
-#define META_IS_DEFAULT_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_DEFAULT_PLUGIN_TYPE))
-#define META_IS_DEFAULT_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_DEFAULT_PLUGIN))
-#define META_DEFAULT_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_DEFAULT_PLUGIN, MetaDefaultPluginClass))
+#define META_DEFAULT_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ META_TYPE_DEFAULT_PLUGIN, \
+ MetaDefaultPlugin))
+#define META_DEFAULT_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ META_TYPE_DEFAULT_PLUGIN, \
+ MetaDefaultPluginClass))
+#define META_IS_DEFAULT_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ META_DEFAULT_PLUGIN_TYPE))
+#define META_IS_DEFAULT_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ META_TYPE_DEFAULT_PLUGIN))
+#define META_DEFAULT_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ META_TYPE_DEFAULT_PLUGIN, \
+ MetaDefaultPluginClass))
#define META_DEFAULT_PLUGIN_GET_PRIVATE(obj) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_DEFAULT_PLUGIN, MetaDefaultPluginPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_DEFAULT_PLUGIN, \
+ MetaDefaultPluginPrivate))
-typedef struct _MetaDefaultPlugin MetaDefaultPlugin;
-typedef struct _MetaDefaultPluginClass MetaDefaultPluginClass;
+typedef struct _MetaDefaultPlugin MetaDefaultPlugin;
+typedef struct _MetaDefaultPluginClass MetaDefaultPluginClass;
typedef struct _MetaDefaultPluginPrivate MetaDefaultPluginPrivate;
struct _MetaDefaultPlugin
@@ -72,32 +81,32 @@ struct _MetaDefaultPluginClass
static GQuark actor_data_quark = 0;
static GQuark display_tile_preview_data_quark = 0;
-static void start (MetaPlugin *plugin);
-static void minimize (MetaPlugin *plugin,
- MetaWindowActor *actor);
-static void map (MetaPlugin *plugin,
- MetaWindowActor *actor);
-static void destroy (MetaPlugin *plugin,
- MetaWindowActor *actor);
-
-static void switch_workspace (MetaPlugin *plugin,
- gint from,
- gint to,
- MetaMotionDirection direction);
-
-static void kill_window_effects (MetaPlugin *plugin,
- MetaWindowActor *actor);
-static void kill_switch_workspace (MetaPlugin *plugin);
-
-static void show_tile_preview (MetaPlugin *plugin,
- MetaWindow *window,
- MetaRectangle *tile_rect,
- int tile_monitor_number);
-static void hide_tile_preview (MetaPlugin *plugin);
+static void start (MetaPlugin *plugin);
+static void minimize (MetaPlugin *plugin,
+ MetaWindowActor *actor);
+static void map (MetaPlugin *plugin,
+ MetaWindowActor *actor);
+static void destroy (MetaPlugin *plugin,
+ MetaWindowActor *actor);
+
+static void switch_workspace (MetaPlugin *plugin,
+ gint from,
+ gint to,
+ MetaMotionDirection direction);
+
+static void kill_window_effects (MetaPlugin *plugin,
+ MetaWindowActor *actor);
+static void kill_switch_workspace (MetaPlugin *plugin);
+
+static void show_tile_preview (MetaPlugin *plugin,
+ MetaWindow *window,
+ MetaRectangle *tile_rect,
+ int tile_monitor_number);
+static void hide_tile_preview (MetaPlugin *plugin);
static void confirm_display_change (MetaPlugin *plugin);
-static const MetaPluginInfo * plugin_info (MetaPlugin *plugin);
+static const MetaPluginInfo *plugin_info (MetaPlugin *plugin);
/*
* Plugin private data that we store in the .plugin_private member.
@@ -105,14 +114,14 @@ static const MetaPluginInfo * plugin_info (MetaPlugin *plugin);
struct _MetaDefaultPluginPrivate
{
/* Valid only when switch_workspace effect is in progress */
- ClutterTimeline *tml_switch_workspace1;
- ClutterTimeline *tml_switch_workspace2;
- ClutterActor *desktop1;
- ClutterActor *desktop2;
+ ClutterTimeline *tml_switch_workspace1;
+ ClutterTimeline *tml_switch_workspace2;
+ ClutterActor *desktop1;
+ ClutterActor *desktop2;
- ClutterActor *background_group;
+ ClutterActor *background_group;
- MetaPluginInfo info;
+ MetaPluginInfo info;
};
META_PLUGIN_DECLARE_WITH_CODE (MetaDefaultPlugin, meta_default_plugin,
@@ -140,18 +149,18 @@ typedef struct
typedef struct _DisplayTilePreview
{
- ClutterActor *actor;
+ ClutterActor *actor;
- GdkRGBA *preview_color;
+ GdkRGBA *preview_color;
- MetaRectangle tile_rect;
+ MetaRectangle tile_rect;
} DisplayTilePreview;
static void
meta_default_plugin_dispose (GObject *object)
{
/* MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (object)->priv;
- */
+ */
G_OBJECT_CLASS (meta_default_plugin_parent_class)->dispose (object);
}
@@ -163,9 +172,9 @@ meta_default_plugin_finalize (GObject *object)
static void
meta_default_plugin_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
switch (prop_id)
{
@@ -177,9 +186,9 @@ meta_default_plugin_set_property (GObject *object,
static void
meta_default_plugin_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
switch (prop_id)
{
@@ -192,23 +201,23 @@ meta_default_plugin_get_property (GObject *object,
static void
meta_default_plugin_class_init (MetaDefaultPluginClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- MetaPluginClass *plugin_class = META_PLUGIN_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ MetaPluginClass *plugin_class = META_PLUGIN_CLASS (klass);
- gobject_class->finalize = meta_default_plugin_finalize;
- gobject_class->dispose = meta_default_plugin_dispose;
- gobject_class->set_property = meta_default_plugin_set_property;
- gobject_class->get_property = meta_default_plugin_get_property;
+ gobject_class->finalize = meta_default_plugin_finalize;
+ gobject_class->dispose = meta_default_plugin_dispose;
+ gobject_class->set_property = meta_default_plugin_set_property;
+ gobject_class->get_property = meta_default_plugin_get_property;
- plugin_class->start = start;
- plugin_class->map = map;
- plugin_class->minimize = minimize;
- plugin_class->destroy = destroy;
+ plugin_class->start = start;
+ plugin_class->map = map;
+ plugin_class->minimize = minimize;
+ plugin_class->destroy = destroy;
plugin_class->switch_workspace = switch_workspace;
plugin_class->show_tile_preview = show_tile_preview;
plugin_class->hide_tile_preview = hide_tile_preview;
- plugin_class->plugin_info = plugin_info;
- plugin_class->kill_window_effects = kill_window_effects;
+ plugin_class->plugin_info = plugin_info;
+ plugin_class->kill_window_effects = kill_window_effects;
plugin_class->kill_switch_workspace = kill_switch_workspace;
plugin_class->confirm_display_change = confirm_display_change;
}
@@ -220,10 +229,10 @@ meta_default_plugin_init (MetaDefaultPlugin *self)
self->priv = priv = META_DEFAULT_PLUGIN_GET_PRIVATE (self);
- priv->info.name = "Default Effects";
- priv->info.version = "0.1";
- priv->info.author = "Intel Corp.";
- priv->info.license = "GPL";
+ priv->info.name = "Default Effects";
+ priv->info.version = "0.1";
+ priv->info.author = "Intel Corp.";
+ priv->info.license = "GPL";
priv->info.description = "This is an example of a plugin implementation.";
}
@@ -258,10 +267,10 @@ get_actor_private (MetaWindowActor *actor)
}
static ClutterTimeline *
-actor_animate (ClutterActor *actor,
- ClutterAnimationMode mode,
- guint duration,
- const gchar *first_property,
+actor_animate (ClutterActor *actor,
+ ClutterAnimationMode mode,
+ guint duration,
+ const gchar *first_property,
...)
{
va_list args;
@@ -285,7 +294,7 @@ actor_animate (ClutterActor *actor,
static void
on_switch_workspace_effect_complete (ClutterTimeline *timeline, gpointer data)
{
- MetaPlugin *plugin = META_PLUGIN (data);
+ MetaPlugin *plugin = META_PLUGIN (data);
MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (plugin)->priv;
MetaDisplay *display = meta_plugin_get_display (plugin);
GList *l = meta_get_window_actors (display);
@@ -347,9 +356,9 @@ on_monitors_changed (MetaMonitorManager *monitor_manager,
clutter_actor_set_size (background_actor, rect.width, rect.height);
/* Don't use rand() here, mesa calls srand() internally when
- parsing the driconf XML, but it's nice if the colors are
- reproducible.
- */
+ * parsing the driconf XML, but it's nice if the colors are
+ * reproducible.
+ */
clutter_color_init (&color,
g_rand_int_range (rand, 0, 255),
g_rand_int_range (rand, 0, 255),
@@ -358,10 +367,12 @@ on_monitors_changed (MetaMonitorManager *monitor_manager,
background = meta_background_new (display);
meta_background_set_color (background, &color);
- meta_background_actor_set_background (META_BACKGROUND_ACTOR (background_actor), background);
+ meta_background_actor_set_background (META_BACKGROUND_ACTOR (
+ background_actor), background);
g_object_unref (background);
- meta_background_actor_set_vignette (META_BACKGROUND_ACTOR (background_actor),
+ meta_background_actor_set_vignette (META_BACKGROUND_ACTOR (
+ background_actor),
TRUE,
0.5,
0.5);
@@ -398,11 +409,11 @@ switch_workspace (MetaPlugin *plugin,
{
MetaDisplay *display;
MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (plugin)->priv;
- GList *l;
- ClutterActor *workspace0 = clutter_actor_new ();
- ClutterActor *workspace1 = clutter_actor_new ();
+ GList *l;
+ ClutterActor *workspace0 = clutter_actor_new ();
+ ClutterActor *workspace1 = clutter_actor_new ();
ClutterActor *stage;
- int screen_width, screen_height;
+ int screen_width, screen_height;
display = meta_plugin_get_display (plugin);
stage = meta_get_stage_for_display (display);
@@ -432,12 +443,14 @@ switch_workspace (MetaPlugin *plugin,
while (l)
{
MetaWindowActor *window_actor = l->data;
- ActorPrivate *apriv = get_actor_private (window_actor);
- ClutterActor *actor = CLUTTER_ACTOR (window_actor);
- MetaWorkspace *workspace;
- gint win_workspace;
+ ActorPrivate *apriv = get_actor_private (window_actor);
+ ClutterActor *actor = CLUTTER_ACTOR (window_actor);
+ MetaWorkspace *workspace;
+ gint win_workspace;
- workspace = meta_window_get_workspace (meta_window_actor_get_meta_window (window_actor));
+ workspace =
+ meta_window_get_workspace (meta_window_actor_get_meta_window (
+ window_actor));
win_workspace = meta_workspace_index (workspace);
if (win_workspace == to || win_workspace == from)
@@ -493,7 +506,8 @@ switch_workspace (MetaPlugin *plugin,
* calls the manager callback function.
*/
static void
-on_minimize_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data)
+on_minimize_effect_complete (ClutterTimeline *timeline,
+ EffectCompleteData *data)
{
/*
* Must reverse the effect of the effect; must hide it first to ensure
@@ -528,12 +542,12 @@ minimize (MetaPlugin *plugin, MetaWindowActor *window_actor)
MetaWindowType type;
MetaRectangle icon_geometry;
MetaWindow *meta_window = meta_window_actor_get_meta_window (window_actor);
- ClutterActor *actor = CLUTTER_ACTOR (window_actor);
+ ClutterActor *actor = CLUTTER_ACTOR (window_actor);
type = meta_window_get_window_type (meta_window);
- if (!meta_window_get_icon_geometry(meta_window, &icon_geometry))
+ if (!meta_window_get_icon_geometry (meta_window, &icon_geometry))
{
icon_geometry.x = 0;
icon_geometry.y = 0;
@@ -549,15 +563,14 @@ minimize (MetaPlugin *plugin, MetaWindowActor *window_actor)
MINIMIZE_TIMEOUT,
"scale-x", 0.0,
"scale-y", 0.0,
- "x", (double)icon_geometry.x,
- "y", (double)icon_geometry.y,
+ "x", (double) icon_geometry.x,
+ "y", (double) icon_geometry.y,
NULL);
data->plugin = plugin;
data->actor = actor;
g_signal_connect (apriv->tml_minimize, "completed",
G_CALLBACK (on_minimize_effect_complete),
data);
-
}
else
meta_plugin_minimize_completed (plugin, window_actor);
@@ -570,8 +583,8 @@ on_map_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data)
* Must reverse the effect of the effect.
*/
MetaPlugin *plugin = data->plugin;
- MetaWindowActor *window_actor = META_WINDOW_ACTOR (data->actor);
- ActorPrivate *apriv = get_actor_private (window_actor);
+ MetaWindowActor *window_actor = META_WINDOW_ACTOR (data->actor);
+ ActorPrivate *apriv = get_actor_private (window_actor);
apriv->tml_map = NULL;
@@ -679,19 +692,23 @@ free_display_tile_preview (gpointer data)
{
DisplayTilePreview *preview = data;
- if (G_LIKELY (preview != NULL)) {
- clutter_actor_destroy (preview->actor);
- g_slice_free (DisplayTilePreview, preview);
- }
+ if (G_LIKELY (preview != NULL))
+ {
+ clutter_actor_destroy (preview->actor);
+ g_slice_free (DisplayTilePreview, preview);
+ }
}
static DisplayTilePreview *
get_display_tile_preview (MetaDisplay *display)
{
- DisplayTilePreview *preview = g_object_get_qdata (G_OBJECT (display), display_tile_preview_data_quark);
+ DisplayTilePreview *preview = g_object_get_qdata (G_OBJECT (
+ display),
+ display_tile_preview_data_quark);
if (G_UNLIKELY (display_tile_preview_data_quark == 0))
- display_tile_preview_data_quark = g_quark_from_static_string (DISPLAY_TILE_PREVIEW_DATA_KEY);
+ display_tile_preview_data_quark = g_quark_from_static_string (
+ DISPLAY_TILE_PREVIEW_DATA_KEY);
if (G_UNLIKELY (!preview))
{
@@ -701,7 +718,8 @@ get_display_tile_preview (MetaDisplay *display)
clutter_actor_set_background_color (preview->actor, CLUTTER_COLOR_Blue);
clutter_actor_set_opacity (preview->actor, 100);
- clutter_actor_add_child (meta_get_window_group_for_display (display), preview->actor);
+ clutter_actor_add_child (meta_get_window_group_for_display (
+ display), preview->actor);
g_object_set_qdata_full (G_OBJECT (display),
display_tile_preview_data_quark, preview,
free_display_tile_preview);
@@ -733,7 +751,8 @@ show_tile_preview (MetaPlugin *plugin,
clutter_actor_show (preview->actor);
window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window));
- clutter_actor_set_child_below_sibling (clutter_actor_get_parent (preview->actor),
+ clutter_actor_set_child_below_sibling (clutter_actor_get_parent (preview->
+ actor),
preview->actor,
window_actor);
@@ -750,7 +769,7 @@ hide_tile_preview (MetaPlugin *plugin)
}
static void
-kill_switch_workspace (MetaPlugin *plugin)
+kill_switch_workspace (MetaPlugin *plugin)
{
MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (plugin)->priv;
diff --git a/src/compositor/region-utils.c b/src/compositor/region-utils.c
index b268fd346..5655e8d33 100644
--- a/src/compositor/region-utils.c
+++ b/src/compositor/region-utils.c
@@ -30,17 +30,20 @@
* that are unsorted or overlap; unioning such a set of rectangles 1-by-1
* using cairo_region_union_rectangle() produces O(N^2) behavior (if the union
* adds or removes rectangles in the middle of the region, then it has to
- * move all the rectangles after that.) To avoid this behavior, MetaRegionBuilder
+ * move all the rectangles after that.) To avoid this behavior,
+ *MetaRegionBuilder
* creates regions for small groups of rectangles and merges them together in
* a binary tree.
*
- * Possible improvement: From a glance at the code, accumulating all the rectangles
+ * Possible improvement: From a glance at the code, accumulating all the
+ *rectangles
* into a flat array and then calling the (not usefully documented)
* cairo_region_create_rectangles() would have the same behavior and would be
* simpler and a bit more efficient.
*/
-/* Optimium performance seems to be with MAX_CHUNK_RECTANGLES=4; 8 is about 10% slower.
+/* Optimium performance seems to be with MAX_CHUNK_RECTANGLES=4; 8 is about 10%
+ * slower.
* But using 8 may be more robust to systems with slow malloc(). */
#define MAX_CHUNK_RECTANGLES 8
@@ -112,7 +115,7 @@ meta_region_builder_finish (MetaRegionBuilder *builder)
result = builder->levels[i];
else
{
- cairo_region_union(result, builder->levels[i]);
+ cairo_region_union (result, builder->levels[i]);
cairo_region_destroy (builder->levels[i]);
}
}
@@ -165,7 +168,8 @@ meta_region_iterator_next (MetaRegionIterator *iter)
if (iter->i + 1 < iter->n_rectangles)
{
- cairo_region_get_rectangle (iter->region, iter->i + 1, &iter->next_rectangle);
+ cairo_region_get_rectangle (iter->region, iter->i + 1,
+ &iter->next_rectangle);
iter->line_end = iter->next_rectangle.y != iter->rectangle.y;
}
else
@@ -175,9 +179,9 @@ meta_region_iterator_next (MetaRegionIterator *iter)
}
cairo_region_t *
-meta_region_scale_double (cairo_region_t *region,
- double scale,
- MetaRoundingStrategy rounding_strategy)
+meta_region_scale_double (cairo_region_t *region,
+ double scale,
+ MetaRoundingStrategy rounding_strategy)
{
int n_rects, i;
cairo_rectangle_int_t *rects;
@@ -190,7 +194,7 @@ meta_region_scale_double (cairo_region_t *region,
n_rects = cairo_region_num_rectangles (region);
- rects = g_malloc (sizeof(cairo_rectangle_int_t) * n_rects);
+ rects = g_malloc (sizeof (cairo_rectangle_int_t) * n_rects);
for (i = 0; i < n_rects; i++)
{
cairo_region_get_rectangle (region, i, &rects[i]);
@@ -231,7 +235,7 @@ meta_region_scale (cairo_region_t *region, int scale)
n_rects = cairo_region_num_rectangles (region);
- rects = g_malloc (sizeof(cairo_rectangle_int_t) * n_rects);
+ rects = g_malloc (sizeof (cairo_rectangle_int_t) * n_rects);
for (i = 0; i < n_rects; i++)
{
cairo_region_get_rectangle (region, i, &rects[i]);
@@ -249,23 +253,25 @@ meta_region_scale (cairo_region_t *region, int scale)
}
static void
-add_expanded_rect (MetaRegionBuilder *builder,
- int x,
- int y,
- int width,
- int height,
- int x_amount,
- int y_amount,
- gboolean flip)
+add_expanded_rect (MetaRegionBuilder *builder,
+ int x,
+ int y,
+ int width,
+ int height,
+ int x_amount,
+ int y_amount,
+ gboolean flip)
{
if (flip)
meta_region_builder_add_rectangle (builder,
y - y_amount, x - x_amount,
- height + 2 * y_amount, width + 2 * x_amount);
+ height + 2 * y_amount,
+ width + 2 * x_amount);
else
meta_region_builder_add_rectangle (builder,
x - x_amount, y - y_amount,
- width + 2 * x_amount, height + 2 * y_amount);
+ width + 2 * x_amount,
+ height + 2 * y_amount);
}
static cairo_region_t *
@@ -337,10 +343,14 @@ expand_region_inverse (cairo_region_t *region,
if (iter.line_end)
{
- if (extents.x + extents.width > iter.rectangle.x + iter.rectangle.width)
+ if (extents.x + extents.width >
+ iter.rectangle.x + iter.rectangle.width)
add_expanded_rect (&builder,
- iter.rectangle.x + iter.rectangle.width, iter.rectangle.y,
- (extents.x + extents.width) - (iter.rectangle.x + iter.rectangle.width), iter.rectangle.height,
+ iter.rectangle.x + iter.rectangle.width,
+ iter.rectangle.y,
+ (extents.x + extents.width) -
+ (iter.rectangle.x + iter.rectangle.width),
+ iter.rectangle.height,
x_amount, y_amount, flip);
last_x = extents.x;
}