1
0
Fork 0
Commit graph

5427 commits

Author SHA1 Message Date
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
5d837a5c85 wayland: Support sending wl_surface.enter/leave to cursor surfaces
Support notifying clients about what outputs their cursor surfaces are
on so that they can attach appropriately scaled buffers to them.

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
7c7cf91c32 wayland: Move cursor surface role to meta-wayland-pointer.c
The wl_pointer assigns a role to a wl_surface, so it makes sense to put
the related logic there.

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
Jonas Ådahl
83c17134f1 wayland: GObject:ify surface roles
Make a surface roles into objects with vfuncs for things where there
before was a big switch statement. The declaration and definition
boilerplate is hidden behind C macros.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:24:58 +08:00
Jonas Ådahl
8e5fb03611 MetaWaylandSurface: Don't respond to frame callback when role unassigned
If a surface doesn't have a role, the compositor will not know how, if
or when it will be painted. By adding it to the compositor frame
callback list, the compositor will respond to the client that the
surface has been drawn already which might not be true.

Instead, queue the frame callback in a list that is then processed when
the surface gets a role assigned. The compositor may then, given the
role the surface got, queue the frame callback accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:24:58 +08:00
Jonas Ådahl
dece49b53d wayland: Introduce XWayland surface role
Being a "XWayland window" should be considered equivalent to a role,
even though it is not part of any protocol anywhere. The commit doesn't
have any functional difference, but just makes it clear that an
wl_surface managed by XWayland have the same type of special casing as
surface roles as defined by the Wayland protocol.

As the semantics are more explicit given the role is defined, a comment
explaining why the semantics need to be how they are was added.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:24:58 +08:00
Olivier Fourdan
443d579d40 wayland: do not crash if the surface is gone
If a queued event is being processed after the surface is
destroyed, trying to access the window associated with the surface
will lead to a segmentation fault.

This patch avoids the crash by first checking if the surface is not null.

https://bugzilla.gnome.org/show_bug.cgi?id=754715
2015-09-09 09:30:14 +02: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
Javier Jardón
6ea7fa9973 xwayland: Add missing include
https://bugzilla.gnome.org/show_bug.cgi?id=754621
2015-09-07 14:13:48 +01: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
Jonas Ådahl
94513726de wayland: Clean up surface role assignment
Use a better name, use GNOME conventions for error handling, open code the
client error reporting and send the error to the correct resource.
wl_subcompositor doesn't have a role error yet, so continue use some
other error. The only effect of this is error received in the client will
be a bit confusing, it will still be disconnected.

https://bugzilla.gnome.org/show_bug.cgi?id=754215
2015-09-07 17:41:14 +08:00
Ting-Wei Lan
0aa4c4d43e build: Fix return value in meta-background.c
https://bugzilla.gnome.org/show_bug.cgi?id=754545
2015-09-04 11:47:34 +08:00
Owen W. Taylor
e3db4ab16a Avoid declaring variables in for loop to avoid upsetting older GCC
Older GCC only allows "for (int i" in explicit c99 mode - there's probably
no reason that we can't enable that, but avoiding the construct for
a fast fix.
2015-09-03 16:13:50 -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
Ray Strode
1d56d50fcd background: paint color matte for scaled and centered backgrounds
Some backgrounds don't fully fill the screen.  For those backgrounds
it's important to paint a color behind them to fill in the gaps.

This commit checks whether or not the background image textures take
up the entire monitor, and in the event they don't, draws a color
behind them (such as it would do if the background were
translucent).

https://bugzilla.gnome.org/show_bug.cgi?id=754476
2015-09-03 15:14:15 -04:00
Ray Strode
0ffd4254d9 background: simplify conditional in meta_background_get_texture
meta_background_get_texture only draws the bottom image texture
if
   1) the blend factor leaves the top image translucent
   or
   2) the top image is translucent from alpha

The latter case doesn't actually matter since we're using REPLACE
on the top image texture.

This commit drops the unnecessary check for the second case and
applies demorgans law to the conditional for clarity.

https://bugzilla.gnome.org/show_bug.cgi?id=754476
2015-09-03 15:14:15 -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
68279e8a08 MetaWaylandPointer: Don't keep our own MetaCursorTracker pointer
There is no reason to, we can just retrieve it every time we need it.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-08-28 09:52:30 +08:00
Jonas Ådahl
cd1ce2cb0a MetaWaylandSurface: Make it a GObject
This way we can add signals and weak references without relying on
wl_signal, wl_listener etc.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-08-28 09:52:30 +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
e76c3ecb00 wayland/pointer-gestures: Send error on protocol version mismatch
When a client binds an incompatible version, we should terminate it.
This check should only be there for the unstable version, as once it is
declared stable and renamed, future versions will be backward compatible.

