Commit Graph

23339 Commits

Author SHA1 Message Date
Ray Strode
31c3695314 native: add some logging spew
hopefully this will help us get to the bottom of why jkoten's machine
isn't fixed.
2019-02-13 09:53:42 -05:00
Carlos Garnacho
b79e74f13f clutter: Add clutter_input_method_forward_key() method.
This allows input methods to inject key events with specific keyval/keycode,
those events will be flagged with CLUTTER_EVENT_FLAG_INPUT_METHOD so they
won't be processed by the IM again.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/531
2019-02-12 10:43:10 -05:00
Carlos Garnacho
be0e1a65e5 wayland: Relax requirements for evdev events to have a evcode
There may be emulated events that don't contain those, it's fine to
go through the fallback paths for these.
2019-02-12 10:43:10 -05:00
Carlos Garnacho
0dccf69cb3 clutter: Only reset scroll axes on slave devices
As a plus, unknown source device IDs will just warn instead of crash.
2019-02-12 10:43:10 -05:00
Ray Strode
e4da08218a main: be more aggressive in assuming X11 backend
If the session is started by vncserver right now, the
XDG_SESSION_TYPE won't be X11.  Ideally that would be
fixed, but for backward compatibility we should default
to X11 if the session type isn't set to wayland explicitly.
2019-02-12 10:43:10 -05:00
Rui Matos
d720a0a366 backends/x11: Support plain old X device configuration
We re-use part of the code added to support synaptics and add a few
bits specific for xorg-x11-drv-evdev devices.
2019-02-12 10:43:10 -05:00
Rui Matos
b0067b45b9 backends/x11: Add disable while typing support for synaptics
This is basically a copy of the old g-s-d mouse plugin code to manage
syndaemon when the synaptics driver is being used.
2019-02-12 10:43:10 -05:00
Rui Matos
325d3ebb2a backends/x11: Add a synaptics check for two finger scroll availability
Commit "backends/x11: Support synaptics configuration" added support
for synaptics two finger scrolling but didn't add the code to check
that it is available resulting in the upper layer always assuming it
isn't.
2019-02-12 10:43:10 -05:00
Olivier Fourdan
3680d75a76 wayland: enable scale-monitor-framebuffer by default 2019-02-12 10:43:10 -05:00
Carlos Garnacho
c697d2a7a9 clutter: Do not latch modifiers on modifier keys
If the user maps eg. Alt+F2 to a pad button, the MetaInputSettings will
send the full Alt press, F2 press, F2 release, Alt release sequence.
However the keycode corresponding to Alt is found in level 1, so the
Shift modifier gets unintendedly latched in addition to the Alt key
press/release pair.

We could probably improve keycode lookup heuristics so level=0 (and
no modifier latching) is preferred, but we can do without it altogether
for modifier keys.
2019-02-12 10:43:10 -05:00
rpm-build
0a50755fd6 monitor-manager: only reuse initial-config if monitor topology matches startup
Right now we try to apply the current monitor config when a new
monitor is attached.  The current config obviously doesn't include the
new monitor, so the new monitor isn't lit up.

The only reason we apply the current config at all is to handle the
startup case:  We want to reuse the config set in Xorg when first
logging in.

This commit changes the code to look at the *initial config* instead
of the current config, and only if the new monitor topology matches
the start up topology.
2019-02-12 10:43:10 -05:00
Owen W. Taylor
c15c8facfe Add support for quad-buffer stereo
Track the stereo status of windows using the new EXT_stereo_tree
GLX extension.

When stereo is enabled or disabled, a restart is triggered via
meta_restart() after a timeout, setting a _META_ENABLE_STEREO
property on the root window to indicate whether we should
turn on a stereo stage for clutter. The property avoids a loop,
since we need to enable stereo *before* initializing Clutter and GL,
but we need GL to figure out whether we have stereo windows.

Stereo windows are drawn to the stage using new functionality
in Cogl to setup a stereo context, select which buffer to draw
to, and draw either the left or right buffer of a stereo
texture_from_pixmap.
2019-02-12 10:43:10 -05:00
Carlos Garnacho
4c765238ae clutter/x11: Implement keycode lookup from keysyms on virtual key devices
Unfortunately XKeysymToKeycode() falls short in that it coalesces keysyms
into keycodes pertaining to the first level (i.e. lowercase). Add a
ClutterKeymapX11 method (much alike its GdkKeymap counterpart) to look up
all matches for the given keysym.

