Commit Graph

7188 Commits

Author SHA1 Message Date
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
Jonas Ådahl
cf7c39e2c1 build: Add soversion to shared libraries
It's easier to add it now, then adding it later would so be needed.
2018-11-07 13:00:47 +00:00
Jonas Ådahl
c03a401f4c clutter: Install x11 related header files when using autotools again
clutter-x11.h and x11/clutter-x11-texture-pixmap.h were not installed
any longer. Fix that.
2018-11-07 12:54:41 +00:00
Jonas Ådahl
fc5b94e077 clutter: Install cally headers again when using autotools
The install step was accidentally removed.
2018-11-07 12:54:41 +00:00
Jonas Ådahl
ef85d1a643 Add meson build support
This commit adds meson build support to mutter. It takes a step away
from the three separate code bases with three different autotools setups
into a single meson build system. There are still places that can be
unified better, for example by removing various "config.h" style files
from cogl and clutter, centralizing debug C flags and other configurable
macros, and similar artifacts that are there only because they were once
separate code bases.

There are some differences between the autotools setup and the new
meson. Here are a few:

The meson setup doesn't generate wrapper scripts for various cogl and
clutter test cases. What these tests did was more or less generate a
tiny script that called an executable with a test name as the argument.
To run particular tests, just run the test executable with the name of
the test as the argument.

The meson setup doesn't install test files anymore. The autotools test
suite was designed towards working with installed tests, but it didn't
really still, and now with meson, it doesn't install anything at all,
but instead makes sure that everything runs with the uninstalled input
files, binaries and libraries when running the test suite. Installable
tests may come later.

Tests from cogl, clutter and mutter are run on 'meson test'. In
autotools, only cogl and clutter tests were run on 'make check'.
2018-11-06 18:51:44 +01:00
Jonas Ådahl
d48d56f831 autotools: Make install directories paths more consistent
Install include files in
$prefix/include/mutter-$apiversion/[clutter,cogl,...,meta]/, and
datafiles in /usr/share/mutter-$apiversion/.... We still would conflict
e.g. given that our gettext name is "mutter", and how keybindings are
installed, but it's a step in the right direction.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
e0727aba5f clutter/tests/micro-bench: Don't define unused macro
TESTS_DATA_DIR was not used by any of the tests, so no use defining it.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
14be04a630 clutter/tests: Unconditionally include tests using gdk-pixbuf
We already have gdk-pixbuf as a dependency, so there is no reason to
make it conditional here.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
0067f78155 clutter: Unconditionalize a few X11 extensions
We now require xcomposite, xkb, xi 2.2, at least at compile time.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
3e03d1e38e clutter/configure.ac: Remove left-over gbm and drm dependencies
The gbm and drm facing code has since long been moved into mutter.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
fe7a67f0e7 clutter/configure.ac: Remove unused gdk dependency 2018-11-06 17:17:36 +01:00
Jonas Ådahl
db77e2e187 clutter: Assume compiler supports visibility flag and attributes
Unconditionally pass -fvisibility=hidden to compiler and define
_CLUTTER_EXTERN to __attribute__((visibility("default"))) extern.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
e3c6e3b84d clutter: Fix a couple of guard macros
Use #ifdef instead of #if in a couple of places.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
0d9391e282 clutter: Remove examples
Running clutter apps standalone using mutters fork is not something
worth supporting.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
1e2610e4f4 clutter: Remove useless OS_LINUX macro
It was unconditionally set to 1.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
0095c2e340 clutter: Require full relative path when including 2018-11-06 17:17:36 +01:00
Jonas Ådahl
c90e63a91d clutter: Stop defining some unused macros 2018-11-06 17:17:36 +01:00
Jonas Ådahl
8c0e13ca7a clutter: Remove clutter specific version
Use the mutter version when something is still needed.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
11f8b12a9d clutter: Unconditionally include clutter-build-config.h 2018-11-06 17:17:36 +01:00
Jonas Ådahl
97004e6114 cogl: Remove ARBfp pipeline support
As with fixed pipelines, we require the use of the GLSL pipeline in
mutter, and no point in supporting ARBfp anyway.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
98af9bb251 cogl: Remove notion of a "cogl" version
Mutters copy of cogl isn't a separate library with its own version, so
remove the old version macros.
2018-11-06 17:17:36 +01:00
Jonas Ådahl
00a5523667 cogl: Remove some left over KMS backend stuff 2018-11-06 17:17:36 +01:00
Carlos Garnacho
df94a18791 clutter: Add clutter_input_method_forward_key() method.
This allows input methods to inject key events with specific keyval/keycode,
those events will be flagged with CLUTTER_EVENT_FLAG_INPUT_METHOD so they
won't be processed by the IM again.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/531
2018-10-08 16:30:04 +00:00
Carlos Garnacho
67aab7c138 clutter: Do not latch modifiers on modifier keys
If the user maps eg. Alt+F2 to a pad button, the MetaInputSettings will
send the full Alt press, F2 press, F2 release, Alt release sequence.
However the keycode corresponding to Alt is found in level 1, so the
Shift modifier gets unintendedly latched in addition to the Alt key
press/release pair.

We could probably improve keycode lookup heuristics so level=0 (and
no modifier latching) is preferred, but we can do without it altogether
for modifier keys.
2018-10-08 16:24:11 +00:00
Sam Spilsbury
a8a3c1017f actor: Also recompute paint volume if we recently dropped effects
Otherwise we'll be stuck with the same paint volume on the last
frame of the given effect, which could be wrong.
2018-09-18 19:39:12 +00:00
Sam Spilsbury
5d19aee23a actor: Always use get_paint_volume override for active effects
If an effect is active and it overrides the paint volume, we should
always recompute the paint volume when requested and not use the
cache, since the paint volume override can change from call to
call depending on what phase of painting we are in. For instance,
if we are part way through painting effects and request the
paint volume, the paint volume should only go up to the current
effect, but in a later call to compute repaint regions, the
paint volume needs to expand to accomadate the effect.

This still involves a lot of recomputation in the case of effects -
in a later clutter version it would be worth adding an API to
allow effects to explicitly recompute and return a new the paint
volume up to the current effect as opposed to recomputing
the cached one.
2018-09-18 19:39:12 +00:00
Sam Spilsbury
4270eef16e actor: Fix logic error in determining terminal effect for paint volume
Previously we were checking l->data != NULL || (l->data != NULL &&
l->data != priv->current_effect). This would continue the loop even
if l->data == priv->current_effect, since l->data != NULL, which was
not the intention of that loop.

