Commit Graph

7157 Commits

Author SHA1 Message Date
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
Carlos Garnacho
cb31e3e12a clutter: Drop unused function to translate to screen coordinates
We don't have anything like GdkInputMode that we'd like to honor, this
can just be dropped.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
ad72fa46b0 clutter: Move X11 input to src/backends/x11
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
MutterClutterBackendX11, 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
fa4580de53 clutter: Temporarily comment out clutter tests
It will be enabled back in later commits. We're set for quite a ride
here.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
5e343e2c16 clutter: Remove support for foreign stages
We have no use for this.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
ef93bb6471 clutter: Remove event retrieval toggle
This is x11-specific API that was added back when clutter was out
of tree. Just remove it and directly do what we want.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
d6aaef9954 clutter: Drop _() define
It's an unused no-op, we can do without it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
2ca351366e clutter/cally: Remove needless per-backend code in cally
We can poke the X11 stage to translate to root coordinates, or just assume
the compositor will cover the root window area and avoid per-backend behavior
here.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
Carlos Garnacho
f54bf022bd clutter: Remove ClutterEventExtender interface
Just move those methods to ClutterDeviceManager, since the two available
ones want to implement it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:07 +00:00
Carlos Garnacho
e56df455ae clutter: Drop ClutterEventTranslator interface
We don't need that much complexity when we have a fixed set of
translators, and only one of them wants a given event.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:07 +00:00
Carlos Garnacho
54101b1948 clutter: Use G_DECLARE_DERIVABLE_TYPE for ClutterDeviceManager
https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:07 +00:00
Carlos Garnacho
829d9c863c clutter: Move scattered x11 keymap code into ClutterKeymapX11
https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:07 +00:00
Carlos Garnacho
f304fa4869 Drop xinput2 version checks
We always request XInput >= 2.3 and fail otherwise, we don't need to
check for lower versions for touch events.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:07 +00:00
Carlos Garnacho
a32559e5ae clutter: Remove "has_xinput" x11 API
We always must have xinput, this is moot now.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:07 +00:00
Georges Basile Stavracas Neto
e33d6b2908 clutter/paint-node: Expose clutter_paint_node_get_framebuffer()
Mutter needs to know which framebuffer the paint nodes will be
drawn into, and using cogl_get_draw_framebuffer() directly is
not an option since ClutterRootNode only pushes the draw fb
at draw time.

Expose clutter_paint_node_get_framebuffer().

https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
2019-08-23 13:23:07 +00:00
Daniel van Vugt
5c617ac286 clutter/stage: Only queue compressible events
Incompressible events already pass through unmodified, so queuing them
just wasted time and memory.

We would however like to keep the ordering of events so we can only
apply this optimization if the queue is empty.

This reduces the input latency of incompressible events like touchpad
scrolling or drawing tablets by up to one frame. It also means the same
series of events now arrives at the client more smoothly and not in
bursts.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/711
2019-08-20 23:52:49 +00:00
Daniel van Vugt
bc08ad2fbb clutter/device-manager-evdev: Update device modifiers before queuing
Until now we would:

  1. Enqueue modifier key event on the stage.
  2. Update device modifier state.
  3. Dequeue and process modifier key event with NEW device modifier state.

But if we consider optimizing out the queuing in some cases then there
will become a problem:

  1. Process modifier key event with OLD device modifier state.
  2. Update device modifier state.

To correct the above we now do:

  1. Update device modifier state.
  2. Queue/process modifier key event with NEW device modifier state.

It appears commit dd940a71 which introduced the old behaviour was correct
in the need to update the device modifier state, but is at least no longer
correct (if it ever was) that it should be done after queuing the event.
If queuing is working, as it is right now, then it makes no difference
whether the device modifier state is updated before or after. Because both
cases will come before the dequeing and processing.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/711
2019-08-20 23:52:49 +00:00
Jonas Dreßler
0947bc37d3 clutter/main: Move grabbing functions to clutter-input-device.c
Thanks to the now removed global/context grabs, we can move pointer and
keyboard grabs back home to where they belong.

While at it, also add handling of CLUTTER_TABLET_DEVICE devices to
`on_grab_actor_destroy` and `clutter_input_device_get_grabbed_actor`.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/536
2019-08-20 14:11:38 +02:00
Jonas Dreßler
959eb98090 clutter/main: Remove global/context grabs
Those are deprecated in favour of per device grabs.

Also switch to ClutterInputDevice grabs for the grab test.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/536
2019-08-20 14:08:44 +02:00
Jonas Dreßler
32dcf77a8f clutter/text: Switch to input device grabs
The old global/context grabs are being removed in favour of input device
grabs.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/536
2019-08-20 14:08:44 +02:00
Niels De Graef
9d65eab549 clutter: Use va_marshaller for Actor signals
If possible, GLib will try to use the va_marshaller to pass the signal
arguments, rather than unboxing into and out of a `GValue`. This is much
more performant and especially good for often-thrown signals.

