Commit Graph

7011 Commits

Author SHA1 Message Date
Carlos Garnacho
353d7909f6 clutter: Check updated devices with the current clip
We do check the clip area as an optimization to know which input devices
might need updating state after a relayout (Assuming that if a device is
under a non-painted area, it's actor beneath didn't change).

Use the clip region for this, and drop the last usage of the clip region
bounds.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/867
2019-11-22 21:07:05 +00:00
Carlos Garnacho
8598b654ba clutter/cogl: Use regions for clipping if necessary
Use the new cogl function to perform clipping if the clip area
consists of more than a single rectangle.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/867
2019-11-22 21:07:05 +00:00
Robert Mader
8e172aeecb cleanup: Use g_clear_handle_id() for g_source_remove()
It makes sure we do not forget to zero the id and lets us avoid
zero checks before. We use it for all new code, lets clean up the
existing code base.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/947
2019-11-22 01:27:40 +01:00
Robert Mader
51f68f1054 clutter/cally-root: Use g_clear_signal_handler and fix a signal leak
This commit was split out from `cleanup: Use g_clear_signal_handler()
where possible` as it fixes an actual signal leak and should therefore
get backported to stable releases.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/940
2019-11-21 15:02:27 +00:00
Robert Mader
92375c75f8 cleanup: Use g_clear_signal_handler() where possible
This is inspired by 98892391d7 where the usage of
`g_signal_handler_disconnect()` without resetting the corresponding
handler id later resulted in a bug. Using `g_clear_signal_handler()`
makes sure we avoid similar bugs and is almost always the better
alternative. We use it for new code, let's clean up the old code to
also use it.

A further benefit is that it can get called even if the passed id is
0, allowing us to remove a lot of now unnessecary checks, and the fact
that `g_clear_signal_handler()` checks for the right type size, forcing us
to clean up all places where we used `guint` instead of `gulong`.

No functional changes intended here and all changes should be trivial,
thus bundled in one big commit.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/940
2019-11-21 15:02:27 +00:00
Adam Jackson
794d3239c7 cogl: Remove deprecated cogl_color_set_from_*
https://gitlab.gnome.org/GNOME/mutter/merge_requests/933
2019-11-20 11:59:15 -05:00
Adam Jackson
7adaaab2d6 clutter: Remove deprecated ClutterTableLayout
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:27 +00:00
Adam Jackson
289e24f1f7 clutter: Remove some unused deprecated clutter_actor API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:27 +00:00
Adam Jackson
c4d1e150ba clutter: Remove some unused deprecated clutter_alpha API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:27 +00:00
Adam Jackson
293ec0a1cb clutter: Remove some unused deprecated clutter_state API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:27 +00:00
Adam Jackson
24b38a5059 clutter: Remove some unused deprecated clutter_animation API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:27 +00:00
Adam Jackson
c74f4f6340 clutter: Remove some unused deprecated clutter_table_layout API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:27 +00:00
Adam Jackson
3e9f8471fc clutter: Remove unused deprecated clutter_container_{add,remove}_valist
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:26 +00:00
Adam Jackson
0a41f0f855 clutter: Remove unused deprecated/clutter-bin-layout.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:26 +00:00
Adam Jackson
375d35be60 clutter: Remove unused deprecated/clutter-animatable.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:26 +00:00
Adam Jackson
6da568e29a clutter: Remove unused deprecated/clutter-stage-manager.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:26 +00:00
Adam Jackson
c039764d52 clutter: Remove unused deprecated/clutter-keysyms.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:26 +00:00
Jonas Ådahl
b078917500 clutter: Remove ClutterTexture
It was deprecated for a long time, and isn't used anymore. Would similar
functionality be needed, use a ClutterContent based approach, such as
ClutterImage.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/932
2019-11-13 13:56:08 +00:00
Jonas Ådahl
ec1c94d4a7 cally: Remove CallyTexture
CallyTexture is an accessibility object associated with ClutterTexture.
ClutterTexture is going away, so prepare by first removing the
accessibility object that would be constructed for it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/932
2019-11-13 13:56:08 +00:00
Jonas Ådahl
faad63adce clutter: Remove ClutterCairoTexture
No longer used, and has been deprecated for very long, so remove it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/932
2019-11-13 13:56:08 +00:00
Thomas Hindoe Paaboel Andersen
bcc519e4ee clutter: return correct enum type
clutter_event_get_scroll_finish_flags() should return a ClutterScrollFinishFlags
but due to what looks like a bad copy/paste it instead returns a
ClutterScrollSource on asserts.