https://bugzilla.gnome.org/show_bug.cgi?id=753855
2015-08-22 00:04:33 +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
Jasper St. Pierre
a5417ebee1 cursor: Move check for cursor NULL-ness
Before, it used to be in the screen, but now,
meta_cursor_reference_from_theme can never fail. Move it to where we
load the images from the cursor name.
2015-08-18 13:59:29 -07:00
Carlos Garnacho
b64b159109 wayland: Avoid warning when switching out into another vt
meta_wayland_pointer_get_client_pointer() may be called when the
MetaWaylandPointer as been already shut down, so the hash table will be
NULL at that moment.
2015-08-14 14:48:43 +02:00
Carlos Garnacho
804ab7894f wayland: Use wl_resource_for_each_safe() on pointer client destruction
We must use this by definition since we're removing all elements from the
resource lists.
2015-08-14 14:46:27 +02:00
Rui Matos
299ed424d3 compositor: Handle fences in the frontend X connection
Since mutter has two X connections and does damage handling on the
frontend while fence triggering is done on the backend, we have a race
between XDamageSubtract() and XSyncFenceTrigger() causing missed
redraws in the GL_EXT_X11_sync_object path.

If the fence trigger gets processed first by the server, any client
drawing that happens between that and the damage subtract being
processed and is completely contained in the last damage event box
that mutter got, won't be included in the current frame nor will it
cause a new damage event.

A simple fix for this would be XSync()ing on the frontend connection
after doing all the damage subtracts but that would add a round trip
on every frame again which defeats the asynchronous design of X
fences.

Instead, if we move fence handling to the frontend we automatically
get the right ordering between damage subtracts and fence triggers.

https://bugzilla.gnome.org/show_bug.cgi?id=728464
2015-08-13 14:14:46 +02:00
Carlos Garnacho
55692b4019 wayland: Implement wl_pointer_gestures
The global wl_pointer_gestures object is now created, effectively
bridging pinch/swipe gestures with clients, so they're now
accessible to clients implementing the protocol.
2015-08-10 17:30:12 +02:00
Carlos Garnacho
2fafa24305 wayland: Implement the wl_pointer_gesture_pinch interface
The pinch gesture resources are part of the MetaWaylandPointerClient, which
will be used during the propagation of CLUTTER_TOUCHPAD_PINCH events.
2015-08-10 17:23:23 +02:00
Carlos Garnacho
51a2f28723 wayland: Implement the wl_pointer_gesture_swipe interface
The swipe gesture resources are part of the MetaWaylandPointerClient, which
will be used during the emission of CLUTTER_TOUCHPAD_SWIPE events.
2015-08-10 17:23:23 +02:00
Carlos Garnacho
e11feb229b wayland: Add gestures protocol XML 2015-08-10 17:23:23 +02:00
Jonas Ådahl
1ee387bb31 MetaWaylandPointer: Put client resources in its own struct
Instead of moving around all the bound pointer resources for a client
when changing focus, keep all the resources bound by a client in a per
client struct, and track the focus by having a pointer to the current
active pointer client struct instance.

This will simplify having wl_pointer extensinos sharing the pointer
focus of the wl_pointer by only having to add them to the pointer
client.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2015-08-10 17:23:23 +02:00
Florian Müllner
cba2ab445e backend-x11: Don't assert on something that might happen
While we shouldn't normally receive crossing events for any windows
except the stage when running nested, we do in case we hold a pointer
grab - just ignore those events instead of taking down the user's
session.
2015-08-10 17:00:57 +02:00
Adel Gadllah
038f828ab1 SurfaceActorWayland: Destroy frame callbacks when the surface gets destroyed
https://bugzilla.gnome.org/show_bug.cgi?id=739163
2015-08-09 19:25:46 +02:00
Adel Gadllah
4dc5882777 wayland: Add frame callbacks to the actor based on the role
Checking for the presense of the actor is wrong because we always
create one.

https://bugzilla.gnome.org/show_bug.cgi?id=739163
2015-08-09 19:25:46 +02:00
Ting-Wei Lan
b0b08d5010 build: Fix return value in meta-sync-ring.c
https://bugzilla.gnome.org/show_bug.cgi?id=753380
2015-08-09 17:49:57 +08:00
Adel Gadllah
070cd27786 wayland: Only call frame callbacks when a surface gets drawn on screen
The spec says:
"A server should avoid signalling the frame callbacks if the surface is not
visible in any way, e.g. the surface is off-screen, or completely obscured
by other opaque surfaces."

