1
0
Fork 0
Commit graph

704 commits

Author SHA1 Message Date
Carlos Garnacho
4fc1811c15 wayland: Add X11/wayland selection interoperation
This piece of code hooks in both wl_data_device and the relevant X
selection events, an X11 Window is set up so it can act as the clipboard
owner when any wayland client owns the selection, reacting to
SelectionRequest events, and returning the data from the wayland client
FD to any X11 requestor through X properties.

In the opposite direction, SelectionNotify messages are received,
which results in the property contents being converted then written
into the wayland requestor's FD.

This code also takes care of the handling incremental transfers through
the INCR property type, reading/writing data chunk by chunk.

https://bugzilla.gnome.org/show_bug.cgi?id=738312
2015-05-15 17:43:53 +02:00
Carlos Garnacho
4b5f5abb4f wayland: refactor MetaWaylandDataSource
Expose it partly (in internal headers anyway), and pass a vtable for the
data source functions, the wayland vfuncs just delegate operations on the
wl_data_source resource. The resource has been also made optional, although
it'll be present on all data sources from wayland clients.

The ownership/lifetime of the DnD data source has also changed a bit,
belonging now to the MetaWaylandDataDevice like the selection one does, as
we can't guarantee how long it will be needed after the grab is finished,
it will be left inert and replaced the next time DnD is started at worst.

This allows the creation of custom/proxy data sources, which will turn out
useful for X11 selection interoperation.

https://bugzilla.gnome.org/show_bug.cgi?id=738312
2015-05-15 17:43:46 +02:00
Carlos Garnacho
d6a7559750 wayland: Fix c&p typo in wl_listener notify callback
The corresponding wl_notify field for destroy_data_device_icon()
is drag_grab->drag_icon_listener, otherwise we're fetching a pointer
that's slightly off where we want.
2015-05-01 18:50:06 +02:00
Jasper St. Pierre
9f13033f15 window-wayland.[ch] => meta-window-wayland.[ch]
This finishes off the meta- prefix for wayland/.
2015-04-27 18:09:16 -07:00
Jasper St. Pierre
dd3cf94744 Properly implement wl_shell_surface's poor surface commit semantics 2015-04-25 11:19:25 -07:00
Ray Strode
eb56e0a3d7 xwayland: plug some leaks in stop function
This commit makes sure the lockfile and display
name are freed in meta_xwayland_stop.

https://bugzilla.gnome.org/show_bug.cgi?id=748380
2015-04-23 13:51:11 -04:00
Ray Strode
8937c32cd5 xwayland: rename lockfile to lock_file
The missing underscore is inconsistent with the
coding style of the surrounding code.

https://bugzilla.gnome.org/show_bug.cgi?id=748380
2015-04-23 13:51:11 -04:00
Ray Strode
a8a5da768a xwayland: don't unlink lock file twice in stop function
The stop function currently manually constructs the lock
filename from the display number and also calls unlink
on the same, already known lock filename from the manager
struct.

This commit gets rid fo the manual construction in favor
of the saved lock filename.

https://bugzilla.gnome.org/show_bug.cgi?id=748380
2015-04-23 13:51:11 -04:00
Ray Strode
33bfcf56ce xwayland: free lockfile in start function on error
Right now we just leak the lockfile.

https://bugzilla.gnome.org/show_bug.cgi?id=748380
2015-04-23 13:51:11 -04:00
Ray Strode
40cccb58a5 xwayland: use out label for cleanup in start function
The start function has a few exit paths that need to
perform clean up of the lock file.

This commit consolidates those exit paths at the end
using an out label and gotos.

https://bugzilla.gnome.org/show_bug.cgi?id=748380
2015-04-23 13:51:11 -04:00
Jonas Ådahl
eb6c70137b wayland: Add and implement set/unset_modal for the gtk_surface interface
Add set_modal ond unset_modal to the gtk_surface interface. When a
surface is modal, the compositor can treat it differently from non-modal
dialogs, for example attach it to the parent window if any. There is
currently no changes to input device focus; it is up to the client to
ignore events to the parent surface that is wanted.

This bumps the gtk_shell version to 2.

https://bugzilla.gnome.org/show_bug.cgi?id=745720
2015-04-23 16:02:37 +08:00
Jonas Ådahl
df3b412a25 wayland: Kill clients who try to bind an incompatible gtk_shell version
gtk_shell is not backward compatible, and clients binding to it should
check whether the advertised version is the same as the client supports.

https://bugzilla.gnome.org/show_bug.cgi?id=745720
2015-04-23 16:02:37 +08:00
Jonas Ådahl
cfba0a5dfc wayland: Sync protocol/gtk-shell.xml from GTK+
Had added a new capability enum value.

