1
0
Fork 0
Commit graph

269 commits

Author SHA1 Message Date
Carlos Garnacho
d3988c04d6 wayland: Destroy pending frame callbacks when destroying a surface
MetaWaylandFrameCallback has been added a surface field, which is then
checked when destroying the surfaces. This prevents unintended callbacks
to run after a surface has been destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=745163
2015-03-05 17:07:32 +01:00
Jonas Ådahl
adf7c0e730 wayland: Fix surface damage region scales
Use the correct scale when processing damage from the client.

https://bugzilla.gnome.org/show_bug.cgi?id=744933
2015-03-03 14:53:15 -05:00
Jonas Ådahl
bbcee174ce wayland: Make the surface actor set its own state
Since the surface actor knows more about how it draws itself, instead of
pushing texture state (buffer and scale), input region and opaque region
from MetaWaylandSurface after having transformed into what the surface
actor expects, make the surface actor set its own state given what state
the Wayland surface is in.

https://bugzilla.gnome.org/show_bug.cgi?id=744933
2015-03-03 14:53:15 -05:00
Rui Matos
438410c22c window-wayland: Set transient and window type on manage() for popups
Doing this on manage() allows the common MetaWindow initialization to
do the right thing for popups like setting skip_taskbar and
skip_pager.

In particular this avoids gnome-shell's app tracker to create a new
ShellApp instance for every popup.

https://bugzilla.gnome.org/show_bug.cgi?id=745118
2015-02-25 18:25:42 +01:00
Rui Matos
59f348eb11 wayland-surface: Keep a reference to a popup's parent surface
This will allows us to access the parent while constructing the
MetaWindow.

https://bugzilla.gnome.org/show_bug.cgi?id=745118
2015-02-25 18:25:42 +01:00
Jonas Ådahl
9a99a80710 wayland: Fail clients who try to create or destroy a not-top-most popup
If a client creates an xdg_popup given a parent that is a xdg_popup that
is not the most top one in the grab chain, send the
not_the_topmost_popup error.

Also fail a client who destroys a popup that is not the top most one.

https://bugzilla.gnome.org/show_bug.cgi?id=744452
2015-02-17 22:14:47 +08:00
Jonas Ådahl
be77874ec9 wayland: Unmap popup windows when a popup chain is dismissed
When dismissing a popup grab, always unmap every popup window in the
chain, instead of relying on the surfaces and xdg_popups being
destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=744452
2015-02-17 22:14:47 +08:00
Jonas Ådahl
768286bffb wayland: Move out popup logic to its own file
We'll want to expose popup logic outside of meta-wayland-pointer.c and
one day we'll also probably want to add touch support for popups, so
lets move it to its own file. There are no significant semantical
changes, only refactoring.

https://bugzilla.gnome.org/show_bug.cgi?id=744452
2015-02-17 22:14:47 +08:00
Jonas Ådahl
f5c65d9ea1 wayland: Check the serial when creating popups
Send popup_done immediately if the serial is incorrect so the client can
destroy its resources.

https://bugzilla.gnome.org/show_bug.cgi?id=744452
2015-02-17 22:14:47 +08:00
Jonas Ådahl
f328890ed1 wayland: Fail when popup parent does not have an allowed role
An xdg_popup may only have another xdg_popup or xdg_surface as a parent,
so send an error if it provides an invalid parent.

https://bugzilla.gnome.org/show_bug.cgi?id=744452
2015-02-17 22:14:47 +08:00
Jonas Ådahl
945bf626c6 wayland: Introduce MetaWaylandSurfaceRole
Introduce surface roles and use it to ensure a surface never changes
role.

https://bugzilla.gnome.org/show_bug.cgi?id=744452
2015-02-17 22:14:47 +08:00
Jonas Ådahl
f6869bbbc2 wayland: Update to xdg-shell unstable version 5
Updates the function type signatures and version number. The rest will
come as separate commits.