We actually do have the information to do that but we are always calling
the frame callbacks in after_stage_paint. So fix that to only call when
when the surface gets drawn on screen.

https://bugzilla.gnome.org/show_bug.cgi?id=739163
2015-08-09 10:40:40 +02:00
Aaron Plattner
9df6cda3e3 compositor: Fix GL_EXT_x11_sync_object race condition
The compositor maintains a ring of shared fences with the X server in order to
properly synchronize rendering between the X server and the compositor's GPU
channel.  When all of the fences have been used, the compositor needs to reset
one so that it can be reused.  It does this by first waiting on the CPU for the
fence to become triggered, and then sending a request to the X server to reset
the fence.

If the compositor's GPU channel is busy processing other work (e.g. the desktop
switcher animation), then the X server may process the reset request before the
GPU has consumed the fence.  This causes the GPU channel to hang.

Fix the problem by having the compositor's GPU channel trigger its own fence
after waiting for the X server's fence.  Wait for that fence on the CPU before
sending the reset request to the X server.  This ensures that the GPU has
consumed the X11 fence before the server resets it.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>

https://bugzilla.gnome.org/show_bug.cgi?id=728464
2015-08-07 17:27:42 +02:00
Rui Matos
39763d4add compositor: Add support for GL_EXT_x11_sync_object
If GL advertises this extension we'll use it to synchronize X with GL
rendering instead of relying on the XSync() behavior with open source
drivers.

Some driver bugs were uncovered while working on this so if we have
had to reboot the ring a few times, something is probably wrong and
we're likely to just make things worse by continuing to try.  Let's
err on the side of caution, disable ourselves and fallback to the
XSync() path in the compositor.

https://bugzilla.gnome.org/show_bug.cgi?id=728464
2015-08-07 17:27:42 +02:00
Jasper St. Pierre
352cac3850 group: Convert code to XCB to prevent errors
Windows can disappear at any time because X11 is really cool and good,
so just use XCB so we won't crash if the window disappears.
2015-08-05 13:39:23 -07:00
Rui Matos
9c745105f8 wayland-surface: Send out an error for a popup with an invalid parent
Instead of silently failing without the client noticing.

https://bugzilla.gnome.org/show_bug.cgi?id=753237
2015-08-05 13:50:09 +02:00
Rui Matos
ab9dabe725 wayland-surface: Don't crash if clients commit to a done popup
If we can't put up a popup because grabbing the pointer fails we
immediately dismiss the popup but the client might have made requests
already, in particular it might have commited the surface and in that
case we should ignore it.

https://bugzilla.gnome.org/show_bug.cgi?id=753237
2015-08-05 13:50:09 +02:00
Jonas Ådahl
7ce06928e2 native: Actually close input device fds
Don't only release it, also close the fd so that we don't leak it.

https://bugzilla.gnome.org/show_bug.cgi?id=752753
2015-08-05 10:28:15 +08:00
Jonas Ådahl
ac79988939 wayland: Handle unsetting of input and opaque surface region
When a client sets an input region or a opaque region to NULL, it
should still be considered a change to the corresponding region on the
actor. This patch makes sure this state is properly forwarded.

https://bugzilla.gnome.org/show_bug.cgi?id=753222
2015-08-05 10:22:49 +08:00
Rui Matos
07f533f617 window: Remove fullscreen_after_placement special case
This was introduced in commit c6793d477a
to prevent window self-maximisation. It turns out that that bug seems
to have been fixed meanwhile in a different way since the reproducer
in https://bugzilla.gnome.org/show_bug.cgi?id=461927#c37 now works
fine with this special handling removed.

In fact, failing to set window->fullscreen immediately when loading
the initial set of X properties causes us to create a UI frame for a
window that sets _NET_WM_STATE_FULLSCREEN.

This, in turn, might cause the fullscreen constrain code to fail if
the window also sets min_width/min_height size hints to be the monitor
size since the UI frame size added to those makes the rectangle too
big to fit the monitor. If the window doesn't set these hints, we
fullscreen it but the window will get sized such that the UI frame is
taken into account while it really shouldn't (see the reproducer
above).