https://bugzilla.gnome.org/show_bug.cgi?id=745720
2015-04-23 16:02:37 +08:00
Jonas Ådahl
868e1427a8 wayland: Rework synchronized state application semantics
When a parent of a subsurface gets it state applied (either by a
wl_surface.commit, wl_subsurface.set_desync or a recursive
wl_surface.commit on a parent surface), the pending position state
of the subsurface should be applied. If the subsurface is in effective
synchronized mode (i.e. if its in explicit synchronized mode or any of
its parent surfaces is a subsurface in explicit synchronized mode), the
cached state should also be applied at this point, including its
subsurface children, recursively.

https://bugzilla.gnome.org/show_bug.cgi?id=743617
2015-04-10 09:15:12 +08:00
Rui Matos
4aa74af694 wayland-keyboard: Disconnect from backend signals on release
Otherwise we'll access freed memory in the handlers.

The wayland keyboard is released when the seat loses the keyboard
capability which happens when leaving the VT so if there are keymap
changes while switched away from the VT we would crash.

https://bugzilla.gnome.org/show_bug.cgi?id=747263
2015-04-02 23:21:22 +02:00
Ray Strode
a5d1f67c34 wayland: try 50 times to create lock file again for login screen
since commit 8c16ac47c1, we started
creating the login screen on display 1024 instead of display 0.

This defeats this logic in try_display:

    display++;
    /* If display is above 50, then something's wrong. Just
     * abort in this case. */
    if (display > 50)

In practice it doesn't matter much since we only have one login
screen in most setups, but we should still fix the bug.

This commit introduces a separate counter to keep try of 50 tries,
rather than assuming "display number == number of tries".

https://bugzilla.gnome.org/show_bug.cgi?id=746545
2015-04-01 10:30:24 -04:00
Jasper St. Pierre
102fa0e373 xwayland: Don't leak the launcher 2015-03-31 11:47:34 -07:00
Jonas Ådahl
dbca3337b2 wayland: Fix damage of infinite regions
To avoid integer overflow when scaling "infinite" regions (0, 0)
(INT32_MAX, INT32_MAX), intersect with the surface rect before scaling,
instead of intersecting with the buffer rect afterwards.

https://bugzilla.gnome.org/show_bug.cgi?id=746510
2015-03-31 15:09:13 +08:00
Jasper St. Pierre
d4e8d97e58 xwayland: Port to GSubprocess 2015-03-27 13:58:56 -07:00
Jasper St. Pierre
a86368dcb1 xwayland: Prevent some boolean confusion
The original code in Weston that this was ported from returned an errno,
not a boolean, so we were inadvertently returning TRUE here during an
error path. Fix that up.
2015-03-27 13:58:56 -07:00
Jonas Ådahl
7b79c44608 wayland: Don't skip notifying about initial maximized size
When a client wants to start initialized it my set the maximized state
before having attached any buffers. Before we'd not notify the client of
the new expected size if the previous size was 0x0 as it would normally
mean we'd resize to 1x1, but since this is not always the case, only
avoid notifying the client if the previous size was 0x0 and the result
is 1x1.

https://bugzilla.gnome.org/show_bug.cgi?id=745303
2015-03-17 13:51:11 -04:00
Carlos Garnacho
3ff6316562 wayland: Protect against unordered destruction of surface resources
If the wl_surface resource happens to be destroyed before any other
role resource, the destructor for the latter will attempt to
access/modify random memory.

Fix this by ensuring the associated resources are destroyed on the
wl_surface destructor, this will free all associated memory and
remove the resources ahead of their imminent destruction.

https://bugzilla.gnome.org/show_bug.cgi?id=745734
2015-03-16 18:02:43 +01:00
Ray Strode
8c16ac47c1 wayland: don't let the login screen steal :0
In 3.16, GDM keeps a login screen running on vt1.
This login screen starts an Xwayland instance.
Since it's the first X server to start, it gets
the prized :0 display number.

This commit works around that problem, for now,
by having GDM's display number start at 1024.

https://bugzilla.gnome.org/show_bug.cgi?id=746295
2015-03-16 11:08:45 -04:00
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
fffb863f37 wayland: Sync surface actor state when changing main monitor
In order to switch to the correct surface actor scale given the monitor
the surface is on, without relying on the client committing a new state
given some other side effect, sync the surface actor state when the main
monitor associated with the corresponding window changed.