We also don't need to check that l->data != NULL before checking if
it does not match the current_effect, since we already checked
that current_effect was non-NULL before entering the loop.
2018-09-18 19:39:12 +00:00
Carlos Garnacho
9cfd185316 clutter: Handle grabs from CLUTTER_TABLET_DEVICE devices
Those would result in warnings. Actually, these should be dealt
similarly to pointers, as they get their own standalone pointer
cursor in Wayland.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/issues/540
2018-09-07 15:17:36 +02:00
Peter Hutterer
176117c5f7 device-manager-evdev: handle tablet axis motion before button and tip events
Some tablets have a noticable pointer jump on tip down/up, causing unintended
lines during drawing. Likewise, a button event may have an axis update that we
currently ignore. libinput provides tablet axis events only if no other state
changes, the client must instead get the current axis data from the tip/button
event. So let's do this, process the event axis data during tip/button as
well.

A libinput recording to reproduce is the 'dots.yml' in
https://gitlab.freedesktop.org/libinput/libinput/issues/128

Fixes #289
2018-09-07 19:54:06 +10:00
Carlos Garnacho
85284acb00 clutter/x11: Implement keycode lookup from keysyms on virtual key devices
Unfortunately XKeysymToKeycode() falls short in that it coalesces keysyms
into keycodes pertaining to the first level (i.e. lowercase). Add a
ClutterKeymapX11 method (much alike its GdkKeymap counterpart) to look up
all matches for the given keysym.

Two other helper methods have been added so the virtual device can fetch
the current keyboard group, and latch modifiers for key emission. Combining
all this, the virtual device is now able to handle keycodes in further
levels.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/135
2018-08-28 12:22:52 +02:00
Carlos Garnacho
aaed7c9a4f clutter: Set can_show_preedit flag on ClutterText
It is certainly able to visualize preedit text inline, so it must
announce itself as such.
2018-08-23 20:03:51 +00:00
Carlos Garnacho
fa8930817e clutter: Refactor ClutterText IM focus in into separate function
A just focused ClutterInputFocus must set itself up correctly on
all situations. Refactor this into a function, so it can be used
for the case where a ClutterText gets editable while focused.
2018-08-23 20:03:51 +00:00
Daniel van Vugt
b8340f1355 clutter-text: Avoid clipping the wrong framebuffer
`ClutterText` painting for editable single_line_mode actors like `StEntry`
is always clipped by:

`cogl_framebuffer_push_rectangle_clip (fb, 0, 0, alloc_width, alloc_height)`

So it's difficult to get the rectangle wrong. However in cases where the
target framebuffer has changed (`cogl_push_framebuffer`) such as when
updating `ClutterOffscreenEffect` we had the wrong old value of `fb`. And
so would be clipping the wrong framebuffer, effectively not clipping at all.
2018-08-20 18:07:32 +00:00
Andrea Azzarone
e1513b6b00 clutter/x11: Detect auto-repeated key events
Detect auto-repeated key events using the XIKeyRepeat flag.
2018-08-20 10:16:33 +00:00
Andrea Azzarone
0f40541bb2 clutter/enum: Add CLUTTER_EVENT_FLAG_REPEATED for auto-repeated events 2018-08-20 10:16:33 +00:00
Jonas Ådahl
24aef44baf virtual-input/evdev: Translate from button internal codes to evdev
Sending button events to a ClutterVirtualInputDevice, the API expects
button codes to be of the internal clutter type. The evdev
implementation incorrectly assumed it was already prepared evdev event
codes, which was not the case. Fix the evdev implementation to translate
from the internal representation to evdev before passing it along to
ClutterSeatEvdev.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/190
2018-08-09 13:04:07 +00:00
Daniel van Vugt
b393f3d540 clutter/actor: Inherit clone branch depth from parent
Children added to a parent after that parent (or its ancestors)
have already been cloned now inherit the clone branch depth of
the parent. Otherwise `clutter_actor_is_in_clone_paint` on the child
could return FALSE when it should have been returning TRUE.
2018-08-01 11:53:10 +08:00
Florian Müllner
7fdaf7721c Don't cast free function passed to g_clear_pointer
The function is intentionally provided as macro to not require a
cast. Recently the macro was improved to check that the passed in
pointer matches the free function, so the cast to GDestroyNotify
is now even harmful.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/176
2018-07-31 23:40:01 +02:00
Florian Müllner
4fe594bf9c clutter: Stop using g_type_class_add_private()
It is now deprecated in favor of the G_ADD_PRIVATE() macro (usually
called via G_DEFINE_WITH_PRIVATE()).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/176
2018-07-31 23:40:01 +02:00
Carlos Garnacho
161d2540e6 ClutterActor: Preserve valid paint volumes till the next relayout/repaint
Cuts down approximately all paint volume calculations when there's
windows that redraw frequently, but don't move.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2018-07-13 11:42:28 +00:00
Corentin Noël
2a45b7de7c clutter-input-device-xi2: Check for null group_modes before unref 2018-06-07 12:54:56 +01:00
Daniel van Vugt
62c67be4c8 clutter-actor: Fix uninitialized matrix multiply
`modelview` is uninitialized and the `apply` function just multiplies it.
What we really want is to initialize `modelview` so replace `apply` with
`get`.

Who knows what bugs this may have caused...
2018-05-31 15:43:27 +08:00
Marco Trevisan (Treviño)
15f41c9f68 device-manager-evdev: Add main seat to seats by default
Treat the main seat as other seats, so we don't have to handle it differently
in specific places. This was already the case before when a real device
was plugged before the startup, but not applied when hotplugging a device.
2018-05-29 10:35:51 +00:00
Marco Trevisan (Treviño)
2a38601b42 device-manager-evdev: Free the main seat on finalize 2018-05-29 10:35:51 +00:00
Marco Trevisan (Treviño)
d7bdc1591f device-manager-evdev: Set and unset the stage for the main seat too
When no input devices are available on startup the device manager might be fast
enough to be constructed so that no default stage is set yet, and thus when
main seat virtual devices are created they won't have a proper stage set.
If then we plug a real device, the events that an input manager could generate
won't be associated to any stage and thus won't be processed.

We need then ensure that when we update the stage for the device manager we
(un)associate it also to the main seat devices.
2018-05-29 10:35:51 +00:00
Marco Trevisan (Treviño)
3e85ac8131 clutter-device-evdev: Get devices from main seat if no real seat is set
In devices such as ARM boards there could be no input devices connected on
startup, leading to a crash when we try to process artificial events that
could be queued (as gnome-shell does when syncing pointer).

Those events still should refer to a device and, in case we don't have one
provided by libinput we should still return the core devices defined in the
main seat.
2018-05-15 12:09:59 +01:00
Marco Trevisan (Treviño)
5f83d9a5c8 clutter-seat-evdev: Add function to get device by id 2018-05-15 12:05:39 +01:00
Florian Müllner
a30166a547 clutter: Don't reference invalid pc in gir
Cally is built into clutter itself rather than exposed as a separate
library.

