Compare commits

..

69 Commits

Author SHA1 Message Date
ec5d127cd2 wayland: Emit wp_tablet_pad_group.buttons after focus changes
The buttons grabbed by the compositor might have changed in between,
so just broadcast the button array again.
2016-07-20 19:27:24 +02:00
1c1785ea6e wayland: Check serial on wp_tablet_pad.set_feedback
We must lookup the mode switch serial for the group where the button
belongs to. Also, avoid the changes if the client requests setting
the feedback for buttons owned by the compositor.
2016-07-20 19:27:24 +02:00
aef997f7a1 wayland: Export function to tell whether a button belongs to a pad group 2016-07-20 19:27:24 +02:00
27477cbd30 wayland: Check serial on wp_tablet_pad_strip.set_feedback 2016-07-20 19:27:24 +02:00
ed73efa63f wayland: Check serial on wp_tablet_pad_ring.set_feedback 2016-07-20 19:27:24 +02:00
98f26bf01a wayland: Fix label lookup on >1 strips/rings
We assumed that each group could only have 1 strip and/or ring, because
accounting is performed per group, so we could not assume the real
index for anything above 1. Get rid of this restriction, now that
MetaWaylandTabletPad does its own accounting of rings/strips, alongside
groups.
2016-07-20 19:27:24 +02:00
edda88a7dd wayland: Move strips/rings management back to MetaWaylandTabletPad
This is best for 2 reasons:
- It's feels cleaner doing first creation of rings/strips and then
  the group assignment. The other option is making groups iterate
  other all rings/strips and selectively skip those not meant for
  it, which sounds somewhat redundant.
- Some minimal accounting of rings/strips without group restrictions
  is needed for meta_wayland_tablet_pad_get_label().

The rings/strips memory is now owned by MetaWaylandTabletPad instead
of groups, which is sort of meaningless since all are meant to go
at the same time.
2016-07-20 19:27:24 +02:00
5815259897 wayland: Add method to relate a pad strip to its group 2016-07-20 19:27:24 +02:00
1f7c7bdeaa wayland: Add method to relate a pad ring to its group 2016-07-20 19:27:24 +02:00
05a5c86203 backends: Implement the "show osd" pad action
Just call back into meta_display_request_show_osd().
2016-07-20 19:27:24 +02:00
c90d7a373b core: Add special case for the pad OSD in event handling
When it's active, we want wayland to stop handling (most notably key)
events.
2016-07-20 19:27:24 +02:00
6225cc6e60 core: Add meta_display_request_pad_osd() function
There may be external/compositor-specific reasons to trigger the
pad OSD. Expose this call so the pad OSD can be triggered looking
up the right settings, monitor, etc...
2016-07-20 19:27:24 +02:00
4c4b40d468 core: Add MetaDisplay:show-pad-osd signal
This is intended to be caught in the gnome-shell code, in order to
show the OSD with the pad action mapping.
2016-07-20 19:27:24 +02:00
02ce6c5865 backends: Export function to query the mapped MetaOutput of a tablet
Or NULL if the tablet is mapped to the full desktop size.
2016-07-20 19:26:31 +02:00
522989494f backends: Export call to retrieve the base GSettings for a tablet 2016-07-20 19:26:31 +02:00
ab851fc6e5 backends: Implement "switch monitor" pad button action
This action remaps the tablet to each of the connected monitors,
or to the span of all monitors.
2016-07-20 19:26:31 +02:00
185eabd3e3 core: Add public MetaDisplay functions to get action labels for pad buttons
This API will be used from the gnome-shell pad OSD implementation, in order
to show the actions that currently apply to every button/ring/strip in the
tablet.
2016-07-20 19:26:31 +02:00
67f5b89659 backends: Add function to retrieve the label for a pad button action
As those are specified by settings.
2016-07-20 19:26:31 +02:00
c7e0b87d7e meta: Add MetaPadActionType enum
This will be used on lookups to the current action assigned to
any element in a tablet pad.
2016-07-20 19:26:31 +02:00
ec50fcd320 wayland: Add getters for the current feedback strings in MetaWaylandTabletPad
Each of the buttons/rings/strips may have one such feedback string, this API
makes is meant to make lookups consistent.
2016-07-20 19:26:31 +02:00
982802d66c wayland: Hook MetaWaylandTabletPad to pad button actions management
These are handled by the MetaInputSettings, so hook the events emitted
to it.
2016-07-20 19:26:31 +02:00
0dcca308e7 backends: Add API to trigger actions related to pad buttons
It does nothing at the moment, but can be hooked into MetaWaylandTabletPad
now. For X11, we need to trigger these for the pad events we receive from
the passive pad button grabs.
2016-07-20 19:26:31 +02:00
b68247d51e wayland: Add update() phase to MetaWaylandTabletPad
This will be needed to update internal state of pad groups.
2016-07-20 19:26:31 +02:00
499851d404 wayland: Apply pressure settings before sending wp_tablet_tool.pressure 2016-07-20 19:26:31 +02:00
ef113d708b backends: Add function to apply pressure sensitivity to tablet tools
A bezier curve is created out of the 2 control points in settings, so
the pressure is made to follow the stablished curve between 0 and 1.
2016-07-20 19:26:31 +02:00
e2b8b0bf67 wayland: Implement stylus button actions
Those just send different BTN_ keycodes.
2016-07-20 19:26:31 +02:00
ec2ab05d8e backends: Add function to retrieve the action mapped to an stylus button
This function will be useful for the wayland implementation, because buttons
are mapped at the time of sending those through the wire.
As x11/wayland implementations differ here, this function will be useful for
the wayland implementation, as the action is handled lat
2016-07-20 19:26:31 +02:00
69955471fc backends: Perform libwacom checks before applying settings
Some settings make no sense on external tablets, and others make
no sense in display/system-integrated tablets. Perform those checks
so we don't end up with possibly broken configuration.
2016-07-20 19:26:31 +02:00
e59a32afa5 backends: Disable keep-aspect and output mapping on relative devices
Those settings make no sense there, so should be made ineffective.
2016-07-20 19:26:31 +02:00
1c0b063855 backends: Implement set_tablet_mapping() in native backend
We can now just set the mapping through clutter_input_device_set_mapping()
2016-07-20 19:26:31 +02:00
0cd46afa8f clutter/evdev: Optionally report abs/rel motions for tablet tools
Depending on clutter_input_device_get_mapping(), or whether the current
tool is either cursor or lens (those don't make any sense in absolute
mode), relative motions will be reported.
2016-07-20 19:26:31 +02:00
c73cc5138b clutter: Add clutter_input_device_[gs]et_mapping()
This function call only applies to tablets, and thus will error
out unless it's called with CLUTTER_TABLET_DEVICEs. This will
allow setting absolute/relative mapping on those on the fly, as
this is optional.
2016-07-20 19:26:31 +02:00
f51972c2aa backends: Turn MetaInputSettings into a singleton
We will need to fetch information from it at certain places.
The MetaBackend still takes care of freeing it though.
2016-07-20 19:26:31 +02:00
f81e0f8922 backends: Fetch libwacom information for tablets in MetaInputSettings
Given that information defines largely how such devices are to be
configured, it makes sense to have that information at hand. A getter
has been also added for the places where it could be useful, although
it will require HAVE_LIBWACOM checks in callers too.
2016-07-20 19:26:31 +02:00
1bf263f038 wayland: Implement wp_tablet.path
Now that we have clutter_input_device_get_device_node(), it is trivial
to implement.
2016-07-20 19:26:31 +02:00
257b16680f clutter/x11: Set device node information in XI2 devices 2016-07-20 19:26:31 +02:00
ed6eb8c94b clutter/evdev: Set device node information to evdev devices 2016-07-20 19:26:31 +02:00
95181bdbaa clutter: Add clutter_input_device_get_device_node()
This function is meant to return the device node path (eg. /dev/input/...),
which will be useful to wire up a few things.
2016-07-20 19:26:31 +02:00
59be5bf3b1 backends: Add function to lookup the mapping for a given tablet
At least for wayland, this needs implementing within mutter. So add
a function to look this setting up.
2016-07-20 19:26:31 +02:00
7f8932b489 backends: Store mappable devices' info in the hashtable
Instead of as closure data. We will need to store (and query) more
per-device info, so access to this struct is necessary.
2016-07-20 19:26:31 +02:00
f2feb6d53d backends: Map tablets/pads, and wire to configuration vfuncs
With this, the left-handed setting works. The other configuration
vfuncs remain empty stubs, but will be correctly applied when those
are handled.
2016-07-20 19:26:31 +02:00
47067e6d17 backends: Add empty stubs for tablet configuration
Those will be called when configuring tablets.
2016-07-20 19:26:31 +02:00
3386e5dc39 wayland: Implement wp_tablet_tool.hardware_id_wacom
We can now fetch this info from the ClutterInputDeviceTool, so
use it to implement this event.
2016-07-20 19:26:31 +02:00
384400cd24 clutter/evdev: Set tool IDs 2016-07-20 19:26:31 +02:00
be9997c717 clutter: Add ClutterInputDeviceTool:id property 2016-07-20 19:26:31 +02:00
d3be071196 configure: Check for libwacom
It will be used for some advanced tablet features, which we can't
get solely from libinput.
2016-07-20 19:26:31 +02:00
de704e591b wayland: Add focus management to pads
All pads will share the same focus than the keyboard, so this means that:
- The focus changes in-sync for keyboard and all pad devices, and
- Newly plugged pads will be immediately focused on that same surface
2016-07-20 19:26:31 +02:00
a14f0edcae wayland: Add MetaWaylandTabletSeat API to correlate pads/tablets
All pads have one tablet, but a tablet may have multiple pads. Add
API to look things up from a MetaWaylandTablet(Pad).
2016-07-20 19:26:31 +02:00
bf5324a339 wayland: Add pointer from MetaWaylandTabletSeat to MetaWaylandSeat
It will be useful to backreference to the MetaWaylandSeat from tablet
code.
2016-07-20 19:26:31 +02:00
9855ff010a wayland: Wire up pad device event management
The tablet manager will now lookup the correct MetaWaylandTabletSeat,
and forward the events through it.
2016-07-20 19:26:31 +02:00
6bd06cf40b wayland: Implement pad management in MetaWaylandTabletSeat
Now pads are looked up and notified upon, both on startup and
when plugging a tablet.
2016-07-20 19:26:31 +02:00
01fd218e17 wayland: Implement wp_tablet_pad
This object represents the collection of buttons, strips and rings
in a tablet pad. All the objects created (pad, strips and rings)
share a common focus surface and have the same lifetime.
2016-07-20 19:26:31 +02:00
f8c0301ecc wayland: Implement wp_tablet_pad_group 2016-07-20 19:26:31 +02:00
2354643d55 wayland: Implement wp_tablet_pad_strip
This represents pad sliders.
2016-07-20 19:26:31 +02:00
c1d1477c64 wayland: Implement wp_tablet_pad_ring
This object represents pad "wheels"
2016-07-20 19:26:31 +02:00
04629d2bc2 clutter: Handle pad button events in clutter_event_get_button() 2016-07-20 19:26:31 +02:00
c789459a31 clutter/evdev: Translate/emit libinput pad events 2016-07-20 19:26:31 +02:00
2f7602f297 clutter/evdev: Handle management of pad devices 2016-07-20 19:26:31 +02:00
d5459427d5 clutter: Add ::n-rings and ::n-strips property to ClutterInputDevice
This will only be practical for pads (and maybe generic buttonsets in
the future?), we just need to know the number as the events will also
contain a number as the identificator.
2016-07-20 19:26:31 +02:00
379c6fb81a clutter: Add pad event types
And their management along the pipeline.
2016-07-20 19:26:31 +02:00
fc5af32cdc clutter: Add clutter_event_get_mode_group()
This event can be used on pad events to find out the group they
pertain to.
2016-07-20 19:26:31 +02:00
b71d7058db clutter: Add pad event structs
Those map closely what we get from libinput. Button events have
been made its own separate struct, its semantics fall somewhere
in between of ClutterButtonEvent and ClutterKeyEvent, so is better
emitted as its own set.
2016-07-20 19:26:31 +02:00
1d9d176c3f clutter: Add "pad" device type 2016-07-20 19:26:31 +02:00
cd911584eb wayland: Set an specific role on surfaces passed in wp_tablet_tool.set_cursor
This is now separated from the generic cursor one. This means that wl_surfaces
can't be shared across wl_pointer and wp_tablet_tool. This is a change in
tablet protocol v2.
2016-07-20 19:26:31 +02:00
2ff629a984 wayland: Add MetaWaylandSurfaceRoleTabletCursor
This is a simple subclass of MetaWaylandSurfaceRoleCursor, mostly
so we can distinguish by GType, the methods in the parent class
still apply and are useful.
2016-07-20 19:26:31 +02:00
b0a3c472ea wayland: Make MetaWaylandSurfaceRoleCursor derivable 2016-07-20 19:26:31 +02:00
7ecbca6291 wayland: Make additional data in MetaWaylandSurfaceRoleCursor private
This will help subclassing it.
2016-07-20 19:26:31 +02:00
780c66fa73 wayland: Use wl_fixed_t for angle arguments in wp_tablet_tool
This is a change in tablet protocol v2
2016-07-20 19:26:31 +02:00
ffa991d422 wayland: Use tablet protocol v2
This commit merely updates the code generation from the v2 protocol
description.
2016-07-20 19:26:31 +02:00
539 changed files with 39310 additions and 82649 deletions

17
.gitignore vendored
View File

@ -41,21 +41,14 @@ stamp-h1
*~
stamp-it
.intltool-merge-cache
ABOUT-NLS
POTFILES
Makevars.template
po/*.header
po/*.pot
po/*.sed
po/*.sin
Rules-quot
libmutter.pc
mutter
mutter-restart-helper
mutter-test-client
mutter-test-runner
mutter-test-unit-tests
mutter-test-headless-start-test
mutter-all.test
org.gnome.mutter.gschema.valid
org.gnome.mutter.gschema.xml
@ -72,8 +65,6 @@ src/stamp-meta-enum-types.h
src/meta-dbus-display-config.[ch]
src/meta-dbus-idle-monitor.[ch]
src/meta-dbus-login1.[ch]
src/meta-dbus-remote-desktop.[ch]
src/meta-dbus-screen-cast.[ch]
src/gtk-primary-selection-protocol.c
src/gtk-primary-selection-server-protocol.h
src/gtk-shell-protocol.c
@ -86,14 +77,7 @@ src/relative-pointer-unstable-v*-protocol.c
src/relative-pointer-unstable-v*-server-protocol.h
src/pointer-constraints-unstable-v*-protocol.c
src/pointer-constraints-unstable-v*-server-protocol.h
src/xdg-foreign-unstable-v*-protocol.c
src/xdg-foreign-unstable-v*-server-protocol.h
src/xdg-output-unstable-v1-protocol.c
src/xdg-output-unstable-v1-server-protocol.h
src/xwayland-keyboard-grab-unstable-v1-protocol.c
src/xwayland-keyboard-grab-unstable-v1-server-protocol.h
src/meta/meta-version.h
src/libmutter-*.pc
doc/reference/*.args
doc/reference/*.bak
doc/reference/*.hierarchy
@ -119,4 +103,3 @@ ltsugar.m4
ltversion.m4
lt~obsolete.m4
.dirstamp
**/tags.*

435
NEWS
View File

@ -1,438 +1,3 @@
3.27.1
======
* Work with clients that require older linux_dmabuf protocol [Daniel; #788558]
* Support hybrid GPU systems [Jonas; #785381]
* Prevent crash when closing maximized windows [Jonni; #788666]
* Use the correct monitor for HiDPI scaling of shell chrome [Jonas; #788820]
* Fix unredirection of fullscreen windows [Rui, Jonas; #788493]
* Fix list of supported monitor scales on X11 [Jonas; #788901]
* Misc. bug fixes [Florian, Jonas, Marco; #788572, #788569, #788607, #788860,
#788921]
Contributors:
Jonas Ådahl, Carlos Garnacho, Rui Matos, Florian Müllner, Daniel Stone,
Marco Trevisan, Jonni Westphalen
Translations:
Xavi Ivars [ca@valencia]
3.26.1
======
* Fix crash when respawning shortcut inhibitor dialog [Olivier; #787568]
* Fix crash during monitor configuration migration [Carlos, Jonas; #787668]
* Fix multihead regressions in X11 session [Jonas; #787477]
* Fix screen rotation regressions [Hans; #787836]
* Fix keybindings not being resolved with non-latin layouts [Jonas; #787016]
* Support snap packages for sandboxed app IDs [Marco; #788217]
* Fix crash when reconnecting tablet device [Jason; #787649]
* Support running headless [Jonas; #730551, #787637]
* Support _NET_RESTACK_WINDOW and ConfigureRequest siblings [Vasilis; #786365]
* Fix monitor layout not being remembered across sessions [Jonas; #787629]
* Make sure to export _NET_NUMBER_OF_DESKTOPS [Florian; #760651]
* Allow resizing of tiled windows [Georges, Florian; #645153]
* Export tiling information to clients [Georges; #751857]
* Misc. bug fixes [Jonas, Florian, Jeremy, Rico; #787570, #787715, #787953,
#788049, #788199, #788292, #788197]
Contributors:
Jonas Ådahl, Andrea Azzarone, Georges Basile Stavracas Neto, Hans de Goede,
Olivier Fourdan, Carlos Garnacho, Jason Gerecke, Vasilis Liaskovitis,
Rui Matos, Florian Müllner, Jeremy Soller, Marco Trevisan, Rico Tzschichholz
Translations:
Matej Urbančič [sl], gogo [hr], Cheng-Chia Tseng [zh_TW]
3.26.0
======
Contributors:
Florian Müllner
Translations:
Trần Ngọc Quân [vi], Inaki Larranaga Murgoitio [eu], Jordi Mas [ca],
Anders Jonsson [sv], Alexander Shopov [bg], Ask Hjorth Larsen [da],
Jean-Baptiste Holcroft [fr], A S Alam [pa]
3.25.92
=======
* Add screencast and remote desktop support [Jonas; #784199]
* Support running with no attached monitors [Jonas; #730551]
* Add a vertical gradient effect to background actor [Alessandro; #786618]
* Misc. bug fixes [Mario, Daniel, Piotr, Jonas, Bastien; #786619, #786677,
#772218, #786918, #760670]
Contributors:
Jonas Ådahl, Alessandro Bono, Piotr Drąg, Bastien Nocera,
Mario Sanchez Prada, Daniel Stone
Translations:
Marek Cernocky [cs], Aurimas Černius [lt], Piotr Drąg [pl],
Fran Dieguez [gl], gogo [hr], Dušan Kazik [sk], Milo Casagrande [it],
Jordi Mas [ca], Cheng-Chia Tseng [zh_TW], Марко Костић [sr],
Милош Поповић [sr@latin], Rūdolfs Mazurs [lv], Matej Urbančič [sl],
Ask Hjorth Larsen [da], Piotr Drąg [it, lt], Jiri Grönroos [fi],
Emin Tufan Çetin [tr], Wolfgang Stöggl [de], Kukuh Syafaat [id],
Yuras Shumovich [be], Changwoo Ryu [ko], Alexander Shopov [bg],
Rafael Fontenelle [pt_BR], Balázs Úr [hu]
3.25.91
=======
* Reduce memory use of suspended instances [Jonas; #786299]
* Make supported scales determination saner [Rui; #786474]
* Fix crash on inhibit-shortcuts dialog reponse [Jonas; #786385]
* Support libinput's tag-and-drag setting [freeroot; #775755]
* Avoid overlapping keybindings with multiple layouts [Jonas; #786408]
* Fix non-transformed cursor on rotated monitors [Jonas; #786023]
* Avoid unnecessary work during background painting [Alessandro; #783512]
* Misc. bug fixes [Alberts, Jonas, Mario; #691611, #786300, #777732, #786568]
Contributors:
freeroot, Jonas Ådahl, Alessandro Bono, Carlos Garnacho, Rui Matos,
Alberts Muktupāvels, Mario Sanchez Prada
Translations:
Muhammet Kara [tr], Claude Paroz [fr], Мирослав Николић [sr, sr@latin],
Pawan Chitrakar [ne], Kukuh Syafaat [id]
3.25.90
=======
* Add zwp_linux_dmabuf_v1 support [Daniel; #785262]
* Add (x)wayland shortcut inhibitor support [Olivier; #783342]
* Misc. bug fixes [Daniel, Carlos, Cosimo; #785263, #785347, #767805]
Contributors:
Jonas Ådahl, Cosimo Cecchi, Olivier Fourdan, Carlos Garnacho, Daniel Stone
Translations:
Fabio Tomat [fur], Kukuh Syafaat [id], Aurimas Černius [lt],
Daniel Mustieles [es], Baurzhan Muftakhidinov [kk], Jordi Mas [ca],
Matej Urbančič [sl], Marek Cernocky [cs], gogo [hr], Fran Dieguez [gl],
Balázs Meskó [hu]
3.25.4
======
* Do not throttle motion events on tablet tools [Carlos; #783535]
* Handle left-handed mode on pen/eraser devices [Carlos; #782027]
* Add wl_surface.damage_buffer() support [Jonas; #784080]
* Fix crash when moving across on-adjacent monitors [Jonas; #783630]
* Fix window moving/resizing via tablet tools [Jason; #777333]
* Support fractional monitor scaling [Jonas, Marco; #765011]
* Keep override-redirect windows stacked on top [Rui; #780485]
* Implement tablet rings/strips configuration [Carlos; #782033]
* Support tablet wheel events on wayland [Jason; #783716]
* Move g-s-d xrandr functionality into mutter [Rui; #781906]
* Misc. bug fixes [Florian, Jason, Miguel, Carlos, Jonas; #783502, #784009,
#784223, #784272, #784402, #784881, #762083, #784867, #781723]
Contributors:
Jonas Ådahl, Miguel A. Vico, Emmanuele Bassi, Carlos Garnacho, Jason Gerecke,
Rui Matos, Florian Müllner, Marco Trevisan (Treviño)
3.25.3
======
* Ignore hotplug-mode-update value on startup [Marco; #783073]
* Implement configurable monitor scales on X11 [Jonas; #777732]
* Fix handling of tiled monitors [Jonas; #781723]
* Handle multiple keycodes for keysym [Christian; #781223]
* Consider subsurfaces when grabbing [mindtree; #781811]
* Fix logic for HiPDPI scaling of TV outputs [Christian; #777347]
* Fix handling of left-handed mode on pen/eraser devices [Carlos; #782027]
* Fix output cycling in non-display-attached tablets [Carlos; #782032]
* Fix wacom cursor offset on wayland [Jason; #784009]
* Handle EXIF orientation of backgrounds [Silvère; #783125]
* Misc. bug fixes [Piotr, Tim, Bastien, Jonas, Florian, Benoit, Carlos; #772218,
#783161, #780407, #783113, #783293, #783505, #781703]
Contributors:
mitchmindtree, Jonas Ådahl, Ikey Doherty, Piotr Drąg, Carlos Garnacho,
Jason Gerecke, Benoit Gschwind, Christian Kellner, Silvère Latchurié,
Tim Lunn, Florian Müllner, Bastien Nocera, Marco Trevisan (Treviño)
Translations:
Fabio Tomat [fur], Kukuh Syafaat [id], Khaled Hosny [ar],
Daniel Mustieles [es]
3.25.2
======
* Fix frame updates on hide-titlebar-when-maximized changes [Florian; #781862]
* Fix accessible screen coordinates on X11 [Florian; #781902]
* Use less CPU when rendering fast-updating windows [Carlos, Emmanuele; #782344]
* Compute geometry of clients that don't set one explicitly [Olivier; #782213]
* Fix copy+paste of UTF8 strings between X11 and wayland [Carlos; #782472]
* Fix non-wayland builds [Chris; #780533]
* Add plugin vfunc to implement a custom force-quit dialog [Carlos; #711619]
* Fix swapped red and blue channels in CoglTexture data [Carlos; #779234
* Fix build where libtool's link_all_deplibs defaults to 'no' [Marco; #782821]
* Fix glitches when opening a window maximized [Olivier; #781353, #782183]
* Fix wrong cursor after window underneath the pointer changed [Carlos; #755164]
* Implement support for disable-while-typing option [Evan; #764852]
* Emit size-change signal when tiling [Alessandro; #782968]
* Misc. bug fixes [Nigel, Matthias, Jonas; #759085, #780215, #782156, #782152]
Contributors:
Jonas Ådahl, Emmanuele Bassi, Alessandro Bono, Olivier Fourdan,
Carlos Garnacho, Matthias Liertzer, Florian Müllner, Nigel Taylor,
Marco Trevisan (Treviño), Chris Vine, Evan Welsh
Translations:
Fabio Tomat [fur], Jordi Mas [ca], Mario Blättermann [de],
Emin Tufan Çetin [tr], Balázs Úr [hu]
3.25.1
======
* Always sync window geometry on state changes [Jonas; #780292]
* Use EGL instead of GLX when drawing using GLES [Jonas; #771636]
* Fix HiDPI detection on vertical monitor layouts [Carlos; #777687]
* Get double-click timing from desktop mouse settings [Armin; #771576]
* Scale relative motion deltas with monitor scale [Jonas, Carlos; #778119]
* Use texture fallback when setting hardware cursor fails [Jente; #770020]
* Fix lock-up when using additional theme variants [Shantanu; #780254]
* Rework low-level monitor configuration [Jonas; #777732]
* Fix building with GLES2 instead of GL [Mario; #781398]
* Misc. bug fixes [Jonas, Piotr, Philip; #780304, #772218, #781242, #781391]
Contributors:
Jonas Ådahl, Philip Chimento, Piotr Drąg, Carlos Garnacho, Shantanu Goel,
Jente Hidskes, Armin Krezović, Rui Matos, Florian Müllner, Mario Sanchez Prada
Translations:
Yuras Shumovich [be], Yosef Or Boczko [he], Tom Tryfonidis [el],
Fabio Tomat [fur], Kukuh Syafaat [id]
3.24.0
======
Translations:
Yuri Myasoedov [ru], Rūdolfs Mazurs [lv], Jordi Mas [ca]
3.23.92
=======
* Properly handle EGLOutput acquire errors [Jonas, Miguel; #779112]
* Fix crash when a window closes during Alt+Tab [Rui; #779483]
* Implement DnD handling code in wayland [Hyungwon; #765003]
* Fix fallout from pixel conversion optimization in 3.23.91 [Carlos; #779234]
* Fix mouse input stopping to work in applications [Carlos; #763246]
* Fix DnD between QT5 and GTK3 applications on wayland [Carlos; #779757]
* Make EDID reading less fragile [Jonas; #779837]
* Add support for tablet grouping [Carlos; #779986]
* Misc. bug fixes and cleanups [Rui, Jonas; #779436, #779001, #779745]
Contributors:
Jonas Ådahl, Miguel A. Vico, Olivier Fourdan, Carlos Garnacho,
Hyungwon Hwang, Rui Matos
Translations:
Chao-Hsiung Liao [zh_TW], Sveinn í Felli [is], Ask Hjorth Larsen [da],
Changwoo Ryu [ko], Aurimas Černius [lt], GNOME Translation Robot [gd],
Marek Černocký [cs], Fran Dieguez [gl], Dušan Kazik [sk]
3.23.91
=======
* Give libinput read-only access to /sys [Carlos; #778472]
* Allow edge-scrolling without 2-finger-scroll capable devices [Rui; #778554]
* Fullscreen windows on the requested monitor on wayland [Rui; #772525]
* Implement threaded swap_event fallback for NVIDIA driver [Owen; #779039]
* Avoid pixel conversions when storing textures from cairo [Carlos; #779234]
* Misc. bug fixes [Piotr, Rui, Florian; #772218, #776919, #778831, #642652]
Contributors:
Piotr Drąg, Carlos Garnacho, Rui Matos, Florian Müllner, Owen W. Taylor
Translations:
Inaki Larranaga Murgoitio [eu], Daniel Mustieles [es], Claude Paroz [fr],
Mario Blättermann [de], Kjartan Maraas [nb], Piotr Drąg [pl],
Andika Triwidada [id], Anders Jonsson [sv], Milo Casagrande [it],
Fabio Tomat [fur], Rafael Fontenelle [pt_BR],
Мирослав Николић [sr, sr@latin], Balázs Meskó [hu], Chao-Hsiung Liao [zh_TW]
3.23.90
=======
* Fix window menu placement with HiDPI [Jonas; #776055]
* Improve EGLStream support [Jonas; #773629]
* Start moving low-level monitor configuration into mutter [Jonas; #777732]
* Fix erroneous key event repeats [Rui; #774989]
* Don't hardcode seat ID in ClutterDeviceManager [Carlos; #778092]
* Fix "ghost" cursors in multi-monitor setups [Jonas; #771056]
* Use eglGetPlatformDisplay [Adam; #772422]
* Fix erratic raise_or_lower behavior [Jose; #705200]
* Fix coordinate mapping of absolute devices [Carlos; #774115]
* Show OSD on tablet mode switches [Carlos; #771098]
* Make mutter libs parallel installable [Jonas; #777317]
* Only apply keymap when not running nested [Jonas; #777800]
* Set right scale for tablet tool cursors on HiDPI [Carlos; #778474]
* Adjust server-side shadows to match Adwaita [Juraj; #744667]
* Misc. bug fixes [Jonas, Bastien, Carlos, Peter, Lionel, Jeremy, Florian;
#774891, #777389, #777691, #778262, #776543, #778684, #778699, #744667]
Contributors:
Jonas Ådahl, Jeremy Bicha, Piotr Drąg, Juraj Fiala, Carlos Garnacho,
Peter Hutterer, Adam Jackson, Lionel Landwerlin, Jose Marino, Rui Matos,
Florian Müllner, Bastien Nocera
Translations:
Kjartan Maraas [nb], Mandy Wang [zh_CN], Marek Černocký [cs],
Anders Jonsson [sv], Dušan Kazik [sk], Piotr Drąg [pl], Matej Urbančič [sl]
3.23.3
======
* Fix frequent freezes in multihead setups on wayland [Rui; #774557]
* Preserve root window mask on XSelectionRequest [Olivier; #776128]
* Misc. bug fixes [Carlos, Florian, Rui, Olivier; #775478, #774891, #775986,
#776036]
Contributors:
Olivier Fourdan, Carlos Garnacho, Rui Matos, Florian Müllner
3.23.2
======
* Stack docks below other windows on fullscreen monitors [Rui; #772937]
* Fix popup grabs blocking screen lock on wayland [Rui; #771235]
* Handle touchpad pinch gestures with more than two fingers [Carlos; #765937]
* Implement drawing tablet support on X11 [Carlos; #773779]
* Fix some Wine games starting minimized [Carlos; #774333]
* Fix switching between two finger- and edge scrolling on wayland [Rui; #771744]
* Implement support for EGLStream/EGLDevice [Jonas; #773629]
* Add size_changed vfunc to handle async client size changes [Rui; #770345]
* Change focus window on clicks with any modifiers [Rui; #746642]
* Misc. bug fixes and cleanups [Carlos, Daniel, Jonas, Rui; #771067, #774330, #774613,
#771297, #774135, #774827, #774923]
Contributors:
Jonas Ådahl, Carlos Garnacho, Rui Matos, Florian Müllner, Daniel Stone
Translations:
Kjartan Maraas [nb]
3.23.1
======
* Fix handling of Escape shortcut in force-quit dialog [Landry; #737109]
* Improve pointer constraints support [Jonas; #771859]
* Really fix framebuffer capture origin offset [Rui; #771502]
* Fix session going into idle mode immediately on startup [Rui; #772839]
* Fix mirror mode with stage views [Rui; #773115]
* Fall back to X with connectors spread across multiple GPUs [Ray; #771442]
* Fix various crashes on wayland [Jonas, Carlos; #771646, #771858, #772929]
* Fix various placement issues on wayland [Olivier, Jonas, Sjoerd; #772729,
#768039, #771841, #771841, #773141]
* Misc. bug fixes [Rui, Jonas, Olivier; #771019, #773116, #772914, #773210]
Contributors:
Jonas Ådahl, Olivier Fourdan, Carlos Garnacho, Rui Matos, Landry MINOZA,
Sjoerd Simons, Ray Strode
Translations:
Theppitak Karoonboonyanan [th], Kjartan Maraas [nb], Hannie Dumoleyn [nl],
liushuyu [zh_CN]
3.22.1
======
* Fix feedback loop between StClipboard and X11 bridge [Carlos; #760745]
* Fall back gracefully if DRM plane rotation fails [Carlos; #772512]
* Approximate native monitor backend behavior to X [Rui; #772176]
* Fix crash on VT switch on wayland [Jonas; #771646]
* Expose Flatpak ID for application matching [Florian; #772613, #772614]
Contributors:
Jonas Ådahl, Carlos Garnacho, Rui Matos, Florian Müllner, Olav Vitters
Translations:
Inaki Larranaga Murgoitio [eu], Milo Casagrande [it]
3.22.0
======
* Fix wayland crashes [Jonas; #771305, #771345, #770940, #771495]
* Fix display rotation on wayland [Jonas; #770672]
* Fix framebuffer capture origin offset [Rui; #771502]
* Misc. bug fixes [Jonas, Florian, Carlos; #770937, #771536, #771628, #771549]
Contributors:
Jonas Ådahl, Carlos Garnacho, Rui Matos, Florian Müllner
Translations:
Ask Hjorth Larsen [da], Charles Monzat [fr], Stas Solovey [ru],
Tom Tryfonidis [el], David King [en_GB]
3.21.92
=======
* Fix absolute pointer motion events on wayland [Jonas; #770557]
* Default to using stage views [Jonas; #770366]
* Fix animated cursors on wayland [Rui; #749913]
* Fix various crashes on wayland [Jonas; #757568, #770727, #770992]
* Fix screen capture for stage views not at (0, 0) [Jonas; #770127]
* Compress motion events instead of discarding them [Jonas; #771049]
* Fix XWayland pointer warp emulation [Jonas; #771050]
* Add common monitor modes in KMS backend [Rui; #744544]
* Temporarily use g-s-d schemas for tablet configuration [Carlos; #771315]
* Misc. bug fixes [Jonas, Carlos; #770402, #770647, #770991, #770994, #770929]
Contributors:
Jonas Ådahl, Olivier Fourdan, Carlos Garnacho, Rui Matos, Florian Müllner
Translations:
Changwoo Ryu [ko], Baurzhan Muftakhidinov [kk], Anders Jonsson [sv],
Tiago Santos [pt], Rafael Fontenelle [pt_BR], Mario Blättermann [de],
Alexander Shopov [bg], Rūdolfs Mazurs [lv], Fran Dieguez [gl],
Trần Ngọc Quân [vi], Piotr Drąg [pl], Мирослав Николић [sr, sr@latin]
3.21.91
=======
* Add support for xdg-foreign protocol [Jonas; #769786]
* Support monitor rotation on wayland [Carlos; #745079]
* Port xdg-shell implementation to unstable v6 [Jonas; #769936]
* Handle unsupported buffer sizes more gracefully [Olivier; #770387]
* Use the same output naming logic as the X server on wayland [Rui; #770338]
* Fix replies in gnome-shell's chat notifications on wayland [Florian; #758167]
* Misc. bug fixes and cleanups [Bastien, Sjoerd, Jonas; #769276, #769636,
#770131, #770324, #769731]
Contributors:
Jonas Ådahl, Olivier Fourdan, Carlos Garnacho, Rui Matos, Florian Müllner,
Bastien Nocera, Sjoerd Simons
Translations:
Piotr Drąg [pl], Mario Blättermann [de], Andika Triwidada [id],
Enrico Nicoletto [pt_BR], Мирослав Николић [sr, sr@latin]
3.21.90
=======
* Consider XDG_SESSION_TYPE when determining session type [Jouke; #759388]
* Re-add support for edge scrolling on some touchpads [Bastien; #768245]
* Support mouse and trackball acceleration profile [Jonas; #769179]
* Draw monitor contentn to individual framebuffer [Jonas; #768976]
* Support virtual input devices [Jonas, Carlos; #765009]
* Set correct output scale on hotplug [Jonas; #769505]
* Misc. bug fixes and cleanups [Florian, Jonas, Thomas, Bastien, Carlos;
#769014, #769024, #769054, #769070, #769036, #769305, #769578, #769800,
#769073]
Contributors:
Jonas Ådahl, Carlos Garnacho, Thomas Hindoe Paaboel Andersen, Simon McVittie,
Alberts Muktupāvels, Florian Müllner, Bastien Nocera, Jouke Witteveen
Translations:
Daniel Mustieles [es], Aurimas Černius [lt], Dušan Kazik [sk],
Fabio Tomat [fur], Balázs Úr [hu], Yosef Or Boczko [he], Marek Černocký [cs],
Matej Urbančič [sl]
3.21.4
======
* Fix missing frame border around GTK+ dialogs [Florian; #745060]
* Improve X11 <-> wayland copy and paste interaction [Carlos; #768007]
* Add support for NV_robustness_video_memory_purge extension [Rui; #739178]
* Fix restoring the old focused window on restart [Owen; #766243]
* Fix fullscreen windows on other monitors stealing focus after closing
a window [Rui; #768221]
* Draw monitor content to individual framebuffer [Jonas; #768976]
* Provide screen capture API [Jonas; #768978]
* Misc. bug fixes and cleanups [Rui, Owen, Luca, Olivier, Jonas, Carlos;
#767969, #768243, #762407, #767997, #768039, #768977, #768977]
Contributors:
Jonas Ådahl, Luca Bruno, Olivier Fourdan, Carlos Garnacho, Rui Matos,
Florian Müllner, Owen W. Taylor
Translations:
Andika Triwidada [id]
3.21.3
======
* Don't create invalid UTF-8 window description strings [Rui; #765535]

View File

@ -6,23 +6,16 @@ test -z "$srcdir" && srcdir=.
REQUIRED_AUTOMAKE_VERSION=1.11
olddir="$(pwd)"
cd "${srcdir}"
(test -f configure.ac \
&& test -d src) || {
(test -f $srcdir/configure.ac \
&& test -d $srcdir/src) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level mutter directory"
echo " top-level metacity directory"
exit 1
}
aclocal --install || exit 1
intltoolize --force --copy --automake || exit 1
autoreconf --verbose --force --install || exit 1
cd "${olddir}"
if [ "$NOCONFIGURE" = "" ]; then
"${srcdir}/configure" "$@" || exit 1
fi
which gnome-autogen.sh || {
echo "You need to install gnome-common from GNOME Subversion (or from"
echo "your distribution's package manager)."
exit 1
}
. gnome-autogen.sh

View File

@ -25,7 +25,6 @@ AM_CPPFLAGS = \
-I$(top_builddir)/clutter \
-I$(top_srcdir)/../cogl \
-I$(top_builddir)/../cogl \
-I$(top_builddir)/../cogl/cogl \
$(CLUTTER_DEPRECATED_CFLAGS) \
$(CLUTTER_DEBUG_CFLAGS) \
$(CLUTTER_HIDDEN_VISIBILITY_CFLAGS) \
@ -37,7 +36,7 @@ AM_CFLAGS = $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS)
INTROSPECTION_GIRS =
# the base include path for headers
clutter_base_includedir = $(includedir)/mutter/clutter-$(LIBMUTTER_API_VERSION)
clutter_base_includedir = $(includedir)/mutter/clutter-$(CLUTTER_API_VERSION)
clutter_includedir = $(clutter_base_includedir)/clutter
clutter_deprecateddir = $(clutter_base_includedir)/clutter/deprecated
@ -87,8 +86,6 @@ source_h = \
clutter-image.h \
clutter-input-device.h \
clutter-input-device-tool.h \
clutter-input-focus.h \
clutter-input-method.h \
clutter-interval.h \
clutter-keyframe-transition.h \
clutter-keysyms.h \
@ -115,6 +112,7 @@ source_h = \
clutter-snap-constraint.h \
clutter-stage.h \
clutter-stage-manager.h \
clutter-stage-view.h \
clutter-tap-action.h \
clutter-test-utils.h \
clutter-texture.h \
@ -125,7 +123,6 @@ source_h = \
clutter-transition.h \
clutter-types.h \
clutter-units.h \
clutter-virtual-input-device.h \
clutter-zoom-action.h \
$(NULL)
@ -171,9 +168,6 @@ source_c = \
clutter-image.c \
clutter-input-device.c \
clutter-input-device-tool.c \
clutter-input-focus.c \
clutter-input-method.c \
clutter-virtual-input-device.c \
clutter-interval.c \
clutter-keyframe-transition.c \
clutter-keysyms-table.c \
@ -202,6 +196,7 @@ source_c = \
clutter-snap-constraint.c \
clutter-stage.c \
clutter-stage-manager.c \
clutter-stage-view.c \
clutter-stage-window.c \
clutter-tap-action.c \
clutter-test-utils.c \
@ -243,7 +238,6 @@ source_h_priv = \
clutter-settings-private.h \
clutter-stage-manager-private.h \
clutter-stage-private.h \
clutter-stage-view.h \
clutter-stage-window.h \
$(NULL)
@ -252,7 +246,6 @@ source_c_priv = \
clutter-easing.c \
clutter-event-translator.c \
clutter-id-pool.c \
clutter-stage-view.c \
$(NULL)
# deprecated installed headers
@ -360,7 +353,7 @@ EXTRA_DIST += clutter-version.h.in clutter-version.h
# key symbol update script
EXTRA_DIST += clutter-keysyms-update.pl
pc_files += mutter-clutter-$(LIBMUTTER_API_VERSION).pc
pc_files += mutter-clutter-$(CLUTTER_API_VERSION).pc
# in order to be compatible with Clutter < 1.10, when we shipped a single
# shared library whose name was determined by the single backend it
@ -392,7 +385,6 @@ x11_source_c = \
x11/clutter-keymap-x11.c \
x11/clutter-stage-x11.c \
x11/clutter-x11-texture-pixmap.c \
x11/clutter-xkb-a11y-x11.c \
$(NULL)
x11_source_h = \
@ -407,7 +399,6 @@ x11_source_h_priv = \
x11/clutter-keymap-x11.h \
x11/clutter-settings-x11.h \
x11/clutter-stage-x11.h \
x11/clutter-xkb-a11y-x11.h \
$(NULL)
x11_source_c_priv = \
@ -420,21 +411,11 @@ x11_source_c_priv = \
x11_source_c += \
x11/clutter-device-manager-xi2.c \
x11/clutter-input-device-xi2.c \
x11/clutter-input-device-tool-xi2.c \
$(NULL)
x11_source_h_priv += \
x11/clutter-device-manager-xi2.h \
x11/clutter-input-device-xi2.h \
x11/clutter-input-device-tool-xi2.h \
$(NULL)
x11_source_c += \
x11/clutter-virtual-input-device-x11.c \
$(NULL)
x11_source_h_priv += \
x11/clutter-virtual-input-device-x11.h \
$(NULL)
backend_source_h += $(x11_source_h)
@ -448,10 +429,10 @@ x11_introspection = $(x11_source_c) $(x11_source_h)
clutterx11_includedir = $(clutter_includedir)/x11
clutterx11_include_HEADERS = $(x11_source_h)
mutter-clutter-x11-@LIBMUTTER_API_VERSION@.pc: mutter-clutter-$(LIBMUTTER_API_VERSION).pc
mutter-clutter-x11-$(CLUTTER_API_VERSION).pc: mutter-clutter-$(CLUTTER_API_VERSION).pc
$(QUIET_GEN)cp -f $< $(@F)
pc_files += mutter-clutter-x11-$(LIBMUTTER_API_VERSION).pc
pc_files += mutter-clutter-x11-$(CLUTTER_API_VERSION).pc
# Shared cogl backend files
cogl_source_h =
@ -477,17 +458,13 @@ backend_source_c += $(glx_source_c)
evdev_c_priv = \
evdev/clutter-device-manager-evdev.c \
evdev/clutter-input-device-evdev.c \
evdev/clutter-seat-evdev.c \
evdev/clutter-virtual-input-device-evdev.c \
evdev/clutter-event-evdev.c \
evdev/clutter-input-device-tool-evdev.c \
$(NULL)
evdev_h_priv = \
evdev/clutter-device-manager-evdev.h \
evdev/clutter-input-device-evdev.h \
evdev/clutter-seat-evdev.h \
evdev/clutter-input-device-tool-evdev.h \
evdev/clutter-virtual-input-device-evdev.h \
$(NULL)
evdev_h = evdev/clutter-evdev.h
@ -589,17 +566,17 @@ nodist_clutter_include_HEADERS = clutter-config.h $(built_source_h)
clutter_deprecated_HEADERS = $(deprecated_h)
mutterlibdir = $(libdir)/mutter
mutterlib_LTLIBRARIES = libmutter-clutter-@LIBMUTTER_API_VERSION@.la
mutterlib_LTLIBRARIES = libmutter-clutter-@CLUTTER_API_VERSION@.la
libmutter_clutter_@LIBMUTTER_API_VERSION@_la_LIBADD = \
libmutter_clutter_@CLUTTER_API_VERSION@_la_LIBADD = \
$(LIBM) \
$(CLUTTER_LIBS) \
$(top_builddir)/../cogl/cogl/libmutter-cogl-$(LIBMUTTER_API_VERSION).la \
$(top_builddir)/../cogl/cogl-pango/libmutter-cogl-pango-$(LIBMUTTER_API_VERSION).la \
$(top_builddir)/../cogl/cogl-path/libmutter-cogl-path-$(LIBMUTTER_API_VERSION).la \
$(top_builddir)/../cogl/cogl/libmutter-cogl.la \
$(top_builddir)/../cogl/cogl-pango/libmutter-cogl-pango.la \
$(top_builddir)/../cogl/cogl-path/libmutter-cogl-path.la \
$(NULL)
libmutter_clutter_@LIBMUTTER_API_VERSION@_la_SOURCES = \
libmutter_clutter_@CLUTTER_API_VERSION@_la_SOURCES = \
$(backend_source_c) \
$(backend_source_h) \
$(backend_source_c_priv) \
@ -617,12 +594,12 @@ libmutter_clutter_@LIBMUTTER_API_VERSION@_la_SOURCES = \
$(cally_sources_private) \
$(NULL)
nodist_libmutter_clutter_@LIBMUTTER_API_VERSION@_la_SOURCES = \
nodist_libmutter_clutter_@CLUTTER_API_VERSION@_la_SOURCES = \
$(backend_source_built) \
$(built_source_c) \
$(built_source_h)
libmutter_clutter_@LIBMUTTER_API_VERSION@_la_LDFLAGS = \
libmutter_clutter_@CLUTTER_API_VERSION@_la_LDFLAGS = \
$(CLUTTER_LINK_FLAGS) \
$(CLUTTER_LT_LDFLAGS) \
-export-dynamic \
@ -636,13 +613,13 @@ install-exec-local:
rm -f $$lib.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION); \
) ; \
(cd $(DESTDIR)$(mutterlibdir) && \
{ ln -s -f libmutter-clutter-$(LIBMUTTER_API_VERSION).so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib.0 || \
{ rm -f $$lib.0 && ln -s libmutter-clutter-$(LIBMUTTER_API_VERSION).so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib.0; }; \
{ ln -s -f libmutter-clutter-$(CLUTTER_API_VERSION).so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib.0 || \
{ rm -f $$lib.0 && ln -s libmutter-clutter-1.0.so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib.0; }; \
} \
) ; \
(cd $(DESTDIR)$(mutterlibdir) && \
{ ln -s -f libmutter-clutter-$(LIBMUTTER_API_VERSION).so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib || \
{ rm -f $$lib && ln -s libmutter-clutter-$(LIBMUTTER_API_VERSION).so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib; }; \
{ ln -s -f libmutter-clutter-$(CLUTTER_API_VERSION).so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib || \
{ rm -f $$lib && ln -s libmutter-clutter-1.0.so.0.$(CLUTTER_LT_CURRENT).$(CLUTTER_LT_REVISION) $$lib; }; \
} \
) ; \
done
@ -650,65 +627,59 @@ install-exec-local:
# gobject-introspection rules
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_SCANNER_ARGS = \
--add-include-path=$(top_builddir)/../cogl/cogl \
--add-include-path=$(top_builddir)/../cogl/cogl-pango
INTROSPECTION_COMPILER_ARGS = \
--includedir=$(top_builddir)/../cogl/cogl \
--includedir=$(top_builddir)/../cogl/cogl-pango
INTROSPECTION_SCANNER_ENV = \
PKG_CONFIG_PATH=$(top_builddir)/../cogl/cogl/:$(top_builddir)/../cogl/cogl-pango/:$${PKG_CONFIG_PATH}
INTROSPECTION_SCANNER_ARGS = --add-include-path=$(top_builddir)/../cogl/cogl --add-include-path=$(top_builddir)/../cogl/cogl-pango
INTROSPECTION_COMPILER_ARGS = --includedir=$(top_builddir)/../cogl/cogl --includedir=$(top_builddir)/../cogl/cogl-pango
Clutter-@LIBMUTTER_API_VERSION@.gir: libmutter-clutter-@LIBMUTTER_API_VERSION@.la Makefile
Clutter-@CLUTTER_API_VERSION@.gir: libmutter-clutter-@CLUTTER_API_VERSION@.la Makefile
Clutter_@LIBMUTTER_API_VERSION@_gir_NAMESPACE = Clutter
Clutter_@LIBMUTTER_API_VERSION@_gir_VERSION = @LIBMUTTER_API_VERSION@
Clutter_@LIBMUTTER_API_VERSION@_gir_LIBS = libmutter-clutter-@LIBMUTTER_API_VERSION@.la
Clutter_@LIBMUTTER_API_VERSION@_gir_FILES = \
Clutter_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = Clutter
Clutter_@CLUTTER_API_VERSION_AM@_gir_VERSION = @CLUTTER_API_VERSION@
Clutter_@CLUTTER_API_VERSION_AM@_gir_LIBS = libmutter-clutter-@CLUTTER_API_VERSION@.la
Clutter_@CLUTTER_API_VERSION_AM@_gir_FILES = \
$(clutter_include_HEADERS) \
$(clutter_deprecated_HEADERS) \
$(nodist_clutter_include_HEADERS) \
$(source_c) \
$(deprecated_c) \
$(built_source_c)
Clutter_@LIBMUTTER_API_VERSION@_gir_CFLAGS = $(AM_CPPFLAGS) $(CLUTTER_CFLAGS)
Clutter_@LIBMUTTER_API_VERSION@_gir_INCLUDES = GL-1.0 GObject-2.0 cairo-1.0 Cogl-@LIBMUTTER_API_VERSION@ CoglPango-@LIBMUTTER_API_VERSION@ Atk-1.0 Json-1.0
Clutter_@LIBMUTTER_API_VERSION@_gir_SCANNERFLAGS = \
Clutter_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(AM_CPPFLAGS) $(CLUTTER_CFLAGS)
Clutter_@CLUTTER_API_VERSION_AM@_gir_INCLUDES = GL-1.0 GObject-2.0 cairo-1.0 Cogl-1.0 CoglPango-1.0 Atk-1.0 Json-1.0
Clutter_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \
--warn-all \
--c-include='clutter/clutter.h' \
--pkg-export=mutter-clutter-@LIBMUTTER_API_VERSION@
--pkg-export=mutter-clutter-@CLUTTER_API_VERSION@
INTROSPECTION_GIRS += Clutter-@LIBMUTTER_API_VERSION@.gir
INTROSPECTION_GIRS += Clutter-@CLUTTER_API_VERSION@.gir
Cally-@LIBMUTTER_API_VERSION@.gir: Makefile Clutter-@LIBMUTTER_API_VERSION@.gir
Cally-@CLUTTER_API_VERSION@.gir: Makefile Clutter-@CLUTTER_API_VERSION@.gir
Cally_@LIBMUTTER_API_VERSION@_gir_NAMESPACE = Cally
Cally_@LIBMUTTER_API_VERSION@_gir_VERSION = @LIBMUTTER_API_VERSION@
Cally_@LIBMUTTER_API_VERSION@_gir_LIBS = libmutter-clutter-@LIBMUTTER_API_VERSION@.la
Cally_@LIBMUTTER_API_VERSION@_gir_FILES = $(cally_sources_h) $(cally_sources_c)
Cally_@LIBMUTTER_API_VERSION@_gir_CFLAGS = $(AM_CPPFLAGS) $(CLUTTER_CFLAGS)
Cally_@LIBMUTTER_API_VERSION@_gir_SCANNERFLAGS = \
Cally_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = Cally
Cally_@CLUTTER_API_VERSION_AM@_gir_VERSION = @CLUTTER_API_VERSION@
Cally_@CLUTTER_API_VERSION_AM@_gir_LIBS = libmutter-clutter-@CLUTTER_API_VERSION@.la
Cally_@CLUTTER_API_VERSION_AM@_gir_FILES = $(cally_sources_h) $(cally_sources_c)
Cally_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(AM_CPPFLAGS) $(CLUTTER_CFLAGS)
Cally_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \
--warn-all \
--c-include='cally/cally.h' \
--pkg-export=mutter-cally-@LIBMUTTER_API_VERSION@ \
--include-uninstalled=$(top_builddir)/clutter/Clutter-@LIBMUTTER_API_VERSION@.gir
--pkg-export=mutter-cally-@CLUTTER_API_VERSION@ \
--include-uninstalled=$(top_builddir)/clutter/Clutter-@CLUTTER_API_VERSION@.gir
INTROSPECTION_GIRS += Cally-@LIBMUTTER_API_VERSION@.gir
INTROSPECTION_GIRS += Cally-@CLUTTER_API_VERSION@.gir
ClutterX11-@LIBMUTTER_API_VERSION@.gir: Makefile Clutter-@LIBMUTTER_API_VERSION@.gir
ClutterX11-@CLUTTER_API_VERSION@.gir: Makefile Clutter-@CLUTTER_API_VERSION@.gir
ClutterX11_@LIBMUTTER_API_VERSION@_gir_NAMESPACE = ClutterX11
ClutterX11_@LIBMUTTER_API_VERSION@_gir_INCLUDES = xlib-2.0
ClutterX11_@LIBMUTTER_API_VERSION@_gir_LIBS = libmutter-clutter-@LIBMUTTER_API_VERSION@.la
ClutterX11_@LIBMUTTER_API_VERSION@_gir_FILES = $(x11_introspection)
ClutterX11_@LIBMUTTER_API_VERSION@_gir_CFLAGS = $(AM_CPPFLAGS) $(CLUTTER_CFLAGS)
ClutterX11_@LIBMUTTER_API_VERSION@_gir_SCANNERFLAGS = \
ClutterX11_@CLUTTER_API_VERSION_AM@_gir_NAMESPACE = ClutterX11
ClutterX11_@CLUTTER_API_VERSION_AM@_gir_INCLUDES = xlib-2.0
ClutterX11_@CLUTTER_API_VERSION_AM@_gir_LIBS = libmutter-clutter-@CLUTTER_API_VERSION@.la
ClutterX11_@CLUTTER_API_VERSION_AM@_gir_FILES = $(x11_introspection)
ClutterX11_@CLUTTER_API_VERSION_AM@_gir_CFLAGS = $(AM_CPPFLAGS) $(CLUTTER_CFLAGS)
ClutterX11_@CLUTTER_API_VERSION_AM@_gir_SCANNERFLAGS = \
--warn-all \
--c-include='clutter/x11/clutter-x11.h' \
--pkg-export=mutter-clutter-x11-@LIBMUTTER_API_VERSION@ \
--include-uninstalled=$(top_builddir)/clutter/Clutter-@LIBMUTTER_API_VERSION@.gir
--pkg-export=mutter-clutter-x11-@CLUTTER_API_VERSION@ \
--include-uninstalled=$(top_builddir)/clutter/Clutter-@CLUTTER_API_VERSION@.gir
INTROSPECTION_GIRS += ClutterX11-@LIBMUTTER_API_VERSION@.gir
INTROSPECTION_GIRS += ClutterX11-@CLUTTER_API_VERSION@.gir
# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
# install anything - we need to install inside our prefix.

View File

@ -34,7 +34,6 @@ stamp-marshal: $(marshal_list)
$(AM_V_GEN)$(GLIB_GENMARSHAL) \
--prefix=$(glib_marshal_prefix) \
--header \
--valist-marshallers \
$(marshal_list) > xgen-mh \
&& (cmp -s xgen-mh $(marshal_h) || cp -f xgen-mh $(marshal_h)) \
&& rm -f xgen-mh \
@ -44,11 +43,10 @@ $(marshal_h): stamp-marshal
@true
$(marshal_c): $(marshal_h)
$(AM_V_GEN)$(GLIB_GENMARSHAL) \
$(AM_V_GEN)(echo "#include \"$(marshal_h)\"" ; \
$(GLIB_GENMARSHAL) \
--prefix=$(glib_marshal_prefix) \
--body \
--valist-marshallers \
--prototypes \
$(marshal_list) > xgen-mc \
&& (cmp -s xgen-mc $(marshal_c) || cp -f xgen-mc $(marshal_c)) \
$(marshal_list)) > xgen-mc \
&& cp xgen-mc $(marshal_c) \
&& rm -f xgen-mc

View File

@ -781,7 +781,7 @@ _cally_actor_get_top_level_origin (ClutterActor *actor,
"position of the stage");
}
else
#endif
#else
{
static gboolean yet_warned = FALSE;
@ -793,6 +793,7 @@ _cally_actor_get_top_level_origin (ClutterActor *actor,
"atk_component_get_extents() with ATK_XY_SCREEN.");
}
}
#endif
if (xp)
*xp = x;

View File

@ -2656,15 +2656,7 @@ _clutter_actor_signal_queue_redraw (ClutterActor *self,
_clutter_actor_queue_redraw_on_clones (self);
/* calls klass->queue_redraw in default handler */
if (g_signal_has_handler_pending (self, actor_signals[QUEUE_REDRAW],
0, TRUE))
{
g_signal_emit (self, actor_signals[QUEUE_REDRAW], 0, origin);
}
else
{
CLUTTER_ACTOR_GET_CLASS (self)->queue_redraw (self, origin);
}
g_signal_emit (self, actor_signals[QUEUE_REDRAW], 0, origin);
}
static void
@ -4023,11 +4015,7 @@ clutter_actor_continue_paint (ClutterActor *self)
clutter_paint_node_unref (dummy);
/* XXX:2.0 - Call the paint() virtual directly */
if (g_signal_has_handler_pending (self, actor_signals[PAINT],
0, TRUE))
g_signal_emit (self, actor_signals[PAINT], 0);
else
CLUTTER_ACTOR_GET_CLASS (self)->paint (self);
g_signal_emit (self, actor_signals[PAINT], 0);
}
else
{
@ -4041,11 +4029,7 @@ clutter_actor_continue_paint (ClutterActor *self)
*
* XXX:2.0 - Call the pick() virtual directly
*/
if (g_signal_has_handler_pending (self, actor_signals[PICK],
0, TRUE))
g_signal_emit (self, actor_signals[PICK], 0, &col);
else
CLUTTER_ACTOR_GET_CLASS (self)->pick (self, &col);
g_signal_emit (self, actor_signals[PICK], 0, &col);
}
}
else

View File

@ -58,8 +58,6 @@ struct _ClutterBackend
gint32 units_serial;
GList *event_translators;
ClutterInputMethod *input_method;
};
struct _ClutterBackendClass
@ -102,8 +100,6 @@ struct _ClutterBackendClass
PangoDirection (* get_keymap_direction) (ClutterBackend *backend);
void (* bell_notify) (ClutterBackend *backend);
/* signals */
void (* resolution_changed) (ClutterBackend *backend);
void (* font_changed) (ClutterBackend *backend);

View File

@ -127,7 +127,6 @@ clutter_backend_finalize (GObject *gobject)
g_free (backend->font_name);
clutter_backend_set_font_options (backend, NULL);
g_clear_object (&backend->input_method);
G_OBJECT_CLASS (clutter_backend_parent_class)->finalize (gobject);
}
@ -1364,41 +1363,3 @@ clutter_set_allowed_drivers (const char *drivers)
allowed_drivers = g_strdup (drivers);
}
void
clutter_backend_bell_notify (ClutterBackend *backend)
{
ClutterBackendClass *klass;
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (klass->bell_notify)
klass->bell_notify (backend);
}
/**
* clutter_backend_get_input_method:
* @backend: the #CLutterBackend
*
* Returns the input method used by Clutter
*
* Returns: (transfer none): the input method
**/
ClutterInputMethod *
clutter_backend_get_input_method (ClutterBackend *backend)
{
return backend->input_method;
}
/**
* clutter_backend_set_input_method:
* @backend: the #ClutterBackend
* @method: the input method
*
* Sets the input method to be used by Clutter
**/
void
clutter_backend_set_input_method (ClutterBackend *backend,
ClutterInputMethod *method)
{
g_set_object (&backend->input_method, method);
}

View File

@ -74,15 +74,6 @@ const cairo_font_options_t * clutter_backend_get_font_options (Clutter
CLUTTER_AVAILABLE_IN_1_8
CoglContext * clutter_backend_get_cogl_context (ClutterBackend *backend);
CLUTTER_AVAILABLE_IN_ALL
void clutter_backend_bell_notify (ClutterBackend *backend);
CLUTTER_AVAILABLE_IN_MUTTER
ClutterInputMethod * clutter_backend_get_input_method (ClutterBackend *backend);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_backend_set_input_method (ClutterBackend *backend,
ClutterInputMethod *method);
G_END_DECLS
#endif /* __CLUTTER_BACKEND_H__ */

View File

@ -76,6 +76,9 @@ struct _ClutterCanvasPrivate
gboolean dirty;
CoglBitmap *buffer;
int scale_factor;
guint scale_factor_set : 1;
};
enum
@ -84,6 +87,8 @@ enum
PROP_WIDTH,
PROP_HEIGHT,
PROP_SCALE_FACTOR,
PROP_SCALE_FACTOR_SET,
LAST_PROP
};
@ -180,6 +185,11 @@ clutter_canvas_set_property (GObject *gobject,
}
break;
case PROP_SCALE_FACTOR:
clutter_canvas_set_scale_factor (CLUTTER_CANVAS (gobject),
g_value_get_int (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -204,6 +214,17 @@ clutter_canvas_get_property (GObject *gobject,
g_value_set_int (value, priv->height);
break;
case PROP_SCALE_FACTOR:
if (priv->scale_factor_set)
g_value_set_int (value, priv->scale_factor);
else
g_value_set_int (value, -1);
break;
case PROP_SCALE_FACTOR_SET:
g_value_set_boolean (value, priv->scale_factor_set);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -247,6 +268,46 @@ clutter_canvas_class_init (ClutterCanvasClass *klass)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
/**
* ClutterCanvas:scale-factor-set:
*
* Whether the #ClutterCanvas:scale-factor property is set.
*
* If the #ClutterCanvas:scale-factor-set property is %FALSE
* then #ClutterCanvas will use the #ClutterSettings:window-scaling-factor
* property.
*
* Since: 1.18
*/
obj_props[PROP_SCALE_FACTOR_SET] =
g_param_spec_boolean ("scale-factor-set",
P_("Scale Factor Set"),
P_("Whether the scale-factor property is set"),
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* ClutterCanvas:scale-factor:
*
* The scaling factor to be applied to the Cairo surface used for
* drawing.
*
* If #ClutterCanvas:scale-factor is set to a negative value, the
* value of the #ClutterSettings:window-scaling-factor property is
* used instead.
*
* Use #ClutterCanvas:scale-factor-set to check if the scale factor
* is set.
*
* Since: 1.18
*/
obj_props[PROP_SCALE_FACTOR] =
g_param_spec_int ("scale-factor",
P_("Scale Factor"),
P_("The scaling factor for the surface"),
-1, 1000,
-1,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
* ClutterCanvas::draw:
@ -293,6 +354,7 @@ clutter_canvas_init (ClutterCanvas *self)
self->priv->width = -1;
self->priv->height = -1;
self->priv->scale_factor = -1;
}
static void
@ -335,18 +397,28 @@ clutter_canvas_emit_draw (ClutterCanvas *self)
gboolean mapped_buffer;
unsigned char *data;
CoglBuffer *buffer;
int window_scale = 1;
gboolean res;
cairo_t *cr;
g_assert (priv->height > 0 && priv->width > 0);
g_assert (priv->width > 0 && priv->width > 0);
priv->dirty = TRUE;
real_width = priv->width;
real_height = priv->height;
if (priv->scale_factor_set)
window_scale = priv->scale_factor;
else
g_object_get (clutter_settings_get_default (),
"window-scaling-factor", &window_scale,
NULL);
CLUTTER_NOTE (MISC, "Creating Cairo surface with size %d x %d",
priv->width, priv->height);
real_width = priv->width * window_scale;
real_height = priv->height * window_scale;
CLUTTER_NOTE (MISC, "Creating Cairo surface with size %d x %d (real: %d x %d, scale: %d)",
priv->width, priv->height,
real_width, real_height,
window_scale);
if (priv->buffer == NULL)
{
@ -389,6 +461,8 @@ clutter_canvas_emit_draw (ClutterCanvas *self)
mapped_buffer = FALSE;
}
cairo_surface_set_device_scale (surface, window_scale, window_scale);
self->priv->cr = cr = cairo_create (surface);
g_signal_emit (self, canvas_signals[DRAW], 0,
@ -562,3 +636,81 @@ clutter_canvas_set_size (ClutterCanvas *canvas,
return clutter_canvas_invalidate_internal (canvas, width, height);
}
/**
* clutter_canvas_set_scale_factor:
* @canvas: a #ClutterCanvas
* @scale: the scale factor, or -1 for the default
*
* Sets the scaling factor for the Cairo surface used by @canvas.
*
* This function should rarely be used.
*
* The default scaling factor of a #ClutterCanvas content uses the
* #ClutterSettings:window-scaling-factor property, which is set by
* the windowing system. By using this function it is possible to
* override that setting.
*
* Changing the scale factor will invalidate the @canvas.
*
* Since: 1.18
*/
void
clutter_canvas_set_scale_factor (ClutterCanvas *canvas,
int scale)
{
ClutterCanvasPrivate *priv;
GObject *obj;
g_return_if_fail (CLUTTER_IS_CANVAS (canvas));
g_return_if_fail (scale != 0);
priv = canvas->priv;
if (scale < 0)
{
if (!priv->scale_factor_set)
return;
priv->scale_factor_set = FALSE;
priv->scale_factor = -1;
}
else
{
if (priv->scale_factor_set && priv->scale_factor == scale)
return;
priv->scale_factor_set = TRUE;
priv->scale_factor = scale;
}
clutter_content_invalidate (CLUTTER_CONTENT (canvas));
obj = G_OBJECT (canvas);
g_object_notify_by_pspec (obj, obj_props[PROP_SCALE_FACTOR]);
g_object_notify_by_pspec (obj, obj_props[PROP_SCALE_FACTOR_SET]);
}
/**
* clutter_canvas_get_scale_factor:
* @canvas: a #ClutterCanvas
*
* Retrieves the scaling factor of @canvas, as set using
* clutter_canvas_set_scale_factor().
*
* Return value: the scaling factor, or -1 if the @canvas
* uses the default from #ClutterSettings
*
* Since: 1.18
*/
int
clutter_canvas_get_scale_factor (ClutterCanvas *canvas)
{
g_return_val_if_fail (CLUTTER_IS_CANVAS (canvas), -1);
if (!canvas->priv->scale_factor_set)
return -1;
return canvas->priv->scale_factor;
}

View File

@ -54,7 +54,6 @@
struct _ClutterClonePrivate
{
ClutterActor *clone_source;
gulong source_destroy_id;
};
G_DEFINE_TYPE_WITH_PRIVATE (ClutterClone, clutter_clone, CLUTTER_TYPE_ACTOR)
@ -377,13 +376,6 @@ clutter_clone_new (ClutterActor *source)
return g_object_new (CLUTTER_TYPE_CLONE, "source", source, NULL);
}
static void
on_source_destroyed (ClutterActor *source,
ClutterClone *self)
{
clutter_clone_set_source_internal (self, NULL);
}
static void
clutter_clone_set_source_internal (ClutterClone *self,
ClutterActor *source)
@ -395,8 +387,6 @@ clutter_clone_set_source_internal (ClutterClone *self,
if (priv->clone_source != NULL)
{
g_signal_handler_disconnect (priv->clone_source, priv->source_destroy_id);
priv->source_destroy_id = 0;
_clutter_actor_detach_clone (priv->clone_source, CLUTTER_ACTOR (self));
g_object_unref (priv->clone_source);
priv->clone_source = NULL;
@ -406,8 +396,6 @@ clutter_clone_set_source_internal (ClutterClone *self,
{
priv->clone_source = g_object_ref (source);
_clutter_actor_attach_clone (priv->clone_source, CLUTTER_ACTOR (self));
priv->source_destroy_id = g_signal_connect (priv->clone_source, "destroy",
G_CALLBACK (on_source_destroyed), self);
}
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_SOURCE]);

View File

@ -48,7 +48,7 @@
#include "clutter-debug.h"
/* XXX - keep in sync with the ClutterStaticColor enumeration order */
static const ClutterColor static_colors[] = {
static const ClutterColor const static_colors[] = {
/* CGA/EGA color palette */
{ 0xff, 0xff, 0xff, 0xff }, /* white */
{ 0x00, 0x00, 0x00, 0xff }, /* black */

View File

@ -145,9 +145,6 @@ struct _ClutterInputDevice
guint is_enabled : 1;
};
typedef void (*ClutterEmitInputDeviceEvent) (ClutterEvent *event,
ClutterInputDevice *device);
struct _ClutterInputDeviceClass
{
GObjectClass parent_class;
@ -157,20 +154,6 @@ struct _ClutterInputDeviceClass
guint *evdev_keycode);
void (* update_from_tool) (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
gboolean (* is_mode_switch_button) (ClutterInputDevice *device,
guint group,
guint button);
gint (* get_group_n_modes) (ClutterInputDevice *device,
gint group);
gboolean (* is_grouped) (ClutterInputDevice *device,
ClutterInputDevice *other_device);
/* Keyboard accessbility */
void (* process_kbd_a11y_event) (ClutterEvent *event,
ClutterInputDevice *device,
ClutterEmitInputDeviceEvent emit_event_func);
};
/* Platform-dependent interface */
@ -205,10 +188,6 @@ void _clutter_device_manager_select_stage_events (ClutterDeviceMa
ClutterStage *stage);
ClutterBackend *_clutter_device_manager_get_backend (ClutterDeviceManager *device_manager);
void _clutter_device_manager_compress_motion (ClutterDeviceManager *device_manger,
ClutterEvent *event,
const ClutterEvent *to_discard);
/* input device */
gboolean _clutter_input_device_has_sequence (ClutterInputDevice *device,
ClutterEventSequence *sequence);

View File

@ -47,16 +47,11 @@
#include "clutter-marshal.h"
#include "clutter-private.h"
#include "clutter-stage-private.h"
#include "clutter-virtual-input-device.h"
#include "clutter-input-device-tool.h"
struct _ClutterDeviceManagerPrivate
{
/* back-pointer to the backend */
ClutterBackend *backend;
/* Keyboard a11y */
ClutterKbdA11ySettings kbd_a11y_settings;
};
enum
@ -74,9 +69,6 @@ enum
{
DEVICE_ADDED,
DEVICE_REMOVED,
TOOL_CHANGED,
KBD_A11Y_MASK_CHANGED,
KBD_A11Y_FLAGS_CHANGED,
LAST_SIGNAL
};
@ -191,56 +183,6 @@ clutter_device_manager_class_init (ClutterDeviceManagerClass *klass)
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_INPUT_DEVICE);
manager_signals[TOOL_CHANGED] =
g_signal_new (I_("tool-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__OBJECT_OBJECT,
G_TYPE_NONE, 2,
CLUTTER_TYPE_INPUT_DEVICE,
CLUTTER_TYPE_INPUT_DEVICE_TOOL);
/**
* ClutterDeviceManager::kbd-a11y-mods-state-changed:
* @manager: the #ClutterDeviceManager that emitted the signal
* @latched_mask: the latched modifier mask from stickykeys
* @locked_mask: the locked modifier mask from stickykeys
*
* The ::kbd-a11y-mods-state-changed signal is emitted each time either the
* latched modifiers mask or locked modifiers mask are changed as the
* result of keyboard accessibilty's sticky keys operations.
*/
manager_signals[KBD_A11Y_MASK_CHANGED] =
g_signal_new (I_("kbd-a11y-mods-state-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__UINT_UINT,
G_TYPE_NONE, 2,
G_TYPE_UINT,
G_TYPE_UINT);
/**
* ClutterDeviceManager::kbd-a11y-flags-changed:
* @manager: the #ClutterDeviceManager that emitted the signal
* @settings_flags: the new ClutterKeyboardA11yFlags configuration
* @changed_mask: the ClutterKeyboardA11yFlags changed
*
* The ::kbd-a11y-flags-changed signal is emitted each time the
* ClutterKeyboardA11yFlags configuration is changed as the result of
* keyboard accessibilty operations.
*/
manager_signals[KBD_A11Y_FLAGS_CHANGED] =
g_signal_new (I_("kbd-a11y-flags-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__UINT_UINT,
G_TYPE_NONE, 2,
G_TYPE_UINT,
G_TYPE_UINT);
}
static void
@ -493,82 +435,3 @@ _clutter_device_manager_get_backend (ClutterDeviceManager *manager)
return manager->priv->backend;
}
/**
* clutter_device_manager_create_virtual_device:
* @device_manager: a #ClutterDeviceManager
* @device_type: the type of the virtual device
*
* Creates a virtual input device.
*
* Returns: (transfer full): a newly created virtual device
**/
ClutterVirtualInputDevice *
clutter_device_manager_create_virtual_device (ClutterDeviceManager *device_manager,
ClutterInputDeviceType device_type)
{
ClutterDeviceManagerClass *manager_class;
g_return_val_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager), NULL);
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
return manager_class->create_virtual_device (device_manager,
device_type);
}
void
_clutter_device_manager_compress_motion (ClutterDeviceManager *device_manager,
ClutterEvent *event,
const ClutterEvent *to_discard)
{
ClutterDeviceManagerClass *manager_class;
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
if (!manager_class->compress_motion)
return;
manager_class->compress_motion (device_manager, event, to_discard);
}
static gboolean
are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
ClutterKbdA11ySettings *b)
{
return (a->controls == b->controls &&
a->slowkeys_delay == b->slowkeys_delay &&
a->debounce_delay == b->debounce_delay &&
a->timeout_delay == b->timeout_delay &&
a->mousekeys_init_delay == b->mousekeys_init_delay &&
a->mousekeys_max_speed == b->mousekeys_max_speed &&
a->mousekeys_accel_time == b->mousekeys_accel_time);
}
void
clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings)
{
ClutterDeviceManagerClass *manager_class;
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
if (are_kbd_a11y_settings_equal (&device_manager->priv->kbd_a11y_settings, settings))
return;
device_manager->priv->kbd_a11y_settings = *settings;
manager_class = CLUTTER_DEVICE_MANAGER_GET_CLASS (device_manager);
if (manager_class->apply_kbd_a11y_settings)
manager_class->apply_kbd_a11y_settings (device_manager, settings);
}
void
clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings)
{
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER (device_manager));
*settings = device_manager->priv->kbd_a11y_settings;
}

View File

@ -44,25 +44,6 @@ typedef struct _ClutterDeviceManager ClutterDeviceManager;
typedef struct _ClutterDeviceManagerPrivate ClutterDeviceManagerPrivate;
typedef struct _ClutterDeviceManagerClass ClutterDeviceManagerClass;
/**
* 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;
/**
* ClutterDeviceManager:
*
@ -102,16 +83,9 @@ struct _ClutterDeviceManagerClass
ClutterInputDevice *device);
void (* select_stage_events) (ClutterDeviceManager *manager,
ClutterStage *stage);
ClutterVirtualInputDevice *(* create_virtual_device) (ClutterDeviceManager *device_manager,
ClutterInputDeviceType device_type);
void (* compress_motion) (ClutterDeviceManager *device_manger,
ClutterEvent *event,
const ClutterEvent *to_discard);
/* Keyboard accessbility */
void (* apply_kbd_a11y_settings) (ClutterDeviceManager *device_manger,
ClutterKbdA11ySettings *settings);
/* padding */
gpointer _padding[6];
gpointer _padding[7];
};
CLUTTER_AVAILABLE_IN_1_2
@ -131,17 +105,6 @@ CLUTTER_AVAILABLE_IN_1_2
ClutterInputDevice * clutter_device_manager_get_core_device (ClutterDeviceManager *device_manager,
ClutterInputDeviceType device_type);
CLUTTER_AVAILABLE_IN_ALL
ClutterVirtualInputDevice *clutter_device_manager_create_virtual_device (ClutterDeviceManager *device_manager,
ClutterInputDeviceType device_type);
CLUTTER_AVAILABLE_IN_ALL
void clutter_device_manager_set_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings);
CLUTTER_AVAILABLE_IN_ALL
void clutter_device_manager_get_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *settings);
G_END_DECLS
#endif /* __CLUTTER_DEVICE_MANAGER_H__ */

View File

@ -396,43 +396,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;
/**
* ClutterActorFlags:
* @CLUTTER_ACTOR_MAPPED: the actor will be painted (is visible, and inside
@ -767,9 +730,8 @@ typedef enum { /*< prefix=CLUTTER_DRAG >*/
* Since: 0.6
*/
typedef enum { /*< flags prefix=CLUTTER_EVENT >*/
CLUTTER_EVENT_NONE = 0,
CLUTTER_EVENT_FLAG_SYNTHETIC = 1 << 0,
CLUTTER_EVENT_FLAG_INPUT_METHOD = 1 << 1
CLUTTER_EVENT_NONE = 0,
CLUTTER_EVENT_FLAG_SYNTHETIC = 1 << 0
} ClutterEventFlags;
/**
@ -1574,41 +1536,6 @@ typedef enum {
CLUTTER_INPUT_DEVICE_MAPPING_RELATIVE,
} ClutterInputDeviceMapping;
typedef enum {
CLUTTER_INPUT_CONTENT_HINT_COMPLETION = 1 << 0,
CLUTTER_INPUT_CONTENT_HINT_SPELLCHECK = 1 << 1,
CLUTTER_INPUT_CONTENT_HINT_AUTO_CAPITALIZATION = 1 << 2,
CLUTTER_INPUT_CONTENT_HINT_LOWERCASE = 1 << 3,
CLUTTER_INPUT_CONTENT_HINT_UPPERCASE = 1 << 4,
CLUTTER_INPUT_CONTENT_HINT_TITLECASE = 1 << 5,
CLUTTER_INPUT_CONTENT_HINT_HIDDEN_TEXT = 1 << 6,
CLUTTER_INPUT_CONTENT_HINT_SENSITIVE_DATA = 1 << 7,
CLUTTER_INPUT_CONTENT_HINT_LATIN = 1 << 8,
CLUTTER_INPUT_CONTENT_HINT_MULTILINE = 1 << 9,
} ClutterInputContentHintFlags;
typedef enum {
CLUTTER_INPUT_CONTENT_PURPOSE_NORMAL,
CLUTTER_INPUT_CONTENT_PURPOSE_ALPHA,
CLUTTER_INPUT_CONTENT_PURPOSE_DIGITS,
CLUTTER_INPUT_CONTENT_PURPOSE_NUMBER,
CLUTTER_INPUT_CONTENT_PURPOSE_PHONE,
CLUTTER_INPUT_CONTENT_PURPOSE_URL,
CLUTTER_INPUT_CONTENT_PURPOSE_EMAIL,
CLUTTER_INPUT_CONTENT_PURPOSE_NAME,
CLUTTER_INPUT_CONTENT_PURPOSE_PASSWORD,
CLUTTER_INPUT_CONTENT_PURPOSE_DATE,
CLUTTER_INPUT_CONTENT_PURPOSE_TIME,
CLUTTER_INPUT_CONTENT_PURPOSE_DATETIME,
CLUTTER_INPUT_CONTENT_PURPOSE_TERMINAL,
} ClutterInputContentPurpose;
typedef enum {
CLUTTER_INPUT_PANEL_STATE_OFF,
CLUTTER_INPUT_PANEL_STATE_ON,
CLUTTER_INPUT_PANEL_STATE_TOGGLE,
} ClutterInputPanelState;
G_END_DECLS
#endif /* __CLUTTER_ENUMS_H__ */

View File

@ -1990,28 +1990,22 @@ clutter_event_remove_filter (guint id)
}
/**
* clutter_event_get_touchpad_gesture_finger_count:
* @event: a touchpad swipe/pinch event
* clutter_event_get_gesture_swipe_finger_count:
* @event: a touchpad swipe event
*
* Returns the number of fingers that is triggering the touchpad gesture.
*
* Returns: the number of fingers in the gesture.
* Returns: the number of fingers swiping.
*
* Since: 1.24
**/
guint
clutter_event_get_touchpad_gesture_finger_count (const ClutterEvent *event)
clutter_event_get_gesture_swipe_finger_count (const ClutterEvent *event)
{
g_return_val_if_fail (event != NULL, 0);
g_return_val_if_fail (event->type == CLUTTER_TOUCHPAD_SWIPE ||
event->type == CLUTTER_TOUCHPAD_PINCH, 0);
g_return_val_if_fail (event->type == CLUTTER_TOUCHPAD_SWIPE, 0);
if (event->type == CLUTTER_TOUCHPAD_SWIPE)
return event->touchpad_swipe.n_fingers;
else if (event->type == CLUTTER_TOUCHPAD_PINCH)
return event->touchpad_pinch.n_fingers;
return 0;
return event->touchpad_swipe.n_fingers;
}
/**
@ -2179,61 +2173,3 @@ clutter_event_get_mode_group (const ClutterEvent *event)
return 0;
}
}
/**
* clutter_event_get_pad_event_details:
* @event: a pad event
* @number: (out) (optional): ring/strip/button number
* @mode: (out) (optional): pad mode as per the event
* @value: (out) (optional): event axis value
*
* Returns the details of a pad event.
*
* Returns: #TRUE if event details could be obtained
**/
gboolean
clutter_event_get_pad_event_details (const ClutterEvent *event,
guint *number,
guint *mode,
gdouble *value)
{
guint n, m;
gdouble v;
g_return_val_if_fail (event != NULL, FALSE);
g_return_val_if_fail (event->type == CLUTTER_PAD_BUTTON_PRESS ||
event->type == CLUTTER_PAD_BUTTON_RELEASE ||
event->type == CLUTTER_PAD_RING ||
event->type == CLUTTER_PAD_STRIP, FALSE);
switch (event->type)
{
case CLUTTER_PAD_BUTTON_PRESS:
case CLUTTER_PAD_BUTTON_RELEASE:
n = event->pad_button.button;
m = event->pad_button.mode;
v = 0.0;
break;
case CLUTTER_PAD_RING:
n = event->pad_ring.ring_number;
m = event->pad_ring.mode;
v = event->pad_ring.angle;
break;
case CLUTTER_PAD_STRIP:
n = event->pad_strip.strip_number;
m = event->pad_strip.mode;
v = event->pad_strip.value;
break;
default:
return FALSE;
}
if (number)
*number = n;
if (mode)
*mode = m;
if (value)
*value = v;
return TRUE;
}

View File

@ -459,7 +459,6 @@ struct _ClutterTouchpadPinchEvent
gfloat dy;
gfloat angle_delta;
gfloat scale;
guint n_fingers;
};
/**
@ -508,7 +507,6 @@ struct _ClutterPadButtonEvent
guint32 button;
guint32 group;
ClutterInputDevice *device;
guint32 mode;
};
struct _ClutterPadStripEvent
@ -524,7 +522,6 @@ struct _ClutterPadStripEvent
guint32 strip_number;
guint32 group;
gdouble value;
guint32 mode;
};
struct _ClutterPadRingEvent
@ -540,7 +537,6 @@ struct _ClutterPadRingEvent
guint32 ring_number;
guint32 group;
gdouble angle;
guint32 mode;
};
/**
@ -756,7 +752,7 @@ CLUTTER_AVAILABLE_IN_1_2
const ClutterEvent * clutter_get_current_event (void);
CLUTTER_AVAILABLE_IN_1_24
guint clutter_event_get_touchpad_gesture_finger_count (const ClutterEvent *event);
guint clutter_event_get_gesture_swipe_finger_count (const ClutterEvent *event);
CLUTTER_AVAILABLE_IN_1_24
gdouble clutter_event_get_gesture_pinch_angle_delta (const ClutterEvent *event);
@ -778,12 +774,6 @@ ClutterScrollFinishFlags clutter_event_get_scroll_finish_flags (const Clut
CLUTTER_AVAILABLE_IN_ALL
guint clutter_event_get_mode_group (const ClutterEvent *event);
CLUTTER_AVAILABLE_IN_MUTTER
gboolean clutter_event_get_pad_event_details (const ClutterEvent *event,
guint *number,
guint *mode,
gdouble *value);
G_END_DECLS

View File

@ -2175,63 +2175,6 @@ clutter_input_device_get_n_mode_groups (ClutterInputDevice *device)
return device->n_mode_groups;
}
gint
clutter_input_device_get_group_n_modes (ClutterInputDevice *device,
gint group)
{
ClutterInputDeviceClass *device_class;
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
g_return_val_if_fail (clutter_input_device_get_device_type (device) ==
CLUTTER_PAD_DEVICE, 0);
g_return_val_if_fail (group >= 0, 0);
device_class = CLUTTER_INPUT_DEVICE_GET_CLASS (device);
if (device_class->get_group_n_modes)
return device_class->get_group_n_modes (device, group);
return 0;
}
gboolean
clutter_input_device_is_mode_switch_button (ClutterInputDevice *device,
guint group,
guint button)
{
ClutterInputDeviceClass *device_class;
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
g_return_val_if_fail (clutter_input_device_get_device_type (device) ==
CLUTTER_PAD_DEVICE, FALSE);
device_class = CLUTTER_INPUT_DEVICE_GET_CLASS (device);
if (device_class->is_mode_switch_button)
return device_class->is_mode_switch_button (device, group, button);
return FALSE;
}
gint
clutter_input_device_get_mode_switch_button_group (ClutterInputDevice *device,
guint button)
{
gint group;
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), -1);
g_return_val_if_fail (clutter_input_device_get_device_type (device) ==
CLUTTER_PAD_DEVICE, -1);
for (group = 0; group < device->n_mode_groups; group++)
{
if (clutter_input_device_is_mode_switch_button (device, group, button))
return group;
}
return -1;
}
const gchar *
clutter_input_device_get_device_node (ClutterInputDevice *device)
{
@ -2243,15 +2186,10 @@ clutter_input_device_get_device_node (ClutterInputDevice *device)
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,
g_return_val_if_fail (clutter_input_device_get_device_type (device) ==
CLUTTER_TABLET_DEVICE,
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE);
return device->mapping_mode;
@ -2261,14 +2199,9 @@ 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);
g_return_if_fail (clutter_input_device_get_device_type (device) ==
CLUTTER_TABLET_DEVICE);
if (device->mapping_mode == mapping)
return;
@ -2276,13 +2209,3 @@ clutter_input_device_set_mapping_mode (ClutterInputDevice *device,
device->mapping_mode = mapping;
g_object_notify (G_OBJECT (device), "mapping-mode");
}
gboolean
clutter_input_device_is_grouped (ClutterInputDevice *device,
ClutterInputDevice *other_device)
{
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (other_device), FALSE);
return CLUTTER_INPUT_DEVICE_GET_CLASS (device)->is_grouped (device, other_device);
}

View File

@ -147,18 +147,6 @@ gint clutter_input_device_get_n_strips (ClutterInputDev
CLUTTER_AVAILABLE_IN_ALL
gint clutter_input_device_get_n_mode_groups (ClutterInputDevice *device);
CLUTTER_AVAILABLE_IN_ALL
gint clutter_input_device_get_group_n_modes (ClutterInputDevice *device,
gint group);
CLUTTER_AVAILABLE_IN_ALL
gboolean clutter_input_device_is_mode_switch_button (ClutterInputDevice *device,
guint group,
guint button);
CLUTTER_AVAILABLE_IN_ALL
gint clutter_input_device_get_mode_switch_button_group (ClutterInputDevice *device,
guint button);
CLUTTER_AVAILABLE_IN_ALL
const gchar * clutter_input_device_get_device_node (ClutterInputDevice *device);
@ -168,9 +156,6 @@ ClutterInputDeviceMapping clutter_input_device_get_mapping_mode (ClutterInputDev
CLUTTER_AVAILABLE_IN_ALL
void clutter_input_device_set_mapping_mode (ClutterInputDevice *device,
ClutterInputDeviceMapping mapping);
CLUTTER_AVAILABLE_IN_ALL
gboolean clutter_input_device_is_grouped (ClutterInputDevice *device,
ClutterInputDevice *other_device);
G_END_DECLS

View File

@ -1,229 +0,0 @@
/*
* Copyright (C) 2017 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Author: Carlos Garnacho <carlosg@gnome.org>
*/
#include "clutter-build-config.h"
#include "clutter/clutter-input-focus.h"
enum {
FOCUS_IN,
FOCUS_OUT,
COMMIT,
DELETE_SURROUNDING,
REQUEST_SURROUNDING,
SET_PREEDIT_TEXT,
N_SIGNALS,
};
static guint signals[N_SIGNALS] = { 0 };
G_DEFINE_INTERFACE (ClutterInputFocus, clutter_input_focus, G_TYPE_OBJECT)
static void
clutter_input_focus_default_init (ClutterInputFocusInterface *iface)
{
signals[FOCUS_IN] =
g_signal_new ("focus-in",
CLUTTER_TYPE_INPUT_FOCUS,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterInputFocusInterface, focus_in),
NULL, NULL, NULL,
G_TYPE_NONE, 1, CLUTTER_TYPE_INPUT_METHOD);
signals[FOCUS_OUT] =
g_signal_new ("focus-out",
CLUTTER_TYPE_INPUT_FOCUS,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterInputFocusInterface, focus_out),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[COMMIT] =
g_signal_new ("commit",
CLUTTER_TYPE_INPUT_FOCUS,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterInputFocusInterface, commit_text),
NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_STRING);
signals[DELETE_SURROUNDING] =
g_signal_new ("delete-surrounding",
CLUTTER_TYPE_INPUT_FOCUS,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterInputFocusInterface, delete_surrounding),
NULL, NULL, NULL,
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
signals[REQUEST_SURROUNDING] =
g_signal_new ("request-surrounding",
CLUTTER_TYPE_INPUT_FOCUS,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterInputFocusInterface, request_surrounding),
NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[SET_PREEDIT_TEXT] =
g_signal_new ("set-preedit-text",
CLUTTER_TYPE_INPUT_FOCUS,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ClutterInputFocusInterface, set_preedit_text),
NULL, NULL, NULL,
G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_UINT);
}
void
clutter_input_focus_reset (ClutterInputFocus *focus)
{
ClutterBackend *backend = clutter_get_default_backend ();
ClutterInputMethod *method = clutter_backend_get_input_method (backend);
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (method));
if (clutter_input_method_get_focus (method) != focus)
return;
CLUTTER_INPUT_METHOD_GET_CLASS (method)->reset (method);
}
void
clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
const ClutterRect *rect)
{
ClutterBackend *backend = clutter_get_default_backend ();
ClutterInputMethod *method = clutter_backend_get_input_method (backend);
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (method));
if (clutter_input_method_get_focus (method) != focus)
return;
CLUTTER_INPUT_METHOD_GET_CLASS (method)->set_cursor_location (method, rect);
}
void
clutter_input_focus_set_surrounding (ClutterInputFocus *focus,
const gchar *text,
guint cursor,
guint anchor)
{
ClutterBackend *backend = clutter_get_default_backend ();
ClutterInputMethod *method = clutter_backend_get_input_method (backend);
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (method));
if (clutter_input_method_get_focus (method) != focus)
return;
CLUTTER_INPUT_METHOD_GET_CLASS (method)->set_surrounding (method, text, cursor, anchor);
}
void
clutter_input_focus_set_content_hints (ClutterInputFocus *focus,
ClutterInputContentHintFlags hints)
{
ClutterBackend *backend = clutter_get_default_backend ();
ClutterInputMethod *method = clutter_backend_get_input_method (backend);
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (method));
if (clutter_input_method_get_focus (method) != focus)
return;
g_object_set (G_OBJECT (method), "content-hints", hints, NULL);
}
void
clutter_input_focus_set_content_purpose (ClutterInputFocus *focus,
ClutterInputContentPurpose purpose)
{
ClutterBackend *backend = clutter_get_default_backend ();
ClutterInputMethod *method = clutter_backend_get_input_method (backend);
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (method));
if (clutter_input_method_get_focus (method) != focus)
return;
g_object_set (G_OBJECT (method), "content-purpose", purpose, NULL);
}
void
clutter_input_focus_focus_in (ClutterInputFocus *focus)
{
ClutterBackend *backend = clutter_get_default_backend ();
ClutterInputMethod *method = clutter_backend_get_input_method (backend);
clutter_input_method_focus_in (method, focus);
}
void
clutter_input_focus_focus_out (ClutterInputFocus *focus)
{
ClutterBackend *backend = clutter_get_default_backend ();
ClutterInputMethod *method = clutter_backend_get_input_method (backend);
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (method));
if (clutter_input_method_get_focus (method) == focus)
clutter_input_method_focus_out (method);
}
gboolean
clutter_input_focus_filter_key_event (ClutterInputFocus *focus,
const ClutterKeyEvent *key)
{
ClutterBackend *backend = clutter_get_default_backend ();
ClutterInputMethod *method = clutter_backend_get_input_method (backend);
g_return_val_if_fail (CLUTTER_IS_INPUT_METHOD (method), FALSE);
if (clutter_event_get_flags ((ClutterEvent *) key) & CLUTTER_EVENT_FLAG_INPUT_METHOD)
return FALSE;
if (clutter_input_method_get_focus (method) == focus)
{
ClutterInputMethodClass *im_class = CLUTTER_INPUT_METHOD_GET_CLASS (method);
if (im_class->filter_key_event)
return im_class->filter_key_event (method, (const ClutterEvent *) key);
}
return FALSE;
}
void
clutter_input_focus_set_can_show_preedit (ClutterInputFocus *focus,
gboolean can_show_preedit)
{
ClutterBackend *backend = clutter_get_default_backend ();
ClutterInputMethod *method = clutter_backend_get_input_method (backend);
if (clutter_input_method_get_focus (method) == focus)
g_object_set (G_OBJECT (method), "can-show-preedit", can_show_preedit, NULL);
}
void
clutter_input_focus_request_toggle_input_panel (ClutterInputFocus *focus)
{
ClutterBackend *backend = clutter_get_default_backend ();
ClutterInputMethod *method = clutter_backend_get_input_method (backend);
if (clutter_input_method_get_focus (method) == focus)
{
g_signal_emit_by_name (method, "input-panel-state",
CLUTTER_INPUT_PANEL_STATE_TOGGLE);
}
}

View File

@ -1,86 +0,0 @@
/*
* Copyright (C) 2017 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Author: Carlos Garnacho <carlosg@gnome.org>
*/
#ifndef __CLUTTER_INPUT_FOCUS_H__
#define __CLUTTER_INPUT_FOCUS_H__
#include <clutter/clutter.h>
#define CLUTTER_TYPE_INPUT_FOCUS (clutter_input_focus_get_type ())
CLUTTER_AVAILABLE_IN_MUTTER
G_DECLARE_INTERFACE (ClutterInputFocus, clutter_input_focus,
CLUTTER, INPUT_FOCUS, GObject)
typedef struct _ClutterInputFocusInterface ClutterInputFocusInterface;
struct _ClutterInputFocusInterface
{
GTypeInterface iface;
void (* focus_in) (ClutterInputFocus *focus,
ClutterInputMethod *input_method);
void (* focus_out) (ClutterInputFocus *focus);
void (* request_surrounding) (ClutterInputFocus *focus);
void (* delete_surrounding) (ClutterInputFocus *focus,
guint offset,
guint len);
void (* commit_text) (ClutterInputFocus *focus,
const gchar *text);
void (* set_preedit_text) (ClutterInputFocus *focus,
const gchar *preedit,
guint cursor);
};
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_focus_focus_in (ClutterInputFocus *focus);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_focus_focus_out (ClutterInputFocus *focus);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_focus_reset (ClutterInputFocus *focus);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_focus_set_cursor_location (ClutterInputFocus *focus,
const ClutterRect *rect);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_focus_set_surrounding (ClutterInputFocus *focus,
const gchar *text,
guint cursor,
guint anchor);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_focus_set_content_hints (ClutterInputFocus *focus,
ClutterInputContentHintFlags hint);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_focus_set_content_purpose (ClutterInputFocus *focus,
ClutterInputContentPurpose purpose);
CLUTTER_AVAILABLE_IN_MUTTER
gboolean clutter_input_focus_filter_key_event (ClutterInputFocus *focus,
const ClutterKeyEvent *key);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_focus_set_can_show_preedit (ClutterInputFocus *focus,
gboolean can_show_preedit);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_focus_request_toggle_input_panel (ClutterInputFocus *focus);
#endif /* __CLUTTER_INPUT_FOCUS_H__ */

View File

@ -1,359 +0,0 @@
/*
* Copyright (C) 2017 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Author: Carlos Garnacho <carlosg@gnome.org>
*/
#include "clutter-build-config.h"
#include "clutter-private.h"
#include "clutter/clutter-input-method.h"
typedef struct _ClutterInputMethodPrivate ClutterInputMethodPrivate;
struct _ClutterInputMethodPrivate
{
ClutterInputFocus *focus;
ClutterInputContentHintFlags content_hints;
ClutterInputContentPurpose content_purpose;
gboolean can_show_preedit;
};
enum {
COMMIT,
DELETE_SURROUNDING,
REQUEST_SURROUNDING,
INPUT_PANEL_STATE,
N_SIGNALS,
};
enum {
PROP_0,
PROP_CONTENT_HINTS,
PROP_CONTENT_PURPOSE,
PROP_CAN_SHOW_PREEDIT,
N_PROPS
};
static guint signals[N_SIGNALS] = { 0 };
static GParamSpec *pspecs[N_PROPS] = { 0 };
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterInputMethod, clutter_input_method, G_TYPE_OBJECT)
static void
set_content_hints (ClutterInputMethod *method,
ClutterInputContentHintFlags content_hints)
{
ClutterInputMethodPrivate *priv;
priv = clutter_input_method_get_instance_private (method);
priv->content_hints = content_hints;
CLUTTER_INPUT_METHOD_GET_CLASS (method)->update_content_hints (method,
content_hints);
}
static void
set_content_purpose (ClutterInputMethod *method,
ClutterInputContentPurpose content_purpose)
{
ClutterInputMethodPrivate *priv;
priv = clutter_input_method_get_instance_private (method);
priv->content_purpose = content_purpose;
CLUTTER_INPUT_METHOD_GET_CLASS (method)->update_content_purpose (method,
content_purpose);
}
static void
set_can_show_preedit (ClutterInputMethod *method,
gboolean can_show_preedit)
{
ClutterInputMethodPrivate *priv;
priv = clutter_input_method_get_instance_private (method);
priv->can_show_preedit = can_show_preedit;
}
static void
clutter_input_method_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
case PROP_CONTENT_HINTS:
set_content_hints (CLUTTER_INPUT_METHOD (object),
g_value_get_flags (value));
break;
case PROP_CONTENT_PURPOSE:
set_content_purpose (CLUTTER_INPUT_METHOD (object),
g_value_get_enum (value));
break;
case PROP_CAN_SHOW_PREEDIT:
set_can_show_preedit (CLUTTER_INPUT_METHOD (object),
g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_input_method_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterInputMethodPrivate *priv;
ClutterInputMethod *method;
method = CLUTTER_INPUT_METHOD (object);
priv = clutter_input_method_get_instance_private (method);
switch (prop_id)
{
case PROP_CONTENT_HINTS:
g_value_set_flags (value, priv->content_hints);
break;
case PROP_CONTENT_PURPOSE:
g_value_set_enum (value, priv->content_purpose);
break;
case PROP_CAN_SHOW_PREEDIT:
g_value_set_boolean (value, priv->can_show_preedit);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_input_method_class_init (ClutterInputMethodClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = clutter_input_method_set_property;
object_class->get_property = clutter_input_method_get_property;
signals[COMMIT] =
g_signal_new ("commit",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 1, G_TYPE_STRING);
signals[DELETE_SURROUNDING] =
g_signal_new ("delete-surrounding",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
signals[REQUEST_SURROUNDING] =
g_signal_new ("request-surrounding",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[INPUT_PANEL_STATE] =
g_signal_new ("input-panel-state",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 1,
CLUTTER_TYPE_INPUT_PANEL_STATE);
pspecs[PROP_CONTENT_HINTS] =
g_param_spec_flags ("content-hints",
P_("Content hints"),
P_("Content hints"),
CLUTTER_TYPE_INPUT_CONTENT_HINT_FLAGS, 0,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
pspecs[PROP_CONTENT_PURPOSE] =
g_param_spec_enum ("content-purpose",
P_("Content purpose"),
P_("Content purpose"),
CLUTTER_TYPE_INPUT_CONTENT_PURPOSE, 0,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
pspecs[PROP_CAN_SHOW_PREEDIT] =
g_param_spec_boolean ("can-show-preedit",
P_("Can show preedit"),
P_("Can show preedit"),
FALSE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, pspecs);
}
static void
clutter_input_method_init (ClutterInputMethod *method)
{
}
void
clutter_input_method_focus_in (ClutterInputMethod *method,
ClutterInputFocus *focus)
{
ClutterInputMethodPrivate *priv;
ClutterInputMethodClass *klass;
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (method));
g_return_if_fail (CLUTTER_IS_INPUT_FOCUS (focus));
priv = clutter_input_method_get_instance_private (method);
if (priv->focus == focus)
return;
if (priv->focus)
clutter_input_method_focus_out (method);
g_set_object (&priv->focus, focus);
if (focus)
{
klass = CLUTTER_INPUT_METHOD_GET_CLASS (method);
klass->focus_in (method, focus);
g_signal_emit_by_name (priv->focus, "focus-in", method);
}
}
void
clutter_input_method_focus_out (ClutterInputMethod *method)
{
ClutterInputMethodPrivate *priv;
ClutterInputMethodClass *klass;
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (method));
priv = clutter_input_method_get_instance_private (method);
if (!priv->focus)
return;
g_signal_emit_by_name (priv->focus, "focus-out");
g_clear_object (&priv->focus);
klass = CLUTTER_INPUT_METHOD_GET_CLASS (method);
klass->focus_out (method);
g_signal_emit (method, signals[INPUT_PANEL_STATE],
0, CLUTTER_INPUT_PANEL_STATE_OFF);
}
/**
* clutter_input_method_get_focus:
* @method: the #ClutterInputMethod
*
* Retrieves the current focus of the input method, or %NULL
* if there is none.
*
* Returns: (transfer none) (nullable): the current focus
**/
ClutterInputFocus *
clutter_input_method_get_focus (ClutterInputMethod *method)
{
ClutterInputMethodPrivate *priv;
priv = clutter_input_method_get_instance_private (method);
return priv->focus;
}
void
clutter_input_method_commit (ClutterInputMethod *method,
const gchar *text)
{
ClutterInputMethodPrivate *priv;
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (method));
priv = clutter_input_method_get_instance_private (method);
if (priv->focus)
g_signal_emit_by_name (priv->focus, "commit", text);
}
void
clutter_input_method_delete_surrounding (ClutterInputMethod *method,
guint offset,
guint len)
{
ClutterInputMethodPrivate *priv;
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (method));
priv = clutter_input_method_get_instance_private (method);
if (priv->focus)
g_signal_emit_by_name (priv->focus, "delete-surrounding", offset, len);
}
void
clutter_input_method_request_surrounding (ClutterInputMethod *method)
{
ClutterInputMethodPrivate *priv;
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (method));
priv = clutter_input_method_get_instance_private (method);
if (priv->focus)
g_signal_emit_by_name (priv->focus, "request-surrounding");
}
/**
* clutter_input_method_set_preedit_text:
* @method: a #ClutterInputMethod
* @preedit: (nullable): the preedit text, or %NULL
*
* Sets the preedit text on the current input focus.
**/
void
clutter_input_method_set_preedit_text (ClutterInputMethod *method,
const gchar *preedit,
guint cursor)
{
ClutterInputMethodPrivate *priv;
g_return_if_fail (CLUTTER_IS_INPUT_METHOD (method));
priv = clutter_input_method_get_instance_private (method);
if (priv->focus)
g_signal_emit_by_name (priv->focus, "set-preedit-text", preedit, cursor);
}
void
clutter_input_method_notify_key_event (ClutterInputMethod *method,
const ClutterEvent *event,
gboolean filtered)
{
if (!filtered)
{
ClutterEvent *copy;
/* XXX: we rely on the IM implementation to notify back of
* key events in the exact same order they were given.
*/
copy = clutter_event_copy (event);
clutter_event_set_flags (copy, clutter_event_get_flags (event) |
CLUTTER_EVENT_FLAG_INPUT_METHOD);
clutter_event_put (copy);
clutter_event_free (copy);
}
}

View File

@ -1,89 +0,0 @@
/*
* Copyright (C) 2017 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Author: Carlos Garnacho <carlosg@gnome.org>
*/
#ifndef __CLUTTER_INPUT_METHOD_H__
#define __CLUTTER_INPUT_METHOD_H__
#include <clutter/clutter.h>
#define CLUTTER_TYPE_INPUT_METHOD (clutter_input_method_get_type ())
CLUTTER_AVAILABLE_IN_MUTTER
G_DECLARE_DERIVABLE_TYPE (ClutterInputMethod, clutter_input_method,
CLUTTER, INPUT_METHOD, GObject)
typedef struct _ClutterInputMethodClass ClutterInputMethodClass;
struct _ClutterInputMethodClass
{
GObjectClass parent_class;
void (* focus_in) (ClutterInputMethod *method,
ClutterInputFocus *actor);
void (* focus_out) (ClutterInputMethod *method);
void (* reset) (ClutterInputMethod *method);
void (* set_cursor_location) (ClutterInputMethod *method,
const ClutterRect *rect);
void (* set_surrounding) (ClutterInputMethod *method,
const gchar *text,
guint cursor,
guint anchor);
void (* update_content_hints) (ClutterInputMethod *method,
ClutterInputContentHintFlags hint);
void (* update_content_purpose) (ClutterInputMethod *method,
ClutterInputContentPurpose purpose);
gboolean (* filter_key_event) (ClutterInputMethod *method,
const ClutterEvent *key);
};
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_method_focus_in (ClutterInputMethod *method,
ClutterInputFocus *focus);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_method_focus_out (ClutterInputMethod *method);
CLUTTER_AVAILABLE_IN_MUTTER
ClutterInputFocus * clutter_input_method_get_focus (ClutterInputMethod *method);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_method_commit (ClutterInputMethod *method,
const gchar *text);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_method_delete_surrounding (ClutterInputMethod *method,
guint offset,
guint len);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_method_request_surrounding (ClutterInputMethod *method);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_method_set_preedit_text (ClutterInputMethod *method,
const gchar *preedit,
guint cursor);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_input_method_notify_key_event (ClutterInputMethod *method,
const ClutterEvent *event,
gboolean filtered);
#endif /* __CLUTTER_INPUT_METHOD_H__ */

View File

@ -719,8 +719,14 @@ clutter_get_text_direction (void)
}
else
{
/* Re-use GTK+'s LTR/RTL handling */
const char *e = g_dgettext ("gtk30", "default:LTR");
/* Translators: Leave this UNTRANSLATED if your language is
* left-to-right. If your language is right-to-left
* (e.g. Hebrew, Arabic), translate it to "default:RTL".
*
* Do NOT translate it to non-English e.g. "predefinito:LTR"! If
* it isn't default:LTR or default:RTL it will not work.
*/
char *e = _("default:LTR");
if (strcmp (e, "default:RTL") == 0)
dir = CLUTTER_TEXT_DIRECTION_RTL;
@ -2089,21 +2095,6 @@ emit_keyboard_event (ClutterEvent *event,
}
}
static inline void
process_key_event (ClutterEvent *event,
ClutterInputDevice *device)
{
ClutterInputDeviceClass *device_class = CLUTTER_INPUT_DEVICE_GET_CLASS (device);
if (device_class->process_kbd_a11y_event)
{
device_class->process_kbd_a11y_event (event, device, emit_keyboard_event);
return;
}
emit_keyboard_event (event, device);
}
static gboolean
is_off_stage (ClutterActor *stage,
gfloat x,
@ -2191,7 +2182,7 @@ _clutter_process_event_details (ClutterActor *stage,
}
}
process_key_event (event, device);
emit_keyboard_event (event, device);
}
break;

View File

@ -17,14 +17,12 @@ VOID:BOXED,FLAGS
VOID:INT
VOID:INT64,INT64,FLOAT,BOOLEAN
VOID:INT,INT
VOID:INT,POINTER
VOID:FLOAT,FLOAT
VOID:INT,INT,INT,INT
VOID:OBJECT
VOID:OBJECT,FLAGS
VOID:OBJECT,FLOAT,FLOAT
VOID:OBJECT,FLOAT,FLOAT,FLAGS
VOID:OBJECT,OBJECT
VOID:OBJECT,PARAM
VOID:OBJECT,POINTER
VOID:OBJECT,UINT

View File

@ -40,12 +40,6 @@ gboolean _clutter_get_sync_to_vblank (void);
CLUTTER_AVAILABLE_IN_MUTTER
int64_t clutter_stage_get_frame_counter (ClutterStage *stage);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_stage_capture_into (ClutterStage *stage,
gboolean paint,
cairo_rectangle_int_t *rect,
uint8_t *data);
#undef __CLUTTER_H_INSIDE__
#endif /* __CLUTTER_MUTTER_H__ */

View File

@ -77,7 +77,9 @@ struct _ClutterSettings
guint password_hint_time;
gint window_scaling_factor;
gint unscaled_font_dpi;
guint fixed_scaling_factor : 1;
};
struct _ClutterSettingsClass
@ -110,6 +112,7 @@ enum
PROP_PASSWORD_HINT_TIME,
PROP_WINDOW_SCALING_FACTOR,
PROP_UNSCALED_FONT_DPI,
PROP_LAST
@ -352,6 +355,14 @@ clutter_settings_set_property (GObject *gobject,
self->password_hint_time = g_value_get_uint (value);
break;
case PROP_WINDOW_SCALING_FACTOR:
if (!self->fixed_scaling_factor)
{
self->window_scaling_factor = g_value_get_int (value);
self->fixed_scaling_factor = TRUE;
}
break;
case PROP_UNSCALED_FONT_DPI:
self->font_dpi = g_value_get_int (value);
settings_update_resolution (self);
@ -371,7 +382,14 @@ clutter_settings_set_property_internal (ClutterSettings *self,
property = g_intern_string (property);
if (property == I_("window-scaling-factor") &&
self->fixed_scaling_factor)
return;
g_object_set_property (G_OBJECT (self), property, value);
if (property == I_("window-scaling-factor"))
self->fixed_scaling_factor = FALSE;
}
static void
@ -428,6 +446,10 @@ clutter_settings_get_property (GObject *gobject,
g_value_set_uint (value, self->password_hint_time);
break;
case PROP_WINDOW_SCALING_FACTOR:
g_value_set_int (value, self->window_scaling_factor);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -655,6 +677,14 @@ clutter_settings_class_init (ClutterSettingsClass *klass)
500,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_WINDOW_SCALING_FACTOR] =
g_param_spec_int ("window-scaling-factor",
P_("Window Scaling Factor"),
P_("The scaling factor to be applied to windows"),
1, G_MAXINT,
1,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_FONTCONFIG_TIMESTAMP] =
g_param_spec_uint ("fontconfig-timestamp",
P_("Fontconfig configuration timestamp"),
@ -692,6 +722,8 @@ clutter_settings_class_init (ClutterSettingsClass *klass)
static void
clutter_settings_init (ClutterSettings *self)
{
const char *scale_str;
self->resolution = -1.0;
self->font_dpi = -1;
@ -710,6 +742,18 @@ clutter_settings_init (ClutterSettings *self)
self->xft_rgba = NULL;
self->long_press_duration = 500;
/* if the scaling factor was set by the environment we ignore
* any explicit setting
*/
scale_str = g_getenv ("CLUTTER_SCALE");
if (scale_str != NULL)
{
self->window_scaling_factor = atol (scale_str);
self->fixed_scaling_factor = TRUE;
}
else
self->window_scaling_factor = 1;
}
/**

View File

@ -20,7 +20,6 @@
#include "clutter/clutter-stage-view.h"
#include <cairo-gobject.h>
#include <math.h>
enum
{
@ -28,8 +27,6 @@ enum
PROP_LAYOUT,
PROP_FRAMEBUFFER,
PROP_OFFSCREEN,
PROP_SCALE,
PROP_LAST
};
@ -39,12 +36,7 @@ static GParamSpec *obj_props[PROP_LAST];
typedef struct _ClutterStageViewPrivate
{
cairo_rectangle_int_t layout;
float scale;
CoglFramebuffer *framebuffer;
CoglOffscreen *offscreen;
CoglPipeline *pipeline;
guint dirty_viewport : 1;
guint dirty_projection : 1;
} ClutterStageViewPrivate;
@ -63,18 +55,6 @@ clutter_stage_view_get_layout (ClutterStageView *view,
CoglFramebuffer *
clutter_stage_view_get_framebuffer (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
if (priv->offscreen)
return priv->offscreen;
else
return priv->framebuffer;
}
CoglFramebuffer *
clutter_stage_view_get_onscreen (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
@ -82,77 +62,6 @@ clutter_stage_view_get_onscreen (ClutterStageView *view)
return priv->framebuffer;
}
static void
clutter_stage_view_ensure_offscreen_blit_pipeline (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
ClutterStageViewClass *view_class =
CLUTTER_STAGE_VIEW_GET_CLASS (view);
g_assert (priv->offscreen != NULL);
if (priv->pipeline)
return;
priv->pipeline =
cogl_pipeline_new (cogl_framebuffer_get_context (priv->offscreen));
cogl_pipeline_set_layer_filters (priv->pipeline, 0,
COGL_PIPELINE_FILTER_NEAREST,
COGL_PIPELINE_FILTER_NEAREST);
cogl_pipeline_set_layer_texture (priv->pipeline, 0,
cogl_offscreen_get_texture (priv->offscreen));
cogl_pipeline_set_layer_wrap_mode (priv->pipeline, 0,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
if (view_class->setup_offscreen_blit_pipeline)
view_class->setup_offscreen_blit_pipeline (view, priv->pipeline);
}
void
clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
g_clear_pointer (&priv->pipeline, cogl_object_unref);
}
void
clutter_stage_view_blit_offscreen (ClutterStageView *view,
const cairo_rectangle_int_t *rect)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
CoglMatrix matrix;
clutter_stage_view_ensure_offscreen_blit_pipeline (view);
cogl_framebuffer_push_matrix (priv->framebuffer);
/* Set transform so 0,0 is on the top left corner and 1,1 on
* the bottom right corner.
*/
cogl_matrix_init_identity (&matrix);
cogl_matrix_translate (&matrix, -1, 1, 0);
cogl_matrix_scale (&matrix, 2, -2, 0);
cogl_framebuffer_set_projection_matrix (priv->framebuffer, &matrix);
cogl_framebuffer_draw_rectangle (priv->framebuffer,
priv->pipeline,
0, 0, 1, 1);
cogl_framebuffer_pop_matrix (priv->framebuffer);
}
float
clutter_stage_view_get_scale (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
return priv->scale;
}
gboolean
clutter_stage_view_is_dirty_viewport (ClutterStageView *view)
{
@ -191,35 +100,6 @@ clutter_stage_view_set_dirty_projection (ClutterStageView *view,
priv->dirty_projection = dirty;
}
void
clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
CoglMatrix *matrix)
{
ClutterStageViewClass *view_class = CLUTTER_STAGE_VIEW_GET_CLASS (view);
view_class->get_offscreen_transformation_matrix (view, matrix);
}
void
clutter_stage_view_transform_to_onscreen (ClutterStageView *view,
gfloat *x,
gfloat *y)
{
gfloat z = 0, w = 1;
CoglMatrix matrix;
clutter_stage_view_get_offscreen_transformation_matrix (view, &matrix);
cogl_matrix_get_inverse (&matrix, &matrix);
cogl_matrix_transform_point (&matrix, x, y, &z, &w);
}
static void
clutter_stage_default_get_offscreen_transformation_matrix (ClutterStageView *view,
CoglMatrix *matrix)
{
cogl_matrix_init_identity (matrix);
}
static void
clutter_stage_view_get_property (GObject *object,
guint prop_id,
@ -238,14 +118,6 @@ clutter_stage_view_get_property (GObject *object,
case PROP_FRAMEBUFFER:
g_value_set_boxed (value, priv->framebuffer);
break;
case PROP_OFFSCREEN:
g_value_set_boxed (value, priv->offscreen);
break;
case PROP_SCALE:
g_value_set_float (value, priv->scale);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
@ -267,30 +139,8 @@ clutter_stage_view_set_property (GObject *object,
priv->layout = *layout;
break;
case PROP_FRAMEBUFFER:
priv->framebuffer = g_value_dup_boxed (value);
#ifndef G_DISABLE_CHECKS
if (priv->framebuffer)
{
int fb_width, fb_height;
fb_width = cogl_framebuffer_get_width (priv->framebuffer);
fb_height = cogl_framebuffer_get_height (priv->framebuffer);
g_warn_if_fail (fabsf (roundf (fb_width / priv->scale) -
fb_width / priv->scale) < FLT_EPSILON);
g_warn_if_fail (fabsf (roundf (fb_height / priv->scale) -
fb_height / priv->scale) < FLT_EPSILON);
}
#endif
priv->framebuffer = g_value_get_boxed (value);
break;
case PROP_OFFSCREEN:
priv->offscreen = g_value_dup_boxed (value);
break;
case PROP_SCALE:
priv->scale = g_value_get_float (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
@ -302,21 +152,11 @@ clutter_stage_view_dispose (GObject *object)
clutter_stage_view_get_instance_private (view);
g_clear_pointer (&priv->framebuffer, cogl_object_unref);
g_clear_pointer (&priv->offscreen, cogl_object_unref);
g_clear_pointer (&priv->pipeline, cogl_object_unref);
G_OBJECT_CLASS (clutter_stage_view_parent_class)->dispose (object);
}
static void
clutter_stage_view_init (ClutterStageView *view)
{
ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view);
priv->dirty_viewport = TRUE;
priv->dirty_projection = TRUE;
priv->scale = 1.0;
}
static void
@ -324,9 +164,6 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
klass->get_offscreen_transformation_matrix =
clutter_stage_default_get_offscreen_transformation_matrix;
object_class->get_property = clutter_stage_view_get_property;
object_class->set_property = clutter_stage_view_set_property;
object_class->dispose = clutter_stage_view_dispose;
@ -337,34 +174,14 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
"The view layout on the screen",
CAIRO_GOBJECT_TYPE_RECTANGLE_INT,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_FRAMEBUFFER] =
g_param_spec_boxed ("framebuffer",
"View framebuffer",
"The front buffer of the view",
"The framebuffer of the view",
COGL_TYPE_HANDLE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_OFFSCREEN] =
g_param_spec_boxed ("offscreen",
"Offscreen buffer",
"Framebuffer used as intermediate buffer",
COGL_TYPE_HANDLE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_SCALE] =
g_param_spec_float ("scale",
"View scale",
"The view scale",
0.5, G_MAXFLOAT, 1.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, PROP_LAST, obj_props);

View File

@ -33,12 +33,6 @@ G_DECLARE_DERIVABLE_TYPE (ClutterStageView, clutter_stage_view,
struct _ClutterStageViewClass
{
GObjectClass parent_class;
void (* setup_offscreen_blit_pipeline) (ClutterStageView *view,
CoglPipeline *pipeline);
void (* get_offscreen_transformation_matrix) (ClutterStageView *view,
CoglMatrix *matrix);
};
CLUTTER_AVAILABLE_IN_MUTTER
@ -47,21 +41,6 @@ void clutter_stage_view_get_layout (ClutterStageView *view,
CLUTTER_AVAILABLE_IN_MUTTER
CoglFramebuffer *clutter_stage_view_get_framebuffer (ClutterStageView *view);
CLUTTER_AVAILABLE_IN_MUTTER
CoglFramebuffer *clutter_stage_view_get_onscreen (ClutterStageView *view);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_stage_view_transform_to_onscreen (ClutterStageView *view,
gfloat *x,
gfloat *y);
void clutter_stage_view_blit_offscreen (ClutterStageView *view,
const cairo_rectangle_int_t *clip);
CLUTTER_AVAILABLE_IN_MUTTER
float clutter_stage_view_get_scale (ClutterStageView *view);
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
@ -73,8 +52,4 @@ gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
gboolean dirty);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
CoglMatrix *matrix);
#endif /* __CLUTTER_STAGE_VIEW_H__ */

View File

@ -303,6 +303,33 @@ _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window)
return FALSE;
}
void
_clutter_stage_window_set_scale_factor (ClutterStageWindow *window,
int factor)
{
ClutterStageWindowIface *iface;
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->set_scale_factor != NULL)
iface->set_scale_factor (window, factor);
}
int
_clutter_stage_window_get_scale_factor (ClutterStageWindow *window)
{
ClutterStageWindowIface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), 1);
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->get_scale_factor != NULL)
return iface->get_scale_factor (window);
return 1;
}
GList *
_clutter_stage_window_get_views (ClutterStageWindow *window)
{

View File

@ -83,6 +83,9 @@ struct _ClutterStageWindowIface
gboolean (* can_clip_redraws) (ClutterStageWindow *stage_window);
void (* set_scale_factor) (ClutterStageWindow *stage_window,
int factor);
int (* get_scale_factor) (ClutterStageWindow *stage_window);
GList *(* get_views) (ClutterStageWindow *stage_window);
int64_t (* get_frame_counter) (ClutterStageWindow *stage_window);
void (* finish_frame) (ClutterStageWindow *stage_window);
@ -137,6 +140,10 @@ void _clutter_stage_window_get_dirty_pixel (ClutterStageWin
gboolean _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window);
void _clutter_stage_window_set_scale_factor (ClutterStageWindow *window,
int factor);
int _clutter_stage_window_get_scale_factor (ClutterStageWindow *window);
GList * _clutter_stage_window_get_views (ClutterStageWindow *window);
void _clutter_stage_window_finish_frame (ClutterStageWindow *window);

View File

@ -161,7 +161,6 @@ struct _ClutterStagePrivate
guint accept_focus : 1;
guint motion_events_enabled : 1;
guint has_custom_perspective : 1;
guint stage_was_relayout : 1;
};
enum
@ -365,6 +364,7 @@ clutter_stage_allocate (ClutterActor *self,
float new_width, new_height;
float width, height;
cairo_rectangle_int_t window_size;
int scale_factor;
if (priv->impl == NULL)
return;
@ -465,6 +465,11 @@ clutter_stage_allocate (ClutterActor *self,
*/
_clutter_stage_window_get_geometry (priv->impl, &window_size);
scale_factor = _clutter_stage_window_get_scale_factor (priv->impl);
window_size.width *= scale_factor;
window_size.height *= scale_factor;
cogl_onscreen_clutter_backend_set_size (window_size.width,
window_size.height);
@ -625,13 +630,15 @@ clutter_stage_do_paint_view (ClutterStage *stage,
float clip_poly[8];
float viewport[4];
cairo_rectangle_int_t geom;
int window_scale;
_clutter_stage_window_get_geometry (priv->impl, &geom);
window_scale = _clutter_stage_window_get_scale_factor (priv->impl);
viewport[0] = priv->viewport[0];
viewport[1] = priv->viewport[1];
viewport[2] = priv->viewport[2];
viewport[3] = priv->viewport[3];
viewport[0] = priv->viewport[0] * window_scale;
viewport[1] = priv->viewport[1] * window_scale;
viewport[2] = priv->viewport[2] * window_scale;
viewport[3] = priv->viewport[3] * window_scale;
if (!clip)
{
@ -639,14 +646,16 @@ clutter_stage_do_paint_view (ClutterStage *stage,
clip = &view_layout;
}
clip_poly[0] = MAX (clip->x, 0);
clip_poly[1] = MAX (clip->y, 0);
clip_poly[0] = MAX (clip->x * window_scale, 0);
clip_poly[1] = MAX (clip->y * window_scale, 0);
clip_poly[2] = MIN (clip->x + clip->width, geom.width);
clip_poly[2] = MIN ((clip->x + clip->width) * window_scale,
geom.width * window_scale);
clip_poly[3] = clip_poly[1];
clip_poly[4] = clip_poly[2];
clip_poly[5] = MIN (clip->y + clip->height, geom.height);
clip_poly[5] = MIN ((clip->y + clip->height) * window_scale,
geom.height * window_scale);
clip_poly[6] = clip_poly[0];
clip_poly[7] = clip_poly[5];
@ -962,7 +971,6 @@ _clutter_stage_process_queued_events (ClutterStage *stage)
ClutterEvent *next_event;
ClutterInputDevice *device;
ClutterInputDevice *next_device;
ClutterInputDeviceType device_type;
gboolean check_device = FALSE;
event = l->data;
@ -978,16 +986,8 @@ _clutter_stage_process_queued_events (ClutterStage *stage)
if (device != NULL && next_device != NULL)
check_device = TRUE;
device_type = clutter_input_device_get_device_type (device);
/* Skip consecutive motion events coming from the same device,
* except those of tablet tools, since users of these events
* want no precision loss.
*/
if (priv->throttle_motion_events && next_event != NULL &&
device_type != CLUTTER_TABLET_DEVICE &&
device_type != CLUTTER_PEN_DEVICE &&
device_type != CLUTTER_ERASER_DEVICE)
/* Skip consecutive motion events coming from the same device */
if (priv->throttle_motion_events && next_event != NULL)
{
if (event->type == CLUTTER_MOTION &&
(next_event->type == CLUTTER_MOTION ||
@ -998,16 +998,6 @@ _clutter_stage_process_queued_events (ClutterStage *stage)
"Omitting motion event at %d, %d",
(int) event->motion.x,
(int) event->motion.y);
if (next_event->type == CLUTTER_MOTION)
{
ClutterDeviceManager *device_manager =
clutter_device_manager_get_default ();
_clutter_device_manager_compress_motion (device_manager,
next_event, event);
}
goto next_event;
}
else if (event->type == CLUTTER_TOUCH_UPDATE &&
@ -1069,7 +1059,6 @@ _clutter_stage_maybe_relayout (ClutterActor *actor)
if (!CLUTTER_ACTOR_IN_RELAYOUT (stage))
{
priv->relayout_pending = FALSE;
priv->stage_was_relayout = TRUE;
CLUTTER_NOTE (ACTOR, "Recomputing layout");
@ -1140,58 +1129,6 @@ clutter_stage_do_redraw (ClutterStage *stage)
stage);
}
static GSList *
_clutter_stage_check_updated_pointers (ClutterStage *stage)
{
ClutterStagePrivate *priv = stage->priv;
ClutterDeviceManager *device_manager;
GSList *updating = NULL;
const GSList *devices;
cairo_rectangle_int_t clip;
ClutterPoint point;
gboolean has_clip;
has_clip = _clutter_stage_window_get_redraw_clip_bounds (priv->impl, &clip);
device_manager = clutter_device_manager_get_default ();
devices = clutter_device_manager_peek_devices (device_manager);
for (; devices != NULL; devices = devices->next)
{
ClutterInputDevice *dev = devices->data;
if (clutter_input_device_get_device_mode (dev) !=
CLUTTER_INPUT_MODE_MASTER)
continue;
switch (clutter_input_device_get_device_type (dev))
{
case CLUTTER_POINTER_DEVICE:
case CLUTTER_TABLET_DEVICE:
case CLUTTER_PEN_DEVICE:
case CLUTTER_ERASER_DEVICE:
case CLUTTER_CURSOR_DEVICE:
if (!clutter_input_device_get_coords (dev, NULL, &point))
continue;
if (!has_clip ||
(point.x >= clip.x && point.x < clip.x + clip.width &&
point.y >= clip.y && point.y < clip.y + clip.height))
updating = g_slist_prepend (updating, dev);
break;
default:
/* Any other devices don't need checking, either because they
* don't have x/y coordinates, or because they're implicitly
* grabbed on an actor by default as it's the case of
* touch(screens).
*/
break;
}
}
return updating;
}
/**
* _clutter_stage_do_update:
* @stage: A #ClutterStage
@ -1204,10 +1141,6 @@ gboolean
_clutter_stage_do_update (ClutterStage *stage)
{
ClutterStagePrivate *priv = stage->priv;
gboolean stage_was_relayout = priv->stage_was_relayout;
GSList *pointers = NULL;
priv->stage_was_relayout = FALSE;
/* if the stage is being destroyed, or if the destruction already
* happened and we don't have an StageWindow any more, then we
@ -1228,9 +1161,6 @@ _clutter_stage_do_update (ClutterStage *stage)
if (!priv->redraw_pending)
return FALSE;
if (stage_was_relayout)
pointers = _clutter_stage_check_updated_pointers (stage);
clutter_stage_maybe_finish_queue_redraws (stage);
clutter_stage_do_redraw (stage);
@ -1248,12 +1178,6 @@ _clutter_stage_do_update (ClutterStage *stage)
}
#endif /* CLUTTER_ENABLE_DEBUG */
while (pointers)
{
_clutter_input_device_update (pointers->data, NULL, TRUE);
pointers = g_slist_delete_link (pointers, pointers);
}
return TRUE;
}
@ -1444,19 +1368,19 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
gint dirty_y;
gint read_x;
gint read_y;
int window_scale;
float fb_width, fb_height;
float fb_scale;
float viewport_offset_x;
float viewport_offset_y;
int viewport_offset_x;
int viewport_offset_y;
priv = stage->priv;
context = _clutter_context_get_default ();
fb_scale = clutter_stage_view_get_scale (view);
window_scale = _clutter_stage_window_get_scale_factor (priv->impl);
clutter_stage_view_get_layout (view, &view_layout);
fb_width = view_layout.width * fb_scale;
fb_height = view_layout.height * fb_scale;
fb_width = view_layout.width;
fb_height = view_layout.height;
cogl_push_framebuffer (fb);
/* needed for when a context switch happens */
@ -1466,38 +1390,40 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
* picking to not work at all, so setting it the whole framebuffer content
* for now. */
cogl_framebuffer_push_scissor_clip (fb, 0, 0,
view_layout.width * fb_scale,
view_layout.height * fb_scale);
view_layout.width,
view_layout.height);
_clutter_stage_window_get_dirty_pixel (priv->impl, view, &dirty_x, &dirty_y);
dirty_x -= view_layout.x;
dirty_y -= view_layout.y;
if (G_LIKELY (!(clutter_pick_debug_flags & CLUTTER_DEBUG_DUMP_PICK_BUFFERS)))
{
CLUTTER_NOTE (PICK, "Pushing pick scissor clip x: %d, y: %d, 1x1",
(int) dirty_x * fb_scale,
(int) dirty_y * fb_scale);
cogl_framebuffer_push_scissor_clip (fb, dirty_x * fb_scale, dirty_y * fb_scale, 1, 1);
dirty_x * window_scale,
dirty_y * window_scale);
cogl_framebuffer_push_scissor_clip (fb, dirty_x * window_scale, dirty_y * window_scale, 1, 1);
}
viewport_offset_x = x * fb_scale - dirty_x * fb_scale;
viewport_offset_y = y * fb_scale - dirty_y * fb_scale;
viewport_offset_x = x * window_scale - dirty_x * window_scale;
viewport_offset_y = y * window_scale - dirty_y * window_scale;
CLUTTER_NOTE (PICK, "Setting viewport to %f, %f, %f, %f",
priv->viewport[0] * fb_scale - viewport_offset_x,
priv->viewport[1] * fb_scale - viewport_offset_y,
priv->viewport[2] * fb_scale,
priv->viewport[3] * fb_scale);
cogl_set_viewport (priv->viewport[0] * fb_scale - viewport_offset_x,
priv->viewport[1] * fb_scale - viewport_offset_y,
priv->viewport[2] * fb_scale,
priv->viewport[3] * fb_scale);
priv->viewport[0] * window_scale - viewport_offset_x,
priv->viewport[1] * window_scale - viewport_offset_y,
priv->viewport[2] * window_scale,
priv->viewport[3] * window_scale);
cogl_set_viewport (priv->viewport[0] * window_scale - viewport_offset_x,
priv->viewport[1] * window_scale - viewport_offset_y,
priv->viewport[2] * window_scale,
priv->viewport[3] * window_scale);
read_x = dirty_x * fb_scale;
read_y = dirty_y * fb_scale;
read_x = dirty_x * window_scale;
read_y = dirty_y * window_scale;
CLUTTER_NOTE (PICK, "Performing pick at %i,%i on view %dx%d+%d+%d s: %d",
CLUTTER_NOTE (PICK, "Performing pick at %i,%i on view %dx%d+%d+%d",
x, y,
view_layout.width, view_layout.height,
view_layout.x, view_layout.y, fb_scale);
view_layout.x, view_layout.y);
cogl_color_init_from_4ub (&stage_pick_id, 255, 255, 255, 255);
cogl_clear (&stage_pick_id, COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH);
@ -1520,10 +1446,10 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
used. The format is requested as pre-multiplied because Cogl
assumes that all pixels in the framebuffer are premultiplied so
it avoids a conversion. */
cogl_framebuffer_read_pixels (fb,
read_x, read_y, 1, 1,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
pixel);
cogl_read_pixels (read_x, read_y, 1, 1,
COGL_READ_PIXELS_COLOR_BUFFER,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
pixel);
if (G_UNLIKELY (clutter_pick_debug_flags & CLUTTER_DEBUG_DUMP_PICK_BUFFERS))
{
@ -2252,8 +2178,8 @@ clutter_stage_class_init (ClutterStageClass *klass)
g_signal_new (I_("presented"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
_clutter_marshal_VOID__INT_POINTER,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 2,
G_TYPE_INT, G_TYPE_POINTER);
@ -2276,6 +2202,7 @@ clutter_stage_init (ClutterStage *self)
ClutterStagePrivate *priv;
ClutterStageWindow *impl;
ClutterBackend *backend;
int window_scale = 1;
GError *error;
/* a stage is a top-level object */
@ -2293,6 +2220,7 @@ clutter_stage_init (ClutterStage *self)
{
_clutter_stage_set_window (self, impl);
_clutter_stage_window_get_geometry (priv->impl, &geom);
window_scale = _clutter_stage_window_get_scale_factor (priv->impl);
}
else
{
@ -2346,8 +2274,8 @@ clutter_stage_init (ClutterStage *self)
priv->perspective.aspect,
priv->perspective.z_near,
50, /* distance to 2d plane */
geom.width,
geom.height);
geom.width * window_scale,
geom.height * window_scale);
/* FIXME - remove for 2.0 */
@ -3476,6 +3404,16 @@ clutter_stage_ensure_viewport (ClutterStage *stage)
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
}
static void
clutter_stage_apply_scale (ClutterStage *stage)
{
int factor;
factor = _clutter_stage_window_get_scale_factor (stage->priv->impl);
if (factor != 1)
cogl_matrix_scale (&stage->priv->view, factor, factor, 1.f);
}
# define _DEG_TO_RAD(d) ((d) * ((float) G_PI / 180.0f))
/* This calculates a distance into the view frustum to position the
@ -3622,9 +3560,9 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
{
cairo_rectangle_int_t view_layout;
ClutterPerspective perspective;
float fb_scale;
float viewport_offset_x;
float viewport_offset_y;
int window_scale;
int viewport_offset_x;
int viewport_offset_y;
float z_2d;
CLUTTER_NOTE (PAINT,
@ -3632,15 +3570,15 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
priv->viewport[2],
priv->viewport[3]);
fb_scale = clutter_stage_view_get_scale (view);
window_scale = _clutter_stage_window_get_scale_factor (priv->impl);
clutter_stage_view_get_layout (view, &view_layout);
viewport_offset_x = view_layout.x * fb_scale;
viewport_offset_y = view_layout.y * fb_scale;
cogl_set_viewport (priv->viewport[0] * fb_scale - viewport_offset_x,
priv->viewport[1] * fb_scale - viewport_offset_y,
priv->viewport[2] * fb_scale,
priv->viewport[3] * fb_scale);
viewport_offset_x = view_layout.x * window_scale;
viewport_offset_y = view_layout.y * window_scale;
cogl_set_viewport (priv->viewport[0] * window_scale - viewport_offset_x,
priv->viewport[1] * window_scale - viewport_offset_y,
priv->viewport[2] * window_scale,
priv->viewport[3] * window_scale);
perspective = priv->perspective;
@ -3671,8 +3609,10 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
perspective.aspect,
perspective.z_near,
z_2d,
priv->viewport[2],
priv->viewport[3]);
priv->viewport[2] * window_scale,
priv->viewport[3] * window_scale);
clutter_stage_apply_scale (stage);
clutter_stage_view_set_dirty_viewport (view, FALSE);
}
@ -4687,6 +4627,23 @@ clutter_stage_skip_sync_delay (ClutterStage *stage)
_clutter_stage_window_schedule_update (stage_window, -1);
}
void
_clutter_stage_set_scale_factor (ClutterStage *stage,
int factor)
{
ClutterStagePrivate *priv = stage->priv;
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
return;
if (priv->impl == NULL)
return;
_clutter_stage_window_set_scale_factor (priv->impl, factor);
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
}
int64_t
clutter_stage_get_frame_counter (ClutterStage *stage)
{
@ -4719,23 +4676,18 @@ capture_view (ClutterStage *stage,
uint8_t *data;
int stride;
CoglBitmap *bitmap;
cairo_rectangle_int_t view_layout;
float view_scale;
framebuffer = clutter_stage_view_get_framebuffer (view);
if (paint)
{
cogl_push_framebuffer (framebuffer);
_clutter_stage_maybe_setup_viewport (stage, view);
cogl_push_framebuffer (framebuffer);
clutter_stage_do_paint_view (stage, view, rect);
}
view_scale = clutter_stage_view_get_scale (view);
image = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
rect->width * view_scale,
rect->height * view_scale);
cairo_surface_set_device_scale (image, view_scale, view_scale);
rect->width, rect->height);
data = cairo_image_surface_get_data (image);
stride = cairo_image_surface_get_stride (image);
@ -4743,17 +4695,13 @@ capture_view (ClutterStage *stage,
backend = clutter_get_default_backend ();
context = clutter_backend_get_cogl_context (backend);
bitmap = cogl_bitmap_new_for_data (context,
rect->width * view_scale,
rect->height * view_scale,
rect->width, rect->height,
CLUTTER_CAIRO_FORMAT_ARGB32,
stride,
data);
clutter_stage_view_get_layout (view, &view_layout);
cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
(rect->x - view_layout.x) * view_scale,
(rect->y - view_layout.y) * view_scale,
rect->x, rect->y,
COGL_READ_PIXELS_COLOR_BUFFER,
bitmap);
@ -4810,93 +4758,3 @@ clutter_stage_capture (ClutterStage *stage,
return TRUE;
}
static void
capture_view_into (ClutterStage *stage,
gboolean paint,
ClutterStageView *view,
cairo_rectangle_int_t *rect,
uint8_t *data,
int stride)
{
CoglFramebuffer *framebuffer;
ClutterBackend *backend;
CoglContext *context;
CoglBitmap *bitmap;
cairo_rectangle_int_t view_layout;
framebuffer = clutter_stage_view_get_framebuffer (view);
if (paint)
{
cogl_push_framebuffer (framebuffer);
_clutter_stage_maybe_setup_viewport (stage, view);
clutter_stage_do_paint_view (stage, view, rect);
}
backend = clutter_get_default_backend ();
context = clutter_backend_get_cogl_context (backend);
bitmap = cogl_bitmap_new_for_data (context,
rect->width, rect->height,
CLUTTER_CAIRO_FORMAT_ARGB32,
stride,
data);
clutter_stage_view_get_layout (view, &view_layout);
cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
rect->x - view_layout.x,
rect->y - view_layout.y,
COGL_READ_PIXELS_COLOR_BUFFER,
bitmap);
if (paint)
cogl_pop_framebuffer ();
cogl_object_unref (bitmap);
}
static ClutterStageView *
get_view_at_rect (ClutterStage *stage,
cairo_rectangle_int_t *rect)
{
ClutterStagePrivate *priv = stage->priv;
GList *views = _clutter_stage_window_get_views (priv->impl);
GList *l;
for (l = views; l; l = l->next)
{
ClutterStageView *view = l->data;
cairo_rectangle_int_t view_layout;
cairo_region_t *region;
cairo_rectangle_int_t view_capture_rect;
clutter_stage_view_get_layout (view, &view_layout);
region = cairo_region_create_rectangle (&view_layout);
cairo_region_intersect_rectangle (region, rect);
cairo_region_get_extents (region, &view_capture_rect);
cairo_region_destroy (region);
if (view_capture_rect.width == 0 || view_capture_rect.height == 0)
continue;
g_assert (view_capture_rect.width == rect->width &&
view_capture_rect.height == rect->height);
return view;
}
return NULL;
}
void
clutter_stage_capture_into (ClutterStage *stage,
gboolean paint,
cairo_rectangle_int_t *rect,
uint8_t *data)
{
ClutterStageView *view;
int bpp = 4;
view = get_view_at_rect (stage, rect);
capture_view_into (stage, paint, view, rect, data, rect->width * bpp);
}

View File

@ -63,7 +63,6 @@
#include "clutter-units.h"
#include "clutter-paint-volume-private.h"
#include "clutter-scriptable.h"
#include "clutter-input-focus.h"
/* cursor width in pixels */
#define DEFAULT_CURSOR_SIZE 2
@ -177,9 +176,6 @@ struct _ClutterTextPrivate
/* Signal handler for when the :text-direction changes */
guint direction_changed_id;
ClutterInputContentHintFlags input_hints;
ClutterInputContentPurpose input_purpose;
/* bitfields */
guint alignment : 2;
guint wrap : 1;
@ -240,8 +236,6 @@ enum
PROP_SINGLE_LINE_MODE,
PROP_SELECTED_TEXT_COLOR,
PROP_SELECTED_TEXT_COLOR_SET,
PROP_INPUT_HINTS,
PROP_INPUT_PURPOSE,
PROP_LAST
};
@ -275,7 +269,6 @@ static const ClutterColor default_selected_text_color = { 0, 0, 0, 255 };
static ClutterAnimatableIface *parent_animatable_iface = NULL;
static ClutterScriptableIface *parent_scriptable_iface = NULL;
static void clutter_input_focus_iface_init (ClutterInputFocusInterface *iface);
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
static void clutter_animatable_iface_init (ClutterAnimatableIface *iface);
@ -283,91 +276,11 @@ G_DEFINE_TYPE_WITH_CODE (ClutterText,
clutter_text,
CLUTTER_TYPE_ACTOR,
G_ADD_PRIVATE (ClutterText)
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_INPUT_FOCUS,
clutter_input_focus_iface_init)
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
clutter_scriptable_iface_init)
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_ANIMATABLE,
clutter_animatable_iface_init));
static void
clutter_text_input_focus_request_surrounding (ClutterInputFocus *focus)
{
ClutterText *clutter_text = CLUTTER_TEXT (focus);
ClutterTextBuffer *buffer;
const gchar *text;
gint anchor_pos, cursor_pos;
buffer = clutter_text_get_buffer (clutter_text);
text = clutter_text_buffer_get_text (buffer);
cursor_pos = clutter_text_get_cursor_position (clutter_text);
if (cursor_pos < 0)
cursor_pos = clutter_text_buffer_get_length (buffer);
anchor_pos = clutter_text_get_selection_bound (clutter_text);
if (anchor_pos < 0)
anchor_pos = cursor_pos;
clutter_input_focus_set_surrounding (focus, text,
g_utf8_offset_to_pointer (text, cursor_pos) - text,
g_utf8_offset_to_pointer (text, anchor_pos) - text);
}
static void
clutter_text_input_focus_delete_surrounding (ClutterInputFocus *focus,
guint offset,
guint len)
{
ClutterText *clutter_text = CLUTTER_TEXT (focus);
if (clutter_text_get_editable (clutter_text))
clutter_text_delete_text (clutter_text, offset, len);
}
static void
clutter_text_input_focus_commit_text (ClutterInputFocus *focus,
const gchar *text)
{
ClutterText *clutter_text = CLUTTER_TEXT (focus);
if (clutter_text_get_editable (clutter_text))
{
clutter_text_delete_selection (clutter_text);
clutter_text_insert_text (clutter_text, text,
clutter_text_get_cursor_position (clutter_text));
}
}
static void
clutter_text_input_focus_set_preedit_text (ClutterInputFocus *focus,
const gchar *preedit_text,
guint cursor_pos)
{
ClutterText *clutter_text = CLUTTER_TEXT (focus);
if (clutter_text_get_editable (clutter_text))
{
PangoAttrList *list;
list = pango_attr_list_new ();
pango_attr_list_insert (list, pango_attr_underline_new (PANGO_UNDERLINE_SINGLE));
clutter_text_set_preedit_string (clutter_text,
preedit_text, list,
cursor_pos);
pango_attr_list_unref (list);
}
}
static void
clutter_input_focus_iface_init (ClutterInputFocusInterface *iface)
{
iface->request_surrounding = clutter_text_input_focus_request_surrounding;
iface->delete_surrounding = clutter_text_input_focus_delete_surrounding;
iface->commit_text = clutter_text_input_focus_commit_text;
iface->set_preedit_text = clutter_text_input_focus_set_preedit_text;
}
static inline void
clutter_text_dirty_paint_volume (ClutterText *text)
{
@ -1096,22 +1009,6 @@ clutter_text_position_to_coords (ClutterText *self,
return TRUE;
}
static inline void
update_cursor_location (ClutterText *self)
{
ClutterTextPrivate *priv = self->priv;
ClutterRect rect;
float x, y;
if (!priv->editable)
return;
rect = priv->cursor_rect;
clutter_actor_get_transformed_position (CLUTTER_ACTOR (self), &x, &y);
clutter_rect_offset (&rect, x, y);
clutter_input_focus_set_cursor_location (CLUTTER_INPUT_FOCUS (self), &rect);
}
static inline void
clutter_text_ensure_cursor_position (ClutterText *self)
{
@ -1160,8 +1057,6 @@ clutter_text_ensure_cursor_position (ClutterText *self)
g_signal_emit (self, text_signals[CURSOR_EVENT], 0, &cursor_pos);
g_signal_emit (self, text_signals[CURSOR_CHANGED], 0);
update_cursor_location (self);
}
}
@ -1964,7 +1859,6 @@ clutter_text_press (ClutterActor *actor,
return CLUTTER_EVENT_PROPAGATE;
clutter_actor_grab_key_focus (actor);
clutter_input_focus_request_toggle_input_panel (CLUTTER_INPUT_FOCUS (self));
/* if the actor is empty we just reset everything and not
* set up the dragging of the selection since there's nothing
@ -2191,11 +2085,9 @@ clutter_text_key_press (ClutterActor *actor,
g_assert (pool != NULL);
/* we allow passing synthetic events that only contain
* the Unicode value and not the key symbol, unless they
* contain the input method flag.
* the Unicode value and not the key symbol
*/
if (event->keyval == 0 && (event->flags & CLUTTER_EVENT_FLAG_SYNTHETIC) &&
!(event->flags & CLUTTER_EVENT_FLAG_INPUT_METHOD))
if (event->keyval == 0 && (event->flags & CLUTTER_EVENT_FLAG_SYNTHETIC))
res = FALSE;
else
res = clutter_binding_pool_activate (pool, event->keyval,
@ -2213,9 +2105,6 @@ clutter_text_key_press (ClutterActor *actor,
{
gunichar key_unichar;
if (clutter_input_focus_filter_key_event (CLUTTER_INPUT_FOCUS (actor), event))
return CLUTTER_EVENT_STOP;
/* Skip keys when control is pressed */
key_unichar = clutter_event_get_key_unicode ((ClutterEvent *) event);
@ -2252,16 +2141,6 @@ clutter_text_key_press (ClutterActor *actor,
return CLUTTER_EVENT_PROPAGATE;
}
static gboolean
clutter_text_key_release (ClutterActor *actor,
ClutterKeyEvent *event)
{
if (clutter_input_focus_filter_key_event (CLUTTER_INPUT_FOCUS (actor), event))
return CLUTTER_EVENT_STOP;
return CLUTTER_EVENT_PROPAGATE;
}
static void
clutter_text_compute_layout_offsets (ClutterText *self,
PangoLayout *layout,
@ -2785,9 +2664,6 @@ clutter_text_key_focus_in (ClutterActor *actor)
{
ClutterTextPrivate *priv = CLUTTER_TEXT (actor)->priv;
if (priv->editable)
clutter_input_focus_focus_in (CLUTTER_INPUT_FOCUS (actor));
priv->has_focus = TRUE;
clutter_text_queue_redraw (actor);
@ -2800,9 +2676,6 @@ clutter_text_key_focus_out (ClutterActor *actor)
priv->has_focus = FALSE;
if (priv->editable)
clutter_input_focus_focus_out (CLUTTER_INPUT_FOCUS (actor));
clutter_text_queue_redraw (actor);
}
@ -3496,7 +3369,6 @@ clutter_text_class_init (ClutterTextClass *klass)
actor_class->get_preferred_height = clutter_text_get_preferred_height;
actor_class->allocate = clutter_text_allocate;
actor_class->key_press_event = clutter_text_key_press;
actor_class->key_release_event = clutter_text_key_release;
actor_class->button_press_event = clutter_text_button_press;
actor_class->button_release_event = clutter_text_button_release;
actor_class->motion_event = clutter_text_motion;
@ -3997,22 +3869,6 @@ clutter_text_class_init (ClutterTextClass *klass)
obj_props[PROP_SELECTED_TEXT_COLOR_SET] = pspec;
g_object_class_install_property (gobject_class, PROP_SELECTED_TEXT_COLOR_SET, pspec);
pspec = g_param_spec_flags ("input-hints",
P_("Input hints"),
P_("Input hints"),
CLUTTER_TYPE_INPUT_CONTENT_HINT_FLAGS,
0, CLUTTER_PARAM_READWRITE);
obj_props[PROP_INPUT_HINTS] = pspec;
g_object_class_install_property (gobject_class, PROP_INPUT_HINTS, pspec);
pspec = g_param_spec_enum ("input-purpose",
P_("Input purpose"),
P_("Input purpose"),
CLUTTER_TYPE_INPUT_CONTENT_PURPOSE,
0, CLUTTER_PARAM_READWRITE);
obj_props[PROP_INPUT_PURPOSE] = pspec;
g_object_class_install_property (gobject_class, PROP_INPUT_PURPOSE, pspec);
/**
* ClutterText::text-changed:
* @self: the #ClutterText that emitted the signal
@ -4613,11 +4469,6 @@ clutter_text_set_editable (ClutterText *self,
{
priv->editable = editable;
if (!priv->editable)
clutter_input_focus_focus_out (CLUTTER_INPUT_FOCUS (self));
else if (priv->has_focus)
clutter_input_focus_focus_in (CLUTTER_INPUT_FOCUS (self));
clutter_text_queue_redraw (CLUTTER_ACTOR (self));
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_EDITABLE]);
@ -6447,49 +6298,3 @@ clutter_text_get_cursor_rect (ClutterText *self,
*rect = self->priv->cursor_rect;
}
void
clutter_text_set_input_hints (ClutterText *self,
ClutterInputContentHintFlags hints)
{
g_return_if_fail (CLUTTER_IS_TEXT (self));
self->priv->input_hints = hints;
clutter_input_focus_set_content_hints (CLUTTER_INPUT_FOCUS (self), hints);
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_INPUT_HINTS]);
}
ClutterInputContentHintFlags
clutter_text_get_input_hints (ClutterText *self)
{
g_return_val_if_fail (CLUTTER_IS_TEXT (self), 0);
return self->priv->input_hints;
}
void
clutter_text_set_input_purpose (ClutterText *self,
ClutterInputContentPurpose purpose)
{
g_return_if_fail (CLUTTER_IS_TEXT (self));
self->priv->input_purpose = purpose;
clutter_input_focus_set_content_purpose (CLUTTER_INPUT_FOCUS (self), purpose);
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_INPUT_PURPOSE]);
}
ClutterInputContentPurpose
clutter_text_get_input_purpose (ClutterText *self)
{
g_return_val_if_fail (CLUTTER_IS_TEXT (self), 0);
return self->priv->input_purpose;
}
gboolean
clutter_text_has_preedit (ClutterText *self)
{
g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE);
return self->priv->preedit_set;
}

View File

@ -302,20 +302,6 @@ void clutter_text_get_layout_offsets (ClutterText *
gint *x,
gint *y);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_text_set_input_hints (ClutterText *self,
ClutterInputContentHintFlags hints);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_text_set_input_purpose (ClutterText *self,
ClutterInputContentPurpose purpose);
CLUTTER_AVAILABLE_IN_MUTTER
ClutterInputContentHintFlags clutter_text_get_input_hints (ClutterText *self);
CLUTTER_AVAILABLE_IN_MUTTER
ClutterInputContentPurpose clutter_text_get_input_purpose (ClutterText *self);
CLUTTER_AVAILABLE_IN_MUTTER
gboolean clutter_text_has_preedit (ClutterText *self);
G_END_DECLS
#endif /* __CLUTTER_TEXT_H__ */

View File

@ -95,10 +95,6 @@ typedef struct _ClutterState ClutterState;
typedef struct _ClutterInputDeviceTool ClutterInputDeviceTool;
typedef struct _ClutterInputDevice ClutterInputDevice;
typedef struct _ClutterVirtualInputDevice ClutterVirtualInputDevice;
typedef struct _ClutterInputMethod ClutterInputMethod;
typedef struct _ClutterInputFocus ClutterInputFocus;
typedef CoglMatrix ClutterMatrix;

View File

@ -312,7 +312,7 @@ G_BEGIN_DECLS
*
* Since: 1.2
*/
extern const guint clutter_major_version;
const guint clutter_major_version;
/**
* clutter_minor_version:
@ -326,7 +326,7 @@ extern const guint clutter_major_version;
*
* Since: 1.2
*/
extern const guint clutter_minor_version;
const guint clutter_minor_version;
/**
* clutter_micro_version:
@ -340,7 +340,7 @@ extern const guint clutter_minor_version;
*
* Since: 1.2
*/
extern const guint clutter_micro_version;
const guint clutter_micro_version;
G_END_DECLS

View File

@ -1,235 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2016 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Jonas Ådahl <jadahl@gmail.com>
*/
#ifdef HAVE_CONFIG_H
#include "clutter-build-config.h"
#endif
#include <glib-object.h>
#include "clutter-virtual-input-device.h"
#include "clutter-device-manager.h"
#include "clutter-private.h"
#include "clutter-enum-types.h"
enum
{
PROP_0,
PROP_DEVICE_MANAGER,
PROP_DEVICE_TYPE,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
typedef struct _ClutterVirtualInputDevicePrivate
{
ClutterDeviceManager *manager;
ClutterInputDeviceType device_type;
} ClutterVirtualInputDevicePrivate;
G_DEFINE_TYPE_WITH_PRIVATE (ClutterVirtualInputDevice,
clutter_virtual_input_device,
G_TYPE_OBJECT)
void
clutter_virtual_input_device_notify_relative_motion (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
double dx,
double dy)
{
ClutterVirtualInputDeviceClass *klass =
CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
klass->notify_relative_motion (virtual_device, time_us, dx, dy);
}
void
clutter_virtual_input_device_notify_absolute_motion (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
double x,
double y)
{
ClutterVirtualInputDeviceClass *klass =
CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
klass->notify_absolute_motion (virtual_device, time_us, x, y);
}
void
clutter_virtual_input_device_notify_button (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t button,
ClutterButtonState button_state)
{
ClutterVirtualInputDeviceClass *klass =
CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
klass->notify_button (virtual_device, time_us, button, button_state);
}
void
clutter_virtual_input_device_notify_key (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t key,
ClutterKeyState key_state)
{
ClutterVirtualInputDeviceClass *klass =
CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
klass->notify_key (virtual_device, time_us, key, key_state);
}
void
clutter_virtual_input_device_notify_keyval (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t keyval,
ClutterKeyState key_state)
{
ClutterVirtualInputDeviceClass *klass =
CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
klass->notify_keyval (virtual_device, time_us, keyval, key_state);
}
void
clutter_virtual_input_device_notify_discrete_scroll (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
ClutterScrollDirection direction,
ClutterScrollSource scroll_source)
{
ClutterVirtualInputDeviceClass *klass =
CLUTTER_VIRTUAL_INPUT_DEVICE_GET_CLASS (virtual_device);
klass->notify_discrete_scroll (virtual_device, time_us,
direction, scroll_source);
}
/**
* clutter_virtual_input_device_get_manager:
* @virtual_device: a virtual device
*
* Gets the device manager of this virtual device.
*
* Returns: (transfer none): The #ClutterDeviceManager of this virtual device
**/
ClutterDeviceManager *
clutter_virtual_input_device_get_manager (ClutterVirtualInputDevice *virtual_device)
{
ClutterVirtualInputDevicePrivate *priv =
clutter_virtual_input_device_get_instance_private (virtual_device);
return priv->manager;
}
int
clutter_virtual_input_device_get_device_type (ClutterVirtualInputDevice *virtual_device)
{
ClutterVirtualInputDevicePrivate *priv =
clutter_virtual_input_device_get_instance_private (virtual_device);
return priv->device_type;
}
static void
clutter_virtual_input_device_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterVirtualInputDevice *virtual_device =
CLUTTER_VIRTUAL_INPUT_DEVICE (object);
ClutterVirtualInputDevicePrivate *priv =
clutter_virtual_input_device_get_instance_private (virtual_device);
switch (prop_id)
{
case PROP_DEVICE_MANAGER:
g_value_set_object (value, priv->manager);
break;
case PROP_DEVICE_TYPE:
g_value_set_enum (value, priv->device_type);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_virtual_input_device_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterVirtualInputDevice *virtual_device =
CLUTTER_VIRTUAL_INPUT_DEVICE (object);
ClutterVirtualInputDevicePrivate *priv =
clutter_virtual_input_device_get_instance_private (virtual_device);
switch (prop_id)
{
case PROP_DEVICE_MANAGER:
priv->manager = g_value_get_object (value);
break;
case PROP_DEVICE_TYPE:
priv->device_type = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_virtual_input_device_init (ClutterVirtualInputDevice *virtual_device)
{
}
static void
clutter_virtual_input_device_class_init (ClutterVirtualInputDeviceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = clutter_virtual_input_device_get_property;
object_class->set_property = clutter_virtual_input_device_set_property;
obj_props[PROP_DEVICE_MANAGER] =
g_param_spec_object ("device-manager",
P_("Device Manager"),
P_("The device manager instance"),
CLUTTER_TYPE_DEVICE_MANAGER,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
obj_props[PROP_DEVICE_TYPE] =
g_param_spec_enum ("device-type",
P_("Device type"),
P_("Device type"),
CLUTTER_TYPE_INPUT_DEVICE_TYPE,
CLUTTER_POINTER_DEVICE,
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
}

View File

@ -1,128 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2016 Red Hat inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Jonas Ådahl <jadahl@gmail.com>
*/
#ifndef __CLUTTER_VIRTUAL_INPUT_DEVICE_H__
#define __CLUTTER_VIRTUAL_INPUT_DEVICE_H__
#include <glib-object.h>
#include <stdint.h>
#include "clutter-device-manager.h"
#define CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE (clutter_virtual_input_device_get_type ())
CLUTTER_AVAILABLE_IN_ALL
G_DECLARE_DERIVABLE_TYPE (ClutterVirtualInputDevice,
clutter_virtual_input_device,
CLUTTER, VIRTUAL_INPUT_DEVICE,
GObject)
typedef enum _ClutterButtonState
{
CLUTTER_BUTTON_STATE_RELEASED,
CLUTTER_BUTTON_STATE_PRESSED
} ClutterButtonState;
typedef enum _ClutterKeyState
{
CLUTTER_KEY_STATE_RELEASED,
CLUTTER_KEY_STATE_PRESSED
} ClutterKeyState;
struct _ClutterVirtualInputDeviceClass
{
GObjectClass parent_class;
void (*notify_relative_motion) (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
double dx,
double dy);
void (*notify_absolute_motion) (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
double x,
double y);
void (*notify_button) (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t button,
ClutterButtonState button_state);
void (*notify_key) (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t key,
ClutterKeyState key_state);
void (*notify_keyval) (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t keyval,
ClutterKeyState key_state);
void (*notify_discrete_scroll) (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
ClutterScrollDirection direction,
ClutterScrollSource scroll_source);
};
CLUTTER_AVAILABLE_IN_ALL
void clutter_virtual_input_device_notify_relative_motion (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
double dx,
double dy);
CLUTTER_AVAILABLE_IN_ALL
void clutter_virtual_input_device_notify_absolute_motion (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
double x,
double y);
CLUTTER_AVAILABLE_IN_ALL
void clutter_virtual_input_device_notify_button (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t button,
ClutterButtonState button_state);
CLUTTER_AVAILABLE_IN_ALL
void clutter_virtual_input_device_notify_key (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t key,
ClutterKeyState key_state);
CLUTTER_AVAILABLE_IN_ALL
void clutter_virtual_input_device_notify_keyval (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t keyval,
ClutterKeyState key_state);
CLUTTER_AVAILABLE_IN_ALL
void clutter_virtual_input_device_notify_discrete_scroll (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
ClutterScrollDirection direction,
ClutterScrollSource scroll_source);
CLUTTER_AVAILABLE_IN_ALL
ClutterDeviceManager * clutter_virtual_input_device_get_manager (ClutterVirtualInputDevice *virtual_device);
int clutter_virtual_input_device_get_device_type (ClutterVirtualInputDevice *virtual_device);
#endif /* __CLUTTER_VIRTUAL_INPUT_DEVICE_H__ */

View File

@ -72,8 +72,6 @@
#include "clutter-image.h"
#include "clutter-input-device.h"
#include "clutter-input-device-tool.h"
#include "clutter-input-method.h"
#include "clutter-input-focus.h"
#include "clutter-interval.h"
#include "clutter-keyframe-transition.h"
#include "clutter-keysyms.h"
@ -109,7 +107,6 @@
#include "clutter-transition.h"
#include "clutter-units.h"
#include "clutter-version.h"
#include "clutter-virtual-input-device.h"
#include "clutter-zoom-action.h"
#include "clutter-deprecated.h"

View File

@ -37,7 +37,6 @@
#include "clutter-stage-cogl.h"
#include <stdlib.h>
#include <math.h>
#include "clutter-actor-private.h"
#include "clutter-backend-private.h"
@ -51,9 +50,7 @@
typedef struct _ClutterStageViewCoglPrivate
{
/*
* List of previous damaged areas in stage view framebuffer coordinate space.
*/
/* Stores a list of previous damaged areas in the stage coordinate space */
#define DAMAGE_HISTORY_MAX 16
#define DAMAGE_HISTORY(x) ((x) & (DAMAGE_HISTORY_MAX - 1))
cairo_rectangle_int_t damage_history[DAMAGE_HISTORY_MAX];
@ -360,7 +357,7 @@ swap_framebuffer (ClutterStageWindow *stage_window,
cairo_rectangle_int_t *swap_region,
gboolean swap_with_damage)
{
CoglFramebuffer *framebuffer = clutter_stage_view_get_onscreen (view);
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
int damage[4], ndamage;
damage[0] = swap_region->x;
@ -422,12 +419,6 @@ paint_stage (ClutterStageCogl *stage_cogl,
_clutter_stage_maybe_setup_viewport (stage, view);
_clutter_stage_paint_view (stage, view, clip);
if (clutter_stage_view_get_onscreen (view) !=
clutter_stage_view_get_framebuffer (view))
{
clutter_stage_view_blit_offscreen (view, clip);
}
}
static void
@ -437,93 +428,16 @@ fill_current_damage_history_and_step (ClutterStageView *view)
ClutterStageViewCoglPrivate *view_priv =
clutter_stage_view_cogl_get_instance_private (view_cogl);
cairo_rectangle_int_t view_rect;
float fb_scale;
cairo_rectangle_int_t *current_fb_damage;
cairo_rectangle_int_t *current_damage;
current_fb_damage =
current_damage =
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index)];
clutter_stage_view_get_layout (view, &view_rect);
fb_scale = clutter_stage_view_get_scale (view);
*current_fb_damage = (cairo_rectangle_int_t) {
.x = 0,
.y = 0,
.width = view_rect.width * fb_scale,
.height = view_rect.height * fb_scale
};
*current_damage = view_rect;
view_priv->damage_index++;
}
static void
transform_swap_region_to_onscreen (ClutterStageView *view,
cairo_rectangle_int_t *swap_region)
{
CoglFramebuffer *framebuffer;
cairo_rectangle_int_t layout;
gfloat x1, y1, x2, y2;
gint width, height;
framebuffer = clutter_stage_view_get_onscreen (view);
clutter_stage_view_get_layout (view, &layout);
x1 = (float) swap_region->x / layout.width;
y1 = (float) swap_region->y / layout.height;
x2 = (float) (swap_region->x + swap_region->width) / layout.width;
y2 = (float) (swap_region->y + swap_region->height) / layout.height;
clutter_stage_view_transform_to_onscreen (view, &x1, &y1);
clutter_stage_view_transform_to_onscreen (view, &x2, &y2);
width = cogl_framebuffer_get_width (framebuffer);
height = cogl_framebuffer_get_height (framebuffer);
x1 = floor (x1 * width);
y1 = floor (height - (y1 * height));
x2 = ceil (x2 * width);
y2 = ceil (height - (y2 * height));
*swap_region = (cairo_rectangle_int_t) {
.x = x1,
.y = y1,
.width = x2 - x1,
.height = y2 - y1
};
}
static void
calculate_scissor_region (cairo_rectangle_int_t *fb_clip_region,
int subpixel_compensation,
int fb_width,
int fb_height,
cairo_rectangle_int_t *out_scissor_rect)
{
int scissor_x;
int scissor_y;
int scissor_width;
int scissor_height;
scissor_x = fb_clip_region->x;
scissor_y = fb_clip_region->y;
scissor_width = fb_clip_region->width;
scissor_height = fb_clip_region->height;
if (fb_clip_region->x > 0)
scissor_x += subpixel_compensation;
if (fb_clip_region->y > 0)
scissor_y += subpixel_compensation;
if (fb_clip_region->x + fb_clip_region->width < fb_width)
scissor_width -= 2 * subpixel_compensation;
if (fb_clip_region->y + fb_clip_region->height < fb_height)
scissor_height -= 2 * subpixel_compensation;
*out_scissor_rect = (cairo_rectangle_int_t) {
.x = scissor_x,
.y = scissor_y,
.width = scissor_width,
.height = scissor_height
};
}
static gboolean
clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
ClutterStageView *view)
@ -544,18 +458,13 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
ClutterActor *wrapper;
cairo_rectangle_int_t redraw_clip;
cairo_rectangle_int_t swap_region;
cairo_rectangle_int_t fb_clip_region;
cairo_rectangle_int_t clip_region;
gboolean clip_region_empty;
float fb_scale;
int subpixel_compensation = 0;
int fb_width, fb_height;
int window_scale;
wrapper = CLUTTER_ACTOR (stage_cogl->wrapper);
clutter_stage_view_get_layout (view, &view_rect);
fb_scale = clutter_stage_view_get_scale (view);
fb_width = cogl_framebuffer_get_width (fb);
fb_height = cogl_framebuffer_get_height (fb);
can_blit_sub_buffer =
cogl_is_onscreen (fb) &&
@ -590,24 +499,11 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3)
{
may_use_clipped_redraw = TRUE;
if (fb_scale != floorf (fb_scale))
subpixel_compensation = ceilf (fb_scale);
fb_clip_region = (cairo_rectangle_int_t) {
.x = (floorf ((redraw_clip.x - view_rect.x) * fb_scale) -
subpixel_compensation),
.y = (floorf ((redraw_clip.y - view_rect.y) * fb_scale) -
subpixel_compensation),
.width = (ceilf (redraw_clip.width * fb_scale) +
(2 * subpixel_compensation)),
.height = (ceilf (redraw_clip.height * fb_scale) +
(2 * subpixel_compensation))
};
clip_region = redraw_clip;
}
else
{
fb_clip_region = (cairo_rectangle_int_t) { 0 };
clip_region = (cairo_rectangle_int_t){ 0 };
}
if (may_use_clipped_redraw &&
@ -616,7 +512,9 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
else
use_clipped_redraw = FALSE;
clip_region_empty = may_use_clipped_redraw && fb_clip_region.width == 0;
clip_region_empty = may_use_clipped_redraw && clip_region.width == 0;
window_scale = _clutter_stage_window_get_scale_factor (stage_window);
swap_with_damage = FALSE;
if (has_buffer_age)
@ -624,44 +522,34 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
if (use_clipped_redraw && !clip_region_empty)
{
int age, i;
cairo_rectangle_int_t *current_fb_damage =
cairo_rectangle_int_t *current_damage =
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index++)];
age = cogl_onscreen_get_buffer_age (COGL_ONSCREEN (fb));
if (valid_buffer_age (view_cogl, age))
{
cairo_rectangle_int_t damage_region;
*current_fb_damage = fb_clip_region;
*current_damage = clip_region;
for (i = 1; i <= age; i++)
{
cairo_rectangle_int_t *fb_damage =
cairo_rectangle_int_t *damage =
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - i - 1)];
_clutter_util_rectangle_union (&fb_clip_region,
fb_damage,
&fb_clip_region);
_clutter_util_rectangle_union (&clip_region, damage, &clip_region);
}
/* Update the bounding redraw clip state with the extra damage. */
damage_region = (cairo_rectangle_int_t) {
.x = view_rect.x + floorf (fb_clip_region.x / fb_scale),
.y = view_rect.y + floorf (fb_clip_region.y / fb_scale),
.width = ceilf (fb_clip_region.width / fb_scale),
.height = ceilf (fb_clip_region.height / fb_scale)
};
_clutter_util_rectangle_union (&stage_cogl->bounding_redraw_clip,
&damage_region,
&clip_region,
&stage_cogl->bounding_redraw_clip);
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: x=%d, y=%d, width=%d, height=%d\n",
age,
fb_clip_region.x,
fb_clip_region.y,
fb_clip_region.width,
fb_clip_region.height);
clip_region.x,
clip_region.y,
clip_region.width,
clip_region.height);
swap_with_damage = TRUE;
}
@ -669,12 +557,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
{
CLUTTER_NOTE (CLIPPING, "Invalid back buffer(age=%d): forcing full redraw\n", age);
use_clipped_redraw = FALSE;
*current_fb_damage = (cairo_rectangle_int_t) {
.x = 0,
.y = 0,
.width = view_rect.width * fb_scale,
.height = view_rect.height * fb_scale
};
*current_damage = view_rect;
}
}
else if (!use_clipped_redraw)
@ -690,34 +573,26 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
}
else if (use_clipped_redraw)
{
cairo_rectangle_int_t scissor_rect;
calculate_scissor_region (&fb_clip_region,
subpixel_compensation,
fb_width, fb_height,
&scissor_rect);
int scissor_x;
int scissor_y;
CLUTTER_NOTE (CLIPPING,
"Stage clip pushed: x=%d, y=%d, width=%d, height=%d\n",
scissor_rect.x,
scissor_rect.y,
scissor_rect.width,
scissor_rect.height);
clip_region.x,
clip_region.y,
clip_region.width,
clip_region.height);
stage_cogl->using_clipped_redraw = TRUE;
scissor_x = (clip_region.x - view_rect.x) * window_scale;
scissor_y = (clip_region.y - view_rect.y) * window_scale;
cogl_framebuffer_push_scissor_clip (fb,
scissor_rect.x,
scissor_rect.y,
scissor_rect.width,
scissor_rect.height);
paint_stage (stage_cogl, view,
&(cairo_rectangle_int_t) {
.x = view_rect.x + floorf ((fb_clip_region.x - 0) / fb_scale),
.y = view_rect.y + floorf ((fb_clip_region.y - 0) / fb_scale),
.width = ceilf ((fb_clip_region.width + 0) / fb_scale),
.height = ceilf ((fb_clip_region.height + 0) / fb_scale)
});
scissor_x,
scissor_y,
clip_region.width * window_scale,
clip_region.height * window_scale);
paint_stage (stage_cogl, view, &clip_region);
cogl_framebuffer_pop_clip (fb);
stage_cogl->using_clipped_redraw = FALSE;
@ -732,25 +607,17 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
may_use_clipped_redraw &&
!clip_region_empty)
{
cairo_rectangle_int_t scissor_rect;
calculate_scissor_region (&fb_clip_region,
subpixel_compensation,
fb_width, fb_height,
&scissor_rect);
int scissor_x;
int scissor_y;
scissor_x = (clip_region.x - view_rect.x) * window_scale;;
scissor_y = (clip_region.y - view_rect.y) * window_scale;
cogl_framebuffer_push_scissor_clip (fb,
scissor_rect.x,
scissor_rect.y,
scissor_rect.width,
scissor_rect.height);
paint_stage (stage_cogl, view,
&(cairo_rectangle_int_t) {
.x = view_rect.x + floorf (fb_clip_region.x / fb_scale),
.y = view_rect.y + floorf (fb_clip_region.y / fb_scale),
.width = ceilf (fb_clip_region.width / fb_scale),
.height = ceilf (fb_clip_region.height / fb_scale)
});
scissor_x,
scissor_y,
clip_region.width * window_scale,
clip_region.height * window_scale);
paint_stage (stage_cogl, view, &clip_region);
cogl_framebuffer_pop_clip (fb);
}
else
@ -813,7 +680,12 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
}
else if (use_clipped_redraw)
{
swap_region = fb_clip_region;
swap_region = (cairo_rectangle_int_t) {
.x = (clip_region.x - view_rect.x) * window_scale,
.y = (clip_region.y - view_rect.y) * window_scale,
.width = clip_region.width * window_scale,
.height = clip_region.height * window_scale,
};
g_assert (swap_region.width > 0);
do_swap_buffer = TRUE;
}
@ -822,8 +694,8 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
swap_region = (cairo_rectangle_int_t) {
.x = 0,
.y = 0,
.width = view_rect.width * fb_scale,
.height = view_rect.height * fb_scale,
.width = view_rect.width * window_scale,
.height = view_rect.height * window_scale,
};
do_swap_buffer = TRUE;
}
@ -836,12 +708,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
if (do_swap_buffer)
{
if (clutter_stage_view_get_onscreen (view) !=
clutter_stage_view_get_framebuffer (view))
{
transform_swap_region_to_onscreen (view, &swap_region);
}
return swap_framebuffer (stage_window,
view,
&swap_region,
@ -891,29 +757,11 @@ clutter_stage_cogl_get_dirty_pixel (ClutterStageWindow *stage_window,
int *x,
int *y)
{
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
gboolean has_buffer_age =
cogl_is_onscreen (framebuffer) &&
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE);
float fb_scale;
gboolean scale_is_fractional;
cairo_rectangle_int_t *rect;
fb_scale = clutter_stage_view_get_scale (view);
if (fb_scale != floorf (fb_scale))
scale_is_fractional = TRUE;
else
scale_is_fractional = FALSE;
/*
* Buffer damage is tracked in the framebuffer coordinate space
* using the damage history. When fractional scaling is used, a
* coordinate on the stage might not correspond to the exact position of any
* physical pixel, which causes issues when painting using the pick mode.
*
* For now, always use the (0, 0) pixel for picking when using fractional
* framebuffer scaling.
*/
if (!has_buffer_age || scale_is_fractional)
if (!has_buffer_age)
{
*x = 0;
*y = 0;
@ -923,14 +771,10 @@ clutter_stage_cogl_get_dirty_pixel (ClutterStageWindow *stage_window,
ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (view);
ClutterStageViewCoglPrivate *view_priv =
clutter_stage_view_cogl_get_instance_private (view_cogl);
cairo_rectangle_int_t view_layout;
cairo_rectangle_int_t *fb_damage;
clutter_stage_view_get_layout (view, &view_layout);
fb_damage = &view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - 1)];
*x = fb_damage->x / fb_scale;
*y = fb_damage->y / fb_scale;
rect = &view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - 1)];
*x = rect->x;
*y = rect->y;
}
}

View File

@ -48,7 +48,6 @@
#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"
@ -61,8 +60,6 @@ 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);
@ -80,181 +77,9 @@ clutter_backend_egl_native_class_init (ClutterBackendEglNativeClass *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,
FALSE);
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 ();
}

View File

@ -61,9 +61,6 @@ struct _ClutterBackendEglNative
/* event timer */
GTimer *event_timer;
/* "xsettings" is still the defacto place for Xft settings, even in Wayland */
GSettings *xsettings;
};
struct _ClutterBackendEglNativeClass

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,6 @@
#ifndef __CLUTTER_DEVICE_MANAGER_EVDEV_H__
#define __CLUTTER_DEVICE_MANAGER_EVDEV_H__
#include <clutter/clutter-backend.h>
#include <clutter/clutter-device-manager.h>
G_BEGIN_DECLS
@ -40,8 +39,6 @@ typedef struct _ClutterDeviceManagerEvdev ClutterDeviceManagerEvdev;
typedef struct _ClutterDeviceManagerEvdevClass ClutterDeviceManagerEvdevClass;
typedef struct _ClutterDeviceManagerEvdevPrivate ClutterDeviceManagerEvdevPrivate;
typedef struct _ClutterSeatEvdev ClutterSeatEvdev;
struct _ClutterDeviceManagerEvdev
{
ClutterDeviceManager parent_instance;
@ -64,45 +61,6 @@ gint _clutter_device_manager_evdev_acquire_device_id (ClutterDeviceManagerEvdev
void _clutter_device_manager_evdev_release_device_id (ClutterDeviceManagerEvdev *manager_evdev,
ClutterInputDevice *device);
struct xkb_keymap * _clutter_device_manager_evdev_get_keymap (ClutterDeviceManagerEvdev *manager_evdev);
ClutterStage * _clutter_device_manager_evdev_get_stage (ClutterDeviceManagerEvdev *manager_evdev);
void _clutter_device_manager_evdev_constrain_pointer (ClutterDeviceManagerEvdev *manager_evdev,
ClutterInputDevice *core_pointer,
uint64_t time_us,
float x,
float y,
float *new_x,
float *new_y);
void _clutter_device_manager_evdev_filter_relative_motion (ClutterDeviceManagerEvdev *manager_evdev,
ClutterInputDevice *device,
float x,
float y,
float *dx,
float *dy);
void _clutter_device_manager_evdev_dispatch (ClutterDeviceManagerEvdev *manager_evdev);
static inline guint64
us (guint64 us)
{
return us;
}
static inline guint64
ms2us (guint64 ms)
{
return us (ms * 1000);
}
static inline guint32
us2ms (guint64 us)
{
return (guint32) (us / 1000);
}
G_END_DECLS
#endif /* __CLUTTER_DEVICE_MANAGER_EVDEV_H__ */

View File

@ -57,9 +57,6 @@ void clutter_evdev_set_device_callbacks (ClutterOpenDeviceCallback open_callba
ClutterCloseDeviceCallback close_callback,
gpointer user_data);
CLUTTER_AVAILABLE_IN_ALL
void clutter_evdev_set_seat_id (const gchar *seat_id);
CLUTTER_AVAILABLE_IN_1_10
void clutter_evdev_release_devices (void);
CLUTTER_AVAILABLE_IN_1_10
@ -97,18 +94,6 @@ void clutter_evdev_set_pointer_constrain_callback (ClutterDeviceManager
gpointer user_data,
GDestroyNotify user_data_notify);
typedef void (*ClutterRelativeMotionFilter) (ClutterInputDevice *device,
float x,
float y,
float *dx,
float *dy,
gpointer user_data);
CLUTTER_AVAILABLE_IN_MUTTER
void clutter_evdev_set_relative_motion_filter (ClutterDeviceManager *evdev,
ClutterRelativeMotionFilter filter,
gpointer user_data);
CLUTTER_AVAILABLE_IN_1_16
void clutter_evdev_set_keyboard_map (ClutterDeviceManager *evdev,
struct xkb_keymap *keymap);
@ -120,13 +105,6 @@ CLUTTER_AVAILABLE_IN_1_20
void clutter_evdev_set_keyboard_layout_index (ClutterDeviceManager *evdev,
xkb_layout_index_t idx);
CLUTTER_AVAILABLE_IN_MUTTER
xkb_layout_index_t clutter_evdev_get_keyboard_layout_index (ClutterDeviceManager *evdev);
CLUTTER_AVAILABLE_IN_1_26
void clutter_evdev_set_keyboard_numlock (ClutterDeviceManager *evdev,
gboolean numlock_state);
CLUTTER_AVAILABLE_IN_1_18
void clutter_evdev_set_keyboard_repeat (ClutterDeviceManager *evdev,
gboolean repeat,
@ -168,14 +146,6 @@ gboolean clutter_evdev_event_get_relative_motion (const ClutterEvent *event,
double *dx_unaccel,
double *dy_unaccel);
CLUTTER_AVAILABLE_IN_ALL
void clutter_evdev_input_device_tool_set_pressure_curve (ClutterInputDeviceTool *tool,
gdouble curve[4]);
CLUTTER_AVAILABLE_IN_ALL
void clutter_evdev_input_device_tool_set_button_code (ClutterInputDeviceTool *tool,
guint button,
guint evcode);
G_END_DECLS
#endif /* __CLUTTER_EVDEV_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -29,8 +29,7 @@
#include <glib-object.h>
#include <libinput.h>
#include "clutter/clutter-device-manager-private.h"
#include "evdev/clutter-seat-evdev.h"
#include <clutter/clutter-input-device.h>
G_BEGIN_DECLS
@ -57,6 +56,7 @@ G_BEGIN_DECLS
CLUTTER_TYPE_INPUT_DEVICE_EVDEV, ClutterInputDeviceEvdevClass))
typedef struct _ClutterInputDeviceEvdev ClutterInputDeviceEvdev;
typedef struct _ClutterSeatEvdev ClutterSeatEvdev;
typedef struct _ClutterEventEvdev ClutterEventEvdev;
struct _ClutterInputDeviceEvdev
@ -66,33 +66,6 @@ struct _ClutterInputDeviceEvdev
struct libinput_device *libinput_device;
ClutterSeatEvdev *seat;
ClutterInputDeviceTool *last_tool;
cairo_matrix_t device_matrix;
gdouble device_aspect_ratio; /* w:h */
gdouble output_ratio; /* w:h */
/* Keyboard a11y */
ClutterKeyboardA11yFlags a11y_flags;
GList *slow_keys_list;
guint debounce_timer;
guint16 debounce_key;
xkb_mod_mask_t stickykeys_depressed_mask;
xkb_mod_mask_t stickykeys_latched_mask;
xkb_mod_mask_t stickykeys_locked_mask;
guint toggle_slowkeys_timer;
guint16 shift_count;
guint32 last_shift_time;
gint mousekeys_btn;
gboolean mousekeys_btn_states[3];
guint32 mousekeys_first_motion_time; /* ms */
guint32 mousekeys_last_motion_time; /* ms */
guint mousekeys_init_delay;
guint mousekeys_accel_time;
guint mousekeys_max_speed;
gdouble mousekeys_curve_factor;
guint move_mousekeys_timer;
guint16 last_mousekeys_key;
ClutterVirtualInputDevice *mousekeys_virtual_device;
};
GType _clutter_input_device_evdev_get_type (void) G_GNUC_CONST;
@ -103,8 +76,7 @@ ClutterInputDevice * _clutter_input_device_evdev_new (ClutterDe
ClutterInputDevice * _clutter_input_device_evdev_new_virtual (ClutterDeviceManager *manager,
ClutterSeatEvdev *seat,
ClutterInputDeviceType type,
ClutterInputMode mode);
ClutterInputDeviceType type);
ClutterSeatEvdev * _clutter_input_device_evdev_get_seat (ClutterInputDeviceEvdev *device);
@ -129,14 +101,6 @@ void _clutter_evdev_event_set_relative_motion (ClutterEvent *event,
double dx_unaccel,
double dy_unaccel);
void clutter_input_device_evdev_translate_coordinates (ClutterInputDevice *device,
ClutterStage *stage,
gfloat *x,
gfloat *y);
void clutter_input_device_evdev_apply_kbd_a11y_settings (ClutterInputDeviceEvdev *device,
ClutterKbdA11ySettings *settings);
G_END_DECLS
#endif /* __CLUTTER_INPUT_DEVICE_EVDEV_H__ */

View File

@ -26,7 +26,6 @@
#endif
#include "clutter-input-device-tool-evdev.h"
#include "clutter-evdev.h"
G_DEFINE_TYPE (ClutterInputDeviceToolEvdev, clutter_input_device_tool_evdev,
CLUTTER_TYPE_INPUT_DEVICE_TOOL)
@ -36,7 +35,6 @@ clutter_input_device_tool_evdev_finalize (GObject *object)
{
ClutterInputDeviceToolEvdev *tool = CLUTTER_INPUT_DEVICE_TOOL_EVDEV (object);
g_hash_table_unref (tool->button_map);
libinput_tablet_tool_unref (tool->tool);
G_OBJECT_CLASS (clutter_input_device_tool_evdev_parent_class)->finalize (object);
@ -53,7 +51,6 @@ clutter_input_device_tool_evdev_class_init (ClutterInputDeviceToolEvdevClass *kl
static void
clutter_input_device_tool_evdev_init (ClutterInputDeviceToolEvdev *tool)
{
tool->button_map = g_hash_table_new (NULL, NULL);
}
ClutterInputDeviceTool *
@ -73,96 +70,3 @@ clutter_input_device_tool_evdev_new (struct libinput_tablet_tool *tool,
return CLUTTER_INPUT_DEVICE_TOOL (evdev_tool);
}
void
clutter_evdev_input_device_tool_set_pressure_curve (ClutterInputDeviceTool *tool,
gdouble curve[4])
{
ClutterInputDeviceToolEvdev *evdev_tool;
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE_TOOL_EVDEV (tool));
g_return_if_fail (curve[0] >= 0 && curve[0] <= 1 &&
curve[1] >= 0 && curve[1] <= 1 &&
curve[2] >= 0 && curve[2] <= 1 &&
curve[3] >= 0 && curve[3] <= 1);
evdev_tool = CLUTTER_INPUT_DEVICE_TOOL_EVDEV (tool);
evdev_tool->pressure_curve[0] = curve[0];
evdev_tool->pressure_curve[1] = curve[1];
evdev_tool->pressure_curve[2] = curve[2];
evdev_tool->pressure_curve[3] = curve[3];
}
void
clutter_evdev_input_device_tool_set_button_code (ClutterInputDeviceTool *tool,
guint button,
guint evcode)
{
ClutterInputDeviceToolEvdev *evdev_tool;
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE_TOOL_EVDEV (tool));
evdev_tool = CLUTTER_INPUT_DEVICE_TOOL_EVDEV (tool);
if (evcode == 0)
{
g_hash_table_remove (evdev_tool->button_map, GUINT_TO_POINTER (button));
}
else
{
g_hash_table_insert (evdev_tool->button_map, GUINT_TO_POINTER (button),
GUINT_TO_POINTER (evcode));
}
}
static gdouble
calculate_bezier_position (gdouble pos,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2)
{
gdouble int1_y, int2_y;
pos = CLAMP (pos, 0, 1);
/* Intersection between 0,0 and x1,y1 */
int1_y = pos * y1;
/* Intersection between x2,y2 and 1,1 */
int2_y = (pos * (1 - y2)) + y2;
/* Find the new position in the line traced by the previous points */
return (pos * (int2_y - int1_y)) + int1_y;
}
gdouble
clutter_input_device_tool_evdev_translate_pressure (ClutterInputDeviceTool *tool,
gdouble pressure)
{
ClutterInputDeviceToolEvdev *evdev_tool;
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE_TOOL (tool), pressure);
evdev_tool = CLUTTER_INPUT_DEVICE_TOOL_EVDEV (tool);
return calculate_bezier_position (CLAMP (pressure, 0, 1),
evdev_tool->pressure_curve[0],
evdev_tool->pressure_curve[1],
evdev_tool->pressure_curve[2],
evdev_tool->pressure_curve[3]);
}
guint
clutter_input_device_tool_evdev_get_button_code (ClutterInputDeviceTool *tool,
guint button)
{
ClutterInputDeviceToolEvdev *evdev_tool;
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE_TOOL (tool), 0);
evdev_tool = CLUTTER_INPUT_DEVICE_TOOL_EVDEV (tool);
return GPOINTER_TO_UINT (g_hash_table_lookup (evdev_tool->button_map,
GUINT_TO_POINTER (button)));
}

View File

@ -59,8 +59,6 @@ struct _ClutterInputDeviceToolEvdev
{
ClutterInputDeviceTool parent_instance;
struct libinput_tablet_tool *tool;
GHashTable *button_map;
gdouble pressure_curve[4];
};
struct _ClutterInputDeviceToolEvdevClass
@ -74,11 +72,6 @@ ClutterInputDeviceTool * clutter_input_device_tool_evdev_new (struct libinp
guint64 serial,
ClutterInputDeviceToolType type);
gdouble clutter_input_device_tool_evdev_translate_pressure (ClutterInputDeviceTool *tool,
gdouble pressure);
guint clutter_input_device_tool_evdev_get_button_code (ClutterInputDeviceTool *tool,
guint button);
G_END_DECLS
#endif /* __CLUTTER_INPUT_DEVICE_EVDEV_TOOL_H__ */

View File

@ -1,802 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2010 Intel Corp.
* Copyright (C) 2014 Jonas Ådahl
* Copyright (C) 2016 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Damien Lespiau <damien.lespiau@intel.com>
* Author: Jonas Ådahl <jadahl@gmail.com>
*/
#include "clutter-build-config.h"
#include "clutter-seat-evdev.h"
#include <linux/input.h>
#include <math.h>
#include "clutter-event-private.h"
#include "clutter-input-device-evdev.h"
#include "clutter-input-device-tool-evdev.h"
#include "clutter-main.h"
/* Try to keep the pointer inside the stage. Hopefully no one is using
* this backend with stages smaller than this. */
#define INITIAL_POINTER_X 16
#define INITIAL_POINTER_Y 16
#define AUTOREPEAT_VALUE 2
#define DISCRETE_SCROLL_STEP 10.0
void
clutter_seat_evdev_set_libinput_seat (ClutterSeatEvdev *seat,
struct libinput_seat *libinput_seat)
{
g_assert (seat->libinput_seat == NULL);
libinput_seat_ref (libinput_seat);
libinput_seat_set_user_data (libinput_seat, seat);
seat->libinput_seat = libinput_seat;
}
void
clutter_seat_evdev_sync_leds (ClutterSeatEvdev *seat)
{
GSList *iter;
ClutterInputDeviceEvdev *device_evdev;
int caps_lock, num_lock, scroll_lock;
enum libinput_led leds = 0;
caps_lock = xkb_state_led_index_is_active (seat->xkb, seat->caps_lock_led);
num_lock = xkb_state_led_index_is_active (seat->xkb, seat->num_lock_led);
scroll_lock = xkb_state_led_index_is_active (seat->xkb, seat->scroll_lock_led);
if (caps_lock)
leds |= LIBINPUT_LED_CAPS_LOCK;
if (num_lock)
leds |= LIBINPUT_LED_NUM_LOCK;
if (scroll_lock)
leds |= LIBINPUT_LED_SCROLL_LOCK;
for (iter = seat->devices; iter; iter = iter->next)
{
device_evdev = iter->data;
_clutter_input_device_evdev_update_leds (device_evdev, leds);
}
}
static void
clutter_touch_state_free (ClutterTouchState *touch_state)
{
g_slice_free (ClutterTouchState, touch_state);
}
ClutterTouchState *
clutter_seat_evdev_add_touch (ClutterSeatEvdev *seat,
guint32 id)
{
ClutterTouchState *touch;
touch = g_slice_new0 (ClutterTouchState);
touch->id = id;
g_hash_table_insert (seat->touches, GUINT_TO_POINTER (id), touch);
return touch;
}
void
clutter_seat_evdev_remove_touch (ClutterSeatEvdev *seat,
guint32 id)
{
g_hash_table_remove (seat->touches, GUINT_TO_POINTER (id));
}
ClutterTouchState *
clutter_seat_evdev_get_touch (ClutterSeatEvdev *seat,
guint32 id)
{
return g_hash_table_lookup (seat->touches, GUINT_TO_POINTER (id));
}
ClutterSeatEvdev *
clutter_seat_evdev_new (ClutterDeviceManagerEvdev *manager_evdev)
{
ClutterDeviceManager *manager = CLUTTER_DEVICE_MANAGER (manager_evdev);
ClutterSeatEvdev *seat;
ClutterInputDevice *device;
ClutterStage *stage;
struct xkb_keymap *keymap;
seat = g_new0 (ClutterSeatEvdev, 1);
if (!seat)
return NULL;
seat->manager_evdev = manager_evdev;
device = _clutter_input_device_evdev_new_virtual (
manager, seat, CLUTTER_POINTER_DEVICE,
CLUTTER_INPUT_MODE_MASTER);
stage = _clutter_device_manager_evdev_get_stage (manager_evdev);
_clutter_input_device_set_stage (device, stage);
seat->pointer_x = INITIAL_POINTER_X;
seat->pointer_y = INITIAL_POINTER_Y;
_clutter_input_device_set_coords (device, NULL,
seat->pointer_x, seat->pointer_y,
NULL);
_clutter_device_manager_add_device (manager, device);
seat->core_pointer = device;
device = _clutter_input_device_evdev_new_virtual (
manager, seat, CLUTTER_KEYBOARD_DEVICE,
CLUTTER_INPUT_MODE_MASTER);
_clutter_input_device_set_stage (device, stage);
_clutter_device_manager_add_device (manager, device);
seat->core_keyboard = device;
seat->touches = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) clutter_touch_state_free);
seat->repeat = TRUE;
seat->repeat_delay = 250; /* ms */
seat->repeat_interval = 33; /* ms */
keymap = _clutter_device_manager_evdev_get_keymap (manager_evdev);
if (keymap)
{
seat->xkb = xkb_state_new (keymap);
seat->caps_lock_led =
xkb_keymap_led_get_index (keymap, XKB_LED_NAME_CAPS);
seat->num_lock_led =
xkb_keymap_led_get_index (keymap, XKB_LED_NAME_NUM);
seat->scroll_lock_led =
xkb_keymap_led_get_index (keymap, XKB_LED_NAME_SCROLL);
}
return seat;
}
void
clutter_seat_evdev_clear_repeat_timer (ClutterSeatEvdev *seat)
{
if (seat->repeat_timer)
{
g_source_remove (seat->repeat_timer);
seat->repeat_timer = 0;
g_clear_object (&seat->repeat_device);
}
}
static gboolean
keyboard_repeat (gpointer data)
{
ClutterSeatEvdev *seat = data;
GSource *source;
/* There might be events queued in libinput that could cancel the
repeat timer. */
_clutter_device_manager_evdev_dispatch (seat->manager_evdev);
if (!seat->repeat_timer)
return G_SOURCE_REMOVE;
g_return_val_if_fail (seat->repeat_device != NULL, G_SOURCE_REMOVE);
source = g_main_context_find_source_by_id (NULL, seat->repeat_timer);
clutter_seat_evdev_notify_key (seat,
seat->repeat_device,
g_source_get_time (source),
seat->repeat_key,
AUTOREPEAT_VALUE,
FALSE);
return G_SOURCE_CONTINUE;
}
static void
queue_event (ClutterEvent *event)
{
_clutter_event_push (event, FALSE);
}
static int
update_button_count (ClutterSeatEvdev *seat,
uint32_t button,
uint32_t state)
{
if (state)
{
return ++seat->button_count[button];
}
else
{
/* Handle cases where we newer saw the initial pressed event. */
if (seat->button_count[button] == 0)
return 0;
return --seat->button_count[button];
}
}
void
clutter_seat_evdev_notify_key (ClutterSeatEvdev *seat,
ClutterInputDevice *device,
uint64_t time_us,
uint32_t key,
uint32_t state,
gboolean update_keys)
{
ClutterStage *stage;
ClutterEvent *event = NULL;
enum xkb_state_component changed_state;
if (state != AUTOREPEAT_VALUE)
{
/* Drop any repeated button press (for example from virtual devices. */
int count = update_button_count (seat, key, state);
if (state && count > 1)
return;
if (!state && count != 0)
return;
}
/* We can drop the event on the floor if no stage has been
* associated with the device yet. */
stage = _clutter_input_device_get_stage (device);
if (stage == NULL)
{
clutter_seat_evdev_clear_repeat_timer (seat);
return;
}
event = _clutter_key_event_new_from_evdev (device,
seat->core_keyboard,
stage,
seat->xkb,
seat->button_state,
us2ms (time_us), key, state);
_clutter_evdev_event_set_event_code (event, key);
/* We must be careful and not pass multiple releases to xkb, otherwise it gets
confused and locks the modifiers */
if (state != AUTOREPEAT_VALUE)
{
changed_state = xkb_state_update_key (seat->xkb,
event->key.hardware_keycode,
state ? XKB_KEY_DOWN : XKB_KEY_UP);
}
else
{
changed_state = 0;
clutter_event_set_flags (event, CLUTTER_EVENT_FLAG_SYNTHETIC);
}
queue_event (event);
if (update_keys && (changed_state & XKB_STATE_LEDS))
clutter_seat_evdev_sync_leds (seat);
if (state == 0 || /* key release */
!seat->repeat ||
!xkb_keymap_key_repeats (xkb_state_get_keymap (seat->xkb),
event->key.hardware_keycode))
{
clutter_seat_evdev_clear_repeat_timer (seat);
return;
}
if (state == 1) /* key press */
seat->repeat_count = 0;
seat->repeat_count += 1;
seat->repeat_key = key;
switch (seat->repeat_count)
{
case 1:
case 2:
{
guint32 interval;
clutter_seat_evdev_clear_repeat_timer (seat);
seat->repeat_device = g_object_ref (device);
if (seat->repeat_count == 1)
interval = seat->repeat_delay;
else
interval = seat->repeat_interval;
seat->repeat_timer =
clutter_threads_add_timeout_full (CLUTTER_PRIORITY_EVENTS,
interval,
keyboard_repeat,
seat,
NULL);
return;
}
default:
return;
}
}
static ClutterEvent *
new_absolute_motion_event (ClutterSeatEvdev *seat,
ClutterInputDevice *input_device,
guint64 time_us,
gfloat x,
gfloat y,
gdouble *axes)
{
ClutterStage *stage = _clutter_input_device_get_stage (input_device);
ClutterEvent *event;
event = clutter_event_new (CLUTTER_MOTION);
if (clutter_input_device_get_device_type (input_device) != CLUTTER_TABLET_DEVICE)
_clutter_device_manager_evdev_constrain_pointer (seat->manager_evdev,
seat->core_pointer,
time_us,
seat->pointer_x,
seat->pointer_y,
&x, &y);
_clutter_evdev_event_set_time_usec (event, time_us);
event->motion.time = us2ms (time_us);
event->motion.stage = stage;
event->motion.device = seat->core_pointer;
_clutter_xkb_translate_state (event, seat->xkb, seat->button_state);
event->motion.x = x;
event->motion.y = y;
event->motion.axes = axes;
clutter_event_set_device (event, seat->core_pointer);
clutter_event_set_source_device (event, input_device);
if (clutter_input_device_get_device_type (input_device) == CLUTTER_TABLET_DEVICE)
{
ClutterInputDeviceEvdev *device_evdev =
CLUTTER_INPUT_DEVICE_EVDEV (input_device);
clutter_event_set_device_tool (event, device_evdev->last_tool);
clutter_event_set_device (event, input_device);
}
else
{
clutter_event_set_device (event, seat->core_pointer);
}
_clutter_input_device_set_stage (seat->core_pointer, stage);
if (clutter_input_device_get_device_type (input_device) != CLUTTER_TABLET_DEVICE)
{
seat->pointer_x = x;
seat->pointer_y = y;
}
return event;
}
void
clutter_seat_evdev_notify_relative_motion (ClutterSeatEvdev *seat,
ClutterInputDevice *input_device,
uint64_t time_us,
float dx,
float dy,
float dx_unaccel,
float dy_unaccel)
{
gfloat new_x, new_y;
ClutterEvent *event;
/* We can drop the event on the floor if no stage has been
* associated with the device yet. */
if (!_clutter_input_device_get_stage (input_device))
return;
_clutter_device_manager_evdev_filter_relative_motion (seat->manager_evdev,
input_device,
seat->pointer_x,
seat->pointer_y,
&dx,
&dy);
new_x = seat->pointer_x + dx;
new_y = seat->pointer_y + dy;
event = new_absolute_motion_event (seat, input_device,
time_us, new_x, new_y, NULL);
_clutter_evdev_event_set_relative_motion (event,
dx, dy,
dx_unaccel, dy_unaccel);
queue_event (event);
}
void clutter_seat_evdev_notify_absolute_motion (ClutterSeatEvdev *seat,
ClutterInputDevice *input_device,
uint64_t time_us,
float x,
float y,
double *axes)
{
ClutterEvent *event;
event = new_absolute_motion_event (seat, input_device, time_us, x, y, axes);
queue_event (event);
}
void
clutter_seat_evdev_notify_button (ClutterSeatEvdev *seat,
ClutterInputDevice *input_device,
uint64_t time_us,
uint32_t button,
uint32_t state)
{
ClutterInputDeviceEvdev *device_evdev = (ClutterInputDeviceEvdev *) input_device;
ClutterStage *stage;
ClutterEvent *event = NULL;
gint button_nr;
static gint maskmap[8] =
{
CLUTTER_BUTTON1_MASK, CLUTTER_BUTTON3_MASK, CLUTTER_BUTTON2_MASK,
CLUTTER_BUTTON4_MASK, CLUTTER_BUTTON5_MASK, 0, 0, 0
};
int button_count;
/* Drop any repeated button press (for example from virtual devices. */
button_count = update_button_count (seat, button, state);
if (state && button_count > 1)
return;
if (!state && button_count != 0)
return;
/* We can drop the event on the floor if no stage has been
* associated with the device yet. */
stage = _clutter_input_device_get_stage (input_device);
if (stage == NULL)
return;
/* The evdev button numbers don't map sequentially to clutter button
* numbers (the right and middle mouse buttons are in the opposite
* order) so we'll map them directly with a switch statement */
switch (button)
{
case BTN_LEFT:
case BTN_TOUCH:
button_nr = CLUTTER_BUTTON_PRIMARY;
break;
case BTN_RIGHT:
case BTN_STYLUS:
button_nr = CLUTTER_BUTTON_SECONDARY;
break;
case BTN_MIDDLE:
case BTN_STYLUS2:
button_nr = CLUTTER_BUTTON_MIDDLE;
break;
default:
/* For compatibility reasons, all additional buttons go after the old 4-7 scroll ones */
if (clutter_input_device_get_device_type (input_device) == CLUTTER_TABLET_DEVICE)
button_nr = button - BTN_TOOL_PEN + 4;
else
button_nr = button - (BTN_LEFT - 1) + 4;
break;
}
if (button_nr < 1 || button_nr > 12)
{
g_warning ("Unhandled button event 0x%x", button);
return;
}
if (state)
event = clutter_event_new (CLUTTER_BUTTON_PRESS);
else
event = clutter_event_new (CLUTTER_BUTTON_RELEASE);
if (button_nr < G_N_ELEMENTS (maskmap))
{
/* Update the modifiers */
if (state)
seat->button_state |= maskmap[button_nr - 1];
else
seat->button_state &= ~maskmap[button_nr - 1];
}
_clutter_evdev_event_set_time_usec (event, time_us);
event->button.time = us2ms (time_us);
event->button.stage = CLUTTER_STAGE (stage);
_clutter_xkb_translate_state (event, seat->xkb, seat->button_state);
event->button.button = button_nr;
if (clutter_input_device_get_device_type (input_device) == CLUTTER_TABLET_DEVICE)
{
ClutterPoint point;
clutter_input_device_get_coords (input_device, NULL, &point);
event->button.x = point.x;
event->button.y = point.y;
}
else
{
event->button.x = seat->pointer_x;
event->button.y = seat->pointer_y;
}
clutter_event_set_device (event, seat->core_pointer);
clutter_event_set_source_device (event, input_device);
if (device_evdev->last_tool)
{
/* Apply the button event code as per the tool mapping */
guint mapped_button;
mapped_button = clutter_input_device_tool_evdev_get_button_code (device_evdev->last_tool,
button_nr);
if (mapped_button != 0)
button = mapped_button;
}
_clutter_evdev_event_set_event_code (event, button);
if (clutter_input_device_get_device_type (input_device) == CLUTTER_TABLET_DEVICE)
{
clutter_event_set_device_tool (event, device_evdev->last_tool);
clutter_event_set_device (event, input_device);
}
else
{
clutter_event_set_device (event, seat->core_pointer);
}
_clutter_input_device_set_stage (seat->core_pointer, stage);
queue_event (event);
}
static void
notify_scroll (ClutterInputDevice *input_device,
guint64 time_us,
gdouble dx,
gdouble dy,
ClutterScrollSource scroll_source,
ClutterScrollFinishFlags flags,
gboolean emulated)
{
ClutterInputDeviceEvdev *device_evdev;
ClutterSeatEvdev *seat;
ClutterStage *stage;
ClutterEvent *event = NULL;
gdouble scroll_factor;
/* We can drop the event on the floor if no stage has been
* associated with the device yet. */
stage = _clutter_input_device_get_stage (input_device);
if (stage == NULL)
return;
device_evdev = CLUTTER_INPUT_DEVICE_EVDEV (input_device);
seat = _clutter_input_device_evdev_get_seat (device_evdev);
event = clutter_event_new (CLUTTER_SCROLL);
_clutter_evdev_event_set_time_usec (event, time_us);
event->scroll.time = us2ms (time_us);
event->scroll.stage = CLUTTER_STAGE (stage);
event->scroll.device = seat->core_pointer;
_clutter_xkb_translate_state (event, seat->xkb, seat->button_state);
/* libinput pointer axis events are in pointer motion coordinate space.
* To convert to Xi2 discrete step coordinate space, multiply the factor
* 1/10. */
event->scroll.direction = CLUTTER_SCROLL_SMOOTH;
scroll_factor = 1.0 / DISCRETE_SCROLL_STEP;
clutter_event_set_scroll_delta (event,
scroll_factor * dx,
scroll_factor * dy);
event->scroll.x = seat->pointer_x;
event->scroll.y = seat->pointer_y;
clutter_event_set_device (event, seat->core_pointer);
clutter_event_set_source_device (event, input_device);
event->scroll.scroll_source = scroll_source;
event->scroll.finish_flags = flags;
_clutter_event_set_pointer_emulated (event, emulated);
queue_event (event);
}
static void
notify_discrete_scroll (ClutterInputDevice *input_device,
uint64_t time_us,
ClutterScrollDirection direction,
ClutterScrollSource scroll_source,
gboolean emulated)
{
ClutterInputDeviceEvdev *device_evdev;
ClutterSeatEvdev *seat;
ClutterStage *stage;
ClutterEvent *event = NULL;
if (direction == CLUTTER_SCROLL_SMOOTH)
return;
/* We can drop the event on the floor if no stage has been
* associated with the device yet. */
stage = _clutter_input_device_get_stage (input_device);
if (stage == NULL)
return;
device_evdev = CLUTTER_INPUT_DEVICE_EVDEV (input_device);
seat = _clutter_input_device_evdev_get_seat (device_evdev);
event = clutter_event_new (CLUTTER_SCROLL);
_clutter_evdev_event_set_time_usec (event, time_us);
event->scroll.time = us2ms (time_us);
event->scroll.stage = CLUTTER_STAGE (stage);
event->scroll.device = seat->core_pointer;
_clutter_xkb_translate_state (event, seat->xkb, seat->button_state);
event->scroll.direction = direction;
event->scroll.x = seat->pointer_x;
event->scroll.y = seat->pointer_y;
clutter_event_set_device (event, seat->core_pointer);
clutter_event_set_source_device (event, input_device);
event->scroll.scroll_source = scroll_source;
_clutter_event_set_pointer_emulated (event, emulated);
queue_event (event);
}
static void
check_notify_discrete_scroll (ClutterSeatEvdev *seat,
ClutterInputDevice *device,
uint64_t time_us,
ClutterScrollSource scroll_source)
{
int i, n_xscrolls, n_yscrolls;
n_xscrolls = floor (fabs (seat->accum_scroll_dx) / DISCRETE_SCROLL_STEP);
n_yscrolls = floor (fabs (seat->accum_scroll_dy) / DISCRETE_SCROLL_STEP);
for (i = 0; i < n_xscrolls; i++)
{
notify_discrete_scroll (device, time_us,
seat->accum_scroll_dx > 0 ?
CLUTTER_SCROLL_RIGHT : CLUTTER_SCROLL_LEFT,
scroll_source, TRUE);
}
for (i = 0; i < n_yscrolls; i++)
{
notify_discrete_scroll (device, time_us,
seat->accum_scroll_dy > 0 ?
CLUTTER_SCROLL_DOWN : CLUTTER_SCROLL_UP,
scroll_source, TRUE);
}
seat->accum_scroll_dx = fmodf (seat->accum_scroll_dx, DISCRETE_SCROLL_STEP);
seat->accum_scroll_dy = fmodf (seat->accum_scroll_dy, DISCRETE_SCROLL_STEP);
}
void
clutter_seat_evdev_notify_scroll_continuous (ClutterSeatEvdev *seat,
ClutterInputDevice *input_device,
uint64_t time_us,
double dx,
double dy,
ClutterScrollSource scroll_source,
ClutterScrollFinishFlags finish_flags)
{
if (finish_flags & CLUTTER_SCROLL_FINISHED_HORIZONTAL)
seat->accum_scroll_dx = 0;
else
seat->accum_scroll_dx += dx;
if (finish_flags & CLUTTER_SCROLL_FINISHED_VERTICAL)
seat->accum_scroll_dy = 0;
else
seat->accum_scroll_dy += dy;
notify_scroll (input_device, time_us, dx, dy, scroll_source,
finish_flags, FALSE);
check_notify_discrete_scroll (seat, input_device, time_us, scroll_source);
}
static ClutterScrollDirection
discrete_to_direction (double discrete_dx,
double discrete_dy)
{
if (discrete_dx > 0)
return CLUTTER_SCROLL_RIGHT;
else if (discrete_dx < 0)
return CLUTTER_SCROLL_LEFT;
else if (discrete_dy > 0)
return CLUTTER_SCROLL_DOWN;
else if (discrete_dy < 0)
return CLUTTER_SCROLL_UP;
else
g_assert_not_reached ();
}
void
clutter_seat_evdev_notify_discrete_scroll (ClutterSeatEvdev *seat,
ClutterInputDevice *input_device,
uint64_t time_us,
double discrete_dx,
double discrete_dy,
ClutterScrollSource scroll_source)
{
notify_scroll (input_device, time_us,
discrete_dx * DISCRETE_SCROLL_STEP,
discrete_dy * DISCRETE_SCROLL_STEP,
scroll_source, CLUTTER_SCROLL_FINISHED_NONE,
TRUE);
notify_discrete_scroll (input_device, time_us,
discrete_to_direction (discrete_dx, discrete_dy),
scroll_source, FALSE);
}
void
clutter_seat_evdev_free (ClutterSeatEvdev *seat)
{
GSList *iter;
for (iter = seat->devices; iter; iter = g_slist_next (iter))
{
ClutterInputDevice *device = iter->data;
g_object_unref (device);
}
g_slist_free (seat->devices);
g_hash_table_unref (seat->touches);
xkb_state_unref (seat->xkb);
clutter_seat_evdev_clear_repeat_timer (seat);
if (seat->libinput_seat)
libinput_seat_unref (seat->libinput_seat);
g_free (seat);
}
void
clutter_seat_evdev_set_stage (ClutterSeatEvdev *seat,
ClutterStage *stage)
{
GSList *l;
_clutter_input_device_set_stage (seat->core_pointer, stage);
_clutter_input_device_set_stage (seat->core_keyboard, stage);
for (l = seat->devices; l; l = l->next)
{
ClutterInputDevice *device = l->data;
_clutter_input_device_set_stage (device, stage);
}
}

View File

@ -1,148 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2010 Intel Corp.
* Copyright (C) 2014 Jonas Ådahl
* Copyright (C) 2016 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Damien Lespiau <damien.lespiau@intel.com>
* Author: Jonas Ådahl <jadahl@gmail.com>
*/
#ifndef __CLUTTER_SEAT_EVDEV_H__
#define __CLUTTER_SEAT_EVDEV_H__
#include <libinput.h>
#include <linux/input.h>
#include "clutter-input-device.h"
#include "clutter-device-manager-evdev.h"
#include "clutter-xkb-utils.h"
typedef struct _ClutterTouchState ClutterTouchState;
struct _ClutterTouchState
{
guint32 id;
ClutterPoint coords;
};
struct _ClutterSeatEvdev
{
struct libinput_seat *libinput_seat;
ClutterDeviceManagerEvdev *manager_evdev;
GSList *devices;
ClutterInputDevice *core_pointer;
ClutterInputDevice *core_keyboard;
GHashTable *touches;
struct xkb_state *xkb;
xkb_led_index_t caps_lock_led;
xkb_led_index_t num_lock_led;
xkb_led_index_t scroll_lock_led;
xkb_layout_index_t layout_idx;
uint32_t button_state;
int button_count[KEY_CNT];
/* keyboard repeat */
gboolean repeat;
guint32 repeat_delay;
guint32 repeat_interval;
guint32 repeat_key;
guint32 repeat_count;
guint32 repeat_timer;
ClutterInputDevice *repeat_device;
gfloat pointer_x;
gfloat pointer_y;
/* Emulation of discrete scroll events out of smooth ones */
gfloat accum_scroll_dx;
gfloat accum_scroll_dy;
};
void clutter_seat_evdev_notify_key (ClutterSeatEvdev *seat,
ClutterInputDevice *device,
uint64_t time_us,
uint32_t key,
uint32_t state,
gboolean update_keys);
void clutter_seat_evdev_notify_relative_motion (ClutterSeatEvdev *seat_evdev,
ClutterInputDevice *input_device,
uint64_t time_us,
float dx,
float dy,
float dx_unaccel,
float dy_unaccel);
void clutter_seat_evdev_notify_absolute_motion (ClutterSeatEvdev *seat_evdev,
ClutterInputDevice *input_device,
uint64_t time_us,
float x,
float y,
double *axes);
void clutter_seat_evdev_notify_button (ClutterSeatEvdev *seat,
ClutterInputDevice *input_device,
uint64_t time_us,
uint32_t button,
uint32_t state);
void clutter_seat_evdev_notify_scroll_continuous (ClutterSeatEvdev *seat,
ClutterInputDevice *input_device,
uint64_t time_us,
double dx,
double dy,
ClutterScrollSource source,
ClutterScrollFinishFlags flags);
void clutter_seat_evdev_notify_discrete_scroll (ClutterSeatEvdev *seat,
ClutterInputDevice *input_device,
uint64_t time_us,
double discrete_dx,
double discrete_dy,
ClutterScrollSource source);
void clutter_seat_evdev_set_libinput_seat (ClutterSeatEvdev *seat,
struct libinput_seat *libinput_seat);
void clutter_seat_evdev_sync_leds (ClutterSeatEvdev *seat);
ClutterTouchState * clutter_seat_evdev_add_touch (ClutterSeatEvdev *seat,
guint32 id);
void clutter_seat_evdev_remove_touch (ClutterSeatEvdev *seat,
guint32 id);
ClutterTouchState * clutter_seat_evdev_get_touch (ClutterSeatEvdev *seat,
guint32 id);
void clutter_seat_evdev_set_stage (ClutterSeatEvdev *seat,
ClutterStage *stage);
void clutter_seat_evdev_clear_repeat_timer (ClutterSeatEvdev *seat);
ClutterSeatEvdev * clutter_seat_evdev_new (ClutterDeviceManagerEvdev *manager_evdev);
void clutter_seat_evdev_free (ClutterSeatEvdev *seat);
#endif /* __CLUTTER_SEAT_EVDEV_H__ */

View File

@ -1,562 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2016 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Jonas Ådahl <jadahl@gmail.com>
*/
#ifdef HAVE_CONFIG_H
#include "clutter-build-config.h"
#endif
#include <glib-object.h>
#include <linux/input.h>
#include "clutter-private.h"
#include "clutter-virtual-input-device.h"
#include "evdev/clutter-input-device-evdev.h"
#include "evdev/clutter-seat-evdev.h"
#include "evdev/clutter-virtual-input-device-evdev.h"
enum
{
PROP_0,
PROP_SEAT,
PROP_LAST
};
static GParamSpec *obj_props[PROP_LAST];
struct _ClutterVirtualInputDeviceEvdev
{
ClutterVirtualInputDevice parent;
ClutterInputDevice *device;
ClutterSeatEvdev *seat;
int button_count[KEY_CNT];
};
G_DEFINE_TYPE (ClutterVirtualInputDeviceEvdev,
clutter_virtual_input_device_evdev,
CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE)
typedef enum _EvdevButtonType
{
EVDEV_BUTTON_TYPE_NONE,
EVDEV_BUTTON_TYPE_KEY,
EVDEV_BUTTON_TYPE_BUTTON,
} EvdevButtonType;
static int
update_button_count (ClutterVirtualInputDeviceEvdev *virtual_evdev,
uint32_t button,
uint32_t state)
{
if (state)
return ++virtual_evdev->button_count[button];
else
return --virtual_evdev->button_count[button];
}
static EvdevButtonType
get_button_type (uint16_t code)
{
switch (code)
{
case BTN_TOOL_PEN:
case BTN_TOOL_RUBBER:
case BTN_TOOL_BRUSH:
case BTN_TOOL_PENCIL:
case BTN_TOOL_AIRBRUSH:
case BTN_TOOL_MOUSE:
case BTN_TOOL_LENS:
case BTN_TOOL_QUINTTAP:
case BTN_TOOL_DOUBLETAP:
case BTN_TOOL_TRIPLETAP:
case BTN_TOOL_QUADTAP:
case BTN_TOOL_FINGER:
case BTN_TOUCH:
return EVDEV_BUTTON_TYPE_NONE;
}
if (code >= KEY_ESC && code <= KEY_MICMUTE)
return EVDEV_BUTTON_TYPE_KEY;
if (code >= BTN_MISC && code <= BTN_GEAR_UP)
return EVDEV_BUTTON_TYPE_BUTTON;
if (code >= KEY_OK && code <= KEY_LIGHTS_TOGGLE)
return EVDEV_BUTTON_TYPE_KEY;
if (code >= BTN_DPAD_UP && code <= BTN_DPAD_RIGHT)
return EVDEV_BUTTON_TYPE_BUTTON;
if (code >= KEY_ALS_TOGGLE && code <= KEY_KBDINPUTASSIST_CANCEL)
return EVDEV_BUTTON_TYPE_KEY;
if (code >= BTN_TRIGGER_HAPPY && code <= BTN_TRIGGER_HAPPY40)
return EVDEV_BUTTON_TYPE_BUTTON;
return EVDEV_BUTTON_TYPE_NONE;
}
static void
release_pressed_buttons (ClutterVirtualInputDevice *virtual_device)
{
ClutterVirtualInputDeviceEvdev *virtual_evdev =
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
int code;
uint64_t time_us;
time_us = g_get_monotonic_time ();
for (code = 0; code < G_N_ELEMENTS (virtual_evdev->button_count); code++)
{
if (virtual_evdev->button_count[code] == 0)
continue;
switch (get_button_type (code))
{
case EVDEV_BUTTON_TYPE_KEY:
clutter_virtual_input_device_notify_key (virtual_device,
time_us,
code,
CLUTTER_KEY_STATE_RELEASED);
break;
case EVDEV_BUTTON_TYPE_BUTTON:
clutter_virtual_input_device_notify_button (virtual_device,
time_us,
code,
CLUTTER_BUTTON_STATE_RELEASED);
break;
case EVDEV_BUTTON_TYPE_NONE:
g_assert_not_reached ();
}
}
}
static void
clutter_virtual_input_device_evdev_notify_relative_motion (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
double dx,
double dy)
{
ClutterVirtualInputDeviceEvdev *virtual_evdev =
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
if (time_us == CLUTTER_CURRENT_TIME)
time_us = g_get_monotonic_time ();
clutter_seat_evdev_notify_relative_motion (virtual_evdev->seat,
virtual_evdev->device,
time_us,
dx, dy,
dx, dy);
}
static void
clutter_virtual_input_device_evdev_notify_absolute_motion (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
double x,
double y)
{
ClutterVirtualInputDeviceEvdev *virtual_evdev =
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
if (time_us == CLUTTER_CURRENT_TIME)
time_us = g_get_monotonic_time ();
clutter_seat_evdev_notify_absolute_motion (virtual_evdev->seat,
virtual_evdev->device,
time_us,
x, y,
NULL);
}
static void
clutter_virtual_input_device_evdev_notify_button (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t button,
ClutterButtonState button_state)
{
ClutterVirtualInputDeviceEvdev *virtual_evdev =
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
int button_count;
if (time_us == CLUTTER_CURRENT_TIME)
time_us = g_get_monotonic_time ();
if (get_button_type (button) != EVDEV_BUTTON_TYPE_BUTTON)
{
g_warning ("Unknown/invalid virtual device button 0x%x pressed",
button);
return;
}
button_count = update_button_count (virtual_evdev, button, button_state);
if (button_count < 0 || button_count > 1)
{
g_warning ("Received multiple virtual 0x%x button %s (ignoring)", button,
button_state == CLUTTER_BUTTON_STATE_PRESSED ? "presses" : "releases");
update_button_count (virtual_evdev, button, 1 - button_state);
return;
}
clutter_seat_evdev_notify_button (virtual_evdev->seat,
virtual_evdev->device,
time_us,
button,
button_state);
}
static void
clutter_virtual_input_device_evdev_notify_key (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t key,
ClutterKeyState key_state)
{
ClutterVirtualInputDeviceEvdev *virtual_evdev =
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
int key_count;
if (time_us == CLUTTER_CURRENT_TIME)
time_us = g_get_monotonic_time ();
if (get_button_type (key) != EVDEV_BUTTON_TYPE_KEY)
{
g_warning ("Unknown/invalid virtual device key 0x%x pressed\n", key);
return;
}
key_count = update_button_count (virtual_evdev, key, key_state);
if (key_count < 0 || key_count > 1)
{
g_warning ("Received multiple virtual 0x%x key %s (ignoring)", key,
key_state == CLUTTER_KEY_STATE_PRESSED ? "presses" : "releases");
update_button_count (virtual_evdev, key, 1 - key_state);
return;
}
clutter_seat_evdev_notify_key (virtual_evdev->seat,
virtual_evdev->device,
time_us,
key,
key_state,
TRUE);
}
static gboolean
pick_keycode_for_keyval_in_current_group (ClutterVirtualInputDevice *virtual_device,
guint keyval,
guint *keycode_out,
guint *level_out)
{
ClutterVirtualInputDeviceEvdev *virtual_evdev =
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
ClutterDeviceManager *manager;
struct xkb_keymap *xkb_keymap;
struct xkb_state *state;
guint keycode, layout;
xkb_keycode_t min_keycode, max_keycode;
manager = clutter_virtual_input_device_get_manager (virtual_device);
xkb_keymap = _clutter_device_manager_evdev_get_keymap (CLUTTER_DEVICE_MANAGER_EVDEV (manager));
state = virtual_evdev->seat->xkb;
layout = xkb_state_serialize_layout (state, XKB_STATE_LAYOUT_EFFECTIVE);
min_keycode = xkb_keymap_min_keycode (xkb_keymap);
max_keycode = xkb_keymap_max_keycode (xkb_keymap);
for (keycode = min_keycode; keycode < max_keycode; keycode++)
{
gint num_levels, level;
num_levels = xkb_keymap_num_levels_for_key (xkb_keymap, keycode, layout);
for (level = 0; level < num_levels; level++)
{
const xkb_keysym_t *syms;
gint num_syms, sym;
num_syms = xkb_keymap_key_get_syms_by_level (xkb_keymap, keycode, layout, level, &syms);
for (sym = 0; sym < num_syms; sym++)
{
if (syms[sym] == keyval)
{
*keycode_out = keycode;
if (level_out)
*level_out = level;
return TRUE;
}
}
}
}
return FALSE;
}
static void
apply_level_modifiers (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t level,
uint32_t key_state)
{
ClutterVirtualInputDeviceEvdev *virtual_evdev =
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
guint keysym, keycode, evcode;
if (level == 0)
return;
if (level == 1)
{
keysym = XKB_KEY_Shift_L;
}
else if (level == 2)
{
keysym = XKB_KEY_ISO_Level3_Shift;
}
else
{
g_warning ("Unhandled level: %d\n", level);
return;
}
if (!pick_keycode_for_keyval_in_current_group (virtual_device, keysym,
&keycode, NULL))
return;
clutter_input_device_keycode_to_evdev (virtual_evdev->device,
keycode, &evcode);
clutter_seat_evdev_notify_key (virtual_evdev->seat,
virtual_evdev->device,
time_us,
evcode,
key_state,
TRUE);
}
static void
clutter_virtual_input_device_evdev_notify_keyval (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t keyval,
ClutterKeyState key_state)
{
ClutterVirtualInputDeviceEvdev *virtual_evdev =
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
int key_count;
guint keycode = 0, level = 0, evcode = 0;
if (time_us == CLUTTER_CURRENT_TIME)
time_us = g_get_monotonic_time ();
if (!pick_keycode_for_keyval_in_current_group (virtual_device,
keyval, &keycode, &level))
{
g_warning ("No keycode found for keyval %x in current group", keyval);
return;
}
clutter_input_device_keycode_to_evdev (virtual_evdev->device,
keycode, &evcode);
if (get_button_type (evcode) != EVDEV_BUTTON_TYPE_KEY)
{
g_warning ("Unknown/invalid virtual device key 0x%x pressed\n", evcode);
return;
}
key_count = update_button_count (virtual_evdev, evcode, key_state);
if (key_count < 0 || key_count > 1)
{
g_warning ("Received multiple virtual 0x%x key %s (ignoring)", keycode,
key_state == CLUTTER_KEY_STATE_PRESSED ? "presses" : "releases");
update_button_count (virtual_evdev, evcode, 1 - key_state);
return;
}
if (key_state)
apply_level_modifiers (virtual_device, time_us, level, key_state);
clutter_seat_evdev_notify_key (virtual_evdev->seat,
virtual_evdev->device,
time_us,
evcode,
key_state,
TRUE);
if (!key_state)
apply_level_modifiers (virtual_device, time_us, level, key_state);
}
static void
direction_to_discrete (ClutterScrollDirection direction,
double *discrete_dx,
double *discrete_dy)
{
switch (direction)
{
case CLUTTER_SCROLL_UP:
*discrete_dx = 0.0;
*discrete_dy = -1.0;
break;
case CLUTTER_SCROLL_DOWN:
*discrete_dx = 0.0;
*discrete_dy = 1.0;
break;
case CLUTTER_SCROLL_LEFT:
*discrete_dx = -1.0;
*discrete_dy = 0.0;
break;
case CLUTTER_SCROLL_RIGHT:
*discrete_dx = 1.0;
*discrete_dy = 0.0;
break;
case CLUTTER_SCROLL_SMOOTH:
g_assert_not_reached ();
break;
}
}
static void
clutter_virtual_input_device_evdev_notify_discrete_scroll (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
ClutterScrollDirection direction,
ClutterScrollSource scroll_source)
{
ClutterVirtualInputDeviceEvdev *virtual_evdev =
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (virtual_device);
double discrete_dx = 0.0, discrete_dy = 0.0;
if (time_us == CLUTTER_CURRENT_TIME)
time_us = g_get_monotonic_time ();
direction_to_discrete (direction, &discrete_dx, &discrete_dy);
clutter_seat_evdev_notify_discrete_scroll (virtual_evdev->seat,
virtual_evdev->device,
time_us,
discrete_dx, discrete_dy,
scroll_source);
}
static void
clutter_virtual_input_device_evdev_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ClutterVirtualInputDeviceEvdev *virtual_evdev =
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (object);
switch (prop_id)
{
case PROP_SEAT:
g_value_set_pointer (value, virtual_evdev->seat);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_virtual_input_device_evdev_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ClutterVirtualInputDeviceEvdev *virtual_evdev =
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (object);
switch (prop_id)
{
case PROP_SEAT:
virtual_evdev->seat = g_value_get_pointer (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
clutter_virtual_input_device_evdev_constructed (GObject *object)
{
ClutterVirtualInputDevice *virtual_device =
CLUTTER_VIRTUAL_INPUT_DEVICE (object);
ClutterVirtualInputDeviceEvdev *virtual_evdev =
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (object);
ClutterDeviceManager *manager;
ClutterInputDeviceType device_type;
ClutterStage *stage;
manager = clutter_virtual_input_device_get_manager (virtual_device);
device_type = clutter_virtual_input_device_get_device_type (virtual_device);
virtual_evdev->device =
_clutter_input_device_evdev_new_virtual (manager,
virtual_evdev->seat,
device_type,
CLUTTER_INPUT_MODE_SLAVE);
stage = _clutter_device_manager_evdev_get_stage (CLUTTER_DEVICE_MANAGER_EVDEV (manager));
_clutter_input_device_set_stage (virtual_evdev->device, stage);
}
static void
clutter_virtual_input_device_evdev_finalize (GObject *object)
{
ClutterVirtualInputDevice *virtual_device =
CLUTTER_VIRTUAL_INPUT_DEVICE (object);
ClutterVirtualInputDeviceEvdev *virtual_evdev =
CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV (object);
GObjectClass *object_class;
release_pressed_buttons (virtual_device);
g_clear_object (&virtual_evdev->device);
object_class =
G_OBJECT_CLASS (clutter_virtual_input_device_evdev_parent_class);
object_class->finalize (object);
}
static void
clutter_virtual_input_device_evdev_init (ClutterVirtualInputDeviceEvdev *virtual_device_evdev)
{
}
static void
clutter_virtual_input_device_evdev_class_init (ClutterVirtualInputDeviceEvdevClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ClutterVirtualInputDeviceClass *virtual_input_device_class =
CLUTTER_VIRTUAL_INPUT_DEVICE_CLASS (klass);
object_class->get_property = clutter_virtual_input_device_evdev_get_property;
object_class->set_property = clutter_virtual_input_device_evdev_set_property;
object_class->constructed = clutter_virtual_input_device_evdev_constructed;
object_class->finalize = clutter_virtual_input_device_evdev_finalize;
virtual_input_device_class->notify_relative_motion = clutter_virtual_input_device_evdev_notify_relative_motion;
virtual_input_device_class->notify_absolute_motion = clutter_virtual_input_device_evdev_notify_absolute_motion;
virtual_input_device_class->notify_button = clutter_virtual_input_device_evdev_notify_button;
virtual_input_device_class->notify_key = clutter_virtual_input_device_evdev_notify_key;
virtual_input_device_class->notify_keyval = clutter_virtual_input_device_evdev_notify_keyval;
virtual_input_device_class->notify_discrete_scroll = clutter_virtual_input_device_evdev_notify_discrete_scroll;
obj_props[PROP_SEAT] = g_param_spec_pointer ("seat",
P_("ClutterSeatEvdev"),
P_("ClutterSeatEvdev"),
CLUTTER_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
}

View File

@ -1,35 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2016 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Jonas Ådahl <jadahl@gmail.com>
*/
#ifndef __CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV_H__
#define __CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV_H__
#include "clutter-virtual-input-device.h"
#define CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE_EVDEV (clutter_virtual_input_device_evdev_get_type ())
G_DECLARE_FINAL_TYPE (ClutterVirtualInputDeviceEvdev,
clutter_virtual_input_device_evdev,
CLUTTER, VIRTUAL_INPUT_DEVICE_EVDEV,
ClutterVirtualInputDevice)
#endif /* __CLUTTER_VIRTUAL_INPUT_DEVICE_EVDEV_H__ */

View File

@ -3,8 +3,8 @@ exec_prefix=@exec_prefix@
libdir=@libdir@/mutter
includedir=@includedir@/mutter
apiversion=@LIBMUTTER_API_VERSION@
requires=@CLUTTER_REQUIRES@ mutter-cogl-@LIBMUTTER_API_VERSION@
apiversion=@CLUTTER_API_VERSION@
requires=@CLUTTER_REQUIRES@ mutter-cogl-1.0
requires_private=@CLUTTER_REQUIRES_PRIVATE@
backends=@CLUTTER_BACKENDS@
@ -17,7 +17,7 @@ cogl_driver=deprecated
Name: Mutter Clutter
Description: Mutter's Clutter Private Library
Version: @MUTTER_VERSION@
Version: @VERSION@
Libs: -L${libdir} -lmutter-clutter-${apiversion}
Cflags: -I${includedir}/clutter-${apiversion}
Requires: ${requires}

View File

@ -28,7 +28,6 @@
#include "clutter-backend-x11.h"
#include "clutter-input-device-core-x11.h"
#include "clutter-stage-x11.h"
#include "clutter-virtual-input-device-x11.h"
#include "clutter-backend.h"
#include "clutter-debug.h"
@ -37,7 +36,6 @@
#include "clutter-event-translator.h"
#include "clutter-stage-private.h"
#include "clutter-private.h"
#include "clutter-xkb-a11y-x11.h"
enum
{
@ -137,6 +135,7 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
ClutterTranslateReturn res;
ClutterStage *stage;
XEvent *xevent;
int window_scale;
manager_x11 = CLUTTER_DEVICE_MANAGER_X11 (translator);
backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
@ -152,6 +151,8 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
stage_x11 = CLUTTER_STAGE_X11 (_clutter_stage_get_window (stage));
window_scale = stage_x11->scale_factor;
event->any.stage = stage;
res = CLUTTER_TRANSLATE_CONTINUE;
@ -224,8 +225,8 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
event->scroll.direction = CLUTTER_SCROLL_RIGHT;
event->scroll.time = xevent->xbutton.time;
event->scroll.x = xevent->xbutton.x;
event->scroll.y = xevent->xbutton.y;
event->scroll.x = xevent->xbutton.x / window_scale;
event->scroll.y = xevent->xbutton.y / window_scale;
event->scroll.modifier_state = xevent->xbutton.state;
event->scroll.axes = NULL;
break;
@ -233,8 +234,8 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
default:
event->button.type = event->type = CLUTTER_BUTTON_PRESS;
event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y;
event->button.x = xevent->xbutton.x / window_scale;
event->button.y = xevent->xbutton.y / window_scale;
event->button.modifier_state = xevent->xbutton.state;
event->button.button = xevent->xbutton.button;
event->button.axes = NULL;
@ -267,8 +268,8 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
event->button.type = event->type = CLUTTER_BUTTON_RELEASE;
event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y;
event->button.x = xevent->xbutton.x / window_scale;
event->button.y = xevent->xbutton.y / window_scale;
event->button.modifier_state = xevent->xbutton.state;
event->button.button = xevent->xbutton.button;
event->button.axes = NULL;
@ -285,8 +286,8 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
event->motion.type = event->type = CLUTTER_MOTION;
event->motion.time = xevent->xmotion.time;
event->motion.x = xevent->xmotion.x;
event->motion.y = xevent->xmotion.y;
event->motion.x = xevent->xmotion.x / window_scale;
event->motion.y = xevent->xmotion.y / window_scale;
event->motion.modifier_state = xevent->xmotion.state;
event->motion.axes = NULL;
clutter_event_set_device (event, manager_x11->core_pointer);
@ -299,8 +300,8 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
event->crossing.type = CLUTTER_ENTER;
event->crossing.time = xevent->xcrossing.time;
event->crossing.x = xevent->xcrossing.x;
event->crossing.y = xevent->xcrossing.y;
event->crossing.x = xevent->xcrossing.x / window_scale;
event->crossing.y = xevent->xcrossing.y / window_scale;
event->crossing.source = CLUTTER_ACTOR (stage);
event->crossing.related = NULL;
clutter_event_set_device (event, manager_x11->core_pointer);
@ -325,8 +326,8 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
event->crossing.type = CLUTTER_LEAVE;
event->crossing.time = xevent->xcrossing.time;
event->crossing.x = xevent->xcrossing.x;
event->crossing.y = xevent->xcrossing.y;
event->crossing.x = xevent->xcrossing.x / window_scale;
event->crossing.y = xevent->xcrossing.y / window_scale;
event->crossing.source = CLUTTER_ACTOR (stage);
event->crossing.related = NULL;
clutter_event_set_device (event, manager_x11->core_pointer);
@ -353,11 +354,9 @@ static void
clutter_device_manager_x11_constructed (GObject *gobject)
{
ClutterDeviceManagerX11 *manager_x11;
ClutterDeviceManager *manager;
ClutterBackendX11 *backend_x11;
manager_x11 = CLUTTER_DEVICE_MANAGER_X11 (gobject);
manager = CLUTTER_DEVICE_MANAGER (gobject);
g_object_get (gobject, "backend", &backend_x11, NULL);
g_assert (backend_x11 != NULL);
@ -392,8 +391,6 @@ clutter_device_manager_x11_constructed (GObject *gobject)
_clutter_input_device_set_associated_device (manager_x11->core_keyboard,
manager_x11->core_pointer);
clutter_device_manager_x11_a11y_init (manager);
if (G_OBJECT_CLASS (clutter_device_manager_x11_parent_class)->constructed)
G_OBJECT_CLASS (clutter_device_manager_x11_parent_class)->constructed (gobject);
}
@ -483,13 +480,6 @@ clutter_device_manager_x11_get_device (ClutterDeviceManager *manager,
GINT_TO_POINTER (id));
}
static ClutterVirtualInputDevice *
clutter_device_manager_x11_create_virtual_device (ClutterDeviceManager *device_manager,
ClutterInputDeviceType device_type)
{
return g_object_new (CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE_X11, NULL);
}
static void
clutter_device_manager_x11_set_property (GObject *gobject,
guint prop_id,
@ -536,8 +526,6 @@ clutter_device_manager_x11_class_init (ClutterDeviceManagerX11Class *klass)
manager_class->get_devices = clutter_device_manager_x11_get_devices;
manager_class->get_core_device = clutter_device_manager_x11_get_core_device;
manager_class->get_device = clutter_device_manager_x11_get_device;
manager_class->create_virtual_device = clutter_device_manager_x11_create_virtual_device;
manager_class->apply_kbd_a11y_settings = clutter_device_manager_x11_apply_kbd_a11y_settings;
}
static void

View File

@ -29,8 +29,6 @@
#include "clutter-backend-x11.h"
#include "clutter-input-device-xi2.h"
#include "clutter-input-device-tool-xi2.h"
#include "clutter-virtual-input-device-x11.h"
#include "clutter-stage-x11.h"
#include "clutter-backend.h"
@ -40,7 +38,6 @@
#include "clutter-event-translator.h"
#include "clutter-stage-private.h"
#include "clutter-private.h"
#include "clutter-xkb-a11y-x11.h"
#include <X11/extensions/XInput2.h>
@ -67,14 +64,6 @@ static const char *clutter_input_axis_atom_names[] = {
#define N_AXIS_ATOMS G_N_ELEMENTS (clutter_input_axis_atom_names)
enum {
PAD_AXIS_FIRST = 3, /* First axes are always x/y/pressure, ignored in pads */
PAD_AXIS_STRIP1 = PAD_AXIS_FIRST,
PAD_AXIS_STRIP2,
PAD_AXIS_RING1,
PAD_AXIS_RING2,
};
static Atom clutter_input_axis_atoms[N_AXIS_ATOMS] = { 0, };
static void clutter_event_translator_iface_init (ClutterEventTranslatorIface *iface);
@ -368,36 +357,6 @@ get_device_node_path (ClutterBackendX11 *backend_x11,
return node_path;
}
static void
get_pad_features (XIDeviceInfo *info,
guint *n_rings,
guint *n_strips)
{
gint i, rings = 0, strips = 0;
for (i = PAD_AXIS_FIRST; i < info->num_classes; i++)
{
XIValuatorClassInfo *valuator = (XIValuatorClassInfo*) info->classes[i];
int axis = valuator->number;
if (valuator->type != XIValuatorClass)
continue;
if (valuator->max <= 1)
continue;
/* Ring/strip axes are fixed in pad devices as handled by the
* wacom driver. Match those to detect pad features.
*/
if (axis == PAD_AXIS_STRIP1 || axis == PAD_AXIS_STRIP2)
strips++;
else if (axis == PAD_AXIS_RING1 || axis == PAD_AXIS_RING2)
rings++;
}
*n_rings = rings;
*n_strips = strips;
}
static ClutterInputDevice *
create_device (ClutterDeviceManagerXI2 *manager_xi2,
ClutterBackendX11 *backend_x11,
@ -407,7 +366,7 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
ClutterInputDevice *retval;
ClutterInputMode mode;
gboolean is_enabled;
guint num_touches = 0, num_rings = 0, num_strips = 0;
guint num_touches = 0;
gchar *vendor_id = NULL, *product_id = NULL, *node_path = NULL;
if (info->use == XIMasterKeyboard || info->use == XISlaveKeyboard)
@ -435,8 +394,6 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
source = CLUTTER_ERASER_DEVICE;
else if (strstr (name, "cursor") != NULL)
source = CLUTTER_CURSOR_DEVICE;
else if (strstr (name, " pad") != NULL)
source = CLUTTER_PAD_DEVICE;
else if (strstr (name, "wacom") != NULL || strstr (name, "pen") != NULL)
source = CLUTTER_PEN_DEVICE;
else if (strstr (name, "touchpad") != NULL)
@ -475,12 +432,6 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
node_path = get_device_node_path (backend_x11, info);
}
if (source == CLUTTER_PAD_DEVICE)
{
is_enabled = TRUE;
get_pad_features (info, &num_rings, &num_strips);
}
retval = g_object_new (CLUTTER_TYPE_INPUT_DEVICE_XI2,
"name", info->name,
"id", info->deviceid,
@ -493,8 +444,6 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
"vendor-id", vendor_id,
"product-id", product_id,
"device-node", node_path,
"n-rings", num_rings,
"n-strips", num_strips,
NULL);
translate_device_classes (backend_x11->xdpy, retval,
@ -511,46 +460,6 @@ create_device (ClutterDeviceManagerXI2 *manager_xi2,
return retval;
}
static void
pad_passive_button_grab (ClutterInputDevice *device)
{
XIGrabModifiers xi_grab_mods = { XIAnyModifier, };
XIEventMask xi_event_mask;
gint device_id, rc;
device_id = clutter_input_device_get_device_id (device);
xi_event_mask.deviceid = device_id;
xi_event_mask.mask_len = XIMaskLen (XI_LASTEVENT);
xi_event_mask.mask = g_new0 (unsigned char, xi_event_mask.mask_len);
XISetMask (xi_event_mask.mask, XI_Motion);
XISetMask (xi_event_mask.mask, XI_ButtonPress);
XISetMask (xi_event_mask.mask, XI_ButtonRelease);
clutter_x11_trap_x_errors ();
rc = XIGrabButton (clutter_x11_get_default_display (),
device_id, XIAnyButton,
clutter_x11_get_root_window (), None,
XIGrabModeSync, XIGrabModeSync,
True, &xi_event_mask, 1, &xi_grab_mods);
if (rc != 0)
{
g_warning ("Could not passively grab pad device: %s",
clutter_input_device_get_device_name (device));
}
else
{
XIAllowEvents (clutter_x11_get_default_display (),
device_id, XIAsyncDevice,
CLUTTER_CURRENT_TIME);
}
clutter_x11_untrap_x_errors ();
g_free (xi_event_mask.mask);
}
static ClutterInputDevice *
add_device (ClutterDeviceManagerXI2 *manager_xi2,
ClutterBackendX11 *backend_x11,
@ -585,9 +494,6 @@ add_device (ClutterDeviceManagerXI2 *manager_xi2,
g_warning ("Unhandled device: %s",
clutter_input_device_get_device_name (device));
if (clutter_input_device_get_device_type (device) == CLUTTER_PAD_DEVICE)
pad_passive_button_grab (device);
/* relationships between devices and signal emissions are not
* necessary while we're constructing the device manager instance
*/
@ -894,54 +800,6 @@ translate_axes (ClutterInputDevice *device,
return retval;
}
static gboolean
translate_pad_axis (ClutterInputDevice *device,
XIValuatorState *valuators,
ClutterEventType *evtype,
guint *number,
gdouble *value)
{
double *values;
gint i;
values = valuators->values;
for (i = PAD_AXIS_FIRST; i < valuators->mask_len * 8; i++)
{
gdouble val;
guint axis_number = 0;
if (!XIMaskIsSet (valuators->mask, i))
continue;
val = *values++;
if (val <= 0)
continue;
_clutter_input_device_translate_axis (device, i, val, value);
if (i == PAD_AXIS_RING1 || i == PAD_AXIS_RING2)
{
*evtype = CLUTTER_PAD_RING;
(*value) *= 360.0;
}
else if (i == PAD_AXIS_STRIP1 || i == PAD_AXIS_STRIP2)
{
*evtype = CLUTTER_PAD_STRIP;
}
else
continue;
if (i == PAD_AXIS_STRIP2 || i == PAD_AXIS_RING2)
axis_number++;
*number = axis_number;
return TRUE;
}
return FALSE;
}
static void
translate_coords (ClutterStageX11 *stage_x11,
gdouble event_x,
@ -956,8 +814,8 @@ translate_coords (ClutterStageX11 *stage_x11,
clutter_actor_get_size (stage, &stage_width, &stage_height);
*x_out = CLAMP (event_x, 0, stage_width);
*y_out = CLAMP (event_y, 0, stage_height);
*x_out = CLAMP (event_x / stage_x11->scale_factor, 0, stage_width);
*y_out = CLAMP (event_y / stage_x11->scale_factor, 0, stage_height);
}
static gdouble
@ -1048,126 +906,6 @@ clutter_device_manager_xi2_select_stage_events (ClutterDeviceManager *manager,
g_free (mask);
}
static guint
device_get_tool_serial (ClutterBackendX11 *backend_x11,
ClutterInputDevice *device)
{
gulong nitems, bytes_after;
guint32 *data = NULL;
guint serial_id = 0;
int rc, format;
Atom type;
Atom prop;
prop = XInternAtom (backend_x11->xdpy, "Wacom Serial IDs", True);
if (prop == None)
return 0;
clutter_x11_trap_x_errors ();
rc = XIGetProperty (backend_x11->xdpy,
clutter_input_device_get_device_id (device),
prop, 0, 4, FALSE, XA_INTEGER, &type, &format, &nitems, &bytes_after,
(guchar **) &data);
clutter_x11_untrap_x_errors ();
if (rc == Success && type == XA_INTEGER && format == 32 && nitems >= 4)
serial_id = data[3];
XFree (data);
return serial_id;
}
static void
handle_property_event (ClutterDeviceManagerXI2 *manager_xi2,
XIEvent *event)
{
XIPropertyEvent *xev = (XIPropertyEvent *) event;
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
Atom serial_ids_prop = XInternAtom (backend_x11->xdpy, "Wacom Serial IDs", True);
ClutterInputDevice *device;
device = g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (xev->deviceid));
if (!device)
return;
if (xev->property == serial_ids_prop)
{
ClutterInputDeviceTool *tool = NULL;
ClutterInputDeviceToolType type;
guint serial_id;
serial_id = device_get_tool_serial (backend_x11, device);
if (serial_id != 0)
{
tool = g_hash_table_lookup (manager_xi2->tools_by_serial,
GUINT_TO_POINTER (serial_id));
if (!tool)
{
type = clutter_input_device_get_device_type (device) == CLUTTER_ERASER_DEVICE ?
CLUTTER_INPUT_DEVICE_TOOL_ERASER : CLUTTER_INPUT_DEVICE_TOOL_PEN;
tool = clutter_input_device_tool_xi2_new (serial_id, type);
g_hash_table_insert (manager_xi2->tools_by_serial,
GUINT_TO_POINTER (serial_id),
tool);
}
}
clutter_input_device_xi2_update_tool (device, tool);
g_signal_emit_by_name (manager_xi2, "tool-changed", device, tool);
}
}
static gboolean
translate_pad_event (ClutterEvent *event,
XIDeviceEvent *xev,
ClutterInputDevice *device)
{
gdouble value;
guint number;
if (!translate_pad_axis (device, &xev->valuators,
&event->any.type,
&number, &value))
return FALSE;
/* When touching a ring/strip a first XI_Motion event
* is generated. Use it to reset the pad state, so
* later events actually have a directionality.
*/
if (xev->evtype == XI_Motion)
value = -1;
if (event->any.type == CLUTTER_PAD_RING)
{
event->pad_ring.ring_number = number;
event->pad_ring.angle = value;
}
else
{
event->pad_strip.strip_number = number;
event->pad_strip.value = value;
}
event->any.time = xev->time;
clutter_event_set_device (event, device);
clutter_event_set_source_device (event, device);
CLUTTER_NOTE (EVENT,
"%s: win:0x%x, device:%d '%s', time:%d "
"(value:%f)",
event->any.type == CLUTTER_PAD_RING
? "pad ring "
: "pad strip",
(unsigned int) xev->event,
device->id,
device->device_name,
event->any.time, value);
return TRUE;
}
static ClutterTranslateReturn
clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
gpointer native,
@ -1199,8 +937,7 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
return CLUTTER_TRANSLATE_REMOVE;
if (!(xi_event->evtype == XI_HierarchyChanged ||
xi_event->evtype == XI_DeviceChanged ||
xi_event->evtype == XI_PropertyEvent))
xi_event->evtype == XI_DeviceChanged))
{
stage = get_event_stage (translator, xi_event);
if (stage == NULL || CLUTTER_ACTOR_IN_DESTRUCTION (stage))
@ -1341,59 +1078,6 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
stage != NULL)
_clutter_input_device_set_stage (device, stage);
if (clutter_input_device_get_device_type (source_device) == CLUTTER_PAD_DEVICE)
{
/* We got these events because of the passive button grab */
XIAllowEvents (clutter_x11_get_default_display (),
xev->sourceid,
XIAsyncDevice,
xev->time);
event->any.stage = stage;
if (xev->detail >= 4 && xev->detail <= 7)
{
retval = CLUTTER_TRANSLATE_REMOVE;
if (xi_event->evtype == XI_ButtonPress &&
translate_pad_event (event, xev, source_device))
retval = CLUTTER_TRANSLATE_QUEUE;
break;
}
event->any.type =
(xi_event->evtype == XI_ButtonPress) ? CLUTTER_PAD_BUTTON_PRESS
: CLUTTER_PAD_BUTTON_RELEASE;
event->any.time = xev->time;
/* The 4-7 button range is taken as non-existent on pad devices,
* let the buttons above that take over this range.
*/
if (xev->detail > 7)
xev->detail -= 4;
/* Pad buttons are 0-indexed */
event->pad_button.button = xev->detail - 1;
clutter_event_set_device (event, device);
clutter_event_set_source_device (event, source_device);
CLUTTER_NOTE (EVENT,
"%s: win:0x%x, device:%d '%s', time:%d "
"(button:%d)",
event->any.type == CLUTTER_BUTTON_PRESS
? "pad button press "
: "pad button release",
(unsigned int) stage_x11->xwin,
device->id,
device->device_name,
event->any.time,
event->pad_button.button);
retval = CLUTTER_TRANSLATE_QUEUE;
break;
}
switch (xev->detail)
{
case 4:
@ -1473,8 +1157,6 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
clutter_event_set_source_device (event, source_device);
clutter_event_set_device (event, device);
clutter_event_set_device_tool (event,
clutter_input_device_xi2_get_current_tool (source_device));
event->button.axes = translate_axes (event->button.device,
event->button.x,
@ -1532,15 +1214,6 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
device = g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (xev->deviceid));
if (clutter_input_device_get_device_type (source_device) == CLUTTER_PAD_DEVICE)
{
event->any.stage = stage;
if (translate_pad_event (event, xev, source_device))
retval = CLUTTER_TRANSLATE_QUEUE;
break;
}
/* Set the stage for core events coming out of nowhere (see bug #684509) */
if (clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_MASTER &&
clutter_input_device_get_pointer_stage (device) == NULL &&
@ -1592,8 +1265,6 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
clutter_event_set_source_device (event, source_device);
clutter_event_set_device (event, device);
clutter_event_set_device_tool (event,
clutter_input_device_xi2_get_current_tool (source_device));
event->motion.axes = translate_axes (event->motion.device,
event->motion.x,
@ -1795,10 +1466,6 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
case XI_FocusOut:
retval = CLUTTER_TRANSLATE_CONTINUE;
break;
case XI_PropertyEvent:
handle_property_event (manager_xi2, xi_event);
retval = CLUTTER_TRANSLATE_CONTINUE;
break;
}
return retval;
@ -1976,7 +1643,6 @@ clutter_device_manager_xi2_constructed (GObject *gobject)
XISetMask (mask, XI_HierarchyChanged);
XISetMask (mask, XI_DeviceChanged);
XISetMask (mask, XI_PropertyEvent);
event_mask.deviceid = XIAllDevices;
event_mask.mask_len = sizeof (mask);
@ -1988,8 +1654,6 @@ clutter_device_manager_xi2_constructed (GObject *gobject)
XSync (backend_x11->xdpy, False);
clutter_device_manager_x11_a11y_init (manager);
if (G_OBJECT_CLASS (clutter_device_manager_xi2_parent_class)->constructed)
G_OBJECT_CLASS (clutter_device_manager_xi2_parent_class)->constructed (gobject);
}
@ -2014,16 +1678,6 @@ clutter_device_manager_xi2_set_property (GObject *gobject,
}
}
static ClutterVirtualInputDevice *
clutter_device_manager_xi2_create_virtual_device (ClutterDeviceManager *manager,
ClutterInputDeviceType device_type)
{
return g_object_new (CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE_X11,
"device-manager", manager,
"device-type", device_type,
NULL);
}
static void
clutter_device_manager_xi2_class_init (ClutterDeviceManagerXI2Class *klass)
{
@ -2051,8 +1705,6 @@ clutter_device_manager_xi2_class_init (ClutterDeviceManagerXI2Class *klass)
manager_class->get_core_device = clutter_device_manager_xi2_get_core_device;
manager_class->get_device = clutter_device_manager_xi2_get_device;
manager_class->select_stage_events = clutter_device_manager_xi2_select_stage_events;
manager_class->create_virtual_device = clutter_device_manager_xi2_create_virtual_device;
manager_class->apply_kbd_a11y_settings = clutter_device_manager_x11_apply_kbd_a11y_settings;
}
static void
@ -2061,6 +1713,4 @@ clutter_device_manager_xi2_init (ClutterDeviceManagerXI2 *self)
self->devices_by_id = g_hash_table_new_full (NULL, NULL,
NULL,
(GDestroyNotify) g_object_unref);
self->tools_by_serial = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) g_object_unref);
}

View File

@ -43,7 +43,6 @@ struct _ClutterDeviceManagerXI2
ClutterDeviceManager parent_instance;
GHashTable *devices_by_id;
GHashTable *tools_by_serial;
GSList *all_devices;

View File

@ -1,51 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright © 2016 Red Hat
*
* 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/>.
*
* Author: Carlos Garnacho <carlosg@gnome.org>
*/
#ifdef HAVE_CONFIG_H
#include "clutter-build-config.h"
#endif
#include "clutter-input-device-tool-xi2.h"
G_DEFINE_TYPE (ClutterInputDeviceToolXI2, clutter_input_device_tool_xi2,
CLUTTER_TYPE_INPUT_DEVICE_TOOL)
static void
clutter_input_device_tool_xi2_class_init (ClutterInputDeviceToolXI2Class *klass)
{
}
static void
clutter_input_device_tool_xi2_init (ClutterInputDeviceToolXI2 *tool)
{
}
ClutterInputDeviceTool *
clutter_input_device_tool_xi2_new (guint serial,
ClutterInputDeviceToolType type)
{
return g_object_new (CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2,
"type", type,
"serial", serial,
NULL);
}

View File

@ -1,74 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright © 2016 Red Hat
*
* 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/>.
*
* Author: Carlos Garnacho <carlosg@gnome.org>
*/
#ifndef __CLUTTER_INPUT_DEVICE_XI2_TOOL_H__
#define __CLUTTER_INPUT_DEVICE_XI2_TOOL_H__
#include <clutter/clutter-input-device-tool.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2 (clutter_input_device_tool_xi2_get_type ())
#define CLUTTER_INPUT_DEVICE_TOOL_XI2(o) \
(G_TYPE_CHECK_INSTANCE_CAST ((o), \
CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2, ClutterInputDeviceToolXI2))
#define CLUTTER_IS_INPUT_DEVICE_TOOL_XI2(o) \
(G_TYPE_CHECK_INSTANCE_TYPE ((o), \
CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2))
#define CLUTTER_INPUT_DEVICE_TOOL_XI2_CLASS(c) \
(G_TYPE_CHECK_CLASS_CAST ((c), \
CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2, ClutterInputDeviceToolXI2Class))
#define CLUTTER_IS_INPUT_DEVICE_TOOL_XI2_CLASS(c) \
(G_TYPE_CHECK_CLASS_TYPE ((c), \
CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2))
#define CLUTTER_INPUT_DEVICE_TOOL_XI2_GET_CLASS(o) \
(G_TYPE_INSTANCE_GET_CLASS ((o), \
CLUTTER_TYPE_INPUT_DEVICE_TOOL_XI2, ClutterInputDeviceToolXI2Class))
typedef struct _ClutterInputDeviceToolXI2 ClutterInputDeviceToolXI2;
typedef struct _ClutterInputDeviceToolXI2Class ClutterInputDeviceToolXI2Class;
struct _ClutterInputDeviceToolXI2
{
ClutterInputDeviceTool parent_instance;
struct libinput_tablet_tool *tool;
};
struct _ClutterInputDeviceToolXI2Class
{
ClutterInputDeviceToolClass parent_class;
};
GType clutter_input_device_tool_xi2_get_type (void) G_GNUC_CONST;
ClutterInputDeviceTool * clutter_input_device_tool_xi2_new (guint serial,
ClutterInputDeviceToolType type);
G_END_DECLS
#endif /* __CLUTTER_INPUT_DEVICE_XI2_TOOL_H__ */

View File

@ -44,7 +44,6 @@ struct _ClutterInputDeviceXI2
ClutterInputDevice device;
gint device_id;
ClutterInputDeviceTool *current_tool;
};
#define N_BUTTONS 5
@ -80,13 +79,6 @@ clutter_input_device_xi2_keycode_to_evdev (ClutterInputDevice *device,
return TRUE;
}
static gboolean
clutter_input_device_xi2_is_grouped (ClutterInputDevice *device,
ClutterInputDevice *other_device)
{
return FALSE;
}
static void
clutter_input_device_xi2_class_init (ClutterInputDeviceXI2Class *klass)
{
@ -96,7 +88,6 @@ clutter_input_device_xi2_class_init (ClutterInputDeviceXI2Class *klass)
gobject_class->constructed = clutter_input_device_xi2_constructed;
device_class->keycode_to_evdev = clutter_input_device_xi2_keycode_to_evdev;
device_class->is_grouped = clutter_input_device_xi2_is_grouped;
}
static void
@ -181,18 +172,3 @@ _clutter_input_device_xi2_translate_state (ClutterEvent *event,
_clutter_event_set_state_full (event, button, base, latched, locked, effective);
}
void
clutter_input_device_xi2_update_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool)
{
ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);
g_set_object (&device_xi2->current_tool, tool);
}
ClutterInputDeviceTool *
clutter_input_device_xi2_get_current_tool (ClutterInputDevice *device)
{
ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (device);
return device_xi2->current_tool;
}

View File

@ -41,9 +41,6 @@ void _clutter_input_device_xi2_translate_state (ClutterEvent *event,
XIModifierState *modifiers_state,
XIButtonState *buttons_state,
XIGroupState *group_state);
void clutter_input_device_xi2_update_tool (ClutterInputDevice *device,
ClutterInputDeviceTool *tool);
ClutterInputDeviceTool * clutter_input_device_xi2_get_current_tool (ClutterInputDevice *device);
G_END_DECLS

View File

@ -6,14 +6,18 @@ static const struct {
const char *xsetting_name;
const char *settings_property;
} _clutter_settings_map[] = {
{ "Net/DoubleClickTime", "double-click-time" },
{ "Net/DoubleClickDistance", "double-click-distance" },
{ "Net/DndDragThreshold", "dnd-drag-threshold" },
{ "Gtk/FontName", "font-name" },
{ "Xft/Antialias", "font-antialias" },
{ "Xft/DPI", "font-dpi" },
{ "Xft/Hinting", "font-hinting" },
{ "Xft/HintStyle", "font-hint-style" },
{ "Xft/RGBA", "font-subpixel-order" },
{ "Fontconfig/Timestamp", "fontconfig-timestamp" },
{ "Gdk/WindowScalingFactor", "window-scaling-factor" },
{ "Gdk/UnscaledDPI", "unscaled-font-dpi" },
};
static const gint _n_clutter_settings_map = G_N_ELEMENTS (_clutter_settings_map);

View File

@ -162,10 +162,10 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
&min_height);
if (new_width <= 0)
new_width = min_width;
new_width = min_width * stage_x11->scale_factor;
if (new_height <= 0)
new_height = min_height;
new_height = min_height * stage_x11->scale_factor;
size_hints->flags = 0;
@ -175,8 +175,8 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
{
if (resize)
{
size_hints->min_width = min_width;
size_hints->min_height = min_height;
size_hints->min_width = min_width * stage_x11->scale_factor;
size_hints->min_height = min_height * stage_x11->scale_factor;
size_hints->flags = PMinSize;
}
else
@ -236,8 +236,8 @@ clutter_stage_x11_get_geometry (ClutterStageWindow *stage_window,
return;
}
geometry->width = stage_x11->xwin_width;
geometry->height = stage_x11->xwin_height;
geometry->width = stage_x11->xwin_width / stage_x11->scale_factor;
geometry->height = stage_x11->xwin_height / stage_x11->scale_factor;
}
static void
@ -255,8 +255,8 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window,
* so we need to manually set the size and queue a relayout on the
* stage here (as is normally done in response to ConfigureNotify).
*/
stage_x11->xwin_width = width;
stage_x11->xwin_height = height;
stage_x11->xwin_width = width * stage_x11->scale_factor;
stage_x11->xwin_height = height * stage_x11->scale_factor;
clutter_actor_queue_relayout (CLUTTER_ACTOR (stage_cogl->wrapper));
return;
}
@ -277,6 +277,9 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window,
CLUTTER_NOTE (BACKEND, "New size received: (%d, %d)", width, height);
width *= stage_x11->scale_factor;
height *= stage_x11->scale_factor;
if (stage_x11->xwin != None)
{
clutter_stage_x11_fix_window_size (stage_x11, width, height);
@ -397,6 +400,20 @@ set_cursor_visible (ClutterStageX11 *stage_x11)
}
}
static void
on_window_scaling_factor_notify (GObject *settings,
GParamSpec *pspec,
ClutterStageX11 *stage_x11)
{
g_object_get (settings,
"window-scaling-factor", &stage_x11->scale_factor,
NULL);
clutter_stage_x11_resize (CLUTTER_STAGE_WINDOW (stage_x11),
stage_x11->xwin_width,
stage_x11->xwin_height);
}
static void
clutter_stage_x11_unrealize (ClutterStageWindow *stage_window)
{
@ -626,8 +643,12 @@ clutter_stage_x11_realize (ClutterStageWindow *stage_window)
CLUTTER_NOTE (BACKEND, "Wrapper size: %.2f x %.2f", width, height);
CLUTTER_NOTE (BACKEND, "Creating a new Cogl onscreen surface: %.2f x %.2f",
width, height);
width = width * (float) stage_x11->scale_factor;
height = height * (float) stage_x11->scale_factor;
CLUTTER_NOTE (BACKEND, "Creating a new Cogl onscreen surface: %.2f x %.2f (factor: %d)",
width, height,
stage_x11->scale_factor);
stage_x11->onscreen = cogl_onscreen_new (backend->cogl_context, width, height);
@ -888,6 +909,28 @@ clutter_stage_x11_can_clip_redraws (ClutterStageWindow *stage_window)
return stage_x11->clipped_redraws_cool_off == 0;
}
static void
clutter_stage_x11_set_scale_factor (ClutterStageWindow *stage_window,
int factor)
{
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
if (stage_x11->scale_factor == factor)
return;
stage_x11->scale_factor = factor;
clutter_stage_x11_resize (stage_window, stage_x11->xwin_width, stage_x11->xwin_height);
}
static int
clutter_stage_x11_get_scale_factor (ClutterStageWindow *stage_window)
{
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
return stage_x11->scale_factor;
}
static void
ensure_legacy_view (ClutterStageWindow *stage_window)
{
@ -959,6 +1002,8 @@ clutter_stage_x11_class_init (ClutterStageX11Class *klass)
static void
clutter_stage_x11_init (ClutterStageX11 *stage)
{
ClutterSettings *settings;
stage->xwin = None;
stage->xwin_width = 640;
stage->xwin_height = 480;
@ -971,6 +1016,12 @@ clutter_stage_x11_init (ClutterStageX11 *stage)
stage->accept_focus = TRUE;
stage->title = NULL;
settings = clutter_settings_get_default ();
g_signal_connect (settings, "notify::window-scaling-factor",
G_CALLBACK (on_window_scaling_factor_notify),
stage);
on_window_scaling_factor_notify (G_OBJECT (settings), NULL, stage);
}
static void
@ -990,6 +1041,8 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
iface->realize = clutter_stage_x11_realize;
iface->unrealize = clutter_stage_x11_unrealize;
iface->can_clip_redraws = clutter_stage_x11_can_clip_redraws;
iface->set_scale_factor = clutter_stage_x11_set_scale_factor;
iface->get_scale_factor = clutter_stage_x11_get_scale_factor;
iface->get_views = clutter_stage_x11_get_views;
iface->get_frame_counter = clutter_stage_x11_get_frame_counter;
}
@ -1114,8 +1167,8 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
stage_x11->xwin_height = xevent->xconfigure.height;
}
stage_width = xevent->xconfigure.width;
stage_height = xevent->xconfigure.height;
stage_width = xevent->xconfigure.width / stage_x11->scale_factor;
stage_height = xevent->xconfigure.height / stage_x11->scale_factor;
clutter_actor_set_size (CLUTTER_ACTOR (stage), stage_width, stage_height);
if (size_changed)
@ -1282,10 +1335,10 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
expose->width,
expose->height);
clip.x = expose->x;
clip.y = expose->y;
clip.width = expose->width;
clip.height = expose->height;
clip.x = expose->x / stage_x11->scale_factor;
clip.y = expose->y / stage_x11->scale_factor;
clip.width = expose->width / stage_x11->scale_factor;
clip.height = expose->height / stage_x11->scale_factor;
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stage), &clip);
}
break;
@ -1451,8 +1504,8 @@ set_foreign_window_callback (ClutterActor *actor,
fwd->stage_x11->xwin = fwd->xwindow;
fwd->stage_x11->is_foreign_xwin = TRUE;
fwd->stage_x11->xwin_width = fwd->geom.width;
fwd->stage_x11->xwin_height = fwd->geom.height;
fwd->stage_x11->xwin_width = fwd->geom.width * fwd->stage_x11->scale_factor;
fwd->stage_x11->xwin_height = fwd->geom.height * fwd->stage_x11->scale_factor;
clutter_actor_set_size (actor, fwd->geom.width, fwd->geom.height);
@ -1546,8 +1599,8 @@ clutter_x11_set_stage_foreign (ClutterStage *stage,
fwd.geom.x = x;
fwd.geom.y = y;
fwd.geom.width = width;
fwd.geom.height = height;
fwd.geom.width = width / stage_x11->scale_factor;
fwd.geom.height = height / stage_x11->scale_factor;
actor = CLUTTER_ACTOR (stage);

View File

@ -69,6 +69,8 @@ struct _ClutterStageX11
ClutterStageX11State wm_state;
int scale_factor;
guint is_foreign_xwin : 1;
guint fullscreening : 1;
guint is_cursor_visible : 1;

View File

@ -1,110 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2016 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Jonas Ådahl <jadahl@gmail.com>
*/
#ifdef HAVE_CONFIG_H
#include "clutter-build-config.h"
#endif
#include <glib-object.h>
#include "clutter-x11.h"
#include "X11/extensions/XTest.h"
#include "clutter-virtual-input-device.h"
#include "x11/clutter-virtual-input-device-x11.h"
struct _ClutterVirtualInputDeviceX11
{
ClutterVirtualInputDevice parent;
};
G_DEFINE_TYPE (ClutterVirtualInputDeviceX11,
clutter_virtual_input_device_x11,
CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE)
static void
clutter_virtual_input_device_x11_notify_relative_motion (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
double dx,
double dy)
{
}
static void
clutter_virtual_input_device_x11_notify_absolute_motion (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
double x,
double y)
{
}
static void
clutter_virtual_input_device_x11_notify_button (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t button,
ClutterButtonState button_state)
{
XTestFakeButtonEvent (clutter_x11_get_default_display (),
button, button_state == CLUTTER_BUTTON_STATE_PRESSED, 0);
}
static void
clutter_virtual_input_device_x11_notify_key (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t key,
ClutterKeyState key_state)
{
XTestFakeKeyEvent (clutter_x11_get_default_display (),
key, key_state == CLUTTER_KEY_STATE_PRESSED, 0);
}
static void
clutter_virtual_input_device_x11_notify_keyval (ClutterVirtualInputDevice *virtual_device,
uint64_t time_us,
uint32_t keyval,
ClutterKeyState key_state)
{
KeyCode keycode;
keycode = XKeysymToKeycode (clutter_x11_get_default_display (), keyval);
XTestFakeKeyEvent (clutter_x11_get_default_display (),
keycode, key_state == CLUTTER_KEY_STATE_PRESSED, 0);
}
static void
clutter_virtual_input_device_x11_init (ClutterVirtualInputDeviceX11 *virtual_device_x11)
{
}
static void
clutter_virtual_input_device_x11_class_init (ClutterVirtualInputDeviceX11Class *klass)
{
ClutterVirtualInputDeviceClass *virtual_input_device_class =
CLUTTER_VIRTUAL_INPUT_DEVICE_CLASS (klass);
virtual_input_device_class->notify_relative_motion = clutter_virtual_input_device_x11_notify_relative_motion;
virtual_input_device_class->notify_absolute_motion = clutter_virtual_input_device_x11_notify_absolute_motion;
virtual_input_device_class->notify_button = clutter_virtual_input_device_x11_notify_button;
virtual_input_device_class->notify_key = clutter_virtual_input_device_x11_notify_key;
virtual_input_device_class->notify_keyval = clutter_virtual_input_device_x11_notify_keyval;
}

View File

@ -1,35 +0,0 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2016 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Jonas Ådahl <jadahl@gmail.com>
*/
#ifndef __CLUTTER_VIRTUAL_INPUT_DEVICE_X11_H__
#define __CLUTTER_VIRTUAL_INPUT_DEVICE_X11_H__
#include "clutter-virtual-input-device.h"
#define CLUTTER_TYPE_VIRTUAL_INPUT_DEVICE_X11 (clutter_virtual_input_device_x11_get_type ())
G_DECLARE_FINAL_TYPE (ClutterVirtualInputDeviceX11,
clutter_virtual_input_device_x11,
CLUTTER, VIRTUAL_INPUT_DEVICE_X11,
ClutterVirtualInputDevice)
#endif /* __CLUTTER_VIRTUAL_INPUT_DEVICE_X11_H__ */

View File

@ -1,328 +0,0 @@
/*
*
* Copyright © 2001 Ximian, Inc.
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
* Copyright (C) 2017 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
*/
#include "clutter-device-manager-private.h"
#include "clutter-xkb-a11y-x11.h"
#include <X11/XKBlib.h>
#include <X11/extensions/XKBstr.h>
#define DEFAULT_XKB_SET_CONTROLS_MASK XkbSlowKeysMask | \
XkbBounceKeysMask | \
XkbStickyKeysMask | \
XkbMouseKeysMask | \
XkbMouseKeysAccelMask | \
XkbAccessXKeysMask | \
XkbAccessXTimeoutMask | \
XkbAccessXFeedbackMask | \
XkbControlsEnabledMask
static int _xkb_event_base;
static XkbDescRec *
get_xkb_desc_rec (ClutterBackendX11 *backend_x11)
{
XkbDescRec *desc;
Status status = Success;
clutter_x11_trap_x_errors ();
desc = XkbGetMap (backend_x11->xdpy, XkbAllMapComponentsMask, XkbUseCoreKbd);
if (desc != NULL)
{
desc->ctrls = NULL;
status = XkbGetControls (backend_x11->xdpy, XkbAllControlsMask, desc);
}
clutter_x11_untrap_x_errors ();
g_return_val_if_fail (desc != NULL, NULL);
g_return_val_if_fail (desc->ctrls != NULL, NULL);
g_return_val_if_fail (status == Success, NULL);
return desc;
}
static void
set_xkb_desc_rec (ClutterBackendX11 *backend_x11,
XkbDescRec *desc)
{
clutter_x11_trap_x_errors ();
XkbSetControls (backend_x11->xdpy, DEFAULT_XKB_SET_CONTROLS_MASK, desc);
XSync (backend_x11->xdpy, FALSE);
clutter_x11_untrap_x_errors ();
}
static void
check_settings_changed (ClutterDeviceManager *device_manager)
{
ClutterBackendX11 *backend_x11;
ClutterKbdA11ySettings kbd_a11y_settings;
ClutterKeyboardA11yFlags what_changed = 0;
XkbDescRec *desc;
backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
desc = get_xkb_desc_rec (backend_x11);
if (!desc)
return;
clutter_device_manager_get_kbd_a11y_settings (device_manager, &kbd_a11y_settings);
if (desc->ctrls->enabled_ctrls & XkbSlowKeysMask &&
!(kbd_a11y_settings.controls & CLUTTER_A11Y_SLOW_KEYS_ENABLED))
{
what_changed |= CLUTTER_A11Y_SLOW_KEYS_ENABLED;
kbd_a11y_settings.controls |= CLUTTER_A11Y_SLOW_KEYS_ENABLED;
}
else if (!(desc->ctrls->enabled_ctrls & XkbSlowKeysMask) &&
kbd_a11y_settings.controls & CLUTTER_A11Y_SLOW_KEYS_ENABLED)
{
what_changed |= CLUTTER_A11Y_SLOW_KEYS_ENABLED;
kbd_a11y_settings.controls &= ~CLUTTER_A11Y_SLOW_KEYS_ENABLED;
}
if (desc->ctrls->enabled_ctrls & XkbStickyKeysMask &&
!(kbd_a11y_settings.controls & CLUTTER_A11Y_STICKY_KEYS_ENABLED))
{
what_changed |= CLUTTER_A11Y_STICKY_KEYS_ENABLED;
kbd_a11y_settings.controls |= CLUTTER_A11Y_STICKY_KEYS_ENABLED;
}
else if (!(desc->ctrls->enabled_ctrls & XkbStickyKeysMask) &&
kbd_a11y_settings.controls & CLUTTER_A11Y_STICKY_KEYS_ENABLED)
{
what_changed |= CLUTTER_A11Y_STICKY_KEYS_ENABLED;
kbd_a11y_settings.controls &= ~CLUTTER_A11Y_STICKY_KEYS_ENABLED;
}
if (what_changed)
g_signal_emit_by_name (device_manager,
"kbd-a11y-flags-changed",
kbd_a11y_settings.controls,
what_changed);
XkbFreeKeyboard (desc, XkbAllComponentsMask, TRUE);
}
static ClutterX11FilterReturn
xkb_a11y_event_filter (XEvent *xevent,
ClutterEvent *clutter_event,
gpointer data)
{
ClutterDeviceManager *device_manager = CLUTTER_DEVICE_MANAGER (data);
XkbEvent *xkbev = (XkbEvent *) xevent;
/* 'event_type' is set to zero on notifying us of updates in
* response to client requests (including our own) and non-zero
* to notify us of key/mouse events causing changes (like
* pressing shift 5 times to enable sticky keys).
*
* We only want to update out settings when it's in response to an
* explicit user input event, so require a non-zero event_type.
*/
if (xevent->xany.type == (_xkb_event_base + XkbEventCode) &&
xkbev->any.xkb_type == XkbControlsNotify && xkbev->ctrls.event_type != 0)
check_settings_changed (device_manager);
return CLUTTER_X11_FILTER_CONTINUE;
}
static gboolean
is_xkb_available (ClutterBackendX11 *backend_x11)
{
gint opcode, error_base, event_base, major, minor;
if (_xkb_event_base)
return TRUE;
if (!XkbQueryExtension (backend_x11->xdpy,
&opcode,
&event_base,
&error_base,
&major,
&minor))
return FALSE;
if (!XkbUseExtension (backend_x11->xdpy, &major, &minor))
return FALSE;
_xkb_event_base = event_base;
return TRUE;
}
static unsigned long
set_value_mask (gboolean flag,
unsigned long value,
unsigned long mask)
{
if (flag)
return value | mask;
return value & ~mask;
}
static gboolean
set_xkb_ctrl (XkbDescRec *desc,
ClutterKeyboardA11yFlags settings,
ClutterKeyboardA11yFlags flag,
unsigned long mask)
{
gboolean result = (settings & flag) == flag;
desc->ctrls->enabled_ctrls = set_value_mask (result, desc->ctrls->enabled_ctrls, mask);
return result;
}
void
clutter_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *kbd_a11y_settings)
{
ClutterBackendX11 *backend_x11;
XkbDescRec *desc;
gboolean enable_accessX;
backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
desc = get_xkb_desc_rec (backend_x11);
if (!desc)
return;
/* general */
enable_accessX = kbd_a11y_settings->controls & CLUTTER_A11Y_KEYBOARD_ENABLED;
desc->ctrls->enabled_ctrls = set_value_mask (enable_accessX,
desc->ctrls->enabled_ctrls,
XkbAccessXKeysMask);
if (set_xkb_ctrl (desc, kbd_a11y_settings->controls, CLUTTER_A11Y_TIMEOUT_ENABLED,
XkbAccessXTimeoutMask))
{
desc->ctrls->ax_timeout = kbd_a11y_settings->timeout_delay;
/* disable only the master flag via the server we will disable
* the rest on the rebound without affecting settings state
* don't change the option flags at all.
*/
desc->ctrls->axt_ctrls_mask = XkbAccessXKeysMask | XkbAccessXFeedbackMask;
desc->ctrls->axt_ctrls_values = 0;
desc->ctrls->axt_opts_mask = 0;
}
desc->ctrls->ax_options =
set_value_mask (kbd_a11y_settings->controls & CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP,
desc->ctrls->ax_options,
XkbAccessXFeedbackMask | XkbAX_FeatureFBMask | XkbAX_SlowWarnFBMask);
/* bounce keys */
if (set_xkb_ctrl (desc, kbd_a11y_settings->controls,
CLUTTER_A11Y_BOUNCE_KEYS_ENABLED, XkbBounceKeysMask))
{
desc->ctrls->debounce_delay = kbd_a11y_settings->debounce_delay;
desc->ctrls->ax_options =
set_value_mask (kbd_a11y_settings->controls & CLUTTER_A11Y_BOUNCE_KEYS_BEEP_REJECT,
desc->ctrls->ax_options,
XkbAccessXFeedbackMask | XkbAX_BKRejectFBMask);
}
/* mouse keys */
if (set_xkb_ctrl (desc, kbd_a11y_settings->controls,
CLUTTER_A11Y_MOUSE_KEYS_ENABLED, XkbMouseKeysMask | XkbMouseKeysAccelMask))
{
gint mk_max_speed;
gint mk_accel_time;
desc->ctrls->mk_interval = 100; /* msec between mousekey events */
desc->ctrls->mk_curve = 50;
/* We store pixels / sec, XKB wants pixels / event */
mk_max_speed = kbd_a11y_settings->mousekeys_max_speed;
desc->ctrls->mk_max_speed = mk_max_speed / (1000 / desc->ctrls->mk_interval);
if (desc->ctrls->mk_max_speed <= 0)
desc->ctrls->mk_max_speed = 1;
mk_accel_time = kbd_a11y_settings->mousekeys_accel_time;
desc->ctrls->mk_time_to_max = mk_accel_time / desc->ctrls->mk_interval;
if (desc->ctrls->mk_time_to_max <= 0)
desc->ctrls->mk_time_to_max = 1;
desc->ctrls->mk_delay = kbd_a11y_settings->mousekeys_init_delay;
}
/* slow keys */
if (set_xkb_ctrl (desc, kbd_a11y_settings->controls,
CLUTTER_A11Y_SLOW_KEYS_ENABLED, XkbSlowKeysMask))
{
desc->ctrls->ax_options =
set_value_mask (kbd_a11y_settings->controls & CLUTTER_A11Y_SLOW_KEYS_BEEP_PRESS,
desc->ctrls->ax_options, XkbAccessXFeedbackMask | XkbAX_SKPressFBMask);
desc->ctrls->ax_options =
set_value_mask (kbd_a11y_settings->controls & CLUTTER_A11Y_SLOW_KEYS_BEEP_ACCEPT,
desc->ctrls->ax_options, XkbAccessXFeedbackMask | XkbAX_SKAcceptFBMask);
desc->ctrls->ax_options =
set_value_mask (kbd_a11y_settings->controls & CLUTTER_A11Y_SLOW_KEYS_BEEP_REJECT,
desc->ctrls->ax_options, XkbAccessXFeedbackMask | XkbAX_SKRejectFBMask);
desc->ctrls->slow_keys_delay = kbd_a11y_settings->slowkeys_delay;
/* anything larger than 500 seems to loose all keyboard input */
if (desc->ctrls->slow_keys_delay > 500)
desc->ctrls->slow_keys_delay = 500;
}
/* sticky keys */
if (set_xkb_ctrl (desc, kbd_a11y_settings->controls,
CLUTTER_A11Y_STICKY_KEYS_ENABLED, XkbStickyKeysMask))
{
desc->ctrls->ax_options |= XkbAX_LatchToLockMask;
desc->ctrls->ax_options =
set_value_mask (kbd_a11y_settings->controls & CLUTTER_A11Y_STICKY_KEYS_TWO_KEY_OFF,
desc->ctrls->ax_options, XkbAccessXFeedbackMask | XkbAX_TwoKeysMask);
desc->ctrls->ax_options =
set_value_mask (kbd_a11y_settings->controls & CLUTTER_A11Y_STICKY_KEYS_BEEP,
desc->ctrls->ax_options, XkbAccessXFeedbackMask | XkbAX_StickyKeysFBMask);
}
/* toggle keys */
desc->ctrls->ax_options =
set_value_mask (kbd_a11y_settings->controls & CLUTTER_A11Y_TOGGLE_KEYS_ENABLED,
desc->ctrls->ax_options, XkbAccessXFeedbackMask | XkbAX_IndicatorFBMask);
set_xkb_desc_rec (backend_x11, desc);
XkbFreeKeyboard (desc, XkbAllComponentsMask, TRUE);
}
gboolean
clutter_device_manager_x11_a11y_init (ClutterDeviceManager *device_manager)
{
ClutterBackendX11 *backend_x11;
guint event_mask;
backend_x11 =
CLUTTER_BACKEND_X11 (_clutter_device_manager_get_backend (device_manager));
if (!is_xkb_available (backend_x11))
return FALSE;
event_mask = XkbControlsNotifyMask | XkbAccessXNotifyMask;
XkbSelectEvents (backend_x11->xdpy, XkbUseCoreKbd, event_mask, event_mask);
clutter_x11_add_filter (xkb_a11y_event_filter, device_manager);
return TRUE;
}

View File

@ -1,39 +0,0 @@
/*
*
* Copyright © 2001 Ximian, Inc.
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
* Copyright (C) 2017 Red Hat
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
*/
#ifndef CLUTTER_XKB_A11Y_X11_H
#define CLUTTER_XKB_A11Y_X11_H
#include "clutter-device-manager-private.h"
#include "clutter-backend-x11.h"
#include <X11/Xlib.h>
void
clutter_device_manager_x11_apply_kbd_a11y_settings (ClutterDeviceManager *device_manager,
ClutterKbdA11ySettings *kbd_a11y_settings);
gboolean
clutter_device_manager_x11_a11y_init (ClutterDeviceManager *device_manager);
#endif /* CLUTTER_XKB_A11Y_X11_H */

View File

@ -42,6 +42,9 @@ m4_define([clutter_release_status],
m4_define([clutter_version], [clutter_major_version.clutter_minor_version.clutter_micro_version])
# change this only when breaking the API
m4_define([clutter_api_version], [1.0])
AC_PREREQ([2.63])
AC_INIT([clutter],
@ -58,18 +61,12 @@ AC_CONFIG_MACRO_DIR([build/autotools])
AM_INIT_AUTOMAKE([1.11 foreign -Wno-portability no-define no-dist-gzip dist-xz tar-ustar])
AM_SILENT_RULES([yes])
dnl = Check that we are configured by mutter ==============================
AC_ARG_VAR([MUTTER_VERSION])
AC_ARG_VAR([LIBMUTTER_API_VERSION])
AS_IF([test "x$MUTTER_VERSION" = "x"],
[AC_MSG_ERROR([Clutter can only be configured by mutter])],)
AC_SUBST([CLUTTER_MAJOR_VERSION], [clutter_major_version])
AC_SUBST([CLUTTER_MINOR_VERSION], [clutter_minor_version])
AC_SUBST([CLUTTER_MICRO_VERSION], [clutter_micro_version])
AC_SUBST([CLUTTER_VERSION], [clutter_version])
AC_SUBST([CLUTTER_API_VERSION], [clutter_api_version])
AC_SUBST([CLUTTER_API_VERSION_AM], [$CLUTTER_MAJOR_VERSION\_0])
AC_SUBST([CLUTTER_RELEASE_STATUS], [clutter_release_status])
m4_define([lt_current], [m4_eval(100 * clutter_minor_version + clutter_micro_version - clutter_interface_age)])
@ -110,7 +107,7 @@ LT_LIB_M
AC_HEADER_STDC
# required versions for dependencies
m4_define([glib_req_version], [2.53.2])
m4_define([glib_req_version], [2.44.0])
m4_define([cogl_req_version], [1.21.2])
m4_define([json_glib_req_version], [0.12.0])
m4_define([atk_req_version], [2.5.3])
@ -119,7 +116,7 @@ m4_define([pango_req_version], [1.30])
m4_define([gi_req_version], [1.39.0])
m4_define([xcomposite_req_version], [0.4])
m4_define([gdk_req_version], [3.3.18])
m4_define([libinput_req_version], [1.4.0])
m4_define([libinput_req_version], [0.19.0])
m4_define([libudev_req_version], [136])
AC_SUBST([GLIB_REQ_VERSION], [glib_req_version])
@ -385,22 +382,6 @@ AS_IF([test "x$SUPPORT_X11" = "x1"],
[AC_MSG_ERROR([not found])]
)
# XTEST (required)
AC_MSG_CHECKING([for XTest extension])
PKG_CHECK_EXISTS([xtst], [have_xtest=yes], [have_xtest=no])
AS_IF([test "x$have_xtest" = "xyes"],
[
AC_DEFINE(HAVE_XTEST, [1], [Define to 1 if we have the XTest X extension])
X11_LIBS="$X11_LIBS -lXtst"
X11_PC_FILES="$X11_PC_FILES xtst"
X11_EXTS="$X11_EXTS xtst"
AC_MSG_RESULT([found])
],
[AC_MSG_ERROR([Not found])]
)
# X Generic Extensions (optional)
clutter_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X11_CFLAGS"
@ -784,7 +765,7 @@ AC_CONFIG_FILES([
clutter/Makefile
clutter/clutter-config.h
clutter/clutter-version.h
clutter/mutter-clutter-$LIBMUTTER_API_VERSION.pc:clutter/mutter-clutter.pc.in
clutter/mutter-clutter-$CLUTTER_API_VERSION.pc:clutter/mutter-clutter.pc.in
tests/Makefile
tests/accessibility/Makefile

View File

@ -21,7 +21,7 @@ all_examples += \
image-content
endif
LDADD = $(top_builddir)/clutter/libmutter-clutter-@LIBMUTTER_API_VERSION@.la $(CLUTTER_LIBS) $(GDK_PIXBUF_LIBS) $(LIBM)
LDADD = $(top_builddir)/clutter/libmutter-clutter-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS) $(GDK_PIXBUF_LIBS) $(LIBM)
AM_CFLAGS = $(CLUTTER_CFLAGS) $(GDK_PIXBUF_CFLAGS) $(MAINTAINER_CFLAGS)
AM_CPPFLAGS = \
-DG_DISABLE_SINGLE_INCLUDES \

View File

@ -1,5 +1,5 @@
common_ldadd = \
$(top_builddir)/clutter/libmutter-clutter-@LIBMUTTER_API_VERSION@.la
$(top_builddir)/clutter/libmutter-clutter-@CLUTTER_API_VERSION@.la
common_sources = \
cally-examples-util.c \
@ -11,7 +11,6 @@ AM_CPPFLAGS = \
-DGLIB_DISABLE_DEPRECATION_WARNINGS \
-I$(top_srcdir)/../cogl \
-I$(top_builddir)/../cogl \
-I$(top_builddir)/../cogl/cogl \
-I$(top_srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/clutter \

View File

@ -3,13 +3,12 @@ installed_testdir = $(libexecdir)/installed-tests/mutter-clutter
include $(top_srcdir)/build/autotools/glib-tap.mk
AM_CFLAGS = -g $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS)
LDADD = $(top_builddir)/../cogl/cogl/libmutter-cogl-@LIBMUTTER_API_VERSION@.la $(top_builddir)/clutter/libmutter-clutter-@LIBMUTTER_API_VERSION@.la $(CLUTTER_LIBS) $(LIBM)
LDADD = $(top_builddir)/../cogl/cogl/libmutter-cogl.la $(top_builddir)/clutter/libmutter-clutter-1.0.la $(CLUTTER_LIBS) $(LIBM)
AM_LDFLAGS = -export-dynamic
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"Clutter-Conform\" \
-I$(top_srcdir)/../cogl \
-I$(top_builddir)/../cogl \
-I$(top_builddir)/../cogl/cogl \
-I$(top_srcdir) \
-I$(top_builddir) \
-DCOGL_DISABLE_DEPRECATION_WARNINGS \
@ -79,7 +78,7 @@ script_tests = \
test-script-timeline-markers.json \
test-state-1.json
TESTS_ENVIRONMENT += G_ENABLE_DIAGNOSTIC=0 CLUTTER_ENABLE_DIAGNOSTIC=0 CLUTTER_SCALE=1
TESTS_ENVIRONMENT += G_ENABLE_DIAGNOSTIC=0 CLUTTER_ENABLE_DIAGNOSTIC=0
# simple rules for generating a Git ignore file for the conformance test suite
$(srcdir)/.gitignore: Makefile

View File

@ -350,8 +350,7 @@ actor_replace_child (void)
g_assert_cmpstr (clutter_actor_get_name (iter), ==, "qux");
clutter_actor_add_child (actor, g_object_new (CLUTTER_TYPE_ACTOR,
"name", "foo",
NULL));
"name", "foo"));
clutter_actor_replace_child (actor, iter,
g_object_new (CLUTTER_TYPE_ACTOR,

View File

@ -15,13 +15,16 @@ UNIT_TESTS = \
test-state-animator.c \
test-fbo.c \
test-multistage.c \
test-cogl-primitives.c \
test-cogl-tex-tile.c \
test-cogl-tex-convert.c \
test-cogl-tex-foreign.c \
test-cogl-tex-getset.c \
test-cogl-offscreen.c \
test-cogl-tex-polygon.c \
test-cogl-multitexture.c \
test-stage-read-pixels.c \
test-clip.c \
test-paint-wrapper.c \
test-texture-quality.c \
test-layout.c \
@ -109,9 +112,7 @@ clean-wrappers:
.PHONY: wrappers clean-wrappers
common_ldadd = \
$(top_builddir)/clutter/libmutter-clutter-@LIBMUTTER_API_VERSION@.la \
$(top_builddir)/../cogl/cogl/libmutter-cogl-@LIBMUTTER_API_VERSION@.la
common_ldadd = $(top_builddir)/clutter/libmutter-clutter-@CLUTTER_API_VERSION@.la
check_PROGRAMS = test-interactive
check_SCRIPTS = wrappers
@ -127,7 +128,6 @@ test_interactive_CPPFLAGS = \
-DCLUTTER_DISABLE_DEPRECATION_WARNINGS \
-I$(top_srcdir)/../cogl \
-I$(top_builddir)/../cogl \
-I$(top_builddir)/../cogl/cogl \
-I$(top_srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/clutter \

View File

@ -0,0 +1,396 @@
#include <clutter/clutter.h>
#include <gmodule.h>
#include <math.h>
typedef struct _CallbackData CallbackData;
typedef struct _Clip Clip;
typedef enum
{
CLIP_NONE,
CLIP_RECTANGLE,
CLIP_ROTATED_RECTANGLE,
CLIP_SHAPES
} ClipType;
struct _Clip
{
ClipType type;
gint x1, y1, x2, y2;
};
struct _CallbackData
{
ClutterActor *stage;
CoglHandle hand;
Clip current_clip;
GSList *clips;
};
static const char
instructions[] =
"Left button and drag to draw a rectangle, control+left to draw a rotated "
"rectangle or shift+left to draw a path. Press 'r' to reset or 'u' "
"to undo the last clip.";
static void
path_shapes (gint x, gint y, gint width, gint height)
{
cogl_path_move_to (x, y);
cogl_path_line_to (x, (y + height * 4 / 5));
cogl_path_line_to ((x + width * 4 / 15), (y + height * 4 / 5));
cogl_path_close ();
cogl_path_rectangle (x + width / 3,
y,
x + width * 9 / 15,
y + height * 4 / 5);
cogl_path_ellipse ((x + width * 4 / 5),
(y + height * 2 / 5),
(width * 2 / 15),
(height * 2 / 5));
}
static void
draw_shapes (gint x, gint y)
{
path_shapes (x, y, 300, 100);
cogl_set_source_color4ub (0x00, 0x00, 0xff, 0xff);
cogl_path_fill_preserve ();
cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
cogl_path_stroke ();
}
static void
make_clip_path (Clip *clip)
{
switch (clip->type)
{
case CLIP_NONE:
break;
case CLIP_RECTANGLE:
cogl_path_rectangle (clip->x1,
clip->y1,
clip->x2,
clip->y2);
break;
case CLIP_ROTATED_RECTANGLE:
{
int size = MIN (ABS (clip->x2 - clip->x1),
ABS (clip->y2 - clip->y1));
int cx = (clip->x1 + clip->x2) / 2;
int cy = (clip->y1 + clip->y2) / 2;
cogl_path_move_to (cx - size / 2, cy);
cogl_path_line_to (cx, cy - size / 2);
cogl_path_line_to (cx + size / 2, cy);
cogl_path_line_to (cx, cy + size / 2);
cogl_path_close ();
}
break;
case CLIP_SHAPES:
{
int x, y, width, height;
if (clip->x1 < clip->x2)
{
x = clip->x1;
width = clip->x2 - x;
}
else
{
x = clip->x2;
width = clip->x1 - x;
}
if (clip->y1 < clip->y2)
{
y = clip->y1;
height = clip->y2 - y;
}
else
{
y = clip->y2;
height = clip->y1 - y;
}
path_shapes (x, y, width, height);
}
break;
}
}
static void
on_paint (ClutterActor *actor, CallbackData *data)
{
int i;
ClutterGeometry stage_size;
gint hand_width, hand_height;
GSList *node;
clutter_actor_get_allocation_geometry (data->stage, &stage_size);
hand_width = cogl_texture_get_width (data->hand);
hand_height = cogl_texture_get_height (data->hand);
/* Setup the clipping */
for (node = data->clips; node; node = node->next)
{
Clip *clip = (Clip *) node->data;
if (clip->type == CLIP_RECTANGLE)
cogl_clip_push_rectangle (clip->x1,
clip->y1,
clip->x2,
clip->y2);
else if (clip->type == CLIP_ROTATED_RECTANGLE)
{
float size = MIN (ABS (clip->x2 - clip->x1),
ABS (clip->y2 - clip->y1));
int cx = (clip->x1 + clip->x2) / 2;
int cy = (clip->y1 + clip->y2) / 2;
size = sqrtf ((size / 2) * (size / 2) * 2);
cogl_push_matrix ();
/* Rotate 45° about the centre point */
cogl_translate (cx, cy, 0.0f);
cogl_rotate (45.0f, 0.0f, 0.0f, 1.0f);
cogl_clip_push_rectangle (-size / 2, -size / 2, size / 2, size / 2);
cogl_pop_matrix ();
}
else
{
make_clip_path (clip);
cogl_clip_push_from_path ();
}
}
/* Draw a rectangle filling the entire stage */
cogl_set_source_color4ub (0x80, 0x80, 0xff, 0xff);
cogl_rectangle (0, 0, stage_size.width, stage_size.height);
draw_shapes (10, 10);
/* Draw the hand at different rotations */
for (i = -2; i <= 2; i++)
{
cogl_push_matrix ();
cogl_translate (stage_size.width / 2 + stage_size.width / 6 * i,
stage_size.height / 2, 0);
cogl_rotate (i * 40, 0, 1, 0);
cogl_set_source_color4ub (0xff, 0xff, 0xff, 0xff);
cogl_set_source_texture (data->hand);
cogl_rectangle_with_texture_coords ((-hand_width / 2),
(-hand_height / 2),
(hand_width / 2),
(hand_height / 2),
0, 0, 1, 1);
cogl_pop_matrix ();
}
draw_shapes (stage_size.width - 310, stage_size.height - 110);
/* Remove all of the clipping */
g_slist_foreach (data->clips, (GFunc) cogl_clip_pop, NULL);
/* Draw the bounding box for each of the clips */
for (node = data->clips; node; node = node->next)
{
Clip *clip = (Clip *) node->data;
make_clip_path (clip);
cogl_set_source_color4ub (0x00, 0x00, 0xff, 0xff);
cogl_path_stroke ();
}
/* Draw the bounding box for the pending new clip */
if (data->current_clip.type != CLIP_NONE)
{
make_clip_path (&data->current_clip);
cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
cogl_path_stroke ();
}
}
static gboolean
on_button_press (ClutterActor *stage, ClutterButtonEvent *event,
CallbackData *data)
{
data->current_clip.x1 = data->current_clip.x2 = event->x;
data->current_clip.y1 = data->current_clip.y2 = event->y;
switch (event->button)
{
case CLUTTER_BUTTON_PRIMARY:
if (clutter_event_has_shift_modifier ((ClutterEvent *) event))
data->current_clip.type = CLIP_SHAPES;
else if (clutter_event_has_control_modifier ((ClutterEvent *) event))
data->current_clip.type = CLIP_ROTATED_RECTANGLE;
else
data->current_clip.type = CLIP_RECTANGLE;
break;
case CLUTTER_BUTTON_SECONDARY:
data->current_clip.type = CLIP_ROTATED_RECTANGLE;
break;
case CLUTTER_BUTTON_MIDDLE:
data->current_clip.type = CLIP_SHAPES;
break;
default:
data->current_clip.type = CLIP_NONE;
break;
}
clutter_actor_queue_redraw (stage);
return FALSE;
}
static gboolean
on_button_release (ClutterActor *stage, ClutterButtonEvent *event,
CallbackData *data)
{
if (data->current_clip.type != CLIP_NONE)
{
data->clips = g_slist_prepend (data->clips,
g_slice_copy (sizeof (Clip),
&data->current_clip));
data->current_clip.type = CLIP_NONE;
}
clutter_actor_queue_redraw (stage);
return FALSE;
}
static gboolean
on_motion (ClutterActor *stage, ClutterMotionEvent *event,
CallbackData *data)
{
if (data->current_clip.type != CLIP_NONE)
{
data->current_clip.x2 = event->x;
data->current_clip.y2 = event->y;
clutter_actor_queue_redraw (stage);
}
return FALSE;
}
static void
free_clips (CallbackData *data)
{
GSList *node;
for (node = data->clips; node; node = node->next)
g_slice_free (Clip, node->data);
g_slist_free (data->clips);
data->clips = NULL;
}
static gboolean
on_key_press (ClutterActor *stage,
ClutterEvent *event,
CallbackData *data)
{
switch (clutter_event_get_key_symbol (event))
{
case CLUTTER_KEY_r:
free_clips (data);
clutter_actor_queue_redraw (stage);
break;
case CLUTTER_KEY_u:
if (data->clips)
{
g_slice_free (Clip, data->clips->data);
data->clips = g_slist_delete_link (data->clips, data->clips);
clutter_actor_queue_redraw (stage);
}
break;
}
return FALSE;
}
G_MODULE_EXPORT int
test_clip_main (int argc, char **argv)
{
CallbackData data;
ClutterActor *stub_actor, *label;
gchar *file;
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
data.current_clip.type = CLIP_NONE;
data.clips = NULL;
data.stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (data.stage), "Clipping");
g_signal_connect (data.stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
stub_actor = clutter_rectangle_new ();
clutter_container_add (CLUTTER_CONTAINER (data.stage), stub_actor, NULL);
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
data.hand = cogl_texture_new_from_file (file,
COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_ANY,
NULL);
g_free (file);
label = clutter_text_new_with_text ("Sans 12px", instructions);
clutter_text_set_line_wrap (CLUTTER_TEXT (label), TRUE);
clutter_actor_set_width (label, clutter_actor_get_width (data.stage) - 310);
clutter_actor_set_y (label,
clutter_actor_get_height (data.stage)
- clutter_actor_get_height (label));
clutter_container_add (CLUTTER_CONTAINER (data.stage), label, NULL);
g_signal_connect (stub_actor, "paint", G_CALLBACK (on_paint), &data);
g_signal_connect (data.stage, "button-press-event",
G_CALLBACK (on_button_press), &data);
g_signal_connect (data.stage, "button-release-event",
G_CALLBACK (on_button_release), &data);
g_signal_connect (data.stage, "motion-event",
G_CALLBACK (on_motion), &data);
g_signal_connect (data.stage, "key-press-event",
G_CALLBACK (on_key_press), &data);
clutter_actor_show (data.stage);
clutter_main ();
cogl_handle_unref (data.hand);
free_clips (&data);
return 0;
}
G_MODULE_EXPORT const char *
test_clip_describe (void)
{
return "Actor clipping with various techniques";
}

View File

@ -0,0 +1,144 @@
#include <glib.h>
#include <gmodule.h>
#include <stdlib.h>
#include <cogl/cogl.h>
#include <clutter/clutter.h>
typedef void (*PaintFunc) (void);
static void
test_paint_line (void)
{
cogl_path_line (-50, -25, 50, 25);
}
static void
test_paint_rect (void)
{
cogl_path_rectangle (-50, -25, 50, 25);
}
static void
test_paint_rndrect(void)
{
cogl_path_round_rectangle (-50, -25, 50, 25, 10, 5);
}
static void
test_paint_polyl (void)
{
gfloat poly_coords[] = {
-50, -50,
+50, -30,
+30, +30,
-30, +40
};
cogl_path_polyline (poly_coords, 4);
}
static void
test_paint_polyg (void)
{
gfloat poly_coords[] = {
-50, -50,
+50, -30,
+30, +30,
-30, +40
};
cogl_path_polygon (poly_coords, 4);
}
static void
test_paint_elp (void)
{
cogl_path_ellipse (0, 0, 60, 40);
}
static void
test_paint_curve (void)
{
cogl_path_move_to (-50, +50);
cogl_path_curve_to (+100, -50,
-100, -50,
+50, +50);
}
static PaintFunc paint_func []=
{
test_paint_line,
test_paint_rect,
test_paint_rndrect,
test_paint_polyl,
test_paint_polyg,
test_paint_elp,
test_paint_curve
};
static void
paint_cb (ClutterActor *self, ClutterTimeline *tl)
{
gint paint_index = (clutter_timeline_get_progress (tl)
* G_N_ELEMENTS (paint_func));
cogl_push_matrix ();
paint_func[paint_index] ();
cogl_translate (100, 100, 0);
cogl_set_source_color4ub (0, 160, 0, 255);
cogl_path_stroke_preserve ();
cogl_translate (150, 0, 0);
cogl_set_source_color4ub (200, 0, 0, 255);
cogl_path_fill ();
cogl_pop_matrix();
}
G_MODULE_EXPORT int
test_cogl_primitives_main (int argc, char *argv[])
{
ClutterActor *stage;
ClutterActor *coglbox;
ClutterTimeline *tl;
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
tl = clutter_timeline_new (G_N_ELEMENTS (paint_func) * 1000);
clutter_timeline_set_loop (tl, TRUE);
clutter_timeline_start (tl);
stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Path Primitives");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
coglbox = clutter_group_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox);
g_signal_connect (coglbox, "paint", G_CALLBACK (paint_cb), tl);
/* Redraw every frame of the timeline */
g_signal_connect_swapped (tl, "new-frame",
G_CALLBACK (clutter_actor_queue_redraw), coglbox);
clutter_actor_set_rotation (coglbox, CLUTTER_Y_AXIS, -30, 200, 0, 0);
clutter_actor_set_position (coglbox, 0, 100);
clutter_actor_show (stage);
clutter_main ();
g_object_unref (tl);
return 0;
}
G_MODULE_EXPORT const char *
test_cogl_primitives (void)
{
return "2D Path primitives support in Cogl.";
}

View File

@ -0,0 +1,270 @@
#include <glib.h>
#include <gmodule.h>
#include <stdlib.h>
#include <clutter/clutter.h>
#include <cogl/cogl.h>
/* Coglbox declaration
*--------------------------------------------------*/
G_BEGIN_DECLS
#define TEST_TYPE_COGLBOX test_coglbox_get_type()
#define TEST_COGLBOX(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
TEST_TYPE_COGLBOX, TestCoglboxClass))
#define TEST_COGLBOX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
TEST_TYPE_COGLBOX, TestCoglboxClass))
#define TEST_IS_COGLBOX(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
TEST_TYPE_COGLBOX))
#define TEST_IS_COGLBOX_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
TEST_TYPE_COGLBOX))
#define TEST_COGLBOX_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
TEST_TYPE_COGLBOX, TestCoglboxClass))
typedef struct _TestCoglbox TestCoglbox;
typedef struct _TestCoglboxClass TestCoglboxClass;
typedef struct _TestCoglboxPrivate TestCoglboxPrivate;
struct _TestCoglbox
{
ClutterActor parent;
/*< private >*/
TestCoglboxPrivate *priv;
};
struct _TestCoglboxClass
{
ClutterActorClass parent_class;
/* padding for future expansion */
void (*_test_coglbox1) (void);
void (*_test_coglbox2) (void);
void (*_test_coglbox3) (void);
void (*_test_coglbox4) (void);
};
static GType test_coglbox_get_type (void) G_GNUC_CONST;
G_END_DECLS
/* Coglbox private declaration
*--------------------------------------------------*/
G_DEFINE_TYPE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR);
#define TEST_COGLBOX_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), TEST_TYPE_COGLBOX, TestCoglboxPrivate))
struct _TestCoglboxPrivate
{
CoglHandle cogl_tex_id[4];
};
/* Coglbox implementation
*--------------------------------------------------*/
static void
test_coglbox_paint(ClutterActor *self)
{
TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (self);
gfloat texcoords[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
cogl_set_source_color4ub (0x66, 0x66, 0xdd, 0xff);
cogl_rectangle (0, 0, 400, 400);
cogl_push_matrix ();
cogl_translate (100, 100, 0);
cogl_set_source_texture (priv->cogl_tex_id[1]);
cogl_rectangle_with_texture_coords (0, 0, 200, 213,
texcoords[0], texcoords[1],
texcoords[2], texcoords[3]);
cogl_pop_matrix();
}
static void
test_coglbox_finalize (GObject *object)
{
G_OBJECT_CLASS (test_coglbox_parent_class)->finalize (object);
}
static void
test_coglbox_dispose (GObject *object)
{
TestCoglboxPrivate *priv;
priv = TEST_COGLBOX_GET_PRIVATE (object);
cogl_handle_unref (priv->cogl_tex_id);
G_OBJECT_CLASS (test_coglbox_parent_class)->dispose (object);
}
static void
test_coglbox_init (TestCoglbox *self)
{
TestCoglboxPrivate *priv;
guint width;
guint height;
guint rowstride;
CoglPixelFormat format;
gint size;
guchar *data;
gint x,y,t;
guchar *pixel;
gchar *file;
self->priv = priv = TEST_COGLBOX_GET_PRIVATE(self);
/* Load image from file */
file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL);
priv->cogl_tex_id[0] =
cogl_texture_new_from_file (file,
COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_ANY,
NULL);
if (priv->cogl_tex_id[0] == COGL_INVALID_HANDLE)
{
printf ("Failed loading redhand.png image!\n");
return;
}
g_free (file);
printf("Texture loaded from file.\n");
/* Obtain pixel data */
format = cogl_texture_get_format (priv->cogl_tex_id[0]);
g_assert(format == COGL_PIXEL_FORMAT_RGBA_8888_PRE ||
format == COGL_PIXEL_FORMAT_ARGB_8888_PRE);
width = cogl_texture_get_width (priv->cogl_tex_id[0]);
height = cogl_texture_get_height (priv->cogl_tex_id[0]);
size = cogl_texture_get_data (priv->cogl_tex_id[0],
format, 0, NULL);
printf("size: %dx%d\n", width, height);
printf("format: 0x%x\n", format);
printf("bytesize: %d\n", size);
data = (guchar*) g_malloc (sizeof(guchar) * size);
cogl_texture_get_data (priv->cogl_tex_id[0],
format, 0, data);
rowstride = cogl_texture_get_rowstride (priv->cogl_tex_id[0]);
/* Create new texture from modified data */
priv->cogl_tex_id[1] =
cogl_texture_new_from_data (width, height,
COGL_TEXTURE_NONE,
format, format,
rowstride, data);
if (priv->cogl_tex_id[1] == COGL_INVALID_HANDLE)
{
printf ("Failed creating image from data!\n");
return;
}
printf ("Texture created from data.\n");
/* Modify data (swap red and green) */
for (y=0; y<height; ++y)
{
for (x=0; x<width; ++x)
{
pixel = data + y * rowstride + x * 4;
if (format == COGL_PIXEL_FORMAT_RGBA_8888_PRE)
{
t = pixel[0];
pixel[0] = pixel[1];
pixel[1] = t;
}
else
{
t = pixel[1];
pixel[1] = pixel[2];
pixel[2] = t;
}
}
}
cogl_texture_set_region (priv->cogl_tex_id[1],
0, 0, 0, 0,
100, 100, width, height,
format, 0, data);
cogl_texture_set_region (priv->cogl_tex_id[1],
100, 100, 100, 100,
100, 100, width, height,
format, 0, data);
printf ("Subregion data updated.\n");
}
static void
test_coglbox_class_init (TestCoglboxClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
gobject_class->finalize = test_coglbox_finalize;
gobject_class->dispose = test_coglbox_dispose;
actor_class->paint = test_coglbox_paint;
g_type_class_add_private (gobject_class, sizeof (TestCoglboxPrivate));
}
static ClutterActor*
test_coglbox_new (void)
{
return g_object_new (TEST_TYPE_COGLBOX, NULL);
}
G_MODULE_EXPORT int
test_cogl_tex_getset_main (int argc, char *argv[])
{
ClutterActor *stage;
ClutterActor *coglbox;
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
/* Stage */
stage = clutter_stage_new ();
clutter_actor_set_size (stage, 400, 400);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Texture Readback");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
/* Cogl Box */
coglbox = test_coglbox_new ();
clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox);
clutter_actor_show_all (stage);
clutter_main ();
return 0;
}
G_MODULE_EXPORT const char *
test_cogl_tex_getset_describe (void)
{
return "Texture region readback and update in Cogl.";
}

View File

@ -1,7 +1,4 @@
common_ldadd = \
$(top_builddir)/clutter/libmutter-clutter-@LIBMUTTER_API_VERSION@.la \
$(top_builddir)/../cogl/cogl/libmutter-cogl-@LIBMUTTER_API_VERSION@.la
common_ldadd = $(top_builddir)/clutter/libmutter-clutter-@CLUTTER_API_VERSION@.la
check_PROGRAMS = \
test-text \
@ -20,7 +17,6 @@ AM_CPPFLAGS = \
-DTESTS_DATA_DIR=\""$(top_srcdir)/tests/data/"\" \
-I$(top_srcdir)/../cogl \
-I$(top_builddir)/../cogl \
-I$(top_builddir)/../cogl/cogl \
-I$(top_srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/clutter \

View File

@ -1,4 +1,4 @@
#include <clutter-build-config.h>
#include <config.h>
#include <glib.h>
#include <gmodule.h>
#include <stdlib.h>

View File

@ -7,7 +7,7 @@ check_PROGRAMS = \
test-state-mini \
test-state-pick
common_ldadd = $(top_builddir)/clutter/libmutter-clutter-@LIBMUTTER_API_VERSION@.la
common_ldadd = $(top_builddir)/clutter/libmutter-clutter-@CLUTTER_API_VERSION@.la
LDADD = $(common_ldadd) $(CLUTTER_LIBS) $(LIBM)
@ -21,7 +21,6 @@ AM_CPPFLAGS = \
-DTESTS_DATA_DIR=\""$(top_srcdir)/tests/data/"\" \
-I$(top_srcdir)/../cogl \
-I$(top_builddir)/../cogl \
-I$(top_builddir)/../cogl/cogl \
-I$(top_srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/clutter \

View File

@ -2,10 +2,8 @@
NULL =
DISTCLEANFILES =
mutterlibdir = $(libdir)/mutter
mutterlib_LTLIBRARIES = libmutter-cogl-gles2-@LIBMUTTER_API_VERSION@.la
mutterlib_LTLIBRARIES = libmutter-cogl-gles2.la
AM_CPPFLAGS = \
-I$(top_srcdir) \
@ -13,8 +11,8 @@ AM_CPPFLAGS = \
AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS)
libmutter_cogl_gles2_@LIBMUTTER_API_VERSION@_la_SOURCES = cogl-gles2-api.c
libmutter_cogl_gles2_@LIBMUTTER_API_VERSION@_la_LDFLAGS = \
libmutter_cogl_gles2_la_SOURCES = cogl-gles2-api.c
libmutter_cogl_gles2_la_LDFLAGS = \
-no-undefined \
-rpath $(mutterlibdir) \
-avoid-version \
@ -27,9 +25,7 @@ coglgles2include_HEADERS = \
GLES2/gl2ext.h \
GLES2/gl2platform.h
pc_files = mutter-cogl-gles2-$(LIBMUTTER_API_VERSION).pc
pc_files = mutter-cogl-gles2-1.0.pc
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(pc_files)
DISTCLEANFILES += $(pc_files)

View File

@ -2,12 +2,12 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@/mutter
includedir=@includedir@/mutter
apiversion=@LIBMUTTER_API_VERSION@
requires=@COGL_PKG_REQUIRES@ mutter-cogl-@LIBMUTTER_API_VERSION@
apiversion=1.0
requires=@COGL_PKG_REQUIRES@ mutter-cogl-1.0
Name: Cogl
Description: An object oriented GL/GLES Abstraction/Utility Layer
Version: @MUTTER_VERSION@
Libs: -L${libdir} -lmutter-cogl-gles2-@LIBMUTTER_API_VERSION@
Version: @COGL_1_VERSION@
Libs: -L${libdir} -lmutter-cogl-gles2
Cflags: -I${includedir}/cogl
Requires: ${requires}

View File

@ -23,13 +23,13 @@ source_h_priv = \
$(NULL)
mutterlibdir = $(libdir)/mutter
mutterlib_LTLIBRARIES = libmutter-cogl-pango-@LIBMUTTER_API_VERSION@.la
mutterlib_LTLIBRARIES = libmutter-cogl-pango.la
libmutter_cogl_pango_@LIBMUTTER_API_VERSION@_la_SOURCES = $(source_c) $(source_h) $(source_h_priv)
libmutter_cogl_pango_@LIBMUTTER_API_VERSION@_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_PANGO_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS)
libmutter_cogl_pango_@LIBMUTTER_API_VERSION@_la_LIBADD = $(top_builddir)/cogl/libmutter-cogl-$(LIBMUTTER_API_VERSION).la
libmutter_cogl_pango_@LIBMUTTER_API_VERSION@_la_LIBADD += $(COGL_DEP_LIBS) $(COGL_PANGO_DEP_LIBS) $(COGL_EXTRA_LDFLAGS)
libmutter_cogl_pango_@LIBMUTTER_API_VERSION@_la_LDFLAGS = \
libmutter_cogl_pango_la_SOURCES = $(source_c) $(source_h) $(source_h_priv)
libmutter_cogl_pango_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_PANGO_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS)
libmutter_cogl_pango_la_LIBADD = $(top_builddir)/cogl/libmutter-cogl.la
libmutter_cogl_pango_la_LIBADD += $(COGL_DEP_LIBS) $(COGL_PANGO_DEP_LIBS) $(COGL_EXTRA_LDFLAGS)
libmutter_cogl_pango_la_LDFLAGS = \
-export-dynamic \
-rpath $(mutterlibdir) \
-export-symbols-regex "^cogl_pango_.*" \
@ -49,7 +49,7 @@ cogl_base_includedir = $(includedir)/mutter
cogl_pangoheadersdir = $(cogl_base_includedir)/cogl/cogl-pango
cogl_pangoheaders_HEADERS = $(source_h)
pc_files = mutter-cogl-pango-$(LIBMUTTER_API_VERSION).pc
pc_files = mutter-cogl-pango-1.0.pc
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(pc_files)
@ -65,23 +65,23 @@ INTROSPECTION_GIRS =
if HAVE_INTROSPECTION
INTROSPECTION_COMPILER_ARGS=--includedir=$(top_builddir)/cogl
CoglPango-@LIBMUTTER_API_VERSION@.gir: libmutter-cogl-pango-$(LIBMUTTER_API_VERSION).la Makefile
CoglPango-1.0.gir: libmutter-cogl-pango.la Makefile
CoglPango_@LIBMUTTER_API_VERSION@_gir_NAMESPACE = CoglPango
CoglPango_@LIBMUTTER_API_VERSION@_gir_VERSION = @LIBMUTTER_API_VERSION@
CoglPango_@LIBMUTTER_API_VERSION@_gir_LIBS = $(top_builddir)/cogl/libmutter-cogl-$(LIBMUTTER_API_VERSION).la libmutter-cogl-pango-$(LIBMUTTER_API_VERSION).la
CoglPango_@LIBMUTTER_API_VERSION@_gir_FILES = $(source_h) $(source_c)
CoglPango_@LIBMUTTER_API_VERSION@_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) $(COGL_PANGO_DEP_CFLAGS)
CoglPango_@LIBMUTTER_API_VERSION@_gir_INCLUDES = Pango-1.0 PangoCairo-1.0
CoglPango_@LIBMUTTER_API_VERSION@_gir_EXPORT_PACKAGES = mutter-cogl-pango-@LIBMUTTER_API_VERSION@
CoglPango_@LIBMUTTER_API_VERSION@_gir_SCANNERFLAGS = \
CoglPango_1_0_gir_NAMESPACE = CoglPango
CoglPango_1_0_gir_VERSION = 1.0
CoglPango_1_0_gir_LIBS = $(top_builddir)/cogl/libmutter-cogl.la libmutter-cogl-pango.la
CoglPango_1_0_gir_FILES = $(source_h) $(source_c)
CoglPango_1_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) $(COGL_PANGO_DEP_CFLAGS)
CoglPango_1_0_gir_INCLUDES = Pango-1.0 PangoCairo-1.0
CoglPango_1_0_gir_EXPORT_PACKAGES = mutter-cogl-pango-1.0
CoglPango_1_0_gir_SCANNERFLAGS = \
--warn-all \
--identifier-prefix=CoglPango \
--symbol-prefix=cogl_pango \
--c-include='cogl-pango/cogl-pango.h' \
--include-uninstalled=$(top_builddir)/cogl/Cogl-@LIBMUTTER_API_VERSION@.gir
--include-uninstalled=$(top_builddir)/cogl/Cogl-1.0.gir
INTROSPECTION_GIRS += CoglPango-@LIBMUTTER_API_VERSION@.gir
INTROSPECTION_GIRS += CoglPango-1.0.gir
girdir = $(mutterlibdir)
gir_DATA = $(INTROSPECTION_GIRS)

View File

@ -2,12 +2,12 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@/mutter
includedir=@includedir@/mutter
apiversion=@LIBMUTTER_API_VERSION@
requires=@COGL_PKG_REQUIRES@ mutter-cogl-@LIBMUTTER_API_VERSION@
apiversion=1.0
requires=@COGL_PKG_REQUIRES@ mutter-cogl-1.0
Name: Cogl
Description: An object oriented GL/GLES Abstraction/Utility Layer
Version: @MUTTER_VERSION@
Libs: -L${libdir} -lmutter-cogl-pango-@LIBMUTTER_API_VERSION@
Version: @COGL_1_VERSION@
Libs: -L${libdir} -lmutter-cogl-pango
Cflags: -I${includedir}/cogl
Requires: ${requires}

View File

@ -65,14 +65,14 @@ glib_enum_headers = $(source_1_x_h)
include $(top_srcdir)/build/autotools/Makefile.am.enums
mutterlibdir = $(libdir)/mutter
mutterlib_LTLIBRARIES = libmutter-cogl-path-@LIBMUTTER_API_VERSION@.la
mutterlib_LTLIBRARIES = libmutter-cogl-path.la
libmutter_cogl_path_@LIBMUTTER_API_VERSION@_la_SOURCES = $(source_c) $(source_h)
nodist_libmutter_cogl_path_@LIBMUTTER_API_VERSION@_la_SOURCES = $(BUILT_SOURCES)
libmutter_cogl_path_@LIBMUTTER_API_VERSION@_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS)
libmutter_cogl_path_@LIBMUTTER_API_VERSION@_la_LIBADD = $(top_builddir)/cogl/libmutter-cogl-$(LIBMUTTER_API_VERSION).la
libmutter_cogl_path_@LIBMUTTER_API_VERSION@_la_LIBADD += $(COGL_DEP_LIBS) $(COGL_EXTRA_LDFLAGS)
libmutter_cogl_path_@LIBMUTTER_API_VERSION@_la_LDFLAGS = \
libmutter_cogl_path_la_SOURCES = $(source_c) $(source_h)
nodist_libmutter_cogl_path_la_SOURCES = $(BUILT_SOURCES)
libmutter_cogl_path_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS)
libmutter_cogl_path_la_LIBADD = $(top_builddir)/cogl/libmutter-cogl.la
libmutter_cogl_path_la_LIBADD += $(COGL_DEP_LIBS) $(COGL_EXTRA_LDFLAGS)
libmutter_cogl_path_la_LDFLAGS = \
-export-dynamic \
-export-symbols-regex "^(cogl|cogl2)_(framebuffer|path|is|clip|[sg]et)_.*" \
-no-undefined \
@ -94,7 +94,7 @@ cogl_pathheadersdir = $(cogl_base_includedir)/cogl/cogl-path
cogl_pathheaders_HEADERS = $(source_h)
nodist_cogl_pathheaders_HEADERS = cogl-path-enum-types.h
pc_files = mutter-cogl-path-$(LIBMUTTER_API_VERSION).pc
pc_files = mutter-cogl-path-1.0.pc
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(pc_files)

View File

@ -2,12 +2,12 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@/mutter
includedir=@includedir@/mutter
apiversion=@LIBMUTTER_API_VERSION@
requires=@COGL_PKG_REQUIRES@ mutter-cogl-@LIBMUTTER_API_VERSION@
apiversion=1.0
requires=@COGL_PKG_REQUIRES@ mutter-cogl-1.0
Name: Cogl
Description: A 2D path drawing library for Cogl
Version: @MUTTER_VERSION@
Libs: -L${libdir} -lmutter-cogl-path-@LIBMUTTER_API_VERSION@
Version: @COGL_1_VERSION@
Libs: -L${libdir} -lmutter-cogl-path
Cflags: -I${includedir}/cogl
Requires: ${requires}

View File

@ -41,7 +41,7 @@ BUILT_SOURCES += cogl-defines.h cogl-egl-defines.h cogl-gl-header.h
DISTCLEANFILES += cogl-defines.h cogl-egl-defines.h cogl-gl-header.h
EXTRA_DIST += cogl-defines.h.in cogl-egl-defines.h.in cogl-gl-header.h.in
pc_files = mutter-cogl-$(LIBMUTTER_API_VERSION).pc
pc_files = mutter-cogl-1.0.pc
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(pc_files)
@ -439,23 +439,23 @@ cogl_sources_c += \
endif
mutterlibdir = $(libdir)/mutter
mutterlib_LTLIBRARIES = libmutter-cogl-@LIBMUTTER_API_VERSION@.la
mutterlib_LTLIBRARIES = libmutter-cogl.la
libmutter_cogl_@LIBMUTTER_API_VERSION@_la_LIBADD = $(LIBM) $(COGL_DEP_LIBS) $(COGL_EXTRA_LDFLAGS)
libmutter_cogl_la_LIBADD = $(LIBM) $(COGL_DEP_LIBS) $(COGL_EXTRA_LDFLAGS)
if UNIT_TESTS
libmutter_cogl_@LIBMUTTER_API_VERSION@_la_LIBADD += $(top_builddir)/test-fixtures/libtest-fixtures.la
libmutter_cogl_la_LIBADD += $(top_builddir)/test-fixtures/libtest-fixtures.la
endif
# XXX: The aim is to eventually get rid of all private API exports
# for cogl-pango.
libmutter_cogl_@LIBMUTTER_API_VERSION@_la_LDFLAGS = \
libmutter_cogl_la_LDFLAGS = \
-no-undefined \
-avoid-version \
-export-dynamic \
-rpath $(mutterlibdir) \
-export-symbols-regex "^(cogl|_cogl_debug_flags|_cogl_atlas_new|_cogl_atlas_add_reorganize_callback|_cogl_atlas_reserve_space|_cogl_callback|_cogl_util_get_eye_planes_for_screen_poly|_cogl_atlas_texture_remove_reorganize_callback|_cogl_atlas_texture_add_reorganize_callback|_cogl_texture_get_format|_cogl_texture_foreach_sub_texture_in_region|_cogl_texture_set_region|_cogl_profile_trace_message|_cogl_context_get_default|_cogl_framebuffer_get_stencil_bits|_cogl_clip_stack_push_rectangle|_cogl_framebuffer_get_modelview_stack|_cogl_object_default_unref|_cogl_pipeline_foreach_layer_internal|_cogl_clip_stack_push_primitive|_cogl_buffer_unmap_for_fill_or_fallback|_cogl_framebuffer_draw_primitive|_cogl_debug_instances|_cogl_framebuffer_get_projection_stack|_cogl_pipeline_layer_get_texture|_cogl_buffer_map_for_fill_or_fallback|_cogl_texture_can_hardware_repeat|_cogl_pipeline_prune_to_n_layers|_cogl_primitive_draw|test_|unit_test_|_cogl_winsys_glx_get_vtable|_cogl_winsys_egl_xlib_get_vtable|_cogl_winsys_egl_get_vtable|_cogl_closure_disconnect|_cogl_onscreen_notify_complete|_cogl_onscreen_notify_frame_sync|_cogl_winsys_egl_renderer_connect_common|_cogl_winsys_error_quark|_cogl_set_error|_cogl_poll_renderer_add_fd|_cogl_poll_renderer_add_idle|_cogl_framebuffer_winsys_update_size|_cogl_winsys_egl_make_current|_cogl_pixel_format_get_bytes_per_pixel).*"
-export-symbols-regex "^(cogl|_cogl_debug_flags|_cogl_atlas_new|_cogl_atlas_add_reorganize_callback|_cogl_atlas_reserve_space|_cogl_callback|_cogl_util_get_eye_planes_for_screen_poly|_cogl_atlas_texture_remove_reorganize_callback|_cogl_atlas_texture_add_reorganize_callback|_cogl_texture_get_format|_cogl_texture_foreach_sub_texture_in_region|_cogl_profile_trace_message|_cogl_context_get_default|_cogl_framebuffer_get_stencil_bits|_cogl_clip_stack_push_rectangle|_cogl_framebuffer_get_modelview_stack|_cogl_object_default_unref|_cogl_pipeline_foreach_layer_internal|_cogl_clip_stack_push_primitive|_cogl_buffer_unmap_for_fill_or_fallback|_cogl_framebuffer_draw_primitive|_cogl_debug_instances|_cogl_framebuffer_get_projection_stack|_cogl_pipeline_layer_get_texture|_cogl_buffer_map_for_fill_or_fallback|_cogl_texture_can_hardware_repeat|_cogl_pipeline_prune_to_n_layers|_cogl_primitive_draw|test_|unit_test_|_cogl_winsys_glx_get_vtable|_cogl_winsys_egl_xlib_get_vtable|_cogl_winsys_egl_get_vtable|_cogl_closure_disconnect|_cogl_onscreen_notify_complete|_cogl_onscreen_notify_frame_sync|_cogl_winsys_egl_renderer_connect_common|_cogl_winsys_error_quark|_cogl_set_error|_cogl_poll_renderer_add_fd|_cogl_poll_renderer_add_idle|_cogl_framebuffer_winsys_update_size|_cogl_winsys_egl_make_current).*"
libmutter_cogl_@LIBMUTTER_API_VERSION@_la_SOURCES = $(cogl_sources_c)
nodist_libmutter_cogl_@LIBMUTTER_API_VERSION@_la_SOURCES = $(BUILT_SOURCES)
libmutter_cogl_la_SOURCES = $(cogl_sources_c)
nodist_libmutter_cogl_la_SOURCES = $(BUILT_SOURCES)
# Cogl installed headers
cogl_headers = \
@ -483,22 +483,22 @@ EXTRA_DIST += \
INTROSPECTION_GIRS =
if HAVE_INTROSPECTION
Cogl-@LIBMUTTER_API_VERSION@.gir: libmutter-cogl-$(LIBMUTTER_API_VERSION).la Makefile
Cogl-1.0.gir: libmutter-cogl.la Makefile
Cogl_@LIBMUTTER_API_VERSION@_gir_NAMESPACE = Cogl
Cogl_@LIBMUTTER_API_VERSION@_gir_VERSION = $(LIBMUTTER_API_VERSION)
Cogl_@LIBMUTTER_API_VERSION@_gir_LIBS = libmutter-cogl-$(LIBMUTTER_API_VERSION).la
Cogl_1_0_gir_NAMESPACE = Cogl
Cogl_1_0_gir_VERSION = 1.0
Cogl_1_0_gir_LIBS = libmutter-cogl.la
if UNIT_TESTS
Cogl_@LIBMUTTER_API_VERSION@_gir_LIBS += $(top_builddir)/test-fixtures/libtest-fixtures.la
Cogl_1_0_gir_LIBS += $(top_builddir)/test-fixtures/libtest-fixtures.la
endif
Cogl_@LIBMUTTER_API_VERSION@_gir_FILES = $(cogl_1_public_h)
Cogl_1_0_gir_FILES = $(cogl_1_public_h)
Cogl_@LIBMUTTER_API_VERSION@_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) -UCOGL_COMPILATION -D__COGL_H_INSIDE__ -D__COGL_XLIB_H_INSIDE__ -D__COGL_EGL_H_INSIDE__ -D__COGL_GLX_H_INSIDE__ -DCOGL_GIR_SCANNING
Cogl_@LIBMUTTER_API_VERSION@_gir_INCLUDES = GL-1.0 GObject-2.0
Cogl_@LIBMUTTER_API_VERSION@_gir_EXPORT_PACKAGES = mutter-cogl-@LIBMUTTER_API_VERSION@
Cogl_@LIBMUTTER_API_VERSION@_gir_SCANNERFLAGS = --warn-all --c-include='cogl/cogl.h'
Cogl_1_0_gir_CFLAGS = $(AM_CPPFLAGS) $(COGL_DEP_CFLAGS) -UCOGL_COMPILATION -D__COGL_H_INSIDE__ -D__COGL_XLIB_H_INSIDE__ -D__COGL_EGL_H_INSIDE__ -D__COGL_GLX_H_INSIDE__ -DCOGL_GIR_SCANNING
Cogl_1_0_gir_INCLUDES = GL-1.0 GObject-2.0
Cogl_1_0_gir_EXPORT_PACKAGES = mutter-cogl-1.0
Cogl_1_0_gir_SCANNERFLAGS = --warn-all --c-include='cogl/cogl.h'
INTROSPECTION_GIRS += Cogl-@LIBMUTTER_API_VERSION@.gir
INTROSPECTION_GIRS += Cogl-1.0.gir
girdir = $(mutterlibdir)
gir_DATA = $(INTROSPECTION_GIRS)

View File

@ -81,19 +81,6 @@
#define GL_PURGED_CONTEXT_RESET_NV 0x92BB
#endif
/* These aren't defined in the GLES2 headers */
#ifndef GL_GUILTY_CONTEXT_RESET_ARB
#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253
#endif
#ifndef GL_INNOCENT_CONTEXT_RESET_ARB
#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254
#endif
#ifndef GL_UNKNOWN_CONTEXT_RESET_ARB
#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255
#endif
static void _cogl_context_free (CoglContext *context);
COGL_OBJECT_DEFINE (Context, context);

View File

@ -262,7 +262,6 @@ typedef enum _CoglFeatureID
COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE,
COGL_FEATURE_ID_TEXTURE_RG,
COGL_FEATURE_ID_BUFFER_AGE,
COGL_FEATURE_ID_TEXTURE_EGL_IMAGE_EXTERNAL,
/*< private >*/
_COGL_N_FEATURE_IDS /*< skip >*/

View File

@ -55,13 +55,6 @@ struct _CoglDriverVtable
GLenum *out_glintformat,
GLenum *out_glformat,
GLenum *out_gltype);
CoglPixelFormat
(* pixel_format_to_gl_with_target) (CoglContext *context,
CoglPixelFormat format,
CoglPixelFormat target_format,
GLenum *out_glintformat,
GLenum *out_glformat,
GLenum *out_gltype);
CoglBool
(* update_features) (CoglContext *context,

View File

@ -152,7 +152,6 @@ typedef long GLsizeiptr;
#define GL_POLYGON_OFFSET_FILL 0x8037
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
#define GL_SAMPLE_COVERAGE 0x80A0
#define GL_TEXTURE_EXTERNAL_OES 0x8D65
/* ErrorCode */
#define GL_NO_ERROR 0

View File

@ -65,7 +65,7 @@
* conflicts we only expose the minimal set of GLES 2.0 types and enums
* publicly.
*/
#if defined(COGL_COMPILATION) || defined(COGL_ENABLE_MUTTER_API)
#ifdef COGL_COMPILATION
#include "cogl-gl-header.h"
#else
#include <cogl/cogl-gles2-types.h>

View File

@ -111,14 +111,6 @@ _cogl_glsl_shader_set_source_with_boilerplate (CoglContext *ctx,
lengths[count++] = sizeof (texture_3d_extension) - 1;
}
if (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_EGL_IMAGE_EXTERNAL))
{
static const char texture_3d_extension[] =
"#extension GL_OES_EGL_image_external : require\n";
strings[count] = texture_3d_extension;
lengths[count++] = sizeof (texture_3d_extension) - 1;
}
if (shader_gl_type == GL_VERTEX_SHADER)
{
strings[count] = vertex_boilerplate;

View File

@ -51,9 +51,6 @@ typedef struct _CoglGLXDisplay
CoglBool found_fbconfig;
CoglBool fbconfig_has_rgba_visual;
CoglBool is_direct;
CoglBool have_vblank_counter;
CoglBool can_vblank_wait;
GLXFBConfig fbconfig;
/* Single context for all wins */

View File

@ -43,6 +43,8 @@ typedef struct _CoglGLXRenderer
int glx_error_base;
int glx_event_base;
CoglBool is_direct;
/* Vblank stuff */
int dri_fd;

View File

@ -169,8 +169,7 @@ check_qualcomm_vendor (const CoglGpuInfoStrings *strings)
static CoglBool
check_nvidia_vendor (const CoglGpuInfoStrings *strings)
{
if (strcmp (strings->vendor_string, "NVIDIA") != 0 &&
strcmp (strings->vendor_string, "NVIDIA Corporation") != 0)
if (strcmp (strings->vendor_string, "NVIDIA") != 0)
return FALSE;
return TRUE;

View File

@ -1102,7 +1102,7 @@ upload_vertices (CoglJournal *journal,
attribute_buffer = create_attribute_buffer (journal, needed_vbo_len * 4);
buffer = COGL_BUFFER (attribute_buffer);
cogl_buffer_set_update_hint (buffer, COGL_BUFFER_UPDATE_HINT_DYNAMIC);
cogl_buffer_set_update_hint (buffer, COGL_BUFFER_UPDATE_HINT_STATIC);
vout = _cogl_buffer_map_range_for_fill_or_fallback (buffer,
0, /* offset */

View File

@ -42,8 +42,7 @@
#include <cogl/winsys/cogl-winsys-egl-private.h>
#include <cogl/winsys/cogl-winsys-private.h>
void cogl_renderer_set_custom_winsys (CoglRenderer *renderer,
CoglCustomWinsysVtableGetter winsys_vtable_getter,
void *user_data);
void cogl_renderer_set_custom_winsys (CoglRenderer *renderer,
CoglWinsysVtableGetter winsys_vtable_getter);
#endif /* __COGL_MUTTER_H___ */

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