1
0
Fork 0
Commit graph

840 commits

Author SHA1 Message Date
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
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
9c4908b44a xwayland: Don't crash when the window disappears from under us
If we attach to a MetaWindow that disappears before the idle fires,
we'll notice that we can't associate the window properly again and
try to access data on the MetaWindow struct, which might crash.

Install a weak ref that ties the lifetime of the idle to the lifetime
of the MetaWindow.

It seems every GTK+ app does this for some reason at startup. This
is really unfortunate, since we'll have to create and destroy a new
MetaWindow really quickly.
2014-05-04 15:51:53 -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
43d6088ebb window: Change meta_window_move_resize_internal to take a MetaRectangle
We construct one anyway, and most callers already pass in a rectangle
the long way around, so why not change the internal API?
2014-05-01 19:13:33 -04:00
Jasper St. Pierre
57bb297450 window-wayland: Fix interactive resizing from the top/left once more
Ugh. So in the fullscreen case, we need to make sure to specify that
it's a MOVE_ACTION so that we move to the saved position, but we
can't do that in the resizing case since we need to use the resized
rectangle.

The flags are really hurting us here. Perhaps we should make it the
client's responsibility to specify a complete rectangle which we
could resize to; then the weird-o logic would be self-contained in
each front-end.

I'm not convinced this covers all cases, especially when we could have
a dangling weird state pointer, but it fixes our existing two testcases.
2014-05-01 18:59:17 -04:00
Jasper St. Pierre
b773898a60 window-wayland: Fix resizing from the top/left once more
Restoring the position in our move_resize_internal implementation
is too late. We need to do it at ack-time, before we hand off the
new position to the constraints code.
2014-04-28 18:22:55 -04: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
Jasper St. Pierre
eb0c4db46d keyboard: Don't use a grab interface for sending key events 2014-04-28 16:30:51 -04:00
Jasper St. Pierre
19e97ec567 keyboard: Remove start_grab / end_grab
It's unused.
2014-04-28 16:30:50 -04:00
Jasper St. Pierre
ce5c029509 window-wayland: Make sure to save where the position for server-initiated resizes
For the server-initiated resize case, like unmaximize or some forms
of tiling, we dropped the x/y of the server-assigned rectangle on the
floor, which meant the surface didn't move to where it needed to be in
that case. Now, save it internally, and combine it with the dx/dy passed
in during attaches to figure out where we actually need to be.

Make sure to only use it for when we send out a configure notify. We
should use the passed in rectangle for other scenarios, like a
client-initiated resize.

This fixes incorrect surface placement after unmaximization.
2014-04-28 16:23:38 -04:00
Jasper St. Pierre
647743aa5f Revert "window-wayland: Don't enter the only-moving path for Wayland
resizes"

We're going to use the old code structure now.

This reverts commit 23ae11043f.
2014-04-28 16:23:38 -04:00
Jasper St. Pierre
e94f169d4e Revert "window-wayland: Make sure to save where the position for server-initiated resizes"
This is wrong for client-initiated resizes now.

This reverts commit e6b0525c70.
2014-04-28 16:23:38 -04:00
Jasper St. Pierre
e6b0525c70 window-wayland: Make sure to save where the position for server-initiated resizes
For the server-initiated resize case, like unmaximize or some forms
of tiling, we dropped the x/y of the server-assigned rectangle on the
floor, which meant the surface didn't move to where it needed to be in
that case. Now, save it internally, and combine it with the dx/dy passed
in during attaches to figure out where we actually need to be.

This fixes incorrect surface placement after unmaximization.
2014-04-28 16:11:10 -04:00
Jasper St. Pierre
23ae11043f window-wayland: Don't enter the only-moving path for Wayland resizes
We'll be adding additional code here for "correct" moving soon, so
we need to make sure not to do it for Wayland resizes.
2014-04-28 16:11:09 -04:00
Jasper St. Pierre
78657dafca window-wayland: Clean up a bit 2014-04-28 16:11:09 -04:00
Jasper St. Pierre
0f47eae33a window-wayland: Split an if statement in two 2014-04-28 16:11:09 -04:00
Jasper St. Pierre
d1619e4f53 wayland-pointer: Remove the conditional around the surface actor too
The actor should always exist.
2014-04-27 10:39:19 -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
657318d4d3 meta-wayland-pointer: Remove the surface->window conditional 2014-04-25 20:38:24 +02:00
Adel Gadllah
f051e05b0a meta-wayland-pointer: Transform coordinates relative to the surface_actor
Not the window_actor ..
2014-04-25 20:36:46 +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
b501ca5a24 cursor: Remove cursor tracker from API 2014-04-23 12:15:11 -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
003ff3d255 wayland: Fix header file style 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
eaf85ddec9 wayland: Split outputs to another file 2014-04-22 18:25:34 -04:00
Jasper St. Pierre
fa2e1e4eda wayland-seat: Clean up includes 2014-04-22 18:25:34 -04:00
Jasper St. Pierre
2769683521 Rename MetaWaylandStage to MetaStage and put in compositor/ 2014-04-22 16:56:02 -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
168ede9374 compositor: Create the MetaWaylandStage here 2014-04-22 16:56:01 -04:00
Jasper St. Pierre
a0d608e083 wayland: Remove the stage destroy hook
We assert fail / segfault when pressing the "X" button anyway, so
I don't think it does us too much good.
2014-04-22 16:56:01 -04:00
Jasper St. Pierre
326740e00f Move the cursor renderer to the backend 2014-04-22 16:56:01 -04:00
Jasper St. Pierre
3c0ca1f2af wayland-stage: Fix a race condition early in init
If Xwayland takes too long to start up, Clutter can choose to draw, at
which point we'll crash because the MetaDisplay hasn't initialized yet.
2014-04-22 10:26:03 -04:00
Jasper St. Pierre
9a6f5e115d Revert "wayland-stage: Use the C setter for cursor-visible"
This reverts commit d1a31952de.

Whoops, I did not mean to push this one.
2014-04-21 21:07:47 -04:00
Jasper St. Pierre
731e1ed74f wayland-stage: Remove unused variable 2014-04-21 21:07:47 -04:00
Jasper St. Pierre
eba5648c27 wayland-stage: Add missing include
Again, had it locally, forgot to amend.
2014-04-21 21:07:47 -04:00
Jasper St. Pierre
d1a31952de wayland-stage: Use the C setter for cursor-visible
This makes meta_wayland_stage_new(); synonymous with g_object_newv(...);
2014-04-21 21:05:23 -04:00
Jasper St. Pierre
13a444482a wayland-stage: Don't use the Wayland seat to find the cursor tracker
Simply look it up on the seat itself.
2014-04-21 21:05:23 -04:00
Jasper St. Pierre
9d780bca7a wayland-stage: Cut down on dependencies 2014-04-21 21:05:23 -04:00
Jasper St. Pierre
b6a80934d6 backend: Move pointer constrainment code to native backend 2014-04-21 21:05:23 -04:00
Jasper St. Pierre
c44b1d730d backends: Move MonitorManager creation to MetaBackend as well 2014-04-21 20:25:21 -04:00
Jasper St. Pierre
d189ddcc86 Split out the code that renders the code into a MetaCursorRenderer
Right now, this is the same exact same mess it's always been, but
it will be fixed up soon with backend-specific renderers.
2014-04-21 20:25:20 -04:00
Jasper St. Pierre
d09116ebce display: Rename meta_grab_op_is_mouse to is_moving_or_resizing
is_mouse actually checks for all combinations of moving/resizing
grab ops, which is quite confusing. Just rename it.
2014-04-20 12:03:24 -04:00
Jasper St. Pierre
e55dd4e3f4 display: Rename META_GRAB_OP_WAYLAND_CLIENT to WAYLAND_POPUP
We're going to introduce other grab ops soon.
2014-04-20 12:03:24 -04:00
Jasper St. Pierre
02c31ac069 data-device: Clean up slightly 2014-04-20 12:03:24 -04:00
Jasper St. Pierre
3f375c9426 pointer: Remove get_focus_surface
Yeah, I was wrong, it doesn't improve code clarity.
2014-04-20 12:03:24 -04:00
Jasper St. Pierre
258112d6a7 display: Remove COMPOSITOR from mouse/keyboard grab ops
Looking at the code paths where is_mouse / is_keyboard are used,
all of them should never be run when dealing with a COMPOSITOR
grab op, since they're filtered out above or the method is just
never run during that time.