https://bugzilla.gnome.org/show_bug.cgi?id=781471
2018-05-07 21:44:47 +02:00
Carlos Garnacho
8cf42cd06c clutter: Plug minor leak
clutter_stage_manager_list_stages() returns a copied list, which
should be freed.
2018-04-22 00:52:19 +02:00
Carlos Garnacho
b5328c977e clutter: Set slave=master in IM forwarded key events
The fix is twofold. On one hand, it makes sense not to relate IM (nor
any other) generated events to a HW device. On the other hand, if we
are unfortunate that an IM event is in flight when we are switching
to another TTY, it may arrive at a time when the source device is no
longer existent.
2018-04-22 00:52:05 +02:00
Olivier Fourdan
6df2b7af55 clutter/evdev: Don't ignore CAPS lock as modifier
Mark CAPS lock as a modifier (as it should) so that when using XKB
options to change the default behaviour of CAPS lock, the new assigned
key can by used as a sticky key as well.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/112
2018-04-18 17:07:21 +02:00
Olivier Fourdan
c01b099dbd clutter/evdev: ignore injected events from IM
Input method can inject key events, which leads to multiple reported key
press/release events for a single user action.

Ignore those events as this confuses keyboard accessibility.
2018-04-18 17:07:21 +02:00
Carlos Garnacho
3684f6b0ac clutter: Apply input hints/purpose on ClutterTextInputFocus focus in
And make the ClutterText-level properties independent from the input
focus, as those properties can be set anytime, not just when the
ClutterText actor is focused.

https://gitlab.gnome.org/GNOME/mutter/issues/66

Closes: #66
2018-04-03 14:55:17 +00:00
Yussuf Khalil
8286557a05 clutter: Avoid unnecessary relayouts in ClutterText
We can save an unnecessary relayout if the required size to fully draw the text
is equal to the currently allocated size after the underlying text buffer or
attributes that only affect the PangoLayout have changed.
2018-03-22 21:21:43 +01:00
Ting-Wei Lan
4e6114b14d configure: Don't declare functions in AC_TRY_LINK and AC_TRY_COMPILE
https://bugzilla.gnome.org/show_bug.cgi?id=792717
2018-03-21 13:14:50 +00:00
handsome-feng
b8a81128e0 Fix some spelling errors
https://gitlab.gnome.org/GNOME/mutter/merge_requests/45
2018-03-21 13:22:35 +08:00
Carlos Garnacho
481e87032c clutter: Give the ClutterTextInputFocus a first stab at handling key events
Actor keybindings were dispatched in an earlier return path, which means
the IM doesn't get to see certain key events. Flip the order around so the
IM has an opportunity to handle all keypresses.

https://gitlab.gnome.org/GNOME/mutter/issues/65

Closes: #65
2018-03-13 20:00:10 +00:00
Carlos Garnacho
0bf0e5780c clutter/x11: Communicate proper group/mode on pad events.
So we can trigger actions for the right mode.

https://gitlab.gnome.org/GNOME/mutter/issues/48

Closes: #48
2018-03-03 16:07:24 +00:00
Carlos Garnacho
d7c5e57134 clutter/x11: Implement missing ClutterInputDevice pad vmethods
Use libwacom to be able to find out modes, groups and button roles on
pad devices.

https://gitlab.gnome.org/GNOME/mutter/issues/48

Closes: #48
2018-03-03 16:07:23 +00:00
Carlos Garnacho
8d2f794bd3 clutter/x11: Plug a leak 2018-02-27 14:09:48 +01:00
Jonas Ådahl
a1517cae1c clutter/device-manager: Add way to check virtual device support
This is needed so that mutter can let applications using the remote
desktop API to know whether touch screens are supported.
2018-02-23 19:33:31 +08:00
Jonas Ådahl
542502be53 clutter/x11: Add pointer motion support to virtual devices
As the other virtual input event delivery mechanisms, this also uses
the XTEST protocol.
2018-02-23 19:33:31 +08:00
Jonas Ådahl
203a0b37ed clutter: Add smooth scroll and touch API to virtual devices
So far only implemented on the evdev backend,as X11 doesn't support touch
devices nor smooth scrolling via XTEST.
2018-02-23 19:33:31 +08:00
Jonas Ådahl
b6477a826d clutter/evdev: Don't treat device touch slots as seat slots
IF two touch devices have colliding touch point IDs they'd interfere on
the seat. To avoid this, always allocate a seat wide slot for each
device wide slot, but don't use device slots directly in the seat.
2018-02-23 19:33:31 +08:00
Jonas Ådahl
95adc45b71 clutter/evdev: Move touch notification to seat 2018-02-23 19:24:07 +08:00
Jonas Ådahl
f20daf567d clutter: Silence gtk-doc warning 2018-02-23 19:24:07 +08:00
Carlos Garnacho
bcd5882081 clutter: Check the ClutterTextInputFocus has focus before filtering events
Checking correct state is responsibility of the ClutterInputFocus user, and
it is indeed possible to get a focused ClutterText while its
ClutterInputFocus didn't get itself focused (eg. lack of IM).

https://gitlab.gnome.org/GNOME/mutter/issues/36

Closes: #36
2018-02-18 15:22:13 +01:00
Carlos Garnacho
37aab9280a clutter/text: Be more pervasive at updating input method state
More concretely, ensure preedit text goes away after commit/focus_out,
and update cursor position right after focus_in.
2018-02-12 14:44:30 +01:00
Jonas Ådahl
61bc1a7d6f clutter/x11: Remove video memory purge API
Clutter doesn't handle it anyway, and mutter now creates the
CoglRenderer object itself so we don't need this API anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=739178
2018-02-07 11:04:51 +08:00
Jason Gerecke
91df801ffb clutter/evdev: Add support for BTN_STYLUS3
BTN_STYLUS3 is defined by the Linux 4.15 kernel and is sent when the
third button on a stylus is pressed. At the moment, only Wacom's "Pro
Pen 3D" has three stylus buttons. Pressing this button triggers a button
8 event to be sent under X11, so we use the same mapping here.

https://bugzilla.gnome.org/show_bug.cgi?id=790033
2018-01-30 19:28:02 +01:00
Ray Strode
58bb61e161 clutter/stage: Set framebuffer state directly
clutter_set_viewport always operates on the draw fb, but
mutter sometimes has an offscreen fb it uses instead.

This commit uses the non-deprecated, clutter_framebuffer_set_viewport
function, which takes an explicit fb argument.

