1
0
Fork 0
Commit graph

840 commits

Author SHA1 Message Date
Carlos Garnacho
935d76ba04 wayland: Implement wl_pointer.axis_source/axis_stop/axis_frame emission
As per the spec:
- wl_pointer.axis_source determines the current source of
  scroll events.
- wl_pointer.axis_stop determines when there's no further
  scroll events on the given axis.
- wl_pointer.axis_discrete is emitted on "wheel"
  scroll sources, measured in ticks.
- wl_pointer.frame is meant to coalesce events that logically belong
  together, e.g. axis events in this case.

Co-Authored-By: Peter Hutterer <peter.hutterer@who-t.net>

https://bugzilla.gnome.org/show_bug.cgi?id=760637
2016-01-14 19:27:48 +01:00
Florian Müllner
3aea8d8ce6 Revert "Add "size states" which save window size information"
This reverts commit 2c7ef2269f.
2016-01-10 15:16:09 +01:00
Jasper St. Pierre
2c7ef2269f Add "size states" which save window size information
https://bugzilla.gnome.org/show_bug.cgi?id=751857
2016-01-09 18:08:35 -08:00
Marek Chalupa
49ea6486e2 wayland: bind wayland socket after xwayland is initialized
During xwayland initialization we run main loop and dispatch wayland
events, so that xwayland can initialize. If some client during this
phase connects and creates surface, mutter crashes because
it is not initialized yet. If we bind wayland socket after xwayland
is initialized and main loop is not running anymore, no client can
connect to mutter during initialization and that is what we want.

https://bugzilla.gnome.org/show_bug.cgi?id=751845
2015-12-15 15:49:13 +01:00
Jasper St. Pierre
91ac69382d wayland: Fix up touch coordinates on HiDPI 2015-12-14 14:52:23 -08:00
Jonas Ådahl
428c687b5a wayland: Clean up wl_pointer_send_enter/leave code
Be consistent and always use a helper, and fix the naming so
broadcast means to actually broadcast.

https://bugzilla.gnome.org/show_bug.cgi?id=755503
2015-12-03 16:11:37 +08:00
Jonas Ådahl
be5643cee7 wayland: Use xdg shell protocol from wayland-protocols
Use the xdg_shell XML file installed by wayland-protocols instead of
our own copy. This protocol has yet to go through any unstable naming,
but since we had an outdated (though wire compatible) version, some
minor changes were needed.

https://bugzilla.gnome.org/show_bug.cgi?id=758633
2015-11-26 16:55:35 +08:00
Jonas Ådahl
2ee1c5fa61 wayland: Use pointer gestures protocol from wayand-protocols
Remove our own copy of the pointer gestures protocol, and us the one
installed by wayland-protocols. This also means the new fixed unstable
naming conventions are used for the new version of the protocol, which
is reflected in the change. No functional changes were made, it is only
a rename.

https://bugzilla.gnome.org/show_bug.cgi?id=758633
2015-11-26 16:55:35 +08:00
Carlos Garnacho
3078f70f90 wayland: Fetch keyboard event codes from ClutterEvents
When running as a native compositor, we can just do that. However, the
previous code must stay for whenever it's run as a X11 client.

https://bugzilla.gnome.org/show_bug.cgi?id=758239
2015-11-25 18:00:36 +01:00
Carlos Garnacho
7309b20c25 wayland: Fetch pointer button event codes from the ClutterEvent
When running as a native compositor, we can just do that. However, the
previous code must stay for whenever it's run as a X11 client.

Additionally, the fallback switch{} that transforms clutter 1-indexed
buttons into input.h event codes had to be adapted to the change introduced
in clutter commit 83b738c0e, where the 4-7 button range is kept clear for
compatibility with the X11 backend.

https://bugzilla.gnome.org/show_bug.cgi?id=758239
2015-11-25 17:56:51 +01:00
Daniel Stone
c16a5ec1cf KMS/Wayland: Correct refresh rate units
On the wire, Wayland specifies the refresh rate in milliHz. Mutter sends
the refresh rate in Hz, which confuses clients, e.g. weston-info:
interface: 'wl_output', version: 2, name: 4
	mode:
		width: 2560 px, height: 1440 px, refresh: 0 Hz,
		flags: current preferred
interface: 'wl_output', version: 2, name: 5
	mode:
		width: 3200 px, height: 1800 px, refresh: 0 Hz,
		flags: current preferred

and xrandr:
XWAYLAND0 connected 2560x1440+3200+0 600mm x 340mm
   2560x1440@0.1Hz   0.05*+
XWAYLAND1 connected 3200x1800+0+0 290mm x 170mm
   3200x1800@0.1Hz   0.03*+

Export the refresh rate in the correct units. For improved precision,
perform the KMS intermediate calculations in milliHz as well, and
account for interlaced/doublescan modes.