It's confusing that COMPOSITOR is in here, and requires us to
be funny with other places in code, so just take it out.
2014-04-20 12:03:24 -04:00
Jasper St. Pierre
ceb0f1005d pointer: Repick on update, not on handle_event
pointer->current needs to always be the surface under the pointer,
even when we have a grab. We do need to make sure we keep the focus
surface the same even when we have a grab, though, so add logic
for that.
2014-04-20 12:03:24 -04:00
Jasper St. Pierre
c9e99ebbbf pointer: Move update up
It seems that I forgot or messed this up in one of my reshufflings.
2014-04-18 18:56:01 -04:00
Jasper St. Pierre
020f209c45 pointer: Split out the code that gets the proper focus surface as well 2014-04-18 18:56:01 -04:00
Jasper St. Pierre
45df3e41c5 pointer: Split out the code that sets the focus surface 2014-04-18 18:56:01 -04:00
Jasper St. Pierre
1a723954fc pointer: Only the focus_surface should only be influenced by the grab
... not the normal current. That should *always* be the surface under
the pointer, regardless of events.
2014-04-18 18:56:01 -04:00
Jasper St. Pierre
3e554efc70 pointer: Clean up repick_for_event a bit 2014-04-18 18:56:01 -04:00
Jasper St. Pierre
d68da0b8cf pointer: Merge update_current_focus and repick_for_event
In order to correctly fix the issue to make sure we only set the
focused surface to NULL during a grab, but not the current surface,
we need to merge update_current_surface back into repick_for_event
so we have more control over the behavior here.
2014-04-18 18:56:01 -04:00
Jasper St. Pierre
de7a644656 pointer: Unset the window cursor when we do a pick
... not when we do an update.

We only repick when we handle events, not when we update. Perhaps
this is a mistake.

Since update runs before handle_event, this means that when we
drop a grab, update will notice the NULL surface, since we haven't
repicked after the event, and then we'll repick the correct surface.
The end result is that you see a root cursor after a grab ends,
rather than the correct window cursor.

This doesn't fix it, since the current surface becomes NULL when
we start the grab. But it does make the code here more correct when
we fix that bug.
2014-04-18 18:56:01 -04:00
Jasper St. Pierre
16bcbd1a34 pointer: Reindent 2014-04-18 18:56:01 -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
2748661f63 pointer: Remove our own position tracking
Use the coords inside ClutterInputDevice instead.
2014-04-18 12:26:31 -04:00
Jasper St. Pierre
aee074b11d pointer: Remove unused field 2014-04-18 12:26:31 -04:00
Jasper St. Pierre
5f29b8c206 pointer/keyboard: Rearrange slightly 2014-04-18 12:26:30 -04:00
Jasper St. Pierre
7c6c4d63c5 seat: Move the keyboard resource creation over to MetaWaylandKeyboard 2014-04-17 19:15:53 -04:00
Jasper St. Pierre
5d43e33032 seat: Don't set the data device key focus on get_keyboard creation
It's not necessary, as we don't use anything from the protocol
keyboard at all.
2014-04-17 19:15:53 -04:00
Jasper St. Pierre
45a8a3f490 seat: Move pointer event handling to MetaWaylandPointer as well
Now everything that deals with the pointer is inside meta-wayland-pointer.c
2014-04-17 19:15:53 -04:00
Jasper St. Pierre
bdf55bc674 seat: Rewrite event handling in terms of MetaWaylandPointer 2014-04-17 19:15:53 -04:00
Jasper St. Pierre
e15c260e56 seat: Group CLUTTER_SCROLL handling together with other pointer events 2014-04-17 19:15:53 -04:00
Jasper St. Pierre
65ed8a817d seat: Don't save the current stage ourselves
ClutterInputDevice already saves it.
2014-04-17 19:15:53 -04:00
Jasper St. Pierre
a8d2dfd14f seat: Don't require an event to repick()
We always pass NULL, and anywhere where we want to pass an event
should be handled internally.
2014-04-17 19:15:53 -04:00
Jasper St. Pierre
e02bf13206 seat: Remove incorrect comment above repick 2014-04-17 19:15:53 -04:00
Jasper St. Pierre
4b7d77864a seat: Move update_pointer to MetaWaylandPointer 2014-04-17 19:15:52 -04:00
Jasper St. Pierre
72e4d42267 seat: Reorder handle_event helpers near handle_event 2014-04-17 19:15:52 -04:00
Jasper St. Pierre
1abdd7be10 seat: Move pointer interface over to MetaWaylandPointer 2014-04-17 19:15:52 -04:00
Jasper St. Pierre
f3d88ca1d1 seat: Rewrite the pointer interface in terms of MetaWaylandPointer 2014-04-17 19:15:52 -04:00
Jasper St. Pierre
15d89d451f seat: Move update_cursor_surface to the end
It's now only a public API.
2014-04-17 19:15:52 -04:00
Jasper St. Pierre
4510b82361 seat: Move set_cursor_surface and all that tracking to MetaWaylandPointer 2014-04-17 19:15:52 -04:00
Jasper St. Pierre
ae0853ed86 seat: Move cursor storage to MetaWaylandPointer 2014-04-17 19:15:52 -04:00
Jasper St. Pierre
76544ff6e1 seat: Rewrite get_pointer / get_keyboard in terms of MetaWaylandPointer 2014-04-17 19:15:52 -04:00
Jasper St. Pierre
dde96951a7 seat: Rewrite handle_scroll in terms of MetaWaylandPointer 2014-04-17 19:15:52 -04:00
Jasper St. Pierre
24eb737858 keyboard: Remove the useless return value of init 2014-04-17 19:15:52 -04:00
Jasper St. Pierre
ddc7938961 keyboard: Reformat 2014-04-17 19:15:51 -04:00
Jasper St. Pierre
4f2dc77ec3 keyboard: Reorder
The correct order is:

init
release
update
handle_event
set_focus
start_grab
end_grab
other stuff
2014-04-17 19:15:51 -04:00
Jasper St. Pierre
678fa52ae1 seat: Reformat 2014-04-17 19:15:51 -04:00
Jasper St. Pierre
1be97f3d59 seat: Reorder 2014-04-17 19:15:51 -04:00
Jasper St. Pierre
30ecd7c770 keyboard: Gobble up key events whenever we have a focused surface
If we have a focused surface, we need to eat up key events, not
just if we have a non-empty focus resource list. The latter would
happen if we have a focused client but it never called get_keyboard.
2014-04-17 19:15:51 -04:00
Jasper St. Pierre
0dd27edb91 xwayland: Remove some unused includes 2014-04-17 16:23:37 -04:00
Jasper St. Pierre
6a44f04b51 xwayland: Stop using UNIX signals for readiness
The latest Xorg / Xwayland has support for -displayfd being used
in conjunction with an explicit display number. Use that to know
when the X server is ready, rather than UNIX signals, because
they're UNIX signals.
2014-04-17 16:23:37 -04:00
Jasper St. Pierre
745134e066 xwayland: Rename sp to something a bit more handy
We also want to create a socketpair for -displayfd instead
of using signals.
2014-04-17 16:23:37 -04:00
Jasper St. Pierre
72b1a2837d xwayland: Clean up display finding code
Split out and make it more manageable.
2014-04-17 16:23:37 -04:00
Jasper St. Pierre
e5ab4f13f1 xwayland: Put the filename in the error message 2014-04-17 16:23:37 -04:00
Jasper St. Pierre
14deeef8a7 xwayland: Use %m instead of explicit strerror 2014-04-17 16:23:37 -04:00
Jasper St. Pierre
8c0ef829c9 pointer/keyboard: Unset the entire focus when the surface is destroyed
Otherwise, we'll end up with dangling parts in our resource list.
2014-04-16 19:04:58 -04:00
Jasper St. Pierre
eb1c9175f9 wayland: Move the RESULT_RESIZED code to the proper place
We need to set this when we update window->rect, not when we simply
send out a configure event.
2014-04-16 16:31:45 -04:00
Jasper St. Pierre
f25243e121 wayland: Don't move the window when we're simply sending out a configure
If we're sending out a configure event, we can't immediately move the
window; we need to instead wait to apply the new position when the
client sends a new buffer.
2014-04-16 16:31:45 -04:00
Jasper St. Pierre
c1f4352683 window: Add proper interpretation of dx/dy
dx/dy should be against the regular window's rect, and need to
be ignored when we're resizing. Instead, we use gravity to anchor
the window's new rectangle when resizing.
2014-04-16 16:31:45 -04:00
Jasper St. Pierre
260b6d02f2 wayland: Simplify the move/resize code
The old protocol is out of date and broken for resizing at the
top/left. This is still as broken, but a lot simpler.
2014-04-16 16:31:45 -04:00
Jasper St. Pierre
339a78718d pointer/keyboard: Support more than one focused resource
Sophisticated clients, like those using ClutterGtk, will have more
than one focused resource per client, as both Clutter and GDK will
ask for a wl_pointer / wl_keyboard. Support this naturally using
the same "hack" as Weston: multiple resource lists, where we move
elements from one to the other.
2014-04-16 15:31:53 -04:00
Jasper St. Pierre
f1034d0459 pointer/keyboard: Remove focus_resource_listener
In order to support multiple pointers for the same client, we're
going to need to kill it.