Closes: https://gitlab.gnome.org/GNOME/mutter/merge_requests/2
2018-01-25 11:41:54 +08:00
Carlos Garnacho
513c278077 clutter: Make ClutterText request toggling the input panel
So gnome-shell is able to show the OSK for it.
2018-01-18 16:20:45 +01:00
Carlos Garnacho
ac8ee9a08c clutter: Add clutter_text_has_preedit()
This function returns TRUE if there is any preedit going on. This method
will be useful in gnome-shell where similar checks are performed on
StIMText actors.
2018-01-18 16:20:45 +01:00
Carlos Garnacho
952c1fefa2 clutter: Add input-purpose/hint properties to ClutterText
So those properties can be changed or queried within shell UI.
2018-01-18 16:20:45 +01:00
Carlos Garnacho
3a914a915e clutter: Implement ClutterInputFocus subclass for ClutterText
This only applies when the actor is editable. This object will allow
editable ClutterText instances to interact with the input method.
2018-01-18 16:20:45 +01:00
Carlos Garnacho
aa6561a3b1 clutter: Add ClutterInputMethod and ClutterInputFocus
ClutterInputFocus is an abstract object to be subclassed by UI actors and
the wayland interface and represents the user of an input method. It
represents the current focus of the input method, so all emitted signals
and public API hooks are expected to be called when the input method is
currently interfacing with the input focus.

ClutterInputMethod is an abstract class (to be implemented in the upper
layers) that represents the input method itself. Besides focus management
itself, all public API calls that would be called by the subclasses are
delivered through the current input focus.
2018-01-18 15:35:29 +01:00
Carlos Garnacho
9eb9623288 clutter: Add ClutterBackend IM setter/getter
The input method will be global to Clutter and shared between all the
IM aware foci. These methods allow querying it and setting one up.
2018-01-18 15:33:12 +01:00
Carlos Garnacho
8c988aa632 clutter: Add special event flag for events that went through an IM
This will be useful to let Clutter know whether those should be or have
already been dispatched through an input method.
2018-01-18 15:33:12 +01:00
Carlos Garnacho
7346419295 clutter/evdev: Ensure a valid ClutterEventSequence on single-touch devices
Libinput shall report those as having slot=-1, which gets mistakenly
translated into the special "NULL" ClutterEventSequence. Making those
events get a non-NULL sequence will make single touch devices work.

https://bugzilla.gnome.org/show_bug.cgi?id=792005
2018-01-17 00:22:22 +01:00
Jonas Ådahl
4e3b26d2ed clutter/evdev: Ignore unknown touch points
We might receive touch events for unknown touch points, for example
when starting mutter while touching the screen (resulting in no
touch-down event ever being received). Avoid crashing when this happens
by just dropping these events on the floor.

https://bugzilla.gnome.org/show_bug.cgi?id=791371
2018-01-12 18:57:43 +08:00
Marco Trevisan (Treviño)
2b60fb0144 stage: Push framebuffer before setting up viewport
When capture_view* functions are called with the paint flag set
to TRUE, we need to setup the framebuffer, however this was
happening after setting up the viewport, while the viewport
needs the framebuffer to be valid when calling cogl_set_viewport.

https://bugzilla.gnome.org/show_bug.cgi?id=791809
2017-12-20 05:56:51 -05:00
Olivier Fourdan
7f5f5eb847 wayland/keyboard: preserve layout index
On VT switch, the xkb state layout index is lost and reset to the first
group, so if the first layout is not the last one being used, the xkb
state used in both meta-wayland-keyboard.c and clutter/evdev will be
desynchronized with the keyboard source indicator in the gnome-shell UI.

Save the effective layout chosen along with the seat so it can be
restored when reclaiming devices.

Use the saved layout index from the clutter/evdev's seat to restore the
layout in meta-wayland-keyboard, so that switching VT doesn't reset the
layout and causes further discrepancies with the layout indicator in the
gnome-shell UI.

https://bugzilla.gnome.org/show_bug.cgi?id=791383
2017-12-20 09:56:34 +01:00
Olivier Fourdan
03be6b687b clutter/x11: Configure XKB accessibility
Configure XKB accessibility features from the x11 and xi2 clutter input
device managers, offloading this feature from gnome-settings-daemon.

https://bugzilla.gnome.org/show_bug.cgi?id=788564
2017-11-16 14:14:31 +01:00
Olivier Fourdan
32c22d375a clutter/x11: Add xkb accessibility helpers
Adds a set of convenient functions that can be shared between x11 input
device backends (namely core-x11 and xi2) to control XKB accessibility
features.

https://bugzilla.gnome.org/show_bug.cgi?id=788564
2017-11-16 14:14:31 +01:00
Olivier Fourdan
bdf3f49a82 clutter/evdev: implement mouse keys support
Control the pointer using the numeric keypad.

When enabled, creates a virtual pointer and emulate the pointer event
based on keyboard events.

https://bugzilla.gnome.org/show_bug.cgi?id=788564
2017-11-16 14:14:31 +01:00
Olivier Fourdan
356b4b0dc5 clutter/evdev: implement toggle keys support
Keeping Shift pressed for 8 seconds enables slow keys, pressing Shift 5
times in a row enables sticky keys.

https://bugzilla.gnome.org/show_bug.cgi?id=788564
2017-11-16 14:14:31 +01:00
Olivier Fourdan
06d976e853 clutter/evdev: implement sticky keys support
One key press on a modifier latches it, two consecutive presses lock it.

https://bugzilla.gnome.org/show_bug.cgi?id=788564
2017-11-16 14:14:31 +01:00
Olivier Fourdan
96ebd1c214 clutter/evdev: implement bounce keys support
Ignore multiple consecutive identical key presses within a time frame.

https://bugzilla.gnome.org/show_bug.cgi?id=788564
2017-11-16 14:14:31 +01:00
Olivier Fourdan
fa28481736 clutter/evdev: implement slow keys support
Delay emitting clutter key press events when slow key is enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=788564
2017-11-16 14:14:31 +01:00
Olivier Fourdan
76b064cffc clutter/evdev: Implement a11y configuration hooks
Apply the keyboard accessibility settings to the master keyboard.

https://bugzilla.gnome.org/show_bug.cgi?id=788564
2017-11-16 14:14:31 +01:00
Olivier Fourdan
aa73504d95 clutter: add keyboard accessibility signals
Implementing keyboard accessibility in clutter means we need to be able
to notify higher layers of possible modifier masks or setting changes
(as some keyboard accessibility can be disabled or enabled by keyboard).

For this purpose, add two new signals:

   ClutterDeviceManager::kbd-a11y-mods-state-changed
   ClutterDeviceManager::kbd-a11y-flags-changed

https://bugzilla.gnome.org/show_bug.cgi?id=788564
2017-11-16 14:14:31 +01:00
Olivier Fourdan
32305b453d clutter: add hooks for kbd a11y configuration
Use a set of bitwise enum flags to set different keyboard accessibility
features and the necessary vfunc hooks in clutter input device so that
keyboard preferences can be passed to different input device
implementations.