https://bugzilla.gnome.org/show_bug.cgi?id=744933
2015-03-03 14:53:15 -05: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
Jasper St. Pierre
78d8525699 backends/native: Calculate the output scale in here
It makes more sense as a backend thing, not a frontend thing.
2015-02-26 00:13:28 -08: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
Jasper St. Pierre
adccbc9b7b wayland-outputs: Respect the scaling-factor override
This allows someone to explicitly set a scaling factor that overrides
the computed scale for all outputs.
2015-02-22 11:09:27 -08:00
Jasper St. Pierre
94b111cf6c wayland-outputs: Use the wrappers for post_event 2015-02-22 11:09:27 -08:00
Ray Strode
2aa6dcd9d8 wayland: don't try to use seat devices that aren't (yet) present
Before commit ac448bd42b the pointer,
keyboard, and touch objects were initialized when the seat was created.
Now they're initialized later, when the clutter device manager finds and
loads them.

This commit makes sure we don't try to access those objects if they
aren't initialized.

https://bugzilla.gnome.org/show_bug.cgi?id=744640
2015-02-18 11:52:13 -05:00
Carlos Garnacho
469b85eb7c data-device: Set "dnd" role on the icon surface, not the source one
The DnD source surface evidently has other role assigned, it's the
icon surface which is supposed to be a fresh one.
2015-02-18 17:32:38 +01:00
Ray Strode
673ddfde04 wayland: discard non-seat events sent to the seat
The wayland seat event handlers get sent events that
aren't strictly interesting to them (such as events for
hardware devices the seat doesn't support and events for
virtual devices that the seat needs to ignore).

This commit makes sure all uninteresting events get ignored.
2015-02-18 11:20:36 -05:00
Ray Strode
56ca7eeb65 wayland: treat touchpads like mouse devices
They both serve the same purpose of moving
the pointer around, so they both should be
considered pointer devices on the seat.
2015-02-18 11:19:17 -05: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
Jasper St. Pierre
1f0ed5483a Revert "Revert "wayland-pointer: Just use the pointer actor instead of doing a full repick""
The Clutter bug has now been fixed.

This reverts commit ead79f834c.
2015-02-06 09:45:34 -08:00
Rui Matos
3f2d658f20 monitor-manager: Expose MetaMonitorManager to introspection
This just exposes the type and the singleton getter necessary to make
it available to introspection. We'll expose more functionality as it
becomes needed.

https://bugzilla.gnome.org/show_bug.cgi?id=743745
2015-01-30 13:13:49 -05: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
Jasper St. Pierre
d561b3b18f frames: Clutterify frame event handling
This lets us remove our horrible X11-based, GDK-based hacky frame event
handling in favor of a more sane one in Clutter.
2015-01-19 21:56:08 -08:00
Carlos Garnacho
9d73b4efbb wayland: Use the new keyboard settings location for repeat settings
This makes keyboard repeat in clients in-sync with the input config changes.

https://bugzilla.gnome.org/show_bug.cgi?id=739397
2015-01-18 13:32:28 -08:00
Marek Chalupa
b6d070b06f wayland: Seal SHM buffers before access
If wayland client lies about size of given buffer, compositor could touch bad
memory and get SIGBUS. Wayland provides simple API to fix it - so fix it!

[1] http://cgit.freedesktop.org/wayland/wayland/tree/src/wayland-server.h#n416
[2] http://lists.freedesktop.org/archives/wayland-devel/2013-November/012159.html

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=727893
2015-01-09 16:39:37 -08:00
Jasper St. Pierre
ad7292faef wayland: Use g_source_add_unix_fd instead of g_source_add_poll
g_source_add_poll is deprecated.
2014-12-15 14:44:00 -08:00
Jasper St. Pierre
b24cd5ae08 window: Force state changes on maximized / fullscreen 2014-12-15 13:52:40 -08:00
Jasper St. Pierre
c782078e00 Rename MetaMoveResizeFlags items to fit with the theme
Use a proper prefix, even if more wordy, instead of META_IS.
2014-12-15 13:30:39 -08:00
Jasper St. Pierre
9fdf487da1 pointer: Actually do change the focus during window ops
Whenever the compositor takes a grab, we're supposed send leave/enter
events to the current surface, which makes sense, as the compositor
has stolen the pointer from the client.

I forget why I added the special case in the first place, but it's
likely a bug that's since been fixed.

