Commit Graph

6993 Commits

Author SHA1 Message Date
Sebastian Keller
65401ed3f9 clutter/cogl: Plug region leak in clutter_stage_cogl_redraw_view
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/1000
2020-01-16 20:57:20 +00:00
Jonas Ådahl
6e5ac0b585 Use G_GNUC_FALLTHROUGH instead of comments
Get the same task done in a bit more C:y way.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/998
2020-01-09 17:58:29 +01:00
Georges Basile Stavracas Neto
84ea4ad990 clutter/brightness-contrast-effect: Compare float with G_APPROX_VALUE
Nobody should ever compare float for equality. Use G_APPROX_VALUE to
check that.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/992
2020-01-07 14:20:21 -03:00
Georges Basile Stavracas Neto
64685f4b20 clutter/offscreen-effect: Clear offscreen when pre-paint fails
Some ClutterOffscreenEffect subclasses, such as ClutterBrightnessContrastEffect,
early-return FALSE in pre-paint before chaining up. It's an important optimization
that avoids creating or updating the offscreen framebuffer.

However, if an offscreen framebuffer already exists by the time pre-paint fails,
it will be used *without* repaint the actor over it. That causes an old picture
of the actor to be displayed.

Fix that by always clearing the offscreen framebuffer when pre-paint fails.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/810

https://gitlab.gnome.org/GNOME/mutter/merge_requests/992
2020-01-07 14:20:21 -03:00
Georges Basile Stavracas Neto
bf594e9fb6 clutter/offscreen-effect: Clear offscreen framebuffer when disabling
When changing the 'enabled' property and disabling the offscreen effect,
it doesn't make sense to preserve the offscreen framebuffer. It's not
drawing, after all.

Furthermore, because ClutterOffscreenEffect only checks if the offscreen
framebuffer exists to decide whether or not to redraw, keeping the fbo
alive is a waste of resources.

Clear the offscreen framebuffer when the effect is disabled or enabled.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/810

https://gitlab.gnome.org/GNOME/mutter/merge_requests/992
2020-01-07 14:19:33 -03:00
Georges Basile Stavracas Neto
3958e75ed2 clutter/offscreen-effect: Use g_clear_pointer for cleanup
It does the exact same checks, and saves us a few lines of code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/992
2020-01-07 14:02:25 -03:00
Sebastian Keller
674f52ba74 clutter/stage: Fix picking of rectangles with negative positions
FLT_MIN is the smallest *positive* number above 0 that can be
represented as floating point number. If this is used to initialize the
maximum x/y coordinates of a rectangle, this will always be used if all
x/y coordinates of the rectangle are negative. This means that picking
at 0,0 will always be a hit for such rectangles.

Since mutter creates such a window for server side decorations on X11,
this window will always be picked at 0,0 preventing clicking/hovering
the activities button in gnome-shell at that coordinate.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/893
2019-12-23 17:53:53 +01:00
Adam Jackson
a46fd33460 clutter: Remove unneeded X11 includes from various headers
https://gitlab.gnome.org/GNOME/mutter/merge_requests/977
2019-12-18 16:06:35 +00:00
Robert Mader
06fa131235 clutter-timeline: Fix some indentation
In Gnome Builder this looks very odd, much worse than in git.
We'll probably not touch the code soon, so fix indentation
for better readability.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/965
2019-12-09 17:53:51 +01:00
Georges Basile Stavracas Neto
0d1c18a4ce paint-context: Expose push and pop framebuffer
When rendering on-stage, it might be necessary to push offscreen
framebuffers to the paint context by external consumers, such as
GNOME Shell effects.

Expose clutter_paint_context_push|pop_framebuffer().

https://gitlab.gnome.org/GNOME/mutter/merge_requests/955
2019-12-03 16:41:34 -03:00
Jonas Ådahl
4ede6ea8c5 cogl: Remove the framebuffer and source stacks
They have been deprecated for a long time, and all their uses in clutter
and mutter has been removed. This also removes some no longer needed
legacy state tracking, as they were only ever excercised in certain
circumstances when there was sources (pipelines or materials) on the now
removed source stack.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
629dc4c770 clutter/paint-nodes: Add missing newline
https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
3f65837e0d clutter, core: Stop using the Cogl framebuffer stack
The Cogl framebuffer stack is going away; replace all its uses by the
framebuffer stack carried by the paint context.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
fd0ce66ac1 clutter/paint-nodes: Stop using implicit framebuffer stack Cogl API
Stop using API that uses the implicit Cogl framebuffer stack, (e.g.
cogl_push_matrix()) and replace usage by the corresponding API taking an
explicit framebuffer (e.g. cogl_framebuffer_push_matrix()).