https://bugzilla.gnome.org/show_bug.cgi?id=744452
2015-02-17 22:14:47 +08:00
Jonas Ådahl
4d23e7c202 wayland: Fix caching of surface state
The commit 97a69cee5a broke the caching of
the surface state when because the frame_callback_list target state was
overwritten after the content had been moved to it.

This commit fixes it by moving the frame list addition after the copy. We
also need to initialize the list since the plain copy put garbage in it.

https://bugzilla.gnome.org/show_bug.cgi?id=743678
2015-01-29 15:48:46 +08:00
Adel Gadllah
718a89eb2f meta-wayland-surface: Correcly scale the input region
The input region currently only gets scaled by the surface
scale while ignoring the output scale, which causes input events to not get
delivered correctly for clients on hidpi screens. So take the output scale
into account when doing so.

https://bugzilla.gnome.org/show_bug.cgi?id=739161
2014-10-27 18:11:53 +01:00
Adel Gadllah
a43ca7b5b1 Revert "wayland-surface: Apply the surface scale only if needed"
This commit is wrong, it assumes that the scale only applies to the one
set by the client but its not. meta_surface_actor_wayland_scale_texture
also handles the output scale. Revert the commit to fix hidpi for wayland
clients like weston-terminal.

This reverts commit 0364ea9140.

https://bugzilla.gnome.org/show_bug.cgi?id=739161
2014-10-27 18:11:53 +01:00
Jasper St. Pierre
9f5c38d121 wayland: Make the MetaWaylandRegion type opaque 2014-10-07 20:44:19 -07:00
Jasper St. Pierre
ead0e902ed wayland: Move MetaWaylandRegion into a new file as well 2014-10-07 20:44:18 -07:00
Jasper St. Pierre
3044cfb7bf wayland-surface: Clean up includes 2014-10-07 20:42:27 -07:00
Jasper St. Pierre
f658740043 wayland: Move some buffer manipulation functions to meta-wayland-buffer 2014-10-07 20:42:27 -07:00
Jasper St. Pierre
c1613a16c0 wayland: Put the MetaWaylandBuffer implementation in a new file 2014-10-07 20:42:27 -07:00
Jasper St. Pierre
f127ee3bde wayland-surface: Fix a build coming from a bad rebase 2014-10-07 12:09:52 -07:00
Jasper St. Pierre
acd928044f wayland-surface: Remove MetaWaylandSurfaceExtension
It only contained a pointer to a wl_resource, which isn't much of
value. Just replace it with the wl_resource instead. Any future private
data should be handled by our future role system.
2014-10-07 11:23:45 -07:00
Jasper St. Pierre
4ef2f2ce09 wayland-surface: Remove create_surface_extension and friends
This function has a lot of parameters, and doesn't do much in the way of
boilerplate. It's a lot simpler to hand-code.
2014-10-07 11:23:45 -07:00
Jasper St. Pierre
bc81736e6b wayland-surface: Rename the subsurface extension to wl_subsurface
To match the interface name.
2014-10-07 11:23:45 -07:00
Jasper St. Pierre
97705d3cfe wayland-surface: Move wl_surface.frame above role-specific stuff
The role-specific stuff will soon be part of a set_role callback set on
the surface itself.
2014-10-07 11:23:44 -07:00
Jasper St. Pierre
0364ea9140 wayland-surface: Apply the surface scale only if needed
There's no need to call scale_texture on every commit.
2014-10-07 11:23:31 -07:00
Carlos Garnacho
9c589b6798 wayland: Ensure drag surface offset changes update the DnD actor 2014-10-06 19:39:43 -07:00
Jasper St. Pierre
c061e26da5 wayland: Record the offset position
This is needed for DND surfaces. We should probably test to see if it's
used for cursor surfaces at all.
2014-10-06 19:39:42 -07:00
Jasper St. Pierre
082cc9c83a wayland: Immediately give keyboard focus to Wayland popups 2014-10-06 17:05:23 -07:00
Jasper St. Pierre
6565bca210 wayland: Send accurate capabilities
mutter now knows whether the app menu should be shown, so expose this
properly under Wayland as well.
2014-09-24 15:42:17 -06:00
Jasper St. Pierre
1de740955f wayland: Don't leak the existing texture if we already have one
We were missing a check in ensure_buffer_texture that checked if we
already had a CoglTexture bound for the buffer.
2014-09-16 12:12:21 -06:00
Jasper St. Pierre
1ed607f398 wayland-surface: Make bad xdg-shell versions crash the client
Otherwise, we might continue with weird semantics.
2014-09-05 16:21:43 -07:00
Carlos Garnacho
e822e51752 surface: Don't calculate geometry for buffer-less subsurfaces
A wl_surface may have a wl_subsurface interface, but no buffers attached
yet, even though the geometry calculation code for surfaces/subsurfaces
assumes everything has already a buffer.