The definitions of the enums are these:

typedef enum
{
  CLUTTER_SCROLL_SOURCE_UNKNOWN,
  CLUTTER_SCROLL_SOURCE_WHEEL,
  CLUTTER_SCROLL_SOURCE_FINGER,
  CLUTTER_SCROLL_SOURCE_CONTINUOUS
} ClutterScrollSource;

typedef enum
{
  CLUTTER_SCROLL_FINISHED_NONE       = 0,
  CLUTTER_SCROLL_FINISHED_HORIZONTAL = 1 << 0,
  CLUTTER_SCROLL_FINISHED_VERTICAL   = 1 << 1
} ClutterScrollFinishFlags;

The asserts would only return CLUTTER_SCROLL_SOURCE_UNKNOWN. This
is equal to CLUTTER_SCROLL_FINISHED_NONE which this patch uses
instead. Thus no functional change is intended. This only fixes a
compile warning.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/931
2019-11-12 17:09:09 +01:00
Georges Basile Stavracas Neto
044238b503 clutter/actor: Draw paint volumes using paint nodes
Clutter has a draw debug mode that allows for painting
paint volumes. Right now, this debug mode uses the old
immediate paint mode.

Switch the painting of paint volumes to use paint nodes,
and sneak a few minor style cleanups.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/890
2019-11-11 10:40:44 -03:00
Georges Basile Stavracas Neto
03b59f9e19 clutter/actor: Move paint flag to ClutterActorNode
Now that we unconditionally use ClutterActorNode to
paint ClutterActors, move the PAINT private flag to
the ClutterActorNode. This way, we can run the paint
on the actor anywhere inside the paint tree.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/890
2019-11-11 10:40:44 -03:00
Marco Trevisan (Treviño)
f133de2dd4 clutter/actor: Unref the root node if set as child
When setting the root node as child of a clip or transform node, we add a
new reference to it, without removing the one that we've previously added
when getting it from the actor node (and that won't ever be unset by the
auto-pointer since the root_node is re-associated).

So, once we add the root node as child and re-define it, unref it.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/908
2019-11-04 12:07:43 +00:00
Olivier Fourdan
db90c0d509 clutter/stage-view: Separate offscreen and shadowfb
Previously, we would use a single offscreen framebuffer for both
transformations and when a shadow framebuffer should be used, but that
can be dreadfully slow when using software rendering with a discrete GPU
due to bandwidth limitations.

Keep the offscreen framebuffer for transformations only and add another
intermediate shadow framebuffer used as a copy of the onscreen
framebuffer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/877
2019-11-04 10:44:42 +01:00
Carlos Garnacho
1688cf7c44 clutter: Drop the no-clear stage hint
A compositor is notably opaque (usually has nothing to be painted on!).
gnome-shell sets this hint, but there's no reason why we wouldn't want
it by default.

Also, the color buffer being cleared messes with stencil clips, as the
clear operation by definition ignores the stencil buffer. We want to
use these more extensively in the future, so just drop this API.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/911
2019-11-01 15:02:09 +00:00
Carlos Garnacho
6bfa61a3a7 Revert "clutter/cogl: Store empty clip regions for buffer age"
This reverts commit 4918893326.

This commit prevented cogl_stage_cogl_redraw_view() from skipping
swap buffers entirely if the invalidation region ended up empty.
This meant we were actually swapping buffers when we didn't need to.