This will cause crashes for now, but will be fixed by the next
commit.
2014-04-16 15:30:42 -04:00
Jasper St. Pierre
edfaf3de49 pointer/keyboard: Stop using focus_resource for anything unessential 2014-04-16 15:30:41 -04:00
Jasper St. Pierre
bbec66c2d8 pointer/keyboard: Surfaces should always have resources
There's no possible way that they shouldn't.
2014-04-16 15:27:08 -04:00
Jasper St. Pierre
339b856d84 pointer: Clean up a tiny bit 2014-04-16 15:27:07 -04:00
Jasper St. Pierre
7560aaee73 pointer: Make sure to care about FFM even if the client didn't get a
resource
2014-04-16 15:27:03 -04:00
Jasper St. Pierre
2bcd4ab159 data-device: Don't poke into MetaWaylandKeyboard
It needs to know the wl_client that has keyboard focus, so add a simple
getter for that.
2014-04-16 15:26:58 -04:00
Jasper St. Pierre
c9d2a5bee2 pointer: Don't use default_grab_focus in popup grabs
default_grab_focus tries to add implicit grab semantics where
focus won't take effect if there's a pointer button down. This
is not what we want for popup grabs at all, as it's perfectly
valid to want to drag on a menu while there's a button down.
2014-04-12 00:31:21 -07:00
Jasper St. Pierre
30d534f17e display: Rename grab_op_is_wayland to grab_op_should_block_wayland
The idea here is that while we take a WM-side grab, like a compositor
grab or a resizing grab, we need to remove the focus from the Wayland
client.

We make a special exception for CLICKING operations, because these
are really an internal state machine while you're pressing on a button
inside a frame, and in this case, we need to not kill the focus.
2014-04-12 00:24:26 -07: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
Jasper St. Pierre
277879c11b wayland: Small code style fix-up 2014-04-11 23:55:36 -07:00
Jasper St. Pierre
1a4c16659f wayland: Remove an old comment
wl_buffer_release semantics are centrally managed, and the comment
is above something completely unrelated.
2014-04-11 23:55:36 -07:00
Jasper St. Pierre
239195c1d1 wayland: Rename commit_attached_surface to commit_attached_buffer
The buffer is the thing that's attached here, not the surface.
2014-04-11 23:55:28 -07:00
Jasper St. Pierre
7c4f4c6f36 wayland: Rename set_transient_for to set_parent
This is also something that we did upstream. Since we want to
introduce an explicit "xdg_transient" window type for tooltips
and popovers, and since "transient_for" is a confusing dumb
80s term lifted from the ICCCM spec, just rename it.
2014-04-11 23:54:11 -07:00
Jasper St. Pierre
e8447ad9bb wayland: Rename the delete event to the close event
This was changed upstream a little while ago for C++ compatibility.

It's also the more common term for the operation: you close a window,
you don't delete one. In fact, a delete event might seem like it
would be about resource management instead.
2014-04-11 23:52:48 -07:00
Bastien Nocera
d53e04f4c8 Name all timeouts and idles
Better names can be used once we make more use of them.

https://bugzilla.gnome.org/show_bug.cgi?id=727979
2014-04-10 18:59:46 +02:00
Rui Matos
feca0fb512 xwayland: Re-sync input focus when associating a surface to a window
When the MetaWindow is created we don't have the surface yet and thus
we can't set input focus to it so we need to try again when we get the
surface.
2014-04-09 11:20:28 +02:00
Jasper St. Pierre
c40868b239 xwayland: Fix rendering
Since we get the ClientMessage after the surface is created, there's
no good way to synchronize the two streams. In this case, what we
need to do is delay the surface commit until after we get the
ClientMessage. Ideally, we'd be using a better surface system overall
where committing the surface didn't depend on what type it is, but
oh well, this is a good short-term hack for now.
2014-04-02 13:24:58 -04:00
Jasper St. Pierre
a21e7a2188 wayland: Move surface_set_buffer back into the commits
For XWayland support, we need to delay the buffer set until after
we do the typechecking, as we need to bail out early in that case.
2014-04-02 13:24:58 -04:00
Jasper St. Pierre
371fba6843 wayland: Move the commit implementation to the top
We're going to need to expose commit as a public method for XWayland
support, so decouple it from the handler implementation.
2014-04-02 13:24:57 -04:00
Jasper St. Pierre
be02fa1120 xwayland: Switch to the new Xwayland DDX 2014-04-02 13:24:57 -04:00
Jasper St. Pierre
43730f1660 xwayland: Switch to SIGUSR1 to know when the X server has finished init
This is effectively the same, but since we lose the xserver.xml protocol
in the new XWayland DDX, we have to use SIGUSR1 anyway, so might as well
switch over now.
2014-04-02 13:16:10 -04:00
Jasper St. Pierre
4f609dbf5e xwayland: Don't use glib after forking
glib doesn't have any guarantee about working after forking.
We can get away with it, but we're better off just not using it.
2014-04-02 13:04:31 -04:00
Jasper St. Pierre
2a7d12ba14 xwayland: Make failing to exec a fatal error 2014-04-02 13:03:29 -04:00
Jasper St. Pierre
c4c0b5f0ab xwayland: Detect a fail to fork 2014-04-02 13:03:17 -04:00
Jasper St. Pierre
eb5b54dd8b xwayland: Split another part of the initialization sequence out
This will be used from a SIGUSR1 handler.
2014-04-02 11:41:28 -04:00
Jasper St. Pierre
9653b79a35 xwayland: Split a helper out
This will make the next commit, which ports to the new ClientMessage
API, more understandable.
2014-04-02 11:41:28 -04:00
Jasper St. Pierre
e07bd15fc2 xwayland: Make file cosmetically modern
Put a modeline, include "config.h", and shift around the include ordering
2014-04-02 11:41:27 -04:00
Jasper St. Pierre
5cf0740b4e xwayland: Fork the X server ourselves
gspawn just isn't us the fine-grained control we need for starting
processes and leaking file descriptors in.
2014-04-02 11:41:27 -04:00
Jasper St. Pierre
c540ddf59b xwayland: Move display_name into choose_xdisplay 2014-04-02 11:41:27 -04:00
Jasper St. Pierre
a44295599c xwayland: Split out the code that creates the XWayland sockets 2014-04-02 11:41:26 -04:00
Jasper St. Pierre
af272f2685 xwayland: Move global initialization down 2014-04-02 11:41:26 -04:00
Jasper St. Pierre
81d033ec73 xwayland: Use %m instead of manual strerror(errno) 2014-04-02 11:41:26 -04:00
Jasper St. Pierre
e9ee984921 wayland: Rename the wl_surface interface handlers
We usually name the method handlers after the direct name
of the interface methods. Do that for wl_surface as well.
2014-04-02 11:41:26 -04:00
Jasper St. Pierre
3c404c5db3 wayland: Replace make_toplevel / window_unmanaging with set_window
The make_toplevel / window_unmanaging interface has never made
a lot of sense to me. Replace it with set_window, which does
effectively the same thing.

It's still not perfect in the case of XWayland, but I don't think
XWayland will ever make me happy.
2014-04-02 11:41:07 -04:00
Jasper St. Pierre
e4cd000cef wayland: Implement wl_seat v3
The new XWayland DDX flat out requires seat v3.
2014-04-02 11:40:40 -04:00
Jasper St. Pierre
57803f1d59 wayland-stage: Clean up and rename
It should be META_TYPE_WAYLAND_STAGE, not META_WAYLAND_TYPE_STAGE.

