Compare commits

...

202 Commits

Author SHA1 Message Date
208e292df1 backends/native: Add input thread inside MetaSeatImpl
This (now) doesn't change anything in regards to the API that the UI
thread should access from the MetaSeatImpl. The MetaInputDeviceNative,
MetaInputSettings and MetaKeymap objects are now considered owned by
the input thread, as well as all of libinput objects.

The MetaEventSource now dispatches events in a GMainContext that is
the thread default to this thread, and all UI-thread-accessible API
(seat and virtual input device API) will be handled in a serialized
manner by that same input thread.

The MetaSeatImpl itself is still considered to be owned by the caller
thread, and all the signals that this object emits will be emitted in
the GMainContext that is default at the time of calling
meta_seat_impl_new().

The MetaInputSettings configuration changes will likewise be handled
in the input thread, close to libinput devices.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
548e5138fc backends/native: Make MetaVirtualInputDevice vmethods "async"
These are one-way API calls, that now should get executed in the MetaSeatImpl
context. Use the MetaSeatImpl async task plumbing so that's the case.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
6b8d95d9c4 backends/native: Make some MetaSeatImpl API "async"
This API is the one accessed from different bits of the UI thread,
make it "async" (it's basically one-way setters, so API stays the same
in the surface) and able to run in the MetaSeatImpl main context.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
faec8d29b0 backends/native: Shuffle xkb_keymap creation
Push it a little bit down to the MetaSeatNative. As both the UI thread
and the input thread are interested in dealing with the xkb_keymap and
it is not meant to be used in different threads, keep 2 separate copies
around.

The keyboard map will always be set from the UI thread, so the xkb_keymap
owned by the MetaSeatNative (owned by the UI thread) can be considered
canonical.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
4b88a769d2 backends/native: Seal MetaKeymapNative xkb usage
Don't let the vfuncs (meant to be called from the UI thread) deal with
xkb state itself. Instead store the current state in struct fields, which
is then fetched in vfuncs.

This makes the keymap able to be used from the UI thread, while being
maintained by the input thread. Same caveats apply than
clutter_seat_query_state(), you are asking for the most up-to-date state,
but it still may be changing under your feet.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
6704e986a0 backends/native: Surround device state queries/updates with RW lock
Wrap all keyboard state updates, and all pointer/stylus/touch cursor
position with a write lock, and ::query_state() (The only entrypoint
to this state from other threads) with a read lock.

The principle is that query_state may be called from different threads
(UI so far, but maybe KMS too in the future), while the input thread
may (or may not) be updating it. This state is fetched "atomically"
(eg. x/y will be consistently old or new, if the input thread were
updating it at the same time).

There's other places deep in backends/native that read this state,
they all will run in the input thread, so they count as "other readers"
to the other thread. Those changes are already mutually exclusive with
updates, so they don't explicitly need the RW lock.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
d55b44df50 backends/native: Protect MetaBarrierManagerNative
While barriers will be added from the main thread, the native barrier
manager will sit close to the MetaSeatImpl in its own thread. Add the
necessary locking so that we can pass MetaBarrierImplNative from the
UI thread to the input thread, and ensure the MetaBarrier signals are
still emitted in the UI thread.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
6496cd7c55 clutter: Switch to GAsyncQueue for ClutterMainContext event queue
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
6f3ce4de24 clutter: Drop _clutter_clear_events_queue_for_stage()
There's only one stage. Let's not overcomplicate things, as it
will not be possible to simply go through the event queue inspecting
every event.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
034aff4306 clutter: Drop clutter_event_peek()
Peeking doesn't seem such a good idea when we switch to async queues.
Luckily nobody seems to be using this.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
af5f93377a backends: Avoid usage of ClutterBackend/ClutterSeat in MetaInputDeviceNative
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
abd858fb69 backends/native: Move MetaInputSettings ownership to MetaSeatImpl
Together with keymaps and devices, MetaInputSettings will live in the
ninth circle of hell with MetaSeatImpl, forever tied to it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
09e02a772e backends/native: Do not dispatch libinput during MetaSeatImpl construction
This saves us from some egg/chicken problems, since we mean to use the
MetaInputSettings while it (thus far) is created at a later stage.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
c850aa9733 backends: Do not use clutter_seat_list_devices() in MetaInputSettings
Make it keep its own list of devices, it's not that far off.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
5a1c7e4a54 backends: Make device tracking at MetaInputSettings ad-hoc API
Depending on the backend, we want to integrate this object at different
levels. It will sit close to the MetaBackendX11/MetaSeatX11 in X11, but
it will be put deep down with MetaSeatImpl in the native backend, in a
separate thread.

Since we can't depend on a single object type, nor are able to track
ClutterSeat signals neatly, make this API something to be called
explicitly by backends.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
e324f0fad0 backends: Simplify function arguments
We just pass a device in order to check it with the seat pointer, we
can do without this.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
5978531963 backends/native: Proxy modifier state changes via MetaSeatImpl
This changes within the MetaSeatImpl realm, so use a signal to forward
this to the MetaSeatNative/MetaKeymapNative one.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
bc111bf958 backends/native: Proxy bell notifications from within the MetaSeatImpl
As with other changes from within the MetaSeatImpl realm, proxy that
through a MetaSeatImpl signal, instead of poking directly on the ClutterSeat.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
074d78bd9b backends/native: Proxy touch-mode via MetaSeatImpl
Handle this via a MetaSeatImpl signal, as the heuristics that apply
here are based on libinput events. The MetaSeatNative just forwards
the touch-mode changes now.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
2e604709df backends/native: Forward keyboard a11y changes via the MetaSeatImpl
These changes will happen in the input event management code, so let them
be emitted via the MetaSeatImpl, as that's what we'll have neat access to.
The ClutterSeat signals are now emitted from there.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
6c265c131f clutter: Don't keep extra copy on device events
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
06adde5c6b backends/native: Spin MetaSeatImpl off MetaSeatNative
Move most of the functional bits (those meant to run on a standalone
thread) to a MetaSeatImpl object. This object is managed by the MetaSeatImpl
and not exposed outside the friend MetaSeatNative/MetaInputDeviceNative/
MetaInputSettings classes.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
a2616d83e8 clutter: Make ClutterSeat::handle_device_event vfunc more generic
Make it able to handle not just device added/removed events, but perform
any kind of post-processing that needed to be done on ClutterEvents at
the seat level.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:40:10 +02:00
92bc79fd51 backends/native: Remove unused function
This meta_seat_native_get_device() function has been unused for some time.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:38 +02:00
ef67fab737 backends: Move keyboard a11y into backends
And out of Clutter API. This is mainly set via settings, or the windowing
itself, so we don't need to leak these details up our own backend.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:34 +02:00
9acb7f0eed backends: Make MetaInputMapper take over MetaInputSettings public API
Banish MetaInputSettings from MetaBackend "public" API, it's now meant to
spend the rest of its days in the backend dungeons, maybe hanging
off a thread.

MetaInputMapper replaces all external uses.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:30 +02:00
c678cdab5a backends: Move all output management to MetaInputMapper
Delegate on the MetaInputMapper all matching of inputs and outputs,
including configuration. Other secondary aspects, like output
aspect ratio for tablet letterbox mode, or toggling attached devices
with power saving changes, are also moved here.

This makes MetaInputSettings independent of MetaMonitorManager,
all interaction with it happens indirectly via public API entrypoints.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:25 +02:00
91f6b3b5bc backends: Simplify MetaInputSettings vfunc
Rename the set_tablet_keep_aspect() vfunc into a set_tablet_aspect_ratio()
one that takes an aspect ratio double, instead of leaking monitor info
into subclasses to let them all figure out this number themselves.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:19 +02:00
696915a951 backends/native: Drop meta_seat_native_[gs]et_stage()
This is now unused.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:15 +02:00
2e07c55241 backends: Assign stage to events in MetaBackend
Don't do this in the MetaSeatNative, this should be detached from
the stage.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:11 +02:00
0f0848191e backends/native: Drop early processing of ClutterEvents
We have 2 sources (this one in MetaSeatNative, and the one in
MetaBackend) dispatching ClutterEvents to the stage. Make the
MetaSeatNative one exclusively about dispatching the libinput
queue, and leave ClutterEvents to the other.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:13:04 +02:00
4b0d3f44e1 backends/native: Use viewport info to find out stage extents
This information is equivalent to the stage extents, this just
leaves meta_seat_native_get_stage() used for setting event->any.stage,
which is a tiny lame excuse.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:59 +02:00
4f794d3acb backends: Add method to get extents from viewport info
This way we know the stage extents without poking the stage.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:55 +02:00
3252ef5dd7 backends: Use also a native cursor renderer for tablets
This will resort to SW rendering if this cursor renderer does not
own the MetaKmsCursorRenderer, so it's pretty much equivalent thus
far, except we may now implement logic to flip the kms cursor renderer
around.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:51 +02:00
0c9bbbe90e backends: Use MetaViewportInfo to keep MetaSeatNative informed of layout
Use this for the calculations to keep absolute motion properly constrained,
and relative motion properly scaled.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:44 +02:00
bb62d9e4b0 backends: Add simple object to delegate logical monitor layout queries
This object can be passed to random places, and be trusted to remain unchanged
till replaced. Makes it an ideal replacement for MetaMonitorManager across
threads.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:40 +02:00
579220a762 clutter: Drop ClutterInputDevice::enabled and setter/getter
This is unused now, and not something we generally allow.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:37 +02:00
575a4ca281 backends: Move away from clutter_input_device_set_enabled()
We actually have a set_send_events() vfunc that can enable or disable
devices at the libinput and X11 input driver level, so use that. A
positive side effect is that those layers will leave the device at
a consistent idle state (as opposed to going mute maybe amid user
input).

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:31 +02:00
4b7f2905d6 backends: Split pad action mapping to a separate object
This now lives in the core, and will get updated from events in the
UI thread.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:26 +02:00
c7758046eb backends: Drop unused function
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:22 +02:00
e64112de64 backends: Split kms cursor renderer from MetaCursorRendererNative
Move the KMS updating pieces to a distinct MetaKmsCursorRenderer whose
cursor sprite will get updated from the driving MetaCursorRenderer.
Since there could be multiple MetaCursorRenderers, also add the
necessary pieces to move the KMS cursor renderer between renderers.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:19 +02:00
05f385c8ee backends: Move HW cursor inhibitors to MetaBackend
We are aiming for a split of HW and SW cursor rendering management.
Given the HW plane is a limited resource and the amount of cursor
renderers may be >1 (due to tablets, even though we currently use an
always-software cursor renderer there), it would ideally be able to
switch between renderers.

Being MetaCursorRenderer not really a singleton, having cursor
inhibitor accounting here doesn't pan out. Make it MetaBackend API
so all cursor renderers get the same picture.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:14 +02:00
8a2b529ca3 backends: Make MetaHwCursorInhibitor less about sprites
Remove the sprite argument from the vfunc, it's used in no implementations
and conceptually gets a bit in the middle.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:12:11 +02:00
0c92417178 core: Centralize cursor renderer and tracker updates
These use now more of a "pull" model, where they receive update
notifications and the relevant input position is queried, instead
of the coordinates being passed along.

This allows to treat cursor renderers all the same independently
of the device they track. This notifying of position changes should
ideally be more backend-y than core-y, a better location will be
figured out in future commits.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:48 +02:00
543d232b51 backends: Drop meta_cursor_renderer_get_position()
This is now unused.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:45 +02:00
4398d63566 wayland: Move away from meta_cursor_renderer_get_position()
Fetch the cursor renderer device, and query its position instead.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:42 +02:00
dc022a67b0 backends: Add ::device property to MetaCursorRenderer
A cursor renderer is made to invariably follow a pointer device, make
it a construct-time property, and update all creators of cursor renderers
to specify it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:38 +02:00
60fa895ae3 backends: Move away from meta_cursor_renderer_get_position()
We are moving onto relying fully on the seat cursor position. As
this focuses (thus far?) on mouse pointers only, use the cursor
tracker as a convenient shortcut.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:35 +02:00
7bb3fe25aa backends: Use graphene_point_t on meta_cursor_tracker_get_pointer()
It's nicer to propagate along.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:31 +02:00
6c5bba94fd backends: Manage tablet cursors in backend
Instead of letting the wayland bits maintain an always-software
cursor renderer, let the cursor renderer be managed by the backend,
and only hook to it (as we do for pointer cursor) in the wayland
bits.

ATM, make the cursor renderer still always-software, although
ideally we should allow moving the HW cursor management between
renderers.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:18 +02:00
667b2726f5 wayland: Look up cursor renderer for device on MetaWaylandPointer
Make it explicitly look up the pointer device, instead of implicitly
relying on it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:15 +02:00
1d3588ba48 backends: Add meta_backend_get_cursor_renderer_for_device()
Different devices may get standalone cursor renderers, add this API
to adapt slowly to this. The meta_backend_get_cursor_renderer() call
still exists, but shortcuts to the mouse pointer's renderer (as it
actually did before).

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:11 +02:00
16317cec12 wayland: Replace cursor renderer usage with cursor tracker
We just want to know the pointer position, let's use something else
here.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:08 +02:00
f3991c0164 backends: Add argument for best scale on MetaCursorSprite::prepare-at
Instead of letting implementations poke backend internals from various
places, give that information right away.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:05 +02:00
b07d9c5f92 core: Do not force cursor renderer update here
This is already taken care of in meta_backend_monitors_changed(), called
from the same code paths that emit ::monitors-changed-internal. It is
better to leave this up to backend internals.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:11:02 +02:00
be51a8c18c backends: Remove x/y arguments from MetaCursorTracker::cursor-moved
Make this signal a hint, the actual coordinates should be queried to the
cursor tracker, the device, the seat... There's enough options.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:58 +02:00
11c86f9cb3 core: Remove unused struct field
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:55 +02:00
87c0821a30 backends: Drop unused function
meta_cursor_tracker_get_displayed_cursor() is used nowhere.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:52 +02:00
03f2bade19 backends: Delegate pointer confinements to an impl object
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:49 +02:00
a3825f2085 backends: Fix typo in comment
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:46 +02:00
8b2a89041a backends: Drop GDK device querying code from MetaCursorTracker
Clutter behavior is now equivalent to GDK's on X11, avoid poking to
GDK here.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:42 +02:00
52da5fe4f2 clutter: Simplify backend-independent touch accounting
Coordinates are tracked by the ClutterSeat backends, we just need to
track the target actor at this level.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:39 +02:00
307be1e495 clutter: Drop clutter_input_device_set_coords()
Input devices aren't "updated" anymore, but their state queried to the
seat. This goes nowhere.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:36 +02:00
9b3ca86b7c clutter: Drop clutter_input_device_update_from_event()
Input devices aren't "updated" anymore, but their state queried to
the seat instead. This is API only meant for embedders of Clutter,
and is pointless to us.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:33 +02:00
da55f15156 clutter: Pass base event to clutter_input_device_update()
So we may fetch coordinates without necessarily querying the device
state.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:29 +02:00
b13fe4895f clutter: Drop clutter_input_device_set_state()
Nothing uses it anymore.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:25 +02:00
aae4a6065c backends/native: Move away from ClutterInputDevice coords
Use a new set in MetaInputDeviceNative for the time being.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:22 +02:00
1555ecad11 clutter: Use ClutterSeat underneath coords/modifiers input device getters
This is not device state, but belonging to seat guts.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:18 +02:00
292b4dd605 backends/native: Implement ClutterSeat::query_state() vmethod
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:15 +02:00
4766e2f858 backends/x11: Implement ClutterSeat::query_state() vmethod
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:12 +02:00
e3fe8c3dd1 clutter: Add ClutterSeat::query_state() vmethod
This will query a device state; position and modifiers.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:09 +02:00
d3e1ce7dbc clutter: Drop unused field in ClutterInputDevice struct
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:04 +02:00
63ad2c958d clutter: Drop clutter_input_device_set_time()
An input device does not have time on itself, events do. This was made
unused so drop it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:10:01 +02:00
849cc3d7f5 clutter: Pass timestamp to clutter_input_device_set_actor()
This function emits crossing events, so needs a (most times truthful)
timestamp. Make it explicit instead of fetching it from the device.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:58 +02:00
8d8c933eb4 clutter/main: Drop dead code branches
We shouldn't get an input event that has not a device.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:54 +02:00
2363f4c30b clutter: Drop clutter_input_device_set_stage()
No one uses this already.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:51 +02:00
5d45722362 backends/x11: Drop users of clutter_input_device_set_stage()
There is no getter, so this information is useless.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:47 +02:00
cef6520836 backends/native: Drop users of clutter_input_device_set_stage()
There is no getter, so doing this is now pointless.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:44 +02:00
0fbbeb0c82 clutter: Drop clutter_input_device_get_[pointer_]stage()
Input devices are not related to the stage in any way. Drop all the
users that relied on it being so.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:40 +02:00
b97519bb6e backends/x11: Drop all users of clutter_input_device_get_stage()
And clutter_input_device_get_pointer_stage().

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:36 +02:00
60b3f628a6 backends/native: Drop all uses of clutter_input_device_get_stage()
Rely on the seat stage, or other ways to fetch it. Also rely that
there is actually a single stage, so that we assign the right stage
to all events going out of the seat, in a single place.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:32 +02:00
37deba9557 clutter: Do not depend on device stage on ClutterInputMethod
Look it up through other means.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:29 +02:00
89cefd037f clutter: Work out stage from actor on which to emit crossing
Don't rely on the device stage.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:26 +02:00
c9efadacd1 clutter: Specify stage on clutter_input_device_update() function
This is the function performing the picking, tell it explicitly the
stage it should happen on.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:22 +02:00
df724f5c75 backends/native: Move relative motion filter to MetaSeatNative altogether
And drop the relative motion filter API. The seat will handle relative motion
across outputs with different scales. This accesses the MetaMonitorManager
ATM.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:19 +02:00
44bb21c7aa backends/native: Make seat constrain pointer to monitors out of the box
It does access the MetaMonitorManager directly ATM.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:15 +02:00
73e705a49b backend/native: Move barrier manager to MetaSeatNative
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:10 +02:00
2316dfe394 backends/native: Use libinput seat slot API
Instead of creating a seat-wide touch slot ID ourselves, rely on libinput
API doing this for us.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:06 +02:00
9597b5a703 backends: Move absolute/relative device mapping to native backend
This is a bit scattered around, with the setter/getter in Clutter, and
it only being only directly honored in Wayland (it goes straight through
device properties in X11).

Make this private native API, and out of public ClutterInputDevice API.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:09:02 +02:00
0be0a14225 backends: Move device mapping check into backend
Make the upper parts agnostic about the device being relative in
order to apply the display mapping. Just make the low level bits
resort to the identity matrix for those.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:08:58 +02:00
7fafec21b6 backends: Fold device mapping check into backend
Make the upper part agnostic about the device being relative in order
to avoid applying keep-aspect. The X11 bits already are, so make it
sure it's also the case for the native backend.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:08:55 +02:00
88f03d3a26 clutter: Sanitize ClutterInputDevice header
Move some exposed setters to private headers. It makes some sense to
provide those for backends, not as much to the upper layers.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:08:51 +02:00
edc399e5cf backends: Drop extra layer of touch info handling
We have a hashtable in the device that does not add much on top
to the seat handling. Make all the places rely on the seat accounting
instead.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:08:48 +02:00
908a331fa8 backends: Drop the filter for libinput events
This is now unused, and it's arguably any useful to stay.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:08:43 +02:00
3083e98254 wayland: Use Clutter event to handle touch cancel
The semantics for libinput events are not as expected here. Besides
it's pointless, as those should arrive per-slot in a burst, and we
cancel on the first event.

We can simply use the Clutter event for this.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:08:39 +02:00
7dc1a28c8c backends: Use slot from cancel events
As it does seem from a read to libinput code, TOUCH_CANCEL events
actually do contain slot information, and are emitted per-slot.
This means we can avoid iterating over the slots ourselves, they
are still expected to be sent altogether.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:08:35 +02:00
3ce5b34ade wayland: Simplify wl_touch.frame handling
We want to coalesce multiple touch events into the same wl_touch.frame
event. Instead of poking internals to peek the touch events (and their
slots) coming at us before we handle them, simplify things by queueing
the event at a slightly lower priority than events, so we are ensured
to handle all pending input events before sending the event.

If there's no pending events, we can just send the frame event. As it
doesn't make sense to hold any longer.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
2020-08-13 21:07:22 +02:00
5677fbb64d seat-native: Process device added/removed events as ClutterEvents
Delay the addition and removal of devices using ClutterDeviceEvent's so that
they are processed following the libinput event order, and that we don't
have to flush the events on removal.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1371
2020-08-13 21:07:18 +02:00
e7f29e764f seat-x11: Translate device enabled/disabled into clutter events
When a device is removed from the seat the events that this device may have
emitted just before being removed might still be in the stage events queue,
this may lead a to a crash because:

Once the device is removed, we dispose it and the staling event is
kept in queue and sent for processing at next loop.
During event processing we ask the backend to update the last device
with the disposed device
The device is disposed once the events referencing it, are free'd
The actual last device emission happens in an idle, but at this point
the device may have been free'd, and in any case will be still disposed
and so not providing useful informations.

To avoid this, once a device has been added/removed from the seat, we queue
ClutterDeviceEvent events to inform the stack that the device state has
changed, preserving the order with the other actual generated device events.
In this way it can't happen that we emit another event before that the
device has been added or after that it has been removed.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1345
2020-08-13 21:07:08 +02:00
5563bfe7d9 clutter-seat: Handle device events and emit signals
Clutter device events are special events coming from the backend when an
input device is added or removed.

When such events are processed, we should make the seat to handle them by
calling vfunc that can be implemented by each backend and eventually
emitting the appropriate signal.

If a device is removed, we can also safely dispose it, as it can be
considered stale at this point.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1371
2020-08-13 21:07:05 +02:00
cd00e69ce3 clutter-event: Add device added/removed events
Add clutter device added and removed events to allow processing of them as
it happens in the backends, queuing them and performing actions in order.

This allows not to loose any event that is performed just before removing or
disabling a device, and still process the events in order in the event
queue.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1371
2020-08-13 21:07:03 +02:00
fe1d297680 backend: Use connect-after to perform actions on device removed
When a device is removed we perform some actions such as stopping the
"::last-device-changed" signal emission and unsetting the current device.
And we want to be sure that these actions happen after all the
device-removed operations are sorted out.

Related to: https://gitlab.gnome.org/GNOME/mutter/-/issues/1345
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1371
2020-08-13 21:07:00 +02:00
67a31633d8 backend: Don't emit last-device updates with no device
When removing a device that has been just marked as the last in use, we may
try to notify that a NULL device is the last one.

This is not supported, as both update_last_device() and the clients of the
"::last-device-changed" signal are assuming that the last device is always
a valid ClutterInputDevice.

So let's avoid erroring, and stop the idle when clearing the current device.

Related to: https://gitlab.gnome.org/GNOME/mutter/-/issues/1345
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1371
2020-08-13 21:06:51 +02:00
3d54f973ce clutter/main: Remove unused "fuzzy picking" option
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
678e1fcd47 clutter/stage: Remove clutter_stage_new()
It's never expected that anything creates its own stage directly, so
remove the constructor function.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
e848414f89 clutter: Remove main loop helper
It's expected to always use meta_*() or your own main loop.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
961a1376cd clutter: Remove 'eglnative' backend layer
It's completely empty, so remove it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
72a389ef12 clutter/egl: Remove unused clutter_egl_get_egl_display()
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
3566fa7bb0 clutter/main: Remove checking windowing system
Last user in gnome-shell removed with
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1358.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
c2a155f767 clutter: Remove support not specifying backend
This was from the old clutter-as-application-library days, where it had
to try find a suitable backend. Now we already have a backend selected
(MetaBackend), and the clutter backend is already predecided depending
on that, so we don't need the code that auto detects an appropriate one
anymore.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
0d95f4d854 tests/clutter: Always use stage from backend
This removes all occurrences of creating a custom stage from the tests,
making them always use the one from MetaBackend. This will allow for
further cleanups.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
21e2f41a26 tests/clutter/conform: Make sure to destroy created actors
We're moving towards not supporting stand-alone application style
clutter stages, meaning the stage tests use will be reused instead of
recreated. To make this feasable, tests must clean up after themself.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:56 +02:00
06d5973851 main: Split up meta_run() into meta_start() and meta_run_main_loop()
meta_run() is still left intact and does the same as before; the new
functions are only intended to be used by tests, as they may need to set
things up after starting up. Doing so linearly in the test case is much
easier than adding callbacks, so meta_run() is split up to make this
possible.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 17:51:30 +02:00
ebfa94f360 clutter/eglnative: Remove unused source field
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
5279e9a922 clutter/eglnative: Remove unused timer
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
3958a019bb clutter: Move font settings reading to ClutterSettings
There is no reason to use Xsettings for the X11 backend, as it comes
from the GSetting store anyway, so move the font setting reading to
ClutterSettings and read directly from GSettings.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
7e97268592 clutter/x11: Remove helper for checking XComposite presence
It's not used by anything.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
d857edf09c clutter: Remove support for transparent windows
We're only ever a compositor, so we're never asking to be transparent.
Thus remove support for requesting to paint to GLX or EGL displays with
an alpha channel.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
787bc3d993 tests/clutter: Make $DISPLAY non-optional
All our tests rely on the nested backend, which runs on top of X11, so
there is no point in having code that tries to handle not finding a
valid $DISPLAY.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
28cb025190 clutter: Remove DELETE event, signal and vfunc
The delete event was used for signalling the close button was clicked on
clutter windows. Being a compositor we should never see these, unless
we're running nested. Remove the plumbing of the DELETE event and just
directly call meta_quit() when we see it, if we're running nested.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
c7429e8aad clutter/main: Use "is display server" state to decide a11y routing
We checked if we were using the usig the X11 backend to decide when to
deal with a11y event posting - in order to make the clutter code less
windowing system dependent, make this check a check whether we're a
display server or not, in contrast to a window/compositing manager
client. This is made into a vfunc ot ClutterBackendClass, implemented by
MetaClutterBackendNative and MetaClutterBackendX11.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1364
2020-08-13 14:45:10 +02:00
e0562f192f Updated Spanish translation 2020-08-13 10:35:11 +02:00
9581e9e31b tests/stage-view: Test timeline updates clock when parent moves
Test that if a timeline got its frame clock from a parent of the
associated actor, if that actor moves across the stage so that the stage
views changes and thus the would be picked frame clock too, this is
noticed by the timeline so that it also changes to the correct frame
clock.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1404
2020-08-13 06:34:05 +00:00
090c72b3c3 tests/stage-view: Test timelines notice stage views changing
Timelines where the frame clock was picked from a parent of the
associated actor didn't get notified about any stage views changes, as
it only listened on the associated actor. If that actor didn't actually
get its stage views changed (because it went from empty to empty), we'd
end up with a stale frame clock, leading to crashes.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1404
2020-08-13 06:34:05 +00:00
06c4841e22 clutter/timeline: Listen to 'stage-view-changed' on picked actor
When we pick the frame clock given the associated actor, that frame
clock in fact comes from a picked actor. In order to not end up with
stale frame clocks, which may happen on e.g. hotplugs, monitor layout
changes, or non-optimal frame clocks, which may happen when the parent
used for picking the clock moves to another view, lets listen to
'stage-views-changed' on the actor used for picking the clock too.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1327
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1404
2020-08-13 06:34:05 +00:00
c6fc3a8953 stage/x11: Only resize X11 CM stage in response to ConfigureNotify
Flip flop resize, which is the result of respecting ConfigureNotify
makes test annoyingly racy, as one cannot do

    clutter_actor_set_size (stage, 1024, 768);
    wait_for_paint (stage);
    g_assert_assert (clutter_actor_get_width (stage) == 1024);

The reason for this is any lingering ConfigureNotify event that might
arrive in an inconvenient time in response to some earlier resize.

In order to not risk breaking any current behavior in the X11 CM case
(running as a compositing window manager), only avoid changing the stage
size in response to ConfigureNotify when running nested.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1404
2020-08-13 06:34:05 +00:00
07e964e9fc clutter/actor: Return the actor used when picking clock
The actor used might be relevant, so that e.g. if it moves or for some
other reason changes stage views, the user can listen for that.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1404
2020-08-13 06:34:05 +00:00
9bcb03ab48 clutter/actor: Make frame clock picking semi private API
Let's not expose that outside of mutter quite yet; it's not used in
gnome-shell, and to avoid future breakage if it starts to be used, lets
move it to clutter-mutter.h so only mutter and clutter itself can use
it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1404
2020-08-13 06:34:04 +00:00
fb0f03640a stage-view: Add clutter_stage_view_destroy()
This aims to make sure a view and its resources are destroyed when it
should. Using references might keep certain components (e.g frame clock)
alive for too long.

We currently don't take any long lived references to the stage view
anywhere, so this doesn't matter in practice, but this may change, and
will be used by a to be added test case.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1404
2020-08-13 06:34:04 +00:00
a13c307fa4 frame-clock: Fix indentation
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1404
2020-08-13 06:34:04 +00:00
adf513c7fc Update Galician translation 2020-08-12 22:46:49 +00:00
623d562933 Bump version to 3.37.90
Update NEWS.
2020-08-11 15:20:10 +02:00
c8f30be91d Update French translation 2020-08-11 06:11:27 +00:00
7c2c3e7880 Update Ukrainian translation 2020-08-08 15:01:05 +00:00
2611ee14b5 ci: Add gnome-shell runtime dependencies
In order to run gnome-shell as part of the CI pipeline, we need
an additional runtime dependency plus python3 modules to mock
required system services and run gnome-shell-perf-tool.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1401
2020-08-07 16:49:59 +02:00
a54a01d1e2 wayland/dma-buf: Advertise support for 64 half point RGBA formats
Just as wl_shm, hook up the Wayland DMA-BUF protocol to the 64 bit half
point pixel formats too. This makes it possible for Wayland EGL clients
to use 64 bit pixel EGL configurations.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:49 +00:00
d3f629bfa8 wayland/shm: Advertise support for 64 half point RGBA formats
Now that cogl understands them, hook wl_shm up so they can be used.

This also bumps the wayland-server version dependency to 1.17.90, which
corresponds to the master branch of wayland. The new formats will be
available in 1.18.0.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:49 +00:00
8e673d5798 wayland/dma-buf: Advertise support for XRGB2101010 too
https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:49 +00:00
115de303b0 wayland/shm: Add ARGB2101010 formats and friends
In order to get higher color pixel precision when the alpha channel is
less important. Only advertise these formats if it is supported by the
used cogl renderer.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:49 +00:00
2d6040e2a3 wayland/shm: Advertise support for RGB565
Doesn't hurt to support it, could save memory bandwidth would any client
use it without degrading visual quality.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:49 +00:00
5a8e4da2a8 wayland/shm: Send error if client uses unsupported format
Instead of rendering incorrectly (we fell back on some arbitrary
format), just send an error.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:49 +00:00
d6b5f89a1c cogl: Add API to check whether a format is supported by the driver
Will let us advertise what we actually support at runtime.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:49 +00:00
6777a547ca cogl: Add 64 bit half-point pixel RGBA formats
In order to support the DRM formats DRM_FORMAT_ABGR16161616F and
friends, as well as the wl_shm formats WL_SHM_FORMAT_ABGR16161616F and
friends, cogl needs to have knowledge about said formats too.

We don't have a software implementation of the half point data types
however, so the pack/unpack methods remain unimplemented. We don't need
them for now, so it's not crucial that we add them.

For the GLES2 driver, currently only two formats are supported, and
since we don't currently have pack/unpack implementations, the other
formats will for now remain unsupported, until we have a half float
implementation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:48 +00:00
b191f89305 cogl/gles2: Add support for actual 10 bpc formats
Only for little-endian, depends on an extension, and needs unpack/pack
for many of the formats.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:48 +00:00
2fc8841416 cogl: Add private feature flags for 10 bpc and 16 bpc formats
10 bpc are enabled for OpenGL and GLES 2 with the right extension. 16
bpc (half float) are enabled for OpenGL 3 and higher, and GLES 2 with
the right extension.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:48 +00:00
598f536c51 cogl/bitmap-packing: Use hexadecimals for bit masks
It's easier to reason about what bits are 1 or 0 with e.g. 0x1f vs 0x3f
compared to 31 and 63.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/804
2020-08-07 09:02:48 +00:00
fc778e2bd3 cursor-tracker/x11: Also update sprite when updating position
Without doing this, we'd use the same sprite that was last set by
mutter, most likely a leftptr cursor, and fail to update when e.g.
moving the pointer above a text entry and the displayed cursor updated
to a cursor position marker.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 16:22:16 +02:00
2d010c9b84 cursor-renderer: Disconnect the overlay cursor from the displayed cursor
The displayed cursor is the one displayed on the screen, e.g. via the
hardware cursor plane, by Xorg, or using the stage overlay.

When screen recording under X11, we don't get a stream of pointer and
cursor updates, as they might be grabbed by some other client. Because
of this, the cursor tracker or cursor renderer are not kept up to date
with positional and cursor state.

To be able to use the stage overlays when recording, we need to be able
to update the overlay without updating the displayed cursor, as we
shouldn't update the X server with cursor state we just retrieved from
it.

Thus, to achieve this, create a separate overlay cursor pointer. When
being a display server, they are always the same, but when using X11,
during screen recording, the overlay one will be polled at a fixed
interval to get a somewhat up to date state.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
a10f35c613 cursor-renderer: Keep ref to displayed cursor sprite
If it'd end up beig the XCursor sprite, it'll be unref:ed by the cursor
tracker when receiving a XFixesCursorNotify:XFixesDisplayCursorNotify
X11 event.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
5f5ef704fc cursor-tracker/x11: Don't leak xfixes cursor sprite
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
3d19b8f49c cursor-tracker: Move out more X11:isms to the X11 backend
This includes the xfixes cursor management.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
a80b0f34e3 clutter: Remove old split capture based screen shooting API
This is no longer used, and the replacement (clutter_stage_paint_to_*())
should be used instead.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
1743887fa7 clutter: Expose clutter_stage_paint_to_(frame)buffer()
This will be used by GNOME Shell to take screenshots.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
b4a8247191 screen-cast: Track and always record cursors
Always force-track the cursor position (so that the X11 backend can keep
it up to date), and if the cursor wasn't part of the sampled
framebuffer when reading pixels into CPU memory, draw it in an extra
pass using cairo after the fact. The cairo based cursor painting only
happens on the X11 backend, as we otherwise inhibit the hw cursor.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
eeee7bed1d cursor-tracker: Add way to force tracking cursor position
On X11 we won't always receive cursor positions, as some other client
might have grabbed the pointer (e.g. for implementing a popup menu). To
make screen casting show a somewhat correct cursor position, we need to
actively poll the X server about the current cursor position.

We only really want to do this when screen casting or taking a
screenshot, so add an API that forces the cursor tracker to track the
cursor position.

On the native backend this is a no-op as we by default always track the
cursor position anyway.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
b24b95db15 cursor-tracker: Only emit 'cursor-moved' if it moved
This makes it safe to update the position with the same coordinates
without risking 'cursor-moved' being emitted when nothing actually
moved.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
e1f25b7244 cursor-sprite: Don't NULL check realize_texture() vfunc
All non-abstract MetaCursorSprite type implementations implement this
function, so no need to NULL check it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
b319add04b cursor-renderer: Remove unneeded NULL check
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
3abbfef66e cursor-tracker: Add X11 cursor tracker backend
The intention is to use this to actively track the cursor position given
a fixed interval when needed, e.g. when screen casting.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
fcf7c4d0c7 cursor-renderer: Always keep the cursor overlay on the stage
Only when the cursor isn't handled by the backend is the overlay made
visible. This is intended to be used when painting the stage to an
offscreen using clutter_stage_paint_to_(frame)buffer() in a way where
the cursor is always included.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
d8be2a8b85 stage: Use g_list_foreach instead of manual for loop
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
f5958fa473 stage: Keep a pointer to the backend
Will be used later.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
c23b675daf cursor-tracker: Keep a pointer to the backend
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
59a2fc4f5a cursor-tracker: Move struct fields into instance private
This is so that we can make the cursor tracker type derivable.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
4a125e73a2 cursor-tracker: Move struct definition into .c file
Not used externally, and if so should use API.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1391
2020-08-05 11:11:38 +02:00
2de69cd3cc clutter-offscreen-effect: Invalidate cache on gl-video-memory-purged
This fixes graphics corruption that could occur on resume from suspend
with the Nvidia driver.

https://www.khronos.org/registry/OpenGL/extensions/NV/NV_robustness_video_memory_purge.txt

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1374
2020-08-05 08:26:37 +00:00
305fcd0713 clutter-stage: Add gl-video-memory-purged signal
For when you want parts of Clutter to connect to the signal, without
referencing Meta classes.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1374
2020-08-05 08:26:37 +00:00
7564c2f2e4 kms: Skip displays with 'non-desktop' property set
Detect displays marked as 'non-desktop' by the kernel and skip them when
creating the outputs. Mutter is not able to render images that are shown
properly on those devices anyway.

This avoids lighting up attached VR HMDs and showing the GDM login
screen between the eyes in a VR HMD instead of on the monitor.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1393
2020-08-05 06:09:36 +00:00
769997b0bc ci: Explicitly specify job dependencies
We can speed up CI a bit by allowing build jobs to run in parallel
with review jobs, and don't have test jobs wait for non-default
build configuration builds.

See https://gitlab.gnome.org/help/ci/yaml/README.md#needs for details.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1398
2020-08-04 18:00:04 +02:00
5ea0034943 renderer/native: Remove left-over comment
Since the frame clock split it's no longer valid, so remove it.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1397
2020-08-04 15:20:54 +02:00
4c513e3e19 backends/native: Remove unused meta_gpu_kms_wait_for_flip and more
Remove unused function `meta_gpu_kms_wait_for_flip` and other code which
only existed to support `meta_gpu_kms_wait_for_flip`.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1388
2020-08-04 08:57:06 +00:00
f3ad63e206 Remove unused flag COGL_WINSYS_FEATURE_SWAP_THROTTLE
This also removes an old comment about `wait_for_pending_flips` which
no longer exists.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1390
2020-08-04 08:43:57 +00:00
593e610415 clutter: Remove unused flag CLUTTER_FEATURE_SWAP_THROTTLE
It's been unused ever since e415cc538a.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1390
2020-08-04 08:43:57 +00:00
f894f5cc13 wayland: Add API to launch trusted clients
Allowing code from inside mutter to create a child process and
delegate on it some of its tasks is something very useful. This can
be done easily with the g_subprocess and g_subprocess_launcher classes
already available in GLib and GObject.

Unfortunately, although the child process can be a graphical program,
currently it is not possible for the inner code to identify the
windows created by the child in a secure manner (this is: being able
to ensure that a malicious program won't be able to trick the inner
code into thinking it is a child process launched by it).

Under X11 this is not a problem because any program has full control
over their windows, but under Wayland it is a different story: a
program can't neither force their window to be kept at the top (like a
docker program does) or at the bottom (like a program for desktop icons
does), nor hide it from the list of windows. This means that it is not
possible for a "classic", non-priviledged program, to fulfill these
tasks, and it can be done only from code inside mutter (like a
gnome-shell extension).

This is a non desirable situation, because an extension runs in the
same main loop than the whole desktop itself, which means that a
complex extension can need to do too much work inside the main loop,
and freeze the whole desktop for too much time. Also, it is important
to note that javascript doesn't have access to fork(), or threads,
which means that, at most, all the parallel computing that can do is
those available in the _async calls in GLib/GObject.

Also, having to create an extension for any priviledged graphical
element is an stopper for a lot of programmers who already know
GTK+ but doesn't know Clutter.

This patch wants to offer a solution to this problem, by offering a
new class that allows to launch a trusted child process from inside
mutter, and make it to use an specific UNIX socket to communicate
with the compositor. It also allows to check whether an specific
MetaWindow was created by one of this trusted child processes or not.

This allows to create extensions that launch a child process, and
when that process creates a window, the extension can confirm in a
secure way that the window really belongs to that process
launched by it, so it can give to that window "superpowers" like
being kept at the bottom of the desktop, not being listed in the
list of windows or shown in the Activities panel... Also, in future
versions, it could easily implement protocol extensions that only
could be used by these trusted child processes.

Several examples of the usefulness of this are that, with it, it
is possible to write programs that implements:

- desktop icons
- a dock
- a top or bottom bar
...

all in a secure manner, avoiding insecure programs to do the same.
In fact, even if the same code is launched manually, it won't have
those privileges, only the specific process launched from inside
mutter.

Since this is only needed under Wayland, it won't work under X11.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/741
2020-08-04 08:42:29 +00:00
17417a82a5 cleanup: remove controversial naming
Replace "whitelist" and "blacklist" with "allow_list" and "deny_list"
which better represent the purpose of those variables.

There is no functional change.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1396
2020-08-04 10:04:16 +02:00
5ed97f3a02 Update Catalan translation 2020-08-02 12:24:58 +02:00
34579d71cc remote-access-handle: Add 'is-recording' property
Will be TRUE if it is a screen cast session where all streams have the
'is-recording' set to TRUE. For other screen casts or remote desktop
sessions, it'll be FALSE.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1377
2020-07-31 10:41:38 +02:00
153357cd36 screen-cast: Add 'is-recording' option to record methods
This can be used by the Shell to change the UI to be the same as the
current built in screen recording.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1377
2020-07-31 10:41:15 +02:00
14cd78a016 screen-cast: Add screen cast flag to streams
Intended to be used to pass state from screen cast clients down the
line. The first use case will be a boolean whether a screen cast is a
plain recording or not, e.g. letting the Shell decide whether to use a
red dot as the icon, or the generic "sharing" symbol.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1377
2020-07-30 09:51:16 +02:00
109fbdbac9 clutter/actor: Add get_transformed_extents
The clutter_actor_get_transformed_position returns the position of the
top left point of the actor, with the actor transformations. That means
that if the actor is rotated 180º it'll return the "screen" position top
right.

Using this to calculate if the actor is in the screen is causing
problems when it's transformted.

This patch adds a new function clutter_actor_get_transformed_extents,
that will return the transformed actor bounding rect.

This new function is used on the update_stage_views so the actor will
get updated. this way rotated actors will be updated if they are on the
screen.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1386
2020-07-29 11:12:26 +02:00
2c08eb6d16 build: bump ABI to sysprof-capture-4
GLib will now be linking against sysprof-capture-4.a. To support that,
sysprof had to remove the GLib dependency from sysprof-capture-4 which
had the side-effect of breaking ABi.

This bumps the dependency and includes a fallback to compile just the
libsysprof-capture-4.a using a subproject wrap.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1352
2020-07-28 11:13:30 -07:00
ca64a308eb surface-actor: Restore drop shadow with server-side decorations
Commit 510cbef15a changed the logic in `handle_update()` for X11 window
actors to return early if the surface is not an X11 surface.

That works fine for plain Xorg, but on Xwayland, the surface is actually
a Wayland surface, therefore the function returns early before updating
the drop shadows of server-side decorations for X11 windows.

Change the test logic to restore drops shadows with Xwayland windows.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1384
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1358
2020-07-28 13:21:23 +00:00
d0ee02fae7 cleanup: Remove duplicate semicolons in C code
No functional change, it just hurts my eyes when reading the code.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1385
2020-07-28 10:32:46 +02:00
c7d14244b1 x11: Add STRING/UTF8_STRING targets for selection sources lacking them
The memory selection source was only providing the "text/plain" or the
"text/plain;charset=utf-8" mimetype, but not "STRING" or "UTF8_STRING",
which some X11 clients, like wine, are looking for. This was breaking
pasting from the clipboard in wine applications.

Fix this by adding those targets when they are missing and the selection
source provides the corresponding mimetypes.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1369
2020-07-27 08:34:40 +00:00
e1c4e55880 x11: Handle selection windows being destroyed before new selection
Wine destroys its old selection window immediately before creating a new
selection. This would trigger restoring the clipboard, which would
overwrite the new selection with the old one. The selection window
however can also be destroyed as part of the shutdown process of
applications, such as Chromium for example. In those cases we want the
clipboard to be restored after the selection window has been destroyed.

Solve this by not immediately restoring the clipboard but instead using
a timeout which can be canceled by any new selection owner, such as in
the Wine case.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1338
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1369
2020-07-27 08:34:40 +00:00
7b79fcee45 Fix segfaults on 32-bit systems.
The new "id" properties for the MetaCrtc* and MetaOuput* objects are 64-bit
values, so take care to pass 64-bit values when calling g_object_new.

Fixes https://gitlab.gnome.org/GNOME/mutter/-/issues/1343.
2020-07-24 11:24:08 +00:00
ac6990ef51 build: Depend on an up-to-date gsettings-desktop-schemas
Update the dependency as we use newer settings there.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3004

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1376
2020-07-21 12:54:42 +02:00
0aa4bab539 kms: Use custom page flip function when retrying failed flips
When using its EGLStream-based presentation path with the proprietary NVIDIA
driver, mutter will use a different function to process page flips -
custom_egl_stream_page_flip.  If that fails due to an EBUSY error, it will
attempt to retry the flip.  However, when retrying, it unconditionally uses the
libdrm-based path. In practice, this causes a segfault when attempting to
access plane_assignments->fb_id, since plane_assignments will be NULL in the
EGLStream case.  The issue can be reproduced reliably by VT-switching away from
GNOME and back again while an EGL application is running.

This patch has mutter also use the custom page flip function when retrying the
failed flip.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1375
2020-07-19 12:50:37 -07:00
224db78409 Update Brazilian Portuguese translation
(cherry picked from commit ef3dac7064)
2020-07-17 21:36:43 +00:00
7658e07beb Include the pkgconfig-specified gdesktop-enums.h
Instead of blindly hoping that `$INCLUDE` contains the parent directory
of `gsettings-desktop-schemas`.

Because `gsettings-desktop-schemas.pc` says:
```
Cflags: -I/SOME/DIRECTORY/gsettings-desktop-schemas
```
Which means to include the version that Meson has configured you need
to drop the directory prefix and only `#include <gdesktop-enums.h>`.

This fixes a build failure with local installs triggered by 775ec67a44
but it's also the right thing to do™.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1370
2020-07-13 17:30:20 +08:00
1faba58ccc Update Friulian translation 2020-07-12 16:35:03 +00:00
775ec67a44 Add tap-button-map and tap-and-drag-lock support to X11 and Wayland
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1319
2020-07-10 13:31:46 +00:00
d67ba3ea65 screen-cast/src: Remove follow up timeout source on disable
We failed to remove the timeout source when disabling, meaning that if a
follow up was scheduled, and shortly after we disabled the source, the
timeout would be invoked after the source was freed causing
use-after-free bugs.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1337

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1365
2020-07-10 09:08:59 +02:00
50634d450e screen-cast/src: Use G_USEC_PER_SEC instead of 1000000
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
2020-07-08 21:42:23 +02:00
9bab8e8751 screen-cast/src: Record follow up frame after timeout
During animation or other things that cause multiple frames in a row
being painted, we might skip recording frames if the max framerate is
reached.

Doing so means we might end up skipping the last frame in a series,
ending with the last frame we sent was not the last one, making things
appear to get stuck sometimes.

Handle this by creating a timeout if we ever throttle, and at the time
the timeout callback is triggered, make sure we eventually send an up to
date frame.

This is handle differently depending on the source type. A monitor
source type reports 1x1 pixel damage on each view its monitor overlaps,
while a window source type simply records a frame from the surface
directly, except without recording a timestamp, so that timestamps
always refer to when damage actually happened.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
2020-07-08 21:42:23 +02:00
7adc24d3a6 screen-cast/src: Fix signedness of timestamp field
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
2020-07-08 21:42:23 +02:00
047da80c3b screen-cast/src: Make record functions return an error when failing
Now that we don't use the record function to early out depending on
implicit state (don't record pixels if only cursor moved for example),
let it simply report an error when it fails, as we should no longer ever
return without pixels if nothing failed.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
2020-07-08 21:42:23 +02:00
882967d3ce screen-cast: Let the reason for recording determine what to record
E.g. we'll have pointer movement that, if no painting is already
scheduled, should only send new cursor metadata without any new pixel
buffer. When this happens, tell next step to not record the pixels if
this was the case, instead of having it rediscover this itself.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/1323
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
2020-07-08 21:42:23 +02:00
cea0722e72 screen-cast/src: Add flag to maybe_record()
Will later be used to make recording avoid recording actual pixel
content if e.g. only the cursor moved.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
2020-07-08 21:42:23 +02:00
03823128c4 screen-cast/window-stream-src: Fix indentation
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
2020-07-08 21:42:22 +02:00
7b35ed8c35 screen-cast-src: Make the two record vfuncs more similarly named
Both do more or less the same but with different methods - one puts
pixels into a buffer using the CPU, the other puts pixels into a buffer
using the GPU.

However, they are behaving slightly different, which they shouldn't.
Lets first address the misleading disconnect in naming, and later we'll
make them behave more similarly.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1361
2020-07-08 21:42:22 +02:00
ecaaccb064 background: Use NEAREST filtering when the texture is the monitor resolution
That was obviously always the intention, but it didn't work when the
display was scaled. My 3840x2160 monitor with a 3840x2160 texture was
being rendered with LINEAR filtering.

It seems the `force_bilinear` flag was TRUE when it should be FALSE.
Because a texture area that's an integer fraction of the texture
resolution is still a perfect match when that integer is the monitor
scale. We were also getting:

`meta_actor_painting_untransformed (fb, W, H, W, H, NULL, NULL) == FALSE`

when the display was scaled. Because the second W,H was not the real
sampling resolution. So with both of those issues fixed we now get
NEAREST filtering when the texture resolution matches the resolution it's
physically being rendered at.

Note: The background texture actually wasn't equal to the physical monitor
resolution prior to January 2020 (76240e24f7). So it wasn't possible to do
this before then. Since then however, the texture resolution is always
equal to the physical monitor resolution.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1346
2020-07-08 07:26:50 +00:00
290 changed files with 14629 additions and 11001 deletions

1
.gitignore vendored
View File

@ -103,3 +103,4 @@ doc/reference/meta.types
.dirstamp
**/tags.*
build/
subprojects/sysprof/

View File

@ -17,6 +17,7 @@ check-commit-log:
build-mutter:
stage: build
needs: []
script:
- meson . build -Dbuildtype=debugoptimized -Db_coverage=true -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
- ninja -C build
@ -31,6 +32,7 @@ build-mutter:
build-without-opengl-and-glx:
stage: build
needs: []
script:
- meson . build -Dbuildtype=debugoptimized -Dopengl=false -Dglx=false -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
- ninja -C build
@ -44,6 +46,7 @@ build-without-opengl-and-glx:
build-without-native-backend-and-wayland:
stage: build
needs: []
script:
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false -Dwayland=false -Dcore_tests=false --werror --prefix /usr
- ninja -C build
@ -59,6 +62,7 @@ test-mutter:
stage: test
dependencies:
- build-mutter
needs: ["build-mutter"]
variables:
XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
GSETTINGS_SCHEMA_DIR: "$CI_PROJECT_DIR/build/data"
@ -84,6 +88,7 @@ test-mutter-coverage:
stage: coverage
dependencies:
- test-mutter
needs: ["test-mutter"]
script:
- ninja -C build coverage
- cat build/meson-logs/coverage.txt
@ -100,6 +105,7 @@ can-build-gnome-shell:
stage: test
dependencies:
- build-mutter
needs: ["build-mutter"]
before_script:
- meson install --no-rebuild -C build
script:

View File

@ -17,6 +17,7 @@ RUN dnf -y update && dnf -y upgrade && \
# For running unit tests
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 \
'*/xvfb-run' gdm-lib accountsservice-libs gnome-control-center gcovr \
libnma python3-gobject python3-dbusmock \
--setopt=install_weak_deps=False && \
# GNOME Shell

27
NEWS
View File

@ -1,3 +1,30 @@
3.37.90
=======
* Fix using NEAREST filter for backgrounds on scaled monitors [Daniel V.; !1346]
* Screencast fixes and improvements [Jonas; !1361, !1377, !1391]
* Support tap-button-map and tap-drag-lock touchpad settings [Giusy; !1319]
* Fix wine copy & paste [Sebastian; !1369]
* Fix shadows of server-side decorated XWayland windows [Olivier; #1358]
* Replace some loaded terms with more descriptive ones [Olivier; !1396]
* Add API to launch trusted wayland clients [Sergio; #741]
* Skip displays with 'non-desktop' property set [Philipp; !1393]
* Invalidate offscreen effect cache on video memory purge [Daniel V.; !1374]
* Add wl_shm support for 10 bpc and 16 bpc half float formats [Jonas; !804]
* Fixed crashes [Jonas, Erik, Martin; !1365, !1375, #1343]
* Misc. bug fixes and cleanups [Daniel V., Carlos, Olivier, Christian,
Daniel * G., Jonas, Florian; !1370, !1376, !1385, !1352, !1386, !1390,
!1388, !1397, !1398, !1401]
Contributors:
Jonas Ådahl, Sergio Costas, Olivier Fourdan, Carlos Garnacho,
Christian Hergert, Sebastian Keller, Erik Kurzinger, Giusy Margarita,
Daniel García Moreno, Florian Müllner, Daniel van Vugt, Martin Whitaker,
Philipp Zabel
Translators:
Fabio Tomat [fur], Rafael Fontenelle [pt_BR], Jordi Mas [ca],
Yuri Chornoivan [uk], Alexandre Franke [fr]
3.37.3
======
* Support custom keyboard layouts in $XDG_CONFIG_HOME/xkb [Peter; !936]

View File

@ -1093,7 +1093,6 @@ static GQuark quark_scroll = 0;
static GQuark quark_stage = 0;
static GQuark quark_destroy = 0;
static GQuark quark_client = 0;
static GQuark quark_delete = 0;
static GQuark quark_touch = 0;
static GQuark quark_touchpad = 0;
static GQuark quark_proximity = 0;
@ -6003,7 +6002,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
quark_stage = g_quark_from_static_string ("stage");
quark_destroy = g_quark_from_static_string ("destroy");
quark_client = g_quark_from_static_string ("client");
quark_delete = g_quark_from_static_string ("delete");
quark_touch = g_quark_from_static_string ("touch");
quark_touchpad = g_quark_from_static_string ("touchpad");
quark_proximity = g_quark_from_static_string ("proximity");
@ -10295,6 +10293,38 @@ clutter_actor_get_fixed_position (ClutterActor *self,
return FALSE;
}
/**
* clutter_actor_get_transformed_extents:
* @self: A #ClutterActor
* @rect: (out): return location for the transformed bounding rect
*
* Gets the transformed bounding rect of an actor, in pixels relative to the stage.
*/
void
clutter_actor_get_transformed_extents (ClutterActor *self,
graphene_rect_t *rect)
{
graphene_quad_t quad;
graphene_point3d_t v[4];
ClutterActorBox box;
box.x1 = 0;
box.y1 = 0;
box.x2 = clutter_actor_box_get_width (&self->priv->allocation);
box.y2 = clutter_actor_box_get_height (&self->priv->allocation);
if (_clutter_actor_transform_and_project_box (self, &box, v))
{
graphene_quad_init (&quad,
(graphene_point_t *) &v[0],
(graphene_point_t *) &v[1],
(graphene_point_t *) &v[2],
(graphene_point_t *) &v[3]);
if (rect)
graphene_quad_bounds (&quad, rect);
}
}
/**
* clutter_actor_get_transformed_position:
* @self: A #ClutterActor
@ -12673,10 +12703,6 @@ clutter_actor_event (ClutterActor *actor,
signal_num = -1;
detail = quark_pad;
break;
case CLUTTER_DELETE:
signal_num = -1;
detail = quark_delete;
break;
case CLUTTER_DESTROY_NOTIFY:
signal_num = -1;
detail = quark_destroy;
@ -12689,6 +12715,9 @@ clutter_actor_event (ClutterActor *actor,
signal_num = -1;
detail = quark_stage;
break;
case CLUTTER_DEVICE_ADDED:
case CLUTTER_DEVICE_REMOVED:
break;
case CLUTTER_EVENT_LAST: /* Just keep compiler warnings quiet */
break;
}
@ -16183,12 +16212,7 @@ update_stage_views (ClutterActor *self)
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
g_return_if_fail (stage);
clutter_actor_get_transformed_position (self,
&bounding_rect.origin.x,
&bounding_rect.origin.y);
clutter_actor_get_transformed_size (self,
&bounding_rect.size.width,
&bounding_rect.size.height);
clutter_actor_get_transformed_extents (self, &bounding_rect);
if (bounding_rect.size.width == 0.0 ||
bounding_rect.size.height == 0.0)
@ -16327,15 +16351,19 @@ clutter_actor_is_effectively_on_stage_view (ClutterActor *self,
}
/**
* clutter_actor_pick_frame_clock:
* clutter_actor_pick_frame_clock: (skip)
* @self: a #ClutterActor
* @out_actor: (nullable): a pointer to an #ClutterActor
*
* Pick the most suitable frame clock for driving animations for this actor.
*
* The #ClutterActor used for picking the frame clock is written @out_actor.
*
* Returns: (transfer none): a #ClutterFrameClock
*/
ClutterFrameClock *
clutter_actor_pick_frame_clock (ClutterActor *self)
clutter_actor_pick_frame_clock (ClutterActor *self,
ClutterActor **out_actor)
{
ClutterActorPrivate *priv = self->priv;
float max_refresh_rate = 0.0;
@ -16345,7 +16373,7 @@ clutter_actor_pick_frame_clock (ClutterActor *self)
if (!priv->stage_views)
{
if (priv->parent)
return clutter_actor_pick_frame_clock (priv->parent);
return clutter_actor_pick_frame_clock (priv->parent, out_actor);
else
return NULL;
}
@ -16364,9 +16392,15 @@ clutter_actor_pick_frame_clock (ClutterActor *self)
}
if (best_view)
return clutter_stage_view_get_frame_clock (best_view);
{
if (out_actor)
*out_actor = self;
return clutter_stage_view_get_frame_clock (best_view);
}
else
return NULL;
{
return NULL;
}
}
/**

View File

@ -813,6 +813,11 @@ void clutter_actor_set_child_transform
CLUTTER_EXPORT
void clutter_actor_get_child_transform (ClutterActor *self,
ClutterMatrix *transform);
CLUTTER_EXPORT
void clutter_actor_get_transformed_extents (ClutterActor *self,
graphene_rect_t *rect);
CLUTTER_EXPORT
void clutter_actor_get_transformed_position (ClutterActor *self,
gfloat *x,
@ -930,9 +935,6 @@ GList * clutter_actor_peek_stage_views (ClutterActor *self);
CLUTTER_EXPORT
void clutter_actor_invalidate_transform (ClutterActor *self);
CLUTTER_EXPORT
ClutterFrameClock * clutter_actor_pick_frame_clock (ClutterActor *self);
G_END_DECLS
#endif /* __CLUTTER_ACTOR_H__ */

View File

@ -93,6 +93,8 @@ struct _ClutterBackendClass
ClutterSeat * (* get_default_seat) (ClutterBackend *backend);
gboolean (* is_display_server) (ClutterBackend *backend);
/* signals */
void (* resolution_changed) (ClutterBackend *backend);
void (* font_changed) (ClutterBackend *backend);
@ -142,6 +144,8 @@ void clutter_backend_set_fallback_resource_scale (ClutterBackend *backend,
float clutter_backend_get_fallback_resource_scale (ClutterBackend *backend);
gboolean clutter_backend_is_display_server (ClutterBackend *backend);
G_END_DECLS
#endif /* __CLUTTER_BACKEND_PRIVATE_H__ */

View File

@ -58,13 +58,6 @@
#include <cogl/cogl.h>
#ifdef CLUTTER_INPUT_X11
#include "x11/clutter-backend-x11.h"
#endif
#ifdef CLUTTER_WINDOWING_EGL
#include "egl/clutter-backend-eglnative.h"
#endif
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
#include <cogl/cogl-wayland-server.h>
#include <wayland-server.h>
@ -422,14 +415,6 @@ clutter_backend_real_get_features (ClutterBackend *backend)
flags |= CLUTTER_FEATURE_STAGE_STATIC;
}
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_THROTTLE))
{
CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers throttling");
flags |= CLUTTER_FEATURE_SWAP_THROTTLE;
}
else
CLUTTER_NOTE (BACKEND, "Cogl doesn't support swap buffers throttling");
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT))
{
CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers complete events");
@ -439,23 +424,8 @@ clutter_backend_real_get_features (ClutterBackend *backend)
return flags;
}
static const char *allowed_backends;
static ClutterBackend * (* custom_backend_func) (void);
static const struct {
const char *name;
ClutterBackend * (* create_backend) (void);
} available_backends[] = {
#ifdef CLUTTER_WINDOWING_X11
{ CLUTTER_WINDOWING_X11, clutter_backend_x11_new },
#endif
#ifdef CLUTTER_WINDOWING_EGL
{ CLUTTER_WINDOWING_EGL, clutter_backend_egl_native_new },
#endif
{ NULL, NULL },
};
void
clutter_set_custom_backend_func (ClutterBackend *(* func) (void))
{
@ -465,58 +435,13 @@ clutter_set_custom_backend_func (ClutterBackend *(* func) (void))
ClutterBackend *
_clutter_create_backend (void)
{
const char *backends_list;
ClutterBackend *retval;
gboolean allow_any;
char **backends;
int i;
if (custom_backend_func)
{
retval = custom_backend_func ();
g_return_val_if_fail (custom_backend_func, NULL);
if (!retval)
g_error ("Failed to create custom backend.");
return retval;
}
if (allowed_backends == NULL)
allowed_backends = "*";
allow_any = strstr (allowed_backends, "*") != NULL;
backends_list = g_getenv ("CLUTTER_BACKEND");
if (backends_list == NULL)
backends_list = allowed_backends;
backends = g_strsplit (backends_list, ",", 0);
retval = NULL;
for (i = 0; retval == NULL && backends[i] != NULL; i++)
{
const char *backend = backends[i];
gboolean is_any = g_str_equal (backend, "*");
int j;
for (j = 0; available_backends[j].name != NULL; j++)
{
if ((is_any && allow_any) ||
(is_any && strstr (allowed_backends, available_backends[j].name)) ||
g_str_equal (backend, available_backends[j].name))
{
retval = available_backends[j].create_backend ();
if (retval != NULL)
break;
}
}
}
g_strfreev (backends);
if (retval == NULL)
g_error ("No default Clutter backend found.");
retval = custom_backend_func ();
if (!retval)
g_error ("Failed to create custom backend.");
return retval;
}
@ -1046,3 +971,9 @@ clutter_backend_get_fallback_resource_scale (ClutterBackend *backend)
{
return backend->fallback_resource_scale;
}
gboolean
clutter_backend_is_display_server (ClutterBackend *backend)
{
return CLUTTER_BACKEND_GET_CLASS (backend)->is_display_server (backend);
}

View File

@ -387,44 +387,6 @@ typedef enum
CLUTTER_MODIFIER_MASK = 0x5c001fff
} ClutterModifierType;
/**
* ClutterKeyboardA11yFlags:
* @CLUTTER_A11Y_KEYBOARD_ENABLED:
* @CLUTTER_A11Y_TIMEOUT_ENABLED:
* @CLUTTER_A11Y_MOUSE_KEYS_ENABLED:
* @CLUTTER_A11Y_SLOW_KEYS_ENABLED:
* @CLUTTER_A11Y_SLOW_KEYS_BEEP_PRESS:
* @CLUTTER_A11Y_SLOW_KEYS_BEEP_ACCEPT:
* @CLUTTER_A11Y_SLOW_KEYS_BEEP_REJECT:
* @CLUTTER_A11Y_BOUNCE_KEYS_ENABLED:
* @CLUTTER_A11Y_BOUNCE_KEYS_BEEP_REJECT:
* @CLUTTER_A11Y_TOGGLE_KEYS_ENABLED:
* @CLUTTER_A11Y_STICKY_KEYS_ENABLED:
* @CLUTTER_A11Y_STICKY_KEYS_TWO_KEY_OFF:
* @CLUTTER_A11Y_STICKY_KEYS_BEEP:
* @CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP:
*
* Keyboard accessibility features applied to a ClutterInputDevice keyboard.
*
*/
typedef enum
{
CLUTTER_A11Y_KEYBOARD_ENABLED = 1 << 0,
CLUTTER_A11Y_TIMEOUT_ENABLED = 1 << 1,
CLUTTER_A11Y_MOUSE_KEYS_ENABLED = 1 << 2,
CLUTTER_A11Y_SLOW_KEYS_ENABLED = 1 << 3,
CLUTTER_A11Y_SLOW_KEYS_BEEP_PRESS = 1 << 4,
CLUTTER_A11Y_SLOW_KEYS_BEEP_ACCEPT = 1 << 5,
CLUTTER_A11Y_SLOW_KEYS_BEEP_REJECT = 1 << 6,
CLUTTER_A11Y_BOUNCE_KEYS_ENABLED = 1 << 7,
CLUTTER_A11Y_BOUNCE_KEYS_BEEP_REJECT = 1 << 8,
CLUTTER_A11Y_TOGGLE_KEYS_ENABLED = 1 << 9,
CLUTTER_A11Y_STICKY_KEYS_ENABLED = 1 << 10,
CLUTTER_A11Y_STICKY_KEYS_TWO_KEY_OFF = 1 << 11,
CLUTTER_A11Y_STICKY_KEYS_BEEP = 1 << 12,
CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP = 1 << 13,
} ClutterKeyboardA11yFlags;
/**
* ClutterPointerA11yFlags:
* @CLUTTER_A11Y_POINTER_ENABLED:
@ -857,7 +819,6 @@ typedef enum /*< flags prefix=CLUTTER_EVENT >*/
* @CLUTTER_STAGE_STATE: Stage state change event
* @CLUTTER_DESTROY_NOTIFY: Destroy notification event
* @CLUTTER_CLIENT_MESSAGE: Client message event
* @CLUTTER_DELETE: Stage delete event
* @CLUTTER_TOUCH_BEGIN: A new touch event sequence has started;
* event added in 1.10
* @CLUTTER_TOUCH_UPDATE: A touch event sequence has been updated;
@ -895,7 +856,6 @@ typedef enum /*< prefix=CLUTTER >*/
CLUTTER_STAGE_STATE,
CLUTTER_DESTROY_NOTIFY,
CLUTTER_CLIENT_MESSAGE,
CLUTTER_DELETE,
CLUTTER_TOUCH_BEGIN,
CLUTTER_TOUCH_UPDATE,
CLUTTER_TOUCH_END,
@ -908,6 +868,8 @@ typedef enum /*< prefix=CLUTTER >*/
CLUTTER_PAD_BUTTON_RELEASE,
CLUTTER_PAD_STRIP,
CLUTTER_PAD_RING,
CLUTTER_DEVICE_ADDED,
CLUTTER_DEVICE_REMOVED,
CLUTTER_EVENT_LAST /* helper */
} ClutterEventType;
@ -951,7 +913,6 @@ typedef enum
/**
* ClutterFeatureFlags:
* @CLUTTER_FEATURE_SWAP_THROTTLE: Set if backend throttles buffer swaps.
* @CLUTTER_FEATURE_STAGE_STATIC: Set if stage size if fixed (i.e framebuffer)
* @CLUTTER_FEATURE_STAGE_CURSOR: Set if stage has a graphical cursor.
* @CLUTTER_FEATURE_SHADERS_GLSL: Set if the backend supports GLSL shaders.
@ -966,7 +927,6 @@ typedef enum
*/
typedef enum
{
CLUTTER_FEATURE_SWAP_THROTTLE = (1 << 3),
CLUTTER_FEATURE_STAGE_STATIC = (1 << 6),
CLUTTER_FEATURE_STAGE_CURSOR = (1 << 8),
CLUTTER_FEATURE_SHADERS_GLSL = (1 << 9),
@ -1634,12 +1594,6 @@ typedef enum
CLUTTER_INPUT_DEVICE_PAD_SOURCE_FINGER,
} ClutterInputDevicePadSource;
typedef enum
{
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE,
CLUTTER_INPUT_DEVICE_MAPPING_RELATIVE,
} ClutterInputDeviceMapping;
typedef enum
{
CLUTTER_INPUT_CONTENT_HINT_COMPLETION = 1 << 0,

View File

@ -407,7 +407,6 @@ clutter_event_get_position (const ClutterEvent *event,
case CLUTTER_STAGE_STATE:
case CLUTTER_DESTROY_NOTIFY:
case CLUTTER_CLIENT_MESSAGE:
case CLUTTER_DELETE:
case CLUTTER_EVENT_LAST:
case CLUTTER_PROXIMITY_IN:
case CLUTTER_PROXIMITY_OUT:
@ -415,6 +414,8 @@ clutter_event_get_position (const ClutterEvent *event,
case CLUTTER_PAD_BUTTON_RELEASE:
case CLUTTER_PAD_STRIP:
case CLUTTER_PAD_RING:
case CLUTTER_DEVICE_ADDED:
case CLUTTER_DEVICE_REMOVED:
graphene_point_init (position, 0.f, 0.f);
break;
@ -481,7 +482,6 @@ clutter_event_set_coords (ClutterEvent *event,
case CLUTTER_STAGE_STATE:
case CLUTTER_DESTROY_NOTIFY:
case CLUTTER_CLIENT_MESSAGE:
case CLUTTER_DELETE:
case CLUTTER_EVENT_LAST:
case CLUTTER_PROXIMITY_IN:
case CLUTTER_PROXIMITY_OUT:
@ -489,6 +489,8 @@ clutter_event_set_coords (ClutterEvent *event,
case CLUTTER_PAD_BUTTON_RELEASE:
case CLUTTER_PAD_STRIP:
case CLUTTER_PAD_RING:
case CLUTTER_DEVICE_ADDED:
case CLUTTER_DEVICE_REMOVED:
break;
case CLUTTER_ENTER:
@ -1105,7 +1107,6 @@ clutter_event_set_device (ClutterEvent *event,
case CLUTTER_STAGE_STATE:
case CLUTTER_DESTROY_NOTIFY:
case CLUTTER_CLIENT_MESSAGE:
case CLUTTER_DELETE:
case CLUTTER_EVENT_LAST:
break;
@ -1161,6 +1162,11 @@ clutter_event_set_device (ClutterEvent *event,
case CLUTTER_PAD_RING:
event->pad_ring.device = device;
break;
case CLUTTER_DEVICE_ADDED:
case CLUTTER_DEVICE_REMOVED:
event->device.device = device;
break;
}
}
@ -1202,7 +1208,6 @@ clutter_event_get_device (const ClutterEvent *event)
case CLUTTER_STAGE_STATE:
case CLUTTER_DESTROY_NOTIFY:
case CLUTTER_CLIENT_MESSAGE:
case CLUTTER_DELETE:
case CLUTTER_EVENT_LAST:
break;
@ -1258,6 +1263,11 @@ clutter_event_get_device (const ClutterEvent *event)
case CLUTTER_PAD_RING:
device = event->pad_ring.device;
break;
case CLUTTER_DEVICE_ADDED:
case CLUTTER_DEVICE_REMOVED:
device = event->device.device;
break;
}
return device;
@ -1411,6 +1421,8 @@ clutter_event_copy (const ClutterEvent *event)
sizeof (gdouble) * n_axes);
break;
case CLUTTER_DEVICE_ADDED:
case CLUTTER_DEVICE_REMOVED:
default:
break;
}
@ -1465,6 +1477,9 @@ clutter_event_free (ClutterEvent *event)
case CLUTTER_TOUCH_CANCEL:
g_free (event->touch.axes);
break;
case CLUTTER_DEVICE_ADDED:
case CLUTTER_DEVICE_REMOVED:
break;
default:
break;
@ -1489,40 +1504,17 @@ ClutterEvent *
clutter_event_get (void)
{
ClutterMainContext *context = _clutter_context_get_default ();
ClutterEvent *event;
if (context->events_queue == NULL)
return NULL;
event = g_async_queue_try_pop (context->events_queue);
if (g_queue_is_empty (context->events_queue))
return NULL;
return g_queue_pop_tail (context->events_queue);
return event;
}
/**
* clutter_event_peek:
*
* Returns a pointer to the first event from the event queue but
* does not remove it.
*
* Return value: (transfer none): A #ClutterEvent or NULL if queue empty.
*
* Since: 0.4
*/
ClutterEvent *
clutter_event_peek (void)
static gboolean
spin_context (gpointer data)
{
ClutterMainContext *context = _clutter_context_get_default ();
g_return_val_if_fail (context != NULL, NULL);
if (context->events_queue == NULL)
return NULL;
if (g_queue_is_empty (context->events_queue))
return NULL;
return g_queue_peek_tail (context->events_queue);
return G_SOURCE_REMOVE;
}
void
@ -1530,21 +1522,9 @@ _clutter_event_push (const ClutterEvent *event,
gboolean do_copy)
{
ClutterMainContext *context = _clutter_context_get_default ();
ClutterInputDevice *device;
g_assert (context != NULL);
if (context->events_queue == NULL)
context->events_queue = g_queue_new ();
/* disabled devices don't propagate events */
device = clutter_event_get_device (event);
if (device != NULL)
{
if (!clutter_input_device_get_enabled (device))
return;
}
if (do_copy)
{
ClutterEvent *copy;
@ -1553,7 +1533,8 @@ _clutter_event_push (const ClutterEvent *event,
event = copy;
}
g_queue_push_head (context->events_queue, (gpointer) event);
g_async_queue_push (context->events_queue, (gpointer) event);
g_idle_add (spin_context, NULL);
}
/**
@ -1590,10 +1571,7 @@ clutter_events_pending (void)
g_return_val_if_fail (context != NULL, FALSE);
if (context->events_queue == NULL)
return FALSE;
return g_queue_is_empty (context->events_queue) == FALSE;
return g_async_queue_length (context->events_queue) > 0;
}
/**
@ -1725,7 +1703,6 @@ clutter_event_get_axes (const ClutterEvent *event,
case CLUTTER_STAGE_STATE:
case CLUTTER_DESTROY_NOTIFY:
case CLUTTER_CLIENT_MESSAGE:
case CLUTTER_DELETE:
case CLUTTER_ENTER:
case CLUTTER_LEAVE:
case CLUTTER_KEY_PRESS:
@ -1733,6 +1710,8 @@ clutter_event_get_axes (const ClutterEvent *event,
case CLUTTER_EVENT_LAST:
case CLUTTER_PROXIMITY_IN:
case CLUTTER_PROXIMITY_OUT:
case CLUTTER_DEVICE_ADDED:
case CLUTTER_DEVICE_REMOVED:
break;
case CLUTTER_SCROLL:

View File

@ -121,6 +121,7 @@ typedef struct _ClutterProximityEvent ClutterProximityEvent;
typedef struct _ClutterPadButtonEvent ClutterPadButtonEvent;
typedef struct _ClutterPadStripEvent ClutterPadStripEvent;
typedef struct _ClutterPadRingEvent ClutterPadRingEvent;
typedef struct _ClutterDeviceEvent ClutterDeviceEvent;
/**
* ClutterAnyEvent:
@ -544,6 +545,17 @@ struct _ClutterPadRingEvent
guint32 mode;
};
struct _ClutterDeviceEvent
{
ClutterEventType type;
guint32 time;
ClutterEventFlags flags;
ClutterStage *stage;
ClutterActor *source;
ClutterInputDevice *device;
};
/**
* ClutterEvent:
*
@ -570,6 +582,7 @@ union _ClutterEvent
ClutterPadButtonEvent pad_button;
ClutterPadStripEvent pad_strip;
ClutterPadRingEvent pad_ring;
ClutterDeviceEvent device;
};
/**
@ -601,8 +614,6 @@ gboolean clutter_events_pending (void);
CLUTTER_EXPORT
ClutterEvent * clutter_event_get (void);
CLUTTER_EXPORT
ClutterEvent * clutter_event_peek (void);
CLUTTER_EXPORT
void clutter_event_put (const ClutterEvent *event);
CLUTTER_EXPORT

View File

@ -514,7 +514,7 @@ clutter_frame_clock_destroy (ClutterFrameClock *frame_clock)
static void
clutter_frame_clock_dispose (GObject *object)
{
ClutterFrameClock *frame_clock = CLUTTER_FRAME_CLOCK (object);
ClutterFrameClock *frame_clock = CLUTTER_FRAME_CLOCK (object);
if (frame_clock->source)
{

View File

@ -61,15 +61,6 @@ typedef struct _ClutterScrollInfo
guint last_value_valid : 1;
} ClutterScrollInfo;
typedef struct _ClutterTouchInfo
{
ClutterEventSequence *sequence;
ClutterActor *actor;
float current_x;
float current_y;
} ClutterTouchInfo;
typedef struct _ClutterPtrA11yData
{
int n_btn_pressed;
@ -120,25 +111,18 @@ struct _ClutterInputDevice
/* the current click count */
int click_count;
/* the stage the device is on */
ClutterStage *stage;
/* the current state */
float current_x;
float current_y;
uint32_t current_time;
int current_button_number;
ClutterModifierType current_state;
/* the current touch points states */
GHashTable *touch_sequences_info;
/* the current touch points targets */
GHashTable *touch_sequence_actors;
/* the previous state, used for click count generation */
int previous_x;
int previous_y;
uint32_t previous_time;
int previous_button_number;
ClutterModifierType previous_state;
GArray *axes;
@ -157,8 +141,6 @@ struct _ClutterInputDevice
int n_strips;
int n_mode_groups;
ClutterInputDeviceMapping mapping_mode;
guint has_cursor : 1;
guint is_enabled : 1;
@ -180,33 +162,11 @@ CLUTTER_EXPORT
void clutter_input_device_update_from_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
CLUTTER_EXPORT
ClutterStage * _clutter_input_device_get_stage (ClutterInputDevice *device);
CLUTTER_EXPORT
void _clutter_input_device_set_stage (ClutterInputDevice *device,
ClutterStage *stage);
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_);
void _clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterActor *actor,
gboolean emit_crossing);
CLUTTER_EXPORT
ClutterActor * clutter_input_device_update (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gboolean emit_crossing);
CLUTTER_EXPORT
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
ClutterEventSequence *sequence,
ClutterStage *stage,
gboolean emit_crossing,
ClutterEvent *for_event);
CLUTTER_EXPORT
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
ClutterEvent *event);
@ -214,6 +174,12 @@ CLUTTER_EXPORT
void _clutter_input_device_set_n_keys (ClutterInputDevice *device,
guint n_keys);
CLUTTER_EXPORT
void clutter_input_device_set_key (ClutterInputDevice *device,
guint index_,
guint keyval,
ClutterModifierType modifiers);
CLUTTER_EXPORT
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
guint index_,
gdouble value,
@ -252,4 +218,9 @@ ClutterInputDeviceTool *
guint64 serial,
ClutterInputDeviceToolType type);
CLUTTER_EXPORT
gboolean clutter_input_device_keycode_to_evdev (ClutterInputDevice *device,
guint hardware_keycode,
guint *evdev_keycode);
#endif /* CLUTTER_INPUT_DEVICE_PRIVATE_H */

View File

@ -61,7 +61,6 @@ enum
PROP_DEVICE_MODE,
PROP_HAS_CURSOR,
PROP_ENABLED,
PROP_N_AXES,
@ -72,12 +71,10 @@ enum
PROP_N_RINGS,
PROP_N_MODE_GROUPS,
PROP_DEVICE_NODE,
PROP_MAPPING_MODE,
PROP_LAST
};
static void _clutter_input_device_free_touch_info (gpointer data);
static void on_cursor_actor_destroy (ClutterActor *actor,
ClutterInputDevice *device);
static void on_cursor_actor_reactive_changed (ClutterActor *actor,
@ -114,7 +111,7 @@ clutter_input_device_dispose (GObject *gobject)
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);
g_clear_pointer (&device->touch_sequences_info, g_hash_table_unref);
g_clear_pointer (&device->touch_sequence_actors, g_hash_table_unref);
if (device->cursor_actor)
{
@ -191,10 +188,6 @@ clutter_input_device_set_property (GObject *gobject,
self->has_cursor = g_value_get_boolean (value);
break;
case PROP_ENABLED:
clutter_input_device_set_enabled (self, g_value_get_boolean (value));
break;
case PROP_VENDOR_ID:
self->vendor_id = g_value_dup_string (value);
break;
@ -219,10 +212,6 @@ clutter_input_device_set_property (GObject *gobject,
self->node_path = g_value_dup_string (value);
break;
case PROP_MAPPING_MODE:
self->mapping_mode = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -271,10 +260,6 @@ clutter_input_device_get_property (GObject *gobject,
g_value_set_uint (value, clutter_input_device_get_n_axes (self));
break;
case PROP_ENABLED:
g_value_set_boolean (value, self->is_enabled);
break;
case PROP_VENDOR_ID:
g_value_set_string (value, self->vendor_id);
break;
@ -299,10 +284,6 @@ clutter_input_device_get_property (GObject *gobject,
g_value_set_string (value, self->node_path);
break;
case PROP_MAPPING_MODE:
g_value_set_enum (value, self->mapping_mode);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -402,25 +383,6 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
FALSE,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
/**
* ClutterInputDevice:enabled:
*
* Whether the device is enabled.
*
* A device with the #ClutterInputDevice:device-mode property set
* to %CLUTTER_INPUT_MODE_MASTER cannot be disabled.
*
* A device must be enabled in order to receive events from it.
*
* Since: 1.6
*/
obj_props[PROP_ENABLED] =
g_param_spec_boolean ("enabled",
P_("Enabled"),
P_("Whether the device is enabled"),
FALSE,
CLUTTER_PARAM_READWRITE);
/**
* ClutterInputDevice:n-axes:
*
@ -506,14 +468,6 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
NULL,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
obj_props[PROP_MAPPING_MODE] =
g_param_spec_enum ("mapping-mode",
P_("Device mapping mode"),
P_("Device mapping mode"),
CLUTTER_TYPE_INPUT_DEVICE_MAPPING,
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE,
CLUTTER_PARAM_READWRITE);
gobject_class->dispose = clutter_input_device_dispose;
gobject_class->set_property = clutter_input_device_set_property;
gobject_class->get_property = clutter_input_device_get_property;
@ -528,91 +482,15 @@ clutter_input_device_init (ClutterInputDevice *self)
self->click_count = 0;
self->current_time = self->previous_time = CLUTTER_CURRENT_TIME;
self->current_x = self->previous_x = -1;
self->current_y = self->previous_y = -1;
self->previous_time = CLUTTER_CURRENT_TIME;
self->previous_x = -1;
self->previous_y = -1;
self->current_button_number = self->previous_button_number = -1;
self->current_state = self->previous_state = 0;
self->touch_sequences_info =
g_hash_table_new_full (NULL, NULL,
NULL, _clutter_input_device_free_touch_info);
self->touch_sequence_actors = g_hash_table_new (NULL, NULL);
self->inv_touch_sequence_actors = g_hash_table_new (NULL, NULL);
}
static ClutterTouchInfo *
_clutter_input_device_ensure_touch_info (ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterStage *stage)
{
ClutterTouchInfo *info;
info = g_hash_table_lookup (device->touch_sequences_info, sequence);
if (info == NULL)
{
info = g_slice_new0 (ClutterTouchInfo);
info->sequence = sequence;
g_hash_table_insert (device->touch_sequences_info, sequence, info);
if (g_hash_table_size (device->touch_sequences_info) == 1)
_clutter_input_device_set_stage (device, stage);
}
return info;
}
/*< private >
* clutter_input_device_set_coords:
* @device: a #ClutterInputDevice
* @sequence: a #ClutterEventSequence or NULL
* @x: X coordinate of the device
* @y: Y coordinate of the device
*
* Stores the last known coordinates of the device
*/
void
_clutter_input_device_set_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gfloat x,
gfloat y,
ClutterStage *stage)
{
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
if (sequence == NULL)
{
if (device->current_x != x)
device->current_x = x;
if (device->current_y != y)
device->current_y = y;
}
else
{
ClutterTouchInfo *info;
info = _clutter_input_device_ensure_touch_info (device, sequence, stage);
info->current_x = x;
info->current_y = y;
}
}
/*< private >
* clutter_input_device_set_state:
* @device: a #ClutterInputDevice
* @state: a bitmask of modifiers
*
* Stores the last known modifiers state of the device
*/
void
_clutter_input_device_set_state (ClutterInputDevice *device,
ClutterModifierType state)
{
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
device->current_state = state;
}
/**
* clutter_input_device_get_modifier_state:
* @device: a #ClutterInputDevice
@ -627,69 +505,17 @@ _clutter_input_device_set_state (ClutterInputDevice *device,
ClutterModifierType
clutter_input_device_get_modifier_state (ClutterInputDevice *device)
{
uint32_t modifiers;
ClutterSeat *seat;
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
return device->current_state;
}
seat = clutter_input_device_get_seat (device);
/*< private >
* clutter_input_device_set_time:
* @device: a #ClutterInputDevice
* @time_: the time
*
* Stores the last known event time of the device
*/
void
_clutter_input_device_set_time (ClutterInputDevice *device,
guint32 time_)
{
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
if (!clutter_seat_query_state (seat, device, NULL, NULL, &modifiers))
return 0;
if (device->current_time != time_)
device->current_time = time_;
}
/*< private >
* clutter_input_device_set_stage:
* @device: a #ClutterInputDevice
* @stage: a #ClutterStage or %NULL
*
* Stores the stage under the device
*/
void
_clutter_input_device_set_stage (ClutterInputDevice *device,
ClutterStage *stage)
{
if (device->stage == stage)
return;
device->stage = stage;
/* we leave the ->cursor_actor in place in order to check
* if we left the stage without crossing it again; this way
* we can emit a leave event on the cursor actor right before
* we emit the leave event on the stage.
*/
}
/*< private >
* clutter_input_device_get_stage:
* @device: a #ClutterInputDevice
*
* Retrieves the stage currently associated with @device.
*
* Return value: The stage currently associated with @device.
*/
ClutterStage *
_clutter_input_device_get_stage (ClutterInputDevice *device)
{
return device->stage;
}
static void
_clutter_input_device_free_touch_info (gpointer data)
{
g_slice_free (ClutterTouchInfo, data);
return modifiers;
}
static void
@ -703,12 +529,8 @@ _clutter_input_device_associate_actor (ClutterInputDevice *device,
{
GList *sequences =
g_hash_table_lookup (device->inv_touch_sequence_actors, actor);
ClutterTouchInfo *info;
ClutterStage *stage = CLUTTER_STAGE (clutter_actor_get_stage (actor));
info = _clutter_input_device_ensure_touch_info (device, sequence, stage);
info->actor = actor;
g_hash_table_insert (device->touch_sequence_actors, sequence, actor);
g_hash_table_insert (device->inv_touch_sequence_actors,
actor, g_list_prepend (sequences, sequence));
}
@ -736,13 +558,7 @@ _clutter_input_device_unassociate_actor (ClutterInputDevice *device,
actor);
for (l = sequences; l != NULL; l = l->next)
{
ClutterTouchInfo *info =
g_hash_table_lookup (device->touch_sequences_info, l->data);
if (info)
info->actor = NULL;
}
g_hash_table_remove (device->touch_sequence_actors, l->data);
g_list_free (sequences);
g_hash_table_remove (device->inv_touch_sequence_actors, actor);
@ -795,17 +611,31 @@ on_cursor_actor_reactive_changed (ClutterActor *actor,
* - set to %TRUE the :has-pointer property of the new pointer
* actor
*/
void
static void
_clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterActor *actor,
gboolean emit_crossing)
gboolean emit_crossing,
graphene_point_t coords,
uint32_t time_)
{
ClutterActor *old_actor = clutter_input_device_get_actor (device, sequence);
ClutterStage *stage = NULL;
if (old_actor == actor)
return;
if (emit_crossing)
{
if (actor)
stage = CLUTTER_STAGE (clutter_actor_get_stage (actor));
else if (old_actor)
stage = CLUTTER_STAGE (clutter_actor_get_stage (old_actor));
if (!stage)
return;
}
if (old_actor != NULL)
{
ClutterActor *tmp_old_actor;
@ -815,12 +645,12 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEvent *event;
event = clutter_event_new (CLUTTER_LEAVE);
event->crossing.time = device->current_time;
event->crossing.time = time_;
event->crossing.flags = 0;
event->crossing.stage = device->stage;
event->crossing.stage = stage;
event->crossing.source = old_actor;
event->crossing.x = device->current_x;
event->crossing.y = device->current_y;
event->crossing.x = coords.x;
event->crossing.y = coords.y;
event->crossing.related = actor;
event->crossing.sequence = sequence;
clutter_event_set_device (event, device);
@ -852,11 +682,11 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
ClutterEvent *event;
event = clutter_event_new (CLUTTER_ENTER);
event->crossing.time = device->current_time;
event->crossing.time = time_;
event->crossing.flags = 0;
event->crossing.stage = device->stage;
event->crossing.x = device->current_x;
event->crossing.y = device->current_y;
event->crossing.stage = stage;
event->crossing.x = coords.x;
event->crossing.y = coords.y;
event->crossing.source = actor;
event->crossing.related = old_actor;
event->crossing.sequence = sequence;
@ -907,56 +737,6 @@ clutter_input_device_get_device_id (ClutterInputDevice *device)
return device->id;
}
/**
* clutter_input_device_set_enabled:
* @device: a #ClutterInputDevice
* @enabled: %TRUE to enable the @device
*
* Enables or disables a #ClutterInputDevice.
*
* Only devices with a #ClutterInputDevice:device-mode property set
* to %CLUTTER_INPUT_MODE_SLAVE or %CLUTTER_INPUT_MODE_FLOATING can
* be disabled.
*
* Since: 1.6
*/
void
clutter_input_device_set_enabled (ClutterInputDevice *device,
gboolean enabled)
{
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
enabled = !!enabled;
if (!enabled && device->device_mode == CLUTTER_INPUT_MODE_MASTER)
return;
if (device->is_enabled == enabled)
return;
device->is_enabled = enabled;
g_object_notify_by_pspec (G_OBJECT (device), obj_props[PROP_ENABLED]);
}
/**
* clutter_input_device_get_enabled:
* @device: a #ClutterInputDevice
*
* Retrieves whether @device is enabled.
*
* Return value: %TRUE if the device is enabled
*
* Since: 1.6
*/
gboolean
clutter_input_device_get_enabled (ClutterInputDevice *device)
{
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
return device->is_enabled;
}
/**
* clutter_input_device_get_coords:
* @device: a #ClutterInputDevice
@ -978,27 +758,14 @@ clutter_input_device_get_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
graphene_point_t *point)
{
ClutterSeat *seat;
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
g_return_val_if_fail (point != NULL, FALSE);
if (sequence == NULL)
{
point->x = device->current_x;
point->y = device->current_y;
}
else
{
ClutterTouchInfo *info =
g_hash_table_lookup (device->touch_sequences_info, sequence);
seat = clutter_input_device_get_seat (device);
if (info == NULL)
return FALSE;
point->x = info->current_x;
point->y = info->current_y;
}
return TRUE;
return clutter_seat_query_state (seat, device, sequence, point, NULL);
}
/*
@ -1018,27 +785,29 @@ clutter_input_device_get_coords (ClutterInputDevice *device,
ClutterActor *
clutter_input_device_update (ClutterInputDevice *device,
ClutterEventSequence *sequence,
gboolean emit_crossing)
ClutterStage *stage,
gboolean emit_crossing,
ClutterEvent *for_event)
{
ClutterStage *stage;
ClutterActor *new_cursor_actor;
ClutterActor *old_cursor_actor;
graphene_point_t point = GRAPHENE_POINT_INIT (-1.0f, -1.0f);
ClutterInputDeviceType device_type = device->device_type;
uint32_t time_;
g_assert (device_type != CLUTTER_KEYBOARD_DEVICE &&
device_type != CLUTTER_PAD_DEVICE);
stage = device->stage;
if (G_UNLIKELY (stage == NULL))
if (for_event)
{
CLUTTER_NOTE (EVENT, "No stage defined for device %d '%s'",
clutter_input_device_get_device_id (device),
clutter_input_device_get_device_name (device));
return NULL;
clutter_event_get_coords (for_event, &point.x, &point.y);
time_ = clutter_event_get_time (for_event);
}
else
{
clutter_input_device_get_coords (device, sequence, &point);
time_ = CLUTTER_CURRENT_TIME;
}
clutter_input_device_get_coords (device, sequence, &point);
old_cursor_actor = clutter_input_device_get_actor (device, sequence);
new_cursor_actor =
@ -1065,7 +834,8 @@ clutter_input_device_update (ClutterInputDevice *device,
_clutter_input_device_set_actor (device, sequence,
new_cursor_actor,
emit_crossing);
emit_crossing,
point, time_);
return new_cursor_actor;
}
@ -1086,37 +856,12 @@ ClutterActor *
clutter_input_device_get_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence)
{
ClutterTouchInfo *info;
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
if (sequence == NULL)
return device->cursor_actor;
info = g_hash_table_lookup (device->touch_sequences_info, sequence);
g_return_val_if_fail (info != NULL, NULL);
return info->actor;
}
/**
* clutter_input_device_get_pointer_stage:
* @device: a #ClutterInputDevice of type %CLUTTER_POINTER_DEVICE
*
* Retrieves the #ClutterStage underneath the pointer of @device
*
* Return value: (transfer none): a pointer to the #ClutterStage or %NULL
*
* Since: 1.2
*/
ClutterStage *
clutter_input_device_get_pointer_stage (ClutterInputDevice *device)
{
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
g_return_val_if_fail (device->device_type == CLUTTER_POINTER_DEVICE, NULL);
return device->stage;
return g_hash_table_lookup (device->touch_sequence_actors, sequence);
}
/**
@ -1177,95 +922,6 @@ clutter_input_device_get_device_mode (ClutterInputDevice *device)
return device->device_mode;
}
/**
* clutter_input_device_update_from_event:
* @device: a #ClutterInputDevice
* @event: a #ClutterEvent
* @update_stage: whether to update the #ClutterStage of the @device
* using the stage of the event
*
* Forcibly updates the state of the @device using a #ClutterEvent
*
* This function should never be used by applications: it is meant
* for integration with embedding toolkits, like clutter-gtk
*
* Embedding toolkits that disable the event collection inside Clutter
* need to use this function to update the state of input devices depending
* on a #ClutterEvent that they are going to submit to the event handling code
* in Clutter though clutter_do_event(). Since the input devices hold the state
* that is going to be used to fill in fields like the #ClutterButtonEvent
* click count, or to emit synthesized events like %CLUTTER_ENTER and
* %CLUTTER_LEAVE, it is necessary for embedding toolkits to also be
* responsible of updating the input device state.
*
* For instance, this might be the code to translate an embedding toolkit
* native motion notification into a Clutter #ClutterMotionEvent and ask
* Clutter to process it:
*
* |[
* ClutterEvent c_event;
*
* translate_native_event_to_clutter (native_event, &c_event);
*
* clutter_do_event (&c_event);
* ]|
*
* Before letting clutter_do_event() process the event, it is necessary to call
* clutter_input_device_update_from_event():
*
* |[
* ClutterEvent c_event;
* ClutterDeviceManager *manager;
* ClutterInputDevice *device;
*
* translate_native_event_to_clutter (native_event, &c_event);
*
* // get the seat
* seat = clutter_backend_get_deafult_seat (clutter_get_default_backend ());
*
* // use the default Core Pointer that Clutter backends register by default
* device = clutter_seat_get_pointer (seat);
*
* // update the state of the input device
* clutter_input_device_update_from_event (device, &c_event, FALSE);
*
* clutter_do_event (&c_event);
* ]|
*
* The @update_stage boolean argument should be used when the input device
* enters and leaves a #ClutterStage; it will use the #ClutterStage field
* of the passed @event to update the stage associated to the input device.
*
* Since: 1.2
*/
void
clutter_input_device_update_from_event (ClutterInputDevice *device,
ClutterEvent *event,
gboolean update_stage)
{
ClutterModifierType event_state;
ClutterEventSequence *sequence;
ClutterStage *event_stage;
gfloat event_x, event_y;
guint32 event_time;
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
g_return_if_fail (event != NULL);
event_state = clutter_event_get_state (event);
event_time = clutter_event_get_time (event);
event_stage = clutter_event_get_stage (event);
sequence = clutter_event_get_event_sequence (event);
clutter_event_get_coords (event, &event_x, &event_y);
_clutter_input_device_set_coords (device, sequence, event_x, event_y, event_stage);
_clutter_input_device_set_state (device, event_state);
_clutter_input_device_set_time (device, event_time);
if (update_stage)
_clutter_input_device_set_stage (device, event_stage);
}
/*< private >
* clutter_input_device_reset_axes:
* @device: a #ClutterInputDevice
@ -1646,31 +1302,6 @@ _clutter_input_device_remove_slave (ClutterInputDevice *master,
master->slaves = g_list_remove (master->slaves, slave);
}
/*< private >
* clutter_input_device_add_sequence:
* @device: a #ClutterInputDevice
* @sequence: a #ClutterEventSequence
*
* Start tracking informations related to a touch point (position,
* actor underneath the touch point).
*/
void
_clutter_input_device_add_event_sequence (ClutterInputDevice *device,
ClutterEvent *event)
{
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
ClutterStage *stage;
if (sequence == NULL)
return;
stage = clutter_event_get_stage (event);
if (stage == NULL)
return;
_clutter_input_device_ensure_touch_info (device, sequence, stage);
}
/*< private >
* clutter_input_device_remove_sequence:
* @device: a #ClutterInputDevice
@ -1683,25 +1314,25 @@ _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
ClutterEvent *event)
{
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
ClutterTouchInfo *info =
g_hash_table_lookup (device->touch_sequences_info, sequence);
ClutterActor *actor =
g_hash_table_lookup (device->touch_sequence_actors, sequence);
if (info == NULL)
return;
if (info->actor != NULL)
if (actor != NULL)
{
GList *sequences =
g_hash_table_lookup (device->inv_touch_sequence_actors, info->actor);
g_hash_table_lookup (device->inv_touch_sequence_actors, actor);
graphene_point_t point;
sequences = g_list_remove (sequences, sequence);
g_hash_table_replace (device->inv_touch_sequence_actors,
info->actor, sequences);
_clutter_input_device_set_actor (device, sequence, NULL, TRUE);
actor, sequences);
clutter_event_get_coords (event, &point.x, &point.y);
_clutter_input_device_set_actor (device, sequence, NULL, TRUE, point,
clutter_event_get_time (event));
}
g_hash_table_remove (device->touch_sequences_info, sequence);
g_hash_table_remove (device->touch_sequence_actors, sequence);
}
/**
@ -2391,43 +2022,6 @@ clutter_input_device_get_device_node (ClutterInputDevice *device)
return device->node_path;
}
ClutterInputDeviceMapping
clutter_input_device_get_mapping_mode (ClutterInputDevice *device)
{
ClutterInputDeviceType device_type;
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device),
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE);
device_type = clutter_input_device_get_device_type (device);
g_return_val_if_fail (device_type == CLUTTER_TABLET_DEVICE ||
device_type == CLUTTER_PEN_DEVICE ||
device_type == CLUTTER_ERASER_DEVICE,
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE);
return device->mapping_mode;
}
void
clutter_input_device_set_mapping_mode (ClutterInputDevice *device,
ClutterInputDeviceMapping mapping)
{
ClutterInputDeviceType device_type;
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
device_type = clutter_input_device_get_device_type (device);
g_return_if_fail (device_type == CLUTTER_TABLET_DEVICE ||
device_type == CLUTTER_PEN_DEVICE ||
device_type == CLUTTER_ERASER_DEVICE);
if (device->mapping_mode == mapping)
return;
device->mapping_mode = mapping;
g_object_notify (G_OBJECT (device), "mapping-mode");
}
gboolean
clutter_input_device_is_grouped (ClutterInputDevice *device,
ClutterInputDevice *other_device)

View File

@ -95,18 +95,11 @@ CLUTTER_EXPORT
ClutterActor * clutter_input_device_get_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence);
CLUTTER_EXPORT
ClutterStage * clutter_input_device_get_pointer_stage (ClutterInputDevice *device);
CLUTTER_EXPORT
const gchar * clutter_input_device_get_device_name (ClutterInputDevice *device);
CLUTTER_EXPORT
ClutterInputMode clutter_input_device_get_device_mode (ClutterInputDevice *device);
CLUTTER_EXPORT
gboolean clutter_input_device_get_has_cursor (ClutterInputDevice *device);
CLUTTER_EXPORT
void clutter_input_device_set_enabled (ClutterInputDevice *device,
gboolean enabled);
CLUTTER_EXPORT
gboolean clutter_input_device_get_enabled (ClutterInputDevice *device);
CLUTTER_EXPORT
guint clutter_input_device_get_n_axes (ClutterInputDevice *device);
@ -122,11 +115,6 @@ gboolean clutter_input_device_get_axis_value (ClutterInputDev
CLUTTER_EXPORT
guint clutter_input_device_get_n_keys (ClutterInputDevice *device);
CLUTTER_EXPORT
void clutter_input_device_set_key (ClutterInputDevice *device,
guint index_,
guint keyval,
ClutterModifierType modifiers);
CLUTTER_EXPORT
gboolean clutter_input_device_get_key (ClutterInputDevice *device,
guint index_,
guint *keyval,
@ -137,11 +125,6 @@ ClutterInputDevice * clutter_input_device_get_associated_device (ClutterInput
CLUTTER_EXPORT
GList * clutter_input_device_get_slave_devices (ClutterInputDevice *device);
CLUTTER_EXPORT
void clutter_input_device_update_from_event (ClutterInputDevice *device,
ClutterEvent *event,
gboolean update_stage);
CLUTTER_EXPORT
void clutter_input_device_grab (ClutterInputDevice *device,
ClutterActor *actor);
@ -161,11 +144,6 @@ CLUTTER_EXPORT
ClutterActor * clutter_input_device_sequence_get_grabbed_actor (ClutterInputDevice *device,
ClutterEventSequence *sequence);
CLUTTER_EXPORT
gboolean clutter_input_device_keycode_to_evdev (ClutterInputDevice *device,
guint hardware_keycode,
guint *evdev_keycode);
CLUTTER_EXPORT
const gchar * clutter_input_device_get_vendor_id (ClutterInputDevice *device);
CLUTTER_EXPORT
@ -193,12 +171,6 @@ gint clutter_input_device_get_mode_switch_button_group (Clutt
CLUTTER_EXPORT
const gchar * clutter_input_device_get_device_node (ClutterInputDevice *device);
CLUTTER_EXPORT
ClutterInputDeviceMapping clutter_input_device_get_mapping_mode (ClutterInputDevice *device);
CLUTTER_EXPORT
void clutter_input_device_set_mapping_mode (ClutterInputDevice *device,
ClutterInputDeviceMapping mapping);
CLUTTER_EXPORT
gboolean clutter_input_device_is_grouped (ClutterInputDevice *device,
ClutterInputDevice *other_device);

View File

@ -454,6 +454,7 @@ clutter_input_method_forward_key (ClutterInputMethod *im,
ClutterInputMethodPrivate *priv;
ClutterInputDevice *keyboard;
ClutterSeat *seat;
ClutterStageManager *stage_manager;
ClutterStage *stage;
ClutterEvent *event;
@ -464,10 +465,9 @@ clutter_input_method_forward_key (ClutterInputMethod *im,
return;
seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
stage_manager = clutter_stage_manager_get_default ();
stage = clutter_stage_manager_get_default_stage (stage_manager);
keyboard = clutter_seat_get_keyboard (seat);
stage = _clutter_input_device_get_stage (keyboard);
if (stage == NULL)
return;
event = clutter_event_new (press ? CLUTTER_KEY_PRESS : CLUTTER_KEY_RELEASE);
event->key.time = time_;

View File

@ -67,13 +67,7 @@
#include "clutter-settings-private.h"
#include "clutter-stage-manager.h"
#include "clutter-stage-private.h"
#ifdef CLUTTER_WINDOWING_X11
#include "x11/clutter-backend-x11.h"
#endif
#ifdef CLUTTER_WINDOWING_EGL
#include "egl/clutter-backend-eglnative.h"
#endif
#include "clutter-backend-private.h"
#include <cogl/cogl.h>
#include <cogl-pango/cogl-pango.h>
@ -88,7 +82,6 @@ static gboolean clutter_is_initialized = FALSE;
static gboolean clutter_show_fps = FALSE;
static gboolean clutter_fatal_warnings = FALSE;
static gboolean clutter_disable_mipmap_text = FALSE;
static gboolean clutter_use_fuzzy_picking = FALSE;
static gboolean clutter_enable_accessibility = TRUE;
static gboolean clutter_sync_to_vblank = TRUE;
@ -96,9 +89,6 @@ static guint clutter_default_fps = 60;
static ClutterTextDirection clutter_text_direction = CLUTTER_TEXT_DIRECTION_LTR;
static guint clutter_main_loop_level = 0;
static GSList *main_loops = NULL;
/* debug flags */
guint clutter_debug_flags = 0;
guint clutter_paint_debug_flags = 0;
@ -185,16 +175,6 @@ clutter_config_read_from_key_file (GKeyFile *keyfile)
else
clutter_disable_mipmap_text = bool_value;
bool_value =
g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP,
"UseFuzzyPicking",
&key_error);
if (key_error != NULL)
g_clear_error (&key_error);
else
clutter_use_fuzzy_picking = bool_value;
bool_value =
g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP,
"EnableAccessibility",
@ -449,76 +429,6 @@ clutter_get_text_direction (void)
return dir;
}
/**
* clutter_main_quit:
*
* Terminates the Clutter mainloop.
*/
void
clutter_main_quit (void)
{
if (main_loops == NULL)
{
g_critical ("Calling clutter_main_quit() without calling clutter_main() "
"is not allowed. If you are using another main loop, use the "
"appropriate API to terminate it.");
return;
}
CLUTTER_NOTE (MISC, "Terminating main loop level %d", clutter_main_loop_level);
g_main_loop_quit (main_loops->data);
}
/**
* clutter_main_level:
*
* Retrieves the depth of the Clutter mainloop.
*
* Return value: The level of the mainloop.
*/
gint
clutter_main_level (void)
{
return clutter_main_loop_level;
}
/**
* clutter_main:
*
* Starts the Clutter mainloop.
*/
void
clutter_main (void)
{
GMainLoop *loop;
if (!_clutter_context_is_initialized ())
{
g_warning ("Called clutter_main() but Clutter wasn't initialised. "
"You must call clutter_init() first.");
return;
}
clutter_main_loop_level++;
CLUTTER_NOTE (MISC, "Entering main loop level %d", clutter_main_loop_level);
loop = g_main_loop_new (NULL, TRUE);
main_loops = g_slist_prepend (main_loops, loop);
if (g_main_loop_is_running (main_loops->data))
g_main_loop_run (loop);
main_loops = g_slist_remove (main_loops, loop);
g_main_loop_unref (loop);
CLUTTER_NOTE (MISC, "Leaving main loop level %d", clutter_main_loop_level);
clutter_main_loop_level--;
}
gboolean
_clutter_threads_dispatch (gpointer data)
{
@ -787,6 +697,8 @@ _clutter_context_get_default (void)
ctx->settings = clutter_settings_get_default ();
_clutter_settings_set_backend (ctx->settings, ctx->backend);
ctx->events_queue = g_async_queue_new ();
ctx->last_repaint_id = 1;
}
@ -923,9 +835,6 @@ static GOptionEntry clutter_args[] = {
{ "clutter-disable-mipmapped-text", 0, 0, G_OPTION_ARG_NONE,
&clutter_disable_mipmap_text,
N_("Disable mipmapping on text"), NULL },
{ "clutter-use-fuzzy-picking", 0, 0, G_OPTION_ARG_NONE,
&clutter_use_fuzzy_picking,
N_("Use 'fuzzy' picking"), NULL },
#ifdef CLUTTER_ENABLE_DEBUG
{ "clutter-debug", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_debug_cb,
N_("Clutter debugging flags to set"), "FLAGS" },
@ -1007,10 +916,6 @@ pre_parse_hook (GOptionContext *context,
if (env_string)
clutter_disable_mipmap_text = TRUE;
env_string = g_getenv ("CLUTTER_FUZZY_PICK");
if (env_string)
clutter_use_fuzzy_picking = TRUE;
return _clutter_backend_pre_parse (backend, error);
}
@ -1669,6 +1574,11 @@ _clutter_process_event_details (ClutterActor *stage,
ClutterEvent *event)
{
ClutterInputDevice *device = clutter_event_get_device (event);
ClutterMainContext *clutter_context;
ClutterBackend *backend;
clutter_context = _clutter_context_get_default ();
backend = clutter_context->backend;
switch (event->type)
{
@ -1713,7 +1623,9 @@ _clutter_process_event_details (ClutterActor *stage,
emit_crossing_event (event, device);
actor = clutter_input_device_update (device, NULL, FALSE);
actor = clutter_input_device_update (device, NULL,
CLUTTER_STAGE (stage), FALSE,
event);
if (actor != stage)
{
ClutterEvent *crossing;
@ -1754,7 +1666,6 @@ _clutter_process_event_details (ClutterActor *stage,
break;
case CLUTTER_DESTROY_NOTIFY:
case CLUTTER_DELETE:
event->any.source = stage;
if (_clutter_event_process_filters (event))
@ -1765,8 +1676,7 @@ _clutter_process_event_details (ClutterActor *stage,
break;
case CLUTTER_MOTION:
#ifdef CLUTTER_WINDOWING_X11
if (!clutter_check_windowing_backend (CLUTTER_WINDOWING_X11) &&
if (clutter_backend_is_display_server (backend) &&
!(event->any.flags & CLUTTER_EVENT_FLAG_SYNTHETIC))
{
if (_clutter_is_input_pointer_a11y_enabled (device))
@ -1777,7 +1687,6 @@ _clutter_process_event_details (ClutterActor *stage,
_clutter_input_pointer_a11y_on_motion_event (device, x, y);
}
}
#endif /* CLUTTER_WINDOWING_X11 */
/* only the stage gets motion events if they are enabled */
if (!clutter_stage_get_motion_events_enabled (CLUTTER_STAGE (stage)) &&
event->any.source == NULL)
@ -1808,8 +1717,7 @@ _clutter_process_event_details (ClutterActor *stage,
G_GNUC_FALLTHROUGH;
case CLUTTER_BUTTON_PRESS:
case CLUTTER_BUTTON_RELEASE:
#ifdef CLUTTER_WINDOWING_X11
if (!clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
if (clutter_backend_is_display_server (backend))
{
if (_clutter_is_input_pointer_a11y_enabled (device) && (event->type != CLUTTER_MOTION))
{
@ -1818,7 +1726,6 @@ _clutter_process_event_details (ClutterActor *stage,
event->type == CLUTTER_BUTTON_PRESS);
}
}
#endif /* CLUTTER_WINDOWING_X11 */
case CLUTTER_SCROLL:
case CLUTTER_TOUCHPAD_PINCH:
case CLUTTER_TOUCHPAD_SWIPE:
@ -1867,21 +1774,9 @@ _clutter_process_event_details (ClutterActor *stage,
break;
}
/* if the backend provides a device then we should
* already have everything we need to update it and
* get the actor underneath
*/
if (device != NULL)
actor = clutter_input_device_update (device, NULL, TRUE);
else
{
CLUTTER_NOTE (EVENT, "No device found: picking");
actor = _clutter_stage_do_pick (CLUTTER_STAGE (stage),
x, y,
CLUTTER_PICK_REACTIVE);
}
actor = clutter_input_device_update (device, NULL,
CLUTTER_STAGE (stage),
TRUE, event);
if (actor == NULL)
break;
@ -1957,9 +1852,6 @@ _clutter_process_event_details (ClutterActor *stage,
sequence =
clutter_event_get_event_sequence (event);
if (event->type == CLUTTER_TOUCH_BEGIN)
_clutter_input_device_add_event_sequence (device, event);
clutter_event_get_coords (event, &x, &y);
/* Only do a pick to find the source if source is not already set
@ -1989,17 +1881,9 @@ _clutter_process_event_details (ClutterActor *stage,
break;
}
if (device != NULL)
actor = clutter_input_device_update (device, sequence, TRUE);
else
{
CLUTTER_NOTE (EVENT, "No device found: picking");
actor = _clutter_stage_do_pick (CLUTTER_STAGE (stage),
x, y,
CLUTTER_PICK_REACTIVE);
}
actor = clutter_input_device_update (device, sequence,
CLUTTER_STAGE (stage),
TRUE, event);
if (actor == NULL)
break;
@ -2051,6 +1935,11 @@ _clutter_process_event_details (ClutterActor *stage,
case CLUTTER_CLIENT_MESSAGE:
break;
case CLUTTER_DEVICE_ADDED:
case CLUTTER_DEVICE_REMOVED:
_clutter_event_process_filters (event);
break;
case CLUTTER_EVENT_LAST:
break;
}
@ -2399,39 +2288,16 @@ void
_clutter_clear_events_queue (void)
{
ClutterMainContext *context = _clutter_context_get_default ();
ClutterEvent *event;
if (context->events_queue != NULL)
{
g_queue_foreach (context->events_queue,
(GFunc) clutter_event_free,
NULL);
g_queue_free (context->events_queue);
context->events_queue = NULL;
}
}
/* Lock the queue for as long as it lives */
g_async_queue_lock (context->events_queue);
void
_clutter_clear_events_queue_for_stage (ClutterStage *stage)
{
ClutterMainContext *context = _clutter_context_get_default ();
GList *l, *next;
while ((event = g_async_queue_try_pop_unlocked (context->events_queue)))
clutter_event_free (event);
if (context->events_queue == NULL)
return;
/* Remove any pending events for this stage from the event queue */
for (l = context->events_queue->head; l; l = next)
{
ClutterEvent *event = l->data;
next = l->next;
if (event->any.stage == stage)
{
g_queue_delete_link (context->events_queue, l);
clutter_event_free (event);
}
}
g_async_queue_unref (context->events_queue);
context->events_queue = NULL;
}
ClutterPickMode
@ -2442,58 +2308,6 @@ _clutter_context_get_pick_mode (void)
return context->pick_mode;
}
/**
* clutter_check_windowing_backend:
* @backend_type: the name of the backend to check
*
* Checks the run-time name of the Clutter windowing system backend, using
* the symbolic macros like %CLUTTER_WINDOWING_X11.
*
* This function should be used in conjuction with the compile-time macros
* inside applications and libraries that are using the platform-specific
* windowing system API, to ensure that they are running on the correct
* windowing system; for instance:
*
* |[
* #ifdef CLUTTER_WINDOWING_X11
* if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
* {
* // it is safe to use the clutter_x11_* API
* }
* else
* #endif
* g_error ("Unknown Clutter backend.");
* ]|
*
* Return value: %TRUE if the current Clutter windowing system backend is
* the one checked, and %FALSE otherwise
*
* Since: 1.10
*/
gboolean
clutter_check_windowing_backend (const char *backend_type)
{
ClutterMainContext *context = _clutter_context_get_default ();
g_return_val_if_fail (backend_type != NULL, FALSE);
backend_type = g_intern_string (backend_type);
#ifdef CLUTTER_WINDOWING_EGL
if (backend_type == I_(CLUTTER_WINDOWING_EGL) &&
CLUTTER_IS_BACKEND_EGL_NATIVE (context->backend))
return TRUE;
else
#endif
#ifdef CLUTTER_WINDOWING_X11
if (backend_type == I_(CLUTTER_WINDOWING_X11) &&
CLUTTER_IS_BACKEND_X11 (context->backend))
return TRUE;
else
#endif
return FALSE;
}
/**
* clutter_add_debug_flags: (skip)
*

View File

@ -136,14 +136,6 @@ GOptionGroup * clutter_get_option_group (void);
CLUTTER_EXPORT
GOptionGroup * clutter_get_option_group_without_init (void);
/* Mainloop */
CLUTTER_EXPORT
void clutter_main (void);
CLUTTER_EXPORT
void clutter_main_quit (void);
CLUTTER_EXPORT
gint clutter_main_level (void);
CLUTTER_EXPORT
void clutter_do_event (ClutterEvent *event);
@ -194,9 +186,6 @@ ClutterTextDirection clutter_get_default_text_direction (void);
CLUTTER_EXPORT
guint clutter_get_default_frame_rate (void);
CLUTTER_EXPORT
gboolean clutter_check_windowing_backend (const char *backend_type);
CLUTTER_EXPORT
void clutter_add_debug_flags (ClutterDebugFlag debug_flags,
ClutterDrawDebugFlag draw_flags,

View File

@ -55,23 +55,6 @@ void clutter_stage_capture_into (ClutterStage *stage,
cairo_rectangle_int_t *rect,
uint8_t *data);
CLUTTER_EXPORT
void clutter_stage_paint_to_framebuffer (ClutterStage *stage,
CoglFramebuffer *framebuffer,
const cairo_rectangle_int_t *rect,
float scale,
ClutterPaintFlag paint_flags);
CLUTTER_EXPORT
gboolean clutter_stage_paint_to_buffer (ClutterStage *stage,
const cairo_rectangle_int_t *rect,
float scale,
uint8_t *data,
int stride,
CoglPixelFormat format,
ClutterPaintFlag paint_flags,
GError **error);
CLUTTER_EXPORT
void clutter_stage_clear_stage_views (ClutterStage *stage);
@ -85,6 +68,13 @@ gboolean clutter_actor_has_damage (ClutterActor *actor);
CLUTTER_EXPORT
gboolean clutter_actor_has_transitions (ClutterActor *actor);
CLUTTER_EXPORT
ClutterFrameClock * clutter_actor_pick_frame_clock (ClutterActor *self,
ClutterActor **out_actor);
CLUTTER_EXPORT
gboolean clutter_seat_handle_event_post (ClutterSeat *seat,
const ClutterEvent *event);
#undef __CLUTTER_H_INSIDE__
#endif /* __CLUTTER_MUTTER_H__ */

View File

@ -100,6 +100,8 @@ struct _ClutterOffscreenEffectPrivate
int target_height;
gint old_opacity_override;
gulong purge_handler_id;
};
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterOffscreenEffect,
@ -158,6 +160,12 @@ ensure_pipeline_filter_for_scale (ClutterOffscreenEffect *self,
filter, filter);
}
static void
video_memory_purged (ClutterOffscreenEffect *self)
{
g_clear_pointer (&self->priv->offscreen, cogl_object_unref);
}
static gboolean
update_fbo (ClutterEffect *effect,
int target_width,
@ -166,8 +174,26 @@ update_fbo (ClutterEffect *effect,
{
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
ClutterOffscreenEffectPrivate *priv = self->priv;
ClutterActor *stage_actor;
stage_actor = clutter_actor_get_stage (priv->actor);
if (stage_actor != priv->stage)
{
g_clear_signal_handler (&priv->purge_handler_id, priv->stage);
priv->stage = stage_actor;
if (priv->stage)
{
priv->purge_handler_id =
g_signal_connect_object (priv->stage,
"gl-video-memory-purged",
G_CALLBACK (video_memory_purged),
self,
G_CONNECT_SWAPPED);
}
}
priv->stage = clutter_actor_get_stage (priv->actor);
if (priv->stage == NULL)
{
CLUTTER_NOTE (MISC, "The actor '%s' is not part of a stage",

View File

@ -33,6 +33,7 @@ typedef enum _ClutterPaintFlag
{
CLUTTER_PAINT_FLAG_NONE = 0,
CLUTTER_PAINT_FLAG_NO_CURSORS = 1 << 0,
CLUTTER_PAINT_FLAG_FORCE_CURSORS = 1 << 1,
} ClutterPaintFlag;
#define CLUTTER_TYPE_PAINT_CONTEXT (clutter_paint_context_get_type ())

View File

@ -122,7 +122,7 @@ struct _ClutterMainContext
ClutterStageManager *stage_manager;
/* the main event queue */
GQueue *events_queue;
GAsyncQueue *events_queue;
/* the event filters added via clutter_event_add_filter. these are
* ordered from least recently added to most recently added */
@ -313,6 +313,12 @@ us (uint64_t us)
return us;
}
static inline uint32_t
ms (uint32_t ms)
{
return ms;
}
static inline uint64_t
ms2us (uint64_t ms)
{

View File

@ -27,6 +27,7 @@
#include "clutter-input-device-tool.h"
#include "clutter-input-pointer-a11y-private.h"
#include "clutter-marshal.h"
#include "clutter-mutter.h"
#include "clutter-private.h"
#include "clutter-seat.h"
#include "clutter-virtual-input-device.h"
@ -65,9 +66,6 @@ struct _ClutterSeatPrivate
unsigned int inhibit_unfocus_count;
/* Keyboard a11y */
ClutterKbdA11ySettings kbd_a11y_settings;
/* Pointer a11y */
ClutterPointerA11ySettings pointer_a11y_settings;
};
@ -404,43 +402,6 @@ clutter_seat_get_keymap (ClutterSeat *seat)
return CLUTTER_SEAT_GET_CLASS (seat)->get_keymap (seat);
}
static gboolean
are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
ClutterKbdA11ySettings *b)
{
return (memcmp (a, b, sizeof (ClutterKbdA11ySettings)) == 0);
}
void
clutter_seat_set_kbd_a11y_settings (ClutterSeat *seat,
ClutterKbdA11ySettings *settings)
{
ClutterSeatClass *seat_class;
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
g_return_if_fail (CLUTTER_IS_SEAT (seat));
if (are_kbd_a11y_settings_equal (&priv->kbd_a11y_settings, settings))
return;
priv->kbd_a11y_settings = *settings;
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
if (seat_class->apply_kbd_a11y_settings)
seat_class->apply_kbd_a11y_settings (seat, settings);
}
void
clutter_seat_get_kbd_a11y_settings (ClutterSeat *seat,
ClutterKbdA11ySettings *settings)
{
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
g_return_if_fail (CLUTTER_IS_SEAT (seat));
*settings = priv->kbd_a11y_settings;
}
void
clutter_seat_ensure_a11y_state (ClutterSeat *seat)
{
@ -674,6 +635,40 @@ clutter_seat_compress_motion (ClutterSeat *seat,
seat_class->compress_motion (seat, event, to_discard);
}
gboolean
clutter_seat_handle_event_post (ClutterSeat *seat,
const ClutterEvent *event)
{
ClutterSeatClass *seat_class;
ClutterInputDevice *device;
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), FALSE);
g_return_val_if_fail (event, FALSE);
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
if (seat_class->handle_event_post)
seat_class->handle_event_post (seat, event);
device = clutter_event_get_source_device (event);
g_assert_true (CLUTTER_IS_INPUT_DEVICE (device));
switch (event->type)
{
case CLUTTER_DEVICE_ADDED:
g_signal_emit (seat, signals[DEVICE_ADDED], 0, device);
break;
case CLUTTER_DEVICE_REMOVED:
g_signal_emit (seat, signals[DEVICE_REMOVED], 0, device);
g_object_run_dispose (G_OBJECT (device));
break;
default:
break;
}
return TRUE;
}
void
clutter_seat_warp_pointer (ClutterSeat *seat,
int x,
@ -709,3 +704,20 @@ clutter_seat_get_touch_mode (ClutterSeat *seat)
return touch_mode;
}
gboolean
clutter_seat_query_state (ClutterSeat *seat,
ClutterInputDevice *device,
ClutterEventSequence *sequence,
graphene_point_t *coords,
ClutterModifierType *modifiers)
{
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), FALSE);
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
return CLUTTER_SEAT_GET_CLASS (seat)->query_state (seat,
device,
sequence,
coords,
modifiers);
}

View File

@ -37,24 +37,6 @@ CLUTTER_EXPORT
G_DECLARE_DERIVABLE_TYPE (ClutterSeat, clutter_seat,
CLUTTER, SEAT, GObject)
/**
* ClutterKbdA11ySettings:
*
* The #ClutterKbdA11ySettings structure contains keyboard accessibility
* settings
*
*/
typedef struct _ClutterKbdA11ySettings
{
ClutterKeyboardA11yFlags controls;
gint slowkeys_delay;
gint debounce_delay;
gint timeout_delay;
gint mousekeys_init_delay;
gint mousekeys_max_speed;
gint mousekeys_accel_time;
} ClutterKbdA11ySettings;
/**
* ClutterPointerA11ySettings:
*
@ -106,10 +88,19 @@ struct _ClutterSeatClass
ClutterEvent *event,
const ClutterEvent *to_discard);
gboolean (* handle_event_post) (ClutterSeat *seat,
const ClutterEvent *event);
void (* warp_pointer) (ClutterSeat *seat,
int x,
int y);
gboolean (* query_state) (ClutterSeat *seat,
ClutterInputDevice *device,
ClutterEventSequence *sequence,
graphene_point_t *coords,
ClutterModifierType *modifiers);
/* Event platform data */
void (* copy_event_data) (ClutterSeat *seat,
const ClutterEvent *src,
@ -117,10 +108,6 @@ struct _ClutterSeatClass
void (* free_event_data) (ClutterSeat *seat,
ClutterEvent *event);
/* Keyboard accessibility */
void (* apply_kbd_a11y_settings) (ClutterSeat *seat,
ClutterKbdA11ySettings *settings);
/* Virtual devices */
ClutterVirtualInputDevice * (* create_virtual_device) (ClutterSeat *seat,
ClutterInputDeviceType device_type);
@ -140,12 +127,6 @@ void clutter_seat_bell_notify (ClutterSeat *seat);
CLUTTER_EXPORT
ClutterKeymap * clutter_seat_get_keymap (ClutterSeat *seat);
CLUTTER_EXPORT
void clutter_seat_set_kbd_a11y_settings (ClutterSeat *seat,
ClutterKbdA11ySettings *settings);
CLUTTER_EXPORT
void clutter_seat_get_kbd_a11y_settings (ClutterSeat *seat,
ClutterKbdA11ySettings *settings);
CLUTTER_EXPORT
void clutter_seat_ensure_a11y_state (ClutterSeat *seat);
@ -188,4 +169,11 @@ void clutter_seat_warp_pointer (ClutterSeat *seat,
CLUTTER_EXPORT
gboolean clutter_seat_get_touch_mode (ClutterSeat *seat);
CLUTTER_EXPORT
gboolean clutter_seat_query_state (ClutterSeat *seat,
ClutterInputDevice *device,
ClutterEventSequence *sequence,
graphene_point_t *coords,
ClutterModifierType *modifiers);
#endif /* CLUTTER_SEAT_H */

View File

@ -40,6 +40,18 @@
#define CLUTTER_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SETTINGS))
#define CLUTTER_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SETTINGS, ClutterSettingsClass))
typedef struct
{
cairo_antialias_t cairo_antialias;
gint clutter_font_antialias;
cairo_hint_style_t cairo_hint_style;
const char *clutter_font_hint_style;
cairo_subpixel_order_t cairo_subpixel_order;
const char *clutter_font_subpixel_order;
} FontSettings;
/**
* ClutterSettings:
*
@ -53,6 +65,7 @@ struct _ClutterSettings
GObject parent_instance;
ClutterBackend *backend;
GSettings *xsettings;
gint double_click_time;
gint double_click_distance;
@ -267,6 +280,159 @@ settings_update_fontmap (ClutterSettings *self,
#endif /* HAVE_PANGO_FT2 */
}
static void
get_font_gsettings (GSettings *xsettings,
FontSettings *output)
{
/* org.gnome.settings-daemon.GsdFontAntialiasingMode */
static const struct
{
cairo_antialias_t cairo_antialias;
gint clutter_font_antialias;
}
antialiasings[] =
{
/* none=0 */ {CAIRO_ANTIALIAS_NONE, 0},
/* grayscale=1 */ {CAIRO_ANTIALIAS_GRAY, 1},
/* rgba=2 */ {CAIRO_ANTIALIAS_SUBPIXEL, 1},
};
/* org.gnome.settings-daemon.GsdFontHinting */
static const struct
{
cairo_hint_style_t cairo_hint_style;
const char *clutter_font_hint_style;
}
hintings[] =
{
/* none=0 */ {CAIRO_HINT_STYLE_NONE, "hintnone"},
/* slight=1 */ {CAIRO_HINT_STYLE_SLIGHT, "hintslight"},
/* medium=2 */ {CAIRO_HINT_STYLE_MEDIUM, "hintmedium"},
/* full=3 */ {CAIRO_HINT_STYLE_FULL, "hintfull"},
};
/* org.gnome.settings-daemon.GsdFontRgbaOrder */
static const struct
{
cairo_subpixel_order_t cairo_subpixel_order;
const char *clutter_font_subpixel_order;
}
rgba_orders[] =
{
/* rgba=0 */ {CAIRO_SUBPIXEL_ORDER_RGB, "rgb"}, /* XXX what is 'rgba'? */
/* rgb=1 */ {CAIRO_SUBPIXEL_ORDER_RGB, "rgb"},
/* bgr=2 */ {CAIRO_SUBPIXEL_ORDER_BGR, "bgr"},
/* vrgb=3 */ {CAIRO_SUBPIXEL_ORDER_VRGB, "vrgb"},
/* vbgr=4 */ {CAIRO_SUBPIXEL_ORDER_VBGR, "vbgr"},
};
guint i;
i = g_settings_get_enum (xsettings, "hinting");
if (i < G_N_ELEMENTS (hintings))
{
output->cairo_hint_style = hintings[i].cairo_hint_style;
output->clutter_font_hint_style = hintings[i].clutter_font_hint_style;
}
else
{
output->cairo_hint_style = CAIRO_HINT_STYLE_DEFAULT;
output->clutter_font_hint_style = NULL;
}
i = g_settings_get_enum (xsettings, "antialiasing");
if (i < G_N_ELEMENTS (antialiasings))
{
output->cairo_antialias = antialiasings[i].cairo_antialias;
output->clutter_font_antialias = antialiasings[i].clutter_font_antialias;
}
else
{
output->cairo_antialias = CAIRO_ANTIALIAS_DEFAULT;
output->clutter_font_antialias = -1;
}
i = g_settings_get_enum (xsettings, "rgba-order");
if (i < G_N_ELEMENTS (rgba_orders))
{
output->cairo_subpixel_order = rgba_orders[i].cairo_subpixel_order;
output->clutter_font_subpixel_order = rgba_orders[i].clutter_font_subpixel_order;
}
else
{
output->cairo_subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
output->clutter_font_subpixel_order = NULL;
}
if (output->cairo_antialias == CAIRO_ANTIALIAS_GRAY)
output->clutter_font_subpixel_order = "none";
}
static void
init_font_options (ClutterSettings *self)
{
GSettings *xsettings = self->xsettings;
cairo_font_options_t *options = cairo_font_options_create ();
FontSettings fs;
get_font_gsettings (xsettings, &fs);
cairo_font_options_set_hint_style (options, fs.cairo_hint_style);
cairo_font_options_set_antialias (options, fs.cairo_antialias);
cairo_font_options_set_subpixel_order (options, fs.cairo_subpixel_order);
clutter_backend_set_font_options (self->backend, options);
cairo_font_options_destroy (options);
}
static gboolean
on_xsettings_change_event (GSettings *xsettings,
gpointer keys,
gint n_keys,
gpointer user_data)
{
ClutterSettings *self = CLUTTER_SETTINGS (user_data);
FontSettings fs;
gint hinting;
get_font_gsettings (xsettings, &fs);
hinting = fs.cairo_hint_style == CAIRO_HINT_STYLE_NONE ? 0 : 1;
g_object_set (self,
"font-hinting", hinting,
"font-hint-style", fs.clutter_font_hint_style,
"font-antialias", fs.clutter_font_antialias,
"font-subpixel-order", fs.clutter_font_subpixel_order,
NULL);
return FALSE;
}
static void
load_initial_settings (ClutterSettings *self)
{
static const gchar xsettings_path[] =
"org.gnome.settings-daemon.plugins.xsettings";
GSettingsSchemaSource *source = g_settings_schema_source_get_default ();
GSettingsSchema *schema;
schema = g_settings_schema_source_lookup (source, xsettings_path, TRUE);
if (!schema)
{
g_warning ("Failed to find schema: %s", xsettings_path);
}
else
{
self->xsettings = g_settings_new_full (schema, NULL, NULL);
if (self->xsettings)
{
init_font_options (self);
g_signal_connect (self->xsettings, "change-event",
G_CALLBACK (on_xsettings_change_event),
self);
}
}
}
static void
clutter_settings_finalize (GObject *gobject)
{
@ -276,6 +442,8 @@ clutter_settings_finalize (GObject *gobject)
g_free (self->xft_hint_style);
g_free (self->xft_rgba);
g_clear_object (&self->xsettings);
G_OBJECT_CLASS (clutter_settings_parent_class)->finalize (gobject);
}
@ -740,6 +908,8 @@ _clutter_settings_set_backend (ClutterSettings *settings,
g_assert (CLUTTER_IS_BACKEND (backend));
settings->backend = backend;
load_initial_settings (settings);
}
#define SETTINGS_GROUP "Settings"

View File

@ -86,6 +86,13 @@ typedef struct _ClutterStageViewPrivate
G_DEFINE_TYPE_WITH_PRIVATE (ClutterStageView, clutter_stage_view, G_TYPE_OBJECT)
void
clutter_stage_view_destroy (ClutterStageView *view)
{
g_object_run_dispose (G_OBJECT (view));
g_object_unref (view);
}
void
clutter_stage_view_get_layout (ClutterStageView *view,
cairo_rectangle_int_t *rect)

View File

@ -52,6 +52,9 @@ struct _ClutterStageViewClass
cairo_rectangle_int_t *dst_rect);
};
CLUTTER_EXPORT
void clutter_stage_view_destroy (ClutterStageView *view);
CLUTTER_EXPORT
void clutter_stage_view_get_layout (ClutterStageView *view,
cairo_rectangle_int_t *rect);

View File

@ -172,6 +172,7 @@ enum
AFTER_UPDATE,
PAINT_VIEW,
PRESENTED,
GL_VIDEO_MEMORY_PURGED,
LAST_SIGNAL
};
@ -544,23 +545,6 @@ queue_full_redraw (ClutterStage *stage)
clutter_stage_add_redraw_clip (stage, NULL);
}
static gboolean
stage_is_default (ClutterStage *stage)
{
ClutterStageManager *stage_manager;
ClutterStageWindow *impl;
stage_manager = clutter_stage_manager_get_default ();
if (stage != clutter_stage_manager_get_default_stage (stage_manager))
return FALSE;
impl = _clutter_stage_get_window (stage);
if (impl != _clutter_stage_get_default_window ())
return FALSE;
return TRUE;
}
static void
clutter_stage_allocate (ClutterActor *self,
const ClutterActorBox *box)
@ -1029,7 +1013,6 @@ _clutter_stage_queue_event (ClutterStage *stage,
{
ClutterStagePrivate *priv;
gboolean first_event;
ClutterInputDevice *device;
g_return_if_fail (CLUTTER_IS_STAGE (stage));
@ -1040,25 +1023,6 @@ _clutter_stage_queue_event (ClutterStage *stage,
if (copy_event)
event = clutter_event_copy (event);
/* if needed, update the state of the input device of the event.
* we do it here to avoid calling the same code from every backend
* event processing function
*/
device = clutter_event_get_device (event);
if (device != NULL &&
event->type != CLUTTER_PROXIMITY_IN &&
event->type != CLUTTER_PROXIMITY_OUT)
{
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
guint32 event_time = clutter_event_get_time (event);
gfloat event_x, event_y;
clutter_event_get_coords (event, &event_x, &event_y);
_clutter_input_device_set_coords (device, sequence, event_x, event_y, stage);
_clutter_input_device_set_time (device, event_time);
}
if (first_event)
{
gboolean compressible = event->type == CLUTTER_MOTION ||
@ -1379,7 +1343,7 @@ clutter_stage_update_devices (ClutterStage *stage,
for (l = devices; l; l = l->next)
{
ClutterInputDevice *device = l->data;
clutter_input_device_update (device, NULL, TRUE);
clutter_input_device_update (device, NULL, stage, TRUE, NULL);
}
}
@ -1590,18 +1554,6 @@ _clutter_stage_do_pick (ClutterStage *stage,
return actor;
}
static gboolean
clutter_stage_real_delete_event (ClutterStage *stage,
ClutterEvent *event)
{
if (stage_is_default (stage))
clutter_main_quit ();
else
clutter_actor_destroy (CLUTTER_ACTOR (stage));
return CLUTTER_EVENT_STOP;
}
static void
clutter_stage_real_apply_transform (ClutterActor *stage,
CoglMatrix *matrix)
@ -1708,7 +1660,7 @@ clutter_stage_dispose (GObject *object)
clutter_actor_hide (CLUTTER_ACTOR (object));
_clutter_clear_events_queue_for_stage (stage);
_clutter_clear_events_queue ();
if (priv->impl != NULL)
{
@ -1877,37 +1829,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
NULL, NULL, NULL,
G_TYPE_NONE, 0);
/**
* ClutterStage::delete-event:
* @stage: the stage that received the event
* @event: a #ClutterEvent of type %CLUTTER_DELETE
*
* The ::delete-event signal is emitted when the user closes a
* #ClutterStage window using the window controls.
*
* Clutter by default will call clutter_main_quit() if @stage is
* the default stage, and clutter_actor_destroy() for any other
* stage.
*
* It is possible to override the default behaviour by connecting
* a new handler and returning %TRUE there.
*
* This signal is emitted only on Clutter backends that
* embed #ClutterStage in native windows. It is not emitted for
* backends that use a static frame buffer.
*
* Since: 1.2
*/
stage_signals[DELETE_EVENT] =
g_signal_new (I_("delete-event"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterStageClass, delete_event),
_clutter_boolean_handled_accumulator, NULL,
_clutter_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
CLUTTER_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* ClutterStage::before-update:
* @stage: the #ClutterStage
@ -2011,9 +1932,24 @@ clutter_stage_class_init (ClutterStageClass *klass)
CLUTTER_TYPE_STAGE_VIEW,
G_TYPE_POINTER);
/**
* ClutterStage::gl-video-memory-purged: (skip)
* @stage: the stage that received the event
*
* Signals that the underlying GL driver has had its texture memory purged
* so anything presently held in texture memory is now invalidated, and
* likely corrupt. It needs redrawing.
*/
stage_signals[GL_VIDEO_MEMORY_PURGED] =
g_signal_new (I_("gl-video-memory-purged"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
klass->activate = clutter_stage_real_activate;
klass->deactivate = clutter_stage_real_deactivate;
klass->delete_event = clutter_stage_real_delete_event;
}
static void
@ -2460,18 +2396,6 @@ clutter_stage_event (ClutterStage *stage,
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (event->type == CLUTTER_DELETE)
{
gboolean retval = FALSE;
g_signal_emit_by_name (stage, "event", event, &retval);
if (!retval)
g_signal_emit_by_name (stage, "delete-event", event, &retval);
return retval;
}
if (event->type != CLUTTER_STAGE_STATE)
return FALSE;
@ -2647,29 +2571,6 @@ G_DEFINE_BOXED_TYPE (ClutterPerspective, clutter_perspective,
clutter_perspective_copy,
clutter_perspective_free);
/**
* clutter_stage_new:
*
* Creates a new, non-default stage. A non-default stage is a new
* top-level actor which can be used as another container.
*
* The ability to support multiple stages depends on the current
* backend. Use clutter_feature_available() and
* %CLUTTER_FEATURE_STAGE_MULTIPLE to check at runtime whether a
* backend supports multiple stages.
*
* Return value: a new stage, or %NULL if the default backend does
* not support multiple stages. Use clutter_actor_destroy() to
* programmatically close the returned stage.
*
* Since: 0.8
*/
ClutterActor *
clutter_stage_new (void)
{
return g_object_new (CLUTTER_TYPE_STAGE, NULL);
}
/**
* clutter_stage_ensure_viewport:
* @stage: a #ClutterStage
@ -3624,102 +3525,6 @@ clutter_stage_presented (ClutterStage *stage,
g_signal_emit (stage, stage_signals[PRESENTED], 0, view, frame_info);
}
static void
capture_view (ClutterStage *stage,
gboolean paint,
ClutterStageView *view,
ClutterCapture *capture)
{
cairo_surface_t *image;
uint8_t *data;
int stride;
cairo_rectangle_int_t *rect;
float view_scale;
float texture_width;
float texture_height;
rect = &capture->rect;
view_scale = clutter_stage_view_get_scale (view);
texture_width = roundf (rect->width * view_scale);
texture_height = roundf (rect->height * view_scale);
image = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
texture_width, texture_height);
cairo_surface_set_device_scale (image, view_scale, view_scale);
data = cairo_image_surface_get_data (image);
stride = cairo_image_surface_get_stride (image);
capture_view_into (stage, paint, view, rect, data, stride);
capture->image = image;
cairo_surface_mark_dirty (capture->image);
}
/**
* clutter_stage_capture:
* @stage: a #ClutterStage
* @paint: whether to pain the frame
* @rect: a #cairo_rectangle_int_t in stage coordinates
* @out_captures: (out) (array length=out_n_captures): an array of
* #ClutterCapture
* @out_n_captures: (out): the number of captures in @out_captures
*
* Captures the stage pixels of @rect into @captures. @rect is in stage
* coordinates.
*
* Returns: %TRUE if a #ClutterCapture has been created, %FALSE otherwise
*/
gboolean
clutter_stage_capture (ClutterStage *stage,
gboolean paint,
cairo_rectangle_int_t *rect,
ClutterCapture **out_captures,
int *out_n_captures)
{
ClutterStagePrivate *priv = stage->priv;
GList *views = _clutter_stage_window_get_views (priv->impl);
GList *l;
ClutterCapture *captures;
int n_captures;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE);
captures = g_new0 (ClutterCapture, g_list_length (views));
n_captures = 0;
for (l = views; l; l = l->next)
{
ClutterStageView *view = l->data;
ClutterCapture *capture;
cairo_rectangle_int_t view_layout;
cairo_region_t *region;
clutter_stage_view_get_layout (view, &view_layout);
region = cairo_region_create_rectangle (&view_layout);
cairo_region_intersect_rectangle (region, rect);
capture = &captures[n_captures];
cairo_region_get_extents (region, &capture->rect);
cairo_region_destroy (region);
if (capture->rect.width == 0 || capture->rect.height == 0)
continue;
capture_view (stage, paint, view, capture);
n_captures++;
}
if (n_captures == 0)
g_clear_pointer (&captures, g_free);
*out_captures = captures;
*out_n_captures = n_captures;
return n_captures > 0;
}
gboolean
clutter_stage_get_capture_final_size (ClutterStage *stage,
cairo_rectangle_int_t *rect,

View File

@ -64,7 +64,6 @@ struct _ClutterStage
* ClutterStageClass:
* @activate: handler for the #ClutterStage::activate signal
* @deactivate: handler for the #ClutterStage::deactivate signal
* @delete_event: handler for the #ClutterStage::delete-event signal
*
* The #ClutterStageClass structure contains only private data
*
@ -81,16 +80,13 @@ struct _ClutterStageClass
void (* activate) (ClutterStage *stage);
void (* deactivate) (ClutterStage *stage);
gboolean (* delete_event) (ClutterStage *stage,
ClutterEvent *event);
void (* paint_view) (ClutterStage *stage,
ClutterStageView *view,
const cairo_region_t *redraw_clip);
/*< private >*/
/* padding for future expansion */
gpointer _padding_dummy[30];
gpointer _padding_dummy[31];
};
/**
@ -136,9 +132,6 @@ GType clutter_perspective_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
GType clutter_stage_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
ClutterActor * clutter_stage_new (void);
CLUTTER_EXPORT
void clutter_stage_get_perspective (ClutterStage *stage,
ClutterPerspective *perspective);
@ -219,11 +212,22 @@ gboolean clutter_stage_get_capture_final_size (ClutterStage *stage,
float *scale);
CLUTTER_EXPORT
gboolean clutter_stage_capture (ClutterStage *stage,
gboolean paint,
cairo_rectangle_int_t *rect,
ClutterCapture **out_captures,
int *out_n_captures);
void clutter_stage_paint_to_framebuffer (ClutterStage *stage,
CoglFramebuffer *framebuffer,
const cairo_rectangle_int_t *rect,
float scale,
ClutterPaintFlag paint_flags);
CLUTTER_EXPORT
gboolean clutter_stage_paint_to_buffer (ClutterStage *stage,
const cairo_rectangle_int_t *rect,
float scale,
uint8_t *data,
int stride,
CoglPixelFormat format,
ClutterPaintFlag paint_flags,
GError **error);
CLUTTER_EXPORT
ClutterStageView * clutter_stage_get_view_at (ClutterStage *stage,
float x,

View File

@ -5326,7 +5326,7 @@ clutter_text_set_selection_bound (ClutterText *self,
if (priv->selection_bound != selection_bound)
{
gint len = clutter_text_buffer_get_length (get_buffer (self));;
gint len = clutter_text_buffer_get_length (get_buffer (self));
if (selection_bound < 0 || selection_bound >= len)
priv->selection_bound = -1;

View File

@ -103,6 +103,7 @@
#include "clutter-frame-clock.h"
#include "clutter-main.h"
#include "clutter-marshal.h"
#include "clutter-mutter.h"
#include "clutter-private.h"
#include "clutter-scriptable.h"
#include "clutter-timeline-private.h"
@ -113,6 +114,8 @@ struct _ClutterTimelinePrivate
ClutterFrameClock *custom_frame_clock;
ClutterFrameClock *frame_clock;
ClutterActor *frame_clock_actor;
gulong frame_clock_actor_stage_views_handler_id;
ClutterActor *actor;
gulong actor_destroy_handler_id;
@ -382,19 +385,40 @@ on_stage_stage_views_changed (ClutterActor *stage,
update_frame_clock (timeline);
}
static void
on_frame_clock_actor_stage_views_changed (ClutterActor *frame_clock_actor,
ClutterTimeline *timeline)
{
update_frame_clock (timeline);
}
static void
update_frame_clock (ClutterTimeline *timeline)
{
ClutterTimelinePrivate *priv = timeline->priv;
ClutterFrameClock *frame_clock = NULL;
ClutterActor *stage;
ClutterActor *frame_clock_actor;
if (!priv->actor)
goto out;
frame_clock = clutter_actor_pick_frame_clock (priv->actor);
if (priv->frame_clock_actor)
{
g_clear_signal_handler (&priv->frame_clock_actor_stage_views_handler_id,
priv->frame_clock_actor);
g_clear_weak_pointer (&priv->frame_clock_actor);
}
frame_clock = clutter_actor_pick_frame_clock (priv->actor, &frame_clock_actor);
if (frame_clock)
{
g_set_weak_pointer (&priv->frame_clock_actor, frame_clock_actor);
priv->frame_clock_actor_stage_views_handler_id =
g_signal_connect (frame_clock_actor, "stage-views-changed",
G_CALLBACK (on_frame_clock_actor_stage_views_changed),
timeline);
g_clear_signal_handler (&priv->stage_stage_views_handler_id, priv->stage);
goto out;
}
@ -736,6 +760,13 @@ clutter_timeline_dispose (GObject *object)
priv->actor = NULL;
}
if (priv->frame_clock_actor)
{
g_clear_signal_handler (&priv->frame_clock_actor_stage_views_handler_id,
priv->frame_clock_actor);
g_clear_weak_pointer (&priv->frame_clock_actor);
}
if (priv->progress_notify != NULL)
{
priv->progress_notify (priv->progress_data);

View File

@ -773,16 +773,16 @@ on_framebuffer_set (ClutterStageView *view)
}
static void
clutter_stage_view_cogl_finalize (GObject *object)
clutter_stage_view_cogl_dispose (GObject *object)
{
ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (object);
ClutterStageViewCoglPrivate *view_priv =
clutter_stage_view_cogl_get_instance_private (view_cogl);
g_clear_handle_id (&view_priv->notify_presented_handle_id, g_source_remove);
clutter_damage_history_free (view_priv->damage_history);
g_clear_pointer (&view_priv->damage_history, clutter_damage_history_free);
G_OBJECT_CLASS (clutter_stage_view_cogl_parent_class)->finalize (object);
G_OBJECT_CLASS (clutter_stage_view_cogl_parent_class)->dispose (object);
}
static void
@ -802,5 +802,5 @@ clutter_stage_view_cogl_class_init (ClutterStageViewCoglClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = clutter_stage_view_cogl_finalize;
object_class->dispose = clutter_stage_view_cogl_dispose;
}

View File

@ -1,297 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2010,2011 Intel Corporation.
* 2011 Giovanni Campagna <scampa.giovanni@gmail.com>
*
* 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/>.
* Authors:
* Matthew Allum
* Emmanuele Bassi
* Robert Bragg
* Neil Roberts
*/
#include "clutter-build-config.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include "clutter-backend-eglnative.h"
/* This is a Cogl based backend */
#include "cogl/clutter-stage-cogl.h"
#include "clutter-debug.h"
#include "clutter-private.h"
#include "clutter-main.h"
#include "clutter-stage-private.h"
#include "clutter-settings-private.h"
#ifdef COGL_HAS_EGL_SUPPORT
#include "clutter-egl.h"
#endif
G_DEFINE_TYPE (ClutterBackendEglNative, clutter_backend_egl_native, CLUTTER_TYPE_BACKEND);
static void
clutter_backend_egl_native_dispose (GObject *gobject)
{
ClutterBackendEglNative *backend_egl_native = CLUTTER_BACKEND_EGL_NATIVE (gobject);
g_clear_object (&backend_egl_native->xsettings);
if (backend_egl_native->event_timer != NULL)
{
g_timer_destroy (backend_egl_native->event_timer);
backend_egl_native->event_timer = NULL;
}
G_OBJECT_CLASS (clutter_backend_egl_native_parent_class)->dispose (gobject);
}
static void
clutter_backend_egl_native_class_init (ClutterBackendEglNativeClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->dispose = clutter_backend_egl_native_dispose;
}
typedef struct
{
cairo_antialias_t cairo_antialias;
gint clutter_font_antialias;
cairo_hint_style_t cairo_hint_style;
const char *clutter_font_hint_style;
cairo_subpixel_order_t cairo_subpixel_order;
const char *clutter_font_subpixel_order;
} FontSettings;
static void
get_font_gsettings (GSettings *xsettings,
FontSettings *output)
{
/* org.gnome.settings-daemon.GsdFontAntialiasingMode */
static const struct
{
cairo_antialias_t cairo_antialias;
gint clutter_font_antialias;
}
antialiasings[] =
{
/* none=0 */ {CAIRO_ANTIALIAS_NONE, 0},
/* grayscale=1 */ {CAIRO_ANTIALIAS_GRAY, 1},
/* rgba=2 */ {CAIRO_ANTIALIAS_SUBPIXEL, 1},
};
/* org.gnome.settings-daemon.GsdFontHinting */
static const struct
{
cairo_hint_style_t cairo_hint_style;
const char *clutter_font_hint_style;
}
hintings[] =
{
/* none=0 */ {CAIRO_HINT_STYLE_NONE, "hintnone"},
/* slight=1 */ {CAIRO_HINT_STYLE_SLIGHT, "hintslight"},
/* medium=2 */ {CAIRO_HINT_STYLE_MEDIUM, "hintmedium"},
/* full=3 */ {CAIRO_HINT_STYLE_FULL, "hintfull"},
};
/* org.gnome.settings-daemon.GsdFontRgbaOrder */
static const struct
{
cairo_subpixel_order_t cairo_subpixel_order;
const char *clutter_font_subpixel_order;
}
rgba_orders[] =
{
/* rgba=0 */ {CAIRO_SUBPIXEL_ORDER_RGB, "rgb"}, /* XXX what is 'rgba'? */
/* rgb=1 */ {CAIRO_SUBPIXEL_ORDER_RGB, "rgb"},
/* bgr=2 */ {CAIRO_SUBPIXEL_ORDER_BGR, "bgr"},
/* vrgb=3 */ {CAIRO_SUBPIXEL_ORDER_VRGB, "vrgb"},
/* vbgr=4 */ {CAIRO_SUBPIXEL_ORDER_VBGR, "vbgr"},
};
guint i;
i = g_settings_get_enum (xsettings, "hinting");
if (i < G_N_ELEMENTS (hintings))
{
output->cairo_hint_style = hintings[i].cairo_hint_style;
output->clutter_font_hint_style = hintings[i].clutter_font_hint_style;
}
else
{
output->cairo_hint_style = CAIRO_HINT_STYLE_DEFAULT;
output->clutter_font_hint_style = NULL;
}
i = g_settings_get_enum (xsettings, "antialiasing");
if (i < G_N_ELEMENTS (antialiasings))
{
output->cairo_antialias = antialiasings[i].cairo_antialias;
output->clutter_font_antialias = antialiasings[i].clutter_font_antialias;
}
else
{
output->cairo_antialias = CAIRO_ANTIALIAS_DEFAULT;
output->clutter_font_antialias = -1;
}
i = g_settings_get_enum (xsettings, "rgba-order");
if (i < G_N_ELEMENTS (rgba_orders))
{
output->cairo_subpixel_order = rgba_orders[i].cairo_subpixel_order;
output->clutter_font_subpixel_order = rgba_orders[i].clutter_font_subpixel_order;
}
else
{
output->cairo_subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
output->clutter_font_subpixel_order = NULL;
}
if (output->cairo_antialias == CAIRO_ANTIALIAS_GRAY)
output->clutter_font_subpixel_order = "none";
}
static void
init_font_options (ClutterBackendEglNative *backend_egl_native)
{
GSettings *xsettings = backend_egl_native->xsettings;
cairo_font_options_t *options = cairo_font_options_create ();
FontSettings fs;
get_font_gsettings (xsettings, &fs);
cairo_font_options_set_hint_style (options, fs.cairo_hint_style);
cairo_font_options_set_antialias (options, fs.cairo_antialias);
cairo_font_options_set_subpixel_order (options, fs.cairo_subpixel_order);
clutter_backend_set_font_options (CLUTTER_BACKEND (backend_egl_native),
options);
cairo_font_options_destroy (options);
}
static gboolean
on_xsettings_change_event (GSettings *xsettings,
gpointer keys,
gint n_keys,
gpointer user_data)
{
/*
* A simpler alternative to this function that does not update the screen
* immediately (like macOS :P):
*
* init_font_options (CLUTTER_BACKEND_EGL_NATIVE (user_data));
*
* which has the added benefit of eliminating the need for all the
* FontSettings.clutter_ fields. However the below approach is better for
* testing settings and more consistent with the existing x11 backend...
*/
ClutterSettings *csettings = clutter_settings_get_default ();
FontSettings fs;
gint hinting;
get_font_gsettings (xsettings, &fs);
hinting = fs.cairo_hint_style == CAIRO_HINT_STYLE_NONE ? 0 : 1;
g_object_set (csettings,
"font-hinting", hinting,
"font-hint-style", fs.clutter_font_hint_style,
"font-antialias", fs.clutter_font_antialias,
"font-subpixel-order", fs.clutter_font_subpixel_order,
NULL);
return FALSE;
}
static void
clutter_backend_egl_native_init (ClutterBackendEglNative *backend_egl_native)
{
static const gchar xsettings_path[] = "org.gnome.settings-daemon.plugins.xsettings";
GSettingsSchemaSource *source = g_settings_schema_source_get_default ();
GSettingsSchema *schema = g_settings_schema_source_lookup (source,
xsettings_path,
TRUE);
if (!schema)
{
g_warning ("Failed to find schema: %s", xsettings_path);
}
else
{
backend_egl_native->xsettings = g_settings_new_full (schema, NULL, NULL);
if (backend_egl_native->xsettings)
{
init_font_options (backend_egl_native);
g_signal_connect (backend_egl_native->xsettings, "change-event",
G_CALLBACK (on_xsettings_change_event),
backend_egl_native);
}
}
backend_egl_native->event_timer = g_timer_new ();
}
ClutterBackend *
clutter_backend_egl_native_new (void)
{
return g_object_new (CLUTTER_TYPE_BACKEND_EGL_NATIVE, NULL);
}
/**
* clutter_egl_get_egl_display:
*
* Retrieves the EGL display used by Clutter, if it supports the
* EGL windowing system and if it is running using an EGL backend.
*
* Return value: the EGL display used by Clutter, or 0
*
* Since: 1.6
*/
EGLDisplay
clutter_egl_get_egl_display (void)
{
ClutterBackend *backend;
if (!_clutter_context_is_initialized ())
{
g_critical ("The Clutter backend has not been initialized yet");
return 0;
}
backend = clutter_get_default_backend ();
if (!CLUTTER_IS_BACKEND_EGL_NATIVE (backend))
{
g_critical ("The Clutter backend is not an EGL backend");
return 0;
}
#ifdef COGL_HAS_EGL_SUPPORT
return cogl_egl_context_get_egl_display (backend->cogl_context);
#else
return 0;
#endif
}

View File

@ -1,78 +0,0 @@
/* Clutter.
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2006, 2007 OpenedHand
* Copyright (C) 2010 Intel Corp
* 2011 Giovanni Campagna <scampa.giovanni@gmail.com>
*
* 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/>.
*
* Authors:
* Matthew Allum
* Robert Bragg
*/
#ifndef __CLUTTER_BACKEND_EGL_NATIVE_H__
#define __CLUTTER_BACKEND_EGL_NATIVE_H__
#include <glib-object.h>
#include <gio/gio.h>
#include <cogl/cogl.h>
#include <cogl/cogl-egl.h>
#include <clutter/clutter-event.h>
#include <clutter/clutter-backend.h>
#include "clutter-backend-private.h"
G_BEGIN_DECLS
#define CLUTTER_TYPE_BACKEND_EGL_NATIVE (clutter_backend_egl_native_get_type ())
#define CLUTTER_BACKEND_EGL_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_BACKEND_EGL_NATIVE, ClutterBackendEglNative))
#define CLUTTER_IS_BACKEND_EGL_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_BACKEND_EGL_NATIVE))
#define CLUTTER_BACKEND_EGL_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_BACKEND_EGL_NATIVE, ClutterBackendEglNativeClass))
#define CLUTTER_IS_BACKEND_EGL_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BACKEND_EGL_NATIVE))
#define CLUTTER_BACKEND_EGL_NATIVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_BACKEND_EGL_NATIVE, ClutterBackendEglNativeClass))
typedef struct _ClutterBackendEglNative ClutterBackendEglNative;
typedef struct _ClutterBackendEglNativeClass ClutterBackendEglNativeClass;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackendEglNative, g_object_unref)
struct _ClutterBackendEglNative
{
ClutterBackend parent_instance;
/* event source */
GSource *event_source;
/* event timer */
GTimer *event_timer;
/* "xsettings" is still the defacto place for Xft settings, even in Wayland */
GSettings *xsettings;
};
struct _ClutterBackendEglNativeClass
{
ClutterBackendClass parent_class;
};
CLUTTER_EXPORT
GType clutter_backend_egl_native_get_type (void) G_GNUC_CONST;
ClutterBackend *clutter_backend_egl_native_new (void);
G_END_DECLS
#endif /* __CLUTTER_BACKEND_EGL_NATIVE_H__ */

View File

@ -1,59 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2006 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
/**
* SECTION:clutter-egl
* @short_description: EGL specific API
*
* The EGL backend for Clutter provides some EGL specific API
*
* You need to include `clutter-egl.h` to have access to the functions documented here.
*/
#ifndef __CLUTTER_EGL_H__
#define __CLUTTER_EGL_H__
#include <glib.h>
#include "clutter-egl-headers.h"
#include <clutter/clutter.h>
G_BEGIN_DECLS
/**
* clutter_egl_get_egl_display:
*
* Retrieves the #EGLDisplay used by Clutter.
*
* Return value: the EGL display
*
* Since: 1.6
*/
CLUTTER_EXPORT
EGLDisplay clutter_egl_get_egl_display (void);
G_END_DECLS
#endif /* __CLUTTER_EGL_H__ */

View File

@ -257,13 +257,6 @@ if have_x11
clutter_backend_nonintrospected_sources += clutter_x11_nonintrospected_sources
endif
if have_native_backend
clutter_native_nonintrospected_sources = [
'egl/clutter-backend-eglnative.c',
]
clutter_backend_nonintrospected_sources += clutter_native_nonintrospected_sources
endif
if have_wayland
clutter_wayland_private_headers = [
'wayland/clutter-wayland-compositor.h',

View File

@ -98,7 +98,6 @@ static const gchar *atom_names[] = {
/* various flags corresponding to pre init setup calls */
static gboolean clutter_enable_xinput = TRUE;
static gboolean clutter_enable_argb = FALSE;
static gboolean clutter_enable_stereo = FALSE;
static Display *_foreign_dpy = NULL;
@ -240,13 +239,6 @@ clutter_backend_x11_pre_parse (ClutterBackend *backend,
env_string = NULL;
}
env_string = g_getenv ("CLUTTER_DISABLE_ARGB_VISUAL");
if (env_string)
{
clutter_enable_argb = FALSE;
env_string = NULL;
}
env_string = g_getenv ("CLUTTER_DISABLE_XINPUT");
if (env_string)
{
@ -550,15 +542,12 @@ clutter_backend_x11_get_renderer (ClutterBackend *backend,
static gboolean
check_onscreen_template (CoglRenderer *renderer,
CoglSwapChain *swap_chain,
CoglOnscreenTemplate *onscreen_template,
gboolean enable_argb,
gboolean enable_stereo,
GError **error)
{
GError *internal_error = NULL;
cogl_swap_chain_set_has_alpha (swap_chain, enable_argb);
cogl_onscreen_template_set_stereo_enabled (onscreen_template,
clutter_enable_stereo);
@ -573,17 +562,15 @@ check_onscreen_template (CoglRenderer *renderer,
*/
if (cogl_renderer_check_onscreen_template (renderer, onscreen_template, &internal_error))
{
clutter_enable_argb = enable_argb;
clutter_enable_stereo = enable_stereo;
return TRUE;
}
else
{
if (enable_argb || enable_stereo) /* More possibilities to try */
if (enable_stereo) /* More possibilities to try */
CLUTTER_NOTE (BACKEND,
"Creation of a CoglDisplay with alpha=%s, stereo=%s failed: %s",
enable_argb ? "enabled" : "disabled",
"Creation of a CoglDisplay with, stereo=%s failed: %s",
enable_stereo ? "enabled" : "disabled",
internal_error != NULL
? internal_error->message
@ -611,8 +598,7 @@ clutter_backend_x11_get_display (ClutterBackend *backend,
CoglDisplay *display = NULL;
gboolean res = FALSE;
CLUTTER_NOTE (BACKEND, "Creating CoglDisplay, alpha=%s, stereo=%s",
clutter_enable_argb ? "enabled" : "disabled",
CLUTTER_NOTE (BACKEND, "Creating CoglDisplay, stereo=%s",
clutter_enable_stereo ? "enabled" : "disabled");
onscreen_template = cogl_onscreen_template_new (swap_chain);
@ -620,22 +606,13 @@ clutter_backend_x11_get_display (ClutterBackend *backend,
/* It's possible that the current renderer doesn't support transparency
* or doesn't support stereo, so we try the different combinations.
*/
if (clutter_enable_argb && clutter_enable_stereo)
res = check_onscreen_template (renderer, swap_chain, onscreen_template,
TRUE, TRUE, error);
/* Prioritize stereo over alpha */
if (!res && clutter_enable_stereo)
res = check_onscreen_template (renderer, swap_chain, onscreen_template,
FALSE, TRUE, error);
if (!res && clutter_enable_argb)
res = check_onscreen_template (renderer, swap_chain, onscreen_template,
TRUE, FALSE, error);
if (clutter_enable_stereo)
res = check_onscreen_template (renderer, onscreen_template,
TRUE, error);
if (!res)
res = check_onscreen_template (renderer, swap_chain, onscreen_template,
FALSE, FALSE, error);
res = check_onscreen_template (renderer, onscreen_template,
FALSE, error);
if (res)
display = cogl_display_new (renderer, onscreen_template);
@ -929,99 +906,6 @@ clutter_x11_remove_filter (ClutterX11FilterFunc func,
}
}
/**
* clutter_x11_has_composite_extension:
*
* Retrieves whether Clutter is running on an X11 server with the
* XComposite extension
*
* Return value: %TRUE if the XComposite extension is available
*/
gboolean
clutter_x11_has_composite_extension (void)
{
static gboolean have_composite = FALSE, done_check = FALSE;
int error = 0, event = 0;
Display *dpy;
if (done_check)
return have_composite;
if (!_clutter_context_is_initialized ())
{
g_critical ("X11 backend has not been initialised");
return FALSE;
}
dpy = clutter_x11_get_default_display();
if (dpy == NULL)
return FALSE;
if (XCompositeQueryExtension (dpy, &event, &error))
{
int major = 0, minor = 0;
if (XCompositeQueryVersion (dpy, &major, &minor))
{
if (major >= 0 && minor >= 3)
have_composite = TRUE;
}
}
done_check = TRUE;
return have_composite;
}
/**
* clutter_x11_set_use_argb_visual:
* @use_argb: %TRUE if ARGB visuals should be requested by default
*
* Sets whether the Clutter X11 backend should request ARGB visuals by default
* or not.
*
* By default, Clutter requests RGB visuals.
*
* If no ARGB visuals are found, the X11 backend will fall back to
* requesting a RGB visual instead.
*
* ARGB visuals are required for the #ClutterStage:use-alpha property to work.
*
* This function can only be called once, and before clutter_init() is
* called.
*
* Since: 1.2
*/
void
clutter_x11_set_use_argb_visual (gboolean use_argb)
{
if (_clutter_context_is_initialized ())
{
g_warning ("%s() can only be used before calling clutter_init()",
G_STRFUNC);
return;
}
CLUTTER_NOTE (BACKEND, "ARGB visuals are %s",
use_argb ? "enabled" : "disabled");
clutter_enable_argb = use_argb;
}
/**
* clutter_x11_get_use_argb_visual:
*
* Retrieves whether the Clutter X11 backend is using ARGB visuals by default
*
* Return value: %TRUE if ARGB visuals are queried by default
*
* Since: 1.2
*/
gboolean
clutter_x11_get_use_argb_visual (void)
{
return clutter_enable_argb;
}
/**
* clutter_x11_set_use_stereo_stage:
* @use_stereo: %TRUE if the stereo stages should be used if possible.

View File

@ -8,12 +8,6 @@ static const struct {
} _clutter_settings_map[] = {
{ "Net/DoubleClickDistance", "double-click-distance" },
{ "Net/DndDragThreshold", "dnd-drag-threshold" },
{ "Gtk/FontName", "font-name" },
{ "Xft/Antialias", "font-antialias" },
{ "Xft/Hinting", "font-hinting" },
{ "Xft/HintStyle", "font-hint-style" },
{ "Xft/RGBA", "font-subpixel-order" },
{ "Fontconfig/Timestamp", "fontconfig-timestamp" },
};
static const gint _n_clutter_settings_map = G_N_ELEMENTS (_clutter_settings_map);

View File

@ -109,14 +109,6 @@ CLUTTER_EXPORT
void clutter_x11_remove_filter (ClutterX11FilterFunc func,
gpointer data);
CLUTTER_EXPORT
gboolean clutter_x11_has_composite_extension (void);
CLUTTER_EXPORT
void clutter_x11_set_use_argb_visual (gboolean use_argb);
CLUTTER_EXPORT
gboolean clutter_x11_get_use_argb_visual (void);
CLUTTER_EXPORT
void clutter_x11_set_use_stereo_stage (gboolean use_stereo);
CLUTTER_EXPORT

View File

@ -351,6 +351,14 @@ _cogl_bitmap_needs_short_temp_buffer (CoglPixelFormat format)
case COGL_PIXEL_FORMAT_BGRA_1010102_PRE:
case COGL_PIXEL_FORMAT_ARGB_2101010_PRE:
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
case COGL_PIXEL_FORMAT_RGBA_FP_16161616:
case COGL_PIXEL_FORMAT_BGRA_FP_16161616:
case COGL_PIXEL_FORMAT_ARGB_FP_16161616:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616:
case COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE:
return TRUE;
}

View File

@ -40,13 +40,13 @@
#define UNPACK_2(b) (((b) * ((1 << (sizeof (component_type) * 8)) - 1) + \
1) / 3)
#define UNPACK_4(b) (((b) * ((1 << (sizeof (component_type) * 8)) - 1) + \
7) / 15)
7) / 0xf)
#define UNPACK_5(b) (((b) * ((1 << (sizeof (component_type) * 8)) - 1) + \
15) / 31)
0xf) / 0x1f)
#define UNPACK_6(b) (((b) * ((1 << (sizeof (component_type) * 8)) - 1) + \
31) / 63)
0x1f) / 0x3f)
#define UNPACK_10(b) (((b) * ((1 << (sizeof (component_type) * 8)) - 1) + \
511) / 1023)
0x1ff) / 0x3ff)
inline static void
G_PASTE (_cogl_unpack_a_8_, component_size) (const uint8_t *src,
@ -207,8 +207,8 @@ G_PASTE (_cogl_unpack_rgb_565_, component_size) (const uint8_t *src,
uint16_t v = *(const uint16_t *) src;
dst[0] = UNPACK_5 (v >> 11);
dst[1] = UNPACK_6 ((v >> 5) & 63);
dst[2] = UNPACK_5 (v & 31);
dst[1] = UNPACK_6 ((v >> 5) & 0x3f);
dst[2] = UNPACK_5 (v & 0x1f);
dst[3] = UNPACK_BYTE (255);
dst += 4;
src += 2;
@ -225,9 +225,9 @@ G_PASTE (_cogl_unpack_rgba_4444_, component_size) (const uint8_t *src,
uint16_t v = *(const uint16_t *) src;
dst[0] = UNPACK_4 (v >> 12);
dst[1] = UNPACK_4 ((v >> 8) & 15);
dst[2] = UNPACK_4 ((v >> 4) & 15);
dst[3] = UNPACK_4 (v & 15);
dst[1] = UNPACK_4 ((v >> 8) & 0xf);
dst[2] = UNPACK_4 ((v >> 4) & 0xf);
dst[3] = UNPACK_4 (v & 0xf);
dst += 4;
src += 2;
}
@ -243,8 +243,8 @@ G_PASTE (_cogl_unpack_rgba_5551_, component_size) (const uint8_t *src,
uint16_t v = *(const uint16_t *) src;
dst[0] = UNPACK_5 (v >> 11);
dst[1] = UNPACK_5 ((v >> 6) & 31);
dst[2] = UNPACK_5 ((v >> 1) & 31);
dst[1] = UNPACK_5 ((v >> 6) & 0x1f);
dst[2] = UNPACK_5 ((v >> 1) & 0x1f);
dst[3] = UNPACK_1 (v & 1);
dst += 4;
src += 2;
@ -261,8 +261,8 @@ G_PASTE (_cogl_unpack_rgba_1010102_, component_size) (const uint8_t *src,
uint32_t v = *(const uint32_t *) src;
dst[0] = UNPACK_10 (v >> 22);
dst[1] = UNPACK_10 ((v >> 12) & 1023);
dst[2] = UNPACK_10 ((v >> 2) & 1023);
dst[1] = UNPACK_10 ((v >> 12) & 0x3ff);
dst[2] = UNPACK_10 ((v >> 2) & 0x3ff);
dst[3] = UNPACK_2 (v & 3);
dst += 4;
src += 2;
@ -279,8 +279,8 @@ G_PASTE (_cogl_unpack_bgra_1010102_, component_size) (const uint8_t *src,
uint32_t v = *(const uint32_t *) src;
dst[2] = UNPACK_10 (v >> 22);
dst[1] = UNPACK_10 ((v >> 12) & 1023);
dst[0] = UNPACK_10 ((v >> 2) & 1023);
dst[1] = UNPACK_10 ((v >> 12) & 0x3ff);
dst[0] = UNPACK_10 ((v >> 2) & 0x3ff);
dst[3] = UNPACK_2 (v & 3);
dst += 4;
src += 2;
@ -297,9 +297,9 @@ G_PASTE (_cogl_unpack_argb_2101010_, component_size) (const uint8_t *src,
uint32_t v = *(const uint32_t *) src;
dst[3] = UNPACK_2 (v >> 30);
dst[0] = UNPACK_10 ((v >> 20) & 1023);
dst[1] = UNPACK_10 ((v >> 10) & 1023);
dst[2] = UNPACK_10 (v & 1023);
dst[0] = UNPACK_10 ((v >> 20) & 0x3ff);
dst[1] = UNPACK_10 ((v >> 10) & 0x3ff);
dst[2] = UNPACK_10 (v & 0x3ff);
dst += 4;
src += 2;
}
@ -315,14 +315,22 @@ G_PASTE (_cogl_unpack_abgr_2101010_, component_size) (const uint8_t *src,
uint32_t v = *(const uint32_t *) src;
dst[3] = UNPACK_2 (v >> 30);
dst[2] = UNPACK_10 ((v >> 20) & 1023);
dst[1] = UNPACK_10 ((v >> 10) & 1023);
dst[0] = UNPACK_10 (v & 1023);
dst[2] = UNPACK_10 ((v >> 20) & 0x3ff);
dst[1] = UNPACK_10 ((v >> 10) & 0x3ff);
dst[0] = UNPACK_10 (v & 0x3ff);
dst += 4;
src += 2;
}
}
inline static void
G_PASTE (_cogl_unpack_argb_fp_16161616_, component_size) (const uint8_t *src,
component_type *dst,
int width)
{
g_warning ("Not implemented");
}
#undef UNPACK_1
#undef UNPACK_2
#undef UNPACK_4
@ -396,6 +404,16 @@ G_PASTE (_cogl_unpack_, component_size) (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
G_PASTE (_cogl_unpack_abgr_2101010_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGBA_FP_16161616:
case COGL_PIXEL_FORMAT_BGRA_FP_16161616:
case COGL_PIXEL_FORMAT_ARGB_FP_16161616:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616:
case COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE:
G_PASTE (_cogl_unpack_argb_fp_16161616_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_DEPTH_16:
case COGL_PIXEL_FORMAT_DEPTH_32:
case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
@ -414,10 +432,10 @@ G_PASTE (_cogl_unpack_, component_size) (CoglPixelFormat format,
#define PACK_1(b) PACK_SIZE (b, 1)
#define PACK_2(b) PACK_SIZE (b, 3)
#define PACK_4(b) PACK_SIZE (b, 15)
#define PACK_5(b) PACK_SIZE (b, 31)
#define PACK_6(b) PACK_SIZE (b, 63)
#define PACK_10(b) PACK_SIZE (b, 1023)
#define PACK_4(b) PACK_SIZE (b, 0xf)
#define PACK_5(b) PACK_SIZE (b, 0x1f)
#define PACK_6(b) PACK_SIZE (b, 0x3f)
#define PACK_10(b) PACK_SIZE (b, 0x3ff)
inline static void
G_PASTE (_cogl_pack_a_8_, component_size) (const component_type *src,
@ -683,6 +701,14 @@ G_PASTE (_cogl_pack_abgr_2101010_, component_size) (const component_type *src,
}
}
inline static void
G_PASTE (_cogl_pack_argb_fp_16161616_, component_size) (const component_type *src,
uint8_t *dst,
int width)
{
g_warning ("Not implemented");
}
#undef PACK_SIZE
#undef PACK_1
#undef PACK_2
@ -757,6 +783,16 @@ G_PASTE (_cogl_pack_, component_size) (CoglPixelFormat format,
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
G_PASTE (_cogl_pack_abgr_2101010_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_RGBA_FP_16161616:
case COGL_PIXEL_FORMAT_BGRA_FP_16161616:
case COGL_PIXEL_FORMAT_ARGB_FP_16161616:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616:
case COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE:
G_PASTE (_cogl_pack_argb_fp_16161616_, component_size) (src, dst, width);
break;
case COGL_PIXEL_FORMAT_DEPTH_16:
case COGL_PIXEL_FORMAT_DEPTH_32:
case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:

View File

@ -30,6 +30,7 @@
#include "cogl-config.h"
#include "cogl-mutter.h"
#include "cogl-object.h"
#include "cogl-private.h"
#include "cogl-profile.h"
@ -464,3 +465,10 @@ cogl_context_is_hardware_accelerated (CoglContext *context)
{
return context->driver_vtable->is_hardware_accelerated (context);
}
gboolean
cogl_context_format_supports_upload (CoglContext *ctx,
CoglPixelFormat format)
{
return ctx->texture_driver->format_supports_upload (ctx, format);
}

View File

@ -325,7 +325,7 @@ foreach_clamped_region (CoglMetaTexture *meta_texture,
if (*tx_1 < 0)
{
clamp_data.start = *tx_1;
clamp_data.end = MIN (0, *tx_2);;
clamp_data.end = MIN (0, *tx_2);
cogl_meta_texture_foreach_in_region (meta_texture,
half_texel_width, *ty_1,
half_texel_width, *ty_2,
@ -377,7 +377,7 @@ foreach_clamped_region (CoglMetaTexture *meta_texture,
if (*ty_1 < 0)
{
clamp_data.start = *ty_1;
clamp_data.end = MIN (0, *ty_2);;
clamp_data.end = MIN (0, *ty_2);
cogl_meta_texture_foreach_in_region (meta_texture,
*tx_1, half_texel_height,
*tx_2, half_texel_height,
@ -396,7 +396,7 @@ foreach_clamped_region (CoglMetaTexture *meta_texture,
/* Handle any bottom clamped region */
if (*ty_2 > max_t_coord)
{
clamp_data.start = MAX (max_t_coord, *ty_1);;
clamp_data.start = MAX (max_t_coord, *ty_1);
clamp_data.end = *ty_2;
cogl_meta_texture_foreach_in_region (meta_texture,
*tx_1,

View File

@ -48,4 +48,8 @@ void cogl_renderer_set_custom_winsys (CoglRenderer *renderer,
CoglCustomWinsysVtableGetter winsys_vtable_getter,
void *user_data);
COGL_EXPORT
gboolean cogl_context_format_supports_upload (CoglContext *ctx,
CoglPixelFormat format);
#endif /* __COGL_MUTTER_H___ */

View File

@ -245,6 +245,62 @@ static const CoglPixelFormatInfo format_info_table[] = {
.aligned = 0,
.bpp = { 4 },
},
{
.cogl_format = COGL_PIXEL_FORMAT_RGBA_FP_16161616,
.format_str = "RGBA_FP_16161616",
.n_planes = 1,
.bpp = { 8 },
.aligned = 1
},
{
.cogl_format = COGL_PIXEL_FORMAT_BGRA_FP_16161616,
.format_str = "BGRA_FP_16161616",
.n_planes = 1,
.bpp = { 8 },
.aligned = 1
},
{
.cogl_format = COGL_PIXEL_FORMAT_ARGB_FP_16161616,
.format_str = "ARGB_FP_16161616",
.n_planes = 1,
.bpp = { 8 },
.aligned = 1
},
{
.cogl_format = COGL_PIXEL_FORMAT_ABGR_FP_16161616,
.format_str = "ABGR_FP_16161616",
.n_planes = 1,
.bpp = { 8 },
.aligned = 1
},
{
.cogl_format = COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE,
.format_str = "RGBA_FP_16161616_PRE",
.n_planes = 1,
.bpp = { 8 },
.aligned = 1
},
{
.cogl_format = COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE,
.format_str = "BGRA_FP_16161616_PRE",
.n_planes = 1,
.bpp = { 8 },
.aligned = 1
},
{
.cogl_format = COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE,
.format_str = "ARGB_FP_16161616_PRE",
.n_planes = 1,
.bpp = { 8 },
.aligned = 1
},
{
.cogl_format = COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE,
.format_str = "ABGR_FP_16161616_PRE",
.n_planes = 1,
.bpp = { 8 },
.aligned = 1
},
{
.cogl_format = COGL_PIXEL_FORMAT_DEPTH_16,
.format_str = "DEPTH_16",

View File

@ -103,7 +103,7 @@ G_BEGIN_DECLS
* 7 = YUV: undefined bpp, undefined alignment
* 9 = 2 bpp, aligned
* 10 = depth, aligned (8, 16, 24, 32, 32f)
* 11 = undefined
* 11 = 8 bpp fp16
* 12 = 3 bpp, not aligned
* 13 = 4 bpp, not aligned (e.g. 2101010)
* 14-15 = undefined
@ -168,6 +168,14 @@ G_BEGIN_DECLS
* @COGL_PIXEL_FORMAT_BGRA_1010102_PRE: Premultiplied BGRA, 32 bits, 10 bpc
* @COGL_PIXEL_FORMAT_ARGB_2101010_PRE: Premultiplied ARGB, 32 bits, 10 bpc
* @COGL_PIXEL_FORMAT_ABGR_2101010_PRE: Premultiplied ABGR, 32 bits, 10 bpc
* @COGL_PIXEL_FORMAT_RGBA_FP_16161616: RGBA half floating point, 64 bit
* @COGL_PIXEL_FORMAT_BGRA_FP_16161616: BGRA half floating point, 64 bit
* @COGL_PIXEL_FORMAT_ARGB_FP_16161616: ARGB half floating point, 64 bit
* @COGL_PIXEL_FORMAT_ABGR_FP_16161616: ABGR half floating point, 64 bit
* @COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE: Premultiplied RGBA half floating point, 64 bit
* @COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE: Premultiplied BGRA half floating point, 64 bit
* @COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE: Premultiplied ARGB half floating point, 64 bit
* @COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE: Premultiplied ABGR half floating point, 64 bit
*
* Pixel formats used by Cogl. For the formats with a byte per
* component, the order of the components specify the order in
@ -216,6 +224,11 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
COGL_PIXEL_FORMAT_ARGB_2101010 = (13 | COGL_A_BIT | COGL_AFIRST_BIT),
COGL_PIXEL_FORMAT_ABGR_2101010 = (13 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
COGL_PIXEL_FORMAT_RGBA_FP_16161616 = (11 | COGL_A_BIT),
COGL_PIXEL_FORMAT_BGRA_FP_16161616 = (11 | COGL_A_BIT | COGL_BGR_BIT),
COGL_PIXEL_FORMAT_ARGB_FP_16161616 = (11 | COGL_A_BIT | COGL_AFIRST_BIT),
COGL_PIXEL_FORMAT_ABGR_FP_16161616 = (11 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
COGL_PIXEL_FORMAT_RGBA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT),
COGL_PIXEL_FORMAT_BGRA_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT),
COGL_PIXEL_FORMAT_ARGB_8888_PRE = (3 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_AFIRST_BIT),
@ -228,6 +241,11 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/
COGL_PIXEL_FORMAT_ARGB_2101010_PRE = (COGL_PIXEL_FORMAT_ARGB_2101010 | COGL_PREMULT_BIT),
COGL_PIXEL_FORMAT_ABGR_2101010_PRE = (COGL_PIXEL_FORMAT_ABGR_2101010 | COGL_PREMULT_BIT),
COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE = (11 | COGL_A_BIT | COGL_PREMULT_BIT),
COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE = (11 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT),
COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE = (11 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_AFIRST_BIT),
COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE = (11 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
COGL_PIXEL_FORMAT_DEPTH_16 = (9 | COGL_DEPTH_BIT),
COGL_PIXEL_FORMAT_DEPTH_32 = (3 | COGL_DEPTH_BIT),

View File

@ -46,6 +46,8 @@ typedef enum
COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL,
COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_BGRA8888,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_RGBA1010102,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_HALF_FLOAT,
COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE,
COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS,
COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT,

View File

@ -37,8 +37,6 @@ struct _CoglSwapChain
{
CoglObject _parent;
gboolean has_alpha;
int length;
};

View File

@ -59,13 +59,6 @@ cogl_swap_chain_new (void)
return _cogl_swap_chain_object_new (swap_chain);
}
void
cogl_swap_chain_set_has_alpha (CoglSwapChain *swap_chain,
gboolean has_alpha)
{
swap_chain->has_alpha = has_alpha;
}
void
cogl_swap_chain_set_length (CoglSwapChain *swap_chain,
int length)

View File

@ -128,6 +128,11 @@ struct _CoglTextureDriver
int width,
int height);
gboolean
(* format_supports_upload) (CoglContext *ctx,
CoglPixelFormat format);
/*
* The driver may impose constraints on what formats can be used to store
* texture data read from textures. For example GLES currently only supports

View File

@ -428,10 +428,6 @@ typedef enum _CoglWinsysFeature
* framebuffers at the same time. */
COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN,
/* Available if onscreen framebuffer swaps can be automatically
* throttled to the vblank frequency. */
COGL_WINSYS_FEATURE_SWAP_THROTTLE,
/* Available if its possible to query a counter that
* increments at each vblank. */
COGL_WINSYS_FEATURE_VBLANK_COUNTER,

View File

@ -288,6 +288,31 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
gltype = GL_UNSIGNED_SHORT_5_5_5_1;
break;
case COGL_PIXEL_FORMAT_RGBA_FP_16161616:
case COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE:
glintformat = GL_RGBA;
glformat = GL_RGBA;
gltype = GL_HALF_FLOAT;
break;
case COGL_PIXEL_FORMAT_BGRA_FP_16161616:
case COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE:
glintformat = GL_RGBA;
glformat = GL_BGRA;
gltype = GL_HALF_FLOAT;
break;
case COGL_PIXEL_FORMAT_ARGB_FP_16161616:
case COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE:
glintformat = GL_RGBA;
glformat = GL_BGRA;
gltype = GL_HALF_FLOAT;
break;
case COGL_PIXEL_FORMAT_ABGR_FP_16161616:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE:
glintformat = GL_RGBA;
glformat = GL_RGBA;
gltype = GL_HALF_FLOAT;
break;
case COGL_PIXEL_FORMAT_DEPTH_16:
glintformat = GL_DEPTH_COMPONENT16;
glformat = GL_DEPTH_COMPONENT;
@ -506,6 +531,14 @@ _cogl_driver_update_features (CoglContext *ctx,
COGL_FEATURE_ID_TEXTURE_RG,
TRUE);
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_RGBA1010102, TRUE);
if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 3, 0))
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_HALF_FLOAT,
TRUE);
/* Cache features */
for (i = 0; i < G_N_ELEMENTS (private_features); i++)
ctx->private_features[i] |= private_features[i];

View File

@ -396,6 +396,64 @@ _cogl_texture_driver_size_supported (CoglContext *ctx,
return new_width != 0;
}
static gboolean
_cogl_texture_driver_upload_supported (CoglContext *ctx,
CoglPixelFormat format)
{
switch (format)
{
case COGL_PIXEL_FORMAT_A_8:
case COGL_PIXEL_FORMAT_G_8:
case COGL_PIXEL_FORMAT_RG_88:
case COGL_PIXEL_FORMAT_BGRA_8888:
case COGL_PIXEL_FORMAT_BGRA_8888_PRE:
case COGL_PIXEL_FORMAT_RGB_888:
case COGL_PIXEL_FORMAT_BGR_888:
case COGL_PIXEL_FORMAT_RGBA_1010102:
case COGL_PIXEL_FORMAT_RGBA_1010102_PRE:
case COGL_PIXEL_FORMAT_BGRA_1010102:
case COGL_PIXEL_FORMAT_BGRA_1010102_PRE:
case COGL_PIXEL_FORMAT_ABGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
case COGL_PIXEL_FORMAT_ARGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010_PRE:
case COGL_PIXEL_FORMAT_RGBA_8888:
case COGL_PIXEL_FORMAT_RGBA_8888_PRE:
case COGL_PIXEL_FORMAT_ARGB_8888:
case COGL_PIXEL_FORMAT_ARGB_8888_PRE:
case COGL_PIXEL_FORMAT_ABGR_8888:
case COGL_PIXEL_FORMAT_ABGR_8888_PRE:
case COGL_PIXEL_FORMAT_RGB_565:
case COGL_PIXEL_FORMAT_RGBA_4444:
case COGL_PIXEL_FORMAT_RGBA_4444_PRE:
case COGL_PIXEL_FORMAT_RGBA_5551:
case COGL_PIXEL_FORMAT_RGBA_5551_PRE:
return TRUE;
case COGL_PIXEL_FORMAT_BGRA_FP_16161616:
case COGL_PIXEL_FORMAT_ARGB_FP_16161616:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616:
case COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_RGBA_FP_16161616:
case COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE:
if (_cogl_has_private_feature
(ctx, COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_HALF_FLOAT))
return TRUE;
else
return FALSE;
case COGL_PIXEL_FORMAT_DEPTH_16:
case COGL_PIXEL_FORMAT_DEPTH_32:
case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
case COGL_PIXEL_FORMAT_ANY:
case COGL_PIXEL_FORMAT_YUV:
return TRUE;
}
g_assert_not_reached ();
return FALSE;
}
static CoglPixelFormat
_cogl_texture_driver_find_best_gl_get_data_format
(CoglContext *context,
@ -419,5 +477,6 @@ _cogl_texture_driver_gl =
_cogl_texture_driver_prep_gl_for_pixels_download,
_cogl_texture_driver_gl_get_tex_image,
_cogl_texture_driver_size_supported,
_cogl_texture_driver_upload_supported,
_cogl_texture_driver_find_best_gl_get_data_format
};

View File

@ -56,6 +56,12 @@
#ifndef GL_RG8
#define GL_RG8 0x822B
#endif
#ifndef GL_UNSIGNED_INT_2_10_10_10_REV_EXT
#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
#endif
#ifndef GL_HALF_FLOAT_OES
#define GL_HALF_FLOAT_OES 0x8D61
#endif
static gboolean
_cogl_driver_pixel_format_from_gl_internal (CoglContext *context,
@ -138,21 +144,44 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
required_format = COGL_PIXEL_FORMAT_RGB_888;
break;
/* Just one 32-bit ordering supported */
case COGL_PIXEL_FORMAT_RGBA_8888:
case COGL_PIXEL_FORMAT_RGBA_8888_PRE:
case COGL_PIXEL_FORMAT_ARGB_8888:
case COGL_PIXEL_FORMAT_ARGB_8888_PRE:
case COGL_PIXEL_FORMAT_ABGR_8888:
case COGL_PIXEL_FORMAT_ABGR_8888_PRE:
case COGL_PIXEL_FORMAT_RGBA_1010102:
case COGL_PIXEL_FORMAT_RGBA_1010102_PRE:
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
if (_cogl_has_private_feature
(context, COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_RGBA1010102))
{
glintformat = GL_RGBA;
glformat = GL_RGBA;
gltype = GL_UNSIGNED_INT_2_10_10_10_REV_EXT;
break;
}
#endif
case COGL_PIXEL_FORMAT_BGRA_1010102:
case COGL_PIXEL_FORMAT_BGRA_1010102_PRE:
case COGL_PIXEL_FORMAT_ABGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
case COGL_PIXEL_FORMAT_ARGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010_PRE:
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
if (_cogl_has_private_feature
(context, COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_RGBA1010102))
{
glintformat = GL_RGBA;
glformat = GL_RGBA;
gltype = GL_UNSIGNED_INT_2_10_10_10_REV_EXT;
required_format = COGL_PIXEL_FORMAT_RGBA_1010102;
required_format |= (format & COGL_PREMULT_BIT);
break;
}
#endif
G_GNUC_FALLTHROUGH;
case COGL_PIXEL_FORMAT_RGBA_8888:
case COGL_PIXEL_FORMAT_RGBA_8888_PRE:
case COGL_PIXEL_FORMAT_ARGB_8888:
case COGL_PIXEL_FORMAT_ARGB_8888_PRE:
case COGL_PIXEL_FORMAT_ABGR_8888:
case COGL_PIXEL_FORMAT_ABGR_8888_PRE:
glintformat = GL_RGBA;
glformat = GL_RGBA;
gltype = GL_UNSIGNED_BYTE;
@ -181,6 +210,26 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
gltype = GL_UNSIGNED_SHORT_5_5_5_1;
break;
case COGL_PIXEL_FORMAT_BGRA_FP_16161616:
case COGL_PIXEL_FORMAT_ARGB_FP_16161616:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616:
case COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE:
g_warning ("Unhandled 16 bpc pixel format used");
G_GNUC_FALLTHROUGH;
case COGL_PIXEL_FORMAT_RGBA_FP_16161616:
case COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE:
if (!_cogl_has_private_feature
(context, COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_HALF_FLOAT))
g_warning ("Missing 16 bpc half float extension");
glintformat = GL_RGBA;
glformat = GL_RGBA;
gltype = GL_HALF_FLOAT_OES;
break;
case COGL_PIXEL_FORMAT_DEPTH_16:
glintformat = GL_DEPTH_COMPONENT;
glformat = GL_DEPTH_COMPONENT;
@ -355,6 +404,14 @@ _cogl_driver_update_features (CoglContext *context,
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_BGRA8888, TRUE);
if (_cogl_check_extension ("GL_EXT_texture_type_2_10_10_10_REV", gl_extensions))
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_RGBA1010102, TRUE);
if (_cogl_check_extension ("GL_OES_texture_half_float", gl_extensions))
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_HALF_FLOAT, TRUE);
if (_cogl_check_extension ("GL_EXT_unpack_subimage", gl_extensions))
COGL_FLAGS_SET (private_features,
COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE, TRUE);

View File

@ -439,6 +439,75 @@ _cogl_texture_driver_size_supported (CoglContext *ctx,
return width <= max_size && height <= max_size;
}
static gboolean
_cogl_texture_driver_upload_supported (CoglContext *ctx,
CoglPixelFormat format)
{
switch (format)
{
case COGL_PIXEL_FORMAT_A_8:
case COGL_PIXEL_FORMAT_G_8:
case COGL_PIXEL_FORMAT_RG_88:
case COGL_PIXEL_FORMAT_BGRA_8888:
case COGL_PIXEL_FORMAT_BGRA_8888_PRE:
case COGL_PIXEL_FORMAT_RGB_888:
case COGL_PIXEL_FORMAT_BGR_888:
return TRUE;
case COGL_PIXEL_FORMAT_RGBA_1010102:
case COGL_PIXEL_FORMAT_RGBA_1010102_PRE:
case COGL_PIXEL_FORMAT_BGRA_1010102:
case COGL_PIXEL_FORMAT_BGRA_1010102_PRE:
case COGL_PIXEL_FORMAT_ABGR_2101010:
case COGL_PIXEL_FORMAT_ABGR_2101010_PRE:
case COGL_PIXEL_FORMAT_ARGB_2101010:
case COGL_PIXEL_FORMAT_ARGB_2101010_PRE:
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
if (_cogl_has_private_feature
(ctx, COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_RGBA1010102))
return TRUE;
else
return FALSE;
#else
return FALSE;
#endif
case COGL_PIXEL_FORMAT_RGBA_8888:
case COGL_PIXEL_FORMAT_RGBA_8888_PRE:
case COGL_PIXEL_FORMAT_ARGB_8888:
case COGL_PIXEL_FORMAT_ARGB_8888_PRE:
case COGL_PIXEL_FORMAT_ABGR_8888:
case COGL_PIXEL_FORMAT_ABGR_8888_PRE:
case COGL_PIXEL_FORMAT_RGB_565:
case COGL_PIXEL_FORMAT_RGBA_4444:
case COGL_PIXEL_FORMAT_RGBA_4444_PRE:
case COGL_PIXEL_FORMAT_RGBA_5551:
case COGL_PIXEL_FORMAT_RGBA_5551_PRE:
return TRUE;
case COGL_PIXEL_FORMAT_BGRA_FP_16161616:
case COGL_PIXEL_FORMAT_ARGB_FP_16161616:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616:
case COGL_PIXEL_FORMAT_BGRA_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_ARGB_FP_16161616_PRE:
case COGL_PIXEL_FORMAT_ABGR_FP_16161616_PRE:
return FALSE;
case COGL_PIXEL_FORMAT_RGBA_FP_16161616:
case COGL_PIXEL_FORMAT_RGBA_FP_16161616_PRE:
if (_cogl_has_private_feature
(ctx, COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_HALF_FLOAT))
return TRUE;
else
return FALSE;
case COGL_PIXEL_FORMAT_DEPTH_16:
case COGL_PIXEL_FORMAT_DEPTH_32:
case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
case COGL_PIXEL_FORMAT_ANY:
case COGL_PIXEL_FORMAT_YUV:
return TRUE;
}
g_assert_not_reached ();
return FALSE;
}
static CoglPixelFormat
_cogl_texture_driver_find_best_gl_get_data_format
(CoglContext *context,
@ -463,5 +532,6 @@ _cogl_texture_driver_gles =
_cogl_texture_driver_prep_gl_for_pixels_download,
_cogl_texture_driver_gl_get_tex_image,
_cogl_texture_driver_size_supported,
_cogl_texture_driver_upload_supported,
_cogl_texture_driver_find_best_gl_get_data_format
};

View File

@ -50,7 +50,6 @@ typedef struct _CoglGLXDisplay
CoglGLXCachedConfig glx_cached_configs[COGL_GLX_N_CACHED_CONFIGS];
gboolean found_fbconfig;
gboolean fbconfig_has_rgba_visual;
gboolean is_direct;
gboolean have_vblank_counter;
gboolean can_vblank_wait;

View File

@ -223,7 +223,7 @@ egl_attributes_from_framebuffer_config (CoglDisplay *display,
attributes[i++] = 1;
attributes[i++] = EGL_ALPHA_SIZE;
attributes[i++] = config->swap_chain->has_alpha ? 1 : EGL_DONT_CARE;
attributes[i++] = EGL_DONT_CARE;
attributes[i++] = EGL_DEPTH_SIZE;
attributes[i++] = 1;

View File

@ -130,7 +130,7 @@ COGL_WINSYS_FEATURE_BEGIN (255, 255,
"SGI\0",
"swap_control\0",
0,
COGL_WINSYS_FEATURE_SWAP_THROTTLE)
0)
COGL_WINSYS_FEATURE_FUNCTION (int, glXSwapInterval,
(int interval))
COGL_WINSYS_FEATURE_END ()

View File

@ -885,7 +885,7 @@ glx_attributes_from_framebuffer_config (CoglDisplay *display,
attributes[i++] = GLX_BLUE_SIZE;
attributes[i++] = 1;
attributes[i++] = GLX_ALPHA_SIZE;
attributes[i++] = config->swap_chain->has_alpha ? 1 : GLX_DONT_CARE;
attributes[i++] = GLX_DONT_CARE;
attributes[i++] = GLX_DEPTH_SIZE;
attributes[i++] = 1;
attributes[i++] = GLX_STENCIL_SIZE;
@ -944,40 +944,8 @@ find_fbconfig (CoglDisplay *display,
goto done;
}
if (config->swap_chain->has_alpha)
{
int i;
for (i = 0; i < n_configs; i++)
{
XVisualInfo *vinfo;
vinfo = glx_renderer->glXGetVisualFromFBConfig (xlib_renderer->xdpy,
configs[i]);
if (vinfo == NULL)
continue;
if (vinfo->depth == 32 &&
(vinfo->red_mask | vinfo->green_mask | vinfo->blue_mask)
!= 0xffffffff)
{
COGL_NOTE (WINSYS, "Found an ARGB FBConfig [index:%d]", i);
*config_ret = configs[i];
goto done;
}
}
g_set_error_literal (error, COGL_WINSYS_ERROR,
COGL_WINSYS_ERROR_CREATE_CONTEXT,
"Unable to find fbconfig with rgba visual");
ret = FALSE;
goto done;
}
else
{
COGL_NOTE (WINSYS, "Using the first available FBConfig");
*config_ret = configs[0];
}
COGL_NOTE (WINSYS, "Using the first available FBConfig");
*config_ret = configs[0];
done:
XFree (configs);
@ -1059,8 +1027,6 @@ create_context (CoglDisplay *display, GError **error)
CoglXlibRenderer *xlib_renderer =
_cogl_xlib_renderer_get_data (display->renderer);
CoglGLXRenderer *glx_renderer = display->renderer->winsys;
gboolean support_transparent_windows =
display->onscreen_template->config.swap_chain->has_alpha;
GLXFBConfig config;
GError *fbconfig_error = NULL;
XSetWindowAttributes attrs;
@ -1084,7 +1050,6 @@ create_context (CoglDisplay *display, GError **error)
}
glx_display->fbconfig = config;
glx_display->fbconfig_has_rgba_visual = support_transparent_windows;
COGL_NOTE (WINSYS, "Creating GLX Context (display: %p)",
xlib_renderer->xdpy);

View File

@ -162,7 +162,7 @@ on_paint (ClutterActor *actor,
/* Comment this out if you want visual feedback for what this test paints */
#if 1
clutter_main_quit ();
clutter_test_quit ();
#endif
}
@ -191,7 +191,7 @@ test_multitexture (TestUtilsGTestFixture *fixture,
clutter_container_add_actor (CLUTTER_CONTAINER (stage), group);
/* We force continuous redrawing incase someone comments out the
* clutter_main_quit and wants visual feedback for the test since we
* clutter_test_quit and wants visual feedback for the test since we
* wont be doing anything else that will trigger redrawing. */
idle_source = g_idle_add (queue_redraw, stage);
@ -199,7 +199,7 @@ test_multitexture (TestUtilsGTestFixture *fixture,
clutter_actor_show (stage);
clutter_main ();
clutter_test_main ();
g_clear_handle_id (&idle_source, g_source_remove);

View File

@ -137,7 +137,7 @@ on_paint (ClutterActor *actor,
/* Comment this out if you want visual feedback of what this test
* paints.
*/
clutter_main_quit ();
clutter_test_quit ();
}
static gboolean
@ -165,7 +165,7 @@ test_readpixels (TestUtilsGTestFixture *fixture,
g_signal_connect_after (stage, "paint", G_CALLBACK (on_paint), NULL);
clutter_actor_show (stage);
clutter_main ();
clutter_test_main ();
g_clear_handle_id (&idle_source, g_source_remove);

View File

@ -92,7 +92,7 @@ on_paint (ClutterActor *actor,
/* Comment this out if you want visual feedback for what this test paints */
#if 1
clutter_main_quit ();
clutter_test_quit ();
#endif
}
@ -129,7 +129,7 @@ test_texture_mipmaps (TestUtilsGTestFixture *fixture,
clutter_actor_show (stage);
clutter_main ();
clutter_test_main ();
g_clear_handle_id (&idle_source, g_source_remove);

View File

@ -183,7 +183,7 @@ on_paint (ClutterActor *actor,
update_pixmap (state);
else if (big_updated)
/* If we successfully got the update then the test is over */
clutter_main_quit ();
clutter_test_quit ();
}
state->frame_count++;
@ -226,7 +226,7 @@ test_texture_pixmap_x11 (TestUtilsGTestFixture *fixture,
clutter_actor_show (state.stage);
clutter_main ();
clutter_test_main ();
g_clear_signal_handler (&paint_handler, state.stage);

View File

@ -375,7 +375,7 @@ on_paint (ClutterActor *actor,
/* Comment this out if you want visual feedback of what this test
* paints.
*/
clutter_main_quit ();
clutter_test_quit ();
}
static gboolean
@ -403,7 +403,7 @@ test_viewport (TestUtilsGTestFixture *fixture,
g_signal_connect_after (stage, "paint", G_CALLBACK (on_paint), NULL);
clutter_actor_show (stage);
clutter_main ();
clutter_test_main ();
g_clear_handle_id (&idle_source, g_source_remove);

View File

@ -75,7 +75,7 @@
For a X11 grab to be taken into account under Wayland, the client must
also either send a specific X11 ClientMessage to the root window or be
among the applications white-listed in key “xwayland-grab-access-rules”.
among the applications allowed in key “xwayland-grab-access-rules”.
</description>
</key>
@ -91,8 +91,9 @@
Wildcards “*” and jokers “?” in the values are supported.
Values starting with “!” are blacklisted, which has precedence over
the whitelist, to revoke applications from the default system list.
Values starting with “!” are denied, which has precedence over
the list of values allowed, to revoke applications from the default
system list.
The default system list includes the following applications:

View File

@ -1,6 +1,6 @@
project('mutter', 'c',
version: '3.37.3',
meson_version: '>= 0.50.0',
version: '3.37.90',
meson_version: '>= 0.51.0',
license: 'GPLv2+'
)
@ -24,7 +24,7 @@ uprof_req = '>= 0.3'
pango_req = '>= 1.2.0'
cairo_req = '>= 1.10.0'
pangocairo_req = '>= 1.20'
gsettings_desktop_schemas_req = '>= 3.33.0'
gsettings_desktop_schemas_req = '>= 3.37.2'
json_glib_req = '>= 0.12.0'
upower_glib_req = '>= 0.99.0'
xcomposite_req = '>= 0.4'
@ -42,7 +42,7 @@ udev_req = '>= 228'
gudev_req = '>= 232'
# wayland version requirements
wayland_server_req = '>= 1.13.0'
wayland_server_req = '>= 1.18'
wayland_protocols_req = '>= 1.19'
# native backend version requirements
@ -53,7 +53,7 @@ gbm_req = '>= 10.3'
libpipewire_req = '>= 0.3.0'
# profiler requirements
sysprof_req = '>= 3.35.2'
sysprof_req = '>= 3.37.2'
gnome = import('gnome')
pkg = import('pkgconfig')
@ -279,7 +279,20 @@ endif
have_profiler = get_option('profiler')
if have_profiler
sysprof_dep = dependency('sysprof-capture-3', version: sysprof_req)
# libsysprof-capture support
sysprof_dep = dependency('sysprof-capture-4',
required: true,
default_options: [
'enable_examples=false',
'enable_gtk=false',
'enable_tests=false',
'enable_tools=false',
'libsysprof=false',
'with_sysprofd=none',
'help=false',
],
fallback: ['sysprof', 'libsysprof_capture_dep'],
)
endif
required_functions = [

172
po/ca.po
View File

@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: metacity 2.24\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n"
"POT-Creation-Date: 2019-08-06 00:49+0000\n"
"POT-Creation-Date: 2020-05-26 13:44+0000\n"
"PO-Revision-Date: 2018-06-17 10:25+0200\n"
"Last-Translator: Jordi Mas <jmas@softcatala.org>\n"
"Language-Team: Catalan <tradgnome@softcatala.org>\n"
@ -261,16 +261,16 @@ msgstr ""
#: data/org.gnome.mutter.gschema.xml.in:8
msgid ""
"This key will initiate the “overlay”, which is a combination window overview "
"and application launching system. The default is intended to be the “Windows "
"key” on PC hardware. Its expected that this binding either the default or "
"set to the empty string."
"This key will initiate the “overlay”, which is a combination window overview"
" and application launching system. The default is intended to be the "
"“Windows key” on PC hardware. Its expected that this binding either the "
"default or set to the empty string."
msgstr ""
"Aquesta tecla iniciarà l'«overlay» (superposador), el qual és una combinació "
"de visualització de finestres i sistema de llançament d'aplicacions. El "
"Aquesta tecla iniciarà l'«overlay» (superposador), el qual és una combinació"
" de visualització de finestres i sistema de llançament d'aplicacions. El "
"valor predeterminat és la «tecla Windows» en maquinari basat en ordinadors "
"PC. El valor d'aquesta vinculació s'espera que sigui el predeterminat o text "
"en blanc."
"PC. El valor d'aquesta vinculació s'espera que sigui el predeterminat o text"
" en blanc."
#: data/org.gnome.mutter.gschema.xml.in:20
msgid "Attach modal dialogs"
@ -282,9 +282,9 @@ msgid ""
"attached to the titlebar of the parent window and are moved together with "
"the parent window."
msgstr ""
"Quan sigui «true» (cert), en lloc de tenir barres de títol independents, els "
"diàlegs modals apareixeran adjuntats a la barra de títol de la finestra mare "
"i es mouran juntament amb aquesta."
"Quan sigui «true» (cert), en lloc de tenir barres de títol independents, els"
" diàlegs modals apareixeran adjuntats a la barra de títol de la finestra "
"mare i es mouran juntament amb aquesta."
#: data/org.gnome.mutter.gschema.xml.in:30
msgid "Enable edge tiling when dropping windows on screen edges"
@ -299,9 +299,9 @@ msgid ""
"area. Dropping windows on the top screen edge maximizes them completely."
msgstr ""
"Si s'habilita, es maximitzaran les finestres verticalment i es "
"redimensionaran horitzontalment per cobrir la meitat de l'àrea disponible en "
"deixar-les anar a les vores verticals de la pantalla. Si es deixen anar a la "
"vora superior de la pantalla es maximitzaran completament."
"redimensionaran horitzontalment per cobrir la meitat de l'àrea disponible en"
" deixar-les anar a les vores verticals de la pantalla. Si es deixen anar a "
"la vora superior de la pantalla es maximitzaran completament."
#: data/org.gnome.mutter.gschema.xml.in:40
msgid "Workspaces are managed dynamically"
@ -310,8 +310,8 @@ msgstr "Els espais de treball es gestionen dinàmicament"
#: data/org.gnome.mutter.gschema.xml.in:41
msgid ""
"Determines whether workspaces are managed dynamically or whether theres a "
"static number of workspaces (determined by the num-workspaces key in org."
"gnome.desktop.wm.preferences)."
"static number of workspaces (determined by the num-workspaces key in "
"org.gnome.desktop.wm.preferences)."
msgstr ""
"Determina si els espais de treball es gestionen dinàmicament o hi ha un "
"nombre determinat d'espais de treball (determinat per la clau «num-"
@ -348,8 +348,8 @@ msgstr "Retarda el canvi del focus fins que s'aturi el punter"
#: data/org.gnome.mutter.gschema.xml.in:69
msgid ""
"If set to true, and the focus mode is either “sloppy” or “mouse” then the "
"focus will not be changed immediately when entering a window, but only after "
"the pointer stops moving."
"focus will not be changed immediately when entering a window, but only after"
" the pointer stops moving."
msgstr ""
"Si és «true» (cert), i el mode del focus és «sloppy» o «mouse», no es "
"canviarà el focus immediatament quan s'entri a una finestra, només es "
@ -365,8 +365,8 @@ msgid ""
"not enough, invisible borders will be added to meet this value."
msgstr ""
"La quantitat total de contorn arrossegable. Si els contorns visibles del "
"tema no són suficients, s'afegiran contorns invisibles per aconseguir aquest "
"valor."
"tema no són suficients, s'afegiran contorns invisibles per aconseguir aquest"
" valor."
#: data/org.gnome.mutter.gschema.xml.in:89
msgid "Auto maximize nearly monitor sized windows"
@ -399,6 +399,7 @@ msgid "Enable experimental features"
msgstr "Habilita les funcionalitats experimentals"
#: data/org.gnome.mutter.gschema.xml.in:108
#, fuzzy
msgid ""
"To enable experimental features, add the feature keyword to the list. "
"Whether the feature requires restarting the compositor depends on the given "
@ -412,6 +413,14 @@ msgid ""
"must have CAP_SYS_NICE. Requires a restart. • “autostart-xwayland” — "
"initializes Xwayland lazily if there are X11 clients. Requires restart."
msgstr ""
"Per habilitar les característiques experimentals afegiu la paraula clau de "
"la característica a la llista. Si la característica requereix reiniciar el "
"compositor depèn de la característica donada. Qualsevol característica "
"experimental no es requereix per estar disponible o configurable. No espereu"
" afegir res en aquest ajustament per ser una prova futura. Actualment les "
"paraules clau possibles • • “inici del monitor d'escala” framebuffer — fa "
"que el «mutter-start» estigui disponible per defecte als monitors lògics en "
"un espai de reinici de píxels lògic mentre que cal «ICE»"
#: data/org.gnome.mutter.gschema.xml.in:134
msgid "Modifier to use to locate the pointer"
@ -421,19 +430,32 @@ msgstr "Modificar a usar per localitzar el punter"
msgid "This key will initiate the “locate pointer” action."
msgstr "Aquesta clau inicialitzarà l'acció «locate pointer»."
#: data/org.gnome.mutter.gschema.xml.in:155
#: data/org.gnome.mutter.gschema.xml.in:142
msgid "Timeout for check-alive ping"
msgstr "Temps d'espera per a la comprovació «ping alive»"
#: data/org.gnome.mutter.gschema.xml.in:143
msgid ""
"Number of milliseconds a client has to respond to a ping request in order to"
" not be detected as frozen. Using 0 will disable the alive check completely."
msgstr ""
"Nombre de mil·lisegons en què un client ha de respondre a una sol·licitud de"
" «ping» per no ser detectat com a congelat. L'ús de 0 inhabilitarà "
"completament la comprovació."
#: data/org.gnome.mutter.gschema.xml.in:165
msgid "Select window from tab popup"
msgstr "Selecció de finestra entre les emergents d'una pestanya"
#: data/org.gnome.mutter.gschema.xml.in:160
#: data/org.gnome.mutter.gschema.xml.in:170
msgid "Cancel tab popup"
msgstr "Cancel·lació de les finestres emergents a les pestanyes"
#: data/org.gnome.mutter.gschema.xml.in:165
#: data/org.gnome.mutter.gschema.xml.in:175
msgid "Switch monitor configurations"
msgstr "Canvia configuracions de monitor"
#: data/org.gnome.mutter.gschema.xml.in:170
#: data/org.gnome.mutter.gschema.xml.in:180
msgid "Rotates the built-in monitor configuration"
msgstr "Gira la configuració del monitor integrada"
@ -491,9 +513,12 @@ msgstr "Torna a habilitar les dreceres"
#: data/org.gnome.mutter.wayland.gschema.xml.in:64
msgid "Allow X11 grabs to lock keyboard focus with Xwayland"
msgstr "Permetre la captura amb Xwayland per bloquejar el focus del teclat amb Xwayland"
msgstr ""
"Permetre la captura amb Xwayland per bloquejar el focus del teclat amb "
"Xwayland"
#: data/org.gnome.mutter.wayland.gschema.xml.in:65
#, fuzzy
msgid ""
"Allow all keyboard events to be routed to X11 “override redirect” windows "
"with a grab when running in Xwayland. This option is to support X11 clients "
@ -505,16 +530,25 @@ msgid ""
"specific X11 ClientMessage to the root window or be among the applications "
"white-listed in key “xwayland-grab-access-rules”."
msgstr ""
"Permet que tots els esdeveniments de teclat s'encaminin a les finestres X11 "
"«sobredirigir redirecció» amb una captura en executar-se a Xwayland. Aquesta"
" opció és per donar suport als clients X11 que mapan una finestra «override "
"redirect» (que no rep el focus del teclat) i emeten un teclat per forçar "
"tots els esdeveniments del teclat a aquesta finestra. Aquesta opció "
"s'utilitza rarament i no té cap efecte en les finestres regulars de "
"l'enviament de X11 que poden rebre el focus del teclat segons el client "
"arrel"
#: data/org.gnome.mutter.wayland.gschema.xml.in:84
msgid "Xwayland applications allowed to issue keyboard grabs"
msgstr "Les aplicacions Xwayland poden capturar el teclat"
#: data/org.gnome.mutter.wayland.gschema.xml.in:85
#, fuzzy
msgid ""
"List the resource names or resource class of X11 windows either allowed or "
"not allowed to issue X11 keyboard grabs under Xwayland. The resource name or "
"resource class of a given X11 window can be obtained using the command "
"not allowed to issue X11 keyboard grabs under Xwayland. The resource name or"
" resource class of a given X11 window can be obtained using the command "
"“xprop WM_CLASS”. Wildcards “*” and jokers “?” in the values are supported. "
"Values starting with “!” are blacklisted, which has precedence over the "
"whitelist, to revoke applications from the default system list. The default "
@ -523,46 +557,52 @@ msgid ""
"using the specific keyboard shortcut defined by the keybinding key “restore-"
"shortcuts”."
msgstr ""
"Llista els noms dels recursos o la classe de recursos de les finestres X11 "
"ja sigui permet o no permet emetre captures de teclat X11 sota Xwayland. El "
"nom dels recursos o la classe dels recursos d'una finestra X11 donada es pot"
" obtenir usant l'ordre «xprop WMCLASS». Els usuaris de les targetes "
"salvatges «*» i els bromistes «?» als valors que comencen amb «EFABD» tenen "
"prioritat sobre la llista blancaESS les aplicacions de dreceres del sistema "
"per defecte."
#. TRANSLATORS: This string refers to a button that switches between
#. * different modes.
#.
#: src/backends/meta-input-settings.c:2531
#: src/backends/meta-input-settings.c:2631
#, c-format
msgid "Mode Switch (Group %d)"
msgstr "Mode de commutació (grup %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs.
#.
#: src/backends/meta-input-settings.c:2554
#: src/backends/meta-input-settings.c:2654
msgid "Switch monitor"
msgstr "Commuta el monitor"
#: src/backends/meta-input-settings.c:2556
#: src/backends/meta-input-settings.c:2656
msgid "Show on-screen help"
msgstr "Mostra l'ajuda en pantalla"
#: src/backends/meta-monitor.c:223
#: src/backends/meta-monitor.c:226
msgid "Built-in display"
msgstr "Pantalla integrada"
#: src/backends/meta-monitor.c:252
#: src/backends/meta-monitor.c:255
msgid "Unknown"
msgstr "Desconeguda"
#: src/backends/meta-monitor.c:254
#: src/backends/meta-monitor.c:257
msgid "Unknown Display"
msgstr "Pantalla desconeguda"
#: src/backends/meta-monitor.c:262
#: src/backends/meta-monitor.c:265
#, c-format
msgctxt ""
"This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'"
"This is a monitor vendor name, followed by a size in inches, like 'Dell "
"15\"'"
msgid "%s %s"
msgstr "%s %s"
#: src/backends/meta-monitor.c:270
#: src/backends/meta-monitor.c:273
#, c-format
msgctxt ""
"This is a monitor vendor name followed by product/model name where size in "
@ -571,13 +611,13 @@ msgid "%s %s"
msgstr "%s %s"
#. Translators: this string will appear in Sysprof
#: src/backends/meta-profiler.c:82
#: src/backends/meta-profiler.c:79
msgid "Compositor"
msgstr "Compositor"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: src/compositor/compositor.c:510
#: src/compositor/compositor.c:545
#, c-format
msgid ""
"Another compositing manager is already running on screen %i on display “%s”."
@ -589,52 +629,52 @@ msgstr ""
msgid "Bell event"
msgstr "Esdeveniment de campana"
#: src/core/main.c:185
#: src/core/main.c:190
msgid "Disable connection to session manager"
msgstr "Inhabilita la connexió al gestor de sessions"
#: src/core/main.c:191
#: src/core/main.c:196
msgid "Replace the running window manager"
msgstr "Reemplaça el gestor de finestres en execució"
#: src/core/main.c:197
#: src/core/main.c:202
msgid "Specify session management ID"
msgstr "Especifica l'ID de gestió de sessió"
#: src/core/main.c:202
#: src/core/main.c:207
msgid "X Display to use"
msgstr "Visualització X per usar"
#: src/core/main.c:208
#: src/core/main.c:213
msgid "Initialize session from savefile"
msgstr "Inicialitza la sessió des del fitxer desat"
#: src/core/main.c:214
#: src/core/main.c:219
msgid "Make X calls synchronous"
msgstr "Fes que les crides a l'X siguin síncrones"
#: src/core/main.c:221
#: src/core/main.c:226
msgid "Run as a wayland compositor"
msgstr "Funciona com a compositor de Wayland"
# Notes:
# Afegeix una nota
#
#
# Camins:
# ../src/core/main.c:223
#: src/core/main.c:227
#: src/core/main.c:232
msgid "Run as a nested compositor"
msgstr "Funciona com a compositor imbricat"
#: src/core/main.c:233
#: src/core/main.c:238
msgid "Run wayland compositor without starting Xwayland"
msgstr "Executa el compositor wayland sense iniciar Xwayland"
#: src/core/main.c:241
#: src/core/main.c:246
msgid "Run as a full display server, rather than nested"
msgstr "Funciona com a servidor de pantalla completa, en comptes d'imbricat"
#: src/core/main.c:247
#: src/core/main.c:252
msgid "Run with X11 backend"
msgstr "Executa amb un rerefons X11"
@ -670,8 +710,7 @@ msgid ""
"mutter %s\n"
"Copyright © 2001-%d Havoc Pennington, Red Hat, Inc., and others\n"
"This is free software; see the source for copying conditions.\n"
"There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A "
"PARTICULAR PURPOSE.\n"
"There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
msgstr ""
"Mutter %s\n"
"Copyright © 2001-%d Havoc Pennington, Red Hat, Inc., i d'altres\n"
@ -688,45 +727,45 @@ msgstr "Escriu versió"
msgid "Mutter plugin to use"
msgstr "Connector del Mutter a utilitzar"
#: src/core/prefs.c:1849
#: src/core/prefs.c:1911
#, c-format
msgid "Workspace %d"
msgstr "Espai de treball %d"
#: src/core/util.c:121
#: src/core/util.c:119
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter es va compilar sense compatibilitat per al mode detallat\n"
#: src/wayland/meta-wayland-tablet-pad.c:567
#: src/wayland/meta-wayland-tablet-pad.c:568
#, c-format
msgid "Mode Switch: Mode %d"
msgstr "Mode de commutació: mode %d"
#: src/x11/meta-x11-display.c:671
#: src/x11/meta-x11-display.c:676
#, c-format
msgid ""
"Display “%s” already has a window manager; try using the --replace option to "
"replace the current window manager."
"Display “%s” already has a window manager; try using the --replace option to"
" replace the current window manager."
msgstr ""
"La pantalla «%s» ja té un gestor de finestres; proveu l'opció --replace per "
"reemplaçar el gestor de finestres actual."
#: src/x11/meta-x11-display.c:1032
#: src/x11/meta-x11-display.c:1089
msgid "Failed to initialize GDK\n"
msgstr "S'ha produït un error en inicialitzar GDK\n"
#: src/x11/meta-x11-display.c:1056
#: src/x11/meta-x11-display.c:1113
#, c-format
msgid "Failed to open X Window System display “%s”\n"
msgstr ""
"S'ha produït un error en obrir la pantalla del sistema de finestres X «%s»\n"
#: src/x11/meta-x11-display.c:1140
#: src/x11/meta-x11-display.c:1196
#, c-format
msgid "Screen %d on display “%s” is invalid\n"
msgstr "El monitor %d en la pantalla «%s»' no és vàlida\n"
#: src/x11/meta-x11-selection-input-stream.c:445
#: src/x11/meta-x11-selection-input-stream.c:460
#, c-format
msgid "Format %s not supported"
msgstr "El format %s no és compatible"
@ -739,8 +778,7 @@ msgstr ""
"Aquestes finestres no implementen «desa la configuració actual» i s'hauran "
"de reiniciar manualment la pròxima vegada que entreu."
#: src/x11/window-props.c:569
#: src/x11/window-props.c:548
#, c-format
msgid "%s (on %s)"
msgstr "%s (a %s)"

View File

@ -13,8 +13,8 @@ msgid ""
msgstr ""
"Project-Id-Version: mutter.master\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n"
"POT-Creation-Date: 2020-02-23 17:41+0000\n"
"PO-Revision-Date: 2020-02-24 13:15+0100\n"
"POT-Creation-Date: 2020-08-04 08:31+0000\n"
"PO-Revision-Date: 2020-08-13 10:31+0200\n"
"Last-Translator: Daniel Mustieles <daniel.mustieles@gmail.com>\n"
"Language-Team: Spanish - Spain <gnome-es-list@gnome.org>\n"
"Language: es_ES\n"
@ -22,7 +22,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Gtranslator 3.34.0\n"
"X-Generator: Gtranslator 3.36.0\n"
#: data/50-mutter-navigation.xml:6
msgid "Navigation"
@ -518,6 +518,16 @@ msgstr ""
"Permitir capturas con X11 para bloquear el foco del teclado con Xwayland"
#: data/org.gnome.mutter.wayland.gschema.xml.in:65
#| msgid ""
#| "Allow all keyboard events to be routed to X11 “override redirect” windows "
#| "with a grab when running in Xwayland. This option is to support X11 "
#| "clients which map an “override redirect” window (which do not receive "
#| "keyboard focus) and issue a keyboard grab to force all keyboard events to "
#| "that window. This option is seldom used and has no effect on regular X11 "
#| "windows which can receive keyboard focus under normal circumstances. For "
#| "a X11 grab to be taken into account under Wayland, the client must also "
#| "either send a specific X11 ClientMessage to the root window or be among "
#| "the applications white-listed in key “xwayland-grab-access-rules”."
msgid ""
"Allow all keyboard events to be routed to X11 “override redirect” windows "
"with a grab when running in Xwayland. This option is to support X11 clients "
@ -527,7 +537,7 @@ msgid ""
"which can receive keyboard focus under normal circumstances. For a X11 grab "
"to be taken into account under Wayland, the client must also either send a "
"specific X11 ClientMessage to the root window or be among the applications "
"white-listed in key “xwayland-grab-access-rules”."
"allowed in key “xwayland-grab-access-rules”."
msgstr ""
"Permitir que los eventos del teclado se dirijan a ventanas X11 “override "
"redirect” con una pulsación cuando se ejecutan en Xwayland. Esta opción es "
@ -545,14 +555,25 @@ msgid "Xwayland applications allowed to issue keyboard grabs"
msgstr "Aplicaciones de Xwayland que pueden capturar el teclado"
#: data/org.gnome.mutter.wayland.gschema.xml.in:85
#| msgid ""
#| "List the resource names or resource class of X11 windows either allowed "
#| "or not allowed to issue X11 keyboard grabs under Xwayland. The resource "
#| "name or resource class of a given X11 window can be obtained using the "
#| "command “xprop WM_CLASS”. Wildcards “*” and jokers “?” in the values are "
#| "supported. Values starting with “!” are blacklisted, which has precedence "
#| "over the whitelist, to revoke applications from the default system list. "
#| "The default system list includes the following applications: "
#| "“@XWAYLAND_GRAB_DEFAULT_ACCESS_RULES@” Users can break an existing grab "
#| "by using the specific keyboard shortcut defined by the keybinding key "
#| "“restore-shortcuts”."
msgid ""
"List the resource names or resource class of X11 windows either allowed or "
"not allowed to issue X11 keyboard grabs under Xwayland. The resource name or "
"resource class of a given X11 window can be obtained using the command "
"“xprop WM_CLASS”. Wildcards “*” and jokers “?” in the values are supported. "
"Values starting with “!” are blacklisted, which has precedence over the "
"whitelist, to revoke applications from the default system list. The default "
"system list includes the following applications: "
"Values starting with “!” are denied, which has precedence over the list of "
"values allowed, to revoke applications from the default system list. The "
"default system list includes the following applications: "
"“@XWAYLAND_GRAB_DEFAULT_ACCESS_RULES@” Users can break an existing grab by "
"using the specific keyboard shortcut defined by the keybinding key “restore-"
"shortcuts”."
@ -570,7 +591,7 @@ msgstr ""
#. TRANSLATORS: This string refers to a button that switches between
#. * different modes.
#.
#: src/backends/meta-input-settings.c:2567
#: src/backends/meta-input-settings.c:2698
#, c-format
msgid "Mode Switch (Group %d)"
msgstr "Cambiar modo (grupo %d)"
@ -578,34 +599,34 @@ msgstr "Cambiar modo (grupo %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs.
#.
#: src/backends/meta-input-settings.c:2590
#: src/backends/meta-input-settings.c:2721
msgid "Switch monitor"
msgstr "Cambiar monitor"
#: src/backends/meta-input-settings.c:2592
#: src/backends/meta-input-settings.c:2723
msgid "Show on-screen help"
msgstr "Mostrar la ayuda en pantalla"
#: src/backends/meta-monitor.c:223
#: src/backends/meta-monitor.c:235
msgid "Built-in display"
msgstr "Pantalla integrada"
#: src/backends/meta-monitor.c:252
#: src/backends/meta-monitor.c:264
msgid "Unknown"
msgstr "Desconocida"
#: src/backends/meta-monitor.c:254
#: src/backends/meta-monitor.c:266
msgid "Unknown Display"
msgstr "Pantalla desconocida"
#: src/backends/meta-monitor.c:262
#: src/backends/meta-monitor.c:274
#, c-format
msgctxt ""
"This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'"
msgid "%s %s"
msgstr "%s %s"
#: src/backends/meta-monitor.c:270
#: src/backends/meta-monitor.c:282
#, c-format
msgctxt ""
"This is a monitor vendor name followed by product/model name where size in "
@ -620,7 +641,7 @@ msgstr "Compositor"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: src/compositor/compositor.c:533
#: src/compositor/compositor.c:516
#, c-format
msgid ""
"Another compositing manager is already running on screen %i on display “%s”."
@ -731,7 +752,7 @@ msgstr "Complemento de mutter que usar"
msgid "Workspace %d"
msgstr "Área de trabajo %d"
#: src/core/util.c:122
#: src/core/util.c:119
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter fue compilado sin soporte para modo prolijo\n"
@ -776,7 +797,7 @@ msgstr ""
"Estas ventanas no soportan «guardar la configuración actual» y tendrán que "
"reiniciarse manualmente la próxima vez que inicie una sesión."
#: src/x11/window-props.c:569
#: src/x11/window-props.c:548
#, c-format
msgid "%s (on %s)"
msgstr "%s (on %s)"

View File

@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: mutter master\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n"
"POT-Creation-Date: 2020-02-23 17:41+0000\n"
"PO-Revision-Date: 2020-03-01 13:19+0100\n"
"POT-Creation-Date: 2020-08-04 08:31+0000\n"
"PO-Revision-Date: 2020-08-10 12:54+0200\n"
"Last-Translator: Guillaume Bernard <associations@guillaume-bernard.fr>\n"
"Language-Team: GNOME French Team <gnomefr@traduc.org>\n"
"Language: fr\n"
@ -536,7 +536,7 @@ msgid ""
"which can receive keyboard focus under normal circumstances. For a X11 grab "
"to be taken into account under Wayland, the client must also either send a "
"specific X11 ClientMessage to the root window or be among the applications "
"white-listed in key “xwayland-grab-access-rules”."
"allowed in key “xwayland-grab-access-rules”."
msgstr ""
"Permettre à tous les évènements clavier dêtre routés vers les fenêtres X11 "
 override redirect » avec capture lors du fonctionnement avec Xwayland. "
@ -547,7 +547,7 @@ msgstr ""
"fenêtres X11 normales qui peuvent recevoir le focus du clavier dans des "
"circonstances normales. Pour quune capture X11 soit prise en compte sous "
"Wayland, le client doit aussi soit envoyer un ClientMessage X11 spécifique à "
"la fenêtre racine, soit figurer parmi la liste blanche des applications dans "
"la fenêtre racine, soit figurer parmi la liste des applications autorisées dans "
"la clé « xwayland-grab-access-rules »."
#: data/org.gnome.mutter.wayland.gschema.xml.in:84
@ -560,9 +560,9 @@ msgid ""
"not allowed to issue X11 keyboard grabs under Xwayland. The resource name or "
"resource class of a given X11 window can be obtained using the command "
"“xprop WM_CLASS”. Wildcards “*” and jokers “?” in the values are supported. "
"Values starting with “!” are blacklisted, which has precedence over the "
"whitelist, to revoke applications from the default system list. The default "
"system list includes the following applications: "
"Values starting with “!” are denied, which has precedence over the list of "
"values allowed, to revoke applications from the default system list. The "
"default system list includes the following applications: "
"“@XWAYLAND_GRAB_DEFAULT_ACCESS_RULES@” Users can break an existing grab by "
"using the specific keyboard shortcut defined by the keybinding key “restore-"
"shortcuts”."
@ -571,8 +571,8 @@ msgstr ""
"autorisées ou non à émettre des captures clavier sous Xwayland. Le nom ou la "
"classe de ressource dune fenêtre X11 donnée peut être obtenue à laide de "
"la commande « xprop WM_CLASS ». Les caractères joker « * » et « ? » sont "
"acceptées dans les valeurs. Les valeurs commençant par « ! » sont en liste "
"noire, qui a priorité sur la liste blanche, pour révoquer les applications "
"acceptées dans les valeurs. Les valeurs commençant par « ! » sont bloquées, "
"en priorité par rapport à la liste des applications autorisées, pour révoquer les applications "
"de la liste système par défaut. Celle-ci contient les applications "
"suivantes : « @XWAYLAND_GRAB_DEFAULT_ACCESS_RULES@ ». Les utilisateurs "
"peuvent casser une capture existante en utilisant le raccourci clavier "
@ -581,7 +581,7 @@ msgstr ""
#. TRANSLATORS: This string refers to a button that switches between
#. * different modes.
#.
#: src/backends/meta-input-settings.c:2567
#: src/backends/meta-input-settings.c:2698
#, c-format
msgid "Mode Switch (Group %d)"
msgstr "Changement de mode (groupe %d)"
@ -589,34 +589,34 @@ msgstr "Changement de mode (groupe %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs.
#.
#: src/backends/meta-input-settings.c:2590
#: src/backends/meta-input-settings.c:2721
msgid "Switch monitor"
msgstr "Changer de moniteur"
#: src/backends/meta-input-settings.c:2592
#: src/backends/meta-input-settings.c:2723
msgid "Show on-screen help"
msgstr "Afficher laide à lécran"
#: src/backends/meta-monitor.c:223
#: src/backends/meta-monitor.c:235
msgid "Built-in display"
msgstr "Affichage intégré"
#: src/backends/meta-monitor.c:252
#: src/backends/meta-monitor.c:264
msgid "Unknown"
msgstr "Inconnu"
#: src/backends/meta-monitor.c:254
#: src/backends/meta-monitor.c:266
msgid "Unknown Display"
msgstr "Affichage inconnu"
#: src/backends/meta-monitor.c:262
#: src/backends/meta-monitor.c:274
#, c-format
msgctxt ""
"This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'"
msgid "%s %s"
msgstr "%s %s"
#: src/backends/meta-monitor.c:270
#: src/backends/meta-monitor.c:282
#, c-format
msgctxt ""
"This is a monitor vendor name followed by product/model name where size in "
@ -631,7 +631,7 @@ msgstr "Compositeur"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: src/compositor/compositor.c:533
#: src/compositor/compositor.c:516
#, c-format
msgid ""
"Another compositing manager is already running on screen %i on display “%s”."
@ -742,7 +742,7 @@ msgstr "Greffon de Mutter à utiliser"
msgid "Workspace %d"
msgstr "Espace de travail %d"
#: src/core/util.c:122
#: src/core/util.c:119
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter a été compilé sans la prise en charge du mode bavard\n"
@ -788,7 +788,7 @@ msgstr ""
"configuration actuelle » et devront être redémarrées manuellement à la "
"prochaine connexion."
#: src/x11/window-props.c:569
#: src/x11/window-props.c:548
#, c-format
msgid "%s (on %s)"
msgstr "%s (sur %s)"

View File

@ -7,15 +7,15 @@ msgid ""
msgstr ""
"Project-Id-Version: mutter master\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n"
"POT-Creation-Date: 2019-08-06 00:49+0000\n"
"PO-Revision-Date: 2019-09-03 09:53+0200\n"
"POT-Creation-Date: 2020-05-26 13:44+0000\n"
"PO-Revision-Date: 2020-07-12 18:34+0200\n"
"Last-Translator: Fabio Tomat <f.t.public@gmail.com>\n"
"Language-Team: Friulian <fur@li.org>\n"
"Language: fur\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.2.3\n"
"X-Generator: Poedit 2.3.1\n"
#: data/50-mutter-navigation.xml:6
msgid "Navigation"
@ -420,19 +420,32 @@ msgstr "Modificadôr di doprâ par localizâ il pontadôr"
msgid "This key will initiate the “locate pointer” action."
msgstr "Cheste clâf e inizializerâ la azion “localize pontadôr”."
#: data/org.gnome.mutter.gschema.xml.in:155
#: data/org.gnome.mutter.gschema.xml.in:142
msgid "Timeout for check-alive ping"
msgstr "Timp scjadût pal control di sorevivence dal ping"
#: data/org.gnome.mutter.gschema.xml.in:143
msgid ""
"Number of milliseconds a client has to respond to a ping request in order to "
"not be detected as frozen. Using 0 will disable the alive check completely."
msgstr ""
"Numar di miliseconts jenfri di chei che un client al à di rispuindi a une "
"richieste di ping, par fâ in mût che nol vegni identificât tant che "
"inglaçât. Doprant 0 si disabilitarà dal dut il control di sorevivence."
#: data/org.gnome.mutter.gschema.xml.in:165
msgid "Select window from tab popup"
msgstr "Selezione barcon dal tab popup"
#: data/org.gnome.mutter.gschema.xml.in:160
#: data/org.gnome.mutter.gschema.xml.in:170
msgid "Cancel tab popup"
msgstr "Anule tab popup"
#: data/org.gnome.mutter.gschema.xml.in:165
#: data/org.gnome.mutter.gschema.xml.in:175
msgid "Switch monitor configurations"
msgstr "Cambie configurazions visôr"
#: data/org.gnome.mutter.gschema.xml.in:170
#: data/org.gnome.mutter.gschema.xml.in:180
msgid "Rotates the built-in monitor configuration"
msgstr "Al volte la configurazion dal visôr integrât"
@ -546,7 +559,7 @@ msgstr ""
#. TRANSLATORS: This string refers to a button that switches between
#. * different modes.
#.
#: src/backends/meta-input-settings.c:2531
#: src/backends/meta-input-settings.c:2631
#, c-format
msgid "Mode Switch (Group %d)"
msgstr "Cambie mût (Grup %d)"
@ -554,34 +567,34 @@ msgstr "Cambie mût (Grup %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs.
#.
#: src/backends/meta-input-settings.c:2554
#: src/backends/meta-input-settings.c:2654
msgid "Switch monitor"
msgstr "Cambie visôr"
#: src/backends/meta-input-settings.c:2556
#: src/backends/meta-input-settings.c:2656
msgid "Show on-screen help"
msgstr "Mostre jutori a schermi"
#: src/backends/meta-monitor.c:223
#: src/backends/meta-monitor.c:226
msgid "Built-in display"
msgstr "Display integrât"
#: src/backends/meta-monitor.c:252
#: src/backends/meta-monitor.c:255
msgid "Unknown"
msgstr "No cognossût"
#: src/backends/meta-monitor.c:254
#: src/backends/meta-monitor.c:257
msgid "Unknown Display"
msgstr "Display no cognossût"
#: src/backends/meta-monitor.c:262
#: src/backends/meta-monitor.c:265
#, c-format
msgctxt ""
"This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'"
msgid "%s %s"
msgstr "%s %s"
#: src/backends/meta-monitor.c:270
#: src/backends/meta-monitor.c:273
#, c-format
msgctxt ""
"This is a monitor vendor name followed by product/model name where size in "
@ -590,13 +603,13 @@ msgid "%s %s"
msgstr "%s %s"
#. Translators: this string will appear in Sysprof
#: src/backends/meta-profiler.c:82
#: src/backends/meta-profiler.c:79
msgid "Compositor"
msgstr "Composidôr"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: src/compositor/compositor.c:510
#: src/compositor/compositor.c:545
#, c-format
msgid ""
"Another compositing manager is already running on screen %i on display “%s”."
@ -608,47 +621,47 @@ msgstr ""
msgid "Bell event"
msgstr "Event cjampane"
#: src/core/main.c:185
#: src/core/main.c:190
msgid "Disable connection to session manager"
msgstr "Disabilite la conession al gjestôr de session"
#: src/core/main.c:191
#: src/core/main.c:196
msgid "Replace the running window manager"
msgstr "Rimplace il window manager in vore"
#: src/core/main.c:197
#: src/core/main.c:202
msgid "Specify session management ID"
msgstr "Specifiche il ID di gjestion session"
#: src/core/main.c:202
#: src/core/main.c:207
msgid "X Display to use"
msgstr "Display X di doprâ"
#: src/core/main.c:208
#: src/core/main.c:213
msgid "Initialize session from savefile"
msgstr "Inizialize session da file salvât"
#: src/core/main.c:214
#: src/core/main.c:219
msgid "Make X calls synchronous"
msgstr "Fâs lis clamadis X sincronis"
#: src/core/main.c:221
#: src/core/main.c:226
msgid "Run as a wayland compositor"
msgstr "Eseguìs come compositor wayland"
#: src/core/main.c:227
#: src/core/main.c:232
msgid "Run as a nested compositor"
msgstr "Eseguìs come compositor nidiât"
#: src/core/main.c:233
#: src/core/main.c:238
msgid "Run wayland compositor without starting Xwayland"
msgstr "Eseguìs il compositôr di wayland cence inviâ Xwayland"
#: src/core/main.c:241
#: src/core/main.c:246
msgid "Run as a full display server, rather than nested"
msgstr "Eseguìs come servidôr display complet, invezit che nidiât"
#: src/core/main.c:247
#: src/core/main.c:252
msgid "Run with X11 backend"
msgstr "Eseguìs cul backend X11"
@ -701,21 +714,21 @@ msgstr "Stampe version"
msgid "Mutter plugin to use"
msgstr "Plugin Mutter di doprâ"
#: src/core/prefs.c:1849
#: src/core/prefs.c:1911
#, c-format
msgid "Workspace %d"
msgstr "Spazi di lavôr %d"
#: src/core/util.c:121
#: src/core/util.c:119
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter al è stât compilât cence supuart pe modalitât fetose\n"
#: src/wayland/meta-wayland-tablet-pad.c:567
#: src/wayland/meta-wayland-tablet-pad.c:568
#, c-format
msgid "Mode Switch: Mode %d"
msgstr "Cambie mût: mût %d"
#: src/x11/meta-x11-display.c:671
#: src/x11/meta-x11-display.c:676
#, c-format
msgid ""
"Display “%s” already has a window manager; try using the --replace option to "
@ -724,21 +737,21 @@ msgstr ""
"Il display “%s” al à za un window manager; prove dopre la opzion --replace "
"par rimplaçâ chel atuâl."
#: src/x11/meta-x11-display.c:1032
#: src/x11/meta-x11-display.c:1089
msgid "Failed to initialize GDK\n"
msgstr "No si è rivâts a inizializâ GDK\n"
#: src/x11/meta-x11-display.c:1056
#: src/x11/meta-x11-display.c:1113
#, c-format
msgid "Failed to open X Window System display “%s”\n"
msgstr "Impussibil vierzi il display “%s” di X Window System\n"
#: src/x11/meta-x11-display.c:1140
#: src/x11/meta-x11-display.c:1196
#, c-format
msgid "Screen %d on display “%s” is invalid\n"
msgstr "Schermi %d su display “%s” no valit\n"
#: src/x11/meta-x11-selection-input-stream.c:445
#: src/x11/meta-x11-selection-input-stream.c:460
#, c-format
msgid "Format %s not supported"
msgstr "Il formât %s nol è supuartât"
@ -751,7 +764,7 @@ msgstr ""
"Chescj barcons no supuartin la funzion “salve impostazions atuâls” e si "
"scugnarà tornâ a inviâlis a man tal prossim acès."
#: src/x11/window-props.c:569
#: src/x11/window-props.c:548
#, c-format
msgid "%s (on %s)"
msgstr "%s (su %s)"

View File

@ -9,21 +9,22 @@
# Mancomún - Centro de Referencia e Servizos de Software Libre <g11n@mancomun.org>, 2009.
# Fran Diéguez <frandieguez@gnome.org>, 2009, 2010, 2011, 2012.
# Leandro Regueiro <leandro.regueiro@gmail.com>, 2012.
# Fran Dieguez <frandieguez@gnome.org>, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019.
# Fran Dieguez <frandieguez@gnome.org>, 2012-2020.
#
msgid ""
msgstr ""
"Project-Id-Version: gl\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n"
"POT-Creation-Date: 2020-02-23 17:41+0000\n"
"PO-Revision-Date: 2020-02-26 21:56+0100\n"
"POT-Creation-Date: 2020-08-04 08:31+0000\n"
"PO-Revision-Date: 2020-08-13 00:46+0200\n"
"Last-Translator: Fran Dieguez <frandieguez@gnome.org>\n"
"Language-Team: Galician\n"
"Language-Team: Galician <proxecto@trasno.gal>\n"
"Language: gl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.3\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"X-Generator: Gtranslator 3.36.0\n"
"X-Project-Style: gnome\n"
#: data/50-mutter-navigation.xml:6
@ -514,6 +515,16 @@ msgstr ""
"Permitir os capturadores de X11 bloquear o foco do teclado con Xwayland"
#: data/org.gnome.mutter.wayland.gschema.xml.in:65
#| msgid ""
#| "Allow all keyboard events to be routed to X11 “override redirect” windows "
#| "with a grab when running in Xwayland. This option is to support X11 "
#| "clients which map an “override redirect” window (which do not receive "
#| "keyboard focus) and issue a keyboard grab to force all keyboard events to "
#| "that window. This option is seldom used and has no effect on regular X11 "
#| "windows which can receive keyboard focus under normal circumstances. For "
#| "a X11 grab to be taken into account under Wayland, the client must also "
#| "either send a specific X11 ClientMessage to the root window or be among "
#| "the applications white-listed in key “xwayland-grab-access-rules”."
msgid ""
"Allow all keyboard events to be routed to X11 “override redirect” windows "
"with a grab when running in Xwayland. This option is to support X11 clients "
@ -523,7 +534,7 @@ msgid ""
"which can receive keyboard focus under normal circumstances. For a X11 grab "
"to be taken into account under Wayland, the client must also either send a "
"specific X11 ClientMessage to the root window or be among the applications "
"white-listed in key “xwayland-grab-access-rules”."
"allowed in key “xwayland-grab-access-rules”."
msgstr ""
"Permite que todos os eventos de teclado se redirixan a xanelas X11 "
"«invalidar redirección» con un capturador ao executarse en Xwayland. Esta "
@ -533,7 +544,7 @@ msgstr ""
"esta xanela. Esta opción é rara vez usada e non ten efecto en xanelas X11 "
"normais que poden recibir o foco do teclado baixo circunstancias normais. "
"Para que a captura de X11 se leve a cabo baixo Wayland, o cliente debe "
"enviar un ClienteMessage de X11 específico á xanela pai ou estar na lista "
"enviar un ClientMessage de X11 específico á xanela pai ou estar na lista "
"branca de aplicacións na chave «xwayland-grab-access-rules»."
#: data/org.gnome.mutter.wayland.gschema.xml.in:84
@ -541,14 +552,25 @@ msgid "Xwayland applications allowed to issue keyboard grabs"
msgstr "Aplicaciones de Xwayland que poden capturar o teclado"
#: data/org.gnome.mutter.wayland.gschema.xml.in:85
#| msgid ""
#| "List the resource names or resource class of X11 windows either allowed "
#| "or not allowed to issue X11 keyboard grabs under Xwayland. The resource "
#| "name or resource class of a given X11 window can be obtained using the "
#| "command “xprop WM_CLASS”. Wildcards “*” and jokers “?” in the values are "
#| "supported. Values starting with “!” are blacklisted, which has precedence "
#| "over the whitelist, to revoke applications from the default system list. "
#| "The default system list includes the following applications: "
#| "“@XWAYLAND_GRAB_DEFAULT_ACCESS_RULES@” Users can break an existing grab "
#| "by using the specific keyboard shortcut defined by the keybinding key "
#| "“restore-shortcuts”."
msgid ""
"List the resource names or resource class of X11 windows either allowed or "
"not allowed to issue X11 keyboard grabs under Xwayland. The resource name or "
"resource class of a given X11 window can be obtained using the command "
"“xprop WM_CLASS”. Wildcards “*” and jokers “?” in the values are supported. "
"Values starting with “!” are blacklisted, which has precedence over the "
"whitelist, to revoke applications from the default system list. The default "
"system list includes the following applications: "
"Values starting with “!” are denied, which has precedence over the list of "
"values allowed, to revoke applications from the default system list. The "
"default system list includes the following applications: "
"“@XWAYLAND_GRAB_DEFAULT_ACCESS_RULES@” Users can break an existing grab by "
"using the specific keyboard shortcut defined by the keybinding key “restore-"
"shortcuts”."
@ -567,7 +589,7 @@ msgstr ""
#. TRANSLATORS: This string refers to a button that switches between
#. * different modes.
#.
#: src/backends/meta-input-settings.c:2567
#: src/backends/meta-input-settings.c:2698
#, c-format
msgid "Mode Switch (Group %d)"
msgstr "Modo conmutador (Grupo %d)"
@ -575,34 +597,34 @@ msgstr "Modo conmutador (Grupo %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs.
#.
#: src/backends/meta-input-settings.c:2590
#: src/backends/meta-input-settings.c:2721
msgid "Switch monitor"
msgstr "Cambiar monitor"
#: src/backends/meta-input-settings.c:2592
#: src/backends/meta-input-settings.c:2723
msgid "Show on-screen help"
msgstr "Mostrar axuda en pantalla"
#: src/backends/meta-monitor.c:223
#: src/backends/meta-monitor.c:235
msgid "Built-in display"
msgstr "Pantalla embebida"
#: src/backends/meta-monitor.c:252
#: src/backends/meta-monitor.c:264
msgid "Unknown"
msgstr "Descoñecido"
#: src/backends/meta-monitor.c:254
#: src/backends/meta-monitor.c:266
msgid "Unknown Display"
msgstr "Pantalla descoñecida"
#: src/backends/meta-monitor.c:262
#: src/backends/meta-monitor.c:274
#, c-format
msgctxt ""
"This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'"
msgid "%s %s"
msgstr "%s %s"
#: src/backends/meta-monitor.c:270
#: src/backends/meta-monitor.c:282
#, c-format
msgctxt ""
"This is a monitor vendor name followed by product/model name where size in "
@ -617,7 +639,7 @@ msgstr "Compositor"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: src/compositor/compositor.c:533
#: src/compositor/compositor.c:516
#, c-format
msgid ""
"Another compositing manager is already running on screen %i on display “%s”."
@ -727,7 +749,7 @@ msgstr "Engadido de mutter que usar"
msgid "Workspace %d"
msgstr "Espazo de traballo %d"
#: src/core/util.c:122
#: src/core/util.c:119
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter foi compilado sen compatibilidade para o modo detallado\n"
@ -772,7 +794,7 @@ msgstr ""
"Estas xanelas non soportan «save current setup» e terán que reiniciarse "
"manualmente a próxima vez que inicie a sesión."
#: src/x11/window-props.c:569
#: src/x11/window-props.c:548
#, c-format
msgid "%s (on %s)"
msgstr "%s (en %s)"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: mutter\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n"
"POT-Creation-Date: 2020-02-23 17:41+0000\n"
"PO-Revision-Date: 2020-02-24 06:39-0300\n"
"POT-Creation-Date: 2020-04-27 14:06+0000\n"
"PO-Revision-Date: 2020-07-17 17:56-0300\n"
"Last-Translator: Rafael Fontenelle <rafaelff@gnome.org>\n"
"Language-Team: Brazilian Portuguese <gnome-pt_br-list@gnome.org>\n"
"Language: pt_BR\n"
@ -30,7 +30,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1)\n"
"X-Generator: Gtranslator 3.32.0\n"
"X-Generator: Gtranslator 3.36.0\n"
"X-Project-Style: gnome\n"
#: data/50-mutter-navigation.xml:6
@ -59,35 +59,35 @@ msgstr "Mover a janela para o último espaço de trabalho"
#: data/50-mutter-navigation.xml:24
msgid "Move window one workspace up"
msgstr "Mover a janela um espaço de trabalho acima"
msgstr "Mover a janela para um espaço de trabalho acima"
#: data/50-mutter-navigation.xml:27
msgid "Move window one workspace down"
msgstr "Mover a janela um espaço de trabalho abaixo"
msgstr "Mover a janela para um espaço de trabalho abaixo"
# Em conformidade com a tradução do gsettings-desktop-schemas --Enrico
#: data/50-mutter-navigation.xml:30
msgid "Move window one monitor to the left"
msgstr "Mover janela para o monitor da esquerda"
msgstr "Mover a janela para o monitor da esquerda"
# Em conformidade com a tradução do gsettings-desktop-schemas --Enrico
#: data/50-mutter-navigation.xml:33
msgid "Move window one monitor to the right"
msgstr "Mover janela para o monitor da direita"
msgstr "Mover a janela para o monitor da direita"
# Em conformidade com a tradução do gsettings-desktop-schemas --Enrico
#: data/50-mutter-navigation.xml:36
msgid "Move window one monitor up"
msgstr "Mover janela para o monitor acima"
msgstr "Mover a janela para o monitor acima"
# Em conformidade com a tradução do gsettings-desktop-schemas --Enrico
#: data/50-mutter-navigation.xml:39
msgid "Move window one monitor down"
msgstr "Mover janela para o monitor abaixo"
msgstr "Mover a janela para o monitor abaixo"
#: data/50-mutter-navigation.xml:43
msgid "Switch applications"
msgstr "Alternar aplicativos"
msgstr "Alternar entre aplicativos"
#: data/50-mutter-navigation.xml:48
msgid "Switch to previous application"
@ -95,7 +95,7 @@ msgstr "Alternar para o aplicativo anterior"
#: data/50-mutter-navigation.xml:52
msgid "Switch windows"
msgstr "Alternar janelas"
msgstr "Alternar entre janelas"
#: data/50-mutter-navigation.xml:57
msgid "Switch to previous window"
@ -111,7 +111,7 @@ msgstr "Alternar para a janela anterior de um aplicativo"
#: data/50-mutter-navigation.xml:70
msgid "Switch system controls"
msgstr "Alternar controles do sistema"
msgstr "Alternar os controles do sistema"
#: data/50-mutter-navigation.xml:75
msgid "Switch to previous system control"
@ -167,11 +167,11 @@ msgstr "Trocar para o último espaço de trabalho"
#: data/50-mutter-navigation.xml:123
msgid "Move to workspace above"
msgstr "Mover para o espaço de trabalho acima"
msgstr "Mover a visualização para o espaço de trabalho acima"
#: data/50-mutter-navigation.xml:126
msgid "Move to workspace below"
msgstr "Mover para o espaço de trabalho abaixo"
msgstr "Mover a visualização para o espaço de trabalho abaixo"
#: data/50-mutter-system.xml:6 data/50-mutter-wayland.xml:6
msgid "System"
@ -199,11 +199,11 @@ msgstr "Ativar o menu da janela"
#: data/50-mutter-windows.xml:10
msgid "Toggle fullscreen mode"
msgstr "Alternar modo de tela inteira"
msgstr "Alternar o modo de tela inteira"
#: data/50-mutter-windows.xml:12
msgid "Toggle maximization state"
msgstr "Alternar estado de maximização"
msgstr "Alternar o estado de maximização"
#: data/50-mutter-windows.xml:14
msgid "Maximize window"
@ -211,35 +211,35 @@ msgstr "Maximizar a janela"
#: data/50-mutter-windows.xml:16
msgid "Restore window"
msgstr "Restaurar janela"
msgstr "Restaurar a anela"
#: data/50-mutter-windows.xml:18
msgid "Close window"
msgstr "Fechar janela"
msgstr "Fechar a janela"
#: data/50-mutter-windows.xml:20
msgid "Hide window"
msgstr "Ocultar janela"
msgstr "Ocultar a janela"
#: data/50-mutter-windows.xml:22
msgid "Move window"
msgstr "Mover janela"
msgstr "Mover a janela"
#: data/50-mutter-windows.xml:24
msgid "Resize window"
msgstr "Redimensionar janela"
msgstr "Redimensionar a janela"
#: data/50-mutter-windows.xml:27
msgid "Toggle window on all workspaces or one"
msgstr "Alternar a janela em todos os espaços de trabalho ou em apenas um"
msgstr "Alternar a janela em todos os espaços de trabalho ou apenas em um"
#: data/50-mutter-windows.xml:29
msgid "Raise window if covered, otherwise lower it"
msgstr "Elevar a janela se estiver coberta; caso contrário, a abaixa"
msgstr "Trazer a janela se estiver coberta; caso contrário, coloca atrás"
#: data/50-mutter-windows.xml:31
msgid "Raise window above other windows"
msgstr "Elevar a janela para frente das outras"
msgstr "Trazer a janela para frente das outras"
#: data/50-mutter-windows.xml:33
msgid "Lower window below other windows"
@ -255,11 +255,11 @@ msgstr "Maximizar a janela horizontalmente"
#: data/50-mutter-windows.xml:41
msgid "View split on left"
msgstr "Visualizar divisão à esquerda"
msgstr "Visualizar a divisão à esquerda"
#: data/50-mutter-windows.xml:45
msgid "View split on right"
msgstr "Visualizar divisão à direita"
msgstr "Visualizar a divisão à direita"
#: data/mutter.desktop.in:4
msgid "Mutter"
@ -580,7 +580,7 @@ msgstr ""
#. TRANSLATORS: This string refers to a button that switches between
#. * different modes.
#.
#: src/backends/meta-input-settings.c:2567
#: src/backends/meta-input-settings.c:2631
#, c-format
msgid "Mode Switch (Group %d)"
msgstr "Alternador de modo (Grupo %d)"
@ -588,34 +588,34 @@ msgstr "Alternador de modo (Grupo %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs.
#.
#: src/backends/meta-input-settings.c:2590
#: src/backends/meta-input-settings.c:2654
msgid "Switch monitor"
msgstr "Trocar monitor"
#: src/backends/meta-input-settings.c:2592
#: src/backends/meta-input-settings.c:2656
msgid "Show on-screen help"
msgstr "Mostrar ajuda na tela"
#: src/backends/meta-monitor.c:223
#: src/backends/meta-monitor.c:226
msgid "Built-in display"
msgstr "Tela embutida"
#: src/backends/meta-monitor.c:252
#: src/backends/meta-monitor.c:255
msgid "Unknown"
msgstr "Desconhecido"
#: src/backends/meta-monitor.c:254
#: src/backends/meta-monitor.c:257
msgid "Unknown Display"
msgstr "Monitor desconhecido"
#: src/backends/meta-monitor.c:262
#: src/backends/meta-monitor.c:265
#, c-format
msgctxt ""
"This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'"
msgid "%s %s"
msgstr "%s %s"
#: src/backends/meta-monitor.c:270
#: src/backends/meta-monitor.c:273
#, c-format
msgctxt ""
"This is a monitor vendor name followed by product/model name where size in "

184
po/uk.po
View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: metacity\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n"
"POT-Creation-Date: 2020-02-23 17:41+0000\n"
"PO-Revision-Date: 2020-03-03 19:30+0200\n"
"POT-Creation-Date: 2020-08-04 08:31+0000\n"
"PO-Revision-Date: 2020-08-08 18:00+0300\n"
"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
"Language-Team: Ukrainian <kde-i18n-uk@kde.org>\n"
"Language: uk\n"
@ -17,7 +17,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<"
"=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
"X-Generator: Lokalize 20.03.70\n"
"X-Generator: Lokalize 20.07.70\n"
"X-Project-Style: gnome\n"
#: data/50-mutter-navigation.xml:6
@ -255,11 +255,6 @@ msgstr ""
"Модифікатор, що використовується для розширених дій віконного менеджера"
#: data/org.gnome.mutter.gschema.xml.in:8
#| msgid ""
#| "This key will initiate the \"overlay\", which is a combination window "
#| "overview and application launching system. The default is intended to be "
#| "the \"Windows key\" on PC hardware. It's expected that this binding "
#| "either the default or set to the empty string."
msgid ""
"This key will initiate the “overlay”, which is a combination window overview "
"and application launching system. The default is intended to be the “Windows "
@ -303,10 +298,6 @@ msgid "Workspaces are managed dynamically"
msgstr "Робочі простори організовуються динамічно"
#: data/org.gnome.mutter.gschema.xml.in:41
#| msgid ""
#| "Determines whether workspaces are managed dynamically or whether there's "
#| "a static number of workspaces (determined by the num-workspaces key in "
#| "org.gnome.desktop.wm.preferences)."
msgid ""
"Determines whether workspaces are managed dynamically or whether theres a "
"static number of workspaces (determined by the num-workspaces key in org."
@ -345,10 +336,6 @@ msgid "Delay focus changes until the pointer stops moving"
msgstr "Затримувати зміни фокусу, поки вказівник не перестане рухатись"
#: data/org.gnome.mutter.gschema.xml.in:69
#| msgid ""
#| "If set to true, and the focus mode is either \"sloppy\" or \"mouse\" then "
#| "the focus will not be changed immediately when entering a window, but "
#| "only after the pointer stops moving."
msgid ""
"If set to true, and the focus mode is either “sloppy” or “mouse” then the "
"focus will not be changed immediately when entering a window, but only after "
@ -363,9 +350,6 @@ msgid "Draggable border width"
msgstr "Перетяжна ширина меж"
#: data/org.gnome.mutter.gschema.xml.in:80
#| msgid ""
#| "The amount of total draggable borders. If the theme's visible borders are "
#| "not enough, invisible borders will be added to meet this value."
msgid ""
"The amount of total draggable borders. If the themes visible borders are "
"not enough, invisible borders will be added to meet this value."
@ -413,21 +397,21 @@ msgid ""
"must have CAP_SYS_NICE. Requires a restart. • “autostart-xwayland” — "
"initializes Xwayland lazily if there are X11 clients. Requires restart."
msgstr ""
"Щоб увімкнути експериментальну можливість, додайте до списку ключове слово"
" можливості. Те, чи потребуватиме вмикання можливості перезапуску"
" композитора, залежить від типу можливості. Експериментальні можливості не"
" обов'язково завжди доступні чи придатні до налаштовування. Не слід"
" очікувати, що у майбутніх версіях обов'язково буде збережено якусь із"
" експериментальних можливостей. У поточній версії передбачено такі ключові"
" слова: • «scale-monitor-framebuffer» — наказує mutter типово розташовувати"
" логічні монітори у координатному просторі логічних пікселів, масштабуючи"
" буфери кадрів моніторів, замість вмісту вікон. Призначено для роботи із"
" моніторами із високою роздільною здатністю. Не потребує перезапуску"
" композитора. • «rt-scheduler» — наказати mutter надсилати до системи запит"
" щодо низькопріоритетного планування режиму реального часу. Для виконуваного"
" файла або запису користувача має бути встановлено CAP_SYS_NICE. Потребує"
" перезапуску композитора. • «autostart-xwayland» — лінива ініціалізація"
" Xwayland, якщо виявлено клієнти X11. Потребує перезапуску композитора."
"Щоб увімкнути експериментальну можливість, додайте до списку ключове слово "
"можливості. Те, чи потребуватиме вмикання можливості перезапуску "
"композитора, залежить від типу можливості. Експериментальні можливості не "
"обов'язково завжди доступні чи придатні до налаштовування. Не слід "
"очікувати, що у майбутніх версіях обов'язково буде збережено якусь із "
"експериментальних можливостей. У поточній версії передбачено такі ключові "
"слова: • «scale-monitor-framebuffer» — наказує mutter типово розташовувати "
"логічні монітори у координатному просторі логічних пікселів, масштабуючи "
"буфери кадрів моніторів, замість вмісту вікон. Призначено для роботи із "
"моніторами із високою роздільною здатністю. Не потребує перезапуску "
"композитора. • «rt-scheduler» — наказати mutter надсилати до системи запит "
"щодо низькопріоритетного планування режиму реального часу. Для виконуваного "
"файла або запису користувача має бути встановлено CAP_SYS_NICE. Потребує "
"перезапуску композитора. • «autostart-xwayland» — лінива ініціалізація "
"Xwayland, якщо виявлено клієнти X11. Потребує перезапуску композитора."
#: data/org.gnome.mutter.gschema.xml.in:134
msgid "Modifier to use to locate the pointer"
@ -446,9 +430,9 @@ msgid ""
"Number of milliseconds a client has to respond to a ping request in order to "
"not be detected as frozen. Using 0 will disable the alive check completely."
msgstr ""
"Проміжок часу у мілісекундах, протягом якого клієнт має відповісти на"
" луна-запит, щоб вважатися працездатним. Скористайтеся значенням 0, щоб"
" повністю вимкнути перевірку працездатності."
"Проміжок часу у мілісекундах, протягом якого клієнт має відповісти на луна-"
"запит, щоб вважатися працездатним. Скористайтеся значенням 0, щоб повністю "
"вимкнути перевірку працездатності."
#: data/org.gnome.mutter.gschema.xml.in:165
msgid "Select window from tab popup"
@ -459,7 +443,6 @@ msgid "Cancel tab popup"
msgstr "Скасувати контекстні вкладки"
#: data/org.gnome.mutter.gschema.xml.in:175
#| msgid "Switch applications"
msgid "Switch monitor configurations"
msgstr "Перемкнути налаштування монітора"
@ -525,6 +508,16 @@ msgstr ""
"Дозволити захопленням у X11 блокувати зміну фокусування клавіатури з Xwayland"
#: data/org.gnome.mutter.wayland.gschema.xml.in:65
#| msgid ""
#| "Allow all keyboard events to be routed to X11 “override redirect” windows "
#| "with a grab when running in Xwayland. This option is to support X11 "
#| "clients which map an “override redirect” window (which do not receive "
#| "keyboard focus) and issue a keyboard grab to force all keyboard events to "
#| "that window. This option is seldom used and has no effect on regular X11 "
#| "windows which can receive keyboard focus under normal circumstances. For "
#| "a X11 grab to be taken into account under Wayland, the client must also "
#| "either send a specific X11 ClientMessage to the root window or be among "
#| "the applications white-listed in key “xwayland-grab-access-rules”."
msgid ""
"Allow all keyboard events to be routed to X11 “override redirect” windows "
"with a grab when running in Xwayland. This option is to support X11 clients "
@ -534,20 +527,20 @@ msgid ""
"which can receive keyboard focus under normal circumstances. For a X11 grab "
"to be taken into account under Wayland, the client must also either send a "
"specific X11 ClientMessage to the root window or be among the applications "
"white-listed in key “xwayland-grab-access-rules”."
"allowed in key “xwayland-grab-access-rules”."
msgstr ""
"Дозволяє маршрутизацію усіх подій клавіатури до вікон X11 із «перевизначенням"
" переспрямовування», які захоплюють клавіатуру, коли їх запущено у Xwayland."
" Цей параметр призначено для реалізації підтримки клієнтів X11, які"
" здійснюють відображення вікна із «перевизначенням переспрямовування» (вікна,"
" яке не отримує фокусування клавіатури) і видають сигнал щодо захоплення"
" клавіатури, щоб примусово переспрямувати усі події з клавіатури у відповідне"
" вікно. Використання цього параметра є рідкісним. Воно не впливає на звичайні"
" вікна X11, які можуть отримувати фокусування клавіатури за звичних обставин."
" Щоб захоплення клавіатури X11 бралося до уваги у Wayland, клієнтська"
" програма також має або надіслати специфічне ClientMessage X11 до кореневого"
" вікна, або мати свій пункт у «білому» списку ключа"
" «xwayland-grab-access-rules»."
"Дозволяє маршрутизацію усіх подій клавіатури до вікон X11 із "
"«перевизначенням переспрямовування», які захоплюють клавіатуру, коли їх "
"запущено у Xwayland. Цей параметр призначено для реалізації підтримки "
"клієнтів X11, які здійснюють відображення вікна із «перевизначенням "
"переспрямовування» (вікна, яке не отримує фокусування клавіатури) і видають "
"сигнал щодо захоплення клавіатури, щоб примусово переспрямувати усі події з "
"клавіатури у відповідне вікно. Використання цього параметра є рідкісним. "
"Воно не впливає на звичайні вікна X11, які можуть отримувати фокусування "
"клавіатури за звичних обставин. Щоб захоплення клавіатури X11 бралося до "
"уваги у Wayland, клієнтська програма також має або надіслати специфічне "
"ClientMessage X11 до кореневого вікна, або мати свій пункт у списку"
" дозволених програм ключа «xwayland-grab-access-rules»."
#: data/org.gnome.mutter.wayland.gschema.xml.in:84
msgid "Xwayland applications allowed to issue keyboard grabs"
@ -555,35 +548,46 @@ msgstr ""
"Програми Xwayland, яким дозволено надсилати запит щодо захоплення клавіатури"
#: data/org.gnome.mutter.wayland.gschema.xml.in:85
#| msgid ""
#| "List the resource names or resource class of X11 windows either allowed "
#| "or not allowed to issue X11 keyboard grabs under Xwayland. The resource "
#| "name or resource class of a given X11 window can be obtained using the "
#| "command “xprop WM_CLASS”. Wildcards “*” and jokers “?” in the values are "
#| "supported. Values starting with “!” are blacklisted, which has precedence "
#| "over the whitelist, to revoke applications from the default system list. "
#| "The default system list includes the following applications: "
#| "“@XWAYLAND_GRAB_DEFAULT_ACCESS_RULES@” Users can break an existing grab "
#| "by using the specific keyboard shortcut defined by the keybinding key "
#| "“restore-shortcuts”."
msgid ""
"List the resource names or resource class of X11 windows either allowed or "
"not allowed to issue X11 keyboard grabs under Xwayland. The resource name or "
"resource class of a given X11 window can be obtained using the command "
"“xprop WM_CLASS”. Wildcards “*” and jokers “?” in the values are supported. "
"Values starting with “!” are blacklisted, which has precedence over the "
"whitelist, to revoke applications from the default system list. The default "
"system list includes the following applications: "
"Values starting with “!” are denied, which has precedence over the list of "
"values allowed, to revoke applications from the default system list. The "
"default system list includes the following applications: "
"“@XWAYLAND_GRAB_DEFAULT_ACCESS_RULES@” Users can break an existing grab by "
"using the specific keyboard shortcut defined by the keybinding key “restore-"
"shortcuts”."
msgstr ""
"Список назв ресурсів або клас ресурсів вікон X11, яким дозволено або"
" заборонено видавати запити на захоплення фокусу клавіатури X11 у Xwayland."
" Назву ресурсу або клас ресурсу певного вікна X11 можна визначити за"
" допомогою команди «xprop WM_CLASS». Передбачено підтримку"
" символів-замінників «*» і «?» у записах. Значення, які починатимуться з «!»,"
" буде додано до «чорного» списку, який матиме пріоритет над «білим» списком,"
" щоб програми можна було вилучати із типового загальносистемного списку."
" Типовий загальносистемний список містить записи таких програм:"
" «@XWAYLAND_GRAB_DEFAULT_ACCESS_RULES@». Користувачі можуть усувати наявне"
" захоплення фокуса за допомогою певного клавіатурного скорочення, яке"
" визначається ключем «restore-"
"shortcuts»."
"Список назв ресурсів або клас ресурсів вікон X11, яким дозволено або "
"заборонено видавати запити на захоплення фокусу клавіатури X11 у Xwayland. "
"Назву ресурсу або клас ресурсу певного вікна X11 можна визначити за "
"допомогою команди «xprop WM_CLASS». Передбачено підтримку символів-"
"замінників «*» і «?» у записах. Значення, які починатимуться з «!», буде "
"додано до списку заборонених, який матиме пріоритет над списком дозволених"
" значень, щоб "
"програми можна було вилучати із типового загальносистемного списку. Типовий "
"загальносистемний список містить записи таких програм: "
"«@XWAYLAND_GRAB_DEFAULT_ACCESS_RULES@». Користувачі можуть усувати наявне "
"захоплення фокуса за допомогою певного клавіатурного скорочення, яке "
"визначається ключем «restore-shortcuts»."
#. TRANSLATORS: This string refers to a button that switches between
#. * different modes.
#.
#: src/backends/meta-input-settings.c:2567
#: src/backends/meta-input-settings.c:2698
#, c-format
msgid "Mode Switch (Group %d)"
msgstr "Перемкнути режим (група %d)"
@ -591,38 +595,35 @@ msgstr "Перемкнути режим (група %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs.
#.
#: src/backends/meta-input-settings.c:2590
#| msgid "Switch system controls"
#: src/backends/meta-input-settings.c:2721
msgid "Switch monitor"
msgstr "Перемкнути монітор"
#: src/backends/meta-input-settings.c:2592
#: src/backends/meta-input-settings.c:2723
msgid "Show on-screen help"
msgstr "Показати довідку на екрані"
#: src/backends/meta-monitor.c:223
#: src/backends/meta-monitor.c:235
msgid "Built-in display"
msgstr "Вбудований екран"
#: src/backends/meta-monitor.c:252
#: src/backends/meta-monitor.c:264
msgid "Unknown"
msgstr "Невідомо"
#: src/backends/meta-monitor.c:254
#: src/backends/meta-monitor.c:266
msgid "Unknown Display"
msgstr "Невідомий екран"
#: src/backends/meta-monitor.c:262
#: src/backends/meta-monitor.c:274
#, c-format
#| msgid "%s %s"
msgctxt ""
"This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'"
msgid "%s %s"
msgstr "%s %s"
#: src/backends/meta-monitor.c:270
#: src/backends/meta-monitor.c:282
#, c-format
#| msgid "%s %s"
msgctxt ""
"This is a monitor vendor name followed by product/model name where size in "
"inches could not be calculated, e.g. Dell U2414H"
@ -631,17 +632,13 @@ msgstr "%s %s"
#. Translators: this string will appear in Sysprof
#: src/backends/meta-profiler.c:79
#| msgid "Compositing Manager"
msgid "Compositor"
msgstr "Композитор"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: src/compositor/compositor.c:533
#: src/compositor/compositor.c:516
#, c-format
#| msgid ""
#| "Another compositing manager is already running on screen %i on display "
#| "\"%s\"."
msgid ""
"Another compositing manager is already running on screen %i on display “%s”."
msgstr "Уже запущено інший композитний менеджер на екрані %i через показ «%s»."
@ -679,7 +676,6 @@ msgid "Run as a wayland compositor"
msgstr "запустити як композитор wayland"
#: src/core/main.c:232
#| msgid "Run as a wayland compositor"
msgid "Run as a nested compositor"
msgstr "Запустити як вкладений композитор"
@ -722,12 +718,6 @@ msgstr "_Зачекати"
#: src/core/mutter.c:38
#, c-format
#| msgid ""
#| "mutter %s\n"
#| "Copyright (C) 2001-%d Havoc Pennington, Red Hat, Inc., and others\n"
#| "This is free software; see the source for copying conditions.\n"
#| "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A "
#| "PARTICULAR PURPOSE.\n"
msgid ""
"mutter %s\n"
"Copyright © 2001-%d Havoc Pennington, Red Hat, Inc., and others\n"
@ -754,7 +744,7 @@ msgstr "Додатки Clutter для використання"
msgid "Workspace %d"
msgstr "Робочий простір %d"
#: src/core/util.c:122
#: src/core/util.c:119
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter зібрано без підтримки докладного режиму\n"
@ -765,9 +755,6 @@ msgstr "Перемикання режимів: режим %d"
#: src/x11/meta-x11-display.c:676
#, c-format
#| msgid ""
#| "Display \"%s\" already has a window manager; try using the --replace "
#| "option to replace the current window manager."
msgid ""
"Display “%s” already has a window manager; try using the --replace option to "
"replace the current window manager."
@ -781,13 +768,11 @@ msgstr "Не вдалося ініціалізувати GDK\n"
#: src/x11/meta-x11-display.c:1113
#, c-format
#| msgid "Failed to open X Window System display '%s'\n"
msgid "Failed to open X Window System display “%s”\n"
msgstr "Не вдалось відкрити дисплей віконної системи X «%s»\n"
#: src/x11/meta-x11-display.c:1196
#, c-format
#| msgid "Screen %d on display '%s' is invalid\n"
msgid "Screen %d on display “%s” is invalid\n"
msgstr "Екран %d на дисплеї «%s» не правильний\n"
@ -797,17 +782,14 @@ msgid "Format %s not supported"
msgstr "Підтримки формату %s не передбачено"
#: src/x11/session.c:1821
#| msgid ""
#| "These windows do not support &quot;save current setup&quot; and will have "
#| "to be restarted manually next time you log in."
msgid ""
"These windows do not support “save current setup” and will have to be "
"restarted manually next time you log in."
msgstr ""
"Ці вікна не підтримують «збереження поточних параметрів», і при "
"наступному входженні їх треба запустити власноруч."
"Ці вікна не підтримують «збереження поточних параметрів», і при наступному "
"входженні їх треба запустити власноруч."
#: src/x11/window-props.c:569
#: src/x11/window-props.c:548
#, c-format
msgid "%s (on %s)"
msgstr "%s (на %s)"

View File

@ -34,6 +34,7 @@
#include "backends/meta-backend-types.h"
#include "backends/meta-cursor-renderer.h"
#include "backends/meta-egl.h"
#include "backends/meta-input-mapper-private.h"
#include "backends/meta-input-settings-private.h"
#include "backends/meta-monitor-manager-private.h"
#include "backends/meta-orientation-manager.h"
@ -67,7 +68,9 @@ struct _MetaBackendClass
MetaMonitorManager * (* create_monitor_manager) (MetaBackend *backend,
GError **error);
MetaCursorRenderer * (* create_cursor_renderer) (MetaBackend *backend);
MetaCursorRenderer * (* get_cursor_renderer) (MetaBackend *backend,
ClutterInputDevice *device);
MetaCursorTracker * (* create_cursor_tracker) (MetaBackend *backend);
MetaRenderer * (* create_renderer) (MetaBackend *backend,
GError **error);
MetaInputSettings * (* create_input_settings) (MetaBackend *backend);
@ -104,6 +107,8 @@ struct _MetaBackendClass
void (* set_numlock) (MetaBackend *backend,
gboolean numlock_state);
void (* set_pointer_constraint) (MetaBackend *backend,
MetaPointerConstraint *constraint);
};
void meta_init_backend (GType backend_gtype);
@ -128,6 +133,8 @@ META_EXPORT_TEST
MetaMonitorManager * meta_backend_get_monitor_manager (MetaBackend *backend);
MetaOrientationManager * meta_backend_get_orientation_manager (MetaBackend *backend);
MetaCursorTracker * meta_backend_get_cursor_tracker (MetaBackend *backend);
MetaCursorRenderer * meta_backend_get_cursor_renderer_for_device (MetaBackend *backend,
ClutterInputDevice *device);
MetaCursorRenderer * meta_backend_get_cursor_renderer (MetaBackend *backend);
META_EXPORT_TEST
MetaRenderer * meta_backend_get_renderer (MetaBackend *backend);
@ -170,6 +177,7 @@ gboolean meta_is_stage_views_enabled (void);
gboolean meta_is_stage_views_scaled (void);
MetaInputMapper *meta_backend_get_input_mapper (MetaBackend *backend);
MetaInputSettings *meta_backend_get_input_settings (MetaBackend *backend);
void meta_backend_notify_keymap_changed (MetaBackend *backend);
@ -190,4 +198,12 @@ GList * meta_backend_get_gpus (MetaBackend *backend);
WacomDeviceDatabase * meta_backend_get_wacom_database (MetaBackend *backend);
#endif
void meta_backend_add_hw_cursor_inhibitor (MetaBackend *backend,
MetaHwCursorInhibitor *inhibitor);
void meta_backend_remove_hw_cursor_inhibitor (MetaBackend *backend,
MetaHwCursorInhibitor *inhibitor);
gboolean meta_backend_is_hw_cursors_inhibited (MetaBackend *backend);
#endif /* META_BACKEND_PRIVATE_H */

View File

@ -53,8 +53,10 @@
#include <stdlib.h>
#include "backends/meta-cursor-renderer.h"
#include "backends/meta-cursor-tracker-private.h"
#include "backends/meta-idle-monitor-private.h"
#include "backends/meta-input-mapper-private.h"
#include "backends/meta-input-settings-private.h"
#include "backends/meta-logical-monitor.h"
#include "backends/meta-monitor-manager-dummy.h"
@ -120,8 +122,9 @@ struct _MetaBackendPrivate
MetaMonitorManager *monitor_manager;
MetaOrientationManager *orientation_manager;
MetaCursorTracker *cursor_tracker;
MetaCursorRenderer *cursor_renderer;
GHashTable *cursor_renderers;
MetaInputSettings *input_settings;
MetaInputMapper *input_mapper;
MetaRenderer *renderer;
#ifdef HAVE_EGL
MetaEgl *egl;
@ -150,6 +153,7 @@ struct _MetaBackendPrivate
ClutterActor *stage;
GList *gpus;
GList *hw_cursor_inhibitors;
gboolean is_pointer_position_initialized;
@ -173,6 +177,14 @@ struct _MetaBackendPrivate
};
typedef struct _MetaBackendPrivate MetaBackendPrivate;
typedef struct _MetaBackendSource MetaBackendSource;
struct _MetaBackendSource
{
GSource parent;
MetaBackend *backend;
};
static void
initable_iface_init (GInitableIface *initable_iface);
@ -213,6 +225,8 @@ meta_backend_finalize (GObject *object)
g_clear_pointer (&priv->wacom_db, libwacom_database_destroy);
#endif
g_hash_table_unref (priv->cursor_renderers);
if (priv->sleep_signal_id)
g_dbus_connection_signal_unsubscribe (priv->system_bus, priv->sleep_signal_id);
if (priv->upower_watch_id)
@ -264,6 +278,19 @@ reset_pointer_position (MetaBackend *backend)
primary->rect.y + primary->rect.height * 0.9);
}
static void
update_cursors (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
MetaCursorRenderer *renderer;
GHashTableIter iter;
g_hash_table_iter_init (&iter, priv->cursor_renderers);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &renderer))
meta_cursor_renderer_force_update (renderer);
}
void
meta_backend_monitors_changed (MetaBackend *backend)
{
@ -289,7 +316,7 @@ meta_backend_monitors_changed (MetaBackend *backend)
}
}
meta_cursor_renderer_force_update (priv->cursor_renderer);
update_cursors (backend);
}
void
@ -355,8 +382,19 @@ on_device_added (ClutterSeat *seat,
gpointer user_data)
{
MetaBackend *backend = META_BACKEND (user_data);
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
ClutterInputDeviceType device_type;
create_device_monitor (backend, device);
device_type = clutter_input_device_get_device_type (device);
if (device_type == CLUTTER_TOUCHSCREEN_DEVICE ||
device_type == CLUTTER_TABLET_DEVICE ||
device_type == CLUTTER_PEN_DEVICE ||
device_type == CLUTTER_ERASER_DEVICE ||
device_type == CLUTTER_CURSOR_DEVICE ||
device_type == CLUTTER_PAD_DEVICE)
meta_input_mapper_add_device (priv->input_mapper, device);
}
static inline gboolean
@ -428,6 +466,8 @@ on_device_removed (ClutterSeat *seat,
destroy_device_monitor (backend, device);
meta_input_mapper_remove_device (priv->input_mapper, device);
/* If the device the user last interacted goes away, check again pointer
* visibility.
*/
@ -438,6 +478,7 @@ on_device_removed (ClutterSeat *seat,
ClutterInputDeviceType device_type;
priv->current_device = NULL;
g_clear_handle_id (&priv->device_update_idle_id, g_source_remove);
device_type = clutter_input_device_get_device_type (device);
has_touchscreen = check_has_slave_touchscreen (seat);
@ -504,6 +545,42 @@ meta_backend_create_input_settings (MetaBackend *backend)
return META_BACKEND_GET_CLASS (backend)->create_input_settings (backend);
}
static void
input_mapper_device_mapped_cb (MetaInputMapper *mapper,
ClutterInputDevice *device,
float matrix[6],
MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
MetaInputSettings *input_settings = priv->input_settings;
meta_input_settings_set_device_matrix (input_settings, device, matrix);
}
static void
input_mapper_device_enabled_cb (MetaInputMapper *mapper,
ClutterInputDevice *device,
gboolean enabled,
MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
MetaInputSettings *input_settings = priv->input_settings;
meta_input_settings_set_device_enabled (input_settings, device, enabled);
}
static void
input_mapper_device_aspect_ratio_cb (MetaInputMapper *mapper,
ClutterInputDevice *device,
double aspect_ratio,
MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
MetaInputSettings *input_settings = priv->input_settings;
meta_input_settings_set_device_aspect_ratio (input_settings, device, aspect_ratio);
}
static void
meta_backend_real_post_init (MetaBackend *backend)
{
@ -519,8 +596,6 @@ meta_backend_real_post_init (MetaBackend *backend)
meta_backend_sync_screen_size (backend);
priv->cursor_renderer = META_BACKEND_GET_CLASS (backend)->create_cursor_renderer (backend);
priv->device_monitors =
g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) g_object_unref);
@ -529,7 +604,8 @@ meta_backend_real_post_init (MetaBackend *backend)
g_signal_connect_object (seat, "device-added",
G_CALLBACK (on_device_added), backend, 0);
g_signal_connect_object (seat, "device-removed",
G_CALLBACK (on_device_removed), backend, 0);
G_CALLBACK (on_device_removed), backend,
G_CONNECT_AFTER);
set_initial_pointer_visibility (backend, seat);
@ -544,6 +620,14 @@ meta_backend_real_post_init (MetaBackend *backend)
meta_input_settings_maybe_restore_numlock_state (priv->input_settings);
}
priv->input_mapper = meta_input_mapper_new ();
g_signal_connect (priv->input_mapper, "device-mapped",
G_CALLBACK (input_mapper_device_mapped_cb), backend);
g_signal_connect (priv->input_mapper, "device-enabled",
G_CALLBACK (input_mapper_device_enabled_cb), backend);
g_signal_connect (priv->input_mapper, "device-aspect-ratio",
G_CALLBACK (input_mapper_device_aspect_ratio_cb), backend);
#ifdef HAVE_REMOTE_DESKTOP
priv->dbus_session_watcher = g_object_new (META_TYPE_DBUS_SESSION_WATCHER, NULL);
priv->screen_cast = meta_screen_cast_new (backend,
@ -592,6 +676,14 @@ meta_backend_real_is_lid_closed (MetaBackend *backend)
return priv->lid_is_closed;
}
static MetaCursorTracker *
meta_backend_real_create_cursor_tracker (MetaBackend *backend)
{
return g_object_new (META_TYPE_CURSOR_TRACKER,
"backend", backend,
NULL);
}
gboolean
meta_backend_is_lid_closed (MetaBackend *backend)
{
@ -745,6 +837,7 @@ meta_backend_class_init (MetaBackendClass *klass)
klass->ungrab_device = meta_backend_real_ungrab_device;
klass->select_stage_events = meta_backend_real_select_stage_events;
klass->is_lid_closed = meta_backend_real_is_lid_closed;
klass->create_cursor_tracker = meta_backend_real_create_cursor_tracker;
signals[KEYMAP_CHANGED] =
g_signal_new ("keymap-changed",
@ -907,10 +1000,18 @@ clutter_source_dispatch (GSource *source,
GSourceFunc callback,
gpointer user_data)
{
MetaBackendSource *backend_source = (MetaBackendSource *) source;
MetaBackendPrivate *priv =
meta_backend_get_instance_private (backend_source->backend);
ClutterEvent *event = clutter_event_get ();
ClutterSeat *seat;
if (event)
{
event->any.stage =
CLUTTER_STAGE (meta_backend_get_stage (backend_source->backend));
seat = clutter_backend_get_default_seat (priv->clutter_backend);
clutter_seat_handle_event_post (seat, event);
clutter_do_event (event);
clutter_event_free (event);
}
@ -936,6 +1037,7 @@ static gboolean
init_clutter (MetaBackend *backend,
GError **error)
{
MetaBackendSource *backend_source;
GSource *source;
clutter_set_custom_backend_func (meta_get_clutter_backend);
@ -947,7 +1049,9 @@ init_clutter (MetaBackend *backend,
return FALSE;
}
source = g_source_new (&clutter_source_funcs, sizeof (GSource));
source = g_source_new (&clutter_source_funcs, sizeof (MetaBackendSource));
backend_source = (MetaBackendSource *) source;
backend_source->backend = backend;
g_source_attach (source, NULL);
g_source_unref (source);
@ -988,7 +1092,8 @@ meta_backend_initable_init (GInitable *initable,
if (!priv->renderer)
return FALSE;
priv->cursor_tracker = g_object_new (META_TYPE_CURSOR_TRACKER, NULL);
priv->cursor_tracker =
META_BACKEND_GET_CLASS (backend)->create_cursor_tracker (backend);
priv->dnd = g_object_new (META_TYPE_DND, NULL);
@ -1071,8 +1176,25 @@ MetaCursorRenderer *
meta_backend_get_cursor_renderer (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
ClutterInputDevice *pointer;
ClutterSeat *seat;
return priv->cursor_renderer;
seat = clutter_backend_get_default_seat (priv->clutter_backend);
pointer = clutter_seat_get_pointer (seat);
return meta_backend_get_cursor_renderer_for_device (backend, pointer);
}
MetaCursorRenderer *
meta_backend_get_cursor_renderer_for_device (MetaBackend *backend,
ClutterInputDevice *device)
{
g_return_val_if_fail (META_IS_BACKEND (backend), NULL);
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
g_return_val_if_fail (clutter_input_device_get_device_type (device) !=
CLUTTER_KEYBOARD_DEVICE, NULL);
return META_BACKEND_GET_CLASS (backend)->get_cursor_renderer (backend, device);
}
/**
@ -1319,7 +1441,7 @@ meta_backend_get_client_pointer_constraint (MetaBackend *backend)
* @constraint: (nullable): the client constraint to follow.
*
* Sets the current pointer constraint and removes (and unrefs) the previous
* one. If @constrant is %NULL, this means that there is no
* one. If @constraint is %NULL, this means that there is no
* #MetaPointerConstraint active.
*/
void
@ -1328,11 +1450,8 @@ meta_backend_set_client_pointer_constraint (MetaBackend *backend,
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
g_assert (!constraint || !priv->client_pointer_constraint);
g_clear_object (&priv->client_pointer_constraint);
if (constraint)
priv->client_pointer_constraint = g_object_ref (constraint);
META_BACKEND_GET_CLASS (backend)->set_pointer_constraint (backend, constraint);
g_set_object (&priv->client_pointer_constraint, constraint);
}
ClutterBackend *
@ -1398,6 +1517,14 @@ meta_is_stage_views_scaled (void)
return layout_mode == META_LOGICAL_MONITOR_LAYOUT_MODE_LOGICAL;
}
MetaInputMapper *
meta_backend_get_input_mapper (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
return priv->input_mapper;
}
MetaInputSettings *
meta_backend_get_input_settings (MetaBackend *backend)
{
@ -1464,3 +1591,40 @@ meta_backend_get_wacom_database (MetaBackend *backend)
return priv->wacom_db;
}
#endif
void
meta_backend_add_hw_cursor_inhibitor (MetaBackend *backend,
MetaHwCursorInhibitor *inhibitor)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
priv->hw_cursor_inhibitors = g_list_prepend (priv->hw_cursor_inhibitors,
inhibitor);
}
void
meta_backend_remove_hw_cursor_inhibitor (MetaBackend *backend,
MetaHwCursorInhibitor *inhibitor)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
priv->hw_cursor_inhibitors = g_list_remove (priv->hw_cursor_inhibitors,
inhibitor);
}
gboolean
meta_backend_is_hw_cursors_inhibited (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
GList *l;
for (l = priv->hw_cursor_inhibitors; l; l = l->next)
{
MetaHwCursorInhibitor *inhibitor = l->data;
if (meta_hw_cursor_inhibitor_is_cursor_inhibited (inhibitor))
return TRUE;
}
return FALSE;
}

View File

@ -28,6 +28,8 @@
#include <math.h>
#include "backends/meta-backend-private.h"
#include "backends/meta-logical-monitor.h"
#include "backends/meta-stage-private.h"
#include "clutter/clutter.h"
#include "clutter/clutter-mutter.h"
@ -44,6 +46,7 @@ enum
PROP_0,
PROP_BACKEND,
PROP_DEVICE,
N_PROPS
};
@ -57,7 +60,10 @@ struct _MetaCursorRendererPrivate
float current_x;
float current_y;
ClutterInputDevice *device;
MetaCursorSprite *displayed_cursor;
MetaCursorSprite *overlay_cursor;
MetaOverlay *stage_overlay;
gboolean handled_by_backend;
gulong after_paint_handler_id;
@ -75,14 +81,13 @@ static guint signals[LAST_SIGNAL];
G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRenderer, meta_cursor_renderer, G_TYPE_OBJECT);
static gboolean
meta_hw_cursor_inhibitor_is_cursor_sprite_inhibited (MetaHwCursorInhibitor *inhibitor,
MetaCursorSprite *cursor_sprite)
gboolean
meta_hw_cursor_inhibitor_is_cursor_inhibited (MetaHwCursorInhibitor *inhibitor)
{
MetaHwCursorInhibitorInterface *iface =
META_HW_CURSOR_INHIBITOR_GET_IFACE (inhibitor);
return iface->is_cursor_sprite_inhibited (inhibitor, cursor_sprite);
return iface->is_cursor_inhibited (inhibitor);
}
static void
@ -123,18 +128,16 @@ align_cursor_position (MetaCursorRenderer *renderer,
graphene_rect_offset (rect, view_layout.x, view_layout.y);
}
static void
queue_redraw (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
void
meta_cursor_renderer_update_stage_overlay (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
ClutterActor *stage = meta_backend_get_stage (priv->backend);
CoglTexture *texture;
graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
/* During early initialization, we can have no stage */
if (!stage)
return;
g_set_object (&priv->overlay_cursor, cursor_sprite);
if (cursor_sprite)
{
@ -145,11 +148,12 @@ queue_redraw (MetaCursorRenderer *renderer,
if (!priv->stage_overlay)
priv->stage_overlay = meta_stage_create_cursor_overlay (META_STAGE (stage));
if (cursor_sprite && !priv->handled_by_backend)
if (cursor_sprite)
texture = meta_cursor_sprite_get_cogl_texture (cursor_sprite);
else
texture = NULL;
meta_overlay_set_visible (priv->stage_overlay, !priv->handled_by_backend);
meta_stage_update_cursor_overlay (META_STAGE (stage), priv->stage_overlay,
texture, &rect);
}
@ -202,6 +206,9 @@ meta_cursor_renderer_get_property (GObject *object,
case PROP_BACKEND:
g_value_set_object (value, priv->backend);
break;
case PROP_DEVICE:
g_value_set_object (value, priv->device);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -223,6 +230,9 @@ meta_cursor_renderer_set_property (GObject *object,
case PROP_BACKEND:
priv->backend = g_value_get_object (value);
break;
case PROP_DEVICE:
priv->device = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -241,6 +251,9 @@ meta_cursor_renderer_finalize (GObject *object)
g_clear_signal_handler (&priv->after_paint_handler_id, stage);
g_clear_object (&priv->displayed_cursor);
g_clear_object (&priv->overlay_cursor);
G_OBJECT_CLASS (meta_cursor_renderer_parent_class)->finalize (object);
}
@ -280,6 +293,14 @@ meta_cursor_renderer_class_init (MetaCursorRendererClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_DEVICE] =
g_param_spec_object ("device",
"device",
"Input device",
CLUTTER_TYPE_INPUT_DEVICE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, obj_props);
signals[CURSOR_PAINTED] = g_signal_new ("cursor-painted",
@ -328,40 +349,74 @@ meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
};
}
static float
find_highest_logical_monitor_scale (MetaBackend *backend,
MetaCursorSprite *cursor_sprite)
{
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
MetaCursorRenderer *cursor_renderer =
meta_backend_get_cursor_renderer (backend);
graphene_rect_t cursor_rect;
GList *logical_monitors;
GList *l;
float highest_scale = 0.0;
cursor_rect = meta_cursor_renderer_calculate_rect (cursor_renderer,
cursor_sprite);
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager);
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
graphene_rect_t logical_monitor_rect =
meta_rectangle_to_graphene_rect (&logical_monitor->rect);
if (!graphene_rect_intersection (&cursor_rect,
&logical_monitor_rect,
NULL))
continue;
highest_scale = MAX (highest_scale, logical_monitor->scale);
}
return highest_scale;
}
static void
meta_cursor_renderer_update_cursor (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
gboolean handled_by_backend;
gboolean should_redraw = FALSE;
if (cursor_sprite)
meta_cursor_sprite_prepare_at (cursor_sprite,
(int) priv->current_x,
(int) priv->current_y);
{
float scale = find_highest_logical_monitor_scale (priv->backend,
cursor_sprite);
meta_cursor_sprite_prepare_at (cursor_sprite,
MAX (1, scale),
(int) priv->current_x,
(int) priv->current_y);
}
handled_by_backend =
META_CURSOR_RENDERER_GET_CLASS (renderer)->update_cursor (renderer,
cursor_sprite);
if (handled_by_backend != priv->handled_by_backend)
{
priv->handled_by_backend = handled_by_backend;
should_redraw = TRUE;
}
priv->handled_by_backend = handled_by_backend;
if (!handled_by_backend)
should_redraw = TRUE;
if (should_redraw)
queue_redraw (renderer, cursor_sprite);
meta_cursor_renderer_update_stage_overlay (renderer, cursor_sprite);
}
MetaCursorRenderer *
meta_cursor_renderer_new (MetaBackend *backend)
meta_cursor_renderer_new (MetaBackend *backend,
ClutterInputDevice *device)
{
return g_object_new (META_TYPE_CURSOR_RENDERER,
"backend", backend,
"device", device,
NULL);
}
@ -373,7 +428,7 @@ meta_cursor_renderer_set_cursor (MetaCursorRenderer *renderer,
if (priv->displayed_cursor == cursor_sprite)
return;
priv->displayed_cursor = cursor_sprite;
g_set_object (&priv->displayed_cursor, cursor_sprite);
meta_cursor_renderer_update_cursor (renderer, cursor_sprite);
}
@ -388,78 +443,43 @@ meta_cursor_renderer_force_update (MetaCursorRenderer *renderer)
}
void
meta_cursor_renderer_set_position (MetaCursorRenderer *renderer,
float x,
float y)
meta_cursor_renderer_update_position (MetaCursorRenderer *renderer)
{
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
graphene_point_t pos;
g_assert (meta_is_wayland_compositor ());
priv->current_x = x;
priv->current_y = y;
clutter_input_device_get_coords (priv->device, NULL, &pos);
priv->current_x = pos.x;
priv->current_y = pos.y;
meta_cursor_renderer_update_cursor (renderer, priv->displayed_cursor);
}
graphene_point_t
meta_cursor_renderer_get_position (MetaCursorRenderer *renderer)
{
MetaCursorRendererPrivate *priv =
meta_cursor_renderer_get_instance_private (renderer);
return (graphene_point_t) {
.x = priv->current_x,
.y = priv->current_y
};
}
MetaCursorSprite *
meta_cursor_renderer_get_cursor (MetaCursorRenderer *renderer)
{
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
return priv->displayed_cursor;
}
void
meta_cursor_renderer_add_hw_cursor_inhibitor (MetaCursorRenderer *renderer,
MetaHwCursorInhibitor *inhibitor)
{
MetaCursorRendererPrivate *priv =
meta_cursor_renderer_get_instance_private (renderer);
priv->hw_cursor_inhibitors = g_list_prepend (priv->hw_cursor_inhibitors,
inhibitor);
}
void
meta_cursor_renderer_remove_hw_cursor_inhibitor (MetaCursorRenderer *renderer,
MetaHwCursorInhibitor *inhibitor)
{
MetaCursorRendererPrivate *priv =
meta_cursor_renderer_get_instance_private (renderer);
priv->hw_cursor_inhibitors = g_list_remove (priv->hw_cursor_inhibitors,
inhibitor);
return priv->overlay_cursor;
}
gboolean
meta_cursor_renderer_is_hw_cursors_inhibited (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
meta_cursor_renderer_is_overlay_visible (MetaCursorRenderer *renderer)
{
MetaCursorRendererPrivate *priv =
meta_cursor_renderer_get_instance_private (renderer);
GList *l;
for (l = priv->hw_cursor_inhibitors; l; l = l->next)
{
MetaHwCursorInhibitor *inhibitor = l->data;
if (!priv->stage_overlay)
return FALSE;
if (meta_hw_cursor_inhibitor_is_cursor_sprite_inhibited (inhibitor,
cursor_sprite))
return TRUE;
}
return FALSE;
return meta_overlay_is_visible (priv->stage_overlay);
}
ClutterInputDevice *
meta_cursor_renderer_get_input_device (MetaCursorRenderer *renderer)
{
MetaCursorRendererPrivate *priv =
meta_cursor_renderer_get_instance_private (renderer);
return priv->device;
}

View File

@ -38,10 +38,11 @@ struct _MetaHwCursorInhibitorInterface
{
GTypeInterface parent_iface;
gboolean (* is_cursor_sprite_inhibited) (MetaHwCursorInhibitor *inhibitor,
MetaCursorSprite *cursor_sprite);
gboolean (* is_cursor_inhibited) (MetaHwCursorInhibitor *inhibitor);
};
gboolean meta_hw_cursor_inhibitor_is_cursor_inhibited (MetaHwCursorInhibitor *inhibitor);
#define META_TYPE_CURSOR_RENDERER (meta_cursor_renderer_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaCursorRenderer, meta_cursor_renderer,
META, CURSOR_RENDERER, GObject);
@ -54,32 +55,27 @@ struct _MetaCursorRendererClass
MetaCursorSprite *cursor_sprite);
};
MetaCursorRenderer * meta_cursor_renderer_new (MetaBackend *backend);
MetaCursorRenderer * meta_cursor_renderer_new (MetaBackend *backend,
ClutterInputDevice *device);
void meta_cursor_renderer_set_cursor (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite);
void meta_cursor_renderer_set_position (MetaCursorRenderer *renderer,
float x,
float y);
graphene_point_t meta_cursor_renderer_get_position (MetaCursorRenderer *renderer);
void meta_cursor_renderer_update_position (MetaCursorRenderer *renderer);
void meta_cursor_renderer_force_update (MetaCursorRenderer *renderer);
MetaCursorSprite * meta_cursor_renderer_get_cursor (MetaCursorRenderer *renderer);
void meta_cursor_renderer_add_hw_cursor_inhibitor (MetaCursorRenderer *renderer,
MetaHwCursorInhibitor *inhibitor);
void meta_cursor_renderer_remove_hw_cursor_inhibitor (MetaCursorRenderer *renderer,
MetaHwCursorInhibitor *inhibitor);
gboolean meta_cursor_renderer_is_hw_cursors_inhibited (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite);
gboolean meta_cursor_renderer_is_overlay_visible (MetaCursorRenderer *renderer);
graphene_rect_t meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite);
void meta_cursor_renderer_emit_painted (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite);
ClutterInputDevice * meta_cursor_renderer_get_input_device (MetaCursorRenderer *renderer);
void meta_cursor_renderer_update_stage_overlay (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite);
#endif /* META_CURSOR_RENDERER_H */

View File

@ -24,44 +24,31 @@
#include "backends/meta-cursor.h"
#include "backends/meta-cursor-renderer.h"
#include "backends/x11/cm/meta-cursor-sprite-xfixes.h"
#include "meta/meta-cursor-tracker.h"
struct _MetaCursorTracker {
GObject parent_instance;
struct _MetaCursorTrackerClass
{
GObjectClass parent_class;
gboolean is_showing;
MetaCursorSprite *effective_cursor; /* May be NULL when hidden */
MetaCursorSprite *displayed_cursor;
/* Wayland clients can set a NULL buffer as their cursor
* explicitly, which means that we shouldn't display anything.
* So, we can't simply store a NULL in window_cursor to
* determine an unset window cursor; we need an extra boolean.
*/
gboolean has_window_cursor;
MetaCursorSprite *window_cursor;
MetaCursorSprite *root_cursor;
/* The cursor from the X11 server. */
MetaCursorSpriteXfixes *xfixes_cursor;
void (* set_force_track_position) (MetaCursorTracker *tracker,
gboolean is_enabled);
MetaCursorSprite * (* get_sprite) (MetaCursorTracker *tracker);
};
gboolean meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
XEvent *xevent);
void meta_cursor_tracker_set_window_cursor (MetaCursorTracker *tracker,
MetaCursorSprite *cursor_sprite);
void meta_cursor_tracker_unset_window_cursor (MetaCursorTracker *tracker);
void meta_cursor_tracker_set_root_cursor (MetaCursorTracker *tracker,
MetaCursorSprite *cursor_sprite);
void meta_cursor_tracker_update_position (MetaCursorTracker *tracker,
float new_x,
float new_y);
void meta_cursor_tracker_update_position (MetaCursorTracker *tracker);
MetaCursorSprite * meta_cursor_tracker_get_displayed_cursor (MetaCursorTracker *tracker);
void meta_cursor_tracker_track_position (MetaCursorTracker *tracker);
void meta_cursor_tracker_untrack_position (MetaCursorTracker *tracker);
MetaBackend * meta_cursor_tracker_get_backend (MetaCursorTracker *tracker);
void meta_cursor_tracker_notify_cursor_changed (MetaCursorTracker *tracker);
#endif

View File

@ -31,21 +31,53 @@
#include "backends/meta-cursor-tracker-private.h"
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <string.h>
#include "backends/meta-backend-private.h"
#include "backends/x11/cm/meta-cursor-sprite-xfixes.h"
#include "cogl/cogl.h"
#include "core/display-private.h"
#include "clutter/clutter.h"
#include "meta-marshal.h"
#include "meta/main.h"
#include "meta/meta-x11-errors.h"
#include "meta/util.h"
#include "x11/meta-x11-display-private.h"
G_DEFINE_TYPE (MetaCursorTracker, meta_cursor_tracker, G_TYPE_OBJECT);
enum
{
PROP_0,
PROP_BACKEND,
N_PROPS
};
static GParamSpec *obj_props[N_PROPS];
typedef struct _MetaCursorTrackerPrivate
{
MetaBackend *backend;
gboolean is_showing;
int track_position_count;
float x;
float y;
MetaCursorSprite *effective_cursor; /* May be NULL when hidden */
MetaCursorSprite *displayed_cursor;
/* Wayland clients can set a NULL buffer as their cursor
* explicitly, which means that we shouldn't display anything.
* So, we can't simply store a NULL in window_cursor to
* determine an unset window cursor; we need an extra boolean.
*/
gboolean has_window_cursor;
MetaCursorSprite *window_cursor;
MetaCursorSprite *root_cursor;
} MetaCursorTrackerPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorTracker, meta_cursor_tracker,
G_TYPE_OBJECT)
enum
{
@ -57,6 +89,12 @@ enum
static guint signals[LAST_SIGNAL];
void
meta_cursor_tracker_notify_cursor_changed (MetaCursorTracker *tracker)
{
g_signal_emit (tracker, signals[CURSOR_CHANGED], 0);
}
static void
cursor_texture_updated (MetaCursorSprite *cursor,
MetaCursorTracker *tracker)
@ -67,26 +105,28 @@ cursor_texture_updated (MetaCursorSprite *cursor,
static gboolean
update_displayed_cursor (MetaCursorTracker *tracker)
{
MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker);
MetaDisplay *display = meta_get_display ();
MetaCursorSprite *cursor = NULL;
if (display && meta_display_windows_are_interactable (display) &&
tracker->has_window_cursor)
cursor = tracker->window_cursor;
priv->has_window_cursor)
cursor = priv->window_cursor;
else
cursor = tracker->root_cursor;
cursor = priv->root_cursor;
if (tracker->displayed_cursor == cursor)
if (priv->displayed_cursor == cursor)
return FALSE;
if (tracker->displayed_cursor)
if (priv->displayed_cursor)
{
g_signal_handlers_disconnect_by_func (tracker->displayed_cursor,
g_signal_handlers_disconnect_by_func (priv->displayed_cursor,
cursor_texture_updated,
tracker);
}
g_set_object (&tracker->displayed_cursor, cursor);
g_set_object (&priv->displayed_cursor, cursor);
if (cursor)
{
@ -100,22 +140,25 @@ update_displayed_cursor (MetaCursorTracker *tracker)
static gboolean
update_effective_cursor (MetaCursorTracker *tracker)
{
MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker);
MetaCursorSprite *cursor = NULL;
if (tracker->is_showing)
cursor = tracker->displayed_cursor;
if (priv->is_showing)
cursor = priv->displayed_cursor;
return g_set_object (&tracker->effective_cursor, cursor);
return g_set_object (&priv->effective_cursor, cursor);
}
static void
change_cursor_renderer (MetaCursorTracker *tracker)
{
MetaBackend *backend = meta_get_backend ();
MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker);
MetaCursorRenderer *cursor_renderer =
meta_backend_get_cursor_renderer (backend);
meta_backend_get_cursor_renderer (priv->backend);
meta_cursor_renderer_set_cursor (cursor_renderer, tracker->effective_cursor);
meta_cursor_renderer_set_cursor (cursor_renderer, priv->effective_cursor);
}
static void
@ -133,22 +176,83 @@ sync_cursor (MetaCursorTracker *tracker)
}
static void
meta_cursor_tracker_init (MetaCursorTracker *self)
meta_cursor_tracker_real_set_force_track_position (MetaCursorTracker *tracker,
gboolean is_enabled)
{
self->is_showing = TRUE;
}
static MetaCursorSprite *
meta_cursor_tracker_real_get_sprite (MetaCursorTracker *tracker)
{
MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker);
return priv->displayed_cursor;
}
static void
meta_cursor_tracker_init (MetaCursorTracker *tracker)
{
MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker);
priv->is_showing = TRUE;
priv->x = -1.0;
priv->y = -1.0;
}
static void
meta_cursor_tracker_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
MetaCursorTracker *tracker = META_CURSOR_TRACKER (object);
MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker);
switch (prop_id)
{
case PROP_BACKEND:
g_value_set_object (value, priv->backend);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
meta_cursor_tracker_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
MetaCursorTracker *tracker = META_CURSOR_TRACKER (object);
MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker);
switch (prop_id)
{
case PROP_BACKEND:
priv->backend = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
meta_cursor_tracker_finalize (GObject *object)
{
MetaCursorTracker *self = META_CURSOR_TRACKER (object);
MetaCursorTracker *tracker = META_CURSOR_TRACKER (object);
MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker);
if (self->effective_cursor)
g_object_unref (self->effective_cursor);
if (self->displayed_cursor)
g_object_unref (self->displayed_cursor);
if (self->root_cursor)
g_object_unref (self->root_cursor);
g_clear_object (&priv->effective_cursor);
g_clear_object (&priv->displayed_cursor);
g_clear_object (&priv->root_cursor);
G_OBJECT_CLASS (meta_cursor_tracker_parent_class)->finalize (object);
}
@ -158,8 +262,25 @@ meta_cursor_tracker_class_init (MetaCursorTrackerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = meta_cursor_tracker_get_property;
object_class->set_property = meta_cursor_tracker_set_property;
object_class->finalize = meta_cursor_tracker_finalize;
klass->set_force_track_position =
meta_cursor_tracker_real_set_force_track_position;
klass->get_sprite =
meta_cursor_tracker_real_get_sprite;
obj_props[PROP_BACKEND] =
g_param_spec_object ("backend",
"backend",
"MetaBackend",
META_TYPE_BACKEND,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, obj_props);
signals[CURSOR_CHANGED] = g_signal_new ("cursor-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@ -179,14 +300,8 @@ meta_cursor_tracker_class_init (MetaCursorTrackerClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
meta_marshal_VOID__FLOAT_FLOAT,
G_TYPE_NONE, 2,
G_TYPE_FLOAT,
G_TYPE_FLOAT);
g_signal_set_va_marshaller (signals[CURSOR_MOVED],
G_TYPE_FROM_CLASS (klass),
meta_marshal_VOID__FLOAT_FLOATv);
NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[VISIBILITY_CHANGED] = g_signal_new ("visibility-changed",
G_TYPE_FROM_CLASS (klass),
@ -219,50 +334,16 @@ set_window_cursor (MetaCursorTracker *tracker,
gboolean has_cursor,
MetaCursorSprite *cursor_sprite)
{
g_clear_object (&tracker->window_cursor);
MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker);
g_clear_object (&priv->window_cursor);
if (cursor_sprite)
tracker->window_cursor = g_object_ref (cursor_sprite);
tracker->has_window_cursor = has_cursor;
priv->window_cursor = g_object_ref (cursor_sprite);
priv->has_window_cursor = has_cursor;
sync_cursor (tracker);
}
gboolean
meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
XEvent *xevent)
{
MetaX11Display *x11_display = meta_get_display ()->x11_display;
XFixesCursorNotifyEvent *notify_event;
if (meta_is_wayland_compositor ())
return FALSE;
if (xevent->xany.type != x11_display->xfixes_event_base + XFixesCursorNotify)
return FALSE;
notify_event = (XFixesCursorNotifyEvent *)xevent;
if (notify_event->subtype != XFixesDisplayCursorNotify)
return FALSE;
g_clear_object (&tracker->xfixes_cursor);
g_signal_emit (tracker, signals[CURSOR_CHANGED], 0);
return TRUE;
}
static void
ensure_xfixes_cursor (MetaCursorTracker *tracker)
{
MetaDisplay *display = meta_get_display ();
g_autoptr (GError) error = NULL;
if (tracker->xfixes_cursor)
return;
tracker->xfixes_cursor = meta_cursor_sprite_xfixes_new (display, &error);
if (!tracker->xfixes_cursor)
g_warning ("Failed to create XFIXES cursor: %s", error->message);
}
/**
* meta_cursor_tracker_get_sprite:
*
@ -273,27 +354,13 @@ meta_cursor_tracker_get_sprite (MetaCursorTracker *tracker)
{
MetaCursorSprite *cursor_sprite;
g_return_val_if_fail (META_IS_CURSOR_TRACKER (tracker), NULL);
cursor_sprite = META_CURSOR_TRACKER_GET_CLASS (tracker)->get_sprite (tracker);
if (meta_is_wayland_compositor ())
{
cursor_sprite = tracker->displayed_cursor;
}
else
{
ensure_xfixes_cursor (tracker);
cursor_sprite = META_CURSOR_SPRITE (tracker->xfixes_cursor);
}
if (!cursor_sprite)
return NULL;
if (cursor_sprite)
{
meta_cursor_sprite_realize_texture (cursor_sprite);
return meta_cursor_sprite_get_cogl_texture (cursor_sprite);
}
else
{
return NULL;
}
meta_cursor_sprite_realize_texture (cursor_sprite);
return meta_cursor_sprite_get_cogl_texture (cursor_sprite);
}
/**
@ -312,15 +379,7 @@ meta_cursor_tracker_get_hot (MetaCursorTracker *tracker,
g_return_if_fail (META_IS_CURSOR_TRACKER (tracker));
if (meta_is_wayland_compositor ())
{
cursor_sprite = tracker->displayed_cursor;
}
else
{
ensure_xfixes_cursor (tracker);
cursor_sprite = META_CURSOR_SPRITE (tracker->xfixes_cursor);
}
cursor_sprite = META_CURSOR_TRACKER_GET_CLASS (tracker)->get_sprite (tracker);
if (cursor_sprite)
meta_cursor_sprite_get_hotspot (cursor_sprite, x, y);
@ -358,107 +417,99 @@ void
meta_cursor_tracker_set_root_cursor (MetaCursorTracker *tracker,
MetaCursorSprite *cursor_sprite)
{
g_clear_object (&tracker->root_cursor);
MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker);
g_clear_object (&priv->root_cursor);
if (cursor_sprite)
tracker->root_cursor = g_object_ref (cursor_sprite);
priv->root_cursor = g_object_ref (cursor_sprite);
sync_cursor (tracker);
}
void
meta_cursor_tracker_update_position (MetaCursorTracker *tracker,
float new_x,
float new_y)
meta_cursor_tracker_update_position (MetaCursorTracker *tracker)
{
MetaBackend *backend = meta_get_backend ();
MetaCursorRenderer *cursor_renderer =
meta_backend_get_cursor_renderer (backend);
g_assert (meta_is_wayland_compositor ());
meta_cursor_renderer_set_position (cursor_renderer, new_x, new_y);
g_signal_emit (tracker, signals[CURSOR_MOVED], 0, new_x, new_y);
}
static void
get_pointer_position_gdk (int *x,
int *y,
int *mods)
{
GdkSeat *gseat;
GdkDevice *gdevice;
GdkScreen *gscreen;
gseat = gdk_display_get_default_seat (gdk_display_get_default ());
gdevice = gdk_seat_get_pointer (gseat);
gdk_device_get_position (gdevice, &gscreen, x, y);
if (mods)
gdk_device_get_state (gdevice,
gdk_screen_get_root_window (gscreen),
NULL, (GdkModifierType*)mods);
}
static void
get_pointer_position_clutter (int *x,
int *y,
int *mods)
{
ClutterSeat *seat;
ClutterInputDevice *cdevice;
graphene_point_t point;
seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
cdevice = clutter_seat_get_pointer (seat);
clutter_input_device_get_coords (cdevice, NULL, &point);
if (x)
*x = point.x;
if (y)
*y = point.y;
if (mods)
*mods = clutter_input_device_get_modifier_state (cdevice);
g_signal_emit (tracker, signals[CURSOR_MOVED], 0);
}
void
meta_cursor_tracker_get_pointer (MetaCursorTracker *tracker,
int *x,
int *y,
graphene_point_t *coords,
ClutterModifierType *mods)
{
/* We can't use the clutter interface when not running as a wayland compositor,
because we need to query the server, rather than using the last cached value.
OTOH, on wayland we can't use GDK, because that only sees the events
we forward to xwayland.
*/
if (meta_is_wayland_compositor ())
get_pointer_position_clutter (x, y, (int*)mods);
else
get_pointer_position_gdk (x, y, (int*)mods);
ClutterSeat *seat;
ClutterInputDevice *cdevice;
seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
cdevice = clutter_seat_get_pointer (seat);
clutter_seat_query_state (seat, cdevice, NULL, coords, mods);
}
void
meta_cursor_tracker_track_position (MetaCursorTracker *tracker)
{
MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker);
priv->track_position_count++;
if (priv->track_position_count == 1)
{
MetaCursorTrackerClass *klass =
META_CURSOR_TRACKER_GET_CLASS (tracker);
klass->set_force_track_position (tracker, TRUE);
}
}
void
meta_cursor_tracker_untrack_position (MetaCursorTracker *tracker)
{
MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker);
g_return_if_fail (priv->track_position_count > 0);
priv->track_position_count--;
if (priv->track_position_count == 0)
{
MetaCursorTrackerClass *klass =
META_CURSOR_TRACKER_GET_CLASS (tracker);
klass->set_force_track_position (tracker, FALSE);
}
}
gboolean
meta_cursor_tracker_get_pointer_visible (MetaCursorTracker *tracker)
{
return tracker->is_showing;
MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker);
return priv->is_showing;
}
void
meta_cursor_tracker_set_pointer_visible (MetaCursorTracker *tracker,
gboolean visible)
{
if (visible == tracker->is_showing)
MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker);
if (visible == priv->is_showing)
return;
tracker->is_showing = visible;
priv->is_showing = visible;
sync_cursor (tracker);
g_signal_emit (tracker, signals[VISIBILITY_CHANGED], 0);
}
MetaCursorSprite *
meta_cursor_tracker_get_displayed_cursor (MetaCursorTracker *tracker)
MetaBackend *
meta_cursor_tracker_get_backend (MetaCursorTracker *tracker)
{
return tracker->displayed_cursor;
MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker);
return priv->backend;
}

View File

@ -179,20 +179,18 @@ meta_cursor_sprite_get_texture_transform (MetaCursorSprite *sprite)
}
void
meta_cursor_sprite_prepare_at (MetaCursorSprite *sprite,
int x,
int y)
meta_cursor_sprite_prepare_at (MetaCursorSprite *sprite,
float best_scale,
int x,
int y)
{
g_signal_emit (sprite, signals[PREPARE_AT], 0, x, y);
g_signal_emit (sprite, signals[PREPARE_AT], 0, best_scale, x, y);
}
void
meta_cursor_sprite_realize_texture (MetaCursorSprite *sprite)
{
MetaCursorSpriteClass *klass = META_CURSOR_SPRITE_GET_CLASS (sprite);
if (klass->realize_texture)
klass->realize_texture (sprite);
META_CURSOR_SPRITE_GET_CLASS (sprite)->realize_texture (sprite);
}
static void
@ -229,7 +227,8 @@ meta_cursor_sprite_class_init (MetaCursorSpriteClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 2,
G_TYPE_NONE, 3,
G_TYPE_FLOAT,
G_TYPE_INT,
G_TYPE_INT);
signals[TEXTURE_CHANGED] = g_signal_new ("texture-changed",

View File

@ -43,6 +43,7 @@ struct _MetaCursorSpriteClass
};
void meta_cursor_sprite_prepare_at (MetaCursorSprite *sprite,
float best_scale,
int x,
int y);

View File

@ -23,7 +23,8 @@
#define META_INPUT_MAPPER_H
#include <clutter/clutter.h>
#include "meta-monitor-manager-private.h"
#include "backends/meta-backend-types.h"
#define META_TYPE_INPUT_MAPPER (meta_input_mapper_get_type ())
@ -33,10 +34,9 @@ G_DECLARE_FINAL_TYPE (MetaInputMapper, meta_input_mapper,
MetaInputMapper * meta_input_mapper_new (void);
void meta_input_mapper_add_device (MetaInputMapper *mapper,
ClutterInputDevice *device,
gboolean builtin);
ClutterInputDevice *device);
void meta_input_mapper_remove_device (MetaInputMapper *mapper,
ClutterInputDevice *device);
ClutterInputDevice *device);
ClutterInputDevice *
meta_input_mapper_get_logical_monitor_device (MetaInputMapper *mapper,
@ -46,4 +46,7 @@ MetaLogicalMonitor *
meta_input_mapper_get_device_logical_monitor (MetaInputMapper *mapper,
ClutterInputDevice *device);
GSettings * meta_input_mapper_get_tablet_settings (MetaInputMapper *mapper,
ClutterInputDevice *device);
#endif /* META_INPUT_MAPPER_H */

View File

@ -24,6 +24,7 @@
#include <gudev/gudev.h>
#endif
#include "backends/meta-input-device-private.h"
#include "meta-input-mapper-private.h"
#include "meta-monitor-manager-private.h"
#include "meta-logical-monitor.h"
@ -59,6 +60,7 @@ typedef enum
typedef enum
{
META_MATCH_CONFIG, /* Specified by config */
META_MATCH_IS_BUILTIN, /* Output is builtin, applies mainly to system-integrated devices */
META_MATCH_SIZE, /* Size from input device and output match */
META_MATCH_EDID_FULL, /* Full EDID model match, eg. "Cintiq 12WX" */
@ -72,6 +74,7 @@ struct _MetaMapperInputInfo
ClutterInputDevice *device;
MetaInputMapper *mapper;
MetaMapperOutputInfo *output;
GSettings *settings;
guint builtin : 1;
};
@ -99,24 +102,149 @@ struct _DeviceCandidates
enum
{
DEVICE_MAPPED,
DEVICE_ENABLED,
DEVICE_ASPECT_RATIO,
N_SIGNALS
};
static guint signals[N_SIGNALS] = { 0, };
static void mapper_recalculate_input (MetaInputMapper *mapper,
MetaMapperInputInfo *input);
G_DEFINE_TYPE (MetaInputMapper, meta_input_mapper, G_TYPE_OBJECT)
static GSettings *
get_device_settings (ClutterInputDevice *device)
{
const gchar *group, *schema, *vendor, *product;
ClutterInputDeviceType type;
GSettings *settings;
gchar *path;
type = clutter_input_device_get_device_type (device);
if (type == CLUTTER_TOUCHSCREEN_DEVICE)
{
group = "touchscreens";
schema = "org.gnome.desktop.peripherals.touchscreen";
}
else if (type == CLUTTER_TABLET_DEVICE ||
type == CLUTTER_PEN_DEVICE ||
type == CLUTTER_ERASER_DEVICE ||
type == CLUTTER_CURSOR_DEVICE ||
type == CLUTTER_PAD_DEVICE)
{
group = "tablets";
schema = "org.gnome.desktop.peripherals.tablet";
}
else
return NULL;
vendor = clutter_input_device_get_vendor_id (device);
product = clutter_input_device_get_product_id (device);
path = g_strdup_printf ("/org/gnome/desktop/peripherals/%s/%s:%s/",
group, vendor, product);
settings = g_settings_new_with_path (schema, path);
g_free (path);
return settings;
}
static MetaMonitor *
logical_monitor_find_monitor (MetaLogicalMonitor *logical_monitor,
const char *vendor,
const char *product,
const char *serial)
{
GList *monitors;
GList *l;
monitors = meta_logical_monitor_get_monitors (logical_monitor);
for (l = monitors; l; l = l->next)
{
MetaMonitor *monitor = l->data;
if (g_strcmp0 (meta_monitor_get_vendor (monitor), vendor) == 0 &&
g_strcmp0 (meta_monitor_get_product (monitor), product) == 0 &&
g_strcmp0 (meta_monitor_get_serial (monitor), serial) == 0)
return monitor;
}
return NULL;
}
static void
find_settings_monitor (MetaInputMapper *mapper,
GSettings *settings,
ClutterInputDevice *device,
MetaMonitor **out_monitor,
MetaLogicalMonitor **out_logical_monitor)
{
MetaMonitor *monitor;
guint n_values;
GList *logical_monitors;
GList *l;
gchar **edid;
edid = g_settings_get_strv (settings, "output");
n_values = g_strv_length (edid);
if (n_values != 3)
{
g_warning ("EDID configuration for device '%s' "
"is incorrect, must have 3 values",
clutter_input_device_get_device_name (device));
goto out;
}
if (!*edid[0] && !*edid[1] && !*edid[2])
goto out;
logical_monitors =
meta_monitor_manager_get_logical_monitors (mapper->monitor_manager);
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
monitor = logical_monitor_find_monitor (logical_monitor,
edid[0], edid[1], edid[2]);
if (monitor)
{
if (out_monitor)
*out_monitor = monitor;
if (out_logical_monitor)
*out_logical_monitor = logical_monitor;
break;
}
}
out:
g_strfreev (edid);
}
static void
settings_output_changed_cb (GSettings *settings,
const gchar *key,
MetaMapperInputInfo *info)
{
mapper_recalculate_input (info->mapper, info);
}
static MetaMapperInputInfo *
mapper_input_info_new (ClutterInputDevice *device,
MetaInputMapper *mapper,
gboolean builtin)
MetaInputMapper *mapper)
{
MetaMapperInputInfo *info;
info = g_new0 (MetaMapperInputInfo, 1);
info->mapper = mapper;
info->device = device;
info->builtin = builtin;
info->settings = get_device_settings (device);
g_signal_connect (info->settings, "changed::output",
G_CALLBACK (settings_output_changed_cb), info);
return info;
}
@ -124,6 +252,7 @@ mapper_input_info_new (ClutterInputDevice *device,
static void
mapper_input_info_free (MetaMapperInputInfo *info)
{
g_object_unref (info->settings);
g_free (info);
}
@ -174,13 +303,36 @@ mapper_input_info_set_output (MetaMapperInputInfo *input,
MetaMapperOutputInfo *output,
MetaMonitor *monitor)
{
MetaInputMapper *mapper = input->mapper;
float matrix[6] = { 1, 0, 0, 0, 1, 0 };
double aspect_ratio;
int width, height;
if (input->output == output)
return;
input->output = output;
if (output && monitor)
{
meta_monitor_manager_get_monitor_matrix (mapper->monitor_manager,
monitor,
output->logical_monitor,
matrix);
meta_monitor_get_current_resolution (monitor, &width, &height);
}
else
{
meta_monitor_manager_get_screen_size (mapper->monitor_manager,
&width, &height);
}
aspect_ratio = (double) width / height;
g_signal_emit (input->mapper, signals[DEVICE_MAPPED], 0,
input->device,
output ? output->logical_monitor : NULL, monitor);
input->device, matrix);
g_signal_emit (input->mapper, signals[DEVICE_ASPECT_RATIO], 0,
input->device, aspect_ratio);
}
static void
@ -361,6 +513,32 @@ guess_candidates (MetaInputMapper *mapper,
MetaOutputMatchType best = N_OUTPUT_MATCHES;
GList *monitors, *l;
MetaMonitor *matched_monitor = NULL;
gboolean builtin = FALSE;
gboolean integrated = TRUE;
#ifdef HAVE_LIBWACOM
if (clutter_input_device_get_device_type (input->device) != CLUTTER_TOUCHSCREEN_DEVICE)
{
WacomDevice *wacom_device;
WacomIntegrationFlags flags = 0;
wacom_device =
meta_input_device_get_wacom_device (META_INPUT_DEVICE (input->device));
if (wacom_device)
{
flags = libwacom_get_integration_flags (wacom_device);
if ((flags & (WACOM_DEVICE_INTEGRATED_SYSTEM |
WACOM_DEVICE_INTEGRATED_DISPLAY)) == 0)
return;
integrated = (flags & (WACOM_DEVICE_INTEGRATED_SYSTEM |
WACOM_DEVICE_INTEGRATED_DISPLAY)) != 0;
builtin = (flags & WACOM_DEVICE_INTEGRATED_SYSTEM) != 0;
}
}
#endif
monitors = meta_monitor_manager_get_monitors (mapper->monitor_manager);
@ -375,18 +553,23 @@ guess_candidates (MetaInputMapper *mapper,
}
}
if (find_size_match (input, monitors, &matched_monitor))
if (integrated && find_size_match (input, monitors, &matched_monitor))
{
best = MIN (best, META_MATCH_SIZE);
info->candidates[META_MATCH_SIZE] = matched_monitor;
}
if (input->builtin || best == N_OUTPUT_MATCHES)
if (builtin || best == N_OUTPUT_MATCHES)
{
best = MIN (best, META_MATCH_IS_BUILTIN);
find_builtin_output (mapper, &info->candidates[META_MATCH_IS_BUILTIN]);
}
find_settings_monitor (mapper, input->settings, input->device,
&info->candidates[META_MATCH_CONFIG], NULL);
if (info->candidates[META_MATCH_CONFIG])
best = MIN (best, META_MATCH_CONFIG);
info->best = best;
}
@ -524,6 +707,37 @@ input_mapper_monitors_changed_cb (MetaMonitorManager *monitor_manager,
mapper_update_outputs (mapper);
}
static void
input_mapper_power_save_mode_changed_cb (MetaMonitorManager *monitor_manager,
MetaInputMapper *mapper)
{
ClutterInputDevice *device;
MetaLogicalMonitor *logical_monitor;
MetaMonitor *builtin;
MetaPowerSave power_save_mode;
gboolean on;
power_save_mode =
meta_monitor_manager_get_power_save_mode (mapper->monitor_manager);
on = power_save_mode == META_POWER_SAVE_ON;
if (!find_builtin_output (mapper, &builtin))
return;
logical_monitor = meta_monitor_get_logical_monitor (builtin);
if (!logical_monitor)
return;
device =
meta_input_mapper_get_logical_monitor_device (mapper,
logical_monitor,
CLUTTER_TOUCHSCREEN_DEVICE);
if (!device)
return;
g_signal_emit (mapper, signals[DEVICE_ENABLED], 0, device, on);
}
static void
input_mapper_device_removed_cb (ClutterSeat *seat,
ClutterInputDevice *device,
@ -576,6 +790,9 @@ meta_input_mapper_constructed (GObject *object)
mapper->monitor_manager = meta_backend_get_monitor_manager (backend);
g_signal_connect (mapper->monitor_manager, "monitors-changed-internal",
G_CALLBACK (input_mapper_monitors_changed_cb), mapper);
g_signal_connect (mapper->monitor_manager, "power-save-mode-changed",
G_CALLBACK (input_mapper_power_save_mode_changed_cb),
mapper);
mapper_update_outputs (mapper);
}
@ -594,9 +811,27 @@ meta_input_mapper_class_init (MetaInputMapperClass *klass)
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 3,
G_TYPE_NONE, 2,
CLUTTER_TYPE_INPUT_DEVICE,
G_TYPE_POINTER, G_TYPE_POINTER);
G_TYPE_POINTER);
signals[DEVICE_ENABLED] =
g_signal_new ("device-enabled",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 2,
CLUTTER_TYPE_INPUT_DEVICE,
G_TYPE_BOOLEAN);
signals[DEVICE_ASPECT_RATIO] =
g_signal_new ("device-aspect-ratio",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 2,
CLUTTER_TYPE_INPUT_DEVICE,
G_TYPE_DOUBLE);
}
static void
@ -618,8 +853,7 @@ meta_input_mapper_new (void)
void
meta_input_mapper_add_device (MetaInputMapper *mapper,
ClutterInputDevice *device,
gboolean builtin)
ClutterInputDevice *device)
{
MetaMapperInputInfo *info;
@ -629,7 +863,7 @@ meta_input_mapper_add_device (MetaInputMapper *mapper,
if (g_hash_table_contains (mapper->input_devices, device))
return;
info = mapper_input_info_new (device, mapper, builtin);
info = mapper_input_info_new (device, mapper);
g_hash_table_insert (mapper->input_devices, device, info);
mapper_recalculate_input (mapper, info);
}
@ -676,6 +910,43 @@ meta_input_mapper_get_logical_monitor_device (MetaInputMapper *mapper,
return NULL;
}
static ClutterInputDevice *
find_grouped_pen (ClutterInputDevice *device)
{
GList *l, *devices;
ClutterInputDeviceType device_type;
ClutterInputDevice *pen = NULL;
ClutterSeat *seat;
device_type = clutter_input_device_get_device_type (device);
if (device_type == CLUTTER_TABLET_DEVICE ||
device_type == CLUTTER_PEN_DEVICE)
return device;
seat = clutter_input_device_get_seat (device);
devices = clutter_seat_list_devices (seat);
for (l = devices; l; l = l->next)
{
ClutterInputDevice *other_device = l->data;
device_type = clutter_input_device_get_device_type (other_device);
if ((device_type == CLUTTER_TABLET_DEVICE ||
device_type == CLUTTER_PEN_DEVICE) &&
clutter_input_device_is_grouped (device, other_device))
{
pen = other_device;
break;
}
}
g_list_free (devices);
return pen;
}
MetaLogicalMonitor *
meta_input_mapper_get_device_logical_monitor (MetaInputMapper *mapper,
ClutterInputDevice *device)
@ -685,6 +956,13 @@ meta_input_mapper_get_device_logical_monitor (MetaInputMapper *mapper,
GHashTableIter iter;
GList *l;
if (clutter_input_device_get_device_type (device) == CLUTTER_PAD_DEVICE)
{
device = find_grouped_pen (device);
if (!device)
return NULL;
}
g_hash_table_iter_init (&iter, mapper->output_devices);
while (g_hash_table_iter_next (&iter, (gpointer *) &logical_monitor,
@ -701,3 +979,19 @@ meta_input_mapper_get_device_logical_monitor (MetaInputMapper *mapper,
return NULL;
}
GSettings *
meta_input_mapper_get_tablet_settings (MetaInputMapper *mapper,
ClutterInputDevice *device)
{
MetaMapperInputInfo *input;
g_return_val_if_fail (META_IS_INPUT_MAPPER (mapper), NULL);
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
input = g_hash_table_lookup (mapper->input_devices, device);
if (!input)
return NULL;
return input->settings;
}

View File

@ -22,7 +22,7 @@
#ifndef META_INPUT_SETTINGS_PRIVATE_H
#define META_INPUT_SETTINGS_PRIVATE_H
#include <gsettings-desktop-schemas/gdesktop-enums.h>
#include <gdesktop-enums.h>
#ifdef HAVE_LIBWACOM
#include <libwacom/libwacom.h>
@ -36,6 +36,62 @@
G_DECLARE_DERIVABLE_TYPE (MetaInputSettings, meta_input_settings,
META, INPUT_SETTINGS, GObject)
/**
* MetaKeyboardA11yFlags:
* @CLUTTER_A11Y_KEYBOARD_ENABLED:
* @CLUTTER_A11Y_TIMEOUT_ENABLED:
* @CLUTTER_A11Y_MOUSE_KEYS_ENABLED:
* @CLUTTER_A11Y_SLOW_KEYS_ENABLED:
* @CLUTTER_A11Y_SLOW_KEYS_BEEP_PRESS:
* @CLUTTER_A11Y_SLOW_KEYS_BEEP_ACCEPT:
* @CLUTTER_A11Y_SLOW_KEYS_BEEP_REJECT:
* @CLUTTER_A11Y_BOUNCE_KEYS_ENABLED:
* @CLUTTER_A11Y_BOUNCE_KEYS_BEEP_REJECT:
* @CLUTTER_A11Y_TOGGLE_KEYS_ENABLED:
* @CLUTTER_A11Y_STICKY_KEYS_ENABLED:
* @CLUTTER_A11Y_STICKY_KEYS_TWO_KEY_OFF:
* @CLUTTER_A11Y_STICKY_KEYS_BEEP:
* @CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP:
*
* Keyboard accessibility features applied to a ClutterInputDevice keyboard.
*
*/
typedef enum
{
META_A11Y_KEYBOARD_ENABLED = 1 << 0,
META_A11Y_TIMEOUT_ENABLED = 1 << 1,
META_A11Y_MOUSE_KEYS_ENABLED = 1 << 2,
META_A11Y_SLOW_KEYS_ENABLED = 1 << 3,
META_A11Y_SLOW_KEYS_BEEP_PRESS = 1 << 4,
META_A11Y_SLOW_KEYS_BEEP_ACCEPT = 1 << 5,
META_A11Y_SLOW_KEYS_BEEP_REJECT = 1 << 6,
META_A11Y_BOUNCE_KEYS_ENABLED = 1 << 7,
META_A11Y_BOUNCE_KEYS_BEEP_REJECT = 1 << 8,
META_A11Y_TOGGLE_KEYS_ENABLED = 1 << 9,
META_A11Y_STICKY_KEYS_ENABLED = 1 << 10,
META_A11Y_STICKY_KEYS_TWO_KEY_OFF = 1 << 11,
META_A11Y_STICKY_KEYS_BEEP = 1 << 12,
META_A11Y_FEATURE_STATE_CHANGE_BEEP = 1 << 13,
} MetaKeyboardA11yFlags;
/**
* MetaKbdA11ySettings:
*
* The #MetaKbdA11ySettings structure contains keyboard accessibility
* settings
*
*/
typedef struct _MetaKbdA11ySettings
{
MetaKeyboardA11yFlags controls;
gint slowkeys_delay;
gint debounce_delay;
gint timeout_delay;
gint mousekeys_init_delay;
gint mousekeys_max_speed;
gint mousekeys_accel_time;
} MetaKbdA11ySettings;
struct _MetaInputSettingsClass
{
GObjectClass parent_class;
@ -55,9 +111,15 @@ struct _MetaInputSettingsClass
void (* set_tap_enabled) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled);
void (* set_tap_button_map) (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopTouchpadTapButtonMap mode);
void (* set_tap_and_drag_enabled) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled);
void (* set_tap_and_drag_lock_enabled) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled);
void (* set_disable_while_typing) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled);
@ -86,10 +148,9 @@ struct _MetaInputSettingsClass
void (* set_tablet_mapping) (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopTabletMapping mapping);
void (* set_tablet_keep_aspect) (MetaInputSettings *settings,
void (* set_tablet_aspect_ratio) (MetaInputSettings *settings,
ClutterInputDevice *device,
MetaLogicalMonitor *logical_monitor,
gboolean keep_aspect);
double ratio);
void (* set_tablet_area) (MetaInputSettings *settings,
ClutterInputDevice *device,
gdouble padding_left,
@ -131,26 +192,31 @@ struct _MetaInputSettingsClass
ClutterInputDevice *device);
};
GSettings * meta_input_settings_get_tablet_settings (MetaInputSettings *settings,
ClutterInputDevice *device);
MetaLogicalMonitor * meta_input_settings_get_tablet_logical_monitor (MetaInputSettings *settings,
ClutterInputDevice *device);
GDesktopTabletMapping meta_input_settings_get_tablet_mapping (MetaInputSettings *settings,
ClutterInputDevice *device);
gboolean meta_input_settings_is_pad_button_grabbed (MetaInputSettings *input_settings,
ClutterInputDevice *pad,
guint button);
gboolean meta_input_settings_handle_pad_event (MetaInputSettings *input_settings,
const ClutterEvent *event);
gchar * meta_input_settings_get_pad_action_label (MetaInputSettings *input_settings,
ClutterInputDevice *pad,
MetaPadActionType action,
guint number);
void meta_input_settings_maybe_save_numlock_state (MetaInputSettings *input_settings);
void meta_input_settings_maybe_restore_numlock_state (MetaInputSettings *input_settings);
void meta_input_settings_set_device_matrix (MetaInputSettings *input_settings,
ClutterInputDevice *device,
float matrix[6]);
void meta_input_settings_set_device_enabled (MetaInputSettings *input_settings,
ClutterInputDevice *device,
gboolean enabled);
void meta_input_settings_set_device_aspect_ratio (MetaInputSettings *input_settings,
ClutterInputDevice *device,
double aspect_ratio);
void meta_input_settings_get_kbd_a11y_settings (MetaInputSettings *input_settings,
MetaKbdA11ySettings *a11y_settings);
void meta_input_settings_add_device (MetaInputSettings *input_settings,
ClutterInputDevice *device);
void meta_input_settings_remove_device (MetaInputSettings *input_settings,
ClutterInputDevice *device);
void meta_input_settings_notify_tool_change (MetaInputSettings *input_settings,
ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
void meta_input_settings_notify_kbd_a11y_change (MetaInputSettings *input_settings,
MetaKeyboardA11yFlags new_flags,
MetaKeyboardA11yFlags what_changed);
#endif /* META_INPUT_SETTINGS_PRIVATE_H */

File diff suppressed because it is too large Load Diff

View File

@ -317,7 +317,7 @@ handle_start_element (GMarkupParseContext *context,
}
else if (g_str_equal (element_name, "monitor"))
{
parser->current_monitor_config = g_new0 (MetaMonitorConfig, 1);;
parser->current_monitor_config = g_new0 (MetaMonitorConfig, 1);
parser->state = STATE_MONITOR;
}

View File

@ -96,7 +96,7 @@ create_mode (CrtcModeSpec *spec,
crtc_mode_info->refresh_rate = spec->refresh_rate;
return g_object_new (META_TYPE_CRTC_MODE,
"id", mode_id,
"id", (uint64_t) mode_id,
"info", crtc_mode_info,
NULL);
}
@ -205,7 +205,7 @@ append_monitor (MetaMonitorManager *manager,
*modes = g_list_concat (*modes, new_modes);
crtc = g_object_new (META_TYPE_CRTC_DUMMY,
"id", g_list_length (*crtcs) + 1,
"id", (uint64_t) g_list_length (*crtcs) + 1,
"gpu", gpu,
NULL);
*crtcs = g_list_append (*crtcs, crtc);
@ -237,7 +237,7 @@ append_monitor (MetaMonitorManager *manager,
output_info->n_possible_crtcs = 1;
output = g_object_new (META_TYPE_OUTPUT_DUMMY,
"id", number,
"id", (uint64_t) number,
"gpu", gpu,
"info", output_info,
NULL);
@ -291,7 +291,7 @@ append_tiled_monitor (MetaMonitorManager *manager,
MetaCrtc *crtc;
crtc = g_object_new (META_TYPE_CRTC_DUMMY,
"id", g_list_length (*crtcs) + i + 1,
"id", (uint64_t) g_list_length (*crtcs) + i + 1,
"gpu", gpu,
NULL);
new_crtcs = g_list_append (new_crtcs, crtc);
@ -358,7 +358,7 @@ append_tiled_monitor (MetaMonitorManager *manager,
output_info->n_possible_crtcs = n_tiles;
output = g_object_new (META_TYPE_OUTPUT_DUMMY,
"id", number,
"id", (uint64_t) number,
"gpu", gpu,
"info", output_info,
NULL);

View File

@ -31,6 +31,7 @@
#include "backends/meta-cursor.h"
#include "backends/meta-display-config-shared.h"
#include "backends/meta-monitor-transform.h"
#include "backends/meta-viewport-info.h"
#include "core/util-private.h"
#include "meta/display.h"
#include "meta/meta-monitor-manager.h"
@ -405,4 +406,6 @@ meta_find_output_assignment (MetaOutputAssignment **outputs,
return NULL;
}
MetaViewportInfo * meta_monitor_manager_get_viewports (MetaMonitorManager *manager);
#endif /* META_MONITOR_MANAGER_PRIVATE_H */

View File

@ -1186,7 +1186,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
{
MetaCrtcMode *mode = l->data;
const MetaCrtcModeInfo *crtc_mode_info =
meta_crtc_mode_get_info (mode);;
meta_crtc_mode_get_info (mode);
g_variant_builder_add (&mode_builder, "(uxuudu)",
i, /* ID */
@ -3175,3 +3175,37 @@ meta_monitor_manager_get_vendor_name (MetaMonitorManager *manager,
return gnome_pnp_ids_get_pnp_id (manager->pnp_ids, vendor);
}
MetaViewportInfo *
meta_monitor_manager_get_viewports (MetaMonitorManager *manager)
{
MetaViewportInfo *info;
GArray *views, *scales;
GList *logical_monitors, *l;
views = g_array_new (FALSE, FALSE, sizeof (cairo_rectangle_int_t));
scales = g_array_new (FALSE, FALSE, sizeof (float));
logical_monitors = meta_monitor_manager_get_logical_monitors (manager);
for (l = logical_monitors; l; l = l->next)
{
MetaLogicalMonitor *logical_monitor = l->data;
cairo_rectangle_int_t rect;
float scale;
rect = logical_monitor->rect;
g_array_append_val (views, rect);
scale = logical_monitor->scale;
g_array_append_val (scales, scale);
}
info = meta_viewport_info_new ((cairo_rectangle_int_t *) views->data,
(float *) scales->data,
views->len);
g_array_unref (views);
g_array_unref (scales);
return info;
}

View File

@ -39,8 +39,19 @@
#include "backends/meta-pointer-constraint.h"
#ifdef HAVE_NATIVE_BACKEND
#include "backends/native/meta-backend-native.h"
#include "backends/native/meta-pointer-constraint-native.h"
#endif
#include <glib-object.h>
struct _MetaPointerConstraint
{
GObject parent_instance;
cairo_region_t *region;
};
G_DEFINE_TYPE (MetaPointerConstraint, meta_pointer_constraint, G_TYPE_OBJECT);
static void
@ -53,9 +64,40 @@ meta_pointer_constraint_class_init (MetaPointerConstraintClass *klass)
{
}
MetaPointerConstraint *
meta_pointer_constraint_new (const cairo_region_t *region)
{
MetaPointerConstraint *constraint;
constraint = g_object_new (META_TYPE_POINTER_CONSTRAINT, NULL);
constraint->region = cairo_region_copy (region);
return constraint;
}
cairo_region_t *
meta_pointer_constraint_get_region (MetaPointerConstraint *constraint)
{
return constraint->region;
}
G_DEFINE_TYPE (MetaPointerConstraintImpl, meta_pointer_constraint_impl,
G_TYPE_OBJECT);
static void
meta_pointer_constraint_impl_init (MetaPointerConstraintImpl *impl)
{
}
static void
meta_pointer_constraint_impl_class_init (MetaPointerConstraintImplClass *klass)
{
}
/**
* meta_pointer_constraint_constrain:
* @constraint: a #MetaPointerConstraint.
* meta_pointer_constraint_impl_constrain:
* @impl: a #MetaPointerConstraintImpl.
* @device; the device of the pointer.
* @time: the timestamp (in ms) of the event.
* @prev_x: X-coordinate of the previous pointer position.
@ -67,17 +109,25 @@ meta_pointer_constraint_class_init (MetaPointerConstraintClass *klass)
* if needed.
*/
void
meta_pointer_constraint_constrain (MetaPointerConstraint *constraint,
ClutterInputDevice *device,
guint32 time,
float prev_x,
float prev_y,
float *x,
float *y)
meta_pointer_constraint_impl_constrain (MetaPointerConstraintImpl *impl,
ClutterInputDevice *device,
uint32_t time,
float prev_x,
float prev_y,
float *x,
float *y)
{
META_POINTER_CONSTRAINT_GET_CLASS (constraint)->constrain (constraint,
device,
time,
prev_x, prev_y,
x, y);
META_POINTER_CONSTRAINT_IMPL_GET_CLASS (impl)->constrain (impl,
device,
time,
prev_x, prev_y,
x, y);
}
void
meta_pointer_constraint_impl_ensure_constrained (MetaPointerConstraintImpl *impl,
ClutterInputDevice *device)
{
META_POINTER_CONSTRAINT_IMPL_GET_CLASS (impl)->ensure_constrained (impl,
device);
}

View File

@ -32,34 +32,45 @@
G_BEGIN_DECLS
#define META_TYPE_POINTER_CONSTRAINT (meta_pointer_constraint_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaPointerConstraint, meta_pointer_constraint,
META, POINTER_CONSTRAINT, GObject);
G_DECLARE_FINAL_TYPE (MetaPointerConstraint, meta_pointer_constraint,
META, POINTER_CONSTRAINT, GObject);
MetaPointerConstraint * meta_pointer_constraint_new (const cairo_region_t *region);
cairo_region_t * meta_pointer_constraint_get_region (MetaPointerConstraint *constraint);
#define META_TYPE_POINTER_CONSTRAINT_IMPL (meta_pointer_constraint_impl_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaPointerConstraintImpl, meta_pointer_constraint_impl,
META, POINTER_CONSTRAINT_IMPL, GObject);
/**
* MetaPointerConstraintClass:
* MetaPointerConstraintImplClass:
* @constrain: the virtual function pointer for
* meta_pointer_constraint_constrain().
* meta_pointer_constraint_impl_constrain().
*/
struct _MetaPointerConstraintClass
struct _MetaPointerConstraintImplClass
{
GObjectClass parent_class;
void (*constrain) (MetaPointerConstraint *constraint,
ClutterInputDevice *device,
guint32 time,
float prev_x,
float prev_y,
float *x,
float *y);
void (* constrain) (MetaPointerConstraintImpl *impl,
ClutterInputDevice *device,
uint32_t time,
float prev_x,
float prev_y,
float *x,
float *y);
void (* ensure_constrained) (MetaPointerConstraintImpl *impl,
ClutterInputDevice *device);
};
void meta_pointer_constraint_constrain (MetaPointerConstraint *constraint,
ClutterInputDevice *device,
guint32 time,
float prev_x,
float prev_y,
float *x,
float *y);
void meta_pointer_constraint_impl_constrain (MetaPointerConstraintImpl *impl,
ClutterInputDevice *device,
uint32_t time,
float prev_x,
float prev_y,
float *x,
float *y);
void meta_pointer_constraint_impl_ensure_constrained (MetaPointerConstraintImpl *impl,
ClutterInputDevice *device);
G_END_DECLS

View File

@ -36,6 +36,17 @@ enum
static int handle_signals[N_HANDLE_SIGNALS];
enum
{
PROP_0,
PROP_IS_RECORDING,
N_PROPS
};
static GParamSpec *obj_props[N_PROPS];
enum
{
CONTROLLER_NEW_HANDLE,
@ -50,6 +61,8 @@ typedef struct _MetaRemoteAccessHandlePrivate
gboolean has_stopped;
gboolean disable_animations;
gboolean is_recording;
} MetaRemoteAccessHandlePrivate;
G_DEFINE_TYPE_WITH_PRIVATE (MetaRemoteAccessHandle,
@ -177,6 +190,48 @@ meta_remote_access_controller_new (MetaRemoteDesktop *remote_desktop,
return remote_access_controller;
}
static void
meta_remote_access_handle_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
MetaRemoteAccessHandle *handle = META_REMOTE_ACCESS_HANDLE (object);
MetaRemoteAccessHandlePrivate *priv =
meta_remote_access_handle_get_instance_private (handle);
switch (prop_id)
{
case PROP_IS_RECORDING:
g_value_set_boolean (value, priv->is_recording);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
meta_remote_access_handle_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
MetaRemoteAccessHandle *handle = META_REMOTE_ACCESS_HANDLE (object);
MetaRemoteAccessHandlePrivate *priv =
meta_remote_access_handle_get_instance_private (handle);
switch (prop_id)
{
case PROP_IS_RECORDING:
priv->is_recording = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
meta_remote_access_handle_init (MetaRemoteAccessHandle *handle)
{
@ -185,6 +240,11 @@ meta_remote_access_handle_init (MetaRemoteAccessHandle *handle)
static void
meta_remote_access_handle_class_init (MetaRemoteAccessHandleClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = meta_remote_access_handle_get_property;
object_class->set_property = meta_remote_access_handle_set_property;
handle_signals[HANDLE_STOPPED] =
g_signal_new ("stopped",
G_TYPE_FROM_CLASS (klass),
@ -192,6 +252,16 @@ meta_remote_access_handle_class_init (MetaRemoteAccessHandleClass *klass)
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
obj_props[PROP_IS_RECORDING] =
g_param_spec_boolean ("is-recording",
"is-recording",
"Is a screen recording",
FALSE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, obj_props);
}
static void

View File

@ -143,7 +143,7 @@ meta_renderer_real_rebuild_views (MetaRenderer *renderer)
meta_backend_get_monitor_manager (backend);
GList *logical_monitors, *l;
g_list_free_full (priv->views, g_object_unref);
g_list_free_full (priv->views, (GDestroyNotify) clutter_stage_view_destroy);
priv->views = NULL;
logical_monitors =

View File

@ -83,19 +83,6 @@ get_backend (MetaScreenCastAreaStreamSrc *area_src)
return meta_screen_cast_get_backend (screen_cast);
}
static MetaCursorRenderer *
get_cursor_renderer (MetaScreenCastAreaStreamSrc *area_src)
{
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (area_src);
MetaScreenCastStream *stream = meta_screen_cast_stream_src_get_stream (src);
MetaScreenCastSession *session = meta_screen_cast_stream_get_session (stream);
MetaScreenCast *screen_cast =
meta_screen_cast_session_get_screen_cast (session);
MetaBackend *backend = meta_screen_cast_get_backend (screen_cast);
return meta_backend_get_cursor_renderer (backend);
}
static void
meta_screen_cast_area_stream_src_get_specs (MetaScreenCastStreamSrc *src,
int *width,
@ -142,9 +129,11 @@ is_cursor_in_stream (MetaScreenCastAreaStreamSrc *area_src)
}
else
{
MetaCursorTracker *cursor_tracker =
meta_backend_get_cursor_tracker (backend);
graphene_point_t cursor_position;
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
meta_cursor_tracker_get_pointer (cursor_tracker, &cursor_position, NULL);
return graphene_rect_contains_point (&area_rect, &cursor_position);
}
}
@ -170,6 +159,7 @@ static void
sync_cursor_state (MetaScreenCastAreaStreamSrc *area_src)
{
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (area_src);
MetaScreenCastRecordFlag flags;
if (!is_cursor_in_stream (area_src))
return;
@ -177,13 +167,12 @@ sync_cursor_state (MetaScreenCastAreaStreamSrc *area_src)
if (is_redraw_queued (area_src))
return;
meta_screen_cast_stream_src_maybe_record_frame (src);
flags = META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
}
static void
cursor_moved (MetaCursorTracker *cursor_tracker,
float x,
float y,
MetaScreenCastAreaStreamSrc *area_src)
{
sync_cursor_state (area_src);
@ -200,14 +189,14 @@ cursor_changed (MetaCursorTracker *cursor_tracker,
static void
inhibit_hw_cursor (MetaScreenCastAreaStreamSrc *area_src)
{
MetaCursorRenderer *cursor_renderer;
MetaHwCursorInhibitor *inhibitor;
MetaBackend *backend;
g_return_if_fail (!area_src->hw_cursor_inhibited);
cursor_renderer = get_cursor_renderer (area_src);
backend = get_backend (area_src);
inhibitor = META_HW_CURSOR_INHIBITOR (area_src);
meta_cursor_renderer_add_hw_cursor_inhibitor (cursor_renderer, inhibitor);
meta_backend_add_hw_cursor_inhibitor (backend, inhibitor);
area_src->hw_cursor_inhibited = TRUE;
}
@ -215,14 +204,14 @@ inhibit_hw_cursor (MetaScreenCastAreaStreamSrc *area_src)
static void
uninhibit_hw_cursor (MetaScreenCastAreaStreamSrc *area_src)
{
MetaCursorRenderer *cursor_renderer;
MetaHwCursorInhibitor *inhibitor;
MetaBackend *backend;
g_return_if_fail (area_src->hw_cursor_inhibited);
cursor_renderer = get_cursor_renderer (area_src);
backend = get_backend (area_src);
inhibitor = META_HW_CURSOR_INHIBITOR (area_src);
meta_cursor_renderer_remove_hw_cursor_inhibitor (cursor_renderer, inhibitor);
meta_backend_remove_hw_cursor_inhibitor (backend, inhibitor);
area_src->hw_cursor_inhibited = FALSE;
}
@ -233,10 +222,12 @@ maybe_record_frame_on_idle (gpointer user_data)
MetaScreenCastAreaStreamSrc *area_src =
META_SCREEN_CAST_AREA_STREAM_SRC (user_data);
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (area_src);
MetaScreenCastRecordFlag flags;
area_src->maybe_record_idle_id = 0;
meta_screen_cast_stream_src_maybe_record_frame (src);
flags = META_SCREEN_CAST_RECORD_FLAG_NONE;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
return G_SOURCE_REMOVE;
}
@ -339,6 +330,7 @@ meta_screen_cast_area_stream_src_enable (MetaScreenCastStreamSrc *src)
g_signal_connect_after (cursor_tracker, "cursor-changed",
G_CALLBACK (cursor_changed),
area_src);
meta_cursor_tracker_track_position (cursor_tracker);
G_GNUC_FALLTHROUGH;
case META_SCREEN_CAST_CURSOR_MODE_HIDDEN:
add_view_painted_watches (area_src,
@ -346,6 +338,7 @@ meta_screen_cast_area_stream_src_enable (MetaScreenCastStreamSrc *src)
break;
case META_SCREEN_CAST_CURSOR_MODE_EMBEDDED:
inhibit_hw_cursor (area_src);
meta_cursor_tracker_track_position (cursor_tracker);
add_view_painted_watches (area_src,
META_STAGE_WATCH_AFTER_ACTOR_PAINT);
break;
@ -359,6 +352,7 @@ meta_screen_cast_area_stream_src_disable (MetaScreenCastStreamSrc *src)
{
MetaScreenCastAreaStreamSrc *area_src =
META_SCREEN_CAST_AREA_STREAM_SRC (src);
MetaScreenCastStream *stream = meta_screen_cast_stream_src_get_stream (src);
MetaBackend *backend = get_backend (area_src);
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
ClutterStage *stage;
@ -385,11 +379,22 @@ meta_screen_cast_area_stream_src_disable (MetaScreenCastStreamSrc *src)
cursor_tracker);
g_clear_handle_id (&area_src->maybe_record_idle_id, g_source_remove);
switch (meta_screen_cast_stream_get_cursor_mode (stream))
{
case META_SCREEN_CAST_CURSOR_MODE_METADATA:
case META_SCREEN_CAST_CURSOR_MODE_EMBEDDED:
meta_cursor_tracker_untrack_position (cursor_tracker);
break;
case META_SCREEN_CAST_CURSOR_MODE_HIDDEN:
break;
}
}
static gboolean
meta_screen_cast_area_stream_src_record_frame (MetaScreenCastStreamSrc *src,
uint8_t *data)
meta_screen_cast_area_stream_src_record_to_buffer (MetaScreenCastStreamSrc *src,
uint8_t *data,
GError **error)
{
MetaScreenCastAreaStreamSrc *area_src =
META_SCREEN_CAST_AREA_STREAM_SRC (src);
@ -400,7 +405,6 @@ meta_screen_cast_area_stream_src_record_frame (MetaScreenCastStreamSrc *src,
float scale;
int stride;
ClutterPaintFlag paint_flags = CLUTTER_PAINT_FLAG_NONE;
g_autoptr (GError) error = NULL;
stage = get_stage (area_src);
area = meta_screen_cast_area_stream_get_area (area_stream);
@ -414,6 +418,7 @@ meta_screen_cast_area_stream_src_record_frame (MetaScreenCastStreamSrc *src,
paint_flags |= CLUTTER_PAINT_FLAG_NO_CURSORS;
break;
case META_SCREEN_CAST_CURSOR_MODE_EMBEDDED:
paint_flags |= CLUTTER_PAINT_FLAG_FORCE_CURSORS;
break;
}
@ -422,18 +427,16 @@ meta_screen_cast_area_stream_src_record_frame (MetaScreenCastStreamSrc *src,
stride,
CLUTTER_CAIRO_FORMAT_ARGB32,
paint_flags,
&error))
{
g_warning ("Failed to record area: %s", error->message);
return FALSE;
}
error))
return FALSE;
return TRUE;
}
static gboolean
meta_screen_cast_area_stream_src_blit_to_framebuffer (MetaScreenCastStreamSrc *src,
CoglFramebuffer *framebuffer)
meta_screen_cast_area_stream_src_record_to_framebuffer (MetaScreenCastStreamSrc *src,
CoglFramebuffer *framebuffer,
GError **error)
{
MetaScreenCastAreaStreamSrc *area_src =
META_SCREEN_CAST_AREA_STREAM_SRC (src);
@ -456,6 +459,7 @@ meta_screen_cast_area_stream_src_blit_to_framebuffer (MetaScreenCastStreamSrc *s
paint_flags |= CLUTTER_PAINT_FLAG_NO_CURSORS;
break;
case META_SCREEN_CAST_CURSOR_MODE_EMBEDDED:
paint_flags |= CLUTTER_PAINT_FLAG_FORCE_CURSORS;
break;
}
clutter_stage_paint_to_framebuffer (stage, framebuffer,
@ -467,6 +471,19 @@ meta_screen_cast_area_stream_src_blit_to_framebuffer (MetaScreenCastStreamSrc *s
return TRUE;
}
static void
meta_screen_cast_area_stream_record_follow_up (MetaScreenCastStreamSrc *src)
{
MetaScreenCastAreaStreamSrc *area_src =
META_SCREEN_CAST_AREA_STREAM_SRC (src);
MetaScreenCastRecordFlag flags;
g_clear_handle_id (&area_src->maybe_record_idle_id, g_source_remove);
flags = META_SCREEN_CAST_RECORD_FLAG_NONE;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
}
static void
meta_screen_cast_area_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc *src,
struct spa_meta_cursor *spa_meta_cursor)
@ -476,6 +493,8 @@ meta_screen_cast_area_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc *s
MetaScreenCastStream *stream = meta_screen_cast_stream_src_get_stream (src);
MetaScreenCastAreaStream *area_stream = META_SCREEN_CAST_AREA_STREAM (stream);
MetaBackend *backend = get_backend (area_src);
MetaCursorTracker *cursor_tracker =
meta_backend_get_cursor_tracker (backend);
MetaCursorRenderer *cursor_renderer =
meta_backend_get_cursor_renderer (backend);
MetaCursorSprite *cursor_sprite;
@ -496,7 +515,7 @@ meta_screen_cast_area_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc *s
area = meta_screen_cast_area_stream_get_area (area_stream);
scale = meta_screen_cast_area_stream_get_scale (area_stream);
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
meta_cursor_tracker_get_pointer (cursor_tracker, &cursor_position, NULL);
cursor_position.x -= area->x;
cursor_position.y -= area->y;
cursor_position.x *= scale;
@ -538,8 +557,7 @@ meta_screen_cast_area_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc *s
}
static gboolean
meta_screen_cast_area_stream_src_is_cursor_sprite_inhibited (MetaHwCursorInhibitor *inhibitor,
MetaCursorSprite *cursor_sprite)
meta_screen_cast_area_stream_src_is_cursor_inhibited (MetaHwCursorInhibitor *inhibitor)
{
MetaScreenCastAreaStreamSrc *area_src =
META_SCREEN_CAST_AREA_STREAM_SRC (inhibitor);
@ -550,8 +568,8 @@ meta_screen_cast_area_stream_src_is_cursor_sprite_inhibited (MetaHwCursorInhibit
static void
hw_cursor_inhibitor_iface_init (MetaHwCursorInhibitorInterface *iface)
{
iface->is_cursor_sprite_inhibited =
meta_screen_cast_area_stream_src_is_cursor_sprite_inhibited;
iface->is_cursor_inhibited =
meta_screen_cast_area_stream_src_is_cursor_inhibited;
}
MetaScreenCastAreaStreamSrc *
@ -578,9 +596,12 @@ meta_screen_cast_area_stream_src_class_init (MetaScreenCastAreaStreamSrcClass *k
src_class->get_specs = meta_screen_cast_area_stream_src_get_specs;
src_class->enable = meta_screen_cast_area_stream_src_enable;
src_class->disable = meta_screen_cast_area_stream_src_disable;
src_class->record_frame = meta_screen_cast_area_stream_src_record_frame;
src_class->blit_to_framebuffer =
meta_screen_cast_area_stream_src_blit_to_framebuffer;
src_class->record_to_buffer =
meta_screen_cast_area_stream_src_record_to_buffer;
src_class->record_to_framebuffer =
meta_screen_cast_area_stream_src_record_to_framebuffer;
src_class->record_follow_up =
meta_screen_cast_area_stream_record_follow_up;
src_class->set_cursor_metadata =
meta_screen_cast_area_stream_src_set_cursor_metadata;
}

View File

@ -87,6 +87,7 @@ meta_screen_cast_area_stream_new (MetaScreenCastSession *session,
MetaRectangle *area,
ClutterStage *stage,
MetaScreenCastCursorMode cursor_mode,
MetaScreenCastFlag flags,
GError **error)
{
MetaScreenCastAreaStream *area_stream;
@ -105,6 +106,7 @@ meta_screen_cast_area_stream_new (MetaScreenCastSession *session,
"session", session,
"connection", connection,
"cursor-mode", cursor_mode,
"flags", flags,
NULL);
if (!area_stream)
return NULL;

View File

@ -37,6 +37,7 @@ MetaScreenCastAreaStream * meta_screen_cast_area_stream_new (MetaScreenCastSessi
MetaRectangle *area,
ClutterStage *stage,
MetaScreenCastCursorMode cursor_mode,
MetaScreenCastFlag flags,
GError **error);
ClutterStage * meta_screen_cast_area_stream_get_stage (MetaScreenCastAreaStream *area_stream);

View File

@ -121,8 +121,10 @@ stage_painted (MetaStage *stage,
gpointer user_data)
{
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (user_data);
MetaScreenCastRecordFlag flags;
meta_screen_cast_stream_src_maybe_record_frame (src);
flags = META_SCREEN_CAST_RECORD_FLAG_NONE;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
}
static MetaBackend *
@ -168,9 +170,11 @@ is_cursor_in_stream (MetaScreenCastMonitorStreamSrc *monitor_src)
}
else
{
MetaCursorTracker *cursor_tracker =
meta_backend_get_cursor_tracker (backend);
graphene_point_t cursor_position;
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
meta_cursor_tracker_get_pointer (cursor_tracker, &cursor_position, NULL);
return graphene_rect_contains_point (&logical_monitor_rect,
&cursor_position);
}
@ -202,6 +206,7 @@ static void
sync_cursor_state (MetaScreenCastMonitorStreamSrc *monitor_src)
{
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (monitor_src);
MetaScreenCastRecordFlag flags;
if (!is_cursor_in_stream (monitor_src))
return;
@ -209,13 +214,15 @@ sync_cursor_state (MetaScreenCastMonitorStreamSrc *monitor_src)
if (is_redraw_queued (monitor_src))
return;
meta_screen_cast_stream_src_maybe_record_frame (src);
if (meta_screen_cast_stream_src_pending_follow_up_frame (src))
return;
flags = META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
}
static void
cursor_moved (MetaCursorTracker *cursor_tracker,
float x,
float y,
MetaScreenCastMonitorStreamSrc *monitor_src)
{
sync_cursor_state (monitor_src);
@ -229,30 +236,17 @@ cursor_changed (MetaCursorTracker *cursor_tracker,
sync_cursor_state (monitor_src);
}
static MetaCursorRenderer *
get_cursor_renderer (MetaScreenCastMonitorStreamSrc *monitor_src)
{
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (monitor_src);
MetaScreenCastStream *stream = meta_screen_cast_stream_src_get_stream (src);
MetaScreenCastSession *session = meta_screen_cast_stream_get_session (stream);
MetaScreenCast *screen_cast =
meta_screen_cast_session_get_screen_cast (session);
MetaBackend *backend = meta_screen_cast_get_backend (screen_cast);
return meta_backend_get_cursor_renderer (backend);
}
static void
inhibit_hw_cursor (MetaScreenCastMonitorStreamSrc *monitor_src)
{
MetaCursorRenderer *cursor_renderer;
MetaHwCursorInhibitor *inhibitor;
MetaBackend *backend;
g_return_if_fail (!monitor_src->hw_cursor_inhibited);
cursor_renderer = get_cursor_renderer (monitor_src);
backend = get_backend (monitor_src);
inhibitor = META_HW_CURSOR_INHIBITOR (monitor_src);
meta_cursor_renderer_add_hw_cursor_inhibitor (cursor_renderer, inhibitor);
meta_backend_add_hw_cursor_inhibitor (backend, inhibitor);
monitor_src->hw_cursor_inhibited = TRUE;
}
@ -260,14 +254,14 @@ inhibit_hw_cursor (MetaScreenCastMonitorStreamSrc *monitor_src)
static void
uninhibit_hw_cursor (MetaScreenCastMonitorStreamSrc *monitor_src)
{
MetaCursorRenderer *cursor_renderer;
MetaHwCursorInhibitor *inhibitor;
MetaBackend *backend;
g_return_if_fail (monitor_src->hw_cursor_inhibited);
cursor_renderer = get_cursor_renderer (monitor_src);
backend = get_backend (monitor_src);
inhibitor = META_HW_CURSOR_INHIBITOR (monitor_src);
meta_cursor_renderer_remove_hw_cursor_inhibitor (cursor_renderer, inhibitor);
meta_backend_remove_hw_cursor_inhibitor (backend, inhibitor);
monitor_src->hw_cursor_inhibited = FALSE;
}
@ -336,6 +330,7 @@ meta_screen_cast_monitor_stream_src_enable (MetaScreenCastStreamSrc *src)
g_signal_connect_after (cursor_tracker, "cursor-changed",
G_CALLBACK (cursor_changed),
monitor_src);
meta_cursor_tracker_track_position (cursor_tracker);
G_GNUC_FALLTHROUGH;
case META_SCREEN_CAST_CURSOR_MODE_HIDDEN:
add_view_painted_watches (monitor_src,
@ -343,6 +338,7 @@ meta_screen_cast_monitor_stream_src_enable (MetaScreenCastStreamSrc *src)
break;
case META_SCREEN_CAST_CURSOR_MODE_EMBEDDED:
inhibit_hw_cursor (monitor_src);
meta_cursor_tracker_track_position (cursor_tracker);
add_view_painted_watches (monitor_src,
META_STAGE_WATCH_AFTER_PAINT);
break;
@ -356,6 +352,7 @@ meta_screen_cast_monitor_stream_src_disable (MetaScreenCastStreamSrc *src)
{
MetaScreenCastMonitorStreamSrc *monitor_src =
META_SCREEN_CAST_MONITOR_STREAM_SRC (src);
MetaScreenCastStream *stream = meta_screen_cast_stream_src_get_stream (src);
MetaBackend *backend = get_backend (monitor_src);
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
ClutterStage *stage;
@ -380,32 +377,115 @@ meta_screen_cast_monitor_stream_src_disable (MetaScreenCastStreamSrc *src)
cursor_tracker);
g_clear_signal_handler (&monitor_src->cursor_changed_handler_id,
cursor_tracker);
switch (meta_screen_cast_stream_get_cursor_mode (stream))
{
case META_SCREEN_CAST_CURSOR_MODE_METADATA:
case META_SCREEN_CAST_CURSOR_MODE_EMBEDDED:
meta_cursor_tracker_untrack_position (cursor_tracker);
break;
case META_SCREEN_CAST_CURSOR_MODE_HIDDEN:
break;
}
}
static void
maybe_paint_cursor_sprite (MetaScreenCastMonitorStreamSrc *monitor_src,
uint8_t *data)
{
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (monitor_src);
MetaBackend *backend = get_backend (monitor_src);
MetaCursorRenderer *cursor_renderer =
meta_backend_get_cursor_renderer (backend);
MetaCursorSprite *cursor_sprite;
CoglTexture *sprite_texture;
int sprite_width, sprite_height, sprite_stride;
float sprite_scale;
uint8_t *sprite_data;
cairo_surface_t *sprite_surface;
graphene_rect_t sprite_rect;
int width, height, stride;
cairo_surface_t *surface;
cairo_t *cr;
cursor_sprite = meta_cursor_renderer_get_cursor (cursor_renderer);
if (!cursor_sprite)
return;
if (meta_cursor_renderer_is_overlay_visible (cursor_renderer))
return;
sprite_rect = meta_cursor_renderer_calculate_rect (cursor_renderer,
cursor_sprite);
sprite_texture = meta_cursor_sprite_get_cogl_texture (cursor_sprite);
sprite_width = cogl_texture_get_width (sprite_texture);
sprite_height = cogl_texture_get_height (sprite_texture);
sprite_stride = sprite_width * 4;
sprite_scale = meta_cursor_sprite_get_texture_scale (cursor_sprite);
sprite_data = g_new0 (uint8_t, sprite_stride * sprite_height);
cogl_texture_get_data (sprite_texture,
CLUTTER_CAIRO_FORMAT_ARGB32,
sprite_stride,
sprite_data);
sprite_surface = cairo_image_surface_create_for_data (sprite_data,
CAIRO_FORMAT_ARGB32,
sprite_width,
sprite_height,
sprite_stride);
cairo_surface_set_device_scale (sprite_surface, sprite_scale, sprite_scale);
stride = meta_screen_cast_stream_src_get_stride (src);
width = meta_screen_cast_stream_src_get_width (src);
height = meta_screen_cast_stream_src_get_height (src);
surface = cairo_image_surface_create_for_data (data,
CAIRO_FORMAT_ARGB32,
width, height, stride);
cr = cairo_create (surface);
cairo_set_source_surface (cr, sprite_surface,
sprite_rect.origin.x,
sprite_rect.origin.y);
cairo_paint (cr);
cairo_destroy (cr);
cairo_surface_destroy (sprite_surface);
cairo_surface_destroy (surface);
g_free (sprite_data);
}
static gboolean
meta_screen_cast_monitor_stream_src_record_frame (MetaScreenCastStreamSrc *src,
uint8_t *data)
meta_screen_cast_monitor_stream_src_record_to_buffer (MetaScreenCastStreamSrc *src,
uint8_t *data,
GError **error)
{
MetaScreenCastMonitorStreamSrc *monitor_src =
META_SCREEN_CAST_MONITOR_STREAM_SRC (src);
MetaScreenCastStream *stream = meta_screen_cast_stream_src_get_stream (src);
ClutterStage *stage;
MetaMonitor *monitor;
MetaLogicalMonitor *logical_monitor;
if (!is_redraw_queued (monitor_src))
return FALSE;
monitor = get_monitor (monitor_src);
logical_monitor = meta_monitor_get_logical_monitor (monitor);
stage = get_stage (monitor_src);
clutter_stage_capture_into (stage, FALSE, &logical_monitor->rect, data);
switch (meta_screen_cast_stream_get_cursor_mode (stream))
{
case META_SCREEN_CAST_CURSOR_MODE_EMBEDDED:
maybe_paint_cursor_sprite (monitor_src, data);
break;
case META_SCREEN_CAST_CURSOR_MODE_METADATA:
case META_SCREEN_CAST_CURSOR_MODE_HIDDEN:
break;
}
return TRUE;
}
static gboolean
meta_screen_cast_monitor_stream_src_blit_to_framebuffer (MetaScreenCastStreamSrc *src,
CoglFramebuffer *framebuffer)
meta_screen_cast_monitor_stream_src_record_to_framebuffer (MetaScreenCastStreamSrc *src,
CoglFramebuffer *framebuffer,
GError **error)
{
MetaScreenCastMonitorStreamSrc *monitor_src =
META_SCREEN_CAST_MONITOR_STREAM_SRC (src);
@ -429,7 +509,6 @@ meta_screen_cast_monitor_stream_src_blit_to_framebuffer (MetaScreenCastStreamSrc
for (l = meta_renderer_get_views (renderer); l; l = l->next)
{
ClutterStageView *view = CLUTTER_STAGE_VIEW (l->data);
g_autoptr (GError) error = NULL;
CoglFramebuffer *view_framebuffer;
MetaRectangle view_layout;
int x, y;
@ -450,12 +529,8 @@ meta_screen_cast_monitor_stream_src_blit_to_framebuffer (MetaScreenCastStreamSrc
x, y,
cogl_framebuffer_get_width (view_framebuffer),
cogl_framebuffer_get_height (view_framebuffer),
&error))
{
g_warning ("Error blitting view into DMABuf framebuffer: %s",
error->message);
return FALSE;
}
error))
return FALSE;
}
cogl_framebuffer_finish (framebuffer);
@ -463,6 +538,44 @@ meta_screen_cast_monitor_stream_src_blit_to_framebuffer (MetaScreenCastStreamSrc
return TRUE;
}
static void
meta_screen_cast_monitor_stream_record_follow_up (MetaScreenCastStreamSrc *src)
{
MetaScreenCastMonitorStreamSrc *monitor_src =
META_SCREEN_CAST_MONITOR_STREAM_SRC (src);
MetaBackend *backend = get_backend (monitor_src);
MetaRenderer *renderer = meta_backend_get_renderer (backend);
ClutterStage *stage = get_stage (monitor_src);
MetaMonitor *monitor;
MetaLogicalMonitor *logical_monitor;
MetaRectangle logical_monitor_layout;
GList *l;
monitor = get_monitor (monitor_src);
logical_monitor = meta_monitor_get_logical_monitor (monitor);
logical_monitor_layout = meta_logical_monitor_get_layout (logical_monitor);
for (l = meta_renderer_get_views (renderer); l; l = l->next)
{
MetaRendererView *view = l->data;
MetaRectangle view_layout;
MetaRectangle damage;
clutter_stage_view_get_layout (CLUTTER_STAGE_VIEW (view), &view_layout);
if (!meta_rectangle_overlap (&logical_monitor_layout, &view_layout))
continue;
damage = (cairo_rectangle_int_t) {
.x = view_layout.x,
.y = view_layout.y,
.width = 1,
.height = 1,
};
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stage), &damage);
}
}
static void
meta_screen_cast_monitor_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc *src,
struct spa_meta_cursor *spa_meta_cursor)
@ -472,6 +585,8 @@ meta_screen_cast_monitor_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
MetaBackend *backend = get_backend (monitor_src);
MetaCursorRenderer *cursor_renderer =
meta_backend_get_cursor_renderer (backend);
MetaCursorTracker *cursor_tracker =
meta_backend_get_cursor_tracker (backend);
MetaCursorSprite *cursor_sprite;
MetaMonitor *monitor;
MetaLogicalMonitor *logical_monitor;
@ -501,7 +616,7 @@ meta_screen_cast_monitor_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
else
view_scale = 1.0;
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
meta_cursor_tracker_get_pointer (cursor_tracker, &cursor_position, NULL);
cursor_position.x -= logical_monitor_rect.origin.x;
cursor_position.y -= logical_monitor_rect.origin.y;
cursor_position.x *= view_scale;
@ -543,8 +658,7 @@ meta_screen_cast_monitor_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
}
static gboolean
meta_screen_cast_monitor_stream_src_is_cursor_sprite_inhibited (MetaHwCursorInhibitor *inhibitor,
MetaCursorSprite *cursor_sprite)
meta_screen_cast_monitor_stream_src_is_cursor_inhibited (MetaHwCursorInhibitor *inhibitor)
{
MetaScreenCastMonitorStreamSrc *monitor_src =
META_SCREEN_CAST_MONITOR_STREAM_SRC (inhibitor);
@ -555,8 +669,8 @@ meta_screen_cast_monitor_stream_src_is_cursor_sprite_inhibited (MetaHwCursorInhi
static void
hw_cursor_inhibitor_iface_init (MetaHwCursorInhibitorInterface *iface)
{
iface->is_cursor_sprite_inhibited =
meta_screen_cast_monitor_stream_src_is_cursor_sprite_inhibited;
iface->is_cursor_inhibited =
meta_screen_cast_monitor_stream_src_is_cursor_inhibited;
}
MetaScreenCastMonitorStreamSrc *
@ -583,9 +697,12 @@ meta_screen_cast_monitor_stream_src_class_init (MetaScreenCastMonitorStreamSrcCl
src_class->get_specs = meta_screen_cast_monitor_stream_src_get_specs;
src_class->enable = meta_screen_cast_monitor_stream_src_enable;
src_class->disable = meta_screen_cast_monitor_stream_src_disable;
src_class->record_frame = meta_screen_cast_monitor_stream_src_record_frame;
src_class->blit_to_framebuffer =
meta_screen_cast_monitor_stream_src_blit_to_framebuffer;
src_class->record_to_buffer =
meta_screen_cast_monitor_stream_src_record_to_buffer;
src_class->record_to_framebuffer =
meta_screen_cast_monitor_stream_src_record_to_framebuffer;
src_class->record_follow_up =
meta_screen_cast_monitor_stream_record_follow_up;
src_class->set_cursor_metadata =
meta_screen_cast_monitor_stream_src_set_cursor_metadata;
}

View File

@ -110,6 +110,7 @@ meta_screen_cast_monitor_stream_new (MetaScreenCastSession *session,
MetaMonitor *monitor,
ClutterStage *stage,
MetaScreenCastCursorMode cursor_mode,
MetaScreenCastFlag flags,
GError **error)
{
MetaGpu *gpu = meta_monitor_get_gpu (monitor);
@ -130,6 +131,7 @@ meta_screen_cast_monitor_stream_new (MetaScreenCastSession *session,
"session", session,
"connection", connection,
"cursor-mode", cursor_mode,
"flags", flags,
"monitor", monitor,
NULL);
if (!monitor_stream)

View File

@ -40,6 +40,7 @@ MetaScreenCastMonitorStream * meta_screen_cast_monitor_stream_new (MetaScreenCas
MetaMonitor *monitor,
ClutterStage *stage,
MetaScreenCastCursorMode cursor_mode,
MetaScreenCastFlag flags,
GError **error);
ClutterStage * meta_screen_cast_monitor_stream_get_stage (MetaScreenCastMonitorStream *monitor_stream);

View File

@ -310,6 +310,8 @@ handle_record_monitor (MetaDBusScreenCastSession *skeleton,
meta_backend_get_monitor_manager (backend);
MetaMonitor *monitor;
MetaScreenCastCursorMode cursor_mode;
gboolean is_recording;
MetaScreenCastFlag flags;
ClutterStage *stage;
GError *error = NULL;
MetaScreenCastMonitorStream *monitor_stream;
@ -356,13 +358,21 @@ handle_record_monitor (MetaDBusScreenCastSession *skeleton,
}
}
if (!g_variant_lookup (properties_variant, "is-recording", "b", &is_recording))
is_recording = FALSE;
stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
flags = META_SCREEN_CAST_FLAG_NONE;
if (is_recording)
flags |= META_SCREEN_CAST_FLAG_IS_RECORDING;
monitor_stream = meta_screen_cast_monitor_stream_new (session,
connection,
monitor,
stage,
cursor_mode,
flags,
&error);
if (!monitor_stream)
{
@ -398,6 +408,8 @@ handle_record_window (MetaDBusScreenCastSession *skeleton,
GDBusConnection *connection;
MetaWindow *window;
MetaScreenCastCursorMode cursor_mode;
gboolean is_recording;
MetaScreenCastFlag flags;
GError *error = NULL;
MetaDisplay *display;
GVariant *window_id_variant = NULL;
@ -454,13 +466,21 @@ handle_record_window (MetaDBusScreenCastSession *skeleton,
}
}
if (!g_variant_lookup (properties_variant, "is-recording", "b", &is_recording))
is_recording = FALSE;
interface_skeleton = G_DBUS_INTERFACE_SKELETON (skeleton);
connection = g_dbus_interface_skeleton_get_connection (interface_skeleton);
flags = META_SCREEN_CAST_FLAG_NONE;
if (is_recording)
flags |= META_SCREEN_CAST_FLAG_IS_RECORDING;
window_stream = meta_screen_cast_window_stream_new (session,
connection,
window,
cursor_mode,
flags,
&error);
if (!window_stream)
{
@ -501,6 +521,8 @@ handle_record_area (MetaDBusScreenCastSession *skeleton,
MetaBackend *backend;
ClutterStage *stage;
MetaScreenCastCursorMode cursor_mode;
gboolean is_recording;
MetaScreenCastFlag flags;
g_autoptr (GError) error = NULL;
MetaRectangle rect;
MetaScreenCastAreaStream *area_stream;
@ -530,11 +552,18 @@ handle_record_area (MetaDBusScreenCastSession *skeleton,
}
}
if (!g_variant_lookup (properties_variant, "is-recording", "b", &is_recording))
is_recording = FALSE;
interface_skeleton = G_DBUS_INTERFACE_SKELETON (skeleton);
connection = g_dbus_interface_skeleton_get_connection (interface_skeleton);
backend = meta_screen_cast_get_backend (session->screen_cast);
stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
flags = META_SCREEN_CAST_FLAG_NONE;
if (is_recording)
flags |= META_SCREEN_CAST_FLAG_IS_RECORDING;
rect = (MetaRectangle) {
.x = x,
.y = y,
@ -546,6 +575,7 @@ handle_record_area (MetaDBusScreenCastSession *skeleton,
&rect,
stage,
cursor_mode,
flags,
&error);
if (!area_stream)
{
@ -647,12 +677,37 @@ meta_screen_cast_session_class_init (MetaScreenCastSessionClass *klass)
object_class->finalize = meta_screen_cast_session_finalize;
}
static gboolean
meta_screen_cast_session_is_recording (MetaScreenCastSession *session)
{
GList *l;
if (!session->streams)
return FALSE;
for (l = session->streams; l; l = l->next)
{
MetaScreenCastStream *stream = l->data;
MetaScreenCastFlag flags;
flags = meta_screen_cast_stream_get_flags (stream);
if (!(flags & META_SCREEN_CAST_FLAG_IS_RECORDING))
return FALSE;
}
return TRUE;
}
static MetaScreenCastSessionHandle *
meta_screen_cast_session_handle_new (MetaScreenCastSession *session)
{
MetaScreenCastSessionHandle *handle;
gboolean is_recording;
handle = g_object_new (META_TYPE_SCREEN_CAST_SESSION_HANDLE, NULL);
is_recording = meta_screen_cast_session_is_recording (session);
handle = g_object_new (META_TYPE_SCREEN_CAST_SESSION_HANDLE,
"is-recording", is_recording,
NULL);
handle->session = session;
return handle;

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