The idea is to be able to configure either the clutter own
implementation of keyboard accessibility for evdev, or eventually
configure AccessX from the X11 clutter input device using the same
mechanism.

https://bugzilla.gnome.org/show_bug.cgi?id=788564
2017-11-16 14:14:31 +01:00
Olivier Fourdan
7d5e08c843 clutter-main: Add hooks to plug kbd accessibility
On X11, when AccessX is enabled, all X11 clients benefit from the
AccessX features, including gnome-shell/mutter, meaning that special
keys like the overview or other shortcuts are also affected.

To achieve the same in Wayland, we need to implement the same features
in clutter main rather than the Wayland backend, so that all depending
code within the compositor but also Wayland clients (which rely on the
compositor to get keyboard events) similarly benefit from the
accessibility features.

Add hooks to the clutter main loop to be able to implement such
features.

https://bugzilla.gnome.org/show_bug.cgi?id=788564
2017-11-16 14:14:31 +01:00
Olivier Fourdan
2ffe597617 clutter/backend: Add bell-notify
We'll need a way to trigger a bell from within clutter for keyboard
accessibility features, add the necessary hooks to be able to call a
backend bell-notify method.

https://bugzilla.gnome.org/show_bug.cgi?id=788564
2017-11-16 14:14:31 +01:00
Carlos Garnacho
c86c5d6905 clutter: Plug evdev ClutterDeviceManager leaks
The unused ID GList element is leaked, and so is the node path.

https://bugzilla.gnome.org/show_bug.cgi?id=789984
2017-11-06 20:51:58 +01:00
Daniel van Vugt
a37956c95f eglnative: Use gnome-settings-daemon font settings
While the X11 backend gets its font settings from XSettings, the native
backend did not use any user font preferences till now. So all shell fonts
were rendered with grayscale un-hinted, which some people describe as
"blurry text in Wayland sessions".

Although it's somewhat confusing using the "xsettings" schema on eglnative,
this is consistent with what GTK does already for its Wayland backend. It
is also documented here:

https://wiki.gnome.org/Initiatives/Wayland/GTK%2B#XSettings
https://wiki.gnome.org/Initiatives/Wayland/gnome-settings-daemon#xsettings

No more blurry shell text in Wayland sessions.

https://bugzilla.gnome.org/show_bug.cgi?id=645433
2017-10-27 22:12:57 -05:00
Jeremy Bicha
5fa8f78434 Revert "tests: Fix actor-anchors test"
This reverts commit dd451547a5.

since we reverted commit 5cb5baa with commit 4d2647c
2017-10-21 18:58:37 -04:00
Michael Catanzaro
4d2647cdbc Revert "ClutterActor: Optimize away idempotent scale/position updates"
This reverts commit 5cb5baa7d4.

There's a cascade of regressions that needs to be sorted out before
relanding this:

https://bugzilla.gnome.org/show_bug.cgi?id=784314
2017-10-19 19:54:24 -05:00
Jeremy Soller
ea214fbe0f Remove unscaled-font-dpi setting from X11 backend
https://bugzilla.gnome.org/show_bug.cgi?id=788049
2017-09-25 22:01:11 +01:00
Jonas Ådahl
ba194bd19e clutter: Fix capture_into on non-origin view
The capture_into() function wrote out of bounds when capturing from a
non-origin view (not positioned at (0,0)). At the time of
implementation, this API was used to capture pixels across views into a
single data buffer, but the way it's used, and the way views may work
now, makes this impossible to do properly.

So remove the ability to capture into a pre-allocated buffer from
multiple views, and complain if the passed rectantgle overlapps with
multiple views. This removes the broken offset calculation all
together, fixing the bug motivating this change.

https://bugzilla.gnome.org/show_bug.cgi?id=787715
2017-09-20 18:27:57 +08:00
Carlos Garnacho
26cd031be8 clutter: Use the ClutterScrollFinishFlags when delivering scroll event
This got accidentally hardcoded to CLUTTER_SCROLL_FINISHED_NONE on commit
d3c559a917, which broke kinetic scrolling for touchpads on clients.
2017-09-14 15:39:58 +02:00
Jonas Ådahl
dd4ad4efc4 Revert "renderer-native: Destroy monitor framebuffers when suspending"
The reverted commit seems to cause
https://bugzilla.gnome.org/show_bug.cgi?id=787240 for some reason. Lets
be safe and revert it for now, as the code freeze is just around the
corner.

