Skip to content
  1. Nov 24, 2020
    • Jonas Ådahl's avatar
      wayland/actor-surface: Queue redraw for frame callback · b1dc6f1a
      Jonas Ådahl authored and Robert Mader's avatar Robert Mader committed
      A frame callback without damage is still expected to be responded to.
      Implement this by simply queuing damage if there are any frame callbacks
      requested and there is no damage yet. If there already is damage,
      we'll be queued already, but with more correct damage. Without we simply
      need to make sure we flush the callbacks if any area of surface is not
      occluded.
      
      Fixes: #457
      
      !839
      
      (cherry picked from commit d49d10b1)
      
      Part-of: <!1570>
      b1dc6f1a
  2. Oct 15, 2020
    • Ray Strode's avatar
      cally: fix state set leak · 1b42dbd6
      Ray Strode authored and Jonas Ådahl's avatar Jonas Ådahl committed
      cally_actor_action_do_action leaks a state set object in the
      case where the actor is defunct, insensitive, or hidden.
      
      This commit plugs the leak.
      
      !1225
      
      
      (cherry picked from commit 79e5ec57)
      1b42dbd6
  3. Sep 28, 2020
    • Jonas Ådahl's avatar
      compositor: Make sure _NET_WM_FRAME_DRAWN timestamp has the right scope · 5703a569
      Jonas Ådahl authored and Georges Basile Stavracas Neto's avatar Georges Basile Stavracas Neto committed
      The timestamp sent with _NET_WM_FRAME_DRAWN should be in "high
      resolution X server timestamps", meaning they should have the same scope
      as the built in X11 32 bit unsigned integer timestamps, i.e. overflow at
      the same time.
      
      This was not done correctly when mutter had determined the X server used
      the monotonic clock, where it'd just forward the monotonic clock,
      confusing any client using _NET_WM_FRAME_DRAWN and friends.
      
      Fix this by 1) splitting the timestamp conversiot into an X11 case and a
      display server case, where the display server case simply clamps the
      monotonic clock, as it is assumed Xwayland is always usign the monotonic
      clock, and 2) if we're a X11 compositing manager, if the X server is
      using the monotonic clock, apply the same semantics as the display
      server case and always just clamp, or if not, calculate the offset every
      10 seconds, and offset the monotonic clock timestamp with the calculated
      X server timestamp offset.
      
      This fixes an issue that would occur if mutter (or rather GNOME Shell)
      would have been started before a X11 timestamp overflow, after the
      overflow happened. In this case, GTK3 clients would get unclamped
      timestamps, and get very confused, resulting in frames queued several
      weeks into the future.
      5703a569
  4. Sep 23, 2020
  5. May 05, 2020
    • Marco Trevisan's avatar
      monitor-config-manager: Fallback to closed laptop lid configuration · 079a625e
      Marco Trevisan authored
      When closing the lid of a laptop, we reconfigure all the monitors in order
      to update the CRTCs and (if enabled) the global UI scaling factor.
      
      To do this, we try first to reuse the current configuration for the usable
      monitors, but if we have only monitor enabled and this one is on the laptop
      lid we just end up creating a new configuration where the primary monitor is
      the laptop one (as per find_primary_monitor() in MetaMonitorConfigManager),
      but ignoring the user parameters.
      
      In case the user selected a different resolution / scaling compared to the
      default one, while the laptop lid is closed we might change the monitors
      layout, causing applications to rescale or reposition.
      
      To avoid this, when creating the monitors configuration from the current
      current state, in case we have only one monitor available and that one is
      the laptop panel, let's just reuse this configuration.
      
      !1200
      
      (cherry-picked from commit e4851667)
      079a625e
    • Florian Müllner's avatar
      window: Really propagate effective on-all-workspaces setting to transients · f3420b03
      Florian Müllner authored and Marco Trevisan's avatar Marco Trevisan committed
      Commit cda95790 fixed a corner case when setting the initial workspace
      state of transient windows, but it still missed a case:
      
      should_be_on_all_workspaces() returns whether the window should be on all
      workspaces according to its properties/placement, but it doesn't take
      transient relations into account.
      
      That means in case of nested transients, we can still fail the assert:
      
       1. on-all-workspaces toplevel
       2. should_be_on_all_workspaces() is TRUE for the first transient's parent,
          as the window from (1) has on_all_workspaces_requested == TRUE
       3. should_be_on_all_workspaces() is FALSE for the second transient's
          parent, as the window from (2) is only on-all-workspace because
          of its parent
      
      We can fix this by either using the state from the root ancestor
      instead of the direct transient parent, or by using the parent's
      on_all_workspaces_state.
      
      The latter is simpler, so go with that.
      
      #1083
      f3420b03
    • Carlos Garnacho's avatar
      core: propagate the effective on-all-workspaces setting to transient window · dde09066
      Carlos Garnacho authored and Marco Trevisan's avatar Marco Trevisan committed
      Commit 09bab98b tried to avoid several workspace changes while in
      window construction, but it missed a case:
      
      If we have a window on a secondary monitor with no workspaces enabled
      (so it implicitly gets on_all_workspaces = TRUE without requesting it)
      and trigger the creation of a second window that has the first as
      transient-for, it would first try to set the first workspace than the
      transient-for window and then fallback to all/current workspace.
      
      After that commit we only try to set the same workspace than the
      transient-for window, but it gets none as neither is on a single workspace,
      nor did really request to be on all workspaces.
      
      Fixes crashes when opening transient X11 dialogs in the secondary monitor.
      
      !714
      dde09066
    • Carlos Garnacho's avatar
      core: Avoid consecutive workspace changes in window construction · a611dadc
      Carlos Garnacho authored and Marco Trevisan's avatar Marco Trevisan committed
      We first set the workspace to the transient-for parent's, and then
      try to set on the current workspace. If both happen, we double the
      work on adding/removing it from the workspace, and everything that
      happens in result.
      
      Should reduce some activity while typing on the Epiphany address
      bar, as the animation results in a number of xdg_popup being created
      and destroyed to handle the animation.
      
      #556
      a611dadc
  6. Apr 24, 2020
    • Jonas Ådahl's avatar
      x11: Limit touch replay pointer events to when replaying · 88e855bf
      Jonas Ådahl authored
      When a touch sequence was rejected, the emulated pointer events would be
      replayed with old timestamps. This caused issues with grabs as they
      would be ignored due to being too old. This was mitigated by making sure
      device event timestamps never travelled back in time by tampering with
      any event that had a timestamp seemingly in the past.
      
      This failed when the most recent timestamp that had been received were
      much older than the timestamp of the new event. This could for example
      happen when a session was left not interacted with for 40+ days or so;
      when interacted with again, as any new timestamp would according to
      XSERVER_TIME_IS_BEFORE() still be in the past compared to the "most
      recent" one. The effect is that we'd always use the `latest_evtime` for
      all new device events without ever updating it.
      
      The end result of this was that passive grabs would become active when
      interacted with, but would then newer be released, as the timestamps to
      XIAllowEvents() would out of date, resulting in the desktop effectively
      freezing, as the Shell would have an active pointer grab.
      
      To avoid the situation where we get stuck with an old `latest_evtime`
      timestamp, limit the tampering with device event timestamp to 1) only
      pointer events, and 2) only during the replay sequence. The second part
      is implemented by sending an asynchronous message via the X server after
      rejecting a touch sequence, only potentially tampering with the device
      event timestamps until the reply. This should avoid the stuck timestamp
      as in those situations, we'll always have a relatively up to date
      `latest_evtime` meaning XSERVER_TIME_IS_BEFORE() will not get confused.
      
      !886
      88e855bf
    • Jonas Ådahl's avatar
      display: Move finishing of touch sequence to the backend · f205dabc
      Jonas Ådahl authored
      We need to manipulate an X11 grab when a touch sequence ends; move that
      logic to where it belongs - in the X11 backend.
      
      !886
      f205dabc
  7. Jul 18, 2019
    • Marco Trevisan's avatar
      window-x11: Focus a window in the active workspace as take-focus fallback · 74e3126b
      Marco Trevisan authored
      Starting with commit 2db94e2e we try to focus a fallback default focus window
      if no take-focus window candidate gets the input focus when we request it and
      we limit the focus candidates to the current window's workspace.
      
      However, if the window is unmanaging, the workspace might be unset, and we could
      end up in deferencing a NULL pointer causing a crash.
      
      So, in case the window's workspace is unset, just use the currently active
      workspace for the display.
      
      Closes #687
      
      !688
      
      (cherry picked from commit 5ca0ef07)
      74e3126b
  8. Jul 08, 2019
    • Jonas Ådahl's avatar
      monitor-manager: Don't use switch-config when ensuring configuration · 4f36e82f
      Jonas Ådahl authored and Marco Trevisan's avatar Marco Trevisan committed
      Switch-configs are only to be used in certain circumstances (see
      meta_monitor_manager_can_switch_config()) so when ensuring
      configuration and attempting to create a linear configuration, use the
      linear configuration constructor function directly without going via the
      switch config method, otherwise we might incorrectly fall back to the
      fallback configuration (only enable primary monitor).
      
      This is a regression introduced by 6267732b.
      
      Fixes: #342
      
      
      (cherry picked from commit 149e4d69)
      4f36e82f
    • Daniel Drake's avatar
      monitor-manager: use MonitorsConfig to track switch_config · b7bc8e56
      Daniel Drake authored and Marco Trevisan's avatar Marco Trevisan committed
      When constructing MetaMonitorsConfig objects, store which type
      of switch_config they are for (or UNKNOWN if it is not such
      type of config).
      
      Stop unconditionally setting current_switch_config to UNKNOWN when
      handling monitors changed events. Instead, set it to the switch_config
      type stored in the MonitorsConfig in the codepath that updates logical
      state. In addition to being called in the hotplug case along the same
      code flow that generates monitors changed events, this is also called
      in the coldplug case where a secondary monitor was connected before
      mutter was started.
      
      When creating the default linear display config, create it as a
      switch_config so that internal state gets updated to represent
      linear mode when this config is used.
      
      The previous behaviour of unconditionally resetting current_switch_config
      to UNKNOWN was breaking the internal state machine for display config
      switching, causing misbehaviour in gnome-shell's switchMonitor UI when
      using display switch hotkeys. The lack of internal tracking when the
      displays are already in the default "Join Displays" linear mode was
      then causing the first display switch hotkey press to do nothing
      (it would attempt to select "Join Displays" mode, but that was already
      active).
      
      Fixes: #281
      !213
      
      
      (cherry picked from commit 6267732b)
      b7bc8e56
    • Marco Trevisan's avatar
      screen: Unset the active workspace and remove workspaces on free · d3f75f31
      Marco Trevisan authored and Marco Trevisan's avatar Marco Trevisan committed
      Related to #652
      d3f75f31
    • Marco Trevisan's avatar
      screen: Destroy window actors after windows while unmanaging compositor · 0ca9d889
      Marco Trevisan authored and Marco Trevisan's avatar Marco Trevisan committed
      After commit 2e64457f we destroy window actors as part of compositor
      destruction, however this might emit 'actor-removed' signals on window groups
      that the shell could use to access to resources that are already free'd at this
      point (like the destroyed screen, in gnome-shell's Panel._updateSolidStyle()).
      
      So, move the actor destructions under in a new function and destroy the window
      actors as part of compositor unmanage step, just after that all the windows are
      unmanaged (as they need to have an actor around).
      
      Fixes #652
      0ca9d889
    • Marco Trevisan's avatar
      window-x11: Use any focusable window as fallback delayed focus window · 02766306
      Marco Trevisan authored
      As per commit f71151a5 we focus an input window if no take-focus-window accepts
      it. This might lead to an infinite loop if there are various focusable but
      non-input windows in the stack.
      
      When the current focus window is unmanaging and we're trying to focus a
      WM_TAKE_FOCUS window, we intent to give the focus to the first focusable input
      window in the stack.
      
      However, if an application (such as the Java ones) only uses non-input
      WM_TAKE_FOCUS windows, are not requesting these ones to get the focus. This
      might lead to a state where no window is focused, or a wrong one is.
      
      So, instead of only focus the first eventually input window available, try to
      request to all the take-focus windows that are in the stack between the
      destroyed one and the first input one to acquire the input focus.
      Use a queue to keep track of those windows, that is passed around stealing
      ownership, while we protect for unmanaged queued windows.
      
      Also, reduce the default timeout value, as the previous one might lead to an
      excessive long wait.
      
      Added metatests verifying these situations.
      
      Closes: #660
      !669
      
      (cherry picked from commit 6d8293a4)
      02766306
    • Marco Trevisan's avatar
      stack: Add a function to get a sorted list of focus candidates · 7d54c562
      Marco Trevisan authored
      Use a static function if a window can be the default focus window, and use such
      function to return a filtered list of the stack.
      
      !669
      
      (cherry picked from commit 2439255f)
      7d54c562
    • Marco Trevisan's avatar
      window-x11: Accept any focusable window as fallback focus · 7951ddab
      Marco Trevisan authored
      As per commit f71151a5 we were ignoring WM_TAKE_FOCUS-only windows as focus
      targets, however this might end-up in an infinite loop if there are multiple
      non-input windows stacked.
      
      So, accept any focusable window as fallback focus target even if it's a
      take-focus one (that might not reply to the request).
      
      Added a stacking test to verify this.
      
      Closes: #660
      !669
      
      (cherry picked from commit c327b2df)
      7951ddab
    • Marco Trevisan's avatar
      window-x11: Don't double-check for unmanaging windows · a6df7717
      Marco Trevisan authored
      When looking for the best fallback focus window, we ignore it if it is in the
      unmanaging state, but meta_stack_get_default_focus_window() does this is check
      for us already.
      
      So, ignore the redundant test.
      
      !669
      
      
      (cherry picked from commit 9aee47da)
      a6df7717
  9. Jun 28, 2019
  10. Jun 24, 2019
  11. May 27, 2019
  12. May 14, 2019
  13. May 03, 2019
    • Marco Trevisan's avatar
      compositor: Disconnect from stage signals on destruction · b838fe8f
      Marco Trevisan authored and Marco Trevisan's avatar Marco Trevisan committed
      From this point there's not any need for the compositor to listen to signals
      so we can disconnect from the stage ones we are connected to.
      
      !556
      
      
      (cherry picked from commit 3ba79961)
      b838fe8f
    • Marco Trevisan's avatar
      compositor: Destroy window actors list on destruction · 2e64457f
      Marco Trevisan authored and Marco Trevisan's avatar Marco Trevisan committed
      When the compositor is destroyed we should cleanup the list of window actors we
      created and destroy them.
      Since all the actors are added to the window_group or top_window_group we can
      just destroy these containers (together with the feedback_group), and simply
      free the windows list.
      
      This is particularly needed under X11 because before we destroy the display, we
      might do some cleanups as detaching the surface pixmaps and freeing the damages
      and if this happens at later point (for example when triggered by garbage
      collector in gnome-shell), we might crash because the x11 dpy reference is
      already gone.
      
      Destroying the window actors instead, ensures we avoid any further call to X11
      related functions and that we release the actors XServer resources.
      
      Fixes #576
      
      
      (cherry picked from commit 7718e67f)
      2e64457f
    • Daniel van Vugt's avatar
      wayland: Remove unused GList *l · 9b289728
      Daniel van Vugt authored and Marco Trevisan's avatar Marco Trevisan committed
      
      (cherry picked from commit db5abbb2)
      9b289728
    • Andrea Azzarone's avatar
      clutter/x11: Implement keycode remap to keysyms on virtual key devices · 6198d389
      Andrea Azzarone authored and Marco Trevisan's avatar Marco Trevisan committed
      Keycode lookup can fail for serveral reasons, e.g. if there is no combination of
      modifiers and keycodes that can produce the target keysym with the current
      keyboard layout.
      
      In case the keycode lookup fails, remap temporarily the keysym to an unused
      keycodes.
      
      Fixes: gnome-shell#109
      
      (cherry-picked from commit e3e933c4)
      6198d389
  14. Apr 30, 2019
    • Andrea Azzarone's avatar
      clutter/x11: Consider remapped keys when guessing the keycode from the keysym · 24b4c82a
      Andrea Azzarone authored and Marco Trevisan's avatar Marco Trevisan committed
      Since e3e933c4 a keyval can be temporarily remapped to an unused keycode. Due to
      some limitations in XTestFakeKeyEvent, the remapping has to be done in the first
      xkb group/layout. In case there are two or more keyboard layouts enabled and the
      selected keyboard layout is not the first, clutter_keymap_x11_keycode_for_keyval
      will fail to retrieve the correct keycode for a remapped keyval. Let's use the
      reserved_keycodes map in order to retrieve the correct keycode if needed.
      
      Fixes: #443
      
      
      (cherry picked from commit e0811ce1)
      24b4c82a
  15. Jan 24, 2019