Commit Graph

6721 Commits

Author SHA1 Message Date
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
Rui Matos
5fbb479301 clutter/stage: Fix framebuffer capture origin offset
Commit f36fa53b0e had the offset math
wrong and the reviewer didn't notice it.

https://bugzilla.gnome.org/show_bug.cgi?id=771502
2016-09-19 22:28:05 +02:00
Jonas Ådahl
342532a98d ClutterStageCogl: Don't get buffer damage dirty pixel when not supported
Now with the existance of offscreen view framebuffers the buffer age
damage regions are only valid if the view in question doesn't doesn't
have an intermediate offscreen. So, for views that doesn't have buffer
age, return the dirty pixel (0,0).

https://bugzilla.gnome.org/show_bug.cgi?id=770672
2016-09-15 10:14:20 +08:00
Jonas Ådahl
219d2304e0 clutter: Let the stage window translate dirty pixel according to view
Otherwise if buffer age is not supported the dirty pixel would be
shifted potentially in unpaintable position.

https://bugzilla.gnome.org/show_bug.cgi?id=770672
2016-09-15 10:14:20 +08:00
Jonas Ådahl
fb6b0de48b clutter: Use non-deprecated pixel reading function when picking
This wont fix anything, it just one small step away from using
deprecated cogl functions.

https://bugzilla.gnome.org/show_bug.cgi?id=770672
2016-09-15 10:14:20 +08:00
Jonas Ådahl
b78b8c9578 ClutterStageView: Always blit full texture on full onscreen framebuffer
When blitting an offscreen onto an onscreen, the whole offscreen should
always be drawn on the whole onscreen. Thus, don't try to convert
between coordinate spaces, just draw the whole offscreen on the whole
onscreen.

https://bugzilla.gnome.org/show_bug.cgi?id=770672
2016-09-15 10:14:20 +08:00
Olivier Fourdan
4c106a9c9b wayland: save/restore numlock state
Save the state on NumLock so that is can be (optionally) restored on
next login.

bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=757943
2016-09-09 19:07:10 +02:00
Jonas Ådahl
d893adb290 clutter: Compress instead of discard motion events
Clutter discards any motion event if next event happens to also be a
motion event. This is problematic when the motion event carries
relative motion deltas, since the information about them is completely
lost.

Until we have moved away made the stage stop discarding motion events,
lets work around the issue by compressing them, effectively adding
multiple relative motion deltas together, would one be discarded.

https://bugzilla.gnome.org/show_bug.cgi?id=771049
2016-09-09 10:03:34 +08:00
Jonas Ådahl
f36fa53b0e clutter/stage: Offset framebuffer capture origin by view layout
The rectangle passed to capture_view() is in stage coordinate space;
thus, to translate to framebuffer coordinate space, the origin need to
be translated by the view layout position.

This fixes capturing views not at position (0, 0).

https://bugzilla.gnome.org/show_bug.cgi?id=770127
2016-09-06 14:59:36 +08:00
Jonas Ådahl
01edf10e82 clutter/evdev: Fix absolute pointer motion events
Absolute pointer events used the X coordinate as both X and Y. This
caused the pointer cursor to be moved incorrectly for absolute pointer
devices, commonly used in virtual machines.

https://bugzilla.gnome.org/show_bug.cgi?id=770557
2016-08-30 15:48:30 +08:00
Carlos Garnacho
a6e15e841b clutter/cogl: Transform swap buffers regions into onscreen coordinates
Those are given in view coordinates, so we must transform into onscreen
coordinates in order to perform swap_buffers on the right damage regions.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:38:05 +02:00
Carlos Garnacho
61e9c5c357 clutter/cogl: Hook up ClutterStageView render-to-texture
"Blit" the result on the framebuffer after each view is painted.
This of course only applies if there is an offscreen buffer to
perform any blitting. Otherwise the onscreen framebuffer is rendered
to directly and this step is not necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:38:05 +02:00
Carlos Garnacho
54dc10f890 clutter: Add infrastructure to render ClutterStageViews to offscreen
The offscreen is given through the ::back-buffer property, the ClutterStageView
will set up the the CoglPipeline used to render it back to the "onscreen"
framebuffer.

The pipeline can be altered through the setup_pipeline() vfunc, so ClutterStageView
implementations can alter the default behavior of blitting from offscreen to
onscreen with no transformations.

All getters of "the framebuffer" that were expecting to get an onscreen have
been updated to call the right clutter_stage_view_get_onscreen() function.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-08-24 02:36:45 +02:00
Sjoerd Simons
913c32ee34 Fix build of clutter tests
Various clutter test directly use cogl symbols, so they should be linked
against mutter-cogl as well.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>

https://bugzilla.gnome.org/show_bug.cgi?id=769636
2016-08-23 13:45:05 +02:00
Carlos Garnacho
b53b94e6f2 clutter/evdev: Implement ClutterVirtualInputDevice::notify_keyval
This is somewhat gross at the moment, because we're after all mimicking
real keyboard events, we can only lookup keycodes that are available
in the current map, and the control of levels is rather limited.

Eventually, we want to implement the text_input protocol, handle these
events separately to MetaWaylandKeyboard, so event->key.keyval is
is guaranteed to be the final result. Until then, this is the farthest
we can get.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 11:36:42 +02:00
Carlos Garnacho
4abd31d863 clutter: Add ClutterVirtualInputDevice vmethod to notify keysyms
Evcodes don't cut it when we have something already specifying the
character to be printed, despite the current group/level. This API
allows some more control on the intended output.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 11:03:18 +02:00
Carlos Garnacho
3c8b1462bc clutter: Make ClutterVirtualInputDevice public
This includes adding documentation and introspection annotations,
and marking the functions as extern.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 11:03:18 +02:00
Carlos Garnacho
27a77fa115 clutter/evdev: Allow specifying the ClutterInputMode of virtual devices
The seat core keyboard/pointer will be "master", the ones created through
ClutterVirtualInputDevice will be "slaves".

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 11:03:18 +02:00
Jonas Ådahl
0992b5c53e ClutterVirtualInputDeviceEvdev: Forward button and key presses
https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 11:03:18 +02:00
Jonas Ådahl
e928370bf0 ClutterSeatEvdev: Keep track of button count
libinput does it for us, but only for physical devices. When we add
virtual devices to the same seat, we need to track button press count
ourself.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
d2b05f0305 ClutterVirtualInputDeviceEvdev: Forward motion events
https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
bd326d38ac ClutterVirtualInputDeviceEvdev: Create associated ClutterInputDevice
https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
8e335ce183 ClutterVirtualInputDeviceEvdev: Construct with a specific seat
We are still single seated, so until we are properly multi seated its
always the main seat.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
364b184f41 ClutterVirtualInputDevice: Store the device type
https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
94016f7257 clutter/evdev: Move keyboard and pointer notification into seat
We notify per seat; so lets move the logic there. Touch and tablets to
follow later.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
e38a8363e4 ClutterVirtualInputDevice: Keep track of the device manager
https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
76eb27e786 ClutterDeviceManagerEvdev: Split out seat into a separate file
Split out ClutterSeatEvdev functionality into a separate file.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:24 +02:00
Jonas Ådahl
5db2be414b clutter: Add virtual input device API
Virtual input devices aim to enable injecting input events as if they
came from hardware events. This is useful for things such as remote
controlling, for example via a remote desktop session.

The API so far only consists of stumps.