This is also consistent with what GTK+ expects:
      timings->refresh_interval = 16667; /* default to 1/60th of a second */

      /* We pick a random output out of the outputs that the window touches
       * The rate here is in milli-hertz */
      int refresh_rate = _gdk_wayland_screen_get_output_refresh_rate (wayland_display->screen,
                                                                      impl->outputs->data);
      if (refresh_rate != 0)
        timings->refresh_interval = G_GINT64_CONSTANT(1000000000) / refresh_rate;

Where the 'refresh_rate' given is exactly what's come off the wire.
1000000000/60000 comes out as 16667, whereas divided by 60 is ...
substantially less.

https://bugzilla.gnome.org/show_bug.cgi?id=758653
2015-11-25 15:35:25 +01:00
Giovanni Campagna
a4f763ac3b wayland-surface: disconnect signals on destroy
Otherwise signal handlers will be called on garbage

https://bugzilla.gnome.org/show_bug.cgi?id=756548
2015-10-19 17:21:59 -07:00
Carlos Garnacho
a5d2555196 wayland: Make it possible to trigger popups through pointer/keyboard/touch
Right now we just check the pointer serial, so the popup will be
immediately dismissed if the client passes a serial corresponding to
another input device.

Abstract this a bit further and add a meta_wayland_seat_can_popup() call
that will check the serial all input devices. This makes it possible to
trigger menus through touch or keyboard devices.

https://bugzilla.gnome.org/show_bug.cgi?id=756296
2015-10-17 18:52:52 +02:00
Carlos Garnacho
dd5a4ecdf9 wayland: Store key press/release serials on MetaWaylandKeyboard
https://bugzilla.gnome.org/show_bug.cgi?id=756296
2015-10-17 18:52:15 +02:00
Jonas Ådahl
d6d377a447 wayland: Set the xdg_popup pointer even when not mapping
If we immediately dismiss the popup, we still need to set the
surface->xdg_popup pointer field in order for the destructor to
properly clean up the state. Not doing this may cause a crash if the
xdg_popup resource that was immediately dismissed is destoryed after
wl_surface during client destruction.

https://bugzilla.gnome.org/show_bug.cgi?id=756675
2015-10-16 11:31:51 +08:00
Jonas Ådahl
e84f694668 wayland: Don't scale XWayland pointer cursor sprites
We don't have any way of knowing what the intended size of a XWayland
cursor is supposed to be, so lets do what we do with regular XWayland
surfaces and don't scale them. The result is that cursor sprites of
HiDPI aware X11 clients will show correctly, but non-aware clients may
have tiny cursor sprites.

https://bugzilla.gnome.org/show_bug.cgi?id=755099
2015-10-04 14:17:14 +08:00
Carlos Garnacho
b18542f2b6 wayland: Avoid resending new data offers on intra-client focus changes
Each keyboard focus change ends up calling the MetaWaylandDataDevice
counterpart, we don't need though to notify the current selection
again. In order to fix this, keep track of the current client, and
only emit the relevant signals when the focus switches to another
client.

The situations where wl_data_device.selection were emitted during
focus changes between surfaces of the same client was inocuous most
of the times, although it's prone to inducing confusing behavior
on context menu clipboard actions, as the closing menu triggers a
focus change, which triggers a whole new wl_data_offer being created
and given on wl_data_device.selection, at a time where there's already
ongoing requests on the previous data offer.

https://bugzilla.gnome.org/show_bug.cgi?id=754357
2015-10-02 12:21:17 +02:00
Carlos Garnacho
da0aac665f xwayland: Protect against crash on x11->wayland transfer cancellation
If the transfer is cancelled, the X11SelectionData will be cleared from
the MetaSelectionBridge, although x11_data_write_cb() was invariably
expecting it to be non-NULL.

If the write was cancelled, all the actions done in x11_data_write_cb()
are moot, so just return early. If there's other errors happening
(eg. "connection closed" if the target client happens to crash), we
should still attempt at clearing the data anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=754357
2015-10-02 12:21:17 +02:00
Jonas Ådahl
8b0b0cf028 MetaWaylandSurface: Don't assume a toplevel always have a MetaWindow
When committing a toplevel surface we might no longer have a MetaWindow
associated with it. The reason may vary but some are: a popup was
dismissed, the client attached and committed a NULL buffer to a
wl_surface with the wl_shell_surface role, the client committed a
buffer to a wl_surface which previously had an toplevel window role
which extension object was destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=755490
2015-09-29 09:09:57 +08:00
Carlos Garnacho
6f64d6b0aa wayland: Check the drag focus before processing XDND dest-side messages
If the drag dest surface suddenly disappears, we may find ourselves
processing an XdndPosition message that was sent before the X11 drag
source had an opportunity to find out.