This actually fixes a bug: it prevents the need to double-click on
X11 application titlebars when grabbing them.
2014-11-26 15:32:18 -08:00
Jasper St. Pierre
c5033616e9 pointer: Sync the focus surface instead of calling set_focus directly
set_focus is really meant to be an internal function, and
sync_focus_surface should be able to be called at any time and get
things right.
2014-11-26 15:29:42 -08:00
Jasper St. Pierre
a0e038f34b pointer: Forcibly steal pointer focus when the compositor has a grab 2014-11-26 15:29:25 -08:00
Jasper St. Pierre
0015963457 pointer: Make sure to always update the focus surface after repicking
Our current and focus surfaces might get out of sync during destruction,
which is odd, but just always do this to satisfy it.
2014-11-22 17:06:42 -08:00
Jasper St. Pierre
b832bc7424 wayland: Upgrade to v2 of data-device
To fix a resource leak.
2014-11-22 12:22:02 -08:00
Bastien Nocera
13b6bd20ca wayland: Don't check for hi-dpi on monitors with broken EDID
If the monitor reports a width/height that looks suspiciously like an
aspect ratio (16/9 or 16/10) don't check for hi-dpi. We can assume that
makers of devices that do support hi-dpi aren't so careless.

See http://cgit.freedesktop.org/~daniels/xserver/commit/?h=lodpi

https://bugzilla.gnome.org/show_bug.cgi?id=734839
2014-10-30 17:37:24 +01: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
Carlos Garnacho
7c5989c978 wayland: Avoid MetaWindow call on non window-backed surfaces
Crossing events may also be gotten on subsurfaces.

https://bugzilla.gnome.org/show_bug.cgi?id=738890
2014-10-23 16:53:44 +02:00
Rui Matos
4040a70781 wayland-keyboard: Send modifiers after the key event
The key event should be interpreted by clients with the modifier state
as it was before the event itself just as in X11 input events.
Achieving this in wayland is a matter of sending the key event first
and the modifiers after (if needed).

This isn't really specified in the wayland protocol but it matches
weston's behavior and should avoid corner cases in clients.

https://bugzilla.gnome.org/show_bug.cgi?id=738238
2014-10-10 18:12:23 +02:00
Jasper St. Pierre
ead79f834c Revert "wayland-pointer: Just use the pointer actor instead of doing a full repick"
This reverts commit 33acb5fea0.

The issue here is that the pointer actor does not actually get reset
when the actor's reactivity changes, so we end up with stale picks after
actors are destroyed.

I have a local patch to Clutter for this, but I don't have time to
submit it upstream, so let's just use the ugly code for now.
2014-10-08 13:43:57 -07:00
Jasper St. Pierre
7e431bd6bc Revert "pointer: Repick after the focused surface is destroyed"
This reverts commit e496ed50d6.

This was incorrect. wl_surface_destructor actually does the full repick
-- doing it here is dangerous, because the destroy listeners actually
run *before* the destructor, not after, so the surface is still alive.
2014-10-08 12:38:56 -07:00
Rui Matos
c39f18c2d4 wayland-keyboard: Don't send pressed keys on enter
We never want to send pressed keys to wayland clients on enter. The
protocol says that we should send them, presumably so that clients can
trigger their own key repeat routine in case they are given focus and
a key is physically pressed.

Unfortunately this causes some clients, in particular Xwayland, to
register key events that they really shouldn't handle, e.g. on an
Alt+Tab keybinding, where Alt is released before Tab, clients would
see Tab being pressed on enter followed by a key release event for
Tab, meaning that Tab would be processed by the client when it really
shouldn't.

Since the use case for the pressed keys array on enter seems weak to
us, we'll just fake that there are no pressed keys instead which
should be spec compliant even if it might not be true.