The source of the glitches was fixed more properly, so this just adds
extra work.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/898
2019-10-30 17:17:29 +00:00
Carlos Garnacho
cf89e4d2cd clutter/cogl: Fix invalidation on non-primary monitors with no buffer age
We passed the view rectangle, we however want a fb-scaled rectangle starting
at 0,0. Fixes invalidation on other than the primary monitor when those
paths are hit.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/898
2019-10-30 17:17:29 +00:00
Robert Mader
9678fd5306 clutter/cogl: Scale clip region in paint_stage()
To simplify the code and because it was forgotten once in a7f4f5b291,
breaking clipped redraws of clipped views.

Also sneak in a very small cleanup.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/889
2019-10-28 18:18:34 +01:00
Georges Basile Stavracas Neto
563e7139b6 Allow changing Clutter debug flags at runtime
This way, we can simply pop up the Looking Glass and run:

 >>> Meta.add_clutter_debug_flags(Clutter.DebugFlag.PICK, 0, 0)

And measure specific actions or events on GNOME Shell.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/862
2019-10-25 19:12:34 +00:00
Carlos Garnacho
2e9faaf67a clutter/cogl: Ensure to paint full view if there's no buffer age support
This was falling back to painting an empty area, which is not what we want.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/888
2019-10-25 15:03:24 +00:00
Carlos Garnacho
4918893326 clutter/cogl: Store empty clip regions for buffer age
As we do not prevent the SwapBuffers call from happening, those also
do count. Results in clip area calculations to be right for monitors
that previously did not get invalidated.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/888
2019-10-25 15:03:24 +00:00
Adam Jackson
acc7b83322 cogl: Remove the stub winsys
It's not useful and supporting it leaks into the API in other weird
ways.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:49 -04:00
Adam Jackson
a60457c2d8 clutter: Remove behaviours
https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
Adam Jackson
33d1bae03f clutter: Remove deprecated/clutter-behaviour-scale.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
Adam Jackson
013b336690 clutter: Remove unused deprecated/clutter-behaviour-depth.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
Adam Jackson
68fca552d7 clutter: Remove unused deprecated/clutter-behaviour-opacity.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
Georges Basile Stavracas Neto
cd2ee44216 clutter/actor: Always paint using paint nodes
Make ClutterActor paint using ClutterTransformNode, ClutterClip
node, and ClutterActorNode. Essencially, the actor node is a
replacement for clutter_actor_continue_paint().

An interesting aspect of this commit is that the order of the
operations is reversed to be preserved.

Before being able to remove the dummy node hack, we'll need to
make ClutterEffects compatible with paint nodes first -- and
naturally, that's enough content for its own merge request.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/872
2019-10-22 14:53:48 -03:00
Georges Basile Stavracas Neto
ebf9ac091d clutter/paint-nodes: Introduce ClutterActorNode
ClutterActorNode is a paint node that runs the 'paint'
function of an actor. It is a useful helper node to be
used during the transition to paint nodes.