Just skip subsurfaces that don't have a buffer, those can't be set
a geometry yet, and right now it's crashing accessing the texture from
the NULL surface->buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=735452
2014-08-26 16:58:59 +02:00
Jasper St. Pierre
31f5a916f4 wayland: Tie XDG surfaces together with the Shell that created them
This means that we don't leak when a client binds an XdgShell for a
client more than once, and we send pings/pongs to the correct shell
interface.
2014-08-22 12:52:21 -04:00
Jasper St. Pierre
dc0437a5b5 surface-actor-wayland: Pass in a CoglTexture, as well
This makes it so that MetaSurfaceActorWayland is effectively just a
wrapper actor around MetaShapedTexture with some extra scaling. I think
the MetaSurfaceActor subclassing was a bad idea -- we really should have
these abstractions in much higher levels in the stack than the
compositor.
2014-08-21 16:34:29 -04:00
Jasper St. Pierre
f5580f61f9 wayland: Update the CoglTexture in the MetaWaylandSurface
It doesn't make sense to update it in the surface actor. It's also
theoretically wrong to update the buffer's texture on surface commit,
too, because it's buffer state, not surface state, but I don't think
there's any place we use a wl_buffer without a wl_surface.
2014-08-21 16:22:53 -04:00
Jasper St. Pierre
517e8f6fbd common: Create a better encoding for MetaGrabOp
MetaGrabOp is painful and tedious to work with, because it's a
sequential series of values, meaning we have to use a giant unreadable
switch statement to figure out some basic things about the value.

To solve this, modify the encoding for MetaGrabOp and for the specific
window grab operations so that they're a set of bitflags that we can
easily check.
2014-08-15 16:08:49 -04:00
Jasper St. Pierre
c3950699bf wayland: Don't assert fail when dealing with popup windows 2014-08-13 18:09:55 -04:00
Jasper St. Pierre
63c627ec18 wayland: Add a few statics we forgot before 2014-08-04 10:28:44 -04:00
Jasper St. Pierre
75b6e917ad wayland: Simplify global version management
libwayland-server already checks the bounds of the bind for versioning,
meaning that the value that we pass to wl_global_create is all we need.
2014-08-04 10:25:23 -04:00
Jasper St. Pierre
ab53c0e943 wayland: Simplify slave version management
Slave objects should always be the same version as their parent
constructor, except for the generic wl_registry.bind.
2014-08-04 10:25:20 -04:00
Jasper St. Pierre
6c624e1c26 window-wayland: Update the buffer rect size immediately 2014-07-28 11:30:15 +02:00
Jasper St. Pierre
8fdd226b8b wayland-surface: Fix coordinates for xdg_surface.show_window_menu 2014-07-28 10:22:50 +02:00
Jasper St. Pierre
57037a45b8 wayland-surface: Don't do pending move/resizes on all commits
We assume in meta_window_wayland_move_resize that the next commit that
changes the geometry will always be for our next pending operation, so
if we have a move pending on a resize, the next commit will trigger the
move. This is, of course, fundamentally wrong.

