summaryrefslogtreecommitdiff
path: root/src/wayland
Commit message (Collapse)AuthorAgeFilesLines
...
* wayland: Only send full sequences of touch events to clientsCarlos Garnacho2017-12-211-6/+12
| | | | | | | | | | | | If input happens to be grabbed somewhere along the shell, and ungrabbed while a touch operation is ongoing, the wayland bits will happily start sending wl_touch.update events from an undeterminate point, without clients having ever received wl_touch.down for that id. Consider those touches grabbed for the entirety of their lifetime, if wl_touch.down wasn't received by the client, no other events will. https://bugzilla.gnome.org/show_bug.cgi?id=776220
* wayland/keyboard: preserve layout indexOlivier Fourdan2017-12-201-2/+4
| | | | | | | | | | | | | | | | | On VT switch, the xkb state layout index is lost and reset to the first group, so if the first layout is not the last one being used, the xkb state used in both meta-wayland-keyboard.c and clutter/evdev will be desynchronized with the keyboard source indicator in the gnome-shell UI. Save the effective layout chosen along with the seat so it can be restored when reclaiming devices. Use the saved layout index from the clutter/evdev's seat to restore the layout in meta-wayland-keyboard, so that switching VT doesn't reset the layout and causes further discrepancies with the layout indicator in the gnome-shell UI. https://bugzilla.gnome.org/show_bug.cgi?id=791383
* wayland: Add Xwayland grab keyboard supportOlivier Fourdan2017-12-184-0/+392
| | | | | | | | | | | | | | | | | This protocol is limited to Xwayland only and is not visible/usable by any other client. Mutter uses the following mechanisms to determine if an X11 client should be granted a grab: - is "xwayland-allow-grabs" set? - if set, is the client blacklisted? - otherwise, has the client set the X11 window property _XWAYLAND_MAY_GRAB_KEYBOARD on the window using a client message? - if not, is it a client white-listed either via the default system list or the settings "xwayland-grab-access-rules"? https://bugzilla.gnome.org/show_bug.cgi?id=783342
* xwayland: add _XWAYLAND_MAY_GRAB_KEYBOARD propertyOlivier Fourdan2017-12-182-0/+68
| | | | | | | | | | | | | | | | | | Add a new client message "_XWAYLAND_MAY_GRAB_KEYBOARD" that X11 clients can use to tell mutter this is a well behaving X11 client so it may grant the keyboard grabs when requested. An X11 client wishing to be granted Xwayland grabs by gnome-shell/mutter must send a ClientMessage to the root window with: - message_type set to "_XWAYLAND_MAY_GRAB_KEYBOARD" - window set to the xid of the window on which the grab is to be issued - data.l[0] to a non-zero value Note: Sending this client message when running a plain native X11 environment would have no effect. https://bugzilla.gnome.org/show_bug.cgi?id=783342
* xwayland: Add MetaWindowXwaylandOlivier Fourdan2017-12-182-0/+102
| | | | | | | | MetaWindowXwayland derives from MetaWindowX11 to allow for some Xwayland specific vfunc that wouldn't apply to plain X11 windows, such as shortcut inhibit routines. https://bugzilla.gnome.org/show_bug.cgi?id=783342
* wayland-outputs: Delay wl_output destructionRui Matos2017-12-151-1/+22
| | | | | | | | This tries to avoid wayland clients getting disconnected for binding to a wl_output that we already destroyed which is a known protocol race condition, see https://phabricator.freedesktop.org/T7722 . https://bugzilla.gnome.org/show_bug.cgi?id=789070
* wayland: Add xdg-output supportOlivier Fourdan2017-12-153-5/+194
| | | | | | | | | | | | | | | | | | The xdg-output protocol aims at describing outputs in way which is more in line with the concept of an output on desktop oriented systems. For now it just features the position and logical size which describe the output position and size in the global compositor space. This is however much useful for Xwayland to advertise the output size and position to X11 clients which need this to configure their surfaces in the global compositor space as the compositor may apply a different scale from what is advertised by the output scaling property (to achieve fractional scaling, for example). This was added in wayland-protocols 1.10. https://bugzilla.gnome.org/show_bug.cgi?id=787363
* wayland/xdg-shell: Dismiss a popup on map if parent already dismissedJonas Ådahl2017-11-301-0/+6
| | | | | | | | | | If a parent doesn't have a window, it means it could have been dismissed (for example due to a input serial race), but the more recent popup might win the input serial race and try to map anyway. This would result in a crash later on when trying to process the placement rule, as the parent already has no window. https://bugzilla.gnome.org/show_bug.cgi?id=790358
* wayland/xdg-shell: Check popup parent type when assigningJonas Ådahl2017-11-301-0/+8
| | | | | | | We only allow mapping popups on top of surfaces with a xdg_surface based role. Add a check and fail clients that doesn't follow this rule. https://bugzilla.gnome.org/show_bug.cgi?id=790358
* wayland/xdg-shell: Fix top-most check when grabbingJonas Ådahl2017-11-301-16/+14
| | | | | | | | | | | | | Move the top-most-popup correctness check to the finish_popup_setup() function after checking the serial. If we pass the serial check, we should have reached a state that if there are any popups they should be the one from the same client. Also avoid failing a client that correctly set the top-most popup at map time, but where at the time of processing the top most popup have already been dismissed by the compositor for some arbitrary reason. https://bugzilla.gnome.org/show_bug.cgi?id=790358
* wayland/keyboard: Apply sticky keys masksOlivier Fourdan2017-11-162-0/+71
| | | | | | | | | | | MetaWaylandKeyboard maintains its own xkb_state used to update Wayland clients. Add the necessary hooks to make sure the sticky keys modifier masks set in clutter-evdev are also applied in MetaWaylandKeyboard's xkb_state so that Wayland clients also benefit from sticky keys. https://bugzilla.gnome.org/show_bug.cgi?id=788564
* wayland: Disable AccessX in XwaylandOlivier Fourdan2017-11-161-0/+1
| | | | | | | | Keyboard accessibility features in Wayland are handled in the compositor, we do not want AccessX in Xwayland to interfere with the compositor. https://bugzilla.gnome.org/show_bug.cgi?id=788564
* window/wayland: Handle resizing when headlessJonas Ådahl2017-11-101-2/+6
| | | | | | | | We tried to get the geometry scale, which may depend on the main logical monitor assigned to the window. To avoid dereferencing a NULL logical monitor when headless, instead assume the geometry scale is 1. https://bugzilla.gnome.org/show_bug.cgi?id=788764
* wayland: Plug leakCarlos Garnacho2017-11-071-1/+5
| | | | | | The remote DBus error is leaked. https://bugzilla.gnome.org/show_bug.cgi?id=789984
* wayland/keyboard: Don't transfer layout group when replacing xkb stateJonas Ådahl2017-11-021-5/+6
| | | | | | | | | | | | | The layout group determines what actual keyboard layout in the keymap to use when translating modifier state and key codes to key syms. When changing a keymap to another, the layout groups has no relation to the layout groups in the old keymap, thus there is no reason to transfer it to the new state. This fixes an issue where the xkb state in meta-wayland-keyboard.c got desynchronized with the xkb state in clutter-device-manager-evdev.c. https://bugzilla.gnome.org/show_bug.cgi?id=789300
* wayland/surface: Disconnect actor handlers before unassigning roleJonas Ådahl2017-10-271-9/+10
| | | | | | | | | | | The handlers depend on a role being assigned. Destroying the window causes it to become unmapped, which would sometimes trigger one of the handlers, resulting in an is-assigned assert hitting in one of the handlers. Avoid this by disconnecting the handlers earlier, so that there is no risk that any them being triggered before the role is assigned. https://bugzilla.gnome.org/show_bug.cgi?id=789552
* wayland: Allow Xwayland to leave core dumpsDaniel van Vugt2017-10-262-12/+33
| | | | | | | | | | | | For historical Xorg-reasons, Xwayland would disable its own core dumps by default. This is a problem because Xwayland crashing is the biggest cause of gnome-shell crashes [1][2], and we still have no idea why due to there being no dumps from Xwayland. So enable core dumping from Xwayland. https://bugzilla.gnome.org/show_bug.cgi?id=789086 [1] https://bugs.launchpad.net/bugs/1505409 [2] https://bugs.launchpad.net/bugs/1556601
* wayland: Update pointer confinement on surface actor relocationsCarlos Garnacho2017-10-261-0/+28
| | | | | | | | In the unlikely case that a surface is moved by the compositor while holding a pointer confinement, we also need to update the pointer position when the surface actor gets moved. https://bugzilla.gnome.org/show_bug.cgi?id=782344
* wayland: Trigger wl_output updates on actor position changesCarlos Garnacho2017-10-261-9/+66
| | | | | | | | | | | | | | | Both notify::position on the surface actor and position-changed on MetaWindow are listened to, in order to trigger wl_output updates for wl_surfaces whenever the surfaces move across them. Both signals are necessary in order to cater for toplevel and subsurface relocations (Because it's the parent window actor what changes position in this last case). Also, shuffle signal disconnection, so each signal goes away with the object reference held by MetaWaylandSurface. https://bugzilla.gnome.org/show_bug.cgi?id=782344
* backends: add 'monitors-updated-internal' signal to only update internal stateMarco Trevisan (Treviño)2017-10-131-1/+1
| | | | | | | Adding an internal signal and use it to update the internal state before emitting "monitors-changed" which will be repeated by the screen to the world. https://bugzilla.gnome.org/show_bug.cgi?id=788860
* wayland-dma-buf: Don't send modifiers to old clientsDaniel Stone2017-10-051-1/+8
| | | | | | | | | | | The modifier event was only added in v3 of the client; sending it to older clients (e.g. GStreamer waylandsink) causes them to disconnect immediately. Send the older 'format' event to all clients, and only send the newer 'modifier' event to resource versions 3 or above. https://bugzilla.gnome.org/show_bug.cgi?id=788558
* wayland: Send edge constraintsGeorges Basile Stavracas Neto2017-10-033-10/+119
| | | | | | | | | | | Following up the previous patch, this patch makes the Wayland backend send the edge constraints through a custom protocol extension internal to GTK. As it mature, we can think of upstreaming the protocol to Wayland itself. https://bugzilla.gnome.org/show_bug.cgi?id=751857
* wayland/surface: Send buffer release events immediatelyJonas Ådahl2017-09-281-1/+1
| | | | | | | | | Just queuing the buffer release event is prone to starvation, so send the release immediately. See https://lists.freedesktop.org/archives/wayland-devel/2017-September/035147.html for more detailed explanation. https://bugzilla.gnome.org/show_bug.cgi?id=788197
* wayland: do not leak shortcut inhibit dataOlivier Fourdan2017-09-141-3/+8
| | | | | | | | | | | We would free the shortcut inhibit data only when the client destroys its request, which is not the case when the clients itself is destroyed, leading to a leak of the shortcut inhibit data. Free the data on resource destruction instead, and simply destroy the resource on destroy request. https://bugzilla.gnome.org/show_bug.cgi?id=787568
* wayland: Keep the inhibit shortcut dialogOlivier Fourdan2017-09-143-6/+13
| | | | | | | | | | | | | | | | | | | | | On Wayland, the grab()/ungrab() in gtk+/gdk are wired to the shortcut inhibitor mechanism, which in turn shows the dialog, which can take focus away from the client window when the dialog is shown. If the client issues an ungrab() when the keyboard focus is lost, we would hide the dialog, causing the keyboard focus to be returned to the client surface, which in turn would issue a new grab(), so forth and so on, causing a continuous show/hide of the shortcut inhibitor dialog. To avoid this issue, keep the dialog around even if the shortcut inhibit is canceled by the client, so that the user is forced to make a choice that we can reuse on the next request without showing the dialog again. Instead of hiding the dialog when the shortcut inhibitor is destroyed by the client, we simply mark the request as canceled and do not apply the user's choice. https://bugzilla.gnome.org/show_bug.cgi?id=787568
* wayland/inhibit-shortcuts-dialog: Use g_new0 instead of g_newJonas Ådahl2017-09-141-1/+1
| | | | | | | The code assumed the newly allocated blocked was initialized to 0, but it wasn't since g_new was used. Fix that by using g_new0. https://bugzilla.gnome.org/show_bug.cgi?id=787570
* wayland: Don't free non-transferred string when cleaning upJonas Ådahl2017-09-041-3/+6
| | | | | | | | | When cleaning up the display name string management, the display name string retrieved from libwayland-server was also passed to free() on clean up. This is invalid as the display name string ownership is not transferred to us. Fix this by strdup:ing the string before saving it. https://bugzilla.gnome.org/show_bug.cgi?id=730551
* window: Handle being headless betterJonas Ådahl2017-08-301-3/+7
| | | | | | | | This avoids updating state (such as position, size etc) when going headless. Eventually, when non-headless, things will be updated again, and not until then will we be able to update to a valid state. https://bugzilla.gnome.org/show_bug.cgi?id=730551
* wayland: Don't free the Wayland display name string too earlyJonas Ådahl2017-08-301-4/+4
| | | | | | | We accidentally freed the Wayland display name string, meaning retrieving it later retrieved freed memory. https://bugzilla.gnome.org/show_bug.cgi?id=730551
* wayland/output: Flush clients after creating wl_output globalJonas Ådahl2017-08-303-0/+11
| | | | | | | | In order to give the clients the best chance to bind the wl_output before we later remove it (for example on fast hot plugs or in the test suite), flush the client sockets after creating the global. https://bugzilla.gnome.org/show_bug.cgi?id=730551
* wayland/xdg-foreign: Move out ID generation helper to util.cJonas Ådahl2017-08-291-16/+3
| | | | | | It'll be used to generate ID in the same way in other places later. https://bugzilla.gnome.org/show_bug.cgi?id=784199
* wayland-dma-buf: Fix 32bpp channel order inversionDaniel Stone2017-08-241-5/+2
| | | | | | | | | | | | Apparently my understanding of Cogl pixel formats, or at least their use, was somewhat shaky. Un-invert the inversion of the DRM FourCC -> Cogl pixel format mapping when creating dmabufs from clients, fixing inverted channel ordering seen from GL clients, e.g. gold highlights in gtk4-demo when using the GSK GL backend when they should be blue. https://bugzilla.gnome.org/show_bug.cgi?id=786677
* wayland/inhibit-shortcuts-dialog: Destroy the dialog after responseJonas Ådahl2017-08-191-1/+3
| | | | | | | We'll never actually show it again, but just use the last response, so we can just destroy it now already. https://bugzilla.gnome.org/show_bug.cgi?id=786385
* wayland/inhibit-shortcuts-dialog: Just hide the dialog when hidingJonas Ådahl2017-08-191-1/+4
| | | | | | | | | The meta_wayland_surface_hide_inhibit_shortcuts_dialog() function disconnected the "destroy" handler, but we'd still be listening on response events. Change this to just hide the dialog, leaving the data intact with the proper life time signal in place. https://bugzilla.gnome.org/show_bug.cgi?id=786385
* wayland/inhibit-shortcuts-dialog: Make the dialog ownership clearerJonas Ådahl2017-08-191-15/+14
| | | | | | | Make it clear that the data object is the owner of the dialog; it creates it, and eventually destroys it. https://bugzilla.gnome.org/show_bug.cgi?id=786385
* wayland/inhibit-shortcuts-dialog: Make data life cycle a bit clearerJonas Ådahl2017-08-191-13/+18
| | | | | | | | | | The 'data' object is attached to the MetaWaylandSurface as a GObject qdata. It is created once, and stays allocated until the surface is destroyed. To make things clearer, connect to the "destroy" signal just after creating, and from a on_surface_destroyed() callback call the .._free() function. https://bugzilla.gnome.org/show_bug.cgi?id=786385
* wayland/inhibit-shortcuts-dialog: Only reuse last reply if there was oneJonas Ådahl2017-08-191-1/+3
| | | | | | | | We might have hidden the dialog, without a response. To avoid using the not answered response, make sure we have actually got one before reusing. https://bugzilla.gnome.org/show_bug.cgi?id=786385
* wayland/buffer: Add missing breaks in switch statementJonas Ådahl2017-08-161-0/+2
| | | | | | | We'd process damage, and no matter whether it succeeded or not we'd pretend it succeeded, meaning any potential GError would be leaked. https://bugzilla.gnome.org/show_bug.cgi?id=786300
* wayland: use the inhibit shortcuts dialogOlivier Fourdan2017-08-024-2/+206
| | | | | | | | | | Plug the new MetaInhbitShortcutsDialog to the relevant Wayland protocol implementation. Also, remember the last user choice for a given surface to avoid asking continuously the same question. https://bugzilla.gnome.org/show_bug.cgi?id=783342
* wayland: add keyboard shortcuts inhibitor protocolOlivier Fourdan2017-08-024-0/+225
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=783342
* wayland: add inhibit shortcut mechanismOlivier Fourdan2017-08-025-0/+121
| | | | | | | | | | | Add a mechanism to MetaWaylandSurface that inhibits compositor's own shortcuts when the surface has input focus, so that clients can receive all key events regardless of the compositor own shortcuts. This will help with implementing "fake" active grabs in Wayland and XWayland clients. https://bugzilla.gnome.org/show_bug.cgi?id=783342
* wayland: Add zwp_linux_dmabuf_v1 supportDaniel Stone2017-08-016-0/+664
| | | | | https://bugzilla.gnome.org/show_bug.cgi?id=785262 Signed-off-by: Daniel Stone <daniels@collabora.com>
* wayland: Reset tablet tool cursor surface on proximity outCarlos Garnacho2017-07-261-0/+1
| | | | | | | | | The cursor surface would be remembered until the next proximity in event, causing flashing of the old cursor till the client underneath the tablet tool sent the zwp_tablet_tool.set_cursor request. Forgetting about the cursor surface on proximity out makes the cursor invisible till the request is made.
* wayland: Update button state on motion/button eventsCarlos Garnacho2017-07-241-1/+6
| | | | | | | | More specifically, avoid crossing events, since clutter does not set modifier/button state on those. Fixes implicit grabs being broken when the pointer moves past the surface boundaries. https://bugzilla.gnome.org/show_bug.cgi?id=785347
* wayland/buffer: Create EGLImage with no contextDaniel Stone2017-07-221-2/+3
| | | | | | | | | | | | | | | | | Since a wl_buffer is independent of the GL context in use (unlike, e.g., a GL renderbuffer), EGLImages with the EGL_WAYLAND_BUFFER_WL target must pass EGL_NO_CONTEXT as the context. Quoting from the EGL_WL_bind_wayland_display spec: After querying the wl_buffer layout, create EGLImages for the planes by calling eglCreateImageKHR with wl_buffer as EGLClientBuffer, EGL_WAYLAND_BUFFER_WL as the target, NULL context. The check was already present inside _cogl_egl_create_image. https://bugzilla.gnome.org/show_bug.cgi?id=785263 Signed-off-by: Daniel Stone <daniels@collabora.com>
* wayland: Provide basic tablet wheel event supportJason Gerecke2017-07-171-2/+34
| | | | | | | | | | | | Adds basic support for the "wheel" event from the Wayland tablet protocol. Ideally we would accumulate the angle and report a wheel event with an appropriate value for "clicks". We can get away with a much cruder method for the time being, however, since no Wacom tablet puck actually provides a smooth scrollwheel. Checking whether the angle in CLUTTER_INPUT_AXIS_WHEEL exceeds a nominally-small threshold is sufficient to determine that the wheel has advanced by at least one physical click. https://bugzilla.gnome.org/show_bug.cgi?id=783716
* wayland/window: Update toplevel main monitor before non-toplevelJonas Ådahl2017-07-171-1/+3
| | | | | | | | | | | | When updating the main monitor, make sure to update the toplevel main monitor before trying to use that as the main monitor for non-toplevel windows (such as popups). Without this, when the main monitor is updated as a side effect to monitors being changed (for example due to a hot plug event, or coming back from being suspended) the main monitor pointer may, after 'monitors-changed' has completed, point to freed memory resulting in undefined behaviour. https://bugzilla.gnome.org/show_bug.cgi?id=784867
* cursor-renderer: Track cursor position using floatsJonas Ådahl2017-07-143-6/+10
| | | | | | | | | To be able to render the pointer cursor sprite at sub-(logical)-pixel positions, track the pointer position using floats instead of ints. This also requires users of the cursor sprite rect to deal with floating points, when e.g. finding the logical monitor etc. https://bugzilla.gnome.org/show_bug.cgi?id=765011
* Add support for rudimentary fractional scalingJonas Ådahl2017-07-141-2/+11
| | | | | | | | | | | | | When the logical layout mode is used, allow configuring the scaling to be non-integer. Supported scales are so far hard coded to include at most 1, 1.5 and 2, and scales that doesn't result in non-fractional logical monitor sizes are discarded. Wayland outputs are set to have scale ceil(actual_scale) meaning well behaving Wayland clients will provide buffers with buffer scale 2, thus being scaled down to the fractional scale. https://bugzilla.gnome.org/show_bug.cgi?id=765011
* logical-monitor: Make scale a floatJonas Ådahl2017-07-143-7/+12
| | | | | | | To support fractional scaling, the logical monitor scale must be stored as a float. No other functional changes is part of this commit. https://bugzilla.gnome.org/show_bug.cgi?id=765011