Commit Graph

21488 Commits

Author SHA1 Message Date
Jonas Ådahl
f6c9261bf6 wayland: Scale window geometry rects given the main output
Since we scale surface actors given what main output their toplevel
window is on, also scale the window geometry coordinates and sizes
(window->rect size and window->custom_frame_extents.top/left) in order
to make the window geometry represent what is being rendered on the
stage.

https://bugzilla.gnome.org/show_bug.cgi?id=744934
2015-07-16 11:54:14 +08:00
Jonas Ådahl
14b0a83f64 Don't calculate the main window monitor every time it`s needed
The main monitor of a window is maintained as 'window->monitor' and is
updated when the window is resized or moved. Lets avoid calculating it
every time it`s needed.

https://bugzilla.gnome.org/show_bug.cgi?id=744934
2015-07-16 11:54:14 +08:00
Jonas Ådahl
441efd17ce MetaMonitorInfo: Provide scale information
Tracking back from the monitor to the output every time we need to
figure out the scale of a window on a monitor is inconvenient, so
propagate the scale from the output to the monitor it is associated
with.

https://bugzilla.gnome.org/show_bug.cgi?id=744934
2015-07-16 11:53:40 +08:00
Jonas Ådahl
208da2316d wayland: Fix subsurface place_above/below type cast error
A MetaWaylandSurface was casted into a ClutterActor, but it should have
been the MetaSurfaceActor.

Move out parent_actor and surface_actor out of the loop while at it
since they won't change when iterating.

https://bugzilla.gnome.org/show_bug.cgi?id=745655
2015-07-16 11:43:19 +08:00
Jonas Ådahl
3b993131e8 wayland: Fix subsurface positioning on HiDPI
Keep the active position state in its original coordinate space, and
synchronize the surface actor with it when it changes and when
synchronizing the rest of the surface state, in case the surface scale
had changed.

https://bugzilla.gnome.org/show_bug.cgi?id=745655
2015-07-16 11:43:19 +08:00
Jonas Ådahl
117f57f74c wayland: Factor out some parts of meta_surface_actor_wayland_get_scale
Put a toplevel window getter in meta-wayland-surface.h and a main
monitor scale getter in window-wayland.h.

https://bugzilla.gnome.org/show_bug.cgi?id=745655
2015-07-16 11:43:19 +08:00
Marek Chalupa
b97ebc4124 frames: handle META_FRAME_CONTROL_NONE on left click
We can get this operation in some cases, for example when
we're trying to resize window that cannot be resized.
This can occur with maximized windows that have a border
(without border we couldn't resize them by mouse in maximized state).
In this case we reached abort() beacuse we did not handle this op.

https://bugzilla.gnome.org/show_bug.cgi?id=751884
2015-07-15 07:45:02 -05:00
Jonas Ådahl
5d10196919 MetaSurfaceActorWayland: Don't dereference surface before NULL check
Fixes regression introduced in ba7c524a18.

https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-07-15 17:10:48 +08:00
Jonas Ådahl
f295349e26 wayland: Don't crash if wl_output resource is destroyed after being removed
Previously a MetaWaylandOutput could be removed from the current outputs
table (by being unplugged for example). This would result in the global
object being removed and the MetaWaylandOutput instance freed, but the
wl_resource destructor would still try to remove itself from the list of
resources. Trying to do this, it'd try to access its user data pointer
which would point to the freed MetaWaylandOutput instance, and as a
result crash when trying to manipulate the freed data.

https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-07-15 14:55:55 +08:00
Jonas Ådahl
eb023ff2c9 wayland: Send wl_surface.enter and wl_surface.leave
Whenever a MetaSurfaceActor is painted, update the list of what outputs
the surface is being drawed upon. Since we do this on paint, we
effectively avoids this whenever the surface is not drawn, for example
being minimized, on a non-active workspace, or simply outside of the
damage region of a frame.

DND icons and cursors are not affected by this patch, since they are not
drawn as MetaSurfaceActors. If a MetaSurfaceActor or a parent is cloned,
then we'll check the position of the original actor again when the clone is
drawn, which is slightly expensive, but harmless. If the MetaShapedTexture
instead is cloned, as GNOME Shell does in many cases, then these clones
will not cause duplicate position checks.

https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-07-15 14:55:55 +08:00
Jonas Ådahl
ba7c524a18 MetaSurfaceActorWayland: Unset the MetaWaylandSurface pointer when it goes away
We may access it during painting even if it has been freed. For now,
manually unset it during the MetaWaylandSurface cleanup; in the future
make MetaWaylandSurface a GObject and make the surface pointer a weak
reference.

https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-07-15 14:55:55 +08:00
Jonas Ådahl
dc99af40f3 wayland: Make MetaWaylandOutput a GObject
This way we can later add signals to it.

https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-07-15 14:55:55 +08:00
Jonas Ådahl
1576b7d5a6 wayland: Put MetaWaylandOutput struct in header file
We need this in MetaWaylandSurface to be able to send
wl_surface.enter/leave.

https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-07-15 14:55:55 +08:00
Jonas Ådahl
6ec7fa2cbd wayland: Use surface role when special casing surface commits
Lets use the role when doing role specific commit actions. The
conditions effectively do that anyway, and this way we will get a
compiler warning here whenever we add a new role, as well as we avoid
having different variants of role-determination checks in different
places.

https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-07-15 14:55:55 +08:00
Jonas Ådahl
bede9970de nested: Allow configuration of dummy output configuration
Enable a user to test and debug multi output configurations on Wayland
without having the available hardware by enabling some basic
configuration of the dummy monitor manager.

Currently available configuration options are:

MUTTER_DEBUG_NUM_DUMMY_MONITORS - to set the number of monitors
MUTTER_DEBUG_DUMMY_MONITOR_SCALES - to configure the monitor scales

See src/backends/meta-monitor-manager-dummy.c for detailed description
of the available configuration parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=747089
2015-07-15 14:55:55 +08:00
Peter Hutterer
5f1bcc124f input-settings-x11: check properties for correctness before changing them
Before submitting a new scroll mode, click method or sendevents mode check if
the value is supported by the device. This avoids BadValue errors when setting
two-finger scrolling on single-finger touchpad devices since we can't easily
handle BadValue (see 9747277b)

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-14 16:42:33 -05:00
Ting-Wei Lan
ad690c61b1 macros: Clang 3.4 and later versions can use deprecation macros for GCC
https://bugzilla.gnome.org/show_bug.cgi?id=752272
2015-07-14 02:39:40 +08:00
Nitin Sharma
4dfa4de5d0 actor: Check for NULL pointer for pspec
In function clutter_actor_set_final_state, the pspec pointer returned by calling
g_object_class_find_property is not checked for NULL.
2015-07-13 13:15:52 +01:00
Emmanuele Bassi
332aa3cf21 macros: Add fallback defines for non-GCC compilers
I forgot to add the fallback definitions in case we're not using GCC;
without them, anybody using non-GCC compilers will get a build error.

https://bugzilla.gnome.org/show_bug.cgi?id=752272
2015-07-11 23:58:12 +01:00
Ting-Wei Lan
7e0f588c91 trivial: Fix return value error in clutter_event_get_gesture_motion_delta 2015-07-11 18:09:45 +08:00
Emmanuele Bassi
a722cbebef actor: Fully deprecate the state access macros
Now that we can warn without breaking the build, we should deprecate the
state access macros for ClutterActor.
2015-07-11 10:18:18 +01:00
Emmanuele Bassi
9bd3c8d2e6 conform: Do not use deprecated macros
Porting actor-graph is easier than porting actor-invariants, and we're
not really testing the internals of ClutterActor.
2015-07-11 10:18:18 +01:00
Emmanuele Bassi
ccd3fa0355 conform: Disable deprecation warnings
When testing the invariants we do also test deprecated API; there's no
need to warn.
2015-07-11 10:18:18 +01:00
Emmanuele Bassi
4040f2d556 gdk: Do not use deprecated macros
Use the replacement functions instead.
2015-07-11 10:18:18 +01:00
Emmanuele Bassi
eefbb88675 backend: Do not use deprecated macros
Use the replacement functions instead.
2015-07-11 10:18:18 +01:00
Emmanuele Bassi
02b44fcc60 cally: Drop use of deprecated macros
Use the equivalent functions instead.
2015-07-11 10:18:18 +01:00
Emmanuele Bassi
8a24ad83c9 Add macros for deprecating macros
We want to be able to deprecate macros, but right now the best we can do
is to wrap them with things like:

  #ifndef CLUTTER_DISABLE_DEPRECATED
  # define A_MACRO_I_WANT_TO_DEPRECATE ...
  #endif

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

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

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

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

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

We should provide a simple convenience function that does all this for
us.
2015-07-10 11:26:34 +01:00
Emmanuele Bassi
eda436f0c4 examples/actor-model: Add activate transition
Show a simple transition when the current menu item is activated.
2015-07-10 10:42:27 +01:00
Emmanuele Bassi
bf0ca91662 examples/actor-model: Clean up and comment
This is an example so it ought to be a bit more didactic.
2015-07-09 16:53:39 +01:00
Emmanuele Bassi
365bd482fb gdk: Use X11 API only when running under X11
Avoid using GdkX11Screen API when the GDK backend being used is not the
X11 one.

https://bugzilla.gnome.org/show_bug.cgi?id=752143
2015-07-09 14:34:11 +01:00
Emmanuele Bassi
41cd804f10 actor: Rename internal function
Map to the field name and the signal name, so it's clear what it does.
2015-07-09 14:30:26 +01:00
Emmanuele Bassi
b0300a6247 cogl: Pack ClutterStageCogl a bit more
We should rearrange the fields a bit so they get packed without holes,
and aligned with cacheline boundaries.
2015-07-08 11:15:54 +01:00
Emmanuele Bassi
938eea175f backend: Remove unnecessary private data structure
The whole of ClutterBackend is a final/protected type, so having a bunch
of instance fields and an instance private data structure is redundant
at best, and less efficient at worst.
2015-07-08 11:10:45 +01:00
Emmanuele Bassi
19fbbcd358 build: Do not define Wayland support unconditionally
Now that we discover at configure time if Wayland is available, we
should only enable support if we find it.

https://bugzilla.gnome.org/show_bug.cgi?id=752104
2015-07-08 11:05:10 +01:00
Emmanuele Bassi
02b69e4d76 Move header inclusion guard at the top
GCC has some optimization for the inclusion guard, but they only work if
the check is the outermost one.

We're fairly inconsistent because of historical reasons, so we should
ensure that we follow the same pattern in every public header.
2015-07-07 16:03:32 +01:00
Emmanuele Bassi
cffa243fbe Add autocleanup macros for Clutter types
So that people can use the g_auto* macros, as well as the G_DECLARE_*
ones, from GLib 2.44.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
6cd24faaa5 actor: Clean up transform_stage_point()
Use double precision floats for the intermediate computations, to avoid
loss of precision, and don't convert too integer when unnecessary, to
avoid rounding errors.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
4b9e672bc1 examples: Add actor-model
A basic example that shows how to build a composite actor starting from
a GListStore of model objects.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
bf9a71ae23 actor: Allow binding an actor to a GListModel
It can be useful to bind the children list to set of objects inside a
GListModel implementation; the GListModel stores the objects, and every
time the model changes, a function is called that maps each object in
the model to a newly created ClutterActor, which is then added as a
child. This API, along with the property binding one inside GObject,
allows automatic creation of views based on object models that update
themselves without manual intervention.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
7cde4486aa build: Bump GLib dependency
We need GListModel, in GIO since 2.44.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
db8bb95817 Move ClutterModel to the deprecated area
And deal with the fallout in the source tree.
2015-07-07 16:03:31 +01:00
Emmanuele Bassi
31c2c57f8b Move clutter-list-model.[ch] to the deprecated area 2015-07-07 16:03:31 +01:00
Emmanuele Bassi
52e8864aa3 conform: Disable deprecation warnings in the model units 2015-07-07 16:03:31 +01:00
Emmanuele Bassi
6376eebd9b Deprecate ClutterModel
Now that we've deprecated the only concrete implementation of
ClutterModel, it's time we deprecate the base abstract class.
2015-07-07 16:03:31 +01:00