In that case mutter does know, so double check before processing the
messages.
2015-09-28 16:22:54 +02:00
Carlos Garnacho
ebeca983c7 wayland: Improve transformation of the UTF8_STRING atom to mimetype
We try to translate the atom with its corresponding mimetype both back
and forth, which actually breaks if the X11 client chose to announce the
mimetype atom. To do the translation properly, keep track on whether the
source announced the UTF8_STRING atom, and reply back with this only if
that happened.
2015-09-28 16:22:43 +02:00
Carlos Garnacho
cf88675807 wayland: Fix weak ref tracking on data sources
We may get a NULL one here, and we're wrongly attempting to remove
the old weak ref from the new data source object.
2015-09-28 16:22:32 +02:00
Carlos Garnacho
405f1ce3d0 wayland: Avoid use of struct data after destruction
data_device_end_drag_grab() will destroy the MetaWaylandDragGrab struct,
so we definitely must not use it after destruction.
2015-09-28 16:22:18 +02:00
Rui Matos
69c267b142 xwayland: Fix windows disappearing on reparenting
If the wayland surface isn't available yet when we process the
WL_SURFACE_ID ClientMessage, we schedule a later function to try the
association again after we get a chance to process wayland requests.

This works fine except on cases where the MetaWindow already had a
previous surface attached (i.e. when the xwindow is reparented) since
we only break the existing association on the later function which
means that when processing the old surface's destruction we destroy
the MetaWindow and cancel the pending later function leaving us
without a MetaWindow and an invisible surface.

Fix this by detaching the old surface as soon as possible so that the
MetaWindow survives.

https://bugzilla.gnome.org/show_bug.cgi?id=743339
2015-09-25 19:09:48 +02:00
Jonas Ådahl
a9df4bb81a wayland: Scale saved rect changing monitor scale
The saved rect is used to restore a saved window size. We need to
update this when the window is moved to a monitor with different scale,
so that if we unmaximize a window which was moved to a different
monitor while maximized (for example when unplugged) will restore to
the correct size.

https://bugzilla.gnome.org/show_bug.cgi?id=755097
2015-09-24 11:39:37 +08:00
Jonas Ådahl
bc9e63d3db wayland: Scale unconstrained rect changing monitor scale
When a window is moved across monitors with different scales, its
rectangle is scaled accordingly. We also need to scale the
unconstrained_rect rectangle, so that moving a window via
meta_window_move_resize() which uses the unconstrained_rect.

https://bugzilla.gnome.org/show_bug.cgi?id=755097
2015-09-24 11:39:37 +08:00
Florian Müllner
5b5ceede2b wayland: Fix variable declaration
Storage class always goes first.
2015-09-24 03:08:23 +02:00
Florian Müllner
bc00f118f3 Avoid shadowing existing variables 2015-09-24 03:08:22 +02:00
Florian Müllner
5801b5518f Annotate functions to improve compiler diagnostics 2015-09-24 03:01:51 +02:00
Florian Müllner
27b37407d0 Don't duplicate declarations from G_DEFINE_TYPE 2015-09-24 03:01:51 +02:00
Jonas Ådahl
e23e697043 wayland: Fix output destroyed callback vfunc type
It is not a callback on a parameter signal, and get no GParamSpec passed
to it. This fixes a crash when a surface is on a destroyed output.

https://bugzilla.gnome.org/show_bug.cgi?id=755096
2015-09-24 08:08:41 +08:00
Jonas Ådahl
5d837a5c85 wayland: Support sending wl_surface.enter/leave to cursor surfaces
Support notifying clients about what outputs their cursor surfaces are
on so that they can attach appropriately scaled buffers to them.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
79c86ae890 Support scaling of cursor sprites given what output they are on
This commits refactors cursor handling code and plugs in logic so that
cursor sprites changes appearance as it moves across the screen.
Renderers are adapted to handle the necessary functionality.

The logic for changing the cursor sprite appearance is done outside of
MetaCursorSprite, and actually where depends on what type of cursor it
is. In mutter we now have two types of cursors that may have their
appearance changed:

 - Themed cursors (aka root cursors)
 - wl_surface cursors

Themed cursors are created by MetaScreen and when created, when
applicable(*), it will extend the cursor via connecting to a signal
which is emitted everytime the cursor is moved. The signal handler will
calculate the expected scale given the monitor it is on and reload the
theme in a correct size when needed.

wl_surface cursors are created when a wl_surface is assigned the
"cursor" role, i.e. when a client calls wl_pointer.set_cursor. A
cursor role object is created which is connected to the cursor object
by the position signal, and will set a correct texture scale given what
monitor the cursor is on and what scale the wl_surface's active buffer
is in. It will also push new buffers to the same to the cursor object
when new ones are committed to the surface.

This commit also makes texture loading lazy, since the renderer doesn't
calculate a rectangle when the cursor position changes.

The native backend is refactored to be triple-buffered; see the comment
in meta-cursor-renderer-native.c for further explanations.