The role of ClutterActorNode will change over time. For
now, it is just a call to clutter_actor_continue_paint(),
which also paints the effects. When ClutterEffect is
ported to paint nodes, ClutterActorNode will morph to
only notify the actor about the painting, and will become
a private node to Clutter.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/872
2019-10-22 14:47:37 -03:00
Georges Basile Stavracas Neto
cf791c09f0 clutter/paint-nodes: Expose and cleanup ClutterTransformNode
It will also be used by ClutterActor to apply it's own transform
to the paint node tree, and thus preserve it's rendering area.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/872
2019-10-22 14:47:37 -03:00
Georges Basile Stavracas Neto
1d8807a171 clutter/paint-nodes: Expose ClutterLayerNode
It will be useful to port ClutterOffscreenEffect in
the future.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/872
2019-10-22 14:47:37 -03:00
Adam Jackson
f18e2d2e62 clutter: Remove unused clutter-layout-manager-deprecated.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/878
2019-10-22 11:57:55 -04:00
Robert Mader
3078394951 ClutterStage: Use clutter_region_t for swap_region
We use `clutter_region_t` for the clip now, so lets also use it
for the swap region.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/692
2019-10-22 00:28:47 +02:00
Carlos Garnacho
a7f4f5b291 ClutterStage: Store clip area as a region
This will allow drawing optimizations as a region is more concrete
than the bounding rectangle.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/692
2019-10-22 00:28:47 +02:00
Adam Jackson
bd1630a12c cogl: Remove unused CoglFeatureFlags
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
ba7b8a5de3 cogl: Remove unused COGL_FEATURE_TEXTURE_YUV
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
d54c548aac clutter: Remove unused deprecated clutter_texture_set_from_yuv_data
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
5e0989532e clutter: Remove unused CLUTTER_FEATURE_TEXTURE_READ_PIXELS
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
cf107c89b8 cogl: Remove always-set COGL_FEATURE_OFFSCREEN
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Georges Basile Stavracas Neto
05da4a6094 clutter/effect: Remove pick flags
As pointed out, they are now unused. Remove
the pick flags.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
Georges Basile Stavracas Neto
db8fcc0537 clutter/actor: Remove pick code from paint
Now that they are properly split, remove the pick
code from paint paths.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
Georges Basile Stavracas Neto
86a5358812 clutter/stage: Pick with clutter_actor_pick()
Use the new function to perform picking.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
Georges Basile Stavracas Neto
ff8ed70f84 clutter/stage: Refactor view setup code
We'll share it between pick and paint, so refactor
the framebuffer and view setup code from paint
into a new function.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
Georges Basile Stavracas Neto
179d5ba6a6 clutter: Split pick and paint
Add the corresponding clutter_actor_pick() and
clutter_actor_continue_pick() as public APIs,
and use them in pick overrides and ClutterEffect.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
Daniel van Vugt
e82a657cd9 clutter/actor: Remove color from the pick virtual function
It's unused since commit 14c706e51.

**ABI break**

https://gitlab.gnome.org/GNOME/mutter/merge_requests/851
2019-10-16 12:01:16 +00:00
Daniel van Vugt
8c89ea5f0a clutter/stage: Do picking with float coordinates
Previously picking was done on an int (x,y) to address a particular pixel.
While `int` was the minimum precision required, it was also an unnecessary
type conversion.

The callers (input events mainly) all provide float coordinates and the
internal picking calculations also have always used floats. So it was
inconsistent and unnecessary to drop to integer precision in between those.

ABI break: This changes the parameter types for public function
`clutter_stage_get_actor_at_pos`, but its documentation is already
sufficiently vague to not need changing.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/844
2019-10-16 11:52:04 +00:00
Georges Basile Stavracas Neto
bdf5e3f357 Replace ClutterGeometry by graphene_rect_t
The last of the replacements. It is fine for now
to replace ClutterGeometry's integers by floats.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:14 +00:00
Georges Basile Stavracas Neto
94682e69aa Replace ClutterRect by graphene_rect_t
https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:14 +00:00
Georges Basile Stavracas Neto
160cc9182d Replace ClutterPoint by graphene_point_t
Remove the tests for ClutterPoint since it's
corresponding code moved to private ClutterStage
methods.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:14 +00:00
Georges Basile Stavracas Neto
cd293f764e Replace ClutterSize by graphene_size_t
https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Georges Basile Stavracas Neto
a5d0cfe8fb Replace ClutterVertex by graphene_point3d_t
Pretty direct and straightforward port. This requires a
GNOME Shell counterpart. In addition to that, include a
progress function.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Georges Basile Stavracas Neto
ba0f17f5b1 Replace CoglVector* by graphene_vec*_t
This is an extremely straightforward and minimalistic port of
CoglVector APIs to the corresponding Graphene APIs.

Make ClutterPlane use graphene_vec3_t internally too, for the
simplest purpose of keeping the patch focused.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Georges Basile Stavracas Neto
7c7ccb2e43 clutter: Pull in Clutter dependencies
Mutter requires Clutter, which requires Cogl. That means
Clutter requires all Cogl dependencies, and Mutter requires
all Clutter dependencies as well.

However, currently, Clutter does not pull in its dependencies,
which means we need to link against Cogl manually.