https://bugzilla.gnome.org/show_bug.cgi?id=753020
2015-07-30 15:27:01 +02:00
Florian Müllner
b41873dced window-x11: Remove duplicated code
meta_window_change_workspace_without_transients() already does
exactly that.
2015-07-23 12:13:45 +02:00
Florian Müllner
0a9511b24b window: Remove duplicated code
meta_window_change_workspace_without_transients() already does
exactly that.
2015-07-23 12:13:45 +02:00
Florian Müllner
17438ced91 core: Remove meta_core_get_frame_workspace() declaration
The definition was removed long ago in commit ff33209e1f ...
2015-07-23 12:13:45 +02:00
Florian Müllner
27c7512e4d core: Remove meta_core_change_workspace()
Unused since commit bf64e719a1 (2001!) ...
2015-07-23 12:13:45 +02:00
Florian Müllner
124888764d default-plugin: Replace deprecated macro 2015-07-22 16:01:13 +02:00
Rui Matos
7e1c6ff2a2 screen: On monitors-changed, update the window monitor before resizing
Since commit 14b0a83f64 we store the
main window monitor instead of computing it every time. This means
that we must now ensure that it's updated before trying to use it
which we do from meta_screen_resize_func() or else we'll crash on an
assertion later on when removing a monitor:

assertion failed: (which_monitor < workspace->screen->n_monitor_infos)

https://bugzilla.gnome.org/show_bug.cgi?id=752674
2015-07-21 16:46:09 +02:00
Rui Matos
2fb8da0d5a backends/monitor-manager: Validate EDID strings
Some monitors return a bunch of bytes on their display descriptor
which aren't valid utf8 and thus we fail to serialize them later on
for the DisplayConfig DBus API.

Let's fall back to the stringified product code and serial number in
that case.

https://bugzilla.gnome.org/show_bug.cgi?id=752673
2015-07-21 16:42:53 +02:00
Matthias Clasen
ad51c52b69 feedback actor: Fix a typo
The code for setting an anchor was comparing apples and oranges.
This was pointed out by coverity.

https://bugzilla.gnome.org/show_bug.cgi?id=752552
2015-07-20 17:39:09 -04:00
Matthias Clasen
1b22da0039 Monitor-config: Fix a copy-paste error
The code was checking width twice, instead of width and height,
as was clearly the intention. Coverity pointed this out.

https://bugzilla.gnome.org/show_bug.cgi?id=752551
2015-07-20 17:33:28 -04:00
Carlos Garnacho
8329e97502 backends: Trigger animated cursor animations on the native backend
We will need to update the timeout on either cursor changes, or
right when ticking to the next cursor frame.

https://bugzilla.gnome.org/show_bug.cgi?id=752342
2015-07-20 22:06:44 +02:00
Carlos Garnacho
74ca936a00 backend: Add meta_cursor_renderer_force_update()
There will be times where additional updates will be needed, such
as animated cursors. We should update the texture and redraw in
that case.

https://bugzilla.gnome.org/show_bug.cgi?id=752342
2015-07-20 22:06:44 +02:00
Carlos Garnacho
141760057b backend: Store XcursorImages for theme cursors
There's a chance the icon will be animated, so store the XcursorImages
instead of the individual XcursorImage, and handle that as a nimages=1
special case.

API to "tick" a cursor animation, and retrieve current frame timing
information has been added.

https://bugzilla.gnome.org/show_bug.cgi?id=752342
2015-07-20 22:06:44 +02:00
Carlos Garnacho
e648f2c244 events: Ensure touchpad gesture events go through clutter
They otherwise fall through paths that enable bypass_clutter, this
is necessary so they can be picked by captured-event handlers
along the actor hierarchy.

https://bugzilla.gnome.org/show_bug.cgi?id=752248
2015-07-20 22:01:05 +02:00
Jonas Ådahl
f01247d815 wayland: Fix calculation of window geometry when scaled
Take the surface actor scale into account when calculating the window
geometry.

https://bugzilla.gnome.org/show_bug.cgi?id=744934
2015-07-16 11:54:14 +08:00
Jonas Ådahl
db6caa2c49 wayland: Take scale into account when placing windows relatively
When placing a popup and the legacy transient wl_shell_surface surfaces,
take the current scale of the window into account. This commit doesn't
fix relative positioning in case a window scale would change, but since
the use case for relative positioning is mostly popups, which would be
dismissed before the parent window would be moved, it should not be that
much of a problem.

https://bugzilla.gnome.org/show_bug.cgi?id=744934
2015-07-16 11:54:14 +08:00
Jonas Ådahl
fbd237bc66 MetaWaylandSurface: Return top most toplevel window for popups
Make meta_wayland_surface_get_toplevel_window return the top most window
in case its a chain of popups. This is to make all popups in a chain
including the top most surface have the same scale.