* when we are running as a Wayland compositor

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
7c7cf91c32 wayland: Move cursor surface role to meta-wayland-pointer.c
The wl_pointer assigns a role to a wl_surface, so it makes sense to put
the related logic there.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:26:22 +08:00
Jonas Ådahl
83c17134f1 wayland: GObject:ify surface roles
Make a surface roles into objects with vfuncs for things where there
before was a big switch statement. The declaration and definition
boilerplate is hidden behind C macros.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:24:58 +08:00
Jonas Ådahl
8e5fb03611 MetaWaylandSurface: Don't respond to frame callback when role unassigned
If a surface doesn't have a role, the compositor will not know how, if
or when it will be painted. By adding it to the compositor frame
callback list, the compositor will respond to the client that the
surface has been drawn already which might not be true.

Instead, queue the frame callback in a list that is then processed when
the surface gets a role assigned. The compositor may then, given the
role the surface got, queue the frame callback accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:24:58 +08:00
Jonas Ådahl
dece49b53d wayland: Introduce XWayland surface role
Being a "XWayland window" should be considered equivalent to a role,
even though it is not part of any protocol anywhere. The commit doesn't
have any functional difference, but just makes it clear that an
wl_surface managed by XWayland have the same type of special casing as
surface roles as defined by the Wayland protocol.

As the semantics are more explicit given the role is defined, a comment
explaining why the semantics need to be how they are was added.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-09-13 21:24:58 +08:00
Javier Jardón
6ea7fa9973 xwayland: Add missing include
https://bugzilla.gnome.org/show_bug.cgi?id=754621
2015-09-07 14:13:48 +01:00
Jonas Ådahl
94513726de wayland: Clean up surface role assignment
Use a better name, use GNOME conventions for error handling, open code the
client error reporting and send the error to the correct resource.
wl_subcompositor doesn't have a role error yet, so continue use some
other error. The only effect of this is error received in the client will
be a bit confusing, it will still be disconnected.

https://bugzilla.gnome.org/show_bug.cgi?id=754215
2015-09-07 17:41:14 +08:00
Owen W. Taylor
e3db4ab16a Avoid declaring variables in for loop to avoid upsetting older GCC
Older GCC only allows "for (int i" in explicit c99 mode - there's probably
no reason that we can't enable that, but avoiding the construct for
a fast fix.
2015-09-03 16:13:50 -04:00
Owen W. Taylor
614d6bd0f8 Nested X11: use KeymapNotify events to fix key state on FocusIn
If the user Alt-Tabs out of the window, we will be left thinking
the Alt key is still pressed since we don't see a release for it.

Solve this and other related issues for the nested X11 compositor
by selecting for KeymapStateMask which causes a KeymapNotify event
to be sent after each FocusIn, and when we get these events, update
the internal XKB state and send any necessary modifiers events to
clients.

https://bugzilla.gnome.org/show_bug.cgi?id=753948
2015-09-03 16:02:25 -04:00
Jonas Ådahl
68279e8a08 MetaWaylandPointer: Don't keep our own MetaCursorTracker pointer
There is no reason to, we can just retrieve it every time we need it.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-08-28 09:52:30 +08:00
Jonas Ådahl
cd1ce2cb0a MetaWaylandSurface: Make it a GObject
This way we can add signals and weak references without relying on
wl_signal, wl_listener etc.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-08-28 09:52:30 +08:00
Jonas Ådahl
b01f95cfdd Make MetaCursorSprite a GObject
To easier track lifetime and utilize other GObject features, make
MetaCursorSprite a GObject.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-08-28 09:52:30 +08:00
Jonas Ådahl
4b667d1e09 Rename MetaCursorReference to MetaCursorSprite
It isn't really a reference to a MetaCursor enum, but a reference
counted cursor sprite, and enum value.

https://bugzilla.gnome.org/show_bug.cgi?id=744932
2015-08-28 09:52:30 +08:00
Jonas Ådahl
e76c3ecb00 wayland/pointer-gestures: Send error on protocol version mismatch
When a client binds an incompatible version, we should terminate it.
This check should only be there for the unstable version, as once it is
declared stable and renamed, future versions will be backward compatible.

https://bugzilla.gnome.org/show_bug.cgi?id=753855
2015-08-22 00:04:33 +08:00
Carlos Garnacho
b64b159109 wayland: Avoid warning when switching out into another vt
meta_wayland_pointer_get_client_pointer() may be called when the
MetaWaylandPointer as been already shut down, so the hash table will be
NULL at that moment.
2015-08-14 14:48:43 +02:00
Carlos Garnacho
804ab7894f wayland: Use wl_resource_for_each_safe() on pointer client destruction
We must use this by definition since we're removing all elements from the
resource lists.
2015-08-14 14:46:27 +02:00
Carlos Garnacho
55692b4019 wayland: Implement wl_pointer_gestures
The global wl_pointer_gestures object is now created, effectively
bridging pinch/swipe gestures with clients, so they're now
accessible to clients implementing the protocol.
2015-08-10 17:30:12 +02:00
Carlos Garnacho
2fafa24305 wayland: Implement the wl_pointer_gesture_pinch interface
The pinch gesture resources are part of the MetaWaylandPointerClient, which
will be used during the propagation of CLUTTER_TOUCHPAD_PINCH events.
2015-08-10 17:23:23 +02:00
Carlos Garnacho
51a2f28723 wayland: Implement the wl_pointer_gesture_swipe interface
The swipe gesture resources are part of the MetaWaylandPointerClient, which
will be used during the emission of CLUTTER_TOUCHPAD_SWIPE events.
2015-08-10 17:23:23 +02:00
Carlos Garnacho
e11feb229b wayland: Add gestures protocol XML 2015-08-10 17:23:23 +02:00
Jonas Ådahl
1ee387bb31 MetaWaylandPointer: Put client resources in its own struct
Instead of moving around all the bound pointer resources for a client
when changing focus, keep all the resources bound by a client in a per
client struct, and track the focus by having a pointer to the current
active pointer client struct instance.