For offscreens etc, the offscreen framebuffer is still pushed to and
popped from the Cogl framebuffer stack, so that paint nodes still draw
to the right framebuffer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
c621d4d571 clutter/offscreen-effect: Don't use implicit framebuffer Cogl APIs
While we still push and pop to the Cogl framebuffer stack, as so is
still needed to render the actors correctly, don't use the API using the
implicit framebuffer stack ourself in the offscreen effect code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
8329c6b069 clutter/paint-node: Use non-deprecated Cogl API when drawing operations
The paint node drawing partly used deprecated Cogl implicit stack APIs.
Port that over to the non-deprecated variants.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
f11170fecb clutter/paint-node: Have caller of .._get_framebuffer() handle fallback
clutter_paint_node_get_framebuffer() fell back on
cogl_get_draw_framebuffer() when the root node didn't have a custom
get_framebuffer vfunc. As this relies on deprecated implicit Cogl stack
API, it needs to go away, so handle this in the caller that knows more
about the context.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
48e6fccc95 clutter/pipeline-paint-node: Use draw framebuffer when drawing primitives
As with all the other draw operations, use the current draw framebuffer
to draw the primitives.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
61026d181b clutter/root-node: Require non-null framebuffer on construction
It's the only way it's used, and it removes a usage of deprecated Cogl
implicit stack API.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
5145b33e01 clutter/paint-node: Remove unnecessary NULL check in get_framebuffer()
The only way we would ever get NULL there is if the node passed to the
function is NULL, and that is invalid input to begin with.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
8ce3b3d99e clutter/actor: Remove unnecessary NULL check from paint_node()
The function is static, only has one caller, that always passes a
non-NULL pointer, so the NULL check just adds confusion.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
9c43b12206 clutter/stage: Remove "active framebuffer" state
It has been replaced by the base framebuffer of the paint context.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
78a7c93802 clutter: Use paint context to get paint target framebuffer
Instead of using the intermediate stage state "active framebuffer" to
find the framebuffer a paint eventually targets, use the "base
framebuffer" of the paint context, as this more correctly corresponds to
the end point of a paint. It also means we can then later remove this
intermediate state from the stage.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
5c68596744 clutter/paint-context: Add API to get base framebuffer
This corresponds to the framebuffer the paint targets. For regular stage
redraws, this means the framebuffer of the stage view.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
61b1ead1a2 clutter: Use pick context to track the framebuffer
Instead of pushing and popping the Cogl framebuffer stack, use the
framebuffer passed around using the pick context. This removes usage of
the deprecated framebuffer stack when picking.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
138907c480 clutter/actor: Use paint context when culling to check render target
Rendering off stage we never cull, and previously this was checked by
comparing the "active framebuffer" of the stage, to the current
framebuffer in the cogl stack. Replace this by checking whether the
current paint context is currently drawing on stage or not.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
455535128a clutter/actor: Change comment to refer to non-deprecated API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
53431fce2a clutter/paint-nodes: Stop using deprecated cogl_pango API
As with ClutterText, use the one where you pass the framebuffer
explicitly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
339372ac99 clutter/text: Stop using deprecated cogl-pango API
Use the one passing a framebuffer instead of the one using the
deprecated implicit framebuffer stack.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
cb9d6b79ef clutter: Introduce pick contexts
Just as with painting, add a pick context that carries pick related
temporary state when doing actor picking. It is currently unused, and
will at least at first still carry around a framebuffer to deal track
view transforms etc.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Jonas Ådahl
49c8d42317 clutter: Introduce paint contexts
When painting, actors rely on semi global state tracked by the state to
get various things needed for painting, such as the current draw
framebuffer. Having state hidden in such ways can be very deceiving as
it's hard to follow changes spread out, and adding more and more state
that should be tracked during a paint gets annoying as they will not
change in isolation but one by one in their own places. To do this
better, introduce a paint context that is passed along in paint calls
that contains the necessary state needed during painting.

The paint context implements a framebuffer stack just as Cogl works,
which is currently needed for offscreen rendering used by clutter.

The same context is passed around for paint nodes, contents and effects
as well.

In this commit, the context is only introduced, but not used. It aims to
replace the Cogl framebuffer stack, and will allow actors to know what
view it is currently painted on.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
2019-12-03 19:02:14 +00:00
Carlos Garnacho
f4bf48a7d7 clutter: Drop unused API
clutter_stage_*_get_clip_region_bounds() is no longer used and may be
removed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/867
2019-11-22 21:07:05 +00:00
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