Well, actually, it *should* be META_TYPE_NATIVE_STAGE, because it's
not related to Wayland at all. But that comes later :)
2014-04-01 14:04:58 -04:00
Jasper St. Pierre
5bcc78498f Move MetaLauncher to meta-backend 2014-03-31 23:44:46 -04:00
Jasper St. Pierre
521125b672 meta-wayland: Use meta_clutter_init 2014-03-31 23:44:45 -04:00
Jasper St. Pierre
20547e3b63 Move weston-launch to backends/
It's about display servers, not Wayland integration.
2014-03-31 22:48:34 -04:00
Jasper St. Pierre
ccced506ed Rename monitor => meta-monitor-manager 2014-03-31 22:05:24 -04:00
Jasper St. Pierre
be60e4f6e7 cursor-tracker: Make set_window_cursor take a MetaCursorReference as well 2014-03-31 18:27:19 -04:00
Jasper St. Pierre
1e2bdcc3c5 idle-monitor: Move reset_idletime handling to events.c
It's not specific to the Wayland protocol at all, and it's not really
a Wayland compositor thing. This should eventually be in the native
backend.
2014-03-30 22:55:02 -04:00
Jasper St. Pierre
97ea4e8717 xwayland: Remove some stray logs
These really aren't too helpful.
2014-03-26 12:04:14 -04:00
Jasper St. Pierre
208296a619 wayland: Shut up about Setenv if we're past initialization
I'm a bit tired of hearing about this when I launch mutter-wayland
nested. Ideally, this would be part of display server integration,
not GNOME integration, so we could simply not make the call when
nested, but oh well.
2014-03-26 12:02:08 -04:00
Jasper St. Pierre
d699b2409a xwayland: Shut up conditionally 2014-03-25 12:54:13 -04:00
Jasper St. Pierre
ef65848d11 window-wayland: Implement kill 2014-03-25 12:05:21 -04:00
Jasper St. Pierre
44580ddb80 wayland-surface: Unref the buffer after removing the destroy listener 2014-03-25 12:00:38 -04:00
Jasper St. Pierre
456e3e2429 xwayland: Punt stdout / stderr to /dev/null
This should really go to the journal, but I'm tired of seeing Xorg
log a bunch of garbage that I don't care about when debugging mutter.
2014-03-25 12:00:38 -04:00
Rui Matos
7484d540cd wayland: Use an array initializer for the X server arguments
This fixes the unitialized array members introduced previously and
should avoid such mistakes again going forward.

https://bugzilla.gnome.org/show_bug.cgi?id=727011
2014-03-25 14:52:57 +01:00
Ray Strode
a55622d924 wayland: drop -logfile argument
It breaks testing wayland with setuid X server.
2014-03-24 14:18:49 -04:00
Jasper St. Pierre
0808adefaf Move focus to be a vfunc 2014-03-20 15:20:15 -04:00
Jasper St. Pierre
14f424cd02 Move ping to be a vfunc 2014-03-20 15:20:15 -04:00
Jasper St. Pierre
9debd2fb0d Move delete / kill to be a vfunc 2014-03-20 15:07:44 -04:00
Jasper St. Pierre
57359da9b4 wayland: Kill the buffer destroy error
Previously, a sequence like this would crash a client:

  => surface.attach(buffer)
  => buffer.destroy()

The correct behavior is to wait until we release the buffer before
destroying it.

  => surface.attach(buffer)
  => surface.attach(buffer2)
  <= buffer.release()
  => buffer.destroy()

The protocol upstream says that "the surface contents are undefined"
in a case like this. Personally, I think that this is broken behavior
and no client should ever do it, so I explicitly killed any client
that tried to do this.

But unfortunately, as we're all well aware, XWayland does this.
Rather than wait for XWayland to be fixed, let's just allow this.

Technically, since we always copy SHM buffers into GL textures, we
could release the buffer as soon as the Cogl texture is made.

Since we do this copy, the semantics we apply are that the texture is
"frozen" in time until another newer buffer is attached. For simple
clients that simply abort on exit and don't wait for the buffer event
anyhow, this has the added bonus that we'll get nice destroy animations.
2014-03-20 13:53:05 -04:00
Rui Matos
76dc0ca681 wayland: Exempt CLICKING grab ops when syncing wayland input focus
If we have a CLICKING grab op we still need to send events to xwayland
so that we get them back for gtk+ to process thus we can't steer
wayland input focus away from it.

https://bugzilla.gnome.org/show_bug.cgi?id=726123
2014-03-20 17:08:53 +01:00
Rui Matos
8968501031 wayland-seat: Don't send pointer enter/leave events during a GRAB_OP
meta_wayland_seat_repick() can be called in various cases while mutter
has a GRAB_OP ongoing which means we could be sending wrong pointer
enter/leave events.

https://bugzilla.gnome.org/show_bug.cgi?id=726123
2014-03-20 17:08:53 +01:00
Jasper St. Pierre
a53e094fcd window: Move move_resize_internal logic to protocol-specific directories 2014-03-20 11:02:50 -04:00
Jasper St. Pierre
a377a1a110 window: Move client-type-specific managing / unmanaging to a vfunc 2014-03-20 10:51:32 -04:00
Jasper St. Pierre
1c41f71eef window: Add a type for Wayland windows 2014-03-20 10:50:27 -04:00
Jasper St. Pierre
0eb86de807 Move Wayland protocols into src/wayland 2014-03-18 20:37:35 -04:00
Rui Matos
b3364cad3e wayland: Update keyboard state unconditionally
In particular we need to know about all key events to keep the xkb
state reliable even if the event is then consumed by a global shortcut
or grab and never reaches any wayland client.

We also need to keep track of all pressed keys at all times so that we
can send an updated set or pressed keys to the focused client when a
grab ends.

https://bugzilla.gnome.org/show_bug.cgi?id=722847
2014-03-18 19:15:17 +01:00
Rui Matos
3502cfba34 wayland-keyboard: Split out a function to determine the evdev keycode
We will need to use this is in another place on the next commit.

https://bugzilla.gnome.org/show_bug.cgi?id=722847
2014-03-18 19:15:17 +01:00
Rui Matos
5cc6becb63 wayland-keyboard: Make sure we send an updated modifiers event
Any given clutter event carries the modifier state as it was before it
occured but, for the wayland modifiers event, we want the state
including the current event.

To fix this, we'll keep our xkb_state instance around instead of the
serialized mods.

https://bugzilla.gnome.org/show_bug.cgi?id=722847
2014-03-18 19:15:17 +01:00
Jasper St. Pierre
ae8f21a3dc wayland-keyboard: Don't use our own tracking to detect autorepeat
Clutter already marks all autorepeat key events it as synthetic
key events. We can simply ignore these instead of relying on custom
key tracking code.
2014-03-18 19:15:17 +01:00
Rui Matos
62e45b6d5e wayland-pointer: Drop unused arg from focus grab interface method
https://bugzilla.gnome.org/show_bug.cgi?id=726123
2014-03-17 11:06:58 +01:00
Jasper St. Pierre
0f85986340 Add a META_MAXIMIZE_BOTH
Which has the value of META_MAXIMIZE_VERTICAL |
META_MAXIMIZE_HORIZONTAL.

This is an obvious code cleanup.
2014-03-15 09:49:56 -04:00
Jasper St. Pierre
93ac0329db weston-launch: Fix a typo causing mutter-launch to not work 2014-03-14 16:04:56 -04:00
Jasper St. Pierre
c539dfe0d7 weston-launch: Pass the DRM device to Cogl
Open the device from weston-launch, and pass it to Cogl/Clutter.
This is a preliminary cleanup for our login1 integration.
2014-03-14 14:13:05 -04:00
Jasper St. Pierre
a9d8107c3d window: Replace meta_window_type_changed with meta_window_set_type
Which does the equality checking for us.
2014-03-13 17:14:28 -04:00
Jasper St. Pierre
d1ea17e6a4 meta-weston-launch: Adapt to Clutter's new evdev open callback 2014-03-13 12:47:11 -04:00
Jasper St. Pierre
b37ad66e9d xdg-shell: Update for new state change mechanism
We're still not properly going through the request system. This
will require a dense investigation of the code, but it will happen
soon...
2014-03-12 23:42:55 -04:00
Matthias Clasen
c1f15348a5 Revert "weston-launch: Pass the DRM device to Cogl"
This reverts commit 857561baed.