https://bugzilla.gnome.org/show_bug.cgi?id=727178
2014-10-08 15:26:28 +02:00
Jasper St. Pierre
33acb5fea0 wayland-pointer: Just use the pointer actor instead of doing a full repick
The full repick is unnecessary -- Clutter already does it for us.
2014-10-07 21:30:15 -07:00
Jasper St. Pierre
591718dc02 wayland: Clump the globals code together 2014-10-07 20:54:28 -07:00
Jasper St. Pierre
b6127eeda4 wayland: Remove old comments 2014-10-07 20:52:57 -07:00
Jasper St. Pierre
eeff1b8b02 wayland: Remove unused variable 2014-10-07 20:51:18 -07:00
Jasper St. Pierre
354cc466af wayland: Make WaylandEventSource private 2014-10-07 20:50:57 -07: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
5d16194b03 wayland: Clean up a bit more 2014-10-07 20:42:27 -07:00
Jasper St. Pierre
a74acf0ec2 wayland: Clean up more includes 2014-10-07 20:42:27 -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
49092397f2 wayland-surface: Group MetaWaylandSurface members logically
And add comments so that we know what's what. This cleans up the struct.
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
Carlos Garnacho
113be01ce8 wayland: Use a MetaDnDActor for the DnD icon surface
The actor is updated on DnD grab motion events, properly notified
when dragging finishes, and destroyed if the client/surface disappear
below its feet.
2014-10-06 19:39:43 -07:00
Carlos Garnacho
f211b3ec90 wayland: Store whether the wl_data_source has a target selected
It will be useful to check whether DnD is going to fail or not.
2014-10-06 19:39:43 -07:00
Carlos Garnacho
0510c3a621 wayland: Keep track of the origin surface and drag point on DnD
Keeping track of the surface will be necessary in case it is destroyed
during DnD, and the coordinates will be useful when figuring out the
snap back coordinates.
2014-10-06 19:39:43 -07:00
Carlos Garnacho
18db5d0799 data-device: Store the current drag grab
And bail out if any further start_drag() is attempted.
2014-10-06 19:39:42 -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
e496ed50d6 pointer: Repick after the focused surface is destroyed
Having a null focus is incorrect -- we want to pick the surface that's
under the new pointer position.
2014-10-06 16:30:09 -07:00
Jasper St. Pierre
a127d05790 pointer: Make sure to update the focus after ending a grab
Otherwise, we might not reset it after the grab has ended.
2014-10-06 16:19:30 -07:00
Jasper St. Pierre
607730e96c pointer: Fix the behavior of the pointer under DND
When grabbing with DND, we need to leave the pointer alone and
under the client's control. The code here was a bit messy before about
when it unset the window cursor -- it did it whenever there was no
current surface after repicking, which is a bit wrong, since it will
fire during a drag grab.

Move the check for this to update_cursor_surface, which is our standard
"sync" API for this, and then call update_cursor_surface after we set
the focus.
2014-10-06 15:48:42 -07:00
Jasper St. Pierre
9203db0655 pointer: Don't fizzle out surface changes too soon
During a DND grab, pointer->focus_surface is NULL, since the wl_pointer
doesn't have any focused surface (it's in drag mode). In this case, the
drag interface has control of the focus, and when dragging into a NULL
surface, drag_grab_focus won't get called, properly detaching it from
the previous surface.

Let the interface->focus implementation do the fizzling out.

In the future, we should split out wl_pointer's implementation
(pointer->focus_surface) from the Wayland side of the generic pointer
wrapper (pointer->current) and use our event routing system to determine
or similar whether it should go to wl_pointer or wl_data_device.
2014-10-06 14:31:16 -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
48dfde2073 keyboard/pointer: Calculate the serial once per event
Some applications, like totem, create keyboard/pointer objects from the
same client, and expect it to work. We made this work a while ago, but
due to an oversight in the code, we increment the serial on button press
for every resource that we need to send events to.

Since operations like move/resize use the grab serial of the devices to
determine whether the operation is exact, we need to make sure the same
serial goes to all devices.

Restructure the code so that all that's in the resource loop is the
sending of the event -- all the calculation that's needed happens
outside.

This fixes moving / resizing the Totem window not working sometimes.

https://bugzilla.gnome.org/show_bug.cgi?id=736840
2014-09-18 09:15:13 -06:00
Jasper St. Pierre
4a41d415f8 wayland: Fix the placement of popup windows
The fix in d61dde1 regressed the position of popup windows, since the
size was 0x0 when we wanted to do a sole move. Only fizzle out in the
path where we actually *do* resize.

https://bugzilla.gnome.org/show_bug.cgi?id=736812
2014-09-17 17:42:37 +02:00
Jasper St. Pierre
276df8f18d keyboard/pointer: Make sure to move focused resources into the list
We only broadcast input to the focus_resource_list, so we need to make
sure it's put in the proper list on startup.

This fixes input not working for windows when they first appear.

Argh. There's always more stuff to fix with keyboard/pointer. Every
single time I think I've fixed it, more stuff pops up.
2014-09-16 21:25:26 -06:00
Jasper St. Pierre
d61dde12cb window-wayland: Don't send 1x1 sizes to GTK+ windows
GTK+ requests get_xdg_surface before attaching a buffer, and since it
might take a long time for GTK+ to get around to attaching a buffer and
committing it, our idle for MOVE_RESIZE will kick in beforehand.

And our idle will try to resize the 0x0 window that currently exists,
constrain it to 1x1, which will send a configure event of 1x1 to the
window while it boots up, causing it to awkwardly resize to the minimum
size of the window.

Make sure that in this case, our idle doesn't cause any problems, and
that we fizzle out any idles like this.

The "proper" way to do this would be to delay the creation of the
MetaWindow until a surface is committed, but that's difficult for a
variety of reasons, and might cause unintended issues with focus.
2014-09-16 21:14:19 -06:00