Compare commits

...

1063 Commits

Author SHA1 Message Date
4947e8ae5b Bump version to 3.34.3
Update NEWS.
2020-01-05 12:37:05 +01:00
5724310899 clutter/stage: Fix picking of rectangles with negative positions
FLT_MIN is the smallest *positive* number above 0 that can be
represented as floating point number. If this is used to initialize the
maximum x/y coordinates of a rectangle, this will always be used if all
x/y coordinates of the rectangle are negative. This means that picking
at 0,0 will always be a hit for such rectangles.

Since mutter creates such a window for server side decorations on X11,
this window will always be picked at 0,0 preventing clicking/hovering
the activities button in gnome-shell at that coordinate.

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


(cherry picked from commit 674f52ba74)
2019-12-24 16:52:37 +00:00
9772f084bf screen-cast: Fix window recording on HiDPI
Using the same scale for the window as the
logical monitor only works correctly when having
the experimental 'scale-monitor-framebuffer'
feature enabled.
Without this experimental feature, the stream
will contain a black screen, where the actual
window only takes a small part of it.

Therefore, use a scale of 1 for the non-
experimental case.

Patch is based on commit 3fa6a92cc5.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/976


(cherry picked from commit e89cea8e5a)
2019-12-18 19:54:03 +00:00
8b087cfe56 Bump version to 3.34.2
Update NEWS.
2019-12-11 20:05:26 +01:00
c05328f76a Update British English translation 2019-12-11 10:25:27 +00:00
868a617907 backends/native: Fix double free of error
error is an autoptr, so must not be explicitly freed.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1852
Fixes: 5c500ad402 ("backend: Move GPU ownership from the monitor manager to the backend")

https://gitlab.gnome.org/GNOME/mutter/merge_requests/960


(cherry picked from commit d70ddc65ea)
2019-12-06 19:56:51 +00:00
6f02d2ead0 kms-impl/simple: Fix meta_set_fallback_feedback_idle
Presumably this function is supposed to be like
meta_kms_impl_simple_handle_page_flip_callback() but the condition in the
if-statement is inverted. Fix the inversion to make these two functions look
alike.

This is part 2 of 2 fixing a complete desktop freeze when drmModePageFlip()
fails with EINVAL and the fallback to drmModeSetCrtc() succeeds but the success
is not registered correctly as completed "flip". The freeze occurs under
wait_for_pending_flips() which calls down into meta_kms_impl_device_dispatch()
which ends up poll()'ing the DRM fd even though drmModeSetCrtc() will not
produce a DRM event, hence the poll() never returns. The freeze was observed
when hotplugging a DisplayLink dock for the first time on Ubuntu 19.10.

This patch makes meta_set_fallback_feedback_idle() actually end up calling into
notify_view_crtc_presented() which decrements
secondary_gpu_state->pending_flips so that wait_for_pending_flips() can finish.

CC stable: gnome-3-34

https://gitlab.gnome.org/GNOME/mutter/merge_requests/953
(cherry picked from commit 832a522cce)
2019-12-06 17:27:15 +01:00
fc77efbcd7 kms: Process impl idle callbacks before pre dispatch flush
mode_set_fallback() schedules a call to mode_set_fallback_feedback_idle(), but
it is possible for Mutter to repaint before the idle callbacks are dispatched.
If that happens, mode_set_fallback_feedback_idle() does not get called before
Mutter enters wait_for_pending_flips(), leading to a deadlock.

Add the needed interfaces so that meta_kms_device_dispatch_sync() can flush all
the implementation idle callbacks before it checks if any "events" are
available. This prevents the deadlock by ensuring
mode_set_fallback_feedback_idle() does get called before potentially waiting
for actual DRM events.

Presumably this call would not be needed if the implementation was running in
its own thread, since it would eventually dispatch its idle callbacks before
going to sleep polling on the DRM fd. This call might even be unnecessary
overhead in that case, synchronizing with the implementation thread needlessly.
But the thread does not exist yet, so this is needed for now.

This is part 1 of 2 fixing a complete desktop freeze when drmModePageFlip()
fails with EINVAL and the fallback to drmModeSetCrtc() succeeds but the success
is not registered correctly as completed "flip". The freeze occurs under
wait_for_pending_flips() which calls down into meta_kms_impl_device_dispatch()
which ends up poll()'ing the DRM fd even though drmModeSetCrtc() will not
produce a DRM event, hence the poll() never returns. The freeze was observed
when hotplugging a DisplayLink dock for the first time on Ubuntu 19.10.

CC stable: gnome-3-34

https://gitlab.gnome.org/GNOME/mutter/merge_requests/953
(cherry picked from commit 79491df2b8)
2019-12-06 17:27:14 +01:00
c0e76186da stack: Allow promoting transient windows to their parent's layer
When a window that should be stacked above another one is placed in a lower
layer than the other window, we currently allow promoting it to the higher
layer when it has a "transient type". We should do the same when the window
is an actual transient of the other window.

This is particularly relevant for wayland windows, where types play a
much smaller role: Transient windows like non-modal dialogs (and since
commit 666bef7a, popup windows as well) currently end up underneath their
always-on-top parent.

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


(cherry picked from commit 1c89fce30e)
2019-11-29 14:18:59 +00:00
1b75d78c72 shaped-texture: Do not invalidate content on set_cogl_texture()
This was wrongly introduced in 75cffd0ec4. As the comment above explains, we
only want to queue redraws in response to surface/buffer damage.

This triggered a full redraw when using DMA buffers on Wayland as we currently
create a new texture on every buffer_attach(), breaking partial invalidation.

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


(cherry picked from commit 0247d35e5a)
2019-11-26 22:43:54 +00:00
cbbffd1db7 cursor-tracker: Add API to keep the wayland pointer focus while hidden
Since commit a2a8f0cda we force the focus surface of the
meta-wayland-pointer to NULL while the pointer is invisible. This
introduced an issue with the a11y magnifier of the shell, which uses
`meta_cursor_tracker_set_pointer_visible` to hide the real cursor and
show its own magnified cursor at the correct position: Because the
meta-wayland-pointer is still used to communicate with Wayland clients,
the UI of the windows will not respond to mouse movement anymore as
soon as the real cursor is hidden.

Fix this issue for now by adding an additional method to the
cursor-tracker which allows disabling the behavior commit a2a8f0cda
introduced.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/832
2019-11-25 16:15:14 +01:00
06202c342b device-manager-x11: Ignore events if no source device is set
There might be some inconsistent event for which we don't have a known
source device.

In the current state we don't handle them and we could crash when getting
the current device tool.

So, add an utility function that retrieves the source device for an event
that warns if no device is found, and use this for Motion, Key and Button
events.

In case we don't have a valid source in such case, just return early instead
of trying to generate invalid clutter events.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/823


(cherry picked from commit 427670cc63)
2019-11-23 01:47:33 +00:00
9c372388da clutter/cally-root: Use g_clear_signal_handler and fix a signal leak
This commit was split out from `cleanup: Use g_clear_signal_handler()
where possible` as it fixes an actual signal leak and should therefore
get backported to stable releases.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/940
2019-11-21 16:22:14 +01:00
7e741fe2d2 wayland: Move "ownership" of the DnD selection source to the data device
On wl_data_source destruction we used to indirectly unset the DnD selection
owner via the wl_resource destructor triggering the destruction of the
MetaWaylandDataSource, which would be caught through the weak ref set by
the MetaWaylandDragGrab.

This works as long as the grab is held, however we have a window between
the button being released and the drop site replying with
wl_data_offer.finish that the MetaWaylandDataSource is alive, but its
destruction wouldn't result in the call chain above to unsetting the DnD
source.

In other selection sources, we let the MetaWaylandDataDevice hold the
"ownership" of the MetaWaylandDataSource, and its weak ref functions unset
the respective MetaSelection owners. Do the same here, so the
MetaWaylandDataSource destruction is listened for all its lifetime.

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

(cherry picked from commit e5af790acb)
2019-11-20 12:59:58 +01:00
edb618b2a4 wayland: Do not cancel data source on offer destruction
This is wrong for both clipboard and DnD, as the selection source
will still be able to focus another surface, and churn another
wl_offer.

We should just detach the data offer from the data source in this
case, and let the source live on. However, we should still check
that there is a source and an offer to finish DnD, do that when
handling the drop operation instead.

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

(cherry picked from commit 48639ac5da)
2019-11-20 12:59:40 +01:00
e2d6b33b61 wayland: Avoid redundant cancel() call
This is unnecessary as we are unsetting the DnD selection owner,
and will result in the related data source being cancelled already.

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

(cherry picked from commit e7b2f9603e)
2019-11-20 12:59:19 +01:00
eac37b17b0 wayland: Drop unused wl_signal structs
Those were used to signal clipboard ownership around, but that got
replaced by MetaSelection and friends. These signals are no longer
listened on, so can be safely removed.

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

(cherry picked from commit 46b3811e22)
2019-11-20 12:58:30 +01:00
d78585d68a 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


(cherry picked from commit 8907a29912)
2019-11-13 10:35:31 +00:00
c462544f78 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


(cherry picked from commit a5f986259f)
2019-11-13 10:35:04 +00:00
eb78b7d0d1 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.

(cherry-picked from 40e6aa7d94)

https://gitlab.gnome.org/GNOME/mutter/merge_requests/873
2019-11-12 13:37:30 +01:00
cc00e55513 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.

(cherry-picked from 668be1f4bd)

https://gitlab.gnome.org/GNOME/mutter/merge_requests/873
2019-11-12 13:37:30 +01:00
a14e7b441c 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 22:42:44 +01:00
403d8fcc66 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


(cherry picked from commit a4f51da184)
2019-11-08 22:44:34 +00:00
7e5366f233 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 19:19:45 -03:00
cf78598974 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 17:56:14 +01:00
7c1f3498fe 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


(cherry picked from commit bacbbbd628)
2019-11-07 16:21:37 +00:00
598be2b1d8 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


(cherry picked from commit c85fb107c0)
2019-11-07 16:21:09 +00:00
a8776a9634 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


(cherry picked from commit 13f10e36e4)
2019-11-07 16:19:25 +00:00
4b238c10f4 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


(cherry picked from commit 2644e54c51)
2019-11-07 16:18:55 +00:00
6fa860481c 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


(cherry picked from commit 0e5a5df5fe)
2019-11-07 13:51:43 +00:00
4ba3c4537e ci: Fix checking 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:14:41 +01:00
1f56514e40 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


(cherry picked from commit efe5bed5b4)
2019-11-06 17:48:19 +00:00
5e1bbb770e 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 08:56:26 -03:00
3df4348f23 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 08:56:25 -03:00
9ed33dc72e 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 08:56:23 -03:00
8cb0646b62 tests/runner: Move window shown synchronization to helper
https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 08:56:22 -03:00
c9a05d4581 tests/monitor-unit-tests: Move test client sanity check into helper
https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
2019-11-05 08:56:21 -03:00
98a1630fa2 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 08:56:20 -03:00
4c48c859ea 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 08:56:19 -03:00
d7bdaeeb82 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 08:56:17 -03:00
3564b0df4a 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 08:56:15 -03:00
34b5a07d58 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/917

(cherry picked from commit 551641c74822ca2e3c685e49603836ebf5397df2)
2019-11-04 11:08:02 +01:00
a112d7a10e 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/917

(cherry picked from commit 2b8b450fe16c21f0f37a1779560c0e5da61a9b89)
2019-11-04 11:08:02 +01:00
51f7e8c4dd 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-30 10:08:51 +01:00
f4574ea36f 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-30 10:08:39 +01:00
2301cde8f7 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-30 10:08:32 +01:00
ef2f5f07f0 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


(cherry picked from commit 71c3f4af31)
2019-10-24 15:52:41 +00:00
85f5db7e73 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


(cherry picked from commit 98892391d7)
2019-10-21 13:03:25 +00:00
c0037305eb 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-18 13:40:20 +02:00
ff885fea31 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


(cherry picked from commit 8665084df1)
2019-10-18 11:36:34 +00:00
bf17e04010 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


(cherry picked from commit 553211dd81)
2019-10-15 18:31:50 +00:00
a22731e2b2 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


(cherry picked from commit c2d03bf73e)
2019-10-15 10:42:55 +00:00
b6ed7d6781 dbus-session-watcher: Chain up to parent finalize()
https://gitlab.gnome.org/GNOME/mutter/merge_requests/847


(cherry picked from commit 3a688988e0)
2019-10-14 07:51:15 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
658c741420 Bump version to 3.34.1
Update NEWS.
2019-10-08 14:55:28 +02:00
65cc8c1ea2 Update Catalan translation 2019-10-08 07:35:51 +02:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
8d6d2d07dd Updated Danish translation 2019-10-03 23:41:50 +02:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
fc8aa1cdb1 Updated Danish translation 2019-10-02 05:54:14 +02:00
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
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
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
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
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
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
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
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
acfd03da30 Updated Slovenian translation 2019-09-26 21:31:44 +02:00
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
4bf0bd3f55 Update Dutch translation 2019-09-25 10:48:45 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
e16b75a0b7 Update Italian translation 2019-09-10 08:57:05 +00:00
8cdcf529e9 Bump version to 3.34.0
Update NEWS.
2019-09-09 20:09:35 +02:00
280167f217 Update Japanese translation 2019-09-09 11:03:10 +00:00
a72f3fdabb Update Japanese translation 2019-09-09 10:57:26 +00:00
dd6227e3bf Update Turkish translation 2019-09-07 20:09:26 +00:00
1271ce1cab Update Turkish translation 2019-09-07 14:06:24 +00:00
998114791f Update Italian translation 2019-09-06 08:45:55 +00:00
8a73324a0f Update French translation 2019-09-06 06:24:54 +00:00
9065edfc95 Update German translation (Launchpad bug 1786977) 2019-09-05 23:43:10 +02:00
5111e33948 monitor-manager/kms: Get hotplug events from MetaKms
This makes it clearer that MetaMonitorManagerKms keeps updated as
MetaKms updates its state.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/743
2019-09-05 08:03:36 +00:00
4cf828323d kms/impl-device: Add and remove connectors on hot plug
Connectors may disappear and appear on hot plugs, e.g. when a docking
station is connected, so when processing a hot plug event, make sure we
remove connectors that are now gone, and add new ones that have appeared
since last time.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/743
2019-09-05 08:03:36 +00:00
35776c5d29 kms: Add assert to check that the main thread is blocked on impl task
This is so that we can have code in impl tasks that pokes at the main
context objects.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/743
2019-09-05 08:03:36 +00:00
2f27b8d5fa window-actor: Handle changing surface actor on window reparenting
The commit f2f4af0d50 missed one situation
where mutter does things differently, i.e. changes what surface actor is
associated with a given window actor: reparenting a Xwayland window when
changing whether it is decorated.

To summarize, there are three types of window actors:

X11 window actors - directly tied to the backing X11 window. The
corresponding surface actor is directly owned by the window actor and
will never change.

Wayland window actors - gets its surface actor from MetaWaylandSurface
at construction. A single MetaWaylandSurface may create and destroy
multiple window actors over time, but a single window actor will never
change surface actor.

Xwayland window actors - a mix between the above two types; the window
corresponds to the X11 window, and so does the window actor, but the
surface itself comes from the MetaWaylandSurface.

Normally when a X11 window is unmapped, the corresponding MetaWindow is
unmanaged. With Xwayland, this happens indirectly via the destruction of
the wl_surface. The exception to this is windows that are reparented
during changing their decoration state - in this case on plain X11, the
MetaWindow stays alive. With Xwayland however, there is a race
condition; since the MetaWindow is tied to the wl_surface, if we receive
the new surface ID atom before the destruction of the old wl_surface,
we'll try to associate the existing MetaWindow and MetaWindowActor with
the new wl_surface, hitting the assert. If the surface destruction
arrives first, the MetaWindow and MetaWindowActor will be disposed, and
the we wouldn't hit the assert.

To handle this race gracefully, reinstate handling of replacing the
surface actor of an existing window actor, to handle this race, as it
was handled before.

Eventually, it should be reconsidered whether the MetaWindow lifetime is
tied to the wl_surface or if it should be changed to be consistent with
plain X11, as this re-exposes another bug where the X11 client and
mutter will enter a feedback loop where the window is repeatedly
remapped. See https://gitlab.freedesktop.org/xorg/xserver/issues/740.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/773
2019-09-05 07:43:40 +00:00
be4131b3c4 wayland/xdg-output: Fix xdg-output v3 support
When using xdg-output v3 or later, the Wayland compositor does not send
xdg_output.done events which are deprecated.

Instead, it should send a wl_output.done event for the matching
wl_output.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/771
2019-09-05 07:29:10 +00:00
854feafa83 Update Korean translation 2019-09-05 06:35:18 +00:00
f423736a70 Update Brazilian Portuguese translation 2019-09-05 05:34:42 +00:00
fdbac25e0d Bump version to 3.33.92
Update NEWS.
2019-09-04 20:49:07 +02:00
bcfac0d6dc Updated Czech translation 2019-09-03 22:35:50 +02:00
682d43b5ab Update Croatian translation 2019-09-03 16:01:12 +00:00
cd273e82ad Update Friulian translation 2019-09-03 07:53:58 +00:00
3c0067dc69 x11: Trace XEvent processing
https://gitlab.gnome.org/GNOME/mutter/merge_requests/765
2019-09-02 17:36:00 +00:00
a957c2f0c2 wayland: Trace wl_surface.commit
https://gitlab.gnome.org/GNOME/mutter/merge_requests/765
2019-09-02 17:36:00 +00:00
908203c735 core: Trace various window management actions
https://gitlab.gnome.org/GNOME/mutter/merge_requests/765
2019-09-02 17:36:00 +00:00
2f072af02b clutter/input-pointer-a11y: Restore pointer a11y on resume
When suspending, the devices are removed and the virtual device
associated with the corresponding core pointer is disposed.

Add the pointer accessibility virtual device to the core pointer
on resume to restore pointer accessibility on resume if enabled.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/761
2019-09-02 17:27:17 +00:00
de98fb29da wayland/data-device: Restore keyboard focus on drag end
When starting a DnD operation, mutter would remove keyboard focus from
the client, only to restore it on the data offer destroy.

However, if the DnD fail, the keyboard focus is not restored, leaving
the user unable to type in the focused window, even after clicking in
the window.

That issue would show only on first attempt, as further DnD attempts
would destroy the previous data offer which would also restore the
keyboard focus.

Make sure we restore the keyboard focus on drag end as well.

https://gitlab.gnome.org/GNOME/mutter/issues/747
2019-09-02 17:06:06 +00:00
82c92177ff wayland/data-device: Do not unset focus on drag start
On drag start, `data_device_start_drag()` issues a keyboard grab, which
in turn will unset the current input focus.

There is not need to unset the input focus in `data_device_start_drag()`
as this is redone in `meta_wayland_keyboard_start_grab()`

https://gitlab.gnome.org/GNOME/mutter/issues/747
2019-09-02 17:06:06 +00:00
14c706e51b clutter: Introduce geometric picking
Currently, Clutter does picking by drawing with Cogl and reading
the pixel that's beneath the given point. Since Cogl has a journal
that records drawing operations, and has optimizations to read a
single pixel from a list of rectangle, it would be expected that
we would hit this fast path and not flush the journal while picking.

However, that's not the case: dithering, clipping with scissors, etc,
can all flush the journal, issuing commands to the GPU and making
picking slow. On NVidia-based systems, this glReadPixels() call is
extremely costly.

Introduce geometric picking, and avoid using the Cogl journal entirely.
Do this by introducing a stack of actors in ClutterStage. This stack
is cached, but for now, don't use the cache as much as possible.

The picking routines are still tied to painting.

When projecting the actor vertexes, do it manually and take the modelview
matrix of the framebuffer into account as well.

CPU usage on an Intel i7-7700, tested with two different GPUs/drivers:

  |         |     Intel | Nvidia |
  | ------: | --------: | -----: |
  | Moving the mouse:            |
  | Before  |       10% |    10% |
  | After   |        6% |     6% |
  | Moving a window:             |
  | Before  |       23% |    81% |
  | After   |       19% |    40% |

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/154,
        https://gitlab.gnome.org/GNOME/mutter/issues/691

Helps significantly with: https://gitlab.gnome.org/GNOME/mutter/issues/283,
                          https://gitlab.gnome.org/GNOME/mutter/issues/590,
                          https://gitlab.gnome.org/GNOME/mutter/issues/700

v2: Fix code style issues
    Simplify quadrilateral checks
    Remove the 0.5f hack
    Differentiate axis-aligned rectangles

https://gitlab.gnome.org/GNOME/mutter/merge_requests/189
2019-09-02 16:41:13 +00:00
a70823dd1c clutter/point: Add ClutterPoint quarilateral testing API
Add a function to check whether a point is inside a quadrilateral
by checking the cross product of vectors with the quadrilateral
points, and the point being checked.

If the passed quadrilateral is zero-sized, no point is ever reported
to be inside it.

This will be used by the next commit when comparing the transformed
actor vertices.

[feaneron: add a commit message and remove unecessary code]

https://gitlab.gnome.org/GNOME/mutter/merge_requests/189
2019-09-02 16:41:13 +00:00
fdda8adfcf x11: Add window test before accessing reparents_pending field
https://gitlab.gnome.org/GNOME/mutter/merge_requests/768
2019-09-02 18:27:37 +02:00
8f242f8bf0 core: Fix multiple reparent requests handling
If window decoration is modified within a short period of time, mutter
sometimes starts processing the second request before the first
UnmapNotify event has been received. In this situation, it considers
that the window is not mapped and does not expect another UnmapNotify /
MapNotify event sequence to happen.

This adds a separate counter to keep track of the pending reparents. The
input focus is then restored when MapNotify event is received iff all
the expected pending ReparentNotify events have been received.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>

https://gitlab.gnome.org/GNOME/mutter/merge_requests/657
2019-09-02 15:50:37 +00:00
36a14e65c2 build: Raise libXi minimum dependency for required deadlock fixes
Older than 1.7.4 have deadlock bugs, see
https://bugzilla.gnome.org/show_bug.cgi?id=738944
2019-09-02 15:26:29 +00:00
6ed5d2e2b4 cogl: Remove GLX "threaded swap wait" used on Nvidia
Threaded swap wait was added for using together with the Nvidia GLX
driver due to the lack of anything equivalent to the INTEL_swap_event
GLX extension. The purpose was to avoid inhibiting the invocation of
idle callbacks when constantly rendering, as the combination of
throttling on swap-interval 1 and glxSwapBuffers() and the frame clock
source having higher priority than the default idle callback sources
meant they would never be invoked.

This was solved in gbz#779039 by introducing a thread that took care of
the vsync waiting, pushing frame completion events to the main thread
meaning the main thread could go idle while waiting to draw the next
frame instead of blocking on glxSwapBuffers().

As of https://gitlab.gnome.org/GNOME/mutter/merge_requests/363, the
main thread will instead use prediction to estimate when the next frame
should be drawn. A side effect of this is that even without
INTEL_swap_event, we would not block as much, or at all, on
glxSwapBuffers(), as at the time it is called, we have likely already
hit the vblank, or will hit it soon.

After having introduced the swap waiting thread, it was observed that
the Nvidia driver used a considerable amount of CPU waiting for the
vblank, effectively wasting CPU time. The need to call glFinish() was
also problematic as it would wait for the frame to finish, before
continuing. Due to this, remove the threaded swap wait, and rely only on
the frame clock not scheduling frames too early.

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=781835
Related: https://gitlab.gnome.org/GNOME/mutter/issues/700

[jadahl: Rewrote commit message]

https://gitlab.gnome.org/GNOME/mutter/merge_requests/602
2019-09-02 18:12:10 +08:00
d4eb222644 later: Add tracing
https://gitlab.gnome.org/GNOME/mutter/merge_requests/757
2019-08-31 12:22:39 +00:00
a14fd1b955 compositor: Trace pre/post paint functions
https://gitlab.gnome.org/GNOME/mutter/merge_requests/757
2019-08-31 12:22:39 +00:00
ab1107973b backends/native: Add various cogl traces
Trace the time spent finishing a frame, posting KMS updates and some
other things.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/757
2019-08-31 12:22:39 +00:00
4ab483d991 Update German translation 2019-08-29 22:02:29 +00:00
dabf72f3c0 Updated Vietnamese translation
Signed-off-by: Trần Ngọc Quân <vnwildman@gmail.com>
2019-08-28 14:07:16 +07:00
907a1f5e48 Update Swedish translation 2019-08-27 18:41:44 +00:00
97140ab634 Revert "clutter/stage-cogl: Remove pending_swaps counter"
This reverts commit f57ce7254d.

It causes crashes, https://gitlab.gnome.org/GNOME/mutter/issues/735, and
changes various expectations relied upon by the renderer code, and being
close to release, it's safer to revert now and reconsider how to remove
the pending swap counter at a later point.
2019-08-27 20:16:01 +03:00
dc9c5417bc main: Add test initialization function
Since Clutter's backend relies on MetaBackend now, initialzation has
to go through meta_init(), both in mutter and in gnome-shell.

However the compositor enum and backend gtype used to enforce the
environment used for tests are private, so instead expose a test
initialization function that can be used from both mutter and
gnome-shell.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/750
2019-08-27 16:34:01 +00:00
556e7694de iconcache: Avoid xrender picture formats when creating cairo surface
If an application provides its window icon via wmhints, then mutter
loads the pixmap specified by the application into a cairo xlib surface. When
creating the surface it specifies the visual, indirectly, via an XRender
picture format.

This is suboptimal, since XRender picture formats don't have a way to specify
16bpp depth, which an application may be using.

In particular, applications are likely to use 16bpp depth pixmaps for their
icons, if the video card offers a 16bpp framebuffer/root window.

This commit drops the XRender middleman, and just tells cairo a visual to use
directly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/715
2019-08-27 18:47:41 +03:00
1a5cba5df5 Revert "iconcache: Support 16bit icons"
This reverts commit b95d7e8276.

It's poisoning cairo's GC cache with a GC that has the wrong
colordepth, leading to a crash in unrelated code later on.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/715
2019-08-27 18:47:41 +03:00
cd0990c581 window-actor: Use new get_image() API to screen casting window content
This fixes screen casting of windows consisting of multiple surfaces to
work.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/752
2019-08-27 15:31:25 +00:00
96e831dd8a window-actor: Add API to get a cairo surface of the window
This currently uses a hack where it pushes a CoglFramebuffer backed by a
texture to the framebuffer stack, then calls clutter_actor_paint() on
the window actor causing it to render into the framebuffer. This has the
effect that all subsurfaces of a window will be drawn as part of the
window.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/752
2019-08-27 15:31:25 +00:00
65fde269c6 screen-cast/window: Use window actor damaged signal instead of paint
We are really more interested in when a window is damaged, rather than
when it's painted, for screen casting windows. This also has the benefit
of not listening on the "paint" signal of the actor, meaning it'll open
doors for hacks currently necessary for taking a screenshot of a window
consisting of multiple surfaces.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/752
2019-08-27 15:31:25 +00:00
ad138210b3 window-actor: Add 'damaged' signal
Make it possible to listen for damage on a window actor. For X11, the
signal is emitted when damage is reported; for Wayland, it is emitted
when any of the surfaces associated with the window is damaged.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/752
2019-08-27 15:31:25 +00:00
6968f17f3f Revert "main: Add test initialization function"
This reverts commit 7e69d1400a.
2019-08-27 15:32:54 +03:00
7e69d1400a main: Add test initialization function
Since Clutter's backend relies on MetaBackend now, initialzation has
to go through meta_init(), both in mutter and in gnome-shell.

However the compositor enum and backend gtype used to enforce the
environment used for tests are private, so instead expose a test
initialization function that can be used from both mutter and
gnome-shell.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/750
2019-08-27 15:29:55 +03:00
ccefa87351 build: Add postinstall script
... to compile schemas and update the desktop database when installing
from source rather than building a distribution package.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/756
2019-08-27 09:57:54 +00:00
a3c97ee535 surface-actor-wayland: Handle stex being disposed
As the MetaShapedTexture might already got finalized, this can lead to a crash.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/755
2019-08-27 08:55:51 +00:00
77229f99b8 wayland: Implement subsurface.place_below() for parents
Flatten the subsurface actor tree, making all surface actors children
of the window actor.
Save the subsurface state in a GNode tree in MetaWaylandSurface, where
each surface holds two nodes, one branch, which can be the tree root
or be attached to a parent surfaces branch, and a leaf, which is
used to save the position relative to child branch nodes.

Each time a surface is added or reordered in the tree, unparent all
surface actors from the window actor, traverse all leaves of the
tree and readd the corresponding surface actors back to the window
actor.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/664
2019-08-27 11:31:00 +03:00
a51437ee2b clutter/input-pointer-a11y: Include success boolean in stop signals
Add a boolean parameter to the signal to inform the handler whether the
timeout completed successfully or not. This allows the shell to
gracefully end the pie timer animation and show a success animation when
the click happens.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/745
2019-08-27 07:36:57 +00:00
78232fa3eb core: Check X11 display availability before use in MetaStackTracker
This object can be generally triggered without a X11 display, so make sure
this is alright. For guard window checks, use our internal
meta_stack_tracker_is_guard_window() call, which is already no-x11 aware.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/730
2019-08-26 17:39:10 +00:00
433e1b388d core: Move Stack to StackTracker synchronization back to stack.c
We indirectly were relying on the MetaX11Stack for this. We strictly
need the _NET_CLIENT_LIST* property updates there, so move our own
internal synchronization to common code.

Fixes stacking changes of windows while there's no MetaX11Display.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/730
2019-08-26 17:39:10 +00:00
9b7d918537 surface-actor: Unref shaped texture on dispose
The MetaShapedTexture created by MetaSurfaceActor used to
be a ClutterActor, which means destruction was taken care
by Clutter.

Now that it's a plain GObject, we need to manually clean it
up.

Cleanup the shaped texture on disposal.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/753
2019-08-26 20:14:00 +03:00
4c59eb0910 Update Catalan translation 2019-08-26 15:24:11 +02:00
5cfea4fee3 wayland/dnd-surface: Apply surface offset
The surface offset allows an application to move itself in relative
coordinates to its previous position. It is rather ill defined and
partly incompatible with other functionality, which is why we ignore
it generally.

For dnd-surfaces though, it is the de-facto standard for applications
to properly position the dnd-icon below the cursor. Therefore apply
the offset on actor sync by setting the feedback actor anchor.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/684
2019-08-26 11:57:49 +00:00
7275cf60bd wayland/feedback-actor: Use float for position and anchor
To be correct with fractional scaling. Furthermore, we currently
use it only with ClutterPoint values, which are floats already.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/684
2019-08-26 11:57:49 +00:00
acbefa5263 wayland: pointer-confinement: Listen to "geometry-changed" on the surface, not the actor
Commit b12c92e206 ("wayland: Add MetaWaylandSurface::geometry-changed signal")
Added a "geometry-changed" signal on MetaWaylandSurface, but the matching
changes to src/wayland/meta-pointer-confinement-wayland.c made it listen
for geometry-changed on the surface-actor instead of on the surface itself,
leading to errors like these:

gnome-shell[37805]: ../gobject/gsignal.c:2429: signal 'geometry-changed' is invalid for instance '0x5653aa7cfe50' of type 'MetaSurfaceActorWayland'

This commit fixes this.

Fixes: b12c92e206 ("wayland: Add MetaWaylandSurface::geometry-changed signal")

https://gitlab.gnome.org/GNOME/mutter/merge_requests/751
2019-08-26 13:24:58 +02:00
2b64861ee1 Update Galician translation 2019-08-25 16:07:57 +00:00
ea90b803fa Update Hungarian translation 2019-08-24 20:57:04 +00:00
56e8aab280 Updated Slovenian translation 2019-08-24 20:08:57 +02:00
1b58341e50 Update Latvian translation 2019-08-24 16:56:37 +00:00
634c31d7cb backends: Don’t translate GLib properties
https://gitlab.gnome.org/GNOME/mutter/merge_requests/749
2019-08-24 17:10:32 +02:00
b8dcd5f842 clutter/main: Ignore synthetic events for accessibility
When a dwell click causes the pointer to move to another surface, a
synthetic event is generated which triggers another dwell click.

Make sure we ignore those to avoid dwell clicking twice in a raw.

Suggested-by: Carlos Garnacho <carlosg@gnome.org>
https://gitlab.gnome.org/GNOME/mutter/merge_requests/747
2019-08-24 12:43:20 +03:00
14e02635ff clutter/input-pointer-a11y: Trigger dwell detection in a timeout
Restarting the dwell click immediately would result in a contant
animation showing.

Start dwell detection in its own timeout handler, which has the nice
effect of not constantly showing a dwell animation and also making sure
that the dwell click timeout is started when pointer movement stops.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/747
2019-08-24 12:43:20 +03:00
9b3b5badfb clutter/input-pointer-a11y: Fix dwell timeout start after moving pointer
Sometimes the dwell timeout doesn't start again after quickly moving the
pointer. That happens if `should_stop_dwell` returns TRUE for the last
motion event we receive: It will stop the current timeout, but not start
a new one until we receive another event where the moved distance is
smaller than the threshold.

To fix this, always call `should_start_dwell` and `start_dwell_timeout`
instead of using an else-block, this makes sure we start a new dwell
timeout still during the same motion event that stopped the old one.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/746
2019-08-24 09:25:14 +00:00
47c1558287 clutter/input-pointer-a11y: Remove unneeded character
https://gitlab.gnome.org/GNOME/mutter/merge_requests/746
2019-08-24 09:25:14 +00:00
cc7e843c44 tests: Move clutter-test-utils.[ch] to src/tests
And add the necessary glue so those initialize a X11 clutter backend.
This should get Clutter tests that are dependent on windowing to work
again, thus they were enabled back again.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
cfb8f18cef clutter: Move tests to src/tests
Clutter doesn't hold anymore backend implementations, move tests where
we have one that we may assign.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
c0a71720af backends: Don't use glib types in new native backend objects
https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
8b03d9ecc3 clutter: Move evdev input to src/backends/native
The end goal is to have all clutter backend code in src/backends. Input
is the larger chunk of it, which is now part of our specific
MutterClutterBackendNative, this extends to device manager, input devices,
tools and keymap.

This was supposed to be nice and incremental, but there's no sane way
to cut this through. As a result of the refactor, a number of private
Clutter functions are now exported for external backends to be possible.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
ea54ce7d96 clutter: Drop functions to get XVisualInfo
We don't need nor use visuals anymore.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
cb31e3e12a clutter: Drop unused function to translate to screen coordinates
We don't have anything like GdkInputMode that we'd like to honor, this
can just be dropped.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
c710a56903 backends: Move nested stage to src/backends/x11/nested
We now have a MetaStageX11, so it's extra confusing to have both in
the same directory.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
96d5bde9b7 backends: Don't use glib types in new X11 backend objects
https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
ad72fa46b0 clutter: Move X11 input to src/backends/x11
The end goal is to have all clutter backend code in src/backends. Input
is the larger chunk of it, which is now part of our specific
MutterClutterBackendX11, this extends to device manager, input devices,
tools and keymap.

This was supposed to be nice and incremental, but there's no sane way
to cut this through. As a result of the refactor, a number of private
Clutter functions are now exported for external backends to be possible.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:08 +00:00
fa4580de53 clutter: Temporarily comment out clutter tests
It will be enabled back in later commits. We're set for quite a ride
here.

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

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

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

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

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

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/672
2019-08-24 08:59:07 +00:00
8e13292d62 keybindings: Code cleanup
The boolean `handled` is not needed, remove it.

https://gitlab.gnome.org/GNOME/mutter/issues/734
2019-08-23 14:54:20 +00:00
29ea5306eb keybindings: Restore inhibit shortcut for overlay key
After the introduction of locate-pointer (commit 851b7d063 -
 “keybindings: Trigger locate-pointer on key modifier”), inhibiting
shortcuts would no longer forward the overlay key to the client.

Restore the code that was inadvertently removed so that inhibiting
shortcuts works on the overlay key again.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/734
2019-08-23 14:54:20 +00:00
fb9e8768a3 window-actor: Handle geometry scale
Geometry scale is applied to each surface individually, using
Clutter scales, and not only this breaks subsurfaces, it also
pollutes the toolkit and makes the actor tree slightly too
fragile. If GNOME Shell mistakenly tries to set the actor scale
of any of these surfaces, for example, various artifacts might
happen.

Move geometry scale handling to MetaWindowActor. It is applied
as a child transform operation, so that the Clutter-managed
scale properties are left untouched.

In the future where the entirety of the window is managed by a
ClutterContent itself, the geometry scale will be applied
directly into the transform matrix of MetaWindowActor. However,
doing that now would break the various ClutterClones used by
GNOME Shell, so the child transform is an acceptable compromise
during this transition.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
2019-08-23 13:23:07 +00:00
c747be84d9 wayland: Don't scale input and opaque regions
Leave them at surface coordinates and let MetaSurfaceActor
and MetaShapedTexture handle the interactions between buffer
and geometry scale.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
2019-08-23 13:23:07 +00:00
2d7adb90c8 wayland/tablet-tool: Use meta_wayland_surface_get_relative_coordinates()
Instead of directly calling into clutter_actor_transform_stage_point().

https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
2019-08-23 13:23:07 +00:00
6b35a4901e shaped-texture: Move private function to private header
meta_shaped_texture_update_area() is a private function that
is exposed in the public headers. It is not used anywhere
outside Mutter, and should really be in the private header.

Move it to the private header.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
2019-08-23 13:23:07 +00:00
4c1fde9deb shaped-texture: Move MetaCullable helpers to MetaSurfaceActor
Now that MetaShapedTexture is not a ClutterActor anymore, it does
not make sense to make it a MetaCullable semi-implementation. This
is, naturally, a responsibility of MetaSurfaceActor, since now
MetaShapedTexture is a ClutterContent and as such, it only cares
about what to draw.

Move the MetaCullable implementation of MetaShapedTexture to
MetaSurfaceActor.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
2019-08-23 13:23:07 +00:00
425e65049b shaped-texture: Draw pipeline relative to alloc
By implementing ClutterContent, it is expected that
MetaShapedTexture can draw on any actor. However,
right now this is not possible, since it assumes
that the drawing coordinates and sizes of the actor
are synchronized with its own reported width and
height.

It mistakenly draws, for example, when setting an
actor's content to it. There is no way to trigger
this wrong behavior right now, but it will become
a problem in the future where we can collect the
paint nodes of MetaShapedTexture as part of other
ClutterContent implementations.

Use the allocation box passed by the actor to draw
the pipelines of MetaShapedTexture.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
2019-08-23 13:23:07 +00:00
d3f30d9ece wayland/actor-surface: Set geometry scale in surface actor
Now that MetaShapedTexture is a ClutterContent implemetation that
is aware of its own buffer scale, it is possible to simplify the
event translation routines.

Set the geometry scale in MetaSurfaceActor, and stop adjusting the
surface scale when translating points. Also remove the now obsoleted
meta_wayland_actor_surface_calculate_scale() function.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
2019-08-23 13:23:07 +00:00
75cffd0ec4 shaped-texture: Implement ClutterContent
MetaWindowActor is the compositor-side representative of a
MetaWindow. Specifically it represents the geometry of the
window under Clutter scene graph. MetaWindowActors are backed
by MetaSurfaceActors, that represent the windowing system's
surfaces themselves. Naturally, these surfaces have textures
with the pixel content of the clients associated with them.
These textures are represented by MetaShapedTexture.

MetaShapedTextures are currently implemented as ClutterActor
subclasses that override the paint function to paint the
textures it holds.

Conceptually, however, Clutter has an abstraction layer for
contents of actors: ClutterContent. Which MetaShapedTexture
fits nicely, in fact.

Make MetaShapedTexture a ClutterContent implementation. This
forces a few changes in the stack:

 * MetaShapedTexture now handles buffer scale.

 * We now paint into ClutterPaintNode instead of the direct
   framebuffer.

 * Various pieces of Wayland code now use MetaSurfaceActor
   instead of MetaShapedTexture.

 * MetaSurfaceActorWayland doesn't override size negotiation
   vfuncs anymore

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

Expose clutter_paint_node_get_framebuffer().

https://gitlab.gnome.org/GNOME/mutter/merge_requests/409
2019-08-23 13:23:07 +00:00
a50907513a Update Serbian translation 2019-08-22 17:57:39 +00:00
c0130ca8f7 Update Polish translation 2019-08-22 18:01:17 +02:00
9d4e4e2bd4 ci: Don't build gnome-shell's man pages
One of the man pages is now generated using asciidoc, which is missing
from the CI image. But given that this doesn't depend on mutter in any
way, just disable man pages in the gnome-shell build instead of updating
the Dockerfile.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/740
2019-08-21 22:46:41 +02:00
bdc7cc8ab9 Bump version to 3.33.91
Update NEWS.
2019-08-21 19:16:03 +00:00
13deb22223 wayland/xdg-output: Add xdg-output v3 support
xdg-output v3 marks `xdg_output.done` as deprecated, avoid sending that
event for clients using xdg-output v3.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/704
2019-08-21 15:47:14 +00:00
220e4caf36 ci: Add gnome-autoar to Dockerfile
It is a dependency of the newly added gnome-extensions tool.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/738
2019-08-21 15:10:44 +00:00
5c617ac286 clutter/stage: Only queue compressible events
Incompressible events already pass through unmodified, so queuing them
just wasted time and memory.

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

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

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

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

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

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

To correct the above we now do:

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

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

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

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

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

Also switch to ClutterInputDevice grabs for the grab test.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/536
2019-08-20 14:08:44 +02:00
75349f8cde Updated Spanish translation 2019-08-20 12:46:46 +02:00
eac227a203 xwayland: Add local user to xhost
With the addition of xauth support (commit a8984a81c), Xwayland would
rely only on the provided cookies for authentication.

As a result, running an Xclient from another VT (hence without the
XAUTHORITY environment variable set) would result in an access denied.

The same on X11 is granted because the local user is automatically
granted access to Xserver by the startup scripts.

Add the local user to xhost at startup on Xwayland so that the user can
still run a client by setting the DISPLAY as long as it's the same user
on the same host.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/735
2019-08-19 17:14:40 +02:00
bc166aa6b4 xwayland: Use given X11 display for DnD setup
Use the provided X11 display instead of poking into GDK to get the X11
display.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/735
2019-08-19 17:14:40 +02:00
5fa8b24b2b xwayland: pass the X11 display
Pass the X11 display to `meta_xwayland_complete_init()` so that it can
be used without poking into GDK.

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/700
2019-08-19 13:09:56 +00:00
0db38c4999 compositor: Let MetaDisplay choose the correct compositor type
A base type shouldn't know about sub types, so let MetaDisplay make
the correct choice of what type of MetaCompositor it should create. No
other semantical changes introduced.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/727
2019-08-19 08:44:58 +00:00
8ee00cee60 compositor/x11: Move stage input region setting to MetaX11Display
It doesn't use anything specific to MetaCompositor, and
MetaCompositorX11 isn't exposed, so move it to MetaX11Display.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/727
2019-08-19 08:44:58 +00:00
984aad4b86 compositor: Move out X11 compositing code into sub type
Introduce MetaCompositorX11, dealing with being a X11 compositor, and
MetaCompositorServer, being a compositor while also being the display
server itself, e.g. a Wayland display server.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/727
2019-08-19 08:44:58 +00:00
9af90bf9c1 compositor: Fix indentation mistake
https://gitlab.gnome.org/GNOME/mutter/merge_requests/727
2019-08-19 08:44:58 +00:00
12ea2fcb51 compositor: Make type derivable
This is so that we can split it up properly into X11 compositor and
display server compositor sub types.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/727
2019-08-19 08:44:58 +00:00
55cd110c63 compositor: Use meta_window_actor_from_window() throughout
Instead of explicitly using meta_compositor_get_window_private() and
casting it to MetaWindowActor * each time.

With minor bonus style cleanups.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/727
2019-08-19 08:44:58 +00:00
f37a172dc7 events: No UI frame button press events for Wayland
When double clicking to un-maximize an X11 window under Wayland, there
is a race between X11 and Wayland protocols and the X11 XConfigureWindow
may be processed by Xwayland before the button press event is forwarded
via the Wayland protocol.

As a result, the second click may reach another X11 window placed right
underneath in the X11 stack.

Make sure we do not forward the button press event to Wayland if it was
handled by the frame UI.

https://gitlab.gnome.org/GNOME/mutter/issues/88
2019-08-19 09:16:04 +02:00
ad62a659eb window: Move UI frame event handler to a separate function
In order to tell whether an event has been handled by the frame UI, move
the UI frame handler to a specific helper function.

https://gitlab.gnome.org/GNOME/mutter/issues/88
2019-08-19 09:16:04 +02:00
15c9458e92 Updated Lithuanian translation 2019-08-18 22:30:12 +03:00
a3baf14e72 Update Romanian translation 2019-08-18 12:24:20 +00:00
f57ce7254d clutter/stage-cogl: Remove pending_swaps counter
As a protection against duplicate/early update times, it has already
been replaced by commit 35aa2781 and commit 4faeb127.

Removing it also prevents a common cause of frame skips:

  clutter_stage_cogl_schedule_update()
  clutter_stage_cogl_get_update_time() == -1

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/719
2019-08-16 16:44:27 +00:00
4d8190972d cursor-renderer/native: Fix compilation warning
Previous initialization triggered Wmissing-braces in Clang.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/731
2019-08-16 14:54:48 +02:00
b7ef8796b2 cogl: Remove unused cogl_{begin,end}_gl API
Any GL calls we want to make should be inside cogl already.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/500
2019-08-16 06:35:35 +00:00
7e8a864992 cogl: Remove unused cogl-gles2 API
This was introduced in:

    commit 010d16f647
    Author: Robert Bragg <robert@linux.intel.com>
    Date:   Tue Mar 6 03:21:30 2012 +0000

        Adds initial GLES2 integration support

        This makes it possible to integrate existing GLES2 code with
        applications using Cogl as the rendering api.

That's maybe a reasonable thing for a standalone cogl to want, but our
cogl has only one consumer. So if we want additional rendering out of
our cogl layer, it makes more sense to just add that to cogl rather than
support clutter or mutter or the javascript bindings creating their own
GLES contexts.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/500
2019-08-16 06:35:35 +00:00
f3660dc60e kms: Deal with GPUs being unplugged
Add meta-kms and meta-monitor-manager-kms listener for the udev
device-removed signal and on this signal update the device state /
re-enumerate the monitors, so that the monitors properly get updated
to disconnected state on GPU removal.

We really should also have meta-backend-native remove the GPU itself
from our list of GPU objects. But that is more involved, see:
https://gitlab.gnome.org/GNOME/mutter/issues/710

This commit at least gets us to a point where we properly update the
list of monitors when a GPU gets unplugged; and where we no longer
crash the first time the user changes the monitor configuration after
a GPU was unplugged.

Specifically before this commit we would hit the first g_error () in
meta_renderer_native_create_view () as soon as some monitor
(re)configuration is done after a GPU was unplugged.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/713
2019-08-15 20:38:28 +00:00
0eb355e29d kms: Fix drm_connector mem-leak in meta_kms_connector_update_state
https://gitlab.gnome.org/GNOME/mutter/merge_requests/713
2019-08-15 20:38:28 +00:00
3ccb7cf4b2 kms: drmModeGetConnector may fail
drmModeGetConnector may fail and return NULL, this may happen when
a connector is removed underneath us (which can happen with e.g.
DP MST or GPU hot unplug).

Deal with this by skipping the connector when enumerating and by
assuming it is disconnected when checking its connection state.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/713
2019-08-15 20:38:28 +00:00
578ff22464 kms: drmModeGetCrtc may fail
drmModeGetCrtc may fail and return NULL. This will trigger when
meta_kms_crtc_update_state gets called from meta_kms_update_states_sync
after a GPU has been unplugged leading to a NULL pointer deref causing
a crash.

This commit fixes this by checking for NULL and clearing the current_state
when NULL is returned.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/713
2019-08-15 20:38:28 +00:00
73db35c53c kms: Fix meta_kms_crtc_read_state gamma table memory leak
Before this commit meta_kms_crtc_read_state was overwriting the
entire MetaKmsCrtcState struct stored in crtc->current_state including
the gamma (sub)struct.

This effectively zero-s the gamma struct each time before calling
read_gamma_state, setting the pointers where the previous gamma values
were stored to NULL without freeing the memory. Luckily this zero-ing
also sets gamma.size to 0, causing read_gamma_state to re-alloc the
arrays on each meta_kms_crtc_update_state call. But this does mean that
were leaking the old gamma arrays on each meta_kms_crtc_update_state call.

This commit fixes this by making meta_kms_crtc_read_state only overwrite
the other values in the MetaKmsCrtcState struct and leaving the gamma
sub-struct alone, this will make read_gamma_state correctly re-use the
gamma tables if the gamma table size is unchanged; or re-alloc them
(freeing the old ones) if the size has changed, fixing the memory leak.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/713
2019-08-15 20:38:28 +00:00
76445bcb97 kms: Remove unused fields from MetaKmsCrtcState struct
https://gitlab.gnome.org/GNOME/mutter/merge_requests/713
2019-08-15 20:38:28 +00:00
6792903c4f udev: Add device-removed signal
Add a device-removed signal which gets emitted when a GPU is removed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/713
2019-08-15 20:38:28 +00:00
17c217848d udev: Fix wrong closure function usage for the "device-added" signal
The "device-added" signal should use g_cclosure_marshal_VOID__OBJECT not
g_cclosure_marshal_VOID__VOID.

Instead of fixing this manually, simply replace the closure function for
both signals with NULL, glib will then automatically set the correct
va_marshaller.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/713
2019-08-15 20:38:28 +00:00
07de258f48 ci/Dockerfile: Pass --no-cache in build example
Using the cache means we don't get updates from Fedora or copr.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/726
2019-08-15 19:59:09 +02:00
ee3e195b79 ci/Dockerfile: Upgrade after adding copr repos
So that we make sure to upgrade to the packages in the copr repos.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/726
2019-08-15 19:59:09 +02:00
a0bdf44c2d core: Do not crash on untimely stack queries for X11 windows
Some meta_later operations may happen across XWayland being shutdown,
that trigger MetaStackTracker queries for X11 XIDs. This crashes as
the MetaX11Display is already NULL.

Return a NULL window in that case, as in "unknown stack ID".

https://gitlab.gnome.org/GNOME/mutter/merge_requests/728
2019-08-15 15:11:01 +02:00
3259c7e150 wayland: Start up the grace Xwayland period right after starting Xwayland
There may be cases where a X11 client does not spawn any X11 windows (eg.
simple clients like xinput --list, or xlsclients), in this case the Xwayland
server would remain running until X11 windows happen to come and go in the
future.

Firing the shutdown timeout on restart caters for this, and would be undone
if the client maps X11 windows.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/728
2019-08-15 15:09:49 +02:00
e9e28baab7 wayland: Create XAuthority file once
Where the prepare_auth_file() call is, it does create a new one on every
respawn of Xwayland. This is not benefitial, as the XAUTHORITY envvar is
already fixed in the session.

Only create the XAuthority file once, and reuse it on future Xwayland
respawns.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/728
2019-08-15 15:09:38 +02:00
d20f6c7969 compositor: Use g_clear_signal_handler to disconnect signal handlers
This also exposed wrong types used for the signal handler ids.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/385
2019-08-14 15:42:03 +00:00
93c7d571af display: Destroy compositor using g_clear_pointer
https://gitlab.gnome.org/GNOME/mutter/merge_requests/385
2019-08-14 15:42:03 +00:00
d526283ab9 compositor: Make it a GObject
This means we can later use GObject features like signals, subclassing
etc.

Bump glib_req version as per g_clear_handle_id usage.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/385
2019-08-14 15:42:03 +00:00
782056adab wayland/data-device: Use correct selection type to get mime types
When primary_offer_receive checks if the requested mime_type is supported,
it should check against the list of mime-types supported by the
primary-selection, instead of the list for the clipboard.

This fixes primary selection copy paste from X11 apps to Wayland apps
not working.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/702
2019-08-14 12:00:10 +02:00
0521706617 monitor: Always advertise modes similar to the preferred mode
Even if the preferred mode ends up being too small according to the area
size filter, it should still be advertised as it's still preferred.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/722
2019-08-13 14:38:16 +00:00
989a281b5f monitor: Check mode resolution area when determining advertisability
Explicitly checking the dimensions of a mode to determine whether it
should be advertised or not fails for portrait style modes. Avoid this
by checking the area instead.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/722
2019-08-13 14:38:16 +00:00
18838bcefc monitor: Fix style issue
https://gitlab.gnome.org/GNOME/mutter/merge_requests/722
2019-08-13 14:38:16 +00:00
f780706f09 Update Indonesian translation 2019-08-13 09:21:34 +00:00
358911a049 Update Basque translation 2019-08-11 14:04:49 +00:00
1b9672b5db Bump version to 3.33.90
Update NEWS.
2019-08-09 21:35:49 +02:00
08c6b801d2 core: Exit early on keybindings if this is a wayland compositor
Fixes a thinko in commit 79b5ece2. It is meant to bail out early
on issuing X11 passive grabs if the compositor is a wayland one,
but this condition was inverted.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/721
2019-08-09 11:36:45 +02:00
80c8a287ee wayland: Check the xwayland shutdown policy before listening for x11 windows
We only listen for those so we know there's no more X11 clients that we
should keep the Xwayland server alive for. Check first that we really did
request Xwayland to be handled on demand for this, otherwise the check is
superfluous, even harmful.

https://gitlab.gnome.org/GNOME/mutter/issues/719
2019-08-07 18:34:10 +02:00
7ab07b05e9 clutter-actor: Expose layout manager properties to transitions
ClutterActor allows using properties of actions, constraints and effects
in transitions. Extend that functionality to allow the same for the actor's
layout manager.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/716
2019-08-06 23:19:33 +02:00
141373f0ba wayland: Implement on-demand start of Xwayland
The Xwayland manager now has 4 distinct phases:
- Init and shutdown (Happening together with the compositor itself)
- Start and stop

In these last 2 phases, handle orderly initialization and shutdown
of Xwayland. On initialization We will simply find out what is a
proper display name, and set up the envvar and socket so that clients
think there is a X server.

Whenever we detect data on this socket, we enter the start phase
that will launch Xwayland, and plunge the socket directly to it.
In this phase we now also set up the MetaX11Display.

The stop phase is pretty much the opposite, we will shutdown the
MetaX11Display and all related data, terminate the Xwayland
process, and restore the listening sockets. This phase happens
on a timeout whenever the last known X11 MetaWindow is gone. If no
new X clients come back in this timeout, the X server will be
eventually terminated.

The shutdown phase happens on compositor shutdown and is completely
uninteresting. Some bits there moved into the stop phase as might
happen over and over.

This is all controlled by META_DISPLAY_POLICY_ON_DEMAND and
the "autostart-xwayland" experimental setting.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
2019-08-06 00:41:36 +00:00
0c5866a9e1 core: Avoid queueing a stack operation on the frame when the X11 is closing
When rushing to unmanage X11 windows after the X11 connection is closed/ing,
this would succeed at creating a stack operation for no longer known windows.
Simply avoid to queue a stack operation if we know it's meaningless.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
2019-08-06 00:41:36 +00:00
879f5f0dbb x11: Add "closing" flag to MetaX11Display
So code not directly in dispose() can know to avoid certain things
when the X11 display is about to close.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
2019-08-06 00:41:36 +00:00
123b40105d x11: Shuffle x11-stack destruction in MetaX11Display dispose
Unmanaging the windows may trigger stack operations that we later try
to synchronize despite being in dispose() stage. This may trigger
MetaStackTracker warnings when trying to apply those operations.

Switching destruction order (First dispose the X11 stack representation,
then unmanage windows) won't trigger further stack changes on X11 windows
after having signaled MetaDisplay::x11-display-closing.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
2019-08-06 00:41:36 +00:00
7ef32f747b wayland: Add setting/api to check the policy to set up the X11 display
This replaces meta_should_autostart_x11_display(). The "on-demand" policy
is not honored yet.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
2019-08-06 00:41:36 +00:00
e8949292c1 wayland: Refactor code setting up the display socket
So it may be reused when we need to open those again.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
2019-08-06 00:41:36 +00:00
f5a2694eba wayland: Add tracking of X11 windows
This is unused ATM, but will be used to check whether it is safe to
shut Xwayland down.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
2019-08-06 00:41:36 +00:00
319f7f5b63 compositor: Add explicit API call to redirect X11 windows
This is not useful yet, but will be when Xwayland may restart

https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
2019-08-06 00:41:36 +00:00
9a10b8ff94 wayland: Disconnect signal when the display closes
It would be potentially left dangling if the display were closed, and
reconnected again when restarting the server.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
2019-08-06 00:41:36 +00:00
8b62f4884d wayland: Rename xwayland init/shutdown functions
The start/stop verbs will be reused later when we can start and
stop the X server. Rename these functions to init/shutdown, and
init_xserver() to start_xserver().

https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
2019-08-06 00:41:36 +00:00
500a692e3b core: Manage only X11 windows when (re)starting
What "restart" means is somewhat different between x11 and wayland
sessions. A X11 compositor may restart itself, thus having to manage
again all the client windows that were running. A wayland compositor
cannot restart itself, but might restart X11, in which case there's
possibly a number of wayland clients, plus some x11 app that is
being started.

For the latter case, the assert will break, so just make it
conditional. Also rename the function so it's more clear that it
only affects X11 windows.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
2019-08-06 00:41:36 +00:00
d3d1ff1aae x11: Do not queue stack operation for guard window
In the case mutter is a x11 compositor, it doesn't matter much
since the stack tracker will go away soon. In the case this is a
wayland compositor with mandatory Xwayland, it matters even less
since the session would be shutting down in those paths.

But if this a wayland compositor that can start Xwayland on demand,
this is even harmful, as the MetaStackTracker should be cleared of
x11 windows at this moment, and we actually did right before dispose
on ::x11-display-closing.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
2019-08-06 00:41:36 +00:00
ca51cd8488 core: Prepare MetaStackTracker for X11 display being closed
If the display is closed prematurely, go through all windows that
look X11-y and remove them for future calculations. This is not
strictly needed as Xwayland should shut down orderly (thus no client
windows be there), but doesn't hurt to prepare in advance for the
cases where it might not be the case.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
2019-08-06 00:41:36 +00:00
9109fa0eb8 x11: Add meta_x11_get_display_name() function
Instead of poking the DISPLAY envvar at places.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
2019-08-06 00:41:36 +00:00
79b5ece241 core: Ensure passive key grabs are only set up on X11
We don't strictly need it for wayland compositors, yet there are
paths where we try to trigger those passive grabs there. Just
skip those on the high level code (where "is it x11" decisions
are taken) like we do with passive button grabs.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/709
2019-08-06 00:41:36 +00:00
cda9579034 core: propagate the effective on-all-workspaces setting to transient window
Commit 09bab98b1e tried to avoid several workspace changes while in
window construction, but it missed a case:

If we have a window on a secondary monitor with no workspaces enabled
(so it implicitly gets on_all_workspaces = TRUE without requesting it)
and trigger the creation of a second window that has the first as
transient-for, it would first try to set the first workspace than the
transient-for window and then fallback to all/current workspace.

After that commit we only try to set the same workspace than the
transient-for window, but it gets none as neither is on a single workspace,
nor did really request to be on all workspaces.

Fixes crashes when opening transient X11 dialogs in the secondary monitor.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/714
2019-08-05 18:19:01 +00:00
82b222f218 Update Romanian translation 2019-08-05 14:00:36 +00:00
56a5c5e4d1 cleanup: Stop using g_get_current_time ()
It has been deprecated because it isn't Y2k38 ready, so replace it
with g_get_real_time () which is.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/708
2019-08-03 16:12:32 +00:00
b95d7e8276 iconcache: Support 16bit icons
Mutter current crashes if an application sets a 16-bit color depth
icon in its window manager hints.

This commit fixes the crash.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/710
2019-08-01 16:52:10 -04:00
5b98cc7a3a cursor-tracker: Document cursor-moved signal
It's a bit easier to track what's going on in a signal if you document
it (otherwise you have to check where it was emitted in the code).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/697
2019-07-31 09:34:17 +00:00
4de892b02a cursor-tracker: Don't use g_cclosure_marshal_VOID__VOID
Similar to gtk commit f507a790, this ensures that the valist variant of
the marshaller is used. From that commit's message:

```
If we set c_marshaller manually, then g_signal_newv() will not setup a
va_marshaller for us. However, if we provide c_marshaller as NULL, it will
setup both the c_marshaller (to g_cclosure_marshal_VOID__VOID) and
va_marshaller (to g_cclosure_marshal_VOID__VOIDv) for us.
```

https://gitlab.gnome.org/GNOME/mutter/merge_requests/697
2019-07-31 09:34:17 +00:00
efe6c13d93 cursor-tracker: Use our own marshal for cursor-moved
By putting `NULL` as the C marshaller in `g_signal_new`, you
automatically get `g_cclosure_marshaller_generic`, which will try to
process its arguments and return value with the help of libffi and
GValue.

Using `glib-genmarshal` and valist_marshallers, we can prevent this so
that we need less instructions for each signal emission.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/697
2019-07-31 09:34:17 +00:00
aae9f3a3e6 window-actor: Fix rectangle coordinates in culling
The cull methods expect regions with 0,0 in the actor top-left corner,
whereas meta_window_get_frame_rect() returns a rectangle in workarea
coordinates.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/707
2019-07-31 00:27:33 +02:00
f501fdcc56 window-actor: Remove negation in function name
Double negations are the spawn of the devil, and is_non_opaque() is
used like that to find out if it's opaque most often, change the
function name to see the glass half full.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/698
2019-07-30 23:17:14 +02:00
90a5582a73 background-actor: Clip obscured background areas
The MetaBackgroundActor was ignoring the unobscured area altogether,
and just painted according to the clip area. Check the unobscured
area too, as it might well be covered by client windows.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/698
2019-07-30 23:17:14 +02:00
ac7aa11417 window-actor: Cull out areas covered by opaque windows
Wayland clients do this through the opaque region in the surface
actor. However X11 clients were considered fully transparent for
culling purposes, which may result in mutter painting other bits
of the background or other windows that will be painted over in
reality.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/698
2019-07-30 23:17:14 +02:00
cc5968109b window-actor: Fix check to clip beneath the window
We want to clip it away if 1) The window is fully opaque or
2) If it's translucent but has a frame (as explained in the comment
above). The code didn't quite match and we were only applying it on
case #2.

Case #1 is far more common, and saves us from pushing some drawing
that we know will be covered in the end.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/698
2019-07-30 23:08:51 +02:00
0f6ab787ac window-actor: Check frame bounds region before use
It may be NULL when the window goes unmanaged. This was unnoticed
as we barely enter the clip_shadow_under_window() check.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/698
2019-07-30 23:08:42 +02:00
2812338b7a shadow-factory: Optimize shadows entirely if clip region is empty
If the clip region is empty, we don't need to check the 9 slices
separately, nothing will be painted anyway.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/703
2019-07-30 13:50:17 +02:00
35007ebae0 Update Friulian translation 2019-07-28 08:06:58 +00:00
09bab98b1e core: Avoid consecutive workspace changes in window construction
We first set the workspace to the transient-for parent's, and then
try to set on the current workspace. If both happen, we double the
work on adding/removing it from the workspace, and everything that
happens in result.

Should reduce some activity while typing on the Epiphany address
bar, as the animation results in a number of xdg_popup being created
and destroyed to handle the animation.

https://gitlab.gnome.org/GNOME/mutter/issues/556
2019-07-24 21:06:50 +02:00
aee8bfce3f core: Only notify on MetaWindow::user-time on actual changes
If the timestamp is the same, it doesn't make sense to update and we
don't do so. So it doesn't make sense to notify on the property either.

https://gitlab.gnome.org/GNOME/mutter/issues/556
2019-07-24 13:55:53 +02:00
92868182c9 build: Bump API version automatically each development cycle
Since the API version was added, we've bumped it at some point late-ish in
the cycle when enough changes had accumulated (but way after the first ABI
break). Automate that process by computing the API version automatically
from the project version:
With this commit, the new API version will be 5 for the remaining 3.33.x
releases and all 3.34.x stable versions; 3.35.1 will then bump it to 6 and
so forth.

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

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

https://gitlab.gnome.org/GNOME/mutter/issues/683
2019-07-23 01:38:38 +00:00
59fb26cb00 cogl/tests: Only install run-tests.sh when building installed tests
This is a script for installed tests; leave it out otherwise.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/694
2019-07-22 22:07:39 +01:00
87c734cef9 cleanup: Really stop using G_TYPE_INSTANCE_GET_PRIVATE()
Commit 4259cfd4c6 missed some occurences, move those to the generated
get_instance_private() functions as well.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/691
2019-07-22 09:48:29 +00:00
e9cc220c8e x11: Remove benign warning for older X clients
The default configuration of libinput-gestures utility invokes wmctrl to
switch between desktops. It uses wmctrl because this works on both Xorg
and Wayland (via XWayland). Unfortunately, this generates the following
warning message every time, in both Xorg and Wayland desktops:

"Received a NET_CURRENT_DESKTOP message from a broken (outdated) client
who sent a 0 timestamp"

The desktop switch still works fine. The tiny code change here removes
this specific warning because, as the prefacing code comment originally
said and still says, older clients can validly pass a 0 time value so
why complain about that?

I also refactored the "if (workspace)" code slightly to avoid the double
test of the workspace value.

This is submitted for MR
https://gitlab.gnome.org/GNOME/mutter/merge_requests/671.
2019-07-22 07:31:41 +00:00
92f210039e Update Brazilian Portuguese translation 2019-07-22 04:44:31 +00:00
aef393efd0 Update Basque translation 2019-07-21 18:41:30 +00:00
6836317e41 Bump version to 3.33.4
Update NEWS.
2019-07-20 14:27:14 +02:00
61e51cdef6 dma-buf: Mark DMA-BUF textures as paint-only
Reading pixels directly from a texture imported from a DMA-BUF EGLImage
may result compressed textures to be transferred into non-compressed
texture. This may have side effects causing it to be rendered
incorrectly in subsequent paints.

Avoid this by passing the no-get-data flag to the texture creator
function, eventually causing mutter to use an intermediate offscreen
framebuffer when reading pixels from such textures.

https://bugs.freedesktop.org/show_bug.cgi?id=111140
https://gitlab.freedesktop.org/xorg/xserver/issues/545

https://gitlab.gnome.org/GNOME/mutter/merge_requests/687
2019-07-18 14:09:22 +00:00
7868ab761f cogl/texture: Add EGLImage texture import flags
The flags are 'none', and 'no-get-data' meaning get_data() is not
supported.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/687
2019-07-18 14:09:22 +00:00
e6c8939c30 cogl/texture: Make is_get_data_supported() a bool on the texture
Comparing the gl target is not enough. More on that later.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/687
2019-07-18 14:09:22 +00:00
ac5d9ec558 keybindings: Do not grab the locate-pointer key if unnecessary
On X11, mutter needs to keep a grab on the locate-pointer key to be able
to trigger the functionality time the corresponding key combo is
pressed.

However, doing so may have side effects on other X11 clients that would
want to have a grab on the same key.

Make sure we only actually grab the key combo for "locate-pointer" only
when the feature is actually enabled, so that having the locate pointer
feature turned off (the default) would not cause side effects on other
X11 clients that might want to use the same key for their own use.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/647
2019-07-18 13:10:32 +00:00
9c8ff5dbe8 keybindings: Mark "locate-pointer" key as "no-auto-grab"
Mark the keybinding for locate-pointer as "no-auto-grab" so we don't
automatically redo the grab.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/685
2019-07-18 13:10:32 +00:00
7738316dff keybindings: Mark the "overlay" key as "no-auto-grab"
Mark the keybinding for overlay as "no-auto-grab" to skip it in
`change_binding_keygrabs()` so we don't automatically redo the grab.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/685
2019-07-18 13:10:32 +00:00
1c3d8defb5 keybindings: Add "no-auto-grab" type
Some special modifiers (typically "Control_L" used for locate-pointer in
mutter/gnome-shell or "Super_L" for overlay) must be handled separately
from the rest of the key bindings.

Add a new flag `META_KEY_BINDING_NO_AUTO_GRAB` so we can tell when
dealing with that special keybinding which should not be grabbed
automatically like the rest of the keybindings, and skip those when
changing the grabs of all keybindings.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/685
2019-07-18 13:10:32 +00:00
b2ae03c428 keybindings: Fix indentation
Small cleanup of indentation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/685
2019-07-18 13:10:32 +00:00
456698c814 keybindings: Remove unneeded forward declaration
The functions `grab_key_bindings()` and `ungrab_key_bindings()` are not
used before their actual definition, there is no need to have a forward
declaration for those.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/689
2019-07-18 11:01:09 +02:00
4259cfd4c6 cleanup: Don't use G_TYPE_INSTANCE_GET_PRIVATE()
It has been deprecated in favor of the get_instance_private() function
generated by the G_ADD_PRIVATE() macro.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/689
2019-07-18 11:01:09 +02:00
5ca0ef078d window-x11: Focus a window in the active workspace as take-focus fallback
Starting with commit 2db94e2e we try to focus a fallback default focus window
if no take-focus window candidate gets the input focus when we request it and
we limit the focus candidates to the current window's workspace.

However, if the window is unmanaging, the workspace might be unset, and we could
end up in deferencing a NULL pointer causing a crash.

So, in case the window's workspace is unset, just use the currently active
workspace for the display.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/688
2019-07-18 10:09:45 +02:00
a5265365dd background: Reload when GPU memory is invalidated
Fixes corrupt background wallpaper when resuming from suspend on the
Nvidia driver.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/600
2019-07-16 16:24:41 +08:00
62f576e15b events: Use new API to get MetaWindow from ClutterActor
The new API supports Wayland subsurfaces and is probably better placed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/604
2019-07-13 15:32:19 +02:00
73bc3c4426 window-actor: Add API to get a MetaWindowActor from a ClutterActor
Make it so it returns the closest ancestry MetaWindowActor if it
is a MetaSurfaceActor.
We need this for Wayland subsurfaces, so we can support actions like
Meta+Drag on them.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/604
2019-07-13 15:32:01 +02:00
57772e5850 workspace-manager: Fix a documentation warning
Pure comment should not start with two stars. Fixes a GIR creation warning
introduced in 8038eaa99f.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/683
2019-07-12 22:01:27 +02:00
7c8baf8ed9 compositor: Drop meta_get_overlay_window()
This is no longer necessary outside of mutter, nor used internally.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/680
2019-07-11 10:56:53 +02:00
0e3c062406 dnd: Use composite_overlay_window directly
Saves us from using MetaCompositor API, at a point where it might not
be initialized yet. Use the same window directly, since we already
have it handy.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/672
2019-07-11 10:56:47 +02:00
4bc7425332 wayland/pointer: Remove duplicate include
https://gitlab.gnome.org/GNOME/mutter/merge_requests/448
2019-07-10 12:39:06 +00:00
a2a8f0cdaa wayland/pointer: Set focus to NULL when the cursor is hidden
This is important when using a touchscreen or stylus instead of a mouse
or touchpad. If the cursor only gets hidden and the focus stays the
same, the window will still send hover events to the UI element under
the cursor causing unexpected distractions while interacting with the
touchscreen.

Fix this by emitting a visibility-changed signal from the cursor tracker
which then triggers a focus surface sync and always set the focus
surface to NULL when it's synced while the cursor is hidden.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/448
2019-07-10 12:39:06 +00:00
faa7b2d4e5 cursor-tracker: Add API to get whether the pointer is visible
Allow checking whether the pointer is visible without accessing the
trackers internal is_showing property. While we don't need this just yet
for reading the visibility inside meta-wayland-pointer, it's useful when
implementing the logic to remove Clutter's focus when the cursor goes
hidden later.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/448
2019-07-10 12:39:06 +00:00
a95644dbdc renderer/native: Debug for primary copy mode
COPY_MODE_PRIMARY has two paths, automatically chosen. For debugging purposes,
e.g. why is my DisplayLink screen slowing down the whole desktop, it will be
useful to know which copy path is taken. Debug prints are added to both when
the primary GPU copy succeeds the first time and when it fails the first time.

This is not the full truth, because theoretically the success/failure could
change every frame, but we don't want to spam the logs (even in debug mode)
every frame. In practise, it should be rare for the success or failure to ever
change. Hence, saying what happened on the first time is enough. This does
indicate if it ever changes even once, too, so we know if that unexpected thing
happens.

The debug prints are per secondary GPU since there could be several.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
720f363241 renderer/native: Add tracing for 2nd GPU copies
These traces allow seeing how long the copy operations stall in libmutter, and
which copy operations actually get used.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
3794df608c renderer/native: Use primary GPU to copy
When the preferred path META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU cannot
be used, as is the case for e.g. DisplayLink devices which do not actually have
a GPU, try to use the primary GPU for the copying before falling back to
read-pixels which is a CPU copy.

When the primary GPU copy works, it should be a significant performance win
over the CPU copy by avoiding stalling libmutter for the duration.

This also renames META_SHARED_FRAMEBUFFER_COPY_MODE_* because the new names are
more accurate. While the secondary GPU copy is always a GPU copy, the primary
copy might be either a CPU or a GPU copy.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
2c893beff1 renderer/native: Add meta_dumb_buffer_ensure_dmabuf_fd
Follow-up work will use this in an attempt to use the primary GPU to
copy into secondary GPU dumb buffers.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
a3c425ad89 wayland/dma-buf: Use meta_egl_create_dmabuf_image
Use the new helper instead of open-coding practically the same.

No behavioral changes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
1d144486d1 wayland/dma-buf: Fix offset, stride types
These parameters are uint32_t in the Wayland protocol so make them uint32_t
here as well.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
9cd3b07472 egl: Introduce meta_egl_create_dmabuf_image
This bit of code was more or less duplicated in meta-renderer-native-gles3.c
and meta-wayland-dma-buf.c. Start consolidating the two implementations by
moving the *-gles3.c function into meta-egl.c and generalizing it so it could
also accommodate the meta-wayland-dma-buf.c usage.

The workaround in the *-gles3.c implementation is moved to the caller. It is
the caller's responsibility to check for the existence of the appropriate EGL
extensions.

Commit 6f59e4858e worked around the lack of
EGL_EXT_image_dma_buf_import_modifiers with the assumption that if the modifier
is linear, there is no need to pass it into EGL. The problem is that not
passing a modifier explicitly to EGL invokes implementation-defined behaviour,
so we should not have that workaround in meta-egl.c.

This patch intends to be pure refactoring, no behavioral changes. The one
change is the addition of g_assert to catch overwriting arbitrary memory.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
6061abbf90 cogl: Expose cogl_blit_framebuffer
The function will be used in copying from a primary GPU framebuffer to a
secondary GPU framebuffer using the primary GPU specifically when the
secondary GPU is not render-capable.

To allow falling back in case glBlitFramebuffer cannot be used, add boolean
return value, and GError argument for debugging purposes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
55c084e6e1 cogl: Rename feature OFFSCREEN_BLIT to BLIT_FRAMEBUFFER
The feature is not limited to offscreen framebuffer blits anymore since
"cogl: Allow glBlitFramebuffer between onscreen/offscreen".

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
45289b3d65 cogl: Allow glBlitFramebuffer between onscreen/offscreen
Depends on "cogl: Replace ANGLE with GLES3 and NV framebuffer_blit"

Allow blitting between onscreen and offscreen framebuffers by doing the y-flip
as necessary. This was not possible with ANGLE, but now with ANGLE gone,
glBlitFramebuffer supports flipping the copied image.

This will be useful in follow-up work to copy from onscreen primary GPU
framebuffer to an offscreen secondary GPU framebuffer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
6df34eb4b7 cogl: Relax formats on glBlitFramebuffer
Depends on: "cogl: Replace ANGLE with GLES3 and NV framebuffer_blit"

As a possible ANGLE implementation is not longer limiting the pixel format
matching, lift the requirement of having the same pixel format.

We still cannot do a premult <-> non-premult conversion during a blit, so guard
against that.

This will be useful in follow-up work to copy from onscreen primary GPU
framebuffer to an offscreen secondary GPU framebuffer if the formats do not
match exactly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
3e68c9e8fa cogl: Replace ANGLE with GLES3 and NV framebuffer_blit
ANGLE extensions are only provided by Google's Almost Native Graphics Layer
Engine (ANGLE) implementation. Therefore they do not seem too useful for
Mutter.

The reason to drop GL_ANGLE_framebuffer_blit support is that it has more
limitations compared to the glBlitFramebuffer in GL_EXT_framebuffer_blit,
GL_NV_framebuffer_bit, OpenGL 3.0 and OpenGL ES 3.0. Most importantly, the
ANGLE version cannot flip the image while copying, which limits
_cogl_blit_framebuffer to only off-screen <-> off-screen copies. Follow-up work
will need off-screen <-> on-screen copies.

Instead of adding yet more capability flags to Cogl, dropping ANGLE support
seems appropriate.

The NV extension is added to the list of glBlitFramebuffer providers because it
provides the same support as ANGLE and more.

Likewise OpenGL ES 3.0 is added to the list of glBlitFramebuffer providers
because e.g. Mesa GLES implementation usually provides it and that makes it
widely available, again surpassing the ANGLE supported features.

Follow-up patches will lift some of the Cogl assumptions of what
glBlitFramebuffer cannot do.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
fc0ce11fcd cogl: Fix doc for _cogl_blit_framebuffer
Commit 38921701e5 added explicit source and
destination parameters. Fix the documentation to match.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
c08a24bb40 cogl: Remove unused OFFSCREEN_BLIT feature flag
This named constant is never used anywhere.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/615
2019-07-10 08:15:02 +00:00
78560b8426 core: Use source device on ::accelerator-activated
Using the master device, as we did, won't yield the expected result when
looking up the device node (it comes NULL as this is a virtual device).
Use the slave device, as the g-s-d machinery essentially expects.

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

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/677
2019-07-08 13:21:40 +00:00
dd8c8e82f2 core: Emit ::accelerator-activated with a ClutterInputDevice argument
The device ID is kind of pointless on Wayland, so it might be better to
stick to something that works for both backends. Passing the device here
allows the higher layers to pick.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/676
2019-07-08 10:31:11 +00:00
62f4e0501f stack: Style and introspection doc fixes
https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:46:52 +02:00
6d8293a422 window-x11: Use any focusable window as fallback delayed focus window
As per commit f71151a5 we focus an input window if no take-focus-window accepts
it. This might lead to an infinite loop if there are various focusable but
non-input windows in the stack.

When the current focus window is unmanaging and we're trying to focus a
WM_TAKE_FOCUS window, we intent to give the focus to the first focusable input
window in the stack.

However, if an application (such as the Java ones) only uses non-input
WM_TAKE_FOCUS windows, are not requesting these ones to get the focus. This
might lead to a state where no window is focused, or a wrong one is.

So, instead of only focus the first eventually input window available, try to
request to all the take-focus windows that are in the stack between the
destroyed one and the first input one to acquire the input focus.
Use a queue to keep track of those windows, that is passed around stealing
ownership, while we protect for unmanaged queued windows.

Also, reduce the default timeout value, as the previous one might lead to an
excessive long wait.

Added metatests verifying these situations.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/660
https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:46:52 +02:00
b80250e483 tests: Add "accept_take_focus" command
When used it setups an X11 event monitor that replies to WM_TAKE_FOCUS
ClientMessage's with a XSetInputFocus request.

It can only be used by x11 clients on windows that have WM_TAKE_FOCUS atom set
and that does not accept input.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:21:17 +02:00
bd0f1bd338 test-client: Add x11 events GSource handler
When using gtk under X11 some WM related events are always filtered and not
delivered when using the gdk Window filters.

So, add a new one with higher priority than the GTK events one so that we can
pick those events before than Gtk itself.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:21:17 +02:00
2439255f32 stack: Add a function to get a sorted list of focus candidates
Use a static function if a window can be the default focus window, and use such
function to return a filtered list of the stack.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:21:17 +02:00
c327b2df95 window-x11: Accept any focusable window as fallback focus
As per commit f71151a5 we were ignoring WM_TAKE_FOCUS-only windows as focus
targets, however this might end-up in an infinite loop if there are multiple
non-input windows stacked.

So, accept any focusable window as fallback focus target even if it's a
take-focus one (that might not reply to the request).

Added a stacking test to verify this.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/660
https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:21:17 +02:00
9aee47daa9 window-x11: Don't double-check for unmanaging windows
When looking for the best fallback focus window, we ignore it if it is in the
unmanaging state, but meta_stack_get_default_focus_window() does this is check
for us already.

So, ignore the redundant test.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/669
2019-07-08 11:21:17 +02:00
ecf7e53206 metatest: Dispatch the destruction instead of sleeping after it
https://gitlab.gnome.org/GNOME/mutter/merge_requests/669/
2019-07-08 11:21:17 +02:00
8038eaa99f workspace-manager: Add API to reorder workspaces
https://gitlab.gnome.org/GNOME/mutter/merge_requests/670
2019-07-08 08:25:54 +00:00
9bcb50fa09 Update Indonesian translation 2019-07-08 08:13:00 +00:00
c17af6c794 Add fallback for semi-private symbols in Pango
Pango dropped the PANGO_ENABLE_BACKEND and PANGO_ENABLE_ENGINE symbols,
so we need to add our own defines to avoid breaking the build.

https://gitlab.gnome.org/GNOME/mutter/issues/667
2019-07-07 10:37:51 +01:00
4a184d74d5 monitor-manager: Don't notify unchanged power save mode
Since 4cae9b5b11, and indirectly before that as well, the
MetaMonitorManager::power-save-mode-changed is emitted even
when the power save mode didn't actually change.

On Wayland, this causes a mode set and therefore a stuttering.
It became more proeminent with the transactional KMS code.

Only emit 'power-save-mode-changed' when the power save mode
actually changed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/674
2019-07-06 20:23:57 -03:00
1f133b3ed2 compositor: Add MetaDnD private function to initialize XDND
We need to set XdndAware and XdndProxy on the stage window if running
a X11 compositor, this is not necessary on wayland.

Takes over gnome-shell code doing this initialization.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/667
2019-07-04 12:24:57 +00:00
84616bef27 window: Allow grab if the display focus is unset
As per commit 040de396b, we don't try to grab when shortcuts are inhibited,

However, this uses the focus window assuming that it is always set, while this
might not be the case in some scenarios (like when unsetting the focus before
requesting take-focus-window to acquire the input).

So allow the button grab even if the focus window is not set for the display

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/663
https://gitlab.gnome.org/GNOME/mutter/merge_requests/668
2019-07-03 18:13:25 +02:00
040de396b2 window: Don't use button grab modifiers with inhibit shortcuts
On Wayland, if a client issues a inhibit-shortcut request, the Wayland
compositor will disable its own shortcuts.

We should also disable the default handler for the button grab modifier
so that button events with the window grab modifiers pressed are not
caught by the compositor but are forwarded to the client surface.

That also fixes the same issue with Xwayland applications issuing grabs,
as those end up being emulated like shortcut inhibition.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/642
2019-07-03 10:36:34 +02:00
5a4bc15d0b workspace-manager: Expose layout properties
gnome-shell hardcodes a vertical one-column workspace layout, and
while not supporting arbitrary grids is very much by design, it
currently doesn't have a choice: We simply don't expose the workspace
layout we use.

Change that to allow gnome-shell to be a bit more flexible with the
workspace layouts it supports.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/618
2019-07-02 20:31:57 +02:00
01e20a6ba9 compositor: Don't emit size-changed when only position changes
Waking up gnome-shell and triggering JavaScript listeners of
`size-changed` every time a window was only moved was wasting a lot
of CPU.

This cuts the CPU requirement for dragging windows by around 22%.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/568
2019-07-02 15:19:03 +08:00
b0b1ff36ae clutter/main: Simplify thead lock handling
Now that there are only the default thread functions in
place, we don't need to store them.

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

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

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

Remove the global motion event handling.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/666
2019-07-01 19:12:09 -03:00
73f83f1ab6 Update Friulian translation 2019-07-01 19:07:08 +00:00
5cb6286436 kms-impl-device: Fail up front if we can't retrieve DRM resources
If we can't retrieve the drm resources, instead of segfaulting later on,
treat it as an error, and let the error handler up the stack handle it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/665
2019-07-01 11:56:08 +02:00
1c25b75571 kms-impl-device: Fail if we can't enable universal planes
We currently don't handle the lack of DRM_CLIENT_CAP_UNIVERSAL_PLANES
KMS capability. Fail constructing a device that can't handle this up
front, so later made assumptions, such as presence of a primary plane,
are actually valid.

If we want to support lack of said capability, the required planes need
to be emulated by a dummy MetaKmsPlane object.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/665
2019-07-01 11:55:47 +02:00
f2f4af0d50 window-actor: Make it clearer that the surface actor doesn't change
The way code was structured made it easy to misunderstand things as the
surface actor of a window actor could change over time. So is not the
case, however, the intention of the corresponding "update" function was
so that a surface actor could be assigned to a window actor as soon as
the X11 window was associated with its corresponding wl_surface, if the
window in question came from Xwayland.

Restructure the code and internal API a bit to make it clear that a
window actor only once gets a surface actor assigned to it, and that it
after that point never changes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/659
2019-06-28 21:08:23 +02:00
a8f8bc563e window-actor: Always chain up to parent's dispose vfunc
Our early out shouldn't mean we early out from the parents dispose
function.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/659
2019-06-28 21:07:33 +02:00
46248748a9 window-actor/wayland: Don't set set_surface_actor vfunc
It's implemented by the parent class anyway, so we don't need our empty
call-parent implementation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/659
2019-06-28 21:07:33 +02:00
da7372a2fa window-actor/x11: Fix include macros
Was missing "config.h" and associated header was not on top.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/659
2019-06-28 21:07:33 +02:00
de97b54595 surface-actor-x11: Bind the surface actor resources to window actor life
X11 actors need to release the server data (pixmap and damage) before the
display is closed.
During the close phase all the windows are unmanaged and this causes the window
actors to be removed from the compositor, unsetting their actor surface.

However, in case a window is animating the surface might not be destroyed until
the animation is completed and a reference to it kept around by gjs in the shell
case. By the way, per commit 7718e67f all window actors (even the animating
ones) are destroyed before the display is closed, but this is not true for the
child surface, because the parent window will just unref it, leaving it around
if reffed somewhere else. This is fine for wayland surfaces, but not for X11
ones which are bound to server-side pixmaps.

So, connect to the parent MetaWindowActor "destroy" signal, releasing the x11
resources that implies detaching the pixmap (unsetting the texture) and removing
the damages.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/629
https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
2019-06-28 19:36:47 +02:00
d7d97f2477 surface-actor-x11: Assign X11 Display only if we have resources
free_damage and detach_pixmap functions are called inside dispose and an object
can be disposed multiple times, even when the display is already closed.

So, don't try to deference a possibly null-pointer, assigning the xdisplay too
early, as if the X11 related resources have been unset, the server might not be
open anymore. In fact, we assume that if we have a damage or a pixmap set,
the display is still open.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
2019-06-28 19:36:47 +02:00
7776941b89 window-actor: Set actor as compositor private in window before the surface
In MetaWindowActor creation we're setting the compositor private (i.e. the
window actor itself) of a window before creating the surface actor, and so
passing to the it a window without its compositor side set.

Since the surface actor might use the parent actor, set this before updating
the surface.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
2019-06-28 19:36:46 +02:00
4061c8384b window-actor: Use vfunc to set the surface actor
As per commit 80e3c1d set_surface_actor has been added, meant to do different
things depending on the backend, like connecting to signals under X11.

However, the vfunc isn't ever used, making the X11 surfaces not to react to
repaint-scheduled signal.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
2019-06-28 19:36:46 +02:00
b850f5a732 compositor: Use direct access to disconnect top window actor signal
Everytime the top window changes we connect/disconnect to the actor's destroy
signal, although as explained in commit ba8f5a11 this might be slower in case
the window actor has many other signal connections.

So, just track this using an ID.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
2019-06-28 19:36:46 +02:00
7645c51c54 compositor: Only disconnect/connect top-window signals if it changed
If the stack changed but the top window didn't, there's no need to disconnect
the signal and connect it again.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
2019-06-28 19:36:45 +02:00
f1837b785b compositor: Replace tabs with spaces
Some old code was still using tabs instead of spaces, so replace the leftover
tabs with 8 spaces each.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/660
2019-06-28 19:36:45 +02:00
22978b9d07 Update POTFILES.in 2019-06-28 19:10:39 +02:00
1206879a20 kms-plane: Include <drm_fourcc.h>
Instead of including <drm/drm_fourcc.h>. This is the
only file that includes the drm_fourcc.h header like
this, and it happened to break the build locally.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/663
2019-06-28 13:25:15 -03:00
dc5925b7d1 kms-plane: Restore adding format fallbacks
There were fallbacks in place in case IN_FORMATS didn't yield any usable
formats: the formats in the drmModePlane struct, and a hard coded array.
The lack of these fallbacks in place could result in a segfault as code
using the supported plane formats assumed there were at least something
in there.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/662
2019-06-28 14:21:11 +00:00
b138006bb7 wayland/xdg-output: Add xdg-output v2 support
xdg-output v2 adds the output name and description events, add siupports
for these in mutter.

https://gitlab.gnome.org/GNOME/mutter/issues/645
2019-06-28 11:19:22 +02:00
bca08c2c4e monitor-manager: Use meta_monitor_get_display_name() API
Use the new monitor's `meta_monitor_get_display_name()` instead of
rebuilding the display name for each DBUS request.

https://gitlab.gnome.org/GNOME/mutter/issues/645
2019-06-28 11:19:22 +02:00
6541d49fe7 monitor: Add display name
The display name is being used by the monitor manager to expose to name
to the DBUS API.

It is being rebuilt each time, so instead build the displa yname once
for the monitor and keep it around, with an API to retrieve it, so that
we can reuse it in preparation of xdg-output v2 support.

https://gitlab.gnome.org/GNOME/mutter/issues/645
2019-06-28 11:19:22 +02:00
c3c6668343 monitor-manager: Add get_vendor_name API
The monitor manager keeps the list of PnP Ids, add a new API to get the
vendor name from a given PnP ID.

https://gitlab.gnome.org/GNOME/mutter/issues/645
2019-06-28 11:19:22 +02:00
70de90ebce renderer/native: Discard page flip retries when rebuilding views
Rebuilding views means we don't care to retry page flip attempts for
previous views, especially since connectors may have been disconnected,
making a page flip retry hit an assert a flipped CRTC has connectors
associated with it.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/630
2019-06-27 19:08:01 +02:00
0756fd4636 renderer/native: Queue mode reset from new rebuild_views vfunc
Simplify the call site a bit and make the native renderer know it should
queue mode reset itself when views have been rebuilt. This is done
partly due to more things needing to be dealt with after views have been
rebuilt.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/630
2019-06-27 19:08:01 +02:00
8c339dac3e renderer/native: Remove left-over function declarations
There are no callers and no definitions of these.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/630
2019-06-27 19:07:57 +02:00
06a7c22bcd ci: Test building without native backend support
Nobody from the core team tests that configuration, so some non-guarded
includes regularly sneak in. Avoid those build breakages by adding a
corresponding job to the CI pipeline.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/637
2019-06-27 15:50:11 +00:00
ca88826ce9 remote-desktop-session: Remove unnecessary include
The class doesn't actually use the native backend, so remove it
to avoid build errors when the backend is disabled.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/637
2019-06-27 15:50:11 +00:00
7229a07b6c window-actor: Remove left-over parent field
The commit

commit 60f7ff3a69
Author: Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
Date:   Fri Dec 21 18:12:49 2018 -0200

    window-actor: Turn into a derivable class

made the previous instance struct a instance private struct, but didn't
remove the parent field. Since it's unused, there is no point in keeping
it around, so lets drop it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/658
2019-06-27 15:07:47 +02:00
85f4772a4f backend/native: Fix compiler warning w/out EGL device
When building without EGL device support, the following compiler warning
is seen:

```
  src/backends/native/meta-renderer-native.c:2637:20: warning: unused
  variable ‘cogl_renderer_egl’ [-Wunused-variable]
```

Fix the warning by placing the relevant variable declarations within the
`#ifdef HAVE_EGL_DEVICE/#endif` statement.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/656
2019-06-27 10:21:26 +02:00
f2fb3945d1 wayland/surface: Post error on invalid scale
To follow the spec and make faulty clients fail hard.

https://gitlab.freedesktop.org/wayland/wayland/blob/master/protocol/wayland.xml#L1618

https://gitlab.gnome.org/GNOME/mutter/merge_requests/647
2019-06-26 21:02:46 +02:00
d7d75dd8e7 cogl-trace: Include cogl-trace.h even when not tracing
Public functions in C should be declared before they are defined, and
often compilers warn you if you haven't:

```
../cogl/cogl/cogl-trace.c:237:1: warning: no previous prototype for
‘cogl_set_tracing_enabled_on_thread_with_fd’ [-Wmissing-prototypes]
 cogl_set_tracing_enabled_on_thread_with_fd (void       *data,
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../cogl/cogl/cogl-trace.c:245:1: warning: no previous prototype for
‘cogl_set_tracing_enabled_on_thread’ [-Wmissing-prototypes]
 cogl_set_tracing_enabled_on_thread (void       *data,
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../cogl/cogl/cogl-trace.c:253:1: warning: no previous prototype for
‘cogl_set_tracing_disabled_on_thread’ [-Wmissing-prototypes]
 cogl_set_tracing_disabled_on_thread (void *data)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

In this case the function declarations were not included because
`HAVE_TRACING` isn't defined. But we should still include `cogl-trace.h`
because it handles the case of `HAVE_TRACING` not being defined and
correctly still declares the functions defined in `cogl-trace.c`.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/650
2019-06-26 16:36:05 +00:00
54fe0d311d ci/Dockerfile: Add mesa crash fix
This applies 'egl/x11: calloc dri2_surf so it's properly zeroed' to
mesa-19.0.7, as it fixes a crash introduced by 'egl/dri: flesh out and
use dri2_create_drawable()' included in 19.0.6.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/648
2019-06-26 18:26:52 +02:00
fefac75e96 ci/Dockerfile: Add commands for regenerating
Instead of either figuring out themself, or looking at the commit that
added the file, just make life easier by providing the commands for
rebuilding and pushing as a comment in the Dockerfile itself.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/648
2019-06-26 18:26:50 +02:00
5e46940332 ci: Drop old gsettings-desktop-schemas package versions
Since we switched to F30, the base system provides newer versions than
the ones specified (although since 3.33.3 not new enough).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/648
2019-06-25 17:43:34 +02:00
1767672375 Bump version to 3.33.3
Update NEWS.
2019-06-24 19:37:43 +02:00
6fc4cd3c0c build: Bump gsettings-desktop-schemas requirement 2019-06-24 19:33:30 +02:00
feb9d129db window-x11: Fix typo 2019-06-24 19:33:30 +02:00
2b519cba36 backends: Move numlock persistence handling here
We used to have wayland-specific paths for this in src/wayland, now we
have ClutterKeymap that we can rely on in order to do state tracking,
and can do this all on src/backend domain.

This accomodates the feature in common code, so will work on both
Wayland and X11.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/590
2019-06-24 18:24:57 +02:00
832fc798d5 backends: Add missing code to restore NumLock state on X11
It's not be called to any practical effect yet in this backend, but will
do soon.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/590
2019-06-24 17:12:14 +02:00
bd0743a421 ci: Install sysprof dependency from copr
The currently used package links are outdated. Instead of updating them
to the current release number, rely on copr repos having a higher priority
than system repos and simply specify the package name.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/644
2019-06-24 14:35:46 +00:00
20731887f2 monitor-manager/dummy: Fix name of mode debug env var
It provides ways to configure the modes, not the actual monitors.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/529
2019-06-24 13:49:52 +00:00
980d9b1042 monitor-manager/dummy: Make modes env var override the defaults
So that one can effectively change the default resolution.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/529
2019-06-24 13:49:52 +00:00
bd7704f9e1 meta: Make MetaBackgroundGroup derivable
https://gitlab.gnome.org/GNOME/mutter/merge_requests/640
2019-06-24 13:49:31 +00:00
68f18f1fe9 monitor-manager/kms: Use KMS abstraction to get and set CRTC gamma
Still doesn't synchronize with frame drawing, but no point in doing that
until gamma is managed by mutter itself and not gnome-settings-daemon.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/634
2019-06-24 13:36:10 +00:00
c655166398 kms-impl/simple: Removing extra semi colon
https://gitlab.gnome.org/GNOME/mutter/merge_requests/634
2019-06-24 13:36:10 +00:00
e14613e74e window: Warn if try to focus unmanaging windows
https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
f71151a5dd window-x11: Focus the default window with delay while waiting for take-focus
When requesting to a take-focus window to acquire the input, the client may or
may not respond with a SetInputFocus (this doesn't happen for no-input gtk
windows in fact [to be fixed there too]), in such case we were unsetting the
focus while waiting the reply.

In case the client won't respond, we wait for a small delay (set to 250 ms) for
the take-focus window to grab the input focus before setting it to the default
window.

Added a test for this behavior and for the case in which a window takes the
focus meanwhile we're waiting to focus the default window.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
6022b23923 test-runner: Add 'dispatch' command
This will only wait for events to be dispatched and processed by the server
without waiting for client processing.

Reuse the code for the wait command too.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
d08763c18c test-runner: Add 'sleep' command
This allows to sleep for a given timeout in milliseconds.

Rename test_case_before_redraw to test_case_loop_quit since it's a generic
function and use it for the timeout too.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
fcb408ad5d tests: Verify focused window in closed-transient tests
Ensure that we have a focused window when closing transient windows with
no-focus or no-take-focus atoms

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
51f9e04ef1 test-runner: Add 'assert_focused' command
This allows to verify which window should have the focus, which might not
be the same as the top of the stack.

It's possible to assert the case where there's no focused window using
"NONE" as parameter.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
2fc7760cee tests, stacking: Add tests with no-input and no-take-focus windows
When a window with no frame, that doesn't accept focus and that has no
take-focus atom set is destroyed, we ended up in not changing the current_focus
window, causing a crash.

Added test cases that verify this situation.

Related to https://gitlab.gnome.org/GNOME/mutter/issues/308
https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
f2d2d473b7 tests: Add 'can_take_focus' command to runner and client
Allow to set/unset WM_TAKE_FOCUS from client window.
This is added by default by gtk, but this might not happen in other toolkits,
so add an ability to (un)set this.

So fetch the protocols with XGetWMProtocols and unset the atom.

test-client now needs to depend on Xlib directly in meson build.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
e1f839f48f tests: Add 'accept_focus' command to runner and client
Under the hood, calls gtk_window_set_accept_focus in the client

https://gitlab.gnome.org/GNOME/mutter/merge_requests/307
2019-06-24 09:42:07 +00:00
eccc791f3b workspace: Focus only ancestors that are focusable
When destroying a window that has a parent, we initially try to focus one of
its ancestors. However if no ancestor can be focused, then we should instead
focus the default focus window instead of trying to request focus for a window
that can't get focus anyways.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/308
2019-06-24 09:42:07 +00:00
6055f04814 display: Remove _XOPEN_SOURCE definition
There is no gethostname call in this file.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/638
2019-06-24 09:35:02 +00:00
0185909ee3 window-x11: Fix _XOPEN_SOURCE usage for gethostname on FreeBSD
On FreeBSD, gethostname is guarded by '__POSIX_VISIBLE >= 200112', which
requires either '_POSIX_C_SOURCE >= 200112' or '_XOPEN_SOURCE >= 600'.
Defining _XOPEN_SOURCE to 500 does not break the build because of
implicit declaration, but it defeats the purpose of defining the macro.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/638
2019-06-24 09:35:02 +00:00
c35e56196a xwayland: Use g_get_host_name instead of gethostname
Since the xauth file is never going to be changed after it is generated,
it is safe to use g_get_host_name here.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/626
https://gitlab.gnome.org/GNOME/mutter/merge_requests/638
2019-06-24 09:35:02 +00:00
181c7cab32 wayland: Use right sign for workspace ID
We get a signed integer (-1 meaning "no workspace specified"), store it in
an unsigned integer, check for >= 0 (of course it is!) and set as the window
workspace (signed integer, -1 meaning "show on all workspaces"). What could
possibly go wrong?

https://gitlab.gnome.org/GNOME/mutter/merge_requests/639
2019-06-24 09:21:49 +00:00
740a62044e wayland/pointer-constraints: Fix build when native backend is disabled
https://gitlab.gnome.org/GNOME/mutter/merge_requests/636
2019-06-22 16:12:42 +00:00
0bf0366933 Update Croatian translation 2019-06-22 16:01:11 +00:00
70bacb9402 cogl: Remove CoglError wrapper
CoglError was added at a certain point to remove the hard dependency on
GLib, but since this can't be avoided inside mutter, let's remove this
whole abstraction.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/631
2019-06-20 18:25:04 +02:00
57dfe4696d kms-update: Seal updates when posting them
This makes sure that we won't accidentally change KMS transaction
updates after they have been posted.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
22a91f23ad backends/native: Add some KMS debug logging
Using the g_debug() macro. Set G_DEBUG_MESSAGES to "mutter" to activate
log.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
6aa1026600 kms: Add high level code documentation
Document the high level components of the KMS abstraction.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
75dff3e7c9 backend/native: Add and use transactional KMS API
This commit introduces, and makes use of, a transactional API used for
setting up KMS state, later to be applied, potentially atomically. From
an API point of view, so is always the case, but in the current
implementation, it still uses legacy drmMode* API to apply the state
non-atomically.

The API consists of various buliding blocks:

 * MetaKmsUpdate - a set of configuration changes, the higher level
handle for handing over configuration to the impl backend. It's used to
set mode, assign framebuffers to planes, queue page flips and set
connector properties.
 * MetaKmsPlaneAssignment - the assignment of a framebuffer to a plane.
Currently used to map a framebuffer to the primary plane of a CRTC. In
the legacy KMS implementation, the plane assignment is used to derive
the framebuffer used for mode setting and page flipping.

This also means various high level changes:

State, excluding configuring the cursor plane and creating/destroying
DRM framebuffer handles, are applied in the end of a clutter frame, in
one go. From an API point of view, this is done atomically, but as
mentioned, only the non-atomic implementation exists so far.

From MetaRendererNative's point of view, a page flip now initially
always succeeds; the handling of EBUSY errors are done asynchronously in
the MetaKmsImpl backend (still by retrying at refresh rate, but
postponing flip callbacks instead of manipulating the frame clock).
Handling of falling back to mode setting instead of page flipping is
notified after the fact by a more precise page flip feedback API.

EGLStream based page flipping relies on the impl backend not being
atomic, as the page flipping is done in the EGLStream backend (e.g.
nvidia driver). It uses a 'custom' page flip queueing method, keeping
the EGLStream logic inside meta-renderer-native.c.

Page flip handling is moved to meta-kms-impl-device.c from
meta-gpu-kms.c. It goes via an extra idle callback before reaching
meta-renderer-native.c to make sure callbacks are invoked outside of the
impl context.

While dummy power save page flipping is kept in meta-renderer-native.c, the
EBUSY handling is moved to meta-kms-impl-simple.c. Instead of freezing the
frame clock, actual page flip callbacks are postponed until all EBUSY retries
have either succeeded or failed due to some other error than EBUSY. This
effectively inhibits new frames to be drawn, meaning we won't stall waiting on
the file descriptor for pending page flips.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
bea7600471 logical-monitor: Pass output when iterating over CRTCs
While not currently used by any users, it'll be useful in future
commits.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
8932388dda backend/native: Move some KMS utilities to its own file
They are not strictly related to any of the KMS objects, and should be
reusable without adding a dependency on the non-meta-kms-* files in
meta-kms-*.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
2238c9f180 kms: Add API to register impl file descriptors
To let the MetaKmsImpl implementation register file descriptor GSource
where the invoke function is ensured to be executed in the impl context.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
ca21ca6745 kms: Add API to add a GSource that'll be invoked in the impl context
The MetaKmsImpl implementation may need to add a GSource that should be
invoked in the right context; e.g. a idle callback, timeout etc. It
cannot just add it itself, since it's the responsibility of MetaKms to
determine what is the impl context and what is the main context, so add
API to MetaKms to ensure the callback is invoked correctly.

It's the responsibility of the caller to eventually remove and destroy
the GSource.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
2bbd2e5563 kms: Add API to post callbacks out of the impl context
While the current impl context is in the same thread as the main
context, the separation still exists, and to post callbacks from the
impl context, it must pass MetaKms to make sure the callback is invoked
in the right context.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
691d58e69b gpu/kms: Remove unused typedef
https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
d84c7269b2 crtc/kms: Use MetaKmsPlane to check supported rotations and formats
Instead of manually retrieving supported transforms and formats from the
primary plane of the CRTC, use the MetaKmsPlane abstraction to find the
primary plane of the CRTC and check compatibility using the
MetaKmsPlane API. This removes the last user of direct KMS API usage
except for applying configuration.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
aba689312f gpu/kms: Init global mode list from MetaKmsConnectors
Instead of iterating over the available drmModeConnector objects to
construct a GPU wide mode list, use the state managed by
MetaKmsConnector. This also removes the last user of drmModeRes from
MetaGpuKms.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
f2d9a11013 output/kms: Outsource connector state fetching to MetaKmsConnector
As with CRTC state, variable connector state is now fetched via the
MetaKmsConnector. The existance of a connector state is equivalent of
the connector being connected. MetaOutputKms is changed to fetch
variable connector state via MetaKmsConnector intsead of KMS directly.
The drmModeConnector is still used for constructing the MetaOutputKms to
find properties used for applying configuration.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:56 +00:00
596376c408 crtc/kms: Outsource CRTC state fetching to MetaKmsCrtc
Move reading state into a struct for MetaCrtcKms to use instead of
querying KMS itself. The state is fetched in the impl context, but
consists of only simple data types, so is made accessible publicly. As
of this, MetaCrtcKms construction does not involve any manual KMS
interaction outside of the MetaKms abstraction.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
1f62a8dbd9 crtc/kms: Don't redefine META_MONITOR_N_TRANSFORMS
https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
f59d62bc8f kms: Add connector representation
Represents drmModeConnector; both connected and disconnected. Currently
only provides non-changing meta data. MetaOutputKms is changed to use
MetaKmsConnector to get basic metadata, but variable metadata, those
changing depending on what is connected (e.g. physical dimension, EDID,
etc), are still manually retrieved by MetaOutputKms.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
5d5d296551 gpu/kms: Fix connector id type in helper
It's a uint32_t, not a long.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
065bf752f4 output/kms: Make drmModeEncoderPtr array local
It was only used within one function, where it was always created, but
still was kept around indefinitely for no reason. Lets get rid of it
from the MetaOutputKms struct.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
4d3e804391 kms: Add plane representation
A plane is one of three possible: primary, overlay and cursor. Each
plane can have various properties, such as possible rotations, formats
etc. Each plane can also be used with a set of CRTCs.

A primary plane is the "backdrop" of a CRTC, i.e. the primary output for
the composited frame that covers the whole CRTC. In general, mutter
composites to a stage view frame onto a framebuffer that is then put on
the primary plane.

An overlay plane is a rectangular area that can be displayed on top of
the primary plane. Eventually it will be used to place non-fullscreen
surfaces, potentially avoiding stage redraws.

A cursor plane is a plane placed on top of all the other planes, usually
used to put the mouse cursor sprite.

Initially, we only fetch the rotation properties, and we so far
blacklist all rotations except ones that ends up with the same
dimensions as with no rotations. This is because non-180° rotations
doesn't work yet due to incorrect buffer modifiers. To make it possible
to use non-180° rotations, changes necessary include among other things
finding compatible modifiers using atomic modesetting. Until then,
simply blacklist the ones we know doesn't work.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
15a2ccd21b kms: Add CRTC representation
Add MetaKmsCrtc to represent a CRTC on the associated device. Change
MetaCrtcKms to use the ones discovered by the KMS abstraction. It still
reads the resources handed over by MetaGpuKms, but eventually it will
use only MetaKmsCrtc.

MetaKmsCrtc is a type of object that is usable both from an impl task
and from outside. All the API exposed via the non-private header is
expected to be accessible from outside of the meta-kms namespace.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
fef5753a19 backends/native: Add basic KMS abstraction building blocks
The intention with KMS abstraction is to hide away accessing the drm
functions behind an API that allows us to have different kind of KMS
implementations, including legacy non-atomic and atomic. The intention
is also that the code interacting with the drm device should be able to
be run in a different thread than the main thread. This means that we
need to make sure that all drm*() API usage must only occur from within
tasks that eventually can be run in the dedicated thread.

The idea here is that MetaKms provides a outward facing API other places
of mutter can use (e.g. MetaGpuKms and friends), while MetaKmsImpl is
an internal implementation that only gets interacted with via "tasks"
posted via the MetaKms object. These tasks will in the future
potentially be run on the dedicated KMS thread. Initially, we don't
create any new threads.

Likewise, MetaKmsDevice is a outward facing representation of a KMS
device, while MetaKmsImplDevice is the corresponding implementation,
which only runs from within the MetaKmsImpl tasks.

This commit only moves opening and closing the device to this new API,
while leaking the fd outside of the impl enclosure, effectively making
the isolation for drm*() calls pointless. This, however, is necessary to
allow gradual porting of drm interaction, and eventually the file
descriptor in MetaGpuKms will be removed. For now, it's harmless, since
everything still run in the main thread.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
f3fd7cf92b gpu/kms: Remove max buffer size getter
It was unused.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
5c500ad402 backend: Move GPU ownership from the monitor manager to the backend
Lets work towards making MetaMonitorManager about managing monitors, and
not about managing GPUs. This changes other units to keep a pointer to
the backend instead of a monitor manager, in case their ownership
changed, or their main usage of the monitor manager was to look up GPUs.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
e7fd068a78 monitor-manager/kms: Use 'hotplug' event from MetaUdev
Instead of dealing with udev details here, use the newly added 'hotplug'
event emitted from MetaUdev.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
171e5fc3c2 udev: Add 'hotplug' event
To be used my the monitor manager to handle hotplugs.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
7b7d881386 udev: Add helpers to list DRM devices
Will be used to move out some udev related logic when adding GPUs.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
44905d96da backends/native: Move some initialization from init() to initable_init()
This means we can report the errors properly, instead of logging a
warning and calling exit(1).

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
73e8127d5d backends/native: Add udev abstraction layer
To be used to signal devices added, hotplugs and other udev events.
Currently the only event emitted is when a device is added.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
11e2005563 backends/native: Remove instance private
The object struct definition itself is private, so the object instance
private serves no purpose. Thus, move the fields into the object struct
and remove the instance private struct.

https://gitlab.gnome.org/GNOME/mutter/issues/548
https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
2019-06-20 13:31:55 +00:00
02fc0b4533 clutter/evdev: Implement togglekeys notification
Notify with a system sound when the modifiers lock state is changed.

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/614
2019-06-20 11:40:13 +00:00
c63d0173b5 xwayland: Fix build without <sys/random.h>
The include <sys/random.h> was added to glibc-2.25, previously was
<linux/random.h>.

Adjust meson build and code to accomodate both.

Fixes: a8984a81c "xwayland: Generate a Xauth file and pass this to
                  Xwayland when starting it"

https://gitlab.gnome.org/GNOME/mutter/merge_requests/633
2019-06-20 12:37:18 +02:00
7fcdd60ac5 renderer-native: Fix compiler warning
Fix the following compiler warning:
../src/backends/native/meta-renderer-native.c: In function ‘meta_renderer_native_create_view’:
/usr/include/glib-2.0/glib/gmacros.h:523:17: warning: ‘formats’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  523 |     { if (_ptr) (cleanup) ((ParentName *) _ptr); }                                                              \
      |                 ^
../src/backends/native/meta-renderer-native.c:773:22: note: ‘formats’ was declared here
  773 |   g_autoptr (GArray) formats;
      |                      ^~~~~~~

https://gitlab.gnome.org/GNOME/mutter/merge_requests/632
2019-06-20 10:32:52 +02:00
a8984a81c2 xwayland: Generate a Xauth file and pass this to Xwayland when starting it
Before this commit, sudo x11-app, e.g. sudo gvim /etc/some-file, fails
when running a Wayland session. Where as doing this under a "GNOME on Xorg"
session works fine. For a user switching from the Xorg session to the
Wayland session, this is regression, which we want to avoid.

This commit fixes this by creating and passing an xauth file to Xwayland when
mutter starts it. Just like gdm or startx pass a xauth file to Xorg when they
start Xorg.

Fixes #643

https://gitlab.gnome.org/GNOME/mutter/issues/643
2019-06-20 10:16:21 +02:00
769a02b630 cogl: Drop _COGL_RETURN_VAL_IF_FAIL macro
This was introduced when the Cogl maintainers tried to move away from
GLib. Since we always require it, we can just use
`g_return_val_if_fail()` immediately.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/629
2019-06-19 21:46:22 +02:00
576330edce cogl: Drop _COGL_RETURN_IF_FAIL macro
This was introduced when the Cogl maintainers tried to move away from
GLib. Since we always require it, we can just use `g_return_if_fail()`
immediately.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/629
2019-06-19 21:36:19 +02:00
a2a114e79c cogl: Remove unused _COGL_TYPEDEF_ASSERT() macro
We can safely remove it since it's used nowhere in the code base. If you
would still like to use someting similar, there's `G_STATIC_ASSERT`.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/629
2019-06-19 21:03:31 +02:00
79e22853ea cogl: Remove cogl_util_ffs macro
Since commit 46942c24, we don't need the wrapper macro as we always
require its implementation to be available on the build system.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/629
2019-06-19 21:03:28 +02:00
be72b22964 cogl: Remove cogl_util_memmem() macro
`cogl_util_memmem` was used as a wrapper in case `memmem` wasn't
defined, but since commit 46942c24 these are required. In case of
`memmem`, we didn't explicitly require this in the meson build files, so
add that as well.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/629
2019-06-19 21:03:23 +02:00
2464f00902 screen-cast-monitor-stream-src: Watch monitors using MetaStageWatch
This uses the API introduced by the previous commit. By watching specific
monitors directly, and not whole stage views, we avoid showing artifacts
on multi-monitor setups.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/623
2019-06-19 13:12:18 -03:00
9b5d9f3cb3 stage: Introduce MetaStageWatch and family
MetaStageWatch, watch modes and the watch function are part
of the new stage view watching API. It's design does not
rely on signals on purpose; the number of signals that would
be emitted would be too high, and would impact performance.

MetaStageWatch is an opaque structure outside of MetaStage.

This will be used by the screencast code to monitor a single
view, which has a one-to-one relatioship to logical monitors.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/623
2019-06-19 13:12:17 -03:00
088117a619 clutter/tests: Connect to ClutterStage:paint-view
ClutterStage:after-paint now does not guarantee a valid
implicit framebuffer pushed to the stack. Instead, use
the new 'paint-view' signal, that is emitted at a point
in the drawing routine where a framebuffer is pushed.

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

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

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

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

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

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

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

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

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/623
2019-06-19 12:35:27 -03:00
b836e661cf wayland: Don't export non-public API not used by tests
https://gitlab.gnome.org/GNOME/mutter/merge_requests/628
2019-06-19 15:19:05 +00:00
446e82e86d test-utils: Fix compiler warning
This fixes the following compiler warning:

In file included from /usr/include/glib-2.0/glib.h:114,
                 from ../src/tests/test-utils.h:23,
                 from ../src/tests/test-utils.c:22:
../src/tests/test-utils.c: In function ‘test_init’:
/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: warning: ‘basename’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   28 |   g_free (*pp);
      |   ^~~~~~~~~~~~
../src/tests/test-utils.c:73:24: note: ‘basename’ was declared here
   73 |       g_autofree char *basename;
      |                        ^~~~~~~~

https://gitlab.gnome.org/GNOME/mutter/merge_requests/627
2019-06-19 13:00:17 +02:00
f2020913fd Updated Spanish translation 2019-06-19 10:10:45 +02:00
d9fb11b043 renderer/native: Fix EGLSurface destruction order
Make sure to destroy the EGL surface after releasing held buffers,
otherwise we'll get the following valgrind warnings:

==24016== Invalid read of size 8
==24016==    at 0x1739943F: release_buffer (platform_drm.c:73)
==24016==    by 0x49AC355: meta_drm_buffer_gbm_finalize (meta-drm-buffer-gbm.c:213)
==24016==    by 0x4B75B61: g_object_unref (gobject.c:3346)
==24016==    by 0x49B4B41: free_current_bo (meta-renderer-native.c:991)
==24016==    by 0x49B816F: meta_renderer_native_release_onscreen (meta-renderer-native.c:2971)
==24016==    by 0x5209441: _cogl_onscreen_free (cogl-onscreen.c:167)
==24016==    by 0x5208D81: _cogl_object_onscreen_indirect_free (cogl-onscreen.c:51)
==24016==    by 0x51C8066: _cogl_object_default_unref (cogl-object.c:103)
==24016==    by 0x5207989: _cogl_framebuffer_unref (cogl-framebuffer.c:1814)
==24016==    by 0x51C80B1: cogl_object_unref (cogl-object.c:115)
==24016==    by 0x53673C7: clutter_stage_view_dispose (clutter-stage-view.c:304)
==24016==    by 0x4B75AF2: g_object_unref (gobject.c:3309)
==24016==  Address 0x18e742a8 is 536 bytes inside a block of size 784 free'd
==24016==    at 0x4839A0C: free (vg_replace_malloc.c:540)
==24016==    by 0x17399764: dri2_drm_destroy_surface (platform_drm.c:231)
==24016==    by 0x1738550A: eglDestroySurface (eglapi.c:1145)
==24016==    by 0x5440286: eglDestroySurface (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0)
==24016==    by 0x49613A5: meta_egl_destroy_surface (meta-egl.c:432)
==24016==    by 0x49B80F9: meta_renderer_native_release_onscreen (meta-renderer-native.c:2954)
==24016==    by 0x5209441: _cogl_onscreen_free (cogl-onscreen.c:167)
==24016==    by 0x5208D81: _cogl_object_onscreen_indirect_free (cogl-onscreen.c:51)
==24016==    by 0x51C8066: _cogl_object_default_unref (cogl-object.c:103)
==24016==    by 0x5207989: _cogl_framebuffer_unref (cogl-framebuffer.c:1814)
==24016==    by 0x51C80B1: cogl_object_unref (cogl-object.c:115)
==24016==    by 0x53673C7: clutter_stage_view_dispose (clutter-stage-view.c:304)
==24016==  Block was alloc'd at
==24016==    at 0x483AB1A: calloc (vg_replace_malloc.c:762)
==24016==    by 0x173997AE: dri2_drm_create_window_surface (platform_drm.c:145)
==24016==    by 0x17388906: _eglCreateWindowSurfaceCommon (eglapi.c:929)
==24016==    by 0x5440197: eglCreateWindowSurface (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0)
==24016==    by 0x49612FF: meta_egl_create_window_surface (meta-egl.c:396)
==24016==    by 0x49B752E: meta_renderer_native_create_surface_gbm (meta-renderer-native.c:2538)
==24016==    by 0x49B7E6C: meta_onscreen_native_allocate (meta-renderer-native.c:2870)
==24016==    by 0x49B8BCF: meta_renderer_native_create_view (meta-renderer-native.c:3387)
==24016==    by 0x48D274B: meta_renderer_create_view (meta-renderer.c:78)
==24016==    by 0x48D27DE: meta_renderer_rebuild_views (meta-renderer.c:111)
==24016==    by 0x49BB4FB: meta_stage_native_rebuild_views (meta-stage-native.c:142)
==24016==    by 0x49A733C: meta_backend_native_update_screen_size (meta-backend-native.c:517)

https://gitlab.gnome.org/GNOME/mutter/merge_requests/622
2019-06-18 11:12:03 +02:00
56ddaaa380 renderer/native: Make sure we're not destroying an active EGLSurface
When making a new surface/context pair current, mesa may want to flush
the old context. Make sure we don't try to flush any freed memory by
unmaking a surface/context pair current before freeing it.

Not doing this results in the following valgrind warnings:

==15986== Invalid read of size 8
==15986==    at 0x69A6D80: dri_flush_front_buffer (gbm_dri.c:92)
==15986==    by 0x1750D458: intel_flush_front (brw_context.c:251)
==15986==    by 0x1750D4BB: intel_glFlush (brw_context.c:296)
==15986==    by 0x1739D8DD: dri2_make_current (egl_dri2.c:1461)
==15986==    by 0x17393A3A: eglMakeCurrent (eglapi.c:869)
==15986==    by 0x54381FB: InternalMakeCurrentVendor (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0)
==15986==    by 0x5438515: eglMakeCurrent (in /home/jonas/Dev/gnome/install/lib/libEGL.so.1.1.0)
==15986==    by 0x522A782: _cogl_winsys_egl_make_current (cogl-winsys-egl.c:303)
==15986==    by 0x49B64C8: meta_renderer_native_create_view (meta-renderer-native.c:3076)
==15986==    by 0x48D26E7: meta_renderer_create_view (meta-renderer.c:78)
==15986==    by 0x48D277A: meta_renderer_rebuild_views (meta-renderer.c:111)
==15986==    by 0x49BF46E: meta_stage_native_rebuild_views (meta-stage-native.c:142)
==15986==  Address 0x1b076600 is 0 bytes inside a block of size 48 free'd
==15986==    at 0x4839A0C: free (vg_replace_malloc.c:540)
==15986==    by 0x49B59F3: meta_renderer_native_release_onscreen (meta-renderer-native.c:2651)
==15986==    by 0x5211441: _cogl_onscreen_free (cogl-onscreen.c:167)
==15986==    by 0x5210D81: _cogl_object_onscreen_indirect_free (cogl-onscreen.c:51)
==15986==    by 0x51D0066: _cogl_object_default_unref (cogl-object.c:103)
==15986==    by 0x520F989: _cogl_framebuffer_unref (cogl-framebuffer.c:1814)
==15986==    by 0x51D00B1: cogl_object_unref (cogl-object.c:115)
==15986==    by 0x536F3C7: clutter_stage_view_dispose (clutter-stage-view.c:304)
==15986==    by 0x4B7DAF2: g_object_unref (gobject.c:3309)
==15986==    by 0x4A9596C: g_list_foreach (glist.c:1013)
==15986==    by 0x4A9599A: g_list_free_full (glist.c:223)
==15986==    by 0x48D2737: meta_renderer_rebuild_views (meta-renderer.c:100)
==15986==  Block was alloc'd at
==15986==    at 0x483AB1A: calloc (vg_replace_malloc.c:762)
==15986==    by 0x69A76B2: gbm_dri_surface_create (gbm_dri.c:1252)
==15986==    by 0x69A6BFE: gbm_surface_create (gbm.c:600)
==15986==    by 0x49B4E29: meta_renderer_native_create_surface_gbm (meta-renderer-native.c:2221)
==15986==    by 0x49B57DB: meta_onscreen_native_allocate (meta-renderer-native.c:2569)
==15986==    by 0x49B6423: meta_renderer_native_create_view (meta-renderer-native.c:3062)
==15986==    by 0x48D26E7: meta_renderer_create_view (meta-renderer.c:78)
==15986==    by 0x48D277A: meta_renderer_rebuild_views (meta-renderer.c:111)
==15986==    by 0x49BF46E: meta_stage_native_rebuild_views (meta-stage-native.c:142)
==15986==    by 0x49A75B5: meta_backend_native_update_screen_size (meta-backend-native.c:520)
==15986==    by 0x48B01BB: meta_backend_sync_screen_size (meta-backend.c:224)
==15986==    by 0x48B09B7: meta_backend_real_post_init (meta-backend.c:501)

https://gitlab.gnome.org/GNOME/mutter/merge_requests/622
2019-06-18 11:12:03 +02:00
1efb32d300 renderer/native: Use g_set_error() instead of _cogl_set_error()
It's even a GError, so lets use the proper API.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/622
2019-06-18 11:12:03 +02:00
6dba56223a Update Dutch translation 2019-06-18 08:22:17 +00:00
2ff6beea35 cogl: Remove cogl_wayland_texture_2d_* functions
These are implemented in the Meta namespace these days, where we have
better abstractions for wayland-related types. They also weren't used
anymore, since we removed the unused ClutterWaylandSurface type in the
previous commit.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/624
2019-06-18 09:54:04 +02:00
689c7f4107 clutter: Remove unused ClutterWaylandSurface
This allows for some further cleanups, since it is the sole consumer of
some functions in Cogl.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/624
2019-06-18 09:54:00 +02:00
59bf1f4838 window/wayland: Don't always use constrained size when unfullscreening
When we're unfullscreening, we might be returning to a window state that
has its size either managed by constraints (tiled, maximized), or not
(floating). Lets just pass the configure size 0x0 when we're not using
constrained sizes (i.e. the window going from being fullscreen to not
maximized) and let the application decide how to size itself.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/621
2019-06-13 16:40:57 +00:00
db0f85ba5d window: Add tile mode getter
Lets avoid peeking in the MetaWindow struct itself and add a getter for
the relevant state.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/621
2019-06-13 16:40:57 +00:00
425611eadf window/wayland: Use constrained size when unmaximizing while fullscreen
Otherwise we'll ask the client to use the size 0x0 with the fullscreen
state set.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/621
2019-06-13 16:40:57 +00:00
9213574870 renderer/native: add missing eglTerminate in EGLDevice error path
Currently the EGLDevice code gets the display and calls eglInitialize.
As a follow-up it checks the required EGL extensions - technically it
could check the EGL device extensions earlier.

In either case, eglTerminate is missing. Thus the connection to the
display was still bound.

This was highlighted with Mesa commit d6edccee8da ("egl: add
EGL_platform_device support") + amdgpu.

In that case, since the eglTerminate is missing, we end up reusing the
underlying amdgpu_device due to some caching in libdrm_amdgpu. The
latter in itself being a good solution since it allows buffer sharing
across primary and render node of the same device.

Note: we should really get this in branches all the way back to 3.30.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/619

Fixes: 934184e23 ("MetaRendererNative: Add EGLDevice based rendering support")
Cc: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2019-06-13 17:12:40 +01:00
3073acc3b0 clutter/stage: Remove offscreen property
It was deprecated, unused and unimplemented, so lets remove it.

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

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

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

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

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

Fix it with the "obvious" solution.

This code was added in c1303bd642.

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/115
2019-06-07 19:51:53 +00:00
178b975d6a cursor-renderer: Align OpenGL cursor rect to physical pixel grid
When stage views are scaled with fractional scales, the cursor rectangle
won't be aligned with the physical pixel grid, making it potentially
blurry when positioned in between physical pixels. This can be avoided
by aligning the drawn rectangle to the physical pixel grid of the stage
view the cursor is located on.

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/610
2019-06-07 19:11:34 +00:00
e48c7c009a clutter/stage: Make view fetch helper take floats
https://gitlab.gnome.org/GNOME/mutter/merge_requests/610
2019-06-07 19:11:34 +00:00
36b361617d wayland/cursor-surface: Update sprite when attaching NULL
Attaching a NULL buffer should hide the cursor sprite. In these cases,
we we'll have neither surface nor buffer damage, so also update when we
just attached a NULL buffer.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/630
2019-06-07 16:06:47 +00:00
5eac1d696d wayland/surface: Clear texture when attaching NULL
When 252e64a0ea moved the texture
ownership to MetaWaylandSurface, it failed to handle the case when a
NULL-buffer is attached, leaving the texture reference in place. This
caused issues when the surface should have been hidden (e.g. attaching a
NULL buffer to a cursor surface for hiding the cursor sprite).

Related: https://gitlab.gnome.org/GNOME/mutter/issues/630
2019-06-07 16:06:47 +00:00
9b53583945 cogl/trace: Fix typo
https://gitlab.gnome.org/GNOME/mutter/merge_requests/609
2019-06-07 12:58:10 -03:00
1dbf25afa1 clutter/stage-cogl: Protect against extremely high refresh rates
After 4faeb12731, the maximum time allowed for an update to happen
is calculated as:

  max_render_time_allowed = refresh_interval - 1000 * sync_delay;

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

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

Change suggested by Jasper St. Pierre.

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

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

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

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

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

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

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

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

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

  if (swap_delay != 0)
    return swap_delay;

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

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

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/363
2019-06-07 14:42:01 +08:00
0487d672ed x11-display: Handle mapped XIDs per type
Starting from commit 7713006f5, during X11 disposition we also unmanage the
windows using the xids hash table values list.
However, this is also populated by the X11 Meta barrier implementation and then
contains both Windows and Barriers.

So when going through the values list, check whether we're handling a window or
a barrier and based on that, unmanage or destroy it.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/624
https://gitlab.gnome.org/GNOME/mutter/merge_requests/605
2019-06-06 21:35:11 +00:00
e94a0fced9 display: Dispose Stack after Compositor and X11
As per commit 7718e67f, destroying the compositor causes destroying window
actors and this leads to stack changes, but at this point the stack was already
disposed and cleared.

So, clear the stack when any component that could use it (compositor, and X11)
has already been destroyed.
As consequence, also the stamps should be destroyed at later point.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/623
https://gitlab.gnome.org/GNOME/mutter/merge_requests/605
2019-06-06 21:35:11 +00:00
a3b86447f7 backends: Add mouse accessibility settings
Add support for mouse accessibility settings to set the click assist
values.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/512
2019-06-06 13:04:50 +02:00
1d76eace1e clutter: Hook up pointer accessibility
When using evdev (for Wayland), the backend receives all device events
and queue them for clutter.

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

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

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

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

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

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/512
2019-06-06 13:04:50 +02:00
c33b330799 backends: Rename keyboard accessibility settings
Naming the keyboard accessibility settings `a11y_settings` wrongly
assumes there will never be any other type of accessibility settings.

Rename `a11y_settings` to `keyboard_a11y_settings` to avoid future
confusion.

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/512
2019-06-06 13:04:50 +02:00
a6fc656e91 window: Emit an error and return when trying to activate an unmanaged
If something (i.e. gnome-shell or an extension) tries to activate an unmanaged
window, we should warn about this and avoid to perform further actions as this
could lead to a crash of mutter, since the window has not valid flags (like
workspace) set anymore at this stage.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/564
2019-06-05 17:53:12 +00:00
a38bae259e docs: Update tests instructions
The documentation still refers to autotools, update it to
use the corresponding meson commands.

https://gitlab.gnome.org/GNOME/mutter/issues/568
2019-06-05 14:49:35 -03:00
c53aa89098 keybindings: Small code cleanup
Reuse the name we just set to insert in the hash table, that avoids
duplicating the string.

Suggested-by: Carlos Garnacho <carlosg@gnome.org>

https://gitlab.gnome.org/GNOME/mutter/merge_requests/453
2019-06-05 09:34:39 +00:00
851b7d0639 keybindings: Trigger locate-pointer on key modifier
We trigger the "locate-pointer" mechanism when a special key modifier
(defaults to Control_L) key is pressed and released.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/453
https://gitlab.gnome.org/GNOME/gnome-shell/issues/981
https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas/merge_requests/19
https://gitlab.gnome.org/GNOME/gnome-settings-daemon/merge_requests/86
2019-06-05 09:34:39 +00:00
b4c78726cf compositor: Add "locate_pointer" vmethod
This method is invoked to locate the pointer on screen.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/453
https://gitlab.gnome.org/GNOME/gnome-shell/issues/981
https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas/merge_requests/19
https://gitlab.gnome.org/GNOME/gnome-settings-daemon/merge_requests/86
2019-06-05 09:34:39 +00:00
c9cc07fd3a settings: Slack off “xwayland-allow-grabs” setting
To emulate X11 grabs, mutter as a Wayland compositor would disable its
own keyboard shortcuts and when the X11 window is an override redirect
window (which never receives focus), it also forces keyboard focus onto
that X11 O-R window so that all keyboard events are routed to the
window, just like an X11 server would.

But that's a bit of a “all-or-nothing” approach which prevents
applications that would legitimately grab the keyboard under X11 (like
virtual machine viewers) to work by default.

Change “xwayland-allow-grabs” to control whether the keyboard focus
should be locked onto override redirect windows in case of an X11 grab.

For stringent needs, careful users can still use the blacklisting
feature (i.e. a list containing “!*”) to prevent grabs from any X11
applications to affect other Wayland native applications.

https://gitlab.gnome.org/GNOME/mutter/issues/597
2019-06-03 09:34:31 +02:00
f6eb2a8cf8 settings: Remove space characters
Small code style cleanup.

https://gitlab.gnome.org/GNOME/mutter/issues/597
2019-06-03 09:34:31 +02:00
08e5589836 Update Hungarian translation 2019-06-01 15:48:01 +00:00
4f5a5e84fc Update POTFILES.in 2019-05-31 20:47:46 +02:00
0786683189 meson: Add no-omit-frame-pointer to clutter debug builds
This will help us getting better stacktraces and sysprof integration.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/601
2019-05-31 16:03:43 +00:00
57945a730f backend: Conditionally compile MetaProfiler
MetaProfiler is not built when -Dprofiler=false, and that
breaks the build since MetaBackend unconditionally imports
and uses it.

Fix that by wrapping MetaProfiler in compile-time checks.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/603
2019-05-31 12:54:13 -03:00
78254146f3 build: Rename HAVE_TRACING to HAVE_PROFILER in Mutter
It fits better the name of the build flag. Cogl still uses
HAVE_TRACING since profiler is already used by it.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/197
2019-05-31 11:57:09 -03:00
04b240b50c ci: Add sysprof3 to the Docker image
It is now a dependency that we want to build against,
even if optional.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/197
2019-05-31 11:57:09 -03:00
7810f0e276 cogl/trace: Add user-visible group name
This way, it shows up as "Compositor" in Sysprof instead of
"t:XYZ".

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/197
2019-05-31 11:57:08 -03:00
e741cab3f4 profiler: Support setting output filename
So we can have some control over where the file will
be saved.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/197
2019-05-31 11:57:08 -03:00
53748e3da7 cogl-trace: Cleanup context after disabling
This allows running the Capture() method multiple times,
with different arguments each time.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/197
2019-05-31 11:57:07 -03:00
17c5436f6e profile: Add a Sysprof-based profiler
This exposes the /org/gnome/Sysprof3/Profiler object
inside Mutter to allow initiating a Sysprof capture.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/197
2019-05-31 11:57:07 -03:00
04fb6f7659 clutter: Add some preliminary tracing to clutter
https://gitlab.gnome.org/GNOME/mutter/merge_requests/197
2019-05-31 11:57:07 -03:00
e5e58f8075 cogl: Add libsysprof capture based tracing
Add the ability to add tracing instrumentation to the code. When
enabled, trace entries will generate a file with timing information
that will be processable by sysprof for generating visualization of
traces over time.

While enabled by default at compile time, it is possible to disable the
expansion of the macros completely by passing --disable-tracing to
./configure.

Tracing is so far only actually done if actually enabled on explicitly
specified threads.

This will be used by Mutter passing the write end of a pipe, where the
read end is sent to Sysprof itself via the D-Bus method 'Capture()'.

By passing that, we have to detect EPIPE that is sent when Sysprof stops
recording. Fortunately, we already ignore the signal at meta_init(), so
no need to add a custom signal handler.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/197
2019-05-31 11:55:56 -03:00
1da0355528 wayland: Update tablet cursor outputs across cursor/proximity changes
Make sure those generic surface events are sent early on when setting a
cursor for any tablet tool, so clients can update to output characteristics.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/545
Related: https://gitlab.gnome.org/GNOME/gtk/issues/1675
2019-05-31 09:57:24 +00:00
e5881156f6 wayland: Handle NULL cursor renderer finding the outputs of a cursor role
Having a cursor role with a NULL renderer is valid state, and even desirable
on tablets (eg. after proximity out). In those cases it should be
interpreted as the cursor surface not being over any output.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/545
2019-05-31 09:57:24 +00:00
60170cff70 compositor: Emit 'grab-op-end' signal after ungrab happened
We're currently emitting the 'grab-op-end' signal when the grab prerequisites
are met, but when display->grab_op is still set to a not-NONE value and thus
meta_display_get_grab_op() would return that in the signal callback.
And more importantly when this is emitted, devices are still grabbed.

Instead, emit this signal as soon as we've unset all the grab properties and
released the devices.

Helps with https://gitlab.gnome.org/GNOME/gnome-shell/issues/1326

https://gitlab.gnome.org/GNOME/mutter/merge_requests/596
2019-05-29 20:09:40 +00:00
e2bea48073 display: Emit 'grab-op-end' signal after ungrab happened
We're currently emitting the 'grab-op-end' signal when the grab prerequisites
are met, but when display->grab_op is still set to a not-NONE value and thus
meta_display_get_grab_op() would return that in the signal callback.
And more importantly when this is emitted, devices are still grabbed.

Instead, emit this signal as soon as we've unset all the grab properties and
released the devices.

Helps with https://gitlab.gnome.org/GNOME/gnome-shell/issues/1326

https://gitlab.gnome.org/GNOME/mutter/merge_requests/596
2019-05-29 20:09:40 +00:00
bbfaf8204b wayland: Honor startup sequence workspace on .request_focus
We handle this in backend specific code for x11, so do the wayland
bits here. We can only honor this on applications that request focus
on a surface after a startup request, as we do need an explicit
surface to apply the workspace on (and we don't have additional clues
like WMCLASS on X11). Notably, gtk_shell1.notify_startup doesn't suffice.

Another gotcha is that the .request_focus happens when the surface is
already "mapped". Due to the way x11 and the GDK api currently work (first
reply on the startup id, then map a window, then request focus on that
window). This means the surface will ignore at this point
window->initial_workspace, so it must be actively changed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/544
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/674
2019-05-29 16:21:15 +00:00
b3e19ee669 wayland: Unset DnD selection on wl_data_offer destruction
On a successful DnD operation we may expect the wl_data_source and
wl_data_offer to live long enough to finish the data transfer, despite the
grab operation (and other supporting data) being gone.

When that happens, the compositor expects a wl_data_offer.finish request to
notify that it finished. However the client may still chose not to send that
and destroy the wl_data_offer instead, resulting in the MetaSelectionSource
owner for the DnD selection not being unset.

When that happens, the DnD MetaSelectionSource still exists but it's
detached from any grab operation, so will not be unset if eg. the drag
source client destroys the wl_data_source. This may result in crashes when
the next drag operation tries to replace the owner DnD MetaSelectionSource.

Check explicitly for this case, in order to ensure the DnD owner is unset
after such operations.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/591
2019-05-29 16:10:57 +00:00
75e2bfb062 meson: Do not add compiler flags if 'plain' buildtype is used
That is how the 'plain' buildtype is meant in meson.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/497
2019-05-29 15:52:39 +00:00
a859d76c72 meson: Cleanup debug build handling
Add debug flags based on meson's `debug` option instead of `buildtype`.
This allows custom build configurations to behave like a debug or release build.

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

Remove `-DG_DISABLE_CAST_CHECKS` from Clutter in debug builds

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/497
2019-05-29 15:52:39 +00:00
2145333969 renderer/native: Refactor into secondary_gpu_get_next_dumb_buffer
Extract the next buffer -logic into a new function. This allows to
simplify copy_shared_framebuffer_cpu () making it more readable.

This change is a pure refactoring, no functional changes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/593
2019-05-29 11:53:00 -03:00
1b61b9cd73 boxes: Fix calculation of rounded rectangles
Since 68fba458 the function is used for more calculations, exposing
a bug when used with fractional scaling.

https://gitlab.gnome.org/GNOME/mutter/issues/609
2019-05-29 00:07:15 +02:00
a2c545c321 x11-display: Simplify bell handling
Since commit 956ab4bd made libcanberra mandatory, we never use
the system bell for handling the `audible-bell` setting. So
instead of reacting to settings changes with the exact same call
to XkbChangeEnabledControls(), just call it once when initializing.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/598
2019-05-28 14:34:32 +00:00
3cd8f3b7dc workspace-manager: Remove unnecessary assignment
The initialization to -1 is never used, instead the variables are
re-initialized to 0 before the loop that uses them.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/598
2019-05-28 14:34:32 +00:00
033ce2d956 input-mapper: Remove unnecessary return value
Since commit ae6d9e35bd, there is a fallback to META_MATCH_IS_BUILTIN,
so the condition for returning FALSE is never met.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/598
2019-05-28 14:34:32 +00:00
2b47e89405 renderer-x11-nested: Fix copy-and-paste error
The rounding added in commit c5471e5b8b mixed up some variables,
whoops.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/598
2019-05-28 14:34:32 +00:00
80d11287eb cogl-path: Undeprecate framebuffer functions
It looks like deprecating the functions with explicit framebuffer/pipeline
arguments made it to (cogl) master by mistake:

https://mail.gnome.org/archives/clutter-list/2016-April/msg00008.html

We now use one of them, so this is a good time to undeprecate the lot.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/597
2019-05-27 22:48:19 +00:00
f869e4d54b headless-start-test: Ignore frame counter warnings
When running in slow or busy machines (hey CI!) or under valgrind headless
tests could fail because of a non fatal warning during initialization.

So define a fatal handler that ignores the frame counter warning.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/581
2019-05-27 17:26:30 -05:00
c1059df7f9 test-runner: Always wait after creating a window
Creating a window could take some time, causing false-positive failures when
running in slower or busy hardware like:

  window 1/2 isn't known to Mutter

So before we proceed in doing any operation on it, wait for the client.
Do this in the test runner instead of repeating the same in every .metatest.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/581
2019-05-27 17:23:55 -05:00
e3d3df985f gitlab-ci: Use G_SLICE=always-malloc in tests
This allows to catch errors better, as per MALLOC_CHECK_'s definition

https://gitlab.gnome.org/GNOME/mutter/merge_requests/581
2019-05-27 17:23:55 -05:00
86ff3dfb3c gitlab-ci: Print error logs on failures
https://gitlab.gnome.org/GNOME/mutter/merge_requests/581
2019-05-27 17:23:54 -05:00
7e0d185120 cogl/pipeline: Don't try to access to free'd pointer data
When free'ing a pipeline we destroy the BigState first and then the fragment and
vertex snippets lists using the big state pointer which is now invalid.
This causes a crash  when G_SLICE=always-malloc is set and using MALLOC_CHECK_.

So, invert the operations by free'ing the snippet lists first, and the big state
afterwards.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/581
2019-05-27 17:23:54 -05:00
61c173b777 cogl/xlib-renderer: Save Xlib renderer data in custom winsys pointer
XLib renderer saves its data as the object cogl user data, however this data
is free'd as part of the object destruction that happens before free'ing the
renderer in _cogl_renderer_free(), from where we're calling the renderer
disconnect vfunc.
Thus in _cogl_xlib_renderer_disconnect() we happen to get an invalid pointer to
CoglXlibRenderer and we try access to it in order to close the X11 display.

This causes all the cogl tests to crash when G_SLICE=always-malloc is set and
when using MALLOC_CHECK_.

Fix this using the renderer winsys custom data instead of using cogl object data
for storing the CoglXlibRenderer, and handling the destruction of it manually.

As bonus this also makes access to the renderer data faster.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/581
2019-05-27 17:14:25 -05:00
f99cd18254 clutter/tests/actor-destroy: Check destroying the actor clears the children
Commit df7d8e2cb highlights a crash on test_destroy_destroy, in fact it could
happen that calling clutter_actor_destroy on a child while iterating on the
list, would implicitly call test_destroy_remove that tries to modify the list
at the same time. Causing a memory error.

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/581
2019-05-27 17:14:25 -05:00
0405786573 wayland-seat: Use g_free to cleanup MetaWaylandSeat
MetaWaylandSeat is allocated using g_new0(), and thus we should use g_free() to
destroy it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/581
2019-05-27 17:14:25 -05:00
b016ff29f6 cursor-renderer-native: Free MetaCursorNativePrivate struct
Fix a small leak in native renderer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/581
2019-05-27 17:14:25 -05:00
3f2e86f67c theme: Remove DEBUG_FILL_STRUCT
This debug statement is actually applied all the times, while it could be useful
for crashes analysis, these days the same can be done using `MALLOC_CHECK_` and
`MALLOC_PERTURB_` env variables.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/581
2019-05-27 17:14:25 -05:00
0aa4a526c6 boxes: Use G_DEFINE_BOXED_TYPE to define the type
https://gitlab.gnome.org/GNOME/mutter/merge_requests/581
2019-05-27 17:14:25 -05:00
85c2aef4bc display: Cleanup Edges when display is closed
This could happen if closing the display when dragging a window, unlikely, but
better to use the cleanup function since we have it.

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

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

https://gitlab.gnome.org/GNOME/mutter/issues/494
2019-05-27 18:39:39 +00:00
b1ea768949 wayland: Drop -terminate argument to Xwayland
This argument instructs Xwayland to exit when there are no further
client connections. However we eventually want to handle restarts
ourselves (where, notably, mutter's will be at least the last client
connection).

This behavior could also induce race conditions on startup with clients
that quickly open and close a display, which is a more pressing issue.

Also, add -noreset back (which was also removed in commit 054c25f693 that
added -terminate). We don't want to reset the X server to a pristine state
in that situation either.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:31 +00:00
ea9d8a895b wayland: Drop error trap
Code underneath seems to handle errors properly, or be x11-agnostic
entirely, this is apparently here to save a few XSync()s on X11. Just
drop this windowing dependent bit to make things cleaner.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:31 +00:00
38432da328 compositor: Drop error trap
Code underneath seems to handle errors properly, and this is apparently
here to save a few XSync()s on X11. Just drop this windowing dependent
bit to make things cleaner.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:31 +00:00
430f354cd9 wayland: Split Xwayland initialization in 2 steps
It is now separated into meta_xwayland_start(), which picks an unused
display and sets up the sockets, and meta_xwayland_init_xserver(), which
does the actual exec of Xwayland and MetaX11Display initialization.

This differentiation will be useful when Mutter is able to launch Xwayland
lazily, currently the former calls into the latter.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:31 +00:00
1cf4279745 x11: Initialize GdkDisplay together with MetaX11Display
It's no longer a "singleton", since it might be closed and opened again.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:31 +00:00
7713006f5b x11: Unmanage X11 windows on MetaX11Display finalization
This used to be relied upon meta_display_close(), but MetaDisplay
and MetaX11Display lifetimes may be unrelated.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:31 +00:00
465e13128b core: Add explicit init/shutdown_x11() MetaDisplay calls
The lifetime of MetaX11Display is still tied to MetaDisplay, but these
calls will be useful when it's actually affordable to decouple those.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:31 +00:00
86de79cfc5 core: Untangle input focus management
In all places (including src/wayland) we tap into meta_x11_display* focus
API, which then calls meta_display* API. This relation is backwards, so
rework input focus management so it's the other way around.

We now have high-level meta_display_(un)set_input_focus functions, which
perform the backend-independent maintenance, and calls into the X11
functions where relevant. These functions are what callers should use.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:31 +00:00
1d77641f0b x11: Separate X11 focus handling into MetaX11Display method
Updating the MetaWindow focus and the X Window focus is interrelated but
independent. Call one after the other in the places we handle window focus
changes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:31 +00:00
2f217109aa core: Relax requirement that MetaWindow shall have icon/mini-icon
We use a GtkIconTheme (thus icon-theme, thus xsettings, thus x11) just to
grab a "missing icon" icon to show in place. Relax this requirement that
surfaces for icon/mini-icon will be set, and just let it have NULL here.

It seems better to have the callers (presumably UI layers) aware of this
and set a proper icon by themselves, but AFAICS there is none in sight,
not even plain mutter seems to use MetaWindow::[mini-]icon. Probably
worth a future cleanup.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:31 +00:00
5e0523cc8b x11: Move X11 calls to map/unmap a MetaWindow to MetaWindowX11
Add 2 vmethods so that MetaWindowX11 may handle the X11 calls itself.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:31 +00:00
dbe6e01e12 core: Separate checks for pointer barriers availability
If the check happens on --nested (X11 backend) while there is no X11
display we would get a crash. Since the barriers are non-effective on
nested, just take it out into a separate condition.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:31 +00:00
103c469cc9 core: Avoid grab transfer shenanigans with non-X11 backend
This explicit ungrab is made to ensure the other X11 display connection
is able to start an active grab immediately on the device without receiving
AlreadyGrabbed.

This is just relevant if there's two X11 display connections to transfer
grabs across, which may just happen on X11 windowing.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:31 +00:00
ef074ea510 x11: Add MetaX11Stack object
This object takes care of the X11 representation of the window stack,
namely the _NET_CLIENT_LIST and _NET_CLIENT_LIST_STACKING root window
properties.

This code has been lifted from src/core/stack.c into src/x11 as it's
dependent on the X11 display availability. This also leaves MetaStack
squeaky clean of x11 specifics.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:31 +00:00
39bac6eabd core: Turn MetaStack into a GObject
So we can have it emit signals and whatnot. Those are unused, yet.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:30 +00:00
0200f4fcd9 x11: Move focus sentinel to MetaX11Display
This focus sentinel is a mechanism to avoid some X11-specific race
conditions in focus-follows-pointer, using X11 mechanisms. Move it to
MetaX11Display altogether.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
2019-05-24 15:30:30 +00:00
439afb3f19 window: Move all attached windows with parent
We'd break the loop for moving attached windows at the first window,
meaning we'd only ever move a single attached dialogs or popup if it was
the first window in the list. This doesn't work out well when there are
multiple popups open, so don't break out of the loop at all until all
windows are potentially moved.

This fixes an issue in gtk4 where one or more non-grabbing popups would
end up unattached if there were more than one and the parent window was
moved.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/592
2019-05-24 15:07:03 +00:00
b01edc22f3 backends/x11: Do not reload keymap on new keyboard notifications
XkbNewKeyboardNotify informs the client that there is a new keyboard
driving the VCK. It is essentially meant to notify that the keyboard
possibly has a different range of HW keycodes and/or a different
geometry.

But the translation of those keycodes remain the same, and we don't
do range checks or geometry checks (beyond using KEY_GRAVE as "key
under Esc", but that is hardly one). It seems we can avoid the
busywork that is releasing all our passive grabs, reloading the keymap
and regenerating the keycombos and restoring the passive grabs.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/398
2019-05-24 11:28:07 +02:00
e8bca5052a ci: Make MALLOC_PERTURB_ less random
The point is to not initialize to some non-zero value to find places
incorrectly relying on blocks being zero initialized. Thus, there is no
reason to have a different random number each time, and by having it the
same, we have slightly more reproducable triggers, would we ever trigger
anything due to this.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/591
2019-05-24 10:57:46 +02:00
468882ecec ci: Run dconf update before running tests
Otherwise tests will fail due to the following warning:

(mutter-test-runner:3700): dconf-WARNING **: 06:39:42.124: unable to
open file '/etc/dconf/db/local': Failed to open file
“/etc/dconf/db/local”: open() failed: No such file or directory; expect
degraded performance

https://gitlab.gnome.org/GNOME/mutter/merge_requests/591
2019-05-24 09:23:22 +02:00
be3c89d823 Bump version to 3.33.2
Update NEWS.
2019-05-22 18:15:34 +00:00
7719e33e68 wayland/pointer-constraints: Reject invalid lifetime
https://gitlab.gnome.org/GNOME/mutter/issues/425
2019-05-22 15:06:14 +00:00
deef9960a4 Fix typo in RemoteDesktop dbus api
https://gitlab.gnome.org/GNOME/mutter/merge_requests/586
2019-05-22 16:21:57 +02:00
9305b6d8ee cogl/tests: Remove configure_file workaround for installed tests
Since starting meson 0.50 `install: false` is honored when the install_dir is
set to a non-empty value, we can now remove the workaround we added in commit
dbe73c329

https://gitlab.gnome.org/GNOME/mutter/merge_requests/585
2019-05-21 12:36:15 -05:00
62de4b4f82 meson: Bump meson requirement to 0.50.0
We've been using configure_file's `install` property for some time now, but this
has been officially supported and works as expected only since meson 0.50, so,
bump version to avoid warnings and ensure the behavior is the one we want.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/585
2019-05-21 12:36:13 -05:00
ea0a89bde8 cogl/meson: Remove uneeded cogl-mutter-config.h generation
This was needed until we had autotools in place.

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

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/281
2019-05-21 16:23:49 +00:00
91ac64bb44 drm-buffer: Make the "types" actual types
There is no reason why we should have an internal type enum when we have
all the infrastructure to just use multiple GObject types. Also there
was no code sharing between the old "types", the only common API was
getting the framebuffer ID, so lets make that a vfunc.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/584
2019-05-21 14:55:38 +00:00
ed56edc7ba drm-buffer: Remove useless soft-asserts
If triggered, many would result in crashes later anyway, so lets change
those to asserts. Some are simply useless, so remove those.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/584
2019-05-21 14:55:38 +00:00
6eeba2434a drm-buffer: Clean up file descriptor variable naming
Nowhere else is it called 'drm_fd' so lets not get rid of this
inconsistency.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/584
2019-05-21 14:55:38 +00:00
7fb7b28cd6 kms-buffer: Rename to MetaDrmBuffer
MetaKms* will be a dedicated namespace, which MetaKmsBuffer doesn't fit
under.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/584
2019-05-21 14:55:38 +00:00
08aec58c22 kms-buffer: Clean up include order
https://gitlab.gnome.org/GNOME/mutter/merge_requests/584
2019-05-21 14:55:38 +00:00
52945f383d launcher: Explicitly look up object path for seat
If mutter is running as a systemd user service, then we cannot use the
magic "self" session for the ID lookup. For now we need to lookup the ID
explicitly. Eventually we can change to use the magic "auto" paths for
both the session and seat, but that will require systemd v243.

See also https://github.com/systemd/systemd/pull/12424#issuecomment-487962314

https://gitlab.gnome.org/GNOME/mutter/merge_requests/571
2019-05-21 16:43:09 +02:00
fecc57ddf0 renderer-native: Reference count front buffers
Start reference counting front buffers instead of assuming we know
their (scanout) lifetimes.

Functionally, this should not change anything.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/119
2019-05-21 15:49:42 +02:00
0d7a929b83 cogl: Map CoglPixelFormats to their specific properties
By providing an (internal) table to map `CoglPixelFormat`s to their
respective properties  we will be able to get rid of the unusual enum
values in the future. This is something we will need once we want to
have support for more pixel formats (such as YUV-based formats).

As an extra feature, we provide a `to_string()` method, which is quite
useful for debugging purposes (rather than deciphering enum values).

https://gitlab.gnome.org/GNOME/mutter/merge_requests/524
2019-05-21 15:20:44 +02:00
991f9505ad cogl: Put CoglPixelFormat code into its own file
We're going to add some features and extra code to CoglPixelFormat, so
it's much nicer to have it in once place. Notice also that it doesn't
make sense that e.g. `_cogl_pixel_format_get_bytes_per_pixel()` were in
a private header, since they were being exported anyway.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/524
2019-05-21 15:20:44 +02:00
358b67871f boxes: Assign input to output rect when there's no transformation
https://gitlab.gnome.org/GNOME/mutter/merge_requests/469
2019-05-21 08:50:09 +00:00
2b1acea1b0 place: Assign anchor rect using automatic copy
Set the offsets in different statements.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/469
2019-05-21 08:50:09 +00:00
91aee3d5c4 monitor: Assign monitor layout directly by crtc rect
There's no need to repeat what gcc can do alone.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/469
2019-05-21 08:50:09 +00:00
02812fb988 clutter/stage-cogl: Damage fb using ceiled scaled sizes
https://gitlab.gnome.org/GNOME/mutter/merge_requests/469
2019-05-21 08:50:09 +00:00
29211c9020 clutter/util: Fix styling on functions definitions
https://gitlab.gnome.org/GNOME/mutter/merge_requests/469
2019-05-21 08:50:09 +00:00
68fba458b3 boxes: Ensure we scale to a fully rounded rectangle
In order to scale a rectangle by a double value, we can reuse a ClutterRect
to do the scale computations in floating point math and then to convert it back
using the proper strategy that will take in account the subpixel compensation.

In this way we can be sure that the resulting rectangle can fully contain the
original scaled one.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/469
2019-05-21 08:50:09 +00:00
9c2fdcdbb2 ci: Update Dockerfile to :v2
This commit is a bit deceitful: The main change in the image is *not* the
more recent Fedora base, but an updated (and not backward-compatible)
evolution-data-server package from the fmuellner/gnome-shell-ci copr.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/501 ports
gnome-shell to the new API, so to keep mutter and gnome-shell CI
working after that change, we need to build against the correct
EDS version.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/582
2019-05-20 19:44:57 +02:00
d4a0893d76 ci: Disable a11y bus for tests
While the regular session bus is provided by `dbus-run-session`, the
a11y bus is spawn by the "normal" D-Bus daemon (that is, dbus-broker
in F30). This currently fails, either due to a bug or some missing
dependencies in the container environment. But as we don't actually
need the additional bus, just disable it via the environment to make
not break tests when updating the base image to F30.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/582
2019-05-20 19:44:09 +02:00
7a6c755833 clutter: Add fribidi dependency and copy deprecated pango functions
Pango functions pango_unichar_direction() and pango_find_base_dir() have been
deprecated in pango 1.44, since these are used mostly clutter and gtk, copy the
code from pango and use fribidi dependency explicitly.

This is the same strategy used by Gtk.

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

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

**Example**

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

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

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

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

```

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

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

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

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

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

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

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

v2: adjust variable names and code style.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/520
2019-05-16 22:13:54 +00:00
e96136e418 gitlab-ci: Use MALLOC_CHECK_ and MALLOC_PERTURB_ env variables in tests
Linux glibc supports a malloc implementation that is allows to be tunable using
environment variables, to check allocation issues.

When MALLOC_CHECK_ is set to 3, a diagnostic message is printed on stderr and
the program is aborted.

Setting the MALLOC_PERTURB_ environment variable causes the malloc functions in
to return memory which has been wiped and initialized with the byte value of the
environment variable.

So use this features when running tests in order to catch better memory errors.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/578
2019-05-16 21:30:36 +00:00
eae6e7a889 Updated Spanish translation 2019-05-16 12:42:33 +02:00
a48b6cc9ca clutter/actor: Fix a wrong comment
https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
2019-05-15 20:38:28 +00:00
786305f7d6 clutter/input-device: Replace device check with assertion
We only call _clutter_input_device_update with devices that are not
Keyboard devices. Also passing a Keyboard device to a function whose
primary purpose is picking should be considered a bug in the caller.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
2019-05-15 20:38:28 +00:00
f7ecf3b618 meta: Remove meta_free_gslist_and_elements
This function was added for historic reasons, before that we had GSlist's
free_full function.

Since this can be now easily implemented with a function call and an explicit
GDestroyFunc, while no known dependency uses it let's move to use
g_slist_free_func instead.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/57
2019-05-15 14:49:56 -05:00
7a17e236f7 Use free_full on GSList's instead of foreach + free
GList's used in legacy code were free'd using a g_slist_foreach + g_slist_free,
while we can just use g_slist_free_full as per GLib 2.28.

So replace code where we were using this legacy codepath.

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

So replace code where we were using this legacy codepath.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/576
2019-05-15 14:42:25 -05:00
9e82f9af25 x11: Do not warn on cancelled X11 selection sources
This shouldn't happen frequently, but is just a sign that the source is
being replaced by something else. Just keep the warning for other possible
error situations.

Also, plug the potential GError leak.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/598
2019-05-15 13:14:12 +00:00
329c4bc5b3 Bump version to 3.33.1
Update NEWS.
2019-05-14 18:14:48 +00:00
706c5a7565 clutter: LEQUAL depth_testing on ClutterDeformEffect
Moving an actor with a ClutterDeformEffect applied flickers because
the depth_testing, setting the depth testing test function to
COGL_DEPTH_TEST_FUNCTION_LEQUAL fixes the problem.

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/396
2019-05-13 09:44:50 +00:00
dae2c1d420 backends/native: Add rt-scheduler experimental key to set RT scheduling
This is similar to a change in kwin:
https://blog.martin-graesslin.com/blog/2017/09/kwinwayland-goes-real-time/

If the experimental features key has "rt-scheduler", make it claim the lowest
of RT scheduler priorities, this will be both educated to other RT processes
and improves responsiveness wrt all other processes.

This can only work if mutter/gnome-shell process receives CAP_SYS_NICE
somehow, e.g.: "setcap CAP_SYS_NICE=+ep `which gnome-shell`"

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/921
https://gitlab.gnome.org/GNOME/mutter/merge_requests/460
2019-05-10 21:47:53 +00:00
01d0316fd7 wayland/dnd-surface: Propagate commit to parent class
We need to call the underlying actor-surface so the actor
state is synced, otherwise surface state like the scale factor
does not get applied.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/537
2019-05-09 09:06:52 +00:00
7e2a0ede16 wayland: Move check for present window out of the actor-surface class
All child classes of `MetaWaylandShellSurface` as well as
`MetaWaylandSurfaceRoleXWayland` should only sync their actor if
their toplevel surface has a window. Currently this check is done
in the actor-surface class, but not all surface classes have a
toplevel window, e.g. dnd-surfaces.
Move the check to the right places.

For subsurfaces this assumes that the subsurface is not the child of
a window-less surface (like, as stated above, e.g. a dnd-surface).
If we want to support subsurfaces of window-less surfaces in the future
we have to extend the check here.
But as this is not a regression, ignore this case for now.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/537
2019-05-09 09:06:52 +00:00
7738b5c00b core/window: Fix copy/paste error in size-changed docs
It appears it was copied from MetaWindow::position-changed and pasted
for MetaWindow::size-changed, without updating all the words.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/567
2019-05-08 09:28:16 +00:00
454651f79f Update Indonesian translation 2019-05-07 07:14:36 +00:00
bf8bc65cc9 core: Check environment variables before giving to GAppLaunchContext
Depending on the type of session, one or the other might be NULL, which
is not meant to be handled by these functions. Check for both DISPLAY
envvars before setting them on the GAppLaunchContext.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/586
2019-05-06 17:27:56 +02:00
6a89e7969f Update Friulian translation 2019-05-03 17:43:01 +00:00
3ffc4f8876 ci: Use mutter image to build GNOME Shell
https://gitlab.gnome.org/GNOME/mutter/merge_requests/548
2019-05-03 14:15:31 -03:00
b4d973fbe4 ci: Update gsettings-desktop-schema URLs
Copr keeps changing them.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/548
2019-05-03 14:15:31 -03:00
da1e917b38 ci: Add GNOME Shell dependencies to Dockerfile
Embrace, extend and (soon) extinguish GNOME Shell's CI
image.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/548
2019-05-03 14:15:30 -03:00
160d2d56d9 ci: Install to Mutter and GNOME Shell to /usr
So GNOME Shell can find the pkg-config files properly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/548
2019-05-03 14:15:30 -03:00
3468144847 ci: Build GNOME Shell at the test stage
Hopefully this will allow us prevent merging branches
that accidentally break GNOME Shell.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/548
2019-05-03 14:15:30 -03:00
ae6d9e35bd backends: Fallback to builtin panel for devices where all heuristics fail
This is 1) relatively likely as not all touchscreens are nice enough to
report a device size that will help us here and 2) Better than nothing if
everything fails anyway, as it will break on multi-monitor and non-default
monitor rotations.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/581
2019-05-03 15:01:47 +00:00
ac15a8abca Updated Spanish translation 2019-05-03 14:31:16 +02:00
5480a3f238 Update POTFILES.in 2019-05-03 12:54:24 +02:00
0d50a37091 display: Fix a possible bug in meta_display_sync_wayland_focus
The check for the focus xwindow is called, but not used. Fix that by
renaming the variable to reflect better what it does and actually using
the return value of the check.

This was the original intention of the author in commit
05899596d1 and got broken in commit
8e7e1eeef5.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/535
2019-05-02 23:54:22 +00:00
1ca0fdc928 idle-monitor: Postpone dispatching of idle timeout if not ready
If we update the ready time while the source is already in the
to-dispatch list, changing the ready time doesn't have any effect, and
the source will still be dispatched. This could cause incorrect idle
watch firing causing the power management plugin in
gnome-settings-daemon to sometimes turn off monitors due to it believing
the user had been idle for some time, while in fact, they just logged
back in.

Fix this by not actually dispatching the idle timeout if the ready time
is in the future when actually dispatching.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/543
2019-05-02 23:46:43 +00:00
23a8ea2821 idle-monitor: Use G_SOURCE_CONTINUE instead of TRUE
Returning TRUE is confusing, as it doesn't carry any relevant meaning.
Use G_SOURCE_CONTINUE to make it clearer that the source is here to
stay.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/543
2019-05-02 23:46:43 +00:00
ee4bb2240b workspace: Activate a window also if it's already in workspace
meta_workspace_activate_with_focus is supposed to focus the passed window after
switching the workspace.

However if the passed workspace is already the active one, we just return
without activating the window.
So fix this calling meta_window_activate on the foucs_this window if that is
valid.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/562
2019-05-02 17:33:17 -05:00
81ae886dda cogl/tests: Use less verbose run-tests.sh on single tests run by meson
Use less verbose output when run-tests.sh is running only a test and we're
requested for less verbose output.

Also write the test name first of running it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
63c40a9711 meson: Define srcdir and builddir using meson functions
No need to redefine paths starting from top src/build dirs, as meson can give us
this information for free using its functions.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
8374be46d2 cogl/tests: Export and run unit tests if they are enabled
Cogl unit tests are just functions inside normal code files that needs to be
dload'ed by the test binary.

So in case unit-tests are enabled, we need to export those symbols.
Since map file can't be overridden, use a configure_file to generate the map
file when tests are enabled, in order to export the needed symbols.

Then goes through the source files to look unit tests checking for their macro
definition and load them with the runner script.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
5d1a87d355 meson: Add option flags to control test suites building
Now the `tests` meson option controls weather we should build all the test suites
while `core_tests` controls mutter tests.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
34312c272b cogl/tests: Run conform tests as single meson tests
Use find-conform-unit-tests.sh to create a meson list of tests to run.
This allows to run each test as single test with meson and to remove the timeout
for all the tests.

Instead of changing 'run-tests.sh' to take test-names as arguments we can just
generate simple dummy test-files for each test, without having to change the
tooling.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
2b8f5e65b6 cogl/tests: Run tests supports both test names and files as parameter
Make run-tests.sh to support as arguments both an unit-tests file or test names

This allows to run a test with this script without having to create fake files.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
c6d1cf4af4 tests: Add single stacking tests with suite
Don't launch the stacking tests in one single shot, to allow better debugging
and being able to launch just one single test using meson test.

Those tests can now be all launched with:
  meson test --suite stacking [single-test-name]

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
8dbe4210b4 tests: Add missing stacking tests
List all .metatest files that were added only to autotools while they are
missing since the meson port.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/442
2019-05-02 19:56:23 +00:00
02c99524bf Make MetaSelection, MetaSelectionSource and MetaMemorySelectionSource public
This exposes the base so that we can reimplement StClipboard on top. Some
gtk-docs have been added for documentation and introspection purposes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 16:31:45 +02:00
17d00d49d4 wayland: Reduce MetaXWaylandSelection to just DnD
All the actual selection management functionality is superseded by
MetaSelection. Reduce it to just handling the XDND messaging and leave
selections to MetaSelection.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 16:31:45 +02:00
634f512bb0 wayland: Integrate with MetaSelection
Make MetaWaylandDataDevice use MetaSelection and MetaSelectionSource to
handle primary/clipboard/dnd.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 16:31:45 +02:00
5c009c20ab core: Add clipboard manager
This is a simple clipboard manager implementation on top of MetaSelection.
It will inspect the clipboard content for UTF-8 text and image data whenever
any other selection source claims ownership, and claim it for itself
whenever the clipboard goes unowned.

The stored text has a maximum size of 4MB and images 200MB, to prevent the
compositor from allocating indefinite amounts of memory.

This is not quite a X11 clipboard manager, but also works there.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 16:22:45 +02:00
535ce00abb core: Add memory-based selection source
This is a simple implementation of a MetaSelectionSource, able to hold a
single mimetype, provided as GBytes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 16:22:45 +02:00
37144f0609 x11: Add X11 selection management
This code takes care of both setting up X11 selection sources whenever
X11 clients claim selection ownership, and claiming selection ownership
on a mutter X11 window whenever other selection sources claim ownership.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 16:22:45 +02:00
ab76576340 core: Set up MetaSelection on MetaDisplay
https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 16:22:08 +02:00
09aa82db49 wayland: Add wayland MetaSelectionSource implementation
This object represents a Wayland selection owner. In order to invert the
FD direction (we hand an output fd, but want an inpu fd), create an
intermediate pipe so we can then create a GInputStream on top of it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 16:22:08 +02:00
c95db7c542 x11: Add X11 MetaSelectionSource implementation
This object represents the selection ownership from an X11 client. The
list of supported targets is queried upfront, so its initialization is
asynchronous. Requests to read contents from the selection will hand
a MetaX11SelectionInputStream.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 16:22:08 +02:00
a984622cd1 core: Add MetaSelection and MetaSelectionSource
MetaSelectionSource represents a primary/clipboard/dnd selection owner,
it is an abstract type so wayland/x11/etc implementations can be provided.
These 3 selections are managed by the MetaSelection object, the current
selection owners will be set there, and signals will be emitted so the
previous selection owner can clean itself up.

The actual data transfer is done through the meta_selection_transfer_async()
call, which will take a GOutputStream and create a corresponding
GInputStream from the MetaSelectionSource in order to splice them.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 16:22:08 +02:00
156980eff9 x11: Add X11 selection input/output streams
These are rip off of GTK+ ones, with some adaptions to integrate them in
mutter event dispatching code and make them easier to use in future
commits.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
2019-05-02 15:40:13 +02:00
736cac43e9 compositor: Remove unused background_actor private reference
https://gitlab.gnome.org/GNOME/mutter/merge_requests/556
2019-04-30 16:15:42 -05:00
3ba79961fe compositor: Disconnect from stage signals on destruction
From this point there's not any need for the compositor to listen to signals
so we can disconnect from the stage ones we are connected to.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/556
2019-04-30 16:15:42 -05:00
7718e67f5c compositor: Destroy window actors list on destruction
When the compositor is destroyed we should cleanup the list of window actors we
created and destroy them.
Since all the actors are added to the window_group or top_window_group we can
just destroy these containers (together with the feedback_group), and simply
free the windows list.

This is particularly needed under X11 because before we destroy the display, we
might do some cleanups as detaching the surface pixmaps and freeing the damages
and if this happens at later point (for example when triggered by garbage
collector in gnome-shell), we might crash because the x11 dpy reference is
already gone.

Destroying the window actors instead, ensures we avoid any further call to X11
related functions and that we release the actors XServer resources.

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

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

Related: https://gitlab.gnome.org/GNOME/mutter/issues/556
2019-04-30 13:12:53 +00:00
502da973eb window: free close dialog before unmanaging window from compositor
When an application stops responding, the shell darkens its windows.

If a window from a not-responding application gets unmanaged
then the shell will currently throw an exception trying to retrieve
the now-dissociated window actor.

That leads to a "stuck window" ghost on screen and a traceback
in the log.

This commit addresses the problem by making sure the effect is cleaned
up before the actor is disocciated from its window.

https://gitlab.gnome.org/GNOME/mutter/issues/575
2019-04-29 14:06:12 -04:00
eccf7b105c input-settings: Use 0 initialized struct for kbd a11y
Make sure our keyboard accessibility settings structure is all zero
initialized, to avoid potential padding issues on some platform when
comparing settings.

Reported by Daniel van Vugt on IRC.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/552
2019-04-26 11:17:50 +02:00
bcee890434 ci: Ensure we clone a deep enough history for commit review
It seems gitlab changed something recently in the default clone depth
which made MRs with >10 commits to obscurely fail in the review stage.
As per https://docs.gitlab.com/ee/ci/yaml/#shallow-cloning, bump it
to 100 to allow bigger MRs.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/551
2019-04-24 12:29:22 +02:00
251fa024c4 clutter/x11: disable mousekeys with Numlock ON
GNOME documentation on accessibility features states that mousekeys
work only when NumLock is OFF:

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

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

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

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

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

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

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/530
2019-04-19 13:51:35 +00:00
7df86fb246 cogl: Use EGL_IMG_context_priority if available
We're the context closest to the display, so we should take priority
over other clients.

v2: Warn if we asked for a high-priority context and didn't get one.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/454
2019-04-18 20:27:26 +00:00
3f29b47809 cogl: Generalize EGL context attribute initialization
No functional change, just makes the next change clearer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/454
2019-04-18 20:27:26 +00:00
9ab3a02a8a cogl: Remove unused TEXTURE_RECTANGLE feature flag
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:28 -04:00
ca2be8ef5b cogl: Remove CoglTextureType
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:26 -04:00
1783ea5af1 cogl: Remove unused texture_type argument from cogl_pipeline_set_layer_null_texture
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:24 -04:00
862e56f01d cogl: Remove unused CoglTextureVable::get_type
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:21 -04:00
2b9cd50e84 cogl: Eliminate _cogl_gl_util_get_texture_target_string
Its results are effectively constant now. Fold them into the callers and
remove the function.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:19 -04:00
e71f44dbd6 cogl: Remove never-changing COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE state
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:17 -04:00
c881b4970d cogl: Remove unused CoglTextureRectangle
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:16 -04:00
d79f176142 cogl: Remove texture_rectangle awareness from the GLX TFP code
GL 2.1 implies ARB_texture_non_power_of_two so this will never be hit.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:14 -04:00
ce6acf9dca cogl: Remove rectangle-texture tests
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:12 -04:00
2a15e5f16a compositor: Drop ARB_texture_rectangle awareness
The GL/GLES versions we require imply full NPOT texture support, so the
ARB_texture_rectangle path will never be hit.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:10 -04:00
fb40e2eefb cogl: Remove unused cogl_texture_new_from_foreign
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:09 -04:00
fc09fa50a5 cogl: NPOT textures are always available
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:07 -04:00
48f04c7968 cogl: COGL_FEATURE_TEXTURE_NPOT_BASIC is always available
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:06 -04:00
007297f1a6 cogl: COGL_FEATURE_TEXTURE_NPOT_MIPMAP is always available
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:04 -04:00
302a171c08 cogl: COGL_FEATURE_TEXTURE_NPOT_REPEAT is always available
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:03 -04:00
893e894fff cogl: Remove always-true COGL_FEATURE_SHADERS_GLSL
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:53:01 -04:00
2aaed7bdfc cogl: Remove debug disables for GLSL and NPOT textures
https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:52:57 -04:00
249f9a4a2e cogl: Stop running non-NPOT tests
The minimum GL/GLES versions require working NPOT textures.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/546
2019-04-18 12:52:54 -04:00
68166f33d9 cogl: Fix some misleading variable names
This was clearly blindly copypasta'd from the (now deleted) 3D texture
code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/487
2019-04-18 01:26:32 +00:00
28954e8271 cogl: Remove unused 3D texture support
We're not using this, and it's difficult to imagine we ever would.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/487
2019-04-18 01:26:32 +00:00
22884b0b00 shaped-texture: Use draw_rectangle() for full paints
This reverts a change introduced in edfe5cc3 to use `paint_clipped_rectangle()`
instead of `cogl_framebuffer_draw_rectangle()` for full paints as it
contained logic necessary for viewport src-rects. This is not longer the case.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/504
2019-04-17 20:28:43 +00:00
d2415da0d4 shaped-texture: Use CoglMatrix for viewport src-rect
This brings the viewport src-rect code in line with how we handle
transforms, by applying a `CoglMatrix` to the pipeline instead of
changing the paint logic.
It also fixes not-y-inverted textures in combination with
transforms.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/504
2019-04-17 20:28:43 +00:00
96f7bf28f1 shaped-texture: Add checks to viewport reset functions
The set and reset functions are unconditionally called on every
commit. Add missings checks to the reset functions to bail out if
nothing changed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/504
2019-04-17 20:28:42 +00:00
db486ad897 cogl/texture-2d: Remove notes about COGL_FEATURE_ID_TEXTURE_NPOT
NPOT capabilities were made madatory in OpenGL 2.0 and GLES 2.0,
so let's stop encouraging developers to write new code with checks
for it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/467
2019-04-17 20:14:59 +00:00
8180927de2 cogl: Bump minimum GLES version to 2.0
This is already effectively true because there is only a GLSL backend.
It also implies OES_texture_npot.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/489
2019-04-17 20:06:47 +00:00
191c31b0f0 cogl: Bump minimum GL version to 2.1
We already effectively require GLSL, because there's no fixed-function
backend anymore. OpenGL 2.0 drivers don't really exist in the wild, so
just go ahead and require 2.1 or better. 2.1 implies GLSL 1.20 or
better, so simplify that as well.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/489
2019-04-17 20:06:47 +00:00
a94841abf1 cogl: Remove color write masks from the framebuffer and pipeline API
The only thing using this is its own tests, and it's difficult to
imagine a real use for it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/468
2019-04-17 19:57:14 +00:00
b624e94ab1 cogl: Remove viewport scissor workaround
This is effectively a revert of:

    commit 6cfc93f26f
    Author: Robert Bragg <robert@linux.intel.com>
    Date:   Tue Oct 2 11:44:00 2012 +0100

        clip-stack: workaround intel gen6 viewport clip bug

It's been over six years, if this bug is still present we should just
fix Mesa already.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/481
2019-04-17 19:48:03 +00:00
e3f3274bbf Bump version to 3.32.1
Update NEWS.
2019-04-17 19:40:01 +02:00
d2ca5cc26b display: Fix inconsistent behavior with demand attention
When focus stealing prevention kicks in, mutter would set the demand
attention flag on the window.

Focus stealing prevention would also prevent the window from being
raised and focused, which is expected as its precisely its purpose.

Yet, when that occurs, the user expects the window which has just been
prevented from being focused to be the next one in the MRU list, so
that pressing [Alt]-[Tab] would raise and give focus to that window.

This works fine when the window is placed on the primary monitor, but
not when placed on another monitor, in which case the window which has
been denied focus is placed ahead of the MRU list and pressing
[Alt]-[Tab] would leave the focus on the current window.

This is because of a mechanism in `meta_display_get_tab_list()` which
forces the windows with the demand attention flag set to be placed first
in the MRU list when they're placed on a workspace different from the
current one.

But because workspaces apply only to the primary monitor (by default),
the windows placed on other outputs have their workspace set to `NULL`
which forces them ahead of the MRU list by mistake.

Fix this by using the appropriate `meta_window_located_on_workspace()
function to check if the window is on another workspace.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/523
2019-04-17 18:53:04 +02:00
3de6f7ebfe core: Emit MetaStartupNotification::changed on sequence completion
This way handlers that want to know the get_complete() status will be able
to do so without further delays.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/541
2019-04-17 18:42:09 +02:00
38ff01d6d0 core: Add MetaStartupSequence::complete signal
It was a vfunc so far, but we want things subscribing to it.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/541
2019-04-17 18:42:04 +02:00
40103d6f41 core: Account for completed sequences in feedback updates
The sequences may stay completed in the list (eg. pending a focus request),
it's then confusing to show the "wait" cursor icon until they are really
gone.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/541
2019-04-17 18:42:00 +02:00
ab7ef5f8bf core: Fix differing sequence timestamp precision expectations
Calculations were being done at places accounting on usec precision,
however those are still treated as having msec precision at places. Let's
consolidate for the latter since it requires less changes across the board
and usec precision doesn't buy us anything here.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/541
2019-04-17 18:41:13 +02:00
2c1a951b6e wayland/output: Set user data of xdg_output resource
mutter would randomly crash in `send_xdg_output_events()` when changing
the fractional scaling:

  wl_resource_post_event ()
  zxdg_output_v1_send_logical_size ()
  send_xdg_output_events ()
  wayland_output_update_for_output ()
  meta_wayland_compositor_update_outputs ()
  on_monitors_changed ()
  g_closure_invoke ()
  signal_emit_unlocked_R ()
  g_signal_emit_valist ()
  _signal_emit ()
  meta_monitor_manager_notify_monitors_changed ()
  meta_monitor_manager_rebuild ()

This is because the xdg-output resource got freed but wasn't removed
from the list of resources.

Fix this by setting the user data of the xdg-output resource to the
corresponding `MetaWaylandOutput` so that the xdg-output resource
destructor can remove it from the list of resources.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/538
2019-04-15 15:41:47 +02:00
6ec330ccfa keybindings: Stop keybinding if a touch happens while Super is pressed
We use the combination of pressing Super and clicking+moving the mouse
to drag windows around and we also support pressing Super and using the
touchscreen to drag windows.

Since we don't want to show the overview when the Super key was used to
initiate a window drag, prevent showing the overview in case a
TOUCH_BEGIN or TOUCH_END event happened during the key was pressed.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/495
2019-04-15 11:10:47 +00:00
20c1295a33 cogl-winsys-glx: Fix frame notification race/leak
If a second `set_{sync,complete}_pending` was queued before the idle
handler had flushed the first then one of them would be forgotten.
It would stay queued forever and never emitted as a notification.

This could happen repeatedly causing a slow leak. But worse still,
`clutter-stage-cogl` would then have `pending_swaps` permanently stuck
above zero preventing the presentation timing logic from being used.

The problem is that a boolean can only count to one, but in some cases
(triple buffering, whether intentional or accidental #334) we need it to
count to two. So just change booleans to integers and count properly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/216
2019-04-12 11:09:00 +08:00
fa4a787386 clutter/evdev: Toggle accessibility features from keyboard
The keyboard accessibility setting "enable" is actually even more
misleading that initially anticipated, as it does not control the
entire keyboard accessibility feature, but just the "enable by
keyboard" feature, i.e. being able to enable or disable stickykeys
or slowkeys using various keyboard actions.

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/531
2019-04-11 13:51:43 +00:00
28419cdedf renderer/native: Check primary GPU supports EGL
Since "renderer/native: make EGL initialization failure not fatal" it is
possible, under specific failure conditions, to end up with a primary GPU whose
EGL initialization failed. That cannot work.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/521
2019-04-11 15:11:41 +03:00
3b46a8cd70 renderer/native: Make EGL initialization failure not fatal
The failure to initialize EGL does not necessarily mean the KMS device cannot
be used. The device could still be used as a "secondary GPU" with the CPU copy
mode.

If meta_renderer_native_create_renderer_gpu_data () fails,
meta_renderer_native_get_gpu_data () will return NULL, which may cause crashes.
This patch removes most of the failures, but does not fix the NULL dereferences
that will still happen if creating gpu data fails.

This patch reorders create_renderer_gpu_data_gbm () so that it fails hard only
if GBM device cannot be created, and otherwise always returns an initialized
gpu data structure. Users of the gpu data structure are responsible for
checking egl_display validity.

The GBM device creation failure is a hard failure because presumably GBM is
necessary for cursors.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/542
https://gitlab.gnome.org/GNOME/mutter/merge_requests/521
2019-04-11 15:11:41 +03:00
b2d0184c6e renderer-native: Freeze frames while retrying to page flip
We're currently always waiting for unfinished page flips before flipping
again. This is awkward when we are in an asynchronous retry-page-flip
loop, as we can synchronously wait for any KMS page flip event.

To avoid ending up with such situations, just freeze the frame clock
while we're retrying, then thaw it when we succeded.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/506
2019-04-02 13:50:00 +00:00
808a75b231 renderer-native: Add helper to get backend from renderer
https://gitlab.gnome.org/GNOME/mutter/merge_requests/506
2019-04-02 13:49:59 +00:00
88e4ff7409 backend: Add API to freeze/thaw frame clock
It's just a thin wrapper around the ClutterStage API, with the intention
to hide the awkward nest of interdependent backends.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/506
2019-04-02 13:49:59 +00:00
3cc3b7526c renderer-native: Fake page flipping slower when power saving
We rely on the frame clock to compress input events, thus if the frame
clock stops, input events are not dispatched. At the same time, there
is no reason to redraw at a full frame rate, as nothing will be
presented anyway, so slow down to 10Hz (compared to the most common
60Hz). Note that we'll only actually reach 10Hz if there is an active
animation being displayed, which won't happen e.g. if there is a screen
shield in the way.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/506
2019-04-02 13:49:59 +00:00
53b59d8bff renderer-native: Fake page flipped if power saving when retrying
When we're in a page-flip retry loop due to the FIFO being full
(drmModePageFlip() failing with EBUSY), we should not continue to try
when starting to power save, as that means we're blocking new frames,
which itself blocks input events due to them being compressed using the
frame clock.

We'd also hit an assert assuming we only try to page flip when not power
saving.

Thus, fake we flipped if we ended up reaching a power saving state while
retrying.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/506
2019-04-02 13:49:59 +00:00
40e7e5d356 renderer-native: Fix page flip retry timeout calculation
It tried to add a (implicitly casted) float to a uint64_t, and due to
floating point precision issues resulted in timestamps intended to be
in the future to actually be in the past. Fix this by first casting the
delay to an uint64_t, then add it to the time stamp.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/506
2019-04-02 13:49:59 +00:00
4cae9b5b11 monitor-manager: Clean up DPMS state tracking
DPMS is configured from a bit all over the place: via D-Bus, via X11 and
when reading the current KMS state. Each of these places did it slightly
differently, directly poking at the field in MetaMonitorManager.

To make things a bit more managable, move the field into a new
MetaMonitorManagerPrivate, and add helpers to get and set the current
value. Prior to this, there were for example situations where the DPMS
setting was changed, but without signal listeners being notified about
it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/506
2019-04-02 13:49:59 +00:00
72aeeb8c37 ci: Blacklist .c and .h in the commit message subject prefix
`boxes.c: Do that` should be just `boxes: Do that`.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/519
2019-04-02 11:42:44 +00:00
7b3dee2d97 ci: Nag about invalid commit message subject prefixes
Prefixes use an abbreviated form of the module or section being changed.
For example, changes to MetaBackend/meta-backend.c are prefixed with
`backend:` and generic changes to src/x11/ are prefixed `x11:`.

This extra nit picking check is meant to avoid using non-abbreviated
prefixes, e.g. `MetaBackend:`, or `meta-backend:`, other prefixes are
Currently consisting of only a "blacklist".

https://gitlab.gnome.org/GNOME/mutter/merge_requests/519
2019-04-02 11:42:44 +00:00
5199c7834d backends/native: Move underscan setting to MetaOutputKms
The 'underscan' property is a drm connector property, not a CRTC
property, so we would never find it. We also didn't advertise support
for the feature, meaning even if it was on the CRTC, Settings wouldn't
know about it.

Fix this by moving the property to where it belongs: in MetaOutputKms,
and properly advertise support for it if the property is found.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/507
2019-04-02 09:38:45 +00:00
afe8610b4a cogl/texture: Implement is_get_data_supported on GLES textures
https://gitlab.gnome.org/GNOME/mutter/merge_requests/515
2019-04-02 09:15:14 +00:00
9d49e8abd0 launch-context: Swap reversed timestamp/workspace
The parameters had been mixed up for X11 sessions.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/505
2019-04-01 10:34:51 +00:00
4043d0b455 Updated Spanish translation 2019-04-01 10:30:08 +02:00
34ee46022e clutter: Fix check for keyboard a11y features
The typo was actually toggling the feature on for those who had it
disabled.

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

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

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

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1049
https://gitlab.gnome.org/GNOME/mutter/merge_requests/511
2019-03-28 17:42:01 +08:00
28e0a7bfb5 wayland/xdg-shell: Correct window menu position in logical layout mode
Fixes https://gitlab.gnome.org/GNOME/mutter/issues/527
2019-03-26 22:41:57 +01:00
58f7059ea4 Update Croatian translation 2019-03-26 11:41:13 +00:00
d15e11bfe7 background: Shrink wallpaper using LINEAR_MIPMAP_LINEAR
Commit 8e9184b6 added filtering to avoid image jaggies when downscaling
but used `LINEAR_MIPMAP_NEAREST`. In some situations this could lead to
GL choosing a single lower resolution mipmap and then upscaling it, hence
slightly blurry.

We don't want to revert that change since it avoids aliasing jaggies, so
let's use `LINEAR_MIPMAP_LINEAR` instead. This provides the highest quality
filtering that GL can do and avoids the situation of GL using a single
mipmap that's lower resolution than the screen. Now it will blend that one
with the next mipmap which is higher resolution than the screen. This still
avoids jaggies but also maintains 1px resolution.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1105
https://gitlab.gnome.org/GNOME/mutter/merge_requests/505
2019-03-26 11:38:52 +08:00
1eabaf12da renderer/native: Make the EGLStreams operate in mailbox mode
This means eglSwapBuffers() wont dead lock if there is an old buffer pending
page flip. This could happen after e.g. mode changes or for other reasons.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/485
2019-03-25 17:29:25 +00:00
fe86694ddd renderer/native: Make EGLStream page flip errors non-fatal
Just continue rendering; we don't care if we were busy once, as it'll most
likely work when we flip the next time.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/485
2019-03-25 17:29:25 +00:00
a1969c98cd wayland: Defer text_input.done on an idle
With the right priority so we hopefully group events properly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/499
https://gitlab.gnome.org/GNOME/gtk/issues/1365
2019-03-25 14:55:12 +00:00
47663c7e0f clutter: Drop no longer necessary API
clutter_input_device_get_physical_size was just used for device mapping
heuristics in MetaInputMapper. It now started using the info from udev
on for both backends, so this means this clutter API is no longer
necessary.

https://gitlab.gnome.org/GNOME/mutter/issues/514
2019-03-25 14:08:40 +01:00
9843e21fff backends: Use udev to determine absolute input devices' size
Use the ID_INPUT_WIDTH_MM/ID_INPUT_HEIGHT_MM udev properties to figure out
absolute input devices' physical size. This works across both backends, and
requires less moving pieces to have it get the right results.

Concretely, fixes size detection on X11/libinput, which makes touchscreen
mapping go wrong.

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/501
2019-03-20 18:41:56 +01:00
f0b9654deb core: Remove startup sequences after timeout
The complete/remove semantics were split to cater for presenting windows,
so we must now separately do both here.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/492
2019-03-18 12:37:14 +00:00
00b4556051 constraints: Don't use intersection when sliding with custom rule
If an intersection is empty, the (x, y) coordinates are undefined, so
just use the work area and in-progress constrained window rect when
sliding according to the SLIDE_X or SLIDE_Y custom placement rule.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
86b5247770 constraints: Only get parent rect once when placement rule constraining
We got it in a switch case, then again when finalizing. Only get it once
instead.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
23f31e518e constraints: Only readjust placement constraint when not checking
When check_only is TRUE, the constraint should not be applied, just
checked. We failed to comply here when a placed transient window was
to be moved together with its parent, updating the window position
directly even if check_only was TRUE.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
f580b28a27 window: Replace placement constrained bool with state
Using an actual state instead of a boolean makes it clearer it's a state
that changes. Eventually we might add more state too.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
b4f1569640 window: Unmanage rule placed window if ending up outside of parent
If a client maps a persistent popup with a placement rule, then resizes
the parent window so that the popup ends up outside of the parent,
unmanage the popup and log a warning about the client being buggy.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
f2d7165a52 window: Don't try to move hidden attached windows
When a parent window is moved, attached windows (attached modal dialogs
or popups) is moved with it. This is problematic when such a window
hasn't been shown yet (e.g. a popup that has been configured but not
shown), as it'll mean we try to constrain an empty window. Avoid this
issue by not trying to auto-move empty windows.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
1bd3c13fe1 wayland/xdg-shell: Split out popup placement out of setup finish
Makes the function slightly more comprehensible.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
5d1eccfb6f boxes: Fix spelling in API
Change adjecent to adjacent.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
2019-03-17 14:12:40 +00:00
c96cf0608d Update Arabic translation 2019-03-15 23:42:49 +02:00
056c45fe0c wayland/buffer: Try realizing EGLStream before EGLImage buffer
Currently, it is assumed that if querying the EGL_TEXTURE_FORMAT of a
Wayland buffer succeeds it is an EGLImage. However, this assumption will no
longer hold on upcoming versions of the NVIDIA EGL Wayland driver which
will include support for querying this attribute for EGLStream buffers as
well. Hence, we need to check if buffers are EGLStreams first.

Fixes #488
https://gitlab.gnome.org/GNOME/mutter/merge_requests/477
2019-03-14 14:39:52 -07:00
2ac7f7f1e5 build: Make libsystemd an optional dependency
Otherwise it errors out before checking for elogind instead

https://gitlab.gnome.org/GNOME/mutter/merge_requests/491
2019-03-12 13:39:15 +00:00
318164779c boxes: Actually check for rectangle containment
Fixes condition duplicated:

          /* If a contains b, just remove b */
          if (meta_rectangle_contains_rect (a, b))
            {
              delete_me = other;
            }
          /* If b contains a, just remove a */
          else if (meta_rectangle_contains_rect (a, b))
            {
              delete_me = compare;
            }

Closes https://gitlab.gnome.org/GNOME/mutter/issues/480
2019-03-12 05:03:53 +01:00
7bd33e7b00 frame: Remove flashing support
It's now unused.

https://gitlab.gnome.org/GNOME/mutter/issues/491
2019-03-12 00:27:07 +00:00
f8d62da2dc bell: Always flash window instead of frame
Traditionally visual alerts were implemented by flashing the focus
window's frame. As that only works for windows that we decorate,
flashing the whole window was added as a fallback for client-decorated
windows.

However that introduces some confusing inconsistency, better to just
always flash the entire window.

https://gitlab.gnome.org/GNOME/mutter/issues/491
2019-03-12 00:27:07 +00:00
303e02bdac monitor: Fix indentation style on foreach functions
https://gitlab.gnome.org/GNOME/mutter/merge_requests/488
2019-03-12 00:15:43 +00:00
e2525f286d monitor: Fix indentation style on calculate_crtc_pos and friends
https://gitlab.gnome.org/GNOME/mutter/merge_requests/488
2019-03-12 00:15:43 +00:00
9b8510ac56 monitor: Fix indentation style on calculate_supported_scales and friends
https://gitlab.gnome.org/GNOME/mutter/merge_requests/488
2019-03-12 00:15:42 +00:00
8a87e87a05 shadow-factory: Update shadow of attached modals
When commit 91c6a144da synced shadows with Adwaita, it removed the
shadow completely from attached modal dialogs. However Adwaita uses
the same shadow for all dialogs (modal or not), so do the same here.

https://gitlab.gnome.org/GNOME/mutter/issues/490
2019-03-12 00:05:42 +00:00
9aca31c814 cogl: Introspect CoglTexture2D(Sliced)
gnome-shell cannot use CoglTexture if gjs can't tell that an object
in question implements the CoglTexture interface.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1020
https://gitlab.gnome.org/GNOME/mutter/merge_requests/482
2019-03-11 23:57:08 +00:00
a555a2c8eb cogl: Remove unused CoglTextureDriver::try_setting_gl_border_color
https://gitlab.gnome.org/GNOME/mutter/merge_requests/480
2019-03-11 23:50:10 +00:00
32504ae917 meta-monitor: Remove useless variable
Since commit f76b3edf9c, the variable is never set to TRUE and
we can simply remove it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/475
2019-03-11 23:44:46 +00:00
80ceeb2848 keybindings: Fix theoretical memory leak while ungrabbing
In the unlikely event that one tries to ungrab an action which does not
exist, a small leak could occur. Fix this by using g_autofree.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/478
2019-03-11 23:39:25 +00:00
1574099449 prefs: Change default of show-fallback-app-menu
The app menu always was a GNOME-only thing, so after it was removed this
cycle, assuming that it is not displayed by the environment is a better
default.

https://gitlab.gnome.org/GNOME/mutter/issues/493
2019-03-11 23:30:10 +00:00
efb1ee9730 Bump version to 3.32.0
Update NEWS.
2019-03-11 18:45:20 +01:00
a871d56f88 cogl: Revert swizzling for BGRA buffers
As it was originally reported on
https://bugzilla.gnome.org/show_bug.cgi?id=779234#c0, the hottest path was
convert_ubyte() in mesa. Reverting this shows no trace of those hot paths,
nor any higher than usual CPU activity.

As the improvements at the time were real, I can only conclude that pixel
conversion was happening somewhere further the pipeline, and swizzling just
helped indirectly. That got eventually fixed, so swizzling just stayed to
cause grief. And lots it caused.

Time to bin this, it seems.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/486
2019-03-08 10:41:25 +01:00
d83a325f98 Revert "Revert "cogl: Pick glReadPixels format by target, not source""
This reverts commit 4f72099023.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/486
2019-03-07 23:04:55 +01:00
4f72099023 Revert "cogl: Pick glReadPixels format by target, not source"
This reverts commit 981b045459.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/418
2019-03-06 17:02:00 +01:00
8856a396fd sound-player: Don't deadlock in finish_cb
The function finish_cb can be called as a result of a call to ca_context_cancel
in cancelled_cb. This will result in a deadlock because, as per documentation,
g_cancellable_disconnect cannot be called inside the cancellable handler.

It is possible to detect if the call to finish_cb is caused by ca_context_cancel
checking if error_code == CA_ERROR_CANCELED. To avoid the deadlock we should
call g_signal_handler_disconnect instead g_cancellable_disconnect if this is the
case.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/474
2019-03-05 12:07:41 +00:00
b0fb39bb54 Bump version to 3.31.92
Update NEWS.
2019-03-05 04:39:08 +01:00
7abceb434d x11-display: Split out restoring of active workspace
Splitting out the X11 display initialization from display_open() broke
restoring the previously active workspace in two ways:

 - when dynamic workspaces are used, the old workspaces haven't
   been restored yet, so we stay on the first workspace

 - when static workspaces are used, the code tries to access
   the compositor that hasn't been initialized yet, resulting
   in a segfault

Fix both those issues by splitting out restoring of the active workspace.

https://gitlab.gnome.org/GNOME/mutter/issues/479
2019-03-04 19:42:00 +00:00
3e472faf5c wayland: Minor refactor
We use the input_method on both branches, but only check for its existence
when enabling the text_input. The case of focusing out shouldn't happen in
practice as we couldn't have focused in ever before, but still make the
check one level above so it's clearer that the text_input's IM focus cannot
be enabled without an IM implementation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/432
2019-03-04 18:17:08 +00:00
eabb789381 wayland: Only enable OSK if receiving .enable when already active
Enable the OSK if receiving .enable consecutively (i.e. the
ClutterInputFocus was already focused). We specifically want to avoid
enabling the panel just because of focus changes within a surface (where
the .disable request across focus change would previously unfocus the
ClutterInputFocus). Prior state should be preserved if possible in that
situation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/432
2019-03-04 18:17:08 +00:00
1f1f49dc79 clutter: Do not toggle the OSK panel off after focus out
Let the upper layers figure out whether the panel should be shown
or hidden.

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

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

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

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

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

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

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

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/443
2019-03-02 13:20:30 +00:00
d597449a0e Update POTFILES.skip
https://gitlab.gnome.org/GNOME/mutter/merge_requests/471
2019-03-02 12:35:34 +01:00
cbd3ad8585 clutter/stage-cogl: Add function to scale and clamp fractional values to pixels
Compute pixels rectangles using various clutter utility functions that take
care of the subpixel compensation.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 19:42:08 +01:00
8b09542fd9 boxes: Crop rectangle converting to integer with grow strategy
Reuse meta_rectangle_from_clutter_rect with growing strategy to properly cast
the clutter floating rectangle to integer MetaRectangle.

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

And add ability to offset a cairo rect.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 19:42:08 +01:00
a8c972cd6b boxes: Add function to create a rectangle from floating clutter rect
Meta rectangles are integer based while clutter works in floating coordinates,
so when converting to integers we need a strategy.

Implement the shrink strategy by ceiling the coordinates and flooring the width,
and the grow strategy reusing clutter facility for this.

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 19:22:03 +01:00
ceb4fe2151 wayland-tablet-tool: Downscale the sprite texture in FB mode
When using scaled framebuffer we need to downscale the texture size in order
to get the cursor properly drawn at its real size and in good quality.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

And add ability to offset a cairo rect.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
3512647419 background: Use monitor scale to generate the texture at real monitor size
We need to use pixel size of the monitor in order to generate a valid
texture with full quality for current monitor

In spanned case the background should cover all the differently scaled monitors
thus we scale the texture up to the maximum scaling level and then we resample
it drawing only each side in the monitor it should occupy using the proper
scaling level.

In wallpaper mode (or color mode) for example we don't need to scale the area,
also the texture size we return should be unscaled, not to confuse
MetaBackgroundActor making it use more space than needed.

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:46:49 +00:00
42953a50bb stage: Queue redraw previous Rect only if it has changed
No need to queue redraw the same area multiple times, so we can avoid the
computation involved with it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
f4c2b69934 stage: Clamp to pixel the redraw clip taking care of the floored coords
When we floor the quad coordinates then we've also to enlarge the quad by the
difference between the floored value and the actual coordinate, otherwise
we'd end up in a smaller quad.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
d7ec5d3022 stage: Add utility function to queue draw a ClutterRect
Remove duplicated code to clamp to pixel

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3
2019-03-01 17:46:49 +00:00
7442de81bb display: Add meta_display_get_monitor_scale
This will return the monitor scaling for the requested logical screen

https://bugzilla.gnome.org/show_bug.cgi?id=765011
2019-03-01 17:46:49 +00:00
f76b3edf9c monitor: Define scale_steps globally
No need to compute the scale steps multiple times, since
it's just a defined value, so let's use a define for this
avoiding to pass around.

https://bugzilla.gnome.org/show_bug.cgi?id=782742
2019-03-01 17:46:49 +00:00
c67b0bd7e2 Updated Spanish translation 2019-03-01 12:20:26 +01:00
5356cd3c7d Update Serbian translation 2019-02-28 20:25:58 +00:00
bc657c9feb clutter: Remove unused deprecated/clutter-input-device-deprecated.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/464
2019-02-28 13:01:36 -05:00
52e074b08a clutter: Remove unused deprecated/clutter-{list-,}model.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/464
2019-02-28 13:01:32 -05:00
f1b148e488 clutter: Remove tests/conform/model.c
The clutter model code is deprecated and this is the only consumer.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/461
2019-02-28 10:35:39 -05:00
cc07702386 clutter: Remove unused deprecated/clutter-behaviour-path.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/461
2019-02-28 10:35:29 -05:00
1f796f1fbf clutter: Remove unused deprecated/clutter-timeout-interval.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/461
2019-02-28 10:35:29 -05:00
65312be59d clutter: Remove unused deprecated/clutter-behaviour-ellipse.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/461
2019-02-28 10:35:29 -05:00
5a6a602da8 clutter: Remove unused deprecated/clutter-shader.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/461
2019-02-28 10:35:29 -05:00
8d9a5e3c7e wayland/touch: Remove undelivered touches earlier
When the touch_down event was not delivered to Wayland clients, there's
no point in keeping the touchpoint in our list, so remove it early
inside update() instead of removing it after the touch ended.

This fixes a crash inside touch_handle_surface_destroy() where the
assertion to make sure the surface is removed fails because the
touch_count of the surface never reached 0. This in turn happened
because a new sequence was added, while a (already ended one) wasn't
removed from the touch->touches list before. This caused the touch
counter to get incremented by 1 while no new sequence was added to the
list (because Clutter reuses sequence IDs, the old sequence is equal to
the new one, i.e. the new sequence already is present in the list).

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/426
2019-02-28 09:52:23 +00:00
1c6ea5d1db Use a consistent style for enum braces
https://gitlab.gnome.org/GNOME/mutter/merge_requests/361
2019-02-28 09:31:01 +01:00
ca0b6fc3ac Update Korean translation 2019-02-28 03:16:37 +00:00
7c3a0d54cc Updated Vietnamese translation
Signed-off-by: Trần Ngọc Quân <vnwildman@gmail.com>
2019-02-28 07:47:58 +07:00
16a2eab290 clutter: Animatable: Use G_DECLARE_INTERFACE()
It cuts away a bit of the GObject boilerplate, gives us support for
`g_autoptr`, and removes the typedef hack inside clutter-scroll-actor.c.

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

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

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

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

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
2019-02-27 03:32:21 +00:00
cf2d06e9b9 clutter: Remove deprecated clutter-score.c
https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
2019-02-27 03:32:21 +00:00
d39211f438 clutter: Remove deprecated clutter_egl{,x}_display
https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
2019-02-27 03:32:21 +00:00
909464f749 clutter: Remove deprecated XInput code
https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
2019-02-27 03:32:21 +00:00
5669b64021 clutter: Remove unused clutter-glx-texture-pixmap.c and friends
https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
2019-02-27 03:32:21 +00:00
8f0b4767de clutter: Remove deprecated clutter_x11_get_stage_visual
https://gitlab.gnome.org/GNOME/mutter/merge_requests/452
2019-02-27 03:32:21 +00:00
9e75ce2ad7 monitor-config-store: Read system wide config files
Before introducing the new config store, the old monitor configuration
system read system wide monitor configuration files. Add back that
feature.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/253
2019-02-26 21:04:27 +00:00
c010a3b195 Update German translation 2019-02-26 19:44:02 +00:00
7c807c6e2a org.gnome.Mutter.ScreenCast: Document what was added in API version 2
RecordWindow and the cursor-mode property are only available if the
advertised version is at least 2.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
9a20271f90 screen-cast-window-stream: Add support for cursor modes
Make the RecordWindow method also understand the 'cursor-mode' property.
For 'embedded' the cursor is drawn onto the pixel buffer using cairo,
otherwise it works similarly to how RecordMonitor deals with it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
1760a6e560 screen-cast: Bump API version to 2
https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
8c2b805d88 screen-cast-src: Add helper to draw cursor sprite into pixel buffer
It makes sure the cursor sprite is correctly scaled and positioned in
stream coordinate space.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
2f01418d45 screen-cast-window: Add API to check if content has damage
https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
a76107a19f screen-cast-window: Add API to transform cursor state
To be used to translate absolute cursor positions to relative positions,
as well as to determine whether a cursor sprite is inside the stream or
not. It also helps calculating the scale the cursor sprite needs to be
scaled with to be in stream coordinate space.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
6372e3e4db clutter: Add clutter_actor_has_damage() API
Will be used to check whether there are any damage to an actor.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
c80ba819e7 screen-cast-window-src: Keep a screen cast window instead of an actor
Practically it's the same object, but ideally, we should not deal
with "actors" anywhere here.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
14c6a347c1 screen-cast-window-src: Rename painted callback to after_paint
We'll add a before_paint soon, so better have the names somewhat match.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
11bd847896 screen-cast-window-stream: Don't set the position property
It was not meant to be set for window streams, and was set to (0, 0)
anyway. This removes the corresponding MetaScreenCastWindow API, as it's
not needed anymore.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
870f38542d screen-cast-window-stream: Set the size property to the logical size
As the stream size is the logical monitor size multiplied with the ceil
of the logical monitor scale, the corresponding logical size, which is
what should be passed via the size property on the D-Bus object, should
be the logical monitor size.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
c22edeff1f screen-cast-window-stream: Use initable to initialize
Move the initialization from _new() to an initable implementation. This
will allow us to initialize fields before MetaScreenCastStream
initializes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
183de60d91 screen-cast-src: Move back MetaSpaType to C file
It's not needed by the monitor source anymore.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
176b508029 screen-cast-src: Change offscreen cursor helper to take a uint8_t *
Instead of a `uint32_t *`. Eventually we shouldn't assume pixels are
always 32 bit, and this gets rid of some casts while at it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/413
2019-02-26 13:39:11 +00:00
9be189daa7 screen-cast: Move cursor metadata setting to generic source
Make the monitor implementation do things strictly related to its own
source type, leaving the Spa related logic and cursor read back in the
generic layer, later to be reused by the window source type
implementation.

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

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

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2019-02-25 18:17:34 +00:00
8a9a78ec8a wayland: Check whether Xwayland window had a prior surface in generic code
Since commit 8df2a1452c (As pointed out by Robert Mader) we just happened
do this check when doing the first lookup for a Wayland surface for a
XWayland window, when we are later notifying upon surface creation we just
set the relation with no further checks.

The cases pointed out in the comment (eg. window changing decoration) might
presumably happen in a quick enough sequence that we have two scheduled
associations on the fly, so move this check to the more generic
meta_xwayland_associate_window_with_surface() which is called on both
immediate and delayed paths.

https://gitlab.gnome.org/GNOME/mutter/issues/361
2019-02-25 17:53:52 +00:00
803ffc19a4 shaped-texture: Clean-up deprecated NPOT check
There are most likely no GNOME users left still using hardware that
does not support NPOT textures. Further more, they would crash much
earlier and never hit this code-path. So remove the unnecessary check
here.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/447
2019-02-25 17:51:48 +01:00
ddd2ce3a88 wayland/buffer: Fall back to CoglTexture2DSliced
XWayland creates buffers of the combined size of all connected displays.
This can, especially on older but still in use hardware, exceed the limits
of the GPU.

If that is the case, use `CoglTexture2DSliced` instead of `CoglTexture2D`

https://gitlab.gnome.org/GNOME/mutter/merge_requests/447
2019-02-25 17:51:44 +01:00
979e689278 renderer/native: Retry page flip after one vsync if EBUSY
We might fail to page flip a new buffer, often after resuming, due to
the FIFO being full. Prior to this commit, we handled this by switching
over to plain mode setting instead of page flipping. This is bad because
we won't be synchronized to the refresh rate anymore, but just the
clock.

Instead, deal with this by trying again until the FIFO is no longer
full. Do this on a v-sync based interval, until it works.

This also changes the error handling code for drivers not supporting
page flipping to rely on them returning -EINVAL. The handling is moved
from pretending a page flip working to explicit mode setting in
meta-renderer-native.c.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/460
2019-02-25 15:48:29 +00:00
2c1ab8b3cc renderer/native: Remove legacy non-stage-view code
A renderer view will, under the native backend, since long ago always
have a logical monitor associated with it, so remove the code handling
the legacy non-stage view case.

https://gitlab.gnome.org/GNOME/mutter/issues/460
2019-02-25 15:48:29 +00:00
252e64a0ea wayland: Move surface texture ownership to MetaWaylandSurface
Prior to this commit, MetaWaylandSurface held a reference to
MetaWaylandBuffer, who owned the texture drawn by the surface. When
switching buffer, the texture change with it.

This is problematic when dealing with SHM buffer damage management, as
when having one texture per buffer, damaged regions uploaded to one,
will not follow along to the next one attached. It also wasted GPU
memory as there would be one texture per buffer, instead of one one
texture per surface.

Instead, move the texture ownership to MetaWaylandSurface, and have the
SHM buffer damage management update the surface texture. This ensures
damage is processed properly, and that we won't end up with stale
texture content when doing partial texture uploads. If the same SHM
buffer is attached to multiple surfaces, each surface will get their own
copy, and damage is tracked and uploaded separately.

Non-SHM types of buffers still has their own texture reference, as the
texture is just a representation of the GPU memory associated with the
buffer. When such a buffer is attached to a surface, instead the surface
just gets a reference to that texture, instead of a separately allocated
one.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/199
2019-02-25 15:35:38 +00:00
d2f1edd6c6 wayland/surface: Process damage also for non-actor surfaces
The texture still needs to be updated with damaged content.

https://gitlab.gnome.org/GNOME/mutter/issues/199
2019-02-25 15:35:38 +00:00
944a4763f6 cursor-renderer/native: Clear active CRTC gbm_bo when destroyed
When we freed the cursor GPU state including the gbm_bo objects attached
to it, we didn't unset the cursor renderer private of the CRTCs of the
associated GPU. This means that HW cursor invalidation could potentially
break if a new gbm_bo happened to be allocated at the same memory
address as the previous one.

To avoid this, iterate through the CRTCs of the GPU of which the cursor
data is freed, and unset the cursor renderer private if it was the one
destroyed.

https://gitlab.gnome.org/GNOME/mutter/issues/199
2019-02-25 15:35:38 +00:00
22a296f971 wayland/dma-buf: Don't use API meant for MetaWaylandSurface internally
What was actually done when calling meta_wayland_buffer_attach() was
that the texture was realized, so just call the function
`meta_wayland_dma_buf_realize_texture()` and call that.

This is in preparation to change how meta_wayland_buffer_attach() work.

https://gitlab.gnome.org/GNOME/mutter/issues/199
2019-02-25 15:35:38 +00:00
ef2153739c idle-monitor: Fix duplicate return value of ResetIdletime call
The signal handler must return TRUE as the invocation is already handled
by returning an error. Also update the error message a bit to clarify
that the API exists only for testing purposes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/457
2019-02-25 14:42:03 +00:00
9e1c8e2c22 Update Italian translation 2019-02-22 11:07:11 +00:00
fca0e6abb1 Bump version to 3.31.91
Update NEWS.
2019-02-21 19:45:43 +01:00
6975c8b424 monitor-config-manager: respect other outputs' CRTC
We should not only take the old CRTC for an output whenever
possible, but we should also assign one that is 'free', i.e.
one that another monitor (to be processed after this one)
isn't using, so that that monitor can use the same CRTC.

https://gitlab.gnome.org/GNOME/mutter/issues/373
2019-02-21 17:23:38 +02:00
f4f823f238 monitor-config-manager: reuse old CRTC when possible
We shouldn't change an output's CRTC if we don't have to, as
that causes the output to go black.

This patch depends on
"monitor-unit-tests: initial crtcs in custom_lid_switch".

https://gitlab.gnome.org/GNOME/mutter/issues/373
2019-02-21 17:23:38 +02:00
1c67260bd4 monitor-unit-tests: initial crtcs in custom_lid_switch
This test forgot to specify the existing CRTC routings in the setup. For the
first output the default 0 was ok, now it is -1 to ensure that the code will
assign it correctly. For the second output the default 0 was incorrect, because
possible_crtcs does not include 0.  Now that CRTC is initialized to off
instead, because the second output is hotplugged later and running a CRTC
without an output does not make sense.

This fix will keep this test passing when a future patch attempts to preserve
existing CRTC routings. Assuming that any existing routing is valid, such
routing will be kept. In this test case the existing routing was illegal, it
should have been impossible, which then causes that future patch to fail the
test by assigning the wrong CRTC.

https://gitlab.gnome.org/GNOME/mutter/issues/373
2019-02-21 17:22:12 +02:00
79f90c147c MetaPluginManager: Don't return void value
The spec for `meta_plugin_manager_confirm_display_change()` is to return
`void`, no need to return a value there.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/456
2019-02-21 09:31:15 +01:00
4e751a3b58 Update Brazilian Portuguese translation 2019-02-21 01:12:00 +00:00
1c2e8fcf06 keybinding: Store flags in MetaKeyGrab
The external grab handler is shared across all external bindings and external
bindings have now different binding flags. For this reason, when rebuilding the
binding table there could be loss of information if we assign the bindings flags
of the external handler to all external bindings. Let's store the bindings flags
in MetaKeyGrab too and use this when rebuilding the binding table to avoid the
above issue.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/169
2019-02-20 14:36:24 +00:00
00ca387ec7 keybindings: Add flag param to grab_accelerator
Add a 'flags' parameters to meta_display_grab_accelerator. This will allow
e.g. gnome-settings-daemon (through the gnome-shell's GrabAccelerator API) to
create shorcuts that should descard auto-repeated key events.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/169

Closes: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/issues/68
2019-02-20 14:36:24 +00:00
5688f1cf6e Updated Spanish translation 2019-02-20 15:34:11 +01:00
7bd668e6d0 window: Do not restore shortcuts on a NULL window
The "force restore shortcuts" being triggered by a key-combo, there is
no guarantee that the currently focused window is actually non-NULL in
which case we would crash.

Make sure there is a window currently focused before trying to restore
the shortcuts on that window.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/464
2019-02-18 11:23:59 +01:00
1dc602e289 Update Chinese (Taiwan) translation 2019-02-17 16:23:32 +00:00
ec518c4f24 Update Kazakh translation 2019-02-17 07:40:18 +00:00
0d9295523e clutter: Remove deprecate/clutter-frame-source.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/445
2019-02-15 23:01:01 +00:00
a4443885a3 clutter: Remove deprecated/clutter-timeout-pool.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/445
2019-02-15 23:01:01 +00:00
ef8f2876e3 clutter: Remove deprecated/clutter-backend.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/445
2019-02-15 23:01:01 +00:00
75071aba68 clutter: Remove deprecated/clutter-util.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/445
2019-02-15 23:01:01 +00:00
a81435ab5f cogl: Remove CoglBool, use gboolean instead
This basically reverts commit 54735dec, which tried to avoid the
GLib-defined types in favor the standard C ones. One exception to this
is the bool type, for which the commit introduces a new type CoglBool.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/321
2019-02-15 16:35:46 +01:00
6fe46cac60 wayland/xdg-shell: Do not maximize if not possible
On X11, if a window cannot be maximized because its minimum size is
already larger than the output size, a request to maximize will be
ignored.

On Wayland, however, we would still honor the maximize request and
switch the window state to maximized, without actually moving the window
which leads to weird visual effects, as the window end up being
maximized in-place.

To avoid this, make sure the window has the maximize functionality
available prior to change its state in xdg-shell `set_maximized`
request.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/463
2019-02-15 09:40:44 +01:00
c3b9ef7bf5 gpu: Remove unimplemented ::get_kms_file_path()
https://gitlab.gnome.org/GNOME/mutter/merge_requests/444
2019-02-15 09:17:07 +01:00
b70c0eb9a5 gitlab-ci.yml: Add check for issue or MR URL
This adds a pipeline stage for merge requests that checks that the
commit message contains an URL to either a issue or a merge request.
This means that for merge requests without corresponding issues will
always fail initially, as the merge request URL is not known until after
it is created. This is still arguably better than accidentally merging
merge requests without URLs.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/440
2019-02-14 17:10:32 +01:00
f3dd97e67b README: Add contribution section
Short and incomplete blurb about coding style and commit message
guidelines.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/440
2019-02-14 15:38:46 +01:00
77fb0a0003 window-actor: Remove public declaration for get_x_window
meta_window_actor_get_x_window has been removed in commit 422648e2 but has not
been removed from the header for ages.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/439
2019-02-14 13:09:20 +00:00
58d2a674c4 window: Return focusable ability looking at properties only
As per commit 43633d6b, we mark an unmanaging window as not focusable, while
this is true, it might cause not resetting the current focused window when
unmanaging it causing a crash.

Also this wouldn't allow to check if a window can be focused when unmanaging it,
so let's revert the previous behavior.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/462
2019-02-14 13:49:51 +01:00
9e2ed4104d wayland: Reset text-input state after commit
This was wrongly done just before enable, which is not right as
per the protocol. A side effect was that input purpose/hints were
eagerly reset before being applied, thus not properly honored,
noticed in the doing of emoji/numeric OSK panels.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/410
2019-02-14 11:23:07 +01:00
3f9b4a1ab5 Updated Danish translation 2019-02-13 18:50:51 +01:00
2aa0ec004a Update Romanian translation 2019-02-13 15:02:51 +00:00
f798912cbd window: Move can_ping to a function and implement in X11
https://gitlab.gnome.org/GNOME/mutter/merge_requests/421
2019-02-13 02:07:41 +00:00
3bf80a967c window-x11: Move delete_window to MetaWindowX11Private
https://gitlab.gnome.org/GNOME/mutter/merge_requests/421
2019-02-13 02:07:41 +00:00
6c3b0cfc36 window-x11: Move take_focus to MetaWindowX11Private
https://gitlab.gnome.org/GNOME/mutter/merge_requests/421
2019-02-13 02:07:41 +00:00
43633d6b2f window: Add is_focusable class method
Implement is_focusable for both x11 and wayland and just use this check
so that we can abstract things more and be less dependent on window backend.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/421
2019-02-13 02:07:41 +00:00
fdd531f307 Updated Czech translation 2019-02-12 14:23:15 +01:00
70c45f8941 Updated Slovenian translation 2019-02-12 12:35:34 +01:00
b82fa2c610 meta-launcher: g_propagate_*_error takes ownership
This means we need to make sure we don't accidentally free the provided
source GError (which automatically happens with `g_autoptr`), so use
`g_steal_pointer()`.

This fixes an issue where, when launched in a bubblewrap environment
(such as the one provided by Buildstream), mutter would give the
following warning message:

```
mutter-WARNING **: 8:31:35:069: Can't initialize KMS backend: (null)
```

... which isn't that useful when trying to debug the actual issue.
2019-02-12 09:41:04 +01:00
eaacbb3289 gitlab-ci: Don't upload test artifacts
There's no need to upload test artifacts since they don't produce anything
that we care about so far, while this phase slows down the pipeline execution.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/436
2019-02-11 16:31:10 +01:00
54fdd633fe input-mapper: Use g_auto to free a string array
https://gitlab.gnome.org/GNOME/mutter/merge_requests/435
2019-02-11 15:42:16 +01:00
29ed84e921 input-mapper: Don't loop infinitely in EDID matching
Iterate over all the monitor product words to check for a partial matching on
EDID, otherwise we would hang inside an infinite while loop.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/459
2019-02-11 15:42:16 +01:00
d587fc1ef4 Update Swedish translation 2019-02-09 21:16:02 +00:00
285d717ceb Updated Lithuanian translation 2019-02-09 22:55:38 +02:00
616a149917 Update Turkish translation 2019-02-09 20:14:51 +00:00
f578c4daaa Update Galician translation 2019-02-09 15:34:22 +00:00
830495b7c6 Updated French translation 2019-02-09 12:21:14 +01:00
4d02f68057 Update French translation
Cherry-pick 28d2d54189 from gnome-3-30 branch.
2019-02-09 12:18:05 +01:00
31c5a0009f Update Finnish translation 2019-02-09 09:03:39 +00:00
c91d9df481 Bump version to 3.31.90
Update NEWS.
2019-02-07 01:22:26 +01:00
e64cbfcc3f Update Polish translation 2019-02-06 22:00:09 +01:00
3c2d85b544 Update Catalan translation 2019-02-06 20:56:26 +01:00
96c4dd817e Update Indonesian translation 2019-02-06 14:18:39 +00:00
ba7af4f7d3 wayland/surface: Add support for wp_viewporter
This adds the required bits to wayland surfaces and ties them up
to the compositor parts.

It is based on and very similar in nature to buffer transforms.

From the specification:
> The global interface exposing surface cropping and scaling
> capabilities is used to instantiate an interface extension for a
> wl_surface object. This extended interface will then allow cropping
> and scaling the surface contents, effectively disconnecting the
> direct relationship between the buffer and the surface size.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/323
2019-02-06 12:24:03 +00:00
edfe5cc3b7 shaped-texture: Add support for viewports
This implements the viewporter protocol which offers a cropping and scaling
capabilities to wayland clients.

There are several use cases for this, for example video players and games,
both as a convenience function and as potential performance optimization when
paired with hardware overlays etc.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/323
2019-02-06 12:24:02 +00:00
07e65a6ef2 region-utils: Add API to crop and scale an integer region
https://gitlab.gnome.org/GNOME/mutter/merge_requests/323
2019-02-06 12:24:02 +00:00
d574cf59f1 boxes: Add API to crop and scale a MetaRectangle
https://gitlab.gnome.org/GNOME/mutter/merge_requests/323
2019-02-06 12:24:02 +00:00
47402d848d Updated Spanish translation 2019-02-06 11:43:48 +01:00
922f14276a Update Hungarian translation 2019-02-05 20:07:46 +00:00
8c5ad7ea2d Update Friulian translation 2019-02-05 11:13:55 +00:00
20c5e2525e monitor-manager: Provide proper contexts for translators
Two strings were both "%s %s", but with different meaning. Let
translators know the difference by providing context using C_().
2019-02-04 18:41:05 +01:00
325fec31da monitor-manager: Add yet another wacky "physical dimension" 2019-02-04 17:41:36 +01:00
cbb2a286f2 monitor-manager: Don't use wacky physical dimensions in display name 2019-02-04 17:41:36 +01:00
e9eaa37401 monitor-manager: Use output name as display name in GetResources 2019-02-04 17:41:36 +01:00
dbe73c3296 meson: Do not install cogl config.env if installed tests are disabled
Until meson 0.50, setting the install parameter in 'configure_file' is ignored
if 'install_dir' is set. Then until mutter doesn't depend on such meson version
cogl_installed_tests_libexecdir should be empty unless have_installed_tests is
false, or this file will be installed anyway.

See https://github.com/mesonbuild/meson/issues/4160
2019-02-04 15:49:56 +00:00
b4ae6cdd62 Don't include potentially sensitive window titles in logs
For various error and warning messages, mutter includes a description of
the window, and that description includes a snippet of the title of the
window. Those snippets find their way into system logs, which then means
they can potentially find their way into bug reports and similar. Remove
the window title information to eliminate this potential privacy issue.
2019-02-03 06:32:14 +01:00
317414ab26 clutter/paint-nodes: Push/pop framebuffer
Unfortunately, many parts of GNOME Shell and Mutter and Clutter
still use the implicit Cogl1 API. As such, it as a transition
between the old and new APIs, it is important to keep the
implicit draw framebuffer updated.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/405
2019-02-01 12:42:12 +00:00
5a71ed4411 clutter-event: Correctly annotate some methods
https://gitlab.gnome.org/GNOME/mutter/merge_requests/181
2019-01-31 16:50:04 +00:00
de76074336 ui: Remove fallback app menu
The app menu is in the process of being retired[0], and the shell
stopped displaying it while applications are in the process of
dropping it. It therefore doesn't make sense to always show a
fallback menu in server-side decorations, applications that still
set the menu can rely on GTK+'s own fallback instead.

[0] https://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement

https://gitlab.gnome.org/GNOME/gnome-shell/issues/624
2019-01-30 18:39:42 +00:00
f63b69bb23 gitlab-ci: Define exported global variables once
Don't redefine XDG runtime and gsettings schema paths multiple times, just
export the variables once and reuse them.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/408
2019-01-30 19:16:46 +01:00
a54f9e835c gitlab-ci: Use runtime dir owned only by current user
https://gitlab.gnome.org/GNOME/mutter/merge_requests/408
2019-01-30 18:57:56 +01:00
7a941138de gitlab-ci: Use artifacts to keep built data and reuse in test
Make test to be dependent on build phase, saving artifacts for some time in
order to just run the tests without performing any rebuild.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/408
2019-01-30 18:55:51 +01:00
2c5404532b screen-cast-stream: Don't broadcast PipeWireStreamAdded signal
The helper function from gdbus-codegen broadcasts the signal emission,
but we really only care about sending it to the specific peer that
created the session. Thus, only emit the signal to the particular peer
that owns the session.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
2019-01-30 17:14:47 +00:00
be259117f5 Update POTFILES.skip 2019-01-30 17:29:03 +01:00
6932b3cbb3 renderer/native: fix missing GPU copy egl ext error
If the extension is missing, the GPU copy path would not work. The code sets
the error, but forgets to return a failure. Fix this.

While adding the necessary return FALSE, also destroy the EGL context we just
created. Code refactoring shares the destroying code.

Found by reading code.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/416
2019-01-30 15:57:30 +02:00
b76bf20092 backends/native: Don't use software renderer for GPU copy
If the GPU copy path would use a software renderer, fall back to the CPU
copy path. The CPU copy path is possibly faster and avoids screen
corruption issues that were observed on an Intel Haswell desktop. The
corruption was likely due to texturing from an unfinished rendering or
memory caching issues.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/325
2019-01-30 15:12:57 +02:00
a62dbc6680 renderer/native: Debug print chosen secondary FB format
Print the pixel format chosen for an output on a secondary GPU for
debugging. Knowing the format can aid in debugging e.g. red/blue channel
swaps and CPU copy performance issues.

This adds a DRM format printing helper in meta-crtc-kms.h. This header
is included in most native backend files making it widely available,
while DRM formats are specific to the native backend. It could be shared
with Wayland bits, DRM format codes are used there too.

The helper makes the pixel format much more readable than a "%x".

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
442dcc7855 renderer/native: Valid formats for secondary dumb buffers
When setting up an output on a secondary GPU with the CPU copy mode,
allocate the dumb buffers with a DRM format that is advertised supported
instead of hardcoding a format.

Particularly, DisplayLink devices do not quite yet support the hardcoded
DRM_FORMAT_XBGR8888. The proprietary driver stack actually ignores the
format assuming it is DRM_FORMAT_XRGB8888 which results the display
having red and blue channels swapped. This patch fixes the color swap
right now, while taking advantage if the driver adds support for XBGR
later.

The preferred_formats ordering is somewhat arbitrary. Here it is written
from glReadPixels point of view, based on my benchmarks on Intel Haswell
Desktop machine. This ordering prefers the format that was hardcoded
before.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
23e7a0a099 crtc/kms: Add primary plane format list accessors
These functions allow inspecting which pixel formats a CRTC's primary
plane supports. Future patches will inspect the supported formats and
pick a framebuffer format accordingly instead of hardcoding a format.

The copy list function will be used to initialize a formats list, and
the supports format function will be used to intersect that list against
another CRTC's supported formats.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
7f2dbb6c44 crtc/kms: Document meta_crtc_kms_get_modifiers
It has some details that may not be obvious from the function signature.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
8a0d0ce987 crtc/kms: Add fallback primary plane formats
This avoids having to hardcode the same fallbacks elsewhere multiple
times when determining what formats might be suitable for a set of
CRTCs. The formats_modifiers hash table is now guaranteed to be
populated with at least something, so future code will not need to
handle it being empty.

The hardcoded fallback formats are a minimal set probably supported by
most hardware. XRGB8888 is the format that, according to ancient lore,
all DRM devices should support, especially if they don't have the
capability to advertise otherwise. Mutter also hardcodes XRGB8888 as the
GBM surface format, so it is already required on primary GPUs.

XBGR8888 matches the most common OpenGL format, sans alpha channel since
scanout hardware has not traditionally supported alpha. XBGR8888 is here
also because Mutter hardcodes that format for secondary GPU outputs when
using the CPU copy path.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
0789c3fb9f crtc/kms: Use plane formats if no IN_FORMATS
If the IN_FORMATS property is not found, copy the formats from the DRM
plane instead. This is the fallback for getting a list of formats the
primary plane supports when DRM universal planes capability is enabled.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
31d99c51cb crtc/kms: Remove unused field formats_prop_id
It was set but never used.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
30550ef688 crtc/kms: Parse and store IN_FORMATS in full
Rather than picking just one format, parse and store all the formats and
their modifiers.

This gives us a list of supported formats (and modifiers) on a CRTC
primary plane. Later I will be using this list to choose a framebuffer
format instead of hardcoding it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/341
2019-01-30 12:53:20 +00:00
b04cca9eab clutter/evdev: Set the backend keymap before using it
The device manager evdev assumes the keymap is set, so better set it
before its creation.

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

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

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

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

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

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

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/375
2019-01-28 18:36:05 +01:00
177b4df217 wayland: Implement window activation and focus stealing prevention
This is done through gtk-shell ATM. If a window requests focus with
an invalid startup ID, just the demands-attention flag will be set.
The "did user interaction happen in between" checks are left to
meta_window_activate_full/meta_window_focus, by passing the timestamp
of the original launch request.
2019-01-26 18:07:03 +01:00
a08d7cf48a wayland: Update gtk-shell protocol to v3
This version has 2 new requests:
- gtk_shell1.notify_launch notifies the compositor that the requesting
  client shall launch another application. The given ID is expected to
  be unique.
- gtk_surface1.request_focus notifies the compositor that a surface
  requests focus due to it being activated. The given ID is passed to
  this process through undetermined means, if it corresponds with a
  current startup ID and there was no user interaction in between the
  surface will be focused, otherwise it will demand attention.
2019-01-26 18:07:03 +01:00
3fa6a92cc5 screen-cast: Fix monitor recording on HiDPI
It scaled the logical monitor rect with scale to get the stream
dimensions, but that is only valid when having
'scale-monitor-framebuffers' enabled. Even when it was, it didn't work
properly, as clutter_stage_capture_into() doesn't work properly with
scaled monitor framebuffers yet.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/415
2019-01-26 16:18:45 +00:00
d5a7bbd094 Fix builds with G_DISABLE_ASSERT
Commit 25f416c13d added additional compilation warnings, including
-Werror=return-type. There are several places where this results
in build failures if `g_assert_not_reached()` is disabled at compile
time and the compiler misses a return value.

https://gitlab.gnome.org/GNOME/mutter/issues/447
2019-01-25 09:43:06 +01:00
de41f3ea28 clutter: Fix builds with G_DISABLE_ASSERT
Commit 25f416c13d added additional compilation warnings, including
-Werror=return-type. There are several places where this results
in build failures if `g_assert_not_reached()` is disabled at compile
time and the compiler misses a return value.

https://gitlab.gnome.org/GNOME/mutter/issues/447
2019-01-25 09:43:06 +01:00
5c3ec27b4b cogl: Fix builds with G_DISABLE_ASSERT
Commit 25f416c13d added additional compilation warnings, including
-Werror=return-type. There are several places where this results
in build failures if `g_assert_not_reached()` is disabled at compile
time and the compiler misses a return value.

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

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

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

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

Fixes:
https://bugzilla.gnome.org/show_bug.cgi?id=789050,
https://bugzilla.gnome.org/show_bug.cgi?id=659523#c9,
https://gitlab.gnome.org/GNOME/mutter/issues/196,
https://gitlab.gnome.org/GNOME/mutter/issues/282,
https://gitlab.gnome.org/GNOME/gnome-shell/issues/387,
https://launchpad.net/bugs/1767648,
https://launchpad.net/bugs/1779615
2019-01-24 17:00:25 +00:00
2e53ce8e75 meta, startup-notification: Make type declarations public
Shell is using these, which was revealed by
1bbb5c8107 breaking its build when
generating its introspection due to meta_startup_notification_get_type()
not being found.

We keep the class structs private, so in practice MetaStartupSequence
and MetaBackend can't be derived from (the are semi-private).
2019-01-24 16:38:09 +00:00
2528a39781 gitlab-ci.yml: Change build step build type to debugoptimized
We will catch -Wmaybe-uninitialized errors this way.
2019-01-23 21:05:51 +00:00
e02fef8e2f meta: Hide libmutter symbols by default and selectively export them
Make meson link libmutter using -fvisibility=hidden, and introduce META_EXPORT
and META_EXPORT_TEST defines to mark a symbols as visible.
The TEST version is meant to be used to flag symbols that are only used
internally by mutter tests, but that should not be considered public API.

This allows us to be more precise in selecting what is exported and what is
not, without the need of a version-script file that would be more complicated
to maintain.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/395
2019-01-23 14:18:13 +01:00
e352011830 MonitorManager: Use composition instead of inheriting from dbus skeleton
MonitorManager was inheriting from MetaDBusDisplayConfigSkeleton, this was
causing introspection to see this like a GDBus skeleton object exposing to
clients methods that were not required.

Also, this required us to export meta_dbus_* symbols to the library, while
these should be actually private.

So, make MetaMonitorManager to be just a simple GObject holding a skeleton
instance, and connect to its signals reusing most of the code with just few
minor changes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/395
2019-01-23 14:12:07 +01:00
7f551ba776 meson: Don't list libraries private dependencies in pc files
pkg-config files for mutter are generated using *_pkg_deps as requires, but
programs linked with libmutter doesn't need most of these private dependencies
which are only needed for building and linking mutter and its subprojects.

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

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3955
2019-01-23 13:03:40 +00:00
3838341d83 meson: Set cogl as dependency of libmutter-cogl dependency
Since a libmutter-cogl dependency is declared as libmutter_cogl_dep, it can be
used to avoid repeating cogl dependency everywhere.

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

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

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

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

Fix all shared libraries by setting valid version and soversion.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/3955
2019-01-23 13:03:40 +00:00
371b97af27 meson: Fix map files and load them to hide private symbols
Map files were using wrong syntax (missing final `;` or invalid chars).

Also, the map files were only monitored for rebuilding, but not really used by
ld, so pass the ldflags with version-script so that private symbols are really
hidden.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/395
2019-01-23 13:03:40 +00:00
562cf14258 core: Fix compiler warning
Fix compiler warning: ‘startup_id’ may be used uninitialized in
`meta_launch_context_get_startup_notify_id()`.

Also change `gchar` to plain `char` while at it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/406
2019-01-23 10:06:30 +01:00
c57ae7fc9c cogl/path: Don't depend on GL/glu.h
It's not needed for anything, and we can get rid of the dependency we
just added.

Also remove the installation step from Dockerfile.
2019-01-22 19:06:14 +01:00
6c91683380 gitlab-ci.yml: Treat warnings as errors
This'll allow us to catch them before they land.
2019-01-22 18:32:28 +01:00
25f416c13d meson.build: Add more compilation warnings
So that we can catch more issues. The warning list is copied from GTK+,
with two switch related ones removed.
2019-01-22 18:32:28 +01:00
8d91135926 wayland/xdg-shell: Fix buffer attach coordinate comparison
Only x was checked, but twice. Should check both x and y.
2019-01-22 18:32:28 +01:00
1bbb5c8107 meta: Only declare types when generating gir files
Some types were declared in the public headers so that g-ir-scanner
could resolve the types. This caused warnings when using
-Wredundant-decls, so only redeclare them for the gir scanner.
2019-01-22 18:32:28 +01:00
12a42a9295 wayland: Move DND surface role into its own file
This avoids a -Wredundand-decls warning about the get_type() function.
2019-01-22 18:32:28 +01:00
01cea0d9ef Fix const qualifier usage
As with the commits earlier, this also adds const qualifiers where
expected. However, the const variables are casted to non-const variants
so they can be passed to glib functions that take non-const variants but
expect const-like input.
2019-01-22 18:31:53 +01:00
f615eea7ee backend: Remove redundant function declarations 2019-01-22 18:31:52 +01:00
cbbd3e366a clutter/build: Don't pass --prototypes to glib-genmarshal
This causes compilation warnings and the prototypes are declared in the
header file already.
2019-01-22 18:31:52 +01:00
ede10dded0 clutter: Add missing void to function declaration 2019-01-22 18:31:52 +01:00
982d135ace cogl: Add missing function declarations
In plenty of places a non-static function was defined but didn't have
the corresponding declaration. Fix this by adding them, or alternatively
making them static.
2019-01-22 18:31:52 +01:00
548c0f16f4 cogl: Remove redundant function declarations 2019-01-22 18:31:52 +01:00
bbd295ae09 cogl: Fix const qualifier usage 2019-01-22 18:31:52 +01:00
c55004864d cogl: Add missing void to functions with no arguments
I.e. foo () -> foo (void).
2019-01-22 18:31:52 +01:00
54685091f1 cogl-path: Remove own glu.h version
cogl-path uses types from glu.h, but to avoid a build dependency on glu,
it kept a minified copy of glu.h in tree. Drop this file and just use
the actual glu.h. To avoid linking to libGLU.so, just use the
includepath, instead of actually adding glu as a real dependency.

This means we can remove an includepath meant to make it possible to
include <GL/glu.h>.
2019-01-22 18:31:52 +01:00
d4a9535f04 cogl-path: Cast function pointer explicitly
gluTessCallback() expects an equivalent to a GFunc, but we pass
functions with arguments without casting. To get rid of warnings, cast
the callback function pointer to the expected type.
2019-01-22 18:31:52 +01:00
44477390a9 clutter: Fix const qualifier usage
The const qualifiers were implicitly discarded here and there. Avoid that
either by adding the constness, or casting it away when a const variable
is passed to a function that is defined as non-const but effectively
expect a const.
2019-01-22 18:31:19 +01:00
caf27c4c16 clutter/tests: Remove dead code
Defined, but not used anywhere.
2019-01-22 18:31:19 +01:00
576e7a43df clutter/tests: Fix missing declaration warnings 2019-01-22 18:31:19 +01:00
c242558398 clutter/debug: Add printf annotations to log helpers 2019-01-22 18:31:19 +01:00
8c9e827aab clutter/stage: Fix debug logging
We expected %d but passed %f in a couple of places.
2019-01-22 18:31:19 +01:00
2bcc9e2b86 clutter/tests/interactive: Remove dead code
It was hidden behind a macro that was never defined anywhere.
2019-01-22 18:31:19 +01:00
5c66afbf63 Dockerfile: Update gsettings-desktop-schemas copr URL
The old rpms had been cleaned out.
2019-01-22 18:31:19 +01:00
84aeb8f715 Dockerfile: Remove manual pipewire-0.2.5 upgrade
It's already in F29 stable.
2019-01-22 18:31:14 +01:00
3738579dd3 window-actor: Use actual image size for capture
Previously, the clipping rectangle passed to
`meta_surface_actor_get_image()` was updated with the actual texture
size, but recent changes in `meta_shaped_texture_get_image()` now keep
the caller's clipping rectangle unchanged.

The implementation of `meta_window_actor_capture_into()` was relying on
the old behavior of updating the passed clipping rectangle, but now that
it's kept unchanged, the actual clipping rectangle used to copy the data
is wrong, which causes either a distorded image or worse, a crash of
mutter.

Use the resulting cairo image size to copy the data instead of the
clipping rectangle to avoid the issue and get the expected size.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/442
2019-01-22 10:30:04 +01:00
1ca60f424a input-settings/x11: Only warn once about missing udev support
Otherwise we end up logging the same message everytime we enter this function,
flooding the logs and making it annoying to spot other entries.
2019-01-22 02:21:13 +01:00
1081 changed files with 45714 additions and 59994 deletions

View File

@ -1,20 +1,79 @@
image: registry.gitlab.gnome.org/gnome/mutter/master:v1
image: registry.gitlab.gnome.org/gnome/mutter/master:v2
stages:
- review
- build
- test
check-commit-log:
stage: review
variables:
GIT_DEPTH: "100"
script:
- ./.gitlab-ci/check-commit-log.sh
only:
- merge_requests
build-mutter:
stage: build
script:
- meson . build -Degl_device=true -Dwayland_eglstream=true
- meson . build -Dbuildtype=debugoptimized -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
- ninja -C build
- ninja -C build install
artifacts:
expire_in: 1 day
paths:
- build
only:
- merge_requests
- /^.*$/
build-without-native-backend-and-wayland:
stage: build
script:
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false -Dwayland=false -Dcore_tests=false --werror --prefix /usr
- ninja -C build
- ninja -C build install
artifacts:
expire_in: 1 day
paths:
- build
only:
- merge_requests
- /^.*$/
test-mutter:
stage: test
dependencies:
- build-mutter
variables:
XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
GSETTINGS_SCHEMA_DIR: "$CI_PROJECT_DIR/build/data"
G_SLICE: "always-malloc"
MALLOC_CHECK_: "3"
NO_AT_BRIDGE: "1"
MALLOC_PERTURB_: "123"
script:
- meson . build -Degl_device=true -Dwayland_eglstream=true
- ninja -C build
- glib-compile-schemas $PWD/build/data
- env XDG_RUNTIME_DIR=/tmp/ GSETTINGS_SCHEMA_DIR=$PWD/build/data dbus-run-session -- xvfb-run -s '+iglx -noreset' meson test -C build -t 10 --verbose --no-stdsplit --wrap catchsegv
- dconf update
- mkdir -m 700 $XDG_RUNTIME_DIR
- glib-compile-schemas $GSETTINGS_SCHEMA_DIR
- >
dbus-run-session -- xvfb-run -s '+iglx -noreset'
meson test -C build --no-rebuild -t 10 --verbose --no-stdsplit --print-errorlogs --wrap catchsegv
only:
- merge_requests
- /^.*$/
can-build-gnome-shell:
stage: test
dependencies:
- build-mutter
before_script:
- meson install --no-rebuild -C build
script:
- .gitlab-ci/checkout-gnome-shell.sh
- meson gnome-shell gnome-shell/build --prefix /usr -Dman=false
- ninja -C gnome-shell/build install
only:
- merge_requests
- /^.*$/

View File

@ -1,20 +1,40 @@
FROM fedora:29
# Rebuild and push with
#
# cd .gitlab-ci/
# docker build --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v2 .
# docker push registry.gitlab.gnome.org/gnome/mutter/master:v2
#
FROM fedora:30
RUN dnf -y update && dnf -y upgrade && \
dnf install -y 'dnf-command(builddep)' && \
dnf install -y 'dnf-command(copr)' && \
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 builddep -y mutter && \
# Until Fedora catches up with meson build-deps
dnf install -y meson xorg-x11-server-Xorg gnome-settings-daemon-devel egl-wayland-devel xorg-x11-server-Xwayland && \
# Until Fedora catches up with mesa bug fixes
dnf upgrade -y mesa-dri-drivers mesa-libEGL && \
# For running unit tests
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 && \
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs && \
# Unpackaged versions
dnf install -y https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00836095-gsettings-desktop-schemas/gsettings-desktop-schemas-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00836095-gsettings-desktop-schemas/gsettings-desktop-schemas-devel-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm && \
# Packages not yet in stable
dnf install -y https://kojipkgs.fedoraproject.org//packages/pipewire/0.2.5/1.fc29/x86_64/pipewire-0.2.5-1.fc29.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/pipewire/0.2.5/1.fc29/x86_64/pipewire-devel-0.2.5-1.fc29.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/pipewire/0.2.5/1.fc29/x86_64/pipewire-libs-0.2.5-1.fc29.x86_64.rpm && \
dnf install -y sysprof-devel && \
dnf install -y intltool redhat-rpm-config make && \
# GNOME Shell
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 --noautoremove mutter mutter-devel && \
dnf clean all

57
.gitlab-ci/check-commit-log.sh Executable file
View File

@ -0,0 +1,57 @@
#!/usr/bin/env bash
if [ -z "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
echo Cannot review non-merge request
exit 1
fi
git fetch $CI_MERGE_REQUEST_PROJECT_URL.git $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
branch_point=$(git merge-base HEAD FETCH_HEAD)
commits=$(git log --format='format:%H' $branch_point..$CI_COMMIT_SHA)
if [ -z "$commits" ]; then
echo Commit range empty
exit 1
fi
function commit_message_has_url() {
commit=$1
commit_message=$(git show -s --format='format:%b' $commit)
echo "$commit_message" | grep -qe "\($CI_MERGE_REQUEST_PROJECT_URL/\(issues\|merge_requests\)/[0-9]\+\|https://bugzilla.gnome.org/show_bug.cgi?id=[0-9]\+\)"
return $?
}
function commit_message_subject_is_compliant() {
commit=$1
commit_message_subject=$(git show -s --format='format:%s' $commit)
if echo "$commit_message_subject" | grep -qe "\(^meta-\|^Meta\)"; then
echo " - message subject should not be prefixed with 'meta-' or 'Meta'"
return 1
fi
if echo "$commit_message_subject" | grep -qe "\.[ch]:"; then
echo " - message subject prefix should not include .c, .h, etc."
return 1
fi
return 0
}
for commit in $commits; do
commit_short=$(echo $commit | cut -c -8)
if ! commit_message_has_url $commit; then
echo "Missing merge request or issue URL on commit $commit_short"
exit 1
fi
errors=$(commit_message_subject_is_compliant $commit)
if [ $? != 0 ]; then
echo "Commit message for $commit_short is not compliant:"
echo "$errors"
exit 1
fi
done

View File

@ -0,0 +1,33 @@
#!/usr/bin/bash
gnome_shell_target=
git clone https://gitlab.gnome.org/GNOME/gnome-shell.git
if [ $? -ne 0 ]; then
echo Checkout failed
exit 1
fi
cd gnome-shell
if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
merge_request_remote=${CI_MERGE_REQUEST_SOURCE_PROJECT_URL//mutter/gnome-shell}
merge_request_branch=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
echo Looking for $merge_request_branch on remote ...
if git fetch -q $merge_request_remote $merge_request_branch 2>/dev/null; then
gnome_shell_target=FETCH_HEAD
else
gnome_shell_target=origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
echo Using $gnome_shell_target instead
fi
fi
if [ -z "$gnome_shell_target" ]; then
gnome_shell_target=$(git branch -r -l origin/$CI_COMMIT_REF_NAME)
gnome_shell_target=${gnome_shell_target:-origin/master}
echo Using $gnome_shell_target instead
fi
git checkout -q $gnome_shell_target

370
NEWS
View File

@ -1,3 +1,373 @@
3.34.3
======
* Fix window recording on HiDPI [Pascal; !976]
* Fix top-left pixel being insensitive to clicks [Sebastian; #893]
Contributors:
Sebastian Keller, Pascal Nowack
3.34.2
======
* Fix immediate screen blank after releasing inhibitor [Tim; #573]
* Respond to frame callbacks regardless of damage [Jonas Å.; !839]
* Translate well-known selection atoms to mimetypes [Carlos; !842]
* Fix Night Light on wayland [Jonas Å.; !840]
* Fix various copy+paste/DND regressions [Carlos; !848, #789, #842,
#793, #845, #854]
* Don't emit focus event after desctruction [Marco; gnome-shell#1704, !860]
* Fix hang when opening not-responding dialog on Xorg [Carlos; !876]
* Fix frozen grabs on Xorg after weeks of inactivity [Jonas Å.; !886]
* Fix triggering popups from stylus devices on wayland [Carlos; #886]
* Support shadow framebuffers for offscreen rendering [Olivier; !917]
* Fix hang after interacting with desktop icons on X11 [Marco; !909]
* Don't double scale when getting absolute surface coordinates [Xiang; !915]
* Kill window effects on destroy [Robert; !924]
* Use partial damage for dma-buf and EGLImage buffers on wayland [Robert; #947]
* Do not stack transients underneath their always-on-top parent [Florian; #587]
* Fix KMS freeze after pageflip [Pekka; !953]
* Fixed crashes [Robert, Jonas Å., Marco, Hans, Carlos, Tim; !856, !912, !895,
!928, #591, !823, !960]
* Plugged memory leaks [Niels, Robert, Carlos; !847, !868, !873]
* Misc. bug fixes and cleanups [Daniel, Marco, Jonas Å., Georges, Cosimo,
Florian, Hans, Robert, Jonas D.; !841, !764, !837, !846, !673, !811, !893,
!925, !927, !940, !832]
Contributors:
Marco Trevisan (Treviño), Cosimo Cecchi, Tim Crawford, Jonas Dreßler,
Xiang Fan, Olivier Fourdan, Carlos Garnacho, Hans de Goede, Niels De Graef,
Tim Klocke, Robert Mader, Florian Müllner, Georges Basile Stavracas Neto,
Pekka Paalanen, Daniel van Vugt, Jonas Ådahl
Translators:
Bruce Cowan [en_GB]
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
======
* Fix xdg-output v3 support [Olivier; !771]
* Fix crash when changing decoration state [Jonas; !773]
* Add and remove connectors on hot-plug [Jonas; !743]
Contributors:
Olivier Fourdan, Jonas Ådahl
Translators:
Rafael Fontenelle [pt_BR], Gwan-gyeong Mun [ko], Christian Kirbach [de],
Claude Paroz [fr], Milo Casagrande [it], Emin Tufan Çetin [tr],
Ryuta Fujii [ja]
3.33.92
=======
* Turn MetaShapedTexture into a ClutterContent implementation [Georges; !409]
* Restore inhibit shortcut for overlay key [Olivier; #734]
* Misc. pointer a11y improvements [Jonas D., Olivier; !746, !747, !745, !761]
* Fix position of drag surfaces [Robert; !684]
* Implement subsurface.place_below() for parents [Robert; !664]
* Add meta_window_actor_get_image() [Jonas Å.; !752]
* Revert faulty optimization from !719 [Jonas Å.; #735]
* Add additional sysprof trace points [Jonas Å.; !757, !765]
* Remove GLX "threaded swap wait" used on Nvidia [Daniel; !602]
* Implement geometric picking [Daniel; !189]
* Fix lost keyboard focus after DND [Olivier; #747]
* Misc. bug fixes and cleanups [Florian, Carlos, Piotr, Hans, Georges, Robert,
Ray, Mart, Rémi; !740, !672, !749, !751, !753, !730, !755, !756, !750, !715,
#738944, !657, !768]
Contributors:
Jonas Ådahl, Rémi Bernon, Piotr Drąg, Jonas Dreßler, Olivier Fourdan,
Carlos Garnacho, Hans de Goede, Robert Mader, Florian Müllner,
Georges Basile Stavracas Neto, Mart Raudsepp, Ray Strode, Daniel van Vugt
Translators:
Piotr Drąg [pl], Марко Костић [sr], Rūdolfs Mazurs [lv], Matej Urbančič [sl],
Balázs Úr [hu], Fran Dieguez [gl], Jordi Mas [ca], Anders Jonsson [sv],
Trần Ngọc Quân [vi], Tim Sabsch [de], Fabio Tomat [fur], Goran Vidović [hr],
Marek Černocký [cs]
3.33.91
=======
* Fix primary selection copy and paste between X11 and wayland [Hans; #702]
* Improve monitor hotplug support [Hans; !713]
* Remove a source of frame skips [Daniel; !719]
* Fix windows being lowered after unmaximizing with double click [Olivier; #88]
* Remove Clutter API for global grabs [Jonas D.; !536]
* Improve processing of incompressible events [Daniel; !711]
* Add xdg-output v3 support [Olivier; !704]
* Misc. bug fixes and cleanups [Jonas Å., Marco, Carlos, Adam, Albert, Niels,
Olivier, Florian; !722, !385, !728, !726, !500, !731, !727, !700, !735, !738]
Contributors:
Jonas Ådahl, Albert Vaca Cintora, Jonas Dreßler, Olivier Fourdan,
Carlos Garnacho, Hans de Goede, Niels De Graef, Adam Jackson, Florian Müllner,
Marco Trevisan (Treviño), Daniel van Vugt
Translators:
Asier Sarasua Garmendia [eu], Kukuh Syafaat [id], Florentina Mușat [ro],
Aurimas Černius [lt], Daniel Mustieles [es]
3.33.90
=======
* Fix visibility of clones with hidden source [Florian; #683]
* Reduce freezes when opening some popup windows [Carlos; #556]
* Be more thorough when excluding obscured areas from painting [Carlos; !698]
* Make it possible to start Xwayland on demand [Carlos; !709]
* clutter: Expose layout_manager to transitions [Florian; !716]
* Misc. bug fixes and cleanups [Mark, Florian, Iain, Niels, Carlos, Ray; !671,
!691, !694, !696, !703, !707, !697, !710, !708, !714, #719, !721]
Contributors:
Mark Blakeney, Carlos Garnacho, Niels De Graef, Iain Lane, Florian Müllner,
Ray Strode
Translators:
Asier Sarasua Garmendia [eu], Rafael Fontenelle [pt_BR], Fabio Tomat [fur],
Florentina Mușat [ro]
3.33.4
======
* Discard page flip retries on hotplug [Jonas; !630]
* Add xdg-output v2 support [Olivier; #645]
* Restore DRM format fallbacks [Jonas; !662]
* Don't emit ::size-changed when only position changed [Daniel; !568]
* Expose workspace layout properties [Florian; !618]
* Don't use grab modifiers when shortcuts are inhibited [Olivier; #642]
* Fix stuttering due to unchanged power save mode notifications [Georges; !674]
* Add API to reorder workspaces [Adam; !670]
* Make picking a new focus window more reliable [Marco; !669]
* Defer actor allocation till shown [Carlos; !677]
* Try to use primary GPU for copy instead of glReadPixels [Pekka; !615]
* Unset pointer focus when the cursor is hidden [Jonas D.; !448]
* Fix modifier-drag on wayland subsurfaces [Robert; !604]
* Fix background corruption on Nvidia after resuming from suspend [Daniel; !600]
* Only grab the locate-pointer key when necessary [Olivier; !685, #647]
* Misc. bug fixes and cleanups [Florian, Jonas, Daniel, Robert, Olivier,
Georges, Marco, Carlos, Emmanuele; !648, !650, !647, !656, !658, !637,
!663, !660, !659, !665, !666, !668, !667, #667, !676, !678, #672, !680,
!683, !688, !689, !687]
Contributors:
Jonas Ådahl, Emmanuele Bassi, Adam Bieńkowski, Piotr Drąg, Jonas Dreßler,
Olivier Fourdan, Carlos Garnacho, Robert Mader, Florian Müllner,
Georges Basile Stavracas Neto, Pekka Paalanen, Marco Trevisan (Treviño),
Daniel van Vugt
Translators:
Fabio Tomat [fur], Kukuh Syafaat [id]
3.33.3
======
* Prepare for running Xwayland on demand [Carlos; !420]
* Fix text selection color rendering [Florian; #494]
* Fix black shadows when using fractional scaling [Robert; #609]
* Honor startup sequence workspace on wayland [Carlos; gnome-shell#674]
* Only emit 'grab-op-end` signal after dropping grabs [Marco; !596]
* Add a Sysprof-based profiler [Jonas, Georges; !197, !603]
* Relax "xwayland-allow-grabs" setting [Olivier; #597]
* Implement locate-pointer accessibility feature [Olivier; !453]
* Implement mouse accessibility [Olivier; !512]
* Consolidate frame throttling [Daniel, Georges; !363]
* Fix setting blank cursor under wayland [Jonas; #630]
* Pixel-align OpenGL cursors [Jonas; !610]
* Handle returning from fullscreen/maximization better [Jonas; !621]
* Improve screencast support on multi-monitor systems [Georges; !623]
* Fix running X11 applications with sudo under wayland [Hans; #643]
* Implement toggle-keys notification [Olivier; #637]
* Add initial KMS transactional support [Jonas; !525]
* Improve finding new focus window when the old one is closed [Marco; #308]
* Misc. bug fixes and cleanups [Jonas, Carlos, Marco, Florian, Pekka, Robert,
Douglas, Georges, Daniel, Emil, Niels, Hans, Olivier, Ting-Wei, Corentin;
!591, #398, !592, !581, !597, !598, !593, !497, #591, !545, gtk#1675, !601,
#568, !564, !605, !609, !115, !214, !611, !617, !616, !619, !624, !622, !627,
!628, !629, !632, !633, !631, !636, !639, !638, !634, !640, !529, !644, !590]
Contributors:
Jonas Ådahl, Piotr Drąg, Olivier Fourdan, Carlos Garnacho, Hans de Goede,
Niels De Graef, Ting-Wei Lan, Robert Mader, Florian Müllner,
Georges Basile Stavracas Neto, Corentin Noël, Pekka Paalanen, Douglas R. Reno,
Marco Trevisan (Treviño), Emil Velikov, Daniel van Vugt
Translators:
Balázs Úr [hu], Daniel Mustieles [es], Nathan Follens [nl], Goran Vidović [hr]
3.33.2
======
* Fix rendering lag on Xorg [Daniel; !520, !281]
* Misc. bug fixes and cleanups [Carlos, Marco, Jonas D., Florian, Niels,
Daniel, Benjamin, Jonas Å., Ignacio, Vasilis; #598, !576, !547, !578,
!583, !582, !469, !524, !119, !571, !584, !585, !586, #425]
Contributors:
Jonas Ådahl, Benjamin Berg, Jonas Dreßler, Carlos Garnacho, Niels De Graef,
Vasilis Liaskovitis, Florian Müllner, Ignacio Casal Quinteiro,
Marco Trevisan (Treviño), Daniel van Vugt
Translators:
Daniel Mustieles [es]
3.33.1
======
* Remove unused APIs and outdated driver support
[Adam; !481, !468, !489, !487, !546]
* Enable EGL_IMG_context_priority [Adam; !454]
* Disable mouse keys with Numlock on [Olivier; #530]
* Fix crash when restarting on X11 [Marco; #576]
* Implement clipboard manager [Carlos; !320]
* Fix spurious idle signals that prevent session unblank [Jonas Å.; !543]
* Fix mapping of touchscreens that don't report dimensions [Carlos; #581]
* Fix propagating fractional scaling factor [Robert; !537]
* Add experimental RT scheduling support [Carlos; !460]
* Misc. bug fixes and cleanups [Robert, Carlos, Olivier, Ray, Marco, Jonas D.,
Georges, Daniel V., Daniel M; !467, !504, !551, !552, #575, #556, !557, !442,
!562, !535, !548, #586, !567, !396, !422, !507]
Contributors:
Jonas Ådahl, Piotr Drąg, Jonas Dreßler, Olivier Fourdan, Carlos Garnacho,
Adam Jackson, Robert Mader, Daniel García Moreno, Florian Müllner,
Georges Basile Stavracas Neto, Ray Strode, Marco Trevisan (Treviño),
Daniel van Vugt
Translators:
Daniel Mustieles [es], Fabio Tomat [fur], Kukuh Syafaat [id]
3.32.1
======
* Fix fallback app menu on wayland [Florian; #493]
* Fix elogind support [Tom; !491]
* Fix startup notifications not timing out [Carlos; #501]
* Fix keyboard accessibility toggle from keys
[Olivier, Carlos; !501, #529, !531]
* Fix touchscreen input on rotated displays [Carlos; #514]
* Work around hangul text input bug [Carlos; #1365]
* Fix blurry wallpaper scaling [Daniel; !505]
* Fix placement of window menu when using fractional scaling [Jan; #527]
* Fix repaint issues of offscreen effects on secondary monitors [Daniel; !511]
* Fix windows not getting focus after launch [Daniel; #505]
* Properly advertise support for 'underscan' property [Jonas; !507]
* Improve power-saving handling [Jonas; !506]
* Fix moving windows by super+touch [Jonas D.; !495]
* Misc. bug fixes and cleanups [Benjamin, Florian, Adam, Marco, Pablo,
Erik, Jonas, Heiher, Pekka, Daniel, Olivier, Carlos; !478, !475, !480,
!482, #490, !488, #491, #480, !477, !496, !492, !485, !515, !519, !521,
!216, !538, #541, #523]
Contributors:
Jonas Ådahl, Pablo Barciela, Benjamin Berg, Tom Briden, Jonas Dreßler,
Olivier Fourdan, Carlos Garnacho, Jan Alexander Steffens (heftig), Heiher,
Adam Jackson, Erik Kurzinger, Florian Müllner, Pekka Paalanen,
Marco Trevisan (Treviño), Daniel van Vugt
Translators:
Khaled Hosny [ar], Goran Vidović [hr], Daniel Mustieles [es]
3.32.0
======
* Fix deadlock when cancelling a theme sound [Andrea; !474]
* Stop swizzling BGRA buffers (bye-bye inverted colors in screenshots
and animations) [Carlos; !486]
Contributors:
Andrea Azzarone, Carlos Garnacho, Robert Mader
3.31.92
=======
* Fix flicker of apps that use multiple SHM buffers [Jonas Å.; #199]
* Don't disable page flips after temporary failues [Jonas Å.; #460]
* Improve redraw performance [Carlos; !196]
* Add cursor-mode support to window screencasting [Jonas Å.; !413]
* Add back support for system-wide monitor configurations [Jonas Å.; !253]
* Add fractional scaling support [Marco, Jonas Å.; !3]
* Consider remapped keys when guessing keycode from keysym [Andrea; #443]
* Stop turning on-screen-keyboard off on focus changes [Carlos; !432]
* Fix crashes [Robert, Carlos, Jonas D., Florian; !447, #361, !426, #479]
* Misc. bug fixes and cleanups [Benjamin, Adam, Olivier, Niels, Piotr; !457,
!452, !459, !380, !361, !461, !464, !471, !473, !463]
Contributors:
Jonas Ådahl, Andrea Azzarone, Benjamin Berg, Piotr Drąg, Jonas Dreßler,
Olivier Fourdan, Carlos Garnacho, Niels De Graef, Adam Jackson, Robert Mader,
Florian Müllner, Marco Trevisan (Treviño)
Translators:
Milo Casagrande [it], Tim Sabsch [de], Trần Ngọc Quân [vi],
Gwan-gyeong Mun [ko], Марко Костић [sr], Daniel Mustieles [es],
Rūdolfs Mazurs [lv], Nathan Follens [nl]
3.31.91
=======
* Fix infinite loop in EDID matching [Marco; #459]
* wayland: Don't resetin text-input state prematurely [Carlos; !410]
* wayland: Don't maximize windows if minimum size is too big [Olivier; #463]
* Fix crash when using "restore shortcuts" without focus window [Olivier; #464]
* Add flag parameter to grab accelerator API [Andrea; !169]
* Reuse old CRTC if possible to avoid flicker on hotplug [Pekka, Emilio; #373]
* Misc. bug fixes and cleanups [Marco, Jonas, Niels, Adam, Olivier; !436,
!421, #462, !439, !440, !444, !321, !445, !456]
Contributors:
Jonas Ådahl, Andrea Azzarone, Olivier Fourdan, Carlos Garnacho,
Niels De Graef, Adam Jackson, Emilio Pozuelo Monfort, Pekka Paalanen,
Marco Trevisan (Treviño)
Translators:
Jiri Grönroos [fi], Charles Monzat [fr], Claude Paroz [fr], Fran Dieguez [gl],
Emin Tufan Çetin [tr], Aurimas Černius [lt], Anders Jonsson [sv],
Matej Urbančič [sl], Marek Cernocky [cs], Daniel Șerbănescu [ro],
Alan Mortensen [da], Baurzhan Muftakhidinov [kk], Yi-Jyun Pan [zh_TW],
Daniel Mustieles [es], Rafael Fontenelle [pt_BR]
3.31.90
=======
* Fix support of extended characters in on-screen keyboard [Andrea; #109]
* Improve selection of the primary GPU [Pekka, Emilio; !271]
* Screen-cast cursor updates as PipeWire stream metadata [Jonas; !357]
* Fix rendering glitches in magnifier [Daniel; gnome-shell#387]
* Fix monitor recording on HiDPI [Jonas; !415]
* Honour secondary GPU supported pixel formats [Pekka; !341]
* Fall back to CPU copy path when using a software renderer [Emilio; !325]
* Remove fallback app menu [Florian; gnome-shell#624]
* wayland: Add support for viewporter protocol [Robert; !323]
* Misc. bug fixes and cleanups [Florian, Carlos, Olivier, Marco, Robert,
Daniel, Pekka, Jonas, Ole, Georges; !391, #335, #442, !406, !395, #447,
!375, gnome-shell#349, #451, !416, #784199, !408, !181, !405]
Contributors:
Jonas Ådahl, Andrea Azzarone, Ole Jørgen Brønner, Piotr Drąg, Olivier Fourdan,
Dariusz Gadomski, Carlos Garnacho, Antoine Jacoutot, Iain Lane, Robert Mader,
Emilio Pozuelo Monfort, Florian Müllner, Georges Basile Stavracas Neto,
Pekka Paalanen, Marco Trevisan (Treviño), Josh Triplett, Daniel van Vugt
Translators:
Fabio Tomat [fur], Balázs Úr [hu], Daniel Mustieles [es], Kukuh Syafaat [id],
Jordi Mas [ca], Piotr Drąg [pl]
3.31.4
======
* keybindings: Limit corner move to current monitor [Jānis; #320]

View File

@ -22,6 +22,20 @@ by Gala, elementary OS's window manager. It can also be run standalone, using
the command "mutter", but just running plain mutter is only intended for
debugging purposes.
## Contributing
To contribute, open merge requests at https://gitlab.gnome.org/GNOME/mutter.
The coding style used is primarily the GNU flavor of the [GNOME coding
style](https://developer.gnome.org/programming-guidelines/stable/c-coding-style.html.en)
with some minor additions such as preferring `stdint.h` types over GLib
fundamental types, and a soft 80 character line limit. However, in general,
look at the file you're editing for inspiration.
Commit messages should follow the [GNOME commit message
guidelines](https://wiki.gnome.org/Git/CommitMessages). We require an URL
to either an issue or a merge request in each commit.
## License
Mutter is distributed under the terms of the GNU General Public License,

View File

@ -737,11 +737,7 @@ cally_actor_grab_focus (AtkComponent *component)
*
* This gets the top level origin, it is, the position of the stage in
* the global screen. You can see it as the absolute display position
* of the stage.
*
* FIXME: only the case with x11 is implemented, other backends are
* required
*
* of the stage. This is 0,0 for a compositor.
*/
void
_cally_actor_get_top_level_origin (ClutterActor *actor,
@ -749,54 +745,11 @@ _cally_actor_get_top_level_origin (ClutterActor *actor,
gint *yp)
{
/* default values */
gint x = 0;
gint y = 0;
#ifdef CLUTTER_WINDOWING_X11
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
{
ClutterActor *stage = NULL;
Display *display = NULL;
Window root_window;
Window stage_window;
Window child;
gint return_val = 0;
stage = clutter_actor_get_stage (actor);
/* FIXME: what happens if you use another display with
clutter_backend_x11_set_display ?*/
display = clutter_x11_get_default_display ();
root_window = clutter_x11_get_root_window ();
stage_window = clutter_x11_get_stage_window (CLUTTER_STAGE (stage));
return_val = XTranslateCoordinates (display, stage_window, root_window,
0, 0, &x, &y,
&child);
if (!return_val)
g_warning ("[x11] We were not able to get proper absolute "
"position of the stage");
}
else
#endif
{
static gboolean yet_warned = FALSE;
if (!yet_warned)
{
yet_warned = TRUE;
g_warning ("The current Clutter backend does not support using "
"atk_component_get_extents() with ATK_XY_SCREEN.");
}
}
if (xp)
*xp = x;
*xp = 0;
if (yp)
*yp = y;
*yp = 0;
}
/* AtkAction implementation */
@ -1044,10 +997,8 @@ _cally_actor_clean_action_list (CallyActor *cally_actor)
if (priv->action_list)
{
g_list_foreach (priv->action_list,
(GFunc) _cally_actor_destroy_action_info,
NULL);
g_list_free (priv->action_list);
g_list_free_full (priv->action_list,
(GDestroyNotify) _cally_actor_destroy_action_info);
priv->action_list = NULL;
}
}

View File

@ -75,8 +75,8 @@ struct _CallyRootPrivate
GSList *stage_list;
/* signals id */
guint stage_added_id;
guint stage_removed_id;
gulong stage_added_id;
gulong stage_removed_id;
};
G_DEFINE_TYPE_WITH_PRIVATE (CallyRoot, cally_root, ATK_TYPE_GOBJECT_ACCESSIBLE)
@ -149,11 +149,9 @@ cally_root_finalize (GObject *object)
stage_manager = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (root));
g_signal_handler_disconnect (stage_manager,
root->priv->stage_added_id);
g_clear_signal_handler (&root->priv->stage_added_id, stage_manager);
g_signal_handler_disconnect (stage_manager,
root->priv->stage_added_id);
g_clear_signal_handler (&root->priv->stage_removed_id, stage_manager);
G_OBJECT_CLASS (cally_root_parent_class)->finalize (object);
}

View File

@ -0,0 +1,12 @@
#ifndef __CLUTTER_ACTOR_BOX_PRIVATE_H__
#define __CLUTTER_ACTOR_BOX_PRIVATE_H__
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
void _clutter_actor_box_enlarge_for_effects (ClutterActorBox *box);
G_END_DECLS
#endif /* __CLUTTER_ACTOR_BOX_PRIVATE_H__ */

View File

@ -5,6 +5,7 @@
#include "clutter-types.h"
#include "clutter-interval.h"
#include "clutter-private.h"
#include "clutter-actor-box-private.h"
/**
* clutter_actor_box_new:
@ -542,6 +543,78 @@ clutter_actor_box_set_size (ClutterActorBox *box,
box->y2 = box->y1 + height;
}
void
_clutter_actor_box_enlarge_for_effects (ClutterActorBox *box)
{
float width, height;
/* The aim here is that for a given rectangle defined with floating point
* coordinates we want to determine a stable quantized size in pixels
* that doesn't vary due to the original box's sub-pixel position.
*
* The reason this is important is because effects will use this
* API to determine the size of offscreen framebuffers and so for
* a fixed-size object that may be animated accross the screen we
* want to make sure that the stage paint-box has an equally stable
* size so that effects aren't made to continuously re-allocate
* a corresponding fbo.
*
* The other thing we consider is that the calculation of this box is
* subject to floating point precision issues that might be slightly
* different to the precision issues involved with actually painting the
* actor, which might result in painting slightly leaking outside the
* user's calculated paint-volume. For this we simply aim to pad out the
* paint-volume by at least half a pixel all the way around.
*/
width = box->x2 - box->x1;
height = box->y2 - box->y1;
width = CLUTTER_NEARBYINT (width);
height = CLUTTER_NEARBYINT (height);
/* XXX: NB the width/height may now be up to 0.5px too small so we
* must also pad by 0.25px all around to account for this. In total we
* must padd by at least 0.75px around all sides. */
/* XXX: The furthest that we can overshoot the bottom right corner by
* here is 1.75px in total if you consider that the 0.75 padding could
* just cross an integer boundary and so ceil will effectively add 1.
*/
box->x2 = ceilf (box->x2 + 0.75);
box->y2 = ceilf (box->y2 + 0.75);
/* Now we redefine the top-left relative to the bottom right based on the
* rounded width/height determined above + a constant so that the overall
* size of the box will be stable and not dependant on the box's
* position.
*
* Adding 3px to the width/height will ensure we cover the maximum of
* 1.75px padding on the bottom/right and still ensure we have > 0.75px
* padding on the top/left.
*/
box->x1 = box->x2 - width - 3;
box->y1 = box->y2 - height - 3;
}
/**
* clutter_actor_box_scale:
* @box: a #ClutterActorBox
* @scale: scale factor for resizing this box
*
* Rescale the @box by provided @scale factor.
*
* Since: 1.6
*/
void
clutter_actor_box_scale (ClutterActorBox *box,
gfloat scale)
{
g_return_if_fail (box != NULL);
box->x1 *= scale;
box->x2 *= scale;
box->y1 *= scale;
box->y2 *= scale;
}
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterActorBox, clutter_actor_box,
clutter_actor_box_copy,
clutter_actor_box_free,

View File

@ -577,8 +577,7 @@ _clutter_meta_group_clear_metas (ClutterMetaGroup *group)
{
g_list_foreach (group->meta, (GFunc) _clutter_actor_meta_set_actor, NULL);
g_list_foreach (group->meta, (GFunc) g_object_unref, NULL);
g_list_free (group->meta);
g_list_free_full (group->meta, g_object_unref);
group->meta = NULL;
}

View File

@ -53,7 +53,8 @@ typedef enum
* Controls some options for how clutter_actor_traverse() iterates
* through the graph.
*/
typedef enum {
typedef enum
{
CLUTTER_ACTOR_TRAVERSE_DEPTH_FIRST = 1L<<0,
CLUTTER_ACTOR_TRAVERSE_BREADTH_FIRST = 1L<<1
} ClutterActorTraverseFlags;
@ -74,7 +75,8 @@ typedef enum {
* the continuing traversal. It may stop traversal completely, just
* skip over children for the current actor or continue as normal.
*/
typedef enum {
typedef enum
{
CLUTTER_ACTOR_TRAVERSE_VISIT_CONTINUE = 1L<<0,
CLUTTER_ACTOR_TRAVERSE_VISIT_SKIP_CHILDREN = 1L<<1,
CLUTTER_ACTOR_TRAVERSE_VISIT_BREAK = 1L<<2
@ -240,9 +242,6 @@ ClutterAnimationInfo * _clutter_actor_get_animation_info
ClutterTransition * _clutter_actor_create_transition (ClutterActor *self,
GParamSpec *pspec,
...);
ClutterTransition * _clutter_actor_get_transition (ClutterActor *self,
GParamSpec *pspec);
gboolean _clutter_actor_foreach_child (ClutterActor *self,
ClutterForeachCallback callback,
gpointer user_data);
@ -275,6 +274,9 @@ void _clutter_actor_set_enable_paint_unmapped
void _clutter_actor_set_has_pointer (ClutterActor *self,
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,
ClutterRedrawFlags flags,
const ClutterPaintVolume *clip_volume);
@ -283,9 +285,6 @@ void _clutter_actor_queue_redraw_full
const ClutterPaintVolume *volume,
ClutterEffect *effect);
ClutterPaintVolume * _clutter_actor_get_queue_redraw_clip (ClutterActor *self);
void _clutter_actor_set_queue_redraw_clip (ClutterActor *self,
ClutterPaintVolume *clip_volume);
void _clutter_actor_finish_queue_redraw (ClutterActor *self,
ClutterPaintVolume *clip);
@ -298,8 +297,6 @@ const gchar * _clutter_actor_get_debug_name
void _clutter_actor_push_clone_paint (void);
void _clutter_actor_pop_clone_paint (void);
guint32 _clutter_actor_get_pick_id (ClutterActor *self);
void _clutter_actor_shader_pre_paint (ClutterActor *actor,
gboolean repeat);
void _clutter_actor_shader_post_paint (ClutterActor *actor);
@ -316,8 +313,11 @@ void _clutter_actor_detach_clone
void _clutter_actor_queue_redraw_on_clones (ClutterActor *actor);
void _clutter_actor_queue_relayout_on_clones (ClutterActor *actor);
void _clutter_actor_queue_only_relayout (ClutterActor *actor);
void _clutter_actor_queue_update_resource_scale_recursive (ClutterActor *actor);
CoglFramebuffer * _clutter_actor_get_active_framebuffer (ClutterActor *actor);
gboolean _clutter_actor_get_real_resource_scale (ClutterActor *actor,
float *resource_scale);
ClutterPaintNode * clutter_actor_create_texture_paint_node (ClutterActor *self,
CoglTexture *texture);

File diff suppressed because it is too large Load Diff

View File

@ -236,8 +236,9 @@ struct _ClutterActorClass
void (* pick) (ClutterActor *actor,
const ClutterColor *color);
void (* queue_redraw) (ClutterActor *actor,
ClutterActor *leaf_that_queued);
gboolean (* queue_redraw) (ClutterActor *actor,
ClutterActor *leaf_that_queued,
ClutterPaintVolume *paint_volume);
/* size negotiation */
void (* get_preferred_width) (ClutterActor *self,
@ -583,6 +584,11 @@ gboolean clutter_actor_is_in_clone_paint
CLUTTER_EXPORT
gboolean clutter_actor_get_paint_box (ClutterActor *self,
ClutterActorBox *box);
CLUTTER_EXPORT
gboolean clutter_actor_get_resource_scale (ClutterActor *self,
gfloat *resource_scale);
CLUTTER_EXPORT
gboolean clutter_actor_has_overlaps (ClutterActor *self);
@ -896,6 +902,10 @@ void clutter_actor_bind_model_with_properties
const char *first_model_property,
...);
CLUTTER_EXPORT
void clutter_actor_pick_box (ClutterActor *self,
const ClutterActorBox *box);
G_END_DECLS
#endif /* __CLUTTER_ACTOR_H__ */

View File

@ -30,7 +30,7 @@
* to control how a #ClutterAnimation will animate a property.
*
* Each #ClutterAnimatable should implement the
* #ClutterAnimatableIface.interpolate_property() virtual function of the
* #ClutterAnimatableInterface.interpolate_property() virtual function of the
* interface to compute the animation state between two values of an interval
* depending on a progress factor, expressed as a floating point value.
*
@ -57,7 +57,6 @@
#include "deprecated/clutter-animatable.h"
#include "deprecated/clutter-animation.h"
typedef ClutterAnimatableIface ClutterAnimatableInterface;
G_DEFINE_INTERFACE (ClutterAnimatable, clutter_animatable, G_TYPE_OBJECT);
static void
@ -101,7 +100,7 @@ clutter_animatable_animate_property (ClutterAnimatable *animatable,
gdouble progress,
GValue *value)
{
ClutterAnimatableIface *iface;
ClutterAnimatableInterface *iface;
gboolean res;
g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), FALSE);
@ -155,7 +154,7 @@ GParamSpec *
clutter_animatable_find_property (ClutterAnimatable *animatable,
const gchar *property_name)
{
ClutterAnimatableIface *iface;
ClutterAnimatableInterface *iface;
g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), NULL);
g_return_val_if_fail (property_name != NULL, NULL);
@ -185,7 +184,7 @@ clutter_animatable_get_initial_state (ClutterAnimatable *animatable,
const gchar *property_name,
GValue *value)
{
ClutterAnimatableIface *iface;
ClutterAnimatableInterface *iface;
g_return_if_fail (CLUTTER_IS_ANIMATABLE (animatable));
g_return_if_fail (property_name != NULL);
@ -214,7 +213,7 @@ clutter_animatable_set_final_state (ClutterAnimatable *animatable,
const gchar *property_name,
const GValue *value)
{
ClutterAnimatableIface *iface;
ClutterAnimatableInterface *iface;
g_return_if_fail (CLUTTER_IS_ANIMATABLE (animatable));
g_return_if_fail (property_name != NULL);
@ -260,7 +259,7 @@ clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
gdouble progress,
GValue *value)
{
ClutterAnimatableIface *iface;
ClutterAnimatableInterface *iface;
g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), FALSE);
g_return_val_if_fail (property_name != NULL, FALSE);

View File

@ -33,24 +33,15 @@
G_BEGIN_DECLS
#define CLUTTER_TYPE_ANIMATABLE (clutter_animatable_get_type ())
#define CLUTTER_ANIMATABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ANIMATABLE, ClutterAnimatable))
#define CLUTTER_IS_ANIMATABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ANIMATABLE))
#define CLUTTER_ANIMATABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_ANIMATABLE, ClutterAnimatableIface))
#define CLUTTER_TYPE_ANIMATABLE (clutter_animatable_get_type ())
typedef struct _ClutterAnimatableIface ClutterAnimatableIface;
CLUTTER_EXPORT
G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable,
CLUTTER, ANIMATABLE,
GObject)
/**
* ClutterAnimatable:
*
* #ClutterAnimatable is an opaque structure whose members cannot be directly
* accessed
*
* Since: 1.0
*/
/**
* ClutterAnimatableIface:
* ClutterAnimatableInterface:
* @animate_property: virtual function for custom interpolation of a
* property. This virtual function is deprecated
* @find_property: virtual function for retrieving the #GParamSpec of
@ -67,7 +58,7 @@ typedef struct _ClutterAnimatableIface ClutterAnimatableIface;
*
* Since: 1.0
*/
struct _ClutterAnimatableIface
struct _ClutterAnimatableInterface
{
/*< private >*/
GTypeInterface parent_iface;
@ -95,9 +86,6 @@ struct _ClutterAnimatableIface
GValue *value);
};
CLUTTER_EXPORT
GType clutter_animatable_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
GParamSpec *clutter_animatable_find_property (ClutterAnimatable *animatable,
const gchar *property_name);

View File

@ -34,7 +34,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAction, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorMeta, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAlignConstraint, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAnimatable, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindConstraint, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindingPool, g_object_unref)
@ -49,10 +48,8 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColorizeEffect, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContainer, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContent, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeformEffect, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeviceManager, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDragAction, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDropAction, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterEffect, g_object_unref)

View File

@ -24,10 +24,9 @@
#include <clutter/clutter-backend.h>
#include <clutter/clutter-device-manager.h>
#include <clutter/clutter-keymap.h>
#include <clutter/clutter-stage-window.h>
#include "clutter-event-translator.h"
#define CLUTTER_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND, ClutterBackendClass))
#define CLUTTER_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND))
#define CLUTTER_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BACKEND, ClutterBackendClass))
@ -57,9 +56,11 @@ struct _ClutterBackend
gfloat units_per_em;
gint32 units_serial;
GList *event_translators;
ClutterStageWindow *stage_window;
ClutterInputMethod *input_method;
ClutterKeymap *keymap;
};
struct _ClutterBackendClass
@ -90,12 +91,6 @@ struct _ClutterBackendClass
GError **error);
ClutterDeviceManager *(* get_device_manager) (ClutterBackend *backend);
void (* copy_event_data) (ClutterBackend *backend,
const ClutterEvent *src,
ClutterEvent *dest);
void (* free_event_data) (ClutterBackend *backend,
ClutterEvent *event);
gboolean (* translate_event) (ClutterBackend *backend,
gpointer native,
ClutterEvent *event);
@ -104,6 +99,8 @@ struct _ClutterBackendClass
void (* bell_notify) (ClutterBackend *backend);
ClutterKeymap * (* get_keymap) (ClutterBackend *backend);
/* signals */
void (* resolution_changed) (ClutterBackend *backend);
void (* font_changed) (ClutterBackend *backend);
@ -131,17 +128,11 @@ void _clutter_backend_copy_event_data (Clutter
ClutterEvent *dest);
void _clutter_backend_free_event_data (ClutterBackend *backend,
ClutterEvent *event);
CLUTTER_EXPORT
gboolean _clutter_backend_translate_event (ClutterBackend *backend,
gpointer native,
ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_backend_add_event_translator (ClutterBackend *backend,
ClutterEventTranslator *translator);
void _clutter_backend_remove_event_translator (ClutterBackend *backend,
ClutterEventTranslator *translator);
ClutterFeatureFlags _clutter_backend_get_features (ClutterBackend *backend);
gfloat _clutter_backend_get_units_per_em (ClutterBackend *backend,
@ -155,7 +146,8 @@ void _clutter_backend_reset_cogl_framebuffer (Clutter
void clutter_set_allowed_drivers (const char *drivers);
void clutter_try_set_windowing_backend (const char *drivers);
CLUTTER_EXPORT
ClutterStageWindow * clutter_backend_get_stage_window (ClutterBackend *backend);
G_END_DECLS

View File

@ -53,9 +53,6 @@
#include "clutter-stage-window.h"
#include "clutter-device-manager-private.h"
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "deprecated/clutter-backend.h"
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
#include "wayland/clutter-wayland-compositor.h"
#endif
@ -65,9 +62,6 @@
#ifdef CLUTTER_INPUT_X11
#include "x11/clutter-backend-x11.h"
#endif
#ifdef CLUTTER_INPUT_EVDEV
#include "evdev/clutter-device-manager-evdev.h"
#endif
#ifdef CLUTTER_WINDOWING_EGL
#include "egl/clutter-backend-eglnative.h"
#endif
@ -107,10 +101,12 @@ clutter_backend_dispose (GObject *gobject)
/* clear the events still in the queue of the main context */
_clutter_clear_events_queue ();
/* remove all event translators */
g_clear_pointer (&backend->event_translators, g_list_free);
g_clear_pointer (&backend->dummy_onscreen, cogl_object_unref);
if (backend->stage_window)
{
g_object_remove_weak_pointer (G_OBJECT (backend->stage_window),
(gpointer *) &backend->stage_window);
}
G_OBJECT_CLASS (clutter_backend_parent_class)->dispose (gobject);
}
@ -400,7 +396,7 @@ clutter_backend_real_create_context (ClutterBackend *backend,
else
g_set_error_literal (error, CLUTTER_INIT_ERROR,
CLUTTER_INIT_ERROR_BACKEND,
_("Unable to initialize the Clutter backend: no available drivers found."));
"Unable to initialize the Clutter backend: no available drivers found.");
return FALSE;
}
@ -529,40 +525,7 @@ _clutter_create_backend (void)
static void
clutter_backend_real_init_events (ClutterBackend *backend)
{
const char *input_backend = NULL;
input_backend = g_getenv ("CLUTTER_INPUT_BACKEND");
if (input_backend != NULL)
input_backend = g_intern_string (input_backend);
#ifdef CLUTTER_INPUT_X11
if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11) &&
(input_backend == NULL || input_backend == I_(CLUTTER_INPUT_X11)))
{
_clutter_backend_x11_events_init (backend);
}
else
#endif
#ifdef CLUTTER_INPUT_EVDEV
/* Evdev can be used regardless of the windowing system */
if ((input_backend != NULL && strcmp (input_backend, CLUTTER_INPUT_EVDEV) == 0)
#ifdef CLUTTER_WINDOWING_EGL
/* but we do want to always use it for EGL native */
|| clutter_check_windowing_backend (CLUTTER_WINDOWING_EGL)
#endif
)
{
_clutter_events_evdev_init (backend);
}
else
#endif
if (input_backend != NULL)
{
if (input_backend != I_(CLUTTER_INPUT_NULL))
g_error ("Unrecognized input backend '%s'", input_backend);
}
else
g_error ("Unknown input backend");
g_error ("Unknown input backend");
}
static ClutterDeviceManager *
@ -577,32 +540,16 @@ clutter_backend_real_get_device_manager (ClutterBackend *backend)
return backend->device_manager;
}
static gboolean
clutter_backend_real_translate_event (ClutterBackend *backend,
gpointer native,
ClutterEvent *event)
static ClutterKeymap *
clutter_backend_real_get_keymap (ClutterBackend *backend)
{
GList *l;
for (l = backend->event_translators;
l != NULL;
l = l->next)
if (G_UNLIKELY (backend->keymap == NULL))
{
ClutterEventTranslator *translator = l->data;
ClutterTranslateReturn retval;
retval = _clutter_event_translator_translate_event (translator,
native,
event);
if (retval == CLUTTER_TRANSLATE_QUEUE)
return TRUE;
if (retval == CLUTTER_TRANSLATE_REMOVE)
return FALSE;
g_critical ("No keymap available, expect broken keyboard input");
return NULL;
}
return FALSE;
return backend->keymap;
}
static void
@ -627,8 +574,7 @@ clutter_backend_class_init (ClutterBackendClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterBackendClass, resolution_changed),
NULL, NULL,
_clutter_marshal_VOID__VOID,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
/**
@ -645,8 +591,7 @@ clutter_backend_class_init (ClutterBackendClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterBackendClass, font_changed),
NULL, NULL,
_clutter_marshal_VOID__VOID,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
/**
@ -663,8 +608,7 @@ clutter_backend_class_init (ClutterBackendClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterBackendClass, settings_changed),
NULL, NULL,
_clutter_marshal_VOID__VOID,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
klass->resolution_changed = clutter_backend_real_resolution_changed;
@ -672,9 +616,9 @@ clutter_backend_class_init (ClutterBackendClass *klass)
klass->init_events = clutter_backend_real_init_events;
klass->get_device_manager = clutter_backend_real_get_device_manager;
klass->translate_event = clutter_backend_real_translate_event;
klass->create_context = clutter_backend_real_create_context;
klass->get_features = clutter_backend_real_get_features;
klass->get_keymap = clutter_backend_real_get_keymap;
}
static void
@ -751,6 +695,10 @@ _clutter_backend_create_stage (ClutterBackend *backend,
g_assert (CLUTTER_IS_STAGE_WINDOW (stage_window));
backend->stage_window = stage_window;
g_object_add_weak_pointer (G_OBJECT (backend->stage_window),
(gpointer *) &backend->stage_window);
return stage_window;
}
@ -835,37 +783,24 @@ _clutter_backend_copy_event_data (ClutterBackend *backend,
const ClutterEvent *src,
ClutterEvent *dest)
{
ClutterEventExtenderInterface *iface;
ClutterBackendClass *klass;
ClutterDeviceManagerClass *device_manager_class;
ClutterDeviceManager *device_manager;
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (CLUTTER_IS_EVENT_EXTENDER (backend->device_manager))
{
iface = CLUTTER_EVENT_EXTENDER_GET_IFACE (backend->device_manager);
iface->copy_event_data (CLUTTER_EVENT_EXTENDER (backend->device_manager),
src, dest);
}
else if (klass->copy_event_data != NULL)
klass->copy_event_data (backend, src, dest);
device_manager = clutter_device_manager_get_default ();
device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
device_manager_class->copy_event_data (device_manager, src, dest);
}
void
_clutter_backend_free_event_data (ClutterBackend *backend,
ClutterEvent *event)
{
ClutterEventExtenderInterface *iface;
ClutterBackendClass *klass;
ClutterDeviceManagerClass *device_manager_class;
ClutterDeviceManager *device_manager;
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (CLUTTER_IS_EVENT_EXTENDER (backend->device_manager))
{
iface = CLUTTER_EVENT_EXTENDER_GET_IFACE (backend->device_manager);
iface->free_event_data (CLUTTER_EVENT_EXTENDER (backend->device_manager),
event);
}
else if (klass->free_event_data != NULL)
klass->free_event_data (backend, event);
device_manager = clutter_device_manager_get_default ();
device_manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
device_manager_class->free_event_data (device_manager, event);
}
/**
@ -890,129 +825,6 @@ clutter_get_default_backend (void)
return clutter_context->backend;
}
/**
* clutter_backend_set_double_click_time:
* @backend: a #ClutterBackend
* @msec: milliseconds between two button press events
*
* Sets the maximum time between two button press events, used to
* verify whether it's a double click event or not.
*
* Since: 0.4
*
* Deprecated: 1.4: Use #ClutterSettings:double-click-time instead
*/
void
clutter_backend_set_double_click_time (ClutterBackend *backend,
guint msec)
{
ClutterSettings *settings = clutter_settings_get_default ();
g_object_set (settings, "double-click-time", msec, NULL);
}
/**
* clutter_backend_get_double_click_time:
* @backend: a #ClutterBackend
*
* Gets the maximum time between two button press events, as set
* by clutter_backend_set_double_click_time().
*
* Return value: a time in milliseconds
*
* Since: 0.4
*
* Deprecated: 1.4: Use #ClutterSettings:double-click-time instead
*/
guint
clutter_backend_get_double_click_time (ClutterBackend *backend)
{
ClutterSettings *settings = clutter_settings_get_default ();
gint retval;
g_object_get (settings, "double-click-time", &retval, NULL);
return retval;
}
/**
* clutter_backend_set_double_click_distance:
* @backend: a #ClutterBackend
* @distance: a distance, in pixels
*
* Sets the maximum distance used to verify a double click event.
*
* Since: 0.4
*
* Deprecated: 1.4: Use #ClutterSettings:double-click-distance instead
*/
void
clutter_backend_set_double_click_distance (ClutterBackend *backend,
guint distance)
{
ClutterSettings *settings = clutter_settings_get_default ();
g_object_set (settings, "double-click-distance", distance, NULL);
}
/**
* clutter_backend_get_double_click_distance:
* @backend: a #ClutterBackend
*
* Retrieves the distance used to verify a double click event
*
* Return value: a distance, in pixels.
*
* Since: 0.4
*
* Deprecated: 1.4: Use #ClutterSettings:double-click-distance instead
*/
guint
clutter_backend_get_double_click_distance (ClutterBackend *backend)
{
ClutterSettings *settings = clutter_settings_get_default ();
gint retval;
g_object_get (settings, "double-click-distance", &retval, NULL);
return retval;
}
/**
* clutter_backend_set_resolution:
* @backend: a #ClutterBackend
* @dpi: the resolution in "dots per inch" (Physical inches aren't
* actually involved; the terminology is conventional).
*
* Sets the resolution for font handling on the screen. This is a
* scale factor between points specified in a #PangoFontDescription
* and cairo units. The default value is 96, meaning that a 10 point
* font will be 13 units high. (10 * 96. / 72. = 13.3).
*
* Applications should never need to call this function.
*
* Since: 0.4
*
* Deprecated: 1.4: Use #ClutterSettings:font-dpi instead
*/
void
clutter_backend_set_resolution (ClutterBackend *backend,
gdouble dpi)
{
ClutterSettings *settings;
gint resolution;
g_return_if_fail (CLUTTER_IS_BACKEND (backend));
if (dpi < 0)
resolution = -1;
else
resolution = dpi * 1024;
settings = clutter_settings_get_default ();
g_object_set (settings, "font-dpi", resolution, NULL);
}
/**
* clutter_backend_get_resolution:
* @backend: a #ClutterBackend
@ -1118,61 +930,6 @@ clutter_backend_get_font_options (ClutterBackend *backend)
return backend->font_options;
}
/**
* clutter_backend_set_font_name:
* @backend: a #ClutterBackend
* @font_name: the name of the font
*
* Sets the default font to be used by Clutter. The @font_name string
* must either be %NULL, which means that the font name from the
* default #ClutterBackend will be used; or be something that can
* be parsed by the pango_font_description_from_string() function.
*
* Since: 1.0
*
* Deprecated: 1.4: Use #ClutterSettings:font-name instead
*/
void
clutter_backend_set_font_name (ClutterBackend *backend,
const gchar *font_name)
{
ClutterSettings *settings = clutter_settings_get_default ();
g_object_set (settings, "font-name", font_name, NULL);
}
/**
* clutter_backend_get_font_name:
* @backend: a #ClutterBackend
*
* Retrieves the default font name as set by
* clutter_backend_set_font_name().
*
* Return value: the font name for the backend. The returned string is
* owned by the #ClutterBackend and should never be modified or freed
*
* Since: 1.0
*
* Deprecated: 1.4: Use #ClutterSettings:font-name instead
*/
const gchar *
clutter_backend_get_font_name (ClutterBackend *backend)
{
ClutterSettings *settings;
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), NULL);
settings = clutter_settings_get_default ();
/* XXX yuck. but we return a const pointer, so we need to
* store it in the backend
*/
g_free (backend->font_name);
g_object_get (settings, "font-name", &backend->font_name, NULL);
return backend->font_name;
}
gint32
_clutter_backend_get_units_serial (ClutterBackend *backend)
{
@ -1189,28 +946,6 @@ _clutter_backend_translate_event (ClutterBackend *backend,
event);
}
void
_clutter_backend_add_event_translator (ClutterBackend *backend,
ClutterEventTranslator *translator)
{
if (g_list_find (backend->event_translators, translator) != NULL)
return;
backend->event_translators =
g_list_prepend (backend->event_translators, translator);
}
void
_clutter_backend_remove_event_translator (ClutterBackend *backend,
ClutterEventTranslator *translator)
{
if (g_list_find (backend->event_translators, translator) == NULL)
return;
backend->event_translators =
g_list_remove (backend->event_translators, translator);
}
/**
* clutter_backend_get_cogl_context: (skip)
* @backend: a #ClutterBackend
@ -1262,61 +997,6 @@ clutter_wayland_set_compositor_display (void *display)
}
#endif
/**
* clutter_set_windowing_backend:
* @backend_type: a comma separated list of windowing backends
*
* Restricts Clutter to only use the specified backend or list of backends.
*
* You can use one of the `CLUTTER_WINDOWING_*` symbols, e.g.
*
* |[<!-- language="C" -->
* clutter_set_windowing_backend (CLUTTER_WINDOWING_X11);
* ]|
*
* Will force Clutter to use the X11 windowing and input backend, and terminate
* if the X11 backend could not be initialized successfully.
*
* Since Clutter 1.26, you can also use a comma-separated list of windowing
* system backends to provide a fallback in case backends are not available or
* enabled, e.g.:
*
* |[<!-- language="C" -->
* clutter_set_windowing_backend ("gdk,wayland,x11");
* ]|
*
* Will make Clutter test for the GDK, Wayland, and X11 backends in that order.
*
* You can use the `*` special value to ask Clutter to use the internally
* defined list of backends. For instance:
*
* |[<!-- language="C" -->
* clutter_set_windowing_backend ("x11,wayland,*");
* ]|
*
* Will make Clutter test the X11 and Wayland backends, and then fall back
* to the internal list of available backends.
*
* This function must be called before the first API call to Clutter, including
* clutter_get_option_context()
*
* Since: 1.16
*/
void
clutter_set_windowing_backend (const char *backend_type)
{
g_return_if_fail (backend_type != NULL);
allowed_backends = g_strdup (backend_type);
}
void
clutter_try_set_windowing_backend (const char *backend_type)
{
if (allowed_backends == NULL)
clutter_set_windowing_backend (backend_type);
}
PangoDirection
_clutter_backend_get_keymap_direction (ClutterBackend *backend)
{
@ -1334,7 +1014,7 @@ _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
{
if (backend->dummy_onscreen == COGL_INVALID_HANDLE)
{
CoglError *internal_error = NULL;
GError *internal_error = NULL;
backend->dummy_onscreen = cogl_onscreen_new (backend->cogl_context, 1, 1);
@ -1342,7 +1022,7 @@ _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
&internal_error))
{
g_critical ("Unable to create dummy onscreen: %s", internal_error->message);
cogl_error_free (internal_error);
g_error_free (internal_error);
return;
}
}
@ -1399,3 +1079,23 @@ clutter_backend_set_input_method (ClutterBackend *backend,
{
g_set_object (&backend->input_method, method);
}
/**
* clutter_backend_get_keymap:
* @backend: the #ClutterBackend
*
* Gets the keymap used by Clutter
*
* Returns: (transfer none): the keymap
**/
ClutterKeymap *
clutter_backend_get_keymap (ClutterBackend *backend)
{
return CLUTTER_BACKEND_GET_CLASS (backend)->get_keymap (backend);
}
ClutterStageWindow *
clutter_backend_get_stage_window (ClutterBackend *backend)
{
return backend->stage_window;
}

View File

@ -34,6 +34,7 @@
#include <cogl/cogl.h>
#include <clutter/clutter-config.h>
#include <clutter/clutter-keymap.h>
#include <clutter/clutter-types.h>
G_BEGIN_DECLS
@ -59,9 +60,6 @@ GType clutter_backend_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterBackend * clutter_get_default_backend (void);
CLUTTER_EXPORT
void clutter_set_windowing_backend (const char *backend_type);
CLUTTER_EXPORT
gdouble clutter_backend_get_resolution (ClutterBackend *backend);
@ -83,6 +81,9 @@ ClutterInputMethod * clutter_backend_get_input_method (Clutter
CLUTTER_EXPORT
void clutter_backend_set_input_method (ClutterBackend *backend,
ClutterInputMethod *method);
CLUTTER_EXPORT
ClutterKeymap * clutter_backend_get_keymap (ClutterBackend *backend);
G_END_DECLS
#endif /* __CLUTTER_BACKEND_H__ */

View File

@ -570,6 +570,68 @@ G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterPoint, clutter_point,
clutter_point_free,
CLUTTER_REGISTER_INTERVAL_PROGRESS (clutter_point_progress))
static int
clutter_point_compare_line (const ClutterPoint *p,
const ClutterPoint *a,
const ClutterPoint *b)
{
float x1 = b->x - a->x;
float y1 = b->y - a->y;
float x2 = p->x - a->x;
float y2 = p->y - a->y;
float cross_z = x1 * y2 - y1 * x2;
if (cross_z > 0.f)
return 1;
else if (cross_z < 0.f)
return -1;
else
return 0;
}
/**
* clutter_point_inside_quadrilateral:
* @point: a #ClutterPoint to test
* @vertices: array of vertices of the quadrilateral, in either clockwise or
* anticlockwise order.
*
* Determines whether a point is inside the convex quadrilateral provided,
* or on any of its edges or vertices.
*
* Returns: %TRUE if @point is inside or touching the quadrilateral
*/
gboolean
clutter_point_inside_quadrilateral (const ClutterPoint *point,
const ClutterPoint *vertices)
{
unsigned int i;
int first_side;
first_side = 0;
for (i = 0; i < 4; i++)
{
int side;
side = clutter_point_compare_line (point,
&vertices[i],
&vertices[(i + 1) % 4]);
if (side)
{
if (first_side == 0)
first_side = side;
else if (side != first_side)
return FALSE;
}
}
if (first_side == 0)
return FALSE;
return TRUE;
}
/*
@ -1146,29 +1208,60 @@ clutter_rect_inset (ClutterRect *rect,
rect->size.height = 0.f;
}
/**
* clutter_rect_scale:
* @rect: a #ClutterRect
* @s_x: an horizontal scale value
* @s_y: a vertical scale value
*
* Scale the rectangle coordinates and size by @s_x horizontally and
* @s_y vertically.
*/
void
clutter_rect_scale (ClutterRect *rect,
float s_x,
float s_y)
{
g_return_if_fail (rect != NULL);
g_return_if_fail (s_x > 0.f);
g_return_if_fail (s_y > 0.f);
clutter_rect_normalize_internal (rect);
rect->origin.x *= s_x;
rect->origin.y *= s_y;
rect->size.width *= s_x;
rect->size.height *= s_y;
}
/**
* clutter_rect_clamp_to_pixel:
* @rect: a #ClutterRect
*
* Rounds the origin of @rect downwards to the nearest integer, and rounds
* the size of @rect upwards to the nearest integer, so that @rect is
* updated to the smallest rectangle capable of fully containing the
* original, fractional rectangle.
* Rounds the origin of @rect downwards to the nearest integer, and recompute the
* the size using the @rect origin and size rounded upwards to the nearest integer,
* so that @rect is updated to the smallest rectangle capable of fully containing
* the original, fractional rectangle in the coordinates space.
*
* Since: 1.12
*/
void
clutter_rect_clamp_to_pixel (ClutterRect *rect)
{
float x2, y2;
g_return_if_fail (rect != NULL);
clutter_rect_normalize_internal (rect);
x2 = rect->origin.x + rect->size.width;
y2 = rect->origin.y + rect->size.height;
rect->origin.x = floorf (rect->origin.x);
rect->origin.y = floorf (rect->origin.y);
rect->size.width = ceilf (rect->size.width);
rect->size.height = ceilf (rect->size.height);
rect->size.width = ceilf (x2) - rect->origin.x;
rect->size.height = ceilf (y2) - rect->origin.y;
}
/**

View File

@ -36,7 +36,7 @@ G_BEGIN_DECLS
typedef struct _ClutterBezier ClutterBezier;
ClutterBezier *_clutter_bezier_new ();
ClutterBezier *_clutter_bezier_new (void);
void _clutter_bezier_free (ClutterBezier * b);

View File

@ -235,8 +235,7 @@ clutter_binding_pool_finalize (GObject *gobject)
g_hash_table_destroy (pool->entries_hash);
g_slist_foreach (pool->entries, (GFunc) binding_entry_free, NULL);
g_slist_free (pool->entries);
g_slist_free_full (pool->entries, (GDestroyNotify) binding_entry_free);
G_OBJECT_CLASS (clutter_binding_pool_parent_class)->finalize (gobject);
}

View File

@ -178,8 +178,8 @@ clutter_blur_effect_paint_target (ClutterOffscreenEffect *effect)
}
static gboolean
clutter_blur_effect_get_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
clutter_blur_effect_modify_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
{
gfloat cur_width, cur_height;
ClutterVertex origin;
@ -223,7 +223,7 @@ clutter_blur_effect_class_init (ClutterBlurEffectClass *klass)
gobject_class->dispose = clutter_blur_effect_dispose;
effect_class->pre_paint = clutter_blur_effect_pre_paint;
effect_class->get_paint_volume = clutter_blur_effect_get_paint_volume;
effect_class->modify_paint_volume = clutter_blur_effect_modify_paint_volume;
offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
offscreen_class->paint_target = clutter_blur_effect_paint_target;
@ -249,9 +249,7 @@ clutter_blur_effect_init (ClutterBlurEffect *self)
cogl_pipeline_add_layer_snippet (klass->base_pipeline, 0, snippet);
cogl_object_unref (snippet);
cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
0, /* layer number */
COGL_TEXTURE_TYPE_2D);
cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
}
self->pipeline = cogl_pipeline_copy (klass->base_pipeline);

View File

@ -150,9 +150,9 @@ typedef struct _RequestedSize
gfloat natural_size;
} RequestedSize;
static gint distribute_natural_allocation (gint extra_space,
guint n_requested_sizes,
RequestedSize *sizes);
static float distribute_natural_allocation (float extra_space,
unsigned int n_requested_sizes,
RequestedSize *sizes);
static void count_expand_children (ClutterLayoutManager *layout,
ClutterContainer *container,
gint *visible_children,
@ -624,7 +624,19 @@ get_preferred_size_for_opposite_orientation (ClutterBoxLayout *self,
else
{
/* Bring children up to size first */
size = distribute_natural_allocation (MAX (0, size), nvis_children, sizes);
if (isnormal (size) || size == 0)
{
size = distribute_natural_allocation (MAX (0, size),
nvis_children,
sizes);
}
else
{
g_critical ("Actor %s (%p) received the invalid "
"value %f as minimum/natural size\n",
G_OBJECT_TYPE_NAME (container), container, size);
size = 0;
}
/* Calculate space which hasn't distributed yet,
* and is available for expanding children.
@ -879,17 +891,18 @@ compare_gap (gconstpointer p1,
*
* Pulled from gtksizerequest.c from Gtk+
*/
static gint
distribute_natural_allocation (gint extra_space,
guint n_requested_sizes,
static float
distribute_natural_allocation (float extra_space,
unsigned int n_requested_sizes,
RequestedSize *sizes)
{
guint *spreading;
gint i;
unsigned int *spreading;
int i;
g_return_val_if_fail (isnormal (extra_space) || extra_space == 0, 0);
g_return_val_if_fail (extra_space >= 0, 0);
spreading = g_newa (guint, n_requested_sizes);
spreading = g_newa (unsigned int, n_requested_sizes);
for (i = 0; i < n_requested_sizes; i++)
spreading[i] = i;
@ -913,7 +926,7 @@ distribute_natural_allocation (gint extra_space,
/* Sort descending by gap and position. */
g_qsort_with_data (spreading,
n_requested_sizes, sizeof (guint),
n_requested_sizes, sizeof (unsigned int),
compare_gap, sizes);
/* Distribute available space.
@ -925,11 +938,11 @@ distribute_natural_allocation (gint extra_space,
* Sort order and reducing remaining space by assigned space
* ensures that space is distributed equally.
*/
gint glue = (extra_space + i) / (i + 1);
gint gap = sizes[(spreading[i])].natural_size
- sizes[(spreading[i])].minimum_size;
int glue = (extra_space + i) / (i + 1);
int gap = sizes[(spreading[i])].natural_size
- sizes[(spreading[i])].minimum_size;
gint extra = MIN (glue, gap);
int extra = MIN (glue, gap);
sizes[spreading[i]].minimum_size += extra;
@ -1056,7 +1069,9 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
else
{
/* Bring children up to size first */
size = distribute_natural_allocation (MAX (0, size), nvis_children, sizes);
size = (gint) distribute_natural_allocation (MAX (0, (float) size),
nvis_children,
sizes);
/* Calculate space which hasn't distributed yet,
* and is available for expanding children.

View File

@ -438,9 +438,7 @@ clutter_brightness_contrast_effect_init (ClutterBrightnessContrastEffect *self)
cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
cogl_object_unref (snippet);
cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
0, /* layer number */
COGL_TEXTURE_TYPE_2D);
cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
}
self->pipeline = cogl_pipeline_copy (klass->base_pipeline);

View File

@ -44,6 +44,7 @@
#include "clutter-build-config.h"
#include <math.h>
#include <cogl/cogl.h>
#include <cairo-gobject.h>
@ -69,6 +70,7 @@ struct _ClutterCanvasPrivate
int width;
int height;
float scale_factor;
CoglTexture *texture;
gboolean dirty;
@ -82,6 +84,7 @@ enum
PROP_WIDTH,
PROP_HEIGHT,
PROP_SCALE_FACTOR,
LAST_PROP
};
@ -97,7 +100,7 @@ enum
static guint canvas_signals[LAST_SIGNAL] = { 0, };
static void clutter_content_iface_init (ClutterContentIface *iface);
static void clutter_content_iface_init (ClutterContentInterface *iface);
G_DEFINE_TYPE_WITH_CODE (ClutterCanvas, clutter_canvas, G_TYPE_OBJECT,
G_ADD_PRIVATE (ClutterCanvas)
@ -178,6 +181,19 @@ clutter_canvas_set_property (GObject *gobject,
}
break;
case PROP_SCALE_FACTOR:
{
gfloat new_scale_factor = g_value_get_float (value);
if (priv->scale_factor != new_scale_factor)
{
priv->scale_factor = new_scale_factor;
clutter_content_invalidate (CLUTTER_CONTENT (gobject));
}
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -202,6 +218,10 @@ clutter_canvas_get_property (GObject *gobject,
g_value_set_int (value, priv->height);
break;
case PROP_SCALE_FACTOR:
g_value_set_float (value, priv->scale_factor);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -245,6 +265,19 @@ clutter_canvas_class_init (ClutterCanvasClass *klass)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
/**
* ClutterCanvas:scale-factor:
*
* The height of the canvas.
*/
obj_props[PROP_SCALE_FACTOR] =
g_param_spec_float ("scale-factor",
P_("Scale Factor"),
P_("The Scale factor of the canvas"),
0.01f, G_MAXFLOAT,
1.0f,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
/**
* ClutterCanvas::draw:
@ -291,6 +324,7 @@ clutter_canvas_init (ClutterCanvas *self)
self->priv->width = -1;
self->priv->height = -1;
self->priv->scale_factor = 1.0f;
}
static void
@ -340,8 +374,8 @@ clutter_canvas_emit_draw (ClutterCanvas *self)
priv->dirty = TRUE;
real_width = priv->width;
real_height = priv->height;
real_width = ceilf (priv->width * priv->scale_factor);
real_height = ceilf (priv->height * priv->scale_factor);
CLUTTER_NOTE (MISC, "Creating Cairo surface with size %d x %d",
priv->width, priv->height);
@ -387,6 +421,10 @@ clutter_canvas_emit_draw (ClutterCanvas *self)
mapped_buffer = FALSE;
}
cairo_surface_set_device_scale (surface,
priv->scale_factor,
priv->scale_factor);
self->priv->cr = cr = cairo_create (surface);
g_signal_emit (self, canvas_signals[DRAW], 0,
@ -448,16 +486,16 @@ clutter_canvas_get_preferred_size (ClutterContent *content,
return FALSE;
if (width != NULL)
*width = priv->width;
*width = ceilf (priv->width * priv->scale_factor);
if (height != NULL)
*height = priv->height;
*height = ceilf (priv->height * priv->scale_factor);
return TRUE;
}
static void
clutter_content_iface_init (ClutterContentIface *iface)
clutter_content_iface_init (ClutterContentInterface *iface)
{
iface->invalidate = clutter_canvas_invalidate;
iface->paint_content = clutter_canvas_paint_content;
@ -560,3 +598,48 @@ clutter_canvas_set_size (ClutterCanvas *canvas,
return clutter_canvas_invalidate_internal (canvas, width, height);
}
/**
* clutter_canvas_set_scale_factor:
* @canvas: a #ClutterCanvas
* @scale: the integer scaling factor of the canvas
*
* Sets the scaling factor of the @canvas, and invalidates the content.
*
* This function will cause the @canvas to be invalidated only
* if the scale factor of the canvas surface has changed.
*/
void
clutter_canvas_set_scale_factor (ClutterCanvas *canvas,
float scale)
{
g_return_if_fail (CLUTTER_IS_CANVAS (canvas));
g_return_if_fail (scale > 0.0f);
if (canvas->priv->scale_factor != scale)
{
canvas->priv->scale_factor = scale;
g_object_freeze_notify (G_OBJECT (canvas));
clutter_content_invalidate (CLUTTER_CONTENT (canvas));
g_object_thaw_notify (G_OBJECT (canvas));
g_object_notify_by_pspec (G_OBJECT (canvas), obj_props[PROP_SCALE_FACTOR]);
}
}
/**
* clutter_canvas_get_scale_factor:
* @canvas: a #ClutterCanvas
*
* Gets the scale factor of the @canvas.
*
* Return value: the current @canvas scale factor or -1 if invalid
*/
float
clutter_canvas_get_scale_factor (ClutterCanvas *canvas)
{
g_return_val_if_fail (CLUTTER_IS_CANVAS (canvas), -1.0f);
return canvas->priv->scale_factor;
}

View File

@ -97,9 +97,9 @@ gboolean clutter_canvas_set_size (ClutterCanvas *
CLUTTER_EXPORT
void clutter_canvas_set_scale_factor (ClutterCanvas *canvas,
int scale);
float scale);
CLUTTER_EXPORT
int clutter_canvas_get_scale_factor (ClutterCanvas *canvas);
float clutter_canvas_get_scale_factor (ClutterCanvas *canvas);
G_END_DECLS

View File

@ -355,6 +355,10 @@ on_captured_event (ClutterActor *stage,
switch (clutter_event_type (event))
{
case CLUTTER_TOUCH_CANCEL:
clutter_click_action_release (action);
break;
case CLUTTER_TOUCH_END:
has_button = FALSE;
case CLUTTER_BUTTON_RELEASE:
@ -662,8 +666,7 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterClickActionClass, clicked),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);

View File

@ -252,6 +252,13 @@ clutter_clone_allocate (ClutterActor *self,
if (priv->clone_source == NULL)
return;
/* ClutterActor delays allocating until the actor is shown; however
* we cannot paint it correctly in that case, so force an allocation.
*/
if (clutter_actor_get_parent (priv->clone_source) != NULL &&
!clutter_actor_has_allocation (priv->clone_source))
clutter_actor_allocate_preferred_size (priv->clone_source, flags);
#if 0
/* XXX - this is wrong: ClutterClone cannot clone unparented
* actors, as it will break all invariants

View File

@ -293,9 +293,7 @@ clutter_colorize_effect_init (ClutterColorizeEffect *self)
cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
cogl_object_unref (snippet);
cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
0, /* layer number */
COGL_TEXTURE_TYPE_2D);
cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
}
self->pipeline = cogl_pipeline_copy (klass->base_pipeline);

View File

@ -197,8 +197,7 @@ clutter_container_default_init (ClutterContainerInterface *iface)
iface_type,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterContainerIface, actor_added),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
/**
@ -216,8 +215,7 @@ clutter_container_default_init (ClutterContainerInterface *iface)
iface_type,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterContainerIface, actor_removed),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);

View File

@ -38,14 +38,13 @@
#include "clutter-build-config.h"
#include "clutter-actor-private.h"
#include "clutter-content-private.h"
#include "clutter-debug.h"
#include "clutter-marshal.h"
#include "clutter-private.h"
typedef struct _ClutterContentIface ClutterContentInterface;
enum
{
ATTACHED,
@ -91,6 +90,11 @@ clutter_content_real_invalidate (ClutterContent *content)
{
}
static void
clutter_content_real_invalidate_size (ClutterContent *content)
{
}
static void
clutter_content_real_paint_content (ClutterContent *content,
ClutterActor *actor,
@ -108,6 +112,7 @@ clutter_content_default_init (ClutterContentInterface *iface)
iface->attached = clutter_content_real_attached;
iface->detached = clutter_content_real_detached;
iface->invalidate = clutter_content_real_invalidate;
iface->invalidate_size = clutter_content_real_invalidate_size;
/**
* ClutterContent::attached:
@ -123,9 +128,8 @@ clutter_content_default_init (ClutterContentInterface *iface)
g_signal_new (I_("attached"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterContentIface, attached),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_STRUCT_OFFSET (ClutterContentInterface, attached),
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
@ -143,9 +147,8 @@ clutter_content_default_init (ClutterContentInterface *iface)
g_signal_new (I_("detached"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (ClutterContentIface, detached),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_STRUCT_OFFSET (ClutterContentInterface, detached),
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
}
@ -188,6 +191,45 @@ clutter_content_invalidate (ClutterContent *content)
}
}
/**
* clutter_content_invalidate_size:
* @content: a #ClutterContent
*
* Signals that @content's size changed. Attached actors with request mode
* set to %CLUTTER_REQUEST_CONTENT_SIZE will have a relayout queued.
*
* Attached actors with other request modes are not redrawn. To redraw them
* too, use clutter_content_invalidate().
*/
void
clutter_content_invalidate_size (ClutterContent *content)
{
ClutterActor *actor;
GHashTable *actors;
GHashTableIter iter;
g_return_if_fail (CLUTTER_IS_CONTENT (content));
CLUTTER_CONTENT_GET_IFACE (content)->invalidate_size (content);
actors = g_object_get_qdata (G_OBJECT (content), quark_content_actors);
if (actors == NULL)
return;
g_hash_table_iter_init (&iter, actors);
while (g_hash_table_iter_next (&iter, (gpointer *) &actor, NULL))
{
ClutterRequestMode request_mode;
g_assert (actor != NULL);
request_mode = clutter_actor_get_request_mode (actor);
if (request_mode == CLUTTER_REQUEST_CONTENT_SIZE)
_clutter_actor_queue_only_relayout (actor);
}
}
/*< private >
* _clutter_content_attached:
* @content: a #ClutterContent
@ -199,7 +241,7 @@ clutter_content_invalidate (ClutterContent *content)
* is associated to a #ClutterContent, to set up a backpointer from
* the @content to the @actor.
*
* This function will invoke the #ClutterContentIface.attached() virtual
* This function will invoke the #ClutterContentInterface.attached() virtual
* function.
*/
void
@ -233,7 +275,7 @@ _clutter_content_attached (ClutterContent *content,
* This function should be used internally every time a #ClutterActor
* removes the association with a #ClutterContent.
*
* This function will invoke the #ClutterContentIface.detached() virtual
* This function will invoke the #ClutterContentInterface.detached() virtual
* function.
*/
void
@ -262,7 +304,7 @@ _clutter_content_detached (ClutterContent *content,
*
* Creates the render tree for the @content and @actor.
*
* This function will invoke the #ClutterContentIface.paint_content()
* This function will invoke the #ClutterContentInterface.paint_content()
* virtual function.
*/
void

View File

@ -33,24 +33,13 @@
G_BEGIN_DECLS
#define CLUTTER_TYPE_CONTENT (clutter_content_get_type ())
#define CLUTTER_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CONTENT, ClutterContent))
#define CLUTTER_IS_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CONTENT))
#define CLUTTER_CONTENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_CONTENT, ClutterContentIface))
#define CLUTTER_TYPE_CONTENT (clutter_content_get_type ())
typedef struct _ClutterContentIface ClutterContentIface;
CLUTTER_EXPORT
G_DECLARE_INTERFACE (ClutterContent, clutter_content, CLUTTER, CONTENT, GObject)
/**
* ClutterContent:
*
* The #ClutterContent structure is an opaque type
* whose members cannot be acccessed directly.
*
* Since: 1.10
*/
/**
* ClutterContentIface:
* ClutterContentInterface:
* @get_preferred_size: virtual function; should be overridden by subclasses
* of #ClutterContent that have a natural size
* @paint_content: virtual function; called each time the content needs to
@ -62,12 +51,12 @@ typedef struct _ClutterContentIface ClutterContentIface;
* @invalidate: virtual function; called each time a #ClutterContent state
* is changed.
*
* The #ClutterContentIface structure contains only
* The #ClutterContentInterface structure contains only
* private data.
*
* Since: 1.10
*/
struct _ClutterContentIface
struct _ClutterContentInterface
{
/*< private >*/
GTypeInterface g_iface;
@ -86,10 +75,9 @@ struct _ClutterContentIface
ClutterActor *actor);
void (* invalidate) (ClutterContent *content);
};
CLUTTER_EXPORT
GType clutter_content_get_type (void) G_GNUC_CONST;
void (* invalidate_size) (ClutterContent *content);
};
CLUTTER_EXPORT
gboolean clutter_content_get_preferred_size (ClutterContent *content,
@ -98,6 +86,9 @@ gboolean clutter_content_get_preferred_size (ClutterContent *content
CLUTTER_EXPORT
void clutter_content_invalidate (ClutterContent *content);
CLUTTER_EXPORT
void clutter_content_invalidate_size (ClutterContent *content);
G_END_DECLS
#endif /* __CLUTTER_CONTENT_H__ */

View File

@ -6,7 +6,8 @@
G_BEGIN_DECLS
typedef enum {
typedef enum
{
CLUTTER_DEBUG_MISC = 1 << 0,
CLUTTER_DEBUG_ACTOR = 1 << 1,
CLUTTER_DEBUG_TEXTURE = 1 << 2,
@ -26,12 +27,13 @@ typedef enum {
CLUTTER_DEBUG_OOB_TRANSFORMS = 1 << 16
} ClutterDebugFlag;
typedef enum {
typedef enum
{
CLUTTER_DEBUG_NOP_PICKING = 1 << 0,
CLUTTER_DEBUG_DUMP_PICK_BUFFERS = 1 << 1
} ClutterPickDebugFlag;
typedef enum {
typedef enum
{
CLUTTER_DEBUG_DISABLE_SWAP_EVENTS = 1 << 0,
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS = 1 << 1,
CLUTTER_DEBUG_REDRAWS = 1 << 2,
@ -80,9 +82,9 @@ extern guint clutter_pick_debug_flags;
extern guint clutter_paint_debug_flags;
void _clutter_debug_messagev (const char *format,
va_list var_args);
va_list var_args) G_GNUC_PRINTF (1, 0);
void _clutter_debug_message (const char *format,
...);
...) G_GNUC_PRINTF (1, 2);
G_END_DECLS

View File

@ -282,6 +282,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
/* enable depth testing */
cogl_depth_state_init (&depth_state);
cogl_depth_state_set_test_enabled (&depth_state, TRUE);
cogl_depth_state_set_test_function (&depth_state, COGL_DEPTH_TEST_FUNCTION_LEQUAL);
cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL);
/* enable backface culling if we have a back material */

View File

@ -7,37 +7,23 @@
#include "deprecated/clutter-alpha.h"
#include "deprecated/clutter-animatable.h"
#include "deprecated/clutter-animation.h"
#include "deprecated/clutter-animator.h"
#include "deprecated/clutter-backend.h"
#include "deprecated/clutter-behaviour.h"
#include "deprecated/clutter-behaviour-depth.h"
#include "deprecated/clutter-behaviour-ellipse.h"
#include "deprecated/clutter-behaviour-opacity.h"
#include "deprecated/clutter-behaviour-path.h"
#include "deprecated/clutter-behaviour-rotate.h"
#include "deprecated/clutter-behaviour-scale.h"
#include "deprecated/clutter-bin-layout.h"
#include "deprecated/clutter-box.h"
#include "deprecated/clutter-cairo-texture.h"
#include "deprecated/clutter-container.h"
#include "deprecated/clutter-frame-source.h"
#include "deprecated/clutter-group.h"
#include "deprecated/clutter-input-device.h"
#include "deprecated/clutter-keysyms.h"
#include "deprecated/clutter-list-model.h"
#include "deprecated/clutter-main.h"
#include "deprecated/clutter-model.h"
#include "deprecated/clutter-rectangle.h"
#include "deprecated/clutter-score.h"
#include "deprecated/clutter-shader.h"
#include "deprecated/clutter-stage-manager.h"
#include "deprecated/clutter-stage.h"
#include "deprecated/clutter-state.h"
#include "deprecated/clutter-table-layout.h"
#include "deprecated/clutter-texture.h"
#include "deprecated/clutter-timeline.h"
#include "deprecated/clutter-timeout-pool.h"
#include "deprecated/clutter-util.h"
#undef __CLUTTER_DEPRECATED_H_INSIDE__

View File

@ -297,9 +297,7 @@ clutter_desaturate_effect_init (ClutterDesaturateEffect *self)
cogl_pipeline_add_snippet (klass->base_pipeline, snippet);
cogl_object_unref (snippet);
cogl_pipeline_set_layer_null_texture (klass->base_pipeline,
0, /* layer number */
COGL_TEXTURE_TYPE_2D);
cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0);
}
self->pipeline = cogl_pipeline_copy (klass->base_pipeline);

View File

@ -69,6 +69,23 @@ typedef struct _ClutterTouchInfo
gfloat current_y;
} ClutterTouchInfo;
typedef struct _ClutterPtrA11yData
{
int n_btn_pressed;
float current_x;
float current_y;
float dwell_x;
float dwell_y;
gboolean dwell_drag_started;
gboolean dwell_gesture_started;
guint dwell_timer;
guint dwell_position_timer;
guint secondary_click_timer;
gboolean secondary_click_triggered;
} ClutterPtrA11yData;
struct _ClutterInputDevice
{
GObject parent_instance;
@ -143,6 +160,10 @@ struct _ClutterInputDevice
guint has_cursor : 1;
guint is_enabled : 1;
/* Accessiblity */
ClutterVirtualInputDevice *accessibility_virtual_device;
ClutterPtrA11yData *ptr_a11y_data;
};
typedef void (*ClutterEmitInputDeviceEvent) (ClutterEvent *event,
@ -167,44 +188,21 @@ struct _ClutterInputDeviceClass
gboolean (* is_grouped) (ClutterInputDevice *device,
ClutterInputDevice *other_device);
gboolean (* get_physical_size) (ClutterInputDevice *device,
gdouble *width,
gdouble *height);
/* Keyboard accessbility */
void (* process_kbd_a11y_event) (ClutterEvent *event,
ClutterInputDevice *device,
ClutterEmitInputDeviceEvent emit_event_func);
};
/* Platform-dependent interface */
typedef struct _ClutterEventExtender ClutterEventExtender;
typedef struct _ClutterEventExtenderInterface ClutterEventExtenderInterface;
#define CLUTTER_TYPE_EVENT_EXTENDER (clutter_event_extender_get_type ())
#define CLUTTER_EVENT_EXTENDER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CLUTTER_TYPE_EVENT_EXTENDER, ClutterEventExtender))
#define CLUTTER_IS_EVENT_EXTENDER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CLUTTER_TYPE_EVENT_EXTENDER))
#define CLUTTER_EVENT_EXTENDER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), CLUTTER_TYPE_EVENT_EXTENDER, ClutterEventExtenderInterface))
struct _ClutterEventExtenderInterface
{
GTypeInterface g_iface;
void (* copy_event_data) (ClutterEventExtender *event_extender,
const ClutterEvent *src,
ClutterEvent *dest);
void (* free_event_data) (ClutterEventExtender *event_extender,
ClutterEvent *event);
};
GType clutter_event_extender_get_type (void) G_GNUC_CONST;
/* device manager */
CLUTTER_EXPORT
void _clutter_device_manager_add_device (ClutterDeviceManager *device_manager,
ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_device_manager_remove_device (ClutterDeviceManager *device_manager,
ClutterInputDevice *device);
void _clutter_device_manager_update_devices (ClutterDeviceManager *device_manager);
CLUTTER_EXPORT
void _clutter_device_manager_select_stage_events (ClutterDeviceManager *device_manager,
ClutterStage *stage);
ClutterBackend *_clutter_device_manager_get_backend (ClutterDeviceManager *device_manager);
@ -212,25 +210,35 @@ ClutterBackend *_clutter_device_manager_get_backend (ClutterDeviceMa
void _clutter_device_manager_compress_motion (ClutterDeviceManager *device_manger,
ClutterEvent *event,
const ClutterEvent *to_discard);
CLUTTER_EXPORT
void clutter_device_manager_ensure_a11y_state (ClutterDeviceManager *device_manager);
/* input device */
CLUTTER_EXPORT
gboolean _clutter_input_device_has_sequence (ClutterInputDevice *device,
ClutterEventSequence *sequence);
CLUTTER_EXPORT
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_input_device_set_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gfloat x,
gfloat y,
ClutterStage *stage);
CLUTTER_EXPORT
void _clutter_input_device_set_state (ClutterInputDevice *device,
ClutterModifierType state);
CLUTTER_EXPORT
void _clutter_input_device_set_time (ClutterInputDevice *device,
guint32 time_);
CLUTTER_EXPORT
void _clutter_input_device_set_stage (ClutterInputDevice *device,
ClutterStage *stage);
CLUTTER_EXPORT
ClutterStage * _clutter_input_device_get_stage (ClutterInputDevice *device);
void _clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence,
@ -239,44 +247,57 @@ void _clutter_input_device_set_actor (ClutterInputDev
ClutterActor * _clutter_input_device_update (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gboolean emit_crossing);
CLUTTER_EXPORT
void _clutter_input_device_set_n_keys (ClutterInputDevice *device,
guint n_keys);
CLUTTER_EXPORT
guint _clutter_input_device_add_axis (ClutterInputDevice *device,
ClutterInputAxis axis,
gdouble min_value,
gdouble max_value,
gdouble resolution);
CLUTTER_EXPORT
void _clutter_input_device_reset_axes (ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_input_device_set_associated_device (ClutterInputDevice *device,
ClutterInputDevice *associated);
CLUTTER_EXPORT
void _clutter_input_device_add_slave (ClutterInputDevice *master,
ClutterInputDevice *slave);
CLUTTER_EXPORT
void _clutter_input_device_remove_slave (ClutterInputDevice *master,
ClutterInputDevice *slave);
CLUTTER_EXPORT
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
guint index_,
gdouble value,
gdouble *axis_value);
CLUTTER_EXPORT
void _clutter_input_device_add_scroll_info (ClutterInputDevice *device,
guint index_,
ClutterScrollDirection direction,
gdouble increment);
CLUTTER_EXPORT
void _clutter_input_device_reset_scroll_info (ClutterInputDevice *device);
CLUTTER_EXPORT
gboolean _clutter_input_device_get_scroll_delta (ClutterInputDevice *device,
guint index_,
gdouble value,
ClutterScrollDirection *direction_p,
gdouble *delta_p);
CLUTTER_EXPORT
ClutterInputDeviceTool * clutter_input_device_lookup_tool (ClutterInputDevice *device,
guint64 serial,
ClutterInputDeviceToolType type);
CLUTTER_EXPORT
void clutter_input_device_add_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
CLUTTER_EXPORT
void clutter_input_device_update_from_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);

View File

@ -47,6 +47,7 @@
#include "clutter-stage-private.h"
#include "clutter-virtual-input-device.h"
#include "clutter-input-device-tool.h"
#include "clutter-input-pointer-a11y-private.h"
struct _ClutterDeviceManagerPrivate
{
@ -55,6 +56,8 @@ struct _ClutterDeviceManagerPrivate
/* Keyboard a11y */
ClutterKbdA11ySettings kbd_a11y_settings;
/* Pointer a11y */
ClutterPointerA11ySettings pointer_a11y_settings;
};
enum
@ -75,6 +78,9 @@ enum
TOOL_CHANGED,
KBD_A11Y_MASK_CHANGED,
KBD_A11Y_FLAGS_CHANGED,
PTR_A11Y_DWELL_CLICK_TYPE_CHANGED,
PTR_A11Y_TIMEOUT_STARTED,
PTR_A11Y_TIMEOUT_STOPPED,
LAST_SIGNAL
};
@ -85,22 +91,14 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterDeviceManager,
clutter_device_manager,
G_TYPE_OBJECT)
G_DEFINE_INTERFACE (ClutterEventExtender,
clutter_event_extender,
CLUTTER_TYPE_DEVICE_MANAGER)
static void
clutter_event_extender_default_init (ClutterEventExtenderInterface *iface)
{
}
static void
clutter_device_manager_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterDeviceManagerPrivate *priv = CLUTTER_DEVICE_MANAGER (gobject)->priv;
ClutterDeviceManager *self = CLUTTER_DEVICE_MANAGER (gobject);
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (self);
switch (prop_id)
{
@ -119,7 +117,8 @@ clutter_device_manager_get_property (GObject *gobject,
GValue *value,
GParamSpec *pspec)
{
ClutterDeviceManagerPrivate *priv = CLUTTER_DEVICE_MANAGER (gobject)->priv;
ClutterDeviceManager *self = CLUTTER_DEVICE_MANAGER (gobject);
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (self);
switch (prop_id)
{
@ -165,8 +164,7 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_INPUT_DEVICE);
@ -185,8 +183,7 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_INPUT_DEVICE);
@ -239,12 +236,74 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass)
G_TYPE_NONE, 2,
G_TYPE_UINT,
G_TYPE_UINT);
/**
* ClutterDeviceManager::ptr-a11y-dwell-click-type-changed:
* @manager: the #ClutterDeviceManager that emitted the signal
* @click_type: the new #ClutterPointerA11yDwellClickType mode
*
* The ::ptr-a11y-dwell-click-type-changed signal is emitted each time
* the ClutterPointerA11yDwellClickType mode is changed as the result
* of pointer accessibility operations.
*/
manager_signals[PTR_A11Y_DWELL_CLICK_TYPE_CHANGED] =
g_signal_new (I_("ptr-a11y-dwell-click-type-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__FLAGS,
G_TYPE_NONE, 1,
CLUTTER_TYPE_POINTER_A11Y_DWELL_CLICK_TYPE);
/**
* ClutterDeviceManager::ptr-a11y-timeout-started:
* @manager: the #ClutterDeviceManager that emitted the signal
* @device: the core pointer #ClutterInputDevice
* @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType
* @delay: the delay in ms before secondary-click is triggered.
*
* The ::ptr-a11y-timeout-started signal is emitted when a
* pointer accessibility timeout delay is started, so that upper
* layers can notify the user with some visual feedback.
*/
manager_signals[PTR_A11Y_TIMEOUT_STARTED] =
g_signal_new (I_("ptr-a11y-timeout-started"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__OBJECT_FLAGS_UINT,
G_TYPE_NONE, 3,
CLUTTER_TYPE_INPUT_DEVICE,
CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE,
G_TYPE_UINT);
/**
* ClutterDeviceManager::ptr-a11y-timeout-stopped:
* @manager: the #ClutterDeviceManager that emitted the signal
* @device: the core pointer #ClutterInputDevice
* @timeout_type: the type of timeout #ClutterPointerA11yTimeoutType
* @clicked: %TRUE if the timeout finished and triggered a click
*
* The ::ptr-a11y-timeout-stopped signal is emitted when a running
* pointer accessibility timeout delay is stopped, either because
* it's triggered at the end of the delay or cancelled, so that
* upper layers can notify the user with some visual feedback.
*/
manager_signals[PTR_A11Y_TIMEOUT_STOPPED] =
g_signal_new (I_("ptr-a11y-timeout-stopped"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__OBJECT_FLAGS_BOOLEAN,
G_TYPE_NONE, 3,
CLUTTER_TYPE_INPUT_DEVICE,
CLUTTER_TYPE_POINTER_A11Y_TIMEOUT_TYPE,
G_TYPE_BOOLEAN);
}
static void
clutter_device_manager_init (ClutterDeviceManager *self)
{
self->priv = clutter_device_manager_get_instance_private (self);
}
/**
@ -263,7 +322,7 @@ clutter_device_manager_get_default (void)
{
ClutterBackend *backend = clutter_get_default_backend ();
return backend->device_manager;
return CLUTTER_BACKEND_GET_CLASS (backend)->get_device_manager (backend);
}
/**
@ -487,9 +546,11 @@ _clutter_device_manager_update_devices (ClutterDeviceManager *device_manager)
ClutterBackend *
_clutter_device_manager_get_backend (ClutterDeviceManager *manager)
{
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (manager);
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (manager), NULL);
return manager->priv->backend;
return priv->backend;
}
/**
@ -546,17 +607,25 @@ _clutter_device_manager_compress_motion (ClutterDeviceManager *device_manager,
manager_class->compress_motion (device_manager, event, to_discard);
}
void
clutter_device_manager_ensure_a11y_state (ClutterDeviceManager *device_manager)
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_device_manager_get_core_device (device_manager,
CLUTTER_POINTER_DEVICE);
if (core_pointer)
{
if (_clutter_is_input_pointer_a11y_enabled (core_pointer))
_clutter_input_pointer_a11y_add_device (core_pointer);
}
}
static gboolean
are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
ClutterKbdA11ySettings *b)
{
return (a->controls == b->controls &&
a->slowkeys_delay == b->slowkeys_delay &&
a->debounce_delay == b->debounce_delay &&
a->timeout_delay == b->timeout_delay &&
a->mousekeys_init_delay == b->mousekeys_init_delay &&
a->mousekeys_max_speed == b->mousekeys_max_speed &&
a->mousekeys_accel_time == b->mousekeys_accel_time);
return (memcmp (a, b, sizeof (ClutterKbdA11ySettings)) == 0);
}
void
@ -564,13 +633,14 @@ clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *device_man
ClutterKbdA11ySettings *settings)
{
ClutterDeviceManagerClass *manager_class;
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager);
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
if (are_kbd_a11y_settings_equal (&device_manager->priv->kbd_a11y_settings, settings))
if (are_kbd_a11y_settings_equal (&priv->kbd_a11y_settings, settings))
return;
device_manager->priv->kbd_a11y_settings = *settings;
priv->kbd_a11y_settings = *settings;
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
if (manager_class->apply_kbd_a11y_settings)
@ -581,7 +651,103 @@ void
clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings)
{
ClutterDeviceManagerPrivate *priv = clutter_device_manager_get_instance_private (device_manager);
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
*settings = device_manager->priv->kbd_a11y_settings;
*settings = priv->kbd_a11y_settings;
}
static gboolean
are_pointer_a11y_settings_equal (ClutterPointerA11ySettings *a,
ClutterPointerA11ySettings *b)
{
return (memcmp (a, b, sizeof (ClutterPointerA11ySettings)) == 0);
}
static void
clutter_device_manager_enable_pointer_a11y (ClutterDeviceManager *device_manager)
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_device_manager_get_core_device (device_manager,
CLUTTER_POINTER_DEVICE);
_clutter_input_pointer_a11y_add_device (core_pointer);
}
static void
clutter_device_manager_disable_pointer_a11y (ClutterDeviceManager *device_manager)
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_device_manager_get_core_device (device_manager,
CLUTTER_POINTER_DEVICE);
_clutter_input_pointer_a11y_remove_device (core_pointer);
}
/**
* clutter_device_manager_set_pointer_a11y_settings:
* @device_manager: a #ClutterDeviceManager
* @settings: a pointer to a #ClutterPointerA11ySettings
*
* Sets the pointer accessibility settings
**/
void
clutter_device_manager_set_pointer_a11y_settings (ClutterDeviceManager *device_manager,
ClutterPointerA11ySettings *settings)
{
ClutterDeviceManagerPrivate *priv =
clutter_device_manager_get_instance_private (device_manager);
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
if (are_pointer_a11y_settings_equal (&priv->pointer_a11y_settings, settings))
return;
if (priv->pointer_a11y_settings.controls == 0 && settings->controls != 0)
clutter_device_manager_enable_pointer_a11y (device_manager);
else if (priv->pointer_a11y_settings.controls != 0 && settings->controls == 0)
clutter_device_manager_disable_pointer_a11y (device_manager);
priv->pointer_a11y_settings = *settings;
}
/**
* clutter_device_manager_get_pointer_a11y_settings:
* @device_manager: a #ClutterDeviceManager
* @settings: a pointer to a #ClutterPointerA11ySettings
*
* Gets the current pointer accessibility settings
**/
void
clutter_device_manager_get_pointer_a11y_settings (ClutterDeviceManager *device_manager,
ClutterPointerA11ySettings *settings)
{
ClutterDeviceManagerPrivate *priv =
clutter_device_manager_get_instance_private (device_manager);
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
*settings = priv->pointer_a11y_settings;
}
/**
* clutter_device_manager_set_pointer_a11y_dwell_click_type:
* @device_manager: a #ClutterDeviceManager
* @click_type: type of click as #ClutterPointerA11yDwellClickType
*
* Sets the dwell click type
**/
void
clutter_device_manager_set_pointer_a11y_dwell_click_type (ClutterDeviceManager *device_manager,
ClutterPointerA11yDwellClickType click_type)
{
ClutterDeviceManagerPrivate *priv =
clutter_device_manager_get_instance_private (device_manager);
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
priv->pointer_a11y_settings.dwell_click_type = click_type;
}

View File

@ -33,16 +33,12 @@
G_BEGIN_DECLS
#define CLUTTER_TYPE_DEVICE_MANAGER (clutter_device_manager_get_type ())
#define CLUTTER_DEVICE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DEVICE_MANAGER, ClutterDeviceManager))
#define CLUTTER_IS_DEVICE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DEVICE_MANAGER))
#define CLUTTER_DEVICE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DEVICE_MANAGER, ClutterDeviceManagerClass))
#define CLUTTER_IS_DEVICE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DEVICE_MANAGER))
#define CLUTTER_DEVICE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DEVICE_MANAGER, ClutterDeviceManagerClass))
#define CLUTTER_TYPE_DEVICE_MANAGER (clutter_device_manager_get_type ())
CLUTTER_EXPORT
G_DECLARE_DERIVABLE_TYPE (ClutterDeviceManager, clutter_device_manager,
CLUTTER, DEVICE_MANAGER, GObject)
typedef struct _ClutterDeviceManager ClutterDeviceManager;
typedef struct _ClutterDeviceManagerPrivate ClutterDeviceManagerPrivate;
typedef struct _ClutterDeviceManagerClass ClutterDeviceManagerClass;
/**
* ClutterVirtualDeviceType:
@ -74,19 +70,25 @@ typedef struct _ClutterKbdA11ySettings
} ClutterKbdA11ySettings;
/**
* ClutterDeviceManager:
* ClutterPointerA11ySettings:
*
* The #ClutterDeviceManager structure contains only private data
* The #ClutterPointerA11ySettings structure contains pointer accessibility
* settings
*
* Since: 1.2
*/
struct _ClutterDeviceManager
typedef struct _ClutterPointerA11ySettings
{
/*< private >*/
GObject parent_instance;
ClutterDeviceManagerPrivate *priv;
};
ClutterPointerA11yFlags controls;
ClutterPointerA11yDwellClickType dwell_click_type;
ClutterPointerA11yDwellMode dwell_mode;
ClutterPointerA11yDwellDirection dwell_gesture_single;
ClutterPointerA11yDwellDirection dwell_gesture_double;
ClutterPointerA11yDwellDirection dwell_gesture_drag;
ClutterPointerA11yDwellDirection dwell_gesture_secondary;
gint secondary_click_delay;
gint dwell_delay;
gint dwell_threshold;
} ClutterPointerA11ySettings;
/**
* ClutterDeviceManagerClass:
@ -121,12 +123,17 @@ struct _ClutterDeviceManagerClass
/* Keyboard accessbility */
void (* apply_kbd_a11y_settings) (ClutterDeviceManager *device_manger,
ClutterKbdA11ySettings *settings);
/* padding */
gpointer _padding[6];
};
CLUTTER_EXPORT
GType clutter_device_manager_get_type (void) G_GNUC_CONST;
/* Event platform data */
void (* copy_event_data) (ClutterDeviceManager *device_manager,
const ClutterEvent *src,
ClutterEvent *dest);
void (* free_event_data) (ClutterDeviceManager *device_manager,
ClutterEvent *event);
/* padding */
gpointer _padding[4];
};
CLUTTER_EXPORT
ClutterDeviceManager *clutter_device_manager_get_default (void);
@ -152,10 +159,23 @@ ClutterVirtualDeviceType clutter_device_manager_get_supported_virtual_device_typ
CLUTTER_EXPORT
void clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings);
CLUTTER_EXPORT
void clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings);
CLUTTER_EXPORT
void clutter_device_manager_set_pointer_a11y_settings (ClutterDeviceManager *device_manager,
ClutterPointerA11ySettings *settings);
CLUTTER_EXPORT
void clutter_device_manager_get_pointer_a11y_settings (ClutterDeviceManager *device_manager,
ClutterPointerA11ySettings *settings);
CLUTTER_EXPORT
void clutter_device_manager_set_pointer_a11y_dwell_click_type (ClutterDeviceManager *device_manager,
ClutterPointerA11yDwellClickType click_type);
G_END_DECLS
#endif /* __CLUTTER_DEVICE_MANAGER_H__ */

View File

@ -428,8 +428,7 @@ clutter_drop_action_class_init (ClutterDropActionClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterDropActionClass, over_in),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
@ -448,8 +447,7 @@ clutter_drop_action_class_init (ClutterDropActionClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterDropActionClass, over_out),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);

View File

@ -7,7 +7,7 @@ G_BEGIN_DECLS
gboolean _clutter_effect_pre_paint (ClutterEffect *effect);
void _clutter_effect_post_paint (ClutterEffect *effect);
gboolean _clutter_effect_get_paint_volume (ClutterEffect *effect,
gboolean _clutter_effect_modify_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume);
gboolean _clutter_effect_has_custom_paint_volume (ClutterEffect *effect);
void _clutter_effect_paint (ClutterEffect *effect,

View File

@ -188,8 +188,8 @@ clutter_effect_real_post_paint (ClutterEffect *effect)
}
static gboolean
clutter_effect_real_get_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
clutter_effect_real_modify_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
{
return TRUE;
}
@ -252,7 +252,7 @@ clutter_effect_class_init (ClutterEffectClass *klass)
klass->pre_paint = clutter_effect_real_pre_paint;
klass->post_paint = clutter_effect_real_post_paint;
klass->get_paint_volume = clutter_effect_real_get_paint_volume;
klass->modify_paint_volume = clutter_effect_real_modify_paint_volume;
klass->paint = clutter_effect_real_paint;
klass->pick = clutter_effect_real_pick;
}
@ -297,13 +297,14 @@ _clutter_effect_pick (ClutterEffect *effect,
}
gboolean
_clutter_effect_get_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
_clutter_effect_modify_paint_volume (ClutterEffect *effect,
ClutterPaintVolume *volume)
{
g_return_val_if_fail (CLUTTER_IS_EFFECT (effect), FALSE);
g_return_val_if_fail (volume != NULL, FALSE);
return CLUTTER_EFFECT_GET_CLASS (effect)->get_paint_volume (effect, volume);
return CLUTTER_EFFECT_GET_CLASS (effect)->modify_paint_volume (effect,
volume);
}
gboolean
@ -311,7 +312,7 @@ _clutter_effect_has_custom_paint_volume (ClutterEffect *effect)
{
g_return_val_if_fail (CLUTTER_IS_EFFECT (effect), FALSE);
return CLUTTER_EFFECT_GET_CLASS (effect)->get_paint_volume != clutter_effect_real_get_paint_volume;
return CLUTTER_EFFECT_GET_CLASS (effect)->modify_paint_volume != clutter_effect_real_modify_paint_volume;
}
/**

View File

@ -60,7 +60,7 @@ struct _ClutterEffect
* ClutterEffectClass:
* @pre_paint: virtual function
* @post_paint: virtual function
* @get_paint_volume: virtual function
* @modify_paint_volume: virtual function
* @paint: virtual function
* @pick: virtual function
*
@ -74,16 +74,16 @@ struct _ClutterEffectClass
ClutterActorMetaClass parent_class;
/*< public >*/
gboolean (* pre_paint) (ClutterEffect *effect);
void (* post_paint) (ClutterEffect *effect);
gboolean (* pre_paint) (ClutterEffect *effect);
void (* post_paint) (ClutterEffect *effect);
gboolean (* get_paint_volume) (ClutterEffect *effect,
ClutterPaintVolume *volume);
gboolean (* modify_paint_volume) (ClutterEffect *effect,
ClutterPaintVolume *volume);
void (* paint) (ClutterEffect *effect,
ClutterEffectPaintFlags flags);
void (* pick) (ClutterEffect *effect,
ClutterEffectPaintFlags flags);
void (* paint) (ClutterEffect *effect,
ClutterEffectPaintFlags flags);
void (* pick) (ClutterEffect *effect,
ClutterEffectPaintFlags flags);
/*< private >*/
void (* _clutter_effect4) (void);

View File

@ -13,7 +13,7 @@ G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/* enumerations from "@basename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/

View File

@ -51,7 +51,8 @@ G_BEGIN_DECLS
*
* Deprecated: 1.22: Use the normalized #ClutterActor pivot point instead
*/
typedef enum { /*< prefix=CLUTTER_GRAVITY >*/
typedef enum /*< prefix=CLUTTER_GRAVITY >*/
{
CLUTTER_GRAVITY_NONE = 0,
CLUTTER_GRAVITY_NORTH,
CLUTTER_GRAVITY_NORTH_EAST,
@ -74,7 +75,8 @@ typedef enum { /*< prefix=CLUTTER_GRAVITY >*/
*
* Since: 0.4
*/
typedef enum { /*< prefix=CLUTTER >*/
typedef enum /*< prefix=CLUTTER >*/
{
CLUTTER_X_AXIS,
CLUTTER_Y_AXIS,
CLUTTER_Z_AXIS
@ -91,7 +93,8 @@ typedef enum { /*< prefix=CLUTTER >*/
*
* Deprecated: 1.22
*/
typedef enum { /*< prefix=CLUTTER_ROTATE >*/
typedef enum /*< prefix=CLUTTER_ROTATE >*/
{
CLUTTER_ROTATE_CW,
CLUTTER_ROTATE_CCW
} ClutterRotateDirection;
@ -107,7 +110,8 @@ typedef enum { /*< prefix=CLUTTER_ROTATE >*/
*
* Since: 0.8
*/
typedef enum { /*< prefix=CLUTTER_REQUEST >*/
typedef enum /*< prefix=CLUTTER_REQUEST >*/
{
CLUTTER_REQUEST_HEIGHT_FOR_WIDTH,
CLUTTER_REQUEST_WIDTH_FOR_HEIGHT,
CLUTTER_REQUEST_CONTENT_SIZE
@ -200,7 +204,8 @@ typedef enum { /*< prefix=CLUTTER_REQUEST >*/
*
* Since: 1.0
*/
typedef enum {
typedef enum
{
CLUTTER_CUSTOM_MODE = 0,
/* linear */
@ -272,23 +277,6 @@ typedef enum {
CLUTTER_ANIMATION_LAST
} ClutterAnimationMode;
/**
* ClutterFontFlags:
* @CLUTTER_FONT_MIPMAPPING: Set to use mipmaps for the glyph cache textures.
* @CLUTTER_FONT_HINTING: Set to enable hinting on the glyphs.
*
* Runtime flags to change the font quality. To be used with
* clutter_set_font_flags().
*
* Since: 1.0
*
* Deprecated: 1.22: Use #cairo_font_options_t instead
*/
typedef enum { /*< prefix=CLUTTER_FONT >*/
CLUTTER_FONT_MIPMAPPING = (1 << 0),
CLUTTER_FONT_HINTING = (1 << 1)
} ClutterFontFlags;
/**
* ClutterTextDirection:
* @CLUTTER_TEXT_DIRECTION_DEFAULT: Use the default setting, as returned
@ -300,7 +288,8 @@ typedef enum { /*< prefix=CLUTTER_FONT >*/
*
* Since: 1.2
*/
typedef enum {
typedef enum
{
CLUTTER_TEXT_DIRECTION_DEFAULT,
CLUTTER_TEXT_DIRECTION_LTR,
CLUTTER_TEXT_DIRECTION_RTL
@ -315,7 +304,8 @@ typedef enum {
*
* Since: 1.4
*/
typedef enum {
typedef enum
{
CLUTTER_VERTEX_SHADER,
CLUTTER_FRAGMENT_SHADER
} ClutterShaderType;
@ -350,7 +340,8 @@ typedef enum {
*
* Since: 0.4
*/
typedef enum {
typedef enum
{
CLUTTER_SHIFT_MASK = 1 << 0,
CLUTTER_LOCK_MASK = 1 << 1,
CLUTTER_CONTROL_MASK = 1 << 2,
@ -416,7 +407,8 @@ typedef enum {
* Keyboard accessibility features applied to a ClutterInputDevice keyboard.
*
*/
typedef enum {
typedef enum
{
CLUTTER_A11Y_KEYBOARD_ENABLED = 1 << 0,
CLUTTER_A11Y_TIMEOUT_ENABLED = 1 << 1,
CLUTTER_A11Y_MOUSE_KEYS_ENABLED = 1 << 2,
@ -433,6 +425,88 @@ typedef enum {
CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP = 1 << 13,
} ClutterKeyboardA11yFlags;
/**
* ClutterPointerA11yFlags:
* @CLUTTER_A11Y_POINTER_ENABLED:
* @CLUTTER_A11Y_SECONDARY_CLICK_ENABLED:
* @CLUTTER_A11Y_DWELL_ENABLED:
*
* Pointer accessibility features applied to a ClutterInputDevice pointer.
*
*/
typedef enum {
CLUTTER_A11Y_SECONDARY_CLICK_ENABLED = 1 << 0,
CLUTTER_A11Y_DWELL_ENABLED = 1 << 1,
} ClutterPointerA11yFlags;
/**
* ClutterPointerA11yDwellClickType:
* @CLUTTER_A11Y_DWELL_CLICK_TYPE_NONE: Internal use only
* @CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY:
* @CLUTTER_A11Y_DWELL_CLICK_TYPE_SECONDARY:
* @CLUTTER_A11Y_DWELL_CLICK_TYPE_MIDDLE:
* @CLUTTER_A11Y_DWELL_CLICK_TYPE_DOUBLE:
* @CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG:
*
* Dwell click types.
*
*/
typedef enum {
CLUTTER_A11Y_DWELL_CLICK_TYPE_NONE,
CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY,
CLUTTER_A11Y_DWELL_CLICK_TYPE_SECONDARY,
CLUTTER_A11Y_DWELL_CLICK_TYPE_MIDDLE,
CLUTTER_A11Y_DWELL_CLICK_TYPE_DOUBLE,
CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG,
} ClutterPointerA11yDwellClickType;
/**
* ClutterPointerA11yDwellDirection:
* @CLUTTER_A11Y_DWELL_DIRECTION_NONE:
* @CLUTTER_A11Y_DWELL_DIRECTION_LEFT:
* @CLUTTER_A11Y_DWELL_DIRECTION_RIGHT:
* @CLUTTER_A11Y_DWELL_DIRECTION_UP:
* @CLUTTER_A11Y_DWELL_DIRECTION_DOWN:
*
* Dwell gesture directions.
*
*/
typedef enum {
CLUTTER_A11Y_DWELL_DIRECTION_NONE,
CLUTTER_A11Y_DWELL_DIRECTION_LEFT,
CLUTTER_A11Y_DWELL_DIRECTION_RIGHT,
CLUTTER_A11Y_DWELL_DIRECTION_UP,
CLUTTER_A11Y_DWELL_DIRECTION_DOWN,
} ClutterPointerA11yDwellDirection;
/**
* ClutterPointerA11yDwellMode:
* @CLUTTER_A11Y_DWELL_MODE_WINDOW:
* @CLUTTER_A11Y_DWELL_MODE_GESTURE:
*
* Dwell mode.
*
*/
typedef enum {
CLUTTER_A11Y_DWELL_MODE_WINDOW,
CLUTTER_A11Y_DWELL_MODE_GESTURE,
} ClutterPointerA11yDwellMode;
/**
* ClutterPointerA11yTimeoutType:
* @CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK:
* @CLUTTER_A11Y_TIMEOUT_TYPE_DWELL:
* @CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE:
*
* Pointer accessibility timeout type.
*
*/
typedef enum {
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE,
} ClutterPointerA11yTimeoutType;
/**
* ClutterActorFlags:
* @CLUTTER_ACTOR_MAPPED: the actor will be painted (is visible, and inside
@ -448,7 +522,8 @@ typedef enum {
*
* Flags used to signal the state of an actor.
*/
typedef enum { /*< prefix=CLUTTER_ACTOR >*/
typedef enum /*< prefix=CLUTTER_ACTOR >*/
{
CLUTTER_ACTOR_MAPPED = 1 << 1,
CLUTTER_ACTOR_REALIZED = 1 << 2,
CLUTTER_ACTOR_REACTIVE = 1 << 3,
@ -468,7 +543,8 @@ typedef enum { /*< prefix=CLUTTER_ACTOR >*/
*
* Since: 1.8
*/
typedef enum { /*< prefix=CLUTTER_OFFSCREEN_REDIRECT >*/
typedef enum /*< prefix=CLUTTER_OFFSCREEN_REDIRECT >*/
{
CLUTTER_OFFSCREEN_REDIRECT_AUTOMATIC_FOR_OPACITY = 1<<0,
CLUTTER_OFFSCREEN_REDIRECT_ALWAYS = 1<<1
} ClutterOffscreenRedirect;
@ -492,7 +568,8 @@ typedef enum { /*< prefix=CLUTTER_OFFSCREEN_REDIRECT >*/
*
* Since: 1.0
*/
typedef enum {
typedef enum
{
CLUTTER_ALLOCATION_NONE = 0,
CLUTTER_ABSOLUTE_ORIGIN_CHANGED = 1 << 1,
CLUTTER_DELEGATE_LAYOUT = 1 << 2
@ -509,7 +586,8 @@ typedef enum {
*
* Since: 1.4
*/
typedef enum { /*< prefix=CLUTTER_ALIGN >*/
typedef enum /*< prefix=CLUTTER_ALIGN >*/
{
CLUTTER_ALIGN_X_AXIS,
CLUTTER_ALIGN_Y_AXIS,
CLUTTER_ALIGN_BOTH
@ -526,7 +604,8 @@ typedef enum { /*< prefix=CLUTTER_ALIGN >*/
*
* Deprecated: 1.22
*/
typedef enum {
typedef enum
{
CLUTTER_INTERPOLATION_LINEAR,
CLUTTER_INTERPOLATION_CUBIC
} ClutterInterpolation;
@ -551,7 +630,8 @@ typedef enum {
* Deprecated: 1.12: Use #ClutterActorAlign and the #ClutterActor
* API instead
*/
typedef enum {
typedef enum
{
CLUTTER_BIN_ALIGNMENT_FIXED,
CLUTTER_BIN_ALIGNMENT_FILL,
CLUTTER_BIN_ALIGNMENT_START,
@ -576,7 +656,8 @@ typedef enum {
*
* Since: 1.4
*/
typedef enum { /*< prefix=CLUTTER_BIND >*/
typedef enum /*< prefix=CLUTTER_BIND >*/
{
CLUTTER_BIND_X,
CLUTTER_BIND_Y,
CLUTTER_BIND_WIDTH,
@ -595,7 +676,8 @@ typedef enum { /*< prefix=CLUTTER_BIND >*/
*
* Flags passed to the paint or pick method of #ClutterEffect.
*/
typedef enum { /*< prefix=CLUTTER_EFFECT_PAINT >*/
typedef enum /*< prefix=CLUTTER_EFFECT_PAINT >*/
{
CLUTTER_EFFECT_PAINT_ACTOR_DIRTY = (1 << 0)
} ClutterEffectPaintFlags;
@ -611,7 +693,8 @@ typedef enum { /*< prefix=CLUTTER_EFFECT_PAINT >*/
*
* Since: 1.2
*/
typedef enum {
typedef enum
{
CLUTTER_BOX_ALIGNMENT_START,
CLUTTER_BOX_ALIGNMENT_END,
CLUTTER_BOX_ALIGNMENT_CENTER
@ -628,7 +711,8 @@ typedef enum {
*
* Since: 1.8
*/
typedef enum { /*< prefix=CLUTTER_LONG_PRESS >*/
typedef enum /*< prefix=CLUTTER_LONG_PRESS >*/
{
CLUTTER_LONG_PRESS_QUERY,
CLUTTER_LONG_PRESS_ACTIVATE,
CLUTTER_LONG_PRESS_CANCEL
@ -686,7 +770,8 @@ typedef enum { /*< prefix=CLUTTER_LONG_PRESS >*/
*
* Since: 1.6
*/
typedef enum { /*< prefix=CLUTTER_COLOR >*/
typedef enum /*< prefix=CLUTTER_COLOR >*/
{
/* CGA/EGA-like palette */
CLUTTER_COLOR_WHITE = 0,
CLUTTER_COLOR_BLACK,
@ -750,7 +835,8 @@ typedef enum { /*< prefix=CLUTTER_COLOR >*/
*
* Since: 1.4
*/
typedef enum { /*< prefix=CLUTTER_DRAG >*/
typedef enum /*< prefix=CLUTTER_DRAG >*/
{
CLUTTER_DRAG_AXIS_NONE = 0,
CLUTTER_DRAG_X_AXIS,
@ -767,7 +853,8 @@ typedef enum { /*< prefix=CLUTTER_DRAG >*/
*
* Since: 0.6
*/
typedef enum { /*< flags prefix=CLUTTER_EVENT >*/
typedef enum /*< flags prefix=CLUTTER_EVENT >*/
{
CLUTTER_EVENT_NONE = 0,
CLUTTER_EVENT_FLAG_SYNTHETIC = 1 << 0,
CLUTTER_EVENT_FLAG_INPUT_METHOD = 1 << 1,
@ -812,7 +899,8 @@ typedef enum { /*< flags prefix=CLUTTER_EVENT >*/
*
* Since: 0.4
*/
typedef enum { /*< prefix=CLUTTER >*/
typedef enum /*< prefix=CLUTTER >*/
{
CLUTTER_NOTHING = 0,
CLUTTER_KEY_PRESS,
CLUTTER_KEY_RELEASE,
@ -857,7 +945,8 @@ typedef enum { /*< prefix=CLUTTER >*/
*
* Since: 0.4
*/
typedef enum { /*< prefix=CLUTTER_SCROLL >*/
typedef enum /*< prefix=CLUTTER_SCROLL >*/
{
CLUTTER_SCROLL_UP,
CLUTTER_SCROLL_DOWN,
CLUTTER_SCROLL_LEFT,
@ -867,28 +956,23 @@ typedef enum { /*< prefix=CLUTTER_SCROLL >*/
/**
* ClutterStageState:
* @CLUTTER_STAGE_STATE_FULLSCREEN: Fullscreen mask
* @CLUTTER_STAGE_STATE_OFFSCREEN: Offscreen mask (deprecated)
* @CLUTTER_STAGE_STATE_ACTIVATED: Activated mask
*
* Stage state masks, used by the #ClutterEvent of type %CLUTTER_STAGE_STATE.
*
* Since: 0.4
*/
typedef enum {
CLUTTER_STAGE_STATE_FULLSCREEN = (1 << 1),
CLUTTER_STAGE_STATE_OFFSCREEN = (1 << 2),
typedef enum
{
CLUTTER_STAGE_STATE_ACTIVATED = (1 << 3)
} ClutterStageState;
/**
* ClutterFeatureFlags:
* @CLUTTER_FEATURE_TEXTURE_NPOT: Set if NPOTS textures supported.
* @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_USER_RESIZE: Set if stage is able to be user resized.
* @CLUTTER_FEATURE_STAGE_CURSOR: Set if stage has a graphical cursor.
* @CLUTTER_FEATURE_SHADERS_GLSL: Set if the backend supports GLSL shaders.
* @CLUTTER_FEATURE_OFFSCREEN: Set if the backend supports offscreen rendering.
@ -902,12 +986,10 @@ typedef enum {
*/
typedef enum
{
CLUTTER_FEATURE_TEXTURE_NPOT = (1 << 2),
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_USER_RESIZE = (1 << 7),
CLUTTER_FEATURE_STAGE_CURSOR = (1 << 8),
CLUTTER_FEATURE_SHADERS_GLSL = (1 << 9),
CLUTTER_FEATURE_OFFSCREEN = (1 << 10),
@ -927,7 +1009,8 @@ typedef enum
*
* Since: 1.2
*/
typedef enum { /*< prefix=CLUTTER_FLOW >*/
typedef enum /*< prefix=CLUTTER_FLOW >*/
{
CLUTTER_FLOW_HORIZONTAL,
CLUTTER_FLOW_VERTICAL
} ClutterFlowOrientation;
@ -954,7 +1037,8 @@ typedef enum { /*< prefix=CLUTTER_FLOW >*/
*
* Since: 1.0
*/
typedef enum {
typedef enum
{
CLUTTER_POINTER_DEVICE,
CLUTTER_KEYBOARD_DEVICE,
CLUTTER_EXTENSION_DEVICE,
@ -982,7 +1066,8 @@ typedef enum {
*
* Since: 1.6
*/
typedef enum {
typedef enum
{
CLUTTER_INPUT_MODE_MASTER,
CLUTTER_INPUT_MODE_SLAVE,
CLUTTER_INPUT_MODE_FLOATING
@ -1007,7 +1092,8 @@ typedef enum {
*
* Since: 1.6
*/
typedef enum {
typedef enum
{
CLUTTER_INPUT_AXIS_IGNORE,
CLUTTER_INPUT_AXIS_X,
@ -1034,7 +1120,8 @@ typedef enum {
*
* Since: 1.6
*/
typedef enum {
typedef enum
{
CLUTTER_SNAP_EDGE_TOP,
CLUTTER_SNAP_EDGE_RIGHT,
CLUTTER_SNAP_EDGE_BOTTOM,
@ -1051,7 +1138,8 @@ typedef enum {
*
* Since: 1.0
*/
typedef enum {
typedef enum
{
CLUTTER_PICK_NONE = 0,
CLUTTER_PICK_REACTIVE,
CLUTTER_PICK_ALL
@ -1068,7 +1156,8 @@ typedef enum {
*
* Since: 1.8
*/
typedef enum { /*< prefix=CLUTTER_SWIPE_DIRECTION >*/
typedef enum /*< prefix=CLUTTER_SWIPE_DIRECTION >*/
{
CLUTTER_SWIPE_DIRECTION_UP = 1 << 0,
CLUTTER_SWIPE_DIRECTION_DOWN = 1 << 1,
CLUTTER_SWIPE_DIRECTION_LEFT = 1 << 2,
@ -1088,7 +1177,8 @@ typedef enum { /*< prefix=CLUTTER_SWIPE_DIRECTION >*/
*
* Since: 1.12
*/
typedef enum { /*< prefix=CLUTTER_PAN >*/
typedef enum /*< prefix=CLUTTER_PAN >*/
{
CLUTTER_PAN_AXIS_NONE = 0,
CLUTTER_PAN_X_AXIS,
@ -1113,7 +1203,8 @@ typedef enum { /*< prefix=CLUTTER_PAN >*/
*
* Deprecated: 1.22: Use the alignment properties of #ClutterActor
*/
typedef enum {
typedef enum
{
CLUTTER_TABLE_ALIGNMENT_START,
CLUTTER_TABLE_ALIGNMENT_CENTER,
CLUTTER_TABLE_ALIGNMENT_END
@ -1134,7 +1225,8 @@ typedef enum {
* Deprecated: 1.22: The #ClutterTexture class was the only user of
* this API
*/
typedef enum { /*< prefix=CLUTTER_TEXTURE >*/
typedef enum /*< prefix=CLUTTER_TEXTURE >*/
{
CLUTTER_TEXTURE_NONE = 0,
CLUTTER_TEXTURE_RGB_FLAG_BGR = 1 << 1,
CLUTTER_TEXTURE_RGB_FLAG_PREMULT = 1 << 2, /* FIXME: not handled */
@ -1158,7 +1250,8 @@ typedef enum { /*< prefix=CLUTTER_TEXTURE >*/
* this API; use #ClutterImage and clutter_actor_set_content_scaling_filters()
* instead.
*/
typedef enum { /*< prefix=CLUTTER_TEXTURE_QUALITY >*/
typedef enum /*< prefix=CLUTTER_TEXTURE_QUALITY >*/
{
CLUTTER_TEXTURE_QUALITY_LOW,
CLUTTER_TEXTURE_QUALITY_MEDIUM,
CLUTTER_TEXTURE_QUALITY_HIGH
@ -1173,7 +1266,8 @@ typedef enum { /*< prefix=CLUTTER_TEXTURE_QUALITY >*/
*
* Since: 0.6
*/
typedef enum {
typedef enum
{
CLUTTER_TIMELINE_FORWARD,
CLUTTER_TIMELINE_BACKWARD
} ClutterTimelineDirection;
@ -1192,7 +1286,8 @@ typedef enum {
*
* Since: 1.0
*/
typedef enum { /*< prefix=CLUTTER_UNIT >*/
typedef enum /*< prefix=CLUTTER_UNIT >*/
{
CLUTTER_UNIT_PIXEL,
CLUTTER_UNIT_EM,
CLUTTER_UNIT_MM,
@ -1222,7 +1317,8 @@ typedef enum { /*< prefix=CLUTTER_UNIT >*/
*
* Since: 1.0
*/
typedef enum {
typedef enum
{
CLUTTER_PATH_MOVE_TO = 0,
CLUTTER_PATH_LINE_TO = 1,
CLUTTER_PATH_CURVE_TO = 2,
@ -1253,7 +1349,8 @@ typedef enum {
*
* Since: 1.10
*/
typedef enum {
typedef enum
{
CLUTTER_ACTOR_ALIGN_FILL,
CLUTTER_ACTOR_ALIGN_START,
CLUTTER_ACTOR_ALIGN_CENTER,
@ -1273,7 +1370,8 @@ typedef enum {
*
* Since: 1.10
*/
typedef enum {
typedef enum
{
CLUTTER_REPAINT_FLAGS_PRE_PAINT = 1 << 0,
CLUTTER_REPAINT_FLAGS_POST_PAINT = 1 << 1,
CLUTTER_REPAINT_FLAGS_QUEUE_REDRAW_ON_ADD = 1 << 2
@ -1298,7 +1396,8 @@ typedef enum {
*
* Since: 1.10
*/
typedef enum {
typedef enum
{
CLUTTER_CONTENT_GRAVITY_TOP_LEFT,
CLUTTER_CONTENT_GRAVITY_TOP,
CLUTTER_CONTENT_GRAVITY_TOP_RIGHT,
@ -1328,7 +1427,8 @@ typedef enum {
*
* Since: 1.10
*/
typedef enum {
typedef enum
{
CLUTTER_SCALING_FILTER_LINEAR,
CLUTTER_SCALING_FILTER_NEAREST,
CLUTTER_SCALING_FILTER_TRILINEAR
@ -1343,7 +1443,8 @@ typedef enum {
*
* Since: 1.12
*/
typedef enum {
typedef enum
{
CLUTTER_ORIENTATION_HORIZONTAL,
CLUTTER_ORIENTATION_VERTICAL
} ClutterOrientation;
@ -1359,7 +1460,8 @@ typedef enum {
*
* Since: 1.12
*/
typedef enum { /*< prefix=CLUTTER_SCROLL >*/
typedef enum /*< prefix=CLUTTER_SCROLL >*/
{
CLUTTER_SCROLL_NONE = 0,
CLUTTER_SCROLL_HORIZONTALLY = 1 << 0,
@ -1379,7 +1481,8 @@ typedef enum { /*< prefix=CLUTTER_SCROLL >*/
*
* Since: 1.12
*/
typedef enum {
typedef enum
{
CLUTTER_GRID_POSITION_LEFT,
CLUTTER_GRID_POSITION_RIGHT,
CLUTTER_GRID_POSITION_TOP,
@ -1397,7 +1500,8 @@ typedef enum {
*
* Since: 1.12
*/
typedef enum {
typedef enum
{
CLUTTER_REPEAT_NONE = 0,
CLUTTER_REPEAT_X_AXIS = 1 << 0,
CLUTTER_REPEAT_Y_AXIS = 1 << 1,
@ -1419,7 +1523,8 @@ typedef enum {
*
* Since: 1.12
*/
typedef enum {
typedef enum
{
CLUTTER_STEP_MODE_START,
CLUTTER_STEP_MODE_END
} ClutterStepMode;
@ -1435,7 +1540,8 @@ typedef enum {
*
* Since: 1.12
*/
typedef enum { /*< prefix=CLUTTER_ZOOM >*/
typedef enum /*< prefix=CLUTTER_ZOOM >*/
{
CLUTTER_ZOOM_X_AXIS,
CLUTTER_ZOOM_Y_AXIS,
CLUTTER_ZOOM_BOTH
@ -1458,7 +1564,8 @@ typedef enum { /*< prefix=CLUTTER_ZOOM >*/
*
* Since: 1.18
*/
typedef enum {
typedef enum
{
CLUTTER_GESTURE_TRIGGER_EDGE_NONE = 0,
CLUTTER_GESTURE_TRIGGER_EDGE_AFTER,
CLUTTER_GESTURE_TRIGGER_EDGE_BEFORE
@ -1494,7 +1601,8 @@ typedef enum {
*
* Since: 1.24
*/
typedef enum {
typedef enum
{
CLUTTER_TOUCHPAD_GESTURE_PHASE_BEGIN,
CLUTTER_TOUCHPAD_GESTURE_PHASE_UPDATE,
CLUTTER_TOUCHPAD_GESTURE_PHASE_END,
@ -1516,7 +1624,8 @@ typedef enum {
*
* Since: 1.26
*/
typedef enum {
typedef enum
{
CLUTTER_SCROLL_SOURCE_UNKNOWN,
CLUTTER_SCROLL_SOURCE_WHEEL,
CLUTTER_SCROLL_SOURCE_FINGER,
@ -1534,7 +1643,8 @@ typedef enum {
*
* Since: 1.26
*/
typedef enum {
typedef enum
{
CLUTTER_SCROLL_FINISHED_NONE = 0,
CLUTTER_SCROLL_FINISHED_HORIZONTAL = 1 << 0,
CLUTTER_SCROLL_FINISHED_VERTICAL = 1 << 1
@ -1555,7 +1665,8 @@ typedef enum {
*
* Since: 1.28
*/
typedef enum {
typedef enum
{
CLUTTER_INPUT_DEVICE_TOOL_NONE,
CLUTTER_INPUT_DEVICE_TOOL_PEN,
CLUTTER_INPUT_DEVICE_TOOL_ERASER,
@ -1566,17 +1677,20 @@ typedef enum {
CLUTTER_INPUT_DEVICE_TOOL_LENS
} ClutterInputDeviceToolType;
typedef enum {
typedef enum
{
CLUTTER_INPUT_DEVICE_PAD_SOURCE_UNKNOWN,
CLUTTER_INPUT_DEVICE_PAD_SOURCE_FINGER,
} ClutterInputDevicePadSource;
typedef enum {
typedef enum
{
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE,
CLUTTER_INPUT_DEVICE_MAPPING_RELATIVE,
} ClutterInputDeviceMapping;
typedef enum {
typedef enum
{
CLUTTER_INPUT_CONTENT_HINT_COMPLETION = 1 << 0,
CLUTTER_INPUT_CONTENT_HINT_SPELLCHECK = 1 << 1,
CLUTTER_INPUT_CONTENT_HINT_AUTO_CAPITALIZATION = 1 << 2,
@ -1589,7 +1703,8 @@ typedef enum {
CLUTTER_INPUT_CONTENT_HINT_MULTILINE = 1 << 9,
} ClutterInputContentHintFlags;
typedef enum {
typedef enum
{
CLUTTER_INPUT_CONTENT_PURPOSE_NORMAL,
CLUTTER_INPUT_CONTENT_PURPOSE_ALPHA,
CLUTTER_INPUT_CONTENT_PURPOSE_DIGITS,
@ -1605,7 +1720,8 @@ typedef enum {
CLUTTER_INPUT_CONTENT_PURPOSE_TERMINAL,
} ClutterInputContentPurpose;
typedef enum {
typedef enum
{
CLUTTER_INPUT_PANEL_STATE_OFF,
CLUTTER_INPUT_PANEL_STATE_ON,
CLUTTER_INPUT_PANEL_STATE_TOGGLE,

View File

@ -5,22 +5,28 @@
G_BEGIN_DECLS
CLUTTER_EXPORT
void _clutter_event_set_pointer_emulated (ClutterEvent *event,
gboolean is_emulated);
/* Reinjecting queued events for processing */
CLUTTER_EXPORT
void _clutter_process_event (ClutterEvent *event);
CLUTTER_EXPORT
gboolean _clutter_event_process_filters (ClutterEvent *event);
/* clears the event queue inside the main context */
void _clutter_clear_events_queue (void);
void _clutter_clear_events_queue_for_stage (ClutterStage *stage);
CLUTTER_EXPORT
void _clutter_event_set_platform_data (ClutterEvent *event,
gpointer data);
CLUTTER_EXPORT
gpointer _clutter_event_get_platform_data (const ClutterEvent *event);
CLUTTER_EXPORT
void _clutter_event_set_state_full (ClutterEvent *event,
ClutterModifierType button_state,
ClutterModifierType base_state,
@ -28,6 +34,7 @@ void _clutter_event_set_state_full (ClutterEvent *ev
ClutterModifierType locked_state,
ClutterModifierType effective_state);
CLUTTER_EXPORT
void _clutter_event_push (const ClutterEvent *event,
gboolean do_copy);

View File

@ -1,38 +0,0 @@
#include "clutter-build-config.h"
#include "clutter-event-translator.h"
#include "clutter-backend.h"
#include "clutter-private.h"
#define clutter_event_translator_get_type _clutter_event_translator_get_type
typedef ClutterEventTranslatorIface ClutterEventTranslatorInterface;
G_DEFINE_INTERFACE (ClutterEventTranslator, clutter_event_translator, G_TYPE_OBJECT);
static ClutterTranslateReturn
default_translate_event (ClutterEventTranslator *translator,
gpointer native,
ClutterEvent *event)
{
return CLUTTER_TRANSLATE_CONTINUE;
}
static void
clutter_event_translator_default_init (ClutterEventTranslatorIface *iface)
{
iface->translate_event = default_translate_event;
}
ClutterTranslateReturn
_clutter_event_translator_translate_event (ClutterEventTranslator *translator,
gpointer native,
ClutterEvent *translated)
{
ClutterEventTranslatorIface *iface;
iface = CLUTTER_EVENT_TRANSLATOR_GET_IFACE (translator);
return iface->translate_event (translator, native, translated);
}

View File

@ -1,41 +0,0 @@
#ifndef __CLUTTER_EVENT_TRANSLATOR_H__
#define __CLUTTER_EVENT_TRANSLATOR_H__
#include <glib-object.h>
#include <clutter/clutter-event.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_EVENT_TRANSLATOR (_clutter_event_translator_get_type ())
#define CLUTTER_EVENT_TRANSLATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_EVENT_TRANSLATOR, ClutterEventTranslator))
#define CLUTTER_IS_EVENT_TRANSLATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_EVENT_TRANSLATOR))
#define CLUTTER_EVENT_TRANSLATOR_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_EVENT_TRANSLATOR, ClutterEventTranslatorIface))
typedef struct _ClutterEventTranslator ClutterEventTranslator;
typedef struct _ClutterEventTranslatorIface ClutterEventTranslatorIface;
typedef enum {
CLUTTER_TRANSLATE_CONTINUE,
CLUTTER_TRANSLATE_REMOVE,
CLUTTER_TRANSLATE_QUEUE
} ClutterTranslateReturn;
struct _ClutterEventTranslatorIface
{
GTypeInterface g_iface;
ClutterTranslateReturn (* translate_event) (ClutterEventTranslator *translator,
gpointer native,
ClutterEvent *translated);
};
CLUTTER_EXPORT
GType _clutter_event_translator_get_type (void) G_GNUC_CONST;
ClutterTranslateReturn _clutter_event_translator_translate_event (ClutterEventTranslator *translator,
gpointer native,
ClutterEvent *translated);
G_END_DECLS
#endif /* __CLUTTER_EVENT_TRANSLATOR_H__ */

View File

@ -1021,6 +1021,9 @@ clutter_event_get_event_sequence (const ClutterEvent *event)
event->type == CLUTTER_TOUCH_END ||
event->type == CLUTTER_TOUCH_CANCEL)
return event->touch.sequence;
else if (event->type == CLUTTER_ENTER ||
event->type == CLUTTER_LEAVE)
return event->crossing.sequence;
return NULL;
}

View File

@ -269,6 +269,7 @@ struct _ClutterCrossingEvent
gfloat x;
gfloat y;
ClutterInputDevice *device;
ClutterEventSequence *sequence;
ClutterActor *related;
};
@ -772,7 +773,10 @@ void clutter_event_get_gesture_motion_delta (const Clut
gdouble *dx,
gdouble *dy);
CLUTTER_EXPORT
ClutterScrollSource clutter_event_get_scroll_source (const ClutterEvent *event);
CLUTTER_EXPORT
ClutterScrollFinishFlags clutter_event_get_scroll_finish_flags (const ClutterEvent *event);
CLUTTER_EXPORT

View File

@ -64,17 +64,13 @@ clutter_features_from_cogl (guint cogl_flags)
{
ClutterFeatureFlags clutter_flags = 0;
if (cogl_flags & COGL_FEATURE_TEXTURE_NPOT)
clutter_flags |= CLUTTER_FEATURE_TEXTURE_NPOT;
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;
if (cogl_flags & COGL_FEATURE_SHADERS_GLSL)
clutter_flags |= CLUTTER_FEATURE_SHADERS_GLSL;
clutter_flags |= CLUTTER_FEATURE_SHADERS_GLSL;
if (cogl_flags & COGL_FEATURE_OFFSCREEN)
clutter_flags |= CLUTTER_FEATURE_OFFSCREEN;

View File

@ -804,8 +804,7 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_end),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
@ -827,8 +826,7 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_cancel),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
}

View File

@ -53,9 +53,11 @@
struct _ClutterImagePrivate
{
CoglTexture *texture;
gint width;
gint height;
};
static void clutter_content_iface_init (ClutterContentIface *iface);
static void clutter_content_iface_init (ClutterContentInterface *iface);
G_DEFINE_TYPE_WITH_CODE (ClutterImage, clutter_image, G_TYPE_OBJECT,
G_ADD_PRIVATE (ClutterImage)
@ -68,6 +70,27 @@ clutter_image_error_quark (void)
return g_quark_from_static_string ("clutter-image-error-quark");
}
static void
update_image_size (ClutterImage *self)
{
gint width, height;
if (self->priv->texture == NULL)
return;
width = cogl_texture_get_width (self->priv->texture);
height = cogl_texture_get_height (self->priv->texture);
if (self->priv->width == width &&
self->priv->height == height)
return;
self->priv->width = width;
self->priv->height = height;
clutter_content_invalidate_size (CLUTTER_CONTENT (self));
}
static void
clutter_image_finalize (GObject *gobject)
{
@ -131,7 +154,7 @@ clutter_image_get_preferred_size (ClutterContent *content,
}
static void
clutter_content_iface_init (ClutterContentIface *iface)
clutter_content_iface_init (ClutterContentInterface *iface)
{
iface->get_preferred_size = clutter_image_get_preferred_size;
iface->paint_content = clutter_image_paint_content;
@ -233,11 +256,12 @@ clutter_image_set_data (ClutterImage *image,
{
g_set_error_literal (error, CLUTTER_IMAGE_ERROR,
CLUTTER_IMAGE_ERROR_INVALID_DATA,
_("Unable to load image data"));
"Unable to load image data");
return FALSE;
}
clutter_content_invalidate (CLUTTER_CONTENT (image));
update_image_size (image);
return TRUE;
}
@ -301,11 +325,12 @@ clutter_image_set_bytes (ClutterImage *image,
{
g_set_error_literal (error, CLUTTER_IMAGE_ERROR,
CLUTTER_IMAGE_ERROR_INVALID_DATA,
_("Unable to load image data"));
"Unable to load image data");
return FALSE;
}
clutter_content_invalidate (CLUTTER_CONTENT (image));
update_image_size (image);
return TRUE;
}
@ -394,11 +419,12 @@ clutter_image_set_area (ClutterImage *image,
{
g_set_error_literal (error, CLUTTER_IMAGE_ERROR,
CLUTTER_IMAGE_ERROR_INVALID_DATA,
_("Unable to load image data"));
"Unable to load image data");
return FALSE;
}
clutter_content_invalidate (CLUTTER_CONTENT (image));
update_image_size (image);
return TRUE;
}

View File

@ -63,7 +63,8 @@ typedef struct _ClutterImageClass ClutterImageClass;
*
* Since: 1.10
*/
typedef enum {
typedef enum
{
CLUTTER_IMAGE_ERROR_INVALID_DATA
} ClutterImageError;

View File

@ -35,7 +35,8 @@ struct _ClutterInputDeviceToolPrivate
guint64 id;
};
enum {
enum
{
PROP_0,
PROP_TYPE,
PROP_SERIAL,

View File

@ -107,6 +107,9 @@ clutter_input_device_dispose (GObject *gobject)
device->associated = NULL;
}
if (device->accessibility_virtual_device)
g_clear_object (&device->accessibility_virtual_device);
g_clear_pointer (&device->axes, g_array_unref);
g_clear_pointer (&device->keys, g_array_unref);
g_clear_pointer (&device->scroll_info, g_array_unref);
@ -834,6 +837,7 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
event->crossing.x = device->current_x;
event->crossing.y = device->current_y;
event->crossing.related = actor;
event->crossing.sequence = sequence;
clutter_event_set_device (event, device);
/* we need to make sure that this event is processed
@ -870,6 +874,7 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
event->crossing.y = device->current_y;
event->crossing.source = actor;
event->crossing.related = old_actor;
event->crossing.sequence = sequence;
clutter_event_set_device (event, device);
/* see above */
@ -1034,9 +1039,10 @@ _clutter_input_device_update (ClutterInputDevice *device,
ClutterActor *new_cursor_actor;
ClutterActor *old_cursor_actor;
ClutterPoint point = { -1, -1 };
ClutterInputDeviceType device_type = device->device_type;
if (device->device_type == CLUTTER_KEYBOARD_DEVICE)
return NULL;
g_assert (device_type != CLUTTER_KEYBOARD_DEVICE &&
device_type != CLUTTER_PAD_DEVICE);
stage = device->stage;
if (G_UNLIKELY (stage == NULL))
@ -1919,6 +1925,157 @@ _clutter_input_device_reset_scroll_info (ClutterInputDevice *device)
}
}
static void
on_grab_actor_destroy (ClutterActor *actor,
ClutterInputDevice *device)
{
switch (device->device_type)
{
case CLUTTER_POINTER_DEVICE:
case CLUTTER_TABLET_DEVICE:
device->pointer_grab_actor = NULL;
break;
case CLUTTER_KEYBOARD_DEVICE:
device->keyboard_grab_actor = NULL;
break;
default:
g_assert_not_reached ();
}
}
/**
* clutter_input_device_grab:
* @device: a #ClutterInputDevice
* @actor: a #ClutterActor
*
* Acquires a grab on @actor for the given @device.
*
* Any event coming from @device will be delivered to @actor, bypassing
* the usual event delivery mechanism, until the grab is released by
* calling clutter_input_device_ungrab().
*
* The grab is client-side: even if the windowing system used by the Clutter
* backend has the concept of "device grabs", Clutter will not use them.
*
* Only #ClutterInputDevice of types %CLUTTER_POINTER_DEVICE,
* %CLUTTER_TABLET_DEVICE and %CLUTTER_KEYBOARD_DEVICE can hold a grab.
*
* Since: 1.10
*/
void
clutter_input_device_grab (ClutterInputDevice *device,
ClutterActor *actor)
{
ClutterActor **grab_actor;
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
switch (device->device_type)
{
case CLUTTER_POINTER_DEVICE:
case CLUTTER_TABLET_DEVICE:
grab_actor = &device->pointer_grab_actor;
break;
case CLUTTER_KEYBOARD_DEVICE:
grab_actor = &device->keyboard_grab_actor;
break;
default:
g_critical ("Only pointer and keyboard devices can grab an actor");
return;
}
if (*grab_actor != NULL)
{
g_signal_handlers_disconnect_by_func (*grab_actor,
G_CALLBACK (on_grab_actor_destroy),
device);
}
*grab_actor = actor;
g_signal_connect (*grab_actor,
"destroy",
G_CALLBACK (on_grab_actor_destroy),
device);
}
/**
* clutter_input_device_ungrab:
* @device: a #ClutterInputDevice
*
* Releases the grab on the @device, if one is in place.
*
* Since: 1.10
*/
void
clutter_input_device_ungrab (ClutterInputDevice *device)
{
ClutterActor **grab_actor;
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
switch (device->device_type)
{
case CLUTTER_POINTER_DEVICE:
case CLUTTER_TABLET_DEVICE:
grab_actor = &device->pointer_grab_actor;
break;
case CLUTTER_KEYBOARD_DEVICE:
grab_actor = &device->keyboard_grab_actor;
break;
default:
return;
}
if (*grab_actor == NULL)
return;
g_signal_handlers_disconnect_by_func (*grab_actor,
G_CALLBACK (on_grab_actor_destroy),
device);
*grab_actor = NULL;
}
/**
* clutter_input_device_get_grabbed_actor:
* @device: a #ClutterInputDevice
*
* Retrieves a pointer to the #ClutterActor currently grabbing all
* the events coming from @device.
*
* Return value: (transfer none): a #ClutterActor, or %NULL
*
* Since: 1.10
*/
ClutterActor *
clutter_input_device_get_grabbed_actor (ClutterInputDevice *device)
{
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
switch (device->device_type)
{
case CLUTTER_POINTER_DEVICE:
case CLUTTER_TABLET_DEVICE:
return device->pointer_grab_actor;
case CLUTTER_KEYBOARD_DEVICE:
return device->keyboard_grab_actor;
default:
g_critical ("Only pointer and keyboard devices can grab an actor");
}
return NULL;
}
static void
on_grab_sequence_actor_destroy (ClutterActor *actor,
ClutterInputDevice *device)
@ -2284,15 +2441,3 @@ clutter_input_device_is_grouped (ClutterInputDevice *device,
return CLUTTER_INPUT_DEVICE_GET_CLASS (device)->is_grouped (device, other_device);
}
gboolean
clutter_input_device_get_physical_size (ClutterInputDevice *device,
gdouble *width,
gdouble *height)
{
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
return CLUTTER_INPUT_DEVICE_GET_CLASS (device)->get_physical_size (device,
width,
height);
}

View File

@ -171,10 +171,6 @@ void clutter_input_device_set_mapping_mode (ClutterInputDev
CLUTTER_EXPORT
gboolean clutter_input_device_is_grouped (ClutterInputDevice *device,
ClutterInputDevice *other_device);
CLUTTER_EXPORT
gboolean clutter_input_device_get_physical_size (ClutterInputDevice *device,
gdouble *width,
gdouble *height);
G_END_DECLS

View File

@ -175,7 +175,8 @@ clutter_input_focus_set_can_show_preedit (ClutterInputFocus *focus,
}
void
clutter_input_focus_request_toggle_input_panel (ClutterInputFocus *focus)
clutter_input_focus_set_input_panel_state (ClutterInputFocus *focus,
ClutterInputPanelState state)
{
ClutterInputFocusPrivate *priv;
@ -184,7 +185,7 @@ clutter_input_focus_request_toggle_input_panel (ClutterInputFocus *focus)
priv = clutter_input_focus_get_instance_private (focus);
clutter_input_method_toggle_input_panel (priv->im);
clutter_input_method_set_input_panel_state (priv->im, state);
}
void

View File

@ -78,6 +78,7 @@ CLUTTER_EXPORT
void clutter_input_focus_set_can_show_preedit (ClutterInputFocus *focus,
gboolean can_show_preedit);
CLUTTER_EXPORT
void clutter_input_focus_request_toggle_input_panel (ClutterInputFocus *focus);
void clutter_input_focus_set_input_panel_state (ClutterInputFocus *focus,
ClutterInputPanelState state);
#endif /* __CLUTTER_INPUT_FOCUS_H__ */

View File

@ -37,7 +37,8 @@ struct _ClutterInputMethodPrivate
gboolean can_show_preedit;
};
enum {
enum
{
COMMIT,
DELETE_SURROUNDING,
REQUEST_SURROUNDING,
@ -46,7 +47,8 @@ enum {
N_SIGNALS,
};
enum {
enum
{
PROP_0,
PROP_CONTENT_HINTS,
PROP_CONTENT_PURPOSE,
@ -264,9 +266,6 @@ clutter_input_method_focus_out (ClutterInputMethod *im)
klass = CLUTTER_INPUT_METHOD_GET_CLASS (im);
klass->focus_out (im);
g_signal_emit (im, signals[INPUT_PANEL_STATE],
0, CLUTTER_INPUT_PANEL_STATE_OFF);
}
ClutterInputFocus *
@ -361,12 +360,12 @@ clutter_input_method_notify_key_event (ClutterInputMethod *im,
}
void
clutter_input_method_toggle_input_panel (ClutterInputMethod *im)
clutter_input_method_set_input_panel_state (ClutterInputMethod *im,
ClutterInputPanelState state)
{
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (im));
g_signal_emit (im, signals[INPUT_PANEL_STATE], 0,
CLUTTER_INPUT_PANEL_STATE_TOGGLE);
g_signal_emit (im, signals[INPUT_PANEL_STATE], 0, state);
}
void

View File

@ -83,7 +83,8 @@ void clutter_input_method_notify_key_event (ClutterInputMethod *im,
const ClutterEvent *event,
gboolean filtered);
CLUTTER_EXPORT
void clutter_input_method_request_toggle_input_panel (ClutterInputMethod *im);
void clutter_input_method_set_input_panel_state (ClutterInputMethod *im,
ClutterInputPanelState state);
CLUTTER_EXPORT
void clutter_input_method_forward_key (ClutterInputMethod *im,

View File

@ -0,0 +1,47 @@
/*
* Copyright (C) 2019 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Author: Olivier Fourdan <ofourdan@redhat.com>
*/
#ifndef __CLUTTER_INPUT_POINTER_A11Y_H__
#define __CLUTTER_INPUT_POINTER_A11Y_H__
#include <clutter/clutter-types.h>
#include "clutter-enum-types.h"
G_BEGIN_DECLS
CLUTTER_EXPORT
void _clutter_input_pointer_a11y_add_device (ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_input_pointer_a11y_remove_device (ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_input_pointer_a11y_on_motion_event (ClutterInputDevice *device,
float x,
float y);
CLUTTER_EXPORT
void _clutter_input_pointer_a11y_on_button_event (ClutterInputDevice *device,
int button,
gboolean pressed);
CLUTTER_EXPORT
gboolean _clutter_is_input_pointer_a11y_enabled (ClutterInputDevice *device);
G_END_DECLS
#endif /* __CLUTTER_INPUT_POINTER_A11Y_H__ */

View File

@ -0,0 +1,710 @@
/*
* Copyright (C) 2019 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Author: Olivier Fourdan <ofourdan@redhat.com>
*
* This reimplements in Clutter the same behavior as mousetweaks original
* implementation by Gerd Kohlberger <gerdko gmail com>
* mousetweaks Copyright (C) 2007-2010 Gerd Kohlberger <gerdko gmail com>
*/
#include "clutter-build-config.h"
#include "clutter-device-manager.h"
#include "clutter-device-manager-private.h"
#include "clutter-enum-types.h"
#include "clutter-input-device.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-main.h"
#include "clutter-virtual-input-device.h"
static gboolean
is_secondary_click_enabled (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return (settings.controls & CLUTTER_A11Y_SECONDARY_CLICK_ENABLED);
}
static gboolean
is_dwell_click_enabled (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return (settings.controls & CLUTTER_A11Y_DWELL_ENABLED);
}
static unsigned int
get_secondary_click_delay (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return settings.secondary_click_delay;
}
static unsigned int
get_dwell_delay (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return settings.dwell_delay;
}
static unsigned int
get_dwell_threshold (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return settings.dwell_threshold;
}
static ClutterPointerA11yDwellMode
get_dwell_mode (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return settings.dwell_mode;
}
static ClutterPointerA11yDwellClickType
get_dwell_click_type (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
return settings.dwell_click_type;
}
static ClutterPointerA11yDwellClickType
get_dwell_click_type_for_direction (ClutterInputDevice *device,
ClutterPointerA11yDwellDirection direction)
{
ClutterPointerA11ySettings settings;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
if (direction == settings.dwell_gesture_single)
return CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY;
else if (direction == settings.dwell_gesture_double)
return CLUTTER_A11Y_DWELL_CLICK_TYPE_DOUBLE;
else if (direction == settings.dwell_gesture_drag)
return CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG;
else if (direction == settings.dwell_gesture_secondary)
return CLUTTER_A11Y_DWELL_CLICK_TYPE_SECONDARY;
return CLUTTER_A11Y_DWELL_CLICK_TYPE_NONE;
}
static void
emit_button_press (ClutterInputDevice *device,
gint button)
{
clutter_virtual_input_device_notify_button (device->accessibility_virtual_device,
g_get_monotonic_time (),
button,
CLUTTER_BUTTON_STATE_PRESSED);
}
static void
emit_button_release (ClutterInputDevice *device,
gint button)
{
clutter_virtual_input_device_notify_button (device->accessibility_virtual_device,
g_get_monotonic_time (),
button,
CLUTTER_BUTTON_STATE_RELEASED);
}
static void
emit_button_click (ClutterInputDevice *device,
gint button)
{
emit_button_press (device, button);
emit_button_release (device, button);
}
static void
restore_dwell_position (ClutterInputDevice *device)
{
clutter_virtual_input_device_notify_absolute_motion (device->accessibility_virtual_device,
g_get_monotonic_time (),
device->ptr_a11y_data->dwell_x,
device->ptr_a11y_data->dwell_y);
}
static gboolean
trigger_secondary_click (gpointer data)
{
ClutterInputDevice *device = data;
device->ptr_a11y_data->secondary_click_triggered = TRUE;
device->ptr_a11y_data->secondary_click_timer = 0;
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
TRUE);
return G_SOURCE_REMOVE;
}
static void
start_secondary_click_timeout (ClutterInputDevice *device)
{
unsigned int delay = get_secondary_click_delay (device);
device->ptr_a11y_data->secondary_click_timer =
clutter_threads_add_timeout (delay, trigger_secondary_click, device);
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-started",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
delay);
}
static void
stop_secondary_click_timeout (ClutterInputDevice *device)
{
if (device->ptr_a11y_data->secondary_click_timer)
{
g_source_remove (device->ptr_a11y_data->secondary_click_timer);
device->ptr_a11y_data->secondary_click_timer = 0;
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_SECONDARY_CLICK,
FALSE);
}
device->ptr_a11y_data->secondary_click_triggered = FALSE;
}
static gboolean
pointer_has_moved (ClutterInputDevice *device)
{
float dx, dy;
gint threshold;
dx = device->ptr_a11y_data->dwell_x - device->ptr_a11y_data->current_x;
dy = device->ptr_a11y_data->dwell_y - device->ptr_a11y_data->current_y;
threshold = get_dwell_threshold (device);
/* Pythagorean theorem */
return ((dx * dx) + (dy * dy)) > (threshold * threshold);
}
static gboolean
is_secondary_click_pending (ClutterInputDevice *device)
{
return device->ptr_a11y_data->secondary_click_timer != 0;
}
static gboolean
is_secondary_click_triggered (ClutterInputDevice *device)
{
return device->ptr_a11y_data->secondary_click_triggered;
}
static gboolean
is_dwell_click_pending (ClutterInputDevice *device)
{
return device->ptr_a11y_data->dwell_timer != 0;
}
static gboolean
is_dwell_dragging (ClutterInputDevice *device)
{
return device->ptr_a11y_data->dwell_drag_started;
}
static gboolean
is_dwell_gesturing (ClutterInputDevice *device)
{
return device->ptr_a11y_data->dwell_gesture_started;
}
static gboolean
has_button_pressed (ClutterInputDevice *device)
{
return device->ptr_a11y_data->n_btn_pressed > 0;
}
static gboolean
should_start_secondary_click_timeout (ClutterInputDevice *device)
{
return !is_dwell_dragging (device);
}
static gboolean
should_start_dwell (ClutterInputDevice *device)
{
/* We should trigger a dwell if we've not already started one, and if
* no button is currently pressed or we are in the middle of a dwell
* drag action.
*/
return !is_dwell_click_pending (device) &&
(is_dwell_dragging (device) ||
!has_button_pressed (device));
}
static gboolean
should_stop_dwell (ClutterInputDevice *device)
{
/* We should stop a dwell if the motion exceeds the threshold, unless
* we've started a gesture, because we want to keep the original dwell
* location to both detect a gesture and restore the original pointer
* location once the gesture is finished.
*/
return pointer_has_moved (device) &&
!is_dwell_gesturing (device);
}
static gboolean
should_update_dwell_position (ClutterInputDevice *device)
{
return !is_dwell_gesturing (device) &&
!is_dwell_click_pending (device) &&
!is_secondary_click_pending (device);
}
static void
update_dwell_click_type (ClutterInputDevice *device)
{
ClutterPointerA11ySettings settings;
ClutterPointerA11yDwellClickType dwell_click_type;
clutter_device_manager_get_pointer_a11y_settings (device->device_manager, &settings);
dwell_click_type = settings.dwell_click_type;
switch (dwell_click_type)
{
case CLUTTER_A11Y_DWELL_CLICK_TYPE_DOUBLE:
case CLUTTER_A11Y_DWELL_CLICK_TYPE_SECONDARY:
case CLUTTER_A11Y_DWELL_CLICK_TYPE_MIDDLE:
dwell_click_type = CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY;
break;
case CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG:
if (!is_dwell_dragging (device))
dwell_click_type = CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY;
break;
case CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY:
case CLUTTER_A11Y_DWELL_CLICK_TYPE_NONE:
default:
break;
}
if (dwell_click_type != settings.dwell_click_type)
{
settings.dwell_click_type = dwell_click_type;
clutter_device_manager_set_pointer_a11y_settings (device->device_manager,
&settings);
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-dwell-click-type-changed",
dwell_click_type);
}
}
static void
emit_dwell_click (ClutterInputDevice *device,
ClutterPointerA11yDwellClickType dwell_click_type)
{
switch (dwell_click_type)
{
case CLUTTER_A11Y_DWELL_CLICK_TYPE_PRIMARY:
emit_button_click (device, CLUTTER_BUTTON_PRIMARY);
break;
case CLUTTER_A11Y_DWELL_CLICK_TYPE_DOUBLE:
emit_button_click (device, CLUTTER_BUTTON_PRIMARY);
emit_button_click (device, CLUTTER_BUTTON_PRIMARY);
break;
case CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG:
if (is_dwell_dragging (device))
{
emit_button_release (device, CLUTTER_BUTTON_PRIMARY);
device->ptr_a11y_data->dwell_drag_started = FALSE;
}
else
{
emit_button_press (device, CLUTTER_BUTTON_PRIMARY);
device->ptr_a11y_data->dwell_drag_started = TRUE;
}
break;
case CLUTTER_A11Y_DWELL_CLICK_TYPE_SECONDARY:
emit_button_click (device, CLUTTER_BUTTON_SECONDARY);
break;
case CLUTTER_A11Y_DWELL_CLICK_TYPE_MIDDLE:
emit_button_click (device, CLUTTER_BUTTON_MIDDLE);
break;
case CLUTTER_A11Y_DWELL_CLICK_TYPE_NONE:
default:
break;
}
}
static ClutterPointerA11yDwellDirection
get_dwell_direction (ClutterInputDevice *device)
{
float dx, dy;
dx = ABS (device->ptr_a11y_data->dwell_x - device->ptr_a11y_data->current_x);
dy = ABS (device->ptr_a11y_data->dwell_y - device->ptr_a11y_data->current_y);
/* The pointer hasn't moved */
if (!pointer_has_moved (device))
return CLUTTER_A11Y_DWELL_DIRECTION_NONE;
if (device->ptr_a11y_data->dwell_x < device->ptr_a11y_data->current_x)
{
if (dx > dy)
return CLUTTER_A11Y_DWELL_DIRECTION_LEFT;
}
else
{
if (dx > dy)
return CLUTTER_A11Y_DWELL_DIRECTION_RIGHT;
}
if (device->ptr_a11y_data->dwell_y < device->ptr_a11y_data->current_y)
return CLUTTER_A11Y_DWELL_DIRECTION_UP;
return CLUTTER_A11Y_DWELL_DIRECTION_DOWN;
}
static gboolean
trigger_clear_dwell_gesture (gpointer data)
{
ClutterInputDevice *device = data;
device->ptr_a11y_data->dwell_timer = 0;
device->ptr_a11y_data->dwell_gesture_started = FALSE;
return G_SOURCE_REMOVE;
}
static gboolean
trigger_dwell_gesture (gpointer data)
{
ClutterInputDevice *device = data;
ClutterPointerA11yDwellDirection direction;
unsigned int delay = get_dwell_delay (device);
restore_dwell_position (device);
direction = get_dwell_direction (device);
emit_dwell_click (device,
get_dwell_click_type_for_direction (device,
direction));
/* Do not clear the gesture right away, otherwise we'll start another one */
device->ptr_a11y_data->dwell_timer =
clutter_threads_add_timeout (delay, trigger_clear_dwell_gesture, device);
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE,
TRUE);
return G_SOURCE_REMOVE;
}
static void
start_dwell_gesture_timeout (ClutterInputDevice *device)
{
unsigned int delay = get_dwell_delay (device);
device->ptr_a11y_data->dwell_timer =
clutter_threads_add_timeout (delay, trigger_dwell_gesture, device);
device->ptr_a11y_data->dwell_gesture_started = TRUE;
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-started",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_GESTURE,
delay);
}
static gboolean
trigger_dwell_click (gpointer data)
{
ClutterInputDevice *device = data;
device->ptr_a11y_data->dwell_timer = 0;
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
TRUE);
if (get_dwell_mode (device) == CLUTTER_A11Y_DWELL_MODE_GESTURE)
{
if (is_dwell_dragging (device))
emit_dwell_click (device, CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG);
else
start_dwell_gesture_timeout (device);
}
else
{
emit_dwell_click (device, get_dwell_click_type (device));
update_dwell_click_type (device);
}
return G_SOURCE_REMOVE;
}
static void
start_dwell_timeout (ClutterInputDevice *device)
{
unsigned int delay = get_dwell_delay (device);
device->ptr_a11y_data->dwell_timer =
clutter_threads_add_timeout (delay, trigger_dwell_click, device);
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-started",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
delay);
}
static void
stop_dwell_timeout (ClutterInputDevice *device)
{
if (device->ptr_a11y_data->dwell_timer)
{
g_source_remove (device->ptr_a11y_data->dwell_timer);
device->ptr_a11y_data->dwell_timer = 0;
device->ptr_a11y_data->dwell_gesture_started = FALSE;
g_signal_emit_by_name (device->device_manager,
"ptr-a11y-timeout-stopped",
device,
CLUTTER_A11Y_TIMEOUT_TYPE_DWELL,
FALSE);
}
}
static gboolean
trigger_dwell_position_timeout (gpointer data)
{
ClutterInputDevice *device = data;
device->ptr_a11y_data->dwell_position_timer = 0;
if (is_dwell_click_enabled (device))
{
if (!pointer_has_moved (device))
start_dwell_timeout (device);
}
return G_SOURCE_REMOVE;
}
static void
start_dwell_position_timeout (ClutterInputDevice *device)
{
device->ptr_a11y_data->dwell_position_timer =
clutter_threads_add_timeout (100, trigger_dwell_position_timeout, device);
}
static void
stop_dwell_position_timeout (ClutterInputDevice *device)
{
g_clear_handle_id (&device->ptr_a11y_data->dwell_position_timer,
g_source_remove);
}
static void
update_dwell_position (ClutterInputDevice *device)
{
device->ptr_a11y_data->dwell_x = device->ptr_a11y_data->current_x;
device->ptr_a11y_data->dwell_y = device->ptr_a11y_data->current_y;
}
static void
update_current_position (ClutterInputDevice *device,
float x,
float y)
{
device->ptr_a11y_data->current_x = x;
device->ptr_a11y_data->current_y = y;
}
static gboolean
is_device_core_pointer (ClutterInputDevice *device)
{
ClutterInputDevice *core_pointer;
core_pointer = clutter_device_manager_get_core_device (device->device_manager,
CLUTTER_POINTER_DEVICE);
if (core_pointer == NULL)
return FALSE;
return (core_pointer == device);
}
void
_clutter_input_pointer_a11y_add_device (ClutterInputDevice *device)
{
if (!is_device_core_pointer (device))
return;
device->accessibility_virtual_device =
clutter_device_manager_create_virtual_device (device->device_manager,
CLUTTER_POINTER_DEVICE);
device->ptr_a11y_data = g_new0 (ClutterPtrA11yData, 1);
}
void
_clutter_input_pointer_a11y_remove_device (ClutterInputDevice *device)
{
if (!is_device_core_pointer (device))
return;
/* Terminate a drag if started */
if (is_dwell_dragging (device))
emit_dwell_click (device, CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG);
stop_dwell_position_timeout (device);
stop_dwell_timeout (device);
stop_secondary_click_timeout (device);
g_clear_pointer (&device->ptr_a11y_data, g_free);
}
void
_clutter_input_pointer_a11y_on_motion_event (ClutterInputDevice *device,
float x,
float y)
{
if (!is_device_core_pointer (device))
return;
if (!_clutter_is_input_pointer_a11y_enabled (device))
return;
update_current_position (device, x, y);
if (is_secondary_click_enabled (device))
{
if (pointer_has_moved (device))
stop_secondary_click_timeout (device);
}
if (is_dwell_click_enabled (device))
{
stop_dwell_position_timeout (device);
if (should_stop_dwell (device))
stop_dwell_timeout (device);
if (should_start_dwell (device))
start_dwell_position_timeout (device);
}
if (should_update_dwell_position (device))
update_dwell_position (device);
}
void
_clutter_input_pointer_a11y_on_button_event (ClutterInputDevice *device,
int button,
gboolean pressed)
{
if (!is_device_core_pointer (device))
return;
if (!_clutter_is_input_pointer_a11y_enabled (device))
return;
if (pressed)
{
device->ptr_a11y_data->n_btn_pressed++;
stop_dwell_position_timeout (device);
if (is_dwell_click_enabled (device))
stop_dwell_timeout (device);
if (is_dwell_dragging (device))
stop_dwell_timeout (device);
if (is_secondary_click_enabled (device))
{
if (button == CLUTTER_BUTTON_PRIMARY)
{
if (should_start_secondary_click_timeout (device))
start_secondary_click_timeout (device);
}
else if (is_secondary_click_pending (device))
{
stop_secondary_click_timeout (device);
}
}
}
else
{
if (has_button_pressed (device))
device->ptr_a11y_data->n_btn_pressed--;
if (is_secondary_click_triggered (device))
{
emit_button_click (device, CLUTTER_BUTTON_SECONDARY);
stop_secondary_click_timeout (device);
}
if (is_secondary_click_pending (device))
stop_secondary_click_timeout (device);
if (is_dwell_dragging (device))
emit_dwell_click (device, CLUTTER_A11Y_DWELL_CLICK_TYPE_DRAG);
}
}
gboolean
_clutter_is_input_pointer_a11y_enabled (ClutterInputDevice *device)
{
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
return (is_secondary_click_enabled (device) || is_dwell_click_enabled (device));
}

View File

@ -0,0 +1,64 @@
/*
* Copyright (C) 2018 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Author: Carlos Garnacho <carlosg@gnome.org>
*/
#include "clutter-build-config.h"
#include "clutter-keymap.h"
#include "clutter-private.h"
G_DEFINE_ABSTRACT_TYPE (ClutterKeymap, clutter_keymap, G_TYPE_OBJECT)
enum
{
STATE_CHANGED,
N_SIGNALS
};
static guint signals[N_SIGNALS] = { 0, };
static void
clutter_keymap_class_init (ClutterKeymapClass *klass)
{
signals[STATE_CHANGED] =
g_signal_new (I_("state-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
static void
clutter_keymap_init (ClutterKeymap *keymap)
{
}
gboolean
clutter_keymap_get_num_lock_state (ClutterKeymap *keymap)
{
return CLUTTER_KEYMAP_GET_CLASS (keymap)->get_num_lock_state (keymap);
}
gboolean
clutter_keymap_get_caps_lock_state (ClutterKeymap *keymap)
{
return CLUTTER_KEYMAP_GET_CLASS (keymap)->get_caps_lock_state (keymap);
}

View File

@ -0,0 +1,56 @@
/*
* Copyright (C) 2018 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Author: Carlos Garnacho <carlosg@gnome.org>
*/
#ifndef CLUTTER_KEYMAP_H
#define CLUTTER_KEYMAP_H
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <clutter/clutter-macros.h>
#include <glib-object.h>
typedef struct _ClutterKeymap ClutterKeymap;
typedef struct _ClutterKeymapClass ClutterKeymapClass;
struct _ClutterKeymapClass
{
GObjectClass parent_class;
gboolean (* get_num_lock_state) (ClutterKeymap *keymap);
gboolean (* get_caps_lock_state) (ClutterKeymap *keymap);
};
#define CLUTTER_TYPE_KEYMAP (clutter_keymap_get_type ())
CLUTTER_EXPORT
G_DECLARE_DERIVABLE_TYPE (ClutterKeymap, clutter_keymap,
CLUTTER, KEYMAP,
GObject)
CLUTTER_EXPORT
gboolean clutter_keymap_get_num_lock_state (ClutterKeymap *keymap);
CLUTTER_EXPORT
gboolean clutter_keymap_get_caps_lock_state (ClutterKeymap *keymap);
#endif /* CLUTTER_KEYMAP_H */

View File

@ -444,8 +444,7 @@ clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterLayoutManagerClass,
layout_changed),
NULL, NULL,
_clutter_marshal_VOID__VOID,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
}

File diff suppressed because it is too large Load Diff

View File

@ -53,7 +53,8 @@ G_BEGIN_DECLS
*
* Since: 0.2
*/
typedef enum {
typedef enum
{
CLUTTER_INIT_SUCCESS = 1,
CLUTTER_INIT_ERROR_UNKNOWN = 0,
CLUTTER_INIT_ERROR_THREADS = -1,
@ -116,9 +117,6 @@ void clutter_disable_accessibility (void);
/* Threading functions */
CLUTTER_EXPORT
void clutter_threads_set_lock_functions (GCallback enter_fn,
GCallback leave_fn);
CLUTTER_EXPORT
guint clutter_threads_add_idle (GSourceFunc func,
gpointer data);
CLUTTER_EXPORT
@ -148,19 +146,6 @@ guint clutter_threads_add_repaint_func_full (ClutterRepaintF
CLUTTER_EXPORT
void clutter_threads_remove_repaint_func (guint handle_id);
CLUTTER_EXPORT
void clutter_grab_pointer (ClutterActor *actor);
CLUTTER_EXPORT
void clutter_ungrab_pointer (void);
CLUTTER_EXPORT
ClutterActor * clutter_get_pointer_grab (void);
CLUTTER_EXPORT
void clutter_grab_keyboard (ClutterActor *actor);
CLUTTER_EXPORT
void clutter_ungrab_keyboard (void);
CLUTTER_EXPORT
ClutterActor * clutter_get_keyboard_grab (void);
CLUTTER_EXPORT
PangoFontMap * clutter_get_font_map (void);

View File

@ -1,6 +1,7 @@
BOOLEAN:BOXED
BOOLEAN:BOXED,INT,INT
BOOLEAN:OBJECT,BOOLEAN
BOOLEAN:OBJECT,BOXED
BOOLEAN:OBJECT,BOXED,DOUBLE
BOOLEAN:OBJECT,DOUBLE
BOOLEAN:OBJECT,ENUM
@ -11,29 +12,24 @@ BOOLEAN:OBJECT,FLOAT,FLOAT
BOXED:UINT,UINT
DOUBLE:VOID
UINT:VOID
VOID:BOOLEAN
VOID:BOXED
VOID:BOXED,FLAGS
VOID:INT
VOID:INT64,INT64,FLOAT,BOOLEAN
VOID:INT,INT
VOID:INT,POINTER
VOID:FLOAT,FLOAT
VOID:INT,INT,INT,INT
VOID:OBJECT
VOID:OBJECT,FLAGS
VOID:OBJECT,FLAGS,BOOLEAN
VOID:OBJECT,FLAGS,UINT
VOID:OBJECT,FLOAT,FLOAT
VOID:OBJECT,FLOAT,FLOAT,FLAGS
VOID:OBJECT,OBJECT
VOID:OBJECT,PARAM
VOID:OBJECT,POINTER
VOID:OBJECT,UINT
VOID:POINTER
VOID:STRING,BOOLEAN
VOID:STRING,BOOLEAN,BOOLEAN
VOID:STRING,INT
VOID:UINT
VOID:UINT,STRING,UINT
VOID:UINT,UINT
VOID:VOID
VOID:STRING,INT,POINTER

View File

@ -64,9 +64,6 @@ struct _ClutterMasterClockDefault
/* the current state of the clock, in usecs */
gint64 cur_tick;
/* the previous state of the clock, in usecs, used to compute the delta */
gint64 prev_tick;
#ifdef CLUTTER_ENABLE_DEBUG
gint64 frame_budget;
gint64 remaining_budget;
@ -77,12 +74,6 @@ struct _ClutterMasterClockDefault
*/
GSource *source;
/* If the master clock is idle that means it has
* fallen back to idle polling for timeline
* progressions and it may have been some time since
* the last real stage update.
*/
guint idle : 1;
guint ensure_next_iteration : 1;
guint paused : 1;
@ -109,7 +100,8 @@ static GSourceFuncs clock_funcs = {
NULL
};
static void clutter_master_clock_iface_init (ClutterMasterClockIface *iface);
static void
clutter_master_clock_iface_init (ClutterMasterClockInterface *iface);
#define clutter_master_clock_default_get_type _clutter_master_clock_default_get_type
@ -274,78 +266,12 @@ master_clock_reschedule_stage_updates (ClutterMasterClockDefault *master_clock,
static gint
master_clock_next_frame_delay (ClutterMasterClockDefault *master_clock)
{
gint64 now, next;
gint swap_delay;
if (!master_clock_is_running (master_clock))
return -1;
/* If all of the stages are busy waiting for a swap-buffers to complete
* then we wait for one to be ready.. */
swap_delay = master_clock_get_swap_wait_time (master_clock);
if (swap_delay != 0)
return swap_delay;
/* When we have sync-to-vblank, we count on swap-buffer requests (or
* swap-buffer-complete events if supported in the backend) to throttle our
* frame rate so no additional delay is needed to start the next frame.
*
* If the master-clock has become idle due to no timeline progression causing
* redraws then we can no longer rely on vblank synchronization because the
* last real stage update/redraw may have happened a long time ago and so we
* fallback to polling for timeline progressions every 1/frame_rate seconds.
*
* (NB: if there aren't even any timelines running then the master clock will
* be completely stopped in master_clock_is_running())
*/
if (clutter_feature_available (CLUTTER_FEATURE_SWAP_THROTTLE) &&
!master_clock->idle)
{
CLUTTER_NOTE (SCHEDULER, "swap throttling available and updated stages");
return 0;
}
if (master_clock->prev_tick == 0)
{
/* If we weren't previously running, then draw the next frame
* immediately
*/
CLUTTER_NOTE (SCHEDULER, "draw the first frame immediately");
return 0;
}
/* Otherwise, wait at least 1/frame_rate seconds since we last
* started a frame
*/
now = g_source_get_time (master_clock->source);
next = master_clock->prev_tick;
/* If time has gone backwards then there's no way of knowing how
long we should wait so let's just dispatch immediately */
if (now <= next)
{
CLUTTER_NOTE (SCHEDULER, "Time has gone backwards");
return 0;
}
next += (1000000L / clutter_get_default_frame_rate ());
if (next <= now)
{
CLUTTER_NOTE (SCHEDULER, "Less than %lu microsecs",
1000000L / (gulong) clutter_get_default_frame_rate ());
return 0;
}
else
{
CLUTTER_NOTE (SCHEDULER, "Waiting %" G_GINT64_FORMAT " msecs",
(next - now) / 1000);
return (next - now) / 1000;
}
return master_clock_get_swap_wait_time (master_clock);
}
static void
@ -411,8 +337,7 @@ master_clock_advance_timelines (ClutterMasterClockDefault *master_clock)
for (l = timelines; l != NULL; l = l->next)
_clutter_timeline_do_tick (l->data, master_clock->cur_tick / 1000);
g_slist_foreach (timelines, (GFunc) g_object_unref, NULL);
g_slist_free (timelines);
g_slist_free_full (timelines, g_object_unref);
#ifdef CLUTTER_ENABLE_DEBUG
if (_clutter_diagnostic_enabled ())
@ -530,7 +455,6 @@ clutter_clock_dispatch (GSource *source,
{
ClutterClockSource *clock_source = (ClutterClockSource *) source;
ClutterMasterClockDefault *master_clock = clock_source->master_clock;
gboolean stages_updated = FALSE;
GSList *stages;
CLUTTER_NOTE (SCHEDULER, "Master clock [tick]");
@ -550,8 +474,6 @@ clutter_clock_dispatch (GSource *source,
*/
stages = master_clock_list_ready_stages (master_clock);
master_clock->idle = FALSE;
/* Each frame is split into three separate phases: */
/* 1. process all the events; each stage goes through its events queue
@ -564,19 +486,11 @@ clutter_clock_dispatch (GSource *source,
master_clock_advance_timelines (master_clock);
/* 3. relayout and redraw the stages */
stages_updated = master_clock_update_stages (master_clock, stages);
/* The master clock goes idle if no stages were updated and falls back
* to polling for timeline progressions... */
if (!stages_updated)
master_clock->idle = TRUE;
master_clock_update_stages (master_clock, stages);
master_clock_reschedule_stage_updates (master_clock, stages);
g_slist_foreach (stages, (GFunc) g_object_unref, NULL);
g_slist_free (stages);
master_clock->prev_tick = master_clock->cur_tick;
g_slist_free_full (stages, g_object_unref);
_clutter_threads_release_lock ();
@ -609,7 +523,6 @@ clutter_master_clock_default_init (ClutterMasterClockDefault *self)
source = clutter_clock_source_new (self);
self->source = source;
self->idle = FALSE;
self->ensure_next_iteration = FALSE;
self->paused = FALSE;
@ -689,7 +602,7 @@ clutter_master_clock_default_set_paused (ClutterMasterClock *clock,
}
static void
clutter_master_clock_iface_init (ClutterMasterClockIface *iface)
clutter_master_clock_iface_init (ClutterMasterClockInterface *iface)
{
iface->add_timeline = clutter_master_clock_default_add_timeline;
iface->remove_timeline = clutter_master_clock_default_remove_timeline;

View File

@ -37,10 +37,6 @@
#include "clutter-master-clock-default.h"
#include "clutter-private.h"
#define clutter_master_clock_get_type _clutter_master_clock_get_type
typedef ClutterMasterClockIface ClutterMasterClockInterface;
G_DEFINE_INTERFACE (ClutterMasterClock, clutter_master_clock, G_TYPE_OBJECT)
static void

View File

@ -28,15 +28,12 @@
G_BEGIN_DECLS
#define CLUTTER_TYPE_MASTER_CLOCK (_clutter_master_clock_get_type ())
#define CLUTTER_MASTER_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_MASTER_CLOCK, ClutterMasterClock))
#define CLUTTER_IS_MASTER_CLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_MASTER_CLOCK))
#define CLUTTER_MASTER_CLOCK_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_MASTER_CLOCK, ClutterMasterClockIface))
#define CLUTTER_TYPE_MASTER_CLOCK (clutter_master_clock_get_type ())
G_DECLARE_INTERFACE (ClutterMasterClock, clutter_master_clock,
CLUTTER, MASTER_CLOCK,
GObject)
typedef struct _ClutterMasterClock ClutterMasterClock; /* dummy */
typedef struct _ClutterMasterClockIface ClutterMasterClockIface;
struct _ClutterMasterClockIface
struct _ClutterMasterClockInterface
{
/*< private >*/
GTypeInterface parent_iface;
@ -51,8 +48,6 @@ struct _ClutterMasterClockIface
gboolean paused);
};
GType _clutter_master_clock_get_type (void) G_GNUC_CONST;
ClutterMasterClock * _clutter_master_clock_get_default (void);
void _clutter_master_clock_add_timeline (ClutterMasterClock *master_clock,
ClutterTimeline *timeline);

View File

@ -26,10 +26,15 @@
#define __CLUTTER_H_INSIDE__
#include "clutter-backend.h"
#include "clutter-device-manager-private.h"
#include "clutter-event-private.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-macros.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-stage-view.h"
#include "cogl/clutter-stage-cogl.h"
#include "x11/clutter-stage-x11.h"
#include "clutter/x11/clutter-backend-x11.h"
CLUTTER_EXPORT
void clutter_set_custom_backend_func (ClutterBackend *(* func) (void));
@ -49,6 +54,12 @@ void clutter_stage_freeze_updates (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_thaw_updates (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_update_resource_scales (ClutterStage *stage);
CLUTTER_EXPORT
gboolean clutter_actor_has_damage (ClutterActor *actor);
#undef __CLUTTER_H_INSIDE__
#endif /* __CLUTTER_MUTTER_H__ */

View File

@ -66,12 +66,16 @@
#include "clutter-offscreen-effect.h"
#include <math.h>
#include "cogl/cogl.h"
#include "clutter-actor-private.h"
#include "clutter-debug.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-paint-volume-private.h"
#include "clutter-actor-box-private.h"
struct _ClutterOffscreenEffectPrivate
{
@ -82,27 +86,19 @@ struct _ClutterOffscreenEffectPrivate
ClutterActor *actor;
ClutterActor *stage;
gfloat x_offset;
gfloat y_offset;
ClutterVertex position;
int fbo_offset_x;
int fbo_offset_y;
/* This is the calculated size of the fbo before being passed
through create_texture(). This needs to be tracked separately so
that we can detect when a different size is calculated and
regenerate the fbo */
int fbo_width;
int fbo_height;
int target_width;
int target_height;
gint old_opacity_override;
/* The matrix that was current the last time the fbo was updated. We
need to keep track of this to detect when we can reuse the
contents of the fbo without redrawing the actor. We need the
actual matrix rather than just detecting queued redraws on the
actor because any change in the parent hierarchy (even just a
translation) could cause the actor to look completely different
and it won't cause a redraw to be queued on the parent's
children. */
CoglMatrix last_matrix_drawn;
};
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterOffscreenEffect,
@ -141,8 +137,35 @@ clutter_offscreen_effect_real_create_texture (ClutterOffscreenEffect *effect,
COGL_PIXEL_FORMAT_RGBA_8888_PRE);
}
static void
ensure_pipeline_filter_for_scale (ClutterOffscreenEffect *self,
float resource_scale)
{
CoglPipelineFilter filter;
if (!self->priv->target)
return;
/* If no fractional scaling is set, we're always going to render the texture
at a 1:1 texel:pixel ratio so, in such case we can use 'nearest' filtering
to decrease the effects of rounding errors in the geometry calculation;
if instead we we're using a global fractional scaling we need to make sure
that we're using the default linear effect, not to create artifacts when
scaling down the texture */
if (fmodf (resource_scale, 1.0f) == 0)
filter = COGL_PIPELINE_FILTER_NEAREST;
else
filter = COGL_PIPELINE_FILTER_LINEAR;
cogl_pipeline_set_layer_filters (self->priv->target, 0 /* layer_index */,
filter, filter);
}
static gboolean
update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height)
update_fbo (ClutterEffect *effect,
int target_width,
int target_height,
float resource_scale)
{
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
ClutterOffscreenEffectPrivate *priv = self->priv;
@ -157,10 +180,13 @@ update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height)
return FALSE;
}
if (priv->fbo_width == fbo_width &&
priv->fbo_height == fbo_height &&
if (priv->target_width == target_width &&
priv->target_height == target_height &&
priv->offscreen != NULL)
{
ensure_pipeline_filter_for_scale (self, resource_scale);
return TRUE;
}
if (priv->target == NULL)
{
@ -168,14 +194,7 @@ update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height)
clutter_backend_get_cogl_context (clutter_get_default_backend ());
priv->target = cogl_pipeline_new (ctx);
/* We're always going to render the texture at a 1:1 texel:pixel
ratio so we can use 'nearest' filtering to decrease the
effects of rounding errors in the geometry calculation */
cogl_pipeline_set_layer_filters (priv->target,
0, /* layer_index */
COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
ensure_pipeline_filter_for_scale (self, resource_scale);
}
if (priv->texture != NULL)
@ -191,14 +210,14 @@ update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height)
}
priv->texture =
clutter_offscreen_effect_create_texture (self, fbo_width, fbo_height);
clutter_offscreen_effect_create_texture (self, target_width, target_height);
if (priv->texture == NULL)
return FALSE;
cogl_pipeline_set_layer_texture (priv->target, 0, priv->texture);
priv->fbo_width = fbo_width;
priv->fbo_height = fbo_height;
priv->target_width = target_width;
priv->target_height = target_height;
priv->offscreen = cogl_offscreen_new_to_texture (priv->texture);
if (priv->offscreen == NULL)
@ -208,8 +227,8 @@ update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height)
cogl_handle_unref (priv->target);
priv->target = NULL;
priv->fbo_width = 0;
priv->fbo_height = 0;
priv->target_width = 0;
priv->target_height = 0;
return FALSE;
}
@ -222,15 +241,17 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
{
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
ClutterOffscreenEffectPrivate *priv = self->priv;
ClutterActorBox box;
ClutterActorBox raw_box, box;
ClutterActor *stage;
CoglMatrix projection;
CoglMatrix projection, old_modelview, modelview;
const ClutterPaintVolume *volume;
CoglColor transparent;
gfloat stage_width, stage_height;
gfloat fbo_width = -1, fbo_height = -1;
gfloat width, height;
gfloat xexpand, yexpand;
int texture_width, texture_height;
gfloat target_width = -1, target_height = -1;
gfloat resource_scale;
gfloat ceiled_resource_scale;
ClutterVertex local_offset = { 0.f, 0.f, 0.f };
gfloat old_viewport[4];
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (effect)))
return FALSE;
@ -241,92 +262,98 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
stage = _clutter_actor_get_stage_internal (priv->actor);
clutter_actor_get_size (stage, &stage_width, &stage_height);
/* The paint box is the bounding box of the actor's paint volume in
* stage coordinates. This will give us the size for the framebuffer
* we need to redirect its rendering offscreen and its position will
* be used to setup an offset viewport */
if (clutter_actor_get_paint_box (priv->actor, &box))
if (_clutter_actor_get_real_resource_scale (priv->actor, &resource_scale))
{
clutter_actor_box_get_size (&box, &fbo_width, &fbo_height);
clutter_actor_box_get_origin (&box, &priv->x_offset, &priv->y_offset);
fbo_width = MIN (fbo_width, stage_width);
fbo_height = MIN (fbo_height, stage_height);
ceiled_resource_scale = ceilf (resource_scale);
stage_width *= ceiled_resource_scale;
stage_height *= ceiled_resource_scale;
}
else
{
fbo_width = stage_width;
fbo_height = stage_height;
/* We are sure we have a resource scale set to a good value at paint */
g_assert_not_reached ();
}
if (fbo_width == stage_width)
priv->x_offset = 0.0f;
if (fbo_height == stage_height)
priv->y_offset = 0.0f;
/* Get the minimal bounding box for what we want to paint, relative to the
* parent of priv->actor. Note that we may actually be painting a clone of
* priv->actor so we need to be careful to avoid querying the transformation
* of priv->actor (like clutter_actor_get_paint_box would). Just stay in
* local coordinates for now...
*/
volume = clutter_actor_get_paint_volume (priv->actor);
if (volume)
{
ClutterPaintVolume mutable_volume;
_clutter_paint_volume_copy_static (volume, &mutable_volume);
_clutter_paint_volume_get_bounding_box (&mutable_volume, &raw_box);
clutter_paint_volume_free (&mutable_volume);
}
else
{
clutter_actor_get_allocation_box (priv->actor, &raw_box);
}
box = raw_box;
_clutter_actor_box_enlarge_for_effects (&box);
priv->fbo_offset_x = box.x1 - raw_box.x1;
priv->fbo_offset_y = box.y1 - raw_box.y1;
clutter_actor_box_scale (&box, ceiled_resource_scale);
clutter_actor_box_get_size (&box, &target_width, &target_height);
target_width = ceilf (target_width);
target_height = ceilf (target_height);
/* First assert that the framebuffer is the right size... */
if (!update_fbo (effect, fbo_width, fbo_height))
if (!update_fbo (effect, target_width, target_height, resource_scale))
return FALSE;
texture_width = cogl_texture_get_width (priv->texture);
texture_height = cogl_texture_get_height (priv->texture);
/* get the current modelview matrix so that we can copy it to the
* framebuffer. We also store the matrix that was last used when we
* updated the FBO so that we can detect when we don't need to
* update the FBO to paint a second time */
cogl_get_modelview_matrix (&priv->last_matrix_drawn);
cogl_get_modelview_matrix (&old_modelview);
/* let's draw offscreen */
cogl_push_framebuffer (priv->offscreen);
/* Copy the modelview that would have been used if rendering onscreen */
cogl_set_modelview_matrix (&priv->last_matrix_drawn);
/* Set up the viewport so that it has the same size as the stage,
* but offset it so that the actor of interest lands on our
* framebuffer. */
clutter_actor_get_size (priv->stage, &width, &height);
/* Expand the viewport if the actor is partially off-stage,
* otherwise the actor will end up clipped to the stage viewport
/* We don't want the FBO contents to be transformed. That could waste memory
* (e.g. during zoom), or result in something that's not rectangular (clipped
* incorrectly). So drop the modelview matrix of the current paint chain.
* This is fine since paint_texture runs with the same modelview matrix,
* so it will come out correctly whenever that is used to put the FBO
* contents on screen...
*/
xexpand = 0.f;
if (priv->x_offset < 0.f)
xexpand = -priv->x_offset;
if (priv->x_offset + texture_width > width)
xexpand = MAX (xexpand, (priv->x_offset + texture_width) - width);
clutter_actor_get_transform (priv->stage, &modelview);
cogl_set_modelview_matrix (&modelview);
yexpand = 0.f;
if (priv->y_offset < 0.f)
yexpand = -priv->y_offset;
if (priv->y_offset + texture_height > height)
yexpand = MAX (yexpand, (priv->y_offset + texture_height) - height);
/* Save the original viewport for calculating priv->position */
_clutter_stage_get_viewport (CLUTTER_STAGE (priv->stage),
&old_viewport[0],
&old_viewport[1],
&old_viewport[2],
&old_viewport[3]);
/* Set the viewport */
cogl_set_viewport (-(priv->x_offset + xexpand), -(priv->y_offset + yexpand),
width + (2 * xexpand), height + (2 * yexpand));
/* Set up the viewport so that it has the same size as the stage (avoid
* distortion), but translated to account for the FBO offset...
*/
cogl_set_viewport (-priv->fbo_offset_x,
-priv->fbo_offset_y,
stage_width,
stage_height);
/* Copy the stage's projection matrix across to the framebuffer */
_clutter_stage_get_projection_matrix (CLUTTER_STAGE (priv->stage),
&projection);
/* If we've expanded the viewport, make sure to scale the projection
* matrix accordingly (as it's been initialised to work with the
* original viewport and not our expanded one).
/* Now save the global position of the effect (not just of the actor).
* It doesn't appear anyone actually uses this yet, but get_target_rect is
* documented as returning it. So we should...
*/
if (xexpand > 0.f || yexpand > 0.f)
{
gfloat new_width, new_height;
new_width = width + (2 * xexpand);
new_height = height + (2 * yexpand);
cogl_matrix_scale (&projection,
width / new_width,
height / new_height,
1);
}
_clutter_util_fully_transform_vertices (&old_modelview,
&projection,
old_viewport,
&local_offset,
&priv->position,
1);
cogl_set_projection_matrix (&projection);
@ -382,16 +409,26 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect)
{
ClutterOffscreenEffectPrivate *priv = effect->priv;
CoglMatrix modelview;
float resource_scale;
cogl_push_matrix ();
/* Now reset the modelview to put us in stage coordinates so
* we can drawn the result of our offscreen render as a textured
* quad... */
/* The current modelview matrix is *almost* perfect already. It's only
* missing a correction for the expanded FBO and offset rendering within...
*/
cogl_get_modelview_matrix (&modelview);
cogl_matrix_init_identity (&modelview);
_clutter_actor_apply_modelview_transform (priv->stage, &modelview);
cogl_matrix_translate (&modelview, priv->x_offset, priv->y_offset, 0.0f);
if (clutter_actor_get_resource_scale (priv->actor, &resource_scale) &&
resource_scale != 1.0f)
{
float paint_scale = 1.0f / resource_scale;
cogl_matrix_scale (&modelview, paint_scale, paint_scale, 1);
}
cogl_matrix_translate (&modelview,
priv->fbo_offset_x,
priv->fbo_offset_y,
0.0f);
cogl_set_modelview_matrix (&modelview);
/* paint the target material; this is virtualized for
@ -428,16 +465,11 @@ clutter_offscreen_effect_paint (ClutterEffect *effect,
{
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
ClutterOffscreenEffectPrivate *priv = self->priv;
CoglMatrix matrix;
cogl_get_modelview_matrix (&matrix);
/* If we've already got a cached image for the same matrix and the
actor hasn't been redrawn then we can just use the cached image
in the fbo */
if (priv->offscreen == NULL ||
(flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY) ||
!cogl_matrix_equal (&matrix, &priv->last_matrix_drawn))
/* If we've already got a cached image and the actor hasn't been redrawn
* then we can just use the cached image in the FBO.
*/
if (priv->offscreen == NULL || (flags & CLUTTER_EFFECT_PAINT_ACTOR_DIRTY))
{
/* Chain up to the parent paint method which will call the pre and
post paint functions to update the image */
@ -663,8 +695,8 @@ clutter_offscreen_effect_get_target_rect (ClutterOffscreenEffect *effect,
return FALSE;
clutter_rect_init (rect,
priv->x_offset,
priv->y_offset,
priv->position.x,
priv->position.y,
cogl_texture_get_width (priv->texture),
cogl_texture_get_height (priv->texture));

View File

@ -74,9 +74,11 @@ struct _ClutterPaintNodeClass
#define PAINT_OP_INIT { PAINT_OP_INVALID }
typedef enum {
typedef enum
{
PAINT_OP_INVALID = 0,
PAINT_OP_TEX_RECT,
PAINT_OP_MULTITEX_RECT,
PAINT_OP_PATH,
PAINT_OP_PRIMITIVE
} PaintOpCode;
@ -85,6 +87,8 @@ struct _ClutterPaintOperation
{
PaintOpCode opcode;
GArray *multitex_coords;
union {
float texrect[8];
@ -94,7 +98,6 @@ struct _ClutterPaintOperation
} op;
};
GType _clutter_root_node_get_type (void) G_GNUC_CONST;
GType _clutter_transform_node_get_type (void) G_GNUC_CONST;
GType _clutter_dummy_node_get_type (void) G_GNUC_CONST;
@ -107,13 +110,9 @@ void _clutter_paint_operation_paint_primitive (const C
void _clutter_paint_node_init_types (void);
gpointer _clutter_paint_node_create (GType gtype);
ClutterPaintNode * _clutter_root_node_new (CoglFramebuffer *framebuffer,
const ClutterColor *clear_color,
CoglBufferBit clear_flags);
ClutterPaintNode * _clutter_transform_node_new (const CoglMatrix *matrix);
ClutterPaintNode * _clutter_dummy_node_new (ClutterActor *actor);
void _clutter_paint_node_paint (ClutterPaintNode *root);
void _clutter_paint_node_dump_tree (ClutterPaintNode *root);
G_GNUC_INTERNAL
@ -139,8 +138,6 @@ G_GNUC_INTERNAL
ClutterPaintNode * clutter_paint_node_get_last_child (ClutterPaintNode *node);
G_GNUC_INTERNAL
ClutterPaintNode * clutter_paint_node_get_parent (ClutterPaintNode *node);
G_GNUC_INTERNAL
CoglFramebuffer * clutter_paint_node_get_framebuffer (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))

View File

@ -761,6 +761,11 @@ clutter_paint_operation_clear (ClutterPaintOperation *op)
case PAINT_OP_TEX_RECT:
break;
case PAINT_OP_MULTITEX_RECT:
if (op->multitex_coords != NULL)
g_array_unref (op->multitex_coords);
break;
case PAINT_OP_PATH:
if (op->op.path != NULL)
cogl_object_unref (op->op.path);
@ -794,6 +799,27 @@ clutter_paint_op_init_tex_rect (ClutterPaintOperation *op,
op->op.texrect[7] = y_2;
}
static inline void
clutter_paint_op_init_multitex_rect (ClutterPaintOperation *op,
const ClutterActorBox *rect,
const float *tex_coords,
unsigned int tex_coords_len)
{
clutter_paint_operation_clear (op);
op->opcode = PAINT_OP_MULTITEX_RECT;
op->multitex_coords = g_array_sized_new (FALSE, FALSE,
sizeof (float),
tex_coords_len);
g_array_append_vals (op->multitex_coords, tex_coords, tex_coords_len);
op->op.texrect[0] = rect->x1;
op->op.texrect[1] = rect->y1;
op->op.texrect[2] = rect->x2;
op->op.texrect[3] = rect->y2;
}
static inline void
clutter_paint_op_init_path (ClutterPaintOperation *op,
CoglPath *path)
@ -881,6 +907,33 @@ clutter_paint_node_add_texture_rectangle (ClutterPaintNode *node,
g_array_append_val (node->operations, operation);
}
/**
* clutter_paint_node_add_multitexture_rectangle:
* @node: a #ClutterPaintNode
* @rect: a #ClutterActorBox
* @text_coords: array of multitexture values
* @text_coords_len: number of items of @text_coords
*
* Adds a rectangle region to the @node, with multitexture coordinates.
*/
void
clutter_paint_node_add_multitexture_rectangle (ClutterPaintNode *node,
const ClutterActorBox *rect,
const float *text_coords,
unsigned int text_coords_len)
{
ClutterPaintOperation operation = PAINT_OP_INIT;
g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
g_return_if_fail (rect != NULL);
clutter_paint_node_maybe_init_operations (node);
clutter_paint_op_init_multitex_rect (&operation, rect, text_coords, text_coords_len);
g_array_append_val (node->operations, operation);
}
/**
* clutter_paint_node_add_path: (skip)
* @node: a #ClutterPaintNode
@ -936,15 +989,15 @@ clutter_paint_node_add_primitive (ClutterPaintNode *node,
g_array_append_val (node->operations, operation);
}
/*< private >
* _clutter_paint_node_paint:
/**
* clutter_paint_node_paint:
* @node: a #ClutterPaintNode
*
* Paints the @node using the class implementation, traversing
* its children, if any.
*/
void
_clutter_paint_node_paint (ClutterPaintNode *node)
clutter_paint_node_paint (ClutterPaintNode *node)
{
ClutterPaintNodeClass *klass = CLUTTER_PAINT_NODE_GET_CLASS (node);
ClutterPaintNode *iter;
@ -961,7 +1014,7 @@ _clutter_paint_node_paint (ClutterPaintNode *node)
iter != NULL;
iter = iter->next_sibling)
{
_clutter_paint_node_paint (iter);
clutter_paint_node_paint (iter);
}
if (res)
@ -1006,7 +1059,7 @@ clutter_paint_node_to_json (ClutterPaintNode *node)
if (node->operations != NULL)
{
guint i;
guint i, j;
for (i = 0; i < node->operations->len; i++)
{
@ -1031,14 +1084,27 @@ clutter_paint_node_to_json (ClutterPaintNode *node)
json_builder_end_array (builder);
break;
case PAINT_OP_MULTITEX_RECT:
json_builder_set_member_name (builder, "texrect");
json_builder_begin_array (builder);
for (j = 0; i < op->multitex_coords->len; j++)
{
float coord = g_array_index (op->multitex_coords, float, j);
json_builder_add_double_value (builder, coord);
}
json_builder_end_array (builder);
break;
case PAINT_OP_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;
case PAINT_OP_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;
case PAINT_OP_INVALID:
@ -1128,6 +1194,15 @@ clutter_paint_node_get_root (ClutterPaintNode *node)
return iter;
}
/**
* clutter_paint_node_get_framebuffer:
* @node: a #ClutterPaintNode
*
* Retrieves the #CoglFramebuffer that @node will draw
* into.
*
* Returns: (transfer none): a #CoglFramebuffer
*/
CoglFramebuffer *
clutter_paint_node_get_framebuffer (ClutterPaintNode *node)
{

View File

@ -49,10 +49,16 @@ ClutterPaintNode * clutter_paint_node_ref (Clutter
CLUTTER_EXPORT
void clutter_paint_node_unref (ClutterPaintNode *node);
CLUTTER_EXPORT
void clutter_paint_node_paint (ClutterPaintNode *node);
CLUTTER_EXPORT
void clutter_paint_node_set_name (ClutterPaintNode *node,
const char *name);
CLUTTER_EXPORT
CoglFramebuffer * clutter_paint_node_get_framebuffer (ClutterPaintNode *node);
CLUTTER_EXPORT
void clutter_paint_node_add_child (ClutterPaintNode *node,
ClutterPaintNode *child);
@ -67,6 +73,12 @@ void clutter_paint_node_add_texture_rectangle (Clutter
float x_2,
float y_2);
CLUTTER_EXPORT
void clutter_paint_node_add_multitexture_rectangle (ClutterPaintNode *node,
const ClutterActorBox *rect,
const float *text_coords,
unsigned int text_coords_len);
CLUTTER_EXPORT
void clutter_paint_node_add_path (ClutterPaintNode *node,
CoglPath *path);

View File

@ -75,24 +75,20 @@ _clutter_paint_node_init_types (void)
cogl_pipeline_set_color (default_color_pipeline, &cogl_color);
default_texture_pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_layer_null_texture (default_texture_pipeline, 0,
COGL_TEXTURE_TYPE_2D);
cogl_pipeline_set_layer_null_texture (default_texture_pipeline, 0);
cogl_pipeline_set_color (default_texture_pipeline, &cogl_color);
cogl_pipeline_set_layer_wrap_mode (default_texture_pipeline, 0,
COGL_PIPELINE_WRAP_MODE_AUTOMATIC);
}
/*
* Root node, private
* Root node
*
* any frame can only have a since RootNode instance for each
* top-level actor.
*/
#define clutter_root_node_get_type _clutter_root_node_get_type
typedef struct _ClutterRootNode ClutterRootNode;
typedef struct _ClutterPaintNodeClass ClutterRootNodeClass;
#define clutter_root_node_get_type clutter_root_node_get_type
struct _ClutterRootNode
{
@ -111,6 +107,8 @@ clutter_root_node_pre_draw (ClutterPaintNode *node)
{
ClutterRootNode *rnode = (ClutterRootNode *) node;
cogl_push_framebuffer (rnode->framebuffer);
cogl_framebuffer_clear (rnode->framebuffer,
rnode->clear_flags,
&rnode->clear_color);
@ -121,6 +119,7 @@ clutter_root_node_pre_draw (ClutterPaintNode *node)
static void
clutter_root_node_post_draw (ClutterPaintNode *node)
{
cogl_pop_framebuffer ();
}
static void
@ -158,13 +157,13 @@ clutter_root_node_init (ClutterRootNode *self)
}
ClutterPaintNode *
_clutter_root_node_new (CoglFramebuffer *framebuffer,
const ClutterColor *clear_color,
CoglBufferBit clear_flags)
clutter_root_node_new (CoglFramebuffer *framebuffer,
const ClutterColor *clear_color,
CoglBufferBit clear_flags)
{
ClutterRootNode *res;
res = _clutter_paint_node_create (_clutter_root_node_get_type ());
res = _clutter_paint_node_create (CLUTTER_TYPE_ROOT_NODE);
cogl_color_init_from_4ub (&res->clear_color,
clear_color->red,
@ -431,6 +430,17 @@ clutter_pipeline_node_draw (ClutterPaintNode *node)
op->op.texrect[7]);
break;
case PAINT_OP_MULTITEX_RECT:
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
pnode->pipeline,
op->op.texrect[0],
op->op.texrect[1],
op->op.texrect[2],
op->op.texrect[3],
(float*) op->multitex_coords->data,
op->multitex_coords->len);
break;
case PAINT_OP_PATH:
cogl_path_fill (op->op.path);
break;
@ -827,6 +837,7 @@ clutter_text_node_draw (ClutterPaintNode *node)
cogl_framebuffer_pop_clip (fb);
break;
case PAINT_OP_MULTITEX_RECT:
case PAINT_OP_PATH:
case PAINT_OP_PRIMITIVE:
case PAINT_OP_INVALID:
@ -992,6 +1003,7 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node)
retval = TRUE;
break;
case PAINT_OP_MULTITEX_RECT:
case PAINT_OP_PRIMITIVE:
case PAINT_OP_INVALID:
break;
@ -1025,6 +1037,7 @@ clutter_clip_node_post_draw (ClutterPaintNode *node)
cogl_framebuffer_pop_clip (fb);
break;
case PAINT_OP_MULTITEX_RECT:
case PAINT_OP_PRIMITIVE:
case PAINT_OP_INVALID:
break;
@ -1180,6 +1193,17 @@ clutter_layer_node_post_draw (ClutterPaintNode *node)
cogl_pop_source ();
break;
case PAINT_OP_MULTITEX_RECT:
cogl_framebuffer_draw_multitextured_rectangle (cogl_get_draw_framebuffer (),
lnode->state,
op->op.texrect[0],
op->op.texrect[1],
op->op.texrect[2],
op->op.texrect[3],
(float*) op->multitex_coords->data,
op->multitex_coords->len);
break;
case PAINT_OP_PATH:
cogl_push_source (lnode->state);
cogl_path_fill (op->op.path);

View File

@ -143,6 +143,26 @@ CLUTTER_EXPORT
ClutterPaintNode * clutter_text_node_new (PangoLayout *layout,
const ClutterColor *color);
#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_IS_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ROOT_NODE))
/**
* ClutterRootNode:
*
* The #ClutterRootNode structure is an opaque
* type whose members cannot be directly accessed.
*/
typedef struct _ClutterRootNode ClutterRootNode;
typedef struct _ClutterPaintNodeClass ClutterRootNodeClass;
CLUTTER_EXPORT
GType clutter_root_node_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterPaintNode * clutter_root_node_new (CoglFramebuffer *framebuffer,
const ClutterColor *clear_color,
CoglBufferBit clear_flags);
G_END_DECLS
#endif /* __CLUTTER_PAINT_NODES_H__ */

View File

@ -35,6 +35,7 @@
#include "clutter-paint-volume-private.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-actor-box-private.h"
G_DEFINE_BOXED_TYPE (ClutterPaintVolume, clutter_paint_volume,
clutter_paint_volume_copy,
@ -1138,8 +1139,6 @@ _clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv,
CoglMatrix modelview;
CoglMatrix projection;
float viewport[4];
float width;
float height;
_clutter_paint_volume_copy_static (pv, &projected_pv);
@ -1179,50 +1178,7 @@ _clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv,
return;
}
/* The aim here is that for a given rectangle defined with floating point
* coordinates we want to determine a stable quantized size in pixels
* that doesn't vary due to the original box's sub-pixel position.
*
* The reason this is important is because effects will use this
* API to determine the size of offscreen framebuffers and so for
* a fixed-size object that may be animated accross the screen we
* want to make sure that the stage paint-box has an equally stable
* size so that effects aren't made to continuously re-allocate
* a corresponding fbo.
*
* The other thing we consider is that the calculation of this box is
* subject to floating point precision issues that might be slightly
* different to the precision issues involved with actually painting the
* actor, which might result in painting slightly leaking outside the
* user's calculated paint-volume. For this we simply aim to pad out the
* paint-volume by at least half a pixel all the way around.
*/
width = box->x2 - box->x1;
height = box->y2 - box->y1;
width = CLUTTER_NEARBYINT (width);
height = CLUTTER_NEARBYINT (height);
/* XXX: NB the width/height may now be up to 0.5px too small so we
* must also pad by 0.25px all around to account for this. In total we
* must padd by at least 0.75px around all sides. */
/* XXX: The furthest that we can overshoot the bottom right corner by
* here is 1.75px in total if you consider that the 0.75 padding could
* just cross an integer boundary and so ceil will effectively add 1.
*/
box->x2 = ceilf (box->x2 + 0.75);
box->y2 = ceilf (box->y2 + 0.75);
/* Now we redefine the top-left relative to the bottom right based on the
* rounded width/height determined above + a constant so that the overall
* size of the box will be stable and not dependant on the box's
* position.
*
* Adding 3px to the width/height will ensure we cover the maximum of
* 1.75px padding on the bottom/right and still ensure we have > 0.75px
* padding on the top/left.
*/
box->x1 = box->x2 - width - 3;
box->y1 = box->y2 - height - 3;
_clutter_actor_box_enlarge_for_effects (box);
clutter_paint_volume_free (&projected_pv);
}

View File

@ -579,8 +579,7 @@ clutter_pan_action_class_init (ClutterPanActionClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterPanActionClass, pan_stopped),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
}
@ -961,6 +960,7 @@ clutter_pan_action_get_motion_delta (ClutterPanAction *self,
return clutter_pan_action_get_interpolated_delta (self, delta_x, delta_y);
default:
g_assert_not_reached ();
return 0.0f;
}
}

View File

@ -295,8 +295,7 @@ clutter_path_clear (ClutterPath *path)
{
ClutterPathPrivate *priv = path->priv;
g_slist_foreach (priv->nodes, (GFunc) clutter_path_node_full_free, NULL);
g_slist_free (priv->nodes);
g_slist_free_full (priv->nodes, (GDestroyNotify) clutter_path_node_full_free);
priv->nodes = priv->nodes_tail = NULL;
priv->nodes_dirty = TRUE;
@ -659,8 +658,7 @@ clutter_path_parse_description (const gchar *p,
return TRUE;
fail:
g_slist_foreach (nodes, (GFunc) clutter_path_node_full_free, NULL);
g_slist_free (nodes);
g_slist_free_full (nodes, (GDestroyNotify) clutter_path_node_full_free);
return FALSE;
}

View File

@ -69,6 +69,9 @@ typedef struct _ClutterVertex4 ClutterVertex4;
#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_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_HEIGHT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PREF_HEIGHT) != FALSE)
#define CLUTTER_ACTOR_IN_PREF_SIZE(a) ((CLUTTER_PRIVATE_FLAGS (a) & (CLUTTER_IN_PREF_HEIGHT|CLUTTER_IN_PREF_WIDTH)) != FALSE)
#define CLUTTER_PARAM_READABLE (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
#define CLUTTER_PARAM_WRITABLE (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)
@ -82,7 +85,6 @@ typedef struct _ClutterVertex4 ClutterVertex4;
/* keep this for source compatibility with clutter */
#define P_(String) (String)
#define N_(String) (String)
#define _(String) (String)
/* This is a replacement for the nearbyint function which always rounds to the
* nearest integer. nearbyint is apparently a C99 function so it might not
@ -91,21 +93,24 @@ typedef struct _ClutterVertex4 ClutterVertex4;
* because it will break for negative numbers. */
#define CLUTTER_NEARBYINT(x) ((int) ((x) < 0.0f ? (x) - 0.5f : (x) + 0.5f))
typedef enum {
typedef enum
{
CLUTTER_ACTOR_UNUSED_FLAG = 0,
CLUTTER_IN_DESTRUCTION = 1 << 0,
CLUTTER_IS_TOPLEVEL = 1 << 1,
CLUTTER_IN_REPARENT = 1 << 2,
CLUTTER_IN_PREF_WIDTH = 1 << 3,
CLUTTER_IN_PREF_HEIGHT = 1 << 4,
/* Used to avoid recursion */
CLUTTER_IN_PAINT = 1 << 3,
CLUTTER_IN_PAINT = 1 << 5,
/* Used to avoid recursion */
CLUTTER_IN_RELAYOUT = 1 << 4,
CLUTTER_IN_RELAYOUT = 1 << 6,
/* a flag for internal children of Containers (DEPRECATED) */
CLUTTER_INTERNAL_CHILD = 1 << 5
CLUTTER_INTERNAL_CHILD = 1 << 7
} ClutterPrivateFlags;
/*
@ -136,13 +141,6 @@ struct _ClutterMainContext
/* default FPS; this is only used if we cannot sync to vblank */
guint frame_rate;
/* actors with a grab on all devices */
ClutterActor *pointer_grab_actor;
ClutterActor *keyboard_grab_actor;
/* stack of actors with shaders during paint */
GSList *shaders;
/* fb bit masks for col<->id mapping in picking */
gint fb_r_mask;
gint fb_g_mask;
@ -167,7 +165,6 @@ struct _ClutterMainContext
/* boolean flags */
guint is_initialized : 1;
guint motion_events_per_actor : 1;
guint defer_display_setup : 1;
guint options_parsed : 1;
guint show_fps : 1;
@ -184,7 +181,9 @@ typedef struct
gboolean _clutter_threads_dispatch (gpointer data);
void _clutter_threads_dispatch_free (gpointer data);
CLUTTER_EXPORT
void _clutter_threads_acquire_lock (void);
CLUTTER_EXPORT
void _clutter_threads_release_lock (void);
ClutterMainContext * _clutter_context_get_default (void);
@ -192,23 +191,15 @@ void _clutter_context_lock (void);
void _clutter_context_unlock (void);
gboolean _clutter_context_is_initialized (void);
ClutterPickMode _clutter_context_get_pick_mode (void);
void _clutter_context_push_shader_stack (ClutterActor *actor);
ClutterActor * _clutter_context_pop_shader_stack (ClutterActor *actor);
ClutterActor * _clutter_context_peek_shader_stack (void);
gboolean _clutter_context_get_motion_events_enabled (void);
gboolean _clutter_context_get_show_fps (void);
gboolean _clutter_feature_init (GError **error);
/* Diagnostic mode */
gboolean _clutter_diagnostic_enabled (void);
void _clutter_diagnostic_message (const char *fmt, ...);
/* Picking code */
guint _clutter_pixel_to_id (guchar pixel[4]);
void _clutter_id_to_color (guint id,
ClutterColor *col);
void _clutter_diagnostic_message (const char *fmt, ...) G_GNUC_PRINTF (1, 2);
CLUTTER_EXPORT
void _clutter_set_sync_to_vblank (gboolean sync_to_vblank);
/* use this function as the accumulator if you have a signal with
@ -240,6 +231,17 @@ void _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,
ClutterVertex *vertices_out,
int n_vertices);
void _clutter_util_rect_from_rectangle (const cairo_rectangle_int_t *src,
ClutterRect *dest);
void _clutter_util_rectangle_int_extents (const ClutterRect *src,
cairo_rectangle_int_t *dest);
void _clutter_util_rectangle_offset (const cairo_rectangle_int_t *src,
int x,
int y,
cairo_rectangle_int_t *dest);
void _clutter_util_rectangle_union (const cairo_rectangle_int_t *src1,
const cairo_rectangle_int_t *src2,
cairo_rectangle_int_t *dest);
@ -286,6 +288,12 @@ gboolean _clutter_util_matrix_decompose (const ClutterMatrix *src,
ClutterVertex *translate_p,
ClutterVertex4 *perspective_p);
CLUTTER_EXPORT
PangoDirection _clutter_pango_unichar_direction (gunichar ch);
PangoDirection _clutter_pango_find_base_dir (const gchar *text,
gint length);
typedef struct _ClutterPlane
{
float v0[3];
@ -307,6 +315,8 @@ gboolean _clutter_run_progress_function (GType gtype,
gdouble progress,
GValue *retval);
void clutter_timeline_cancel_delay (ClutterTimeline *timeline);
G_END_DECLS
#endif /* __CLUTTER_PRIVATE_H__ */

View File

@ -1636,14 +1636,17 @@ clutter_script_translate_parameters (ClutterScript *script,
GObject *object,
const gchar *name,
GList *properties,
GArray **params)
GPtrArray **param_names,
GArray **param_values)
{
ClutterScriptable *scriptable = NULL;
ClutterScriptableIface *iface = NULL;
GList *l, *unparsed;
gboolean parse_custom = FALSE;
*params = g_array_new (FALSE, FALSE, sizeof (GParameter));
*param_names = g_ptr_array_new_with_free_func (g_free);
*param_values = g_array_new (FALSE, FALSE, sizeof (GValue));
g_array_set_clear_func (*param_values, (GDestroyNotify) g_value_unset);
if (CLUTTER_IS_SCRIPTABLE (object))
{
@ -1659,7 +1662,7 @@ clutter_script_translate_parameters (ClutterScript *script,
for (l = properties; l != NULL; l = l->next)
{
PropertyInfo *pinfo = l->data;
GParameter param = { NULL };
GValue value = G_VALUE_INIT;
gboolean res = FALSE;
if (pinfo->is_child || pinfo->is_layout)
@ -1676,12 +1679,12 @@ clutter_script_translate_parameters (ClutterScript *script,
pinfo->name);
if (parse_custom)
res = iface->parse_custom_node (scriptable, script, &param.value,
res = iface->parse_custom_node (scriptable, script, &value,
pinfo->name,
pinfo->node);
if (!res)
res = _clutter_script_parse_node (script, &param.value,
res = _clutter_script_parse_node (script, &value,
pinfo->name,
pinfo->node,
pinfo->pspec);
@ -1693,9 +1696,8 @@ clutter_script_translate_parameters (ClutterScript *script,
continue;
}
param.name = g_strdup (pinfo->name);
g_array_append_val (*params, param);
g_ptr_array_add (*param_names, g_strdup (pinfo->name));
g_array_append_val (*param_values, value);
property_info_free (pinfo);
}
@ -1710,7 +1712,8 @@ clutter_script_construct_parameters (ClutterScript *script,
GType gtype,
const gchar *name,
GList *properties,
GArray **construct_params)
GPtrArray **construct_param_names,
GArray **construct_param_values)
{
GObjectClass *klass;
GList *l, *unparsed;
@ -1718,14 +1721,17 @@ clutter_script_construct_parameters (ClutterScript *script,
klass = g_type_class_ref (gtype);
g_assert (klass != NULL);
*construct_params = g_array_new (FALSE, FALSE, sizeof (GParameter));
*construct_param_names = g_ptr_array_new_with_free_func (g_free);
*construct_param_values = g_array_new (FALSE, FALSE, sizeof (GValue));
g_array_set_clear_func (*construct_param_values,
(GDestroyNotify) g_value_unset);
unparsed = NULL;
for (l = properties; l != NULL; l = l->next)
{
PropertyInfo *pinfo = l->data;
GParameter param = { NULL };
GValue value = G_VALUE_INIT;
GParamSpec *pspec = NULL;
/* we allow custom property names for classes, so if we
@ -1749,9 +1755,7 @@ clutter_script_construct_parameters (ClutterScript *script,
continue;
}
param.name = g_strdup (pinfo->name);
if (!_clutter_script_parse_node (script, &param.value,
if (!_clutter_script_parse_node (script, &value,
pinfo->name,
pinfo->node,
pinfo->pspec))
@ -1760,7 +1764,8 @@ clutter_script_construct_parameters (ClutterScript *script,
continue;
}
g_array_append_val (*construct_params, param);
g_ptr_array_add (*construct_param_names, g_strdup (pinfo->name));
g_array_append_val (*construct_param_values, value);
property_info_free (pinfo);
}
@ -2021,8 +2026,7 @@ add_children (ClutterScript *script,
clutter_container_add_actor (container, CLUTTER_ACTOR (object));
}
g_list_foreach (oinfo->children, (GFunc) g_free, NULL);
g_list_free (oinfo->children);
g_list_free_full (oinfo->children, g_free);
oinfo->children = unresolved;
}
@ -2088,7 +2092,8 @@ _clutter_script_apply_properties (ClutterScript *script,
gboolean set_custom_property = FALSE;
GObject *object = oinfo->object;
GList *properties;
GArray *params;
g_autoptr (GPtrArray) param_names = NULL;
g_autoptr (GArray) param_values = NULL;
guint i;
if (!oinfo->has_unresolved)
@ -2112,34 +2117,31 @@ _clutter_script_apply_properties (ClutterScript *script,
object,
oinfo->id,
properties,
&params);
&param_names,
&param_values);
/* consume all the properties we could translate in this pass */
for (i = 0; i < params->len; i++)
for (i = 0; i < param_names->len; i++)
{
GParameter *param = &g_array_index (params, GParameter, i);
char *name = g_ptr_array_index (param_names, i);
GValue *value = &g_array_index (param_values, GValue, i);
CLUTTER_NOTE (SCRIPT,
"Setting %s property '%s' (type:%s) to object '%s' (id:%s)",
set_custom_property ? "custom" : "regular",
param->name,
g_type_name (G_VALUE_TYPE (&param->value)),
name,
g_type_name (G_VALUE_TYPE (value)),
g_type_name (oinfo->gtype),
oinfo->id);
if (set_custom_property)
iface->set_custom_property (scriptable, script,
param->name,
&param->value);
name,
value);
else
g_object_set_property (object, param->name, &param->value);
g_free ((gchar *) param->name);
g_value_unset (&param->value);
g_object_set_property (object, name, value);
}
g_array_free (params, TRUE);
_clutter_script_check_unresolved (script, oinfo);
}
@ -2147,8 +2149,8 @@ void
_clutter_script_construct_object (ClutterScript *script,
ObjectInfo *oinfo)
{
GArray *params = NULL;
guint i;
g_autoptr (GPtrArray) param_names = NULL;
g_autoptr (GArray) param_values = NULL;
/* we have completely updated the object */
if (oinfo->object != NULL)
@ -2191,25 +2193,14 @@ _clutter_script_construct_object (ClutterScript *script,
oinfo->gtype,
oinfo->id,
properties,
&params);
&param_names,
&param_values);
default_stage = clutter_stage_manager_get_default_stage (manager);
oinfo->object = G_OBJECT (default_stage);
for (i = 0; i < params->len; i++)
{
GParameter *param = &g_array_index (params, GParameter, i);
g_free ((gchar *) param->name);
g_value_unset (&param->value);
}
g_array_free (params, TRUE);
}
else
{
g_autoptr (GPtrArray) param_names = NULL;
GArray *param_values;
GList *properties = oinfo->properties;
/* every other object: first, we get the construction parameters */
@ -2218,22 +2209,11 @@ _clutter_script_construct_object (ClutterScript *script,
oinfo->gtype,
oinfo->id,
properties,
&params);
/* Convert GParameter → (GStrv, GValue[]) */
param_names = g_ptr_array_sized_new (params->len);
param_values = g_array_sized_new (TRUE, FALSE, sizeof (GValue), params->len);
for (i = 0; i < params->len; i++)
{
GParameter *param = &g_array_index (params, GParameter, i);
g_ptr_array_add (param_names, (gchar *) param->name);
g_array_append_val (param_values, param->value);
}
g_ptr_array_add (param_names, NULL);
&param_names,
&param_values);
oinfo->object = g_object_new_with_properties (oinfo->gtype,
params->len,
param_names->len,
(const gchar **) param_names->pdata,
(const GValue *) param_values->data);
@ -2242,17 +2222,6 @@ _clutter_script_construct_object (ClutterScript *script,
* else too or only by this ClutterScript object.
*/
g_object_ref_sink (oinfo->object);
for (i = 0; i < params->len; i++)
{
GParameter *param = &g_array_index (params, GParameter, i);
g_free ((gchar *) param->name);
g_value_unset (&param->value);
}
g_array_free (param_values, FALSE);
g_array_free (params, TRUE);
}
g_assert (oinfo->object != NULL);

View File

@ -263,8 +263,6 @@ enum
static GParamSpec *obj_props[PROP_LAST];
#define CLUTTER_SCRIPT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_SCRIPT, ClutterScriptPrivate))
struct _ClutterScriptPrivate
{
GHashTable *objects;
@ -346,15 +344,12 @@ object_info_free (gpointer data)
g_free (oinfo->class_name);
g_free (oinfo->type_func);
g_list_foreach (oinfo->properties, (GFunc) property_info_free, NULL);
g_list_free (oinfo->properties);
g_list_free_full (oinfo->properties, property_info_free);
g_list_foreach (oinfo->signals, (GFunc) signal_info_free, NULL);
g_list_free (oinfo->signals);
g_list_free_full (oinfo->signals, signal_info_free);
/* these are ids */
g_list_foreach (oinfo->children, (GFunc) g_free, NULL);
g_list_free (oinfo->children);
g_list_free_full (oinfo->children, g_free);
/* we unref top-level objects and leave the actors alone,
* unless we are unmerging in which case we have to destroy
@ -380,7 +375,7 @@ object_info_free (gpointer data)
static void
clutter_script_finalize (GObject *gobject)
{
ClutterScriptPrivate *priv = CLUTTER_SCRIPT_GET_PRIVATE (gobject);
ClutterScriptPrivate *priv = CLUTTER_SCRIPT (gobject)->priv;
g_object_unref (priv->parser);
g_hash_table_destroy (priv->objects);
@ -846,8 +841,7 @@ clutter_script_unmerge_objects (ClutterScript *script,
for (l = data.ids; l != NULL; l = l->next)
g_hash_table_remove (priv->objects, l->data);
g_slist_foreach (data.ids, (GFunc) g_free, NULL);
g_slist_free (data.ids);
g_slist_free_full (data.ids, g_free);
clutter_script_ensure_objects (script);
}

View File

@ -79,7 +79,8 @@ typedef void (* ClutterScriptConnectFunc) (ClutterScript *script,
*
* Since: 0.6
*/
typedef enum {
typedef enum
{
CLUTTER_SCRIPT_ERROR_INVALID_TYPE_FUNCTION,
CLUTTER_SCRIPT_ERROR_INVALID_PROPERTY,
CLUTTER_SCRIPT_ERROR_INVALID_VALUE

View File

@ -84,9 +84,9 @@ enum
static GParamSpec *obj_props[PROP_LAST] = { NULL, };
static GParamSpec *animatable_props[ANIM_PROP_LAST] = { NULL, };
static ClutterAnimatableIface *parent_animatable_iface = NULL;
static ClutterAnimatableInterface *parent_animatable_iface = NULL;
static void clutter_animatable_iface_init (ClutterAnimatableIface *iface);
static void clutter_animatable_iface_init (ClutterAnimatableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (ClutterScrollActor, clutter_scroll_actor, CLUTTER_TYPE_ACTOR,
G_ADD_PRIVATE (ClutterScrollActor)
@ -240,7 +240,7 @@ clutter_scroll_actor_get_initial_state (ClutterAnimatable *animatable,
}
static void
clutter_animatable_iface_init (ClutterAnimatableIface *iface)
clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
{
parent_animatable_iface = g_type_interface_peek_parent (iface);

View File

@ -333,6 +333,7 @@ clutter_shader_effect_create_shader (ClutterShaderEffect *self)
default:
g_assert_not_reached ();
return COGL_INVALID_HANDLE;
}
}
@ -499,6 +500,7 @@ static void
clutter_shader_effect_init (ClutterShaderEffect *effect)
{
effect->priv = clutter_shader_effect_get_instance_private (effect);
effect->priv->shader_type = CLUTTER_FRAGMENT_SHADER;
}
/**

View File

@ -89,8 +89,8 @@ clutter_stage_manager_dispose (GObject *gobject)
stage_manager = CLUTTER_STAGE_MANAGER (gobject);
g_slist_foreach (stage_manager->stages, (GFunc) clutter_actor_destroy, NULL);
g_slist_free (stage_manager->stages);
g_slist_free_full (stage_manager->stages,
(GDestroyNotify) clutter_actor_destroy);
stage_manager->stages = NULL;
G_OBJECT_CLASS (clutter_stage_manager_parent_class)->dispose (gobject);
@ -134,8 +134,7 @@ clutter_stage_manager_class_init (ClutterStageManagerClass *klass)
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterStageManagerClass, stage_added),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_STAGE);
/**
@ -153,8 +152,7 @@ clutter_stage_manager_class_init (ClutterStageManagerClass *klass)
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterStageManagerClass, stage_removed),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_STAGE);
}

View File

@ -40,8 +40,12 @@ void _clutter_stage_paint_view (ClutterStage
ClutterStageView *view,
const cairo_rectangle_int_t *clip);
void _clutter_stage_emit_after_paint (ClutterStage *stage);
CLUTTER_EXPORT
void _clutter_stage_set_window (ClutterStage *stage,
ClutterStageWindow *stage_window);
CLUTTER_EXPORT
ClutterStageWindow *_clutter_stage_get_window (ClutterStage *stage);
void _clutter_stage_get_projection_matrix (ClutterStage *stage,
CoglMatrix *projection);
@ -63,6 +67,7 @@ void _clutter_stage_maybe_relayout (ClutterActor
gboolean _clutter_stage_needs_update (ClutterStage *stage);
gboolean _clutter_stage_do_update (ClutterStage *stage);
CLUTTER_EXPORT
void _clutter_stage_queue_event (ClutterStage *stage,
ClutterEvent *event,
gboolean copy_event);
@ -74,6 +79,15 @@ gint64 _clutter_stage_get_update_time (ClutterStage *stage);
void _clutter_stage_clear_update_time (ClutterStage *stage);
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
void clutter_stage_log_pick (ClutterStage *stage,
const ClutterPoint *vertices,
ClutterActor *actor);
void clutter_stage_push_pick_clip (ClutterStage *stage,
const ClutterPoint *vertices);
void clutter_stage_pop_pick_clip (ClutterStage *stage);
ClutterActor *_clutter_stage_do_pick (ClutterStage *stage,
gint x,
gint y,
@ -92,13 +106,6 @@ void _clutter_stage_queue_redraw_entry_invalidate (Clut
CoglFramebuffer *_clutter_stage_get_active_framebuffer (ClutterStage *stage);
gint32 _clutter_stage_acquire_pick_id (ClutterStage *stage,
ClutterActor *actor);
void _clutter_stage_release_pick_id (ClutterStage *stage,
gint32 pick_id);
ClutterActor * _clutter_stage_get_actor_by_pick_id (ClutterStage *stage,
gint32 pick_id);
void _clutter_stage_add_pointer_drag_actor (ClutterStage *stage,
ClutterInputDevice *device,
ClutterActor *actor);
@ -115,20 +122,27 @@ ClutterActor * _clutter_stage_get_touch_drag_actor (ClutterStage *st
void _clutter_stage_remove_touch_drag_actor (ClutterStage *stage,
ClutterEventSequence *sequence);
CLUTTER_EXPORT
ClutterStageState _clutter_stage_get_state (ClutterStage *stage);
CLUTTER_EXPORT
gboolean _clutter_stage_is_activated (ClutterStage *stage);
gboolean _clutter_stage_is_fullscreen (ClutterStage *stage);
CLUTTER_EXPORT
gboolean _clutter_stage_update_state (ClutterStage *stage,
ClutterStageState unset_state,
ClutterStageState set_state);
void _clutter_stage_set_scale_factor (ClutterStage *stage,
int factor);
gboolean _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
ClutterRect *rect,
float *view_scale);
void _clutter_stage_presented (ClutterStage *stage,
CoglFrameEvent frame_event,
ClutterFrameInfo *frame_info);
GList * _clutter_stage_peek_stage_views (ClutterStage *stage);
G_END_DECLS
#endif /* __CLUTTER_STAGE_PRIVATE_H__ */

View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2019 Red Hat Inc.
*
* 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_STAGE_VIEW_PRIVATE_H__
#define __CLUTTER_STAGE_VIEW_PRIVATE_H__
#include "clutter/clutter-stage-view.h"
void clutter_stage_view_blit_offscreen (ClutterStageView *view,
const cairo_rectangle_int_t *clip);
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
void clutter_stage_view_set_dirty_viewport (ClutterStageView *view,
gboolean dirty);
gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
gboolean dirty);
#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */

View File

@ -18,6 +18,7 @@
#include "clutter-build-config.h"
#include "clutter/clutter-stage-view.h"
#include "clutter/clutter-stage-view-private.h"
#include <cairo-gobject.h>
#include <math.h>
@ -29,6 +30,7 @@ enum
PROP_LAYOUT,
PROP_FRAMEBUFFER,
PROP_OFFSCREEN,
PROP_SHADOWFB,
PROP_SCALE,
PROP_LAST
@ -43,7 +45,10 @@ typedef struct _ClutterStageViewPrivate
CoglFramebuffer *framebuffer;
CoglOffscreen *offscreen;
CoglPipeline *pipeline;
CoglPipeline *offscreen_pipeline;
CoglOffscreen *shadowfb;
CoglPipeline *shadowfb_pipeline;
guint dirty_viewport : 1;
guint dirty_projection : 1;
@ -61,6 +66,14 @@ clutter_stage_view_get_layout (ClutterStageView *view,
*rect = priv->layout;
}
/**
* clutter_stage_view_get_framebuffer:
* @view: a #ClutterStageView
*
* Retrieves the framebuffer of @view to draw to.
*
* Returns: (transfer none): a #CoglFramebuffer
*/
CoglFramebuffer *
clutter_stage_view_get_framebuffer (ClutterStageView *view)
{
@ -69,10 +82,20 @@ clutter_stage_view_get_framebuffer (ClutterStageView *view)
if (priv->offscreen)
return priv->offscreen;
else if (priv->shadowfb)
return priv->shadowfb;
else
return priv->framebuffer;
}
/**
* clutter_stage_view_get_onscreen:
* @view: a #ClutterStageView
*
* Retrieves the onscreen framebuffer of @view if available.
*
* Returns: (transfer none): a #CoglFramebuffer
*/
CoglFramebuffer *
clutter_stage_view_get_onscreen (ClutterStageView *view)
{
@ -82,6 +105,24 @@ clutter_stage_view_get_onscreen (ClutterStageView *view)
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
clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
{
@ -92,21 +133,27 @@ clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
g_assert (priv->offscreen != NULL);
if (priv->pipeline)
if (priv->offscreen_pipeline)
return;
priv->pipeline =
cogl_pipeline_new (cogl_framebuffer_get_context (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);
priv->offscreen_pipeline =
clutter_stage_view_create_framebuffer_pipeline (priv->offscreen);
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
@ -115,7 +162,45 @@ clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
g_clear_pointer (&priv->pipeline, cogl_object_unref);
g_clear_pointer (&priv->offscreen_pipeline, cogl_object_unref);
}
static void
clutter_stage_view_copy_to_framebuffer (ClutterStageView *view,
const cairo_rectangle_int_t *rect,
CoglPipeline *pipeline,
CoglFramebuffer *src_framebuffer,
CoglFramebuffer *dst_framebuffer,
gboolean can_blit)
{
CoglMatrix matrix;
/* First, try with blit */
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);
cogl_matrix_init_identity (&matrix);
cogl_matrix_translate (&matrix, -1, 1, 0);
cogl_matrix_scale (&matrix, 2, -2, 0);
cogl_framebuffer_set_projection_matrix (dst_framebuffer, &matrix);
cogl_framebuffer_draw_rectangle (dst_framebuffer,
pipeline,
0, 0, 1, 1);
cogl_framebuffer_pop_matrix (dst_framebuffer);
}
void
@ -124,24 +209,46 @@ clutter_stage_view_blit_offscreen (ClutterStageView *view,
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
CoglMatrix matrix;
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
cogl_framebuffer_push_matrix (priv->framebuffer);
if (priv->offscreen)
{
gboolean can_blit;
CoglMatrix matrix;
/* 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_translate (&matrix, -1, 1, 0);
cogl_matrix_scale (&matrix, 2, -2, 0);
cogl_framebuffer_set_projection_matrix (priv->framebuffer, &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);
cogl_framebuffer_draw_rectangle (priv->framebuffer,
priv->pipeline,
0, 0, 1, 1);
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);
}
}
cogl_framebuffer_pop_matrix (priv->framebuffer);
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
@ -241,6 +348,9 @@ clutter_stage_view_get_property (GObject *object,
case PROP_OFFSCREEN:
g_value_set_boxed (value, priv->offscreen);
break;
case PROP_SHADOWFB:
g_value_set_boxed (value, priv->shadowfb);
break;
case PROP_SCALE:
g_value_set_float (value, priv->scale);
break;
@ -286,6 +396,9 @@ clutter_stage_view_set_property (GObject *object,
case PROP_OFFSCREEN:
priv->offscreen = g_value_dup_boxed (value);
break;
case PROP_SHADOWFB:
priv->shadowfb = g_value_dup_boxed (value);
break;
case PROP_SCALE:
priv->scale = g_value_get_float (value);
break;
@ -302,8 +415,10 @@ clutter_stage_view_dispose (GObject *object)
clutter_stage_view_get_instance_private (view);
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->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);
}
@ -358,6 +473,15 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
G_PARAM_CONSTRUCT_ONLY |
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] =
g_param_spec_float ("scale",
"View scale",

View File

@ -18,6 +18,10 @@
#ifndef __CLUTTER_STAGE_VIEW_H__
#define __CLUTTER_STAGE_VIEW_H__
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <clutter/clutter.h> can be included directly."
#endif
#include <cairo.h>
#include <glib-object.h>
#include <cogl/cogl.h>
@ -57,22 +61,9 @@ void clutter_stage_view_transform_to_onscreen (ClutterStageView *vie
gfloat *x,
gfloat *y);
void clutter_stage_view_blit_offscreen (ClutterStageView *view,
const cairo_rectangle_int_t *clip);
CLUTTER_EXPORT
float clutter_stage_view_get_scale (ClutterStageView *view);
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
void clutter_stage_view_set_dirty_viewport (ClutterStageView *view,
gboolean dirty);
gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
gboolean dirty);
CLUTTER_EXPORT
void clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
CoglMatrix *matrix);

View File

@ -14,10 +14,6 @@
* #ClutterStage actor, abstracting away the specifics of the windowing system.
*/
#define clutter_stage_window_get_type _clutter_stage_window_get_type
typedef ClutterStageWindowIface ClutterStageWindowInterface;
G_DEFINE_INTERFACE (ClutterStageWindow, clutter_stage_window, G_TYPE_OBJECT);
static void
@ -60,40 +56,22 @@ void
_clutter_stage_window_set_title (ClutterStageWindow *window,
const gchar *title)
{
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->set_title)
iface->set_title (window, title);
}
void
_clutter_stage_window_set_fullscreen (ClutterStageWindow *window,
gboolean is_fullscreen)
{
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->set_fullscreen)
iface->set_fullscreen (window, is_fullscreen);
}
void
_clutter_stage_window_set_cursor_visible (ClutterStageWindow *window,
gboolean is_visible)
{
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->set_cursor_visible)
iface->set_cursor_visible (window, is_visible);
}
void
_clutter_stage_window_set_user_resizable (ClutterStageWindow *window,
gboolean is_resizable)
{
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->set_user_resizable (window,
is_resizable);
}
gboolean
_clutter_stage_window_realize (ClutterStageWindow *window)
{
@ -138,7 +116,7 @@ void
_clutter_stage_window_schedule_update (ClutterStageWindow *window,
int sync_delay)
{
ClutterStageWindowIface *iface;
ClutterStageWindowInterface *iface;
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
@ -163,7 +141,7 @@ _clutter_stage_window_schedule_update (ClutterStageWindow *window,
gint64
_clutter_stage_window_get_update_time (ClutterStageWindow *window)
{
ClutterStageWindowIface *iface;
ClutterStageWindowInterface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), 0);
@ -186,7 +164,7 @@ _clutter_stage_window_get_update_time (ClutterStageWindow *window)
void
_clutter_stage_window_clear_update_time (ClutterStageWindow *window)
{
ClutterStageWindowIface *iface;
ClutterStageWindowInterface *iface;
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
@ -204,7 +182,7 @@ void
_clutter_stage_window_add_redraw_clip (ClutterStageWindow *window,
cairo_rectangle_int_t *stage_clip)
{
ClutterStageWindowIface *iface;
ClutterStageWindowInterface *iface;
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
@ -224,7 +202,7 @@ _clutter_stage_window_add_redraw_clip (ClutterStageWindow *window,
gboolean
_clutter_stage_window_has_redraw_clips (ClutterStageWindow *window)
{
ClutterStageWindowIface *iface;
ClutterStageWindowInterface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
@ -246,7 +224,7 @@ _clutter_stage_window_has_redraw_clips (ClutterStageWindow *window)
gboolean
_clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window)
{
ClutterStageWindowIface *iface;
ClutterStageWindowInterface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
@ -261,7 +239,7 @@ gboolean
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *stage_clip)
{
ClutterStageWindowIface *iface;
ClutterStageWindowInterface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
@ -276,7 +254,7 @@ void
_clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
gboolean accept_focus)
{
ClutterStageWindowIface *iface;
ClutterStageWindowInterface *iface;
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
@ -288,7 +266,7 @@ _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
void
_clutter_stage_window_redraw (ClutterStageWindow *window)
{
ClutterStageWindowIface *iface;
ClutterStageWindowInterface *iface;
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
@ -297,28 +275,10 @@ _clutter_stage_window_redraw (ClutterStageWindow *window)
iface->redraw (window);
}
void
_clutter_stage_window_get_dirty_pixel (ClutterStageWindow *window,
ClutterStageView *view,
int *x, int *y)
{
ClutterStageWindowIface *iface;
*x = 0;
*y = 0;
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->get_dirty_pixel)
iface->get_dirty_pixel (window, view, x, y);
}
gboolean
_clutter_stage_window_can_clip_redraws (ClutterStageWindow *window)
{
ClutterStageWindowIface *iface;
ClutterStageWindowInterface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
@ -332,7 +292,7 @@ _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window)
GList *
_clutter_stage_window_get_views (ClutterStageWindow *window)
{
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
return iface->get_views (window);
}
@ -340,7 +300,7 @@ _clutter_stage_window_get_views (ClutterStageWindow *window)
void
_clutter_stage_window_finish_frame (ClutterStageWindow *window)
{
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->finish_frame)
iface->finish_frame (window);
@ -349,7 +309,7 @@ _clutter_stage_window_finish_frame (ClutterStageWindow *window)
int64_t
_clutter_stage_window_get_frame_counter (ClutterStageWindow *window)
{
ClutterStageWindowIface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->get_frame_counter)
return iface->get_frame_counter (window);

View File

@ -7,30 +7,21 @@
G_BEGIN_DECLS
#define CLUTTER_TYPE_STAGE_WINDOW (_clutter_stage_window_get_type ())
#define CLUTTER_STAGE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_STAGE_WINDOW, ClutterStageWindow))
#define CLUTTER_IS_STAGE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_STAGE_WINDOW))
#define CLUTTER_STAGE_WINDOW_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_STAGE_WINDOW, ClutterStageWindowIface))
#define CLUTTER_TYPE_STAGE_WINDOW (clutter_stage_window_get_type ())
CLUTTER_EXPORT
G_DECLARE_INTERFACE (ClutterStageWindow, clutter_stage_window,
CLUTTER, STAGE_WINDOW,
GObject)
/*
* ClutterStageWindow: (skip)
*
* #ClutterStageWindow is an opaque structure
* whose members should not be accessed directly
*
* Since: 0.8
*/
typedef struct _ClutterStageWindow ClutterStageWindow; /* dummy */
typedef struct _ClutterStageWindowIface ClutterStageWindowIface;
/*
* ClutterStageWindowIface: (skip)
* ClutterStageWindowInterface: (skip)
*
* The interface implemented by backends for stage windows
*
* Since: 0.8
*/
struct _ClutterStageWindowIface
struct _ClutterStageWindowInterface
{
/*< private >*/
GTypeInterface parent_iface;
@ -39,12 +30,8 @@ struct _ClutterStageWindowIface
void (* set_title) (ClutterStageWindow *stage_window,
const gchar *title);
void (* set_fullscreen) (ClutterStageWindow *stage_window,
gboolean is_fullscreen);
void (* set_cursor_visible) (ClutterStageWindow *stage_window,
gboolean cursor_visible);
void (* set_user_resizable) (ClutterStageWindow *stage_window,
gboolean is_resizable);
gboolean (* realize) (ClutterStageWindow *stage_window);
void (* unrealize) (ClutterStageWindow *stage_window);
@ -77,10 +64,6 @@ struct _ClutterStageWindowIface
void (* redraw) (ClutterStageWindow *stage_window);
void (* get_dirty_pixel) (ClutterStageWindow *stage_window,
ClutterStageView *view,
int *x, int *y);
gboolean (* can_clip_redraws) (ClutterStageWindow *stage_window);
GList *(* get_views) (ClutterStageWindow *stage_window);
@ -88,19 +71,12 @@ struct _ClutterStageWindowIface
void (* finish_frame) (ClutterStageWindow *stage_window);
};
CLUTTER_EXPORT
GType _clutter_stage_window_get_type (void) G_GNUC_CONST;
ClutterActor * _clutter_stage_window_get_wrapper (ClutterStageWindow *window);
void _clutter_stage_window_set_title (ClutterStageWindow *window,
const gchar *title);
void _clutter_stage_window_set_fullscreen (ClutterStageWindow *window,
gboolean is_fullscreen);
void _clutter_stage_window_set_cursor_visible (ClutterStageWindow *window,
gboolean is_visible);
void _clutter_stage_window_set_user_resizable (ClutterStageWindow *window,
gboolean is_resizable);
gboolean _clutter_stage_window_realize (ClutterStageWindow *window);
void _clutter_stage_window_unrealize (ClutterStageWindow *window);
@ -112,6 +88,7 @@ void _clutter_stage_window_hide (ClutterStageWin
void _clutter_stage_window_resize (ClutterStageWindow *window,
gint width,
gint height);
CLUTTER_EXPORT
void _clutter_stage_window_get_geometry (ClutterStageWindow *window,
cairo_rectangle_int_t *geometry);
void _clutter_stage_window_schedule_update (ClutterStageWindow *window,
@ -131,10 +108,6 @@ void _clutter_stage_window_set_accept_focus (ClutterStageWin
void _clutter_stage_window_redraw (ClutterStageWindow *window);
void _clutter_stage_window_get_dirty_pixel (ClutterStageWindow *window,
ClutterStageView *view,
int *x, int *y);
gboolean _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window);
GList * _clutter_stage_window_get_views (ClutterStageWindow *window);

File diff suppressed because it is too large Load Diff

View File

@ -30,6 +30,7 @@
#include <clutter/clutter-types.h>
#include <clutter/clutter-group.h>
#include <clutter/clutter-stage-view.h>
G_BEGIN_DECLS
@ -61,8 +62,6 @@ struct _ClutterStage
};
/**
* ClutterStageClass:
* @fullscreen: handler for the #ClutterStage::fullscreen signal
* @unfullscreen: handler for the #ClutterStage::unfullscreen signal
* @activate: handler for the #ClutterStage::activate signal
* @deactivate: handler for the #ClutterStage::deactivate signal
* @delete_event: handler for the #ClutterStage::delete-event signal
@ -79,17 +78,18 @@ struct _ClutterStageClass
/*< public >*/
/* signals */
void (* fullscreen) (ClutterStage *stage);
void (* unfullscreen) (ClutterStage *stage);
void (* activate) (ClutterStage *stage);
void (* deactivate) (ClutterStage *stage);
gboolean (* delete_event) (ClutterStage *stage,
ClutterEvent *event);
void (* paint_view) (ClutterStage *stage,
ClutterStageView *view);
/*< private >*/
/* padding for future expansion */
gpointer _padding_dummy[31];
gpointer _padding_dummy[30];
};
/**
@ -168,11 +168,6 @@ CLUTTER_EXPORT
void clutter_stage_get_perspective (ClutterStage *stage,
ClutterPerspective *perspective);
CLUTTER_EXPORT
void clutter_stage_set_fullscreen (ClutterStage *stage,
gboolean fullscreen);
CLUTTER_EXPORT
gboolean clutter_stage_get_fullscreen (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_show_cursor (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_hide_cursor (ClutterStage *stage);
@ -181,11 +176,6 @@ void clutter_stage_set_title (ClutterStage
const gchar *title);
CLUTTER_EXPORT
const gchar * clutter_stage_get_title (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_set_user_resizable (ClutterStage *stage,
gboolean resizable);
CLUTTER_EXPORT
gboolean clutter_stage_get_user_resizable (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_set_minimum_size (ClutterStage *stage,
@ -261,12 +251,23 @@ CLUTTER_EXPORT
void clutter_stage_skip_sync_delay (ClutterStage *stage);
#endif
CLUTTER_EXPORT
gboolean clutter_stage_get_capture_final_size (ClutterStage *stage,
cairo_rectangle_int_t *rect,
int *width,
int *height,
float *scale);
CLUTTER_EXPORT
gboolean clutter_stage_capture (ClutterStage *stage,
gboolean paint,
cairo_rectangle_int_t *rect,
ClutterCapture **captures,
int *n_captures);
CLUTTER_EXPORT
ClutterStageView * clutter_stage_get_view_at (ClutterStage *stage,
float x,
float y);
G_END_DECLS

View File

@ -122,8 +122,7 @@ clutter_tap_action_class_init (ClutterTapActionClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterTapActionClass, tap),
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
}

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