This broke the build, and was pushed prematurely.
2014-03-12 14:48:46 -04:00
Jasper St. Pierre
857561baed weston-launch: Pass the DRM device to Cogl
Open the device from weston-launch, and pass it to Cogl/Clutter.
This is a preliminary cleanup for our login1 integration.
2014-03-11 18:01:21 -04:00
Jasper St. Pierre
a44cc9ef47 wayland: Fix build 2014-03-11 18:01:17 -04:00
Jasper St. Pierre
d47b7ba038 Add meta_activate_session
This will be used on startup to switch to the newly activated session.
2014-03-11 17:25:40 -04:00
Jasper St. Pierre
f21312e2fd meta-weston-launch: Redraw and update the cursor when switching back 2014-03-11 17:25:40 -04:00
Jasper St. Pierre
394af33607 weston-launch: Allow activating our own VT by passing a negative value
This will be used to implement activate_session.
2014-03-11 17:25:40 -04:00
Jasper St. Pierre
7314cdac94 weston-launch: Always use sd_session_get_vt 2014-03-11 17:25:40 -04:00
Jasper St. Pierre
81025e37ea weston-launch: Stat the path before opening it 2014-03-11 17:25:39 -04:00
Jasper St. Pierre
1bb9f1e333 weston-launch: Remove unused prototypes 2014-03-11 17:25:39 -04:00
Jasper St. Pierre
b11c75c1c9 weston-launch: Rearrange code slightly
We need to initialize the main loops before our callback is called, so
this makes it make a slight bit of more sense.
2014-03-11 17:25:39 -04:00
Jasper St. Pierre
757b626aee wayland: Add a few comments, rename some strings 2014-03-11 17:25:02 -04:00
Jasper St. Pierre
e34792d9f0 wayland: Remove needless indirection 2014-03-11 16:00:43 -04:00
Jasper St. Pierre
f397c32192 wayland: Make set_selection private
It's unused outside of us.
2014-03-11 15:42:37 -04:00
Jasper St. Pierre
f79314d7b5 wayland: Fix destroying data sources
The resource is not embedded in the source, it's separate. We need
to get the user data here to not crash.
2014-03-11 15:30:17 -04:00
Jasper St. Pierre
55c61259d8 wayland: Use g_slice_new0
And fix a leak.
2014-03-11 15:30:17 -04:00
Jasper St. Pierre
5298cf0a3a wayland: Pull in a fix for a FIXME from Weston 2014-03-11 15:30:17 -04:00
Jasper St. Pierre
f1dc1a0cbc wayland: Fix drag grabs
We need to have the seat here. This makes weston-dnd not crash when
clicking on an item.
2014-03-11 15:30:16 -04:00
Jasper St. Pierre
9df8e831be xwayland: Make sure to clear an existing surface if we have one
This fixes an assert fail when redecorating an X11 client.
2014-03-11 10:24:13 -04:00
Jasper St. Pierre
84c6b2a3fa wayland: Remove an extra reset
We already reset the double-buffered state when we commit it, so this
is just superfluous.
2014-03-11 10:24:13 -04:00
Jasper St. Pierre
06cd669ccb wayland: Fix bad copy-paste error in unset_fullscreen
This was causing memory corruption and a bad crasher with simple-egl.
2014-03-10 16:45:05 -04:00
Jasper St. Pierre
81eb7d9537 Add META_GRAB_OP_WAYLAND_CLIENT
Which is used for Wayland popup grabs.

The issue here is that we don't want the code that raises or focuses
windows based on mouse ops to run while a client has a grab.

We still keep the "old" grab infrastructure in place for now, but
ideally we'd replace it eventually with a better grab-op infrastructure.
2014-03-10 15:11:03 -04:00
Jasper St. Pierre
dd8d8e436d wayland: Remove special code for modal grabs
Since we never pass any Clutter events to Wayland, it's not needed.
2014-03-10 15:10:44 -04:00
Jasper St. Pierre
d6b6b363ad seat: Add support for smooth scrolling 2014-03-10 11:36:36 -04:00
Jasper St. Pierre
254e2e993c seat: Redo scroll handling
To make way for smooth scrolling
2014-03-10 11:36:36 -04:00
Jasper St. Pierre
c595a9c29f seat: Reduce indentation 2014-03-10 11:36:36 -04:00
Rui Matos
dfc7f7222b wayland-keyboard: Remove unused modifier indexes
This was copied from weston where they're used for compositor
keybindings. Mutter has its own keybindings code which doesn't need
this.

https://bugzilla.gnome.org/show_bug.cgi?id=722847
2014-03-07 15:00:04 +01:00
Jasper St. Pierre
ddc171220a wayland: Remove destroy listener
Do to a bad mixup, the surface listener was never actually fired.
This was accidentally fixed as part of a refactoring in a27fb19,
but the surface listener was broken, and we started crashing. To
fix, just remove the surface listener, as we've mostly been testing
without it.
2014-02-28 13:20:42 -05:00
Rui Matos
0313b38dd6 wayland: Don't try to disconnect the listener from the signal handler
This is not needed since the instance is being destroyed and in fact
actively harmful when code called from other handlers disconnects us
for other reasons. In that case we might crash because the
disconnection doesn't prevent other handlers from running in the
current signal emission and thus we try to remove ourselves from an
empty list.
2014-02-28 13:20:42 -05:00
Jasper St. Pierre
770b58b367 wayland: Move "public" Wayland API to another header file 2014-02-28 10:24:06 -05:00
Jasper St. Pierre
77838c2ca3 wayland: Do a giant code cleanup
This changes the user data of all surface extensions resources to be
the MetaWaylandSurface instead of the MetaWaylandSurfaceExtension,
which means that we no longer need all these pesky wl_container_ofs
in implementations.
2014-02-28 09:07:33 -05:00
Jasper St. Pierre
e56cbfbd0f wayland: Rearrange create_surface_extension a tiny bit
This moves all the "uninteresting" variables we pass to the end.
2014-02-28 09:07:33 -05:00
Jasper St. Pierre
a27fb19473 wayland: Do a small code cleanup
Pass the surface rather than the resource / client. This will become
a lot more helpful in the next commit.
2014-02-28 09:07:33 -05:00
Jasper St. Pierre
86c1c30245 wayland: Add back wl_shell support 2014-02-28 08:32:14 -05:00
Jasper St. Pierre
283546b379 wayland: Enable destroy animations for regular windows
Don't set the surface actor to a new buffer if it's becoming unmapped.
This is also technically wrong since we'll send out the release event,
but oh well.

We should probably decouple MetaWaylandBuffer from the CoglTexture
at some point, so we can send out releases on-demand.
2014-02-27 23:48:00 -05:00
Giovanni Campagna
45624f2edf MetaWindowActor: survive having no MetaSurfaceActor
We need a MetaWaylandSurface to build a MetaSurfaceActor, but
we don't have one until we get the set_window_xid() call from
XWayland. On the other hand, plugins expect to see the window
actor right from when the window is created, so we need this
empty state.

Based on a patch by Jasper St. Pierre.
2014-02-25 01:22:56 +01:00
Jasper St. Pierre
f0cd9b0687 wayland-surface: Rework construction / destruction yet again
This time, to make way for MetaSurfaceActorEmpty. This also fixes
destroy effects as a side effect. It still has issues if we try
to re-assign an actor that's already toplevel (e.g. somebody
re-popping up a menu that's already being destroyed), but this
will be fixed soon.

The idea here is that MetaWindowActor will do the unparenting of
the surface actor when it itself is destroyed. To prevent bad issues
with picking, we only make the surface actor reactive when it's
toplevel.
2014-02-24 14:46:19 -05:00
Jasper St. Pierre
1783bf20ec Revert "window: Delay the showing of XWayland clients until set_window_id"
This reverts commit 59c8b949ad.
2014-02-24 14:46:19 -05:00
Jasper St. Pierre
ff8c4b1bcf pointer/keyboard: Fix segfault once more
If the resource is destroyed before the surface, then we'll kill
ourselves. Why can I never seem to write these correctly...
2014-02-23 10:00:31 -05:00
Jasper St. Pierre
337c69e223 pointer/keyboard: Unset focus_resource when the surface is destroyed
focus_resource is supposed to be set only if focus_surface is
as well.
2014-02-22 18:15:53 -05:00
Jasper St. Pierre
83aca0b53d window-actor: Split into two subclasses of MetaSurfaceActor
The rendering logic before was somewhat complex. We had three independent
cases to take into account when doing rendering:

  * X11 compositor. In this case, we're a traditional X11 compositor,
    not a Wayland compositor. We use XCompositeNameWindowPixmap to get
    the backing pixmap for the window, and deal with the COMPOSITE
    extension messiness.

    In this case, meta_is_wayland_compositor() is FALSE.

  * Wayland clients. In this case, we're a Wayland compositor managing
    Wayland surfaces. The rendering for this is fairly straightforward,
    as Cogl handles most of the complexity with EGL and SHM buffers...
    Wayland clients give us the input and opaque regions through
    wl_surface.

    In this case, meta_is_wayland_compositor() is TRUE and
    priv->window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND.

  * XWayland clients. In this case, we're a Wayland compositor, like
    above, and XWayland hands us Wayland surfaces. XWayland handles
    the COMPOSITE extension messiness for us, and hands us a buffer
    like any other Wayland client. We have to fetch the input and
    opaque regions from the X11 window ourselves.

    In this case, meta_is_wayland_compositor() is TRUE and
    priv->window->client_type == META_WINDOW_CLIENT_TYPE_X11.

We now split the rendering logic into two subclasses, which are:

  * MetaSurfaceActorX11, which handles the X11 compositor case, in that
    it uses XCompositeNameWindowPixmap to get the backing pixmap, and
    deal with all the COMPOSITE extension messiness.

  * MetaSurfaceActorWayland, which handles the Wayland compositor case
    for both native Wayland clients and XWayland clients. XWayland handles
    COMPOSITE for us, and handles pushing a surface over through the
    xf86-video-wayland DDX.