Add Clutter dependencies to declare_dependency() so that the
graphene dependency only needs to be declared once, for Cogl,
and pulled together.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Georges Basile Stavracas Neto
4f2b217a6a clutter/actor: Drop ClutterActor:clip property
This is a deprecated property that is not used anywhere
in the codebase. Not by GNOME Shell. Because it uses the
deprecated ClutterGeometry type, it's a good target for
cleaning up, given that ClutterGeometry will be dropped
later on.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Georges Basile Stavracas Neto
b1a1d4e13d Remove fog support
Fog is explicitly deprecated in favour of CoglSnippet API,
and in nowhere we are using this deprecated feature, which
means we can simply drop it without any sort of replacement.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Marco Trevisan (Treviño)
553211dd81 clutter/stage: Actually set key focus to an actor on key focus
As per commit c2d03bf73 we're using a private method to set the actors key
focus and emit key-focus-in signal, but we're using inverted logic here.

So flip the parameter to match the expected result.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/860
2019-10-15 16:39:04 +02:00
Marco Trevisan (Treviño)
c2d03bf73e clutter/actor: Save key-focus state and unset it before destruction
When clutter actors with key focus are destroyed we emit ::key-focus-out on
them just after their destruction. This is against our assumption that no
signal should be emitted after "::destroy" (see GNOME/mutter!769 [1]), and
in fact could cause the shell to do actions that we won't ever stop on
destroy callback.

To avoid this to happen, use a private function to set its key-state (so we
can avoid looking for the stage) and emit ::key-focus-in/out events and use
this value in both clutter_actor_has_key_focus(),
clutter_actor_grab_key_focus() and on unmap and destruction to unset the
stage key focus before we emit the ::destroy signal.

As result of this, we can now avoid to unset the key focus on actor
destruction in the stage.

[1] https://gitlab.gnome.org/GNOME/mutter/merge_requests/769

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1704
2019-10-15 12:20:58 +02:00
Marco Trevisan (Treviño)
d4ff5e2d31 clutter/actor: Remove deprecated clutter container foreach
This is deprecated, so replace it with ClutterActorIter or alternative funcs

https://gitlab.gnome.org/GNOME/mutter/merge_requests/816
2019-10-15 08:51:45 +00:00
Marco Trevisan (Treviño)
2773e8adf8 clutter/actor: Remove deprecated internal child support
Clutter had support for internal children in its early revisions, but they
were deprecated for long time (commit f41061b8df, more than 7 years ago) and
no one is using them in both clutter and in gnome-shell.

So remove any alternative code path that uses internal children.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/816
2019-10-15 08:51:45 +00:00
Niels De Graef
0d0286d59e cogl: Remove COGL_INVALID_HANDLE
Just use `NULL`, which is the normal C convention