The original bug even mentions Clutter performance issues as a drive to
implement the va_marshaller in GLib (see
https://bugzilla.gnome.org/show_bug.cgi?id=661140).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/700
2019-08-19 13:09:56 +00:00
Niels De Graef
c4a9117ef8 clutter: Remove marshallers that are available in GLib
Some of the marshallers we generate in `clutter-marshal.list` are also
available in GLib, so we don't need to generate them ourselves. Even
more, by passing NULL to `g_signal_new` in these cases will actually
internally optimize this even more by also setting the valist
marshaller, which is a little bit faster than the regular marshalling
using `GValue` and libffi.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/700
2019-08-19 13:09:56 +00:00
Daniel van Vugt
f57ce7254d clutter/stage-cogl: Remove pending_swaps counter
As a protection against duplicate/early update times, it has already
been replaced by commit 35aa2781 and commit 4faeb127.

Removing it also prevents a common cause of frame skips:

  clutter_stage_cogl_schedule_update()
  clutter_stage_cogl_get_update_time() == -1

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1411

https://gitlab.gnome.org/GNOME/mutter/merge_requests/719
2019-08-16 16:44:27 +00:00
Florian Müllner
7ab07b05e9 clutter-actor: Expose layout manager properties to transitions
ClutterActor allows using properties of actions, constraints and effects
in transitions. Extend that functionality to allow the same for the actor's
layout manager.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/716
2019-08-06 23:19:33 +02:00
Florian Müllner
56a5c5e4d1 cleanup: Stop using g_get_current_time ()
It has been deprecated because it isn't Y2k38 ready, so replace it
with g_get_real_time () which is.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/708
2019-08-03 16:12:32 +00:00
Niels De Graef
ddbdb5fa77 clutter: Use g_object_notify_by_pspec()
`g_object_notify()` actually takes a global lock to look up the property
by its name, which means there is a performance hit (albeit tiny) every
time this function is called. For this reason, always try to use
`g_object_notify_by_pspec()` instead.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/703
2019-07-30 13:50:17 +02:00
Florian Müllner
08a3cbfc6c clutter: Force an allocation on clone source if necessary
Since commit 0eab73dc, actors are only allocated when they are actually
visible. While this generally works well, it breaks - because of *course*
it does - ClutterClones when the clone source (or any of its ancestors)
is hidden.

Force an allocation in that case to allow the clone's paint to work as
intended.

https://gitlab.gnome.org/GNOME/mutter/issues/683
2019-07-23 01:38:38 +00:00
Florian Müllner
87c734cef9 cleanup: Really stop using G_TYPE_INSTANCE_GET_PRIVATE()
Commit 4259cfd4c6 missed some occurences, move those to the generated
get_instance_private() functions as well.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/691
2019-07-22 09:48:29 +00:00
Florian Müllner
c755fb6995 clutter-tests: Fix macro definitions
FOO_OBJECT() macros should cast to the corresponding instance type,
not the class.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/691
2019-07-22 09:48:29 +00:00
Florian Müllner
9189b7b512 clutter: Stop using GParameter
The type has been deprecated, so stop using it. The easiest replacement
would be to add our own struct, but considering that separate name/value
arrays are easier to free (g_auto!) and we already do the split in one
place, go that route.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/689
2019-07-18 11:01:09 +02:00
Florian Müllner
4fdefb5b2e cleanup: Don't use g_memmove()
Glib stopped providing any fallback implementations on systems without
memmove() all the way back in 2013. Since then, the symbol is a simple
macro around memmove(); use that function directly now that glib added
a deprecation warning.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/689
2019-07-18 11:01:09 +02:00
Carlos Garnacho
0eab73dc2e clutter: Defer actor allocations till shown
Currently nothing in the clutter machinery prevents hidden portions
of the actor tree from calling queue_relayout() (and having it fully
honored).

But that allocation should not be necessary till the actor is shown,
and one of the things we do on show() is queueing a relayout/redraw
after flagging the actor as visible.

We can simply defer clutter_actor_allocate() calls till that show()
call, and leave the needs_allocate and other flags set so we ensure
the allocation is properly set then.

This should cut down some needless operations when invisible portions
of the actor tree change indirectly due to user interaction, or due
to background activity.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/677
2019-07-08 13:21:40 +00:00
Georges Basile Stavracas Neto
b0b1ff36ae clutter/main: Simplify thead lock handling
Now that there are only the default thread functions in
place, we don't need to store them.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:35 -03:00
Georges Basile Stavracas Neto
5ed9abd51a clutter/main: Remove the rest of deprecated functions
https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:33 -03:00
Georges Basile Stavracas Neto
65c5260312 clutter/main: Remove deprecated input device functions
https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:30 -03:00
Georges Basile Stavracas Neto
7d9674149f clutter/main: Remove various deprecated thread functions
https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:28 -03:00
Georges Basile Stavracas Neto
25376b3b3c clutter/main: Remove clutter_get_show_fps
https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:25 -03:00
Georges Basile Stavracas Neto
b86a67c80a clutter/main: Remove clutter_redraw
https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:22 -03:00
Georges Basile Stavracas Neto
7419ab7de5 clutter/main: Remove ClutterFontFlags and family
More unused code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:19 -03:00
Georges Basile Stavracas Neto
6b853ffdbd clutter/main: Remove clutter_clear_glyph_cache
Deprecated and unused.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:16 -03:00
Georges Basile Stavracas Neto
ad220fc025 clutter/main: Remote global motion event handling
Clutter has two motion event toggles: one in the global context, and
one per stage. The global one is deprecated, and currently unused.

Remove the global motion event handling.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:13 -03:00
Georges Basile Stavracas Neto
5bd85ef7e5 clutter/main: Remove shader stack
It is private to Clutter, and also unused by Clutter.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:09 -03:00
Niels De Graef
70bacb9402 cogl: Remove CoglError wrapper
CoglError was added at a certain point to remove the hard dependency on
GLib, but since this can't be avoided inside mutter, let's remove this
whole abstraction.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/631
2019-06-20 18:25:04 +02:00
Olivier Fourdan
02fc0b4533 clutter/evdev: Implement togglekeys notification
Notify with a system sound when the modifiers lock state is changed.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/637
2019-06-20 11:40:13 +00:00
Olivier Fourdan
36155f72d0 clutter/evdev: Do not reset timers on togglekeys
The “togglekeys” setting is to emit a sounds whenever the state of one
of the modifiers keys (CAPS lock, NUM Lock, SCROLL lock) is changed, it
has nothing to do with the rest of the accessibility settings.

Therefore, there is no need to reset the various timers used by
accessibility whenever the “togglekeys” setting is changed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/614
2019-06-20 11:40:13 +00:00
Georges Basile Stavracas Neto
088117a619
clutter/tests: Connect to ClutterStage:paint-view
ClutterStage:after-paint now does not guarantee a valid
implicit framebuffer pushed to the stack. Instead, use
the new 'paint-view' signal, that is emitted at a point
in the drawing routine where a framebuffer is pushed.

In addition to that, stop using the implicit framebuffer
API and port the actor-shader-effect test to read from
the view's framebuffer directly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/623
2019-06-19 13:12:17 -03:00
Georges Basile Stavracas Neto
4a19628829
clutter/stage: Add ClutterStage:paint-view
Now that ClutterStageView is embraced as part of the public
set of Clutter classes, is it possible to give consumers
of this API more information and control over the drawing
routines of ClutterStage.

Introduce ClutterStage:paint-view, a signal that is emitted
for painting a specific view. It's defined as a RUN_LAST
signal to give anyone connecting to it the ability to run
before the view is actually painted, or after (using the
G_CONNECT_AFTER flag, or g_signal_connect_after).

This signal has a corresponding class handler, which allows
Mutter to have much finer control over the painting routines.
In fact, this will allow us to implement a "paint phase watcher"
mechanism in the following patches.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/623
2019-06-19 13:12:17 -03:00
Georges Basile Stavracas Neto
0cd54c5735
clutter/stage: Emit after-paint after painting
ClutterStage:after-paint is supposed to be emitted after all
painting is done, but before the frame is finished. However,
as it is right now, it is being emitted after each view is
painted -- on multi-monitor setups, after-frame is being
emitted multiple times.

Send after-paint only once, after all views are painted and
before finishing the frame.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/623
2019-06-19 12:35:29 -03:00
Georges Basile Stavracas Neto
cc2c670a5e
clutter/stage: Own clutter_stage_get_view_at()
This function is exported as a Mutter-specific function,
but now that ClutterStageView is part of the public API,
ClutterStage can own this function.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/623
2019-06-19 12:35:29 -03:00
Georges Basile Stavracas Neto
769a01f4e9
clutter: Make ClutterStageView a public class
As a compositor toolkit, it makes sense to allow consumers
of Clutter interact with the stage views themselves. As such,
ClutterStageView should be a public class.

As such, it is now included in clutter.h and should not be
included directly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/623
2019-06-19 12:35:29 -03:00
Georges Basile Stavracas Neto
9c1afbbb67
clutter/stage-view: Annotate some functions
The GIR parser cannot figure out the ownership model of
ClutterStageView.get_framebuffer() and .get_offscreen()
without them, and throws us a couple of warnings.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/623
2019-06-19 12:35:28 -03:00
Georges Basile Stavracas Neto
376725e30e
clutter/stage-view: Move unexported functions to private header
Next commits will expose ClutterStageView as a public class, so
move the functions private to Clutter to a private header.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/623
2019-06-19 12:35:27 -03:00
Niels De Graef
689c7f4107 clutter: Remove unused ClutterWaylandSurface
This allows for some further cleanups, since it is the sole consumer of
some functions in Cogl.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/624
2019-06-18 09:54:00 +02:00
Jonas Ådahl
3073acc3b0 clutter/stage: Remove offscreen property
It was deprecated, unused and unimplemented, so lets remove it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/616
2019-06-13 14:28:46 +00:00
Jonas Ådahl
a61d525111 clutter: Remove stage fullscreening
Another unneeded feature related to clutter originally being an
application library that we have no use for when we're only ever a
compositor.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/616
2019-06-13 14:28:46 +00:00
Jonas Ådahl
4064d9a7a7 clutter: Remove ability to be user resizable
It's a functionality from the application centric clutter that we don't
need for compositors.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/616
2019-06-13 14:28:46 +00:00
Florian Müllner
8a06cfdd81 enum-types: Use @basename@ in header comment
@filename@ may contain arch-specific bits that introduce unnecessary
multi-lib issues.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/617
2019-06-12 18:01:36 +02:00
Pekka Paalanen
c24d8e856b clutter/x11: Fix build without libwacom
When libwacom is configured disabled, this error appears:

../clutter/clutter/x11/clutter-input-device-xi2.c: In function ‘clutter_input_device_xi2_finalize’:
../clutter/clutter/x11/clutter-input-device-xi2.c:122:7: error: ‘device_xi2’ undeclared (first use in this function)
   if (device_xi2->inhibit_pointer_query_timer)

Fix it with the "obvious" solution.

This code was added in c1303bd642.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/611
2019-06-10 14:25:05 +03:00
Daniel van Vugt
9db9793f33 clutter: Clarify clutter_stage_get_actor_at_pos docs
When a user moves their cursor the perceived behaviour is that it will
pick what is under the cursor. However this isn't how picking works.
Picking does a virtual redraw of the screen, so in some cases what gets
picked isn't the same as what the user could see on the previous frame.
It more represents what will be drawn on the next frame than what is on
screen at present.

It may be unsafe to change these semantics, and they are useful anyway.
Just document it better.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/214
2019-06-07 19:58:49 +00:00
Daniel van Vugt
c237bc5f45 clutter-effect: Rename get_paint_volume
`_clutter_effect_get_paint_volume` was misleading. Its only purpose is
to modify an existing paint volume. So change `get` to `modify`.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/115
2019-06-07 19:51:53 +00:00
Jonas Ådahl
4abca411f3 clutter/stage: Expose stage view getter helper as API
Non-introspected and private to mutter, for getting a stage view from a
coordinate.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/610
2019-06-07 19:11:34 +00:00
Jonas Ådahl
e48c7c009a clutter/stage: Make view fetch helper take floats
https://gitlab.gnome.org/GNOME/mutter/merge_requests/610
2019-06-07 19:11:34 +00:00
Georges Basile Stavracas Neto
1dbf25afa1
clutter/stage-cogl: Protect against extremely high refresh rates
After 4faeb12731, the maximum time allowed for an update to happen
is calculated as:

  max_render_time_allowed = refresh_interval - 1000 * sync_delay;

However, extremely small refresh intervals -- that come as consequence
to extremely high refresh rates -- may fall into an odd numerical range
when refresh_interval < 1000 * sync_delay. That would give us a negative
time.

To be extra cautious about it, add another sanity check for this case.

Change suggested by Jasper St. Pierre.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/363
2019-06-07 12:20:49 -03:00
Daniel van Vugt
e415cc538a
clutter/master-clock: Remove fallback throttles
The presentation timing logic (via `master_clock_get_swap_wait_time`) now
works unconditionally. By "works" we mean that a result of zero from
`master_clock_get_swap_wait_time` actually means zero now. Previously
zero could mean either a successful result of zero milliseconds or that
the backend couldn't get an answer. And a non-zero result is the same as
before.

This works even if the screen is "idle" and even if the backend doesn't
provide presentation timestamps. So now our two fallback throttling
mechanisms of relying on `CLUTTER_FEATURE_SWAP_THROTTLE` and decimating
to `clutter_get_default_frame_rate` can be deleted.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/406 and
        https://bugzilla.gnome.org/show_bug.cgi?id=781835

https://gitlab.gnome.org/GNOME/mutter/merge_requests/363
2019-06-07 12:08:49 -03:00
Daniel van Vugt
67a3715ded
clutter/stage-cogl: Reduce while loop iterations
If `last_presentation_time` is zero (unsupported) or just very old
(system was idle) then we would like to avoid that triggering a large
number of loop interations. This will get us closer to the right answer
without iterating.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/363
2019-06-07 12:08:49 -03:00
Daniel van Vugt
35aa278194
clutter/stage-cogl: Stop schedule_update repeatedly returning now
That could happen if the backend did not provide presentation timestamps,
or if the screen was not changing other than the hardware cursor:

  if (stage_cogl->last_presentation_time == 0||
      stage_cogl->last_presentation_time < now - 150000)
    {
      stage_cogl->update_time = now;
      return;
    }

By setting `update_time` to `now`, master_clock_get_swap_wait_time()
returns 0:

  gint64 now = g_source_get_time (master_clock->source);
  if (min_update_time < now)
    {
      return 0;
    }
  else
    {
      gint64 delay_us = min_update_time - now;
      return (delay_us + 999) / 1000;
    }

However, zero is a value unsupported by the default master clock
due to:

  if (swap_delay != 0)
    return swap_delay;

All cases are now handled by extrapolating when the next presentation
time would be and calculating an appropriate update time to meet that.

We also need to add a check for `update_time == last_update_time`, which
is a situation that just became possible since we support old (or zero)
values of `last_presentation_time`. This avoids getting more than one
stage update per frame interval when input events arrive without
triggering a stage redraw (e.g. moving the hardware cursor).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/363
2019-06-07 12:03:35 -03:00
Daniel van Vugt
a76762a05e clutter/stage-cogl: Use default frame rate instead of hardcoded 60Hz
Instead of 0Hz falling back to 60Hz, use `CLUTTER_DEFAULT_FPS` which is
also 60Hz by default.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/363
2019-06-07 14:42:01 +08:00
Daniel van Vugt
ccf27e5f83 clutter/stage-cogl: Schedule immediate update on zero refresh interval
Instead of crazy refresh rates >1MHz falling back to 60Hz, just honour
them by rendering unthrottled (same as `sync_delay < 0`). Although I
wouldn't actually expect that path to ever be needed in reality, it just
ensures an infinite `while` loop never happens.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/363
2019-06-07 14:42:01 +08:00
Daniel van Vugt
912a9ecfba clutter/stage-cogl: Use G_USEC_PER_SEC instead of hardcoded number
One million is the number of microseconds in one second, which is also
defined by `G_USEC_PER_SEC`.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/363
2019-06-07 14:42:01 +08:00
Olivier Fourdan
1d76eace1e clutter: Hook up pointer accessibility
When using evdev (for Wayland), the backend receives all device events
and queue them for clutter.

Hook up the pointer accessibility handlers in clutter's main processing
queue, so that we get better accuracy for pointer location.

We need to avoid doing this on X11 though because X11 relies on the raw
events for this to work reliably, so the same is already done in the
X11 backend when using X11.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/512
2019-06-06 13:04:50 +02:00
Olivier Fourdan
c1303bd642 clutter/x11: Hook up pointer accessibility
Pointer accessibility features requires to receive all pointer events
regardless of X11 grabs.

Add XI2 raw events mask and hook up the pointer accessibility handlers
to the raw motion and button press/release events.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/512
2019-06-06 13:04:50 +02:00
Olivier Fourdan
db11a37a68 clutter: Add pointer accessibility features
Add support for click assist, namely simulated secondary click (on a
long primary button press) and hover click support (simulate a click when
the pointer remains static for some time).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/512
2019-06-06 13:04:50 +02:00
Olivier Fourdan
0d0b9da6f8 clutter: Add pointer accessibility signals
Add the required signaling in place in clutter device manager to notify
the upper layers (namely, the shell) whenever a click assist delay or
gesture is started or stopped.

This will allow the shell to implement a visual feedback for click
assist operations.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/512
2019-06-06 13:04:50 +02:00
Olivier Fourdan
ab0b407da4 clutter/enums: Add pointer accessibility types
Add the relevant enumeration types to support pointer accessibility
features.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/512
2019-06-06 13:04:50 +02:00
Olivier Fourdan
144b24bfcc clutter/evdev: Use the accessibility virtual device
Instead of adding one specifically for keyboard accessibility in evdev,
use the one from ClutterInputDevice instead.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/512
2019-06-06 13:04:50 +02:00
Olivier Fourdan
4d21650d6d clutter: Add an accessibility virtual device
For accessibility features, being either keyboard accessibility to
implement mousekeys, or pointer accessibility to implement simulated
secondary click or dwell click, we need to have a virtual device.

Add that virtual device in ClutterInputDevice so it can be used either
for keyboard or pointer accessibility.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/512
2019-06-06 13:04:50 +02:00
Robert Mader
0786683189 meson: Add no-omit-frame-pointer to clutter debug builds
This will help us getting better stacktraces and sysprof integration.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/601
2019-05-31 16:03:43 +00:00
Robert Mader
4887de533c meson: Do not use clutter_c_args for GIR
Certain arguments like `-fno-omit-frame-pointer` break GIR creation.
Lets handle this like we do for the rest of mutter and duplicate the
relevant arguments from `clutter_c_args`.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/601
2019-05-31 16:03:43 +00:00
Georges Basile Stavracas Neto
3e2a2cf532
clutter/stage-cogl: Simplify redraw function
Spotted while adding tracing to swap buffers, we only enter
the first part of the if condition when use_clipped_redraw
is TRUE, so it's pretty safe to assume it's TRUE.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/197
2019-05-31 11:57:09 -03:00
Georges Basile Stavracas Neto
9b8f9b65b8
clutter: Add more descriptive profiling sections
The idea here is to be able to visualize and immediately
understand what is happening. Something like:

```
                   [ view1 ] [ view2 ]
 [---- Layout ---][------ Paint ------][ Pick ]
[================== Update =====================]
```

But with colors. A few of the previous profiling data
sections were removed, since they didn't really add to
reading the graph.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/197
2019-05-31 11:57:08 -03:00
Jonas Ådahl
04fb6f7659
clutter: Add some preliminary tracing to clutter
https://gitlab.gnome.org/GNOME/mutter/merge_requests/197
2019-05-31 11:57:07 -03:00
Robert Mader
a859d76c72 meson: Cleanup debug build handling
Add debug flags based on meson's `debug` option instead of `buildtype`.
This allows custom build configurations to behave like a debug or release build.

Add `-fno-omit-frame-pointer` to Mutter/Cogl. Not to Clutter though, as that would
require more changes to how Clutter's gir is created

Remove `-DG_DISABLE_CAST_CHECKS` from Clutter in debug builds

Add `-DG_DISABLE_CHECKS`, `-DG_DISABLE_ASSERT` and `-DG_DISABLE_CAST_CHECKS` to all
non-debug builds but `plain`, which explicitly should not have any compile flags

Use `cc.get_supported_arguments`, so it becomes more obvious to the user which flags
are set during compilation

https://gitlab.gnome.org/GNOME/mutter/merge_requests/497
2019-05-29 15:52:39 +00:00
Marco Trevisan (Treviño)
f99cd18254 clutter/tests/actor-destroy: Check destroying the actor clears the children
Commit df7d8e2cb highlights a crash on test_destroy_destroy, in fact it could
happen that calling clutter_actor_destroy on a child while iterating on the
list, would implicitly call test_destroy_remove that tries to modify the list
at the same time. Causing a memory error.

So instead of manually free the children list, just ensure that this list is
valid and that when the object destruction is done, this is free'd.

See: https://gitlab.gnome.org/GNOME/mutter/merge_requests/576

https://gitlab.gnome.org/GNOME/mutter/merge_requests/581
2019-05-27 17:14:25 -05:00
Florian Müllner
76664ef891 clutter-text: Fix selection color drawing
Commit cabcad185 removed the call to cogl_set_source_color4ub() before
cogl_fill_path(), so instead of the previously assigned selection color,
the background is drawn with the last set source.

In order to honour the newly added framebuffer parameter and still apply
the correct color, switch from cogl_fill_path() to the (deprecated!)
cogl_framebuffer_fill_path() method.

https://gitlab.gnome.org/GNOME/mutter/issues/494
2019-05-27 18:39:39 +00:00
Daniel van Vugt
4faeb12731 clutter/stage-cogl: Reschedule update on present
If an update (new frame) had been scheduled already before
`_clutter_stage_cogl_presented` was called then that means it was
scheduled for the wrong time. Because the `last_presentation_time` has
changed since then. And using an `update_time` based on an outdated
presentation time results in scheduling frames too early, filling the
buffer queue (triple buffering or worse) and high visual latency.

So if we do receive a presentation event when an update is already
scheduled, remember to reschedule the update based on the newer
`last_presentation_time`. This way we avoid overfilling the buffer queue
and limit ourselves to double buffering for less visible lag.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/334

Prerequisite: https://gitlab.gnome.org/GNOME/mutter/merge_requests/520

https://gitlab.gnome.org/GNOME/mutter/merge_requests/281
2019-05-21 16:23:49 +00:00
Marco Trevisan (Treviño)
02812fb988 clutter/stage-cogl: Damage fb using ceiled scaled sizes
https://gitlab.gnome.org/GNOME/mutter/merge_requests/469
2019-05-21 08:50:09 +00:00
Marco Trevisan (Treviño)
29211c9020 clutter/util: Fix styling on functions definitions
https://gitlab.gnome.org/GNOME/mutter/merge_requests/469
2019-05-21 08:50:09 +00:00
Marco Trevisan (Treviño)
7a6c755833 clutter: Add fribidi dependency and copy deprecated pango functions
Pango functions pango_unichar_direction() and pango_find_base_dir() have been
deprecated in pango 1.44, since these are used mostly clutter and gtk, copy the
code from pango and use fribidi dependency explicitly.

This is the same strategy used by Gtk.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/583
2019-05-17 18:11:43 -05:00
Daniel van Vugt
45244852ac clutter/stage-cogl: Don't skip over the next frame
The `last_presentation_time` is usually a little in the past (although
sometimes in the future depending on the driver). When it's over 2ms
(`sync_delay`) in the past that would trigger the while loop to count up so
that the next `update_time` is in the future.

The problem with that is for common values of `last_presentation_time`
which are only a few milliseconds ago, incrementing `update_time` by
`refresh_interval` also means counting past the next physical frame that
we haven't rendered yet. And so mutter would skip that frame.

**Example**

Given:
```
  last_presentation_time = now - 3ms
  sync_delay = 2ms
  refresh_interval = 16ms
  next_presentation_time = last_presentation_time + refresh_interval
                         = now + 13ms

          -3ms now        +13ms           +29ms           +45ms
        ----|--+------------|---------------|---------------|----
            :               :
  last_presentation_time  next_presentation_time
```

Old algorithm:
```
  update_time = last_presentation_time + sync_delay
              = now - 1ms
  while (update_time < now)
        (now - 1ms   < now)
    update_time = now - 1ms + 16ms
  update_time = now + 15ms
  next_presentation_time = now + 13ms
  available_render_time = next_presentation_time - max(now, update_time)
                        = (now + 13ms) - (now + 15ms)
                        = -2ms  so the next frame will be skipped.

          -3ms now        +13ms           +29ms           +45ms
        ----|--+------------|-+-------------|---------------|----
            :               : :
            :               : update_time (too late)
            :               :
  last_presentation_time  next_presentation_time (a missed frame)

```

New algorithm:
```
  min_render_time_allowed = refresh_interval / 2
                          = 8ms
  max_render_time_allowed = refresh_interval - sync_delay
                          = 14ms
  target_presentation_time = last_presentation_time + refresh_interval
                           = now - 3ms + 16ms
                           = now + 13ms
  while (target_presentation_time - min_render_time_allowed < now)
        (now + 13ms - 8ms < now)
        (5ms < 0ms)
    # loop is never entered
  update_time = target_presentation_time - max_render_time_allowed
              = now + 13ms - 14ms
              = now - 1ms
  next_presentation_time = now + 13ms
  available_render_time = next_presentation_time - max(now, update_time)
                        = (now + 13ms) - now
                        = 13ms  which is plenty of render time.

          -3ms now        +13ms           +29ms           +45ms
        ----|-++------------|---------------|---------------|----
            : :             :
            : update_time   :
            :               :
  last_presentation_time  next_presentation_time
```

The reason nobody noticed these missed frames very often was because
mutter has some accidental workarounds built-in:

 * Prior to 3.32, the offending code was only reachable in Xorg sessions.
   It was never reached in Wayland sessions because it hadn't been
   implemented yet (till e9e4b2b72).

 * Even though Wayland support is now implemented the native backend
   provides a `last_presentation_time` much faster than Xorg sessions
   (being in the same process) and so is less likely to spuriously enter
   the while loop to miss a frame.

 * For Xorg sessions we are accidentally triple buffering (#334). This
   is a good way to avoid the missed frames, but is also an accident.

 * `sync_delay` is presently just high enough (2ms by coincidence is very
   close to common values of `now - last_presentation_time`) to push the
   `update_time` into the future in some cases, which avoids entering the
   while loop. This is why the same missed frames problem was also noticed
   when experimenting with `sync_delay = 0`.

v2: adjust variable names and code style.

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=789186
       and most of https://gitlab.gnome.org/GNOME/mutter/issues/571

https://gitlab.gnome.org/GNOME/mutter/merge_requests/520
2019-05-16 22:13:54 +00:00
Jonas Dreßler
a48b6cc9ca clutter/actor: Fix a wrong comment
https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
2019-05-15 20:38:28 +00:00
Jonas Dreßler
786305f7d6 clutter/input-device: Replace device check with assertion
We only call _clutter_input_device_update with devices that are not
Keyboard devices. Also passing a Keyboard device to a function whose
primary purpose is picking should be considered a bug in the caller.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
2019-05-15 20:38:28 +00:00
Jonas Dreßler
30a2483e6e clutter/stage-cogl: Fix a comment-typo
https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
2019-05-15 20:38:28 +00:00
Jonas Dreßler
f5f0aa1023 clutter/stage: Move a comment to a more appropriate place
https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
2019-05-15 20:38:28 +00:00
Jonas Dreßler
b86fba2f3c clutter/stage: Avoid unnecessary call to add_redraw_clip
We're bailing out of clutter_stage_cogl_add_redraw_clip() early without
doing anything if we're ignoring redraw clips, so no need to call it if
we already know that will be the case.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
2019-05-15 20:38:28 +00:00
Marco Trevisan (Treviño)
7a17e236f7 Use free_full on GSList's instead of foreach + free
GList's used in legacy code were free'd using a g_slist_foreach + g_slist_free,
while we can just use g_slist_free_full as per GLib 2.28.

So replace code where we were using this legacy codepath.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/576
2019-05-15 14:49:56 -05:00
Marco Trevisan (Treviño)
df7d8e2cbf Use free_full on GList's instead of foreach + free
GList's used in legacy code were free'd using a g_list_foreach + g_list_free,
while we can just use g_list_free_full as per GLib 2.28.

So replace code where we were using this legacy codepath.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/576
2019-05-15 14:42:25 -05:00
Daniel García Moreno
706c5a7565 clutter: LEQUAL depth_testing on ClutterDeformEffect
Moving an actor with a ClutterDeformEffect applied flickers because
the depth_testing, setting the depth testing test function to
COGL_DEPTH_TEST_FUNCTION_LEQUAL fixes the problem.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/507
2019-05-14 17:44:38 +02:00
Jonas Dreßler
24b3467584 clutter: Send touch crossing events only to grab actor
When the pointer is grabbed, we send the crossing events that are
initiated by this pointer only to the actor that has the grab. For
grabbed touch sequences, we always capture and bubble the crossing
events right now.

Fix this and make grabbed pointers and touch sequences behave the same
by sending touch crossing events only to the grab actor.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/422
2019-05-14 09:05:47 +00:00
Jonas Dreßler
9e0e35d2a7 clutter/click-action: Handle touch cancel events
It's important to cancel click actions when we get a touch cancel event,
otherwise the long press event might get emitted after the compositor
took over the touches because it detected a gesture.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/396
2019-05-13 09:44:50 +00:00
Marco Trevisan (Treviño)
63c40a9711 meson: Define srcdir and builddir using meson functions
No need to redefine paths starting from top src/build dirs, as meson can give us
this information for free using its functions.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
Marco Trevisan (Treviño)
a934fa07b8 tests: Use suites for test cases
They allows to filter tests better and so we can just launch tests with:
  meson test --suite [core|cogl|clutter] [single-test-name]

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
Carlos Garnacho
ba8f5a1178 clutter: Use g_signal_handler_disconnect to disconnect frequent signal
Clutter does the nicety of connecting just created PangoContexts to
ClutterBackend signals in order to update it on resolution/font changes.
However the way the signals are disconnected (automatically via
g_signal_connect_object() auto-disconnect feature) may incur into
performance issues with a high enough number of ClutterActors with a
PangoContext (eg. ClutterText) as the lookup by closure is linear across
all signals and handlers.

Keep the handler IDs around, and disconnect them specifically on dispose
so it is more O(1)-ish.

Related: https://gitlab.gnome.org/GNOME/mutter/issues/556
2019-04-30 13:12:53 +00:00
Olivier Fourdan
251fa024c4 clutter/x11: disable mousekeys with Numlock ON
GNOME documentation on accessibility features states that mousekeys
work only when NumLock is OFF:

  https://help.gnome.org/users/gnome-help/stable/mouse-mousekeys.html

Change the clutter/x11 implementation to match the documentation, i.e.
disable mousekeys when NumLock in ON so that switching NumLock ON
restores the numeric keypad behaviour.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/530
2019-04-19 13:51:35 +00:00
Olivier Fourdan
471b61bd14 clutter/evdev: disable mousekeys with Numlock ON
The clutter/evdev implementation of mousekeys is designed after the
current implementation in X11, and works when the setting is enabled
regardless of the status of NumLock.

The GNOME documentation on accessibility features states however that
mousekeys work only when NumLock is OFF:

  https://help.gnome.org/users/gnome-help/stable/mouse-mousekeys.html

Change the clutter/evdev implementation to match the documentation, i.e.
disable mousekeys when NumLock in ON so that switching NumLock ON
restores the numeric keypad behaviour.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/530
2019-04-19 13:51:35 +00:00
Adam Jackson
1783ea5af1 cogl: Remove unused texture_type argument from cogl_pipeline_set_layer_null_texture
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:24 -04:00
Adam Jackson
fb40e2eefb cogl: Remove unused cogl_texture_new_from_foreign
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:09 -04:00
Adam Jackson
fc09fa50a5 cogl: NPOT textures are always available
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:07 -04:00
Adam Jackson
893e894fff cogl: Remove always-true COGL_FEATURE_SHADERS_GLSL
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:01 -04:00
Olivier Fourdan
fa4a787386 clutter/evdev: Toggle accessibility features from keyboard
The keyboard accessibility setting "enable" is actually even more
misleading that initially anticipated, as it does not control the
entire keyboard accessibility feature, but just the "enable by
keyboard" feature, i.e. being able to enable or disable stickykeys
or slowkeys using various keyboard actions.

Yet the accessibility features should still work even if the "enable"
setting is unset, those can be controlled by the accessibility menu in
GNOME Shell for example.

Change the clutter/evdev implementation to match that behavior as found
in the x11 backend, so both backends are now consistent.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/531
2019-04-11 13:51:43 +00:00
Olivier Fourdan
85b734fde8 clutter/device-manager: Small code cleanup
Use a `memcmp()` instead of checking every field in the structure to be
equal, it's both faster and less error prone.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/531
2019-04-11 13:51:43 +00:00
Carlos Garnacho
34ee46022e clutter: Fix check for keyboard a11y features
The typo was actually toggling the feature on for those who had it
disabled.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/529
2019-03-28 12:03:00 +01:00
Daniel van Vugt
ee507d9ab2 clutter-actor: Keep is_dirty unchanged for culled actors
In a multi-monitor setup there is a separate paint run for each monitor.
If an actor doesn't intersect the first monitor painted then it is culled
out for that monitor to save time. Unfortunately this would mean
`clutter_actor_paint` was setting `is_dirty = FALSE` before the actor had
yet been painted on any monitor.

This meant that effects like `ClutterOffscreenEffect` were not receiving
the flag `CLUTTER_EFFECT_PAINT_ACTOR_DIRTY` when they should have, and
so would rightfully think they don't need to do a full internal
invalidation. So `ClutterOffscreenEffect`, and probably other effects,
did not repaint correctly unless on the first monitor in the list.

The fix is to simply avoid setting `is_dirty = FALSE` on those paint
runs where the actor has been culled out (`clutter_actor_continue_paint`
wasn't called). It is only safe to clear the flag after
`clutter_actor_continue_paint` has been called at least once per stage
paint.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1049
https://gitlab.gnome.org/GNOME/mutter/merge_requests/511
2019-03-28 17:42:01 +08:00
Carlos Garnacho
47663c7e0f clutter: Drop no longer necessary API
clutter_input_device_get_physical_size was just used for device mapping
heuristics in MetaInputMapper. It now started using the info from udev
on for both backends, so this means this clutter API is no longer
necessary.

https://gitlab.gnome.org/GNOME/mutter/issues/514
2019-03-25 14:08:40 +01:00
Olivier Fourdan
5c27bf6a2b clutter/evdev: Fix toggling accessibility features from keyboard
Enabling keyboard accessibility features on Wayland from the keyboard
was wrongly assumed to be controlled by the "togglekeys" setting,
whereas it should be simply controlled by the "enable" setting.

As "togglekeys" is off by default and doesn't have a UI option to
enable, that would prevent turning on or off the keyboard accessibility
features using the keyboard.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/501
2019-03-20 18:41:56 +01:00
Florian Müllner
a1e325f749 build: Don't use absolute paths with subdir keyword
Meson 0.50.0 made passing an absolute path to install_headers()'
subdir keyword a fatal error. This means we have to track both
relative (to includedir) paths for header subdirs and absolute
paths for generated headers now :-(

https://gitlab.gnome.org/GNOME/mutter/merge_requests/492
2019-03-18 12:37:14 +00:00
Carlos Garnacho
1f1f49dc79 clutter: Do not toggle the OSK panel off after focus out
Let the upper layers figure out whether the panel should be shown
or hidden.

https://gitlab.gnome.org/GNOME/gtk/issues/1277
https://gitlab.gnome.org/GNOME/mutter/merge_requests/432
2019-03-04 18:17:08 +00:00
Carlos Garnacho
3fd0e23ed9 clutter: Make ClutterInputFocus API to set panel state explicit
Before we just had API to toggle the OSK panel state. Make this API
generic so the upper layers may set the state as they see fit.
All callers have been updated.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/432
2019-03-04 18:17:08 +00:00
Adam Jackson
033a771e8c clutter: Remove clutter_set_windowing_backend()
This is a choice imposed by mutter, not something you can usefully set
from the config file.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/463
2019-03-04 09:28:30 -05:00
Adam Jackson
6cbaeae64d clutter: remove x11/clutter-x11-texure-pixmap.c
We're not using this, our path to BindTexImage is hidden down in cogl
instead. In general we should reduce the amount of X-specific API we
expose.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/463
2019-03-04 09:28:30 -05:00
Adam Jackson
6a5772c881 clutter: Remove tests/interactive/text-pixmap.c
This is the only consumer of clutter_x11_texture_pixmap_*

https://gitlab.gnome.org/GNOME/mutter/merge_requests/463
2019-03-04 09:27:25 -05:00
Olivier Fourdan
ed17559f88 clutter/evdev: Use internal button codes for mousekeys
The ClutterVirtualInputDevice API was fixed to use Clutter button
internal codes, whereas the mousekeys still uses evdev codes.

Change the mousekeys implementation to use the Clutter button code
instead to remain compatible with the ClutterVirtualInputDevice API.

Fixes: 24aef44b (Translate from button internal codes to evdev)
https://gitlab.gnome.org/GNOME/mutter/merge_requests/473
2019-03-04 13:47:26 +01:00
Andrea Azzarone
e0811ce141 clutter/x11: Consider remapped keys when guessing the keycode from the keysym
Since e3e933c4 a keyval can be temporarily remapped to an unused keycode. Due to
some limitations in XTestFakeKeyEvent, the remapping has to be done in the first
xkb group/layout. In case there are two or more keyboard layouts enabled and the
selected keyboard layout is not the first, clutter_keymap_x11_keycode_for_keyval
will fail to retrieve the correct keycode for a remapped keyval. Let's use the
reserved_keycodes map in order to retrieve the correct keycode if needed.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/443
2019-03-02 13:20:30 +00:00
Marco Trevisan (Treviño)
cbd3ad8585 clutter/stage-cogl: Add function to scale and clamp fractional values to pixels
Compute pixels rectangles using various clutter utility functions that take
care of the subpixel compensation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 19:48:40 +01:00
Marco Trevisan (Treviño)
3d89b47757 clutter/stage-cogl: Cleanup the code for scissor region calculation
Ignore the subpixel compensation when this value isn't set, and directly
set the passed rect.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 19:42:08 +01:00
Marco Trevisan (Treviño)
e5a9e9c93b clutter/util: Add functions for managing cairo and clutter rects
Utility functions to easily convert from ClutterRect to cairo int rects and
vice-versa.

And add ability to offset a cairo rect.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 19:42:08 +01:00
Marco Trevisan (Treviño)
9d9d455bba clutter/rect: Add utility function to scale the rectangle
Scale coordinates and size of the rectangle by the passed value.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 19:42:07 +01:00
Marco Trevisan (Treviño)
8bc8dc66f2 clutter/rect: Clamp to pixel taking care of subpixel values
The clamped rectangle currently could not fully contain the original fractional
rectangle because it doesn't take care of the fact that the new width should
consider the fact that flooring we'd translate the rectangle, and thus to cover
the same area we need to take care of it.

So, to properly compute the width and height, calculate x2 and y2 first and then
use this ceiled value to compute the actual width using the floored x1 and y1.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 19:22:03 +01:00
Marco Trevisan (Treviño)
412d5685ba clutter/stage: Add view scale support on read_pixels()
https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
baf98bb205 clutter/stage: Avoid duplicating code for capturing
https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
f2c033b1b4 clutter/stage: Add scaling support to capture_view_into
https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
4be4d85f84 clutter/stage: Cleanup the capture_view code
Reuse capture's rect parameter instead of passing a new one, and support the
case where there are no returned areas.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
c695471475 clutter/stage: Add private API to get max view scale for rect
Move the same code from ClutterActor as this is something we can
reuse elsewhere.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
97a3b88f25 clutter/stage: Use rounded values to create image surfaces
This needs to be an integer, and since the assumptions we
have in Monitor this multiplication should always return
an integer, however in case of precision loss it could
return something very close to the next/prev integer, so
let's be sure this won't happen, by just rounding it.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
1e1cb4961b clutter/offscreen-effect: Make sure we use linear filter for fractional scaling
When we try to update the FB, we might face the case in which the effect target
framebuffer does not need any redraw, because it's already properly sized and
scaled, but the filter applied to the pipeline is not, because it has been
computed for a non-fractional scaling.

This is happens for example to clutter actors with a flattening effect (i.e.
override redirect mode set), that might have been generated properly for a
celied scaling level, but when we go fractional we need to ensure to use a
linear filter, as the 1:1 texel:pixel assumption is not true anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
e3966882e8 clutter/offscreen-effect: Support adding effect to resource scaled actors
At this level we use ceiled resource-scale when painting fractional value

When using fractional scaling we still need to create an integer-sized
texture and then we should paint it using a size which is proportional
to the real actor size ratio, and only paint a subsample of it, but this
doesn't seem to work properly with some weird scaling values.

Then, it's just better to draw the texture ceiled and then we scale it
down to match the proper actor scaling at paint level.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
af3662775e clutter/text: Generate resource scaled text and paint it at proper scaling
When resource scale is set we need to generate a scaled PangoLayout (by adding
a new scale attribute, or adjusting the one we already have according the
resource scale), then it has to be painted with proper scaling matrix.

So everything that has to do with PangoLayout has to be in real coordinates,
then clutter logical coords multiplied by resource scaling.
While the actual size of the layout is the one of the PangoLayout divided by
resource scale.

We map the text positions to logical coords by default, while using
the pixel coordinates when painting.

We fall back to scale 1 when calculating preferred size if no scale is
known. The pango layout will not have set a layout scale attribute,
meaning it'll be 1, thus we should just assume the layout scale is 1 here.
Not doing so might result in the preferred size being 0x0 meaning the
actor won't be laid out properly.

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

https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
9234777e36 clutter/text: Add utility function to set the pango attributes
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
02813d74e1 clutter/canvas: Implement clutter_canvas_{get,set}_scale_factor
https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
d3beb3ddb7 clutter/actor-box: Add clutter_actor_box_scale function
This allows to scale the box by given factor

https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Jonas Ådahl
ad5555bf42 clutter: Add API to get the resource scale of an actor
A clutter actor might be painted on a stage view with a view scale
other than 1. In this case, to show the content in full resolution, the
actor must use a higher resolution resource (e.g. texture), which will
be down scaled to the stage coordinate space, then scaled up again to
the stage view framebuffer scale.

Use a 'resource-scale' property to save information and notify when it
changes.

The resource scale is the ceiled value of the highest stage view scale a
actor is visible on. The value is ceiled because using a higher
resolution resource consistently results in better output quality. One
reason for this is that rendering is often not perfectly pixel aligned,
meaning even if we load a resource with a suitable size, due to us still
scaling ever so slightly, the quality is affected. Using a higher
resolution resource avoids this problem.

For situations inside clutter where the actual maximum view scale is
needed, a function _clutter_actor_get_real_resource_scale() is provided,
which returns the non-ceiled value.

Make sure we ignore resource scale computation requests during size
requests or allocation while ensure we've proper resource-scale on
pre-paint.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Marco Trevisan (Treviño)
789a3ef029 clutter/util: Add function to build a ClutterRect from a cairo rectangle
Utility functions to easily convert a cairo rectangle into a ClutterRect.

And add ability to offset a cairo rect.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
Adam Jackson
bc657c9feb clutter: Remove unused deprecated/clutter-input-device-deprecated.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/464
2019-02-28 13:01:36 -05:00
Adam Jackson
52e074b08a clutter: Remove unused deprecated/clutter-{list-,}model.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/464
2019-02-28 13:01:32 -05:00
Adam Jackson
f1b148e488 clutter: Remove tests/conform/model.c
The clutter model code is deprecated and this is the only consumer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/464
2019-02-28 13:01:29 -05:00
Adam Jackson
df3d2389a9 clutter: Remove unused deprecated/clutter-behaviour-rotate.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/461
2019-02-28 10:51:12 -05:00
Adam Jackson
ac7ca3265e clutter: Remove tests/interactive/test-{depth,multistage.c}
These are the only consumers of deprecated/clutter-behaviour-rotate.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/461
2019-02-28 10:35:39 -05:00
Adam Jackson
cc07702386 clutter: Remove unused deprecated/clutter-behaviour-path.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/461
2019-02-28 10:35:29 -05:00
Adam Jackson
1f796f1fbf clutter: Remove unused deprecated/clutter-timeout-interval.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/461
2019-02-28 10:35:29 -05:00
Adam Jackson
65312be59d clutter: Remove unused deprecated/clutter-behaviour-ellipse.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/461
2019-02-28 10:35:29 -05:00
Adam Jackson
5a6a602da8 clutter: Remove unused deprecated/clutter-shader.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/461
2019-02-28 10:35:29 -05:00
Niels De Graef
1c6ea5d1db Use a consistent style for enum braces
https://gitlab.gnome.org/GNOME/mutter/merge_requests/361
2019-02-28 09:31:01 +01:00
Niels De Graef
16a2eab290 clutter: Animatable: Use G_DECLARE_INTERFACE()
It cuts away a bit of the GObject boilerplate, gives us support for
`g_autoptr`, and removes the typedef hack inside clutter-scroll-actor.c.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/380
2019-02-27 16:44:24 +00:00
Niels De Graef
41a69f194d clutter: MasterClock: Use G_DECLARE_INTERFACE()
It cuts away a bit of the GObject boilerplate, gives us support for
`g_autoptr`, and removes the typedef hack inside clutter-master-clock.c.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/380
2019-02-27 16:44:24 +00:00
Niels De Graef
b77e6f0c98 clutter: Content: Use G_DECLARE_INTERFACE()
It cuts away a bit of the GObject boilerplate, gives us support for
`g_autoptr`, and removes the typedef hack inside clutter-content.c.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/380
2019-02-27 16:44:24 +00:00
Niels De Graef
b67394dcd1 clutter: StageWindow: Use G_DECLARE_INTERFACE()
It cuts away a bit of the GObject boilerplate, gives us support for
`g_autoptr`, and removes the typedef hack inside clutter-stage-window.c.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/380
2019-02-27 16:44:24 +00:00
Olivier Fourdan
f9e33a89fd clutter: cleanup/remove core input X11 backend
We don't use the core input X11 backend, remove it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/459
2019-02-27 12:07:24 +01:00
Adam Jackson
39e9e53871 clutter: Remove the rest of deprecated/clutter-animator.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
2019-02-27 03:32:21 +00:00
Adam Jackson
7f3fda6df6 clutter: Simplify clutter_state_change
clutter_state_get_animator now always returns NULL, because
_set_animator is never called.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
2019-02-27 03:32:21 +00:00
Adam Jackson
73ce5b3a8d clutter: Remove tests/interactive/test-state-animator.c
This is the only caller of the (deprecated) clutter_state_set_animator.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
2019-02-27 03:32:21 +00:00
Adam Jackson
53319a121f clutter: Remove unused deprecated code from clutter-actor-deprecated.c
Since clutter_actor_set_shader() is never called, none of this has any
effect.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
2019-02-27 03:32:21 +00:00
Adam Jackson
cf2d06e9b9 clutter: Remove deprecated clutter-score.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
2019-02-27 03:32:21 +00:00
Adam Jackson
d39211f438 clutter: Remove deprecated clutter_egl{,x}_display
https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
2019-02-27 03:32:21 +00:00
Adam Jackson
909464f749 clutter: Remove deprecated XInput code
https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
2019-02-27 03:32:21 +00:00
Adam Jackson
5669b64021 clutter: Remove unused clutter-glx-texture-pixmap.c and friends
https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
2019-02-27 03:32:21 +00:00
Adam Jackson
8f0b4767de clutter: Remove deprecated clutter_x11_get_stage_visual
https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
2019-02-27 03:32:21 +00:00
Jonas Ådahl
6372e3e4db clutter: Add clutter_actor_has_damage() API
Will be used to check whether there are any damage to an actor.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
Carlos Garnacho
bf12a2497b clutter: Make docs match with signal description
Makes gobject-introspection happy again.

Pointed out by Robert Mader at:
https://gitlab.gnome.org/GNOME/mutter/merge_requests/196
2019-02-25 20:12:21 +01:00
Carlos Garnacho
55d168d01a clutter: Add ClutterPaintVolume argument to ClutterActor::queue_redraw
This is an ABI break, hopefully an unimportant one since this signal/vmethod
is barely overridden.

The signal has been added an extra ClutterPaintVolume argument, and has been
given a boolean return value. The recursion to the parents has been taken
out of the default implementation and into the caller, using the returned
boolean parameter to control further propagation.

Passing the ClutterPaintVolume is easier on performance, as we don't need
setting this pointer as gobject data just to retrieve/unset it further
in propagation.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2019-02-25 18:17:34 +00:00
Adam Jackson
0d9295523e clutter: Remove deprecate/clutter-frame-source.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/445
2019-02-15 23:01:01 +00:00
Adam Jackson
a4443885a3 clutter: Remove deprecated/clutter-timeout-pool.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/445
2019-02-15 23:01:01 +00:00
Adam Jackson
ef8f2876e3 clutter: Remove deprecated/clutter-backend.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/445
2019-02-15 23:01:01 +00:00
Adam Jackson
75071aba68 clutter: Remove deprecated/clutter-util.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/445
2019-02-15 23:01:01 +00:00
Niels De Graef
a81435ab5f cogl: Remove CoglBool, use gboolean instead
This basically reverts commit 54735dec, which tried to avoid the
GLib-defined types in favor the standard C ones. One exception to this
is the bool type, for which the commit introduces a new type CoglBool.

Let's just get rid of this type in favor of having consistency with the
GLib types. Note by the way that neither CoglBool nor gboolean (which
has a size of `int`) are completely compatible with bool (size `char`).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/321
2019-02-15 16:35:46 +01:00
Georges Basile Stavracas Neto
317414ab26 clutter/paint-nodes: Push/pop framebuffer
Unfortunately, many parts of GNOME Shell and Mutter and Clutter
still use the implicit Cogl1 API. As such, it as a transition
between the old and new APIs, it is important to keep the
implicit draw framebuffer updated.

ClutterRootNode does not keep it updated though, and it might
lead to problems when rendering offscreen textures.

Fix that by pushing and popping the root node framebuffer on
pre- and post-draw, respectively.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/405
2019-02-01 12:42:12 +00:00
Georges Basile Stavracas Neto
b63e104561 clutter/paint-nodes: Expose ClutterRootNode
The ClutterRootNode paint node is theoretically the
top-most node of a paint nodes tree, except that we
are not in the point of having full rendering trees
in Clutter (all rendering performed by paint nodes
is still local and immediate).

When controlling the rendering tree, MetaShapedTexture
may need to paint into an offscreen framebuffer under
some circumstations.

Expose ClutterRootNode so that MetaShapedTexture can
use it to render to offscreen framebuffers.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/405
2019-02-01 12:42:12 +00:00
Georges Basile Stavracas Neto
02b184bfd7 clutter/paint-node: Expose clutter_paint_node_paint()
When painting to an offscreen framebuffer, MetaShapedTexture will
need to have full control of the painting routines of paint nodes.
As such, expose clutter_paint_node_paint() to allow forcing a
paint nodes paint from MetaShapedTexture.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/405
2019-02-01 12:42:12 +00:00
Georges Basile Stavracas Neto
d8c7583922 clutter/paint-node: Add multitexture API
The multitexture API is not a shortcut for multiple calls
to the single texture API. It is meant to wrap calls to
cogl_framebuffer_draw_multitexture_rectangle(), which
uses the passed texture coordinates at different layers of
the pipeline.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/405
2019-02-01 12:42:12 +00:00
Georges Basile Stavracas Neto
25f36b3892 clutter/image: Also invalidate size
ClutterImage is a ClutterContent implementation that
has an internally managed CoglTexture. This texture
is recreated when new image data is set.

ClutterContent implementations may have control over
the allocation of the widgets they're attached to,
through CLUTTER_REQUEST_CONTENT_SIZE. On those cases,
if the new image data differs in size from the previous
data, it is important to notify those actors about the
size change. However, currently ClutterImage does not
notify them.

With the introduction of clutter_content_invalidate_size(),
it is possible to report the size changes to attached
actors.

Adapt ClutterImage to invalidate_size() when image data
has different sizes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/405
2019-02-01 12:42:12 +00:00
Georges Basile Stavracas Neto
0f0b411f6e clutter/content: Add clutter_content_invalidate_size()
ClutterContent has the ability to dictate the layout of any
given actor, through the CLUTTER_REQUEST_CONTENT_SIZE request
mode.

However, there is no way for ClutterContent implementations
to notify their attached actors that the content size changed.

Add a new optional ClutterContent.invalidate_size() vfunc and
clutter_content_invalidate_size().

https://gitlab.gnome.org/GNOME/mutter/merge_requests/405
2019-02-01 12:42:12 +00:00
Ole Jørgen Brønner
5a71ed4411 clutter-event: Correctly annotate some methods
https://gitlab.gnome.org/GNOME/mutter/merge_requests/181
2019-01-31 16:50:04 +00:00
Olivier Fourdan
b04cca9eab clutter/evdev: Set the backend keymap before using it
The device manager evdev assumes the keymap is set, so better set it
before its creation.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/451
Fixes: 6de81b051 "evdev: Implement ClutterKeymap"
2019-01-30 11:27:57 +01:00
Daniel van Vugt
e0fd7a6d05 clutter: Avoid redundant margin changes
When profiling gnome-shell it was found that one of the main triggers
of `clutter_actor_queue_relayout` during animations was
`clutter_actor_set_margin_internal` continuously setting the same
zero margins. That's obviously pointless and also expensive. So just
avoid redundant margin changes.

This helps to further improve performance in:
https://gitlab.gnome.org/GNOME/mutter/issues/233,
https://gitlab.gnome.org/GNOME/gnome-shell/issues/349

This change previously landed as 59acb3895 and then got reverted because
it was found to make gnome-shell#517 worse. However that bug now has a
proper fix and this branch isn't really directly related so is being
reproposed...
2019-01-30 09:25:50 +00:00
Carlos Garnacho
923751aa39 clutter: Add ClutterKeymap getter
It is fetched from the ClutterBackend so far.
2019-01-29 16:53:29 +01:00
Carlos Garnacho
6de81b0513 evdev: Implement ClutterKeymap
Just move the minimal bits to this ClutterKeymapEvdev object. Much
of the functionality of a keymap is spread along ClutterSeatEvdev,
ClutterDeviceManagerEvdev and ClutterVirtualInputDevice. Future
refactors are due here.

Also, ideally keymaps are per-seat objects (at least keyboard state
is). We don't expose much info about seats altogether outside the
evdev device manager implementation. We just poke the main seat at
places, but eventually seats should be public.
2019-01-29 16:53:29 +01:00
Carlos Garnacho
7ae698795e clutter: Add generic ClutterKeymap object
We thus far have similar objects/code internal to backends. Expose the
minimum API necessary to cater for gnome-shell as a generic object.
So far only the X11 backend has an actual GObject for it, and was made
to be a subclass right away.
2019-01-29 16:53:29 +01:00
Robert Mader
72692b1144 clutter-box-layout: Use floats and assert on denormal numbers
`distribute_natural_allocation` expects an input >= 0 of type `gint`. In
`get_preferred_size_for_opposite_orientation` it is used with an unchecked
variable `size` of type `gfloat`, which in case it is `Infinity`, gets
passed on in the macro `MAX (0, size)`. `Infinity` becomes `G_MININT`
when implicitly casted to `gint` in `distribute_natural_allocation`,
triggering the assertion `extra_space >= 0`.

The resulting warning in the log is counter intuitive and not very
helpful.

Use `float` in `distribute_natural_allocation` instead of `gint` and
assert on denormal values so we can more easily identify bugs.

Additionally change some types while at it and add a even more
expressive warning referencing the actor at one point.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/375
2019-01-28 18:36:05 +01:00
Florian Müllner
de41f3ea28 clutter: Fix builds with G_DISABLE_ASSERT
Commit 25f416c13d added additional compilation warnings, including
-Werror=return-type. There are several places where this results
in build failures if `g_assert_not_reached()` is disabled at compile
time and the compiler misses a return value.

https://gitlab.gnome.org/GNOME/mutter/issues/447
2019-01-25 09:43:06 +01:00
Daniel van Vugt
8655bc5d8d clutter: Fix offscreen-effect painting of clones
`ClutterOffscreenEffect` had been getting the wrong bounding box in the
case of clones and descendents of clones, causing visibly incorrect
clipping. This was due to `clutter_actor_get_paint_box` only ever being
given the source actor during a paint (which is correct) and not the clone.
Even if we weren't painting a clone but an offscreened descendent of a
clone (like in gnome-shell's desktop zoom), we would get the wrong result.

Fortunately we don't need to know the actual clone/actor being painted so
don't need to call the problematic `clutter_actor_get_paint_box` at all.
The solution is to only keep untransformed rendering in the FBO and leave
the correct transformation for later. The correct clone/actor's
transformation is already set for us as the current cogl modelview matrix
by `clutter_actor_paint`.

Bonus optimization: This all means we don't need to keep `last_matrix_drawn`
or force a full repaint every time some part of the transformation changes.
Because the FBO contents are no longer affected by transformations. As it
should be. In other words, offscreen-effected actors can now move around
on screen without themselves being repainted.

Special thanks to Mai Lavelle for identifying the cause of the problem.

Fixes:
https://bugzilla.gnome.org/show_bug.cgi?id=789050,
https://bugzilla.gnome.org/show_bug.cgi?id=659523#c9,
https://gitlab.gnome.org/GNOME/mutter/issues/196,
https://gitlab.gnome.org/GNOME/mutter/issues/282,
https://gitlab.gnome.org/GNOME/gnome-shell/issues/387,
https://launchpad.net/bugs/1767648,
https://launchpad.net/bugs/1779615
2019-01-24 17:00:25 +00:00
Marco Trevisan (Treviño)
7f551ba776 meson: Don't list libraries private dependencies in pc files
pkg-config files for mutter are generated using *_pkg_deps as requires, but
programs linked with libmutter doesn't need most of these private dependencies
which are only needed for building and linking mutter and its subprojects.

So list packages needed only by mutter itself inside *_pkg_private_deps and
don't expose such packages to pkg-config, but only use them at build time.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3955
2019-01-23 13:03:40 +00:00
Marco Trevisan (Treviño)
adc5670ea9 meson: Hide symbols by default in clutter
Clutter exports symbols explicitly using `CLUTTER_EXPORT`, so everything should
be hidden by default, unless exposed.

Usage of `gnu_symbol_visibility` needs a version bump to meson 0.48.0

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3955
2019-01-23 13:03:40 +00:00
Marco Trevisan (Treviño)
08130912f0 meson: Set proper soversion and version to libraries
Soname of the libraries should be the major version number, while the version
triplet is currently used:
  objdump -p libmutter-4.so.0.0.0 | grep SONAME
    SONAME               libmutter-4.so.0.0.0

While is expected to be only libmutter-4.so.0

Fix all shared libraries by setting valid version and soversion.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3955
2019-01-23 13:03:40 +00:00
Jonas Ådahl
cbbd3e366a clutter/build: Don't pass --prototypes to glib-genmarshal
This causes compilation warnings and the prototypes are declared in the
header file already.
2019-01-22 18:31:52 +01:00
Jonas Ådahl
ede10dded0 clutter: Add missing void to function declaration 2019-01-22 18:31:52 +01:00
Jonas Ådahl
44477390a9 clutter: Fix const qualifier usage
The const qualifiers were implicitly discarded here and there. Avoid that
either by adding the constness, or casting it away when a const variable
is passed to a function that is defined as non-const but effectively
expect a const.
2019-01-22 18:31:19 +01:00
Jonas Ådahl
caf27c4c16 clutter/tests: Remove dead code
Defined, but not used anywhere.
2019-01-22 18:31:19 +01:00
Jonas Ådahl
576e7a43df clutter/tests: Fix missing declaration warnings 2019-01-22 18:31:19 +01:00
Jonas Ådahl
c242558398 clutter/debug: Add printf annotations to log helpers 2019-01-22 18:31:19 +01:00
Jonas Ådahl
8c9e827aab clutter/stage: Fix debug logging
We expected %d but passed %f in a couple of places.
2019-01-22 18:31:19 +01:00
Jonas Ådahl
2bcc9e2b86 clutter/tests/interactive: Remove dead code
It was hidden behind a macro that was never defined anywhere.
2019-01-22 18:31:19 +01:00
Jonas Ådahl
e9778eba18 build: Pass --quiet to glib-genmarshal
We don't need to know it read the input file really.
2019-01-17 20:42:10 +00:00
Jonas Ådahl
50071303af clutter/stage: Add clutter_stage_is_redraw_queued() API
This will be used by the screen casting code to check whether it should
wait for a frame before reading cursor state, or send only the cursor
update, if no redraw is queued.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-01-16 17:09:51 +00:00
Andrea Azzarone
e3e933c47a clutter/x11: Implement keycode remap to keysyms on virtual key devices
Keycode lookup can fail for serveral reasons, e.g. if there is no combination of
modifiers and keycodes that can produce the target keysym with the current
keyboard layout.

In case the keycode lookup fails, remap temporarily the keysym to an unused
keycodes.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/109
2019-01-11 17:29:27 +01:00
Georges Basile Stavracas Neto
763ae36cee
Drop Autotools
I saw Meson fade from the sky
On the wind I heard a sigh
As snowflakes cover fallen Makefiles
I will say this last goodbye

Meson is now coming
So ends Autotools days
Future is now coming
And we must away
Over Python and without Bashisms
Through lands where never Meson touched
By silver streams that run down to the Sea

Under parsers, beneath old legacy
Over snow one winter’s morn
I turned at last to paths that lead home
And though where the road then takes me
I cannot tell
We came all this way
But now comes the day
To bid you farewell

Many places I have been
Many sorrows I have seen
But I don’t regret
Nor will I forget
All Makefiles that took that road with me

I bid you all a very fond farewell.
2019-01-10 11:50:54 -02:00
Florian Müllner
d360b25b81 build: Install .pc files in correct location
If a library is provided in the positional arguments, then meson
defaults to installing the .pc file in a 'pkgconfig' subdirectory
in the library's install location. We want the files in the regular
$libdir/pkgconfig rather than $libdir/mutter-$api/pkgconfig, so
specify the location explicitly in the parameters.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/382
2019-01-08 22:36:20 +01:00
Niels De Graef
58b5dee869 clutter: remove deprecated ClutterMedia.
It isn't used by GNOME Shell, so it should be safe to remove.
2019-01-08 14:18:07 +00:00
Jonas Ådahl
73ddd7cd48 build: Pass library as first argument to pkg.generate()
Dependencies are added automatically, and we no longer get warnings
like:

clutter/clutter/meson.build:628: DEPRECATION: Library mutter-clutter-4
was passed to the "libraries" keyword argument of a previous call to
generate() method instead of first positional argument. Adding
mutter-clutter-4 to "Requires" field, but this is a deprecated behaviour
that will change in a future version of Meson. Please report the issue
if this warning cannot be avoided in your case.
2019-01-08 09:05:08 +01:00
Niels De Graef
0478c225b7 Add some gtk-doc comments. 2019-01-06 21:57:16 +01:00
Daniel van Vugt
93c29318b2 clutter-stage: Don't emit "after-paint" when picking 2019-01-06 12:36:56 +00:00
Jonas Ådahl
f7d4a727a8 build: Always pass --quiet to g-ir-scanner
This makes the build less verbose, as all .gir generation except for
clutters didn't pass --quiet to g-ir-scanner, making it output long
linking commands. Do this by adding a common introspection_args
variable.

While at it, put -U_GNU_SOURCE in there too, as it was always passed
everywhere as without it the scanner would log warnings.
2018-12-22 11:31:10 +01:00
Carlos Garnacho
1d73533f78 tests: Don't check pixels outside actor allocation
The actor-shader-effect test actors are 50px wide, but we check the 51st
pixel. This went along undetected until "clutter: Avoid rounding
compensation when invalidating 2D actors" because the paint volumes were
made slightly bigger and the shaders paint all over them (I guess nobody
noticed those actors being actually ~52px wide).

Update the test to check the middle of the opposite edge, so we keep neatly
rounded numbers.
2018-12-18 13:54:09 +01:00
Carlos Garnacho
697aeae2ad clutter/tests: Update expectations in actor-anchors test
The test does a clutter_actor_set_scale_full() call that only updates
the scale center (i.e. no changes to scale-x/y), but expects to receive
notifications of actor scale changes.

Since "Revert "Revert "ClutterActor: Optimize away idempotent
scale/position updates"" these are optimized away, so just drop the
assumption.
2018-12-18 13:51:44 +01:00
Carlos Garnacho
2e79d05e04 Revert "Revert "ClutterActor: Optimize away idempotent scale/position updates""
This reverts commit 4d2647cdbc.

A proper fix is now in GTK+, let's reintroduce this optimization.

Related: gtk#844, gtk!294
2018-12-18 12:51:28 +01:00
Carlos Garnacho
a7df459416 clutter: Avoid rounding compensation when invalidating 2D actors
This allows the redraw clip to be more constrained, so MetaCullable doesn't
end up rendering portions of window shadows, frame and background when a
window invalidates (part of) its contents.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2018-12-18 12:51:28 +01:00
Carlos Garnacho
df48b94889 clutter: Add API to retrieve the physical size of absolute devices
This will be used in upper layers to match abs input devices (touchscreens,
tablets) to the corresponding output.
2018-12-06 14:44:46 +00:00
Georges Basile Stavracas Neto
2b938ce795 clutter: minor documentation update
Just better wording for swap throttled.
2018-12-06 14:29:34 +00:00
Georges Basile Stavracas Neto
df284f9c9d clutter: Rename SYNC_TO_VBLANK to SWAP_THROTTLE
This is to reflect what this flag is actually about.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/191
2018-12-06 14:29:34 +00:00
Georges Basile Stavracas Neto
7d20101198 cogl-framebuffer: Remove swap_throttled config
Since now we don't set the swap throttled value based
on sync-to-vblank, we can effectively remove it from
Cogl. Throttling swap buffers in Cogl is as much a
historical artifact as sync-to-vblank. Furthermore,
it doesn't make sense to disable it on a compositor,
which is the case with the embedded Cogl.

In addition to that, the winsys vfunc for updating
whenever swap throttling changes could also be removed,
since swap throttling is always enabled now.

Removing it means less code, less branches when running,
and one less config option to deal with.

This also removes the micro-perf test, since it doesn't
make sense for the case where Cogl is embedded into the
compositor.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/191
2018-12-06 14:29:34 +00:00
Georges Basile Stavracas Neto
ae4d3bc27d clutter: Remove ability to externally set sync-to-vblank
Externally setting the sync-to-vblank setting was a feature
added as a workaround to old Intel and ATI graphic cards, and
is not needed anymore. Furthermore, it doesn't make sense to
change it on a compositor whatsoever.

This commit removes all the ways to externally change this
setting, as well as the now unused API.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/191
2018-12-06 14:29:34 +00:00
Peter Hutterer
1f3e9176fc clutter/x11: detect tablet type from the Wacom property
The xf86-input-wacom driver exports a property with the tool type as known by
the driver. This is a more reliable choice than guessing based on the device
name.

In the touchscreen case, we simply use is_touch_device() to guess which one of
the two options it is. Note that this code should never be hit anyway as we
would've succeeded earlier with a previous is_touch_device() call.
2018-12-06 11:46:44 +00:00
Carlos Garnacho
ffaec917e5 clutter: Only redraw affected portions on parent widget on show/hide
If we are lucky enough and the parent actor has the CLUTTER_ACTOR_NO_LAYOUT
flag, we would skip the relayout, but still redraw the parent actor in its
entirety.

In these cases, we can at least just redraw the area affected by the actor
being shown/hidden.
2018-12-06 02:45:11 +00:00
Carlos Garnacho
bf4ccd21c1 clutter: Avoid relayouts when raising/lowering children
These calls don't actually affect the layout, but the paint order.
It seems safe to skip the full relayout/repaint of the parent actor,
and redraw only the area occupied by the affected child.
2018-12-06 02:45:11 +00:00
Carlos Garnacho
9a843857b3 clutter: Make paint volume argument const on queue_redraw*()
The given paint volume is actually unmodified, there is no need to
require non-const arguments when some getters actually give const
paint volumes.
2018-12-06 02:45:11 +00:00
Jonas Ådahl
4baefe46b3 clutter/stage: Round viewport coordinates before setting
cogl_(fromebuffer)_set_viewport will implicitly cast away the fraction
of a floating point number, meaning if a coordinate calculation
resulted in just below the integer (which for example ~1.75 scaling on
a 1920x1080 did), we'd set a one pixel too narrow viewport. Fix this by
always rounding the floating point to the closest int before passing,
avoiding the precision loss.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2018-12-05 10:34:22 +00:00
Georges Basile Stavracas Neto
acacd3dd64 clutter/stage-cogl: Disable buffer age when painting red damage
This is to ensure we're rendering a red damage area that actually
represents what is being damaged.

Fixes an always-fullscreen red damage on bare metal Wayland and
GNOME Shell.
2018-12-04 12:50:51 +00:00
Georges Basile Stavracas Neto
20b271fa49 clutter/stage-cogl: Add option to visualize damaged regions
This is useful to visualize which parts of the screen are being
damaged.

Add a new 'damage-region' value for CLUTTER_PAINT and paint the
damaged regions accordingly.
2018-12-04 12:50:51 +00:00
Ting-Wei Lan
319500e4f3 tests: Fix warnings reported by shellcheck
This commit includes following fixes for a few shell scripts:

1. Follow the best practice of quoting variables everywhere unless they
   are used in places where word-splitting and globbing can never happen.

2. Replace `command` with $(command) because the latter is easier to use
   and read.

3. Don't use "$@" in places expecting a string because it is an array
   of strings instead of a single string.
2018-12-01 13:07:29 +00:00
Ting-Wei Lan
b2e75b5da0 build: Don't hardcode the path of bash
Bash is not always installed in /bin and we should not hardcode the path
of it in source code which is expected to be built on many operating
systems and distributions.

Since most scripts using #!/bin/bash here doesn't have any bashism,
they can be converted to #!/bin/sh instead of using /usr/bin/env trick.
2018-12-01 12:56:12 +00:00
Daniel van Vugt
557b2a0e8c clutter: Remove erroneous "fixed point" comment
The function `clutter_actor_transform_stage_point` actually operates
almost entirely in floating point.
2018-11-26 15:57:41 +00:00
Olivier Fourdan
ac6039bd2a clutter: Keep a device reference with events
If a device (virtual or real) is removed while there are remaining
events queued for that device, the event loop may try to access the
event freed memory.

To avoid the issue, add a reference to the device when the event is
created or copied, and remove the reference once the device is freed.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/393
2018-11-19 15:41:43 +00:00
Olivier Fourdan
97230a2b64 clutter/evdev: Use clutter_event_set_device()
Use the relevant clutter device API `clutter_event_set_device()` instead
of setting the device directly in the event field.
2018-11-19 15:41:43 +00:00
Georges Basile Stavracas Neto
0304433b20
clutter-rectangle: Remove cogl_rectangle()
A pretty regular removal.
2018-11-18 20:28:39 -02:00
Georges Basile Stavracas Neto
fcd1ff9c56
clutter-texture: Remove cogl_rectangle_with_texture_coords()
Mostly as expected, this port is also trivial. A small cleanup
accompanies this patch, making gen_texcoords_and_draw_cogl_rectangle()
receive the framebuffer that it should draw into.
2018-11-18 20:28:39 -02:00
Georges Basile Stavracas Neto
a227e4078b
clutter-wayland-surface: Remove cogl_rectangle()
This is a very straightforward port too: simply replacing
cogl_rectangle() by cogl_framebuffer_draw_rectangle().
2018-11-18 20:28:39 -02:00
Georges Basile Stavracas Neto
cabcad1856
clutter-text: Replace cogl_rectangle()
Because ClutterText has a somewhat convoluted drawing routine,
replacing cogl_rectangle() here isn't as straightfoward as the
effects were.

A new CoglPipeline is now part of the ClutterText struct, and
is used to set the color of the  background or the selection.

Another change is paint_selection() now receives a framebuffer
to draw into. The check for NULL framebuffer does not make
sense here, since there is always a draw framebuffer set
when in the drawing function. Because of that, the check is
now gone.
2018-11-18 20:28:39 -02:00
Georges Basile Stavracas Neto
4c3d9fccc1
clutter-*-effect: Remove cogl_rectangle()
All those effects have the same basic pattern of setting a
color of a pipeline, then drawing a rect with cogl_rectangle().

Thus, replacing those was as easy as retrieving the draw
framebuffer and calling cogl_framebuffer_draw_rectangle() on it.
2018-11-18 20:28:38 -02:00
Georges Basile Stavracas Neto
203725bfd3
clutter-actor: Remove cogl_rectangle from pick()
The default implementation of ClutterActor.pick() uses
cogl_rectangle() to draw the rectangle with the color
for picking.

Replace that by cogl_framebuffer_draw_rectangle(). A
static color pipeline had to be created in order to
hold the pick color.
2018-11-18 20:28:38 -02:00
Georges Basile Stavracas Neto
c1b6184e0a
clutter-stage: Pass framebuffer to read pixels from
Instead of using cogl_read_pixels(), which is deprecated and
uses the implicit framebuffer, pass the current CoglFramebuffer
and use cogl_framebuffer_read_pixels().
2018-11-18 20:28:38 -02:00
Georges Basile Stavracas Neto
dd82fbebf6
clutter-stage: Replace cogl_clear by cogl_framebuffer_clear
Another case of a simple and direct API translation. Instead of
using the deprecated cogl_clear() function, replace it by the
non-deprecated cogl_framebuffer_clear().
2018-11-18 20:28:37 -02:00
Jonas Ådahl
a892e7a6aa clutter/tests: Remove events-touch test
The events-touch test tested that clutter could properly process evdev
touch events. It used uinput to post evdev touch events, thus only ran
when runnig the test as root. Running as non-root it'd just silently
pass. As Clutter doesn't process evdev touch events anymore,
libinput does, so the test is fairly pointless, so remove it.
2018-11-14 15:55:45 +01:00
Jonas Ådahl
626c3745e2 clutter/master-clock: Destroy source when paused
Pausing the master clock didn't actually pause it if there was already a
scheduled frame in progress. This is problematic if one actually expects
to see no new frame scheduling to happen after pausing, for example it
caused actor 'pre-paint' to be signalled on actors, but nothing was ever
painted.

Avoid this by destroying the master clock source when pausing, and then
recreating it when resuming.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/309
2018-11-14 14:37:04 +01:00
Florian Müllner
9f79cf8a60 Revert "clutter: Avoid redundant margin changes"
This reverts commit 59acb38951.
2018-11-14 01:56:47 +01:00
Daniel van Vugt
59acb38951 clutter: Avoid redundant margin changes
When profiling gnome-shell it was found that one of the main triggers
of `clutter_actor_queue_relayout` during animations was
`clutter_actor_set_margin_internal` continuously setting the same
zero margins. That's obviously pointless but also expensive since it
incurs full stage relayouts and reallocation. So just avoid redundant
margin changes.

Helps to further improve:
https://gitlab.gnome.org/GNOME/mutter/issues/233,
https://gitlab.gnome.org/GNOME/gnome-shell/issues/349
2018-11-13 14:21:31 +00:00
Niels De Graef
0b9404dcbe clutter/device-manager/evdev: Fix constraint cb
As pointed out by @jadahl, this shouldn't matter too much, as the
`constraint_callback` should always be set when initializing the mutter
backend.
2018-11-12 15:38:04 +01:00
Niels De Graef
9fb46cca55 clutter/keyframe-transition: Properly compare keys 2018-11-12 15:36:29 +01:00
Niels De Graef
2a4f1be81b clutter/actor: Don't forget va_end if using varargs 2018-11-12 15:36:27 +01:00
Jonas Ådahl
213ed80284 backends: Move clutter frame clock freeze/thaw API to ClutterSTage
It had nothing to do with EGL or the eglnative backend, and will be used
by non-native backends, so move it to a common place.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/170
2018-11-09 11:16:30 +01:00
Jonas Ådahl
80d5f326e8 clutter: Assume XGE is available at build time
Almost a decade old, lets just assume it's there. This makes the button
on cally-atktext-example work again when building with meson, and
probably other things too.
2018-11-08 18:40:53 +00:00
Jonas Ådahl
15732851bc clutter-shader: Don't include unistd.h
It isn't needed.
2018-11-08 18:40:53 +00:00
Georges Basile Stavracas Neto
3d23ecc456
clutter: Drop g_object_newv from ClutterScriptParser
Build an additional set of (GStrv, GValue[]) and pass it
to the non-deprecated g_object_new_with_properties().
2018-11-08 16:20:19 -02:00
Georges Basile Stavracas Neto
cbf6e74915 tests: Remove deprecated ATK functions 2018-11-08 18:08:57 +00:00
Georges Basile Stavracas Neto
b5c4437287 tests: Remove extra const 2018-11-08 18:08:57 +00:00
Georges Basile Stavracas Neto
426d7f3bdf tests: Enumerate all possible events 2018-11-08 18:08:57 +00:00
Georges Basile Stavracas Neto
3483be8566 tests: Remove unused variables 2018-11-08 18:08:57 +00:00
Daniel van Vugt
f31cf0c3ef clutter-offscreen-effect: Disable if no texture
If texture allocation fails (e.g. on an old GPU with size limit 2048)
then `update_fbo` would return `FALSE` but leaves `priv->offscreen`
as non-NULL. So the next paint will try to use the offscreen with a
`NULL` texture and crashes. The solution is simply to ensure that
`priv->offscreen` is NULL if there is no `priv->texture`, so the default
(non-offscreen) paint path gets used instead.

Bug reported and fix provided by Gert van de Kraats.

https://launchpad.net/bugs/1795774
2018-11-08 10:18:25 +00:00
Jonas Ådahl
b86d87453d build: Fix include and lib paths in autotools .pc files
Some hadn't been updated after lib/mutter/ changed to lib/mutter-N/.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/382
2018-11-07 14:29:30 +01:00