This partly (it doesn't reintroduce a whitespace issue) reverts commit
dbc63430d8.
2017-09-04 22:37:16 +08:00
Jonas Ådahl
12710dc644 clutter/stage: Add capture_into API
Add API similar to clutter_stage_capture() but that draws into
externally allocated memory. It is assumed that the pixel format is
ARGB32, and the memory is structured in a way that the width of the
passed rectangle is identical to the stride divided by 4.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 11:49:01 +08:00
Jonas Ådahl
a10ad577a7 ClutterVirtualInputDevice: Add discrete scrolling
Add emitting of discrete scrolling events (such as mouse scroll
wheel-like events).

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 11:49:01 +08:00
Jonas Ådahl
d3c559a917 clutter/evdev: Move scroll notification to ClutterSeatEvdev
This refactors the scroll event emitting code, moving it behind a
clutter_seat_evdev_ helper.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 11:49:01 +08:00
Jonas Ådahl
1e7628a3ef ClutterVirtualInputDevice: Allow passing CLUTTER_CURRENT_TIME
If CLUTTER_CURRENT_TIME is passed, let the backend find an appropriate
time stamp representing the current time in the clock that is used by
that backend.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2017-08-29 11:49:01 +08:00
Jonas Ådahl
5685449e15 clutter/evdev: Add API to get current layout index
We set the layout index when changing keyboard layout, but have no way
to get it back would so be needed. Add that.

https://bugzilla.gnome.org/show_bug.cgi?id=786408
2017-08-21 21:19:18 +08:00
Jonas Ådahl
dbc63430d8 renderer-native: Destroy monitor framebuffers when suspending
When suspending (i.e. VT switching away, the GDM gnome-shell instance
gets hidden, or changing user), destroy the onscreen and offscreen
monitor framebuffers. When resuming, the stage views and framebuffers
will be recreated anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=786299
2017-08-16 13:17:43 +08:00
Carlos Garnacho
c9937faf1e clutter: Fix build with --enable-debug
Message was poking stage_x11, which doesn't exist in this context.
Just print the Window that is receiving the event, the event will be
emitted into the only existing stage anyway.
2017-08-12 11:55:19 +02:00
Jason Gerecke
4d8cb5408b wayland: Provide basic tablet wheel event support
Adds basic support for the "wheel" event from the Wayland tablet protocol.
Ideally we would accumulate the angle and report a wheel event with an
appropriate value for "clicks". We can get away with a much cruder method
for the time being, however, since no Wacom tablet puck actually provides
a smooth scrollwheel. Checking whether the angle in CLUTTER_INPUT_AXIS_WHEEL
exceeds a nominally-small threshold is sufficient to determine that the
wheel has advanced by at least one physical click.

https://bugzilla.gnome.org/show_bug.cgi?id=783716
2017-07-17 21:22:15 +02:00
Carlos Garnacho
5c3b27d02f clutter/x11: Emit CLUTTER_PAD_RING/STRIP events on X11
These events will be useful on gnome-shell UI, so translate the
4-5 button events with exotic axes to those. Also use the
XI_Motion event received when first touching those to reset
the ring/strip state, so we don't receive spurious direction
changes in the upper layers.

https://bugzilla.gnome.org/show_bug.cgi?id=782033
2017-07-17 19:43:13 +02:00
Carlos Garnacho
ead6556b50 clutter: Add clutter_event_get_pad_event_details()
This function extracts pad event information, and more importantly
exposes it for gobject introspection.

https://bugzilla.gnome.org/show_bug.cgi?id=782033
2017-07-17 19:10:05 +02:00
Jonas Ådahl
9ab338d7b6 clutter/stage-cogl: Track regions in buffer coordinate space
When fractional scaling is used, damage and paint clip region is tracked
in stage coordinate space using integers might end up missing some
pixels when the border ends up on half pixels. Change the damage
tracking and clip regions to be in buffer coordinates so we can align
damage on physical pixel borders.

However, just using rounding up to the next physical pixel results in
glitches. To avoid this, extend the damage by one logical pixel in all
directions, but still (scissor) clip the drawing to the non-extended
region, as otherwise drawing the damaged regions will result in
incorrect pixels on the right and bottom edges of the clip region. It is
possible that there are better ways to do this, which can be explored in
the future.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:27 +08:00
Jonas Ådahl
0adc56779f clutter/stage: Don't loose precision when setting up viewport
We always hit non-fractional floats here because the stage views are
always made so that they are aligned on integer positions with integer
sizes, but there is no reason to go float -> int -> float when
calculating the viewport.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
dfc4d0d523 clutter/stage-view: Allow scales down to 0.5
There is support for scaling logical monitors down to 0.5, so don't let
ClutterStageView stand in the way for that.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
fef81cd628 clutter/stage: Fix capturing scaled views
Make clutter_stage_capture() work if views are scaled. This needs
adaptations on the using side to deal with the cairo surface device
scale that is used to communicate the scale used when capturing.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
c2e49f1bb5 clutter: Change stage view scale to be float
To support fractional scaling, change the stage view scale to be a
float instead of an int. Also change the places where it is retrieved
and used when scaling things.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
a3d63d0ac0 clutter/stage-view: Add G_PARAM_CONSTRUCT flag to properties
Otherwise those properties won't be set when ->construct is called.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Jonas Ådahl
88cae8bd3d settings: Manage our own font DPI
Previously gnome-shell listened on the Xft Xsettings via GTK+s
GtkSettings to get the font DPI setting. The Xsetting might not
be what we want, and we should not rely on Xsettings when we don't need
to, so lets manage it ourself.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2017-07-14 20:54:26 +08:00
Carlos Garnacho
56c468a2ef clutter/x11: Set master device on pad button events
These should be set one, but just set the master to be the slave
pad device. We are passively grabbing the pad device, so this is
consistent with active grabs on slave devices. Besides, pads are
paired to the VCP, which is not really truthful.

Fixes inoffensive warnings when trying to check whether motion
throttling applies for these events.

https://bugzilla.gnome.org/show_bug.cgi?id=784881
2017-07-13 19:05:44 +02:00
Carlos Garnacho
328e3f8f4f clutter: Extend mapping-mode to pen/eraser devices
This just used to apply to CLUTTER_TABLET_DEVICE on wayland, allow using
it on pen/eraser devices (as X11 sees tablets) for consistency.

https://bugzilla.gnome.org/show_bug.cgi?id=784402
2017-07-12 23:43:23 +02:00
Emmanuele Bassi
41e22ab592 Use newer glib-genmarshal option
When building against a glib-genmarshal from GLib 2.54 we can use the
`--prototypes` command line argument to generate the prototypes for the
marshallers in the C source, and avoid a missing-prototypes compiler
warning.
2017-07-11 11:30:08 +01:00
Carlos Garnacho
a70ae50ca9 clutter: Do not throttle motion events on tablet tools
Events from tablets must not be filtered out, as the event coalescing
results in precision loss.

https://bugzilla.gnome.org/show_bug.cgi?id=783535
2017-07-03 13:56:21 +02:00
Tim Lunn
dd82f4afcd configure: require glib 2.53.2
This is required for the new glib-genmarshal as introduced in
 commit 9131f26cae

https://bugzilla.gnome.org/show_bug.cgi?id=783161
2017-05-28 11:21:42 +10:00
Florian Müllner
dd451547a5 tests: Fix actor-anchors test
Since commit 5cb5baa7d4, we skip transitions when updating an
actor's scale/position to the existing value. As a result, we
don't get change notification on those properties either - given
that the properties did not actually change, that behavior seems
fine, so just modify the test to not expect a notify signal for
unchanged properties.
2017-05-24 21:04:07 +02:00
Carlos Garnacho
4b23eb064c clutter: Update pointer position on master clock's update stage
Ensure the pointer position is up-to-date for the pointers inside
the clip area after the stage got actors relayout.

https://bugzilla.gnome.org/show_bug.cgi?id=755164
2017-05-23 16:37:53 +02:00
Carlos Garnacho
5cb5baa7d4 ClutterActor: Optimize away idempotent scale/position updates
If the actor results in the same scale/position, there's no need to
trigger a transition.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-22 17:27:11 +02:00
Carlos Garnacho
d620189ae3 ClutterActor: Call queue_redraw vfunc directly if possible
Reduces some signal emission overhead.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-22 17:27:11 +02:00
Emmanuele Bassi
4b4c2b1afa ClutterActor: Avoid frequent signal emission if possible
Avoid signal emission for ::paint/::pick if no handlers are connected,
which is the most frequent case.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-22 17:27:11 +02:00
Carlos Garnacho
3887d25dbc ClutterStage: Use non-generic marshaller for ::presented signal
This signal runs often, so it's better to use a direct marshaler.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2017-05-09 11:53:27 +02:00
Nigel Taylor
d3362a6f05 clutter: conform/actor-graph: Add missing null-termination
https://bugzilla.gnome.org/show_bug.cgi?id=759085
2017-05-05 09:53:51 -04:00
Florian Müllner
9cf8aa4584 cally: Fix compilation without X11 backend
Commit 0fd9e38175 fixed setting the out parameter for the x coordinate
when using the X11 backend, but broke compilation when the backend is
not available ...
Really fix the issue by running the X11-specific code when the X11
backend is available and in use, and display the one-time warning
otherwise.

https://bugzilla.gnome.org/show_bug.cgi?id=781902
2017-05-02 14:29:59 +02:00
Emmanuele Bassi
c76eedd794 Typo fix: missing '\'
Without the backslash, the build breaks.
2017-04-30 15:05:52 +01:00
Emmanuele Bassi
9131f26cae Generate marshallers without including the generated header
GLib now generates the prototypes for the generated marshallers, so it's
not necessary to include the header any more.

This fixes a build failure in GNOME Continuous with GLib master, caused
by -Werror=redundant-decls.
2017-04-30 14:56:29 +01:00
Florian Müllner
0fd9e38175 cally: Fix translation to screen coordinates
Due to an accidental swap of an else statement and a preprocessor #else,
the output x coordinate is currently only set when not using the X11
windowing system, whoops.

https://bugzilla.gnome.org/show_bug.cgi?id=781902
2017-04-28 17:20:36 +02:00
Mario Sanchez Prada
813de50eba Declare clutter version constants as extern
These constants got the CLUTTER_VAR annotations removed when making
it a private library, so the extern modifier needs to be explicitly added.
2017-04-13 13:08:22 +01:00
Florian Müllner
47a01013b1 clutter-color: Shut up a compiler warning 2017-04-07 23:19:22 +02:00
Jonas Ådahl
20fcb88632 clutter: Remove window scaling feature
Window scaling is a clutter feature used to enable automatic scaling of
stage windows when running under as an application in windowing system.
Clutter in mutter does not support running as a stand-alone application
toolkit, so lets remove this unused feature.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:50 +08:00
Jonas Ådahl
63450d69d3 clutter: Add ability to scale stage views
This commit adds the ability to set a scale on a scale view. This will
cause the content in the stage view to be painted with the given scale,
while still keeping the configured layout on the stage. In effect, for
a stage view with scale 'n', this means the framebuffer of a given stage
will 'n' times larger, keeping the same size on the stage.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
2017-04-07 22:30:48 +08:00
Jonas Ådahl
df45c50d0b clutter: Also filter relative tablet tool motions
Pass the relative motion from tablet tools through the same filter
mechanism as used for the relative pointer motions.

https://bugzilla.gnome.org/show_bug.cgi?id=778119
2017-03-27 12:57:56 +02:00
Jonas Ådahl
8f691c28f3 clutter: Add API for filtering relative motion events
Add an API that allows the owner of the clutter context to alter the
relative motion events (so far relative pointer events).

https://bugzilla.gnome.org/show_bug.cgi?id=778119
2017-03-27 12:57:56 +02:00
Armin Krezović
a77da353f3 input-settings: Set double click timeout from gsettings
Clutter's evdev input backend has no support for setting double
click timeout set by gnome-settings-daemon. This results in
touchpad click events timing out on wayland, because the
default timeout value wasn't enough.

This patch moves timeout setting to mutter and removes X11
backend specific setting from clutter.

https://bugzilla.gnome.org/show_bug.cgi?id=771576
2017-03-24 20:47:00 +01:00
Carlos Garnacho
e081bb3921 clutter: Add clutter_input_device_is_grouped call/vfunc
This will be used to query grouped devices (eg. tablets and pads)

https://bugzilla.gnome.org/show_bug.cgi?id=779986
2017-03-13 19:34:10 +01:00
Jonas Ådahl
c5dc0f4a2e clutter/stage-view: Add getter for getting the offscreen blit transform
This will be used to invert the transform in the nested mode, making it
possible to test offscreen texture based transform using the nested
backend.

https://bugzilla.gnome.org/show_bug.cgi?id=779745
2017-03-09 10:17:30 +08:00
Rui Matos
542ed1d024 clutter-clone: Unset source when source actor is destroyed
Otherwise we might be holding on to a source actor that's no longer
fully functioning and cause crashes if for example we try to paint it.

https://bugzilla.gnome.org/show_bug.cgi?id=779483
2017-03-06 14:00:48 +01:00
Carlos Garnacho
46d516cb04 clutter: Force scale=1 in tests/conform
Device pixel sizes are compared in several places, which breaks
some tests on hidpi setups.
2017-02-17 17:01:57 +01:00
Jonas Ådahl
4ebc55f2b3 Make libmutter and friends parallel installable
In order to minimize the amount of breakage, while at the same time
making it easier to make backward incompatible changes needed to
continue turning libmutter into a capable Wayland compositor, make the
libmutter and friends (libmutter-clutter, libmutter-cogl*) parallel
installable by adding a version number to the name. This changes
various filenames, for example what previously was libmutter.so is now
libmutter-0.so (assuming the version for now is 0), and
libmutter-clutter-1.0.so is now libmutter-clutter-0.so. The pkg-config
filenames and GObject introspection has been renamed to reflect this as
well.

This enables a downstream compositor rely on a specific version of the
libmutter API, while gracefully handling API/ABI changes by having to
update to the new version at their own pace.

https://bugzilla.gnome.org/show_bug.cgi?id=777317
2017-02-14 11:16:45 +08:00
Carlos Garnacho
d6fc41b73e clutter: Add function to find out the number of modes for a pad group
This is obtained in backend-dependent ways in the upper layers, seems
better to let ClutterInputDevice provide this information.

https://bugzilla.gnome.org/show_bug.cgi?id=771098
2017-02-10 20:11:19 +01:00
Carlos Garnacho
9d38ffa6e3 clutter: Add functions to find out mode switch buttons, and their group
This is done in the upper layers through backend-dependent ways, seems
better to let ClutterInputDevice provide this information.

https://bugzilla.gnome.org/show_bug.cgi?id=771098
2017-02-10 20:11:19 +01:00
Carlos Garnacho
8bcdf9ba61 clutter: Add current group mode on pad events
This info can be obtained here right away, so we don't need
backend-dependent paths in the upper layers.

https://bugzilla.gnome.org/show_bug.cgi?id=771098
2017-02-10 20:11:19 +01:00
Carlos Garnacho
1ff9bbd59c clutter/evdev: Add ClutterInputDeviceEvdev::output-aspect-ratio
When != 0, this property will express the W:H ratio of the desired
output area (be it one monitor or the span of all monitors). At
the time of translating coordinates, coordinates will be skewed so
that the input area of the tablet is a rectangle of the given ratio.

Events happening in the input areas that fall outside the output
aspect ratio will be clamped to the nearest coordinate in the rect.

If the ratio is 0, the whole input area of the tablet will be used
and no coordinate skewing will happen.

https://bugzilla.gnome.org/show_bug.cgi?id=774115
2017-02-10 16:31:50 +01:00
Carlos Garnacho
cc838ead8b clutter/evdev: Add ClutterInputDeviceEvdev::device-matrix property
And transform absolute events using this matrix. This property is
akin to the "Coordinate Transformation Matrix" property in X11,
and will be used to map tablets/touchscreens to outputs, favoured
over the libinput matrix which is meant for calibration.

https://bugzilla.gnome.org/show_bug.cgi?id=774115
2017-02-10 16:31:50 +01:00
Carlos Garnacho
9c79a1631d backends: Pass seat ID to evdev ClutterDeviceManager
Clutter assumed seat0 which is most usually, but not always correct.
Add an evdev-backend specific function to allow passing the seat
that will be used for ClutterDeviceManager construction, which we
already obtain in MetaLauncher.

https://bugzilla.gnome.org/show_bug.cgi?id=778092
2017-02-02 23:39:02 +01:00
Rui Matos
1597b357a1 clutter/evdev: Dispatch libinput before generating key repeat events
Since both the libinput event source and the key repeat timer have the
same priority, the order in which both handlers are called is
arbitrary if both sources are ready on the same poll return. This
means that sometimes we generate key repeats when there's already a
real key event queued on libinput that would cancel the repeat timer
if only it was processed before.

One solution would be lowering the repeat timer source priority a
notch lower than the libinput source but that would mean that a steady
stream of events from libinput (e.g. pointer device motion) would
prevent any key repeats to happen.

Instead, we can fix this problem by trying to dispatch libinput from
the key repeat timer and checking if the timer source has been
destroyed before generating more key repeats.

https://bugzilla.gnome.org/show_bug.cgi?id=774989
2017-01-25 13:07:48 +01:00
Rui Matos
73524cadd4 clutter/evdev: Avoid losing key repeat timestamp resolution
Commit 9214d5029c changed the notify*
API to use microseconds and we already have a microsecond time source
here so we can use the timestamp directly without losing resolution at
this layer.

https://bugzilla.gnome.org/show_bug.cgi?id=774989
2017-01-25 13:07:43 +01:00
Florian Müllner
e8380d11c4 build: Fix cogl include paths of tests
Those were missed by commit 0aa6d9782c ...
2016-11-23 23:12:55 +01:00
Florian Müllner
0aa6d9782c build: Fix cogl include paths
cogl-egl-defines.h is now referenced from a public header, so we need
to include its location whenever the header is used (directly or via
cogl.h).
2016-11-23 18:03:59 +01:00
Jonas Ådahl
c2e72823fc clutter: Fix a couple introspection warnings
This includes not introspecting ClutterStageView things at all for now,
as they are only used by C code.

https://bugzilla.gnome.org/show_bug.cgi?id=774827
2016-11-23 21:59:16 +08:00
Carlos Garnacho
af920851ca clutter: Fix build
Typo in get_type() function, can only be classified as post-c&p brain fart.
2016-11-07 14:24:36 +01:00
Carlos Garnacho
ea4dbdd66f clutter/x11: Implement ClutterInputDeviceTool
This is implemented using Wacom-driver specific properties at
the moment, until libinput becomes the fallback driver handling
tablet and pad management.

Whenever a tool becomes in proximity, a new ClutterInputDeviceToolXI2
will be created (if it wasn't created previously) for the given
serial number. This tool will be set in all events send from the
device.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
b252771a8f clutter/evdev: Take over stylus configuration
Stylus configuration (stylus buttons, pressure) was handled
at the very high level, doing the button and pressure translations
right before sending these to wayland clients.

However, it makes more sense to store these settings into the
ClutterInputDeviceTool itself, and have clutter apply the config
at the lower level so 1) the settings actually apply desktop-wide,
not just in clients and 2) X11 and wayland may share similar
configuration paths. The settings are now just applied whenever
the tool enters proximity, in reaction to
ClutterDeviceManager::tool-changed.