https://bugzilla.gnome.org/show_bug.cgi?id=765009
2016-08-10 10:39:19 +02:00
Jonas Ådahl
adcd0fe9b4 ClutterStageView: Initialize viewport/projection as dirty
Initially the viewport and projection is not calculated and should thus
be marked as dirty.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-08-03 11:20:55 +08:00
Florian Müllner
740748af3e clutter: Fix typo in assert 2016-07-29 11:35:31 +02:00
Carlos Garnacho
2e4eb86340 configure: Require libinput 1.4
We use API recently added in that version.
2016-07-27 13:32:38 +02:00
Carlos Garnacho
80674fc9e4 clutter/evdev: Optionally report abs/rel motions for tablet tools
Depending on clutter_input_device_get_mapping(), or whether the current
tool is either cursor or lens (those don't make any sense in absolute
mode), relative motions will be reported.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
9587a60da4 clutter: Add clutter_input_device_[gs]et_mapping()
This function call only applies to tablets, and thus will error
out unless it's called with CLUTTER_TABLET_DEVICEs. This will
allow setting absolute/relative mapping on those on the fly, as
this is optional.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
af8b938f92 clutter/x11: Set device node information in XI2 devices 2016-07-22 13:31:09 +02:00
Carlos Garnacho
1496a7ead3 clutter/evdev: Set device node information to evdev devices 2016-07-22 13:31:09 +02:00
Carlos Garnacho
e7e62ee4a4 clutter: Add clutter_input_device_get_device_node()
This function is meant to return the device node path (eg. /dev/input/...),
which will be useful to wire up a few things.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
1c23d4bc51 clutter/evdev: Set tool IDs 2016-07-22 13:31:09 +02:00
Carlos Garnacho
2e6bfa8bae clutter: Add ClutterInputDeviceTool:id property 2016-07-22 13:31:09 +02:00
Carlos Garnacho
a59170c09f clutter: Fix ClutterInputDeviceTool:serial setter/getter
The argument is internally handled as a uint64, but only exposed in
API as guint.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
96aed5fd2e clutter: Handle pad button events in clutter_event_get_button() 2016-07-22 13:31:09 +02:00
Carlos Garnacho
88c510c38a clutter/evdev: Translate/emit libinput pad events 2016-07-22 13:31:09 +02:00
Carlos Garnacho
6bcff556b5 clutter/evdev: Handle management of pad devices 2016-07-22 13:31:09 +02:00
Carlos Garnacho
81736b1dea clutter: Add ::n-rings and ::n-strips property to ClutterInputDevice
This will only be practical for pads (and maybe generic buttonsets in
the future?), we just need to know the number as the events will also
contain a number as the identificator.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
cc09ca8892 clutter: Add pad event types
And their management along the pipeline.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
d76aa89be9 clutter: Add clutter_event_get_mode_group()
This event can be used on pad events to find out the group they
pertain to.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
8cd4b0e11f clutter: Add pad event structs
Those map closely what we get from libinput. Button events have
been made its own separate struct, its semantics fall somewhere
in between of ClutterButtonEvent and ClutterKeyEvent, so is better
emitted as its own set.
2016-07-22 13:31:09 +02:00
Carlos Garnacho
6b08990dcc clutter: Add "pad" device type 2016-07-22 13:31:09 +02:00
Florian Müllner
c8392e025f tests: Adjust to config.h removal
Commit bf71cb2e3c changed this to use different file names for the
cogl and clutter parts to avoid any confusion.
2016-07-20 21:14:43 +02:00
Florian Müllner
820ffa2781 tests: Drop test that uses removed CoglTexture API
Commit 21f2f52269 removed the API to get/set texture format and
rowstride, so drop the corresponding test.
2016-07-20 20:58:21 +02:00
Florian Müllner
51f7892600 tests: Drop tests that use cogl-1.0 path API
Commit d62d780a95 dropped the 1.0 version of that API as well
as the 2.0 compatibility layer.
2016-07-20 20:58:20 +02:00
Florian Müllner
aebd5ba6e0 stage-view: Fix memory handling of :framebuffer property
Currently the setter doesn't take ownership of the value, but dispose()
will unref it (and thus release someone else's reference). Fix this by
taking ownership of the property value in the setter.
2016-07-20 20:04:27 +02:00
Florian Müllner
a310ba7649 build: Dist cogl-mutter/cogl-clutter headers 2016-07-20 14:30:57 +02:00
Florian Müllner
0745734ba5 clutter: Fix a compiler warning
There's no need for a cast for printing an object's type or address,
so we can remove variables that are unused when not building with
CLUTTER_ENABLE_DEBUG.
2016-07-20 13:03:48 +02:00
Jonas Ådahl
ff6186f1ec clutter: Add capture API for reading stage pixels
clutter_stage_capture should be used instead of directly utilizing
cogl's read_pixels API's.

https://bugzilla.gnome.org/show_bug.cgi?id=768978
2016-07-20 14:23:48 +08:00
Carlos Garnacho
a40e4634a6 clutter: Remove clutter-build-config.h.in
This file is autogenerated.

https://bugzilla.gnome.org/show_bug.cgi?id=768977
2016-07-20 14:23:48 +08:00
Jonas Ådahl
d62d780a95 Remove cogl-1.0 vs cogl-2.0 vs cogl experimental API split
Mutter (and libmutter users) are the only users of this version of
cogl, and will more or less only use the cogl-1.0, cogl-2.0 and cogl
experimental API variants, and having the possibility of having
different API versions of the same API depending on what file includes
it is error prone and confusing. Lets just remove the possibility of
having different versions of the same API.

https://bugzilla.gnome.org/show_bug.cgi?id=768977
2016-07-20 14:23:48 +08:00
Jonas Ådahl
eed71654ba Don't pretend we don't have CoglShader
We bypass our build configuration to fetch API from a version which
isn't the one we actually use. Stop bypassing and just admit that the
1.0 API is still there, but still deprecated.

https://bugzilla.gnome.org/show_bug.cgi?id=768977
2016-07-20 14:23:48 +08:00
Jonas Ådahl
aafdb6baaa clutter/evdev/clutter-xkb-utils.c: Include clutter-build-config.h
https://bugzilla.gnome.org/show_bug.cgi?id=768977
2016-07-20 14:23:48 +08:00
Jonas Ådahl
2547a7cd9c ClutterBezier: Make a private copy of sqrti from cogl
We didn't include clutter-build-config.h, meaning we included a
different API of cogl than the rest of clutter. This API contains the
function cogl_sqrti which was the only thing used. Lets include the
build config file and stop depending on the API that is no longer
exposed to us.

https://bugzilla.gnome.org/show_bug.cgi?id=768977
2016-07-20 14:23:48 +08:00
Jonas Ådahl
b4b13ac996 clutter: Remove ClutterFixed
We don't use it any more. Lets get rid of it.

https://bugzilla.gnome.org/show_bug.cgi?id=768977
2016-07-20 14:23:48 +08:00
Jonas Ådahl
21f2f52269 ClutterTexture: Remove texture pixel format access
Deprecated, misleading and not used anywhere; lets get rid of it.

https://bugzilla.gnome.org/show_bug.cgi?id=768977
2016-07-20 14:23:48 +08:00
Jonas Ådahl
28a898a22f Use signals instead of onscreen framebuffer frame callbacks
CoglFrameInfo is a frame info container associated with a single
onscreen framebuffer. The clutter stage will eventually support drawing
a stage frame with multiple onscreen framebuffers, thus needs its own
frame info container.

This patch introduces a new stage signal 'presented' and a accompaning
ClutterFrameInfo and adapts the stage windows and past onscreen frame
callbacks users to use the signal and new info container.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
566c28bdaf Introduce regional stage rendering
Add support for drawing a stage using multiple framebuffers each making
up one part of the stage. This works by the stage backend
(ClutterStageWindow) providing a list of views which will be for
splitting up the stage in different regions.

A view layout, for now, is a set of rectangles. The stage window (i.e.
stage "backend" will use this information when drawing a frame, using
one framebuffer for each view. The scene graph is adapted to explictly
take a view when painting the stage. It will use this view, its
assigned framebuffer and layout to offset and clip the drawing
accordingly.

This effectively removes any notion of "stage framebuffer", since each
stage now may consist of multiple framebuffers. Therefore, API
involving this has been deprecated and made no-ops; namely
clutter_stage_ensure_context(). Callers are now assumed to either
always use a framebuffer reference explicitly, or push/pop the
framebuffer of a given view where the code has not yet changed to use
the explicit-buffer-using cogl API.

Currently only the nested X11 backend supports this mode fully, and the
per view framebuffers are all offscreen. Upon frame completion, it'll
blit each view's framebuffer onto the onscreen framebuffer before
swapping.

Other backends (X11 CM and native/KMS) are adapted to manage a
full-stage view. The X11 CM backend will continue to use this method,
while the native/KMS backend will be adopted to use multiple view
drawing.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
7f0e6b9b4b compositor: Don't access use the onscreen framebuffer directly
Instead of assuming there is a single onscreen framebuffer, use the
helper functions for setting the frame callback and getting the frame
counter.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
767e12125b ClutterStageCogl: Let the sub-classes handle the onscreen
In preperation for having allowing drawing onto multiple onscreen
framebuffers, move the onscreen framebuffer handling to the
corresponding winsys dependent backends.

Currently the onscreen framebuffer is still accessed, but, as can seen
by the usage of "legacy" in the accessor name, it should be considered
the legacy method. Eventually only the X11 Compositing Manager backend
will make use of the legacy single onscreen framebuffer API.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
df0805fb0a ClutterStageWindow: Remove dirty_back_buffer vfunc
It was dead code, so lets remove it.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
14dbdfe483 Get rid of ClutterStageEglNative
The functionality from ClutterStageEglNative (one function returning
TRUE) was moved to MetaStageWindowNative.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
c3d2352a9e Explicitly create per backend stage windows
Split the stage window implementations into three separate objects: one
for X11 as a compositing manager, one for X11 running as a nested
Wayland compositor, and one for running with the native backend.

The new stage window implementations are only thin shells; this is in
preparation for making the stage windows behave more differently.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
f31d71ce63 ClutterStageX11: Remove dead code
https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
2c439dec75 ClutterStageX11: Move macro to .c file
It was only used there, no need to expose it elsewhere.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
942feadffd ClutterStageX11: Don't exposed unused function
https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
2ceff4ee9b Create cogl renderer in MetaRenderer
Instead of passing around the KMS file descriptor via clutter to cogl,
just make our own clutter backend create the cogl renderer and set the
KSM fd.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
2facf26568 clutter: Add test .gitignore files
https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
9c0fa583f5 clutter/tests/conform: Fix actor-offscreen-redirect
The actor-offscreen-redirect didn't initialize its state properly, so
it could potentially end up with the "was_painted" state being TRUE
from the start, effectively skipping the whole test.

Fixing so that the test even run resulted in the test getting stuck in
a dead lock due to the verification that a frame was drawn was done
from a paint callback. A paint callback had the mutex held, so when the
test case tried to run the main loop, the next paint callback caller
path taken would try to re-lock the same mutex, thus dead lock.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
f1b7b41b8d Update .gitignore
The cogl/clutter merge made the .gitignore files in the respective
directories incorrect, due to the using absolute paths.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
bf71cb2e3c Don't use config.h in clutter and cogl
In cogl use cogl-config.h and in clutter use clutter-build-config.h. We
can't use clutter-config.h in clutter because its already used and
installed.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
90de521799 Make mutter manage its own clutter backends
Introduce two new clutter backends: MetaClutterBackendX11 and
MetaClutterBackendNative. They are so far only wrap ClutterBackendX11
and ClutterBackendEglNative respectively, but the aim is to move things
from the original clutter backends when needed.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
a1bedd4b1c clutter: Remove leftover wayland backend references
https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Owen W. Taylor
d6b290ef77 Don't create the Cogl GLib source multiple times
Since the check for backend->cogl_context was accidentally moved
to clutter_backend_do_real_create_context, the Glib source that
is created at the end of clutter_backend_do_create_context() is
created and added each time create_context() is called, though
create_context() is supposed to be idempotent.

https://bugzilla.gnome.org/show_bug.cgi?id=768243
2016-06-30 11:20:21 -04:00
Rui Matos
3691eb6d70 clutter/x11: Add API to request video memory purges to be reported
https://bugzilla.gnome.org/show_bug.cgi?id=739178
2016-06-27 20:23:49 +02:00
Florian Müllner
434f22e820 text: Bind <ctrl>A in addition to <ctrl>a
The 'select-all' action is currently only bound to <ctrl>a, which makes
it awkward to use when caps-lock is active, and is inconsistent with GTK+.
Just accept both upper- and lower-case variants.

https://bugzilla.gnome.org/show_bug.cgi?id=766326
2016-05-12 19:51:54 +02:00
Carlos Garnacho
4c6dae0bae evdev: Avoid updating seat pointer position on tablet events 2016-05-03 13:05:06 +02:00
Carlos Garnacho
2b07a493c5 evdev: Implement ClutterInputDevice::update_from_tool
This vfunc pokes the libinput_tool in order to find out the currently
available axes, and updates the device as such.
2016-05-03 13:05:06 +02:00
Carlos Garnacho
eafa04230b main: Allow updating device axes from the current tool
This way devices are ensured the proper axis status at the time
of processing the events.
2016-05-03 13:05:06 +02:00
Carlos Garnacho
7004818508 evdev: Implement tablet events
Tablet proximity, motion and button events are translated into ClutterEvents,
and the device state is updated accordingly.
2016-05-03 13:05:06 +02:00
Carlos Garnacho
bc8b3d9f39 evdev: Implement ClutterInputDeviceTool
This will be backed by a libinput_tool, the type and serial are
fetched from there.
2016-05-03 13:05:06 +02:00
Carlos Garnacho
b63e73e422 events: Add proximity events
These events will be sent on tool proximity of tablet events.
2016-05-03 13:05:06 +02:00
Carlos Garnacho
3602b49a30 event: Add ClutterInputDeviceTool information to clutter events
These can be used to determine the tool that's being in use for a given event
2016-05-03 13:05:06 +02:00
Carlos Garnacho
8b2c888368 input-device: Add ClutterInputDeviceTool
This is an unique opaque struct that identifies a given tool of
a given device.
2016-05-03 13:05:06 +02:00
Carlos Garnacho
ec708fc1a9 enums: Add rotation/slider axes
These will be useful for the tablet tools that have these features.
2016-05-03 13:05:06 +02:00
Carlos Garnacho
6e773389fd evdev: Map LIBINPUT_DEVICE_CAP_TABLET to CLUTTER_TABLET_DEVICE
This is so tablet devices have the correct ClutterInputDeviceType
2016-05-03 13:05:06 +02:00
Carlos Garnacho
fe59da43ef evdev: Pass axis parameters when notifying absolute motion events
This will be useful for tablet support, NULL is given in the current
callers.
2016-05-03 13:05:06 +02:00
Carlos Garnacho
40a5eff5d4 input-device: Disconnect signals on actors where the device has a cursor
Otherwise the signals are left dangling if the device is removed, causing
possible invalid memory accesses afterwards.
2016-05-03 13:05:06 +02:00
Carlos Garnacho
9d32146edb evdev: Use device name rather than sysname
The device name is something more natural, similar to what's seen
in X11, the sysname is rather the event node basename, which may
also vary depending on device insertion/detection time.
2016-05-03 13:05:06 +02:00
Florian Müllner
3856622ff7 clutter: Add back support for non-wayland builds
Wayland support is only available on Linux, so keep it optional for
now.

https://bugzilla.gnome.org/show_bug.cgi?id=760439
2016-04-29 16:13:59 +02:00
Florian Müllner
28c9b6e1d7 build: Namespace installed tests of private libraries
Currently our private cogl/clutter forks still install tests as
cogl/clutter, which conflicts with the original libraries.
2016-04-29 14:49:03 +02:00
Rico Tzschichholz
29752b6b63 cogl/clutter: Drop soname versions of private libraries 2016-04-28 15:34:51 +02:00
Florian Müllner
6e5888853e build: Export correct pkg-config names in .girs 2016-04-28 15:22:50 +02:00
Emmanuele Bassi
0f78357a5f Include libdrm and gbm when building Clutter
Clutter out of tree depends on Cogl's required dependencies via the
pkg-config file. Since Clutter and Cogl moved in tree, it means that
those dependencies need to be checked by Clutter itself, otherwise
headers and libraries won't be found.
2016-04-28 12:41:34 +01:00
Rico Tzschichholz
ba786d4fae clutter/tests/conform: Link against libmutter-cogl as needed 2016-04-28 11:59:05 +02:00
Rui Matos
1fa540bcb7 Fix the merged build
https://bugzilla.gnome.org/show_bug.cgi?id=760439
2016-04-27 20:37:47 +02:00
Rui Matos
9710e4a8c0 move everything into a clutter/ directory 2016-04-12 20:04:26 +02:00
Ray Strode
a4fb7ef5a3 po: drop translations 2016-04-12 20:03:30 +02:00
Ray Strode
eb959c73ab build: move glib marshaller/enum generation to src dir
the build/ dir is getting gutted so this commit moves
the two still needed bits to the source dir.
2016-04-12 19:57:35 +02:00
Ray Strode
7bd9bc2913 build: get rid of specialized makefile snippets
mutter won't have them, and we don't need them
2016-04-12 19:57:35 +02:00
Rui Matos
ed0051d0b4 clutter: make library private to mutter 2016-04-12 19:57:35 +02:00
Ray Strode
8675400191 configure: hardcode backends 2016-04-12 19:57:35 +02:00
Ray Strode
b1c59579ff clutter-glx: drop old clutter-glx stuff 2016-04-12 19:57:35 +02:00
Ray Strode
2cdd4b8250 tslib: drop tslib support 2016-04-12 19:57:35 +02:00
Ray Strode
89daa8d4fa wayland: drop wayland backend 2016-04-12 19:57:35 +02:00
Ray Strode
04c84b049f gdk: drop gdk backend 2016-04-12 19:57:35 +02:00
Ray Strode
0777de1757 osx: drop osx support 2016-04-12 19:57:35 +02:00
Ray Strode
6d0829b0d2 cex100: drop GDL support 2016-04-12 19:57:35 +02:00
Ray Strode
8f205d76e1 mir: drop mir backend 2016-04-12 19:57:35 +02:00
Ray Strode
c7472841b1 win32: drop win32 support 2016-04-12 19:57:35 +02:00
Emmanuele Bassi
c6e40de500 actor: Warn on adding/removing itself as a child
ClutterActor should warn if a user tries to add or remove an actor to,
and from, itself on the scene graph.

Clutter will likely crash, or warn way down the line, but if we can make
debugging simpler then we should.
2016-03-29 15:09:26 +01:00
Emmanuele Bassi
e62a6376a5 gdk: Disable deprecation warnings
For the GDK backend We're using the GdkDeviceManager API, which maps to
Clutter's own device manager API. GDK has now moved to a per-seat device
management model, and deprecated the device manager singleton one.

In order to avoid the deprecation warnings, we'd have to implement a
model similar to the GDK one inside the generic Clutter API, but that
would also require moving all the others backend to it, which is pretty
pointless.

Instead, we can disable deprecation warnings for the
ClutterDeviceManager implementation inside the GDK backend.
2016-02-28 12:43:43 +00:00
Chun-wei Fan
a99dd7555b clutter/config.h.win32.in: Keep in sync with autotools builds
This updates config.h.win32.in to be in-sync with the entries that are in
the config.h.in that is generated by the autotools builds.  In particular,
for Visual Studio builds, we default to enable all available drivers ("*").
2016-02-27 20:48:51 +08:00
Emmanuele Bassi
2b0ff2f2ba cally: Avoid clone spamming state changes
Clones may generate a temporary map/unmap on their source when painting;
this, in turn, will generate unnecessary ATK state changes.

https://bugzilla.gnome.org/show_bug.cgi?id=756371
2016-02-24 12:03:37 +00:00
Emmanuele Bassi
c867e9d941 actor: Expand is_in_clone_paint() check
The function should return true not only if the actor is being painted
by a ClutterClone, but also if it's inside a sub-graph being painted by
a ClutterClone.

https://bugzilla.gnome.org/show_bug.cgi?id=756371
2016-02-24 12:03:37 +00:00
Jonas Ådahl
8181ef15d6 evdev: Pass a motion delta to pointer constrain callback
The constrain callback cannot rely on the pointer position of the
corresponding ClutterInputDevice to get the actual delta of the motion
event that is to be constrained since it is only updated when an event is
dispatched. So change the API to pass the previous pointer position when
constraining.

https://bugzilla.gnome.org/show_bug.cgi?id=752752
2016-02-16 18:53:58 +08:00
Jonas Ådahl
52e38d1ab7 evdev: Expose microsecond timestamps via the clutter evdev API
This is needed by Wayland compositors for certain types of events.

https://bugzilla.gnome.org/show_bug.cgi?id=752752
2016-02-16 18:24:23 +08:00
Jonas Ådahl
9214d5029c evdev: Use microsecond granularity for internal timestamps
It's what libinput uses internally, and it'll be exposed in a later
patch.

https://bugzilla.gnome.org/show_bug.cgi?id=752752
2016-02-16 18:24:23 +08:00
Jonas Ådahl
a598917e07 evdev: Provide the relative pointer motion event deltas
Compositors need more detailed information about motion events. Make it
possible to retrieve this information when running the evdev backend by
adding the information to the backend specific event struct.

https://bugzilla.gnome.org/show_bug.cgi?id=752752
2016-02-16 18:24:23 +08:00
Jonas Ådahl
a10200509e evdev: Recycle device ids after devices are removed
In order to not grow the device id number forever, recycle the ids
whenever a device is released.

https://bugzilla.gnome.org/show_bug.cgi?id=755849
2016-02-16 18:24:23 +08:00
Emmanuele Bassi
c624230a8a gdk: Enable swap throttling on full screen windows
Since commit 6183eb3632 we disabled swap
throttling in favour of being driven by the GDK frame clock (and thus by
the compositor).

Compositors may decide to unredirect full screen windows to avoid the
performance penalty of the additional copy, especially on X11, which
means that a Clutter application marked as full screen is not going to
be driven by the compositor, and it's not going to be throttled by the
underlying GL machinery. This has a performance impact on constrained
platforms.

For this reason, we should re-enable swap throttling when the window is
full screen.

As the change was introduced especially because of Wayland, we should
check that we're not running as clients under a Wayland compositor; if
we do, we always keep swap throttling disabled, as the compositor will
always manage our output, even when full screen.
2016-01-25 18:48:49 +00:00
Carlos Garnacho
307cb58598 evdev: Add scroll source/finish flags info to scroll events.
Libinput tells us this much, so make use of it.

https://bugzilla.gnome.org/show_bug.cgi?id=757026
2016-01-14 19:12:17 +01:00
Carlos Garnacho
89c1c1e551 clutter-event: Add scroll source enum and axis scroll flags
Those can be used to implement different scrolling behaviors.
The fields have been added to ClutterScrollEvent itself. According
to pahole, this makes the struct as big as ClutterButtonEvent and
ClutterTouchEvent, so already at the limit of the ClutterEvent
union.

https://bugzilla.gnome.org/show_bug.cgi?id=757026
2016-01-14 19:12:17 +01:00
Emmanuele Bassi
a774ff5a09 egl: Rename backend constructor function
Otherwise the build will fail.
2015-12-11 16:23:09 +00:00
Emmanuele Bassi
e9b5eb3045 Allow setting the default backend from the configuration file
We should allow a configuration file to set up the initial state of the
global state, which also implies being able to set the backend.

If the allowed backends have already been set programmatically via the
clutter_set_windowing_backend(), though, then the application code takes
precedence, as we assume that the application author knows better than
us what their code supports or requires.
2015-12-11 15:53:24 +00:00
Emmanuele Bassi
cc31ed77bd Read the config file when creating the global shared state
The configuration file should set up the global state before we
initialize it; instead of relying on implicit ordering, explicitly read
the configuration file once, when creating the global shared context
data structure.
2015-12-11 15:53:24 +00:00
Emmanuele Bassi
6d0d1deda2 backend: Ensure that Cogl drivers are set prior to initialization
It doesn't make sense for the allowed drivers to be changed after
Clutter has been initialized.
2015-12-11 15:53:24 +00:00
Emmanuele Bassi
10b74e7005 backend: Allow setting a list of windowing backends
Like CLUTTER_DRIVER, we want to allow users to specify a list of
backends to test, and fall back to the internally defined priority as a
default.

This requires changing the way the allowed backend string is parsed,
both for the CLUTTER_BACKEND environment variable and for the
clutter_set_windowing_backend() function. Existing callers are still
supported with the exact same semantics.
2015-12-11 15:53:23 +00:00
Emmanuele Bassi
7ca28e0974 Add internal constructor function for each backend
We're going to use it to create an instance of each backend without
using the get_type() function.
2015-12-11 14:23:38 +00:00
Emmanuele Bassi
407d7ca436 Allow overriding the list of Cogl drivers via configuration file
Clutter has a configuration file that can be used to override
various settings, including the ones from environment variables.
2015-12-10 16:52:45 +00:00
Emmanuele Bassi
bb23335b5f Add a configuration option for deciding the Cogl drivers to use
Using environment variables only is not convenient for all platforms,
and in some cases it's beneficial to decide the default driver when
building Clutter. Cogl already has a similar configuration switch, and
since Clutter is overriding the default Cogl behaviour, it should offer
the same mechanism.

https://bugzilla.gnome.org/show_bug.cgi?id=742678
2015-12-10 16:38:46 +00:00
Emmanuele Bassi
2c524fbf73 backend: Allow overriding the Cogl drivers chain
We have an hardcoded list of drivers we have to go through when creating
a Cogl context. Some platforms may expose those drivers, but not be the
preferred ones.

In order to allow users and system integrators to override the list of
drivers, we should crib the same approach used by GDK, and have an
environment variable with a list of drivers to try.

The new environment variable is called `CLUTTER_DRIVER` and accepts a
comma-separated list of driver names, which will be tested in sequence
until one succeeds. There's also an additional '*' token which is used
to ask Clutter to fall back to the internally defined preferred list of
drivers.

https://bugzilla.gnome.org/show_bug.cgi?id=742678
2015-12-10 16:38:46 +00:00
Emmanuele Bassi
b47e1616eb Fix annotation for bind_model()
The (optional) annotation should only be used for (out) arguments; in
arguments that can be NULL should use the (nullable) annotation.
2015-12-09 12:44:20 +00:00
Emmanuele Bassi
a166cc9f35 Fix definition of ClutterEventExtender
The interface vtable structure is missing the GTypeInterface parent, and
GObject is complaining about it, as it should.
2015-12-09 12:42:55 +00:00
Emmanuele Bassi
dd30595084 gdk: Check for both GDK and Cogl winsys support
When using GDK and Cogl API, we need to check that both GDK and Cogl
have been built with support for that API, otherwise the build will
likely fail.
2015-12-08 14:24:36 +00:00
Jonas Ådahl
9c26a98a6f evdev: Drop redundant stage set check
Every path creating a input device in the evdev backend sets a stage,
so the check is unnecessary.

https://bugzilla.gnome.org/show_bug.cgi?id=752752
2015-12-03 15:36:49 +08:00
Emmanuele Bassi
1d53b773fd text: Enforce boolean value
We store the cursor-visible value in a bit field, which means that we
need to enforce the argument for the setter to either 0 or 1 in order to
fit.
2015-11-30 13:47:57 +00:00
Emmanuele Bassi
c8ef4349fe docs: Improve documentation for ClutterText
Ensure that the rule for :cursor-visible are documented.
2015-11-30 13:47:15 +00:00
Emmanuele Bassi
388fe9b542 text: Unify conditions for visible cursor
We have a bunch of similar checks in various places, and they should all
be coalesced into one.
2015-11-30 13:45:45 +00:00
Emmanuele Bassi
78eb07d657 text: Allow selectability without editability
Being able to select text and being able to edit text are two separate
capabilities, but ClutterText only allows the former with the latter.

The ClutterText:selectable property is set to TRUE by default, given
that it depends on the :editable property; this implies that all
ClutterText instances now are going to show a cursor as soon as they get
key focused. Obviously, this would make labels look a bit off — but if
you have a label then you would not give it key focus, either by
explicitly calling clutter_actor_grab_focus(), or by setting it as
reactive and allowing it to be clicked.

If this turns out to be a problem, we have various ways to avoid showing
a cursor — for instance, we could change the default value of the
selectable property, and ensure that setting the :editable property to
TRUE would also set the :selectable property as a side effect. Or we
could hide the cursor until the first button/touch press event. Finally,
we could always back this commit out if it proves to be too much of a
breakage for existing code bases.

https://bugzilla.gnome.org/show_bug.cgi?id=757470
2015-11-28 20:20:00 +00:00
Lionel Landwerlin
8c863573fc gdk: take into account scaling on wayland
The X11 part of the GDK backend takes into account the scaling factor of its
window when resizing the underlying X11 objects. We need to do the same for
Wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=755245
2015-11-22 21:45:55 +00:00
Carlos Garnacho
a9b0715df1 gdk: Implement ClutterEventExtender
This lifts the responsibility off its ClutterBackend.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
2015-11-18 13:00:53 +01:00
Carlos Garnacho
9215852c32 x11: Implement ClutterEventExtender
This lifts the responsibility off its ClutterBackend.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
2015-11-18 13:00:53 +01:00
Carlos Garnacho
8aeea7fb73 evdev: Set event code on button/key events
This will allow users to know the event code without strange calculations
on event->key.hardware_keycode or event->button.button.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
2015-11-18 13:00:53 +01:00
Carlos Garnacho
f1ad702309 evdev: Allow to retrieve the input.h event code from ClutterEvents
This is now stored as platform data in the ClutterEvent, so can
be retrieved with the clutter_evdev_event_get_event_code() call
that's been added to the evdev backend.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
2015-11-18 13:00:48 +01:00
Carlos Garnacho
dfc749e576 evdev: Implement the ClutterEventExtender interface
This will allow the ClutterDeviceManagerEvdev to define evdev-specific
event data.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
2015-11-18 12:59:05 +01:00
Carlos Garnacho
4115f215ac backend: Bridge platform-dependent event data creation to device managers
Device managers can now implement the ClutterEventExtender interface
that allows them to set their own data to events, make the backend call
those implementations if the device manager implements the interface.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
2015-11-18 12:59:05 +01:00
Carlos Garnacho
5ea70bd102 device-manager: Add private interface to manipulate platform event data
This normally belonged to the ClutterBackend, however there's device
managers (eg. evdev) that are somewhat detached from the backend, so
need to bridge this somehow.

This allows device managers to implement these bits that were usually
responsibility of the ClutterBackend.

https://bugzilla.gnome.org/show_bug.cgi?id=758238
2015-11-18 12:59:05 +01:00
Emmanuele Bassi
89a794ec46 Add version macros for Clutter 1.26 2015-11-18 11:54:26 +00:00
Carlos Garnacho
83b738c0e7 evdev: Move additional pointer buttons after the old 4-7 scrolling ones
On X11 those were skipped, so additional pointer buttons would come up
as button >= 8 events. Do here the same, so we remain compatible across
backends.

https://bugzilla.gnome.org/show_bug.cgi?id=758237
2015-11-17 22:47:20 +01:00
Carlos Garnacho
a9f16c3d1f evdev: Mark either of smooth/discrete scroll events as emulating
We're always emulating one of those, depending on the scrolling
device/source, so mark these as such.
2015-10-23 17:04:49 +02:00
Carlos Garnacho
9753c99382 click-action: Ignore motions/updates from different devices/sequences
Otherwise events from other devices or touch sequences might unintendedly
trigger the thresholds, and a "cancelled" ::long-press with it.

https://bugzilla.gnome.org/show_bug.cgi?id=756749
2015-10-17 18:44:25 +02:00
Emmanuele Bassi
b6425bbb15 Use explicit NULL comparison for pointers
Following the coding style.
2015-10-12 19:54:32 +01:00
Carlos Garnacho
1fe21a8fe1 evdev: Emulate discrete scroll events out of smooth scroll ones.
There's handlers around relying on up/down/left/right scroll events,
which won't work as expected if only smooth scroll events are sent.
In order to work properly there, we have to retrofit discrete scroll
events on the evdev backend.

Fix this by implementing emission (on devices with a wheel) and
emulation (on anything else) of discrete scroll events. On the former
both smooth and discrete events are set, for the latter we do accumulate
the dx/dy of the latest scroll events, and emit discrete ones when we
accumulated enough. The ending 0/0 event will reset the accumulators for
the next scrolling batch.

https://bugzilla.gnome.org/show_bug.cgi?id=756284
2015-10-12 19:54:32 +01:00
Owen W. Taylor
2ddec579d6 clutter_actor_update_map_state: Remove a useless warning
A check for priv->parent == NULL was inside the else of a check
for (priv->parent == NULL).

https://bugzilla.gnome.org/show_bug.cgi?id=745517
2015-10-01 13:38:47 -04:00
Owen W. Taylor
4c9443bbd7 _clutter_actor_set_enable_paint_unmapped: don't force an unmap
When enable_paint_unmapped is disabled, we shouldn't force the
source widget to be unmapped if the constraints would keep it
mapped; in practice this shouldn't matter unless a paint handler
is messing with the map state.

https://bugzilla.gnome.org/show_bug.cgi?id=745517
2015-10-01 13:38:47 -04:00
Owen W. Taylor
76c8cd292e Avoid crashing when an actor not parented to a toplevel is cloned
If we can't realize the source actor for a clone, simply skip updating
the map state and painting it.

https://bugzilla.gnome.org/show_bug.cgi?id=745517
2015-09-29 14:15:16 -04:00
Lionel Landwerlin
b9df8524f0 gdk: Enable clock updates when timelines are added to the clock
Enable animation updates from the GdkFrameClock whenever any timeline is
added to the ClutterMasterClockGdk. This may improve animation
smoothness (depending on the GDK backend in use) because it allows GDK
to tweak its frame timing for animation purposes.

https://bugzilla.gnome.org/show_bug.cgi?id=755357
2015-09-22 17:27:42 +01:00
Philip Withnall
3816d5a6bb gdk: Fix frame budget diagnostics
Set the frame budget so that CLUTTER_ENABLE_DIAGNOSTIC correctly outputs
timing diagnostics from the ClutterMasterClockGdk.

https://bugzilla.gnome.org/show_bug.cgi?id=755357
2015-09-21 18:03:04 +01:00
Philip Withnall
9e8da64636 gdk: Use frame time when calculating the tick time for clock updates
This is how GdkFrameClock is meant to be used: the frame time is meant
to be queried from the GdkFrameClock within its frame signals, rather
from the system monotonic time source.

https://bugzilla.gnome.org/show_bug.cgi?id=755357
2015-09-21 18:03:04 +01:00
Philip Withnall
5545b69a8f timeline: Add more debug output
https://bugzilla.gnome.org/show_bug.cgi?id=755357
2015-09-21 17:02:39 +01:00
Philip Withnall
ae1a84853e timeline: Ensure waiting_first_tick is set before adding the timeline
Just in case the timeline starts being prodded by the ClutterMasterClock
before the add function returns. (This has not been verified.)

https://bugzilla.gnome.org/show_bug.cgi?id=755357
2015-09-21 17:02:39 +01:00
Lionel Landwerlin
0e7b18832a cogl: reset pending swaps counter on unrealize
When removing the frame callback on the CoglOnscreen, we loose the ability
to get notified of swap events. This could leave us with a counter != 0
which leads to a deadlock situation after the next realize/draw cycle.

https://bugzilla.gnome.org/show_bug.cgi?id=755014
2015-09-15 12:29:05 +01:00
Lionel Landwerlin
ff1a5aae7a x11: stage window: reset framebuffer on foreign window unrealize
Similarly to 13dbb74c81, we need to reset the
framebuffer in the x11 for foreign windows.

https://bugzilla.gnome.org/show_bug.cgi?id=755014
2015-09-15 12:29:04 +01:00
Lionel Landwerlin
6c7f624f69 master-clock-default: prevent deadlock with GLX_INTEL_swap_event
If we call _clutter_stage_do_update() on a ClutterStage that isn't
mapped/visible, no GL command will be queued, and the Mesa/DRI2
implementation of SwapBuffers will do nothing. This causes
GLX_INTEL_swap_event to not be emitted by the X server because no swapping
has been requested through DRI2 and it eventually leads to a deadlock
situation in ClutterStageCogl because we're waiting for an event before we
start the next draw cycle.

This patch removes the non mapped stages from the list of stages to process.
This is consistent with a previous patch for the ClutterMasterClockGdk [1].

[1] : 5733ad58e5

https://bugzilla.gnome.org/show_bug.cgi?id=755014
2015-09-15 12:23:08 +01:00
Lionel Landwerlin
ee98a5bbe8 gdk: x11: notify Cogl immediately of a foreign window resize
We want to avoid waiting for the acknowledgement event from the X
server as we might redraw the stage before that happens.

This patch reimplements a bit of logic already in clutter-gtk [1].

[1] : https://git.gnome.org/browse/clutter-gtk/tree/clutter-gtk/gtk-clutter-embed.c#n723

https://bugzilla.gnome.org/show_bug.cgi?id=754993
2015-09-14 13:49:08 +01:00
Lionel Landwerlin
aeb19f2f4d gdk: move sync_to_vblank setup from master clock to backend
Setting up the sync_to_vblank in the MasterClock is a bit too late as
the MasterClock can be created after a StageWindow has been created
and realized (and therefore all of its Cogl/GL state setup already).
So move the setup to the backend, prior to any StageWindow creation.

https://bugzilla.gnome.org/show_bug.cgi?id=754938
2015-09-14 13:46:31 +01:00
Lionel Landwerlin
13dbb74c81 gdk: stage window: reset framebuffer on foreign window unrealize
Clutter still uses part of the deprecated stateful API of Cogl (in
particulart cogl_set_framebuffer). It means Cogl can keep an internal
reference to the onscreen object we rendered to. In the case of
foreign window, we want to avoid this, as we don't know what's going
to happen to that window.

This change sets the current Cogl framebuffer to a dummy 1x1
framebuffer if the current Cogl framebuffer is the one we're
unrealizing.

https://bugzilla.gnome.org/show_bug.cgi?id=754890
2015-09-12 00:39:43 +02:00
Lionel Landwerlin
cb4e88884b gdk: master clock: hook ourselves to the paint signal
We're currently hooked to the "update" signal of the FrameClock. When
embedding Clutter inside GTK+ we want to have the layout phase of GTK+
to notify us the size of our stage.

This patch change to FrameClock signal we're listening to, to the
"paint" signal to make sure we've received the layout information from
GTK+, before painting. Otherwise we paint with a delay of one frame.

https://bugzilla.gnome.org/show_bug.cgi?id=754889
2015-09-12 00:39:43 +02:00
Jonas Ådahl
5d83260b19 actor: Fix transforming stage point when scale is less than 1
The commit 6cd24faaa5 (actor: Clean up
transform_stage_point()) changed the validation of the transformation
matrix to ignore the fraction part of the determinant. This caused
clutter_actor_transform_stage_point() to fail and return FALSE for
actors which scale was less than 1.

Previously the validation was ('det' being a float):
	det = (RQ[0][0] * ST[0][0])
	    + (RQ[0][1] * ST[0][1])
	    + (RQ[0][2] * ST[0][2]);
	if (!det)
		return FALSE;

Semantically, the if statement expression '!det' is equivalent to
'det == 0', i.e. 'det == 0.0f'. Post cleanup patches, 'det' was turned
into a double, and the if statement was changed to:

	if (CLUTTER_NEARBYINT (det) == 0)
		return FALSE;

which, different from before, rounds the determinant to the nearest
integer value, meaning determinant in the range (-0.5, 0.5) would be
considered invalid.

This patch reverts this part to the old behavior, while, because of the
inexact nature of floating point arithmetics, allowing a bit more liberal
meaning of "equals to 0" than '== 0.0'.

https://bugzilla.gnome.org/show_bug.cgi?id=754766
2015-09-11 10:36:52 +08:00
Lionel Landwerlin
9432e67ee8 gdk: stage: create subsurface when dealing with foreign windows on wayland
It is safer to create our own wayland surface when rendering into
someone else GdkWindow, otherwise we might draw somewhere we didn't
intend to.

https://bugzilla.gnome.org/show_bug.cgi?id=754697
2015-09-07 18:17:10 +01:00
Lionel Landwerlin
3771ef2f08 gdk: stage: report geometry of the underlying surface for foreign windows
When running on wayland, we might have our own subsurface
desynchronized from the foreign GdkWindow. It is important that we
report the size of the actually surface we're rendering to, otherwise
the logic in ClutterStage might discard resize operation that
resynchronize the subsurface with the stage's size.

https://bugzilla.gnome.org/show_bug.cgi?id=754697
2015-09-07 18:17:10 +01:00
Lionel Landwerlin
55dce70440 gdk: stage: do not ensure native windows are created with foreign windows
For foreign windows this should be dealt with by the embedding
framework. In particular on Wayland with foreign windows, we might
want to create a subsurface and use the foreign window only for events
and frame clock synchronization.

https://bugzilla.gnome.org/show_bug.cgi?id=754697
2015-09-07 18:17:10 +01:00
Lionel Landwerlin
a9b38fefdc gdk: stage: disable some operations for foreign windows
Some operations like :
     * resize
     * show/hide
     * set_title
     * set_user_resizable

should be handled by the embedding framework, so disable them for
foreign windows.

https://bugzilla.gnome.org/show_bug.cgi?id=754671
2015-09-07 18:17:10 +01:00
Lionel Landwerlin
5733ad58e5 gdk: master clock: only process mapped & realized stages
When using Clutter embed inside a Gtk application, a stage might end
up realized but not visible. In this case we might discard doing any
kind of animation processing.

https://bugzilla.gnome.org/show_bug.cgi?id=754671
2015-09-07 18:17:09 +01:00
Lionel Landwerlin
6183eb3632 gdk: master-clock: disable vsync throttling
When running with a master clock based on the GdkFrameClock, we get
synchronized with the compositor, so no need for throttling rendering.

In particular when dealing with foreign windows, we run into deadlocks
in Mesa because of the way the Mesa wayland backend is implemented [1].

[1] : http://cgit.freedesktop.org/mesa/mesa/tree/src/egl/drivers/dri2/platform_wayland.c#n330

https://bugzilla.gnome.org/show_bug.cgi?id=754671
2015-09-07 18:17:09 +01:00
Emmanuele Bassi
dbec3be996 grid-layout: Clarify the scope of the orientation property
Just like GtkGrid, changing the orientation of a ClutterGridLayout does
not change the existing layout; the orientation property is only used as
a hint when adding new children.
2015-09-04 13:53:04 +01:00
Emmanuele Bassi
7ed96aabd8 grid: Use the proper orientation for the request mode
We automatically switch the request mode of the container depending on
the GridLayout's orientation, but we need to keep track of the request
mode during allocation, so that we don't get out of sync if the user
changed the request mode after adding the layout manager.

This change also brings us closer to the code in GtkGrid.
2015-09-03 14:18:33 +01:00
Emmanuele Bassi
dea5057fbd grid: Use the orientation of the request
We use the orientation of the grid to get the preferred size of the
layout, but we should be using the orientation of the request instead.
The preferred width has an orizontal orientation, and the preferred
height has a vertical orientation.

This allows us to refactor the get_preferred_* implementation into a
separate function.
2015-08-29 20:38:29 +01:00
Lionel Landwerlin
0e4d11bcd8 gdk: master clock: fix incorrect symbol use
https://bugzilla.gnome.org/show_bug.cgi?id=754134
2015-08-26 21:40:47 +01:00
Lionel Landwerlin
5b9c31a0ce gdk: fix memory corruption
g_hash_table_replace will free the list pointer we're modifying.
Let's just do memory management ourselves.

https://bugzilla.gnome.org/show_bug.cgi?id=754134
2015-08-26 21:40:41 +01:00
Emmanuele Bassi
84c5846aa0 image: Use internal function for the texture node
ClutterActor has a convenience function that removes the need to query
the actor's state and apply it to a ClutterTextureNode, so we should use
it.
2015-08-24 10:01:03 +01:00
Emmanuele Bassi
af010d5e2d canvas: Use internal function for the texture node
ClutterActor has a convenience function that removes the need to query
the actor's state and apply it to a ClutterTextureNode, so we should use
it.
2015-08-24 09:59:53 +01:00
Emmanuele Bassi
cf7e37b53b actor: Add internal "create textute node" function
To avoid excessive copy and paste. We could even consider making it
public before release.
2015-08-24 09:59:16 +01:00
Emmanuele Bassi
38e983b8e9 docs: Fix a typo in the BoxLayout:homogeneous description
https://bugzilla.gnome.org/show_bug.cgi?id=753895
2015-08-21 12:11:05 +01:00
Emmanuele Bassi
fe422ab61c gdk: Use non-deprecated/non-Clutter specific X11 API
We are currently using deprecated/Clutter-specific API in Cogl to
retrieve the XVisualInfo associated with the (E)GLX context. Cogl 1.21.2
added new CoglRenderer API to achieve the same result.
2015-08-21 11:58:52 +01:00
Anders Jonsson
6d649ec6d1 Fix typo (textues)
https://bugzilla.gnome.org/show_bug.cgi?id=746279
2015-08-01 21:55:07 +02:00
Adel Gadllah
9a510c0117 backend: Check for a known set of drivers
We want to use the Cogl GL3 driver, if possible, and then go through a
known list of Cogl drivers, before giving up and using COGL_DRIVER_ANY.

Based on original patch from Emmanuele Bassi.

We have to create and tear down the whole context when trying
out the drivers though because the extension checks do not happen
until cogl_context_init.

https://bugzilla.gnome.org/show_bug.cgi?id=742678
2015-07-26 16:05:07 +02:00
Carlos Garnacho
40f6a0135e evdev: Set missing dx/dy fields on ClutterTouchpadPinchEvents 2015-07-24 19:17:12 +02:00
Emmanuele Bassi
b834503b79 build: Fix for distcheck 2015-07-22 19:12:42 +01:00
Stefan Sauer
8f976cad44 docs: give more hints about how to replace the anchor-point
In addition to pivot-point also mention _set_translation().
2015-07-22 18:41:39 +01:00
Emmanuele Bassi
13c722c026 x11: Remove unused enumeration
The ClutterX11XInputEventTypes enumeration has been unused inside
Clutter for the past 4 years and a half, since we switched to the
XInput 2 API.

The enumeration itself has always been private, and nobody should
have used it in the first place, but if something breaks, we can
revert this commit.
2015-07-20 13:05:06 +01:00
Emmanuele Bassi
9d40fafa2a Do not generate backend-specific enumeration types
They should be part of the backend-specific API.

The only backend that has an enumeration type is the X11 one, and it's
small, so we can simply put it there.

This is not an ABI change: the backend-specific symbols are still in
the same SO. You'll be required to import clutter-x11.h to have access
to the GType method at the source level, whereas before just importing
clutter.h would have sufficed. The only user of that enumeration was a
function declared in clutter-x11.h, anyway.
2015-07-20 13:00:12 +01:00
Emmanuele Bassi
c2e63cf16b build: Use the appropriate NAMESPACE variable everywhere
We're inconsistently using the NAMESPACE variable instead of passing
the --identifier-prefix and --symbol-prefix command line arguments to
the introspection scanner.
2015-07-19 13:17:49 +01:00
Emmanuele Bassi
e474684f2b deprecated: Regenerate the compatibility key symbols
Now with the appropriate compiler warning that points to the replacement
key symbol.
2015-07-17 13:16:53 +01:00
Emmanuele Bassi
1506ec4a54 keysyms-update: Add deprecation notice for compat symbols
Now that we can warn about deprecated macros, we should finally do it
for the old, non-namespaced key symbol macros that we've been stringing
along since the 1.0 days.
2015-07-17 13:15:32 +01:00
Ting-Wei Lan
ad690c61b1 macros: Clang 3.4 and later versions can use deprecation macros for GCC
https://bugzilla.gnome.org/show_bug.cgi?id=752272
2015-07-14 02:39:40 +08:00
Nitin Sharma
4dfa4de5d0 actor: Check for NULL pointer for pspec
In function clutter_actor_set_final_state, the pspec pointer returned by calling
g_object_class_find_property is not checked for NULL.
2015-07-13 13:15:52 +01:00
Emmanuele Bassi
332aa3cf21 macros: Add fallback defines for non-GCC compilers
I forgot to add the fallback definitions in case we're not using GCC;
without them, anybody using non-GCC compilers will get a build error.

https://bugzilla.gnome.org/show_bug.cgi?id=752272
2015-07-11 23:58:12 +01:00
Ting-Wei Lan
7e0f588c91 trivial: Fix return value error in clutter_event_get_gesture_motion_delta 2015-07-11 18:09:45 +08:00
Emmanuele Bassi
a722cbebef actor: Fully deprecate the state access macros
Now that we can warn without breaking the build, we should deprecate the
state access macros for ClutterActor.
2015-07-11 10:18:18 +01:00
Emmanuele Bassi
4040f2d556 gdk: Do not use deprecated macros
Use the replacement functions instead.
2015-07-11 10:18:18 +01:00
Emmanuele Bassi
eefbb88675 backend: Do not use deprecated macros
Use the replacement functions instead.
2015-07-11 10:18:18 +01:00
Emmanuele Bassi
02b44fcc60 cally: Drop use of deprecated macros
Use the equivalent functions instead.
2015-07-11 10:18:18 +01:00
Emmanuele Bassi
8a24ad83c9 Add macros for deprecating macros
We want to be able to deprecate macros, but right now the best we can do
is to wrap them with things like:

  #ifndef CLUTTER_DISABLE_DEPRECATED
  # define A_MACRO_I_WANT_TO_DEPRECATE ...
  #endif

Which requires adding a new symbol to the build, and will cause a build
error instead of a compiler/pre-processor warning.

Fortunately, we can use the _Pragma() keyword introduced by C99 and
supported by GCC to add a warning to the output, while leaving the macro
itself intact.

GCC does not have a "deprecated" pragma, so we have to use a generic
warning; this also means we cannot do nifty things like concatenating
strings and the like, as we do for the "deprecated" attribute.

The macro deprecation symbol should have the same affordances as the
function deprecation one, and evaluate to nothing if the required
version is lower than the current version; or if the global toggle for
deprecation warnings is in effect.
2015-07-11 10:18:18 +01:00
Carlos Garnacho
b151898534 clutter-event: Add API around touchpad gesture events
These are needed in order to make these events binding friendly
2015-07-10 21:47:30 +02:00
Carlos Garnacho
5b8a2a9e15 evdev: Handle libinput touchpad swipe/pinch gesture events
The translation from libinput events is fairly straightforward, as they
map almost 1:1.
2015-07-10 21:47:30 +02:00
Carlos Garnacho
c185a17783 event: Add pinch/swipe gesture event types and structs
We now have ClutterTouchpadPinchEvent and ClutterTouchpadSwipeEvent,
each bringing the necessary info for the specific gesture. Each
of these events is defined by begin/update/end/cancel phases.

These events have been also made to propagate down/up the pointer
position, just like scroll and button events do.
2015-07-10 21:47:01 +02:00
Emmanuele Bassi
3e14d87188 actor: Use CLUTTER_NEARBYINT instead of C integer casting
Otherwise we break because of rounding.
2015-07-10 14:33:25 +01:00
Emmanuele Bassi
b0e785c6c2 actor: Add bind_model_with_properties()
When binding models to actors to map items to children we don't often
need the full control of a function; in many cases we just need to
specify the type of the child we want to construct and the properties
on both the item and the child that we want to bind.

We should provide a simple convenience function that does all this for
us.
2015-07-10 11:26:34 +01:00
Emmanuele Bassi
365bd482fb gdk: Use X11 API only when running under X11
Avoid using GdkX11Screen API when the GDK backend being used is not the
X11 one.

https://bugzilla.gnome.org/show_bug.cgi?id=752143
2015-07-09 14:34:11 +01:00
Emmanuele Bassi
41cd804f10 actor: Rename internal function
Map to the field name and the signal name, so it's clear what it does.
2015-07-09 14:30:26 +01:00
Emmanuele Bassi
b0300a6247 cogl: Pack ClutterStageCogl a bit more
We should rearrange the fields a bit so they get packed without holes,
and aligned with cacheline boundaries.
2015-07-08 11:15:54 +01:00
Emmanuele Bassi
938eea175f backend: Remove unnecessary private data structure
The whole of ClutterBackend is a final/protected type, so having a bunch
of instance fields and an instance private data structure is redundant
at best, and less efficient at worst.
2015-07-08 11:10:45 +01:00
Emmanuele Bassi
02b69e4d76 Move header inclusion guard at the top
GCC has some optimization for the inclusion guard, but they only work if
the check is the outermost one.

We're fairly inconsistent because of historical reasons, so we should
ensure that we follow the same pattern in every public header.
2015-07-07 16:03:32 +01:00
Emmanuele Bassi
cffa243fbe Add autocleanup macros for Clutter types
So that people can use the g_auto* macros, as well as the G_DECLARE_*
ones, from GLib 2.44.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
6cd24faaa5 actor: Clean up transform_stage_point()
Use double precision floats for the intermediate computations, to avoid
loss of precision, and don't convert too integer when unnecessary, to
avoid rounding errors.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
bf9a71ae23 actor: Allow binding an actor to a GListModel
It can be useful to bind the children list to set of objects inside a
GListModel implementation; the GListModel stores the objects, and every
time the model changes, a function is called that maps each object in
the model to a newly created ClutterActor, which is then added as a
child. This API, along with the property binding one inside GObject,
allows automatic creation of views based on object models that update
themselves without manual intervention.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
db8bb95817 Move ClutterModel to the deprecated area
And deal with the fallout in the source tree.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
31c2c57f8b Move clutter-list-model.[ch] to the deprecated area 2015-07-07 16:03:31 +01:00
Emmanuele Bassi
6376eebd9b Deprecate ClutterModel
Now that we've deprecated the only concrete implementation of
ClutterModel, it's time we deprecate the base abstract class.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
e1e6f7be48 Deprecate ClutterListModel
The model API was an ad hoc addition to Clutter, back in the 0.6 days,
that was needed because GLib did not offer anything of sort, and the
only model-like storage was inside GTK+. The API design was heavily
based on GtkTreeModel and friends, with column-based collections of
generic data.

Since then, the model API inside Clutter has not really been integrated
in the core API; on the other hand, GIO has grown a model API, and it's
seeing more use in the platform.

This means that the ClutterModel API should finally be deprecated, and
we should move code to the GListModel API inside GIO.
2015-07-07 16:03:31 +01:00
Peter Hutterer
661078a4f2 x11: don't create the libinput tapping property
If it doesn't exist, we don't have a touchpad. Don't create the property
and potentially confuse other pieces of the stack that do the same check.
2015-07-07 16:03:31 +01:00
Kalev Lember
7c2ac712f7 docs: Fix a typo in ClutterImage example 2015-06-20 18:55:01 +02:00
Gustavo Noronha Silva
0c75e17814 Add PanAxis mode that automatically pins scroll based on initial movement
This code is inspired by the implementation of the same feature for the
Mx toolkit's MxKineticScrollView. See commit 4d08771.

https://bugzilla.gnome.org/show_bug.cgi?id=707982
2015-06-11 15:47:48 -03:00
Carlos Garnacho
2105055a34 gdk: Enable GDK_TOUCH_MASK on the stage window
This allows touch events to be received and translated.

https://bugzilla.gnome.org/show_bug.cgi?id=750496
2015-06-11 15:06:55 +01:00
Carlos Garnacho
7ed3714a94 gdk: Ignore synthesized leave events out of touch events
Certain crossing modes notify about synthesized events, where
the pointer didn't really leave the window. Unsetting the stage
from the device at that time is incorrect, and will leave all
remaining touches unable to pick coordinates, so silently eaten
away.

https://bugzilla.gnome.org/show_bug.cgi?id=750496
2015-06-11 15:06:55 +01:00
Emmanuele Bassi
2d5b5aa82a gdk: Add function to retrieve the GdkVisual
Straight from Cogl.

This allows us to propagate the GdkVisual Cogl and Clutter use to
embedding toolkits, like GTK+.

The function is annotated as being added to the 1.22 development
cycle because it will be backported to the stable branch, so that
downstream developers can package up a version of Clutter that does
not crash on nVidia.

https://bugzilla.gnome.org/show_bug.cgi?id=747489
2015-06-10 19:09:21 +01:00
Emmanuele Bassi
c91621e8c2 gdk: Use the Cogl visual on Xlib winsys
GDK 3.16 started selecting different visuals, to best comply with the
requirements for OpenGL, and this has broken Clutter on GLX drivers that
are fairly picky in how they select visuals and GLXFBConfig.

GDK selects GLXFBConfig that do not include depth or stencil buffers;
Cogl, on the other hand, needs both depth and stencil buffers, and keeps
selecting the first available visual, assuming that the GLX driver will
give us the best compliant one, as per specification. Sadly, some
drivers will return incompatible configurations, and then bomb out when
you try to embed Clutter inside GTK+, because of mismatched visuals.

Cogl has an old, deprecated, Clutter-only API that allows us to retrieve
the XVisualInfo mapping to the GLXFBConfig it uses; this means we should
look up the GdkVisual for it when creating our own GdkWindows, instead
of relying on the RGBA and system GdkVisuals exposed by GDK — at least
on X11.

https://bugzilla.gnome.org/show_bug.cgi?id=747489
2015-06-10 19:06:25 +01:00
Emmanuele Bassi
c4fa3514ad Use the public symbol for Wayland compositor support
Instead of using a private one. This way, if things go out of sync,
we'll notice immediately.
2015-06-10 12:31:51 +01:00
Emmanuele Bassi
a1c4acf227 Add missing include
Some X11-related system header is leaking stdlib.h, so when we disable
the X11 backend we get a compiler warning for atol().
2015-06-10 12:28:59 +01:00
Emmanuele Bassi
896e43cbd5 gdk/device: Propagate more device details from GDK
In order to do device matching we need to propagate more information,
like the device_id (only on X11 with the XInput2 extension enabled),
the vendor id, and the product id.

https://bugzilla.gnome.org/show_bug.cgi?id=747951
2015-06-03 13:08:01 +01:00
Dima Ryazanov
71743ef660 Fix a compile error when the X11 backend is disabled
When defining clutter_stage_gdk_update_foreign_event_mask, check for the
same macros as when actually using it.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>
2015-05-29 10:13:03 +01:00
Carlos Garnacho
fbe2c74e19 swipe-action: Fix typo
X coords are meant to compare with distance_x.
2015-05-26 19:05:20 +02:00
Carlos Garnacho
a4962c0336 swipe-action: Prepare for multifinger swipes
Its ::gesture-end implementation used to check the press/release
coordinates for the first touchpoint. On multifinger swipes, we
can receive this vfunc called due to other touch sequence going
first, so we'd get 0/0 as the release coordinates for this still
active sequence, resulting in bogus directions.

Instead, check the last event coordinates, that will be always
correct regardless of whether the touchpoint 0 finished yet or
not.

https://bugzilla.gnome.org/show_bug.cgi?id=749739
2015-05-26 19:02:51 +02:00
Emmanuele Bassi
c71dfa2162 docs: Remove stray XML element
We moved to Markdown a while ago, but a stray </para> was left in.
2015-05-19 15:27:30 +01:00
Emmanuele Bassi
c99ce18efb actor: Guard against negative-sized allocations
The allocate_align_fill() method may end up trying to allocate an actor
with a negative size, due to rounding and floating point operations.

https://bugzilla.gnome.org/show_bug.cgi?id=749420
2015-05-19 15:27:29 +01:00
Emmanuele Bassi
e72a1a44e6 actor: Ensure allocation adjustment is safe against zero sizes
We already copy with negative end results, but there's no point in doing
the work in the first place.
2015-05-19 15:27:29 +01:00
Rui Matos
9268bb9144 x11: Fix touchpad detection
Commit 79849ef1d5fff9acd310cd68d59df0c7cf2cb28f had a typo in the
device property format check. This property is formated in 8-bit
items, not 32-bit.

This went unnoticed till now because some touchpads were still being
detected as such due to a second check below:

      else if (strstr (name, "touchpad") != NULL)
        source = CLUTTER_TOUCHPAD_DEVICE;

https://bugzilla.gnome.org/show_bug.cgi?id=749482
2015-05-18 11:43:58 +02:00
Matthieu Bouron
8aea8bc463 clutter-backend-gdk: Only set setting on successful gdk_screen_get_setting call
It could happen that gdk_screen_get_setting fails to retreive
Gdk/WindowScalingFactor which leads to the following warnings when
clutter_init is called:

GLib-GObject-WARNING **: value "0" of type 'gint' is invalid or out of range for property 'window-scaling-factor' of type 'gint'
GLib-GObject-WARNING **: value "0" of type 'gint' is invalid or out of range for property 'dnd-drag-threshold' of type 'gint'

https://bugzilla.gnome.org/show_bug.cgi?id=749256

Slightly edited to fix up whitespace issues.

Edited-by: Emmanuele Bassi <ebassi@gnome.org>
2015-05-12 11:14:14 +01:00
Emmanuele Bassi
8fc8a73580 gdk: Use RGBA visual if there is one
The condition check for the has_rgba_visual flag is reversed, and thus
we relied on drivers returning an ARGB visual first by default.

Referenced by: https://bugzilla.redhat.com/show_bug.cgi?id=1206960
2015-05-07 13:28:33 +01:00
Emmanuele Bassi
9584b23958 docs: Fix typo in ClutterStage::deactivate 2015-05-01 16:51:12 +01:00
Emmanuele Bassi
54a2a20e38 actor: Remove trailing new line
The debug messages have a new line by default.
2015-04-30 12:42:44 +01:00
Emmanuele Bassi
8b8aa0b492 actor: Use the real opacity when clearing the stage
The paint opacity for a top level is always overridden to be the full
value, since it's a composited value and we want to paint our scene.

When clearing the stage framebuffer, though, we want to use the actual
opacity, if ClutterStage:use-alpha is set.
2015-04-30 12:40:39 +01:00
Jasper St. Pierre
21ce9bc08b clutter-stage-cogl: Match EGL's behavior of eglSwapBuffersWithDamage
-1 is explicitly an invalid value to pass to eglSwapBuffersWithDamage,
and the specification admits as much:

                                                         If
    eglSwapBuffersWithDamageEXT is called and <n_rects>, is less
    than zero or <n_rects> is greater than zero but <rects> is
    NULL, EGL_BAD_PARAMETER is generated.

Fix up our usage of SwapBuffersWithDamage to match the behavior in the
EGL specification.

https://bugzilla.gnome.org/show_bug.cgi?id=745512
2015-04-29 22:41:58 +01:00
Emmanuele Bassi
dac33c5fea Stop using macros for accessing actor state
Use the newly added functions instead.
2015-04-23 17:39:30 +01:00
Emmanuele Bassi
4c6a550d13 Soft-deprecation of actor state macros
These are just terrible API that we've been stringing along since the
0.x days. We cannot truly deprecate them, because they are, in some
cases, the only actual API to perform some operation, and porting all
the code in the world is not going to make us any friends.

For the time being, we use a deprecation notice in the documentation.
2015-04-14 12:46:49 +01:00
Emmanuele Bassi
849607316a actor: Add functions mapping to state query macros
The macros are useless for language bindings, and are terribly unsafe
from C as well. There's always the option of using the GObject
properties they refer to, but it's more efficient to just have a simple
getter function.
2015-04-14 12:37:42 +01:00
Emmanuele Bassi
4006b8524d Add version macros for 1.24 2015-04-14 12:29:58 +01:00
Emmanuele Bassi
877e58a6b4 x11: Plug a leak on error path
If XIGetProperty() does not return what we expect, but still returned
something, we need to free it.
2015-04-09 12:35:23 +01:00
Emmanuele Bassi
83cd36e95f x11: Improve touchpad detection heuristics
We should use the same heuristics used by GDK in order to detect whether
a device is a touchpad or not.

Based on the similar code from Carlos Garnacho for GDK:
https://git.gnome.org/browse/gtk+/commit/?id=6f07d5e7

https://bugzilla.gnome.org/show_bug.cgi?id=747436
2015-04-09 11:03:16 +01:00
Emmanuele Bassi
d362e373bb actor: Fix a compiler warning 2015-03-23 13:24:52 +00:00
Emmanuele Bassi
505801cd09 gdk: Fix stage removal from the master clock
Prevents a double-free in the conformance test suite.
2015-03-23 13:24:44 +00:00
Emmanuele Bassi
4f8643cea3 gdk: Fix mapping between frame clock and stages
While each stage has at most a GdkFrameClock, the same GdkFrameClock
instance may drive multiple stages per frame. This means that the
mapping between a GdkFrameClock and a ClutterStage is a 1:M one, not a
1:1.

We should store a list of stages associated to each frame clock
instance, so that we can iterate over it when we need to update the
stages.

This commit fixes redraws of applications using multiple stages,
especially when using clutter-gtk.
2015-03-23 11:00:00 +00:00
Florian Müllner
38c4807230 cally-actor: Don't assume X11 backend is used when supported
_cally_actor_get_top_level_origin() uses a compile time check
without runtime check, which will obviously fail when another
backend like wayland is used.

https://bugzilla.gnome.org/show_bug.cgi?id=746575
2015-03-23 11:00:00 +00:00
Jonas Ådahl
615b0f46ae evdev: Keep track of the pointer coordinate ourself
When multiple relative motion events are received and queued, we can't
base the relative => absolute motion conversion off of the stage pointer
position, since that is only updated when the queue is processed at
the beginning of each frame. The effect of trying to use the stage
pointer position was that subsequent motion events were effectively
dropped.

To improve things, switch to keeping track of the pointer position
ourselves in the evdev backend and adding to that.

This has the side effect of making the internal function
_clutter_input_device_set_coords not effect the internal coordinate
state of the evdev stage, but AFAICS there is nothing depending on that
so that should be fine.

https://bugzilla.gnome.org/show_bug.cgi?id=746328
2015-03-18 22:45:38 +08:00
Emmanuele Bassi
83caeaae9b stage-cogl: Abort realize() if there's no CoglContext
There's no point in trying to go ahead if we don't have a context to
create the CoglOnscreen framebuffer, and Cogl will crash anyway if we
pass NULL to the constructor.
2015-03-17 13:47:08 +00:00
Emmanuele Bassi
ce2d86515a rectangle: Fix the border drawing conditions
And reorganize the code a bit while we're at it.
2015-03-15 15:10:31 +00:00
Chris Wilson
239280f855 stage-cogl: Fix damage tracking with varying buffer ages
With server-side buffer allocation, buffers may be returned out of order
(e.g. they may be held onto by external references or hardware). As such
we may see older buffers the frame after we discard the history from
seeing a very young buffer. To overcome this we want to keep the history
in a ring so we can keep track of older entries without keeping an
unbounded list. After converting to a ring, the maximum buffer age
observed during testing was 5 (expected value of 4), but before we could
see ages as high as 9 due to the huge latency spikes caused by doing full
buffer redraws (compounded by external listeners doing readback on the
damaged areas, for example vnc, drm/udl, prime). For this reason, a
maximum age of 16 was chosen to be suitably large enough to prevent these
worst cases from taxing the system.

v2: Fix off-by-one in combining the damage histroy into the clipping
rectangle, and apply copious whitespace fixes.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=745512
References: https://bugzilla.gnome.org/show_bug.cgi?id=724788
References: https://bugzilla.gnome.org/show_bug.cgi?id=669122
2015-03-15 14:46:42 +00:00
Chris Wilson
55c957267e stage-cogl: Use swap buffers with damage
cogl provides an interface to pass along damage with the swap buffers
request. This is useful for the display servers and hardware to minimise
the work done in updating the screen and also reducing the work done by
external listeners (such as vnc, drm/udl and PRIME).

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=745512
2015-03-15 14:45:53 +00:00
Emmanuele Bassi
6de3413921 rectangle: Do not draw the border if bigger than the allocation
If the rectangle is allocate a size smaller than the border, drawing the
border will end up with negative coordinates, and will mess up the whole
thing. Since rectangles don't have a minimum preferred size, we cannot
rely on the allocation being big enough to contain the border and the
background color.

If the rectangle is smaller than the border width value, we just paint
the border color as well.
2015-03-14 23:17:27 +00:00
Emmanuele Bassi
1912f28063 docs: Remove leftover DocBook tags
We use markdown for the documentation.
2015-03-12 20:22:57 +00:00
Emmanuele Bassi
fefc2b5321 docs: Improve more deprecation notices 2015-03-08 15:49:45 +00:00