We broke this assumption even more now that we don't fizzle out calls to
meta_window_move_resize_internal and now call it on every commit, which
means that a simple damage and then commit would complete a pending
move.

This was even broken by apps like weston-terminal, which, when clicking
on the maximize button, first redraws the terminal with the maximize
button state back on hover on press, and would only redraw when it got
the configure event with the coordinates.

To track the correct commit to apply the move for, we implement the
ack_configure request and ignore all move/resizes that happen before
that.

Right now, we actually fizzle out the entire move/resize if there's a
future pending configure we're waiting on.
2014-07-27 18:09:12 +02:00
Jasper St. Pierre
b60e02956d wayland-surface: Add some extra protection
Make sure we're not configuring some sort of weird surface.
2014-07-27 18:09:12 +02:00
Jasper St. Pierre
817995d97f wayland-surface: Make sure to zero out the geometry
Otherwise our implicit surface geometry calculation will be junk.
2014-07-27 15:23:00 +02:00
Carlos Garnacho
930361b988 wayland: Handle window drags for touch events
The grabbing state is now checked for both pointer/touch devices
within the seat, and the grab start coordinates returned by
meta_wayland_seat_get_grab_info().

https://bugzilla.gnome.org/show_bug.cgi?id=733631
2014-07-24 18:05:56 +02:00
Jasper St. Pierre
c9a2a561f8 wayland: Use a named #define for the xdg-shell version 2014-07-17 17:48:30 -04:00
Jasper St. Pierre
ac0b2fdc6f wayland: Use our named #define for the wl_shell version 2014-07-17 17:47:14 -04:00
Jasper St. Pierre
46b9984414 wayland: Don't leak an extra xdg_shell resource
No idea how this happened...
2014-07-17 17:47:10 -04:00
Jasper St. Pierre
f9743e2174 wayland: Fix indentation 2014-07-17 17:39:43 -04:00
Jasper St. Pierre
692eb4d957 wayland: Replace set_margin with set_window_geometry 2014-07-17 16:45:37 -04:00
Jasper St. Pierre
826751429b wayland: Treat the size in the configure event as frame rect coordinates 2014-07-17 16:45:37 -04:00
Jasper St. Pierre
b5f46c9171 wayland: Calculate the window geometry based on all subsurfaces
Not just the main surface.
2014-07-17 16:20:19 -04:00
Jasper St. Pierre
166b8c042c wayland: Don't fizzle out attaches 2014-07-17 16:18:01 -04:00
Jasper St. Pierre
90d7737fc1 wayland: Don't require a new buffer to move windows with dx/dy
This doesn't match what Weston does. I don't know of any apps that this
fixes (we don't have any apps that even use non-zero dx/dy, I don't
think), but this is part of a cleanup for window geometry.
2014-07-17 14:51:23 -04:00
Jasper St. Pierre
567ca15610 xdg-shell: Update to latest 2014-07-17 14:51:12 -04:00
Jasper St. Pierre
7159d3bc35 window: Remove the concept of surface_mapped
The implementation was just wrong. We now consider it an error to attach
a NULL buffer to an xdg_surface. Users should destroy the surface properly.
2014-07-14 14:49:58 -04:00
Jasper St. Pierre
12d0c98fb5 wayland: Remove an unused field from MetaWaylandFrameCallback 2014-07-10 13:30:05 -04:00
Jasper St. Pierre
66eb4bc34c wayland-surface: Make sure to apply the margin before moving the window 2014-07-03 10:31:26 -04:00
Jasper St. Pierre
e33c58297d wayland-surface: Subsurfaces start out in synchronous mode 2014-06-11 12:34:44 -04:00
Jasper St. Pierre
5350120db4 wayland-surface: Fix whitespace 2014-06-11 12:34:17 -04:00
Jasper St. Pierre
626516d12e window: Remove meta_window_move as well
Move to meta_window_move_frame everywhere...
2014-05-27 15:44:33 -04:00
Florian Müllner
31db32e826 Actually implement opening the app menu
The last commit added support for the "appmenu" button in decorations,
but didn't actually implement it. Add a new MetaWindowMenuType parameter
to the show_window_menu () functions and use it to ask the compositor
to display the app menu when the new button is activated.