This will simplify having wl_pointer extensinos sharing the pointer
focus of the wl_pointer by only having to add them to the pointer
client.

https://bugzilla.gnome.org/show_bug.cgi?id=744104
2015-08-10 17:23:23 +02:00
Adel Gadllah
4dc5882777 wayland: Add frame callbacks to the actor based on the role
Checking for the presense of the actor is wrong because we always
create one.

https://bugzilla.gnome.org/show_bug.cgi?id=739163
2015-08-09 19:25:46 +02:00
Adel Gadllah
070cd27786 wayland: Only call frame callbacks when a surface gets drawn on screen
The spec says:
"A server should avoid signalling the frame callbacks if the surface is not
visible in any way, e.g. the surface is off-screen, or completely obscured
by other opaque surfaces."

We actually do have the information to do that but we are always calling
the frame callbacks in after_stage_paint. So fix that to only call when
when the surface gets drawn on screen.

https://bugzilla.gnome.org/show_bug.cgi?id=739163
2015-08-09 10:40:40 +02:00
Rui Matos
9c745105f8 wayland-surface: Send out an error for a popup with an invalid parent
Instead of silently failing without the client noticing.

https://bugzilla.gnome.org/show_bug.cgi?id=753237
2015-08-05 13:50:09 +02:00
Rui Matos
ab9dabe725 wayland-surface: Don't crash if clients commit to a done popup
If we can't put up a popup because grabbing the pointer fails we
immediately dismiss the popup but the client might have made requests
already, in particular it might have commited the surface and in that
case we should ignore it.

https://bugzilla.gnome.org/show_bug.cgi?id=753237
2015-08-05 13:50:09 +02:00
Jonas Ådahl
ac79988939 wayland: Handle unsetting of input and opaque surface region
When a client sets an input region or a opaque region to NULL, it
should still be considered a change to the corresponding region on the
actor. This patch makes sure this state is properly forwarded.

https://bugzilla.gnome.org/show_bug.cgi?id=753222
2015-08-05 10:22:49 +08:00
Jonas Ådahl
f01247d815 wayland: Fix calculation of window geometry when scaled
Take the surface actor scale into account when calculating the window
geometry.

https://bugzilla.gnome.org/show_bug.cgi?id=744934
2015-07-16 11:54:14 +08:00
Jonas Ådahl
db6caa2c49 wayland: Take scale into account when placing windows relatively
When placing a popup and the legacy transient wl_shell_surface surfaces,
take the current scale of the window into account. This commit doesn't
fix relative positioning in case a window scale would change, but since
the use case for relative positioning is mostly popups, which would be
dismissed before the parent window would be moved, it should not be that
much of a problem.

https://bugzilla.gnome.org/show_bug.cgi?id=744934
2015-07-16 11:54:14 +08:00
Jonas Ådahl
fbd237bc66 MetaWaylandSurface: Return top most toplevel window for popups
Make meta_wayland_surface_get_toplevel_window return the top most window
in case its a chain of popups. This is to make all popups in a chain
including the top most surface have the same scale.

The reason for this is that popups are mostly integrated part of the
user interface of its parent (such as menus). Having them in a different
scale would look awkward.

Note that this doesn't affect non-popup windows with parent-child
relationship, because such windows are typically not an integral part of
the user interface (settings window, dialogs, ..) and can typically be
moved independently. It would probably make sense to make attached modal
dialogs have the same scale as their parent windows, but modal dialogs
are currently not supported for Wayland clients.

https://bugzilla.gnome.org/show_bug.cgi?id=744934
2015-07-16 11:54:14 +08:00
Jonas Ådahl
f6c9261bf6 wayland: Scale window geometry rects given the main output
Since we scale surface actors given what main output their toplevel
window is on, also scale the window geometry coordinates and sizes
(window->rect size and window->custom_frame_extents.top/left) in order
to make the window geometry represent what is being rendered on the
stage.

https://bugzilla.gnome.org/show_bug.cgi?id=744934
2015-07-16 11:54:14 +08:00
Jonas Ådahl
441efd17ce MetaMonitorInfo: Provide scale information
Tracking back from the monitor to the output every time we need to
figure out the scale of a window on a monitor is inconvenient, so
propagate the scale from the output to the monitor it is associated
with.