https://gitlab.gnome.org/GNOME/mutter/merge_requests/451
2019-10-14 17:05:28 +00:00
Niels De Graef
23f77a1b63 cogl: Remove cogl_handle_ref/unref
This is for all intents and purposes the same as
`cogl_object_ref/unref`, but still refers to handles rather than
objects (while we're trying to get rid of the former) so it's a bit of
unnecessary redundant API.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/451
2019-10-14 17:05:28 +00:00
Georges Basile Stavracas Neto
943b069996 clutter/shader-effect: Initialize shader-type properly
The default value of the ClutterShaderEffect:shader-type
property is CLUTTER_FRAGMENT_SHADER. However, because the
struct field is not actually initialized to it, it ends
up assuming the value 0, which is CLUTTER_VERTEX_SHADER.

Properly initialize ClutterShaderEffect's shader_type to
CLUTTER_FRAGMENT_SHADER.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/846
2019-10-11 10:53:33 -03:00
Jonas Ådahl
2c388e2155 clutter/transition: Don't split reference counting with actor
ClutterActor took a reference in its transition 'stopped' handler,
aiming to keep the transition alive during signal emission even if it
was removed during. This is, however, already taken care of by
ClutterTimeline, by always taking a reference during its 'stopped'
signal emission, so no need to add another one.

This also has the bonus of making reference ownership simpler, as well
as avoidance of double free if an actor was destroyed before a
transition has finished.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/828
2019-10-07 18:33:28 +00:00
Jonas Ådahl
6ee006c851 clutter/actor: Mark implicit transitions as remove-on-complete
Implicit transitions had a referenced taken while emitting the
completion signals, but said reference would only be released if it was
had remove-on-complete set to TRUE.

Change this to instead remove the 'is_implicit' state and mark all
implicit transitions as remove-on-complete. This fixes a
ClutterPropertyTransition leak in gnome-shell triggered by e.g. showing
/ hiding menus.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1740

https://gitlab.gnome.org/GNOME/mutter/merge_requests/828
2019-10-07 18:33:28 +00:00
Daniel van Vugt
26b76ee95d clutter/base-types: Clarify docs for point_inside_quadrilateral
The final version of the function was changed to allow points that are
touching the edge of a quadrilateral to be counted as "inside". Update
the function documentation to refect this.

Also clarify that the function is written in such a way that it is
agnostic to clockwise or anticlockwise vertex ordering.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/783
2019-10-03 17:06:28 +00:00
Olivier Fourdan
0a3f25c303 clutter/stage-view: Ignore clipping rectangle for offscreen blit
In `clutter_stage_view_blit_offscreen()`, the given clipping rectangle
is in “view” coordinates whereas we intend to copy the whole actual
framebuffer, meaning that we cannot use the clipping rectangle.

Use the actual framebuffer size, starting at (0, 0) instead.

That fixes the issue with partial repainting with shadow framebuffer
when fractional scaling is enabled.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/820
2019-10-03 10:12:21 +02:00
Marco Trevisan (Treviño)
105a3f757a clutter/actor: Don't emit property changes after ::destroy
Clutter actors might emit property changes in dispose, while unparenting.
However we assume that the ::destroy signal is the last one we emit for an
actor, and that starting from this moment the object is not valid anymore,
and so we don't expect any signal emission from it.

To avoid this, freeze the object notifications on an actor during its
disposition, just before the ::destroy signal emission.

Update the actor-destroy test to verify this behavior.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/769
2019-10-02 17:59:22 +00:00
Marco Trevisan (Treviño)
f376a318ba clutter/actor: Don't emit the parent-set signal on destruction
Clutter actors unset their parent on dispose, after emitting the ::destroy
signal, however this could cause ::parent-set signal emission. Since we
assume that after the destruction has been completed the actor isn't valid
anymore, and that during the destroy phase we do all the signal / source
disconnections, this might create unwanted behaviors, as in the signal
callbacks we always assume that the actor isn't in disposed yet.

To avoid this, don't emit ::parent-set signal if the actor is being
destroyed.

Update the actor-destroy test to verify this behavior.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/769
2019-10-02 17:59:22 +00:00
Olivier Fourdan
05e1a6c2ca clutter/stage-view: Use cogl_blit_framebuffer() for shadow FB
If there is no transformation, use `cogl_blit_framebuffer()` as a
shortcut in `clutter_stage_view_blit_offscreen()`, that dramatically
improves performance when using a shadow framebuffer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/809
2019-09-27 20:47:45 +00:00
Marco Trevisan (Treviño)
c9c53cb55f clutter/actor: Cancel delayed timelines on removal
Delayed clutter timelines might be removed while they are still in the
process of being executed, but if they are not playing yet their delay
timeout won't be stopped, causing them to be executed anyway, leading to a
potential crash.

In fact if something else keeps a reference on the timelines (i.e. gjs), the
dispose vfunc delay cancellation won't take effect, causing the timelines to
be started and added to the master clock.

To avoid this, expose clutter_timeline_cancel_delay() function and call it
if a timeline is not playing but has a delay set.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/815
https://gitlab.gnome.org/GNOME/mutter/merge_requests/805
2019-09-20 16:51:20 +02:00
Marco Trevisan (Treviño)
1e637bd7e1 clutter/timeline: Don't emit ::paused signal on delayed timelines
If a timeline is delayed and we request to stop or pause it, we are emitting
the "::paused" signal on it, however this has never been started, and so
nothing has really be paused.

So, just try to cancel the delay on pause and return if not playing.

No code in mutter or gnome-shell is affected by this, so it is safe to
change.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/805
2019-09-20 16:51:20 +02:00
Marco Trevisan (Treviño)
63a0b702c9 clutter/timeline: Use a function to cancel the delay timeout
Avoid repeating the same code for canceling the delay timeout, using a
function for later uses.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/805
2019-09-20 16:51:20 +02:00
Marco Trevisan (Treviño)
b69d2aa6a0 stage: Compute view perspective when parameters changed
Clutter stage used to compute the initial projection using a fixed z
translation which wasn't matching the one we computed in
calculate_z_translation().
This caused to have a wrong initial projection on startup which was then
correctly recomputed only at the first paint.

However, since this calculation doesn't depend on view, but only on viewport
size, perspective's fovy and z_near we can safely do this at startup and
only when any of those parameters change.

Then we can move the computation out _clutter_stage_maybe_setup_viewport()
since the cogl framebuffer viewport sizes aren't affecting this.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1639
https://gitlab.gnome.org/GNOME/mutter/merge_requests/803
2019-09-20 13:51:33 +02:00
Daniel van Vugt
0b19078b2b clutter/stage-cogl: Use portable formatting for 64-bit integers
On 64-bit systems int64_t is %ld but on 32-bit systems it is %lld.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/778
2019-09-20 11:55:32 +02:00
Daniel van Vugt
7811865e84 clutter/paint-node: Convert safely from pointer to integer
To support 32-bit systems without compiler warnings.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/778
2019-09-20 11:55:25 +02:00
Jonas Dreßler
ab7af2d0c5 clutter/actor: Remove unused private function
`_clutter_actor_get_transition` is almost identical to
`clutter_actor_get_transition` and isn't used anywhere in the code (we
stopped using it with ee00e37b), remove it!