https://bugzilla.gnome.org/show_bug.cgi?id=730752
2014-05-27 19:40:06 +02:00
Jasper St. Pierre
efcd7d86e7 wayland: Add support for show_window_menu 2014-05-24 15:56:04 -04:00
Jasper St. Pierre
6408e59c7c wayland: Move checks for grabbing into a central location
This means that we won't have as much work to do to introduce similar
checks for touch.
2014-05-22 10:58:07 -04:00
Jasper St. Pierre
e2b7b26f28 wayland: Use meta_window_move to position xdg_popup windows
This makes sure we set the user rect as well, which is necessary to
have things not "snap back" to weird locations.
2014-05-14 12:01:11 -04:00
Jasper St. Pierre
7732447abc wayland: Update to latest xdg-shell protocol 2014-05-12 18:25:23 -04:00
Jasper St. Pierre
bca210db45 Revert "Update to latest xdg-shell protocol"
This reverts commit fd5c14550a.

Again, pushed by accident, whoops.
2014-05-05 19:09:07 -04:00
Jasper St. Pierre
fd5c14550a Update to latest xdg-shell protocol 2014-05-05 14:15:03 -04:00
Jasper St. Pierre
afaab8aef2 wayland-surface: Fix warnings 2014-05-04 15:33:38 -04:00
Adel Gadllah
fa29a1a99e Fix last commit
Actually do the changes from the review ... pushed old version of the
patch :/
2014-05-03 12:00:27 +02:00
Adel Gadllah
f9bffae9fd wayland: Scale native surfaces for hidpi
Scale surfaces based on output scale and the buffer scale set by them.
We pick the scale factor of the monitor there are mostly on.

We only handle native i.e non xwayland / legacy clients yet.

https://bugzilla.gnome.org/show_bug.cgi?id=728902
2014-05-03 10:11:55 +02:00
Adel Gadllah
31c925c602 wayland: Add basic hidpi support
Advertise the scale factor on the output and transform pointer and damage
events as well as input and opaque regions for clients
that scale up by themselves i.e use set_buffer_scale.

We do not scale any 'legacy' apps yet.

https://bugzilla.gnome.org/show_bug.cgi?id=728902
2014-05-03 10:11:51 +02:00
Jasper St. Pierre
8461b2c910 window: Move move_resize_wayland to window-wayland.c
The move/resize logic is still busted for top/left resizes... sigh.
2014-04-28 18:22:55 -04:00
Adel Gadllah
c8d0a66921 wayland-surface: Ignore bufferless damage
Instead of letting a buggy client kill us.
2014-04-27 16:18:09 +02:00
Adel Gadllah
dd4d6af185 wayland-surface: Only call process_damage when we have any damage
This fixes a crash when a client commits a surface
without attaching a buffer.
2014-04-27 16:12:02 +02:00
Adel Gadllah
c95c501a5b meta-wayland-surface: Clip damage to buffer dimensions
A client can send us damage that exceeds the buffer size, protect against that
by clipping the damage to the buffer's region.
2014-04-23 22:32:17 +02:00
Jasper St. Pierre
2435d132ac Revert "Update to latest xdg-shell protocol"
This reverts commit eed03d38b0.

