1
0
Fork 0
Commit graph

445 commits

Author SHA1 Message Date
Carlos Garnacho
526fdca3fb 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-22 13:31:09 +02:00
Carlos Garnacho
220ac7c8f2 backends: Add empty stubs for tablet configuration
Those will be called when configuring tablets.
2016-07-22 13:31:09 +02:00
Thomas Hindoe Paaboel Andersen
125cba7100 backend: simplify assert
We already checked that constraint is non-null.

https://bugzilla.gnome.org/show_bug.cgi?id=769054
2016-07-22 10:44:19 +08:00
Florian Müllner
de1464f88f renderer-native: Adjust to StageView memory handling changes
ClutterStageView now takes ownership of the :framebuffer property,
so we need to release our own reference.
2016-07-20 20:58:20 +02:00
Rui Matos
daf5a112fb meta/boxes: typedef cairo_rectangle_int_t MetaRectangle
They are already effectively interchangeable so this should reduce
pointless casts.

Just like in GDK though, we need to keep the old definition for
instrospection to be able to include the struct's fields.
2016-07-20 14:11:25 +02:00
Jonas Ådahl
e891a8b628 renderer-native: Resize legacy onscreen before panting
By creating a pending gbm/EGL surface pair, only setting it on
swap-buffers, we would draw onto a buffer on the old surface, then swap
the buffer from the new surface, causing the first frame after a
hot-plug always having no content.

This was in the past not very noticable since some non-deterministic but
frequent side effect in gnome-shell caused hot-plugging to always render
two new frames, but after "Introduce regional stage rendering", this
side effect did not occur as often, thus making it more visible.

This commit updates the current gbm/EGL surface pair before painting a
frame, so that when the frame is painted, the surface with the correct
size is used and the buffer from correct surface is swapped.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
aecd98b847 backends/native: Support drawing onto multiple onscreen framebuffers
Add support for drawing the stage using multiple stage views, where
each stage view has its own onscreen framebuffer.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
d7b87799c8 backend: Ensure the backend gets notified of monitor state having changed
Being a listener to a signal, it is inconvenient to enforce order of
execution between different signal listeners. If there are things in
the backend that should be updated before various other signal
handlers, make sure so is done by emitting the signal after having
explicitly notified the backend.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
28a898a22f Use signals instead of onscreen framebuffer frame callbacks
CoglFrameInfo is a frame info container associated with a single
onscreen framebuffer. The clutter stage will eventually support drawing
a stage frame with multiple onscreen framebuffers, thus needs its own
frame info container.

This patch introduces a new stage signal 'presented' and a accompaning
ClutterFrameInfo and adapts the stage windows and past onscreen frame
callbacks users to use the signal and new info container.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
92341e7c30 MetaRendererNative: Make cogl variables obvious via their names
Call a CoglContext "cogl_context", CoglDisplay "cogl_display" and
CoglRenderer "cogl_renderer" so that they won't be confused with
ClutterContext, MetaDisplay and MetaRenderer etc.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
2eb843268a renderer-native: Rename cogl vfunc implementations
Make the cogl vfunc functions have names that are globally
discoverable. Calling the same function in every backend the same name
causes code navigation tools to not function properly. Rename the
affected functions to closer correspond to the style mutter uses.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
44b163e39b renderer-native: Meta:ify a struct
Rename a struct from the old Cogl style to mutter style naming and
conventions.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
566c28bdaf Introduce regional stage rendering
Add support for drawing a stage using multiple framebuffers each making
up one part of the stage. This works by the stage backend
(ClutterStageWindow) providing a list of views which will be for
splitting up the stage in different regions.