Two other helper methods have been added so the virtual device can fetch
the current keyboard group, and latch modifiers for key emission. Combining
all this, the virtual device is now able to handle keycodes in further
levels.

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

(cherry picked from commit 85284acb00)
2019-02-12 10:43:10 -05:00
Carlos Garnacho
b4bb859a6a clutter: Extend touchpad device property check for Synaptics
So we reliably get CLUTTER_TOUCHPAD_DEVICE for those. The other heuristics
to get the device type may fall short.
2019-02-12 10:43:10 -05:00
Florian Müllner
9c9551c1bd window-actor: Special-case shaped Java windows
OpenJDK wrongly assumes that shaping a window implies no shadows.
They got lucky until commit b975676c changed the fallback case,
but now their compliance tests are broken. Make them happy again
by special-casing shaped Java windows.
2019-02-12 10:43:10 -05:00
Carlos Garnacho
333d775aba backends/x11: Support synaptics configuration
The code is taken mostly as-is from g-s-d, so we can drag the
dead horse a bit longer.
2019-02-12 10:43:10 -05:00
Florian Müllner
a280a6dbf3 events: Don't move (sloppy) focus while buttons are pressed
(https://bugzilla.redhat.com/show_bug.cgi?id=1358535)
2019-02-12 10:43:10 -05:00
Florian Müllner
f3765bf412 monitor-manager: Consider external layout before default linear config
In case of no existing configuration, we use a default layout of
aligning attached displays horizontally. This sidesteps any layout
configuration that is done externally, for instance via xorg.conf,
which is not desirable. Instead, base the initial configuration on
the existing layout if it passes some sanity checks before falling
back to the default linear config.
2019-02-12 10:43:10 -05:00
Rui Matos
a6f95bc8cd monitor-manager-xrandr: Force an update when resuming from suspend
The stack below us isn't as reliable as we'd like and in some cases
doesn't generate RRScreenChangeNotify events when e.g. resuming a
laptop on a dock, meaning that we'd miss newly attached outputs.
2019-02-12 10:43:10 -05:00
Rui Matos
064788cbc9 monitor-manager-xrandr: Work around spurious hotplugs on Xvnc
Xvnc turns its outputs off/on on every mode set which makes us believe
there was an hotplug when there actually wasn't. Work around this by
requiring new randr configuration timestamps to be ahead of the last
set timestamp by at least 100 ms for us to consider them an actual
hotplug.
2019-02-12 10:43:09 -05:00
Florian Müllner
7aed7293e3 constraints: Enforce X11 size limits
X11 limits windows to a maximum of 32767x32767, enforce that restriction
to keep insanely huge windows from crashing the WM.
2019-02-12 10:43:09 -05:00
Olivier Fourdan
e9d41e0898 window: Really force update monitor on hot plugs
Commit 8d3e05305 ("window: Force update monitor on hot plugs") added the
flag `META_WINDOW_UPDATE_MONITOR_FLAGS_FORCE` passed to
`update_monitor()` from `update_for_monitors_changed()`.

However, `update_for_monitors_changed()` may choose to call another code
path to `move_between_rects()` and `meta_window_move_resize_internal()`
eventually.

As `meta_window_move_resize_internal()` does not use the "force" flag,
we may still end up in case where the window->monitor is left unchanged.

To avoid that problem, add a new `MetaMoveResizeFlags` that
`update_for_monitors_changed()` can use to force the monitor update from
`meta_window_move_resize_internal()`.

Fixes: 8d3e05305 ("window: Force update monitor on hot plugs")
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/189
2019-02-12 10:43:09 -05:00
Ray Strode
bac2a0752b backends/native: explicitly pause on suspend
The kernel forces a VT switch during suspend on some hardware,
and not on others.

We run code from the VT switch handler that we need to also get
run on resume.

This commit makes sure we explicitly run the VT switch handler
during suspend and resume.
2019-02-12 10:43:09 -05:00
Ray Strode
5f1325ed0a MetaShapedTexture: save and restore textures on suspend
The proprietary nvidia driver garbles GPU memory on suspend.

In order to workaround that limitation, this commit copies all
textures to host memory on suspend and restores them on resume.

One complication comes from external textures (such as those
given to us by Xwayland for X clients).  We can't just restore
those textures, since they aren't writable.

This commit addresses that complication by keeping a local texture
around for those external textures, and using it instead for parts
of the window that haven't been redrawn since resume.
2019-02-11 17:45:42 -05:00
Ray Strode
00a06c5538 background: purge all background textures on suspend
This commit makes sure all background textures get purged
on suspend, which is important for nvidia.
2019-02-11 17:45:42 -05:00
Ray Strode
2a2697910a backends/native: update cursor on resume
As mentioned in a previous commit, the proprietary NVIDIA
driver garbles memory on suspend. That behavior, means that
the cursor gets corrupted on suspend.

This commit forces the cursor to redraw itself when the
logind session becomes active (on VT switch and resume).
2019-02-11 17:45:42 -05:00
Ray Strode
e4339aed83 backends/native: update glyph cache on resume
As mentioned in a previous commit, the proprietary NVIDIA
driver garbles memory on suspend. That behavior, means that
clutter's glyph cache (which is stored in GPU memory) gets
corrupted on suspend.

This commit ensures the glyph cache is blown away when
the logind session becomes active (on VT switch and resume).
2019-02-11 17:45:42 -05:00
Ray Strode
4d5869f6e9 backends/native: emit gl-video-memory-purged when becoming active
The proprietary NVIDIA driver garbles memory on suspend.  In order
to work around that limitation, mutter needs to refresh all its
textures on resuem.

This commit lays the way toward doing that by emitting the
"gl-video-memory-purged" signal when the compositor becomes active
by logind (which happens on VT switch and on resume).
2019-02-11 17:45:42 -05:00
Ray Strode
214aced750 wayland: force X clients to redraw on resume
On nvidia, the textures backing Xwayland client window contents get
corrupted on suspend.  Xwayland currently doesn't handle this situation
itself.

For now, in order to work around this issue, send an empty output
change event to Xwayland.  This will cause it to force Expose events
to get sent to all clients and get them to redraw.
2019-02-11 17:45:42 -05:00
Ray Strode
4ac2899576 backend: add signals for reporting suspend and resume
This commit adds "suspending" and "resuming" signals
to MetaBackend.

It's preliminary work needed for tracking when to purge
and recreate all textures (needed by nvidia).
2019-02-11 17:45:42 -05:00
Ray Strode
76c34858d1 backend: switch to using generated logind proxy
Right now we listen to prepare-for-sleep using
raw gdbus calls.

This commit switches it over to use a generated
proxy, which will become useful in a future commit,
for adding suspending inhibitors.
2019-02-11 17:45:42 -05:00
Ray Strode
ea6535c639 cogl: add new UNSTABLE_TEXTURES feature
The proprietary nvidia driver garbles texture memory on suspend.

Before we can address that, we need to be able to detect it.

This commit adds a new UNSTABLE_TEXTURES feature that gets set if
the proprietary nvidia driver is in use.
2019-02-11 13:40:19 -05:00
Jonas Ådahl
18b68e3a84 screen-cast: Fix monitor recording on HiDPI
It scaled the logical monitor rect with scale to get the stream
dimensions, but that is only valid when having
'scale-monitor-framebuffers' enabled. Even when it was, it didn't work
properly, as clutter_stage_capture_into() doesn't work properly with
scaled monitor framebuffers yet.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/415
2019-02-11 13:40:19 -05:00
Olivier Fourdan
3bdfbf97b9 window-actor: Use actual image size for capture
Previously, the clipping rectangle passed to
`meta_surface_actor_get_image()` was updated with the actual texture
size, but recent changes in `meta_shaped_texture_get_image()` now keep
the caller's clipping rectangle unchanged.

The implementation of `meta_window_actor_capture_into()` was relying on
the old behavior of updating the passed clipping rectangle, but now that
it's kept unchanged, the actual clipping rectangle used to copy the data
is wrong, which causes either a distorded image or worse, a crash of
mutter.

Use the resulting cairo image size to copy the data instead of the
clipping rectangle to avoid the issue and get the expected size.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/442
2019-02-11 13:40:19 -05:00
Jonas Ådahl
a7f2145965 screen-cast-monitor-stream-src: Only send cursor bitmap when it changes
To avoid unnecessary pixel copying, only send the cursor bitmap when it
changes. This also allows the receiver to know when the cursor bitmap
actually changed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-02-11 13:40:19 -05:00
Jonas Ådahl
ffa30f50f2 cursor-tracker: Emit cursor-changed after renderer was updated
Otherwise the cursor retrieved via meta_cursor_renderer_get_cursor() is
out of date.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-02-11 13:40:19 -05:00
Jonas Ådahl
0ec335395d screen-cast: Add 'cursor-mode' to allow decoupled cursor updates
The 'cursor-mode', which currently is limited to RecordMonitor(), allows
the user to either do screen casts where the cursor is hidden, embedded
in the framebuffer, or sent as PipeWire stream metadata.

The latter allows the user to get cursor updates sent, including the
cursor sprite, without requiring a stage paint each frame. Currently
this is done by using the cursor sprite texture, and either reading
directly from, or drawing to an offscreen framebuffer which is read from
instead, in case the texture is scaled.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-02-11 13:40:19 -05:00
Jonas Ådahl
46dccd898e cursor-renderer: Add API to allow inhibiting HW cursor
There may be reasons to temporarly inhibit the HW cursor under certain
circumstances. Allow adding such inhibitations by adding API to the
cursor renderer to allow API users to add generic inhibitors with
whatever logic is deemed necessary.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-02-11 13:40:18 -05:00
Jonas Ådahl
fcd55e6f59 screen-cast/monitor-stream-src: Copy content before cursor is drawn
To get a consistent behaviour no matter whether HW cursors are in use or
not, make sure to copy the framebuffer content before the stage overlays
(cursor sprite textures) are painted.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-02-11 13:40:18 -05:00
Jonas Ådahl
c5f0fc1276 backends/stage: Emit signal between painting actors and overlays
Will be used by screen casting for embedding the cursor separately, or
not including at all.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-02-11 13:40:18 -05:00
Jonas Ådahl
7ca0fee437 backends/stage: Fix minor style issue
https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-02-11 13:40:18 -05:00
Jonas Ådahl
1d8384372a renderer: Add API to get view from logical monitor
Will be used to get the view scale for a logical monitor, which is
necessary for passing cursor sprites via PipeWire.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-02-11 13:40:18 -05:00
Jonas Ådahl
851954b7ed screen-cast: Add getters to fetch object owners
MetaBackend owns MetaScreenCast which owns MetaScreenCastSession which
owns MetaScreenCastStream. Make it possible to fetch objects in the
oppositev direction too.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-02-11 13:40:18 -05:00
Jonas Ådahl
fef2ecd1e2 screen-cast-monitor-stream: Don't pass monitor manager when creating
It can be fetched indirectly from the monitor already.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-02-11 13:40:18 -05:00
Jonas Ådahl
c74dc7ce45 clutter/stage: Add clutter_stage_is_redraw_queued() API
This will be used by the screen casting code to check whether it should
wait for a frame before reading cursor state, or send only the cursor
update, if no redraw is queued.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-02-11 13:40:18 -05:00
Jonas Ådahl
63cee05c65 cursor-tracker: Add 'cursor-moved' signal
https://gitlab.gnome.org/GNOME/mutter/merge_requests/357
2019-02-11 13:40:18 -05:00
Jonas Ådahl
6628d12f3c renderer/native: Make the EGLStreams operate in mailbox mode
This means eglSwapBuffers() wont dead lock if there is an old buffer pending
page flip. This could happen after e.g. mode changes or for other reasons.
2019-02-11 13:40:18 -05:00
Jonas Ådahl
3e8364d11d renderer/native: Make EGLStream page flip errors non-fatal
Just continue rendering; we don't care if we were busy once, as it'll most
likely work when we flip the next time.
2019-02-11 13:40:18 -05:00
Jonas Ådahl
58c2c2c444 shaped-texture: Draw external textures via offscreen
EGLStream textures are imported as GL_TEXTURE_EXTERNAL_OES and reading
pixels directly from them is not supported. To make it possible to get
pixels, create an offscreen framebuffer and paint the actor to it, then
read pixels from the framebuffer instead of the texture directly.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/362
2019-02-11 13:40:18 -05:00
Jonas Ådahl
1fe3adcd95 shaped-texture: Don't change the callers clip rect
We intersected the callers clip rect. That is probably not a good idea,
and easily avoided, so lets avoid it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/362
2019-02-11 13:40:18 -05:00