https://bugzilla.gnome.org/show_bug.cgi?id=744934
2015-07-16 11:53:40 +08:00
Jonas Ådahl
208da2316d wayland: Fix subsurface place_above/below type cast error
A MetaWaylandSurface was casted into a ClutterActor, but it should have
been the MetaSurfaceActor.

Move out parent_actor and surface_actor out of the loop while at it
since they won't change when iterating.

https://bugzilla.gnome.org/show_bug.cgi?id=745655
2015-07-16 11:43:19 +08:00
Jonas Ådahl
3b993131e8 wayland: Fix subsurface positioning on HiDPI
Keep the active position state in its original coordinate space, and
synchronize the surface actor with it when it changes and when
synchronizing the rest of the surface state, in case the surface scale
had changed.

https://bugzilla.gnome.org/show_bug.cgi?id=745655
2015-07-16 11:43:19 +08:00
Jonas Ådahl
117f57f74c wayland: Factor out some parts of meta_surface_actor_wayland_get_scale
Put a toplevel window getter in meta-wayland-surface.h and a main
monitor scale getter in window-wayland.h.

https://bugzilla.gnome.org/show_bug.cgi?id=745655
2015-07-16 11:43:19 +08:00
Jonas Ådahl
f295349e26 wayland: Don't crash if wl_output resource is destroyed after being removed
Previously a MetaWaylandOutput could be removed from the current outputs
table (by being unplugged for example). This would result in the global
object being removed and the MetaWaylandOutput instance freed, but the
wl_resource destructor would still try to remove itself from the list of
resources. Trying to do this, it'd try to access its user data pointer
which would point to the freed MetaWaylandOutput instance, and as a
result crash when trying to manipulate the freed data.

https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-07-15 14:55:55 +08:00
Jonas Ådahl
eb023ff2c9 wayland: Send wl_surface.enter and wl_surface.leave
Whenever a MetaSurfaceActor is painted, update the list of what outputs
the surface is being drawed upon. Since we do this on paint, we
effectively avoids this whenever the surface is not drawn, for example
being minimized, on a non-active workspace, or simply outside of the
damage region of a frame.

DND icons and cursors are not affected by this patch, since they are not
drawn as MetaSurfaceActors. If a MetaSurfaceActor or a parent is cloned,
then we'll check the position of the original actor again when the clone is
drawn, which is slightly expensive, but harmless. If the MetaShapedTexture
instead is cloned, as GNOME Shell does in many cases, then these clones
will not cause duplicate position checks.

https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-07-15 14:55:55 +08:00
Jonas Ådahl
ba7c524a18 MetaSurfaceActorWayland: Unset the MetaWaylandSurface pointer when it goes away
We may access it during painting even if it has been freed. For now,
manually unset it during the MetaWaylandSurface cleanup; in the future
make MetaWaylandSurface a GObject and make the surface pointer a weak
reference.

https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-07-15 14:55:55 +08:00
Jonas Ådahl
dc99af40f3 wayland: Make MetaWaylandOutput a GObject
This way we can later add signals to it.

https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-07-15 14:55:55 +08:00
Jonas Ådahl
1576b7d5a6 wayland: Put MetaWaylandOutput struct in header file
We need this in MetaWaylandSurface to be able to send
wl_surface.enter/leave.

https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-07-15 14:55:55 +08:00
Jonas Ådahl
6ec7fa2cbd wayland: Use surface role when special casing surface commits
Lets use the role when doing role specific commit actions. The
conditions effectively do that anyway, and this way we will get a
compiler warning here whenever we add a new role, as well as we avoid
having different variants of role-determination checks in different
places.

https://bugzilla.gnome.org/show_bug.cgi?id=744453
2015-07-15 14:55:55 +08:00
Jonas Ådahl
5547c98f97 wayland: Make MetaWaylandDataSource ownership protocol specific
Firstly, this patch makes MetawaylandDataSource a GObject. This is in
order to easier track its lifetime without adding destroy signals etc. It
also makes the vfunc table GObject class functions instead while at it,
as well as moves protocol specific part of the source into their own
implementations.

An important part of this patch is the change of ownership. Prior to this
patch, MetaWaylandDataDevice would kind of own the source, but for
Wayland sources it would remove it if the corresponding wl_resource was
destroyed. For XWayland clients it would own it completely, and only
remove it if the source was replaced.

This patch changes so that the protocol implementation owns the source.
For Wayland sources, the wl_resource owns the source, and the
MetaWaylandDataDevice sets a weak reference (so in other words, no
semantical changes really). For XWayland sources, the source is owned by
the selection bridge, and not removed until replaced or if the client
goes away.

Given the changes in ownership, data offers may now properly track the
lifetime of a source it represents. Prior to this patch, if an offer with
an XWayland source would loose its source, it wouldn't get notified and
have an invalid pointer it would potentally crash on. For Wayland
sources, an offer would have a weak reference and clean itself up if the
source went away. This patch changes so the behavior is consistent,
meaning a weak reference is added to the source GObject so that the offer
can behave correctly both for Wayland sources and XWayland sources.

