1
0
Fork 0
Commit graph

605 commits

Author SHA1 Message Date
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
Jasper St. Pierre
5c40345128 window-wayland: Don't bother checking if anything changed
This is a small fixup. We don't need the check here, since we don't do
anything extra if it actually changed.
2014-09-16 19:16:38 -06:00
Jasper St. Pierre
43b3573c51 window-wayland: Always update the last_sent size
The last_sent size is effectively what size we should send in configure
requests where the size hasn't changed. Thus, if an app commits a new
size, we need to make sure we respect it and don't reconfigure it with
a size it wasn't expecting when the state changes.

This fixes apps being sent a configure event with 0, 0 on startup,
which was confusing Clutter into displaying a 0x0 viewport.
2014-09-16 19:11:56 -06:00
Jasper St. Pierre
ac6ec168da pointer: Make coding style similar to keyboard 2014-09-16 18:55:49 -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
Owen W. Taylor
d6624b0a75 Cleanup xwayland/wayland window association from the "unmanage" signal
Windows can be freed at some point after they are unmanaged - because
there is an effect in progress, because a language binding is holding
a reference. Therefore, we need to clean up the later to associate
the xwayland and wayland windows deterministically in an "unamanaged"
handler.

https://bugzilla.gnome.org/show_bug.cgi?id=736694
2014-09-16 10:59:45 -04:00
Owen W. Taylor
9c465a2d5a Do xwayland/wayland window association in a later, not an idle
g_idle_add() makes no guarantee about when it will be run - if Mutter
is busy drawing and blocking glXSwapBuffers() it could happen only
minutes later.  Use meta_later_add (META_LATER_BEFORE_REDRAW) instead -
this will deterministically be run after the Wayland socket is read
from but before the next frame is painted.

https://bugzilla.gnome.org/show_bug.cgi?id=736694
2014-09-16 10:59:45 -04:00
Owen W. Taylor
73573a85de Replace MetaStackWindow with a 64-bit "stack ID"
Putting X windows and pointers to MetaWindows into a union had a number of
problems:

 - It caused awkward initialization and conditionalization
 - There was no way to refer to Wayland windows (represented by
   MetaWindow *) in the past, which is necessary for the MetaStackTracker
   algorithms
 - We never even cleaned up old MetaStackWindow so there could be
   records in MetaStackWindow pointing to freed MetaWindow.

Replace MetaStackWindow with a 64-bit "stack ID" which is:

 - The XID for X Windows
 - a "window stamp" for Wayland windows - window stamps are assigned
   for all MetaWindow and are unique across the life of the process.

https://bugzilla.gnome.org/show_bug.cgi?id=736559
2014-09-12 13:42:56 -04:00
Owen W. Taylor
0706de5378 Add meta_wayland_get_[x]wayland_display_name
Add private functions for the test framework to use to find out the
wayland and x11 display names, so they can set up the environment for
children.

https://bugzilla.gnome.org/show_bug.cgi?id=736505
2014-09-12 11:00:55 -04:00
Rui Matos
656573c5d2 wayland-keyboard: Handle keymap-layout-group-changed signal
We need to send a modifiers event to wayland clients when the layout
group changes.

https://bugzilla.gnome.org/show_bug.cgi?id=736433
2014-09-11 19:05:53 +02:00
Rui Matos
53092424e6 wayland-keyboard: Handle keymap-changed signal
We need to inform wayland clients of new keymaps.

https://bugzilla.gnome.org/show_bug.cgi?id=736433
2014-09-11 19:05:53 +02:00
Jasper St. Pierre
4d75de006c wayland: Don't set_focus when the device has been released
It's possible for a released pointer to have repick / set_focus on it as
part of sync_input_focus. When the pointer is actually re-init'd, it
will memset 0, which can cause corruption as our destroy listener has
already been added.

Released devices should be idempotent, so just make sure method calls on
them don't have any effect.
2014-09-05 18:05:44 -07:00
Jasper St. Pierre
e19516ec5a wayland: Don't set_focus for new resources
Otherwise, we can re-add the destroy listener, which can cause
corruption.

