1. 17 Jun, 2020 1 commit
    • Carlos Garnacho's avatar
      wayland: Avoid popup grab focus changes if there's an implicit grab · 79050004
      Carlos Garnacho authored and Georges Basile Stavracas Neto's avatar Georges Basile Stavracas Neto committed
      Event delivery with grabbing popups stay essentially the same within
      the grabbing client, we still must honor the implicit grab as long as
      there is one.
      
      This is however not the case, the popup_grab_focus() function ignores
      the button state. The popup_grab_button() function will already indirectly
      re-sync the focus surface after the last button is released, so checking
      for button state in popup_grab_focus() is sufficient to make the implicit
      grab honored with popup grabs involved.
      
      Fixes: #1275
      
      !1270
      79050004
  2. 16 Jun, 2020 9 commits
    • Jonas Ådahl's avatar
      stage/x11: Check that message is WM_PROTOCOLS before assuming so · e5ea8f54
      Jonas Ådahl authored
      When a touch sequence was rejected, we'd update the event timestamps of
      incoming touch events to help with implementing grabs. This was done by
      sending a ClientMessage with a counter, and comparing the counter to
      decide whether we're seing a replayed event or not.
      
      This had the unforseen consequence that we would potentially end up
      destroying all actors including the stage, since, when mutter receives a
      ClientMessage event, it would assume that it's a WM_PROTOCOLS event, and
      handle it as such. The problem with this approach is that it would
      ignore fact that there might be other ClientMessage types sent to it,
      for example the touch synchronization one. What could happen is that the
      touch count value would match up with the value of the WM_DELETE_WINDOW
      atom, clutter would treat this as WM_PROTOCOLS:WM_DELETE_WINDOW, which
      it'd translate to clutter_actor_destroy(stage).
      
      Destroying the stage in such a way is not expected, and caused wierd
      crashes in different places depending on what was going on.
      
      This commit make sure we only treat WM_PROTOCOLS client messages as
      WM_PROTOCOLS client messages effectively avoiding the issue.
      
      This fixes crashes such as:
      
       #0  meta_window_get_buffer_rect (window=0x0, rect=rect@entry=0x7ffd7fc62e40) at core/window.c:4396
       #1  0x00007f1e2634837f in get_top_visible_window_actor (compositor=0x297d700, compositor=0x297d700) at compositor/compositor.c:1059
       #2  meta_compositor_sync_stack (compositor=0x297d700, stack=<optimized out>, stack@entry=0x26e3140) at compositor/compositor.c:1176
       #3  0x00007f1e263757ac in meta_stack_tracker_sync_stack (tracker=0x297dbc0) at core/stack-tracker.c:871
       #4  0x00007f1e26375899 in stack_tracker_sync_stack_later (data=<optimized out>) at core/stack-tracker.c:881
       #5  0x00007f1e26376914 in run_repaint_laters (laters_list=0x7f1e2663b7d8 <laters+24>) at core/util.c:809
       #6  run_all_repaint_laters (data=<optimized out>) at core/util.c:826
       #7  0x00007f1e26b18325 in _clutter_run_repaint_functions (flags=flags@entry=CLUTTER_REPAINT_FLAGS_PRE_PAINT) at clutter-main.c:3448
       #8  0x00007f1e26b18fc5 in master_clock_update_stages (master_clock=0x32d6a80, stages=0x4e5a740) at clutter-master-clock-default.c:437
       #9  clutter_clock_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at clutter-master-clock-default.c:567
       #10 0x00007f1e27e48049 in g_main_dispatch (context=0x225b8d0) at gmain.c:3175
       #11 g_main_context_dispatch (context=context@entry=0x225b8d0) at gmain.c:3828
       #12 0x00007f1e27e483a8 in g_main_context_iterate (context=0x225b8d0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3901
       #13 0x00007f1e27e4867a in g_main_loop_run (loop=0x24e29f0) at gmain.c:4097
       #14 0x00007f1e2636a3dc in meta_run () at core/main.c:666
       #15 0x000000000040219c in main (argc=1, argv=0x7ffd7fc63238) at ../src/main.c:534
      
      and
      
       #0  0x00007f93943c1f25 in raise () at /usr/lib/libc.so.6
       #1  0x00007f93943ab897 in abort () at /usr/lib/libc.so.6
       #2  0x00007f9393e1e062 in g_assertion_message (domain=<optimized out>, file=<optimized out>, line=<optimized out>, func=0x7f93933e6860 <__func__.116322> "meta_x11_get_stage_window",
       #3  0x00007f9393e4ab1d in g_assertion_message_expr ()
       #4  0x00007f939338ecd7 in meta_x11_get_stage_window (stage=<optimized out>) at ../mutter/src/backends/x11/meta-stage-x11.c:923
       #5  0x00007f939339e599 in meta_backend_x11_cm_translate_device_event (x11=<optimized out>, device_event=0x55bc8bcfd6b0) at ../mutter/src/backends/x11/cm/meta-backend-x11-cm.c:381
       #6  0x00007f939339f2e2 in meta_backend_x11_translate_device_event (device_event=0x55bc8bcfd6b0, x11=0x55bc89dd5220) at ../mutter/src/backends/x11/meta-backend-x11.c:179
       #7  0x00007f939339f2e2 in translate_device_event (device_event=0x55bc8bcfd6b0, x11=0x55bc89dd5220) at ../mutter/src/backends/x11/meta-backend-x11.c:208
       #8  0x00007f939339f2e2 in maybe_spoof_event_as_stage_event (input_event=0x55bc8bcfd6b0, x11=0x55bc89dd5220) at ../mutter/src/backends/x11/meta-backend-x11.c:284
       #9  0x00007f939339f2e2 in handle_input_event (event=0x7fff62d60490, x11=0x55bc89dd5220) at ../mutter/src/backends/x11/meta-backend-x11.c:309
       #10 0x00007f939339f2e2 in handle_host_xevent (event=0x7fff62d60490, backend=0x55bc89dd5220) at ../mutter/src/backends/x11/meta-backend-x11.c:413
       #11 0x00007f939339f2e2 in x_event_source_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at ../mutter/src/backends/x11/meta-backend-x11.c:467
       #12 0x00007f9393e6c39e in g_main_dispatch (context=0x55bc89dd03e0) at ../glib/glib/gmain.c:3179
       #13 0x00007f9393e6c39e in g_main_context_dispatch (context=context@entry=0x55bc89dd03e0) at ../glib/glib/gmain.c:3844
       #14 0x00007f9393e6e1b1 in g_main_context_iterate (context=0x55bc89dd03e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/glib/gmain.c:3917
       #15 0x00007f9393e6f0c3 in g_main_loop_run (loop=0x55bc8a042640) at ../glib/glib/gmain.c:4111
       #16 0x00007f9393369a0c in meta_run () at ../mutter/src/core/main.c:676
       #17 0x000055bc880f2426 in main (argc=<optimized out>, argv=<optimized out>) at ../gnome-shell/src/main.c:552
      
      Related: #338
      Closes: #951
      
      !1317
      e5ea8f54
    • Jonas Dreßler's avatar
      clutter/actor: Clean up clutter_actor_event() · 0ab1a9fa
      Jonas Dreßler authored and Jonas Dreßler's avatar Jonas Dreßler committed
      We can easily do without the goto statement and use only one switch
      statement in this function, so tidy it up a bit.
      
      !1275
      0ab1a9fa
    • Jonas Dreßler's avatar
      clutter: Also remove event sequences on TOUCH_CANCEL events · cb0cc426
      Jonas Dreßler authored and Jonas Dreßler's avatar Jonas Dreßler committed
      We don't want to leave event sequences around when touches are
      cancelled, so also remove those from the ClutterInputDevice's hashtable.
      
      !1275
      cb0cc426
    • Jonas Dreßler's avatar
      clutter/stage: Don't update modifier state when queuing event · b36cfb5b
      Jonas Dreßler authored and Jonas Dreßler's avatar Jonas Dreßler committed
      The modifier state of the input device is supposed to be set to the
      newest state, while the modifier state detail of the event is set to the
      last state before the event (so not including the changes triggered by
      the event).
      
      So since the modifier state of the event is the last state anyway, the
      state of the ClutterInputDevice is supposed to be set by the backend and
      not by the stage while queuing the event, so stop setting the state
      here.
      
      !1275
      b36cfb5b
    • Jonas Dreßler's avatar
      clutter/input-device: Make clutter_input_device_get_actor() public · 7539de23
      Jonas Dreßler authored and Jonas Dreßler's avatar Jonas Dreßler committed
      Make the clutter_input_device_get_actor() API public and remove
      clutter_input_device_get_pointer_actor() in favour of the new function.
      
      This allows also getting the "pointer" actor for a given touch sequence,
      not only for real pointer input devices like mice.
      
      !1275
      7539de23
    • Jonas Dreßler's avatar
      clutter/stage: Switch to clutter_seat_peek_devices() · 8de91f10
      Jonas Dreßler authored and Jonas Dreßler's avatar Jonas Dreßler committed
      Switch from clutter_seat_list_devices() to the new peek_devices() method
      of ClutterSeat in cases where we're only looping through the returned
      list without manipulating it. This way we don't have to unnecessarily
      copy around the list of devices.
      
      !1275
      8de91f10
    • Jonas Dreßler's avatar
      clutter/seat: Add private method to peek list of input devices · 45c14f74
      Jonas Dreßler authored and Jonas Dreßler's avatar Jonas Dreßler committed
      Add a method to ClutterSeat that allows peeking the list of input
      devices and allow looping through devices a bit faster. The API left is
      private so we can make use of peeking the GList internally, but don't
      have to expose any details to the outside, which means we'd have to
      eventually stick with a GList forever to avoid breaking API.
      
      Since we now have the peek_devices() API internally, we can implement
      ClutterSeats public list_devices() API using g_list_copy() on the list
      returned by peek_devices().
      
      !1275
      45c14f74
    • Jonas Dreßler's avatar
      clutter/seat: Fix a typo in an introspection doc · d4457d1f
      Jonas Dreßler authored and Jonas Dreßler's avatar Jonas Dreßler committed
      Make sure that function is actually skipped, gobject-introspection
      should probably complain about that function which can't be found.
      
      !1275
      d4457d1f
    • Jonas Dreßler's avatar
      clutter/stage: Don't do newly queued relayouts after allocation cycle · 0ba15df5
      Jonas Dreßler authored and Robert Mader's avatar Robert Mader committed
      While it's strongly discouraged, it is possible to queue a new relayout
      of an actor in the middle of an allocation cycle, we warn about it but
      don't forbid it.
      
      With the introduction of the "shallow relayout" API, our handling of
      those relayouts silently changed: Before introducing "shallow
      relayouts", we'd handle them on the next stage update, but with the
      priv->pending_relayouts hashtable and the
      priv->pending_relayouts_version counter, we now do them immediately
      during the same allocation cycle (the counter is increased by 1 when
      queuing the relayout and we switch to a new GHashTableIter after
      finishing the current relayout, which means we'll now do the newly
      queued relayout).
      
      This change in behavior was probably not intended and wasn't mentioned
      in the commit message of 5257c6ec, so
      switch back to the old behavior, which is more robust in preventing
      allocation-loops. To do this, use a GSList instead of GHashTable for the
      pending_relayouts list, and simply steal that list before doing the
      relayouts in _clutter_stage_maybe_relayout().
      
      !1267
      0ba15df5
  3. 15 Jun, 2020 4 commits
    • Corentin Noël's avatar
      window-actor-x11: switch the signal callback argument and data on shadow factory change · e09ac676
      Corentin Noël authored and Georges Basile Stavracas Neto's avatar Georges Basile Stavracas Neto committed
      invalidate_shadow takes the MetaWindowActorX11 as argument and not the MetaShadowFactory.
      
      !1314
      e09ac676
    • Jonas Dreßler's avatar
      window-actor: Don't freeze actor updates during the size-change effect · e6a93326
      Jonas Dreßler authored and Robert Mader's avatar Robert Mader committed
      As explained in the last commits, we'll let gnome-shell take care of
      this since freezing and thawing needs to be decoupled from the effect
      starting and ending.
      
      So stop freezing the MetaWindowActor when starting the effect and
      thawing the actor when ending the effect.
      
      !1250
      e6a93326
    • Jonas Dreßler's avatar
      window-actor: Make freezing and thawing of actor updates public API · fb474fb6
      Jonas Dreßler authored and Robert Mader's avatar Robert Mader committed
      As explained in the last commit, gnome-shell needs to be able to thaw
      window actor updates during its size-change effect is active.
      
      So make meta_window_actor_freeze() and meta_window_actor_thaw() public
      API, which will allow the shell to freeze and thaw actor updates itself.
      
      !1250
      fb474fb6
    • Jonas Dreßler's avatar
      window-actor: Allow syncing actor geometry while effect is running · d12dc993
      Jonas Dreßler authored and Robert Mader's avatar Robert Mader committed
      The size-change animation in gnome-shell needs to sync the window actors
      geometry during the animation, it currently does this by notifying the
      compositor that the animation was finished before it actually is.
      
      This causes a few bugs in Mutter though, since it will now emit the
      "effects-completed" signal on the window actor even though they aren't
      completed.
      
      To fix that, we need to decouple freezing and thawing of actor updates
      from window effects and allow gnome-shell to thaw actor updates before
      it notifies Mutter that the effect is completed.
      
      The first step for this is allowing to sync the actor geometry while an
      effect is active, this should be redundant since effects which actually
      need to inhibit those updates will freeze the actor anyway. Also a
      geometry change happening while another effect is active will kill the
      old effect anyway because MetaPluginManager kills all the active window
      effects before starting a new one; so the new size-change effect for any
      geometry change is going to kill the current effect.
      
      !1250
      d12dc993
  4. 11 Jun, 2020 7 commits
  5. 10 Jun, 2020 19 commits