Frame sync is still in MetaWindowActor, as it needs to work for both the
X11 compositor and XWayland client cases. When Wayland's video display
protocol lands, this will need to be significantly overhauled, as it would
have to work for any wl_surface, including subsurfaces, so we would need
surface-level discretion.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-20 14:44:31 -05:00
Jasper St. Pierre
7ebf5aa69a pointer/keyboard: Properly handle destruction
If the client destroys the pointer resource, we shouldn't unfocus the
surface, and we should regrab it when the client gets the pointer
resource again.

This also fixes a crash at surface destruction because of the unchecked
wl_link_remove that will happen on both pointer and surface destroy.
2014-02-20 11:35:01 -05:00
Marek Chalupa
17462c21e8 pointer/keyboard: fix setting focus
Set focus to NULL after using the variable
2014-02-19 10:24:36 -05:00
Jasper St. Pierre
48f7232492 pointer: Don't send modifiers on mouse enter
I talked to Kristian about this. It should be enough to simply
send it when we activate the surface and give it keyboard focus.
2014-02-18 23:21:06 -05:00
Jasper St. Pierre
ff5867e4d3 pointer: Make the code here a bit clearer 2014-02-18 23:21:06 -05:00
Jasper St. Pierre
a5d950f453 pointer/keyboard: Fix focus setting once again
Yet another large-scale restructuring... this is some messy code.
2014-02-18 23:21:06 -05:00
Jasper St. Pierre
7615d17293 wayland: Tie activate / deactivate to appears-focused
... rather than actual focus. This makes things behave better.
2014-02-18 23:21:06 -05:00
Jasper St. Pierre
374e30043b wayland: Remove width / height from MetaWaylandBuffer
They're in the texture.
2014-02-18 22:43:24 -05:00
Jasper St. Pierre
f771bb88d6 Revert "wayland: Explicitly destroy the surface actor"
This reverts commit 283a81eac0.

This can't be done yet, as it will crash when we try to do a destroy
effect from a plugin. The surface actor needs to outlive the surface
in this case.

Though, the unparenting happening is wrong anyway for a destroy effect.
We need to figure out a sane way of doing this unparenting only after
all effects have finished.
2014-02-18 22:23:08 -05:00
Jasper St. Pierre
7ef8d21e48 wayland: Allow destroying the wl_surface before the xdg_surface
As resource destruction can happen in any order at shutdown, we
need to be flexible here. A client disconnecting without cleaning
up all its resources should not assert fail.
2014-02-18 22:21:33 -05:00
Jasper St. Pierre
1e6b3faa83 Fix the input region not working properly
The input region was set on the shaped texture, but the shaped texture
was never picked properly, as it was never set to be reactive. Move the
pick implementation and reactivity to the MetaSurfaceActor, and update
the code everywhere else to expect a MetaSurfaceActor.
2014-02-18 21:29:23 -05:00
Jasper St. Pierre
00c8d3c897 xdg-shell: Update to latest renames for focused_set / focused_unset 2014-02-18 19:02:17 -05:00
Jasper St. Pierre
cc13f8f65e wayland: Fix compile error
I tested this with meta_window_get_input_rect and decided to change
it at the last minute. Turns out meta_window_get_rect is unlike all
the others. Just access window->rect directly instead.
2014-02-18 19:01:50 -05:00
Jasper St. Pierre
47f4c9db7b wayland-surface: Correct xdg_popup placement
Now that we call set_custom_frame_extents, the frame rect corresponds
to the "visible window geometry" used for constrainment, while the
x/y fields in get_xdg_popup instead are relative to the surface.
2014-02-18 18:55:54 -05:00
Jasper St. Pierre
4c621cc30f pointer/keyboard: Make sure to clean up the destroy listeners when releasing 2014-02-18 18:39:19 -05:00
Jasper St. Pierre
756a412436 pointer: Make nested grabs work
Something noticed on code inspection. If we have a popup grab,
it will always return FALSE. The code here clearly meant to continue
if we had an existing popup grab from an existing client.
2014-02-18 18:06:55 -05:00
Jasper St. Pierre
be16c2fe71 pointer: Reindent 2014-02-18 18:06:17 -05:00
Jasper St. Pierre
a364c2a96b pointer/keyboard: Make sure not to get stale on client resources as well
Both the pointer/keyboard resource and surface resource can be destroyed
at any point in the destruction process, so we need to have destroy
listeners on both. To make the code easier to follow, rename ->focus
to ->focus_surface at the same time, and rearrange the code so that
the two of them are always grouped together.
2014-02-18 18:03:31 -05:00
Jasper St. Pierre
414259a7f8 wayland: Fix cast warning
It's sometimes hard to see around all the deprecation warnings. Sorry
about that...
2014-02-18 17:26:03 -05:00
Jasper St. Pierre
283a81eac0 wayland: Explicitly destroy the surface actor
This shouldn't change anything right now, but it's better to be
careful than anything else. This is where the actor should be
destroyed.
2014-02-18 17:07:36 -05:00
Jasper St. Pierre
2a145262c7 wayland: Rework how surface destruction works
To prevent the MetaSurfaceActor from being destroyed, we normally
unparent it before we unmanage the window. However, this doesn't
work for XWayland windows, which we unmanage when we get UnmapNotify
or DestroyNotify, not when we get the wl_surface_destroy.

To solve this, add an early hook in meta_window_unmanage that
unparents the surface actor if we have one. At the same time, clean
up the destruction code to remove old comments and assumptions about
how wl_shell behaves.
2014-02-18 17:01:33 -05:00
Jasper St. Pierre
ef24fb6296 wayland: Don't use WESTON_LAUNCHER_SOCK
We can simply check the windowing backend.
2014-02-17 21:50:32 -05:00
Jasper St. Pierre
dcd628d289 wayland: Kill meta_wayland_compositor_is_native
It's unused. Squash the remaining functionality, setting the DRM FD,
into the main path.
2014-02-17 21:15:31 -05:00
Jasper St. Pierre
304a525744 wayland: Remove is_native from seat
We can easily do this with a Clutter backend check instead...
2014-02-17 20:49:04 -05:00
Jasper St. Pierre
b65649186d pointer/keyboard: Put the destroy listener on the right resource
We care about when the surface is destroyed, not when the wl_pointer
slash wl_keyboard resource is destroyed.
2014-02-17 19:22:30 -05:00
Jasper St. Pierre
515dc08a97 pointer/keyboard: Do a series of renames to our listener as well 2014-02-17 19:22:30 -05:00
Jasper St. Pierre
2e7a56a28f wayland: Rename resource_destroy_cb to wl_surface_destructor
So it doesn't seem like a wl_listener callback.
2014-02-17 19:22:30 -05:00
Jasper St. Pierre
f9f2a82e18 xwayland: Don't -retro
This means we see black instead of checkerboard for now when resizing,
but that's better.
2014-02-17 17:57:40 -05:00
Jasper St. Pierre
d39baeb8ad wayland-surface: Destroy the right thing
data is the wl_client, which we don't want to destroy. Destroy
our XdgShell pointer instead.
2014-02-17 12:53:56 -05:00
Jasper St. Pierre
f27f6aab78 Update to new xdg-shell pinging standards 2014-02-16 10:21:22 -05:00
Jasper St. Pierre
a66060e21a Revert "Move window pings to MetaWindow"
This was a bad idea, as ping/pong has moved to a client-specific
request/event pair, rather than a surface-specific one. Revert
the changes we made here and correct the code to make up for it.

This reverts commit aa3643cdde.
2014-02-16 10:21:22 -05:00
Jasper St. Pierre
11aa3c030b wayland-surface: Don't require we manually bump the version for xdg-shell
It's in the protocol as an enum.
2014-02-16 10:21:22 -05:00
Jasper St. Pierre
bd1bec5617 wayland-surface: Prefix xdg-shell methods with "xdg_shell_" 2014-02-16 10:21:22 -05:00
Adel Gadllah
d9659d4b36 wayland-surface: Don't crash when someone tries to run a native app using old gtk
This ends up calling set_dbus_properties with a NULL
window, instead of segfaulting the compositor return so that the broken
app dies instead.