Instead, split out the broadcast function, and use that.
2014-09-05 17:58:15 -07: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
Jasper St. Pierre
9063e4568c configure: Conditionalize libinput and gbm too 2014-08-27 09:57:43 -04: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
5657a671c1 xdg-shell: Bump unstable version 2014-08-22 12:07:56 -04:00
Jasper St. Pierre
9feb9d6bca events: Update the pointer position here
Rather than in the Wayland front-end, since it's really a core operation.
2014-08-21 17:00:55 -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
d41449b578 wayland: Initialize SHM again
Uh, whoops. I accidentally removed this when revamping the
initialization sequence. This causes bad things to happen.
2014-08-19 18:27:21 -04:00
Jasper St. Pierre
a7b1b1da80 main: Clean up the initialization sequence
The initialization sequence before was quite icky, initializing Clutter
in a few different places depending on what was going on.

Put that all back into main.c
2014-08-18 16:57:00 -04:00
Jasper St. Pierre
53876d2b62 wayland-pointer: Squash warning
This should never happen.
2014-08-16 15:38:25 -04:00
Jasper St. Pierre
2b63b17327 wayland-pointer: Insert missing break;s 2014-08-16 15:38:15 -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
0e758a9e65 display: Establish a separate state variable for routing events
We've long used a switch statement on the grab operation to determine
where events should go. The issue with MetaGrabOp is that it's a mixture
of a few different things, including event routing, state management,
and the behavior to choose during operations.

This leads to poorly defined event routing and hard-to-follow logic,
since it's sometimes unclear what should point where, and our utility
methods for determining grab operations apart can be poorly named.

To fix this, establish the concept of a "event route", which describes
where events should be routed to.
2014-08-15 16:08:49 -04:00
Jasper St. Pierre
71a4fe746e pointer: Update an old function reference
We renamed this and I forgot to rename it here.
2014-08-15 13:49:40 -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
e6b950e31b wayland: Fix minor style issue 2014-08-13 17:49:53 -04:00
Rui Matos
7d54631ebf backends: Make MetaBackend available to introspection
This moves meta-backend.h under meta/ and, for now, just exposes to
introspection the methods that we actually need in gnome-shell.

https://bugzilla.gnome.org/show_bug.cgi?id=734301
2014-08-07 11:31:59 +02:00
Rui Matos
513628e4ad wayland-keyboard: Use the backend's keymap
Instead of getting it from xwayland, let's just keep a reference to
the backend's keymap.

https://bugzilla.gnome.org/show_bug.cgi?id=734301
2014-08-07 11:24:24 +02:00
Jasper St. Pierre
e5c4fedd55 wayland: Use the send event wrappers
Rather than raw post_event.
2014-08-05 16:12:29 -04:00
Jasper St. Pierre
2ce23072d3 wayland: Use wl_display_add_socket_auto 2014-08-05 16:12:29 -04:00
Rui Matos
97f4eb6b75 wayland-keyboard: Send modifiers after the keymap
Clients have to re-create their modifier state when getting a new
keymap so modifiers have to be sent after the keymap, not before.
2014-08-05 18:11:53 +02:00
Rui Matos
75cbf3d730 wayland-keyboard: Send keymap events also to focused resources
We move focused resources out of the global list when we focus a
client's surface so we need to send events for those separately.
2014-08-05 18:11:53 +02:00
Rui Matos
bf9fdf448d wayland-keyboard: Make update_pressed_keys() more generic
It will allow us to re-use this function next. Also rename the keys
array to pressed_keys since we'll need to add a different one.

https://bugzilla.gnome.org/show_bug.cgi?id=727178
2014-08-05 18:11:53 +02:00
Jasper St. Pierre
63c627ec18 wayland: Add a few statics we forgot before 2014-08-04 10:28:44 -04:00
Jasper St. Pierre
dadbd793be wayland: Fix naming scheme for request handlers
Our implementations should take the name of the request.
2014-08-04 10:27:26 -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
Giovanni Campagna
e56f963574 MetaWaylandTouch: fix running without touch hardware
Refuse to create a touch resource if we don't have the capability
(for misbehaving clients), and don't attempt to use touch data
structures that are not initialized.
2014-07-30 15:46:19 +02:00
Jasper St. Pierre
65a8f9100c window-wayland: Only fizzle out configures when we do pending moves
This is a terrible hack. We need to figure out a better way to do
interactive resizes.