https://gitlab.gnome.org/GNOME/mutter/merge_requests/791
2019-09-12 21:36:02 +00:00
Jonas Dreßler
f92e0bec0b clutter/actor: Fix a wrong comment
According to the definition of ClutterAnimationInfo in
clutter-actor-private.h, `transitions` is the third variable of the
struct, not the first one.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/791
2019-09-12 21:36:02 +00:00
Olivier Fourdan
2f072af02b clutter/input-pointer-a11y: Restore pointer a11y on resume
When suspending, the devices are removed and the virtual device
associated with the corresponding core pointer is disposed.

Add the pointer accessibility virtual device to the core pointer
on resume to restore pointer accessibility on resume if enabled.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/761
2019-09-02 17:27:17 +00:00
Daniel van Vugt
14c706e51b clutter: Introduce geometric picking
Currently, Clutter does picking by drawing with Cogl and reading
the pixel that's beneath the given point. Since Cogl has a journal
that records drawing operations, and has optimizations to read a
single pixel from a list of rectangle, it would be expected that
we would hit this fast path and not flush the journal while picking.

However, that's not the case: dithering, clipping with scissors, etc,
can all flush the journal, issuing commands to the GPU and making
picking slow. On NVidia-based systems, this glReadPixels() call is
extremely costly.

Introduce geometric picking, and avoid using the Cogl journal entirely.
Do this by introducing a stack of actors in ClutterStage. This stack
is cached, but for now, don't use the cache as much as possible.

The picking routines are still tied to painting.

When projecting the actor vertexes, do it manually and take the modelview
matrix of the framebuffer into account as well.

CPU usage on an Intel i7-7700, tested with two different GPUs/drivers:

  |         |     Intel | Nvidia |
  | ------: | --------: | -----: |
  | Moving the mouse:            |
  | Before  |       10% |    10% |
  | After   |        6% |     6% |
  | Moving a window:             |
  | Before  |       23% |    81% |
  | After   |       19% |    40% |

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/154,
        https://gitlab.gnome.org/GNOME/mutter/issues/691

Helps significantly with: https://gitlab.gnome.org/GNOME/mutter/issues/283,
                          https://gitlab.gnome.org/GNOME/mutter/issues/590,
                          https://gitlab.gnome.org/GNOME/mutter/issues/700

v2: Fix code style issues
    Simplify quadrilateral checks
    Remove the 0.5f hack
    Differentiate axis-aligned rectangles