The reason for this is that popups are mostly integrated part of the
user interface of its parent (such as menus). Having them in a different
scale would look awkward.

Note that this doesn't affect non-popup windows with parent-child
relationship, because such windows are typically not an integral part of
the user interface (settings window, dialogs, ..) and can typically be
moved independently. It would probably make sense to make attached modal
dialogs have the same scale as their parent windows, but modal dialogs
are currently not supported for Wayland clients.

https://bugzilla.gnome.org/show_bug.cgi?id=744934
2015-07-16 11:54:14 +08:00
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
Jasper St. Pierre
4d3419607a window: Don't reference a dead function
meta_window_move_resize has been gone for a while now.
2015-07-06 00:52:49 -07:00
Jasper St. Pierre
1545d4e638 Put G_GNUC_CONST at the end of the declarations
These attributes go at the end, not the beginning.
2015-07-06 00:29:23 -07:00
Jasper St. Pierre
a191554cf6 compositor: Export meta_shadow_factory_get_shadow to introspection
I forgot we had a separate list of headers for introspection to scan.
2015-07-06 00:27:03 -07:00
Jasper St. Pierre
b33a82eb7c Export the shadow factory
The elementary guys would like this as an API, and I don't see any
reason to refuse -- this is quite nice shadow painting code :)

For some reason, gobject-introspection can't seem to cope with
MetaWindowShape. I'll look into it a bit later, but for now, mark
the function it has trouble with as (skip).
2015-07-06 00:14:22 -07:00
Jasper St. Pierre
2705c87f74 window-group: Fix issues when translated
It seems that when translated, paint_offset and actor_offset will always
be the same, so our translation of the clip group won't work. For now,
until I figure out what's going on here, just use the painting offset,
since that what seems to make sense to me.

I didn't write this code, though, so I don't know why the actor's
allocation was involved in this computation at all.

I tested briefly with clones (magnifier, manual cloning through the
looking glass) and couldn't find any other artifacts, so I'm going to do
this for now.
2015-07-05 23:55:43 -07:00
Jasper St. Pierre
9fc1c919e8 window-actor: Replace no-shadow with a shadow-mode
The elementary guys want to be able to force shadows *on*, for use in
their overview.
2015-07-05 23:29:11 -07:00
Jasper St. Pierre
9f04c58ffe Implement a generic "size change" mechanism
A much less hacky version of maximize / unmaximize is reimplemented
in terms of this, but it could also eventually be used for fullscreen /
unfullscreen, and tile / untile.
2015-07-05 23:03:36 -07:00
Jasper St. Pierre
7de1f3a7be plugin-manager: Make the event an enum 2015-07-05 22:01:59 -07:00
Jasper St. Pierre
fd443ecf2a plugin-manager: Clean up an unused define 2015-07-05 22:01:59 -07:00
Jasper St. Pierre
8979e52a6c Install enum types 2015-07-05 22:01:59 -07:00
Jasper St. Pierre
e8dd5601e7 window-group: Turn clipped redraws back on
Whoops -- I commented this out for debugging reasons.
2015-07-05 19:19:33 -07:00
Jasper St. Pierre
ccca810daf window-group: Improve performance by hacking around Clutter
The comment explains it better, but Clutter tries to be smart and
repaint actors when their allocations change. Since the window group's
allocation changes when windows move around, this means that moving a
window will always cause a full-stage repaint, which is super slow.

Hack around this for now.
2015-07-05 19:18:22 -07:00
Jasper St. Pierre
693456b644 shaped-texture: Remove unnecessary copies of the pipeline 2015-07-05 15:01:15 -07:00
Jasper St. Pierre
aacc3d5628 shaped-texture: Repeat edge pixels instead of mirroring the image
While nothing will completely fix X11's artifacts, this tends to look a
bit better, *especially* with mask textures that have black at the
edges (which are most of them).

It's also faster for GPUs to manage.
2015-07-05 15:00:38 -07:00
Jasper St. Pierre
1ea8efdeda stack: Don't prefer windows in the same group as not_this_one
The only time we ever execute this code is when we're minimizing or
hiding a window, in which case we should respect stacking order.

This fixes weird "bugs" where windows from the same app magically pop up
over other windows.
2015-07-05 14:33:08 -07:00
Jasper St. Pierre
a3fbbaabe8 delete: Remove old code
It doesn't compile
2015-07-05 14:29:56 -07:00