This fixes weird resizing from the left bugs when using GTK+, which is
really slow at acking configures.
2014-07-28 12:04:23 +02: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
6c5595fa9c window-wayland: Don't insist if the window gives us a bad buffer
This is an easy way to get into an infinite loop where we're constantly
re-sending stuff to the window. If it worked once, it probably won't
work again.
2014-07-27 18:38:56 +02:00
Jasper St. Pierre
e6558f838e window-wayland: Clean up code that pends moves 2014-07-27 18:09:12 +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
c844611052 window-wayland: Rename saved_pos to pending_move
This is really what it is -- if we make the move/resize at the same time
as a move, we need to pend the move until the client submits the resize.
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
Jasper St. Pierre
4f55e16fe9 wayland-keyboard: Add support for the repeat_info event in Wayland v4 2014-07-25 09:25:01 -04: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
Carlos Garnacho
baadb75a5e wayland: Clear hashtable pointers on meta_wayland_touch_release()
Just in case they are poked while no touch interface is available;

https://bugzilla.gnome.org/show_bug.cgi?id=733631
2014-07-24 18:05:56 +02:00
Carlos Garnacho
fbea59b326 wayland: set the current serial on touch down/up notifications
Do just like pointer button events, and do not bump the serial, so serials
match on window drag/move requests triggered from touch events.

https://bugzilla.gnome.org/show_bug.cgi?id=733631
2014-07-24 00:16:23 +02:00
Carlos Garnacho
029d69919b wayland: Rename touch_handle_cancel_event() to meta_wayland_touch_cancel()
This will serve as a generic call to issue touch cancellation on clients,
useful for the gesture tracker support.

https://bugzilla.gnome.org/show_bug.cgi?id=733631
2014-07-24 00:14:03 +02:00
Carlos Garnacho
5e395fb676 wayland: Fix infinite loop in touch_handle_cancel_event()
https://bugzilla.gnome.org/show_bug.cgi?id=733631
2014-07-24 00:13:26 +02:00
Carlos Garnacho
ac448bd42b seat: Listen for ClutterDeviceManager signals in order to update capabilities
The capability flags are determined from the device types of the slave devices
that are currently attached. This also happens whenever a device is added or
removed, so the capabilities are kept up to date, and clients know about these.

On VT switch, all slave devices are temporarily removed, so the cascade of
signals will make the seat end up with capabililities=0 while input is suspended.

https://bugzilla.gnome.org/show_bug.cgi?id=733563
2014-07-23 22:07:16 +02:00
Carlos Garnacho
32565e096d wayland: Notify modifiers after keymap changes
Anytime the keymap is changed, either directly, or indirectly through the
keyboard capability being released/initialized, there should be a
notification of the modifiers being changed too.

https://bugzilla.gnome.org/show_bug.cgi?id=733563
2014-07-23 14:53:46 +02:00
Carlos Garnacho
1677a068ce wayland: Unset keyboard/pointer focus when releasing the data for these devices
Otherwise the focus_surface_listener list element becomes stale, and then
mangled if the devices' data is initialized again, and the memory memset().

https://bugzilla.gnome.org/show_bug.cgi?id=733563
2014-07-22 18:01:29 +02:00
Carlos Garnacho
a02b8441b1 wayland: set the interface vfuncs when declaring the touch interface
Otherwise the NULL vtable would be accessed when trying to release the touch
device.

https://bugzilla.gnome.org/show_bug.cgi?id=733563
2014-07-22 18:01:29 +02:00
Carlos Garnacho
dfe1c106f2 wayland: set the interface vfuncs when declaring the keyboard interface
Otherwise the NULL vtable would be accessed when trying to release the keyboard.