This was pushed by accident.
2014-04-23 16:01:02 -04:00
Jasper St. Pierre
eed03d38b0 Update to latest xdg-shell protocol 2014-04-23 14:23:13 -04:00
Jasper St. Pierre
59fc9d832b wayland: Clean up surface creation 2014-04-22 18:27:44 -04:00
Jasper St. Pierre
0bf5c831d5 wayland: Remove unused list of surfaces 2014-04-22 18:27:44 -04:00
Jasper St. Pierre
777a6d4570 surface: Merge version logic inline 2014-04-22 18:27:43 -04:00
Jasper St. Pierre
88040d6b8a wayland: Have a consistent _init pattern for subcomponents 2014-04-22 18:27:43 -04:00
Jasper St. Pierre
6072e981a8 wayland: Kill extra includes to meta-wayland-stage.h
No idea why these are still included at all...
2014-04-22 16:56:02 -04:00
Jasper St. Pierre
29439f8de2 wayland-surface: Fix offset with window dragging
The grab_x / grab_y here were converted from fixed integers to
floats, but we forgot to update one place in the code that used
them as fixed integers.
2014-04-18 18:23:27 -04:00
Jasper St. Pierre
97a69cee5a wayland-surface: Simplify move_double_buffered_state
The majority of the data we can simply copy from one to the other.
2014-04-18 18:23:27 -04:00
Jasper St. Pierre
2e2dd247ce wayland: Rename pending_surface_state => pending
This matches what's normally done.
2014-04-18 18:15:41 -04:00
Jasper St. Pierre
de6054d557 wayland: Remove an extraneous variable 2014-04-18 18:15:41 -04:00
Jasper St. Pierre
db56a7cecb wayland: Rename DoubleBufferedState to PendingState
I was talking with other people and they became confused at the
term "double-buffered", since we were also talking about
double-buffering in general, e.g. swapping between two buffers.

Instead, we'll adapt the "pending state" nomenclature that we
already use for the field / variable names.
2014-04-18 18:15:36 -04:00
Jasper St. Pierre
f92c1af24a wayland-surface: Merge actor_surface_commit back in
Since we do it unconditionally now, the code flows better
if it's inline with commit_double_buffered_state.
2014-04-18 15:43:26 -04:00
Jasper St. Pierre
4ab71ec942 wayland: Make subsurfaces reactive 2014-04-18 12:26:31 -04:00
Jasper St. Pierre
ae0853ed86 seat: Move cursor storage to MetaWaylandPointer 2014-04-17 19:15:52 -04:00
Jasper St. Pierre
62e5faeb0c wayland: Remove the explicit surface commit for Xwayland
It's not needed anymore; we always keep the actor up-to-date.
2014-04-11 23:55:37 -07:00
Jasper St. Pierre
03cfe602d9 wayland: Always keep the MetaSurfaceActorWayland up-to-date
The MetaSurfaceActorWayland should always accurately reflect
the state of the MetaWaylandSurface, even if it's a cursor
surface.
2014-04-11 23:55:37 -07:00
Jasper St. Pierre
e1b0c9c756 wayland: Make synchronous subsurface a very special case in commit
Really, it is a special case. When the subsurface is synchronous,
commit changes meaning from being applied immediately to being
queued up for replay later. Handle this explicit special case
with an explicit special case in the code.

This means that in all other paths, we can unconditionally
apply the actor immediately.
2014-04-11 23:55:37 -07:00
Jasper St. Pierre
dbe4fc0e45 wayland: Always set the new buffer on the surface on commit
Even when it doesn't have a role.

This fixes cursors not quite working right, as they're a "detached"
surface without a role since nobody called set_cursor on them yet.
2014-04-11 23:55:37 -07:00
Jasper St. Pierre
f0bf9c7fc3 wayland: Check for newly_attached everywhere
Instead of using commit_attached_buffer / actor_surface_commit.

We want to kill the return values of these methods because we
really should always be calling them, even if the surface doesn't
have a role.
2014-04-11 23:55:37 -07:00
Jasper St. Pierre
d0f0be8b03 wayland: Only set newly_attached if the buffer changes
This cleans up the check to determine if the buffer changed,
meaning we shouldn't have to pass it around like we needed
to do before.
2014-04-11 23:55:37 -07:00
Jasper St. Pierre
f5e77d7f63 wayland: Remove some extraneous code
This is already handled by the double_buffered_state_reset at the end.
2014-04-11 23:55:37 -07:00