A view layout, for now, is a set of rectangles. The stage window (i.e.
stage "backend" will use this information when drawing a frame, using
one framebuffer for each view. The scene graph is adapted to explictly
take a view when painting the stage. It will use this view, its
assigned framebuffer and layout to offset and clip the drawing
accordingly.

This effectively removes any notion of "stage framebuffer", since each
stage now may consist of multiple framebuffers. Therefore, API
involving this has been deprecated and made no-ops; namely
clutter_stage_ensure_context(). Callers are now assumed to either
always use a framebuffer reference explicitly, or push/pop the
framebuffer of a given view where the code has not yet changed to use
the explicit-buffer-using cogl API.

Currently only the nested X11 backend supports this mode fully, and the
per view framebuffers are all offscreen. Upon frame completion, it'll
blit each view's framebuffer onto the onscreen framebuffer before
swapping.

Other backends (X11 CM and native/KMS) are adapted to manage a
full-stage view. The X11 CM backend will continue to use this method,
while the native/KMS backend will be adopted to use multiple view
drawing.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
a465e4c5b8 compositor: Initiate cogl context field on creation
There will only ever be one context; just get it from clutter instead
of waiting for we interact with a framebuffer.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
767e12125b ClutterStageCogl: Let the sub-classes handle the onscreen
In preperation for having allowing drawing onto multiple onscreen
framebuffers, move the onscreen framebuffer handling to the
corresponding winsys dependent backends.

Currently the onscreen framebuffer is still accessed, but, as can seen
by the usage of "legacy" in the accessor name, it should be considered
the legacy method. Eventually only the X11 Compositing Manager backend
will make use of the legacy single onscreen framebuffer API.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
14dbdfe483 Get rid of ClutterStageEglNative
The functionality from ClutterStageEglNative (one function returning
TRUE) was moved to MetaStageWindowNative.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
c3d2352a9e Explicitly create per backend stage windows
Split the stage window implementations into three separate objects: one
for X11 as a compositing manager, one for X11 running as a nested
Wayland compositor, and one for running with the native backend.

The new stage window implementations are only thin shells; this is in
preparation for making the stage windows behave more differently.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
55726e787b backends: Make clutter stage resizing more explicit
The stage resizing was placed in the generic backend, which was only
run on certain configurations (when running nested or using the native
backend). This commits makes the resizing more explicit thus more
obvious.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
8bebb8126c Let MetaMonitorManagerKms handle page flips
This commit completes the move of monitor logic to the monitor
mangager. The renderer now only deals with framebuffers, asking the
monitor manager to do the crtc flip tracking.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
12ef1a5e4b backends/native: Let the monitor manager manage KMS modes
Let MetaMonitorManagerKms manage KMS modes. This lets us pass less
state to MetaRendererNative. Instead let MetaMonitorManager tell the
monitor manager when it should set the mode and with what framebuffer.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
ec1da588cf MetaRendererNative: glib:ify a couple of struct fields
https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
44628bf224 MetaRendererNative: Absorb CoglDisplayKMS
Absorb the CoglDisplayKMS struct into MetaRendererNative. This makes
t so that all KMS interaction and fields are in the same place.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
27ac0b7f27 MetaRendererNative: Absorb CoglRendererKMS
Absorb the CoglRendererKMS struct into MetaRendererNative. The gbm
device initialization is moved earlier so that the renderer fails to
initialize if the gbm device creation failed.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
e420f386d2 Move cogl KMS winsys into the native backend
Move the KMS interaction from cogl into mutter, where most of the other
KMS interaction already takes place. This also removes dead code which
were only excercised when non-mutter callers used the cogl KMS backend.

The cogl KMS API was updated to pass via MetaRendererNative instead of
via the different cogl objects.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
2ceff4ee9b Create cogl renderer in MetaRenderer
Instead of passing around the KMS file descriptor via clutter to cogl,
just make our own clutter backend create the cogl renderer and set the
KSM fd.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
b2a62e6d5a native: Pass KMS fd to renderer
Will be used in a later commit.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
a54042e938 Introduce MetaRenderer
MetaRenderer is meant to be the object responsible for rendering the
scene graph. It will contain the logic related to the cogl winsys
backend, the clutter backend, and the clutter stage window.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
dd1eaeb262 Use correct cogl object types
Use the correct pointer types for cogl objects. This avoids warnings
when including the cogl headers doesn't result in all the cogl types
being typedefs to void.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
f096cc327d launcher: Expose KMS fd
https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Jonas Ådahl
90de521799 Make mutter manage its own clutter backends
Introduce two new clutter backends: MetaClutterBackendX11 and
MetaClutterBackendNative. They are so far only wrap ClutterBackendX11
and ClutterBackendEglNative respectively, but the aim is to move things
from the original clutter backends when needed.

https://bugzilla.gnome.org/show_bug.cgi?id=768976
2016-07-20 14:23:48 +08:00
Rui Matos
7f6bcea331 compositor: Handle GL video memory purged errors
Emit a signal so that interested parties can recreate their FBOs and
queue a full scene graph redraw to ensure we don't end up showing
graphical artifacts.

This relies on the GL driver supporting the
NV_robustness_video_memory_purge extension and cogl creating a
suitable GL context. For now we only make use of it with the X backend
since the only driver with which this is useful is NVIDIA.

https://bugzilla.gnome.org/show_bug.cgi?id=739178
2016-06-27 20:23:50 +02:00
Florian Müllner
8d7ae52565 stage: Fix function definition 2016-06-02 16:10:42 +02:00
Rui Matos
1141929bc5 backends: Add flags to MetaMonitorMode
And export them in the DBus API since they're useful for
gnome-control-center.

https://bugzilla.gnome.org/show_bug.cgi?id=763832
2016-05-13 18:44:45 +02:00
Carlos Garnacho
362ab781dd backends: Allow multiple "SW" cursor overlays on the stage
All the upper layers are prepared for multiple onscreen cursors, but
this. All MetaCursorRenderers created would poke the same internal
MetaOverlay in the stage.

This will lead to multiple cursor renderers resorting to the "SW"
rendering paths (as it can be seen with tablet support) to reuse the
same overlay, thus leading to flickering when a different
MetaCursorRenderer takes over the overlay.

Fix this by allowing per-cursor-renderer overlays, their lifetime
is attached to the cursor renderer, so is expected to be tear down
if the relevant device (eg. tablet) disappears.
2016-05-03 18:17:01 +02:00
Carlos Garnacho
b3eb56bb78 backend: Realize cursor on default MetaCursorRenderer paths
The cursor is realized on x11/native subclasses, but not if a base
MetaCursorRenderer is created.
2016-05-03 13:05:06 +02:00
Emmanuele Bassi
5f5d8f4091 Drop local g_autoptr definitions for generated code
Sadly, GLib's autoptr cleanup macros cannot be detected by the C
pre-processor, because they generate a function. This means that we are
forced to bump up the dependency on GLib 2.49, in order to build against
a newer version of gdbus-codegen.
2016-05-03 08:54:46 +01:00
Emmanuele Bassi
aeda556af1 Don't re-define auto cleanup symbols
Starting from GLib 2.49, the gdbus-codegen tool automatically generates
the auto cleanup symbols for the GDBus proxy and skeleton interfaces.

Since we don't depend on a specific version of GLib we need to
conditionally generate the auto cleanup symbols in case an older version
of gdbus-codegen is used when building Mutter.

This commit unbreaks the build under GNOME Continuous, which has been
failing with:

usr/include/glib-2.0/glib/gmacros.h:415:43: error: redefinition of 'glib_autoptr_cleanup_Login1Session'
 #define _GLIB_AUTOPTR_FUNC_NAME(TypeName) glib_autoptr_cleanup_##TypeName
                                           ^
[...]
/usr/include/glib-2.0/glib/gmacros.h:415:43: note: previous definition of 'glib_autoptr_cleanup_Login1Session' was here
./meta-dbus-login1.h:82:1: note: in expansion of macro 'G_DEFINE_AUTOPTR_CLEANUP_FUNC'
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (Login1Session, g_object_unref)
 ^
2016-05-03 07:57:55 +01:00
Florian Müllner
ed5c3b39ee monitor-manager: Add get_is_builtin_display_on()
Wrap the existing laptop_display_is_on() method in a public function
that gnome-shell can use to query whether a builtin output is present
and enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=765267
2016-04-21 21:16:16 +02:00
Florian Müllner
b6f11fa8b8 monitor-config: Update laptop heuristics to match GnomeRROutput
gnome-desktop's GnomeRROutput class has heuristics to classify a display
as builtin similar to our own[0]. The two heuristics don't quite match
though, so different core components can end up with a different view
on the current display configuration. Minimize that risk by adding a
couple of rules that bring the two heuristics closer together.

[0] https://git.gnome.org/browse/gnome-desktop/tree/libgnome-desktop/gnome-rr.c#n1674

https://bugzilla.gnome.org/show_bug.cgi?id=765267
2016-04-21 17:36:22 +02:00
Florian Müllner
ab6c008e3e monitor-manager: Expose output_is_laptop() method
We currently duplicate the heuristics of whether an output is considered
a laptop or not. Avoid this by sharing a small helper method.

https://bugzilla.gnome.org/show_bug.cgi?id=765267
2016-04-21 17:36:22 +02:00
Victor Toso
ff312b6958 fix warning due implicit declaration of function
error: implicit declaration of function
  .x = (int)roundf (priv->current_x - (hot_x * texture_scale)),
            ^

https://bugzilla.gnome.org/show_bug.cgi?id=765252
2016-04-20 09:22:52 +02:00
Florian Müllner
8842bdfb11 Do not skip CoglError parameters
While CoglError is a define to GError, it doesn't follow the convention
of ignoring errors when NULL is passed, but rather treats the error as
fatal :-(
That's clearly unwanted for a compositor, so make sure to always pass
an error parameter where a runtime error is possible (i.e. any CoglError
that is not a malformed blend string).

https://bugzilla.gnome.org/show_bug.cgi?id=765058
2016-04-15 17:22:24 +02:00
Florian Müllner
bdc72dd9d7 Do not try to unref NULL CoglObjects
https://bugzilla.gnome.org/show_bug.cgi?id=765058
2016-04-15 17:21:22 +02:00
Rui Matos
8587f0e80d monitor-config: Handle invalid previous configurations
The previous configuration might not apply because the number of
enabled outputs when trying to apply it might have changed. This isn't
a bug so we shouldn't assert. Instead, we can handle it by falling
back as we would if we didn't have a previous configuration to start
with.

https://bugzilla.gnome.org/show_bug.cgi?id=764286
2016-04-13 18:16:36 +02:00
Rui Matos
8b801aac77 Handle meta_screen_get_monitor_for_point() returning NULL
On the X11 backend we don't track the pointer position in
priv->current_x/y which remain set to zero. That means we never set
the clutter stage cursor if point 0,0 isn't covered by any monitor
since we return early.

Commit 4bebc5e5fa introduced this to
avoid crashing on the prepare-at handlers when the cursor position
doesn't fall inside any monitor area but we can handle that higher up
in the stack. In that case, the sprite's scale doesn't matter since
the cursor won't be shown anyway so we can skip setting it.

https://bugzilla.gnome.org/show_bug.cgi?id=763159
2016-03-10 16:01:54 +01:00
Carlos Garnacho
741dd674f6 backends: rate-filter the emission of MetaBackend::last-device-changed signal
It indirectly triggers expensive operations in gnome-shell
(js/ui/keyboard.js), which turns out too expensive if we happen to operate
the shell simultaneously with 2 devices that will trigger the operations
there.

So just rate limit the signal emission, defer to an idle and just emit
the last device gotten. Worst that will happen is that we may possibly
emit the signal on the same device consecutively.

https://bugzilla.gnome.org/show_bug.cgi?id=753527
2016-02-26 16:19:15 +01:00
Jonas Ådahl
9611661154 native: Don't wait for a new input event to wrap the pointer
If we rely on getting back an input event with the warped pointer
coordinates, we might draw a frame with the old coordinates if we warp
during the paint phase. Avoid that by moving the cursor immediately.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
495c89401a Implement support for the wp_pointer_constraints protocol
The wp_pointer_constraints protocol is a protocol which enables clients
to manipulate the behavior of the pointer cursor associated with a seat.

Currently available constraints are locking the pointer to a static
position, and confining the pointer to a given region.

Currently locking is fully implemented, and confining is implemented for
rectangular confinement regions.

What else is lacking is less troublesome semantics for enabling the lock
or confinement; currently the only requirement implemented is that the
window that appears focused is the one that may aquire the lock.

This means that a pointer could be 'stolen' by creating a new window that
receives active focus, or when using focus-follows-mouse, a pointer
passes a window that has requested a lock. This semantics can be changed
and the protocol itself allows any semantics as seems fit.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
525644059d native: Update to new constrain callback API
https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
f0f638d2bd Move out generic math parts out of the native barrier implementation
In order to reuse some vector math for pointer confinement, move out
those parts to its own file, introducing the types old types
"MetaVector2" and "MetaLine2" outside of meta-barrier-native.c, as well
as introducing MetaBorder which is a line, with a blocking direction.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:48 +08:00
Jonas Ådahl
5b0eabec51 wayland: Implement support for wp_relative_pointer
Add support for sending relative pointer motion deltas to clients who
request such events by creating wp_relative_pointer objects via
wp_relative_pointer_manager.

This currently implements the unstable version 1 from wayland-protocols.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2016-02-16 19:02:47 +08:00
Rui Matos
55eef2deb3 cursor-renderer-native: Re-use cogl's gbm device
Instancing a gbm device without initializing EGL with it means that it
won't be able to import wl_drm buffers. Instead, let's re-use cogl's
gbm device which is already properly initialized.

https://bugzilla.gnome.org/show_bug.cgi?id=761557
2016-02-04 18:22:05 +01:00
Rui Matos
3cdcd3e9c1 meta-launcher: Use g_auto* macros
This fixes a couple of minor memory leaks.

https://bugzilla.gnome.org/show_bug.cgi?id=760670
2016-01-25 13:59:53 +01:00
Rui Matos
ac8fe2d9b2 cursor-tracker: Port to GdkSeat API 2016-01-21 14:07:50 +01:00
Marek Chalupa
e7a88dc6b2 meta-launcher: don't call g_object_unref() on NULL
g_object_unref() was called no matter what we got for value

https://bugzilla.gnome.org/show_bug.cgi?id=760670
2016-01-21 14:06:41 +01:00
Rui Matos
5e57af6286 idle-monitor-native: Don't leak user active watches
This fixes an issue analogous to bug 760330 for the X11 backend,
except on this backend we wouldn't crash accessing free'd memory.

Instead we're leaking watches since we steal them from the hash table
which means that when they're removed in
_meta_idle_monitor_watch_fire() they're no longer there and thus
they're never free'd.

https://bugzilla.gnome.org/show_bug.cgi?id=760476
2016-01-11 11:23:54 -05:00
Ray Strode
42b3a34f7b idle-monitor-xsync: fix crash if watch callback removes different watch
Right now the XSync based idle monitoring code, will fetch all active
watches into a list, and then call their watch callbacks one by one
as necessary.  If one watch callback invalidates another watch, the
list will contain free'd memory.

This commit makes sure to consult the hash table after ever call
of a watch callback, to ensure mutter never looks at freed memory.

Fixes crash reported on IRC by Laine Stump with his synergy setup.

https://bugzilla.gnome.org/show_bug.cgi?id=760330
2016-01-11 11:23:39 -05:00
Rui Matos
19d814c887 cursor-renderer-native: Avoid a crash if we fail to allocate a gbm bo
https://bugzilla.gnome.org/show_bug.cgi?id=758613
2016-01-11 14:31:42 +01:00
Jasper St. Pierre
9ebe3419c3 monitor-manager-xrandr: Don't query legacy properties
This never could have worked -- the Atom name it was querying was a root
window property, not an output property.
2016-01-09 18:06:18 -08:00
Rui Matos
9385c835b8 native: Don't leak DRM plane resources 2016-01-07 19:42:19 +01:00
Carlos Garnacho
efef0c993b native: Implement DRM-based crtc rotation
We can know the rotation modes supported by the driver, so
export these as our supported modes, and ensure these modes
are honored on the CRTC primary plane upon apply_configuration().

It is worth noting however that not all hardware will be
capable of supporting all rotation modes (in fact, most of
them won't). A driver independent solution should be in
place to back up the rotation modes unsupported by the
drivers, so this is still a partial solution.

The cursor renderer has also been changed to default to
software-based rendering anytime the cursor enters a
rotated CRTC. Another solution would be actually rotating
the DRM cursor planes, but then it requires applying rotation on
these per-CRTC, and actually transforming the pointer position by
the output matrix. This brings marginal gains, so we use the
"sw" rendered cursor, which will be transformed together with
the primary plane.

https://bugzilla.gnome.org/show_bug.cgi?id=745079
2016-01-07 17:03:44 +01:00
Bastien Nocera
996aeaef41 backends: Fix cut'n'paste error in click method setting
GDesktopTouchpadScrollMethod was used instead of GDesktopTouchpadClickMethod
which became visible now that the former has been removed from
gsettings-desktop-schemas.

https://bugzilla.gnome.org/show_bug.cgi?id=759304
2015-12-15 14:41:51 +01:00
Bastien Nocera
a27b2597b9 backends: Force 2-finger scroll by default if available
When the touchpad is two-finger scrolling capable, always enable it.

When the touchpad only supports edge scrolling (usually older devices, and
usually smaller devices), allow disabling the edge scrolling.

This requires a newer gsettings-desktop-schemas as the scroll-method key
was removed, and the edge-scroll-enabled key added.

https://bugzilla.gnome.org/show_bug.cgi?id=759304
2015-12-15 14:38:23 +01:00
Rui Matos
82bdd1e353 monitor-manager: Fix the max potential number of logical monitors
The max potential number of logical monitors (i.e. MetaMonitorInfos)
is the number of CRTCs, not the number of outputs.

In cases where we have more enabled CRTCs than connected outputs we
would end up appending more MetaMonitorInfos to the GArray than the
size it was initialized with which means the array would get
re-allocated rendering invalid some MetaCRTC->logical_monitor pointers
assigned previously and thus ending in crashes later on.

https://bugzilla.gnome.org/show_bug.cgi?id=751638
2015-11-29 19:15:37 +01:00
Marek Chalupa
4bebc5e5fa cursor-renderer: do not update cursor if it is out of monitor
if the cursor coordinates are out of monitor, just don't render the
cursor

https://bugzilla.gnome.org/show_bug.cgi?id=756698
2015-11-29 19:15:23 +01:00
Daniel Stone
c16a5ec1cf KMS/Wayland: Correct refresh rate units
On the wire, Wayland specifies the refresh rate in milliHz. Mutter sends
the refresh rate in Hz, which confuses clients, e.g. weston-info:
interface: 'wl_output', version: 2, name: 4
	mode:
		width: 2560 px, height: 1440 px, refresh: 0 Hz,
		flags: current preferred
interface: 'wl_output', version: 2, name: 5
	mode:
		width: 3200 px, height: 1800 px, refresh: 0 Hz,
		flags: current preferred

and xrandr:
XWAYLAND0 connected 2560x1440+3200+0 600mm x 340mm
   2560x1440@0.1Hz   0.05*+
XWAYLAND1 connected 3200x1800+0+0 290mm x 170mm
   3200x1800@0.1Hz   0.03*+

Export the refresh rate in the correct units. For improved precision,
perform the KMS intermediate calculations in milliHz as well, and
account for interlaced/doublescan modes.

This is also consistent with what GTK+ expects:
      timings->refresh_interval = 16667; /* default to 1/60th of a second */

      /* We pick a random output out of the outputs that the window touches
       * The rate here is in milli-hertz */
      int refresh_rate = _gdk_wayland_screen_get_output_refresh_rate (wayland_display->screen,
                                                                      impl->outputs->data);
      if (refresh_rate != 0)
        timings->refresh_interval = G_GINT64_CONSTANT(1000000000) / refresh_rate;

Where the 'refresh_rate' given is exactly what's come off the wire.
1000000000/60000 comes out as 16667, whereas divided by 60 is ...
substantially less.

https://bugzilla.gnome.org/show_bug.cgi?id=758653
2015-11-25 15:35:25 +01:00
Alban Browaeys
ca7c1d5e02 launcher: Fix drm device detection for non pci devices
On Odroid U2 (exynos4412) the drm device is not bound to pci.
Open the detection to platform device of the drm subsystem, exclusive of
control devices.

https://bugzilla.gnome.org/show_bug.cgi?id=754911
2015-11-12 14:09:02 -05:00
Ray Strode
cf3ee327a0 meta-backend: include stdlib.h
Otherwise build fails with missing declaration
warning for exit().
2015-11-06 23:10:41 -05:00
Owen W. Taylor
3ec3cc248d Exit, not abort, when we fail to initialize Clutter
Failing to initialize Clutter isn't something it's useful to report
into automatic bug tracking systems or get a backtrace for - in fact,
the most common case is that DISPLAY is unset or points to a
non-existent X server. So simply exit rather than calling g_error().

https://bugzilla.gnome.org/show_bug.cgi?id=757311
2015-11-06 17:03:59 -05:00
Owen W. Taylor
7fb3ecc12c MetaLauncher: Don't g_error() on failure
g_error() is the wrong thing to do when, for example, we can't find the
DRM device, since Mutter should just fail to start rather than reporting
a bug into automatic bug tracking systems. Rather than trying to decipher
which errors are "expected" and which not, just make all failure paths
in meta_launcher_new() return a GError out to the caller - which we make
exit(1).

https://bugzilla.gnome.org/show_bug.cgi?id=757311
2015-11-06 17:03:59 -05:00
Ray Strode
4c9af7267d Revert "Force cursor update after applying configuration"
This reverts commit 33150569cd.

This was a stow-a-away sitting in my local tree.
2015-11-06 16:24:34 -05:00
Ray Strode
33150569cd Force cursor update after applying configuration
The qxl kms driver has a bug where the cursor gets hidden
implicitly after a drmModeSetCrtc call.

This commit works around the bug by forcing a drmModeSetCursor2
call after the drmModeSetCrtc calls.

This is pretty hacky and won't ever go upstream.

https://bugzilla.gnome.org/show_bug.cgi?id=746078
2015-11-06 14:26:46 -05:00
Rui Matos
af2a13ded4 monitor-manager-xrandr: Skip outputs with no crtcs
Outputs with no crtcs shouldn't happen, but if it does we should
ignore them, instead of possibly crashing later.

https://bugzilla.gnome.org/show_bug.cgi?id=756796
2015-10-30 17:47:00 +01:00
Rui Matos
8b200de35a monitor-manager-xrandr: Skip outputs with no modes
If we can't find any valid modes for an output we need to unwind and
skip the output because trying to use a modeless output later will
crash us.

https://bugzilla.gnome.org/show_bug.cgi?id=756796
2015-10-30 17:47:00 +01:00
Rui Matos
57ae203aab Revert "monitor-manager-xrandr: Ignore outputs without modes"
This reverts commit 86a913d37a. It
introduced a memory leak, so we'll go for a cleaner approach.

https://bugzilla.gnome.org/show_bug.cgi?id=756796
2015-10-30 17:47:00 +01:00
Rui Matos
bff75b64be monitor-manager: Expose a few helpers to clear structs
These are useful for child classes to unwind cleanly when constructing
their structures.

https://bugzilla.gnome.org/show_bug.cgi?id=756796
2015-10-30 17:47:00 +01:00
Rui Matos
86a913d37a monitor-manager-xrandr: Ignore outputs without modes
In some cases we get outputs without any valid mode. We need to ignore
them or we'll crash later.

https://bugzilla.gnome.org/show_bug.cgi?id=756796
2015-10-23 14:13:26 +02:00
Alberts Muktupāvels
2857fdbdb8 backend-x11: Ensure the Xkb group index remains properly set
Ubuntu ships a patch in the X server that makes the group switch
keybindings only work on key release, i.e. the X server internal group
locking happens on key release which means that mutter gets the
XKB_KEY_ISO_Next_Group key press event, does its XLockGroup() call
with a new index and then, on key release, the X server moves the
index further again.

We can work around this without affecting our behavior in unpatched X
servers by doing a XLockGroup() every time we're notified of the
locked group changing if it doesn't match what we requested.

https://bugzilla.gnome.org/show_bug.cgi?id=756543
2015-10-23 14:13:26 +02:00
Rui Matos
43a1d43f2b monitor-manager-xrandr: Be more robust when reading XRROutputInfos
We might get modes in XRROutputInfos that aren't in the
XRRScreenResources we get earlier. This always seems to be transient,
i.e. when it happens, the X server will usually send us a follow up
RRScreenChangeNotify where we then get a "stable" view of the world
again.

In any case, when these glitches happen, we end up with NULL pointers
in the MetaOutput->modes array which makes us crash later on. This
patch ensures that doesn't happen.

https://bugzilla.gnome.org/show_bug.cgi?id=756660
2015-10-16 13:57:26 +02:00
Rui Matos
9abc071283 backend-x11: Fallback to a default keymap if getting it from X fails
This shouldn't fail but apparently sometimes it does and in that case
having a possibly wrong idea of the keymap is still better than
crashing.

https://bugzilla.gnome.org/show_bug.cgi?id=754979
2015-09-25 19:09:48 +02:00
Florian Müllner
67d3a7a2d7 meta-monitor-manager: Remove bogus condition from check
An unsigned number is never smaller than 0, so we don't have to
check for it.
2015-09-24 03:08:23 +02:00
Florian Müllner
bc00f118f3 Avoid shadowing existing variables 2015-09-24 03:08:22 +02:00
Florian Müllner
27b37407d0 Don't duplicate declarations from G_DEFINE_TYPE 2015-09-24 03:01:51 +02:00
Jonas Ådahl
b7aca07844 Revert "launcher: simplify getting session dbus proxy"
Signals are sent to a specific ID, so we can't use "self" here. After
this revert, VT switching works again.

This reverts commit 8e22bf5bc9.

https://bugzilla.gnome.org/show_bug.cgi?id=753434
2015-09-17 12:17:45 +08:00
Florian Müllner
dc780d2c44 launcher: Don't pass variable as format string
We know the variable only contains one or another string literal,
but keep compilers happy as well.
2015-09-16 17:38:10 +02:00
Jonas Ådahl
0373b854c1 MetaCursorRenderer: Rely on update_cursor for redrawing
Calling queue_redraw() in _force_update() is not needed because
update_cursor() will do this when needed, i.e. when switching between
hardware cursor and texture cursor, or when drawing with texture cursor.

There is also no need to force _native_force_update() because
update_cursor() will cover this as well when needed. When not changing
cursor but only the gbm_bo, the "dirty" boolean on the gbm_bo will
trigger a redraw.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
79c86ae890 Support scaling of cursor sprites given what output they are on
This commits refactors cursor handling code and plugs in logic so that
cursor sprites changes appearance as it moves across the screen.
Renderers are adapted to handle the necessary functionality.

The logic for changing the cursor sprite appearance is done outside of
MetaCursorSprite, and actually where depends on what type of cursor it
is. In mutter we now have two types of cursors that may have their
appearance changed:

 - Themed cursors (aka root cursors)
 - wl_surface cursors

Themed cursors are created by MetaScreen and when created, when
applicable(*), it will extend the cursor via connecting to a signal
which is emitted everytime the cursor is moved. The signal handler will
calculate the expected scale given the monitor it is on and reload the
theme in a correct size when needed.

wl_surface cursors are created when a wl_surface is assigned the
"cursor" role, i.e. when a client calls wl_pointer.set_cursor. A
cursor role object is created which is connected to the cursor object
by the position signal, and will set a correct texture scale given what
monitor the cursor is on and what scale the wl_surface's active buffer
is in. It will also push new buffers to the same to the cursor object
when new ones are committed to the surface.

This commit also makes texture loading lazy, since the renderer doesn't
calculate a rectangle when the cursor position changes.

The native backend is refactored to be triple-buffered; see the comment
in meta-cursor-renderer-native.c for further explanations.

* when we are running as a Wayland compositor

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
e407f5bbae MetaCursorSprite: Squash MetaCurorImage into MetaCursorSprite
It fills little purpose on separating into a MetaCursorImage struct, so
lets squash in the three fields into the MetaCursorSprite object.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
8900bd2f5c backends/x11: Draw our own cursor sprite when running nested
Use a specialized cursor renderer when running as a nested Wayand
compositor. This new renderer sets an empty X11 cursor and draws the
cursor as part of the stage using the generic cursor renderer drawing
path.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Ting-Wei Lan
5066eaf691 build: Fix non-wayland build
This fixes build error caused by commit 614d6bd. We can simply remove
the usage of meta-wayland.c functions in non-wayland build because
META_BACKEND_X11_MODE_NESTED is only used in wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=753948
2015-09-08 01:50:03 +08:00
Marek Chalupa
79f755bf0f launcher: find the right drm device
Instead of hard-coding /dev/dri/card0, find the device
that has boot_vga flag set or has been explicitly
assigned a seat id other than seat0

https://bugzilla.gnome.org/show_bug.cgi?id=753434
2015-09-07 08:42:21 -04:00
Marek Chalupa
1845bfe1b6 launcher: refactor handling errors in meta_launcher_new
Fill in missing error checks and use g_error, since any
error in this phase would lead to crash later anyway.
This way we'll at least know what went wrong.

Although it was not the patch's original intention, it fixes
https://bugzilla.gnome.org/show_bug.cgi?id=754520

https://bugzilla.gnome.org/show_bug.cgi?id=753434
2015-09-07 08:40:49 -04:00
Marek Chalupa
8e22bf5bc9 launcher: simplify getting session dbus proxy
Use path "/org/freedesktop/login1/session/self" instead of
getting session id and building the path manually

https://bugzilla.gnome.org/show_bug.cgi?id=753434
2015-09-07 08:40:20 -04:00
Marek Chalupa
c13ddafdb8 native: remove obsolete comment
There's not weston-launch anymore

https://bugzilla.gnome.org/show_bug.cgi?id=753434
2015-09-07 08:39:38 -04:00
Owen W. Taylor
614d6bd0f8 Nested X11: use KeymapNotify events to fix key state on FocusIn
If the user Alt-Tabs out of the window, we will be left thinking
the Alt key is still pressed since we don't see a release for it.

Solve this and other related issues for the nested X11 compositor
by selecting for KeymapStateMask which causes a KeymapNotify event
to be sent after each FocusIn, and when we get these events, update
the internal XKB state and send any necessary modifiers events to
clients.

https://bugzilla.gnome.org/show_bug.cgi?id=753948
2015-09-03 16:02:25 -04:00
Jonas Ådahl
d3fdaa3232 MetaCursorSprite: Put renderer specific code in the renderer
There were lots of code handling the native renderer specific cases;
move these parts to the renderer. Note that this causes the X11 case to
always generate the texture which is a waste of memory, but his
regression will be fixed in a following commit.

The lazy loading of the texture was removed because it was eventually
always loaded anyway indirectly by the renderer to calculate the
current rect.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-08-28 09:55:12 +08:00
Jonas Ådahl
165050f8f9 backends: Get rid of meta-cursor-private.h
There is nothing special about the private API which only consists of
getters for renderer specific backing buffer. Lets them to the regular
.h file and treat them as part of the normal API.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-08-28 09:54:57 +08:00
Jonas Ådahl
b01f95cfdd Make MetaCursorSprite a GObject
To easier track lifetime and utilize other GObject features, make
MetaCursorSprite a GObject.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-08-28 09:52:30 +08:00
Jonas Ådahl
4b667d1e09 Rename MetaCursorReference to MetaCursorSprite
It isn't really a reference to a MetaCursor enum, but a reference
counted cursor sprite, and enum value.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-08-28 09:52:30 +08:00
Jonas Ådahl
975feb9202 MetaCursorRenderer: Use G_DECLARE_DERIVABLE_TYPE to declare the type
https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-08-19 16:43:44 +08:00