Compare commits

...

305 Commits

Author SHA1 Message Date
Carlos Garnacho
4d6f99c95d backend/native: Use high priority contexts for secondary GPUs
Ensure the context requests EGL_CONTEXT_PRIORITY_HIGH_IMG, and
that we use cogl_egl_create_context() to ensure that is honored.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/923
2019-11-13 15:12:12 +01:00
Carlos Garnacho
9e54e404ee backends: Drop rt-scheduler configuration key
This is no longer an experimental feature. Even if we wanted to,
GSettings spawns threads, which we want to avoid until we drop
capabilities.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/923
2019-11-13 15:12:12 +01:00
Carlos Garnacho
6ec6ea7d3c core: Drop all capabilities on initialization
Add an optional dependency on libcap-ng, if the library is detected
drop all capabilities by default, in order to allow packagers/users
to do "setcap CAP_SYS_NICE=+ep `which gnome-shell`" and let it set
higher sched/egl priorities without preserving the capability forever.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/923
2019-11-13 15:12:12 +01:00
Carlos Garnacho
d8c4d78f4a core: Set up EGL context creation thread before dropping capabilities
We do intend this thread to preserve the necessary capabilities to
create high priority EGL contexts. Set this thread up before we drop
these.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/923
2019-11-13 15:12:12 +01:00
Carlos Garnacho
b7a662bfdd core: Set SCHED_RR by default on Wayland sessions
This still may fail if the executable is missing the right capability.
This can no longer depend on a setting as we want this to happen
before capabilities are dropped (and before other threads are spawned).

The necessary bits (eg. "setcap CAP_SYS_NICE=+ep `which gnome-shell`")
are still left up to users/distributors.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/923
2019-11-13 15:12:12 +01:00
Carlos Garnacho
9d61e6e56f core: Move unix signal handler later in the process
This does spawn a thread, so better to leave for late(r) initialization.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/923
2019-11-13 15:12:12 +01:00
Carlos Garnacho
231d9e3c31 cogl: Defer EGLContext creation to a separate thread
This is rather pointless and complex at the moment, but will pay
off as we can then spawn this thread early enough that it keeps
capabilities to create high priority contexts.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/923
2019-11-13 15:12:12 +01:00
Hans de Goede
8907a29912 cursor-renderer/native: Fix cursor drawing in combination with panel_orientation_transform
Properly take the panel_orientation_transform into account in
update_monitor_crtc_cursor. This fixes us sometimes drawing the cursor
on two monitors at the same time as we did not properly swap the crtc
width/height when a panel_orientation_transform is active.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/927
2019-11-13 10:54:37 +01:00
Hans de Goede
a5f986259f output-kms: Fix "panel orientation" kms-prop being ignored on native outputs
Actually store the panel_orientation_transform in the meta_output, so
that it gets honored by the core code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/927
2019-11-13 10:53:50 +01:00
Thomas Hindoe Paaboel Andersen
bcc519e4ee clutter: return correct enum type
clutter_event_get_scroll_finish_flags() should return a ClutterScrollFinishFlags
but due to what looks like a bad copy/paste it instead returns a
ClutterScrollSource on asserts.

The definitions of the enums are these:

typedef enum
{
  CLUTTER_SCROLL_SOURCE_UNKNOWN,
  CLUTTER_SCROLL_SOURCE_WHEEL,
  CLUTTER_SCROLL_SOURCE_FINGER,
  CLUTTER_SCROLL_SOURCE_CONTINUOUS
} ClutterScrollSource;

typedef enum
{
  CLUTTER_SCROLL_FINISHED_NONE       = 0,
  CLUTTER_SCROLL_FINISHED_HORIZONTAL = 1 << 0,
  CLUTTER_SCROLL_FINISHED_VERTICAL   = 1 << 1
} ClutterScrollFinishFlags;

The asserts would only return CLUTTER_SCROLL_SOURCE_UNKNOWN. This
is equal to CLUTTER_SCROLL_FINISHED_NONE which this patch uses
instead. Thus no functional change is intended. This only fixes a
compile warning.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/931
2019-11-12 17:09:09 +01:00
Georges Basile Stavracas Neto
044238b503 clutter/actor: Draw paint volumes using paint nodes
Clutter has a draw debug mode that allows for painting
paint volumes. Right now, this debug mode uses the old
immediate paint mode.

Switch the painting of paint volumes to use paint nodes,
and sneak a few minor style cleanups.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/890
2019-11-11 10:40:44 -03:00
Georges Basile Stavracas Neto
03b59f9e19 clutter/actor: Move paint flag to ClutterActorNode
Now that we unconditionally use ClutterActorNode to
paint ClutterActors, move the PAINT private flag to
the ClutterActorNode. This way, we can run the paint
on the actor anywhere inside the paint tree.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/890
2019-11-11 10:40:44 -03:00
Jonas Ådahl
7193938d27 compositor: Guard against untimely calls
It seems that sometimes these functions are called by Javascript in
GNOME Shell during tear down. This causes segfaults and crash reports,
but without any backtraces other than the entry and exit points into
gjs.

In order to get more useful information about where these calls come
from, validate the input passed gracefully, by complaining in the log
and returning NULL values.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/926
2019-11-11 13:09:20 +00:00
Hans de Goede
5afec87b96 input-settings/x11: Add missing clutter_x11_trap_x_errors around XIGetProperty
Add missing clutter_x11_[un]trap_x_errors around the XIGetProperty call
in meta-input-settings-x11.c's get_property helper function.

This fixes mutter crashing with the following error if the XInput device
goes away at an unconvenient time:

 X Error of failed request:  XI_BadDevice (invalid Device parameter)
   Major opcode of failed request:  131 (XInputExtension)
   Minor opcode of failed request:  59 ()
   Device id in failed request: 0x200011
   Serial number of failed request:  454
   Current serial number in output stream:  454

https://gitlab.gnome.org/GNOME/mutter/merge_requests/928
2019-11-10 19:45:08 +01:00
Robert Mader
a4f51da184 plugin-manager: Kill window effects on destroy
We do so for all other window effects already. Why this was left out
is unknown (9b3a0d1ad8), but we will need it for a fix in GS.

Related: https://gitlab.gnome.org/GNOME/mutter/issues/655

https://gitlab.gnome.org/GNOME/mutter/merge_requests/924
2019-11-08 22:18:09 +00:00
Florian Müllner
0545b93232 plugins/default: Handle skipped animations
We currently assume that the actor_animate() helper function returns
a timeline. However Clutter may skip implicit animations and simple
set properties directly, for example when the actor is hidden.

The returned timeline will be NULL in that case, and we abort when
using it as instance parameter to g_signal_connect().

Fix this by only setting up a completed handler when we are actually
animating, and complete the effect directly otherwise.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/925
2019-11-08 22:49:31 +01:00
Adam Jackson
9cbf83d59c cogl: glBlendFuncSeparate is always available
So we don't need glBlendFunc.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/903
2019-11-08 12:15:39 +00:00
Adam Jackson
07ca100130 cogl: glBlendEquationSeparate is always available
So we don't need glBlendEquation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/903
2019-11-08 12:15:39 +00:00
Marco Trevisan (Treviño)
6944839ab6 window-props: Read WM_TRANSIENT_FOR for override-redirect windows
As per the Extended Window Manager Hints standard version 1.3 [1] an
override-redirect window can set a transient-for window per compositing and
app-matching purposes.

So just read the WM_TRASIENT_FOR property also for such windows, adapting
the error in case they are transient for another O-R window and adding a
test to check such case.

[1] https://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472512128

https://gitlab.gnome.org/GNOME/mutter/merge_requests/920
2019-11-07 18:43:16 +00:00
Xiang Fan
4a76f66a54 wayland/surface: Don't double scale when getting absolute coordinates
The actor is already in surface coordinate space, so we should not scale
with the buffer scale to transform surface coordinates to stage
coordinates.

This bug causes input method using wayland text-input protocol to
receive wrong cursor location. Reproduced in ibus (when candidate
window is open) with scaling factor other than 1.

This commit also fixes pointer confinement.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/915
2019-11-07 16:20:13 +00:00
Marco Trevisan (Treviño)
bacbbbd628 window-props: Don't set override redirect windows as top-level parent
Java applications might use override-redirect windows as parent windows for
top-level windows, although this is not following the standard [1].

In such case, the first non-override-redirect child window that is created
was marked as being on_all_workspaces since the call to
should_be_on_all_workspaces() returns TRUE for its parent, and this even
though the on_all_workspaces_requested bit is unset.
When a further child of this window was added, it was set as not having a
workspace and not being on_all_workspaces, since the call to
should_be_on_all_workspaces() for its parent would return FALSE (unless if
it is in a different monitor, and the multiple-monitors workspaces are
disabled).

Since per commit 09bab98b we don't recompute the workspace if the
on_all_workspaces bit is unset, we could end up in a case where a window can
be nor in all the workspaces or in a specific workspace.

So let's just ignore the transient_for bit for a window if that points to an
override-redirect, using the x11 root window instead.

Add a stacking test to verify this scenario (was failing before of this
commit).

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/885
https://gitlab.gnome.org/GNOME/mutter/merge_requests/895

[1] https://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472512128
2019-11-07 16:04:19 +00:00
Marco Trevisan (Treviño)
c85fb107c0 window-props: Don't look for parent multiple times
Once we set the transient_for, we look for parent MetaWindow, so instead
of overwriting this value for loops check, just use another function
and avoid to look for the xwindow again when setting the MetaWindow parent.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/895
2019-11-07 16:04:19 +00:00
Marco Trevisan (Treviño)
13f10e36e4 window: Assert we only set a NULL workspace when unmanaging
There might be cases in which a window might be marked as both not in all
workspaces and with NULL workspace.

So to avoid this to happen, let's just assert early instead of doing this at
later point where the context might not be clear.

Related to https://gitlab.gnome.org/GNOME/mutter/issues/885

https://gitlab.gnome.org/GNOME/mutter/merge_requests/895
2019-11-07 16:04:19 +00:00
Marco Trevisan (Treviño)
2644e54c51 window: Warn if O-R window workspace state is used
Override-redirect windows have no workspace by default, and can't be parent
of a top-level window, so we must check that the parent window is not an
O-R one when setting the workspace state.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/895
2019-11-07 16:04:19 +00:00
Jonas Ådahl
0e5a5df5fe wayland/actor-surface: Always store away frame callbacks on commit
We're expected by MetaWaylandSurface to always pick the frame callbacks
out from the pending state when committing (applying) so that no frame
callbacks are unaccounted for. We failed to do this if our actor for
some reason (e.g. associated window was unmanaged) was destroyed. To
handle this situation better, store away the frame callbacks until we
some later point in time need to pass them on forward.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/893
2019-11-07 12:56:58 +00:00
Adam Jackson
806ebc464a cogl: Remove cogl_texture_2d_gl_new_from_foreign
As noted in <cogl-texture-2d-gl.h> (now also removed), this is for
allowing external GL callers to promote one of their textures to a
CoglTexture. We aren't doing that and don't want to start.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/883
2019-11-07 12:47:23 +00:00
Adam Jackson
54ac1f6b59 test: Remove unreferenced test-texture-rectangle
This isn't even built, and it's testing GL_TEXTURE_RECTANGLE_ARB, which
is not even a code path we support anymore since we require real NPOT.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/883
2019-11-07 12:47:23 +00:00
Adam Jackson
9b16b74b5d cogl: Remove unused stuff from cogl-material-compat.[ch]
You could probably move (most of) what's left into a static-inline kind
of header that only gets consumed by the tests.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/922
2019-11-07 12:33:35 +00:00
Florian Müllner
9172901458 ci: Fix checkout out gnome-shell on stable branches
For stable branches, we currently only check out the correct shell
branch for merge requests. For the regular pipeline, our code to
determine the current mutter branch fails because CI runs on a
temporary "pipeline/12345" branch that doesn't exist for gnome-shell.

Switching to the correct gitlab environment variable fixes that.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/811
2019-11-07 00:06:25 +01:00
Marco Trevisan (Treviño)
ffa0a24848 x11-display: Get next serial just before using it
We ask XLib the next request serial number before performing other actions
triggered by meta_x11_display_set_input_focus_internal() that doesn't use
the request serial anyways. So, just request it before updating the focus
window as that's the operation that needs it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/909
2019-11-06 17:32:29 +00:00
Marco Trevisan (Treviño)
efe5bed5b4 x11-display: Don't unset the X11 focused window after setting one
When using DesktopIcons extension and clicking in an icon, gnome-shell
starts an infinite loop caused by the first focus change that may trigger
on X11 a focus in/out event that leads to stage activation/deactivation
which never ends.

This happens because as part of meta_x11_display_set_input_focus_xwindow()
to focus the X11 stage window, we unset the display focus, but this also
causes to request the X11 display to unset the focus since we convolute by
calling meta_x11_display_set_input_focus() with no window, that leads to
focusing the no_focus_window and then a focus-in / focus-out dance that the
shell amplifies in order to give back the focus to the stage.

In order to fix this, mimic what meta_display_set_input_focus() does, but
without updating the X11 display, and so without implicitly calling
meta_x11_display_set_input_focus(), stopping the said convolution and
properly focusing the requested xwindow.
Also ensure that we're not doing this when using an older timestamp, since
this check isn't performed anymore.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/896
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/899

https://gitlab.gnome.org/GNOME/mutter/merge_requests/909
2019-11-06 17:32:29 +00:00
Carlos Garnacho
e865fcc460 wayland: Check focus surface client in wl_data_device.set_selection()
Similar to our handling in set_primary(), ignore set_selection() requests
that come from unfocused clients.

https://gitlab.gnome.org/GNOME/mutter/issues/878
2019-11-06 15:59:16 +01:00
Carlos Garnacho
16eb461054 wayland: Clean up meta_wayland_data_device_set_primary()
This function is already checking for the focus surface client
matching the requestor. The type check was slightly bogus though
as it'd be an screwup in our code, make it an assert instead.

Also, move the check for the client having the focus into the
upper call, so this and wl_data_device.set_selection code can
get more in line.

https://gitlab.gnome.org/GNOME/mutter/issues/878
2019-11-06 15:59:16 +01:00
Carlos Garnacho
c11ef6ef07 wayland: Flatten data source object hierarchy
We have an abstract MetaWaylandDataSource and 2 subclasses for
clipboard/primary data sources. Since the abstraction provided
by the additional sublevel is arguable, push the wl_resource
field up, and leave us with just 2 objects to think about, all
of them containing a wl_resource.

https://gitlab.gnome.org/GNOME/mutter/issues/878
2019-11-06 15:59:16 +01:00
Thomas Hindoe Paaboel Andersen
95eda361c1 wayland: use correct enum type for tablet pad
Fixes a compile warning.  The two enums are identical, so no
functional change intended.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/863
2019-11-05 13:07:47 +00:00
Jonas Ådahl
662c76c4fc tests/monitor-unit-tests: Add another tiling window hot plug test
Checks that we handle hot plugs of a untiled window, that was previously
tiled.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:36:25 +01:00
Jonas Ådahl
ff799a1abe window: Reset tile monitor number when untiling
Otherwise we'll end up trying to access the out of date state later.

Fixes the following test failure backtrace:

    #0  _g_log_abort ()
    #1  g_logv ()
    #2  g_log ()
    #3  meta_monitor_manager_get_logical_monitor_from_number ()
    #4  meta_window_get_work_area_for_monitor ()
    #5  meta_window_get_tile_area ()
    #6  constrain_maximization ()
    #7  do_all_constraints ()
    #8  meta_window_constrain ()
    #9  meta_window_move_resize_internal ()
    #10 meta_window_tile ()

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:36:25 +01:00
Jonas Ådahl
155b7bf569 tests/monitor-unit-tests: Add window tiling hot plug test
This test that we handle hot plugs correctly together with tiled
windows.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:36:25 +01:00
Jonas Ådahl
47155ed524 tests/runner: Move window shown synchronization to helper
https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:35:00 +01:00
Jonas Ådahl
db91439bb0 tests/monitor-unit-tests: Move test client sanity check into helper
https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:35:00 +01:00
Jonas Ådahl
77aad0869f window: Always update tile monitor number on hot plug
Otherwise we'll end up crashing if we had two connected monitors,
unplugged both, then replugged in a single one.

Avoids the following error:

    #0  _g_log_abort ()
    #1  g_logv ()
    #2  g_log ()
    #3  meta_monitor_manager_get_logical_monitor_from_number ()
    #4  meta_window_get_work_area_for_monitor ()
    #5  meta_window_get_tile_area ()
    #6  constrain_maximization ()
    #7  do_all_constraints ()
    #8  meta_window_constrain ()
    #9  meta_window_move_resize_internal ()
    #10 meta_window_move_resize_frame ()
    #11 meta_window_move_resize_now ()
    #12 idle_move_resize ()
    #13 call_idle_later ()

https://bugzilla.redhat.com/show_bug.cgi?id=1767703

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:35:00 +01:00
Jonas Ådahl
dc1a28c42a plugins/default: Clean up tile preview when closing display
On finalize, the preview actor will have been destroyed behind our back;
avoid that by cleaning up before it's too late.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:35:00 +01:00
Jonas Ådahl
955b27637c plugin/default: Init quark before using
Cut lines in pieces, and remove useless "optimizations" while at it

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:35:00 +01:00
Jonas Ådahl
1f5b403524 display: Add 'closing' signal
Emitted when the MetaDisplay is closing. Meant for clean up that depends
on things that will be torn down during closing.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 10:35:00 +01:00
Robert Mader
5e87d67e5f surface-actor-wayland: Do not send frame callbacks if the actor is obscured
`meta_surface_actor_is_obscured` implies that the actor got successfully culled
out and nothing of it will get painted. This includes that there are no clones,
no effects etc. In this cases we don't want to send frame callbacks, thus avoiding
unnecessary client work.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/918
2019-11-04 16:06:37 +01:00
Marco Trevisan (Treviño)
f133de2dd4 clutter/actor: Unref the root node if set as child
When setting the root node as child of a clip or transform node, we add a
new reference to it, without removing the one that we've previously added
when getting it from the actor node (and that won't ever be unset by the
auto-pointer since the root_node is re-associated).

So, once we add the root node as child and re-define it, unref it.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/908
2019-11-04 12:07:43 +00:00
Olivier Fourdan
60800d2313 renderer-native: Separate offscreen and shadowfb
Create the intermediate shadow framebuffer for use exclusively when a
shadowfb is required.

Keep the previous offscreen framebuffer is as an intermediate
framebuffer for transformations only.

This way, we can apply transformations between in-memory framebuffers
prior to blit the result to screen, and achieve acceptable performance
even with software rendering on discrete GPU.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/877
2019-11-04 10:44:42 +01:00
Olivier Fourdan
db90c0d509 clutter/stage-view: Separate offscreen and shadowfb
Previously, we would use a single offscreen framebuffer for both
transformations and when a shadow framebuffer should be used, but that
can be dreadfully slow when using software rendering with a discrete GPU
due to bandwidth limitations.

Keep the offscreen framebuffer for transformations only and add another
intermediate shadow framebuffer used as a copy of the onscreen
framebuffer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/877
2019-11-04 10:44:42 +01:00
Adam Jackson
e5b0f474ab cogl: Remove some unused framebuffer API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/913
2019-11-01 16:48:12 -04:00
Carlos Garnacho
1688cf7c44 clutter: Drop the no-clear stage hint
A compositor is notably opaque (usually has nothing to be painted on!).
gnome-shell sets this hint, but there's no reason why we wouldn't want
it by default.

Also, the color buffer being cleared messes with stencil clips, as the
clear operation by definition ignores the stencil buffer. We want to
use these more extensively in the future, so just drop this API.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/911
2019-11-01 15:02:09 +00:00
Carlos Garnacho
2202c0d02e tests: Explicitly set a background color for offscreen actor tests
Those change opacity and read pixels, relying on an implicit stage color.
We won't do that anymore.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/911
2019-11-01 15:02:09 +00:00
Hans de Goede
dbb95cbe5f window-xwayland: Add Xwayland fullscreen games workaround
This is a workaround for X11 games which use randr to change the resolution
in combination with NET_WM_STATE_FULLSCREEN when going fullscreen.

Newer versions of Xwayland support the randr part of this by supporting randr
resolution change emulation in combination with using WPviewport to scale the
app's window (at the emulated resolution) to fill the entire monitor.

Apps using randr in combination with NET_WM_STATE_FULLSCREEN expect the
fullscreen window to have the size of the emulated randr resolution since
when running on regular Xorg the resolution will actually be changed and
after that going fullscreen through NET_WM_STATE_FULLSCREEN will size
the window to be equal to the new resolution.

We need to emulate this behavior for these games to work correctly.

Xwayland's emulated resolution is a per X11 client setting and Xwayland
will set a special _XWAYLAND_RANDR_EMU_MONITOR_RECTS property on the
toplevel windows of a client (and only those of that client), which has
changed the (emulated) resolution through a randr call.

This commit checks for that property and if it is set adjusts the fullscreen
monitor rect for this window to match the emulated resolution.

Here is a step-by-step of such an app going fullscreen:
1. App changes monitor resolution with randr.
2. Xwayland sets the _XWAYLAND_RANDR_EMU_MONITOR_RECTS property on all the
   apps current and future windows. This property contains the origin of the
   monitor for which the emulated resolution is set and the emulated
   resolution.
3. App sets _NET_WM_FULLSCREEN.
4. We check the property and adjust the app's fullscreen size to match
   the emulated resolution.
5. Xwayland sees a Window at monitor origin fully covering the emulated
   monitor resolution. Xwayland sets a viewport making the emulated
   resolution sized window cover the full actual monitor resolution.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/739
2019-11-01 14:14:21 +01:00
Hans de Goede
ae238d1d4d window: Add adjust_fullscreen_monitor_rect virtual method
Add an adjust_fullscreen_monitor_rect virtual method to MetaWindowClass
and call this from setup_constraint_info() if the window is fullscreen.

This allows MetaWindowClass to adjust the monitor-rectangle used to size
the window when going fullscreen, which will be used in further commits
for a workaround related to fullscreen games under Xwayland.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/739
2019-11-01 14:12:17 +01:00
Christian Hergert
6051712919 profiler: track changes in GLib and Sysprof
This tracks the changes to gdbus-codegen in terms of how GUnixFDList is
done to use the UnixFD annotation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/908
2019-10-30 16:07:36 -07:00
Carlos Garnacho
6bfa61a3a7 Revert "clutter/cogl: Store empty clip regions for buffer age"
This reverts commit 4918893326.

This commit prevented cogl_stage_cogl_redraw_view() from skipping
swap buffers entirely if the invalidation region ended up empty.
This meant we were actually swapping buffers when we didn't need to.

The source of the glitches was fixed more properly, so this just adds
extra work.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/898
2019-10-30 17:17:29 +00:00
Carlos Garnacho
cf89e4d2cd clutter/cogl: Fix invalidation on non-primary monitors with no buffer age
We passed the view rectangle, we however want a fb-scaled rectangle starting
at 0,0. Fixes invalidation on other than the primary monitor when those
paths are hit.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/898
2019-10-30 17:17:29 +00:00
Carlos Garnacho
d47324e8d7 cogl/egl: Explicitly initialize age variable
In case of error, it's untouched by EGL, which probably means an
invalid read.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/906
2019-10-30 17:09:03 +00:00
Carlos Garnacho
ee4638ef5c cogl/egl: Make surface current before querying buffer age
Unknown since when, we started deferring the eglMakeCurrent for the
current framebuffer till we started painting on it, which means we
are preparing for rendering a view without guarantees that the
framebuffer we will paint to is the current drawing surface for the
EGL context.

A fairly common case where that assumption will break is multimonitor
set ups, in this case we will be preparing to paint to a view while
the current draw surface is that of the previously rendered view's.

Mesa will in this case return EGL_BAD_SURFACE when querying the buffer
age, since the surface is not yet the current draw surface. This
makes us give up on buffer age checks, and paint the whole view. Since
the problem repeats when painting the next view, we are effectively
doing full-screen redraws on all monitors.

Since cogl usually works implicitly, and querying the buffer age is
meaningless if you're not meant to paint on a surface, make the surface
the current draw surface implicitly before querying the buffer age.

This brings us glorious partial invalidations back when several views
had to be repainted.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/906
2019-10-30 17:09:03 +00:00
Carlos Garnacho
6ee7c0f486 cogl/egl: Warn when we fail to query a buffer age.
In order to avoid log spamming, just warn once it starts to happen, not
on every frame for every onscreen. Just knowing that this is happening
is a hint that something's going wrong.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/906
2019-10-30 17:09:03 +00:00
Adam Jackson
f4f7e31303 cogl: Fix GLES2 fallback
Say you're using intel gen3, you poor soul. Your big-GL maxes out at 1.5
unless you use dirty tricks, but you do have GLES2. We try to fall back
to GLES in this case, but we only ever say eglBindAPI(EGL_OPENGL_API).
So when we go to do CreateContext, even though we think we've requested
GLES 2.0, the driver will compare that "2.0" against the maximum big-GL
version, and things will fail.

Fix this by binding EGL_OPENGL_ES_API before trying a GLES context.

https://gitlab.gnome.org/GNOME/mutter/issues/635
2019-10-30 16:14:32 +00:00
Thomas Hindoe Paaboel Andersen
7c036c5896 cogl: fix a compile warning
In find_onscreen_for_xid() we want to loop over the framebuffers
and skip any that is not onscreen.

The code today does this by negating the framebuffer type variable
and skipping if that equals COGL_FRAMEBUFFER_TYPE_ONSCREEN. This
actually works as the enum used will function as a boolean:

typedef enum _CoglFramebufferType {
  COGL_FRAMEBUFFER_TYPE_ONSCREEN,
  COGL_FRAMEBUFFER_TYPE_OFFSCREEN
} CoglFramebufferType;

But it is a bit weird logic and fragile if more types are added.
(not that I can think of any different type...)

To simplify this, and to silence a warning in clang this patch just
changes it to a != test.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/905
2019-10-30 16:02:45 +00:00
Adam Jackson
793c2ac58d cogl: Remove unused cogl-deprecated.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/896
2019-10-30 02:28:40 +00:00
Adam Jackson
13d9e4db30 cogl: Remove unused cogl/cogl-pango.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/896
2019-10-30 02:28:40 +00:00
Adam Jackson
e84dbd7faf cogl: Remove unused CoglPipelineLightingState
https://gitlab.gnome.org/GNOME/mutter/merge_requests/904
2019-10-29 16:00:02 -04:00
Adam Jackson
711023ea93 cogl: Remove unused COGL_PIPELINE_STATE_LIGHTING
https://gitlab.gnome.org/GNOME/mutter/merge_requests/904
2019-10-29 16:00:01 -04:00
Adam Jackson
468dc99dc9 cogl: Remove unused pipeline lighting API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/904
2019-10-29 15:59:59 -04:00
Adam Jackson
6b8ee80fd0 cogl: Remove unused deprecated material lighting API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/904
2019-10-29 15:59:53 -04:00
Adam Jackson
17e39ad79c cogl: Remove support for cogl.conf
There are still environment variables for these controls, but having
them in a config file doesn't really make sense for mutter. Even if it
did we probably don't want to be parsing the same file as some
standalone version of cogl.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/902
2019-10-29 19:25:37 +00:00
Florian Müllner
46aeb9634f ci: Add gnome-control-center
Since 3.34, the gnome-shell package was cleaned up to only depend
on gnome-control-center-filesystem at build-time. However one of
the gnome-shell tests needs the gettext ITS file for keybindings
provided by the main gnome-control-center package (in fact, the
COPR package is stripped down to just that file), so install that
explicitly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/901
2019-10-29 18:34:36 +00:00
Adam Jackson
3f9c5d04d4 cogl: Remove old workaround for software Mesa
The comment says this was fixed in 10.1, which is over five years old
now. Please use a newer Mesa already.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/900
2019-10-29 12:42:30 -04:00
Florian Müllner
40a76590dd ci: Update docker image to v3
It's this time of the cycle again: Rebase the docker image to the
upcoming Fedora release, so we can drop a fair bit of the custom
dependencies that have piled up.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/894
2019-10-29 02:11:02 +01:00
Carlos Garnacho
f2b3dd318f wayland: Check stylus serials on meta_wayland_seat_can_popup()
This allows xdg_popup.grab() to work with styli. Without this check
we would bail out and emit xdg_popup.popup_done, leaving stylus users
unable to interact with popup menus, comboboxes, etc...

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/886
2019-10-28 19:10:01 +00:00
Jonas Ådahl
942883577e x11: Limit touch replay pointer events to when replaying
When a touch sequence was rejected, the emulated pointer events would be
replayed with old timestamps. This caused issues with grabs as they
would be ignored due to being too old. This was mitigated by making sure
device event timestamps never travelled back in time by tampering with
any event that had a timestamp seemingly in the past.

This failed when the most recent timestamp that had been received were
much older than the timestamp of the new event. This could for example
happen when a session was left not interacted with for 40+ days or so;
when interacted with again, as any new timestamp would according to
XSERVER_TIME_IS_BEFORE() still be in the past compared to the "most
recent" one. The effect is that we'd always use the `latest_evtime` for
all new device events without ever updating it.

The end result of this was that passive grabs would become active when
interacted with, but would then newer be released, as the timestamps to
XIAllowEvents() would out of date, resulting in the desktop effectively
freezing, as the Shell would have an active pointer grab.

To avoid the situation where we get stuck with an old `latest_evtime`
timestamp, limit the tampering with device event timestamp to 1) only
pointer events, and 2) only during the replay sequence. The second part
is implemented by sending an asynchronous message via the X server after
rejecting a touch sequence, only potentially tampering with the device
event timestamps until the reply. This should avoid the stuck timestamp
as in those situations, we'll always have a relatively up to date
`latest_evtime` meaning XSERVER_TIME_IS_BEFORE() will not get confused.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/886
2019-10-28 18:40:44 +00:00
Jonas Ådahl
23fa59b77c display: Move finishing of touch sequence to the backend
We need to manipulate an X11 grab when a touch sequence ends; move that
logic to where it belongs - in the X11 backend.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/886
2019-10-28 18:40:43 +00:00
Robert Mader
9678fd5306 clutter/cogl: Scale clip region in paint_stage()
To simplify the code and because it was forgotten once in a7f4f5b291,
breaking clipped redraws of clipped views.

Also sneak in a very small cleanup.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/889
2019-10-28 18:18:34 +01:00
Georges Basile Stavracas Neto
563e7139b6 Allow changing Clutter debug flags at runtime
This way, we can simply pop up the Looking Glass and run:

 >>> Meta.add_clutter_debug_flags(Clutter.DebugFlag.PICK, 0, 0)

And measure specific actions or events on GNOME Shell.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/862
2019-10-25 19:12:34 +00:00
Carlos Garnacho
2e9faaf67a clutter/cogl: Ensure to paint full view if there's no buffer age support
This was falling back to painting an empty area, which is not what we want.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/888
2019-10-25 15:03:24 +00:00
Carlos Garnacho
4918893326 clutter/cogl: Store empty clip regions for buffer age
As we do not prevent the SwapBuffers call from happening, those also
do count. Results in clip area calculations to be right for monitors
that previously did not get invalidated.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/888
2019-10-25 15:03:24 +00:00
Adam Jackson
3e5960b5a2 cogl: Remove unused cogl_egl_context_get_egl_context
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:53:03 -04:00
Adam Jackson
b294e62aed cogl: Remove unused cogl_glx_context_get_glx_context
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:53:01 -04:00
Adam Jackson
c63f54b7a7 cogl: Remove unused cogl_texture_pixmap_x11_set_damage_object
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:53:00 -04:00
Adam Jackson
3186e45ae5 cogl: Remove unused cogl_xlib_renderer_get_visual_info
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:59 -04:00
Adam Jackson
ed7afd9e80 cogl: Remove unused cogl_x11_onscreen_set_foreign_window_xid
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:57 -04:00
Adam Jackson
683f18639e cogl: Remove unused cogl_x11_onscreen_get_visual_xid
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:56 -04:00
Adam Jackson
e17494f3bd cogl: Inline cogl_xlib_renderer_set_event_retrieval_enabled into its one caller
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:54 -04:00
Adam Jackson
c36c865987 cogl: Remove unused _cogl_xlib_renderer_get_dispatch_timeout
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:53 -04:00
Adam Jackson
a99f579127 cogl: Remove unused cogl_check_extension and cogl_clutter_check_extension
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:51 -04:00
Adam Jackson
acc7b83322 cogl: Remove the stub winsys
It's not useful and supporting it leaks into the API in other weird
ways.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:49 -04:00
Adam Jackson
95662fd3d8 cogl: Remove unused cogl_xlib_renderer_get_visual_info
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:47 -04:00
Adam Jackson
b3980f7a94 cogl: Move _cogl_xlib_get_damage_base near its only consumer
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:46 -04:00
Adam Jackson
ac626f7334 cogl: Remove unused API from cogl-xlib
https://gitlab.gnome.org/GNOME/mutter/merge_requests/885
2019-10-24 16:52:43 -04:00
Bastien Nocera
b622a8b55d ci: Print all the commits that need bug references
Rather than just the latest one, otherwise it might leave the patch
submitter to iterate over every commit, if they didn't know every patch
needed a reference.

Closes: #1809
2019-10-23 10:58:07 +02:00
Bastien Nocera
b6170dbe7b ci: Phrase error in a way that gives a hint on how to fix problem
The passive phrasing makes it sound like there's something inherently
broken with the commit, rather than simply being missing an annotation
that the author can add.

Closes: #1809
2019-10-23 10:56:35 +02:00
Adam Jackson
d6bf4800ed cogl: Remove unused _cogl_matrix_entry_flush_to_gl_builtins
https://gitlab.gnome.org/GNOME/mutter/merge_requests/880
2019-10-22 19:44:54 +00:00
Adam Jackson
a60457c2d8 clutter: Remove behaviours
https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
Adam Jackson
33d1bae03f clutter: Remove deprecated/clutter-behaviour-scale.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
Adam Jackson
013b336690 clutter: Remove unused deprecated/clutter-behaviour-depth.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
Adam Jackson
096d78479b clutter: Remove tests/interactive/test-texture-quality.c
This is the last consumer of clutter_behaviour_depth_*, and is testing
clutter_texture_set_filter_quality which is also deprecated.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
Adam Jackson
68fca552d7 clutter: Remove unused deprecated/clutter-behaviour-opacity.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
Adam Jackson
18e0a8f7bf clutter: Remove stray references to ClutterBehaviour{Path,Rotate}
These were removed back in cc077023 and df3d2389.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/879
2019-10-22 19:01:17 +00:00
Georges Basile Stavracas Neto
cd2ee44216 clutter/actor: Always paint using paint nodes
Make ClutterActor paint using ClutterTransformNode, ClutterClip
node, and ClutterActorNode. Essencially, the actor node is a
replacement for clutter_actor_continue_paint().

An interesting aspect of this commit is that the order of the
operations is reversed to be preserved.

Before being able to remove the dummy node hack, we'll need to
make ClutterEffects compatible with paint nodes first -- and
naturally, that's enough content for its own merge request.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/872
2019-10-22 14:53:48 -03:00
Georges Basile Stavracas Neto
ebf9ac091d clutter/paint-nodes: Introduce ClutterActorNode
ClutterActorNode is a paint node that runs the 'paint'
function of an actor. It is a useful helper node to be
used during the transition to paint nodes.

The role of ClutterActorNode will change over time. For
now, it is just a call to clutter_actor_continue_paint(),
which also paints the effects. When ClutterEffect is
ported to paint nodes, ClutterActorNode will morph to
only notify the actor about the painting, and will become
a private node to Clutter.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/872
2019-10-22 14:47:37 -03:00
Georges Basile Stavracas Neto
cf791c09f0 clutter/paint-nodes: Expose and cleanup ClutterTransformNode
It will also be used by ClutterActor to apply it's own transform
to the paint node tree, and thus preserve it's rendering area.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/872
2019-10-22 14:47:37 -03:00
Georges Basile Stavracas Neto
1d8807a171 clutter/paint-nodes: Expose ClutterLayerNode
It will be useful to port ClutterOffscreenEffect in
the future.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/872
2019-10-22 14:47:37 -03:00
Adam Jackson
f18e2d2e62 clutter: Remove unused clutter-layout-manager-deprecated.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/878
2019-10-22 11:57:55 -04:00
Carlos Garnacho
71c3f4af31 x11: Update X11 focus before updating MetaDisplay focus
In a similar vein to commit 8fd55fef85. This notably failed when setting
the focus on the stage (eg. to redirect key events to Clutter actors).
Deeper in MetaDisplay focus updating machinery, it would check
meta_stage_is_focused() which would still return FALSE at the time it's
called.

This would not typically have side effects, but our "App does not respond"
dialogs see the focus change under their feet, so they try to bring
themselves to focus again. This results in a feedback loop.

Changing the order results in later checks on the X11 POV of the focus
being correct, so focus is not mistakenly stolen from the close dialog,
and it actually succeeds in keeping the key focus.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1607

https://gitlab.gnome.org/GNOME/mutter/merge_requests/876
2019-10-22 14:51:36 +02:00
Robert Mader
3078394951 ClutterStage: Use clutter_region_t for swap_region
We use `clutter_region_t` for the clip now, so lets also use it
for the swap region.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/692
2019-10-22 00:28:47 +02:00
Carlos Garnacho
a7f4f5b291 ClutterStage: Store clip area as a region
This will allow drawing optimizations as a region is more concrete
than the bounding rectangle.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/692
2019-10-22 00:28:47 +02:00
Adam Jackson
bd1630a12c cogl: Remove unused CoglFeatureFlags
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
67d5ebb187 cogl: Remove unused COGL_FEATURE_PBOS
Almost there.  The CoglFeatureFlags type is changed to "int"
momentarily.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
ba7b8a5de3 cogl: Remove unused COGL_FEATURE_TEXTURE_YUV
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
d54c548aac clutter: Remove unused deprecated clutter_texture_set_from_yuv_data
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
f01db80387 cogl: Remove unused COGL_FEATURE_TEXTURE_READ_PIXELS
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
5e0989532e clutter: Remove unused CLUTTER_FEATURE_TEXTURE_READ_PIXELS
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
673f4295e8 cogl: Remove unused COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE
This is a _little_ strange, as we still fill in the vtable slot for
glRenderbufferStorageMultisampleIMG, and can in principle still call it.
But that feature was weird to begin with as we were only checking for
that function in big-GL contexts despite that its extension is for GLES.
I'll leave cleaning that up to a future pass.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
1f04b1ae69 cogl: Remove unused COGL_FEATURE_OFFSCREEN_MULTISAMPLE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
26a7387f40 cogl: Remove unused COGL_FEATURE_FOUR_CLIP_PLANES
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
bd5266a05e cogl: Remove unused COGL_FEATURE_STENCIL_BUFFER
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
eb3ffeff0a cogl: Remove unused COGL_FEATURE_UNSIGNED_INT_INDICES
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
0731eb629c cogl: Remove unused COGL_FEATURE_MAP_BUFFER_FOR_{READ,WRITE}
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
34a38827b7 cogl: Remove unused COGL_FEATURE_ID_ONSCREEN_MULTIPLE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
3076895e98 cogl: Remove unused COGL_FEATURE_ONSCREEN_MULTIPLE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
0e4c23c985 cogl: Remove unused depth texture API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
fb49e9def7 cogl: Remove unused COGL_FEATURE_ID_DEPTH_TEXTURE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
45e77c1d87 cogl: Remove unused COGL_FEATURE_DEPTH_TEXTURE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
cf107c89b8 cogl: Remove always-set COGL_FEATURE_OFFSCREEN
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
6a8830a551 cogl: Remove always-set COGL_FEATURE_ID_OFFSCREEN
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
4523251849 cogl: Require {EXT,ARB}_framebuffer_object in the GL driver
This was only promoted to core in 3.0, but Mesa's supported it
unconditionally since around 7.0 even in 2.1 contexts, so this is not a
particularly onerous requirement.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
5f4e8789df cogl: Remove unused COGL_FEATURE_POINT_SPRITE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
eaf0aa1f07 cogl: Remove unused COGL_FEATURE_DEPTH_RANGE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
96da0c60bd cogl: Remove always-set COGL_FEATURE_ID_POINT_SPRITE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
da36575d7f cogl: Remove always-set COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
7716a418ce cogl: Remove always-set COGL_PRIVATE_FEATURE_BLEND_CONSTANT
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
6ab2e30fff cogl: Remove unused COGL_FEATURE_ID_MIRRORED_REPEAT
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
8b0289a5ba cogl: Remove unused COGL_FEATURE_ID_DEPTH_RANGE
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
d810c0576d cogl: Move some GL function pointers from in-gles-core to core
Now that we require GLES2 or GL 2.1 these are always available.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
82f56054d4 cogl: Remove some completely unused GL function pointers
https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
de362537c6 cogl: VBOs are always available
ARB_vertex_buffer_object was promoted to core in GL 1.5 (and thus GLES
2.0).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
ba9fb16048 cogl: Remove COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES
Again, just a difference between GL and GLES for no real reason.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:08 +00:00
Adam Jackson
148cba3270 cogl: Remove COGL_PRIVATE_FEATURE_QUADS
There's no real performance benefit to this, it's just a difference
between GL and GLES for no reason.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/866
2019-10-21 21:43:07 +00:00
Adam Jackson
c5bb2e3f56 cogl: Remove unused cogl_renderer_get_n_fragment_texture_units
https://gitlab.gnome.org/GNOME/mutter/merge_requests/874
2019-10-21 16:32:46 -04:00
Adam Jackson
049e7882b7 cogl: Move _cogl_bitmap_gl_{,un}bind into the GL driver
These are the only pieces of the cogl bitmap support that need GL driver
knowledge, so move them there like the TODO suggests.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/874
2019-10-21 16:32:46 -04:00
Adam Jackson
f297a5faa5 cogl: Remove unneeded driver/ includes from the core
https://gitlab.gnome.org/GNOME/mutter/merge_requests/874
2019-10-21 16:32:46 -04:00
Carlos Garnacho
40e6aa7d94 compositor: Plug cairo_region_t leak
The MetaBackgroundActor uses a region to find out the areas that need
repainting, but forgot to free it, oops.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/873
2019-10-21 19:01:37 +02:00
Carlos Garnacho
668be1f4bd backends: Plug MetaKmsPageFlipData leak
If the page flip is postponed, keep a ref to it, but still unref it
on the page flip callback anyways. Fix suggested by Jonas Ådahl.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/873
2019-10-21 19:01:35 +02:00
Jan Alexander Steffens (heftig)
a444a4c5f5 EGL: Include EGL/eglmesaext.h
The eglext.h shipped by libglvnd does not include the Mesa extensions,
unlike the header shipped in Mesa.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/876
2019-10-21 14:04:30 +00:00
Georges Basile Stavracas Neto
05da4a6094 clutter/effect: Remove pick flags
As pointed out, they are now unused. Remove
the pick flags.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
Georges Basile Stavracas Neto
db8fcc0537 clutter/actor: Remove pick code from paint
Now that they are properly split, remove the pick
code from paint paths.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
Georges Basile Stavracas Neto
86a5358812 clutter/stage: Pick with clutter_actor_pick()
Use the new function to perform picking.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
Georges Basile Stavracas Neto
ff8ed70f84 clutter/stage: Refactor view setup code
We'll share it between pick and paint, so refactor
the framebuffer and view setup code from paint
into a new function.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
Georges Basile Stavracas Neto
179d5ba6a6 clutter: Split pick and paint
Add the corresponding clutter_actor_pick() and
clutter_actor_continue_pick() as public APIs,
and use them in pick overrides and ClutterEffect.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/865
2019-10-21 13:49:26 +00:00
Robert Mader
98892391d7 wayland/surface: Reset buffer_destroy_handler_id
Syncronized subsurfaces that call into `merge_pending_state` might
otherwise not create new destroy handlers, ending up with a invalid
handler ids, throwing errors and leaking.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/868
2019-10-21 12:54:36 +00:00
Carlos Garnacho
45a8806e65 x11: Iterate over selections in a safer manner for event handling
It might be the case that handling an event induces the stream to
trigger completion, hence removing itself from the list. In that
case we would operate on the no longer valid list element to fetch
the next one.

Keep a pointer to the next element beforehand, so we can tiptoe
over streams that did remove themselves.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/869
2019-10-21 13:19:48 +02:00
Carlos Garnacho
e1fa0734a9 x11: Detach selection streams on dispose
The streams were only detached from MetaX11Display (and its event handling)
on completion. This is too much to expect, and those might be in some
circumstances replaced while operating.

Make those streams detach themselves on dispose(), so we don't trip into
freed memory later on when trying to dispatch unrelated X11 selection events.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/869
2019-10-21 11:47:40 +02:00
Cosimo Cecchi
8665084df1 monitor-manager: check for underscan setting validity upfront
Instead of doing a roundtrip to the X server before setting it, rely on
the previous value fetched before the configuration was sent over DBus.
This matches the argument check we already do elsewhere, and will allow
us to more easily add an additional condition to determine if underscan
is supported.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/673
2019-10-16 14:34:14 +00:00
Georges Basile Stavracas Neto
62072838c9 cogl: Remove midscene tracking
Midscene tracking was used at a time that some Cogl users
could call random OpenGL API without going through Cogl.
That is not allowed anymore, and certainly not done by
Mutter and GNOME Shell.

Remove midscene tracking from CoglFramebuffer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/402
2019-10-16 16:25:08 +02:00
Georges Basile Stavracas Neto
c5b7d73ce2 cogl/journal: Track dither
For the exact same reason that previous commit added
viewport tracking, also add dither state tracking and
avoid flushing the journal even more.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/402
2019-10-16 16:25:08 +02:00
Georges Basile Stavracas Neto
0556138b9f cogl/journal: Track viewport
CoglJournal tracks a few OpenGL states so that they can
be batch-applied if necessary. It also has a nice property
of allowing purely CPU-based glReadPixels() when the scene
is composed of simple rectangles.

However, the current journal implementation leaves various
other GL states out, such as dithering and the viewport.
In Clutter, that causes the journal to be flushed when
picking, touching the GPU when we didn't really need to.

Track the viewport of the framebuffer in the journal so that
we can avoid flushing the journal so often.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/402
2019-10-16 16:25:08 +02:00
Jasper St. Pierre
d57dbe1d4c framebuffer: Fix clip tracking in the unclipped case
Leaving the clip bounds untouched means that it will retain the stale value
of whatever it was when we last had a clip; reset it so that it contains the
full framebuffer contents instead.

https://bugzilla.gnome.org/show_bug.cgi?id=712562
https://gitlab.gnome.org/GNOME/mutter/merge_requests/402
2019-10-16 16:25:08 +02:00
Georges Basile Stavracas Neto
5d646a5d6f cogl/framebuffer: Check buffer bits before modifying it
CoglFramebuffer checks the passed buffer bits in order to
detect when the fast path (that uses the journal) should
be used.

However, it also modifies one of the buffer bits that is
checked for the fast path, meaning we never actually hit
the fast path on cogl_framebuffer_cleaf4f().

Check the depth and color buffer bits before modifying them.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/402
2019-10-16 16:25:08 +02:00
Daniel van Vugt
e82a657cd9 clutter/actor: Remove color from the pick virtual function
It's unused since commit 14c706e51.

**ABI break**

https://gitlab.gnome.org/GNOME/mutter/merge_requests/851
2019-10-16 12:01:16 +00:00
Daniel van Vugt
8c89ea5f0a clutter/stage: Do picking with float coordinates
Previously picking was done on an int (x,y) to address a particular pixel.
While `int` was the minimum precision required, it was also an unnecessary
type conversion.

The callers (input events mainly) all provide float coordinates and the
internal picking calculations also have always used floats. So it was
inconsistent and unnecessary to drop to integer precision in between those.

ABI break: This changes the parameter types for public function
`clutter_stage_get_actor_at_pos`, but its documentation is already
sufficiently vague to not need changing.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/844
2019-10-16 11:52:04 +00:00
Georges Basile Stavracas Neto
8cfa8dc0c1 cogl/matrix-stack: Use graphene types on entries
This will help moving to graphene_matrix_t, since the convertions
between nodes and graphene types won't be necessary anymore.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:14 +00:00
Georges Basile Stavracas Neto
bdf5e3f357 Replace ClutterGeometry by graphene_rect_t
The last of the replacements. It is fine for now
to replace ClutterGeometry's integers by floats.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:14 +00:00
Georges Basile Stavracas Neto
94682e69aa Replace ClutterRect by graphene_rect_t
https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:14 +00:00
Georges Basile Stavracas Neto
160cc9182d Replace ClutterPoint by graphene_point_t
Remove the tests for ClutterPoint since it's
corresponding code moved to private ClutterStage
methods.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:14 +00:00
Georges Basile Stavracas Neto
cd293f764e Replace ClutterSize by graphene_size_t
https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Georges Basile Stavracas Neto
a5d0cfe8fb Replace ClutterVertex by graphene_point3d_t
Pretty direct and straightforward port. This requires a
GNOME Shell counterpart. In addition to that, include a
progress function.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Georges Basile Stavracas Neto
ba0f17f5b1 Replace CoglVector* by graphene_vec*_t
This is an extremely straightforward and minimalistic port of
CoglVector APIs to the corresponding Graphene APIs.

Make ClutterPlane use graphene_vec3_t internally too, for the
simplest purpose of keeping the patch focused.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Georges Basile Stavracas Neto
16875340cb Remove CoglQuaternion
This is unused API, and there are no plans to actually
use it. Even if we want to use it in the future, we'll
be fully Graphene and won't need this API anyway.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Georges Basile Stavracas Neto
959a418cc3 Replace CoglEuler by graphene_euler_t
As the first step into removing Cogl types that are covered by
Graphene, remove CoglEuler and replace it by graphene_euler_t.

This is a mostly straightforward replacement, except that the
naming conventions changed a bit. Cogl uses "heading" for the
Y axis, "pitch" for the X axis, and "roll" for the Z axis, and
graphene uses the axis themselves. That means the 1st and 2nd
arguments need to be swapped.

Also adapt the matrix stack to store a graphene_euler_t in the
rotation node -- that simplifies the code a bit as well.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Georges Basile Stavracas Neto
7c7ccb2e43 clutter: Pull in Clutter dependencies
Mutter requires Clutter, which requires Cogl. That means
Clutter requires all Cogl dependencies, and Mutter requires
all Clutter dependencies as well.

However, currently, Clutter does not pull in its dependencies,
which means we need to link against Cogl manually.

Add Clutter dependencies to declare_dependency() so that the
graphene dependency only needs to be declared once, for Cogl,
and pulled together.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Georges Basile Stavracas Neto
cada2b54fe Add Graphene dependency
Graphene is a small library with data types and APIs
specially crafted to computer graphics. It contains
performant implementations of matrices, vectors, points
and rotation tools. It is performance because, among
other reasons, it uses vectorized processor commands
to compute various operations.

Add Graphene dependency to Mutter.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Georges Basile Stavracas Neto
3ecae81809 clutter/tests: Rename variable
Graphene uses C99 and includes stdbool.h, which adds a
new 'bool' type. Clutter has an a11y test that names a
variable as 'bool' too, and they do not play well together.

Rename this variable to boolean.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Georges Basile Stavracas Neto
4f2b217a6a clutter/actor: Drop ClutterActor:clip property
This is a deprecated property that is not used anywhere
in the codebase. Not by GNOME Shell. Because it uses the
deprecated ClutterGeometry type, it's a good target for
cleaning up, given that ClutterGeometry will be dropped
later on.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Georges Basile Stavracas Neto
b1a1d4e13d Remove fog support
Fog is explicitly deprecated in favour of CoglSnippet API,
and in nowhere we are using this deprecated feature, which
means we can simply drop it without any sort of replacement.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
2019-10-16 11:38:13 +00:00
Jonas Ådahl
f7315c9a36 window-actor: Move shapes, shadows and unredirection to X11 sub types
Move out updating of various shapes (input, opaque, shape) indirectly
from X11 to the corresponding X11 sub types of MetaWindowActor and
MetaSurfaceActor.

Also move fullscreen window unredirection code with it. We want to
effectively do something similar for MetaCompositorServer, but it will
work differently enough not to share too much logic.

While it would have been nice to move things piece by piece, things were
too intertwined to make it feasible.

This has the side effect fixing accidentally and arbitrarily adding
server side shadow to Wayland surfaces.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/734
2019-10-16 13:16:55 +02:00
Jonas Ådahl
9ac52f0340 compositor/x11: Move unredirect logic to helper
It makes it clearer what is required for unredirecting a window.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/734
2019-10-16 13:05:40 +02:00
Jonas Ådahl
f059466337 window-actor/x11: Use g_clear_signal_handler()
Also fixes type of handler ID.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/734
2019-10-16 13:05:40 +02:00
Jonas Ådahl
dcd0f4322a shaped-texture: Add API to check opaqueness
It is opaque if the texture has no alpha channel, or if the opaque
region covers the whole content.

Internally uses a function that checks whether there is an alpha
channel. This API will be exposed at a later time as well.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/734
2019-10-16 13:05:40 +02:00
Florian Müllner
65d8f27b6b doap: Update list of maintainers
Move historic entries from "maintainers" to "authors" and add more
fellow gnomies to better reflect reality.
2019-10-16 12:33:47 +02:00
Piotr Drąg
bdceb3acdb Update POTFILES.in 2019-10-15 19:18:30 +02:00
Niels De Graef
8e204e036a cogl: Add a notion of pixel format planes
As we will start adding support for more pixel formats, we will need to
define a notion of planes. This commit doesn't make any functional
change, but starts adding the idea of pixel formats and how they (at
this point only theoretically) can have multple planes.

Since a lot of code in Mutter assumes we only get to deal with single
plane pixel formats, this commit also adds assertions and if-checks to
make sure we don't accidentally try something that doesn't make sense.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/858
2019-10-15 16:35:16 +00:00
Marco Trevisan (Treviño)
553211dd81 clutter/stage: Actually set key focus to an actor on key focus
As per commit c2d03bf73 we're using a private method to set the actors key
focus and emit key-focus-in signal, but we're using inverted logic here.

So flip the parameter to match the expected result.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/860
2019-10-15 16:39:04 +02:00
Carlos Garnacho
97010ac64d meta: Move private defines to a private header
These defines are unused outside of mutter, and actually not
desirable to export. Move them to a private header.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/859
2019-10-15 11:03:56 +00:00
Marco Trevisan (Treviño)
c2d03bf73e clutter/actor: Save key-focus state and unset it before destruction
When clutter actors with key focus are destroyed we emit ::key-focus-out on
them just after their destruction. This is against our assumption that no
signal should be emitted after "::destroy" (see GNOME/mutter!769 [1]), and
in fact could cause the shell to do actions that we won't ever stop on
destroy callback.

To avoid this to happen, use a private function to set its key-state (so we
can avoid looking for the stage) and emit ::key-focus-in/out events and use
this value in both clutter_actor_has_key_focus(),
clutter_actor_grab_key_focus() and on unmap and destruction to unset the
stage key focus before we emit the ::destroy signal.

As result of this, we can now avoid to unset the key focus on actor
destruction in the stage.

[1] https://gitlab.gnome.org/GNOME/mutter/merge_requests/769

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1704
2019-10-15 12:20:58 +02:00
Marco Trevisan (Treviño)
22c8f179d2 cogl/test-readpixel: Remove unused variables
These were added as part of commit d4ff5e2d but they're not needed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/857
2019-10-15 11:55:53 +02:00
Marco Trevisan (Treviño)
d4ff5e2d31 clutter/actor: Remove deprecated clutter container foreach
This is deprecated, so replace it with ClutterActorIter or alternative funcs

https://gitlab.gnome.org/GNOME/mutter/merge_requests/816
2019-10-15 08:51:45 +00:00
Marco Trevisan (Treviño)
2773e8adf8 clutter/actor: Remove deprecated internal child support
Clutter had support for internal children in its early revisions, but they
were deprecated for long time (commit f41061b8df, more than 7 years ago) and
no one is using them in both clutter and in gnome-shell.

So remove any alternative code path that uses internal children.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/816
2019-10-15 08:51:45 +00:00
Jonas Ådahl
e17d70a592 x11/window-controls: Pass around MetaX11Display directly
Instead of passing around an X11 Display pointer that is retrieved from
the default Gdk backend, then finding the MetaX11Display from said X11
Display, pass the MetaX11Display directly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/854
2019-10-15 07:17:29 +00:00
Jonas Ådahl
da213febdc core/core: Rename and move to x11/meta-x11-window-control
The functionality core/core.c and core/core.h provides are helpers for
the window decorations. This was not possible to derive from the name
itself, thus rename it and put it in the right place.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/854
2019-10-15 07:17:29 +00:00
Jonas Ådahl
7c2e926c44 core/core: Remove meta_retheme_all() helper
All it did was get the MetaDisplay and call a function on it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/854
2019-10-15 07:17:29 +00:00
Jonas Ådahl
c474ad6a53 Stop including core.h where it's not used
It provides glue for window frame controls and internal window
management, and that is only relevant for a couple of places in src/ui/.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/854
2019-10-15 07:17:29 +00:00
Jonas Ådahl
877ecc1bb4 core/core: Remove unused function
https://gitlab.gnome.org/GNOME/mutter/merge_requests/854
2019-10-15 07:17:29 +00:00
Niels De Graef
0d0286d59e cogl: Remove COGL_INVALID_HANDLE
Just use `NULL`, which is the normal C convention

https://gitlab.gnome.org/GNOME/mutter/merge_requests/451
2019-10-14 17:05:28 +00:00
Niels De Graef
23f77a1b63 cogl: Remove cogl_handle_ref/unref
This is for all intents and purposes the same as
`cogl_object_ref/unref`, but still refers to handles rather than
objects (while we're trying to get rid of the former) so it's a bit of
unnecessary redundant API.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/451
2019-10-14 17:05:28 +00:00
Robert Mader
317ce05a27 window-actor: Add a missing NULL-check
We shouldn't crash on a NULL-clip.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/856
2019-10-14 18:23:32 +02:00
Robert Mader
a8155a0471 meta: Add META namespace to macros
To silence warnings during GIR generation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/822
2019-10-14 10:14:11 +00:00
Niels De Graef
5e7fa20f06 wayland-egl-stream: Add log message on sucessful dlopen
Right now, there is no feedback message that tells you whether the
nvidia-egl-wayland module was succesfully loaded.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/853
2019-10-14 10:53:38 +02:00
Niels De Graef
3a688988e0 dbus-session-watcher: Chain up to parent finalize()
https://gitlab.gnome.org/GNOME/mutter/merge_requests/847
2019-10-14 09:09:01 +02:00
Florian Müllner
34ff206604 Bump version to 3.35.1
Update NEWS.
2019-10-12 20:35:43 +02:00
Carlos Garnacho
5c1be2233d x11: Map mimetypes back to selection atoms
This may be seen as the missing half of
https://gitlab.gnome.org/GNOME/mutter/merge_requests/842. Now that we
translate some atoms to better known mimetypes, we should also translate
those mimetypes to the underlying atoms if we might have added them.

Fixes c&p from certain X11 clients.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/854
2019-10-12 19:18:19 +02:00
Carlos Garnacho
e1751ad9ee wayland: Figure out better the right selection source for a wl_data_offer
We were just looking at DnD actions which might still be unset at that
point. Instead of doing these heuristics, store the selection type on
the data offer.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/845
2019-10-12 01:19:48 +02:00
Carlos Garnacho
84cc89e19a wayland: Set dummy selection source on .set_selection(null)
Requesting a selection with a NULL data source means "unset the clipboard",
but internally we use an unset clipboard as the indication that the
clipboard manager should take over.

Moreover, this unset request may go unheard if the current owner is someone
else than the MetaWaylandDataDevice.

Instead, set a dummy data source with no mimetypes nor data, this both
prevents the clipboard manager from taking over and ensures the selection
is replaced with it.

The MetaSelectionSourceMemory was also added some checks to allow for this
dummy mode.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/793
2019-10-11 23:04:01 +02:00
Carlos Garnacho
ea4665bf51 wayland: Simplify MetaSelectionSourceWayland
Instead of taking resource and send/cancel funcs, take a
MetaWaylandDataSource, which exposes all the vfuncs to do the same on the
internal resource.

This has the added side effect that only MetaWaylandDataSource has a
pointer to the wl_resource, which may be unset untimely.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/842
2019-10-11 23:04:01 +02:00
Carlos Garnacho
227d272049 wayland: Check resource before emitting cancelled event
If a data source is destroyed we first unset the resource, and then try to
unref the related selection source. At this point the only event that might
be emitted by the internal selection machinery is .cancelled, so make sure
we avoid it on destroyed sources.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/842
2019-10-11 23:01:44 +02:00
Carlos Garnacho
e53db92a7b wayland: Emit wl/primary offer after changing selection
We are still poking the mimetypes from the previous selection when creating
the new offer. This may come out wrong between changes of the copied
mimetypes.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/789
2019-10-11 23:00:12 +02:00
Carlos Garnacho
dd2b1278a0 wayland: Chain up to the right finalize on MetaWaylandDataSourceWayland
This function was using the wrong parent class pointer, so it was mistakenly
skipping over MetaWaylandDataSource::finalize.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/848
2019-10-11 23:00:12 +02:00
Carlos Garnacho
f2e2fcf758 wayland: Drop field from MetaWaylandDataSourcePrimary
This is a subclass of MetaWaylandDataSourceWayland, so there's no need
for a duplicate wl_resource field. Make sure to reuse the parent struct
one.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/848
2019-10-11 23:00:12 +02:00
Carlos Garnacho
dfd44ff971 wayland: Plug MetaSelectionSourceWayland leaks
There was a dangling ref left on all of them, oops.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/848
2019-10-11 23:00:12 +02:00
Georges Basile Stavracas Neto
943b069996 clutter/shader-effect: Initialize shader-type properly
The default value of the ClutterShaderEffect:shader-type
property is CLUTTER_FRAGMENT_SHADER. However, because the
struct field is not actually initialized to it, it ends
up assuming the value 0, which is CLUTTER_VERTEX_SHADER.

Properly initialize ClutterShaderEffect's shader_type to
CLUTTER_FRAGMENT_SHADER.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/846
2019-10-11 10:53:33 -03:00
Jonas Ådahl
2a56de80a2 ci: Change the without-native-backend to not build with Wayland too
There are two common ways of building mutter: With both the native
backend and Wayland support (most common, used by most Linux distributions), and
without the native backend and Wayland support (as is done by some
BSD*s).

To catch compilation errors in both these common build configurations,
change the no-native-backend build phase to also not build with Wayland
support.

This also disables building mutter tests, as tests depend on Wayland to
run.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/837
2019-10-10 22:51:00 +00:00
Jonas Ådahl
69a0c1dc80 main: Warn instead of error in meta_test_init()
Otherwise we'll get the warning

../src/core/main.c: In function 'meta_test_init':
../src/core/main.c:755:1: error: function might be candidate for attribute 'noreturn' [-Werror=suggest-attribute=noreturn]
  755 | meta_test_init (void)
      | ^~~~~~~~~~~~~~

when building without Wayland.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/837
2019-10-10 22:51:00 +00:00
Jonas Ådahl
1b4709794e kms/crtc: Read gamma state when prediction failed
If we did a mode set, the gamma may have been changed by the kernel, and
if we didn't also update the gamma in the same transaction, we have no
way to predict the current gamma ramp state. In this case, read the
gamma state directly from KMS.

This should be relatively harmless regarding the race conditions the
state prediction was meant to solve, as the worst case is we get none or
out of date gamma ramps; and since this is for when gamma ramps are not
updated at mode setting time, we'd get intermediate gamma state to begin
with, so it's not worse than what we currently do anyway.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/840
2019-10-10 14:46:32 +00:00
Jonas Ådahl
1cc249fe18 kms: Always predict state after processing update
Not only mode sets have state that should be predicted; changing gamma
currently happens with its own update, so we missed predicting that.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/840
2019-10-10 14:46:32 +00:00
Marco Trevisan (Treviño)
446bd04b6c clutter-backend-x11: Don't push keymap events to clutter
Xkb events should be handled by clutter backend but they are not translated
into an actual clutter event. However we're now handling them and also trying
to push an empty event to clutter queue, causing a critical error.

So in such case, just handle the native event but don't push the non-populated
clutter-event to the queue.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/750
https://gitlab.gnome.org/GNOME/mutter/merge_requests/764
2019-10-10 13:00:02 +00:00
Marco Trevisan (Treviño)
9234fcb624 event-x11: Use CLUTTER prefix for X11 filter docs
As per commit ad72fa46b clutter_x11_handle_event was renamed into
meta_x11_handle_event but the return type didn't change.

So, keep the doc-string to match the actual possible return values.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/764
2019-10-10 13:00:02 +00:00
Carlos Garnacho
59a697f773 x11: Translate well known selection atoms to mimetypes
Some antediluvian x11 clients only bother to set atoms like
UTF8_STRING/STRING/TEXT/... and no matching mimetypes. Cover for them
and add the well known mimetypes if they are missing.

Reported at https://bugzilla.redhat.com/show_bug.cgi?id=1758873

https://gitlab.gnome.org/GNOME/mutter/merge_requests/842
2019-10-10 12:13:46 +00:00
Jonas Ådahl
d49d10b14f wayland/actor-surface: Queue redraw for frame callback
A frame callback without damage is still expected to be responded to.
Implement this by simply queuing damage if there are any frame callbacks
requested and there is no damage yet. If there already is damage,
we'll be queued already, but with more correct damage. Without we simply
need to make sure we flush the callbacks if any area of surface is not
occluded.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/839
2019-10-10 10:01:05 +00:00
Jonas Ådahl
4c15d32b55 wayland/surface: Some minor coding style clean up
Some very long lines that were split up.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/839
2019-10-10 10:01:05 +00:00
Daniel van Vugt
73eaf51770 cogl-pango/meson.build: Remove extraneous quoting
It wasn't necessary (see other instances of -DG_LOG_DOMAIN) and somewhere
along the line it was getting turned into forward slashes becoming a syntax
error:

```
/usr/include/glib-2.0/gobject/gobject.h:767: syntax error, unexpected '/' in
...
g_assertion_message (/"CoglPango/",
```

https://gitlab.gnome.org/GNOME/mutter/merge_requests/841
2019-10-10 17:29:44 +08:00
Tim Klocke
81ee8886ce backends: Update inhibited state for the monitor and respect that state
The inhibited state of the monitor was after the initializiation never
updated. meta_idle_monitor_reset_idletime didn't respect the inhibited
state, so it set timeouts if it shouldn't have.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/573
2019-10-09 09:53:32 +00:00
Florian Müllner
658c741420 Bump version to 3.34.1
Update NEWS.
2019-10-08 14:55:28 +02:00
Jordi Mas
65cc8c1ea2 Update Catalan translation 2019-10-08 07:35:51 +02:00
Carlos Garnacho
d9597d2148 wayland: Ensure to forward numlock state to clients
This makes sure the numlock key lock state is forwarded to the wl_keyboard
internal state, notably on startup and after keymap changes.

https://gitlab.gnome.org/GNOME/mutter/issues/769
2019-10-07 22:28:45 +00:00
Carlos Garnacho
fc3831c797 backends: Fix thinko
We are meant to pass a flagset there, not a boolean. Fixes state querying
to the ClutterKeymap in the native backend.

https://gitlab.gnome.org/GNOME/mutter/issues/769
2019-10-07 22:28:45 +00:00
Carlos Garnacho
ce86f90efb Revert "backends/x11: Do not reload keymap on new keyboard notifications"
This reverts commit b01edc22f3.

It breaks keybindings on certain physical keyboard layouts.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/822
2019-10-07 22:15:02 +00:00
Jonas Ådahl
b5f50028f2 wayland: Untie MetaWindowXwayland lifetime from the wl_surface
For the most part, a MetaWindow is expected to live roughly as long as
the associated wl_surface, give or take asynchronous API discrepancies.

The exception to this rule is handling of reparenting when decorating or
undecorating a window, when a MetaWindow on X11 is made to survive the
unmap/map cycle. The fact that this didn't hold on Wayland caused
various issues, such as a feedback loop where the X11 window kept being
remapped. By making the MetaWindow lifetime for Xwayland windows being
the same as they are on plain X11, we remove the different semantics
here, which seem to lower the risk of hitting the race condition causing
the feedback loop mentioned above.

What this commit do is separate MetaWindow lifetime handling between
native Wayland windows and Xwayland windows. Wayland windows are handled
just as they were, i.e. unmanaged together as part of the wl_surface
destruction; while during the Xwayland wl_surface destruction, the
MetaWindow <-> MetaWaylandSurface association is simply broken.

Related: https://gitlab.freedesktop.org/xorg/xserver/issues/740
Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/762

https://gitlab.gnome.org/GNOME/mutter/merge_requests/774
2019-10-07 20:25:20 +00:00
Jonas Ådahl
2c388e2155 clutter/transition: Don't split reference counting with actor
ClutterActor took a reference in its transition 'stopped' handler,
aiming to keep the transition alive during signal emission even if it
was removed during. This is, however, already taken care of by
ClutterTimeline, by always taking a reference during its 'stopped'
signal emission, so no need to add another one.

This also has the bonus of making reference ownership simpler, as well
as avoidance of double free if an actor was destroyed before a
transition has finished.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/828
2019-10-07 18:33:28 +00:00
Jonas Ådahl
fb6e2743ec plugins/default: Hold reference on timelines while stopping
We get implicit, thus auto-removed, transitions, then manage them
manually by stopping them and emitting "completed" signals. This doesn't
work since they are removed and freed when stopped. To be able to emit
the "completed" signal, hold a reference while stopping, so that we
still can emit the signal as before.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/828
2019-10-07 18:33:28 +00:00
Jonas Ådahl
6ee006c851 clutter/actor: Mark implicit transitions as remove-on-complete
Implicit transitions had a referenced taken while emitting the
completion signals, but said reference would only be released if it was
had remove-on-complete set to TRUE.

Change this to instead remove the 'is_implicit' state and mark all
implicit transitions as remove-on-complete. This fixes a
ClutterPropertyTransition leak in gnome-shell triggered by e.g. showing
/ hiding menus.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1740

https://gitlab.gnome.org/GNOME/mutter/merge_requests/828
2019-10-07 18:33:28 +00:00
Carlos Garnacho
107e521553 wayland: Unset pointer constraint in the backend before dropping the grab
Dropping the grab has the side effect that the pointer will be re-picked,
and it might find another surface with a pointer constraint. If that were
the case, the focus change would try to add the pointer constraint before
the now old focus surface released its own.

Just invert these operations, so the constraint is unset before the repick
that might enable another pointer constraint.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/779
2019-10-07 19:37:13 +02:00
Carlos Garnacho
7735a919d1 wayland: Check pointer visibility on post-grab focus changes
Just like sync_focus_surface() does, we shouldn't set a focus surface while
the pointer is hidden, so the illusion that there is none remains.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/779
2019-10-07 19:37:13 +02:00
Carlos Garnacho
9f617ae43d wayland: Warn if a surface is being set while the pointer is invisible
This is an unexpected condition, better not to fall in it without further
indications.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/779
2019-10-07 19:30:09 +02:00
Jonas Ådahl
104bdde746 kms: Predict state changes when processing update
We can't just update the state of the connector and CRTC from KMS since
it might contain too new updates, e.g. from a from a future hot plug. In
order to not add ad-hoc hot plug detection everywhere, predict the state
changes by looking inside the MetaKmsUpdate object, and let the hot-plug
state changes happen after the actual hot-plug event.

This fixes issues where connectors were discovered as disconnected while
doing a mode-set, meaning assumptions about the connectedness of
monitors elsewhere were broken until the hot plug event was processed.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/826
2019-10-07 14:59:18 +00:00
Jonas Ådahl
2a990cc140 kms/update: Add helper to turn fixed point rect into int rect
Currently unused, but will in the following commit.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/826
2019-10-07 14:59:18 +00:00
Jonas Ådahl
3e41568074 kms/update: Add helper to get primary plane assignment
Replaces a private static function, with no functional changes made to
it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/826
2019-10-07 14:59:18 +00:00
Robert Mader
66ae09b670 wayland/subsurface: Check if actor exists before unparenting
When we call the subsurface destructor the actor might be gone already.
Check first, like we do in other places, to avoid warnings.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/829
2019-10-07 08:29:18 +00:00
Dorian Stoll
7b97c7b35e wayland/tablet-tool: Fix stylus input with HiDPI scaling
After commit 75cffd0e ("shaped-texture: Implement ClutterContent"), the
input to the meta_wayland_tablet_tool_get_relative_coordinates function
is already scaled correctly. By scaling it again, all stylus events are
getting mapped to the screen incorrectly (for anything != 100% scaling).

See also: d3f30d9e

https://gitlab.gnome.org/GNOME/mutter/merge_requests/830
2019-10-06 22:30:26 +02:00
Jonas Ådahl
ca318c1520 wayland/actor-surface: Pass actor surface to actor destroy handler
Correct silly mistake where the MetaWaylandSurface was passed as the
user_data of the surface actor destroy signal handler, instead of the
expected MetaWaylandActorSurface.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/844
2019-10-04 13:47:18 +02:00
Jonas Ådahl
cbb4f6c892 wayland/actor-surface: Handle surface actor destruction
A surface actor may be destroyed without the backing Wayland surface
being destroyed yet, e.g. by the window being unmanaged. Handle this by
listening on the "destroy" signal and making late requests (e.g.
wl_surface_commit()) resilient against the lack of a surface actor.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/825
2019-10-03 22:13:25 +00:00
Jonas Ådahl
092b3edb51 wayland/actor-surface: Add actor clear helper
No functional changes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/825
2019-10-03 22:13:25 +00:00
Alan Mortensen
8d6d2d07dd Updated Danish translation 2019-10-03 23:41:50 +02:00
Hans de Goede
fa461525ee window-x11: Refactor meta_prop_get_latin1_string() calls
Instead of storing the result of meta_prop_get_latin1_string() into
a temporary string value, g_strdup-ing that temp value storing the
g_strdup result into window->sm_client_id and then g_free-ing the
temporary string, we can pass window->sm_client_id as the place where
meta_prop_get_latin1_string() stores its result, since the result
from meta_prop_get_latin1_string() is itself a g_strdup-ed string,
so there is no need to g_strdup it again.

Note this drops the check to only issue the
"Window %s sets SM_CLIENT_ID on itself ..." warning once. This check is
not necessary as update_sm_hints() is only called once at window
creation time and is never called again.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/786
2019-10-03 17:20:54 +00:00
Hans de Goede
8e510a07c4 xprops: Use g_new0 instead of malloc in size_hints_from_results()
Switch the memory allocation in size_hints_from_results from a malloc call
without error-checking to g_new0 and adjust the free path accordingly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/786
2019-10-03 17:20:54 +00:00
Hans de Goede
e153524748 xprops: Use g_strdup in class_hint_from_results()
Use g_strdup instead of malloc + strcpy, this also gets rid of a bunch
of error checking which is no longer necessary, also adjust the free
path accordingly.

Note that there was a malloc + XFree mismatch in the removed error-handling.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/786
2019-10-03 17:20:54 +00:00
Hans de Goede
eb8a1f42bc xprops: Use g_new0 instead of calloc in wm_hints_from_results()
Switch the memory allocation in wm_hints_from_results from a calloc call
without error-checking to g_new0 and just the free path accordingly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/786
2019-10-03 17:20:54 +00:00
Hans de Goede
89cd9d382d xprops: Use g_free instead of XFree in text_property_from_results()
results->prop is g_malloc memory so it should be free-ed with g_free not
XFree. The same applies to the return value of text_property_from_results
itself.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/786
2019-10-03 17:20:54 +00:00
Hans de Goede
488991b0f6 xprops: Free counter_list_from_results() return value with g_free()
counter_list_from_results directly passes through the results->prop
pointer which is g_malloc memory, so we should free the buffer it
returns with g_free.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/786
2019-10-03 17:20:54 +00:00
Hans de Goede
e2330617ac xprops: Free latin1/utf8_string_from_results() return value with g_free()
latin1_string_from_results and utf8_string_from_results use g_strndup,
so the returned string should be freed with g_free, rather then with
free or XFree. This fixes all free-s of buffers returned by these 2
functions to properly use g_free.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/786
2019-10-03 17:20:54 +00:00
Hans de Goede
5e6d98e79f xprops: Use g_new0 instead of calloc in meta_prop_get_motif_hints()
Use g_new0 instead of calloc for motif_hints_from_results and adjust
its callers to use g_free.

Note that in the process_request_frame_extents function this replaces
the wrong original mismatch of calloc + XFree with a matching g_malloc +
g_free pair.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/786
2019-10-03 17:20:54 +00:00
Hans de Goede
5eaf655224 xprops: Free meta_prop_get_cardinal_list() return value with g_free()
meta_prop_get_cardinal_list directly passes through the results->prop
pointer which is g_malloc memory, so we should free the buffer it
returns with g_free.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/786
2019-10-03 17:20:54 +00:00
Hans de Goede
2c1553570f xprops: Free atom_list_from_results() return value with g_free()
atom_list_from_results directly passes through the results->prop
pointer which is g_malloc memory, so we should free the buffer it
returns with g_free.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/786
2019-10-03 17:20:54 +00:00
Hans de Goede
c937dd5ba3 xprops: Use meta_XFree instead of XFree in validate_or_free_results()
Use meta_XFree instead of XFree, letting meta_XFree do the NULL
checks for us.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/786
2019-10-03 17:20:54 +00:00
Daniel van Vugt
26b76ee95d clutter/base-types: Clarify docs for point_inside_quadrilateral
The final version of the function was changed to allow points that are
touching the edge of a quadrilateral to be counted as "inside". Update
the function documentation to refect this.

Also clarify that the function is written in such a way that it is
agnostic to clockwise or anticlockwise vertex ordering.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/783
2019-10-03 17:06:28 +00:00
Ting-Wei Lan
006eb6d81e build: Fix build when wayland is disabled
https://gitlab.gnome.org/GNOME/mutter/merge_requests/817
2019-10-03 08:52:44 +00:00
Olivier Fourdan
0cdf13ac12 cogl: Flush journal before blitting
Make sure to submit all pending primitives before blitting, otherwise
rendering from the shell may be incomplete leaving partial drawing of
the shell widgets.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/820
2019-10-03 10:12:21 +02:00
Olivier Fourdan
0a3f25c303 clutter/stage-view: Ignore clipping rectangle for offscreen blit
In `clutter_stage_view_blit_offscreen()`, the given clipping rectangle
is in “view” coordinates whereas we intend to copy the whole actual
framebuffer, meaning that we cannot use the clipping rectangle.

Use the actual framebuffer size, starting at (0, 0) instead.

That fixes the issue with partial repainting with shadow framebuffer
when fractional scaling is enabled.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/820
2019-10-03 10:12:21 +02:00
Marco Trevisan (Treviño)
105a3f757a clutter/actor: Don't emit property changes after ::destroy
Clutter actors might emit property changes in dispose, while unparenting.
However we assume that the ::destroy signal is the last one we emit for an
actor, and that starting from this moment the object is not valid anymore,
and so we don't expect any signal emission from it.

To avoid this, freeze the object notifications on an actor during its
disposition, just before the ::destroy signal emission.

Update the actor-destroy test to verify this behavior.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/769
2019-10-02 17:59:22 +00:00
Marco Trevisan (Treviño)
f376a318ba clutter/actor: Don't emit the parent-set signal on destruction
Clutter actors unset their parent on dispose, after emitting the ::destroy
signal, however this could cause ::parent-set signal emission. Since we
assume that after the destruction has been completed the actor isn't valid
anymore, and that during the destroy phase we do all the signal / source
disconnections, this might create unwanted behaviors, as in the signal
callbacks we always assume that the actor isn't in disposed yet.

To avoid this, don't emit ::parent-set signal if the actor is being
destroyed.

Update the actor-destroy test to verify this behavior.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/769
2019-10-02 17:59:22 +00:00
Olivier Fourdan
4b88c1832a events: Sync pending pointer events without a window
Mutter issues a synchronous grab on the pointer for unfocused client
windows to be able to catch the button events first and raise/focus
client windows accordingly.

When there is a synchronous grab in effect, all events are queued until
the grabbing client releases the event queue as it processes the events.

Mutter does release the events in its event handler function but does so
only if it is able to find the window matching the event. If the window
is a shell widget, that matching may fail and therefore Mutter will not
release the events, hence causing a freeze in pointer events delivery.

To avoid the issue, make sure we sync the pointer events in case we
can't find a matching window.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/821
2019-10-02 17:13:16 +02:00
Ask Hjorth Larsen
fc8aa1cdb1 Updated Danish translation 2019-10-02 05:54:14 +02:00
Jonas Ådahl
7049b2f274 Revert "renderer-native: Actually use shadow fb when using software rendering"
It was not the lack of forcing the shadow fb that caused slowness, but
rather due to the method the shadow fb content was copied onto the
scanout fb. With 'clutter: Use cogl_blit_framebuffer() for shadow FB'
we'll use a path that shouldn't be slow when copying onto the scanout
fb.

Also 437f6b3d59 accidentally enabled
shadow fb when using hw accelerated contexts, due to the cap being set
to 1 in majority of drivers. While the kernel documentation for the
related field says "hint to userspace to prefer shadow-fb rendering",
the name of the hint when exposed to userspace is
DRM_CAP_DUMB_PREFER_SHADOW, thus should only be taken into consideration
for dumb buffers, not rendering in general.

This reverts commit 437f6b3d59.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/818
2019-09-30 11:30:47 +02:00
Adam Jackson
0f51ae7cf0 cogl: Remove unused CoglTextureDriver::prep_gl_for_pixels_upload
https://gitlab.gnome.org/GNOME/mutter/merge_requests/814
2019-09-28 14:50:07 +00:00
Jonas Ådahl
437f6b3d59 renderer-native: Actually use shadow fb when using software rendering
The commit 'renderer/native: Use shadow fb on software GL if preferred'
attempted to force using a shadow fb when using llvmpipe in order to
speed up blending, but instead only did so when llvmpipe AND the drm
device explicityl asked for it.

Now instead always force it for llvmpipe and other software rendering
backends, and otherwise just query the drm device (i.e.
DRM_CAP_DUMB_PREFER_SHADOW).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/807
2019-09-27 21:18:59 +00:00
Olivier Fourdan
05e1a6c2ca clutter/stage-view: Use cogl_blit_framebuffer() for shadow FB
If there is no transformation, use `cogl_blit_framebuffer()` as a
shortcut in `clutter_stage_view_blit_offscreen()`, that dramatically
improves performance when using a shadow framebuffer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/809
2019-09-27 20:47:45 +00:00
Robert Mader
25c1a85384 wayland/dnd-surface: Scale DnD-surface-actor content if necessary
Since the recent clutter-content work, legacy scaling (in contrast
to the new stage-view-scaling) only applies to surfaces that belong
to a window. This broke scaling of DnD surfaces.

As a workaround, apply the same scaling on DnD-surface-actors until
we use stage-view-scaling by default and can remove this again.

Also: small corrections of geometry calculation

https://gitlab.gnome.org/GNOME/mutter/merge_requests/780
2019-09-27 15:48:36 +00:00
Robert Mader
bba8f6c53e wayland/actor-surface: Turn get_geometry_scale() into a vfunc
This allows us to implement more sophisticated logic for the different
cases. For DnD surfaces, use the geometry scale of the monitor where
the pointer is, instead of incorrectly assuming '1' as it was before.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/780
2019-09-27 15:48:36 +00:00
Jonas Ådahl
dbe9daeb76 main: Make process PR_SET_DUMPABLE
Otherwise we won't get core dumps if the launching binary has
capabilities set.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/811
2019-09-27 14:27:09 +00:00
Carlos Garnacho
8fd55fef85 x11: Update focus on the X11 display before the MetaDisplay
The meta_display_update_focus_window() call has indirect dependencies
on the X11 focus window, in order to determine the correct focus window
on the Wayland side (i.e. may turn out NULL with certain X windows).

In order to have the right x11_display->focus_xwindow there, we should
perform first the focus update on the X11 display.

Fixes focusing of Java applications, as those don't seem to go through
_NET_ACTIVE_WINDOW.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/819
2019-09-27 13:52:12 +00:00
Matej Urbančič
acfd03da30 Updated Slovenian translation 2019-09-26 21:31:44 +02:00
Jonas Ådahl
f352c3d79d display: Handle late unredirect (un)inhibit calls
When tearing down, gnome-shell may call various methods a bit late,
specifically while MetaDisplay is closing, after MetaCompositor is
freed.

Handle calls to the fullscreen unredirect inhibitation counters
happening after MetaCompositor tear down by ignoring them. We're closing
anyway, so it's not a problem.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1710

https://gitlab.gnome.org/GNOME/mutter/merge_requests/808
2019-09-26 11:43:00 +02:00
Nathan Follens
4bf0bd3f55 Update Dutch translation 2019-09-25 10:48:45 +00:00
Olivier Fourdan
76f2579e44 keybinding: Check for handler functions as well
With the addition of the locate-pointer special keybinding (defaults to
the [Control] key), we have now two separate special modifier keys which
can be triggered separately, one for the locate-pointer action and
another one for overlay.

When processing those special modifier keys, mutter must ensure that the
key was pressed alone, being a modifier, the key could otherwise be part
of another key combo.

As result, if both special modifiers keys are pressed simultaneously,
mutter will try to trigger the function for the second key being
pressed, and since those special modifier keys have no default handler
function set, that will crash mutter.

Check if the handler has a function associated and treat the keybinding
as not found if no handler function is set, as with the special modifier
keys.

https://gitlab.gnome.org/GNOME/mutter/issues/823
2019-09-24 17:08:20 +02:00
Olivier Fourdan
0706e021f5 keybindings: Check for a handler before using it
The `process_event()` would check for a existing keybinding handler and
abort if there is none, however the test is done after the handler had
been accessed, hence defeating the purpose of the check.

Move the check to verify there is an existing keybinding handler before
actually using it.

https://gitlab.gnome.org/GNOME/mutter/issues/823
2019-09-24 17:08:20 +02:00
Robert Mader
b5775e3d85 window-actor: Use surface coordinates for the fast path in get_image()
shaped_texture requires the clip to be in surface coordinates. Scale
it accordingly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/758
2019-09-20 16:42:55 +00:00
Robert Mader
cd70595b50 shaped-texture: Use surface coordinates in get_image()
There were multiple bugs present after the ClutterContent transition.
Refactor `get_image` to:

- always assume surface coordinates for the clip
- return a cairo_surface in buffer size
- make the offscreen path take size arguments, so we can
easily change the assumption in get_image
- fix some clipping bugs on the way

https://gitlab.gnome.org/GNOME/mutter/merge_requests/758
2019-09-20 16:42:55 +00:00
Marco Trevisan (Treviño)
1d2913d9b9 shaped-texture: Declare that we inherit from GObject
As per commit 75cffd0ec MetaShapedTexture is a GObject implementing the Clutter
Content interface.

Reflect this on the type declaration.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/796
2019-09-20 15:03:52 +00:00
Marco Trevisan (Treviño)
b8a49a682e window/surface-actor: Add docstrings
Redefine the docstring for functions using shaped texture, setting the clip
as nullable.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/79
2019-09-20 15:03:52 +00:00
Marco Trevisan (Treviño)
82901f89d5 shaped-texture: Mark set the clip and return value nullable
As per the code definition the clip can be a null rectangle, and we can also
return a null surface, so mark them as nullable in the introspection.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/796
2019-09-20 15:03:52 +00:00
Marco Trevisan (Treviño)
c9c53cb55f clutter/actor: Cancel delayed timelines on removal
Delayed clutter timelines might be removed while they are still in the
process of being executed, but if they are not playing yet their delay
timeout won't be stopped, causing them to be executed anyway, leading to a
potential crash.

In fact if something else keeps a reference on the timelines (i.e. gjs), the
dispose vfunc delay cancellation won't take effect, causing the timelines to
be started and added to the master clock.

To avoid this, expose clutter_timeline_cancel_delay() function and call it
if a timeline is not playing but has a delay set.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/815
https://gitlab.gnome.org/GNOME/mutter/merge_requests/805
2019-09-20 16:51:20 +02:00
Marco Trevisan (Treviño)
1e637bd7e1 clutter/timeline: Don't emit ::paused signal on delayed timelines
If a timeline is delayed and we request to stop or pause it, we are emitting
the "::paused" signal on it, however this has never been started, and so
nothing has really be paused.

So, just try to cancel the delay on pause and return if not playing.

No code in mutter or gnome-shell is affected by this, so it is safe to
change.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/805
2019-09-20 16:51:20 +02:00
Marco Trevisan (Treviño)
63a0b702c9 clutter/timeline: Use a function to cancel the delay timeout
Avoid repeating the same code for canceling the delay timeout, using a
function for later uses.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/805
2019-09-20 16:51:20 +02:00
Adam Jackson
031003a5dc wayland/dma-buf: Handle zero modifiers from eglQueryDmaBufModifiersEXT
Some drivers expose EGL_EXT_image_dma_buf_import_modifiers so you can
query supported formats, but don't support any modifiers. Handle this by
treating it like DRM_FORMAT_MOD_INVALID.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/782
2019-09-20 12:09:13 +00:00
Marco Trevisan (Treviño)
b69d2aa6a0 stage: Compute view perspective when parameters changed
Clutter stage used to compute the initial projection using a fixed z
translation which wasn't matching the one we computed in
calculate_z_translation().
This caused to have a wrong initial projection on startup which was then
correctly recomputed only at the first paint.

However, since this calculation doesn't depend on view, but only on viewport
size, perspective's fovy and z_near we can safely do this at startup and
only when any of those parameters change.

Then we can move the computation out _clutter_stage_maybe_setup_viewport()
since the cogl framebuffer viewport sizes aren't affecting this.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1639
https://gitlab.gnome.org/GNOME/mutter/merge_requests/803
2019-09-20 13:51:33 +02:00
Iain Lane
d7d2612218 build: Compile with -ffloat-store on x86 (32 bit)
GCC's manpage says that this flag does the following:

  Do not store floating-point variables in registers, and inhibit other
  options that might change whether a floating-point value is taken from
  a register or memory.

  This option prevents undesirable excess precision on machines such as
  the 68000 where the floating registers (of the 68881) keep more
  precision than a "double" is supposed to have.  Similarly for the x86
  architecture.  For most programs, the excess precision does only good,
  but a few programs rely on the precise definition of IEEE floating
  point.

We rely on this behaviour in our fork of clutter. When performing
floating point computations on x86, we are getting the wrong results
because of this architecture's use of the CPU's extended (x87, non-IEEE
confirming) precision by default. If we enable `-ffloat-store` here,
then we'll get the same results everywhere by storing into variables
instead of registers. This does not remove the need to be correct when
handling floats, but it does mean we don't need to be more correct than
the IEEE spec requires.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/785
2019-09-20 10:06:36 +00:00
Daniel van Vugt
7a0340c57d kms-impl-device: Use portable formatting for 64-bit integers
On 64-bit systems uint64_t is %lu but on 32-bit systems it is %llu.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/778
2019-09-20 11:55:49 +02:00
Daniel van Vugt
0863bd2408 output-kms: Use portable formatting for 64-bit integers
On 64-bit systems uint64_t is %lu but on 32-bit systems it is %llu.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/778
2019-09-20 11:55:42 +02:00
Daniel van Vugt
594cc7c7d6 input-settings: Use portable formatting for 64-bit integers
On 64-bit systems int64_t is %lx but on 32-bit systems it is %llx.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/778
2019-09-20 11:55:35 +02:00
Daniel van Vugt
0b19078b2b clutter/stage-cogl: Use portable formatting for 64-bit integers
On 64-bit systems int64_t is %ld but on 32-bit systems it is %lld.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/778
2019-09-20 11:55:32 +02:00
Daniel van Vugt
7811865e84 clutter/paint-node: Convert safely from pointer to integer
To support 32-bit systems without compiler warnings.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/778
2019-09-20 11:55:25 +02:00
Jonas Ådahl
0e69fe0781 idle-monitor: Reset timeout before firing watch
The watch might be removed during firing, meaning the source is
destroyed after returning. Avoid use-after-free by unsetting the timeout
before firing. Returning G_SOURCE_CONTINUE in that case is harmless, as
source is destroyed.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/799
2019-09-16 18:08:18 +00:00
Jonas Ådahl
26b08d87a8 idle-monitor: Remove redundant type cast
No need to type cast a `MetaIdleMonitorWatch *` to a
`MetaIdleMonitorWatch *`.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/799
2019-09-16 18:08:18 +00:00
Jonas Ådahl
321ab3b367 idle-monitor: Make helper function static
It wasn't used outside the file, so no reason to not have it static.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/799
2019-09-16 18:08:18 +00:00
Michal Lazo
4d0869e206 kms-device: Free path when finalizing
free path in finalize

https://gitlab.gnome.org/GNOME/mutter/merge_requests/775
2019-09-16 16:41:46 +00:00
Michal Lazo
d13cea6ccb kms-device: Handle impl device creation failure
Properly free kms-device in case of invalid initialization

https://gitlab.gnome.org/GNOME/mutter/merge_requests/772
2019-09-16 16:34:39 +00:00
Carlos Garnacho
6922f0e16a x11: Minor refactor of input focus handling code
Instead of open coding the X11 focus management in display.c, expose
it as a single function with similar arguments to its MetaDisplay
counterpart. This just means less X11 specifics in display.c.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/751
2019-09-13 20:55:57 +00:00
Carlos Garnacho
31df06d94e x11: Use the currently focused X window for _NET_ACTIVE_WINDOW
MetaDisplay and MetaX11Display focus windows are slightly decoupled,
we cannot rely here on the MetaDisplay focus to be updated yet. We
however know the X Window that got focused, so lookup the corresponding
MetaWindow (and client X window) from it.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/751
2019-09-13 20:55:56 +00:00
Jonas Ådahl
ecec9a7eaa cogl/egl: Just notify about failure to create high priority context
Warning about it causes test case failures if there are not enough
privileges, which is likely when running the test suite locally.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/797
2019-09-13 09:47:00 +02:00
Jonas Dreßler
ab7af2d0c5 clutter/actor: Remove unused private function
`_clutter_actor_get_transition` is almost identical to
`clutter_actor_get_transition` and isn't used anywhere in the code (we
stopped using it with ee00e37b), remove it!

https://gitlab.gnome.org/GNOME/mutter/merge_requests/791
2019-09-12 21:36:02 +00:00
Jonas Dreßler
f92e0bec0b clutter/actor: Fix a wrong comment
According to the definition of ClutterAnimationInfo in
clutter-actor-private.h, `transitions` is the third variable of the
struct, not the first one.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/791
2019-09-12 21:36:02 +00:00
Georges Basile Stavracas Neto
7a22f6fd3f Fix a few tracing typos
They are missing the closing parenthesis. Add them.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/795
2019-09-12 14:30:44 -03:00
Carlos Garnacho
850ef51879 core: Split x11-display initialization in 2 signals
We have a "setup" phase, used internally to initialize early the x11
side of things like the stack tracker, and an "opened" phase where
other upper parts may hook up to. This latter phase is delayed during
initialization so the upper parts have a change to connect to on
plugin creation.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/771
2019-09-11 22:30:13 +02:00
Jonas Ådahl
ef2e04a613 plugins/default: Get default keymap from localed
When starting standalone mutter and running using the native backend, we
always fall back on using the us pc105 keyboard layout. This can be very
frustrating if one is used to using some other keyboard layout, such as
dvorak, causing keyboard fumbling everytime when doing something with
standalone mutter.

Avoid this involuntary fumbling by having the default plugin query
localed what layout the user has actually configured the machine to
operate using. It doesn't add any keymap selection user interface, so
it'll always use the first one it encounters.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/787
2019-09-10 20:09:40 +00:00
Milo Casagrande
e16b75a0b7 Update Italian translation 2019-09-10 08:57:05 +00:00
430 changed files with 7243 additions and 17996 deletions

View File

@@ -1,4 +1,4 @@
image: registry.gitlab.gnome.org/gnome/mutter/master:v2 image: registry.gitlab.gnome.org/gnome/mutter/master:v3
stages: stages:
- review - review
@@ -28,10 +28,10 @@ build-mutter:
- merge_requests - merge_requests
- /^.*$/ - /^.*$/
build-without-native-backend: build-without-native-backend-and-wayland:
stage: build stage: build
script: script:
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false --werror --prefix /usr - meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false -Dwayland=false -Dcore_tests=false --werror --prefix /usr
- ninja -C build - ninja -C build
- ninja -C build install - ninja -C build install
artifacts: artifacts:

View File

@@ -1,39 +1,28 @@
# Rebuild and push with # Rebuild and push with
# #
# cd .gitlab-ci/ # cd .gitlab-ci/
# docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v2 . # docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v3 .
# docker push registry.gitlab.gnome.org/gnome/mutter/master:v2 # docker push registry.gitlab.gnome.org/gnome/mutter/master:v3
# #
FROM fedora:30 FROM fedora:31
RUN dnf -y update && dnf -y upgrade && \ RUN dnf -y update && dnf -y upgrade && \
dnf install -y 'dnf-command(builddep)' && \ dnf install -y 'dnf-command(builddep)' && \
dnf install -y 'dnf-command(copr)' && \ dnf install -y 'dnf-command(copr)' && \
dnf copr enable -y fmuellner/gnome-shell-ci && \ dnf copr enable -y fmuellner/gnome-shell-ci && \
dnf copr enable -y jadahl/mutter-ci && \
dnf copr enable -y hergertme/sysprof-3 && \
dnf -y update && dnf -y upgrade && \ dnf -y update && dnf -y upgrade && \
dnf builddep -y mutter && \ dnf builddep -y mutter && \
# Until Fedora catches up with meson build-deps # Until Fedora catches up with new build-deps
dnf install -y meson xorg-x11-server-Xorg gnome-settings-daemon-devel egl-wayland-devel xorg-x11-server-Xwayland && \ dnf install -y 'pkgconfig(graphene-gobject-1.0)' 'pkgconfig(sysprof-capture-3)' 'pkgconfig(libcap-ng)' && \
# Until Fedora catches up with mesa bug fixes
dnf upgrade -y mesa-dri-drivers mesa-libEGL && \
# For running unit tests # For running unit tests
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs && \ dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs gnome-control-center && \
dnf install -y sysprof-devel && \
dnf install -y intltool redhat-rpm-config make && \
# GNOME Shell # GNOME Shell
dnf builddep -y gnome-shell --setopt=install_weak_deps=False && \ dnf builddep -y gnome-shell --setopt=install_weak_deps=False && \
# New dep this cycle
dnf install -y 'pkgconfig(gnome-autoar-0)' && \
dnf remove -y gnome-bluetooth-libs-devel dbus-glib-devel upower-devel python3-devel && \ dnf remove -y gnome-bluetooth-libs-devel dbus-glib-devel upower-devel python3-devel && \
dnf remove -y --noautoremove mutter mutter-devel && \ dnf remove -y --noautoremove mutter mutter-devel && \

View File

@@ -40,11 +40,12 @@ function commit_message_subject_is_compliant() {
return 0 return 0
} }
RET=0
for commit in $commits; do for commit in $commits; do
commit_short=$(echo $commit | cut -c -8) commit_short=$(echo $commit | cut -c -8)
if ! commit_message_has_url $commit; then if ! commit_message_has_url $commit; then
echo "Missing merge request or issue URL on commit $commit_short" echo "Commit $commit_short needs a merge request or issue URL"
exit 1 exit 1
fi fi
@@ -52,6 +53,8 @@ for commit in $commits; do
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "Commit message for $commit_short is not compliant:" echo "Commit message for $commit_short is not compliant:"
echo "$errors" echo "$errors"
exit 1 RET=1
fi fi
done done
exit $RET

View File

@@ -1,6 +1,5 @@
#!/usr/bin/bash #!/usr/bin/bash
mutter_branch=$(git describe --contains --all HEAD)
gnome_shell_target= gnome_shell_target=
git clone https://gitlab.gnome.org/GNOME/gnome-shell.git git clone https://gitlab.gnome.org/GNOME/gnome-shell.git
@@ -26,8 +25,7 @@ if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
fi fi
if [ -z "$gnome_shell_target" ]; then if [ -z "$gnome_shell_target" ]; then
gnome_shell_target=$(git branch -r -l origin/$mutter_branch) gnome_shell_target=$(git branch -r -l origin/$CI_COMMIT_REF_NAME)
gnome_shell_target=${gnome_shell_target:-$(git branch -r -l ${mutter_branch#remotes/})}
gnome_shell_target=${gnome_shell_target:-origin/master} gnome_shell_target=${gnome_shell_target:-origin/master}
echo Using $gnome_shell_target instead echo Using $gnome_shell_target instead
fi fi

45
NEWS
View File

@@ -1,3 +1,48 @@
3.35.1
======
* Fix immediate screen blank after releaseing inhibitor [Tim; #573]
* Respond to frame callbacks regardless of damage [Jonas; !839]
* selection [Carlos; !842]
* Fix Night Light on wayland [Jonas; !840]
* Fix various copy+paste/DND regressions [Carlos; !848, #789, #842,
#793, #845, #854]
* Misc. bug fixes and cleanups [Daniel, Marco, Jonas, Georges;
!841, !764, !837, !846]
Contributors:
Marco Trevisan (Treviño), Carlos Garnacho, Tim Klocke,
Georges Basile Stavracas Neto, Daniel van Vugt, Jonas Ådahl
3.34.1
======
* Fix startup of X11 session services on wayland [Carlos; #771]
* Fix _NET_ACTIVE_WINDOW emission [Carlos; #751]
* Fix initial view perspective [Marco; !803]
* Fix screenshots and window animations when scaled [Robert; !758]
* Re-enable coredumps when capabilities are set [Jonas; !811]
* Fix scaling of DND surface actors [Robert; !780]
* Optimize blitting of untransformed offscreen stage views [Olivier; !809, !820]
* Fix freeze of pointer event delivery on X11 [Olivier; !821]
* Fix scaling of stylus input coordinates with HiDPI [Dorian; !830]
* Fix memory leak when using implicit animations [Jonas; !828]
* Fix numlock state for native backend [Carlos; #769]
* Fixed crashes [Marco, Olivier, Jonas Å.; !805, #823, !808, !825,
#844, !826, #779]
* Misc. bug fixes and cleanups [Jonas Å., Georges, Jonas D., Michal, Daniel,
Iain, Adam, Marco, Carlos, Ting-Wei, Hans, Robert; !787, !795, !791, !797,
!772, !775, !799, !778, !785, !782, !796, #819, !814, !769, !817, !783, !786,
!829, !774, #822]
Contributors:
Marco Trevisan (Treviño), Jonas Dreßler, Olivier Fourdan, Carlos Garnacho,
Hans de Goede, Adam Jackson, Ting-Wei Lan, Iain Lane, Michal Lazo,
Robert Mader, Georges Basile Stavracas Neto, Dorian Stoll, Daniel van Vugt,
Jonas Ådahl
Translators:
Milo Casagrande [it], Nathan Follens [nl], Matej Urbančič [sl],
Ask Hjorth Larsen [da], Alan Mortensen [da], Jordi Mas [ca]
3.34.0 3.34.0
====== ======
* Fix xdg-output v3 support [Olivier; !771] * Fix xdg-output v3 support [Olivier; !771]

View File

@@ -657,7 +657,7 @@ cally_actor_get_extents (AtkComponent *component,
ClutterActor *actor = NULL; ClutterActor *actor = NULL;
gint top_level_x, top_level_y; gint top_level_x, top_level_y;
gfloat f_width, f_height; gfloat f_width, f_height;
ClutterVertex verts[4]; graphene_point3d_t verts[4];
ClutterActor *stage = NULL; ClutterActor *stage = NULL;
g_return_if_fail (CALLY_IS_ACTOR (component)); g_return_if_fail (CALLY_IS_ACTOR (component));

View File

@@ -1438,7 +1438,7 @@ static void cally_text_get_character_extents (AtkText *text,
PangoLayout *layout; PangoLayout *layout;
PangoRectangle extents; PangoRectangle extents;
const gchar *text_value; const gchar *text_value;
ClutterVertex verts[4]; graphene_point3d_t verts[4];
actor = CALLY_GET_CLUTTER_ACTOR (text); actor = CALLY_GET_CLUTTER_ACTOR (text);
if (actor == NULL) /* State is defunct */ if (actor == NULL) /* State is defunct */
@@ -2294,7 +2294,7 @@ _cally_misc_get_index_at_point (ClutterText *clutter_text,
gint index, x_window, y_window, x_toplevel, y_toplevel; gint index, x_window, y_window, x_toplevel, y_toplevel;
gint x_temp, y_temp; gint x_temp, y_temp;
gboolean ret; gboolean ret;
ClutterVertex verts[4]; graphene_point3d_t verts[4];
PangoLayout *layout; PangoLayout *layout;
gint x_layout, y_layout; gint x_layout, y_layout;

View File

@@ -340,7 +340,7 @@ clutter_actor_box_contains (const ClutterActorBox *box,
/** /**
* clutter_actor_box_from_vertices: * clutter_actor_box_from_vertices:
* @box: a #ClutterActorBox * @box: a #ClutterActorBox
* @verts: (array fixed-size=4): array of four #ClutterVertex * @verts: (array fixed-size=4): array of four #graphene_point3d_t
* *
* Calculates the bounding box represented by the four vertices; for details * Calculates the bounding box represented by the four vertices; for details
* of the vertex array see clutter_actor_get_abs_allocation_vertices(). * of the vertex array see clutter_actor_get_abs_allocation_vertices().
@@ -348,8 +348,8 @@ clutter_actor_box_contains (const ClutterActorBox *box,
* Since: 1.0 * Since: 1.0
*/ */
void void
clutter_actor_box_from_vertices (ClutterActorBox *box, clutter_actor_box_from_vertices (ClutterActorBox *box,
const ClutterVertex verts[]) const graphene_point3d_t verts[])
{ {
gfloat x_1, x_2, y_1, y_2; gfloat x_1, x_2, y_1, y_2;

View File

@@ -135,7 +135,7 @@ struct _AnchorCoord
} fraction; } fraction;
/* Use when is_fractional == FALSE */ /* Use when is_fractional == FALSE */
ClutterVertex units; graphene_point3d_t units;
} v; } v;
}; };
@@ -163,7 +163,7 @@ struct _SizeRequest
struct _ClutterLayoutInfo struct _ClutterLayoutInfo
{ {
/* fixed position coordinates */ /* fixed position coordinates */
ClutterPoint fixed_pos; graphene_point_t fixed_pos;
ClutterMargin margin; ClutterMargin margin;
@@ -173,8 +173,8 @@ struct _ClutterLayoutInfo
guint x_expand : 1; guint x_expand : 1;
guint y_expand : 1; guint y_expand : 1;
ClutterSize minimum; graphene_size_t minimum;
ClutterSize natural; graphene_size_t natural;
}; };
const ClutterLayoutInfo * _clutter_actor_get_layout_info_or_defaults (ClutterActor *self); const ClutterLayoutInfo * _clutter_actor_get_layout_info_or_defaults (ClutterActor *self);
@@ -203,13 +203,13 @@ struct _ClutterTransformInfo
AnchorCoord anchor; AnchorCoord anchor;
/* translation */ /* translation */
ClutterVertex translation; graphene_point3d_t translation;
/* z_position */ /* z_position */
gfloat z_position; gfloat z_position;
/* transformation center */ /* transformation center */
ClutterPoint pivot; graphene_point_t pivot;
gfloat pivot_z; gfloat pivot_z;
CoglMatrix transform; CoglMatrix transform;
@@ -242,9 +242,6 @@ ClutterAnimationInfo * _clutter_actor_get_animation_info
ClutterTransition * _clutter_actor_create_transition (ClutterActor *self, ClutterTransition * _clutter_actor_create_transition (ClutterActor *self,
GParamSpec *pspec, GParamSpec *pspec,
...); ...);
ClutterTransition * _clutter_actor_get_transition (ClutterActor *self,
GParamSpec *pspec);
gboolean _clutter_actor_foreach_child (ClutterActor *self, gboolean _clutter_actor_foreach_child (ClutterActor *self,
ClutterForeachCallback callback, ClutterForeachCallback callback,
gpointer user_data); gpointer user_data);
@@ -277,6 +274,9 @@ void _clutter_actor_set_enable_paint_unmapped
void _clutter_actor_set_has_pointer (ClutterActor *self, void _clutter_actor_set_has_pointer (ClutterActor *self,
gboolean has_pointer); gboolean has_pointer);
void _clutter_actor_set_has_key_focus (ClutterActor *self,
gboolean has_key_focus);
void _clutter_actor_queue_redraw_with_clip (ClutterActor *self, void _clutter_actor_queue_redraw_with_clip (ClutterActor *self,
ClutterRedrawFlags flags, ClutterRedrawFlags flags,
const ClutterPaintVolume *clip_volume); const ClutterPaintVolume *clip_volume);

File diff suppressed because it is too large Load Diff

View File

@@ -233,8 +233,7 @@ struct _ClutterActorClass
ClutterActor *old_parent); ClutterActor *old_parent);
void (* destroy) (ClutterActor *self); void (* destroy) (ClutterActor *self);
void (* pick) (ClutterActor *actor, void (* pick) (ClutterActor *actor);
const ClutterColor *color);
gboolean (* queue_redraw) (ClutterActor *actor, gboolean (* queue_redraw) (ClutterActor *actor,
ClutterActor *leaf_that_queued, ClutterActor *leaf_that_queued,
@@ -354,6 +353,10 @@ void clutter_actor_paint
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_continue_paint (ClutterActor *self); void clutter_actor_continue_paint (ClutterActor *self);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_pick (ClutterActor *actor);
CLUTTER_EXPORT
void clutter_actor_continue_pick (ClutterActor *actor);
CLUTTER_EXPORT
void clutter_actor_queue_redraw (ClutterActor *self); void clutter_actor_queue_redraw (ClutterActor *self);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_queue_redraw_with_clip (ClutterActor *self, void clutter_actor_queue_redraw_with_clip (ClutterActor *self,
@@ -431,7 +434,7 @@ void clutter_actor_get_allocation_box
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_get_allocation_vertices (ClutterActor *self, void clutter_actor_get_allocation_vertices (ClutterActor *self,
ClutterActor *ancestor, ClutterActor *ancestor,
ClutterVertex verts[]); graphene_point3d_t *verts);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_actor_has_allocation (ClutterActor *self); gboolean clutter_actor_has_allocation (ClutterActor *self);
CLUTTER_EXPORT CLUTTER_EXPORT
@@ -817,16 +820,16 @@ gboolean clutter_actor_transform_stage_point
gfloat *y_out); gfloat *y_out);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_get_abs_allocation_vertices (ClutterActor *self, void clutter_actor_get_abs_allocation_vertices (ClutterActor *self,
ClutterVertex verts[]); graphene_point3d_t *verts);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_apply_transform_to_point (ClutterActor *self, void clutter_actor_apply_transform_to_point (ClutterActor *self,
const ClutterVertex *point, const graphene_point3d_t *point,
ClutterVertex *vertex); graphene_point3d_t *vertex);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_apply_relative_transform_to_point (ClutterActor *self, void clutter_actor_apply_relative_transform_to_point (ClutterActor *self,
ClutterActor *ancestor, ClutterActor *ancestor,
const ClutterVertex *point, const graphene_point3d_t *point,
ClutterVertex *vertex); graphene_point3d_t *vertex);
/* Implicit animations */ /* Implicit animations */
CLUTTER_EXPORT CLUTTER_EXPORT

View File

@@ -93,10 +93,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMatrix, clutter_matrix_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPoint, clutter_point_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterRect, clutter_rect_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterSize, clutter_size_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterVertex, clutter_vertex_free)
#endif /* __GI_SCANNER__ */ #endif /* __GI_SCANNER__ */

View File

@@ -627,7 +627,7 @@ clutter_backend_init (ClutterBackend *self)
self->units_per_em = -1.0; self->units_per_em = -1.0;
self->units_serial = 1; self->units_serial = 1;
self->dummy_onscreen = COGL_INVALID_HANDLE; self->dummy_onscreen = NULL;
} }
void void
@@ -1012,7 +1012,7 @@ _clutter_backend_get_keymap_direction (ClutterBackend *backend)
void void
_clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend) _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
{ {
if (backend->dummy_onscreen == COGL_INVALID_HANDLE) if (backend->dummy_onscreen == NULL)
{ {
GError *internal_error = NULL; GError *internal_error = NULL;

File diff suppressed because it is too large Load Diff

View File

@@ -152,7 +152,9 @@ clutter_bind_constraint_update_allocation (ClutterConstraint *constraint,
ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (constraint); ClutterBindConstraint *bind = CLUTTER_BIND_CONSTRAINT (constraint);
gfloat source_width, source_height; gfloat source_width, source_height;
gfloat actor_width, actor_height; gfloat actor_width, actor_height;
ClutterVertex source_position = { 0., }; graphene_point3d_t source_position;
source_position = GRAPHENE_POINT3D_INIT (0.f, 0.f, 0.f);
if (bind->source == NULL) if (bind->source == NULL)
return; return;

View File

@@ -182,7 +182,7 @@ clutter_blur_effect_modify_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume) ClutterPaintVolume *volume)
{ {
gfloat cur_width, cur_height; gfloat cur_width, cur_height;
ClutterVertex origin; graphene_point3d_t origin;
clutter_paint_volume_get_origin (volume, &origin); clutter_paint_volume_get_origin (volume, &origin);
cur_width = clutter_paint_volume_get_width (volume); cur_width = clutter_paint_volume_get_width (volume);

View File

@@ -118,37 +118,6 @@ container_real_remove (ClutterContainer *container,
clutter_actor_remove_child (CLUTTER_ACTOR (container), actor); clutter_actor_remove_child (CLUTTER_ACTOR (container), actor);
} }
typedef struct {
ClutterCallback callback;
gpointer data;
} ForeachClosure;
static gboolean
foreach_cb (ClutterActor *actor,
gpointer data)
{
ForeachClosure *clos = data;
clos->callback (actor, clos->data);
return TRUE;
}
static void
container_real_foreach (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data)
{
ForeachClosure clos;
clos.callback = callback;
clos.data = user_data;
_clutter_actor_foreach_child (CLUTTER_ACTOR (container),
foreach_cb,
&clos);
}
static void static void
container_real_raise (ClutterContainer *container, container_real_raise (ClutterContainer *container,
ClutterActor *child, ClutterActor *child,
@@ -243,7 +212,6 @@ clutter_container_default_init (ClutterContainerInterface *iface)
iface->add = container_real_add; iface->add = container_real_add;
iface->remove = container_real_remove; iface->remove = container_real_remove;
iface->foreach = container_real_foreach;
iface->raise = container_real_raise; iface->raise = container_real_raise;
iface->lower = container_real_lower; iface->lower = container_real_lower;
iface->sort_depth_order = container_real_sort_depth_order; iface->sort_depth_order = container_real_sort_depth_order;
@@ -533,15 +501,6 @@ clutter_container_remove_valist (ClutterContainer *container,
container_remove_valist (container, first_actor, var_args); container_remove_valist (container, first_actor, var_args);
} }
static void
get_children_cb (ClutterActor *child,
gpointer data)
{
GList **children = data;
*children = g_list_prepend (*children, child);
}
/** /**
* clutter_container_get_children: * clutter_container_get_children:
* @container: a #ClutterContainer * @container: a #ClutterContainer
@@ -559,108 +518,9 @@ get_children_cb (ClutterActor *child,
GList * GList *
clutter_container_get_children (ClutterContainer *container) clutter_container_get_children (ClutterContainer *container)
{ {
GList *retval;
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL); g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
retval = NULL; return clutter_actor_get_children (CLUTTER_ACTOR (container));
clutter_container_foreach (container, get_children_cb, &retval);
return g_list_reverse (retval);
}
/**
* clutter_container_foreach:
* @container: a #ClutterContainer
* @callback: (scope call): a function to be called for each child
* @user_data: data to be passed to the function, or %NULL
*
* Calls @callback for each child of @container that was added
* by the application (with clutter_container_add_actor()). Does
* not iterate over "internal" children that are part of the
* container's own implementation, if any.
*
* This function calls the #ClutterContainerIface.foreach()
* virtual function, which has been deprecated.
*
* Since: 0.4
*
* Deprecated: 1.10: Use clutter_actor_get_first_child() or
* clutter_actor_get_last_child() to retrieve the beginning of
* the list of children, and clutter_actor_get_next_sibling()
* and clutter_actor_get_previous_sibling() to iterate over it;
* alternatively, use the #ClutterActorIter API.
*/
void
clutter_container_foreach (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data)
{
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (callback != NULL);
#ifdef CLUTTER_ENABLE_DEBUG
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
{
ClutterContainerIface *iface = CLUTTER_CONTAINER_GET_IFACE (container);
if (iface->foreach != container_real_foreach)
_clutter_diagnostic_message ("The ClutterContainer::foreach() "
"virtual function has been deprecated "
"and it should not be overridden by "
"newly written code");
}
#endif /* CLUTTER_ENABLE_DEBUG */
CLUTTER_CONTAINER_GET_IFACE (container)->foreach (container,
callback,
user_data);
}
/**
* clutter_container_foreach_with_internals:
* @container: a #ClutterContainer
* @callback: (scope call): a function to be called for each child
* @user_data: data to be passed to the function, or %NULL
*
* Calls @callback for each child of @container, including "internal"
* children built in to the container itself that were never added
* by the application.
*
* This function calls the #ClutterContainerIface.foreach_with_internals()
* virtual function, which has been deprecated.
*
* Since: 1.0
*
* Deprecated: 1.10: See clutter_container_foreach().
*/
void
clutter_container_foreach_with_internals (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data)
{
ClutterContainerIface *iface;
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (callback != NULL);
iface = CLUTTER_CONTAINER_GET_IFACE (container);
#ifdef CLUTTER_ENABLE_DEBUG
if (G_UNLIKELY (_clutter_diagnostic_enabled ()))
{
if (iface->foreach_with_internals != NULL)
_clutter_diagnostic_message ("The ClutterContainer::foreach_with_internals() "
"virtual function has been deprecated "
"and it should not be overridden by "
"newly written code");
}
#endif /* CLUTTER_ENABLE_DEBUG */
if (iface->foreach_with_internals != NULL)
iface->foreach_with_internals (container, callback, user_data);
else
iface->foreach (container, callback, user_data);
} }
/** /**

View File

@@ -59,14 +59,6 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
* function is deprecated, and it should not be overridden. * function is deprecated, and it should not be overridden.
* @remove: virtual function for removing an actor from the container. This * @remove: virtual function for removing an actor from the container. This
* virtual function is deprecated, and it should not be overridden. * virtual function is deprecated, and it should not be overridden.
* @foreach: virtual function for iterating over the container's children.
* This virtual function is deprecated, and it should not be overridden.
* @foreach_with_internals: virtual functions for iterating over the
* container's children, both added using the #ClutterContainer API
* and internal children. The implementation of this virtual function
* is required only if the #ClutterContainer implementation has
* internal children. This virtual function is deprecated, and it should
* not be overridden.
* @raise: virtual function for raising a child. This virtual function is * @raise: virtual function for raising a child. This virtual function is
* deprecated and it should not be overridden. * deprecated and it should not be overridden.
* @lower: virtual function for lowering a child. This virtual function is * @lower: virtual function for lowering a child. This virtual function is
@@ -88,7 +80,7 @@ typedef struct _ClutterContainerIface ClutterContainerIface;
* @actor_removed: class handler for #ClutterContainer::actor-removed * @actor_removed: class handler for #ClutterContainer::actor-removed
* @child_notify: class handler for #ClutterContainer::child-notify * @child_notify: class handler for #ClutterContainer::child-notify
* *
* Base interface for container actors. The @add, @remove and @foreach * Base interface for container actors. The @add and @remove
* virtual functions must be provided by any implementation; the other * virtual functions must be provided by any implementation; the other
* virtual functions are optional. * virtual functions are optional.
* *
@@ -104,13 +96,6 @@ struct _ClutterContainerIface
ClutterActor *actor); ClutterActor *actor);
void (* remove) (ClutterContainer *container, void (* remove) (ClutterContainer *container,
ClutterActor *actor); ClutterActor *actor);
void (* foreach) (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data);
void (* foreach_with_internals) (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data);
/* child stacking */ /* child stacking */
void (* raise) (ClutterContainer *container, void (* raise) (ClutterContainer *container,

View File

@@ -6,45 +6,6 @@
G_BEGIN_DECLS G_BEGIN_DECLS
typedef enum
{
CLUTTER_DEBUG_MISC = 1 << 0,
CLUTTER_DEBUG_ACTOR = 1 << 1,
CLUTTER_DEBUG_TEXTURE = 1 << 2,
CLUTTER_DEBUG_EVENT = 1 << 3,
CLUTTER_DEBUG_PAINT = 1 << 4,
CLUTTER_DEBUG_PANGO = 1 << 5,
CLUTTER_DEBUG_BACKEND = 1 << 6,
CLUTTER_DEBUG_SCHEDULER = 1 << 7,
CLUTTER_DEBUG_SCRIPT = 1 << 8,
CLUTTER_DEBUG_SHADER = 1 << 9,
CLUTTER_DEBUG_MULTISTAGE = 1 << 10,
CLUTTER_DEBUG_ANIMATION = 1 << 11,
CLUTTER_DEBUG_LAYOUT = 1 << 12,
CLUTTER_DEBUG_PICK = 1 << 13,
CLUTTER_DEBUG_EVENTLOOP = 1 << 14,
CLUTTER_DEBUG_CLIPPING = 1 << 15,
CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16
} ClutterDebugFlag;
typedef enum
{
CLUTTER_DEBUG_NOP_PICKING = 1 << 0,
} ClutterPickDebugFlag;
typedef enum
{
CLUTTER_DEBUG_DISABLE_SWAP_EVENTS = 1 << 0,
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS = 1 << 1,
CLUTTER_DEBUG_REDRAWS = 1 << 2,
CLUTTER_DEBUG_PAINT_VOLUMES = 1 << 3,
CLUTTER_DEBUG_DISABLE_CULLING = 1 << 4,
CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT = 1 << 5,
CLUTTER_DEBUG_CONTINUOUS_REDRAW = 1 << 6,
CLUTTER_DEBUG_PAINT_DEFORM_TILES = 1 << 7,
CLUTTER_DEBUG_PAINT_DAMAGE_REGION = 1 << 8,
} ClutterDrawDebugFlag;
#ifdef CLUTTER_ENABLE_DEBUG #ifdef CLUTTER_ENABLE_DEBUG
#define CLUTTER_HAS_DEBUG(type) ((clutter_debug_flags & CLUTTER_DEBUG_##type) != FALSE) #define CLUTTER_HAS_DEBUG(type) ((clutter_debug_flags & CLUTTER_DEBUG_##type) != FALSE)

View File

@@ -177,7 +177,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
if (priv->is_dirty) if (priv->is_dirty)
{ {
ClutterRect rect; graphene_rect_t rect;
gboolean mapped_buffer; gboolean mapped_buffer;
CoglVertexP3T2C4 *verts; CoglVertexP3T2C4 *verts;
ClutterActor *actor; ClutterActor *actor;
@@ -193,8 +193,8 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
*/ */
if (clutter_offscreen_effect_get_target_rect (effect, &rect)) if (clutter_offscreen_effect_get_target_rect (effect, &rect))
{ {
width = clutter_rect_get_width (&rect); width = graphene_rect_get_width (&rect);
height = clutter_rect_get_height (&rect); height = graphene_rect_get_height (&rect);
} }
else else
clutter_actor_get_size (actor, &width, &height); clutter_actor_get_size (actor, &width, &height);

View File

@@ -7,10 +7,6 @@
#include "deprecated/clutter-alpha.h" #include "deprecated/clutter-alpha.h"
#include "deprecated/clutter-animatable.h" #include "deprecated/clutter-animatable.h"
#include "deprecated/clutter-animation.h" #include "deprecated/clutter-animation.h"
#include "deprecated/clutter-behaviour.h"
#include "deprecated/clutter-behaviour-depth.h"
#include "deprecated/clutter-behaviour-opacity.h"
#include "deprecated/clutter-behaviour-scale.h"
#include "deprecated/clutter-bin-layout.h" #include "deprecated/clutter-bin-layout.h"
#include "deprecated/clutter-box.h" #include "deprecated/clutter-box.h"
#include "deprecated/clutter-cairo-texture.h" #include "deprecated/clutter-cairo-texture.h"

View File

@@ -81,7 +81,7 @@ struct _ClutterDragActionPrivate
gint y_drag_threshold; gint y_drag_threshold;
ClutterActor *drag_handle; ClutterActor *drag_handle;
ClutterDragAxis drag_axis; ClutterDragAxis drag_axis;
ClutterRect drag_area; graphene_rect_t drag_area;
ClutterInputDevice *device; ClutterInputDevice *device;
ClutterEventSequence *sequence; ClutterEventSequence *sequence;
@@ -542,7 +542,7 @@ clutter_drag_action_real_drag_motion (ClutterDragAction *action,
if (action->priv->drag_area_set) if (action->priv->drag_area_set)
{ {
ClutterRect *drag_area = &action->priv->drag_area; graphene_rect_t *drag_area = &action->priv->drag_area;
x = CLAMP (x, drag_area->origin.x, drag_area->origin.x + drag_area->size.width); x = CLAMP (x, drag_area->origin.x, drag_area->origin.x + drag_area->size.width);
y = CLAMP (y, drag_area->origin.y, drag_area->origin.y + drag_area->size.height); y = CLAMP (y, drag_area->origin.y, drag_area->origin.y + drag_area->size.height);
@@ -811,7 +811,7 @@ clutter_drag_action_class_init (ClutterDragActionClass *klass)
g_param_spec_boxed ("drag-area", g_param_spec_boxed ("drag-area",
P_("Drag Area"), P_("Drag Area"),
P_("Constrains the dragging to a rectangle"), P_("Constrains the dragging to a rectangle"),
CLUTTER_TYPE_RECT, GRAPHENE_TYPE_RECT,
CLUTTER_PARAM_READWRITE); CLUTTER_PARAM_READWRITE);
/** /**
@@ -1267,10 +1267,10 @@ clutter_drag_action_get_motion_coords (ClutterDragAction *action,
/** /**
* clutter_drag_action_get_drag_area: * clutter_drag_action_get_drag_area:
* @action: a #ClutterDragAction * @action: a #ClutterDragAction
* @drag_area: (out caller-allocates): a #ClutterRect to be filled * @drag_area: (out caller-allocates): a #graphene_rect_t to be filled
* *
* Retrieves the "drag area" associated with @action, that * Retrieves the "drag area" associated with @action, that
* is a #ClutterRect that constrains the actor movements, * is a #graphene_rect_t that constrains the actor movements,
* in parents coordinates. * in parents coordinates.
* *
* Returns: %TRUE if the actor is actually constrained (and thus * Returns: %TRUE if the actor is actually constrained (and thus
@@ -1278,7 +1278,7 @@ clutter_drag_action_get_motion_coords (ClutterDragAction *action,
*/ */
gboolean gboolean
clutter_drag_action_get_drag_area (ClutterDragAction *action, clutter_drag_action_get_drag_area (ClutterDragAction *action,
ClutterRect *drag_area) graphene_rect_t *drag_area)
{ {
g_return_val_if_fail (CLUTTER_IS_DRAG_ACTION (action), FALSE); g_return_val_if_fail (CLUTTER_IS_DRAG_ACTION (action), FALSE);
@@ -1298,8 +1298,8 @@ clutter_drag_action_get_drag_area (ClutterDragAction *action,
* If @drag_area is %NULL, the actor is not constrained. * If @drag_area is %NULL, the actor is not constrained.
*/ */
void void
clutter_drag_action_set_drag_area (ClutterDragAction *action, clutter_drag_action_set_drag_area (ClutterDragAction *action,
const ClutterRect *drag_area) const graphene_rect_t *drag_area)
{ {
ClutterDragActionPrivate *priv; ClutterDragActionPrivate *priv;

View File

@@ -141,11 +141,11 @@ void clutter_drag_action_get_motion_coords (ClutterDragAction *actio
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_drag_action_get_drag_area (ClutterDragAction *action, gboolean clutter_drag_action_get_drag_area (ClutterDragAction *action,
ClutterRect *drag_area); graphene_rect_t *drag_area);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_drag_action_set_drag_area (ClutterDragAction *action, void clutter_drag_action_set_drag_area (ClutterDragAction *action,
const ClutterRect *drag_area); const graphene_rect_t *drag_area);
G_END_DECLS G_END_DECLS

View File

@@ -12,8 +12,7 @@ gboolean _clutter_effect_modify_paint_volume (ClutterEffect
gboolean _clutter_effect_has_custom_paint_volume (ClutterEffect *effect); gboolean _clutter_effect_has_custom_paint_volume (ClutterEffect *effect);
void _clutter_effect_paint (ClutterEffect *effect, void _clutter_effect_paint (ClutterEffect *effect,
ClutterEffectPaintFlags flags); ClutterEffectPaintFlags flags);
void _clutter_effect_pick (ClutterEffect *effect, void _clutter_effect_pick (ClutterEffect *effect);
ClutterEffectPaintFlags flags);
G_END_DECLS G_END_DECLS

View File

@@ -100,13 +100,13 @@
* // Clear the previous state // * // Clear the previous state //
* if (self->rect_1) * if (self->rect_1)
* { * {
* cogl_handle_unref (self->rect_1); * cogl_object_unref (self->rect_1);
* self->rect_1 = NULL; * self->rect_1 = NULL;
* } * }
* *
* if (self->rect_2) * if (self->rect_2)
* { * {
* cogl_handle_unref (self->rect_2); * cogl_object_unref (self->rect_2);
* self->rect_2 = NULL; * self->rect_2 = NULL;
* } * }
* *
@@ -216,14 +216,13 @@ clutter_effect_real_paint (ClutterEffect *effect,
} }
static void static void
clutter_effect_real_pick (ClutterEffect *effect, clutter_effect_real_pick (ClutterEffect *effect)
ClutterEffectPaintFlags flags)
{ {
ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect); ClutterActorMeta *actor_meta = CLUTTER_ACTOR_META (effect);
ClutterActor *actor; ClutterActor *actor;
actor = clutter_actor_meta_get_actor (actor_meta); actor = clutter_actor_meta_get_actor (actor_meta);
clutter_actor_continue_paint (actor); clutter_actor_continue_pick (actor);
} }
static void static void
@@ -288,12 +287,11 @@ _clutter_effect_paint (ClutterEffect *effect,
} }
void void
_clutter_effect_pick (ClutterEffect *effect, _clutter_effect_pick (ClutterEffect *effect)
ClutterEffectPaintFlags flags)
{ {
g_return_if_fail (CLUTTER_IS_EFFECT (effect)); g_return_if_fail (CLUTTER_IS_EFFECT (effect));
CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect, flags); CLUTTER_EFFECT_GET_CLASS (effect)->pick (effect);
} }
gboolean gboolean

View File

@@ -82,8 +82,7 @@ struct _ClutterEffectClass
void (* paint) (ClutterEffect *effect, void (* paint) (ClutterEffect *effect,
ClutterEffectPaintFlags flags); ClutterEffectPaintFlags flags);
void (* pick) (ClutterEffect *effect, void (* pick) (ClutterEffect *effect);
ClutterEffectPaintFlags flags);
/*< private >*/ /*< private >*/
void (* _clutter_effect4) (void); void (* _clutter_effect4) (void);

View File

@@ -970,8 +970,6 @@ typedef enum
/** /**
* ClutterFeatureFlags: * ClutterFeatureFlags:
* @CLUTTER_FEATURE_SWAP_THROTTLE: Set if backend throttles buffer swaps. * @CLUTTER_FEATURE_SWAP_THROTTLE: Set if backend throttles buffer swaps.
* @CLUTTER_FEATURE_TEXTURE_YUV: Set if YUV based textures supported.
* @CLUTTER_FEATURE_TEXTURE_READ_PIXELS: Set if texture pixels can be read.
* @CLUTTER_FEATURE_STAGE_STATIC: Set if stage size if fixed (i.e framebuffer) * @CLUTTER_FEATURE_STAGE_STATIC: Set if stage size if fixed (i.e framebuffer)
* @CLUTTER_FEATURE_STAGE_CURSOR: Set if stage has a graphical cursor. * @CLUTTER_FEATURE_STAGE_CURSOR: Set if stage has a graphical cursor.
* @CLUTTER_FEATURE_SHADERS_GLSL: Set if the backend supports GLSL shaders. * @CLUTTER_FEATURE_SHADERS_GLSL: Set if the backend supports GLSL shaders.
@@ -987,8 +985,6 @@ typedef enum
typedef enum typedef enum
{ {
CLUTTER_FEATURE_SWAP_THROTTLE = (1 << 3), CLUTTER_FEATURE_SWAP_THROTTLE = (1 << 3),
CLUTTER_FEATURE_TEXTURE_YUV = (1 << 4),
CLUTTER_FEATURE_TEXTURE_READ_PIXELS = (1 << 5),
CLUTTER_FEATURE_STAGE_STATIC = (1 << 6), CLUTTER_FEATURE_STAGE_STATIC = (1 << 6),
CLUTTER_FEATURE_STAGE_CURSOR = (1 << 8), CLUTTER_FEATURE_STAGE_CURSOR = (1 << 8),
CLUTTER_FEATURE_SHADERS_GLSL = (1 << 9), CLUTTER_FEATURE_SHADERS_GLSL = (1 << 9),
@@ -1217,8 +1213,7 @@ typedef enum
* @CLUTTER_TEXTURE_RGB_FLAG_PREMULT: Unused flag * @CLUTTER_TEXTURE_RGB_FLAG_PREMULT: Unused flag
* @CLUTTER_TEXTURE_YUV_FLAG_YUV2: Unused flag * @CLUTTER_TEXTURE_YUV_FLAG_YUV2: Unused flag
* *
* Flags for clutter_texture_set_from_rgb_data() and * Flags for clutter_texture_set_from_rgb_data().
* clutter_texture_set_from_yuv_data().
* *
* Since: 0.4 * Since: 0.4
* *

View File

@@ -370,7 +370,7 @@ clutter_event_get_coords (const ClutterEvent *event,
gfloat *x, gfloat *x,
gfloat *y) gfloat *y)
{ {
ClutterPoint coords; graphene_point_t coords;
g_return_if_fail (event != NULL); g_return_if_fail (event != NULL);
@@ -386,15 +386,15 @@ clutter_event_get_coords (const ClutterEvent *event,
/** /**
* clutter_event_get_position: * clutter_event_get_position:
* @event: a #ClutterEvent * @event: a #ClutterEvent
* @position: a #ClutterPoint * @position: a #graphene_point_t
* *
* Retrieves the event coordinates as a #ClutterPoint. * Retrieves the event coordinates as a #graphene_point_t.
* *
* Since: 1.12 * Since: 1.12
*/ */
void void
clutter_event_get_position (const ClutterEvent *event, clutter_event_get_position (const ClutterEvent *event,
ClutterPoint *position) graphene_point_t *position)
{ {
g_return_if_fail (event != NULL); g_return_if_fail (event != NULL);
g_return_if_fail (position != NULL); g_return_if_fail (position != NULL);
@@ -415,42 +415,42 @@ clutter_event_get_position (const ClutterEvent *event,
case CLUTTER_PAD_BUTTON_RELEASE: case CLUTTER_PAD_BUTTON_RELEASE:
case CLUTTER_PAD_STRIP: case CLUTTER_PAD_STRIP:
case CLUTTER_PAD_RING: case CLUTTER_PAD_RING:
clutter_point_init (position, 0.f, 0.f); graphene_point_init (position, 0.f, 0.f);
break; break;
case CLUTTER_ENTER: case CLUTTER_ENTER:
case CLUTTER_LEAVE: case CLUTTER_LEAVE:
clutter_point_init (position, event->crossing.x, event->crossing.y); graphene_point_init (position, event->crossing.x, event->crossing.y);
break; break;
case CLUTTER_BUTTON_PRESS: case CLUTTER_BUTTON_PRESS:
case CLUTTER_BUTTON_RELEASE: case CLUTTER_BUTTON_RELEASE:
clutter_point_init (position, event->button.x, event->button.y); graphene_point_init (position, event->button.x, event->button.y);
break; break;
case CLUTTER_MOTION: case CLUTTER_MOTION:
clutter_point_init (position, event->motion.x, event->motion.y); graphene_point_init (position, event->motion.x, event->motion.y);
break; break;
case CLUTTER_TOUCH_BEGIN: case CLUTTER_TOUCH_BEGIN:
case CLUTTER_TOUCH_UPDATE: case CLUTTER_TOUCH_UPDATE:
case CLUTTER_TOUCH_END: case CLUTTER_TOUCH_END:
case CLUTTER_TOUCH_CANCEL: case CLUTTER_TOUCH_CANCEL:
clutter_point_init (position, event->touch.x, event->touch.y); graphene_point_init (position, event->touch.x, event->touch.y);
break; break;
case CLUTTER_SCROLL: case CLUTTER_SCROLL:
clutter_point_init (position, event->scroll.x, event->scroll.y); graphene_point_init (position, event->scroll.x, event->scroll.y);
break; break;
case CLUTTER_TOUCHPAD_PINCH: case CLUTTER_TOUCHPAD_PINCH:
clutter_point_init (position, event->touchpad_pinch.x, graphene_point_init (position, event->touchpad_pinch.x,
event->touchpad_pinch.y); event->touchpad_pinch.y);
break; break;
case CLUTTER_TOUCHPAD_SWIPE: case CLUTTER_TOUCHPAD_SWIPE:
clutter_point_init (position, event->touchpad_swipe.x, graphene_point_init (position, event->touchpad_swipe.x,
event->touchpad_swipe.y); event->touchpad_swipe.y);
break; break;
} }
@@ -1796,12 +1796,12 @@ float
clutter_event_get_distance (const ClutterEvent *source, clutter_event_get_distance (const ClutterEvent *source,
const ClutterEvent *target) const ClutterEvent *target)
{ {
ClutterPoint p0, p1; graphene_point_t p0, p1;
clutter_event_get_position (source, &p0); clutter_event_get_position (source, &p0);
clutter_event_get_position (source, &p1); clutter_event_get_position (source, &p1);
return clutter_point_distance (&p0, &p1, NULL, NULL); return graphene_point_distance (&p0, &p1, NULL, NULL);
} }
/** /**
@@ -1822,17 +1822,17 @@ double
clutter_event_get_angle (const ClutterEvent *source, clutter_event_get_angle (const ClutterEvent *source,
const ClutterEvent *target) const ClutterEvent *target)
{ {
ClutterPoint p0, p1; graphene_point_t p0, p1;
float x_distance, y_distance; float x_distance, y_distance;
double angle; double angle;
clutter_event_get_position (source, &p0); clutter_event_get_position (source, &p0);
clutter_event_get_position (target, &p1); clutter_event_get_position (target, &p1);
if (clutter_point_equals (&p0, &p1)) if (graphene_point_equal (&p0, &p1))
return 0; return 0;
clutter_point_distance (&p0, &p1, &x_distance, &y_distance); graphene_point_distance (&p0, &p1, &x_distance, &y_distance);
angle = atan2 (x_distance, y_distance); angle = atan2 (x_distance, y_distance);
@@ -2161,9 +2161,9 @@ clutter_event_get_scroll_source (const ClutterEvent *event)
ClutterScrollFinishFlags ClutterScrollFinishFlags
clutter_event_get_scroll_finish_flags (const ClutterEvent *event) clutter_event_get_scroll_finish_flags (const ClutterEvent *event)
{ {
g_return_val_if_fail (event != NULL, CLUTTER_SCROLL_SOURCE_UNKNOWN); g_return_val_if_fail (event != NULL, CLUTTER_SCROLL_FINISHED_NONE);
g_return_val_if_fail (event->type == CLUTTER_SCROLL, g_return_val_if_fail (event->type == CLUTTER_SCROLL,
CLUTTER_SCROLL_SOURCE_UNKNOWN); CLUTTER_SCROLL_FINISHED_NONE);
return event->scroll.finish_flags; return event->scroll.finish_flags;
} }

View File

@@ -686,7 +686,7 @@ void clutter_event_get_coords (const ClutterEv
gfloat *y); gfloat *y);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_event_get_position (const ClutterEvent *event, void clutter_event_get_position (const ClutterEvent *event,
ClutterPoint *position); graphene_point_t *position);
CLUTTER_EXPORT CLUTTER_EXPORT
float clutter_event_get_distance (const ClutterEvent *source, float clutter_event_get_distance (const ClutterEvent *source,
const ClutterEvent *target); const ClutterEvent *target);

View File

@@ -33,8 +33,6 @@
* *
* It is possible to ask whether Clutter has support for specific features at * It is possible to ask whether Clutter has support for specific features at
* run-time. * run-time.
*
* See also cogl_get_features() and #CoglFeatureFlags
*/ */
#include "clutter-build-config.h" #include "clutter-build-config.h"
@@ -60,20 +58,13 @@ typedef struct ClutterFeatures
static ClutterFeatures* __features = NULL; static ClutterFeatures* __features = NULL;
static ClutterFeatureFlags static ClutterFeatureFlags
clutter_features_from_cogl (guint cogl_flags) clutter_features_from_cogl (void)
{ {
ClutterFeatureFlags clutter_flags = 0; ClutterFeatureFlags clutter_flags = 0;
if (cogl_flags & COGL_FEATURE_TEXTURE_YUV)
clutter_flags |= CLUTTER_FEATURE_TEXTURE_YUV;
if (cogl_flags & COGL_FEATURE_TEXTURE_READ_PIXELS)
clutter_flags |= CLUTTER_FEATURE_TEXTURE_READ_PIXELS;
clutter_flags |= CLUTTER_FEATURE_SHADERS_GLSL; clutter_flags |= CLUTTER_FEATURE_SHADERS_GLSL;
if (cogl_flags & COGL_FEATURE_OFFSCREEN) clutter_flags |= CLUTTER_FEATURE_OFFSCREEN;
clutter_flags |= CLUTTER_FEATURE_OFFSCREEN;
return clutter_flags; return clutter_flags;
} }
@@ -101,7 +92,7 @@ _clutter_feature_init (GError **error)
if (!_clutter_backend_create_context (context->backend, error)) if (!_clutter_backend_create_context (context->backend, error))
return FALSE; return FALSE;
__features->flags = (clutter_features_from_cogl (cogl_get_features ()) __features->flags = (clutter_features_from_cogl ()
| _clutter_backend_get_features (context->backend)); | _clutter_backend_get_features (context->backend));
__features->features_set = TRUE; __features->features_set = TRUE;

View File

@@ -0,0 +1,111 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
*
* Copyright (C) 2019 Endless, Inc
* Copyright (C) 2009, 2010 Intel Corp
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "clutter-build-config.h"
#include "clutter-graphene.h"
#include "clutter-private.h"
#include "clutter-types.h"
static gboolean
graphene_point_progress (const GValue *a,
const GValue *b,
double progress,
GValue *retval)
{
const graphene_point_t *ap = g_value_get_boxed (a);
const graphene_point_t *bp = g_value_get_boxed (b);
graphene_point_t res;
graphene_point_interpolate (ap, bp, progress, &res);
g_value_set_boxed (retval, &res);
return TRUE;
}
static gboolean
graphene_point3d_progress (const GValue *a,
const GValue *b,
double progress,
GValue *retval)
{
const graphene_point3d_t *av = g_value_get_boxed (a);
const graphene_point3d_t *bv = g_value_get_boxed (b);
graphene_point3d_t res;
graphene_point3d_interpolate (av, bv, progress, &res);
g_value_set_boxed (retval, &res);
return TRUE;
}
static gboolean
graphene_rect_progress (const GValue *a,
const GValue *b,
double progress,
GValue *retval)
{
const graphene_rect_t *rect_a = g_value_get_boxed (a);
const graphene_rect_t *rect_b = g_value_get_boxed (b);
graphene_rect_t res;
graphene_rect_interpolate (rect_a, rect_b, progress, &res);
g_value_set_boxed (retval, &res);
return TRUE;
}
static gboolean
graphene_size_progress (const GValue *a,
const GValue *b,
double progress,
GValue *retval)
{
const graphene_size_t *as = g_value_get_boxed (a);
const graphene_size_t *bs = g_value_get_boxed (b);
graphene_size_t res;
graphene_size_interpolate (as, bs, progress, &res);
g_value_set_boxed (retval, &res);
return TRUE;
}
void
clutter_graphene_init (void)
{
clutter_interval_register_progress_func (GRAPHENE_TYPE_POINT,
graphene_point_progress);
clutter_interval_register_progress_func (GRAPHENE_TYPE_POINT3D,
graphene_point3d_progress);
clutter_interval_register_progress_func (GRAPHENE_TYPE_RECT,
graphene_rect_progress);
clutter_interval_register_progress_func (GRAPHENE_TYPE_SIZE,
graphene_size_progress);
}

View File

@@ -0,0 +1,30 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
*
* Copyright (C) 2019 Endless, Inc
* Copyright (C) 2009, 2010 Intel Corp
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CLUTTER_GRAPHENE_H
#define CLUTTER_GRAPHENE_H
void clutter_graphene_init (void);
#endif

View File

@@ -991,7 +991,7 @@ clutter_input_device_get_enabled (ClutterInputDevice *device)
gboolean gboolean
clutter_input_device_get_coords (ClutterInputDevice *device, clutter_input_device_get_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence, ClutterEventSequence *sequence,
ClutterPoint *point) graphene_point_t *point)
{ {
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE); g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
g_return_val_if_fail (point != NULL, FALSE); g_return_val_if_fail (point != NULL, FALSE);
@@ -1038,7 +1038,7 @@ _clutter_input_device_update (ClutterInputDevice *device,
ClutterStage *stage; ClutterStage *stage;
ClutterActor *new_cursor_actor; ClutterActor *new_cursor_actor;
ClutterActor *old_cursor_actor; ClutterActor *old_cursor_actor;
ClutterPoint point = { -1, -1 }; graphene_point_t point = GRAPHENE_POINT_INIT (-1.0f, -1.0f);
ClutterInputDeviceType device_type = device->device_type; ClutterInputDeviceType device_type = device->device_type;
g_assert (device_type != CLUTTER_KEYBOARD_DEVICE && g_assert (device_type != CLUTTER_KEYBOARD_DEVICE &&

View File

@@ -58,7 +58,7 @@ gint clutter_input_device_get_device_id (ClutterInputDev
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_input_device_get_coords (ClutterInputDevice *device, gboolean clutter_input_device_get_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence, ClutterEventSequence *sequence,
ClutterPoint *point); graphene_point_t *point);
CLUTTER_EXPORT CLUTTER_EXPORT
ClutterModifierType clutter_input_device_get_modifier_state (ClutterInputDevice *device); ClutterModifierType clutter_input_device_get_modifier_state (ClutterInputDevice *device);
CLUTTER_EXPORT CLUTTER_EXPORT

View File

@@ -89,8 +89,8 @@ clutter_input_focus_reset (ClutterInputFocus *focus)
} }
void void
clutter_input_focus_set_cursor_location (ClutterInputFocus *focus, clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
const ClutterRect *rect) const graphene_rect_t *rect)
{ {
ClutterInputFocusPrivate *priv; ClutterInputFocusPrivate *priv;

View File

@@ -57,8 +57,8 @@ gboolean clutter_input_focus_is_focused (ClutterInputFocus *focus);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_input_focus_reset (ClutterInputFocus *focus); void clutter_input_focus_reset (ClutterInputFocus *focus);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_input_focus_set_cursor_location (ClutterInputFocus *focus, void clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
const ClutterRect *rect); const graphene_rect_t *rect);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_input_focus_set_surrounding (ClutterInputFocus *focus, void clutter_input_focus_set_surrounding (ClutterInputFocus *focus,

View File

@@ -26,8 +26,8 @@ ClutterInputFocus * clutter_input_method_get_focus (ClutterInputMethod *method);
void clutter_input_method_reset (ClutterInputMethod *method); void clutter_input_method_reset (ClutterInputMethod *method);
void clutter_input_method_set_cursor_location (ClutterInputMethod *method, void clutter_input_method_set_cursor_location (ClutterInputMethod *method,
const ClutterRect *rect); const graphene_rect_t *rect);
void clutter_input_method_set_surrounding (ClutterInputMethod *method, void clutter_input_method_set_surrounding (ClutterInputMethod *method,
const gchar *text, const gchar *text,
guint cursor, guint cursor,

View File

@@ -187,7 +187,7 @@ clutter_input_method_class_init (ClutterInputMethodClass *klass)
G_TYPE_FROM_CLASS (object_class), G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL, 0, NULL, NULL, NULL,
G_TYPE_NONE, 1, CLUTTER_TYPE_RECT); G_TYPE_NONE, 1, GRAPHENE_TYPE_RECT);
pspecs[PROP_CONTENT_HINTS] = pspecs[PROP_CONTENT_HINTS] =
g_param_spec_flags ("content-hints", g_param_spec_flags ("content-hints",
@@ -377,8 +377,8 @@ clutter_input_method_reset (ClutterInputMethod *im)
} }
void void
clutter_input_method_set_cursor_location (ClutterInputMethod *im, clutter_input_method_set_cursor_location (ClutterInputMethod *im,
const ClutterRect *rect) const graphene_rect_t *rect)
{ {
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im)); g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));

View File

@@ -42,8 +42,8 @@ struct _ClutterInputMethodClass
void (* reset) (ClutterInputMethod *im); void (* reset) (ClutterInputMethod *im);
void (* set_cursor_location) (ClutterInputMethod *im, void (* set_cursor_location) (ClutterInputMethod *im,
const ClutterRect *rect); const graphene_rect_t *rect);
void (* set_surrounding) (ClutterInputMethod *im, void (* set_surrounding) (ClutterInputMethod *im,
const gchar *text, const gchar *text,
guint cursor, guint cursor,

View File

@@ -329,9 +329,6 @@ layout_manager_real_begin_animation (ClutterLayoutManager *manager,
/* let the alpha take ownership of the timeline */ /* let the alpha take ownership of the timeline */
g_object_unref (timeline); g_object_unref (timeline);
g_signal_connect_swapped (timeline, "completed",
G_CALLBACK (clutter_layout_manager_end_animation),
manager);
g_signal_connect_swapped (timeline, "new-frame", g_signal_connect_swapped (timeline, "new-frame",
G_CALLBACK (clutter_layout_manager_layout_changed), G_CALLBACK (clutter_layout_manager_layout_changed),
manager); manager);
@@ -375,9 +372,6 @@ layout_manager_real_end_animation (ClutterLayoutManager *manager)
if (clutter_timeline_is_playing (timeline)) if (clutter_timeline_is_playing (timeline))
clutter_timeline_stop (timeline); clutter_timeline_stop (timeline);
g_signal_handlers_disconnect_by_func (timeline,
G_CALLBACK (clutter_layout_manager_end_animation),
manager);
g_signal_handlers_disconnect_by_func (timeline, g_signal_handlers_disconnect_by_func (timeline,
G_CALLBACK (clutter_layout_manager_layout_changed), G_CALLBACK (clutter_layout_manager_layout_changed),
manager); manager);

View File

@@ -213,15 +213,6 @@ void clutter_layout_manager_child_get_property (ClutterLayoutMa
const gchar *property_name, const gchar *property_name,
GValue *value); GValue *value);
CLUTTER_DEPRECATED
ClutterAlpha * clutter_layout_manager_begin_animation (ClutterLayoutManager *manager,
guint duration,
gulong mode);
CLUTTER_DEPRECATED
void clutter_layout_manager_end_animation (ClutterLayoutManager *manager);
CLUTTER_DEPRECATED
gdouble clutter_layout_manager_get_animation_progress (ClutterLayoutManager *manager);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_LAYOUT_MANAGER_H__ */ #endif /* __CLUTTER_LAYOUT_MANAGER_H__ */

View File

@@ -59,6 +59,7 @@
#include "clutter-event-private.h" #include "clutter-event-private.h"
#include "clutter-feature.h" #include "clutter-feature.h"
#include "clutter-input-pointer-a11y-private.h" #include "clutter-input-pointer-a11y-private.h"
#include "clutter-graphene.h"
#include "clutter-main.h" #include "clutter-main.h"
#include "clutter-master-clock.h" #include "clutter-master-clock.h"
#include "clutter-mutter.h" #include "clutter-mutter.h"
@@ -2194,6 +2195,8 @@ clutter_base_init (void)
/* initialise the Big Clutter Lock™ if necessary */ /* initialise the Big Clutter Lock™ if necessary */
clutter_threads_init_default (); clutter_threads_init_default ();
clutter_graphene_init ();
} }
} }
@@ -2602,6 +2605,36 @@ clutter_check_windowing_backend (const char *backend_type)
return FALSE; return FALSE;
} }
/**
* clutter_add_debug_flags: (skip)
*
* Adds the debug flags passed to the list of debug flags.
*/
void
clutter_add_debug_flags (ClutterDebugFlag debug_flags,
ClutterDrawDebugFlag draw_flags,
ClutterPickDebugFlag pick_flags)
{
clutter_debug_flags |= debug_flags;
clutter_paint_debug_flags |= draw_flags;
clutter_pick_debug_flags |= pick_flags;
}
/**
* clutter_remove_debug_flags: (skip)
*
* Removes the debug flags passed from the list of debug flags.
*/
void
clutter_remove_debug_flags (ClutterDebugFlag debug_flags,
ClutterDrawDebugFlag draw_flags,
ClutterPickDebugFlag pick_flags)
{
clutter_debug_flags &= ~debug_flags;
clutter_paint_debug_flags &= ~draw_flags;
clutter_pick_debug_flags &= ~pick_flags;
}
void void
_clutter_set_sync_to_vblank (gboolean sync_to_vblank) _clutter_set_sync_to_vblank (gboolean sync_to_vblank)
{ {

View File

@@ -34,6 +34,45 @@
G_BEGIN_DECLS G_BEGIN_DECLS
typedef enum
{
CLUTTER_DEBUG_MISC = 1 << 0,
CLUTTER_DEBUG_ACTOR = 1 << 1,
CLUTTER_DEBUG_TEXTURE = 1 << 2,
CLUTTER_DEBUG_EVENT = 1 << 3,
CLUTTER_DEBUG_PAINT = 1 << 4,
CLUTTER_DEBUG_PANGO = 1 << 5,
CLUTTER_DEBUG_BACKEND = 1 << 6,
CLUTTER_DEBUG_SCHEDULER = 1 << 7,
CLUTTER_DEBUG_SCRIPT = 1 << 8,
CLUTTER_DEBUG_SHADER = 1 << 9,
CLUTTER_DEBUG_MULTISTAGE = 1 << 10,
CLUTTER_DEBUG_ANIMATION = 1 << 11,
CLUTTER_DEBUG_LAYOUT = 1 << 12,
CLUTTER_DEBUG_PICK = 1 << 13,
CLUTTER_DEBUG_EVENTLOOP = 1 << 14,
CLUTTER_DEBUG_CLIPPING = 1 << 15,
CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16,
} ClutterDebugFlag;
typedef enum
{
CLUTTER_DEBUG_NOP_PICKING = 1 << 0,
} ClutterPickDebugFlag;
typedef enum
{
CLUTTER_DEBUG_DISABLE_SWAP_EVENTS = 1 << 0,
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS = 1 << 1,
CLUTTER_DEBUG_REDRAWS = 1 << 2,
CLUTTER_DEBUG_PAINT_VOLUMES = 1 << 3,
CLUTTER_DEBUG_DISABLE_CULLING = 1 << 4,
CLUTTER_DEBUG_DISABLE_OFFSCREEN_REDIRECT = 1 << 5,
CLUTTER_DEBUG_CONTINUOUS_REDRAW = 1 << 6,
CLUTTER_DEBUG_PAINT_DEFORM_TILES = 1 << 7,
CLUTTER_DEBUG_PAINT_DAMAGE_REGION = 1 << 8,
} ClutterDrawDebugFlag;
/** /**
* CLUTTER_INIT_ERROR: * CLUTTER_INIT_ERROR:
* *
@@ -158,6 +197,15 @@ guint clutter_get_default_frame_rate (void);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_check_windowing_backend (const char *backend_type); gboolean clutter_check_windowing_backend (const char *backend_type);
CLUTTER_EXPORT
void clutter_add_debug_flags (ClutterDebugFlag debug_flags,
ClutterDrawDebugFlag draw_flags,
ClutterPickDebugFlag pick_flags);
CLUTTER_EXPORT
void clutter_remove_debug_flags (ClutterDebugFlag debug_flags,
ClutterDrawDebugFlag draw_flags,
ClutterPickDebugFlag pick_flags);
G_END_DECLS G_END_DECLS

View File

@@ -86,7 +86,7 @@ struct _ClutterOffscreenEffectPrivate
ClutterActor *actor; ClutterActor *actor;
ClutterActor *stage; ClutterActor *stage;
ClutterVertex position; graphene_point3d_t position;
int fbo_offset_x; int fbo_offset_x;
int fbo_offset_y; int fbo_offset_y;
@@ -119,7 +119,7 @@ clutter_offscreen_effect_set_actor (ClutterActorMeta *meta,
/* clear out the previous state */ /* clear out the previous state */
if (priv->offscreen != NULL) if (priv->offscreen != NULL)
{ {
cogl_handle_unref (priv->offscreen); cogl_object_unref (priv->offscreen);
priv->offscreen = NULL; priv->offscreen = NULL;
} }
@@ -199,13 +199,13 @@ update_fbo (ClutterEffect *effect,
if (priv->texture != NULL) if (priv->texture != NULL)
{ {
cogl_handle_unref (priv->texture); cogl_object_unref (priv->texture);
priv->texture = NULL; priv->texture = NULL;
} }
if (priv->offscreen != NULL) if (priv->offscreen != NULL)
{ {
cogl_handle_unref (priv->offscreen); cogl_object_unref (priv->offscreen);
priv->offscreen = NULL; priv->offscreen = NULL;
} }
@@ -224,7 +224,7 @@ update_fbo (ClutterEffect *effect,
{ {
g_warning ("%s: Unable to create an Offscreen buffer", G_STRLOC); g_warning ("%s: Unable to create an Offscreen buffer", G_STRLOC);
cogl_handle_unref (priv->target); cogl_object_unref (priv->target);
priv->target = NULL; priv->target = NULL;
priv->target_width = 0; priv->target_width = 0;
@@ -250,9 +250,11 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
gfloat target_width = -1, target_height = -1; gfloat target_width = -1, target_height = -1;
gfloat resource_scale; gfloat resource_scale;
gfloat ceiled_resource_scale; gfloat ceiled_resource_scale;
ClutterVertex local_offset = { 0.f, 0.f, 0.f }; graphene_point3d_t local_offset;
gfloat old_viewport[4]; gfloat old_viewport[4];
local_offset = GRAPHENE_POINT3D_INIT (0.0f, 0.0f, 0.0f);
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect))) if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
return FALSE; return FALSE;
@@ -487,13 +489,13 @@ clutter_offscreen_effect_finalize (GObject *gobject)
ClutterOffscreenEffectPrivate *priv = self->priv; ClutterOffscreenEffectPrivate *priv = self->priv;
if (priv->offscreen) if (priv->offscreen)
cogl_handle_unref (priv->offscreen); cogl_object_unref (priv->offscreen);
if (priv->target) if (priv->target)
cogl_handle_unref (priv->target); cogl_object_unref (priv->target);
if (priv->texture) if (priv->texture)
cogl_handle_unref (priv->texture); cogl_object_unref (priv->texture);
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject); G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
} }
@@ -537,7 +539,7 @@ clutter_offscreen_effect_init (ClutterOffscreenEffect *self)
* used instead of clutter_offscreen_effect_get_target() when the * used instead of clutter_offscreen_effect_get_target() when the
* effect subclass wants to paint using its own material. * effect subclass wants to paint using its own material.
* *
* Return value: (transfer none): a #CoglHandle or %COGL_INVALID_HANDLE. The * Return value: (transfer none): a #CoglHandle or %NULL. The
* returned texture is owned by Clutter and it should not be * returned texture is owned by Clutter and it should not be
* modified or freed * modified or freed
* *
@@ -602,7 +604,7 @@ clutter_offscreen_effect_paint_target (ClutterOffscreenEffect *effect)
* Calls the create_texture() virtual function of the @effect * Calls the create_texture() virtual function of the @effect
* *
* Return value: (transfer full): a handle to a Cogl texture, or * Return value: (transfer full): a handle to a Cogl texture, or
* %COGL_INVALID_HANDLE. The returned handle has its reference * %NULL. The returned handle has its reference
* count increased. * count increased.
* *
* Since: 1.4 * Since: 1.4
@@ -682,7 +684,7 @@ clutter_offscreen_effect_get_target_size (ClutterOffscreenEffect *effect,
*/ */
gboolean gboolean
clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect, clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
ClutterRect *rect) graphene_rect_t *rect)
{ {
ClutterOffscreenEffectPrivate *priv; ClutterOffscreenEffectPrivate *priv;
@@ -694,11 +696,11 @@ clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
if (priv->texture == NULL) if (priv->texture == NULL)
return FALSE; return FALSE;
clutter_rect_init (rect, graphene_rect_init (rect,
priv->position.x, priv->position.x,
priv->position.y, priv->position.y,
cogl_texture_get_width (priv->texture), cogl_texture_get_width (priv->texture),
cogl_texture_get_height (priv->texture)); cogl_texture_get_height (priv->texture));
return TRUE; return TRUE;
} }

View File

@@ -114,7 +114,7 @@ gboolean clutter_offscreen_effect_get_target_size (ClutterOffscree
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect, gboolean clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
ClutterRect *rect); graphene_rect_t *rect);
G_END_DECLS G_END_DECLS

View File

@@ -139,30 +139,6 @@ ClutterPaintNode * clutter_paint_node_get_last_child (Clutter
G_GNUC_INTERNAL G_GNUC_INTERNAL
ClutterPaintNode * clutter_paint_node_get_parent (ClutterPaintNode *node); ClutterPaintNode * clutter_paint_node_get_parent (ClutterPaintNode *node);
#define CLUTTER_TYPE_LAYER_NODE (_clutter_layer_node_get_type ())
#define CLUTTER_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYER_NODE, ClutterLayerNode))
#define CLUTTER_IS_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYER_NODE))
/*
* ClutterLayerNode:
*
* The #ClutterLayerNode structure is an opaque
* type whose members cannot be directly accessed.
*
* Since: 1.10
*/
typedef struct _ClutterLayerNode ClutterLayerNode;
typedef struct _ClutterLayerNodeClass ClutterLayerNodeClass;
GType _clutter_layer_node_get_type (void) G_GNUC_CONST;
ClutterPaintNode * _clutter_layer_node_new (const CoglMatrix *projection,
const cairo_rectangle_t *viewport,
float width,
float height,
guint8 opacity);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_PAINT_NODE_PRIVATE_H__ */ #endif /* __CLUTTER_PAINT_NODE_PRIVATE_H__ */

View File

@@ -1099,12 +1099,12 @@ clutter_paint_node_to_json (ClutterPaintNode *node)
case PAINT_OP_PATH: case PAINT_OP_PATH:
json_builder_set_member_name (builder, "path"); json_builder_set_member_name (builder, "path");
json_builder_add_int_value (builder, (gint64) op->op.path); json_builder_add_int_value (builder, (intptr_t) op->op.path);
break; break;
case PAINT_OP_PRIMITIVE: case PAINT_OP_PRIMITIVE:
json_builder_set_member_name (builder, "primitive"); json_builder_set_member_name (builder, "primitive");
json_builder_add_int_value (builder, (gint64) op->op.primitive); json_builder_add_int_value (builder, (intptr_t) op->op.primitive);
break; break;
case PAINT_OP_INVALID: case PAINT_OP_INVALID:

View File

@@ -183,35 +183,31 @@ clutter_root_node_new (CoglFramebuffer *framebuffer,
} }
/* /*
* Transform node * ClutterTransformNode
*
* A private PaintNode, that changes the modelview of its child
* nodes.
*/ */
#define clutter_transform_node_get_type _clutter_transform_node_get_type struct _ClutterTransformNode
{
typedef struct _ClutterTransformNode {
ClutterPaintNode parent_instance; ClutterPaintNode parent_instance;
CoglMatrix modelview; CoglMatrix transform;
} ClutterTransformNode; };
typedef struct _ClutterPaintNodeClass ClutterTransformNodeClass; struct _ClutterTransformNodeClass
{
ClutterPaintNodeClass parent_class;
};
G_DEFINE_TYPE (ClutterTransformNode, clutter_transform_node, CLUTTER_TYPE_PAINT_NODE) G_DEFINE_TYPE (ClutterTransformNode, clutter_transform_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean static gboolean
clutter_transform_node_pre_draw (ClutterPaintNode *node) clutter_transform_node_pre_draw (ClutterPaintNode *node)
{ {
ClutterTransformNode *tnode = (ClutterTransformNode *) node; ClutterTransformNode *transform_node = (ClutterTransformNode *) node;
CoglMatrix matrix; CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
cogl_push_matrix (); cogl_framebuffer_push_matrix (fb);
cogl_framebuffer_transform (fb, &transform_node->transform);
cogl_get_modelview_matrix (&matrix);
cogl_matrix_multiply (&matrix, &matrix, &tnode->modelview);
cogl_set_modelview_matrix (&matrix);
return TRUE; return TRUE;
} }
@@ -219,7 +215,9 @@ clutter_transform_node_pre_draw (ClutterPaintNode *node)
static void static void
clutter_transform_node_post_draw (ClutterPaintNode *node) clutter_transform_node_post_draw (ClutterPaintNode *node)
{ {
cogl_pop_matrix (); CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
cogl_framebuffer_pop_matrix (fb);
} }
static void static void
@@ -235,18 +233,24 @@ clutter_transform_node_class_init (ClutterTransformNodeClass *klass)
static void static void
clutter_transform_node_init (ClutterTransformNode *self) clutter_transform_node_init (ClutterTransformNode *self)
{ {
cogl_matrix_init_identity (&self->modelview); cogl_matrix_init_identity (&self->transform);
} }
/*
* clutter_transform_node_new:
* @transform: (nullable): the transform matrix to apply
*
* Return value: (transfer full): the newly created #ClutterTransformNode.
* Use clutter_paint_node_unref() when done.
*/
ClutterPaintNode * ClutterPaintNode *
_clutter_transform_node_new (const CoglMatrix *modelview) clutter_transform_node_new (const CoglMatrix *transform)
{ {
ClutterTransformNode *res; ClutterTransformNode *res;
res = _clutter_paint_node_create (_clutter_transform_node_get_type ()); res = _clutter_paint_node_create (CLUTTER_TYPE_TRANSFORM_NODE);
if (transform)
if (modelview != NULL) res->transform = *transform;
res->modelview = *modelview;
return (ClutterPaintNode *) res; return (ClutterPaintNode *) res;
} }
@@ -1078,10 +1082,114 @@ clutter_clip_node_new (void)
} }
/* /*
* ClutterLayerNode (private) * ClutterActorNode
*/ */
#define clutter_layer_node_get_type _clutter_layer_node_get_type struct _ClutterActorNode
{
ClutterPaintNode parent_instance;
ClutterActor *actor;
};
struct _ClutterActorNodeClass
{
ClutterPaintNodeClass parent_class;
};
G_DEFINE_TYPE (ClutterActorNode, clutter_actor_node, CLUTTER_TYPE_PAINT_NODE)
static gboolean
clutter_actor_node_pre_draw (ClutterPaintNode *node)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
CLUTTER_SET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
return TRUE;
}
static void
clutter_actor_node_draw (ClutterPaintNode *node)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
clutter_actor_continue_paint (actor_node->actor);
}
static void
clutter_actor_node_post_draw (ClutterPaintNode *node)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
CLUTTER_UNSET_PRIVATE_FLAGS (actor_node->actor, CLUTTER_IN_PAINT);
}
static JsonNode *
clutter_actor_node_serialize (ClutterPaintNode *node)
{
ClutterActorNode *actor_node = CLUTTER_ACTOR_NODE (node);
g_autoptr (JsonBuilder) builder = NULL;
const char *debug_name;
debug_name = _clutter_actor_get_debug_name (actor_node->actor);
builder = json_builder_new ();
json_builder_begin_object (builder);
json_builder_set_member_name (builder, "actor");
json_builder_add_string_value (builder, debug_name);
json_builder_end_object (builder);
return json_builder_get_root (builder);
}
static void
clutter_actor_node_class_init (ClutterActorNodeClass *klass)
{
ClutterPaintNodeClass *node_class;
node_class = CLUTTER_PAINT_NODE_CLASS (klass);
node_class->pre_draw = clutter_actor_node_pre_draw;
node_class->draw = clutter_actor_node_draw;
node_class->post_draw = clutter_actor_node_post_draw;
node_class->serialize = clutter_actor_node_serialize;
}
static void
clutter_actor_node_init (ClutterActorNode *self)
{
}
/*
* clutter_actor_node_new:
* @actor: the actor to paint
*
* Creates a new #ClutterActorNode.
*
* The actor is painted together with any effects
* applied to it. Children of this node will draw
* over the actor contents.
*
* Return value: (transfer full): the newly created #ClutterActorNode.
* Use clutter_paint_node_unref() when done.
*/
ClutterPaintNode *
clutter_actor_node_new (ClutterActor *actor)
{
ClutterActorNode *res;
g_assert (actor != NULL);
res = _clutter_paint_node_create (CLUTTER_TYPE_ACTOR_NODE);
res->actor = actor;
return (ClutterPaintNode *) res;
}
/*
* ClutterLayerNode
*/
struct _ClutterLayerNode struct _ClutterLayerNode
{ {
@@ -1268,11 +1376,11 @@ clutter_layer_node_init (ClutterLayerNode *self)
* Since: 1.10 * Since: 1.10
*/ */
ClutterPaintNode * ClutterPaintNode *
_clutter_layer_node_new (const CoglMatrix *projection, clutter_layer_node_new (const CoglMatrix *projection,
const cairo_rectangle_t *viewport, const cairo_rectangle_t *viewport,
float width, float width,
float height, float height,
guint8 opacity) guint8 opacity)
{ {
ClutterLayerNode *res; ClutterLayerNode *res;
CoglColor color; CoglColor color;

View File

@@ -143,6 +143,25 @@ CLUTTER_EXPORT
ClutterPaintNode * clutter_text_node_new (PangoLayout *layout, ClutterPaintNode * clutter_text_node_new (PangoLayout *layout,
const ClutterColor *color); const ClutterColor *color);
#define CLUTTER_TYPE_ACTOR_NODE (clutter_actor_node_get_type ())
#define CLUTTER_ACTOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTOR_NODE, ClutterActorNode))
#define CLUTTER_IS_ACTOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTOR_NODE))
/**
* ClutterActorNode:
*
* The #ClutterActorNode structure is an opaque
* type whose members cannot be directly accessed.
*/
typedef struct _ClutterActorNode ClutterActorNode;
typedef struct _ClutterActorNode ClutterActorNodeClass;
CLUTTER_EXPORT
GType clutter_actor_node_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterPaintNode * clutter_actor_node_new (ClutterActor *actor);
#define CLUTTER_TYPE_ROOT_NODE (clutter_root_node_get_type ()) #define CLUTTER_TYPE_ROOT_NODE (clutter_root_node_get_type ())
#define CLUTTER_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ROOT_NODE, ClutterRootNode)) #define CLUTTER_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ROOT_NODE, ClutterRootNode))
#define CLUTTER_IS_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ROOT_NODE)) #define CLUTTER_IS_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ROOT_NODE))
@@ -163,6 +182,54 @@ CLUTTER_EXPORT
ClutterPaintNode * clutter_root_node_new (CoglFramebuffer *framebuffer, ClutterPaintNode * clutter_root_node_new (CoglFramebuffer *framebuffer,
const ClutterColor *clear_color, const ClutterColor *clear_color,
CoglBufferBit clear_flags); CoglBufferBit clear_flags);
#define CLUTTER_TYPE_LAYER_NODE (clutter_layer_node_get_type ())
#define CLUTTER_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYER_NODE, ClutterLayerNode))
#define CLUTTER_IS_LAYER_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYER_NODE))
/*
* ClutterLayerNode:
*
* The #ClutterLayerNode structure is an opaque
* type whose members cannot be directly accessed.
*
* Since: 1.10
*/
typedef struct _ClutterLayerNode ClutterLayerNode;
typedef struct _ClutterLayerNodeClass ClutterLayerNodeClass;
CLUTTER_EXPORT
GType clutter_layer_node_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterPaintNode * clutter_layer_node_new (const CoglMatrix *projection,
const cairo_rectangle_t *viewport,
float width,
float height,
guint8 opacity);
#define CLUTTER_TYPE_TRANSFORM_NODE (clutter_transform_node_get_type ())
#define CLUTTER_TRANSFORM_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_TRANSFORM_NODE, ClutterTransformNode))
#define CLUTTER_IS_TRANSFORM_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_TRANSFORM_NODE))
/*
* ClutterTransformNode:
*
* The #ClutterLayerNode structure is an opaque
* type whose members cannot be directly accessed.
*
* Since: 1.10
*/
typedef struct _ClutterTransformNode ClutterTransformNode;
typedef struct _ClutterPaintNodeClass ClutterTransformNodeClass;
CLUTTER_EXPORT
GType clutter_transform_node_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterPaintNode * clutter_transform_node_new (const CoglMatrix *projection);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_PAINT_NODES_H__ */ #endif /* __CLUTTER_PAINT_NODES_H__ */

View File

@@ -58,7 +58,7 @@ struct _ClutterPaintVolume
* elements 4, 5, 6 and 7 most of the time for 2D actors when * elements 4, 5, 6 and 7 most of the time for 2D actors when
* calculating the projected paint box. * calculating the projected paint box.
*/ */
ClutterVertex vertices[8]; graphene_point3d_t vertices[8];
/* As an optimization for internally managed PaintVolumes we allow /* As an optimization for internally managed PaintVolumes we allow
* initializing ClutterPaintVolume variables allocated on the stack * initializing ClutterPaintVolume variables allocated on the stack

View File

@@ -63,7 +63,7 @@ _clutter_paint_volume_new (ClutterActor *actor)
pv->actor = actor; pv->actor = actor;
memset (pv->vertices, 0, 8 * sizeof (ClutterVertex)); memset (pv->vertices, 0, 8 * sizeof (graphene_point3d_t));
pv->is_static = FALSE; pv->is_static = FALSE;
pv->is_empty = TRUE; pv->is_empty = TRUE;
@@ -96,7 +96,7 @@ _clutter_paint_volume_init_static (ClutterPaintVolume *pv,
{ {
pv->actor = actor; pv->actor = actor;
memset (pv->vertices, 0, 8 * sizeof (ClutterVertex)); memset (pv->vertices, 0, 8 * sizeof (graphene_point3d_t));
pv->is_static = TRUE; pv->is_static = TRUE;
pv->is_empty = TRUE; pv->is_empty = TRUE;
@@ -170,7 +170,7 @@ clutter_paint_volume_free (ClutterPaintVolume *pv)
/** /**
* clutter_paint_volume_set_origin: * clutter_paint_volume_set_origin:
* @pv: a #ClutterPaintVolume * @pv: a #ClutterPaintVolume
* @origin: a #ClutterVertex * @origin: a #graphene_point3d_t
* *
* Sets the origin of the paint volume. * Sets the origin of the paint volume.
* *
@@ -182,8 +182,8 @@ clutter_paint_volume_free (ClutterPaintVolume *pv)
* Since: 1.6 * Since: 1.6
*/ */
void void
clutter_paint_volume_set_origin (ClutterPaintVolume *pv, clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
const ClutterVertex *origin) const graphene_point3d_t *origin)
{ {
static const int key_vertices[4] = { 0, 1, 3, 4 }; static const int key_vertices[4] = { 0, 1, 3, 4 };
float dx, dy, dz; float dx, dy, dz;
@@ -210,7 +210,7 @@ clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
/** /**
* clutter_paint_volume_get_origin: * clutter_paint_volume_get_origin:
* @pv: a #ClutterPaintVolume * @pv: a #ClutterPaintVolume
* @vertex: (out): the return location for a #ClutterVertex * @vertex: (out): the return location for a #graphene_point3d_t
* *
* Retrieves the origin of the #ClutterPaintVolume. * Retrieves the origin of the #ClutterPaintVolume.
* *
@@ -218,7 +218,7 @@ clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
*/ */
void void
clutter_paint_volume_get_origin (const ClutterPaintVolume *pv, clutter_paint_volume_get_origin (const ClutterPaintVolume *pv,
ClutterVertex *vertex) graphene_point3d_t *vertex)
{ {
g_return_if_fail (pv != NULL); g_return_if_fail (pv != NULL);
g_return_if_fail (vertex != NULL); g_return_if_fail (vertex != NULL);
@@ -659,7 +659,7 @@ clutter_paint_volume_union_box (ClutterPaintVolume *pv,
const ClutterActorBox *box) const ClutterActorBox *box)
{ {
ClutterPaintVolume volume; ClutterPaintVolume volume;
ClutterVertex origin; graphene_point3d_t origin;
g_return_if_fail (pv != NULL); g_return_if_fail (pv != NULL);
g_return_if_fail (box != NULL); g_return_if_fail (box != NULL);
@@ -757,7 +757,7 @@ _clutter_paint_volume_get_bounding_box (ClutterPaintVolume *pv,
ClutterActorBox *box) ClutterActorBox *box)
{ {
gfloat x_min, y_min, x_max, y_max; gfloat x_min, y_min, x_max, y_max;
ClutterVertex *vertices; graphene_point3d_t *vertices;
int count; int count;
gint i; gint i;
@@ -878,9 +878,9 @@ _clutter_paint_volume_transform (ClutterPaintVolume *pv,
cogl_matrix_transform_points (matrix, cogl_matrix_transform_points (matrix,
3, 3,
sizeof (ClutterVertex), sizeof (graphene_point3d_t),
pv->vertices, pv->vertices,
sizeof (ClutterVertex), sizeof (graphene_point3d_t),
pv->vertices, pv->vertices,
transform_count); transform_count);
@@ -896,7 +896,7 @@ _clutter_paint_volume_axis_align (ClutterPaintVolume *pv)
{ {
int count; int count;
int i; int i;
ClutterVertex origin; graphene_point3d_t origin;
float max_x; float max_x;
float max_y; float max_y;
float max_z; float max_z;
@@ -1075,7 +1075,7 @@ _clutter_paint_volume_cull (ClutterPaintVolume *pv,
const ClutterPlane *planes) const ClutterPlane *planes)
{ {
int vertex_count; int vertex_count;
ClutterVertex *vertices = pv->vertices; graphene_point3d_t *vertices = pv->vertices;
gboolean partial = FALSE; gboolean partial = FALSE;
int i; int i;
int j; int j;
@@ -1097,24 +1097,18 @@ _clutter_paint_volume_cull (ClutterPaintVolume *pv,
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
const ClutterPlane *plane = &planes[i];
int out = 0; int out = 0;
for (j = 0; j < vertex_count; j++) for (j = 0; j < vertex_count; j++)
{ {
ClutterVertex p; graphene_vec3_t v;
float distance;
/* XXX: for perspective projections this can be optimized graphene_vec3_init (&v,
* out because all the planes should pass through the origin vertices[j].x - graphene_vec3_get_x (&plane->v0),
* so (0,0,0) is a valid v0. */ vertices[j].y - graphene_vec3_get_y (&plane->v0),
p.x = vertices[j].x - planes[i].v0[0]; vertices[j].z - graphene_vec3_get_z (&plane->v0));
p.y = vertices[j].y - planes[i].v0[1];
p.z = vertices[j].z - planes[i].v0[2];
distance = (planes[i].n[0] * p.x + if (graphene_vec3_dot (&plane->n, &v) < 0)
planes[i].n[1] * p.y +
planes[i].n[2] * p.z);
if (distance < 0)
out++; out++;
} }

View File

@@ -27,8 +27,7 @@
* and bezier curves. * and bezier curves.
* *
* A #ClutterPath contains a description of a path consisting of * A #ClutterPath contains a description of a path consisting of
* straight lines and bezier curves. This can be used in a * straight lines and bezier curves.
* #ClutterBehaviourPath to animate an actor moving along the path.
* *
* The path consists of a series of nodes. Each node is one of the * The path consists of a series of nodes. Each node is one of the
* following four types: * following four types:
@@ -244,9 +243,6 @@ clutter_path_finalize (GObject *object)
* *
* Creates a new #ClutterPath instance with no nodes. * Creates a new #ClutterPath instance with no nodes.
* *
* The object has a floating reference so if you add it to a
* #ClutterBehaviourPath then you do not need to unref it.
*
* Return value: the newly created #ClutterPath * Return value: the newly created #ClutterPath
* *
* Since: 1.0 * Since: 1.0
@@ -267,9 +263,6 @@ clutter_path_new (void)
* @desc. See clutter_path_add_string() for details of the format of * @desc. See clutter_path_add_string() for details of the format of
* the string. * the string.
* *
* The object has a floating reference so if you add it to a
* #ClutterBehaviourPath then you do not need to unref it.
*
* Return value: the newly created #ClutterPath * Return value: the newly created #ClutterPath
* *
* Since: 1.0 * Since: 1.0

View File

@@ -64,10 +64,10 @@ typedef struct _ClutterVertex4 ClutterVertex4;
#define CLUTTER_UNSET_PRIVATE_FLAGS(a,f) (CLUTTER_PRIVATE_FLAGS (a) &= ~(f)) #define CLUTTER_UNSET_PRIVATE_FLAGS(a,f) (CLUTTER_PRIVATE_FLAGS (a) &= ~(f))
#define CLUTTER_ACTOR_IS_TOPLEVEL(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IS_TOPLEVEL) != FALSE) #define CLUTTER_ACTOR_IS_TOPLEVEL(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IS_TOPLEVEL) != FALSE)
#define CLUTTER_ACTOR_IS_INTERNAL_CHILD(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_INTERNAL_CHILD) != FALSE)
#define CLUTTER_ACTOR_IN_DESTRUCTION(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_DESTRUCTION) != FALSE) #define CLUTTER_ACTOR_IN_DESTRUCTION(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_DESTRUCTION) != FALSE)
#define CLUTTER_ACTOR_IN_REPARENT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_REPARENT) != FALSE) #define CLUTTER_ACTOR_IN_REPARENT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_REPARENT) != FALSE)
#define CLUTTER_ACTOR_IN_PAINT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PAINT) != FALSE) #define CLUTTER_ACTOR_IN_PAINT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PAINT) != FALSE)
#define CLUTTER_ACTOR_IN_PICK(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PICK) != FALSE)
#define CLUTTER_ACTOR_IN_RELAYOUT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_RELAYOUT) != FALSE) #define CLUTTER_ACTOR_IN_RELAYOUT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_RELAYOUT) != FALSE)
#define CLUTTER_ACTOR_IN_PREF_WIDTH(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_WIDTH) != FALSE) #define CLUTTER_ACTOR_IN_PREF_WIDTH(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_WIDTH) != FALSE)
#define CLUTTER_ACTOR_IN_PREF_HEIGHT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_HEIGHT) != FALSE) #define CLUTTER_ACTOR_IN_PREF_HEIGHT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_HEIGHT) != FALSE)
@@ -105,12 +105,10 @@ typedef enum
/* Used to avoid recursion */ /* Used to avoid recursion */
CLUTTER_IN_PAINT = 1 << 5, CLUTTER_IN_PAINT = 1 << 5,
CLUTTER_IN_PICK = 1 << 6,
/* Used to avoid recursion */ /* Used to avoid recursion */
CLUTTER_IN_RELAYOUT = 1 << 6, CLUTTER_IN_RELAYOUT = 1 << 7,
/* a flag for internal children of Containers (DEPRECATED) */
CLUTTER_INTERNAL_CHILD = 1 << 7
} ClutterPrivateFlags; } ClutterPrivateFlags;
/* /*
@@ -224,17 +222,17 @@ void _clutter_run_repaint_functions (ClutterRepaintFlags flags);
GType _clutter_layout_manager_get_child_meta_type (ClutterLayoutManager *manager); GType _clutter_layout_manager_get_child_meta_type (ClutterLayoutManager *manager);
void _clutter_util_fully_transform_vertices (const CoglMatrix *modelview, void _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
const CoglMatrix *projection, const CoglMatrix *projection,
const float *viewport, const float *viewport,
const ClutterVertex *vertices_in, const graphene_point3d_t *vertices_in,
ClutterVertex *vertices_out, graphene_point3d_t *vertices_out,
int n_vertices); int n_vertices);
void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src, void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
ClutterRect *dest); graphene_rect_t *dest);
void _clutter_util_rectangle_int_extents (const ClutterRect *src, void _clutter_util_rectangle_int_extents (const graphene_rect_t *src,
cairo_rectangle_int_t *dest); cairo_rectangle_int_t *dest);
void _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src, void _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src,
@@ -282,10 +280,10 @@ void _clutter_util_matrix_skew_yz (ClutterMatrix *matrix,
float factor); float factor);
gboolean _clutter_util_matrix_decompose (const ClutterMatrix *src, gboolean _clutter_util_matrix_decompose (const ClutterMatrix *src,
ClutterVertex *scale_p, graphene_point3d_t *scale_p,
float shear_p[3], float shear_p[3],
ClutterVertex *rotate_p, graphene_point3d_t *rotate_p,
ClutterVertex *translate_p, graphene_point3d_t *translate_p,
ClutterVertex4 *perspective_p); ClutterVertex4 *perspective_p);
CLUTTER_EXPORT CLUTTER_EXPORT
@@ -296,8 +294,8 @@ PangoDirection _clutter_pango_find_base_dir (const gchar *text,
typedef struct _ClutterPlane typedef struct _ClutterPlane
{ {
float v0[3]; graphene_vec3_t v0;
float n[3]; graphene_vec3_t n;
} ClutterPlane; } ClutterPlane;
typedef enum _ClutterCullResult typedef enum _ClutterCullResult
@@ -315,6 +313,8 @@ gboolean _clutter_run_progress_function (GType gtype,
gdouble progress, gdouble progress,
GValue *retval); GValue *retval);
void clutter_timeline_cancel_delay (ClutterTimeline *timeline);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_PRIVATE_H__ */ #endif /* __CLUTTER_PRIVATE_H__ */

View File

@@ -352,63 +352,64 @@ _clutter_script_parse_knot (ClutterScript *script,
} }
static gboolean static gboolean
parse_geometry_from_array (JsonArray *array, parse_rect_from_array (JsonArray *array,
ClutterGeometry *geometry) graphene_rect_t *rect)
{ {
if (json_array_get_length (array) != 4) if (json_array_get_length (array) != 4)
return FALSE; return FALSE;
geometry->x = json_array_get_int_element (array, 0); graphene_rect_init (rect,
geometry->y = json_array_get_int_element (array, 1); json_array_get_int_element (array, 0),
geometry->width = json_array_get_int_element (array, 2); json_array_get_int_element (array, 1),
geometry->height = json_array_get_int_element (array, 3); json_array_get_int_element (array, 2),
json_array_get_int_element (array, 3));
return TRUE; return TRUE;
} }
static gboolean static gboolean
parse_geometry_from_object (JsonObject *object, parse_rect_from_object (JsonObject *object,
ClutterGeometry *geometry) graphene_rect_t *rect)
{ {
if (json_object_has_member (object, "x")) if (json_object_has_member (object, "x"))
geometry->x = json_object_get_int_member (object, "x"); rect->origin.x = json_object_get_int_member (object, "x");
else else
geometry->x = 0; rect->origin.x = 0;
if (json_object_has_member (object, "y")) if (json_object_has_member (object, "y"))
geometry->y = json_object_get_int_member (object, "y"); rect->origin.y = json_object_get_int_member (object, "y");
else else
geometry->y = 0; rect->origin.y = 0;
if (json_object_has_member (object, "width")) if (json_object_has_member (object, "width"))
geometry->width = json_object_get_int_member (object, "width"); rect->size.width = json_object_get_int_member (object, "width");
else else
geometry->width = 0; rect->size.width = 0;
if (json_object_has_member (object, "height")) if (json_object_has_member (object, "height"))
geometry->height = json_object_get_int_member (object, "height"); rect->size.height = json_object_get_int_member (object, "height");
else else
geometry->height = 0; rect->size.height = 0;
return TRUE; return TRUE;
} }
gboolean gboolean
_clutter_script_parse_geometry (ClutterScript *script, _clutter_script_parse_rect (ClutterScript *script,
JsonNode *node, JsonNode *node,
ClutterGeometry *geometry) graphene_rect_t *rect)
{ {
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE); g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (node != NULL, FALSE);
g_return_val_if_fail (geometry != NULL, FALSE); g_return_val_if_fail (rect != NULL, FALSE);
switch (JSON_NODE_TYPE (node)) switch (JSON_NODE_TYPE (node))
{ {
case JSON_NODE_ARRAY: case JSON_NODE_ARRAY:
return parse_geometry_from_array (json_node_get_array (node), geometry); return parse_rect_from_array (json_node_get_array (node), rect);
case JSON_NODE_OBJECT: case JSON_NODE_OBJECT:
return parse_geometry_from_object (json_node_get_object (node), geometry); return parse_rect_from_object (json_node_get_object (node), rect);
default: default:
break; break;
@@ -492,8 +493,8 @@ _clutter_script_parse_color (ClutterScript *script,
} }
static gboolean static gboolean
parse_point_from_array (JsonArray *array, parse_point_from_array (JsonArray *array,
ClutterPoint *point) graphene_point_t *point)
{ {
if (json_array_get_length (array) != 2) if (json_array_get_length (array) != 2)
return FALSE; return FALSE;
@@ -505,8 +506,8 @@ parse_point_from_array (JsonArray *array,
} }
static gboolean static gboolean
parse_point_from_object (JsonObject *object, parse_point_from_object (JsonObject *object,
ClutterPoint *point) graphene_point_t *point)
{ {
if (json_object_has_member (object, "x")) if (json_object_has_member (object, "x"))
point->x = json_object_get_double_member (object, "x"); point->x = json_object_get_double_member (object, "x");
@@ -522,9 +523,9 @@ parse_point_from_object (JsonObject *object,
} }
gboolean gboolean
_clutter_script_parse_point (ClutterScript *script, _clutter_script_parse_point (ClutterScript *script,
JsonNode *node, JsonNode *node,
ClutterPoint *point) graphene_point_t *point)
{ {
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE); g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (node != NULL, FALSE);
@@ -546,8 +547,8 @@ _clutter_script_parse_point (ClutterScript *script,
} }
static gboolean static gboolean
parse_size_from_array (JsonArray *array, parse_size_from_array (JsonArray *array,
ClutterSize *size) graphene_size_t *size)
{ {
if (json_array_get_length (array) != 2) if (json_array_get_length (array) != 2)
return FALSE; return FALSE;
@@ -559,8 +560,8 @@ parse_size_from_array (JsonArray *array,
} }
static gboolean static gboolean
parse_size_from_object (JsonObject *object, parse_size_from_object (JsonObject *object,
ClutterSize *size) graphene_size_t *size)
{ {
if (json_object_has_member (object, "width")) if (json_object_has_member (object, "width"))
size->width = json_object_get_double_member (object, "width"); size->width = json_object_get_double_member (object, "width");
@@ -576,9 +577,9 @@ parse_size_from_object (JsonObject *object,
} }
gboolean gboolean
_clutter_script_parse_size (ClutterScript *script, _clutter_script_parse_size (ClutterScript *script,
JsonNode *node, JsonNode *node,
ClutterSize *size) graphene_size_t *size)
{ {
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE); g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (node != NULL, FALSE);
@@ -1328,11 +1329,11 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE; return TRUE;
} }
} }
else if (p_type == CLUTTER_TYPE_GEOMETRY) else if (p_type == GRAPHENE_TYPE_RECT)
{ {
ClutterGeometry geom = { 0, }; graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
/* geometry := { /* rect := {
* "x" : (int), * "x" : (int),
* "y" : (int), * "y" : (int),
* "width" : (int), * "width" : (int),
@@ -1340,9 +1341,9 @@ _clutter_script_parse_node (ClutterScript *script,
* } * }
*/ */
if (_clutter_script_parse_geometry (script, node, &geom)) if (_clutter_script_parse_rect (script, node, &rect))
{ {
g_value_set_boxed (value, &geom); g_value_set_boxed (value, &rect);
return TRUE; return TRUE;
} }
} }
@@ -1364,9 +1365,9 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE; return TRUE;
} }
} }
else if (p_type == CLUTTER_TYPE_POINT) else if (p_type == GRAPHENE_TYPE_POINT)
{ {
ClutterPoint point = CLUTTER_POINT_INIT_ZERO; graphene_point_t point = GRAPHENE_POINT_INIT_ZERO;
if (_clutter_script_parse_point (script, node, &point)) if (_clutter_script_parse_point (script, node, &point))
{ {
@@ -1374,9 +1375,9 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE; return TRUE;
} }
} }
else if (p_type == CLUTTER_TYPE_SIZE) else if (p_type == GRAPHENE_TYPE_SIZE)
{ {
ClutterSize size = CLUTTER_SIZE_INIT_ZERO; graphene_size_t size = GRAPHENE_SIZE_INIT_ZERO;
if (_clutter_script_parse_size (script, node, &size)) if (_clutter_script_parse_size (script, node, &size))
{ {
@@ -1417,15 +1418,15 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE; return TRUE;
} }
} }
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_GEOMETRY)) else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_RECT))
{ {
ClutterGeometry geom = { 0, }; graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
/* geometry := [ (int), (int), (int), (int) ] */ /* rect := [ (int), (int), (int), (int) ] */
if (_clutter_script_parse_geometry (script, node, &geom)) if (_clutter_script_parse_rect (script, node, &rect))
{ {
g_value_set_boxed (value, &geom); g_value_set_boxed (value, &rect);
return TRUE; return TRUE;
} }
} }
@@ -1441,9 +1442,9 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE; return TRUE;
} }
} }
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_POINT)) else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_POINT))
{ {
ClutterPoint point = CLUTTER_POINT_INIT_ZERO; graphene_point_t point = GRAPHENE_POINT_INIT_ZERO;
if (_clutter_script_parse_point (script, node, &point)) if (_clutter_script_parse_point (script, node, &point))
{ {
@@ -1451,9 +1452,9 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE; return TRUE;
} }
} }
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_SIZE)) else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_SIZE))
{ {
ClutterSize size = CLUTTER_SIZE_INIT_ZERO; graphene_size_t size = GRAPHENE_SIZE_INIT_ZERO;
if (_clutter_script_parse_size (script, node, &size)) if (_clutter_script_parse_size (script, node, &size))
{ {

View File

@@ -122,20 +122,20 @@ gboolean _clutter_script_flags_from_string (GType gtype,
gboolean _clutter_script_parse_knot (ClutterScript *script, gboolean _clutter_script_parse_knot (ClutterScript *script,
JsonNode *node, JsonNode *node,
ClutterKnot *knot); ClutterKnot *knot);
gboolean _clutter_script_parse_geometry (ClutterScript *script, gboolean _clutter_script_parse_rect (ClutterScript *script,
JsonNode *node, JsonNode *node,
ClutterGeometry *geometry); graphene_rect_t *rect);
gboolean _clutter_script_parse_color (ClutterScript *script, gboolean _clutter_script_parse_color (ClutterScript *script,
JsonNode *node, JsonNode *node,
ClutterColor *color); ClutterColor *color);
GObject *_clutter_script_parse_alpha (ClutterScript *script, GObject *_clutter_script_parse_alpha (ClutterScript *script,
JsonNode *node); JsonNode *node);
gboolean _clutter_script_parse_point (ClutterScript *script, gboolean _clutter_script_parse_point (ClutterScript *script,
JsonNode *node, JsonNode *node,
ClutterPoint *point); graphene_point_t *point);
gboolean _clutter_script_parse_size (ClutterScript *script, gboolean _clutter_script_parse_size (ClutterScript *script,
JsonNode *node, JsonNode *node,
ClutterSize *size); graphene_size_t *size);
gboolean _clutter_script_parse_translatable_string (ClutterScript *script, gboolean _clutter_script_parse_translatable_string (ClutterScript *script,
JsonNode *node, JsonNode *node,

View File

@@ -75,65 +75,6 @@
* packing rules of Clutter still apply, and an actor cannot be packed * packing rules of Clutter still apply, and an actor cannot be packed
* in multiple containers without unparenting it in between). * in multiple containers without unparenting it in between).
* *
* Behaviours and timelines can also be defined inside a UI definition
* buffer:
*
* <informalexample><programlisting><![CDATA[
* {
* "id" : "rotate-behaviour",
* "type" : "ClutterBehaviourRotate",
* "angle-start" : 0.0,
* "angle-end" : 360.0,
* "axis" : "z-axis",
* "alpha" : {
* "timeline" : { "duration" : 4000, "loop" : true },
* "mode" : "easeInSine"
* }
* }
* ]]></programlisting></informalexample>
*
* And then to apply a defined behaviour to an actor defined inside the
* definition of an actor, the "behaviour" member can be used:
*
* <informalexample><programlisting><![CDATA[
* {
* "id" : "my-rotating-actor",
* "type" : "ClutterTexture",
* ...
* "behaviours" : [ "rotate-behaviour" ]
* }
* ]]></programlisting></informalexample>
*
* A #ClutterAlpha belonging to a #ClutterBehaviour can only be defined
* implicitly like in the example above, or explicitly by setting the
* "alpha" property to point to a previously defined #ClutterAlpha, e.g.:
*
* <informalexample><programlisting><![CDATA[
* {
* "id" : "rotate-behaviour",
* "type" : "ClutterBehaviourRotate",
* "angle-start" : 0.0,
* "angle-end" : 360.0,
* "axis" : "z-axis",
* "alpha" : {
* "id" : "rotate-alpha",
* "type" : "ClutterAlpha",
* "timeline" : {
* "id" : "rotate-timeline",
* "type : "ClutterTimeline",
* "duration" : 4000,
* "loop" : true
* },
* "function" : "custom_sine_alpha"
* }
* }
* ]]></programlisting></informalexample>
*
* Implicitely defined #ClutterAlpha<!-- -->s and #ClutterTimeline<!-- -->s
* can omit the `id`, as well as the `type` members, but will not be available
* using clutter_script_get_object() (they can, however, be extracted using the
* #ClutterBehaviour and #ClutterAlpha API respectively).
*
* Signal handlers can be defined inside a Clutter UI definition file and * Signal handlers can be defined inside a Clutter UI definition file and
* then autoconnected to their respective signals using the * then autoconnected to their respective signals using the
* clutter_script_connect_signals() function: * clutter_script_connect_signals() function:
@@ -210,7 +151,6 @@
* function * function
* "type_func" := the GType function name, for non-standard classes * "type_func" := the GType function name, for non-standard classes
* "children" := an array of names or objects to add as children * "children" := an array of names or objects to add as children
* "behaviours" := an array of names or objects to apply to an actor
* "signals" := an array of signal definitions to connect to an object * "signals" := an array of signal definitions to connect to an object
* "is-default" := a boolean flag used when defining the #ClutterStage; * "is-default" := a boolean flag used when defining the #ClutterStage;
* if set to "true" the default stage will be used instead * if set to "true" the default stage will be used instead
@@ -246,7 +186,6 @@
#include "clutter-debug.h" #include "clutter-debug.h"
#include "deprecated/clutter-alpha.h" #include "deprecated/clutter-alpha.h"
#include "deprecated/clutter-behaviour.h"
#include "deprecated/clutter-container.h" #include "deprecated/clutter-container.h"
#include "deprecated/clutter-state.h" #include "deprecated/clutter-state.h"
@@ -524,11 +463,10 @@ clutter_script_init (ClutterScript *script)
/** /**
* clutter_script_new: * clutter_script_new:
* *
* Creates a new #ClutterScript instance. #ClutterScript can be used * Creates a new #ClutterScript instance. #ClutterScript can be used to load
* to load objects definitions for scenegraph elements, like actors, * objects definitions for scenegraph elements, like actors, or behavioural
* or behavioural elements, like behaviours and timelines. The * elements, like timelines. The definitions must be encoded using the
* definitions must be encoded using the JavaScript Object Notation (JSON) * JavaScript Object Notation (JSON) language.
* language.
* *
* Return value: the newly created #ClutterScript instance. Use * Return value: the newly created #ClutterScript instance. Use
* g_object_unref() when done. * g_object_unref() when done.
@@ -863,9 +801,7 @@ construct_each_objects (gpointer key,
if (oinfo->object == NULL) if (oinfo->object == NULL)
_clutter_script_construct_object (script, oinfo); _clutter_script_construct_object (script, oinfo);
/* this will take care of setting up properties, /* this will take care of setting up properties and adding children */
* adding children and applying behaviours
*/
_clutter_script_apply_properties (script, oinfo); _clutter_script_apply_properties (script, oinfo);
} }
} }

View File

@@ -56,7 +56,7 @@
struct _ClutterScrollActorPrivate struct _ClutterScrollActorPrivate
{ {
ClutterPoint scroll_to; graphene_point_t scroll_to;
ClutterScrollMode scroll_mode; ClutterScrollMode scroll_mode;
@@ -94,19 +94,19 @@ G_DEFINE_TYPE_WITH_CODE (ClutterScrollActor, clutter_scroll_actor, CLUTTER_TYPE_
clutter_animatable_iface_init)) clutter_animatable_iface_init))
static void static void
clutter_scroll_actor_set_scroll_to_internal (ClutterScrollActor *self, clutter_scroll_actor_set_scroll_to_internal (ClutterScrollActor *self,
const ClutterPoint *point) const graphene_point_t *point)
{ {
ClutterScrollActorPrivate *priv = self->priv; ClutterScrollActorPrivate *priv = self->priv;
ClutterActor *actor = CLUTTER_ACTOR (self); ClutterActor *actor = CLUTTER_ACTOR (self);
ClutterMatrix m = CLUTTER_MATRIX_INIT_IDENTITY; ClutterMatrix m = CLUTTER_MATRIX_INIT_IDENTITY;
float dx, dy; float dx, dy;
if (clutter_point_equals (&priv->scroll_to, point)) if (graphene_point_equal (&priv->scroll_to, point))
return; return;
if (point == NULL) if (point == NULL)
clutter_point_init (&priv->scroll_to, 0.f, 0.f); graphene_point_init (&priv->scroll_to, 0.f, 0.f);
else else
priv->scroll_to = *point; priv->scroll_to = *point;
@@ -216,7 +216,7 @@ clutter_scroll_actor_set_final_state (ClutterAnimatable *animatable,
if (strcmp (property_name, "scroll-to") == 0) if (strcmp (property_name, "scroll-to") == 0)
{ {
ClutterScrollActor *self = CLUTTER_SCROLL_ACTOR (animatable); ClutterScrollActor *self = CLUTTER_SCROLL_ACTOR (animatable);
const ClutterPoint *point = g_value_get_boxed (value); const graphene_point_t *point = g_value_get_boxed (value);
clutter_scroll_actor_set_scroll_to_internal (self, point); clutter_scroll_actor_set_scroll_to_internal (self, point);
} }
@@ -248,7 +248,7 @@ clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
g_param_spec_boxed ("scroll-to", g_param_spec_boxed ("scroll-to",
"Scroll To", "Scroll To",
"The point to scroll the actor to", "The point to scroll the actor to",
CLUTTER_TYPE_POINT, GRAPHENE_TYPE_POINT,
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS | G_PARAM_STATIC_STRINGS |
CLUTTER_PARAM_ANIMATABLE); CLUTTER_PARAM_ANIMATABLE);
@@ -322,7 +322,7 @@ clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor)
/** /**
* clutter_scroll_actor_scroll_to_point: * clutter_scroll_actor_scroll_to_point:
* @actor: a #ClutterScrollActor * @actor: a #ClutterScrollActor
* @point: a #ClutterPoint * @point: a #graphene_point_t
* *
* Scrolls the contents of @actor so that @point is the new origin * Scrolls the contents of @actor so that @point is the new origin
* of the visible area. * of the visible area.
@@ -335,8 +335,8 @@ clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor)
* Since: 1.12 * Since: 1.12
*/ */
void void
clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor, clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
const ClutterPoint *point) const graphene_point_t *point)
{ {
ClutterScrollActorPrivate *priv; ClutterScrollActorPrivate *priv;
const ClutterAnimationInfo *info; const ClutterAnimationInfo *info;
@@ -390,10 +390,10 @@ clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
/* if a transition already exist, update its bounds */ /* if a transition already exist, update its bounds */
clutter_transition_set_from (priv->transition, clutter_transition_set_from (priv->transition,
CLUTTER_TYPE_POINT, GRAPHENE_TYPE_POINT,
&priv->scroll_to); &priv->scroll_to);
clutter_transition_set_to (priv->transition, clutter_transition_set_to (priv->transition,
CLUTTER_TYPE_POINT, GRAPHENE_TYPE_POINT,
point); point);
/* always use the current easing state */ /* always use the current easing state */
@@ -417,10 +417,10 @@ clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
* Since: 1.12 * Since: 1.12
*/ */
void void
clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor, clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
const ClutterRect *rect) const graphene_rect_t *rect)
{ {
ClutterRect n_rect; graphene_rect_t n_rect;
g_return_if_fail (CLUTTER_IS_SCROLL_ACTOR (actor)); g_return_if_fail (CLUTTER_IS_SCROLL_ACTOR (actor));
g_return_if_fail (rect != NULL); g_return_if_fail (rect != NULL);
@@ -428,7 +428,7 @@ clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
n_rect = *rect; n_rect = *rect;
/* normalize, so that we have a valid origin */ /* normalize, so that we have a valid origin */
clutter_rect_normalize (&n_rect); graphene_rect_normalize (&n_rect);
clutter_scroll_actor_scroll_to_point (actor, &n_rect.origin); clutter_scroll_actor_scroll_to_point (actor, &n_rect.origin);
} }

View File

@@ -86,11 +86,11 @@ CLUTTER_EXPORT
ClutterScrollMode clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor); ClutterScrollMode clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor, void clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
const ClutterPoint *point); const graphene_point_t *point);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor, void clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
const ClutterRect *rect); const graphene_rect_t *rect);
G_END_DECLS G_END_DECLS

View File

@@ -177,18 +177,18 @@ clutter_shader_effect_clear (ClutterShaderEffect *self,
{ {
ClutterShaderEffectPrivate *priv = self->priv; ClutterShaderEffectPrivate *priv = self->priv;
if (priv->shader != COGL_INVALID_HANDLE) if (priv->shader != NULL)
{ {
cogl_handle_unref (priv->shader); cogl_object_unref (priv->shader);
priv->shader = COGL_INVALID_HANDLE; priv->shader = NULL;
} }
if (priv->program != COGL_INVALID_HANDLE) if (priv->program != NULL)
{ {
cogl_handle_unref (priv->program); cogl_object_unref (priv->program);
priv->program = COGL_INVALID_HANDLE; priv->program = NULL;
} }
if (reset_uniforms && priv->uniforms != NULL) if (reset_uniforms && priv->uniforms != NULL)
@@ -208,7 +208,7 @@ clutter_shader_effect_update_uniforms (ClutterShaderEffect *effect)
gpointer key, value; gpointer key, value;
gsize size; gsize size;
if (priv->program == COGL_INVALID_HANDLE) if (priv->program == NULL)
return; return;
if (priv->uniforms == NULL) if (priv->uniforms == NULL)
@@ -333,7 +333,7 @@ clutter_shader_effect_create_shader (ClutterShaderEffect *self)
default: default:
g_assert_not_reached (); g_assert_not_reached ();
return COGL_INVALID_HANDLE; return NULL;
} }
} }
@@ -353,7 +353,7 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
CLUTTER_TYPE_SHADER_EFFECT, CLUTTER_TYPE_SHADER_EFFECT,
ClutterShaderEffectClassPrivate); ClutterShaderEffectClassPrivate);
if (class_priv->shader == COGL_INVALID_HANDLE) if (class_priv->shader == NULL)
{ {
gchar *source; gchar *source;
@@ -387,10 +387,10 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self)
} }
} }
priv->shader = cogl_handle_ref (class_priv->shader); priv->shader = cogl_object_ref (class_priv->shader);
if (class_priv->program != COGL_INVALID_HANDLE) if (class_priv->program != NULL)
priv->program = cogl_handle_ref (class_priv->program); priv->program = cogl_object_ref (class_priv->program);
} }
} }
@@ -404,13 +404,13 @@ clutter_shader_effect_paint_target (ClutterOffscreenEffect *effect)
/* If the source hasn't been set then we'll try to get it from the /* If the source hasn't been set then we'll try to get it from the
static source instead */ static source instead */
if (priv->shader == COGL_INVALID_HANDLE) if (priv->shader == NULL)
clutter_shader_effect_try_static_source (self); clutter_shader_effect_try_static_source (self);
/* we haven't been prepared or we don't have support for /* we haven't been prepared or we don't have support for
* GLSL shaders in Clutter * GLSL shaders in Clutter
*/ */
if (priv->program == COGL_INVALID_HANDLE) if (priv->program == NULL)
goto out; goto out;
CLUTTER_NOTE (SHADER, "Applying the shader effect of type '%s'", CLUTTER_NOTE (SHADER, "Applying the shader effect of type '%s'",
@@ -500,6 +500,7 @@ static void
clutter_shader_effect_init (ClutterShaderEffect *effect) clutter_shader_effect_init (ClutterShaderEffect *effect)
{ {
effect->priv = clutter_shader_effect_get_instance_private (effect); effect->priv = clutter_shader_effect_get_instance_private (effect);
effect->priv->shader_type = CLUTTER_FRAGMENT_SHADER;
} }
/** /**
@@ -533,7 +534,7 @@ clutter_shader_effect_new (ClutterShaderType shader_type)
* Retrieves a pointer to the shader's handle * Retrieves a pointer to the shader's handle
* *
* Return value: (transfer none): a pointer to the shader's handle, * Return value: (transfer none): a pointer to the shader's handle,
* or %COGL_INVALID_HANDLE * or %NULL
* *
* Since: 1.4 * Since: 1.4
*/ */
@@ -541,7 +542,7 @@ CoglHandle
clutter_shader_effect_get_shader (ClutterShaderEffect *effect) clutter_shader_effect_get_shader (ClutterShaderEffect *effect)
{ {
g_return_val_if_fail (CLUTTER_IS_SHADER_EFFECT (effect), g_return_val_if_fail (CLUTTER_IS_SHADER_EFFECT (effect),
COGL_INVALID_HANDLE); NULL);
return effect->priv->shader; return effect->priv->shader;
} }
@@ -553,7 +554,7 @@ clutter_shader_effect_get_shader (ClutterShaderEffect *effect)
* Retrieves a pointer to the program's handle * Retrieves a pointer to the program's handle
* *
* Return value: (transfer none): a pointer to the program's handle, * Return value: (transfer none): a pointer to the program's handle,
* or %COGL_INVALID_HANDLE * or %NULL
* *
* Since: 1.4 * Since: 1.4
*/ */
@@ -561,7 +562,7 @@ CoglHandle
clutter_shader_effect_get_program (ClutterShaderEffect *effect) clutter_shader_effect_get_program (ClutterShaderEffect *effect)
{ {
g_return_val_if_fail (CLUTTER_IS_SHADER_EFFECT (effect), g_return_val_if_fail (CLUTTER_IS_SHADER_EFFECT (effect),
COGL_INVALID_HANDLE); NULL);
return effect->priv->program; return effect->priv->program;
} }
@@ -891,7 +892,7 @@ clutter_shader_effect_set_shader_source (ClutterShaderEffect *effect,
priv = effect->priv; priv = effect->priv;
if (priv->shader != COGL_INVALID_HANDLE) if (priv->shader != NULL)
return TRUE; return TRUE;
priv->shader = clutter_shader_effect_create_shader (effect); priv->shader = clutter_shader_effect_create_shader (effect);

View File

@@ -79,18 +79,18 @@ gint64 _clutter_stage_get_update_time (ClutterStage *stage);
void _clutter_stage_clear_update_time (ClutterStage *stage); void _clutter_stage_clear_update_time (ClutterStage *stage);
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage); gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
void clutter_stage_log_pick (ClutterStage *stage, void clutter_stage_log_pick (ClutterStage *stage,
const ClutterPoint *vertices, const graphene_point_t *vertices,
ClutterActor *actor); ClutterActor *actor);
void clutter_stage_push_pick_clip (ClutterStage *stage, void clutter_stage_push_pick_clip (ClutterStage *stage,
const ClutterPoint *vertices); const graphene_point_t *vertices);
void clutter_stage_pop_pick_clip (ClutterStage *stage); void clutter_stage_pop_pick_clip (ClutterStage *stage);
ClutterActor *_clutter_stage_do_pick (ClutterStage *stage, ClutterActor *_clutter_stage_do_pick (ClutterStage *stage,
gint x, float x,
gint y, float y,
ClutterPickMode mode); ClutterPickMode mode);
ClutterPaintVolume *_clutter_stage_paint_volume_stack_allocate (ClutterStage *stage); ClutterPaintVolume *_clutter_stage_paint_volume_stack_allocate (ClutterStage *stage);
@@ -133,9 +133,9 @@ gboolean _clutter_stage_update_state (ClutterStage *stag
void _clutter_stage_set_scale_factor (ClutterStage *stage, void _clutter_stage_set_scale_factor (ClutterStage *stage,
int factor); int factor);
gboolean _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage, gboolean _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
ClutterRect *rect, graphene_rect_t *rect,
float *view_scale); float *view_scale);
void _clutter_stage_presented (ClutterStage *stage, void _clutter_stage_presented (ClutterStage *stage,
CoglFrameEvent frame_event, CoglFrameEvent frame_event,

View File

@@ -20,8 +20,8 @@
#include "clutter/clutter-stage-view.h" #include "clutter/clutter-stage-view.h"
void clutter_stage_view_blit_offscreen (ClutterStageView *view, void clutter_stage_view_after_paint (ClutterStageView *view,
const cairo_rectangle_int_t *clip); const cairo_rectangle_int_t *clip);
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view); gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);

View File

@@ -30,6 +30,7 @@ enum
PROP_LAYOUT, PROP_LAYOUT,
PROP_FRAMEBUFFER, PROP_FRAMEBUFFER,
PROP_OFFSCREEN, PROP_OFFSCREEN,
PROP_SHADOWFB,
PROP_SCALE, PROP_SCALE,
PROP_LAST PROP_LAST
@@ -44,7 +45,10 @@ typedef struct _ClutterStageViewPrivate
CoglFramebuffer *framebuffer; CoglFramebuffer *framebuffer;
CoglOffscreen *offscreen; CoglOffscreen *offscreen;
CoglPipeline *pipeline; CoglPipeline *offscreen_pipeline;
CoglOffscreen *shadowfb;
CoglPipeline *shadowfb_pipeline;
guint dirty_viewport : 1; guint dirty_viewport : 1;
guint dirty_projection : 1; guint dirty_projection : 1;
@@ -78,6 +82,8 @@ clutter_stage_view_get_framebuffer (ClutterStageView *view)
if (priv->offscreen) if (priv->offscreen)
return priv->offscreen; return priv->offscreen;
else if (priv->shadowfb)
return priv->shadowfb;
else else
return priv->framebuffer; return priv->framebuffer;
} }
@@ -99,6 +105,24 @@ clutter_stage_view_get_onscreen (ClutterStageView *view)
return priv->framebuffer; return priv->framebuffer;
} }
static CoglPipeline *
clutter_stage_view_create_framebuffer_pipeline (CoglFramebuffer *framebuffer)
{
CoglPipeline *pipeline;
pipeline = cogl_pipeline_new (cogl_framebuffer_get_context (framebuffer));
cogl_pipeline_set_layer_filters (pipeline, 0,
COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
cogl_pipeline_set_layer_texture (pipeline, 0,
cogl_offscreen_get_texture (framebuffer));
cogl_pipeline_set_layer_wrap_mode (pipeline, 0,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
return pipeline;
}
static void static void
clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view) clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
{ {
@@ -109,21 +133,27 @@ clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
g_assert (priv->offscreen != NULL); g_assert (priv->offscreen != NULL);
if (priv->pipeline) if (priv->offscreen_pipeline)
return; return;
priv->pipeline = priv->offscreen_pipeline =
cogl_pipeline_new (cogl_framebuffer_get_context (priv->offscreen)); clutter_stage_view_create_framebuffer_pipeline (priv->offscreen);
cogl_pipeline_set_layer_filters (priv->pipeline, 0,
COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
cogl_pipeline_set_layer_texture (priv->pipeline, 0,
cogl_offscreen_get_texture (priv->offscreen));
cogl_pipeline_set_layer_wrap_mode (priv->pipeline, 0,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
if (view_class->setup_offscreen_blit_pipeline) if (view_class->setup_offscreen_blit_pipeline)
view_class->setup_offscreen_blit_pipeline (view, priv->pipeline); view_class->setup_offscreen_blit_pipeline (view, priv->offscreen_pipeline);
}
static void
clutter_stage_view_ensure_shadowfb_blit_pipeline (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
if (priv->shadowfb_pipeline)
return;
priv->shadowfb_pipeline =
clutter_stage_view_create_framebuffer_pipeline (priv->shadowfb);
} }
void void
@@ -132,33 +162,93 @@ clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
ClutterStageViewPrivate *priv = ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view); clutter_stage_view_get_instance_private (view);
g_clear_pointer (&priv->pipeline, cogl_object_unref); g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
} }
void static void
clutter_stage_view_blit_offscreen (ClutterStageView *view, clutter_stage_view_copy_to_framebuffer (ClutterStageView *view,
const cairo_rectangle_int_t *rect) const cairo_rectangle_int_t *rect,
CoglPipeline *pipeline,
CoglFramebuffer *src_framebuffer,
CoglFramebuffer *dst_framebuffer,
gboolean can_blit)
{ {
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
CoglMatrix matrix; CoglMatrix matrix;
clutter_stage_view_ensure_offscreen_blit_pipeline (view); /* First, try with blit */
cogl_framebuffer_push_matrix (priv->framebuffer); if (can_blit)
{
if (cogl_blit_framebuffer (src_framebuffer,
dst_framebuffer,
0, 0,
0, 0,
cogl_framebuffer_get_width (dst_framebuffer),
cogl_framebuffer_get_height (dst_framebuffer),
NULL))
return;
}
/* If blit fails, fallback to the slower painting method */
cogl_framebuffer_push_matrix (dst_framebuffer);
/* Set transform so 0,0 is on the top left corner and 1,1 on
* the bottom right corner.
*/
cogl_matrix_init_identity (&matrix); cogl_matrix_init_identity (&matrix);
cogl_matrix_translate (&matrix, -1, 1, 0); cogl_matrix_translate (&matrix, -1, 1, 0);
cogl_matrix_scale (&matrix, 2, -2, 0); cogl_matrix_scale (&matrix, 2, -2, 0);
cogl_framebuffer_set_projection_matrix (priv->framebuffer, &matrix); cogl_framebuffer_set_projection_matrix (dst_framebuffer, &matrix);
cogl_framebuffer_draw_rectangle (priv->framebuffer, cogl_framebuffer_draw_rectangle (dst_framebuffer,
priv->pipeline, pipeline,
0, 0, 1, 1); 0, 0, 1, 1);
cogl_framebuffer_pop_matrix (priv->framebuffer); cogl_framebuffer_pop_matrix (dst_framebuffer);
}
void
clutter_stage_view_after_paint (ClutterStageView *view,
const cairo_rectangle_int_t *rect)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
if (priv->offscreen)
{
gboolean can_blit;
CoglMatrix matrix;
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
can_blit = cogl_matrix_is_identity (&matrix);
if (priv->shadowfb)
{
clutter_stage_view_copy_to_framebuffer (view,
rect,
priv->offscreen_pipeline,
priv->offscreen,
priv->shadowfb,
can_blit);
}
else
{
clutter_stage_view_copy_to_framebuffer (view,
rect,
priv->offscreen_pipeline,
priv->offscreen,
priv->framebuffer,
can_blit);
}
}
if (priv->shadowfb)
{
clutter_stage_view_ensure_shadowfb_blit_pipeline (view);
clutter_stage_view_copy_to_framebuffer (view,
rect,
priv->shadowfb_pipeline,
priv->shadowfb,
priv->framebuffer,
TRUE);
}
} }
float float
@@ -258,6 +348,9 @@ clutter_stage_view_get_property (GObject *object,
case PROP_OFFSCREEN: case PROP_OFFSCREEN:
g_value_set_boxed (value, priv->offscreen); g_value_set_boxed (value, priv->offscreen);
break; break;
case PROP_SHADOWFB:
g_value_set_boxed (value, priv->shadowfb);
break;
case PROP_SCALE: case PROP_SCALE:
g_value_set_float (value, priv->scale); g_value_set_float (value, priv->scale);
break; break;
@@ -303,6 +396,9 @@ clutter_stage_view_set_property (GObject *object,
case PROP_OFFSCREEN: case PROP_OFFSCREEN:
priv->offscreen = g_value_dup_boxed (value); priv->offscreen = g_value_dup_boxed (value);
break; break;
case PROP_SHADOWFB:
priv->shadowfb = g_value_dup_boxed (value);
break;
case PROP_SCALE: case PROP_SCALE:
priv->scale = g_value_get_float (value); priv->scale = g_value_get_float (value);
break; break;
@@ -319,8 +415,10 @@ clutter_stage_view_dispose (GObject *object)
clutter_stage_view_get_instance_private (view); clutter_stage_view_get_instance_private (view);
g_clear_pointer (&priv->framebuffer, cogl_object_unref); g_clear_pointer (&priv->framebuffer, cogl_object_unref);
g_clear_pointer (&priv->shadowfb, cogl_object_unref);
g_clear_pointer (&priv->offscreen, cogl_object_unref); g_clear_pointer (&priv->offscreen, cogl_object_unref);
g_clear_pointer (&priv->pipeline, cogl_object_unref); g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
g_clear_pointer (&priv->shadowfb_pipeline, cogl_object_unref);
G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object); G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
} }
@@ -375,6 +473,15 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
G_PARAM_CONSTRUCT_ONLY | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS); G_PARAM_STATIC_STRINGS);
obj_props[PROP_SHADOWFB] =
g_param_spec_boxed ("shadowfb",
"Shadow framebuffer",
"Framebuffer used as intermediate shadow buffer",
COGL_TYPE_HANDLE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_SCALE] = obj_props[PROP_SCALE] =
g_param_spec_float ("scale", g_param_spec_float ("scale",
"View scale", "View scale",

View File

@@ -235,19 +235,35 @@ _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window)
return TRUE; return TRUE;
} }
gboolean cairo_region_t *
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window, _clutter_stage_window_get_redraw_clip (ClutterStageWindow *window)
cairo_rectangle_int_t *stage_clip)
{ {
ClutterStageWindowInterface *iface; ClutterStageWindowInterface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE); g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window); iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->get_redraw_clip_bounds != NULL) if (iface->get_redraw_clip != NULL)
return iface->get_redraw_clip_bounds (window, stage_clip); return iface->get_redraw_clip (window);
return FALSE; return NULL;
}
gboolean
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *stage_clip)
{
cairo_region_t *redraw_clip;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
redraw_clip = _clutter_stage_window_get_redraw_clip (window);
if (!redraw_clip)
return FALSE;
cairo_region_get_extents (redraw_clip, stage_clip);
cairo_region_destroy (redraw_clip);
return TRUE;
} }
void void

View File

@@ -55,9 +55,7 @@ struct _ClutterStageWindowInterface
cairo_rectangle_int_t *stage_rectangle); cairo_rectangle_int_t *stage_rectangle);
gboolean (* has_redraw_clips) (ClutterStageWindow *stage_window); gboolean (* has_redraw_clips) (ClutterStageWindow *stage_window);
gboolean (* ignoring_redraw_clips) (ClutterStageWindow *stage_window); gboolean (* ignoring_redraw_clips) (ClutterStageWindow *stage_window);
gboolean (* get_redraw_clip_bounds) (ClutterStageWindow *stage_window, cairo_region_t * (* get_redraw_clip) (ClutterStageWindow *stage_window);
cairo_rectangle_int_t *clip);
void (* set_accept_focus) (ClutterStageWindow *stage_window, void (* set_accept_focus) (ClutterStageWindow *stage_window,
gboolean accept_focus); gboolean accept_focus);
@@ -102,6 +100,7 @@ gboolean _clutter_stage_window_has_redraw_clips (ClutterStageWin
gboolean _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window); gboolean _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window);
gboolean _clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window, gboolean _clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *clip); cairo_rectangle_int_t *clip);
cairo_region_t * _clutter_stage_window_get_redraw_clip (ClutterStageWindow *window);
void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window, void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
gboolean accept_focus); gboolean accept_focus);

File diff suppressed because it is too large Load Diff

View File

@@ -115,26 +115,6 @@ struct _ClutterPerspective
gfloat z_far; gfloat z_far;
}; };
/**
* ClutterFog:
* @z_near: starting distance from the viewer to the near clipping
* plane (always positive)
* @z_far: final distance from the viewer to the far clipping
* plane (always positive)
*
* Fog settings used to create the depth cueing effect.
*
* Since: 0.6
*
* Deprecated: 1.10: The fog-related API in #ClutterStage has been
* deprecated as well.
*/
struct _ClutterFog
{
gfloat z_near;
gfloat z_far;
};
/** /**
* ClutterFrameInfo: (skip) * ClutterFrameInfo: (skip)
*/ */
@@ -153,8 +133,6 @@ typedef struct _ClutterCapture
CLUTTER_EXPORT CLUTTER_EXPORT
GType clutter_perspective_get_type (void) G_GNUC_CONST; GType clutter_perspective_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED
GType clutter_fog_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT CLUTTER_EXPORT
GType clutter_stage_get_type (void) G_GNUC_CONST; GType clutter_stage_get_type (void) G_GNUC_CONST;
@@ -186,11 +164,6 @@ void clutter_stage_get_minimum_size (ClutterStage
guint *width, guint *width,
guint *height); guint *height);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_stage_set_no_clear_hint (ClutterStage *stage,
gboolean no_clear);
CLUTTER_EXPORT
gboolean clutter_stage_get_no_clear_hint (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_set_use_alpha (ClutterStage *stage, void clutter_stage_set_use_alpha (ClutterStage *stage,
gboolean use_alpha); gboolean use_alpha);
CLUTTER_EXPORT CLUTTER_EXPORT
@@ -223,8 +196,8 @@ gboolean clutter_stage_event (ClutterStage
CLUTTER_EXPORT CLUTTER_EXPORT
ClutterActor * clutter_stage_get_actor_at_pos (ClutterStage *stage, ClutterActor * clutter_stage_get_actor_at_pos (ClutterStage *stage,
ClutterPickMode pick_mode, ClutterPickMode pick_mode,
gint x, float x,
gint y); float y);
CLUTTER_EXPORT CLUTTER_EXPORT
guchar * clutter_stage_read_pixels (ClutterStage *stage, guchar * clutter_stage_read_pixels (ClutterStage *stage,
gint x, gint x,
@@ -236,6 +209,8 @@ CLUTTER_EXPORT
void clutter_stage_get_redraw_clip_bounds (ClutterStage *stage, void clutter_stage_get_redraw_clip_bounds (ClutterStage *stage,
cairo_rectangle_int_t *clip); cairo_rectangle_int_t *clip);
CLUTTER_EXPORT CLUTTER_EXPORT
cairo_region_t * clutter_stage_get_redraw_clip (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_ensure_viewport (ClutterStage *stage); void clutter_stage_ensure_viewport (ClutterStage *stage);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_stage_ensure_redraw (ClutterStage *stage); void clutter_stage_ensure_redraw (ClutterStage *stage);

View File

@@ -157,7 +157,7 @@ struct _ClutterTextPrivate
gint text_logical_y; gint text_logical_y;
/* Where to draw the cursor */ /* Where to draw the cursor */
ClutterRect cursor_rect; graphene_rect_t cursor_rect;
ClutterColor cursor_color; ClutterColor cursor_color;
guint cursor_size; guint cursor_size;
@@ -1304,7 +1304,7 @@ static inline void
update_cursor_location (ClutterText *self) update_cursor_location (ClutterText *self)
{ {
ClutterTextPrivate *priv = self->priv; ClutterTextPrivate *priv = self->priv;
ClutterRect rect; graphene_rect_t rect;
float x, y; float x, y;
if (!priv->editable) if (!priv->editable)
@@ -1312,7 +1312,7 @@ update_cursor_location (ClutterText *self)
rect = priv->cursor_rect; rect = priv->cursor_rect;
clutter_actor_get_transformed_position (CLUTTER_ACTOR (self), &x, &y); clutter_actor_get_transformed_position (CLUTTER_ACTOR (self), &x, &y);
clutter_rect_offset (&rect, x, y); graphene_rect_offset (&rect, x, y);
clutter_input_focus_set_cursor_location (priv->input_focus, &rect); clutter_input_focus_set_cursor_location (priv->input_focus, &rect);
} }
@@ -1322,7 +1322,7 @@ clutter_text_ensure_cursor_position (ClutterText *self,
{ {
ClutterTextPrivate *priv = self->priv; ClutterTextPrivate *priv = self->priv;
gfloat x, y, cursor_height; gfloat x, y, cursor_height;
ClutterRect cursor_rect = CLUTTER_RECT_INIT_ZERO; graphene_rect_t cursor_rect = GRAPHENE_RECT_INIT_ZERO;
gint position; gint position;
position = priv->position; position = priv->position;
@@ -1345,25 +1345,17 @@ clutter_text_ensure_cursor_position (ClutterText *self,
&x, &y, &x, &y,
&cursor_height); &cursor_height);
clutter_rect_init (&cursor_rect, graphene_rect_init (&cursor_rect,
x, x,
y + CURSOR_Y_PADDING * scale, y + CURSOR_Y_PADDING * scale,
priv->cursor_size * scale, priv->cursor_size * scale,
cursor_height - 2 * CURSOR_Y_PADDING * scale); cursor_height - 2 * CURSOR_Y_PADDING * scale);
if (!clutter_rect_equals (&priv->cursor_rect, &cursor_rect)) if (!graphene_rect_equal (&priv->cursor_rect, &cursor_rect))
{ {
ClutterGeometry cursor_pos;
priv->cursor_rect = cursor_rect; priv->cursor_rect = cursor_rect;
/* XXX:2.0 - remove */ g_signal_emit (self, text_signals[CURSOR_EVENT], 0, &cursor_rect);
cursor_pos.x = clutter_rect_get_x (&priv->cursor_rect);
cursor_pos.y = clutter_rect_get_y (&priv->cursor_rect);
cursor_pos.width = clutter_rect_get_width (&priv->cursor_rect);
cursor_pos.height = clutter_rect_get_height (&priv->cursor_rect);
g_signal_emit (self, text_signals[CURSOR_EVENT], 0, &cursor_pos);
g_signal_emit (self, text_signals[CURSOR_CHANGED], 0); g_signal_emit (self, text_signals[CURSOR_CHANGED], 0);
update_cursor_location (self); update_cursor_location (self);
@@ -2712,7 +2704,7 @@ clutter_text_paint (ClutterActor *self)
if (actor_width < text_width) if (actor_width < text_width)
{ {
gint cursor_x = clutter_rect_get_x (&priv->cursor_rect); gint cursor_x = graphene_rect_get_x (&priv->cursor_rect);
if (priv->position == -1) if (priv->position == -1)
{ {
@@ -2799,7 +2791,7 @@ add_selection_to_paint_volume (ClutterText *text,
{ {
ClutterPaintVolume *total_volume = user_data; ClutterPaintVolume *total_volume = user_data;
ClutterPaintVolume rect_volume; ClutterPaintVolume rect_volume;
ClutterVertex vertex; graphene_point3d_t vertex;
_clutter_paint_volume_init_static (&rect_volume, CLUTTER_ACTOR (text)); _clutter_paint_volume_init_static (&rect_volume, CLUTTER_ACTOR (text));
@@ -2821,7 +2813,7 @@ clutter_text_get_paint_volume_for_cursor (ClutterText *text,
ClutterPaintVolume *volume) ClutterPaintVolume *volume)
{ {
ClutterTextPrivate *priv = text->priv; ClutterTextPrivate *priv = text->priv;
ClutterVertex origin; graphene_point3d_t origin;
clutter_text_ensure_cursor_position (text, resource_scale); clutter_text_ensure_cursor_position (text, resource_scale);
@@ -2864,7 +2856,7 @@ clutter_text_get_paint_volume (ClutterActor *self,
{ {
PangoLayout *layout; PangoLayout *layout;
PangoRectangle ink_rect; PangoRectangle ink_rect;
ClutterVertex origin; graphene_point3d_t origin;
float resource_scale; float resource_scale;
/* If the text is single line editable then it gets clipped to /* If the text is single line editable then it gets clipped to
@@ -4399,10 +4391,10 @@ clutter_text_class_init (ClutterTextClass *klass)
/** /**
* ClutterText::cursor-event: * ClutterText::cursor-event:
* @self: the #ClutterText that emitted the signal * @self: the #ClutterText that emitted the signal
* @geometry: the coordinates of the cursor * @rect: the coordinates of the cursor
* *
* The ::cursor-event signal is emitted whenever the cursor position * The ::cursor-event signal is emitted whenever the cursor position
* changes inside a #ClutterText actor. Inside @geometry it is stored * changes inside a #ClutterText actor. Inside @rect it is stored
* the current position and size of the cursor, relative to the actor * the current position and size of the cursor, relative to the actor
* itself. * itself.
* *
@@ -4417,7 +4409,7 @@ clutter_text_class_init (ClutterTextClass *klass)
G_STRUCT_OFFSET (ClutterTextClass, cursor_event), G_STRUCT_OFFSET (ClutterTextClass, cursor_event),
NULL, NULL, NULL, NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_NONE, 1,
CLUTTER_TYPE_GEOMETRY | G_SIGNAL_TYPE_STATIC_SCOPE); GRAPHENE_TYPE_RECT | G_SIGNAL_TYPE_STATIC_SCOPE);
/** /**
* ClutterText::cursor-changed: * ClutterText::cursor-changed:
@@ -6780,8 +6772,8 @@ clutter_text_get_layout_offsets (ClutterText *self,
* Since: 1.16 * Since: 1.16
*/ */
void void
clutter_text_get_cursor_rect (ClutterText *self, clutter_text_get_cursor_rect (ClutterText *self,
ClutterRect *rect) graphene_rect_t *rect)
{ {
g_return_if_fail (CLUTTER_IS_TEXT (self)); g_return_if_fail (CLUTTER_IS_TEXT (self));
g_return_if_fail (rect != NULL); g_return_if_fail (rect != NULL);

View File

@@ -82,7 +82,7 @@ struct _ClutterTextClass
void (* text_changed) (ClutterText *self); void (* text_changed) (ClutterText *self);
void (* activate) (ClutterText *self); void (* activate) (ClutterText *self);
void (* cursor_event) (ClutterText *self, void (* cursor_event) (ClutterText *self,
const ClutterGeometry *geometry); const graphene_rect_t *rect);
void (* cursor_changed) (ClutterText *self); void (* cursor_changed) (ClutterText *self);
/*< private >*/ /*< private >*/
@@ -230,7 +230,7 @@ CLUTTER_EXPORT
guint clutter_text_get_cursor_size (ClutterText *self); guint clutter_text_get_cursor_size (ClutterText *self);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_text_get_cursor_rect (ClutterText *self, void clutter_text_get_cursor_rect (ClutterText *self,
ClutterRect *rect); graphene_rect_t *rect);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_text_set_selectable (ClutterText *self, void clutter_text_set_selectable (ClutterText *self,
gboolean selectable); gboolean selectable);

View File

@@ -46,8 +46,7 @@ G_BEGIN_DECLS
* @CLUTTER_TEXTURE_ERROR_NO_YUV: YUV operation attempted but no YUV support * @CLUTTER_TEXTURE_ERROR_NO_YUV: YUV operation attempted but no YUV support
* found * found
* @CLUTTER_TEXTURE_ERROR_BAD_FORMAT: The requested format for * @CLUTTER_TEXTURE_ERROR_BAD_FORMAT: The requested format for
* clutter_texture_set_from_rgb_data or * clutter_texture_set_from_rgb_data is unsupported.
* clutter_texture_set_from_yuv_data is unsupported.
* *
* Error enumeration for #ClutterTexture * Error enumeration for #ClutterTexture
* *

View File

@@ -145,8 +145,8 @@ struct _ClutterTimelinePrivate
ClutterStepMode step_mode; ClutterStepMode step_mode;
/* cubic-bezier() parameters */ /* cubic-bezier() parameters */
ClutterPoint cb_1; graphene_point_t cb_1;
ClutterPoint cb_2; graphene_point_t cb_2;
guint is_playing : 1; guint is_playing : 1;
@@ -424,6 +424,11 @@ clutter_timeline_set_custom_property (ClutterScriptable *scriptable,
g_object_set_property (G_OBJECT (scriptable), name, value); g_object_set_property (G_OBJECT (scriptable), name, value);
} }
void
clutter_timeline_cancel_delay (ClutterTimeline *timeline)
{
g_clear_handle_id (&timeline->priv->delay_id, g_source_remove);
}
static void static void
clutter_scriptable_iface_init (ClutterScriptableIface *iface) clutter_scriptable_iface_init (ClutterScriptableIface *iface)
@@ -550,11 +555,7 @@ clutter_timeline_dispose (GObject *object)
priv = self->priv; priv = self->priv;
if (priv->delay_id) clutter_timeline_cancel_delay (self);
{
g_source_remove (priv->delay_id);
priv->delay_id = 0;
}
if (priv->progress_notify != NULL) if (priv->progress_notify != NULL)
{ {
@@ -845,8 +846,8 @@ clutter_timeline_init (ClutterTimeline *self)
self->priv->step_mode = CLUTTER_STEP_MODE_END; self->priv->step_mode = CLUTTER_STEP_MODE_END;
/* default cubic-bezier() paramereters are (0, 0, 1, 1) */ /* default cubic-bezier() paramereters are (0, 0, 1, 1) */
clutter_point_init (&self->priv->cb_1, 0, 0); graphene_point_init (&self->priv->cb_1, 0, 0);
clutter_point_init (&self->priv->cb_2, 1, 1); graphene_point_init (&self->priv->cb_2, 1, 1);
} }
struct CheckIfMarkerHitClosure struct CheckIfMarkerHitClosure
@@ -1213,14 +1214,10 @@ clutter_timeline_pause (ClutterTimeline *timeline)
priv = timeline->priv; priv = timeline->priv;
if (priv->delay_id == 0 && !priv->is_playing) clutter_timeline_cancel_delay (timeline);
return;
if (priv->delay_id) if (!priv->is_playing)
{ return;
g_source_remove (priv->delay_id);
priv->delay_id = 0;
}
priv->msecs_delta = 0; priv->msecs_delta = 0;
set_is_playing (timeline, FALSE); set_is_playing (timeline, FALSE);
@@ -2488,9 +2485,9 @@ clutter_timeline_get_step_progress (ClutterTimeline *timeline,
* Since: 1.12 * Since: 1.12
*/ */
void void
clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline, clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
const ClutterPoint *c_1, const graphene_point_t *c_1,
const ClutterPoint *c_2) const graphene_point_t *c_2)
{ {
ClutterTimelinePrivate *priv; ClutterTimelinePrivate *priv;
@@ -2525,9 +2522,9 @@ clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
* Since: 1.12 * Since: 1.12
*/ */
gboolean gboolean
clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline, clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
ClutterPoint *c_1, graphene_point_t *c_1,
ClutterPoint *c_2) graphene_point_t *c_2)
{ {
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE); g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE);

View File

@@ -208,13 +208,13 @@ gboolean clutter_timeline_get_step_progress
gint *n_steps, gint *n_steps,
ClutterStepMode *step_mode); ClutterStepMode *step_mode);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline, void clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
const ClutterPoint *c_1, const graphene_point_t *c_1,
const ClutterPoint *c_2); const graphene_point_t *c_2);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline, gboolean clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
ClutterPoint *c_1, graphene_point_t *c_1,
ClutterPoint *c_2); graphene_point_t *c_2);
CLUTTER_EXPORT CLUTTER_EXPORT
gint64 clutter_timeline_get_duration_hint (ClutterTimeline *timeline); gint64 clutter_timeline_get_duration_hint (ClutterTimeline *timeline);

View File

@@ -134,7 +134,6 @@ clutter_transition_stopped (ClutterTimeline *timeline,
clutter_transition_detach (CLUTTER_TRANSITION (timeline), clutter_transition_detach (CLUTTER_TRANSITION (timeline),
priv->animatable); priv->animatable);
g_clear_object (&priv->animatable); g_clear_object (&priv->animatable);
g_object_unref (timeline);
} }
} }

View File

@@ -33,20 +33,16 @@
#include <clutter/clutter-macros.h> #include <clutter/clutter-macros.h>
#include <clutter/clutter-enums.h> #include <clutter/clutter-enums.h>
#include <graphene-gobject.h>
G_BEGIN_DECLS G_BEGIN_DECLS
#define CLUTTER_TYPE_ACTOR_BOX (clutter_actor_box_get_type ()) #define CLUTTER_TYPE_ACTOR_BOX (clutter_actor_box_get_type ())
#define CLUTTER_TYPE_FOG (clutter_fog_get_type ())
#define CLUTTER_TYPE_GEOMETRY (clutter_geometry_get_type ())
#define CLUTTER_TYPE_KNOT (clutter_knot_get_type ()) #define CLUTTER_TYPE_KNOT (clutter_knot_get_type ())
#define CLUTTER_TYPE_MARGIN (clutter_margin_get_type ()) #define CLUTTER_TYPE_MARGIN (clutter_margin_get_type ())
#define CLUTTER_TYPE_MATRIX (clutter_matrix_get_type ()) #define CLUTTER_TYPE_MATRIX (clutter_matrix_get_type ())
#define CLUTTER_TYPE_PAINT_VOLUME (clutter_paint_volume_get_type ()) #define CLUTTER_TYPE_PAINT_VOLUME (clutter_paint_volume_get_type ())
#define CLUTTER_TYPE_PERSPECTIVE (clutter_perspective_get_type ()) #define CLUTTER_TYPE_PERSPECTIVE (clutter_perspective_get_type ())
#define CLUTTER_TYPE_VERTEX (clutter_vertex_get_type ())
#define CLUTTER_TYPE_POINT (clutter_point_get_type ())
#define CLUTTER_TYPE_SIZE (clutter_size_get_type ())
#define CLUTTER_TYPE_RECT (clutter_rect_get_type ())
typedef struct _ClutterActor ClutterActor; typedef struct _ClutterActor ClutterActor;
@@ -79,14 +75,9 @@ typedef struct _ClutterPathNode ClutterPathNode;
typedef struct _ClutterActorBox ClutterActorBox; typedef struct _ClutterActorBox ClutterActorBox;
typedef struct _ClutterColor ClutterColor; typedef struct _ClutterColor ClutterColor;
typedef struct _ClutterGeometry ClutterGeometry; /* XXX:2.0 - remove */
typedef struct _ClutterKnot ClutterKnot; typedef struct _ClutterKnot ClutterKnot;
typedef struct _ClutterMargin ClutterMargin; typedef struct _ClutterMargin ClutterMargin;
typedef struct _ClutterPerspective ClutterPerspective; typedef struct _ClutterPerspective ClutterPerspective;
typedef struct _ClutterPoint ClutterPoint;
typedef struct _ClutterRect ClutterRect;
typedef struct _ClutterSize ClutterSize;
typedef struct _ClutterVertex ClutterVertex;
typedef struct _ClutterAlpha ClutterAlpha; typedef struct _ClutterAlpha ClutterAlpha;
typedef struct _ClutterAnimation ClutterAnimation; typedef struct _ClutterAnimation ClutterAnimation;
@@ -113,8 +104,6 @@ typedef union _ClutterEvent ClutterEvent;
*/ */
typedef struct _ClutterEventSequence ClutterEventSequence; typedef struct _ClutterEventSequence ClutterEventSequence;
typedef struct _ClutterFog ClutterFog; /* deprecated */
typedef struct _ClutterBehaviour ClutterBehaviour; /* deprecated */
typedef struct _ClutterShader ClutterShader; /* deprecated */ typedef struct _ClutterShader ClutterShader; /* deprecated */
/** /**
@@ -137,310 +126,6 @@ typedef struct _ClutterShader ClutterShader; /* deprecated */
*/ */
typedef struct _ClutterPaintVolume ClutterPaintVolume; typedef struct _ClutterPaintVolume ClutterPaintVolume;
/**
* ClutterPoint:
* @x: X coordinate, in pixels
* @y: Y coordinate, in pixels
*
* A point in 2D space.
*
* Since: 1.12
*/
struct _ClutterPoint
{
float x;
float y;
};
/**
* CLUTTER_POINT_INIT:
* @x: X coordinate
* @y: Y coordinate
*
* A simple macro for initializing a #ClutterPoint when declaring it, e.g.:
*
* |[
* ClutterPoint p = CLUTTER_POINT_INIT (100, 100);
* ]|
*
* Since: 1.12
*/
#define CLUTTER_POINT_INIT(x,y) { (x), (y) }
/**
* CLUTTER_POINT_INIT_ZERO:
*
* A simple macro for initializing a #ClutterPoint to (0, 0) when
* declaring it.
*
* Since: 1.12
*/
#define CLUTTER_POINT_INIT_ZERO CLUTTER_POINT_INIT (0.f, 0.f)
CLUTTER_EXPORT
GType clutter_point_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
const ClutterPoint * clutter_point_zero (void);
CLUTTER_EXPORT
ClutterPoint * clutter_point_alloc (void);
CLUTTER_EXPORT
ClutterPoint * clutter_point_init (ClutterPoint *point,
float x,
float y);
CLUTTER_EXPORT
ClutterPoint * clutter_point_copy (const ClutterPoint *point);
CLUTTER_EXPORT
void clutter_point_free (ClutterPoint *point);
CLUTTER_EXPORT
gboolean clutter_point_equals (const ClutterPoint *a,
const ClutterPoint *b);
CLUTTER_EXPORT
float clutter_point_distance (const ClutterPoint *a,
const ClutterPoint *b,
float *x_distance,
float *y_distance);
CLUTTER_EXPORT
gboolean clutter_point_inside_quadrilateral (const ClutterPoint *point,
const ClutterPoint *vertices);
/**
* ClutterSize:
* @width: the width, in pixels
* @height: the height, in pixels
*
* A size, in 2D space.
*
* Since: 1.12
*/
struct _ClutterSize
{
float width;
float height;
};
/**
* CLUTTER_SIZE_INIT:
* @width: the width
* @height: the height
*
* A simple macro for initializing a #ClutterSize when declaring it, e.g.:
*
* |[
* ClutterSize s = CLUTTER_SIZE_INIT (200, 200);
* ]|
*
* Since: 1.12
*/
#define CLUTTER_SIZE_INIT(width,height) { (width), (height) }
/**
* CLUTTER_SIZE_INIT_ZERO:
*
* A simple macro for initializing a #ClutterSize to (0, 0) when
* declaring it.
*
* Since: 1.12
*/
#define CLUTTER_SIZE_INIT_ZERO CLUTTER_SIZE_INIT (0.f, 0.f)
CLUTTER_EXPORT
GType clutter_size_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterSize * clutter_size_alloc (void);
CLUTTER_EXPORT
ClutterSize * clutter_size_init (ClutterSize *size,
float width,
float height);
CLUTTER_EXPORT
ClutterSize * clutter_size_copy (const ClutterSize *size);
CLUTTER_EXPORT
void clutter_size_free (ClutterSize *size);
CLUTTER_EXPORT
gboolean clutter_size_equals (const ClutterSize *a,
const ClutterSize *b);
/**
* ClutterRect:
* @origin: the origin of the rectangle
* @size: the size of the rectangle
*
* The location and size of a rectangle.
*
* The width and height of a #ClutterRect can be negative; Clutter considers
* a rectangle with an origin of [ 0.0, 0.0 ] and a size of [ 10.0, 10.0 ] to
* be equivalent to a rectangle with origin of [ 10.0, 10.0 ] and size of
* [ -10.0, -10.0 ].
*
* Application code can normalize rectangles using clutter_rect_normalize():
* this function will ensure that the width and height of a #ClutterRect are
* positive values. All functions taking a #ClutterRect as an argument will
* implicitly normalize it before computing eventual results. For this reason
* it is safer to access the contents of a #ClutterRect by using the provided
* API at all times, instead of directly accessing the structure members.
*
* Since: 1.12
*/
struct _ClutterRect
{
ClutterPoint origin;
ClutterSize size;
};
/**
* CLUTTER_RECT_INIT:
* @x: the X coordinate
* @y: the Y coordinate
* @width: the width
* @height: the height
*
* A simple macro for initializing a #ClutterRect when declaring it, e.g.:
*
* |[
* ClutterRect r = CLUTTER_RECT_INIT (100, 100, 200, 200);
* ]|
*
* Since: 1.12
*/
#define CLUTTER_RECT_INIT(x,y,width,height) { { (x), (y) }, { (width), (height) } }
/**
* CLUTTER_RECT_INIT_ZERO:
*
* A simple macro for initializing a #ClutterRect to (0, 0, 0, 0) when
* declaring it.
*
* Since: 1.12
*/
#define CLUTTER_RECT_INIT_ZERO CLUTTER_RECT_INIT (0.f, 0.f, 0.f, 0.f)
CLUTTER_EXPORT
GType clutter_rect_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
const ClutterRect * clutter_rect_zero (void);
CLUTTER_EXPORT
ClutterRect * clutter_rect_alloc (void);
CLUTTER_EXPORT
ClutterRect * clutter_rect_init (ClutterRect *rect,
float x,
float y,
float width,
float height);
CLUTTER_EXPORT
ClutterRect * clutter_rect_copy (const ClutterRect *rect);
CLUTTER_EXPORT
void clutter_rect_free (ClutterRect *rect);
CLUTTER_EXPORT
gboolean clutter_rect_equals (ClutterRect *a,
ClutterRect *b);
CLUTTER_EXPORT
ClutterRect * clutter_rect_normalize (ClutterRect *rect);
CLUTTER_EXPORT
void clutter_rect_get_center (ClutterRect *rect,
ClutterPoint *center);
CLUTTER_EXPORT
gboolean clutter_rect_contains_point (ClutterRect *rect,
ClutterPoint *point);
CLUTTER_EXPORT
gboolean clutter_rect_contains_rect (ClutterRect *a,
ClutterRect *b);
CLUTTER_EXPORT
void clutter_rect_union (ClutterRect *a,
ClutterRect *b,
ClutterRect *res);
CLUTTER_EXPORT
gboolean clutter_rect_intersection (ClutterRect *a,
ClutterRect *b,
ClutterRect *res);
CLUTTER_EXPORT
void clutter_rect_offset (ClutterRect *rect,
float d_x,
float d_y);
CLUTTER_EXPORT
void clutter_rect_inset (ClutterRect *rect,
float d_x,
float d_y);
CLUTTER_EXPORT
void clutter_rect_scale (ClutterRect *rect,
float s_x,
float s_y);
CLUTTER_EXPORT
void clutter_rect_clamp_to_pixel (ClutterRect *rect);
CLUTTER_EXPORT
float clutter_rect_get_x (ClutterRect *rect);
CLUTTER_EXPORT
float clutter_rect_get_y (ClutterRect *rect);
CLUTTER_EXPORT
float clutter_rect_get_width (ClutterRect *rect);
CLUTTER_EXPORT
float clutter_rect_get_height (ClutterRect *rect);
/**
* ClutterVertex:
* @x: X coordinate of the vertex
* @y: Y coordinate of the vertex
* @z: Z coordinate of the vertex
*
* A point in 3D space, expressed in pixels
*
* Since: 0.4
*/
struct _ClutterVertex
{
gfloat x;
gfloat y;
gfloat z;
};
/**
* CLUTTER_VERTEX_INIT:
* @x: the X coordinate of the vertex
* @y: the Y coordinate of the vertex
* @z: the Z coordinate of the vertex
*
* A simple macro for initializing a #ClutterVertex when declaring it, e.g.:
*
* |[
* ClutterVertex v = CLUTTER_VERTEX_INIT (x, y, z);
* ]|
*
* Since: 1.10
*/
#define CLUTTER_VERTEX_INIT(x,y,z) { (x), (y), (z) }
/**
* CLUTTER_VERTEX_INIT_ZERO:
*
* A simple macro for initializing a #ClutterVertex to (0, 0, 0).
*
* Since: 1.12
*/
#define CLUTTER_VERTEX_INIT_ZERO CLUTTER_VERTEX_INIT (0.f, 0.f, 0.f)
CLUTTER_EXPORT
GType clutter_vertex_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterVertex *clutter_vertex_new (gfloat x,
gfloat y,
gfloat z);
CLUTTER_EXPORT
ClutterVertex *clutter_vertex_alloc (void);
CLUTTER_EXPORT
ClutterVertex *clutter_vertex_init (ClutterVertex *vertex,
gfloat x,
gfloat y,
gfloat z);
CLUTTER_EXPORT
ClutterVertex *clutter_vertex_copy (const ClutterVertex *vertex);
CLUTTER_EXPORT
void clutter_vertex_free (ClutterVertex *vertex);
CLUTTER_EXPORT
gboolean clutter_vertex_equal (const ClutterVertex *vertex_a,
const ClutterVertex *vertex_b);
/** /**
* ClutterActorBox: * ClutterActorBox:
* @x1: X coordinate of the top left corner * @x1: X coordinate of the top left corner
@@ -544,8 +229,8 @@ gboolean clutter_actor_box_contains (const ClutterActorBox *box,
gfloat x, gfloat x,
gfloat y); gfloat y);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_box_from_vertices (ClutterActorBox *box, void clutter_actor_box_from_vertices (ClutterActorBox *box,
const ClutterVertex verts[]); const graphene_point3d_t verts[]);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_actor_box_interpolate (const ClutterActorBox *initial, void clutter_actor_box_interpolate (const ClutterActorBox *initial,
const ClutterActorBox *final, const ClutterActorBox *final,
@@ -571,41 +256,6 @@ CLUTTER_EXPORT
void clutter_actor_box_scale (ClutterActorBox *box, void clutter_actor_box_scale (ClutterActorBox *box,
gfloat scale); gfloat scale);
/**
* ClutterGeometry:
* @x: X coordinate of the top left corner of an actor
* @y: Y coordinate of the top left corner of an actor
* @width: width of an actor
* @height: height of an actor
*
* The rectangle containing an actor's bounding box, measured in pixels.
*
* You should not use #ClutterGeometry, or operate on its fields
* directly; you should use #cairo_rectangle_int_t or #ClutterRect if you
* need a rectangle type, depending on the precision required.
*
* Deprecated: 1.16
*/
struct _ClutterGeometry
{
/*< public >*/
gint x;
gint y;
guint width;
guint height;
};
CLUTTER_EXPORT
GType clutter_geometry_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED
void clutter_geometry_union (const ClutterGeometry *geometry_a,
const ClutterGeometry *geometry_b,
ClutterGeometry *result);
CLUTTER_DEPRECATED
gboolean clutter_geometry_intersects (const ClutterGeometry *geometry0,
const ClutterGeometry *geometry1);
/** /**
* ClutterKnot: * ClutterKnot:
* @x: X coordinate of the knot * @x: X coordinate of the knot
@@ -677,10 +327,10 @@ void clutter_paint_volume_free (ClutterPaintVolume
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_paint_volume_set_origin (ClutterPaintVolume *pv, void clutter_paint_volume_set_origin (ClutterPaintVolume *pv,
const ClutterVertex *origin); const graphene_point3d_t *origin);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_paint_volume_get_origin (const ClutterPaintVolume *pv, void clutter_paint_volume_get_origin (const ClutterPaintVolume *pv,
ClutterVertex *vertex); graphene_point3d_t *vertex);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_paint_volume_set_width (ClutterPaintVolume *pv, void clutter_paint_volume_set_width (ClutterPaintVolume *pv,
gfloat width); gfloat width);

View File

@@ -51,8 +51,8 @@ void
_clutter_util_fully_transform_vertices (const CoglMatrix *modelview, _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
const CoglMatrix *projection, const CoglMatrix *projection,
const float *viewport, const float *viewport,
const ClutterVertex *vertices_in, const graphene_point3d_t *vertices_in,
ClutterVertex *vertices_out, graphene_point3d_t *vertices_out,
int n_vertices) int n_vertices)
{ {
CoglMatrix modelview_projection; CoglMatrix modelview_projection;
@@ -69,7 +69,7 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
modelview); modelview);
cogl_matrix_project_points (&modelview_projection, cogl_matrix_project_points (&modelview_projection,
3, 3,
sizeof (ClutterVertex), sizeof (graphene_point3d_t),
vertices_in, vertices_in,
sizeof (ClutterVertex4), sizeof (ClutterVertex4),
vertices_tmp, vertices_tmp,
@@ -79,7 +79,7 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
{ {
cogl_matrix_transform_points (modelview, cogl_matrix_transform_points (modelview,
3, 3,
sizeof (ClutterVertex), sizeof (graphene_point3d_t),
vertices_in, vertices_in,
sizeof (ClutterVertex4), sizeof (ClutterVertex4),
vertices_tmp, vertices_tmp,
@@ -97,7 +97,7 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
for (i = 0; i < n_vertices; i++) for (i = 0; i < n_vertices; i++)
{ {
ClutterVertex4 vertex_tmp = vertices_tmp[i]; ClutterVertex4 vertex_tmp = vertices_tmp[i];
ClutterVertex *vertex_out = &vertices_out[i]; graphene_point3d_t *vertex_out = &vertices_out[i];
/* Finally translate from OpenGL coords to window coords */ /* Finally translate from OpenGL coords to window coords */
vertex_out->x = MTX_GL_SCALE_X (vertex_tmp.x, vertex_tmp.w, vertex_out->x = MTX_GL_SCALE_X (vertex_tmp.x, vertex_tmp.w,
viewport[2], viewport[0]); viewport[2], viewport[0]);
@@ -108,9 +108,9 @@ _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
void void
_clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src, _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
ClutterRect *dest) graphene_rect_t *dest)
{ {
*dest = (ClutterRect) { *dest = (graphene_rect_t) {
.origin = { .origin = {
.x = src->x, .x = src->x,
.y = src->y .y = src->y
@@ -123,12 +123,12 @@ _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
} }
void void
_clutter_util_rectangle_int_extents (const ClutterRect *src, _clutter_util_rectangle_int_extents (const graphene_rect_t *src,
cairo_rectangle_int_t *dest) cairo_rectangle_int_t *dest)
{ {
ClutterRect tmp = *src; graphene_rect_t tmp = *src;
clutter_rect_clamp_to_pixel (&tmp); graphene_rect_round_extents (&tmp, &tmp);
*dest = (cairo_rectangle_int_t) { *dest = (cairo_rectangle_int_t) {
.x = tmp.origin.x, .x = tmp.origin.x,
@@ -299,48 +299,12 @@ _clutter_util_matrix_skew_yz (ClutterMatrix *matrix,
matrix->zw += matrix->yw * factor; matrix->zw += matrix->yw * factor;
} }
static float
_clutter_util_vertex_length (const ClutterVertex *vertex)
{
return sqrtf (vertex->x * vertex->x + vertex->y * vertex->y + vertex->z * vertex->z);
}
static void static void
_clutter_util_vertex_normalize (ClutterVertex *vertex) _clutter_util_vertex_combine (const graphene_point3d_t *a,
{ const graphene_point3d_t *b,
float factor = _clutter_util_vertex_length (vertex); double ascl,
double bscl,
if (factor == 0.f) graphene_point3d_t *res)
return;
vertex->x /= factor;
vertex->y /= factor;
vertex->z /= factor;
}
static float
_clutter_util_vertex_dot (const ClutterVertex *v1,
const ClutterVertex *v2)
{
return v1->x * v2->x + v1->y * v2->y + v1->z * v2->z;
}
static void
_clutter_util_vertex_cross (const ClutterVertex *v1,
const ClutterVertex *v2,
ClutterVertex *res)
{
res->x = v1->y * v2->z - v2->y * v1->z;
res->y = v1->z * v2->x - v2->z * v1->x;
res->z = v1->x * v2->y - v2->x * v1->y;
}
static void
_clutter_util_vertex_combine (const ClutterVertex *a,
const ClutterVertex *b,
double ascl,
double bscl,
ClutterVertex *res)
{ {
res->x = (ascl * a->x) + (bscl * b->x); res->x = (ascl * a->x) + (bscl * b->x);
res->y = (ascl * a->y) + (bscl * b->y); res->y = (ascl * a->y) + (bscl * b->y);
@@ -388,16 +352,16 @@ _clutter_util_vertex4_interpolate (const ClutterVertex4 *a,
*/ */
gboolean gboolean
_clutter_util_matrix_decompose (const ClutterMatrix *src, _clutter_util_matrix_decompose (const ClutterMatrix *src,
ClutterVertex *scale_p, graphene_point3d_t *scale_p,
float shear_p[3], float shear_p[3],
ClutterVertex *rotate_p, graphene_point3d_t *rotate_p,
ClutterVertex *translate_p, graphene_point3d_t *translate_p,
ClutterVertex4 *perspective_p) ClutterVertex4 *perspective_p)
{ {
CoglMatrix matrix = *src; CoglMatrix matrix = *src;
CoglMatrix perspective; CoglMatrix perspective;
ClutterVertex4 vertex_tmp; ClutterVertex4 vertex_tmp;
ClutterVertex row[3], pdum; graphene_point3d_t row[3], pdum;
int i, j; int i, j;
#define XY_SHEAR 0 #define XY_SHEAR 0
@@ -485,34 +449,34 @@ _clutter_util_matrix_decompose (const ClutterMatrix *src,
} }
/* compute scale.x and normalize the first row */ /* compute scale.x and normalize the first row */
scale_p->x = _clutter_util_vertex_length (&row[0]); scale_p->x = graphene_point3d_length (&row[0]);
_clutter_util_vertex_normalize (&row[0]); graphene_point3d_normalize (&row[0], &row[0]);
/* compute XY shear and make the second row orthogonal to the first */ /* compute XY shear and make the second row orthogonal to the first */
shear_p[XY_SHEAR] = _clutter_util_vertex_dot (&row[0], &row[1]); shear_p[XY_SHEAR] = graphene_point3d_dot (&row[0], &row[1]);
_clutter_util_vertex_combine (&row[1], &row[0], _clutter_util_vertex_combine (&row[1], &row[0],
1.0, -shear_p[XY_SHEAR], 1.0, -shear_p[XY_SHEAR],
&row[1]); &row[1]);
/* compute the Y scale and normalize the second row */ /* compute the Y scale and normalize the second row */
scale_p->y = _clutter_util_vertex_length (&row[1]); scale_p->y = graphene_point3d_length (&row[1]);
_clutter_util_vertex_normalize (&row[1]); graphene_point3d_normalize (&row[1], &row[1]);
shear_p[XY_SHEAR] /= scale_p->y; shear_p[XY_SHEAR] /= scale_p->y;
/* compute XZ and YZ shears, orthogonalize the third row */ /* compute XZ and YZ shears, orthogonalize the third row */
shear_p[XZ_SHEAR] = _clutter_util_vertex_dot (&row[0], &row[2]); shear_p[XZ_SHEAR] = graphene_point3d_dot (&row[0], &row[2]);
_clutter_util_vertex_combine (&row[2], &row[0], _clutter_util_vertex_combine (&row[2], &row[0],
1.0, -shear_p[XZ_SHEAR], 1.0, -shear_p[XZ_SHEAR],
&row[2]); &row[2]);
shear_p[YZ_SHEAR] = _clutter_util_vertex_dot (&row[1], &row[2]); shear_p[YZ_SHEAR] = graphene_point3d_dot (&row[1], &row[2]);
_clutter_util_vertex_combine (&row[2], &row[1], _clutter_util_vertex_combine (&row[2], &row[1],
1.0, -shear_p[YZ_SHEAR], 1.0, -shear_p[YZ_SHEAR],
&row[2]); &row[2]);
/* get the Z scale and normalize the third row*/ /* get the Z scale and normalize the third row*/
scale_p->z = _clutter_util_vertex_length (&row[2]); scale_p->z = graphene_point3d_length (&row[2]);
_clutter_util_vertex_normalize (&row[2]); graphene_point3d_normalize (&row[2], &row[2]);
shear_p[XZ_SHEAR] /= scale_p->z; shear_p[XZ_SHEAR] /= scale_p->z;
shear_p[YZ_SHEAR] /= scale_p->z; shear_p[YZ_SHEAR] /= scale_p->z;
@@ -520,8 +484,8 @@ _clutter_util_matrix_decompose (const ClutterMatrix *src,
* check for a coordinate system flip; if the determinant * check for a coordinate system flip; if the determinant
* is -1, then negate the matrix and scaling factors * is -1, then negate the matrix and scaling factors
*/ */
_clutter_util_vertex_cross (&row[1], &row[2], &pdum); graphene_point3d_cross (&row[1], &row[2], &pdum);
if (_clutter_util_vertex_dot (&row[0], &pdum) < 0.f) if (graphene_point3d_dot (&row[0], &pdum) < 0.f)
{ {
scale_p->x *= -1.f; scale_p->x *= -1.f;

View File

@@ -80,9 +80,9 @@ struct _ClutterZoomActionPrivate
ZoomPoint points[2]; ZoomPoint points[2];
ClutterPoint initial_focal_point; graphene_point_t initial_focal_point;
ClutterPoint focal_point; graphene_point_t focal_point;
ClutterPoint transformed_focal_point; graphene_point_t transformed_focal_point;
gfloat initial_x; gfloat initial_x;
gfloat initial_y; gfloat initial_y;
@@ -238,13 +238,13 @@ clutter_zoom_action_gesture_cancel (ClutterGestureAction *action,
static gboolean static gboolean
clutter_zoom_action_real_zoom (ClutterZoomAction *action, clutter_zoom_action_real_zoom (ClutterZoomAction *action,
ClutterActor *actor, ClutterActor *actor,
ClutterPoint *focal_point, graphene_point_t *focal_point,
gdouble factor) gdouble factor)
{ {
ClutterZoomActionPrivate *priv = action->priv; ClutterZoomActionPrivate *priv = action->priv;
gfloat x, y, z; gfloat x, y, z;
gdouble scale_x, scale_y; gdouble scale_x, scale_y;
ClutterVertex out, in; graphene_point3d_t out, in;
in.x = priv->transformed_focal_point.x; in.x = priv->transformed_focal_point.x;
in.y = priv->transformed_focal_point.y; in.y = priv->transformed_focal_point.y;
@@ -400,7 +400,7 @@ clutter_zoom_action_class_init (ClutterZoomActionClass *klass)
_clutter_marshal_BOOLEAN__OBJECT_BOXED_DOUBLE, _clutter_marshal_BOOLEAN__OBJECT_BOXED_DOUBLE,
G_TYPE_BOOLEAN, 3, G_TYPE_BOOLEAN, 3,
CLUTTER_TYPE_ACTOR, CLUTTER_TYPE_ACTOR,
CLUTTER_TYPE_POINT, GRAPHENE_TYPE_POINT,
G_TYPE_DOUBLE); G_TYPE_DOUBLE);
} }
@@ -478,7 +478,7 @@ clutter_zoom_action_get_zoom_axis (ClutterZoomAction *action)
/** /**
* clutter_zoom_action_get_focal_point: * clutter_zoom_action_get_focal_point:
* @action: a #ClutterZoomAction * @action: a #ClutterZoomAction
* @point: (out): a #ClutterPoint * @point: (out): a #graphene_point_t
* *
* Retrieves the focal point of the current zoom * Retrieves the focal point of the current zoom
* *
@@ -486,7 +486,7 @@ clutter_zoom_action_get_zoom_axis (ClutterZoomAction *action)
*/ */
void void
clutter_zoom_action_get_focal_point (ClutterZoomAction *action, clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
ClutterPoint *point) graphene_point_t *point)
{ {
g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action)); g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action));
g_return_if_fail (point != NULL); g_return_if_fail (point != NULL);
@@ -497,7 +497,7 @@ clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
/** /**
* clutter_zoom_action_get_transformed_focal_point: * clutter_zoom_action_get_transformed_focal_point:
* @action: a #ClutterZoomAction * @action: a #ClutterZoomAction
* @point: (out): a #ClutterPoint * @point: (out): a #graphene_point_t
* *
* Retrieves the focal point relative to the actor's coordinates of * Retrieves the focal point relative to the actor's coordinates of
* the current zoom * the current zoom
@@ -506,7 +506,7 @@ clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
*/ */
void void
clutter_zoom_action_get_transformed_focal_point (ClutterZoomAction *action, clutter_zoom_action_get_transformed_focal_point (ClutterZoomAction *action,
ClutterPoint *point) graphene_point_t *point)
{ {
g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action)); g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action));
g_return_if_fail (point != NULL); g_return_if_fail (point != NULL);

View File

@@ -79,7 +79,7 @@ struct _ClutterZoomActionClass
/*< public >*/ /*< public >*/
gboolean (* zoom) (ClutterZoomAction *action, gboolean (* zoom) (ClutterZoomAction *action,
ClutterActor *actor, ClutterActor *actor,
ClutterPoint *focal_point, graphene_point_t *focal_point,
gdouble factor); gdouble factor);
/*< private >*/ /*< private >*/
@@ -104,10 +104,10 @@ ClutterZoomAxis clutter_zoom_action_get_zoom_axis (ClutterZoomActi
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_zoom_action_get_focal_point (ClutterZoomAction *action, void clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
ClutterPoint *point); graphene_point_t *point);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_zoom_action_get_transformed_focal_point (ClutterZoomAction *action, void clutter_zoom_action_get_transformed_focal_point (ClutterZoomAction *action,
ClutterPoint *point); graphene_point_t *point);
G_END_DECLS G_END_DECLS

View File

@@ -56,7 +56,7 @@ typedef struct _ClutterStageViewCoglPrivate
*/ */
#define DAMAGE_HISTORY_MAX 16 #define DAMAGE_HISTORY_MAX 16
#define DAMAGE_HISTORY(x) ((x) & (DAMAGE_HISTORY_MAX - 1)) #define DAMAGE_HISTORY(x) ((x) & (DAMAGE_HISTORY_MAX - 1))
cairo_rectangle_int_t damage_history[DAMAGE_HISTORY_MAX]; cairo_region_t * damage_history[DAMAGE_HISTORY_MAX];
unsigned int damage_index; unsigned int damage_index;
} ClutterStageViewCoglPrivate; } ClutterStageViewCoglPrivate;
@@ -204,7 +204,7 @@ clutter_stage_cogl_schedule_update (ClutterStageWindow *stage_window,
if (max_render_time_allowed <= 0) if (max_render_time_allowed <= 0)
{ {
g_warning ("Unsupported monitor refresh rate detected. " g_warning ("Unsupported monitor refresh rate detected. "
"(Refresh rate: %.3f, refresh interval: %ld)", "(Refresh rate: %.3f, refresh interval: %" G_GINT64_FORMAT ")",
refresh_rate, refresh_rate,
refresh_interval); refresh_interval);
stage_cogl->update_time = now; stage_cogl->update_time = now;
@@ -296,13 +296,10 @@ clutter_stage_cogl_has_redraw_clips (ClutterStageWindow *stage_window)
/* NB: at the start of each new frame there is an implied clip that /* NB: at the start of each new frame there is an implied clip that
* clips everything (i.e. nothing would be drawn) so we need to make * clips everything (i.e. nothing would be drawn) so we need to make
* sure we return True in the un-initialized case here. * sure we return True in the un-initialized case here.
*
* NB: a clip width of 0 means a full stage redraw has been queued
* so we effectively don't have any redraw clips in that case.
*/ */
if (!stage_cogl->initialized_redraw_clip || if (!stage_cogl->initialized_redraw_clip ||
(stage_cogl->initialized_redraw_clip && (stage_cogl->initialized_redraw_clip &&
stage_cogl->bounding_redraw_clip.width != 0)) stage_cogl->redraw_clip))
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
@@ -313,9 +310,9 @@ clutter_stage_cogl_ignoring_redraw_clips (ClutterStageWindow *stage_window)
{ {
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window); ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
/* NB: a clip width of 0 means a full stage redraw is required */ /* NB: a NULL clip means a full stage redraw is required */
if (stage_cogl->initialized_redraw_clip && if (stage_cogl->initialized_redraw_clip &&
stage_cogl->bounding_redraw_clip.width == 0) !stage_cogl->redraw_clip)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
@@ -346,11 +343,11 @@ clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
return; return;
/* A NULL stage clip means a full stage redraw has been queued and /* A NULL stage clip means a full stage redraw has been queued and
* we keep track of this by setting a zero width * we keep track of this by setting a NULL redraw_clip.
* stage_cogl->bounding_redraw_clip */ */
if (stage_clip == NULL) if (stage_clip == NULL)
{ {
stage_cogl->bounding_redraw_clip.width = 0; g_clear_pointer (&stage_cogl->redraw_clip, cairo_region_destroy);
stage_cogl->initialized_redraw_clip = TRUE; stage_cogl->initialized_redraw_clip = TRUE;
return; return;
} }
@@ -359,34 +356,27 @@ clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
if (stage_clip->width == 0 || stage_clip->height == 0) if (stage_clip->width == 0 || stage_clip->height == 0)
return; return;
if (!stage_cogl->initialized_redraw_clip) if (!stage_cogl->redraw_clip)
{ {
stage_cogl->bounding_redraw_clip = *stage_clip; stage_cogl->redraw_clip = cairo_region_create_rectangle (stage_clip);
} }
else if (stage_cogl->bounding_redraw_clip.width > 0) else
{ {
_clutter_util_rectangle_union (&stage_cogl->bounding_redraw_clip, cairo_region_union_rectangle (stage_cogl->redraw_clip, stage_clip);
stage_clip,
&stage_cogl->bounding_redraw_clip);
} }
stage_cogl->initialized_redraw_clip = TRUE; stage_cogl->initialized_redraw_clip = TRUE;
} }
static gboolean static cairo_region_t *
clutter_stage_cogl_get_redraw_clip_bounds (ClutterStageWindow *stage_window, clutter_stage_cogl_get_redraw_clip (ClutterStageWindow *stage_window)
cairo_rectangle_int_t *stage_clip)
{ {
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window); ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
if (stage_cogl->using_clipped_redraw) if (stage_cogl->using_clipped_redraw && stage_cogl->redraw_clip)
{ return cairo_region_copy (stage_cogl->redraw_clip);
*stage_clip = stage_cogl->bounding_redraw_clip;
return TRUE; return NULL;
}
return FALSE;
} }
static inline gboolean static inline gboolean
@@ -403,37 +393,47 @@ valid_buffer_age (ClutterStageViewCogl *view_cogl,
} }
static void static void
paint_damage_region (ClutterStageWindow *stage_window, paint_damage_region (ClutterStageWindow *stage_window,
ClutterStageView *view, ClutterStageView *view,
cairo_rectangle_int_t *swap_region) cairo_region_t *swap_region)
{ {
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view); CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
CoglContext *ctx = cogl_framebuffer_get_context (framebuffer); CoglContext *ctx = cogl_framebuffer_get_context (framebuffer);
static CoglPipeline *overlay_blue = NULL; static CoglPipeline *overlay_blue = NULL;
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window); ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
ClutterActor *actor = CLUTTER_ACTOR (stage_cogl->wrapper); ClutterActor *actor = CLUTTER_ACTOR (stage_cogl->wrapper);
float x_1 = swap_region->x; CoglMatrix transform;
float x_2 = swap_region->x + swap_region->width; int n_rects, i;
float y_1 = swap_region->y;
float y_2 = swap_region->y + swap_region->height;
CoglMatrix modelview;
cogl_framebuffer_push_matrix (framebuffer);
clutter_actor_get_transform (actor, &transform);
cogl_framebuffer_transform (framebuffer, &transform);
/* Blue for the swap region */
if (G_UNLIKELY (overlay_blue == NULL)) if (G_UNLIKELY (overlay_blue == NULL))
{ {
overlay_blue = cogl_pipeline_new (ctx); overlay_blue = cogl_pipeline_new (ctx);
cogl_pipeline_set_color4ub (overlay_blue, 0x00, 0x00, 0x33, 0x33); cogl_pipeline_set_color4ub (overlay_blue, 0x00, 0x00, 0x33, 0x33);
} }
cogl_framebuffer_push_matrix (framebuffer); n_rects = cairo_region_num_rectangles (swap_region);
cogl_matrix_init_identity (&modelview); for (i = 0; i < n_rects; i++)
_clutter_actor_apply_modelview_transform (actor, &modelview); {
cogl_framebuffer_set_modelview_matrix (framebuffer, &modelview); cairo_rectangle_int_t rect;
float x_1, x_2, y_1, y_2;
/* Blue for the swap region */ cairo_region_get_rectangle (swap_region, i, &rect);
cogl_framebuffer_draw_rectangle (framebuffer, overlay_blue, x_1, y_1, x_2, y_2); x_1 = rect.x;
x_2 = rect.x + rect.width;
y_1 = rect.y;
y_2 = rect.y + rect.height;
cogl_framebuffer_draw_rectangle (framebuffer, overlay_blue, x_1, y_1, x_2, y_2);
}
/* Red for the clip */ /* Red for the clip */
if (stage_cogl->initialized_redraw_clip) if (stage_cogl->initialized_redraw_clip &&
stage_cogl->redraw_clip)
{ {
static CoglPipeline *overlay_red = NULL; static CoglPipeline *overlay_red = NULL;
@@ -443,55 +443,63 @@ paint_damage_region (ClutterStageWindow *stage_window,
cogl_pipeline_set_color4ub (overlay_red, 0x33, 0x00, 0x00, 0x33); cogl_pipeline_set_color4ub (overlay_red, 0x33, 0x00, 0x00, 0x33);
} }
x_1 = stage_cogl->bounding_redraw_clip.x; n_rects = cairo_region_num_rectangles (stage_cogl->redraw_clip);
x_2 = stage_cogl->bounding_redraw_clip.x + stage_cogl->bounding_redraw_clip.width; for (i = 0; i < n_rects; i++)
y_1 = stage_cogl->bounding_redraw_clip.y; {
y_2 = stage_cogl->bounding_redraw_clip.y + stage_cogl->bounding_redraw_clip.height; cairo_rectangle_int_t rect;
float x_1, x_2, y_1, y_2;
cogl_framebuffer_draw_rectangle (framebuffer, overlay_red, x_1, y_1, x_2, y_2); cairo_region_get_rectangle (stage_cogl->redraw_clip, i, &rect);
x_1 = rect.x;
x_2 = rect.x + rect.width;
y_1 = rect.y;
y_2 = rect.y + rect.height;
cogl_framebuffer_draw_rectangle (framebuffer, overlay_red, x_1, y_1, x_2, y_2);
}
} }
cogl_framebuffer_pop_matrix (framebuffer); cogl_framebuffer_pop_matrix (framebuffer);
} }
static gboolean static gboolean
swap_framebuffer (ClutterStageWindow *stage_window, swap_framebuffer (ClutterStageWindow *stage_window,
ClutterStageView *view, ClutterStageView *view,
cairo_rectangle_int_t *swap_region, cairo_region_t *swap_region,
gboolean swap_with_damage) gboolean swap_with_damage)
{ {
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view); CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
int damage[4], ndamage; int *damage, n_rects, i;
damage[0] = swap_region->x;
damage[1] = swap_region->y;
damage[2] = swap_region->width;
damage[3] = swap_region->height;
if (swap_region->width != 0)
ndamage = 1;
else
ndamage = 0;
if (G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION))) if (G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_PAINT_DAMAGE_REGION)))
paint_damage_region (stage_window, view, swap_region); paint_damage_region (stage_window, view, swap_region);
n_rects = cairo_region_num_rectangles (swap_region);
damage = g_newa (int, n_rects * 4);
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t rect;
cairo_region_get_rectangle (swap_region, i, &rect);
damage[i * 4] = rect.x;
damage[i * 4 + 1] = rect.y;
damage[i * 4 + 2] = rect.width;
damage[i * 4 + 3] = rect.height;
}
if (cogl_is_onscreen (framebuffer)) if (cogl_is_onscreen (framebuffer))
{ {
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer); CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
/* push on the screen */ /* push on the screen */
if (ndamage == 1 && !swap_with_damage) if (n_rects > 0 && !swap_with_damage)
{ {
CLUTTER_NOTE (BACKEND, CLUTTER_NOTE (BACKEND,
"cogl_onscreen_swap_region (onscreen: %p, " "cogl_onscreen_swap_region (onscreen: %p)",
"x: %d, y: %d, " onscreen);
"width: %d, height: %d)",
onscreen,
damage[0], damage[1], damage[2], damage[3]);
cogl_onscreen_swap_region (onscreen, cogl_onscreen_swap_region (onscreen,
damage, ndamage); damage, n_rects);
return FALSE; return FALSE;
} }
@@ -501,7 +509,7 @@ swap_framebuffer (ClutterStageWindow *stage_window,
onscreen); onscreen);
cogl_onscreen_swap_buffers_with_damage (onscreen, cogl_onscreen_swap_buffers_with_damage (onscreen,
damage, ndamage); damage, n_rects);
return TRUE; return TRUE;
} }
@@ -517,80 +525,121 @@ swap_framebuffer (ClutterStageWindow *stage_window,
} }
static void static void
paint_stage (ClutterStageCogl *stage_cogl, scale_and_clamp_rect (const graphene_rect_t *rect,
ClutterStageView *view, float scale,
const cairo_rectangle_int_t *clip) cairo_rectangle_int_t *dest)
{ {
ClutterStage *stage = stage_cogl->wrapper; graphene_rect_t tmp = *rect;
_clutter_stage_maybe_setup_viewport (stage, view); graphene_rect_scale (&tmp, scale, scale, &tmp);
_clutter_stage_paint_view (stage, view, clip); _clutter_util_rectangle_int_extents (&tmp, dest);
if (clutter_stage_view_get_onscreen (view) !=
clutter_stage_view_get_framebuffer (view))
{
clutter_stage_view_blit_offscreen (view, clip);
}
} }
static void static void
fill_current_damage_history_and_step (ClutterStageView *view) paint_stage (ClutterStageCogl *stage_cogl,
ClutterStageView *view,
cairo_region_t *clip)
{
ClutterStage *stage = stage_cogl->wrapper;
cairo_rectangle_int_t clip_rect;
cairo_rectangle_int_t paint_rect;
cairo_rectangle_int_t view_rect;
graphene_rect_t rect;
float fb_scale;
clutter_stage_view_get_layout (view, &view_rect);
fb_scale = clutter_stage_view_get_scale (view);
cairo_region_get_extents (clip, &clip_rect);
_clutter_util_rect_from_rectangle (&clip_rect, &rect);
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &paint_rect);
_clutter_util_rectangle_offset (&paint_rect,
view_rect.x,
view_rect.y,
&paint_rect);
_clutter_stage_maybe_setup_viewport (stage, view);
_clutter_stage_paint_view (stage, view, &paint_rect);
clutter_stage_view_after_paint (view, &paint_rect);
}
static void
fill_current_damage_history (ClutterStageView *view,
cairo_region_t *damage)
{ {
ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (view); ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (view);
ClutterStageViewCoglPrivate *view_priv = ClutterStageViewCoglPrivate *view_priv =
clutter_stage_view_cogl_get_instance_private (view_cogl); clutter_stage_view_cogl_get_instance_private (view_cogl);
cairo_rectangle_int_t view_rect; cairo_region_t **current_fb_damage;
float fb_scale;
cairo_rectangle_int_t *current_fb_damage;
current_fb_damage = current_fb_damage =
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index)]; &view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index)];
clutter_stage_view_get_layout (view, &view_rect);
fb_scale = clutter_stage_view_get_scale (view);
*current_fb_damage = (cairo_rectangle_int_t) { g_clear_pointer (current_fb_damage, cairo_region_destroy);
.x = 0, *current_fb_damage = cairo_region_copy (damage);
.y = 0,
.width = ceilf (view_rect.width * fb_scale),
.height = ceilf (view_rect.height * fb_scale)
};
view_priv->damage_index++; view_priv->damage_index++;
} }
static void static void
transform_swap_region_to_onscreen (ClutterStageView *view, fill_current_damage_history_rectangle (ClutterStageView *view,
cairo_rectangle_int_t *swap_region) const cairo_rectangle_int_t *rect)
{
cairo_region_t *damage;
damage = cairo_region_create_rectangle (rect);
fill_current_damage_history (view, damage);
cairo_region_destroy (damage);
}
static cairo_region_t *
transform_swap_region_to_onscreen (ClutterStageView *view,
cairo_region_t *swap_region)
{ {
CoglFramebuffer *framebuffer; CoglFramebuffer *framebuffer;
cairo_rectangle_int_t layout; cairo_rectangle_int_t layout;
gfloat x1, y1, x2, y2;
gint width, height; gint width, height;
int n_rects, i;
cairo_rectangle_int_t *rects;
cairo_region_t *transformed_region;
framebuffer = clutter_stage_view_get_onscreen (view); framebuffer = clutter_stage_view_get_onscreen (view);
clutter_stage_view_get_layout (view, &layout); clutter_stage_view_get_layout (view, &layout);
x1 = (float) swap_region->x / layout.width;
y1 = (float) swap_region->y / layout.height;
x2 = (float) (swap_region->x + swap_region->width) / layout.width;
y2 = (float) (swap_region->y + swap_region->height) / layout.height;
clutter_stage_view_transform_to_onscreen (view, &x1, &y1);
clutter_stage_view_transform_to_onscreen (view, &x2, &y2);
width = cogl_framebuffer_get_width (framebuffer); width = cogl_framebuffer_get_width (framebuffer);
height = cogl_framebuffer_get_height (framebuffer); height = cogl_framebuffer_get_height (framebuffer);
x1 = floor (x1 * width); n_rects = cairo_region_num_rectangles (swap_region);
y1 = floor (height - (y1 * height)); rects = g_newa (cairo_rectangle_int_t, n_rects);
x2 = ceil (x2 * width); for (i = 0; i < n_rects; i++)
y2 = ceil (height - (y2 * height)); {
gfloat x1, y1, x2, y2;
*swap_region = (cairo_rectangle_int_t) { cairo_region_get_rectangle (swap_region, i, &rects[i]);
.x = x1,
.y = y1, x1 = (float) rects[i].x / layout.width;
.width = x2 - x1, y1 = (float) rects[i].y / layout.height;
.height = y2 - y1 x2 = (float) (rects[i].x + rects[i].width) / layout.width;
}; y2 = (float) (rects[i].y + rects[i].height) / layout.height;
clutter_stage_view_transform_to_onscreen (view, &x1, &y1);
clutter_stage_view_transform_to_onscreen (view, &x2, &y2);
x1 = floor (x1 * width);
y1 = floor (height - (y1 * height));
x2 = ceil (x2 * width);
y2 = ceil (height - (y2 * height));
rects[i].x = x1;
rects[i].y = y1;
rects[i].width = x2 - x1;
rects[i].height = y2 - y1;
}
transformed_region = cairo_region_create_rectangles (rects, n_rects);
return transformed_region;
} }
static void static void
@@ -624,18 +673,6 @@ is_buffer_age_enabled (void)
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE); cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE);
} }
static void
scale_and_clamp_rect (const ClutterRect *rect,
float scale,
cairo_rectangle_int_t *dest)
{
ClutterRect tmp = *rect;
clutter_rect_scale (&tmp, scale, scale);
_clutter_util_rectangle_int_extents (&tmp, dest);
}
static gboolean static gboolean
clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window, clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
ClutterStageView *view) ClutterStageView *view)
@@ -654,9 +691,10 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
gboolean do_swap_buffer; gboolean do_swap_buffer;
gboolean swap_with_damage; gboolean swap_with_damage;
ClutterActor *wrapper; ClutterActor *wrapper;
cairo_rectangle_int_t redraw_clip; cairo_region_t *redraw_clip;
cairo_rectangle_int_t swap_region; cairo_region_t *fb_clip_region;
cairo_rectangle_int_t fb_clip_region; cairo_region_t *swap_region;
cairo_rectangle_int_t redraw_rect;
gboolean clip_region_empty; gboolean clip_region_empty;
float fb_scale; float fb_scale;
int subpixel_compensation = 0; int subpixel_compensation = 0;
@@ -675,20 +713,19 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
has_buffer_age = cogl_is_onscreen (fb) && is_buffer_age_enabled (); has_buffer_age = cogl_is_onscreen (fb) && is_buffer_age_enabled ();
/* NB: a zero width redraw clip == full stage redraw */ /* NB: a NULL redraw clip == full stage redraw */
if (stage_cogl->bounding_redraw_clip.width == 0) if (!stage_cogl->redraw_clip)
have_clip = FALSE; have_clip = FALSE;
else else
{ {
redraw_clip = stage_cogl->bounding_redraw_clip; cairo_region_t *view_region;
_clutter_util_rectangle_intersection (&redraw_clip, redraw_clip = cairo_region_copy (stage_cogl->redraw_clip);
&view_rect,
&redraw_clip);
have_clip = !(redraw_clip.x == view_rect.x && view_region = cairo_region_create_rectangle (&view_rect);
redraw_clip.y == view_rect.y && cairo_region_intersect (redraw_clip, view_region);
redraw_clip.width == view_rect.width &&
redraw_clip.height == view_rect.height); have_clip = !cairo_region_equal (redraw_clip, view_region);
cairo_region_destroy (view_region);
} }
may_use_clipped_redraw = FALSE; may_use_clipped_redraw = FALSE;
@@ -699,26 +736,53 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
* frames when starting up... */ * frames when starting up... */
cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3) cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3)
{ {
ClutterRect rect; graphene_rect_t rect;
cairo_rectangle_int_t *rects;
int n_rects, i;
may_use_clipped_redraw = TRUE; may_use_clipped_redraw = TRUE;
_clutter_util_rect_from_rectangle (&redraw_clip, &rect); fb_clip_region = cairo_region_create ();
clutter_rect_offset (&rect, -view_rect.x, -view_rect.y);
scale_and_clamp_rect (&rect, fb_scale, &fb_clip_region); n_rects = cairo_region_num_rectangles (redraw_clip);
rects = g_new (cairo_rectangle_int_t, n_rects);
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t new_fb_clip_rect;
cairo_region_get_rectangle (redraw_clip, i, &rects[i]);
_clutter_util_rect_from_rectangle (&rects[i], &rect);
graphene_rect_offset (&rect, -view_rect.x, -view_rect.y);
scale_and_clamp_rect (&rect, fb_scale, &new_fb_clip_rect);
cairo_region_union_rectangle (fb_clip_region, &new_fb_clip_rect);
}
g_free (rects);
if (fb_scale != floorf (fb_scale)) if (fb_scale != floorf (fb_scale))
{ {
subpixel_compensation = ceilf (fb_scale); subpixel_compensation = ceilf (fb_scale);
fb_clip_region.x -= subpixel_compensation;
fb_clip_region.y -= subpixel_compensation; n_rects = cairo_region_num_rectangles (fb_clip_region);
fb_clip_region.width += 2 * subpixel_compensation; rects = g_newa (cairo_rectangle_int_t, n_rects);
fb_clip_region.height += 2 * subpixel_compensation; for (i = 0; i < n_rects; i++)
{
cairo_region_get_rectangle (fb_clip_region, i, &rects[i]);
rects[i].x -= subpixel_compensation;
rects[i].y -= subpixel_compensation;
rects[i].width += 2 * subpixel_compensation;
rects[i].height += 2 * subpixel_compensation;
}
cairo_region_destroy (fb_clip_region);
fb_clip_region = cairo_region_create_rectangles (rects, n_rects);
} }
} }
else else
{ {
fb_clip_region = (cairo_rectangle_int_t) { 0 }; cairo_rectangle_int_t rect = { 0, 0, view_rect.width, view_rect.height };
fb_clip_region = cairo_region_create_rectangle (&rect);
redraw_clip = cairo_region_copy (fb_clip_region);
} }
if (may_use_clipped_redraw && if (may_use_clipped_redraw &&
@@ -727,71 +791,81 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
else else
use_clipped_redraw = FALSE; use_clipped_redraw = FALSE;
clip_region_empty = may_use_clipped_redraw && fb_clip_region.width == 0; clip_region_empty = may_use_clipped_redraw && cairo_region_is_empty (fb_clip_region);
swap_with_damage = FALSE; swap_with_damage = FALSE;
if (has_buffer_age) if (has_buffer_age)
{ {
if (use_clipped_redraw && !clip_region_empty) if (use_clipped_redraw && !clip_region_empty)
{ {
int age, i; int age;
cairo_rectangle_int_t *current_fb_damage =
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index++)];
age = cogl_onscreen_get_buffer_age (COGL_ONSCREEN (fb)); age = cogl_onscreen_get_buffer_age (COGL_ONSCREEN (fb));
if (valid_buffer_age (view_cogl, age)) if (valid_buffer_age (view_cogl, age))
{ {
ClutterRect rect; graphene_rect_t rect;
cairo_rectangle_int_t damage_region; cairo_rectangle_int_t damage_region;
cairo_rectangle_int_t *rects;
int n_rects, i;
*current_fb_damage = fb_clip_region; fill_current_damage_history (view, fb_clip_region);
for (i = 1; i <= age; i++) for (i = 1; i <= age; i++)
{ {
cairo_rectangle_int_t *fb_damage = cairo_region_t *fb_damage =
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - i - 1)]; view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - i - 1)];
cairo_region_union (fb_clip_region, fb_damage);
_clutter_util_rectangle_union (&fb_clip_region,
fb_damage,
&fb_clip_region);
} }
/* Update the bounding redraw clip state with the extra damage. */ /* Update the redraw clip state with the extra damage. */
_clutter_util_rect_from_rectangle (&fb_clip_region, &rect); n_rects = cairo_region_num_rectangles (fb_clip_region);
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &damage_region); rects = g_newa (cairo_rectangle_int_t, n_rects);
_clutter_util_rectangle_offset (&damage_region, for (i = 0; i < n_rects; i++)
view_rect.x, {
view_rect.y, cairo_region_get_rectangle (fb_clip_region, i, &rects[i]);
&damage_region); _clutter_util_rect_from_rectangle (&rects[i], &rect);
_clutter_util_rectangle_union (&stage_cogl->bounding_redraw_clip, scale_and_clamp_rect (&rect, 1.0f / fb_scale, &damage_region);
&damage_region, _clutter_util_rectangle_offset (&damage_region,
&stage_cogl->bounding_redraw_clip); view_rect.x,
view_rect.y,
&damage_region);
cairo_region_union_rectangle (stage_cogl->redraw_clip,
&damage_region);
}
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: x=%d, y=%d, width=%d, height=%d\n", CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: num rects: %d\n",
age, age,
fb_clip_region.x, cairo_region_num_rectangles (fb_clip_region));
fb_clip_region.y,
fb_clip_region.width,
fb_clip_region.height);
swap_with_damage = TRUE; swap_with_damage = TRUE;
} }
else else
{ {
cairo_rectangle_int_t fb_damage;
CLUTTER_NOTE (CLIPPING, "Invalid back buffer(age=%d): forcing full redraw\n", age); CLUTTER_NOTE (CLIPPING, "Invalid back buffer(age=%d): forcing full redraw\n", age);
use_clipped_redraw = FALSE; use_clipped_redraw = FALSE;
*current_fb_damage = (cairo_rectangle_int_t) { fb_damage = (cairo_rectangle_int_t) {
.x = 0, .x = 0,
.y = 0, .y = 0,
.width = view_rect.width * fb_scale, .width = ceilf (view_rect.width * fb_scale),
.height = view_rect.height * fb_scale .height = ceilf (view_rect.height * fb_scale)
}; };
fill_current_damage_history_rectangle (view, &fb_damage);
} }
} }
else if (!use_clipped_redraw) else if (!use_clipped_redraw)
{ {
fill_current_damage_history_and_step (view); cairo_rectangle_int_t fb_damage;
fb_damage = (cairo_rectangle_int_t) {
.x = 0,
.y = 0,
.width = ceilf (view_rect.width * fb_scale),
.height = ceilf (view_rect.height * fb_scale)
};
fill_current_damage_history_rectangle (view, &fb_damage);
} }
} }
@@ -802,11 +876,12 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
} }
else if (use_clipped_redraw) else if (use_clipped_redraw)
{ {
ClutterRect rect; cairo_rectangle_int_t clip_rect;
cairo_rectangle_int_t scissor_rect; cairo_rectangle_int_t scissor_rect;
cairo_rectangle_int_t paint_rect;
calculate_scissor_region (&fb_clip_region, cairo_region_get_extents (fb_clip_region, &clip_rect);
calculate_scissor_region (&clip_rect,
subpixel_compensation, subpixel_compensation,
fb_width, fb_height, fb_width, fb_height,
&scissor_rect); &scissor_rect);
@@ -826,14 +901,8 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
scissor_rect.width, scissor_rect.width,
scissor_rect.height); scissor_rect.height);
_clutter_util_rect_from_rectangle (&fb_clip_region, &rect); paint_stage (stage_cogl, view, fb_clip_region);
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &paint_rect);
_clutter_util_rectangle_offset (&paint_rect,
view_rect.x,
view_rect.y,
&paint_rect);
paint_stage (stage_cogl, view, &paint_rect);
cogl_framebuffer_pop_clip (fb); cogl_framebuffer_pop_clip (fb);
stage_cogl->using_clipped_redraw = FALSE; stage_cogl->using_clipped_redraw = FALSE;
@@ -843,16 +912,17 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
CLUTTER_NOTE (CLIPPING, "Unclipped stage paint\n"); CLUTTER_NOTE (CLIPPING, "Unclipped stage paint\n");
/* If we are trying to debug redraw issues then we want to pass /* If we are trying to debug redraw issues then we want to pass
* the bounding_redraw_clip so it can be visualized */ * the redraw_clip so it can be visualized */
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS) && if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS) &&
may_use_clipped_redraw && may_use_clipped_redraw &&
!clip_region_empty) !clip_region_empty)
{ {
ClutterRect rect; cairo_rectangle_int_t clip_rect;
cairo_rectangle_int_t scissor_rect; cairo_rectangle_int_t scissor_rect;
cairo_rectangle_int_t paint_rect;
calculate_scissor_region (&fb_clip_region, cairo_region_get_extents (fb_clip_region, &clip_rect);
calculate_scissor_region (&clip_rect,
subpixel_compensation, subpixel_compensation,
fb_width, fb_height, fb_width, fb_height,
&scissor_rect); &scissor_rect);
@@ -863,31 +933,40 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
scissor_rect.width, scissor_rect.width,
scissor_rect.height); scissor_rect.height);
_clutter_util_rect_from_rectangle (&fb_clip_region, &rect); paint_stage (stage_cogl, view, fb_clip_region);
scale_and_clamp_rect (&rect, 1.0f / fb_scale, &paint_rect);
_clutter_util_rectangle_offset (&paint_rect,
view_rect.x,
view_rect.y,
&paint_rect);
paint_stage (stage_cogl, view, &paint_rect);
cogl_framebuffer_pop_clip (fb); cogl_framebuffer_pop_clip (fb);
} }
else else
paint_stage (stage_cogl, view, &view_rect); {
cairo_rectangle_int_t clip;
cairo_region_t *view_region;
clip = (cairo_rectangle_int_t) {
.x = 0,
.y = 0,
.width = ceilf (view_rect.width * fb_scale),
.height = ceilf (view_rect.height * fb_scale)
};
view_region = cairo_region_create_rectangle (&clip);
paint_stage (stage_cogl, view, view_region);
cairo_region_destroy (view_region);
}
} }
cogl_pop_framebuffer (); cogl_pop_framebuffer ();
cairo_region_get_extents (redraw_clip, &redraw_rect);
if (may_use_clipped_redraw && if (may_use_clipped_redraw &&
G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS))) G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS)))
{ {
CoglContext *ctx = cogl_framebuffer_get_context (fb); CoglContext *ctx = cogl_framebuffer_get_context (fb);
static CoglPipeline *outline = NULL; static CoglPipeline *outline = NULL;
ClutterActor *actor = CLUTTER_ACTOR (wrapper); ClutterActor *actor = CLUTTER_ACTOR (wrapper);
float x_1 = redraw_clip.x; float x_1 = redraw_rect.x;
float x_2 = redraw_clip.x + redraw_clip.width; float x_2 = redraw_rect.x + redraw_rect.width;
float y_1 = redraw_clip.y; float y_1 = redraw_rect.y;
float y_2 = redraw_clip.y + redraw_clip.height; float y_2 = redraw_rect.y + redraw_rect.height;
CoglVertexP2 quad[4] = { CoglVertexP2 quad[4] = {
{ x_1, y_1 }, { x_1, y_1 },
{ x_2, y_1 }, { x_2, y_1 },
@@ -933,32 +1012,47 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
} }
else else
{ {
swap_region = fb_clip_region; swap_region = cairo_region_copy (fb_clip_region);
g_assert (swap_region.width > 0);
do_swap_buffer = TRUE; do_swap_buffer = TRUE;
} }
} }
else else
{ {
swap_region = (cairo_rectangle_int_t) { 0 }; swap_region = cairo_region_create ();
do_swap_buffer = TRUE; do_swap_buffer = TRUE;
} }
if (redraw_clip)
cairo_region_destroy (redraw_clip);
if (fb_clip_region)
cairo_region_destroy (fb_clip_region);
if (do_swap_buffer) if (do_swap_buffer)
{ {
gboolean res;
COGL_TRACE_BEGIN_SCOPED (ClutterStageCoglRedrawViewSwapFramebuffer, COGL_TRACE_BEGIN_SCOPED (ClutterStageCoglRedrawViewSwapFramebuffer,
"Paint (swap framebuffer)"); "Paint (swap framebuffer)");
if (clutter_stage_view_get_onscreen (view) != if (clutter_stage_view_get_onscreen (view) !=
clutter_stage_view_get_framebuffer (view)) clutter_stage_view_get_framebuffer (view))
{ {
transform_swap_region_to_onscreen (view, &swap_region); cairo_region_t *transformed_swap_region;
transformed_swap_region =
transform_swap_region_to_onscreen (view, swap_region);
cairo_region_destroy (swap_region);
swap_region = transformed_swap_region;
} }
return swap_framebuffer (stage_window, res = swap_framebuffer (stage_window,
view, view,
&swap_region, swap_region,
swap_with_damage); swap_with_damage);
cairo_region_destroy (swap_region);
return res;
} }
else else
{ {
@@ -998,6 +1092,7 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
/* reset the redraw clipping for the next paint... */ /* reset the redraw clipping for the next paint... */
stage_cogl->initialized_redraw_clip = FALSE; stage_cogl->initialized_redraw_clip = FALSE;
g_clear_pointer (&stage_cogl->redraw_clip, cairo_region_destroy);
stage_cogl->frame_count++; stage_cogl->frame_count++;
@@ -1019,7 +1114,7 @@ clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
iface->add_redraw_clip = clutter_stage_cogl_add_redraw_clip; iface->add_redraw_clip = clutter_stage_cogl_add_redraw_clip;
iface->has_redraw_clips = clutter_stage_cogl_has_redraw_clips; iface->has_redraw_clips = clutter_stage_cogl_has_redraw_clips;
iface->ignoring_redraw_clips = clutter_stage_cogl_ignoring_redraw_clips; iface->ignoring_redraw_clips = clutter_stage_cogl_ignoring_redraw_clips;
iface->get_redraw_clip_bounds = clutter_stage_cogl_get_redraw_clip_bounds; iface->get_redraw_clip = clutter_stage_cogl_get_redraw_clip;
iface->redraw = clutter_stage_cogl_redraw; iface->redraw = clutter_stage_cogl_redraw;
} }

View File

@@ -62,7 +62,7 @@ struct _ClutterStageCogl
gint last_sync_delay; gint last_sync_delay;
cairo_rectangle_int_t bounding_redraw_clip; cairo_region_t *redraw_clip;
guint initialized_redraw_clip : 1; guint initialized_redraw_clip : 1;

View File

@@ -1,44 +0,0 @@
#include "clutter-build-config.h"
#include <glib-object.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-actor.h"
#include "clutter-actor-private.h"
#include "clutter-private.h"
/**
* clutter_actor_get_allocation_geometry:
* @self: A #ClutterActor
* @geom: (out): allocation geometry in pixels
*
* Gets the layout box an actor has been assigned. The allocation can
* only be assumed valid inside a paint() method; anywhere else, it
* may be out-of-date.
*
* An allocation does not incorporate the actor's scale or anchor point;
* those transformations do not affect layout, only rendering.
*
* The returned rectangle is in pixels.
*
* Since: 0.8
*
* Deprecated: 1.12: Use clutter_actor_get_allocation_box() instead.
*/
void
clutter_actor_get_allocation_geometry (ClutterActor *self,
ClutterGeometry *geom)
{
ClutterActorBox box;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
g_return_if_fail (geom != NULL);
clutter_actor_get_allocation_box (self, &box);
geom->x = CLUTTER_NEARBYINT (clutter_actor_box_get_x (&box));
geom->y = CLUTTER_NEARBYINT (clutter_actor_box_get_y (&box));
geom->width = CLUTTER_NEARBYINT (clutter_actor_box_get_width (&box));
geom->height = CLUTTER_NEARBYINT (clutter_actor_box_get_height (&box));
}

View File

@@ -145,10 +145,6 @@ CLUTTER_DEPRECATED
void clutter_actor_get_transformation_matrix (ClutterActor *self, void clutter_actor_get_transformation_matrix (ClutterActor *self,
ClutterMatrix *matrix); ClutterMatrix *matrix);
CLUTTER_DEPRECATED_FOR (clutter_actor_get_allocation_box)
void clutter_actor_get_allocation_geometry (ClutterActor *self,
ClutterGeometry *geom);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_ACTOR_DEPRECATED_H__ */ #endif /* __CLUTTER_ACTOR_DEPRECATED_H__ */

View File

@@ -39,9 +39,7 @@
* be available any more in the next major version of Clutter. * be available any more in the next major version of Clutter.
* *
* A #ClutterAlpha binds a #ClutterTimeline to a progress function which * A #ClutterAlpha binds a #ClutterTimeline to a progress function which
* translates the time T into an adimensional factor alpha. The factor can * translates the time T into an adimensional factor alpha.
* then be used to drive a #ClutterBehaviour, which will translate the
* alpha value into something meaningful for a #ClutterActor.
* *
* You should provide a #ClutterTimeline and bind it to the #ClutterAlpha * You should provide a #ClutterTimeline and bind it to the #ClutterAlpha
* instance using clutter_alpha_set_timeline(). You should also set an * instance using clutter_alpha_set_timeline(). You should also set an
@@ -59,9 +57,6 @@
* pause, stop or resume the #ClutterAlpha from calling the alpha function by * pause, stop or resume the #ClutterAlpha from calling the alpha function by
* using the appropriate functions of the #ClutterTimeline object. * using the appropriate functions of the #ClutterTimeline object.
* *
* #ClutterAlpha is used to "drive" a #ClutterBehaviour instance, and it
* is internally used by the #ClutterAnimation API.
*
* #ClutterAlpha is available since Clutter 0.2. * #ClutterAlpha is available since Clutter 0.2.
* *
* #ClutterAlpha is deprecated since Clutter 1.12. #ClutterTimeline and * #ClutterAlpha is deprecated since Clutter 1.12. #ClutterTimeline and
@@ -78,9 +73,7 @@
* *
* The following JSON fragment defines a #ClutterAlpha * The following JSON fragment defines a #ClutterAlpha
* using a #ClutterTimeline with id "sine-timeline" and an alpha * using a #ClutterTimeline with id "sine-timeline" and an alpha
* function called `my_sine_alpha`. The defined #ClutterAlpha * function called `my_sine_alpha`.
* instance can be reused in multiple #ClutterBehaviour
* definitions or for #ClutterAnimation definitions.
* *
* |[ * |[
* { * {
@@ -645,9 +638,6 @@ clutter_alpha_get_timeline (ClutterAlpha *alpha)
* bind a #ClutterTimeline object to the #ClutterAlpha instance * bind a #ClutterTimeline object to the #ClutterAlpha instance
* using clutter_alpha_set_timeline(). * using clutter_alpha_set_timeline().
* *
* You should use the newly created #ClutterAlpha instance inside
* a #ClutterBehaviour object.
*
* Return value: the newly created empty #ClutterAlpha instance. * Return value: the newly created empty #ClutterAlpha instance.
* *
* Since: 0.2 * Since: 0.2

View File

@@ -57,13 +57,6 @@
* #ClutterAnimatable interface it is possible for that instance to * #ClutterAnimatable interface it is possible for that instance to
* control the way the initial and final states are interpolated. * control the way the initial and final states are interpolated.
* *
* #ClutterAnimations are distinguished from #ClutterBehaviours
* because the former can only control #GObject properties of a single
* #GObject instance, while the latter can control multiple properties
* using accessor functions inside the #ClutterBehaviour
* `alpha_notify` virtual function, and can control multiple #ClutterActors
* as well.
*
* For convenience, it is possible to use the clutter_actor_animate() * For convenience, it is possible to use the clutter_actor_animate()
* function call which will take care of setting up and tearing down * function call which will take care of setting up and tearing down
* a #ClutterAnimation instance and animate an actor between its current * a #ClutterAnimation instance and animate an actor between its current
@@ -2220,7 +2213,7 @@ clutter_actor_animate_with_timeline (ClutterActor *actor,
* *
* Will animate the "rotation-angle-z" property between the current value * Will animate the "rotation-angle-z" property between the current value
* and 360 degrees, and set the "rotation-center-z" property to the fixed * and 360 degrees, and set the "rotation-center-z" property to the fixed
* value of the #ClutterVertex "center". * value of the #graphene_point3d_t "center".
* *
* This function will implicitly create a #ClutterAnimation object which * This function will implicitly create a #ClutterAnimation object which
* will be assigned to the @actor and will be returned to the developer * will be assigned to the @actor and will be returned to the developer

View File

@@ -1,303 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "clutter-build-config.h"
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-actor.h"
#include "clutter-alpha.h"
#include "clutter-behaviour.h"
#include "clutter-behaviour-depth.h"
#include "clutter-enum-types.h"
#include "clutter-main.h"
#include "clutter-debug.h"
#include "clutter-private.h"
/**
* SECTION:clutter-behaviour-depth
* @Title: ClutterBehaviourDepth
* @short_description: A behaviour controlling the Z position
* @Deprecated: 1.6: Use clutter_actor_animate() instead
*
* #ClutterBehaviourDepth is a simple #ClutterBehaviour controlling the
* depth of a set of actors between a start and end depth.
*
* #ClutterBehaviourDepth is available since Clutter 0.4.
*
* Deprecated: 1.6: Use the #ClutterActor:depth property and
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
* instead.
*/
struct _ClutterBehaviourDepthPrivate
{
gint depth_start;
gint depth_end;
};
enum
{
PROP_0,
PROP_DEPTH_START,
PROP_DEPTH_END
};
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourDepth,
clutter_behaviour_depth,
CLUTTER_TYPE_BEHAVIOUR)
static void
alpha_notify_foreach (ClutterBehaviour *behaviour,
ClutterActor *actor,
gpointer user_data)
{
clutter_actor_set_depth (actor, GPOINTER_TO_INT (user_data));
}
static void
clutter_behaviour_depth_alpha_notify (ClutterBehaviour *behaviour,
gdouble alpha_value)
{
ClutterBehaviourDepthPrivate *priv;
gint depth;
priv = CLUTTER_BEHAVIOUR_DEPTH (behaviour)->priv;
/* Need to create factor as to avoid borking signedness */
depth = (alpha_value * (priv->depth_end - priv->depth_start))
+ priv->depth_start;
CLUTTER_NOTE (ANIMATION, "alpha: %.4f, depth: %d", alpha_value, depth);
clutter_behaviour_actors_foreach (behaviour,
alpha_notify_foreach,
GINT_TO_POINTER (depth));
}
static void
clutter_behaviour_depth_applied (ClutterBehaviour *behaviour,
ClutterActor *actor)
{
ClutterBehaviourDepth *depth = CLUTTER_BEHAVIOUR_DEPTH (behaviour);
clutter_actor_set_depth (actor, depth->priv->depth_start);
}
static void
clutter_behaviour_depth_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourDepth *depth = CLUTTER_BEHAVIOUR_DEPTH (gobject);
switch (prop_id)
{
case PROP_DEPTH_START:
depth->priv->depth_start = g_value_get_int (value);
break;
case PROP_DEPTH_END:
depth->priv->depth_end = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_depth_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourDepth *depth = CLUTTER_BEHAVIOUR_DEPTH (gobject);
switch (prop_id)
{
case PROP_DEPTH_START:
g_value_set_int (value, depth->priv->depth_start);
break;
case PROP_DEPTH_END:
g_value_set_int (value, depth->priv->depth_end);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_depth_class_init (ClutterBehaviourDepthClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterBehaviourClass *behaviour_class = CLUTTER_BEHAVIOUR_CLASS (klass);
gobject_class->set_property = clutter_behaviour_depth_set_property;
gobject_class->get_property = clutter_behaviour_depth_get_property;
behaviour_class->alpha_notify = clutter_behaviour_depth_alpha_notify;
behaviour_class->applied = clutter_behaviour_depth_applied;
/**
* ClutterBehaviourDepth:depth-start:
*
* Start depth level to apply to the actors.
*
* Since: 0.4
*
* Deprecated: 1.6
*/
g_object_class_install_property (gobject_class,
PROP_DEPTH_START,
g_param_spec_int ("depth-start",
P_("Start Depth"),
P_("Initial depth to apply"),
G_MININT, G_MAXINT, 0,
CLUTTER_PARAM_READWRITE));
/**
* ClutterBehaviourDepth:depth-end:
*
* End depth level to apply to the actors.
*
* Since: 0.4
*
* Deprecated: 1.6
*/
g_object_class_install_property (gobject_class,
PROP_DEPTH_END,
g_param_spec_int ("depth-end",
P_("End Depth"),
P_("Final depth to apply"),
G_MININT, G_MAXINT, 0,
CLUTTER_PARAM_READWRITE));
}
static void
clutter_behaviour_depth_init (ClutterBehaviourDepth *depth)
{
depth->priv = clutter_behaviour_depth_get_instance_private (depth);
}
/**
* clutter_behaviour_depth_new:
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
* @depth_start: initial value of the depth
* @depth_end: final value of the depth
*
* Creates a new #ClutterBehaviourDepth which can be used to control
* the ClutterActor:depth property of a set of #ClutterActor<!-- -->s.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
* it can be set later with clutter_behaviour_set_alpha().
*
* Return value: (transfer full): the newly created behaviour
*
* Since: 0.4
*
* Deprecated: 1.6
*/
ClutterBehaviour *
clutter_behaviour_depth_new (ClutterAlpha *alpha,
gint depth_start,
gint depth_end)
{
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_DEPTH,
"alpha", alpha,
"depth-start", depth_start,
"depth-end", depth_end,
NULL);
}
/**
* clutter_behaviour_depth_set_bounds:
* @behaviour: a #ClutterBehaviourDepth
* @depth_start: initial value of the depth
* @depth_end: final value of the depth
*
* Sets the boundaries of the @behaviour.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
void
clutter_behaviour_depth_set_bounds (ClutterBehaviourDepth *behaviour,
gint depth_start,
gint depth_end)
{
ClutterBehaviourDepthPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_DEPTH (behaviour));
priv = behaviour->priv;
g_object_freeze_notify (G_OBJECT (behaviour));
if (priv->depth_start != depth_start)
{
priv->depth_start = depth_start;
g_object_notify (G_OBJECT (behaviour), "depth-start");
}
if (priv->depth_end != depth_end)
{
priv->depth_end = depth_end;
g_object_notify (G_OBJECT (behaviour), "depth-end");
}
g_object_thaw_notify (G_OBJECT (behaviour));
}
/**
* clutter_behaviour_depth_get_bounds:
* @behaviour: a #ClutterBehaviourDepth
* @depth_start: (out): return location for the initial depth value, or %NULL
* @depth_end: (out): return location for the final depth value, or %NULL
*
* Gets the boundaries of the @behaviour
*
* Since: 0.6
*
* Deprecated: 1.6
*/
void
clutter_behaviour_depth_get_bounds (ClutterBehaviourDepth *behaviour,
gint *depth_start,
gint *depth_end)
{
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_DEPTH (behaviour));
if (depth_start)
*depth_start = behaviour->priv->depth_start;
if (depth_end)
*depth_end = behaviour->priv->depth_end;
}

View File

@@ -1,101 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BEHAVIOUR_DEPTH__
#define __CLUTTER_BEHAVIOUR_DEPTH__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR_DEPTH (clutter_behaviour_depth_get_type ())
#define CLUTTER_BEHAVIOUR_DEPTH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BEHAVIOUR_DEPTH, ClutterBehaviourDepth))
#define CLUTTER_IS_BEHAVIOUR_DEPTH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BEHAVIOUR_DEPTH))
#define CLUTTER_BEHAVIOUR_DEPTH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BEHAVIOUR_DEPTH, ClutterBehaviourDepthClass))
#define CLUTTER_IS_BEHAVIOUR_DEPTH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BEHAVIOUR_DEPTH))
#define CLUTTER_BEHAVIOUR_DEPTH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BEHAVIOUR_DEPTH, ClutterBehaviourDepthClass))
typedef struct _ClutterBehaviourDepth ClutterBehaviourDepth;
typedef struct _ClutterBehaviourDepthPrivate ClutterBehaviourDepthPrivate;
typedef struct _ClutterBehaviourDepthClass ClutterBehaviourDepthClass;
/**
* ClutterBehaviourDepth:
*
* The #ClutterBehaviourDepth structure contains only private data
* and should be accessed using the provided API
*
* Since: 0.2
*
* Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:depth
* instead.
*/
struct _ClutterBehaviourDepth
{
/*< private >*/
ClutterBehaviour parent_instance;
ClutterBehaviourDepthPrivate *priv;
};
/**
* ClutterBehaviourDepthClass:
*
* The #ClutterBehaviourDepthClass structure contains only private data
*
* Since: 0.2
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourDepthClass
{
/*< private >*/
ClutterBehaviourClass parent_class;
};
CLUTTER_DEPRECATED
GType clutter_behaviour_depth_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_FOR(clutter_actor_animate and ClutterActor:depth)
ClutterBehaviour *clutter_behaviour_depth_new (ClutterAlpha *alpha,
gint depth_start,
gint depth_end);
CLUTTER_DEPRECATED
void clutter_behaviour_depth_set_bounds (ClutterBehaviourDepth *behaviour,
gint depth_start,
gint depth_end);
CLUTTER_DEPRECATED
void clutter_behaviour_depth_get_bounds (ClutterBehaviourDepth *behaviour,
gint *depth_start,
gint *depth_end);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_DEPTH__ */

View File

@@ -1,310 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-behaviour-opacity
* @Title: ClutterBehaviourOpacity
* @short_description: A behaviour controlling opacity
* @Deprecated: 1.6: Use clutter_actor_animate() instead.
*
* #ClutterBehaviourOpacity controls the opacity of a set of actors.
*
* Since: 0.2
*
* Deprecated: 1.6: Use the #ClutterActor:opacity property and
* clutter_actor_animate(), or #ClutterAnimator, or #ClutterState
* instead.
*/
#include "clutter-build-config.h"
#include <math.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-alpha.h"
#include "clutter-behaviour.h"
#include "clutter-behaviour-opacity.h"
#include "clutter-private.h"
#include "clutter-debug.h"
struct _ClutterBehaviourOpacityPrivate
{
guint8 opacity_start;
guint8 opacity_end;
};
enum
{
PROP_0,
PROP_OPACITY_START,
PROP_OPACITY_END,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourOpacity,
clutter_behaviour_opacity,
CLUTTER_TYPE_BEHAVIOUR)
static void
alpha_notify_foreach (ClutterBehaviour *behaviour,
ClutterActor *actor,
gpointer data)
{
clutter_actor_set_opacity (actor, GPOINTER_TO_UINT(data));
}
static void
clutter_behaviour_alpha_notify (ClutterBehaviour *behave,
gdouble alpha_value)
{
ClutterBehaviourOpacityPrivate *priv;
guint8 opacity;
priv = CLUTTER_BEHAVIOUR_OPACITY (behave)->priv;
opacity = alpha_value
* (priv->opacity_end - priv->opacity_start)
+ priv->opacity_start;
CLUTTER_NOTE (ANIMATION, "alpha: %.4f, opacity: %u",
alpha_value,
opacity);
clutter_behaviour_actors_foreach (behave,
alpha_notify_foreach,
GUINT_TO_POINTER ((guint) opacity));
}
static void
clutter_behaviour_opacity_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourOpacity *self = CLUTTER_BEHAVIOUR_OPACITY (gobject);
switch (prop_id)
{
case PROP_OPACITY_START:
clutter_behaviour_opacity_set_bounds (self,
g_value_get_uint (value),
self->priv->opacity_end);
break;
case PROP_OPACITY_END:
clutter_behaviour_opacity_set_bounds (self,
self->priv->opacity_start,
g_value_get_uint (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_opacity_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourOpacity *self = CLUTTER_BEHAVIOUR_OPACITY (gobject);
switch (prop_id)
{
case PROP_OPACITY_START:
g_value_set_uint (value, self->priv->opacity_start);
break;
case PROP_OPACITY_END:
g_value_set_uint (value, self->priv->opacity_end);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_opacity_class_init (ClutterBehaviourOpacityClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
GParamSpec *pspec;
gobject_class->set_property = clutter_behaviour_opacity_set_property;
gobject_class->get_property = clutter_behaviour_opacity_get_property;
/**
* ClutterBehaviourOpacity:opacity-start:
*
* Initial opacity level of the behaviour.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
pspec = g_param_spec_uint ("opacity-start",
P_("Opacity Start"),
P_("Initial opacity level"),
0, 255,
0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_OPACITY_START] = pspec;
g_object_class_install_property (gobject_class, PROP_OPACITY_START, pspec);
/**
* ClutterBehaviourOpacity:opacity-end:
*
* Final opacity level of the behaviour.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
pspec = g_param_spec_uint ("opacity-end",
P_("Opacity End"),
P_("Final opacity level"),
0, 255,
0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_OPACITY_END] = pspec;
g_object_class_install_property (gobject_class, PROP_OPACITY_END, pspec);
behave_class->alpha_notify = clutter_behaviour_alpha_notify;
}
static void
clutter_behaviour_opacity_init (ClutterBehaviourOpacity *self)
{
self->priv = clutter_behaviour_opacity_get_instance_private (self);
}
/**
* clutter_behaviour_opacity_new:
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
* @opacity_start: minimum level of opacity
* @opacity_end: maximum level of opacity
*
* Creates a new #ClutterBehaviourOpacity object, driven by @alpha
* which controls the opacity property of every actor, making it
* change in the interval between @opacity_start and @opacity_end.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
* it can be set later with clutter_behaviour_set_alpha().
*
* Return value: the newly created #ClutterBehaviourOpacity
*
* Since: 0.2
*
* Deprecated: 1.6
*/
ClutterBehaviour *
clutter_behaviour_opacity_new (ClutterAlpha *alpha,
guint8 opacity_start,
guint8 opacity_end)
{
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_OPACITY,
"alpha", alpha,
"opacity-start", opacity_start,
"opacity-end", opacity_end,
NULL);
}
/**
* clutter_behaviour_opacity_set_bounds:
* @behaviour: a #ClutterBehaviourOpacity
* @opacity_start: minimum level of opacity
* @opacity_end: maximum level of opacity
*
* Sets the initial and final levels of the opacity applied by @behaviour
* on each actor it controls.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
void
clutter_behaviour_opacity_set_bounds (ClutterBehaviourOpacity *behaviour,
guint8 opacity_start,
guint8 opacity_end)
{
ClutterBehaviourOpacityPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_OPACITY (behaviour));
priv = behaviour->priv;
g_object_freeze_notify (G_OBJECT (behaviour));
if (priv->opacity_start != opacity_start)
{
priv->opacity_start = opacity_start;
g_object_notify_by_pspec (G_OBJECT (behaviour), obj_props[PROP_OPACITY_START]);
}
if (priv->opacity_end != opacity_end)
{
priv->opacity_end = opacity_end;
g_object_notify_by_pspec (G_OBJECT (behaviour), obj_props[PROP_OPACITY_END]);
}
g_object_thaw_notify (G_OBJECT (behaviour));
}
/**
* clutter_behaviour_opacity_get_bounds:
* @behaviour: a #ClutterBehaviourOpacity
* @opacity_start: (out): return location for the minimum level of opacity, or %NULL
* @opacity_end: (out): return location for the maximum level of opacity, or %NULL
*
* Gets the initial and final levels of the opacity applied by @behaviour
* on each actor it controls.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
void
clutter_behaviour_opacity_get_bounds (ClutterBehaviourOpacity *behaviour,
guint8 *opacity_start,
guint8 *opacity_end)
{
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_OPACITY (behaviour));
if (opacity_start)
*opacity_start = behaviour->priv->opacity_start;
if (opacity_end)
*opacity_end = behaviour->priv->opacity_end;
}

View File

@@ -1,115 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BEHAVIOUR_OPACITY_H__
#define __CLUTTER_BEHAVIOUR_OPACITY_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR_OPACITY (clutter_behaviour_opacity_get_type ())
#define CLUTTER_BEHAVIOUR_OPACITY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacity))
#define CLUTTER_BEHAVIOUR_OPACITY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass))
#define CLUTTER_IS_BEHAVIOUR_OPACITY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY))
#define CLUTTER_IS_BEHAVIOUR_OPACITY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY))
#define CLUTTER_BEHAVIOUR_OPACITY_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_BEHAVIOUR_OPACITY, ClutterBehaviourOpacityClass))
typedef struct _ClutterBehaviourOpacity ClutterBehaviourOpacity;
typedef struct _ClutterBehaviourOpacityPrivate ClutterBehaviourOpacityPrivate;
typedef struct _ClutterBehaviourOpacityClass ClutterBehaviourOpacityClass;
/**
* ClutterBehaviourOpacity:
*
* The #ClutterBehaviourOpacity structure contains only private data and
* should be accessed using the provided API
*
* Since: 0.2
*
* Deprecated: 1.6: Use clutter_actor_animate() and #ClutterActor:opacity
* instead.
*/
struct _ClutterBehaviourOpacity
{
/*< private >*/
ClutterBehaviour parent;
ClutterBehaviourOpacityPrivate *priv;
};
/**
* ClutterBehaviourOpacityClass:
*
* The #ClutterBehaviourOpacityClass structure contains only private data
*
* Since: 0.2
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourOpacityClass
{
/*< private >*/
ClutterBehaviourClass parent_class;
};
CLUTTER_DEPRECATED
GType clutter_behaviour_opacity_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_FOR(clutter_actor_animate and ClutterActor:opacity)
ClutterBehaviour *clutter_behaviour_opacity_new (ClutterAlpha *alpha,
guint8 opacity_start,
guint8 opacity_end);
CLUTTER_DEPRECATED
void clutter_behaviour_opacity_set_bounds (ClutterBehaviourOpacity *behaviour,
guint8 opacity_start,
guint8 opacity_end);
CLUTTER_DEPRECATED
void clutter_behaviour_opacity_get_bounds (ClutterBehaviourOpacity *behaviour,
guint8 *opacity_start,
guint8 *opacity_end);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_OPACITY_H__ */

View File

@@ -1,437 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-behaviour-scale
* @Title: ClutterBehaviourScale
* @short_description: A behaviour controlling scale
* @Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:scale-x
* and #ClutterActor:scale-y instead.
*
* A #ClutterBehaviourScale interpolates actors size between two values.
*
* Deprecated: 1.6: Use the #ClutterActor:scale-x and #ClutterActor:scale-y
* properties, and clutter_actor_animate(), or #ClutterAnimator or
* #ClutterState instead.
*/
#include "clutter-build-config.h"
#include <math.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-actor.h"
#include "clutter-alpha.h"
#include "clutter-behaviour.h"
#include "clutter-behaviour-scale.h"
#include "clutter-debug.h"
#include "clutter-main.h"
#include "clutter-private.h"
struct _ClutterBehaviourScalePrivate
{
gdouble x_scale_start;
gdouble y_scale_start;
gdouble x_scale_end;
gdouble y_scale_end;
};
enum
{
PROP_0,
PROP_X_SCALE_START,
PROP_Y_SCALE_START,
PROP_X_SCALE_END,
PROP_Y_SCALE_END,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
G_DEFINE_TYPE_WITH_PRIVATE (ClutterBehaviourScale,
clutter_behaviour_scale,
CLUTTER_TYPE_BEHAVIOUR)
typedef struct {
gdouble scale_x;
gdouble scale_y;
} ScaleFrameClosure;
static void
scale_frame_foreach (ClutterBehaviour *behaviour,
ClutterActor *actor,
gpointer data)
{
ScaleFrameClosure *closure = data;
clutter_actor_set_scale (actor, closure->scale_x, closure->scale_y);
}
static void
clutter_behaviour_scale_alpha_notify (ClutterBehaviour *behave,
gdouble alpha_value)
{
ClutterBehaviourScalePrivate *priv;
ScaleFrameClosure closure = { 0, };
priv = CLUTTER_BEHAVIOUR_SCALE (behave)->priv;
/* Fix the start/end values, avoids potential rounding errors on large
* values.
*/
if (alpha_value == 1.0)
{
closure.scale_x = priv->x_scale_end;
closure.scale_y = priv->y_scale_end;
}
else if (alpha_value == 0)
{
closure.scale_x = priv->x_scale_start;
closure.scale_y = priv->y_scale_start;
}
else
{
closure.scale_x = (priv->x_scale_end - priv->x_scale_start)
* alpha_value
+ priv->x_scale_start;
closure.scale_y = (priv->y_scale_end - priv->y_scale_start)
* alpha_value
+ priv->y_scale_start;
}
clutter_behaviour_actors_foreach (behave,
scale_frame_foreach,
&closure);
}
static void
clutter_behaviour_scale_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourScalePrivate *priv;
priv = CLUTTER_BEHAVIOUR_SCALE (gobject)->priv;
switch (prop_id)
{
case PROP_X_SCALE_START:
priv->x_scale_start = g_value_get_double (value);
break;
case PROP_X_SCALE_END:
priv->x_scale_end = g_value_get_double (value);
break;
case PROP_Y_SCALE_START:
priv->y_scale_start = g_value_get_double (value);
break;
case PROP_Y_SCALE_END:
priv->y_scale_end = g_value_get_double (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_scale_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterBehaviourScalePrivate *priv;
priv = CLUTTER_BEHAVIOUR_SCALE (gobject)->priv;
switch (prop_id)
{
case PROP_X_SCALE_START:
g_value_set_double (value, priv->x_scale_start);
break;
case PROP_X_SCALE_END:
g_value_set_double (value, priv->x_scale_end);
break;
case PROP_Y_SCALE_START:
g_value_set_double (value, priv->y_scale_start);
break;
case PROP_Y_SCALE_END:
g_value_set_double (value, priv->y_scale_end);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterBehaviourClass *behave_class = CLUTTER_BEHAVIOUR_CLASS (klass);
GParamSpec *pspec = NULL;
gobject_class->set_property = clutter_behaviour_scale_set_property;
gobject_class->get_property = clutter_behaviour_scale_get_property;
/**
* ClutterBehaviourScale:x-scale-start:
*
* The initial scaling factor on the X axis for the actors.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
pspec = g_param_spec_double ("x-scale-start",
P_("X Start Scale"),
P_("Initial scale on the X axis"),
0.0, G_MAXDOUBLE,
1.0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_X_SCALE_START] = pspec;
g_object_class_install_property (gobject_class,
PROP_X_SCALE_START,
pspec);
/**
* ClutterBehaviourScale:x-scale-end:
*
* The final scaling factor on the X axis for the actors.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
pspec = g_param_spec_double ("x-scale-end",
P_("X End Scale"),
P_("Final scale on the X axis"),
0.0, G_MAXDOUBLE,
1.0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_X_SCALE_END] = pspec;
g_object_class_install_property (gobject_class,
PROP_X_SCALE_END,
pspec);
/**
* ClutterBehaviourScale:y-scale-start:
*
* The initial scaling factor on the Y axis for the actors.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
pspec = g_param_spec_double ("y-scale-start",
P_("Y Start Scale"),
P_("Initial scale on the Y axis"),
0.0, G_MAXDOUBLE,
1.0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_Y_SCALE_START] = pspec;
g_object_class_install_property (gobject_class,
PROP_Y_SCALE_START,
pspec);
/**
* ClutterBehaviourScale:y-scale-end:
*
* The final scaling factor on the Y axis for the actors.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
pspec = g_param_spec_double ("y-scale-end",
P_("Y End Scale"),
P_("Final scale on the Y axis"),
0.0, G_MAXDOUBLE,
1.0,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_Y_SCALE_END] = pspec;
g_object_class_install_property (gobject_class,
PROP_Y_SCALE_END,
pspec);
behave_class->alpha_notify = clutter_behaviour_scale_alpha_notify;
}
static void
clutter_behaviour_scale_init (ClutterBehaviourScale *self)
{
ClutterBehaviourScalePrivate *priv;
self->priv = priv = clutter_behaviour_scale_get_instance_private (self);
priv->x_scale_start = priv->x_scale_end = 1.0;
priv->y_scale_start = priv->y_scale_end = 1.0;
}
/**
* clutter_behaviour_scale_new:
* @alpha: (allow-none): a #ClutterAlpha instance, or %NULL
* @x_scale_start: initial scale factor on the X axis
* @y_scale_start: initial scale factor on the Y axis
* @x_scale_end: final scale factor on the X axis
* @y_scale_end: final scale factor on the Y axis
*
* Creates a new #ClutterBehaviourScale instance.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance. In the case when @alpha is %NULL,
* it can be set later with clutter_behaviour_set_alpha().
*
* Return value: (transfer full): the newly created #ClutterBehaviourScale
*
* Since: 0.2
*
* Deprecated: 1.6
*/
ClutterBehaviour *
clutter_behaviour_scale_new (ClutterAlpha *alpha,
gdouble x_scale_start,
gdouble y_scale_start,
gdouble x_scale_end,
gdouble y_scale_end)
{
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
return g_object_new (CLUTTER_TYPE_BEHAVIOUR_SCALE,
"alpha", alpha,
"x-scale-start", x_scale_start,
"y-scale-start", y_scale_start,
"x-scale-end", x_scale_end,
"y-scale-end", y_scale_end,
NULL);
}
/**
* clutter_behaviour_scale_set_bounds:
* @scale: a #ClutterBehaviourScale
* @x_scale_start: initial scale factor on the X axis
* @y_scale_start: initial scale factor on the Y axis
* @x_scale_end: final scale factor on the X axis
* @y_scale_end: final scale factor on the Y axis
*
* Sets the bounds used by scale behaviour.
*
* Since: 0.6
*
* Deprecated: 1.6
*/
void
clutter_behaviour_scale_set_bounds (ClutterBehaviourScale *scale,
gdouble x_scale_start,
gdouble y_scale_start,
gdouble x_scale_end,
gdouble y_scale_end)
{
ClutterBehaviourScalePrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale));
priv = scale->priv;
g_object_freeze_notify (G_OBJECT (scale));
if (priv->x_scale_start != x_scale_start)
{
priv->x_scale_start = x_scale_start;
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_X_SCALE_START]);
}
if (priv->y_scale_start != y_scale_start)
{
priv->y_scale_start = y_scale_start;
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_Y_SCALE_START]);
}
if (priv->x_scale_end != x_scale_end)
{
priv->x_scale_end = x_scale_end;
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_X_SCALE_END]);
}
if (priv->y_scale_end != y_scale_end)
{
priv->y_scale_end = y_scale_end;
g_object_notify_by_pspec (G_OBJECT (scale), obj_props[PROP_Y_SCALE_END]);
}
g_object_thaw_notify (G_OBJECT (scale));
}
/**
* clutter_behaviour_scale_get_bounds:
* @scale: a #ClutterBehaviourScale
* @x_scale_start: (out): return location for the initial scale factor on the X
* axis, or %NULL
* @y_scale_start: (out): return location for the initial scale factor on the Y
* axis, or %NULL
* @x_scale_end: (out): return location for the final scale factor on the X axis,
* or %NULL
* @y_scale_end: (out): return location for the final scale factor on the Y axis,
* or %NULL
*
* Retrieves the bounds used by scale behaviour.
*
* Since: 0.4
*
* Deprecated: 1.6
*/
void
clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
gdouble *x_scale_start,
gdouble *y_scale_start,
gdouble *x_scale_end,
gdouble *y_scale_end)
{
ClutterBehaviourScalePrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale));
priv = scale->priv;
if (x_scale_start)
*x_scale_start = priv->x_scale_start;
if (x_scale_end)
*x_scale_end = priv->x_scale_end;
if (y_scale_start)
*y_scale_start = priv->y_scale_start;
if (y_scale_end)
*y_scale_end = priv->y_scale_end;
}

View File

@@ -1,107 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BEHAVIOUR_SCALE_H__
#define __CLUTTER_BEHAVIOUR_SCALE_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR_SCALE (clutter_behaviour_scale_get_type ())
#define CLUTTER_BEHAVIOUR_SCALE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScale))
#define CLUTTER_BEHAVIOUR_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
#define CLUTTER_IS_BEHAVIOUR_SCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE))
#define CLUTTER_IS_BEHAVIOUR_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BEHAVIOUR_SCALE))
#define CLUTTER_BEHAVIOUR_SCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
typedef struct _ClutterBehaviourScale ClutterBehaviourScale;
typedef struct _ClutterBehaviourScalePrivate ClutterBehaviourScalePrivate;
typedef struct _ClutterBehaviourScaleClass ClutterBehaviourScaleClass;
/**
* ClutterBehaviourScale:
*
* The #ClutterBehaviourScale struct contains only private data and
* should be accessed using the provided API
*
* Since: 0.2
*
* Deprecated: 1.6: Use clutter_actor_animate() with #ClutterActor:scale-x
* and #ClutterActor:scale-y instead.
*/
struct _ClutterBehaviourScale
{
/*< private >*/
ClutterBehaviour parent_instance;
ClutterBehaviourScalePrivate *priv;
};
/**
* ClutterBehaviourScaleClass:
*
* The #ClutterBehaviourScaleClass struct contains only private data
*
* Since: 0.2
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourScaleClass
{
/*< private >*/
ClutterBehaviourClass parent_class;
};
CLUTTER_DEPRECATED
GType clutter_behaviour_scale_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED_FOR(clutter_actor_animate with ClutterActor:scale-x and ClutterActor:scale-y)
ClutterBehaviour *clutter_behaviour_scale_new (ClutterAlpha *alpha,
gdouble x_scale_start,
gdouble y_scale_start,
gdouble x_scale_end,
gdouble y_scale_end);
CLUTTER_DEPRECATED
void clutter_behaviour_scale_set_bounds (ClutterBehaviourScale *scale,
gdouble x_scale_start,
gdouble y_scale_start,
gdouble x_scale_end,
gdouble y_scale_end);
CLUTTER_DEPRECATED
void clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
gdouble *x_scale_start,
gdouble *y_scale_start,
gdouble *x_scale_end,
gdouble *y_scale_end);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_SCALE_H__ */

View File

@@ -1,657 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:clutter-behaviour
* @Title: ClutterBehaviour
* @short_description: Class for providing behaviours to actors
* @Deprecated: 1.6: Use clutter_actor_animate(), #ClutterAnimator or
* #ClutterState instead
*
* #ClutterBehaviour is the base class for implementing behaviours. A
* behaviour is a controller object for #ClutterActor<!-- -->s; you can
* use a behaviour to control one or more properties of an actor (such
* as its opacity, or its position). A #ClutterBehaviour is driven by
* an "alpha function" stored inside a #ClutterAlpha object; an alpha
* function is a function depending solely on time. The alpha function
* computes a value which is then applied to the properties of the
* actors driven by a behaviour.
*
* Clutter provides some pre-defined behaviours, like #ClutterBehaviourPath,
* which controls the position of a set of actors making them "walk" along
* a set of nodes; #ClutterBehaviourOpacity, which controls the opacity
* of a set of actors; #ClutterBehaviourScale, which controls the width
* and height of a set of actors.
*
* To visualize the effects of different alpha functions on a
* #ClutterBehaviour implementation it is possible to take the
* #ClutterBehaviourPath as an example:
*
* ![](path-alpha-func.png)
*
* The actors position between the path's end points directly correlates
* to the #ClutterAlpha's current alpha value driving the behaviour. With
* the #ClutterAlpha's function set to a linear ramp the actor
* will follow the path at a constant velocity, but when changing to
* a sine wave the actor initially accelerates before quickly
* decelerating.
*
* In order to implement a new behaviour you should subclass #ClutterBehaviour
* and override the "alpha_notify" virtual function; inside the overridden
* function you should obtain the alpha value from the #ClutterAlpha
* instance bound to the behaviour and apply it to the desiderd property
* (or properties) of every actor controlled by the behaviour.
*
* #ClutterBehaviour is available since Clutter 0.2.
*
* #ClutterBehaviour and its sub-classes have been discouraged sing Clutter
* 1.0, and formally deprecated since Clutter 1.6. You should use the
* [implicit animation][clutter-actor-animation] support inside #ClutterActor
* if you still have code using #ClutterBehaviour.
*/
#include "clutter-build-config.h"
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter-behaviour.h"
#include "clutter-alpha.h"
#include "clutter-debug.h"
#include "clutter-main.h"
#include "clutter-marshal.h"
#include "clutter-private.h"
#include "clutter-scriptable.h"
#include "clutter-script-private.h"
struct _ClutterBehaviourPrivate
{
ClutterAlpha *alpha;
guint notify_id;
GSList *actors;
};
enum
{
PROP_0,
PROP_ALPHA,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
enum
{
APPLIED,
REMOVED,
LAST_SIGNAL
};
static guint behave_signals[LAST_SIGNAL] = { 0 };
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ClutterBehaviour,
clutter_behaviour,
G_TYPE_OBJECT,
G_ADD_PRIVATE (ClutterBehaviour)
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
clutter_scriptable_iface_init))
static gboolean
clutter_behaviour_parse_custom_node (ClutterScriptable *scriptable,
ClutterScript *script,
GValue *value,
const gchar *name,
JsonNode *node)
{
if (strncmp (name, "alpha", 5) == 0)
{
GObject *alpha;
alpha = _clutter_script_parse_alpha (script, node);
if (alpha != NULL)
{
g_value_init (value, CLUTTER_TYPE_ALPHA);
g_value_set_object (value, alpha);
return TRUE;
}
}
return FALSE;
}
static void
clutter_scriptable_iface_init (ClutterScriptableIface *iface)
{
iface->parse_custom_node = clutter_behaviour_parse_custom_node;
}
static void
clutter_behaviour_dispose (GObject *gobject)
{
ClutterBehaviour *self = CLUTTER_BEHAVIOUR (gobject);
clutter_behaviour_set_alpha (self, NULL);
clutter_behaviour_remove_all (self);
G_OBJECT_CLASS (clutter_behaviour_parent_class)->dispose (gobject);
}
static void
clutter_behaviour_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterBehaviour *behaviour = CLUTTER_BEHAVIOUR (object);
switch (prop_id)
{
case PROP_ALPHA:
clutter_behaviour_set_alpha (behaviour, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterBehaviour *behaviour = CLUTTER_BEHAVIOUR (object);
ClutterBehaviourPrivate *priv = behaviour->priv;
switch (prop_id)
{
case PROP_ALPHA:
g_value_set_object (value, priv->alpha);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_behaviour_alpha_notify_unimplemented (ClutterBehaviour *behaviour,
gdouble alpha_value)
{
g_warning ("ClutterBehaviourClass::alpha_notify not implemented for '%s'",
g_type_name (G_TYPE_FROM_INSTANCE (behaviour)));
}
static void
clutter_behaviour_class_init (ClutterBehaviourClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = clutter_behaviour_dispose;
object_class->set_property = clutter_behaviour_set_property;
object_class->get_property = clutter_behaviour_get_property;
/**
* ClutterBehaviour:alpha:
*
* The #ClutterAlpha object used to drive this behaviour. A #ClutterAlpha
* object binds a #ClutterTimeline and a function which computes a value
* (the "alpha") depending on the time. Each time the alpha value changes
* the alpha-notify virtual function is called.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
obj_props[PROP_ALPHA] =
g_param_spec_object ("alpha",
P_("Alpha"),
P_("Alpha Object to drive the behaviour"),
CLUTTER_TYPE_ALPHA,
CLUTTER_PARAM_READWRITE);
g_object_class_install_properties (object_class,
PROP_LAST,
obj_props);
klass->alpha_notify = clutter_behaviour_alpha_notify_unimplemented;
/**
* ClutterBehaviour::applied:
* @behaviour: the #ClutterBehaviour that received the signal
* @actor: the actor the behaviour was applied to.
*
* The ::apply signal is emitted each time the behaviour is applied
* to an actor.
*
* Since: 0.4
*
* Deprecated: 1.6
*/
behave_signals[APPLIED] =
g_signal_new ("applied",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterBehaviourClass, applied),
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
/**
* ClutterBehaviour::removed:
* @behaviour: the #ClutterBehaviour that received the signal
* @actor: the removed actor
*
* The ::removed signal is emitted each time a behaviour is not applied
* to an actor anymore.
*
* Since: 0.4
*
* Deprecated: 1.6
*/
behave_signals[REMOVED] =
g_signal_new ("removed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterBehaviourClass, removed),
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
}
static void
clutter_behaviour_init (ClutterBehaviour *self)
{
self->priv = clutter_behaviour_get_instance_private (self);
}
static void
remove_actor_on_destroy (ClutterActor *actor,
ClutterBehaviour *behaviour)
{
clutter_behaviour_remove (behaviour, actor);
}
/**
* clutter_behaviour_apply:
* @behave: a #ClutterBehaviour
* @actor: a #ClutterActor
*
* Applies @behave to @actor. This function adds a reference on
* the actor.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
void
clutter_behaviour_apply (ClutterBehaviour *behave,
ClutterActor *actor)
{
ClutterBehaviourPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
priv = behave->priv;
if (g_slist_find (priv->actors, actor))
{
g_warning ("The behaviour of type %s already applies "
"to the actor of type %s",
g_type_name (G_OBJECT_TYPE (behave)),
g_type_name (G_OBJECT_TYPE (actor)));
return;
}
priv->actors = g_slist_append (priv->actors, g_object_ref (actor));
g_signal_connect (actor, "destroy",
G_CALLBACK (remove_actor_on_destroy),
behave);
g_signal_emit (behave, behave_signals[APPLIED], 0, actor);
}
/**
* clutter_behaviour_is_applied:
* @behave: a #ClutterBehaviour
* @actor: a #ClutterActor
*
* Check if @behave applied to @actor.
*
* Return value: TRUE if actor has behaviour. FALSE otherwise.
*
* Since: 0.4
*
* Deprecated: 1.6
*/
gboolean
clutter_behaviour_is_applied (ClutterBehaviour *behave,
ClutterActor *actor)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), FALSE);
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
return (g_slist_find (behave->priv->actors, actor) != NULL);
}
/**
* clutter_behaviour_remove:
* @behave: a #ClutterBehaviour
* @actor: a #ClutterActor
*
* Removes @actor from the list of #ClutterActor<!-- -->s to which
* @behave applies. This function removes a reference on the actor.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
void
clutter_behaviour_remove (ClutterBehaviour *behave,
ClutterActor *actor)
{
ClutterBehaviourPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
priv = behave->priv;
if (!g_slist_find (priv->actors, actor))
{
g_warning ("The behaviour of type %s is not applied "
"to the actor of type %s",
g_type_name (G_OBJECT_TYPE (behave)),
g_type_name (G_OBJECT_TYPE (actor)));
return;
}
g_signal_handlers_disconnect_by_func (actor,
G_CALLBACK (remove_actor_on_destroy),
behave);
priv->actors = g_slist_remove (priv->actors, actor);
g_signal_emit (behave, behave_signals[REMOVED], 0, actor);
g_object_unref (actor);
}
/**
* clutter_behaviour_get_n_actors:
* @behave: a #ClutterBehaviour
*
* Gets the number of actors this behaviour is applied too.
*
* Return value: The number of applied actors
*
* Since: 0.2
*
* Deprecated: 1.6
*/
gint
clutter_behaviour_get_n_actors (ClutterBehaviour *behave)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), 0);
return g_slist_length (behave->priv->actors);
}
/**
* clutter_behaviour_get_nth_actor:
* @behave: a #ClutterBehaviour
* @index_: the index of an actor this behaviour is applied too.
*
* Gets an actor the behaviour was applied to referenced by index num.
*
* Return value: (transfer none): A Clutter actor or NULL if @index_ is invalid.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
ClutterActor *
clutter_behaviour_get_nth_actor (ClutterBehaviour *behave,
gint index_)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), NULL);
return g_slist_nth_data (behave->priv->actors, index_);
}
/**
* clutter_behaviour_actors_foreach:
* @behave: a #ClutterBehaviour
* @func: (scope call): a function called for each actor
* @data: optional data to be passed to the function, or %NULL
*
* Calls @func for every actor driven by @behave.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
void
clutter_behaviour_actors_foreach (ClutterBehaviour *behave,
ClutterBehaviourForeachFunc func,
gpointer data)
{
GSList *l;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
g_return_if_fail (func != NULL);
for (l = behave->priv->actors; l != NULL; l = l->next)
{
ClutterActor *actor = l->data;
g_assert (CLUTTER_IS_ACTOR (actor));
func (behave, actor, data);
}
}
/**
* clutter_behaviour_get_alpha:
* @behave: a #ClutterBehaviour
*
* Retrieves the #ClutterAlpha object bound to @behave.
*
* Return value: (transfer none): a #ClutterAlpha object, or %NULL if no alpha
* object has been bound to this behaviour.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
ClutterAlpha *
clutter_behaviour_get_alpha (ClutterBehaviour *behave)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), NULL);
return behave->priv->alpha;
}
static void
notify_cb (GObject *object,
GParamSpec *param_spec,
ClutterBehaviour *behave)
{
ClutterBehaviourClass *klass;
klass = CLUTTER_BEHAVIOUR_GET_CLASS (behave);
CLUTTER_NOTE (ANIMATION, "notify::alpha");
/* no actors, we can stop right here */
if (behave->priv->actors == NULL)
return;
if (klass->alpha_notify != NULL)
{
gdouble alpha_value = clutter_alpha_get_alpha (behave->priv->alpha);
CLUTTER_NOTE (ANIMATION, "calling %s::alpha_notify (%p, %.4f)",
g_type_name (G_TYPE_FROM_CLASS (klass)),
behave, alpha_value);
klass->alpha_notify (behave, alpha_value);
}
}
/**
* clutter_behaviour_set_alpha:
* @behave: a #ClutterBehaviour
* @alpha: a #ClutterAlpha or %NULL to unset a previously set alpha
*
* Binds @alpha to a #ClutterBehaviour. The #ClutterAlpha object
* is what makes a behaviour work: for each tick of the timeline
* used by #ClutterAlpha a new value of the alpha parameter is
* computed by the alpha function; the value should be used by
* the #ClutterBehaviour to update one or more properties of the
* actors to which the behaviour applies.
*
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
void
clutter_behaviour_set_alpha (ClutterBehaviour *behave,
ClutterAlpha *alpha)
{
ClutterBehaviourPrivate *priv;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
g_return_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha));
priv = behave->priv;
if (priv->alpha == alpha)
return;
if (priv->notify_id)
{
CLUTTER_NOTE (ANIMATION, "removing previous notify-id (%d)",
priv->notify_id);
g_signal_handler_disconnect (priv->alpha, priv->notify_id);
priv->notify_id = 0;
}
if (priv->alpha != NULL)
{
CLUTTER_NOTE (ANIMATION, "removing previous alpha object");
g_object_unref (priv->alpha);
priv->alpha = NULL;
}
if (alpha != NULL)
{
priv->alpha = g_object_ref_sink (alpha);
priv->notify_id = g_signal_connect (priv->alpha, "notify::alpha",
G_CALLBACK(notify_cb),
behave);
CLUTTER_NOTE (ANIMATION, "setting new alpha object (%p, notify:%d)",
priv->alpha, priv->notify_id);
}
g_object_notify_by_pspec (G_OBJECT (behave), obj_props[PROP_ALPHA]);
}
/**
* clutter_behaviour_get_actors:
* @behave: a #ClutterBehaviour
*
* Retrieves all the actors to which @behave applies. It is not recommended
* for derived classes to use this in there alpha notify method but use
* #clutter_behaviour_actors_foreach as it avoids alot of needless allocations.
*
* Return value: (transfer container) (element-type Clutter.Actor): a list of
* actors. You should free the returned list with g_slist_free() when
* finished using it.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
GSList *
clutter_behaviour_get_actors (ClutterBehaviour *behave)
{
ClutterBehaviourPrivate *priv;
GSList *retval, *l;
g_return_val_if_fail (CLUTTER_BEHAVIOUR (behave), NULL);
priv = behave->priv;
retval = NULL;
for (l = priv->actors; l != NULL; l = l->next)
retval = g_slist_prepend (retval, l->data);
return g_slist_reverse (retval);
}
/**
* clutter_behaviour_remove_all:
* @behave: a #ClutterBehaviour
*
* Removes every actor from the list that @behave holds.
*
* Since: 0.4
*
* Deprecated: 1.6
*/
void
clutter_behaviour_remove_all (ClutterBehaviour *behave)
{
ClutterBehaviourPrivate *priv;
GSList *l;
g_return_if_fail (CLUTTER_IS_BEHAVIOUR (behave));
priv = behave->priv;
for (l = priv->actors; l != NULL; l = l->next)
{
ClutterActor *actor = l->data;
g_signal_emit (behave, behave_signals[REMOVED], 0, actor);
g_signal_handlers_disconnect_by_func (actor,
G_CALLBACK (remove_actor_on_destroy),
behave);
g_object_unref (actor);
}
g_slist_free (priv->actors);
priv->actors = NULL;
}

View File

@@ -1,170 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
* Jorn Baayen <jorn@openedhand.com>
* Emmanuele Bassi <ebassi@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#ifndef __CLUTTER_BEHAVIOUR_H__
#define __CLUTTER_BEHAVIOUR_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_BEHAVIOUR clutter_behaviour_get_type()
#define CLUTTER_BEHAVIOUR(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviour))
#define CLUTTER_BEHAVIOUR_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviourClass))
#define CLUTTER_IS_BEHAVIOUR(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_BEHAVIOUR))
#define CLUTTER_IS_BEHAVIOUR_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_BEHAVIOUR))
#define CLUTTER_BEHAVIOUR_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_TYPE_BEHAVIOUR, ClutterBehaviourClass))
typedef struct _ClutterBehaviourPrivate ClutterBehaviourPrivate;
typedef struct _ClutterBehaviourClass ClutterBehaviourClass;
/**
* ClutterBehaviourForeachFunc:
* @behaviour: the #ClutterBehaviour
* @actor: an actor driven by @behaviour
* @data: (closure): optional data passed to the function
*
* This function is passed to clutter_behaviour_actors_foreach() and
* will be called for each actor driven by @behaviour.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
typedef void (*ClutterBehaviourForeachFunc) (ClutterBehaviour *behaviour,
ClutterActor *actor,
gpointer data);
/**
* ClutterBehaviour:
*
* #ClutterBehaviour-struct contains only private data and should
* be accessed with the functions below.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
struct _ClutterBehaviour
{
/*< private >*/
GObject parent;
ClutterBehaviourPrivate *priv;
};
/**
* ClutterBehaviourClass:
* @alpha_notify: virtual function, called each time the #ClutterAlpha
* computes a new alpha value; the actors to which the behaviour applies
* should be changed in this function. Every subclass of #ClutterBehaviour
* must implement this virtual function
* @applied: signal class handler for the ClutterBehaviour::applied signal
* @removed: signal class handler for the ClutterBehaviour::removed signal
*
* Base class for behaviours.
*
* Since: 0.2
*
* Deprecated: 1.6
*/
struct _ClutterBehaviourClass
{
/*< private >*/
GObjectClass parent_class;
/*< public >*/
/* vfunc, not signal */
void (*alpha_notify) (ClutterBehaviour *behave,
gdouble alpha_value);
/* signals */
void (*applied) (ClutterBehaviour *behave,
ClutterActor *actor);
void (*removed) (ClutterBehaviour *behave,
ClutterActor *actor);
/*< private >*/
/* padding, for future expansion */
void (*_clutter_behaviour1) (void);
void (*_clutter_behaviour2) (void);
void (*_clutter_behaviour3) (void);
void (*_clutter_behaviour4) (void);
void (*_clutter_behaviour5) (void);
void (*_clutter_behaviour6) (void);
};
CLUTTER_DEPRECATED
GType clutter_behaviour_get_type (void) G_GNUC_CONST;
CLUTTER_DEPRECATED
void clutter_behaviour_apply (ClutterBehaviour *behave,
ClutterActor *actor);
CLUTTER_DEPRECATED
void clutter_behaviour_remove (ClutterBehaviour *behave,
ClutterActor *actor);
CLUTTER_DEPRECATED
void clutter_behaviour_remove_all (ClutterBehaviour *behave);
CLUTTER_DEPRECATED
void clutter_behaviour_actors_foreach (ClutterBehaviour *behave,
ClutterBehaviourForeachFunc func,
gpointer data);
CLUTTER_DEPRECATED
gint clutter_behaviour_get_n_actors (ClutterBehaviour *behave);
CLUTTER_DEPRECATED
ClutterActor *clutter_behaviour_get_nth_actor (ClutterBehaviour *behave,
gint index_);
CLUTTER_DEPRECATED
GSList * clutter_behaviour_get_actors (ClutterBehaviour *behave);
CLUTTER_DEPRECATED
ClutterAlpha *clutter_behaviour_get_alpha (ClutterBehaviour *behave);
CLUTTER_DEPRECATED
void clutter_behaviour_set_alpha (ClutterBehaviour *behave,
ClutterAlpha *alpha);
CLUTTER_DEPRECATED
gboolean clutter_behaviour_is_applied (ClutterBehaviour *behave,
ClutterActor *actor);
G_END_DECLS
#endif /* __CLUTTER_BEHAVIOUR_H__ */

View File

@@ -294,7 +294,7 @@ clutter_cairo_texture_context_destroy (void *data)
cogl_texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (cairo)); cogl_texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (cairo));
if (cairo_width == 0 || if (cairo_width == 0 ||
cairo_height == 0 || cairo_height == 0 ||
cogl_texture == COGL_INVALID_HANDLE) cogl_texture == NULL)
{ {
draw_context_destroy (ctxt); draw_context_destroy (ctxt);
return; return;
@@ -507,7 +507,7 @@ clutter_cairo_texture_create_surface (ClutterCairoTexture *self,
cairo_stride, cairo_stride,
cairo_data); cairo_data);
clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (self), cogl_texture); clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (self), cogl_texture);
cogl_handle_unref (cogl_texture); cogl_object_unref (cogl_texture);
return surface; return surface;
} }

View File

@@ -65,16 +65,6 @@ void clutter_container_remove_valist (ClutterContaine
CLUTTER_DEPRECATED_FOR(clutter_actor_get_children) CLUTTER_DEPRECATED_FOR(clutter_actor_get_children)
GList * clutter_container_get_children (ClutterContainer *container); GList * clutter_container_get_children (ClutterContainer *container);
CLUTTER_DEPRECATED
void clutter_container_foreach (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data);
CLUTTER_DEPRECATED
void clutter_container_foreach_with_internals (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data);
CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_above_sibling) CLUTTER_DEPRECATED_FOR(clutter_actor_set_child_above_sibling)
void clutter_container_raise_child (ClutterContainer *container, void clutter_container_raise_child (ClutterContainer *container,
ClutterActor *actor, ClutterActor *actor,

View File

@@ -170,20 +170,6 @@ clutter_group_real_actor_removed (ClutterContainer *container,
priv->children = g_list_remove (priv->children, actor); priv->children = g_list_remove (priv->children, actor);
} }
static void
clutter_group_real_foreach (ClutterContainer *container,
ClutterCallback callback,
gpointer user_data)
{
ClutterGroupPrivate *priv = CLUTTER_GROUP (container)->priv;
/* Using g_list_foreach instead of iterating the list manually
because it has better protection against the current node being
removed. This will happen for example if someone calls
clutter_container_foreach(container, clutter_actor_destroy) */
g_list_foreach (priv->children, (GFunc) callback, user_data);
}
static void static void
clutter_group_real_raise (ClutterContainer *container, clutter_group_real_raise (ClutterContainer *container,
ClutterActor *actor, ClutterActor *actor,
@@ -285,7 +271,6 @@ clutter_container_iface_init (ClutterContainerIface *iface)
iface->actor_added = clutter_group_real_actor_added; iface->actor_added = clutter_group_real_actor_added;
iface->remove = clutter_group_real_remove; iface->remove = clutter_group_real_remove;
iface->actor_removed = clutter_group_real_actor_removed; iface->actor_removed = clutter_group_real_actor_removed;
iface->foreach = clutter_group_real_foreach;
iface->raise = clutter_group_real_raise; iface->raise = clutter_group_real_raise;
iface->lower = clutter_group_real_lower; iface->lower = clutter_group_real_lower;
iface->sort_depth_order = clutter_group_real_sort_depth_order; iface->sort_depth_order = clutter_group_real_sort_depth_order;
@@ -306,15 +291,14 @@ clutter_group_real_paint (ClutterActor *actor)
} }
static void static void
clutter_group_real_pick (ClutterActor *actor, clutter_group_real_pick (ClutterActor *actor)
const ClutterColor *pick)
{ {
ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv; ClutterGroupPrivate *priv = CLUTTER_GROUP (actor)->priv;
/* Chain up so we get a bounding box pained (if we are reactive) */ /* Chain up so we get a bounding box pained (if we are reactive) */
CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor, pick); CLUTTER_ACTOR_CLASS (clutter_group_parent_class)->pick (actor);
g_list_foreach (priv->children, (GFunc) clutter_actor_paint, NULL); g_list_foreach (priv->children, (GFunc) clutter_actor_pick, NULL);
} }
static void static void
@@ -391,21 +375,28 @@ clutter_group_dispose (GObject *object)
} }
static void static void
clutter_group_real_show_all (ClutterActor *actor) clutter_group_real_show_all (ClutterActor *self)
{ {
clutter_container_foreach (CLUTTER_CONTAINER (actor), ClutterActorIter iter;
CLUTTER_CALLBACK (clutter_actor_show), ClutterActor *actor;
NULL);
clutter_actor_show (actor); clutter_actor_iter_init (&iter, self);
while (clutter_actor_iter_next (&iter, &actor))
clutter_actor_show (actor);
clutter_actor_show (self);
} }
static void static void
clutter_group_real_hide_all (ClutterActor *actor) clutter_group_real_hide_all (ClutterActor *actor)
{ {
ClutterActorIter iter;
clutter_actor_hide (actor); clutter_actor_hide (actor);
clutter_container_foreach (CLUTTER_CONTAINER (actor),
CLUTTER_CALLBACK (clutter_actor_hide), clutter_actor_iter_init (&iter, actor);
NULL); while (clutter_actor_iter_next (&iter, &actor))
clutter_actor_hide (actor);
} }
static gboolean static gboolean

View File

@@ -1,87 +0,0 @@
#include "clutter-build-config.h"
#include "clutter-layout-manager.h"
/**
* clutter_layout_manager_begin_animation:
* @manager: a #ClutterLayoutManager
* @duration: the duration of the animation, in milliseconds
* @mode: the easing mode of the animation
*
* Begins an animation of @duration milliseconds, using the provided
* easing @mode
*
* The easing mode can be specified either as a #ClutterAnimationMode
* or as a logical id returned by clutter_alpha_register_func()
*
* The result of this function depends on the @manager implementation
*
* Return value: (transfer none): The #ClutterAlpha created by the
* layout manager; the returned instance is owned by the layout
* manager and should not be unreferenced
*
* Since: 1.2
*
* Deprecated: 1.12
*/
ClutterAlpha *
clutter_layout_manager_begin_animation (ClutterLayoutManager *manager,
guint duration,
gulong mode)
{
ClutterLayoutManagerClass *klass;
g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), NULL);
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
return klass->begin_animation (manager, duration, mode);
}
/**
* clutter_layout_manager_end_animation:
* @manager: a #ClutterLayoutManager
*
* Ends an animation started by clutter_layout_manager_begin_animation()
*
* The result of this call depends on the @manager implementation
*
* Since: 1.2
*
* Deprecated: 1.12
*/
void
clutter_layout_manager_end_animation (ClutterLayoutManager *manager)
{
g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager)->end_animation (manager);
}
/**
* clutter_layout_manager_get_animation_progress:
* @manager: a #ClutterLayoutManager
*
* Retrieves the progress of the animation, if one has been started by
* clutter_layout_manager_begin_animation()
*
* The returned value has the same semantics of the #ClutterAlpha:alpha
* value
*
* Return value: the progress of the animation
*
* Since: 1.2
*
* Deprecated: 1.12
*/
gdouble
clutter_layout_manager_get_animation_progress (ClutterLayoutManager *manager)
{
ClutterLayoutManagerClass *klass;
g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), 1.0);
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
return klass->get_animation_progress (manager);
}

View File

@@ -84,7 +84,7 @@ clutter_rectangle_paint (ClutterActor *self)
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer (); CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
static CoglPipeline *default_color_pipeline = NULL; static CoglPipeline *default_color_pipeline = NULL;
CoglPipeline *content_pipeline; CoglPipeline *content_pipeline;
ClutterGeometry geom; ClutterActorBox alloc;
CoglColor color; CoglColor color;
guint8 tmp_alpha; guint8 tmp_alpha;
@@ -92,7 +92,7 @@ clutter_rectangle_paint (ClutterActor *self)
"painting rect '%s'", "painting rect '%s'",
clutter_actor_get_name (self) ? clutter_actor_get_name (self) clutter_actor_get_name (self) ? clutter_actor_get_name (self)
: "unknown"); : "unknown");
clutter_actor_get_allocation_geometry (self, &geom); clutter_actor_get_allocation_box (self, &alloc);
if (G_UNLIKELY (default_color_pipeline == NULL)) if (G_UNLIKELY (default_color_pipeline == NULL))
{ {
@@ -140,40 +140,41 @@ clutter_rectangle_paint (ClutterActor *self)
/* We paint the border and the content only if the rectangle /* We paint the border and the content only if the rectangle
* is big enough to show them * is big enough to show them
*/ */
if ((priv->border_width * 2) < geom.width && if ((priv->border_width * 2) < clutter_actor_box_get_width (&alloc) &&
(priv->border_width * 2) < geom.height) (priv->border_width * 2) < clutter_actor_box_get_height (&alloc))
{ {
/* paint the border. this sucks, but it's the only way to make a border */ /* paint the border. this sucks, but it's the only way to make a border */
cogl_framebuffer_draw_rectangle (framebuffer, cogl_framebuffer_draw_rectangle (framebuffer,
border_pipeline, border_pipeline,
priv->border_width, 0, priv->border_width, 0,
geom.width, clutter_actor_box_get_width (&alloc),
priv->border_width); priv->border_width);
cogl_framebuffer_draw_rectangle (framebuffer, cogl_framebuffer_draw_rectangle (framebuffer,
border_pipeline, border_pipeline,
geom.width - priv->border_width, clutter_actor_box_get_width (&alloc) - priv->border_width,
priv->border_width, priv->border_width,
geom.width, geom.height); clutter_actor_box_get_width (&alloc),
clutter_actor_box_get_height (&alloc));
cogl_framebuffer_draw_rectangle (framebuffer, cogl_framebuffer_draw_rectangle (framebuffer,
border_pipeline, border_pipeline,
0, geom.height - priv->border_width, 0, clutter_actor_box_get_height (&alloc) - priv->border_width,
geom.width - priv->border_width, clutter_actor_box_get_width (&alloc) - priv->border_width,
geom.height); clutter_actor_box_get_height (&alloc));
cogl_framebuffer_draw_rectangle (framebuffer, cogl_framebuffer_draw_rectangle (framebuffer,
border_pipeline, border_pipeline,
0, 0, 0, 0,
priv->border_width, priv->border_width,
geom.height - priv->border_width); clutter_actor_box_get_height (&alloc) - priv->border_width);
/* now paint the rectangle */ /* now paint the rectangle */
cogl_framebuffer_draw_rectangle (framebuffer, cogl_framebuffer_draw_rectangle (framebuffer,
content_pipeline, content_pipeline,
priv->border_width, priv->border_width, priv->border_width, priv->border_width,
geom.width - priv->border_width, clutter_actor_box_get_width (&alloc) - priv->border_width,
geom.height - priv->border_width); clutter_actor_box_get_height (&alloc) - priv->border_width);
} }
else else
{ {
@@ -183,7 +184,9 @@ clutter_rectangle_paint (ClutterActor *self)
*/ */
cogl_framebuffer_draw_rectangle (framebuffer, cogl_framebuffer_draw_rectangle (framebuffer,
border_pipeline, border_pipeline,
0, 0, geom.width, geom.height); 0, 0,
clutter_actor_box_get_width (&alloc),
clutter_actor_box_get_height (&alloc));
} }
cogl_object_unref (border_pipeline); cogl_object_unref (border_pipeline);
@@ -192,7 +195,9 @@ clutter_rectangle_paint (ClutterActor *self)
{ {
cogl_framebuffer_draw_rectangle (framebuffer, cogl_framebuffer_draw_rectangle (framebuffer,
content_pipeline, content_pipeline,
0, 0, geom.width, geom.height); 0, 0,
clutter_actor_box_get_width (&alloc),
clutter_actor_box_get_height (&alloc));
} }
cogl_object_unref (content_pipeline); cogl_object_unref (content_pipeline);

View File

@@ -74,20 +74,6 @@ gboolean clutter_stage_is_default (ClutterStage *stage);
CLUTTER_DEPRECATED_FOR(clutter_actor_queue_redraw) CLUTTER_DEPRECATED_FOR(clutter_actor_queue_redraw)
void clutter_stage_queue_redraw (ClutterStage *stage); void clutter_stage_queue_redraw (ClutterStage *stage);
CLUTTER_DEPRECATED
void clutter_stage_set_use_fog (ClutterStage *stage,
gboolean fog);
CLUTTER_DEPRECATED
gboolean clutter_stage_get_use_fog (ClutterStage *stage);
CLUTTER_DEPRECATED
void clutter_stage_set_fog (ClutterStage *stage,
ClutterFog *fog);
CLUTTER_DEPRECATED
void clutter_stage_get_fog (ClutterStage *stage,
ClutterFog *fog);
CLUTTER_DEPRECATED_FOR(clutter_actor_set_background_color) CLUTTER_DEPRECATED_FOR(clutter_actor_set_background_color)
void clutter_stage_set_color (ClutterStage *stage, void clutter_stage_set_color (ClutterStage *stage,

View File

@@ -438,7 +438,7 @@ set_viewport_with_buffer_under_fbo_source (ClutterActor *fbo_source,
* falling back to a stage sized fbo with an offset of (0,0) * falling back to a stage sized fbo with an offset of (0,0)
*/ */
ClutterVertex verts[4]; graphene_point3d_t verts[4];
float x_min = G_MAXFLOAT, y_min = G_MAXFLOAT; float x_min = G_MAXFLOAT, y_min = G_MAXFLOAT;
int i; int i;
@@ -1229,7 +1229,7 @@ clutter_texture_get_cogl_material (ClutterTexture *texture)
* Replaces the underlying Cogl material drawn by this actor with * Replaces the underlying Cogl material drawn by this actor with
* @cogl_material. A reference to the material is taken so if the * @cogl_material. A reference to the material is taken so if the
* handle is no longer needed it should be deref'd with * handle is no longer needed it should be deref'd with
* cogl_handle_unref. Texture data is attached to the material so * cogl_object_unref. Texture data is attached to the material so
* calling this function also replaces the Cogl * calling this function also replaces the Cogl
* texture. #ClutterTexture requires that the material have a texture * texture. #ClutterTexture requires that the material have a texture
* layer so you should set one on the material before calling this * layer so you should set one on the material before calling this
@@ -1302,7 +1302,7 @@ get_first_layer_index (CoglPipeline *pipeline, int *layer_index)
* *
* Retrieves the handle to the underlying COGL texture used for drawing * Retrieves the handle to the underlying COGL texture used for drawing
* the actor. No extra reference is taken so if you need to keep the * the actor. No extra reference is taken so if you need to keep the
* handle then you should call cogl_handle_ref() on it. * handle then you should call cogl_object_ref() on it.
* *
* The texture handle returned is the first layer of the material * The texture handle returned is the first layer of the material
* handle used by the #ClutterTexture. If you need to access the other * handle used by the #ClutterTexture. If you need to access the other
@@ -1342,7 +1342,7 @@ clutter_texture_get_cogl_texture (ClutterTexture *texture)
* *
* Replaces the underlying COGL texture drawn by this actor with * Replaces the underlying COGL texture drawn by this actor with
* @cogl_tex. A reference to the texture is taken so if the handle is * @cogl_tex. A reference to the texture is taken so if the handle is
* no longer needed it should be deref'd with cogl_handle_unref. * no longer needed it should be deref'd with cogl_object_unref.
* *
* Since: 0.8 * Since: 0.8
* *
@@ -1595,67 +1595,6 @@ clutter_texture_set_from_rgb_data (ClutterTexture *texture,
error); error);
} }
/**
* clutter_texture_set_from_yuv_data:
* @texture: A #ClutterTexture
* @data: (array): Image data in YUV type colorspace.
* @width: Width in pixels of image data.
* @height: Height in pixels of image data
* @flags: #ClutterTextureFlags
* @error: Return location for a #GError, or %NULL.
*
* Sets a #ClutterTexture from YUV image data. If an error occurred,
* %FALSE is returned and @error is set.
*
* The YUV support depends on the driver; the format supported by the
* few drivers exposing this capability are not really useful.
*
* The proper way to convert image data in any YUV colorspace to any
* RGB colorspace is to use a fragment shader associated with the
* #ClutterTexture material.
*
* Return value: %TRUE if the texture was successfully updated
*
* Since: 0.4
*
* Deprecated: 1.10: Use a custom #ClutterContent implementation and
* set up the Cogl pipeline using a #ClutterPipelineNode with a
* fragment shader instead.
*/
gboolean
clutter_texture_set_from_yuv_data (ClutterTexture *texture,
const guchar *data,
gint width,
gint height,
ClutterTextureFlags flags,
GError **error)
{
g_return_val_if_fail (CLUTTER_IS_TEXTURE (texture), FALSE);
if (!clutter_feature_available (CLUTTER_FEATURE_TEXTURE_YUV))
{
g_set_error (error, CLUTTER_TEXTURE_ERROR,
CLUTTER_TEXTURE_ERROR_NO_YUV,
"YUV textures are not supported");
return FALSE;
}
/* Convert the flags to a CoglPixelFormat */
if ((flags & CLUTTER_TEXTURE_YUV_FLAG_YUV2))
{
g_set_error (error, CLUTTER_TEXTURE_ERROR,
CLUTTER_TEXTURE_ERROR_BAD_FORMAT,
"YUV2 textures are not supported");
return FALSE;
}
return clutter_texture_set_from_data (texture, data,
COGL_PIXEL_FORMAT_YUV,
width, height,
width * 3, 3,
error);
}
/* /*
* clutter_texture_async_load_complete: * clutter_texture_async_load_complete:
* @self: a #ClutterTexture * @self: a #ClutterTexture

View File

@@ -123,14 +123,6 @@ gboolean clutter_texture_get_pick_with_alpha (ClutterTexture
CLUTTER_DEPRECATED_FOR(ClutterOffscreenEffect) CLUTTER_DEPRECATED_FOR(ClutterOffscreenEffect)
ClutterActor * clutter_texture_new_from_actor (ClutterActor *actor); ClutterActor * clutter_texture_new_from_actor (ClutterActor *actor);
CLUTTER_DEPRECATED
gboolean clutter_texture_set_from_yuv_data (ClutterTexture *texture,
const guchar *data,
gint width,
gint height,
ClutterTextureFlags flags,
GError **error);
G_END_DECLS G_END_DECLS
#endif /* __CLUTTER_TEXTURE_DEPRECATED_H__ */ #endif /* __CLUTTER_TEXTURE_DEPRECATED_H__ */

View File

@@ -127,6 +127,7 @@ clutter_sources = [
'clutter-flatten-effect.c', 'clutter-flatten-effect.c',
'clutter-flow-layout.c', 'clutter-flow-layout.c',
'clutter-gesture-action.c', 'clutter-gesture-action.c',
'clutter-graphene.c',
'clutter-grid-layout.c', 'clutter-grid-layout.c',
'clutter-image.c', 'clutter-image.c',
'clutter-input-device.c', 'clutter-input-device.c',
@@ -191,6 +192,7 @@ clutter_private_headers = [
'clutter-effect-private.h', 'clutter-effect-private.h',
'clutter-event-private.h', 'clutter-event-private.h',
'clutter-flatten-effect.h', 'clutter-flatten-effect.h',
'clutter-graphene.h',
'clutter-gesture-action-private.h', 'clutter-gesture-action-private.h',
'clutter-id-pool.h', 'clutter-id-pool.h',
'clutter-input-focus-private.h', 'clutter-input-focus-private.h',
@@ -220,10 +222,6 @@ clutter_deprecated_headers = [
'deprecated/clutter-alpha.h', 'deprecated/clutter-alpha.h',
'deprecated/clutter-animatable.h', 'deprecated/clutter-animatable.h',
'deprecated/clutter-animation.h', 'deprecated/clutter-animation.h',
'deprecated/clutter-behaviour.h',
'deprecated/clutter-behaviour-depth.h',
'deprecated/clutter-behaviour-opacity.h',
'deprecated/clutter-behaviour-scale.h',
'deprecated/clutter-bin-layout.h', 'deprecated/clutter-bin-layout.h',
'deprecated/clutter-box.h', 'deprecated/clutter-box.h',
'deprecated/clutter-cairo-texture.h', 'deprecated/clutter-cairo-texture.h',
@@ -240,17 +238,11 @@ clutter_deprecated_headers = [
] ]
clutter_deprecated_sources = [ clutter_deprecated_sources = [
'deprecated/clutter-actor-deprecated.c',
'deprecated/clutter-alpha.c', 'deprecated/clutter-alpha.c',
'deprecated/clutter-animation.c', 'deprecated/clutter-animation.c',
'deprecated/clutter-behaviour.c',
'deprecated/clutter-behaviour-depth.c',
'deprecated/clutter-behaviour-opacity.c',
'deprecated/clutter-behaviour-scale.c',
'deprecated/clutter-box.c', 'deprecated/clutter-box.c',
'deprecated/clutter-cairo-texture.c', 'deprecated/clutter-cairo-texture.c',
'deprecated/clutter-group.c', 'deprecated/clutter-group.c',
'deprecated/clutter-layout-manager-deprecated.c',
'deprecated/clutter-rectangle.c', 'deprecated/clutter-rectangle.c',
'deprecated/clutter-state.c', 'deprecated/clutter-state.c',
'deprecated/clutter-table-layout.c', 'deprecated/clutter-table-layout.c',
@@ -454,6 +446,7 @@ libmutter_clutter = shared_library(libmutter_clutter_name,
libmutter_clutter_dep = declare_dependency( libmutter_clutter_dep = declare_dependency(
sources: [clutter_enum_types[1]], sources: [clutter_enum_types[1]],
link_with: libmutter_clutter, link_with: libmutter_clutter,
dependencies: clutter_deps,
) )
if have_introspection if have_introspection

View File

@@ -276,6 +276,7 @@ emit_vertex_buffer_geometry (CoglFramebuffer *fb,
gboolean allocated = FALSE; gboolean allocated = FALSE;
CoglAttribute *attributes[2]; CoglAttribute *attributes[2];
CoglPrimitive *prim; CoglPrimitive *prim;
CoglIndices *indices;
int i; int i;
n_verts = node->d.texture.rectangles->len * 4; n_verts = node->d.texture.rectangles->len * 4;
@@ -354,22 +355,11 @@ emit_vertex_buffer_geometry (CoglFramebuffer *fb,
attributes, attributes,
2 /* n_attributes */); 2 /* n_attributes */);
#ifdef CLUTTER_COGL_HAS_GL indices =
if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUADS)) cogl_get_rectangle_indices (ctx, node->d.texture.rectangles->len);
cogl_primitive_set_mode (prim, GL_QUADS);
else
#endif
{
/* GLES doesn't support GL_QUADS so instead we use a VBO
with indexed vertices to generate GL_TRIANGLES from the
quads */
CoglIndices *indices = cogl_primitive_set_indices (prim, indices,
cogl_get_rectangle_indices (ctx, node->d.texture.rectangles->len); node->d.texture.rectangles->len * 6);
cogl_primitive_set_indices (prim, indices,
node->d.texture.rectangles->len * 6);
}
node->d.texture.primitive = prim; node->d.texture.primitive = prim;

Some files were not shown because too many files have changed in this diff Show More