1. 29 Apr, 2020 1 commit
  2. 28 Apr, 2020 1 commit
  3. 27 Apr, 2020 4 commits
    • Olivier Fourdan's avatar
      keybindings: Mask out the reserved modifiers mask · 61356caa
      Olivier Fourdan authored and Robert Mader's avatar Robert Mader committed
      When switching layouts, special modifiers bits may be be set for
      internal use by Xkb.
      As we now ignore a set of modifiers when processing the special
      modifiers keys, we ought to also mask out those reserved modifiers
      otherwise we would discard the [Super] key after switching layouts
      in X11.
      Closes: #1144
    • Jonas Ådahl's avatar
      remote-access-controller: Allow inhibiting remote access · 4300f1f9
      Jonas Ådahl authored
      Inhibiting remote access means any current remote access session is
      terminated, and no new ones can be created, until remote access is
      uninhibited. The inhibitation is ref counted, meaning there can be more
      than one inhibitor.
    • Laurent Bigonville's avatar
    • Olivier Fourdan's avatar
      window-actor/x11: Cache the frame bounds · bd45a00f
      Olivier Fourdan authored
      When resizing an X11 window with client side decorations, the shadow is
      clipped by the frame bounds so that we don't need to paint the shadow
      under the opaque areas covered by the window and its frame.
      When the X11 client uses the EMWH synchronization mechanism (like all
      gtk-3 based clients), the actual window may not be updated so that the
      actual window and it frame may be behind the expected window frame
      bounds, which gives the impression of de-synchronized shadows.
      To avoid the issue, keep a copy of the frame bounds as a cache and only
      update it when the client is not frozen so that the clipping occurs on
      the actual content.
      Closes: #1178
  4. 25 Apr, 2020 1 commit
    • Jonas Dreßler's avatar
      clutter/stage-cogl: Fix painting the redraw clip with the damage region · 793a9d45
      Jonas Dreßler authored
      The redraw clip that's painted together with the damage region has to be
      copied earlier than we do right now. That's because if
      PAINT_DAMAGE_REGION is enabled, buffer age is disabled and thus
      use_clipped_redraw is FALSE. That means the redraw_clip is updated and
      set to the full view-rect. If we copy the queued_redraw_clip after that,
      it's also going to be set to the full view-rect. So copy the redraw clip
      a bit earlier to make sure we're actually passing the real redraw clip
      to paint_damage_region().
      Also keep the queued_redraw_clip around a bit longer so it can actually
      be used by paint_damage_region() and isn't freed before that.
      While at it, move paint_damage_region() from swap_framebuffer() into
      clutter_stage_cogl_redraw_view() so we don't have to pass things to
      swap_framebuffer() only for debugging.
      Fixes #1104
  5. 24 Apr, 2020 1 commit
  6. 23 Apr, 2020 11 commits
    • Florian Müllner's avatar
      backend: Remove support for META_DUMMY_MONITORS variable · 43e12dab
      Florian Müllner authored
      Forcing a dummy monitor manager is unexpected and has been broken
      since commit 315a6f43.
    • Jonas Ådahl's avatar
      screen-cast: Add RecordArea for screen cast arbitrary area · c4535fdf
      Jonas Ådahl authored
      It takes coordinates in stage coordinate space, and will result in
      a screen cast stream consisting of that area, but scaled up by the scale
      factor of the view that overlaps with the area and has the highest scale
    • Jonas Ådahl's avatar
      clutter/paint-context: Add 'no-cursors' paint flag · d2c3272e
      Jonas Ådahl authored
      Will be used by the stage to not paint the overlays. We skip all
      overlays since overlays are only ever used for pointer cursors when the
      hardware cursors cannot or should not be used.
    • Jonas Ådahl's avatar
      stage: Only invoke paint phase callbacks when painting views · 90c4b649
      Jonas Ådahl authored
      These phase callbacks are not intended to be inovked when something
      secondary is painting the stage, such as a screen cast stream, or
      similar. Thus, only invoke the callbacks when there is a view associated
      with the paint context, which will not be the case for offscreen
    • Jonas Ådahl's avatar
      clutter/stage: Add API to paint to a custom target · b7bf42e7
      Jonas Ådahl authored
      Either onto a framebuffer, or into a CPU memory buffer. The latter will
      use an former API and then copy the result to CPU memory. The former
      allocates an offscreen framebuffer, sets up the relevant framebuffer
      matrices and paints part of the stage defined by the passed rectangle.
      This will be used by a RecordArea screen cast API. The former to paint
      directly onto PipeWire handled dma-buf framebuffers, and the latter for
      PipeWire handled shared memory buffers.
    • Jonas Ådahl's avatar
    • Jonas Ådahl's avatar
      stage: Pass paint context in phase callbacks · 424016d6
      Jonas Ådahl authored
      If there is a paint context available (i.e. for the phases that are
      during the actual stage paint), pass it along the callbacks, so that
      the callback implementations can change their operation depending on the
      paint context state.
      This also means we can get the current view from the paint context,
      instead of the temporarily used field in the instance struct.
    • Jonas Ådahl's avatar
      clutter/paint-context: Allow passing redraw clip to offscreen paint context · a4f55d49
      Jonas Ådahl authored
      So that we can mark the redraw clip of the part of the stage we're
    • Jonas Ådahl's avatar
      clutter/paint-context: Add paint flag · 1b33a5a3
      Jonas Ådahl authored
      A paint flag affects a paint operation in ways defined by the flags.
      Currently no flags are defined, so no semantical changes are defined
      yet. Eventually a flag aiming to avoid painting of cursors is going to
      be added, so that screen cast streams can decide whether to include a
      cursor or not.
    • Pekka Paalanen's avatar
      kms-impl/simple: Fix page_flip_data ref leak on fallback · 36111270
      Pekka Paalanen authored
      If drmModePageFlip() or custom_page_flip_func fails, process_page_flip() was
      forgetting to undo the ref taken for that call. This would leak page_flip_data.
      The reference counting works like this:
      - when created, ref count is 1
      - when calling drmModePageFlip, ref count is increased to 2
      - new: if flip failed, ref count is decreased back to 1
      - if calling schedule_retry_page_flip(), it takes a ref internally
      - if calling mode_set_fallback(), it takes a ref internally
      - all return FALSE paths have an explicit unref
      - return TRUE path has an explicit unref
      This issue was found by code inspection and while debugging an unrelated issue
      with debug prints sprinkled around. I am not aware of any end-user visible
      issues being fixed by this, as the leak is small and probably very rare.
    • Pekka Paalanen's avatar
      kms: Make GSource ready by default · 6e0cfd3e
      Pekka Paalanen authored
      When testing a laptop with intel and DisplayLink devices, attempting to set the
      DL output as the only active output resulted in GNOME/Wayland freezing. The
      main event loop was running fine, but nothing on screen would get updated once
      the DL output become the only one. This patch fixes that issue.
      DisplayLink USB 3 devices use an out-of-tree kernel DRM driver called EVDI.
      EVDI can sometimes fail drmModePageFlip(). For me, the flip fails reliably when
      hotplugging the DL dock and when changing display configuration to DL only.
      Mutter has a workaround for failing flips, it just calls drmModeSetCrtc() and
      that succeeds.
      What does not work reliably in the fallback path is Mutter keeping track of the
      pageflip. Since drmModePageFlip() failed, there will not be a pageflip event
      coming and instead Mutter queues a callback in its stead. When you have more
      than one output, some other output repainting will attempt to swap buffers and
      calls wait_for_pending_flips() which has the side-effect of dispatching any
      queued flip callbacks. With multiple outputs, you don't get stuck (unless they
      all fail the exact same way at the same time?). When you have only one output,
      it cannot proceed to repaint and buffer swap because the pageflip is not marked
      complete yet. Nothing dispatches the flip callback, leading to the freeze.
      The flip callback is intended to be an idle callback, implemented with a
      GSource. It is supposed to be called as soon as execution returns to the main
      event loop. The setup of the GSource is incomplete, so it will never dispatch.
      Fix the GSource setup by setting its ready-time to be always in the past. That
      gets it dispatched on the next cycle of the main event loop. This is now the
      default behavior for all sources created by meta_kms_add_source_in_impl().
      Sources that need a delay continue to do that by overriding the ready-time
      An alternative solution could have been to implement GSource prepare and check
      callbacks returning TRUE. However, since meta_kms_add_source_in_impl() is used
      by flip retry code as well, and that code needs a delay through the ready-time,
      I was afraid I might break the flip retry code. Hence I decided to use
      ready-time instead.
  7. 21 Apr, 2020 6 commits
    • Carlos Garnacho's avatar
      x11: Allow X11 clients to clear the selection · 5671f0a2
      Carlos Garnacho authored and Robert Mader's avatar Robert Mader committed
      According to the XSetSelectionOwner libX11 documentation:
        [...] If the owner window it has specified in the request is later
        destroyed, the owner of the selection automatically reverts to None,
        but the last-change time is not affected.
      This is indeed visible through the selection_timestamp field in
      XFixesSelectionNotify events.
      Use this to check whether the selection time is recent-ish (thus
      likely coming from an explicit XSetSelectionOwner request) and honor
      the client intent by setting a "NULL" owner. If the selection time
      is too old, it's definitely an indication of the owner client being
      closed, the scenario where we do want the clipboard manager to take
      This fixes two usecases:
      - X11 LibreOffice / WPS clear the selection each time before copying
        its own content. Mutter's clipboard manager would see each of those
        as a hint to take over, competing with the client over selection
        ownership. This would simply no longer happen
      - Password managers may want to clear the selection, which would be
        frustrated by our clipboard manager.
      There's a slight window of opportunity for the heuristics to fail
      though, if a X11 client sets the selection and closes within 50ms, we
      would miss the clipboard manager taking over.
    • Carlos Garnacho's avatar
      x11: Generalize x11 selection owner checks · a7e63bea
      Carlos Garnacho authored and Robert Mader's avatar Robert Mader committed
      Shuffle things so the x11 selection can check the current owner directly,
      instead of its type.
    • Carlos Garnacho's avatar
      x11: Clear X11 selection source after unsetting owner · 94b3c334
      Carlos Garnacho authored and Robert Mader's avatar Robert Mader committed
      The X11 selection source was being preserved after unsetting its
      ownership. This is no leak as it would be eventually replaced by
      another source, or destroyed on finalize. But it's pointless to
      keep it.
    • Jonas Dreßler's avatar
      tests/wayland: Add a test for meta-anonymous-file · efb0addb
      Jonas Dreßler authored
      Test the two modes of MetaAnonymousFile, MAPMODE_SHARED and
      MAPMODE_PRIVATE and make sure they don't leak data to other FDs when
      writing to an FD provided by `meta_anonymous_file_get_fd` even though
      the data of both FDs is residing in the same chunk of memory.
      We do all the reading tests using mmap instead of read() since using
      read() on shared FDs is going to move the read cursor of the fd. That
      means using read() once on the shared FD returned by
      meta_anonymous_file_get_fd() in MAPMODE_PRIVATE breaks every subsequent
      read() call.
      Also test the fallback code of MetaAnonymousFile in case `memfd_create`
      isn't used for the same issues.
    • Jonas Dreßler's avatar
      wayland/keyboard: Use MetaAnonymousFile to share keymap files · 988da215
      Jonas Dreßler authored
      Since protocol version 7 clients must use MAP_PRIVATE to map the keymap
      fd, that means we can use memfd_create() to create the fd by using
      meta_anonymous_file_open_fd() with META_ANONYMOUS_FILE_MAPMODE_PRIVATE,
      for older versions we use META_ANONYMOUS_FILE_MAPMODE_SHARED to be
      compatibile with MAP_SHARED.
      Pretty much all of this code was written for Weston by Sebastian Wick,
      see https://gitlab.freedesktop.org/wayland/weston/merge_requests/240
      Co-authored-by: Sebastian Wick's avatarSebastian Wick <sebastian@sebastianwick.net>
      Fixes gnome-shell#1734
    • Jonas Dreßler's avatar
      Add read-only anonymous file abstraction MetaAnonymousFile · 551a57ed
      Jonas Dreßler authored
      Add MetaAnonymousFile, an abstraction around anonymous read-only files.
      Files can be created by calling meta_anonymous_file_new(), passing the
      data of the file. Subsequent calls to meta_anonymous_file_open_fd()
      return a fd that's ready to be sent over the socket.
      When mapmode is META_ANONYMOUS_FILE_MAPMODE_PRIVATE the fd is only
      guaranteed to be mmap-able readonly with MAP_PRIVATE but does not
      require duplicating the file for each resource when memfd_create is
      available. META_ANONYMOUS_FILE_MAPMODE_SHARED may be used when the
      client must be able to map the file with MAP_SHARED but it also means
      that the file has to be duplicated even when memfd_create is available.
      Pretty much all of this code was written for weston by Sebastian Wick,
      see https://gitlab.freedesktop.org/wayland/weston/merge_requests/240
      Co-authored-by: Sebastian Wick's avatarSebastian Wick <sebastian@sebastianwick.net>
  8. 16 Apr, 2020 15 commits
    • Carlos Garnacho's avatar
      wayland: Drop unused struct variable · b7366b5b
      Carlos Garnacho authored
    • Carlos Garnacho's avatar
      wayland: Move the primary data device manager to its own file · 5e8d8b9a
      Carlos Garnacho authored
      Instead of having everything clumped at MetaWaylandDataManager,
      split the primary selection to its own struct. This manager is
      handled separately from wl_data_device_manager and other selection
      managers, so they would be able to interoperate between them, even.
    • Carlos Garnacho's avatar
      wayland: Move primary data offers to their own file · 4726f3d5
      Carlos Garnacho authored
      Following the MetaWaylandDataOffer split.
    • Carlos Garnacho's avatar
      wayland: Move MetaWaylandDataOffer to its own file · 91ef7515
      Carlos Garnacho authored
      This is still an openly defined struct, as we will need accessed
      by "subclasses". Same principle applies than with the
      MetaWaylandDataSource refactor, this is not meant to introduce
      functional changes, so just go with it.
      On the bright side, the interactions are now clearer, so it could
      be made saner in the future.
    • Carlos Garnacho's avatar
      wayland: Move MetaWaylandDataSourcePrimary to its own file · 317f6c09
      Carlos Garnacho authored
      Following the MetaWaylandDataSource split, this goes next.
    • Carlos Garnacho's avatar
      wayland: Split MetaWaylandDataSource into a separate file · 6a3d5214
      Carlos Garnacho authored
      The split wasn't 100% clean, and some extra private API had to be
      added for it (but well, looking at the API, it's already evident
      there's a cleanup/streamlining task due). This is meant to be a
      refactor with no functional changes, so just go with it.
    • Carlos Garnacho's avatar
      wayland: Rely on MetaSelection::owner-changed for .selection event emission · 1363246d
      Carlos Garnacho authored and Robert Mader's avatar Robert Mader committed
      We already have a signal callback that translates selection ownership changes to
      data_device/primary .selection events. Given both will be run when a data source
      is being replaced, and this event emission being deleted is kinda short sighted
      in that in only knows about Wayland, rely entirely on MetaSelection::owner-changed
      Fixes spurious .selection(null) events being sent when a compositor-local source
      takes over the selection without the focus changing (eg. screenshot to clipboard).
      Closes: #1160
    • Carlos Garnacho's avatar
      wayland: Do not cancel old data source when setting new selection · 0b6560fa
      Carlos Garnacho authored and Carlos Garnacho's avatar Carlos Garnacho committed
      This is taken care already by the MetaSelection machinery, by
      deactivating the previous selection source when setting a new one.
      That works across X11 and internal selection sources. This
      only works when replacing one wayland source with another, and
      actually results in doubly .cancelled events due to the other
      Closes: #1177
    • Carlos Garnacho's avatar
      wayland: Shuffle wl_data_source.cancelled version checks on DnD · d4c38702
      Carlos Garnacho authored and Carlos Garnacho's avatar Carlos Garnacho committed
      We are meant to send a .cancelled event after the drop is performed
      in certain situations, but only for version>3 clients. Since this is
      all version 3 business, only set the drop_performed flag for v3
      clients. This drops the need to perform version checks at the time
      of cancelling (which is present for other usecases in v1).
      Fixes emission of wl_data_source.cancelled for v1 clients.
      Closes: #1177
    • Carlos Garnacho's avatar
      core: Cater for reading selection in chunks · 4bdf9a1e
      Carlos Garnacho authored and Robert Mader's avatar Robert Mader committed
      For the cases where we read a fixed size from the selection (eg. imposing
      limits for the clipboard manager), g_input_stream_read_bytes_async() might
      not read up to this given size if the other side is spoonfeeding it content.
      Cater for multiple read/write cycles here, until (maximum) transfer size is
    • Carlos Garnacho's avatar
      x11: Do not trust there is task in error paths · 1909977a
      Carlos Garnacho authored and Robert Mader's avatar Robert Mader committed
      Flushing the X11 selection output stream may happen synchronously or
      implicitly, in which case there is not a task to complete. Check there
      is actually a task before returning errors. We additionally set the
      pipe_error flag, so future operations will fail with an error, albeit
      with a more generic message.
    • Carlos Garnacho's avatar
      x11: Don't stall on write_async() · 655a7838
      Carlos Garnacho authored and Robert Mader's avatar Robert Mader committed
      If a write_async() comes up while we are flushing on the background,
      the task will be queued, but not deemed a reason on itself to keep
      flushing (and finish the task) after a property delete event.
      To fix this, do not ever queue up write_async tasks (this leaves
      priv->pending_task only used for flush(), so the "flush to end"
      behavior in the background is consistent). We only start a
      background flush if there's reasons to do it, but the tasks are
      immediately finished.
      All data will still be ensured to be transfered on flush/close,
      this makes the caller in this situation still able to reach to it.
    • Carlos Garnacho's avatar
      x11: Fix iterative INCR property checks · a4596bec
      Carlos Garnacho authored and Robert Mader's avatar Robert Mader committed
      It does not make sense to check for the stream not being closed,
      this might happen multiple times during the lifetime of the stream
      for a single transfer. We want to notify the INCR transfer just
      Check for the explicit conditions that we want, that the remaining
      data is bigger than we can transfer at once, and that we are not
      yet within the INCR transfer.
    • Carlos Garnacho's avatar
      x11: Don't exceed transfer size in INCR chunks · 7015bb3e
      Carlos Garnacho authored and Robert Mader's avatar Robert Mader committed
      The stream automatically flushes after data size exceeds the
      size we deem for INCR chunks, but we still try to copy it all.
      Actually limit the data we copy, and leave the rest for future
      INCR chunks.
    • Carlos Garnacho's avatar
      x11: Don't invariably queue a pending delete request · d2c762cc
      Carlos Garnacho authored and Robert Mader's avatar Robert Mader committed
      We don't need doing this roundtrip for non-INCR transfers.