https://bugzilla.gnome.org/show_bug.cgi?id=724472
2014-02-16 16:19:23 +01:00
Jasper St. Pierre
f16e9b2ee7 wayland-surface: Make set_margin double-buffered as well 2014-02-10 14:16:06 -05:00
Jasper St. Pierre
06380938d4 wayland-surface: Make set_fullscreen / set_maximized and friends double-buffered 2014-02-09 18:23:39 -05:00
Jasper St. Pierre
def5e86673 wayland: Add support for the set_margin request 2014-02-07 19:28:36 -05:00
Jasper St. Pierre
0c213c8fee wayland: Add support for the delete event 2014-02-07 19:28:36 -05:00
Jasper St. Pierre
912a0abd26 wayland: Remove edges
This is an upstream change to xdg-shell.
2014-02-07 19:28:36 -05:00
Jasper St. Pierre
d694260ad2 xwayland: Fix xwayland
Don't give us a freed pointer here.
2014-02-07 19:28:05 -05:00
Jasper St. Pierre
8566566451 xwayland: Split out the XWayland stuff into its own private struct 2014-02-07 16:21:27 -05:00
Jasper St. Pierre
f6db756326 shaped-texture: Move unobscured_region processing here
We want to remove a bunch of auxilliary duties from the MetaWindowActor
and MetaSurfaceActor, including some details of how culling is done.
Move the unobscured region culling code to the MetaShapedTexture, which
helps the actor become "more independent".

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-05 14:42:38 -05:00
Jasper St. Pierre
3e98ffaf99 wayland-surface: Don't crash if a client destroys a buffer in use
This is considered "undefined" by upstream. Right now GTK+ does this
a lot, so we shouldn't crash. Let's make them crash instead and send
them an error instead.
2014-02-03 18:36:46 -05:00
Jasper St. Pierre
7e7b671b8e keybindings: Simplify interface for VT switching 2014-02-01 19:38:01 -05:00
Jasper St. Pierre
8905bd2280 window-x11: Move meta_window_new to window-x11.c and rename 2014-02-01 19:19:22 -05:00
Jasper St. Pierre
59c8b949ad window: Delay the showing of XWayland clients until set_window_id
Use our new "surface_mapped" field to delay the showing of XWayland clients
until we have associated together the window's XID and the Wayland surface ID.

This ensures that when we show this window to the compositor, it will properly
use the Wayland surface for rendering, rather than trying to use COMPOSITE and
crash.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 19:18:01 -05:00
Jasper St. Pierre
2f6f0f252c wayland: Simply store a MetaWaylandBuffer
There's no need for the MetaWaylandBufferReference abstraction...
2014-02-01 17:55:16 -05:00
Jasper St. Pierre
13651949ed wayland-seat: Rename sprite to cursor_surface 2014-02-01 17:55:03 -05:00
Jasper St. Pierre
fdeb72224c wayland-seat: Fix pointer issues
Moving the mouse over weston-terminal, we can see several issues:

 * it often updates late, or not at all
 * the attachment of the pointer sprite is wrong

These are because we willy-nilly call seat_update_sprite all over the
place, and often in wrong areas. Set up a set_pointer_surface helper
method that will do the right thing for us in all cases, and call it
on transitions.
2014-02-01 17:54:47 -05:00
Jasper St. Pierre
92e36e7076 wayland-surface: Attach the buffer to a surface, even if it doesn't have a role
Currently, set_cursor isn't properly working. Often, the requests look
like this:

  cursor_surface = wl_compositor.create_surface()
  cursor_buffer = create_cursor_buffer()
  cursor_surface.attach(cursor_buffer, 0, 0)
  cursor_surface.commit()
  wl_pointer.set_cursor(cursor_surface, 7, 14)

But since the surface doesn't "have a role" when the commit comes in,
we ignore it, and don't do anything with the pending buffer. When
set_cursor is called, however, we don't immediately update anything
since it doesn't have a buffer.

This effectively means that set_cursor has unpredictable side effects.
Weston's toy toolkit reuses the same surface for every buffer, so it
only fails the first time. In clients that use a new surface for every
cursor sprite, the cursor is effectively invisible.

To solve this, change the code to always set the buffer for a surface,
even if it doesn't have any real role.
2014-02-01 17:24:13 -05:00
Jasper St. Pierre
d74796ee80 wayland-surface: Use the same commit() when commiting subsurface
Refactor our commit() implementation out of wl_surface_commit(),
and pass the double-buffered state around to all our implementation
methods. This allows us to drop a few lines destroying and
reinitializing list of frame callbacks. This is a big cleanup for
the next commit, though.
2014-02-01 16:44:18 -05:00
Jasper St. Pierre
3e35cac67a wayland-surface: Repick after cleaning up everything else
Just a code cleanup to keep all the freeing code together.
2014-02-01 16:29:36 -05:00
Jasper St. Pierre
1f7a6bf845 wayland-surface: Don't clean up the buffer_destroy_listener twice
double_buffered_state_destroy will do this for us.
2014-02-01 16:29:09 -05:00
Jasper St. Pierre
365442c1ff wayland-surface: Fix typo 2014-02-01 16:19:54 -05:00
Jasper St. Pierre
9567fa9c6a wayland: Check for launcher before freeing it
This prevents a segfault on shutdown.
2014-01-31 19:03:56 -05:00
Jasper St. Pierre
7a8de0c0af wayland: Reindent 2014-01-31 19:03:56 -05:00
Jasper St. Pierre
10fead9ba1 wayland-pointer: Fix infinite loop when leaving focus from a destroyed surface
To prevent corruption, our focus listener needs to be removed even when
the surface is destroyed. So, bailing out when pointer->focus->resource
is NULL just isn't good enough.
2014-01-31 18:21:04 -05:00
Jasper St. Pierre
a09fa3b0e4 wayland: Clean up the parallels between creating callbacks and surface extensions 2014-01-31 16:40:47 -05:00
Jasper St. Pierre
9edff6f250 wayland: Use wl_callback_send_done
For no specific reason...
2014-01-31 16:40:47 -05:00
Jasper St. Pierre
225e20a898 wayland: Remove superfluous "wayland_" from arguments 2014-01-31 11:38:37 -05:00
Jasper St. Pierre
1a62ac9276 xwayland: Shuffle some code around 2014-01-31 11:24:02 -05:00
Jonas Ådahl
4f4b1bfc37 wayland: Support wl_subsurface.set_sync/set_desync
Implement support for synchronous subsurfaces commits. This means that
the client can, by calling wl_subsurface.set_sync, cause its surface
state to be commited not until its parent commits.

This will mean there will be will potentially be one more surface state
(regions, buffer) at the same time: the active surface state, the mutable
pending surface state, and the immutable surface state that was pending
on last surface commit.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=705502
2014-01-30 15:13:44 -05:00
Jonas Ådahl
9348c9bd4b wayland: Make wl_subsurface.place_(above|below) properly synchronized
The placement set by either wl_subsurface.place_above or
wl_subsurface.place_below should be applied when the parent surface
invokes wl_surface.commit.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=705502
2014-01-30 15:13:43 -05:00
Jonas Ådahl
16de7f66fb wayland: Make wl_subsurface.set_position properly synchronized
The position set by wl_subsurface.set_position should be applied when
the parent surface invokes wl_surface.commit.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=705502
2014-01-30 19:12:06 +01:00
Jonas Ådahl
799c27484d wayland: Report error when trying to stack subsurface incorrectly
Don't allow a client to stack a subsurface next to a subsurface with
another parent, or to a non-parent non-subsurface surface.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=705502
2014-01-30 19:12:06 +01:00
Jasper St. Pierre
9c876722a0 xwayland: Use server protocol wrappers instead of wl_resource_post_event 2014-01-29 10:27:16 -05:00
Jasper St. Pierre
96fc93d744 xwayland: Reindent 2014-01-29 10:23:58 -05:00
Jasper St. Pierre
20545941fa Revert unintentional merge from wip/surface-content to wayland
This reverts a lot of commits.
2014-01-22 09:18:13 -05:00
Jasper St. Pierre
ac32b9ef95 get xwayland working again 2014-01-21 19:06:06 -05:00
Jasper St. Pierre
e6391c2896 surface content 2014-01-21 19:01:34 -05:00
Jasper St. Pierre
a0fe392665 surface-actor: Move unobscured_region processing here
https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-01-21 19:01:34 -05:00
Jasper St. Pierre
8cb9cfb7b8 Revert "meta-weston-launch: Call VT_ACTIVATE ourselves"
This reverts commit ebe6e3180e.

This is wrong, as mutter's controlling TTY may not be the same
as the active VT, and in fact won't be in the case of systemd
spawning us.

The "correct" API for this is to use David Herrmann's
"Session Positions" system to switch to another VT:

  http://lists.freedesktop.org/archives/systemd-devel/2013-December/014956.html