https://bugzilla.gnome.org/show_bug.cgi?id=750680
2015-06-30 11:23:40 +08:00
Carlos Garnacho
ea4979e182 data-device: Protect against destroyed dnd-focus clients
When a possible drag dest client crashes during DnD, it may happen
we receive first the destroy notification for the data_device, and
later the notification for the focus surface. When this happens we
unset the drag_focus_data_device first, and later on
meta_wayland_drag_grab_set_focus(grab, NULL) we assume it still
exists when sending the leave event, leading to mutter crashing
right after.

So, as we don't receive any ordering guarantees about resource
destruction, just prepare the meta_wayland_drag_grab_set_focus()
paths for this.
2015-06-29 18:38:50 +02:00
Jonas Ådahl
bb4dcd62ec MetaWaylandDataDevice: Propagate the unsetting of a selection
If a client unsets a selection (calls set_selection with the offer
NULL), this should cause the compositor not to continue sending the
previously set offer.

https://bugzilla.gnome.org/show_bug.cgi?id=750007
2015-06-18 11:15:18 +08:00
Carlos Garnacho
cdac4d0e92 wayland: Ensure we queue a "calc showing" operation after we get a buffer
This will ensure the window is made visible, now that we're going to ignore
all previous petitions until we get a buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=750552
2015-06-16 20:35:00 +02:00
Olivier Fourdan
d593a61b39 wayland: do not generate motion events
Mutter generates a motion event for every button and scroll events,
which confuses Xwayland apps that rely on XMotionEvents for various
purposes, e.g. it fools rxvt jumpy mouse detection code.

Remove the call to notify_motion() from the button and scroll event
handlers to avoid these spurious motion events.

https://bugzilla.gnome.org/show_bug.cgi?id=748705
2015-06-12 11:14:21 -04:00
Jonas Ådahl
daa15d94fd xdg-shell: Popups should be placed relative to the parent surface
According to the xdg-shell protocol specification the (x, y) coordinates
passed when creating a popup surface is relative to top left corner of
the parent surface, but prior to this patch, if the parent surface was
a xdg_surface, it'd position it relative to top left corner of the
window geometry of that xdg_surface.

https://bugzilla.gnome.org/show_bug.cgi?id=749716
2015-06-10 11:08:12 +08:00
Jonas Ådahl
64cf87cfe1 MetaWaylandSurface: Create the window when creating wl_shell_surface
Some clients will do things like set_toplevel before committing the
buffer, so we need to have a window to manipulate before that.

https://bugzilla.gnome.org/show_bug.cgi?id=750256
2015-06-02 10:28:09 +08:00
Dave Airlie
e2d6028924 wayland: use monitors info for outputs instead of kms outputs
Wayland shouldn't use KMS outputs, it should use the monitor
infos to show its outputs, this will make tiled monitors work
with wayland.
2015-06-01 09:38:13 -07:00
Carlos Garnacho
4a968c3b4e xwayland: Implement X11-to-wayland DnD
When DnD is started from an X11 client, mutter now sets up an special
grab that 1) Ensures the drag source keeps receiving events, and 2)
Moves an internal X Window over wayland clients as soon as the pointer
enters over these.

That window will act as the X-side peer for the currently focused
wayland client, and will transform XdndEnter/Position/Leave/Drop
messages into wayland actions. If DnD happens between X11 clients,
the window will be moved away and unmapped, to let these operate as
usual.

https://bugzilla.gnome.org/show_bug.cgi?id=738312
2015-05-29 11:27:53 +02:00
Carlos Garnacho
ccb7833e99 xwayland: Implement wayland-to-X11 DnD
X11 client windows now hook a X11-specific MetaWaylandDragDestFuncs
that converts these into Xdnd* messages, and an additional selection
bridge has been added to take care of XdndSelection, and the data
transfers done through it.

https://bugzilla.gnome.org/show_bug.cgi?id=738312
2015-05-29 11:27:53 +02:00
Carlos Garnacho
b449ba942a xwayland: Refactor XFixesSelectionNotifyEvent handler
Prepare it for more selection atoms (i.e. XdndSelection) to come.

https://bugzilla.gnome.org/show_bug.cgi?id=738312
2015-05-29 11:27:53 +02:00
Carlos Garnacho
f53eea2c1c wayland: Refactor DnD target functions into MetaWaylandDragDestFuncs
This will be useful in order to interact with drag dest surfaces in
its windowing-specific ways, although everything defaults to the
wayland vfuncs.