https://gitlab.gnome.org/GNOME/mutter/merge_requests/189
2019-09-02 16:41:13 +00:00
Daniel van Vugt
a70823dd1c clutter/point: Add ClutterPoint quarilateral testing API
Add a function to check whether a point is inside a quadrilateral
by checking the cross product of vectors with the quadrilateral
points, and the point being checked.

If the passed quadrilateral is zero-sized, no point is ever reported
to be inside it.

This will be used by the next commit when comparing the transformed
actor vertices.

[feaneron: add a commit message and remove unecessary code]

https://gitlab.gnome.org/GNOME/mutter/merge_requests/189
2019-09-02 16:41:13 +00:00
Jonas Ådahl
97140ab634 Revert "clutter/stage-cogl: Remove pending_swaps counter"
This reverts commit f57ce7254d.

It causes crashes, https://gitlab.gnome.org/GNOME/mutter/issues/735, and
changes various expectations relied upon by the renderer code, and being
close to release, it's safer to revert now and reconsider how to remove
the pending swap counter at a later point.
2019-08-27 20:16:01 +03:00
Jonas Dreßler
a51437ee2b clutter/input-pointer-a11y: Include success boolean in stop signals
Add a boolean parameter to the signal to inform the handler whether the
timeout completed successfully or not. This allows the shell to
gracefully end the pie timer animation and show a success animation when
the click happens.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/745
2019-08-27 07:36:57 +00:00
Olivier Fourdan
b8dcd5f842 clutter/main: Ignore synthetic events for accessibility
When a dwell click causes the pointer to move to another surface, a
synthetic event is generated which triggers another dwell click.

Make sure we ignore those to avoid dwell clicking twice in a raw.

Suggested-by: Carlos Garnacho <carlosg@gnome.org>
https://gitlab.gnome.org/GNOME/mutter/merge_requests/747
2019-08-24 12:43:20 +03:00
Olivier Fourdan
14e02635ff clutter/input-pointer-a11y: Trigger dwell detection in a timeout
Restarting the dwell click immediately would result in a contant
animation showing.

Start dwell detection in its own timeout handler, which has the nice
effect of not constantly showing a dwell animation and also making sure
that the dwell click timeout is started when pointer movement stops.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/747
2019-08-24 12:43:20 +03:00
Jonas Dreßler
9b3b5badfb clutter/input-pointer-a11y: Fix dwell timeout start after moving pointer
Sometimes the dwell timeout doesn't start again after quickly moving the
pointer. That happens if `should_stop_dwell` returns TRUE for the last
motion event we receive: It will stop the current timeout, but not start
a new one until we receive another event where the moved distance is
smaller than the threshold.

To fix this, always call `should_start_dwell` and `start_dwell_timeout`
instead of using an else-block, this makes sure we start a new dwell
timeout still during the same motion event that stopped the old one.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/746
2019-08-24 09:25:14 +00:00
Jonas Dreßler
47c1558287 clutter/input-pointer-a11y: Remove unneeded character
https://gitlab.gnome.org/GNOME/mutter/merge_requests/746
2019-08-24 09:25:14 +00:00
Carlos Garnacho
cc7e843c44 tests: Move clutter-test-utils.[ch] to src/tests
And add the necessary glue so those initialize a X11 clutter backend.
This should get Clutter tests that are dependent on windowing to work
again, thus they were enabled back again.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
cfb8f18cef clutter: Move tests to src/tests
Clutter doesn't hold anymore backend implementations, move tests where
we have one that we may assign.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
8b03d9ecc3 clutter: Move evdev input to src/backends/native
The end goal is to have all clutter backend code in src/backends. Input
is the larger chunk of it, which is now part of our specific
MutterClutterBackendNative, this extends to device manager, input devices,
tools and keymap.

This was supposed to be nice and incremental, but there's no sane way
to cut this through. As a result of the refactor, a number of private
Clutter functions are now exported for external backends to be possible.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
ea54ce7d96 clutter: Drop functions to get XVisualInfo
We don't need nor use visuals anymore.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00