2014-01-16 13:42:07 -05:00
Jasper St. Pierre
002c5b8f87 wayland: Don't keep track of the drm FD in the WaylandCompositor
As logind can give us a new FD at any time when it resumes. Theoretically,
this is still technically wrong, as the MetaCursorTracker holds onto it.
We'll fix this after we port to logind.
2013-12-31 19:22:16 -05:00
Jasper St. Pierre
1d3dbea20c meta-weston-launch: Don't use a GObject here
We don't need a complicated API anymore.
2013-12-31 19:22:16 -05:00
Jasper St. Pierre
ebe6e3180e meta-weston-launch: Call VT_ACTIVATE ourselves
We don't need any special permissions, so we don't need to go through
weston-launch to do so...
2013-12-31 19:22:16 -05:00
Jasper St. Pierre
a3de799939 wayland-surface: Remove inappropriate meta-weston-launch.h include 2013-12-31 19:20:58 -05:00
Jasper St. Pierre
7009d1e470 wayland: Update to latest xdg-shell
We don't use the new maximize / fullscreen request system yet, leading
to broken maximization / fullscreen. This will be fixed in a followup.
2013-12-17 15:04:16 -05:00
Jasper St. Pierre
fd8cc9b7a8 xwayland: Remove outdated code
Now that focus management goes through the central display.c,
we don't need to do this separately. Wayland and X clients
should just behave as one.
2013-12-09 13:57:32 -05:00
Jasper St. Pierre
65b39212d5 meta-wayland: Remove undefined variable 2013-12-05 18:32:11 -05:00
Jasper St. Pierre
283649b8d7 Support keybindings again, too 2013-12-05 17:18:49 -05:00
Jasper St. Pierre
1be117e430 wayland-surface: Properly set the window type
We need to make sure to call meta_window_type_changed after updating
the type...
2013-12-04 10:41:58 -05:00
Jasper St. Pierre
0924c7d61b wayland: Use a stage paint callback instead of a signal handler on "paint"
This is much more appropriate...
2013-12-03 14:49:40 -05:00
Jasper St. Pierre
fe26cb5989 wayland-surface: Unmanage the window when destroying xdg_surface/xdg_popup
Also, unparent the actor when destroying a subsurface, as well, and
don't free the surface when we destroy the MetaWindow.
2013-12-03 11:45:50 -05:00
Jasper St. Pierre
602307e694 Revert "pointer: Remove focus listener"
This reverts commit a8ac2cc275.
2013-12-03 11:45:50 -05:00
Jasper St. Pierre
b2c18c4a78 Revert "keyboard: Remove focus listener"
This reverts commit 0ac142d39e.
2013-12-03 11:45:50 -05:00
Jasper St. Pierre
1e211722c7 wayland-surface: Set popups transient to their parents 2013-12-03 11:45:50 -05:00
Rui Matos
461f74ef18 wayland: Fix setting keyboard/pointer focus for new clients
When we have a new client, we potentially set the focus on one of its
surfaces when we map it but the client might not have called
wl_seat.get_keyboard/pointer yet. When it finally calls
get_keyboard/pointer we must then register its resource as the
focus_resource which means that we can only return early if
focus_resource is already set.

https://bugzilla.gnome.org/show_bug.cgi?id=719725
2013-12-03 15:56:15 +01:00
Rui Matos
20e92c5a72 wayland: Set the clutter stage focus when we focus a window
Otherwise clutter events don't have their source actor properly set
and we aren't able to determine the MetaWindow to which a given
keybinding applies.

https://bugzilla.gnome.org/show_bug.cgi?id=719724
2013-12-03 13:58:27 +01:00
Jasper St. Pierre
d44574f738 wayland-surface: Process damage even if the buffer didn't change 2013-11-26 12:32:41 -05:00
Jasper St. Pierre
a9424255a5 wayland-surface: Add support for subsurfaces
The state for a subsurface isn't double-buffered yet, though...
2013-11-25 18:33:03 -05:00
Jasper St. Pierre
5089a63d76 wayland-surface: Create the surface actor ourselves
Otherwise, we can't rely on a surface_actor being around to add
ourselves to...
2013-11-25 18:29:58 -05:00
Jasper St. Pierre
f9a2c64460 wayland-surface: Don't require a MetaWindow to process damage...
and ClutterActor will clip to the actor bounds, anyway...
2013-11-25 18:15:20 -05:00
Jasper St. Pierre
7841042a85 wayland-surface: Restructure code flow in wl_surface_attach a bit more... 2013-11-25 18:15:20 -05:00
Jasper St. Pierre
ea1b8cdc22 wayland-surface: Fix copy/paste typo 2013-11-25 18:15:19 -05:00
Jasper St. Pierre
52b48cfbef wayland-surface: Return after posting errors back to the client 2013-11-25 18:15:03 -05:00
Jasper St. Pierre
304005e04f wayland-surface: Replace MetaWindowActor with MetaSurfaceActor
Since subsurfaces won't have toplevel MetaWindowActors, we need to
use MetaSurfaceActor instead. These are embedded in the MetaWindowActor,
just like MetaShapedTexture was (in fact, MetaSurfaceActor now contains
a MetaShapedTexture)
2013-11-25 17:25:55 -05:00
Jasper St. Pierre
0ccef81789 wayland-surface: Rework flow control for wl_surface_commit 2013-11-25 17:25:46 -05:00
Jasper St. Pierre
4780f74a40 wayland-surface: Properly allow setting the cursor to a NULL buffer 2013-11-25 17:18:22 -05:00
Jasper St. Pierre
57866fb267 wayland-surface: Don't rewrite input/opaque regions if the client doesn't attach any 2013-11-25 17:18:22 -05:00
Jasper St. Pierre
6d639ac528 window: Support pinging Wayland surfaces as well 2013-11-21 14:24:04 -05:00
Rui Matos
8a3501ffe1 xwayland: Fix a couple of small leaks
https://bugzilla.gnome.org/show_bug.cgi?id=712833
2013-11-21 19:22:26 +01:00
Jasper St. Pierre
a37a8c6497 wayland-surface: Fix transient_for
It takes a wl_surface resource, not an xdg_shell_surface resource,
and the argument is allowed to be NULL.
2013-11-21 13:09:21 -05:00
Jasper St. Pierre
ebf6862a10 wayland-surface: Don't mark popup windows as override-redirect 2013-11-21 13:09:21 -05:00
Jasper St. Pierre
1c0e6f26e2 mutter-launch: Don't test the argument name to validate launching things
Somebody could do:

  $ mv my-evil-program mutter-wayland
  $ PATH=.:$PATH mutter-launch mutter-wayland

It's not secure, and it's hard to test with, so just drop it for now
We'll be relying on logind to hand us permissions in the future.
2013-11-20 17:07:03 -05:00
Jasper St. Pierre
f4fc498e65 wayland-surface: Properly destroy extension resources on the destroy request
Otherwise, the resource IDs will linger around and be destroyed again
on client close...
2013-11-19 23:34:03 -05:00
Jasper St. Pierre
a8632c2546 Revert "wayland-surface: Allow extension resources to be double-destroyed"
This reverts commit 2ebecc5370.
2013-11-19 23:34:03 -05:00
Jasper St. Pierre
600a0f836f keyboard: Don't send leave events to dying surfaces 2013-11-19 20:26:28 -05:00
Jasper St. Pierre
0ac142d39e keyboard: Remove focus listener 2013-11-19 20:26:28 -05:00
Jasper St. Pierre
abd368be00 pointer: Don't send leave events to dying surfaces
It's invalid and will crash the client.
2013-11-19 20:26:03 -05:00
Jasper St. Pierre
a8ac2cc275 pointer: Remove focus listener
It's added too late to matter -- by the time we've destroyed the
resource, we've already repicked and re-set the focus.
2013-11-19 20:26:03 -05:00
Jasper St. Pierre
2f14b5cc3f wayland: Set a log handler
To see error messages and such
2013-11-19 20:26:02 -05:00
Jasper St. Pierre
2930612e64 pointer: Remove dead and incorrect code
Now that we can never pick a destroying actor, we can remove these
bad asserts.
2013-11-19 19:35:34 -05:00
Jasper St. Pierre
2ebecc5370 wayland-surface: Allow extension resources to be double-destroyed
As they will be on shutdown... I'm not sure if this is a wayland-server
bug or not, but we should guard against it anyway.
2013-11-19 19:35:34 -05:00
Jasper St. Pierre
02144d17e9 wayland-surface: Fill in the maximized/fullscreen hints to the configure event 2013-11-19 19:35:34 -05:00
Jasper St. Pierre
594b15abf1 pointer: Fix crash when we have the pointer over nothing during a popup grab 2013-11-19 18:51:30 -05:00
Jasper St. Pierre
bbe3641844 wayland-surface: Add support for xdg_popup 2013-11-19 18:44:21 -05:00
Jasper St. Pierre
0cc5cf940b wayland-surface: Remove some properties from the double-buffered state
Now that we can always set them on the MetaWindow...
2013-11-19 18:44:21 -05:00