This commit moves all handling of these two settings to
the clutter level, and removes the wayland-specific paths

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
75c3f0ffba clutter/evdev: Emit ClutterDeviceManager::tool-changed
We do so whenever a tool enters or leaves proximity. We now also
ensure that last_tool is NULL after it leaves proximity, although
the CLUTTER_PROXIMITY_OUT event itself should still contain tool
information.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
bd83873a7f clutter: Add ClutterDeviceManager::tool-changed signal
This signal will notify whenever a device changed tool.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
9abf6892c4 clutter/x11: Add minimal support for pad devices
We most notably handle button events (acquired through a passive grab on
all device buttons) which are translated to CLUTTER_PAD_BUTTON* events,
so there is generic handling of pad actions on X11.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
674a48335d clutter/x11: Implement XTest-based ClutterVirtualInputDevice
This will be used too on X11 in order to implement the button-to-keycombo
mapping in pad devices.

https://bugzilla.gnome.org/show_bug.cgi?id=773779
2016-11-04 21:25:31 +01:00
Carlos Garnacho
4cfc21d49d clutter: Rename touchpad gesture n_fingers getter to be more generic
This can also be used now on pinch events, so make a more generic name
for this function.

https://bugzilla.gnome.org/show_bug.cgi?id=765937
2016-11-04 16:28:30 +01:00
Carlos Garnacho
cf0a453d32 clutter/evdev: Fill n_fingers information in touchpad pinch events
Libinput tells us this much (at least for 3 fingers), so make sure
we propagate this info.

https://bugzilla.gnome.org/show_bug.cgi?id=765937
2016-11-04 16:28:30 +01:00
Carlos Garnacho
4186833df7 clutter: Add n_fingers field to ClutterTouchpadPinchEvent
https://bugzilla.gnome.org/show_bug.cgi?id=765937
2016-11-04 16:28:30 +01:00
Rui Matos
fc8de3d0c8 clutter/stage: Fix framebuffer capture origin offset (again)
Commit 5fbb479301 was wrong too. What we
really want to do here is getting view relative coordinates given the
view's and the rectangle's global coordinates so we need to subtract
the view's origin from the rectangle's.

https://bugzilla.gnome.org/show_bug.cgi?id=771502
2016-10-17 13:47:20 +02:00
Florian Müllner
a4e69f338d clutter: Reuse GTK+'s RTL/LTR handling
Commit a4fb7ef5a3 dropped translations of our internal cogl/clutter
forks, which broke the local-based text direction support. Instead
of bringing back translations just for this purpose, we can re-use
GTK's translations which use the same technique.

https://bugzilla.gnome.org/show_bug.cgi?id=771549
2016-09-19 23:10:57 +02:00