1
0
Fork 0
Commit graph

583 commits

Author SHA1 Message Date
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
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
Carlos Garnacho
2250865eb6 wayland: Implement the server side bits of wl_touch_interface
Clutter touch events are translated into events being sent down
the interface resource, with the exception of FRAME/CANCEL events,
which are handled directly via an evdev event filter.

The seat now announces invariably the WL_SEAT_CAPABILITY_TOUCH
capability, this should be eventually updated as devices come and
go.

The creation of MetaWaylandTouchSurface structs is dynamic, attached
to the lifetime of first/last touch on the client surface, and only
if the surface requests the wl_touch interface. MetaWaylandTouchInfo
structs are created to track individual touches, and are locked to
a single MetaWaylandTouchSurface (the implicit grab surface) determined
on CLUTTER_TOUCH_BEGIN.

https://bugzilla.gnome.org/show_bug.cgi?id=724442
2014-06-04 23:37:45 +02:00
Jonas Ådahl
048f035d30 wayland: Scale smooth scroll events to pointer motion coordinate space
Smooth scroll event vectors from clutter have the same dimensions as the
ones from from Xi2, i.e. where 1.0 is 1 discrete scroll step. To scale
these to the coordinate space used by wl_pointer.axis
vertical/horizontal scroll events, multiply the vector by 10.

https://bugzilla.gnome.org/show_bug.cgi?id=729601
2014-05-31 14:22:10 +02: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
a3747725ed window-wayland: Don't use meta_window_get_position 2014-05-22 15:47:30 -04:00
Jasper St. Pierre
cbffbb0be0 window: Rename the requested_rect to the unconstrained_rect
The requested_rect is a strange name for it, because it's not actually
the rect that the user or client requested all the time: in the case of
a simple move or a simple resize, we calculate some of the fields
ourselves.

To the MetaWindow subclass implementations, it just means "the rect
before we constrained it", so just use the name unconstrained_rect.
This also makes it match the name of the MetaWindow field.
2014-05-22 15:39:10 -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
5b7dff7a57 window: Move constructors to the respective header files 2014-05-20 15:59:17 -04:00
Jasper St. Pierre
1a3aa75385 window: Move meta_window_wayland_new to window-wayland.c 2014-05-20 15:59:17 -04:00
Jasper St. Pierre
41880778b5 window-wayland: Change the state on grab op transitions
This could affect the RESIZING state.
2014-05-20 15:59:17 -04:00
Jasper St. Pierre
2c0ad5bef7 window: Replace the user_rect with the unconstrained_rect
Realistically, the user rect contains the unconstrained window
rectangle coordinates that we want to be displaying, in case
something in the constraints change.

Rename it to the "unconstrained_rect", and change the code to always
save it, regardless of current state.

When metacity was originally being built, the purpose of the user
rect was a lot less clear. The code only saved it on user actions,
with various other calls to save_user_window_placement() and a force
mechanism sprinkled in to avoid windows being snapped back to odd
places when constraints changed.

This could lead to odd bugs. For instance, if the user uses some
extension which automatically tiles windows and didn't pass
user_action=TRUE, and then the struts changed, the window would be
placed back at the last place a user moved it to, rather than where
the window was tiled to.

The META_IS_USER_ACTION flag is still used in the constraints code
to determine whether we should allow shoving windows offscreen, so
we can't remove it completely, but we should think about splitting
out the constrainment policies it commands for a bit more
fine-grained control.

https://bugzilla.gnome.org/show_bug.cgi?id=726714
2014-05-20 15:59:14 -04:00
Jasper St. Pierre
2ae0a72dad wayland: Don't try to autostart gnome-session
It won't work.
2014-05-15 14:16:38 -04:00
Jasper St. Pierre
8d9653dece pointer: Update the button count after repicking
The default focus interface uses the button count to determine
whether we should update the pointer focused surface. When releasing
an implicit grab, we need to send the button release events to the
implicitly grabbed surface, so we can't reset the focus surface too
soon. We already explicitly set the focus at the end of implicit
grabs, so counting the buttons after is perfectly fine.
2014-05-15 13:59:28 -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
33cb7f4a2c wayland: Send a correct width / height for state changes
If we send out a configure notify for a window and then have some
other kind of state change, we need to make sure that we continue
to send out that new size, rather than the last size the client
sent us a buffer for.

In particular, a client might give us a 250x250 buffer and then
immediately request fullscreen. We send out a configure for the
monitor size and a state that tells it it's full-screen, but then
it takes focus, and since the client hasn't sent us a buffer for
the new size, we tell it it's fullscreen at 250x250.

Fix this.
2014-05-12 18:25:24 -04:00
Jasper St. Pierre
7732447abc wayland: Update to latest xdg-shell protocol 2014-05-12 18:25:23 -04:00
Jasper St. Pierre
c49c37999c wayland: Move appears-focused changed handling to window-wayland 2014-05-12 18:25:19 -04:00
Jasper St. Pierre
91f35d6a01 wayland: Use standard SINCE version definitions 2014-05-12 17:01:00 -04:00
Jonas Ådahl
b6f9500ccc wayland: Only send wl_output.scale event if supported by the client
'scale' was introduced in version 2, so only send such an event to
clients which has bound a new enough version of wl_output.

https://bugzilla.gnome.org/show_bug.cgi?id=729602
2014-05-07 22:09:30 +02:00