Commit Graph

6729 Commits

Author SHA1 Message Date
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