https://bugzilla.gnome.org/show_bug.cgi?id=738312
2015-05-29 11:27:52 +02:00
Carlos Garnacho
0b0ce4193f xwayland: Ensure we've got an owner when setting the X selection owner
Otherwise we may end up claiming the X selection when there's no wayland
selection owner.
2015-05-18 20:59:07 +02:00
Carlos Garnacho
719d8bd0c7 xwayland: remove unused struct field 2015-05-18 20:58:57 +02:00
Carlos Garnacho
4fc1811c15 wayland: Add X11/wayland selection interoperation
This piece of code hooks in both wl_data_device and the relevant X
selection events, an X11 Window is set up so it can act as the clipboard
owner when any wayland client owns the selection, reacting to
SelectionRequest events, and returning the data from the wayland client
FD to any X11 requestor through X properties.

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

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

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

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

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

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

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

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

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

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

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

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

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

This bumps the gtk_shell version to 2.

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

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

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

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

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

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

This defeats this logic in try_display:

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

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

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

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

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

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

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

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=746295
2015-03-16 11:08:45 -04:00
Carlos Garnacho
d3988c04d6 wayland: Destroy pending frame callbacks when destroying a surface
MetaWaylandFrameCallback has been added a surface field, which is then
checked when destroying the surfaces. This prevents unintended callbacks
to run after a surface has been destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=745163
2015-03-05 17:07:32 +01:00
Jonas Ådahl
fffb863f37 wayland: Sync surface actor state when changing main monitor
In order to switch to the correct surface actor scale given the monitor
the surface is on, without relying on the client committing a new state
given some other side effect, sync the surface actor state when the main
monitor associated with the corresponding window changed.

https://bugzilla.gnome.org/show_bug.cgi?id=744933
2015-03-03 14:53:15 -05:00
Jonas Ådahl
adf7c0e730 wayland: Fix surface damage region scales
Use the correct scale when processing damage from the client.

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

https://bugzilla.gnome.org/show_bug.cgi?id=744933
2015-03-03 14:53:15 -05:00
Jasper St. Pierre
78d8525699 backends/native: Calculate the output scale in here
It makes more sense as a backend thing, not a frontend thing.
2015-02-26 00:13:28 -08:00
Rui Matos
438410c22c window-wayland: Set transient and window type on manage() for popups
Doing this on manage() allows the common MetaWindow initialization to
do the right thing for popups like setting skip_taskbar and
skip_pager.

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=745118
2015-02-25 18:25:42 +01:00
Jasper St. Pierre
adccbc9b7b wayland-outputs: Respect the scaling-factor override
This allows someone to explicitly set a scaling factor that overrides
the computed scale for all outputs.
2015-02-22 11:09:27 -08:00
Jasper St. Pierre
94b111cf6c wayland-outputs: Use the wrappers for post_event 2015-02-22 11:09:27 -08:00
Ray Strode
2aa6dcd9d8 wayland: don't try to use seat devices that aren't (yet) present
Before commit ac448bd42b the pointer,
keyboard, and touch objects were initialized when the seat was created.
Now they're initialized later, when the clutter device manager finds and
loads them.

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

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

This commit makes sure all uninteresting events get ignored.
2015-02-18 11:20:36 -05:00
Ray Strode
56ca7eeb65 wayland: treat touchpads like mouse devices
They both serve the same purpose of moving
the pointer around, so they both should be
considered pointer devices on the seat.
2015-02-18 11:19:17 -05:00
Jonas Ådahl
9a99a80710 wayland: Fail clients who try to create or destroy a not-top-most popup
If a client creates an xdg_popup given a parent that is a xdg_popup that
is not the most top one in the grab chain, send the
not_the_topmost_popup error.

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

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

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

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

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

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=744452
2015-02-17 22:14:47 +08:00
Jasper St. Pierre
1f0ed5483a Revert "Revert "wayland-pointer: Just use the pointer actor instead of doing a full repick""
The Clutter bug has now been fixed.

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

https://bugzilla.gnome.org/show_bug.cgi?id=743745
2015-01-30 13:13:49 -05:00
Jonas Ådahl
4d23e7c202 wayland: Fix caching of surface state
The commit 97a69cee5a broke the caching of
the surface state when because the frame_callback_list target state was
overwritten after the content had been moved to it.

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

https://bugzilla.gnome.org/show_bug.cgi?id=743678
2015-01-29 15:48:46 +08:00
Jasper St. Pierre
d561b3b18f frames: Clutterify frame event handling
This lets us remove our horrible X11-based, GDK-based hacky frame event
handling in favor of a more sane one in Clutter.
2015-01-19 21:56:08 -08:00
Carlos Garnacho
9d73b4efbb wayland: Use the new keyboard settings location for repeat settings
This makes keyboard repeat in clients in-sync with the input config changes.

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

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

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

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

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

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

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

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

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

This reverts commit 0364ea9140.

https://bugzilla.gnome.org/show_bug.cgi?id=739161
2014-10-27 18:11:53 +01:00
Carlos Garnacho
7c5989c978 wayland: Avoid MetaWindow call on non window-backed surfaces
Crossing events may also be gotten on subsurfaces.

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

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

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

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

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

This was incorrect. wl_surface_destructor actually does the full repick
-- doing it here is dangerous, because the destroy listeners actually
run *before* the destructor, not after, so the surface is still alive.
2014-10-08 12:38:56 -07:00