https://bugzilla.gnome.org/show_bug.cgi?id=733563
2014-07-22 18:01:29 +02:00
Jasper St. Pierre
e49bbe2ed8 cursor-tracker: Don't require a screen
This allows us to do initialization earlier and not have to poke into
Wayland internals from the cursor tracker.
2014-07-22 11:10:14 -04: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
a3c55c2692 wayland: Don't emit SIZE_CHANGED on every commit
Save a little bit of effort here.
2014-07-17 17:27:52 -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
5621d3c0c7 wayland: Fix the sign for the geometry coordinates
I got the spaces for window geometry coordinates vs. surface coordinates
mixed up.
2014-07-17 16:42:41 -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
d34ece6f1a wayland: Don't send superfluous configures for uninteresting grab ops 2014-07-17 16:03:03 -04:00
Jasper St. Pierre
9316256e10 wayland: Use the variables we already have 2014-07-17 15:27:47 -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
558b323485 xdg-shell: Fix typo 2014-07-17 14:50:40 -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
eb952819c2 monitor: Don't use wl_output_transform in our APIs
Invent our own API so we can build without Wayland headers.
2014-07-13 11:35:01 -04:00
Jasper St. Pierre
12d0c98fb5 wayland: Remove an unused field from MetaWaylandFrameCallback 2014-07-10 13:30:05 -04:00
Jasper St. Pierre
817c6986a0 wayland: Remove a few unused fields from MetaWaylandCompositor 2014-07-10 13:30:05 -04:00
Jasper St. Pierre
7c68aaea4c data-device: Put the DataDevice implementation in its own struct 2014-07-10 13:30:05 -04:00
Jasper St. Pierre
6fea46e0cf data-device: Use a better variable name than "resource" 2014-07-10 13:30:05 -04:00
Jasper St. Pierre
59fa74fed1 data-device: Don't look up the same client twice in two different ways 2014-07-10 13:30:05 -04:00
Jasper St. Pierre
581335fbea data-device: Start a cleanup 2014-07-10 13:30:04 -04:00
Jasper St. Pierre
9b5d6cc008 wayland: Remove seat->display
It's unused.
2014-07-10 13:30:04 -04:00
Jasper St. Pierre
d0f98ec1ba wayland: Fix include ordering
This puts it in the same order as the types in the struct.
2014-07-10 13:30:04 -04:00
Jasper St. Pierre
a977fcf3d0 wayland: Add a wrapper for set_input_focus
So we're not poking into seat internals.
2014-07-10 13:30:04 -04:00
Jasper St. Pierre
664f6ef420 wayland: Move DataOffer / DataSource into data-device internals 2014-07-10 13:30:04 -04:00
Jasper St. Pierre
1de2fd7122 window-wayland: Check to update the buffer_rect separately
When frame extents change, we might not update the frame rect, but the
buffer rect still needs to be updated. Split out the check for this to
be independent of the check for the frame rect.

This fixes issues that could happen when the window was maximized while
it was in the top-left corner.
2014-07-07 13:07:37 -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
af135c0b0b monitor-manager: Rename output_id to winsys_id
The output_id is more of an opaque identifier for the monitor, based on
its underlying ID from the windowing system. Since we also use the term
"output_id" for the output's index, rename our use of the opaque cookie
"output_id" to "winsys_id".
2014-07-01 13:24:34 -04:00
Jasper St. Pierre
ea3b961e43 window-wayland: Make sure the size of the buffer rect is kept up to date
When we changed the setting of the buffer rect to be inside the moving
code to make sure it was updated in places we were moving directly
without any round-trip needed, I removed a code to set the buffer rect
without remembering that's where the size of it was updated.

Add back the code to update the buffer rect.

This fixes Wayland windows not appearing.
2014-07-01 11:27:26 -04:00
Jasper St. Pierre
077606c057 window-wayland: Correct the buffer rect for frame extents 2014-06-26 13:58:11 -04:00
Marek Chalupa
c14382181f wayland window: update buffer_rect when moving
Update both - rect and buffer_rect positions when moving wayland window

https://bugzilla.gnome.org/show_bug.cgi?id=731237
2014-06-26 10:50:29 -04:00
Marek Chalupa
b2183dfda7 wayland-pointer: fix condition for grabbing
It returns FALSE when button_count is not 0. But grabbing for
move/resize is activated by clicking the button, so this condition
disallows the wayland clients to be moved/resized.

https://bugzilla.gnome.org/show_bug.cgi?id=731237
2014-06-26 10:50:29 -04:00
Jasper St. Pierre
b0b8f37240 window: Save the buffer_rect internally
Rather than calculate it speculatively with the current properties
which may be too new or too out of date, make sure it always fits
with the proper definition. We update it when we update the toplevel
window for X11, and when a Wayland surface is committed with a newly
attached buffer.
2014-06-17 11:15:32 -04:00
Jasper St. Pierre
e87a01c80b wayland-touch: Rearrange header slightly 2014-06-11 16:28:45 -04:00
Jasper St. Pierre
21d7c1a850 wayland-pointer: Remove useless initialization
There is no way this value will ever be read, because we set the
cursor_surface to NULL, this is set at the same time as cursor_surface,
and it's only read if cursor_surface is non-NULL.
2014-06-11 15:15:58 -04:00