Compare commits
	
		
			10 Commits
		
	
	
		
			3.37.3
			...
			wip/ssd-bl
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 8904c55a86 | ||
|   | 7f4f5f5c4c | ||
|   | 0d1cee5123 | ||
|   | 24b9f2fabc | ||
|   | fbf7e0073e | ||
|   | db1adab828 | ||
|   | 8369fde7f8 | ||
|   | 80562bbb10 | ||
|   | c21d12c4ac | ||
|   | 3488015d17 | 
| @@ -684,6 +684,9 @@ meta_compositor_sync_updates_frozen (MetaCompositor *compositor, | ||||
|                                      MetaWindow     *window) | ||||
| { | ||||
|   MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window)); | ||||
|   if (!window_actor) | ||||
|     return; | ||||
|  | ||||
|   meta_window_actor_sync_updates_frozen (window_actor); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -99,6 +99,20 @@ meta_surface_actor_wayland_add_frame_callbacks (MetaSurfaceActorWayland *self, | ||||
|   wl_list_insert_list (&priv->frame_callback_list, frame_callbacks); | ||||
| } | ||||
|  | ||||
| static void | ||||
| meta_surface_actor_wayland_set_frozen (MetaSurfaceActor *actor, | ||||
|                                        gboolean          is_frozen) | ||||
| { | ||||
|   MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (actor); | ||||
|   MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self); | ||||
|  | ||||
|   META_SURFACE_ACTOR_CLASS (meta_surface_actor_wayland_parent_class)->set_frozen (actor, | ||||
|                                                                                   is_frozen); | ||||
|  | ||||
|   if (surface) | ||||
|     meta_wayland_surface_set_frozen (surface, is_frozen); | ||||
| } | ||||
|  | ||||
| static MetaWindow * | ||||
| meta_surface_actor_wayland_get_window (MetaSurfaceActor *actor) | ||||
| { | ||||
| @@ -111,6 +125,17 @@ meta_surface_actor_wayland_get_window (MetaSurfaceActor *actor) | ||||
|   return surface->window; | ||||
| } | ||||
|  | ||||
| static void | ||||
| meta_surface_actor_wayland_size_changed (MetaSurfaceActor *actor) | ||||
| { | ||||
|   MetaWindow *window; | ||||
|  | ||||
|   window = meta_surface_actor_wayland_get_window (actor); | ||||
|  | ||||
|   if (window) | ||||
|     meta_window_set_resize_pending (window, FALSE); | ||||
| } | ||||
|  | ||||
| static void | ||||
| meta_surface_actor_wayland_get_preferred_width  (ClutterActor *actor, | ||||
|                                                  gfloat        for_height, | ||||
| @@ -220,8 +245,11 @@ meta_surface_actor_wayland_class_init (MetaSurfaceActorWaylandClass *klass) | ||||
|   surface_actor_class->set_unredirected = meta_surface_actor_wayland_set_unredirected; | ||||
|   surface_actor_class->is_unredirected = meta_surface_actor_wayland_is_unredirected; | ||||
|  | ||||
|   surface_actor_class->set_frozen = meta_surface_actor_wayland_set_frozen; | ||||
|   surface_actor_class->get_window = meta_surface_actor_wayland_get_window; | ||||
|  | ||||
|   surface_actor_class->size_changed = meta_surface_actor_wayland_size_changed; | ||||
|  | ||||
|   object_class->dispose = meta_surface_actor_wayland_dispose; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -31,6 +31,9 @@ struct _MetaSurfaceActorPrivate | ||||
|  | ||||
| static void cullable_iface_init (MetaCullableInterface *iface); | ||||
|  | ||||
| void meta_surface_actor_real_set_frozen (MetaSurfaceActor *self, | ||||
|                                          gboolean          frozen); | ||||
|  | ||||
| G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaSurfaceActor, meta_surface_actor, CLUTTER_TYPE_ACTOR, | ||||
|                                   G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init)); | ||||
|  | ||||
| @@ -121,6 +124,8 @@ meta_surface_actor_class_init (MetaSurfaceActorClass *klass) | ||||
|   object_class->dispose = meta_surface_actor_dispose; | ||||
|   actor_class->pick = meta_surface_actor_pick; | ||||
|  | ||||
|   klass->set_frozen = meta_surface_actor_real_set_frozen; | ||||
|  | ||||
|   signals[REPAINT_SCHEDULED] = g_signal_new ("repaint-scheduled", | ||||
|                                              G_TYPE_FROM_CLASS (object_class), | ||||
|                                              G_SIGNAL_RUN_LAST, | ||||
| @@ -130,8 +135,8 @@ meta_surface_actor_class_init (MetaSurfaceActorClass *klass) | ||||
|  | ||||
|   signals[SIZE_CHANGED] = g_signal_new ("size-changed", | ||||
|                                         G_TYPE_FROM_CLASS (object_class), | ||||
|                                         G_SIGNAL_RUN_LAST, | ||||
|                                         0, | ||||
|                                         G_SIGNAL_RUN_FIRST, | ||||
|                                         G_STRUCT_OFFSET (MetaSurfaceActorClass, size_changed), | ||||
|                                         NULL, NULL, NULL, | ||||
|                                         G_TYPE_NONE, 0); | ||||
|  | ||||
| @@ -331,6 +336,13 @@ meta_surface_actor_is_visible (MetaSurfaceActor *self) | ||||
| void | ||||
| meta_surface_actor_set_frozen (MetaSurfaceActor *self, | ||||
|                                gboolean          frozen) | ||||
| { | ||||
|   return META_SURFACE_ACTOR_GET_CLASS (self)->set_frozen (self, frozen); | ||||
| } | ||||
|  | ||||
| void | ||||
| meta_surface_actor_real_set_frozen (MetaSurfaceActor *self, | ||||
|                                     gboolean          frozen) | ||||
| { | ||||
|   MetaSurfaceActorPrivate *priv = self->priv; | ||||
|  | ||||
|   | ||||
| @@ -36,7 +36,12 @@ struct _MetaSurfaceActorClass | ||||
|                                   gboolean          unredirected); | ||||
|   gboolean (* is_unredirected)   (MetaSurfaceActor *actor); | ||||
|  | ||||
|   void     (* set_frozen)        (MetaSurfaceActor *actor, | ||||
|                                   gboolean          is_frozen); | ||||
|  | ||||
|   MetaWindow *(* get_window)      (MetaSurfaceActor *actor); | ||||
|  | ||||
|   void     (* size_changed)      (MetaSurfaceActor *actor); | ||||
| }; | ||||
|  | ||||
| struct _MetaSurfaceActor | ||||
|   | ||||
| @@ -53,6 +53,8 @@ struct _MetaWindowActorPrivate | ||||
|   MetaWindow *window; | ||||
|   MetaCompositor *compositor; | ||||
|  | ||||
|   MetaCompEffect  pending_effect; | ||||
|  | ||||
|   MetaSurfaceActor *surface; | ||||
|  | ||||
|   /* MetaShadowFactory only caches shadows that are actually in use; | ||||
| @@ -117,6 +119,7 @@ struct _MetaWindowActorPrivate | ||||
|  | ||||
|   guint             updates_frozen         : 1; | ||||
|   guint             first_frame_state      : 2; /* FirstFrameState */ | ||||
|   guint             has_pending_effect     : 1; | ||||
| }; | ||||
|  | ||||
| typedef struct _FrameData FrameData; | ||||
| @@ -296,6 +299,7 @@ surface_size_changed (MetaSurfaceActor *actor, | ||||
|   MetaWindowActor *self = META_WINDOW_ACTOR (user_data); | ||||
|  | ||||
|   meta_window_actor_update_shape (self); | ||||
|   meta_window_actor_handle_updates (self); | ||||
| } | ||||
|  | ||||
| static void | ||||
| @@ -345,8 +349,11 @@ meta_window_actor_freeze (MetaWindowActor *self) | ||||
| { | ||||
|   MetaWindowActorPrivate *priv = self->priv; | ||||
|  | ||||
|   if (priv->freeze_count == 0 && priv->surface) | ||||
|     meta_surface_actor_set_frozen (priv->surface, TRUE); | ||||
|   if (priv->freeze_count == 0) | ||||
|     { | ||||
|       if (priv->surface) | ||||
|         meta_surface_actor_set_frozen (priv->surface, TRUE); | ||||
|     } | ||||
|  | ||||
|   priv->freeze_count ++; | ||||
| } | ||||
| @@ -359,6 +366,12 @@ meta_window_actor_sync_thawed_state (MetaWindowActor *self) | ||||
|   if (priv->first_frame_state == INITIALLY_FROZEN) | ||||
|     priv->first_frame_state = DRAWING_FIRST_FRAME; | ||||
|  | ||||
|   if (priv->has_pending_effect) | ||||
|     { | ||||
|       meta_window_actor_show (self, priv->pending_effect); | ||||
|       priv->has_pending_effect = FALSE; | ||||
|     } | ||||
|  | ||||
|   if (priv->surface) | ||||
|     meta_surface_actor_set_frozen (priv->surface, FALSE); | ||||
|  | ||||
| @@ -1317,6 +1330,13 @@ meta_window_actor_show (MetaWindowActor   *self, | ||||
|  | ||||
|   g_return_if_fail (!priv->visible); | ||||
|  | ||||
|   if (is_frozen (self)) | ||||
|     { | ||||
|       priv->pending_effect = effect; | ||||
|       priv->has_pending_effect = TRUE; | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   self->priv->visible = TRUE; | ||||
|  | ||||
|   switch (effect) | ||||
| @@ -1918,10 +1938,11 @@ meta_window_actor_handle_updates (MetaWindowActor *self) | ||||
| { | ||||
|   MetaWindowActorPrivate *priv = self->priv; | ||||
|  | ||||
|   if (is_frozen (self)) | ||||
|   if (is_frozen (self) || meta_window_resize_is_pending (priv->window)) | ||||
|     { | ||||
|       /* The window is frozen due to a pending animation: we'll wait until | ||||
|        * the animation finishes to reshape and repair the window */ | ||||
|       /* If the window is frozen due to a pending animation or a resize is | ||||
|        * pending then we'll wait until the animation or resize finishes to | ||||
|        * reshape and repair the window */ | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -407,6 +407,12 @@ struct _MetaWindow | ||||
|   /* whether or not the window is from a program running on another machine */ | ||||
|   guint is_remote : 1; | ||||
|  | ||||
|   /* if TRUE, the X server hasn't yet committed a new buffer following resize of the frame/client window */ | ||||
|   guint resize_pending : 1; | ||||
|  | ||||
|   /* if TRUE, the window frame has a redraw queued */ | ||||
|   guint frame_redraw_pending : 1; | ||||
|  | ||||
|   /* if non-NULL, the bounds of the window frame */ | ||||
|   cairo_region_t *frame_bounds; | ||||
|  | ||||
| @@ -781,6 +787,12 @@ void meta_window_move_resize_internal (MetaWindow          *window, | ||||
|                                        MetaMoveResizeFlags  flags, | ||||
|                                        int                  gravity, | ||||
|                                        MetaRectangle        frame_rect); | ||||
| void meta_window_set_resize_pending (MetaWindow *window, | ||||
|                                      gboolean    is_resize_pending); | ||||
| gboolean meta_window_resize_is_pending (MetaWindow  *window); | ||||
|  | ||||
| void meta_window_set_frame_redraw_pending (MetaWindow *window, | ||||
|                                            gboolean    is_frame_redraw_pending); | ||||
|  | ||||
| void meta_window_grab_op_began (MetaWindow *window, MetaGrabOp op); | ||||
| void meta_window_grab_op_ended (MetaWindow *window, MetaGrabOp op); | ||||
|   | ||||
| @@ -3730,6 +3730,9 @@ meta_window_updates_are_frozen (MetaWindow *window) | ||||
|   if (window->sync_request_serial < window->sync_request_wait_serial) | ||||
|     return TRUE; | ||||
|  | ||||
|   if (window->frame_redraw_pending) | ||||
|     return TRUE; | ||||
|  | ||||
|   return FALSE; | ||||
| } | ||||
|  | ||||
| @@ -6311,6 +6314,28 @@ meta_window_update_resize (MetaWindow *window, | ||||
|   update_resize (window, snap, x, y, force); | ||||
| } | ||||
|  | ||||
| void | ||||
| meta_window_set_resize_pending (MetaWindow *window, | ||||
|                                 gboolean    is_resize_pending) | ||||
| { | ||||
|   window->resize_pending = is_resize_pending; | ||||
| } | ||||
|  | ||||
| gboolean | ||||
| meta_window_resize_is_pending (MetaWindow  *window) | ||||
| { | ||||
|   return window->resize_pending; | ||||
| } | ||||
|  | ||||
| void | ||||
| meta_window_set_frame_redraw_pending (MetaWindow *window, | ||||
|                                       gboolean    is_frame_redraw_pending) | ||||
| { | ||||
|   window->frame_redraw_pending = is_frame_redraw_pending; | ||||
|  | ||||
|   meta_compositor_sync_updates_frozen (window->display->compositor, window); | ||||
| } | ||||
|  | ||||
| static void | ||||
| end_grab_op (MetaWindow *window, | ||||
|              const ClutterEvent *event) | ||||
|   | ||||
| @@ -149,6 +149,7 @@ static void | ||||
| invalidate_whole_window (MetaUIFrame *frame) | ||||
| { | ||||
|   gdk_window_invalidate_rect (frame->window, NULL, FALSE); | ||||
|   meta_window_set_frame_redraw_pending (frame->meta_window, TRUE); | ||||
| } | ||||
|  | ||||
| static MetaStyleInfo * | ||||
| @@ -484,6 +485,27 @@ meta_ui_frame_attach_style (MetaUIFrame *frame) | ||||
|                                                                             variant)); | ||||
| } | ||||
|  | ||||
| static void | ||||
| after_paint (GdkFrameClock *frame_clock, | ||||
|              MetaUIFrame   *frame) | ||||
| { | ||||
|   MetaFrames *frames = frame->frames; | ||||
|   MetaWindow *window = frame->meta_window; | ||||
|  | ||||
|   /* Make sure the damage is posted to the X server before | ||||
|    * we mark the frame redraw finished and unfreeze, so there's | ||||
|    * a wayland surface commit waiting for us at unfreeze time | ||||
|    */ | ||||
|   if (meta_is_wayland_compositor ()) | ||||
|     gdk_display_sync (gtk_widget_get_display (GTK_WIDGET (frames))); | ||||
|  | ||||
|   meta_window_set_frame_redraw_pending (window, FALSE); | ||||
|  | ||||
|   g_signal_handlers_disconnect_by_func (G_OBJECT (gdk_window_get_frame_clock (frame->window)), | ||||
|                                         G_CALLBACK (after_paint), | ||||
|                                         frame); | ||||
| } | ||||
|  | ||||
| MetaUIFrame * | ||||
| meta_frames_manage_window (MetaFrames *frames, | ||||
|                            MetaWindow *meta_window, | ||||
| @@ -531,6 +553,10 @@ meta_ui_frame_unmanage (MetaUIFrame *frame) | ||||
|                                frame->xwindow, | ||||
|                                META_CURSOR_DEFAULT); | ||||
|  | ||||
|   g_signal_handlers_disconnect_by_func (G_OBJECT (gdk_window_get_frame_clock (frame->window)), | ||||
|                                         G_CALLBACK (after_paint), | ||||
|                                         frame); | ||||
|  | ||||
|   gdk_window_set_user_data (frame->window, NULL); | ||||
|  | ||||
|   g_hash_table_remove (frames->frames, &frame->xwindow); | ||||
| @@ -1396,6 +1422,11 @@ meta_frames_draw (GtkWidget *widget, | ||||
|   meta_ui_frame_paint (frame, cr); | ||||
|   cairo_region_destroy (region); | ||||
|  | ||||
|   g_signal_connect (G_OBJECT (gdk_window_get_frame_clock (frame->window)), | ||||
|                     "after-paint", | ||||
|                     G_CALLBACK (after_paint), | ||||
|                     frame); | ||||
|  | ||||
|   return TRUE; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -703,6 +703,9 @@ cleanup: | ||||
| static void | ||||
| meta_wayland_surface_commit (MetaWaylandSurface *surface) | ||||
| { | ||||
|   if (surface->is_frozen) | ||||
|     return; | ||||
|  | ||||
|   /* | ||||
|    * If this is a sub-surface and it is in effective synchronous mode, only | ||||
|    * cache the pending surface state until either one of the following two | ||||
| @@ -1099,6 +1102,7 @@ meta_wayland_surface_set_window (MetaWaylandSurface *surface, | ||||
|                                "position-changed", | ||||
|                                G_CALLBACK (window_position_changed), | ||||
|                                surface, 0); | ||||
|       meta_window_set_resize_pending (window, FALSE); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -1719,3 +1723,16 @@ meta_wayland_surface_is_shortcuts_inhibited (MetaWaylandSurface *surface, | ||||
|  | ||||
|   return g_hash_table_contains (surface->shortcut_inhibited_seats, seat); | ||||
| } | ||||
|  | ||||
| void | ||||
| meta_wayland_surface_set_frozen (MetaWaylandSurface *surface, | ||||
|                                  gboolean            is_frozen) | ||||
| { | ||||
|   if (surface->is_frozen == is_frozen) | ||||
|     return; | ||||
|  | ||||
|   surface->is_frozen = is_frozen; | ||||
|  | ||||
|   if (!surface->is_frozen && surface->pending) | ||||
|     meta_wayland_surface_commit (surface); | ||||
| } | ||||
|   | ||||
| @@ -203,6 +203,8 @@ struct _MetaWaylandSurface | ||||
|  | ||||
|   /* table of seats for which shortcuts are inhibited */ | ||||
|   GHashTable *shortcut_inhibited_seats; | ||||
|  | ||||
|   guint32 is_frozen : 1; | ||||
| }; | ||||
|  | ||||
| void                meta_wayland_shell_init     (MetaWaylandCompositor *compositor); | ||||
| @@ -302,5 +304,7 @@ void                meta_wayland_surface_restore_shortcuts (MetaWaylandSurface * | ||||
|  | ||||
| gboolean            meta_wayland_surface_is_shortcuts_inhibited (MetaWaylandSurface *surface, | ||||
|                                                                  MetaWaylandSeat    *seat); | ||||
| void                meta_wayland_surface_set_frozen (MetaWaylandSurface *surface, | ||||
|                                                      gboolean            is_frozen); | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -71,6 +71,20 @@ meta_window_xwayland_shortcuts_inhibited (MetaWindow         *window, | ||||
|   return meta_wayland_compositor_is_shortcuts_inhibited (compositor, source); | ||||
| } | ||||
|  | ||||
| static void | ||||
| meta_window_xwayland_move_resize_internal (MetaWindow                *window, | ||||
|                                            int                        gravity, | ||||
|                                            MetaRectangle              unconstrained_rect, | ||||
|                                            MetaRectangle              constrained_rect, | ||||
|                                            MetaMoveResizeFlags        flags, | ||||
|                                            MetaMoveResizeResultFlags *result) | ||||
| { | ||||
|   META_WINDOW_CLASS (meta_window_xwayland_parent_class)->move_resize_internal (window, gravity, unconstrained_rect, constrained_rect, flags, result); | ||||
|  | ||||
|   if (*result & META_MOVE_RESIZE_RESULT_RESIZED) | ||||
|     meta_window_set_resize_pending (window, TRUE); | ||||
| } | ||||
|  | ||||
| static void | ||||
| meta_window_xwayland_get_property (GObject    *object, | ||||
|                                    guint       prop_id, | ||||
| @@ -117,6 +131,7 @@ meta_window_xwayland_class_init (MetaWindowXwaylandClass *klass) | ||||
|  | ||||
|   window_class->force_restore_shortcuts = meta_window_xwayland_force_restore_shortcuts; | ||||
|   window_class->shortcuts_inhibited = meta_window_xwayland_shortcuts_inhibited; | ||||
|   window_class->move_resize_internal = meta_window_xwayland_move_resize_internal; | ||||
|  | ||||
|   gobject_class->get_property = meta_window_xwayland_get_property; | ||||
|   gobject_class->set_property = meta_window_xwayland_set_property; | ||||
|   | ||||
| @@ -1244,8 +1244,9 @@ meta_window_x11_move_resize_internal (MetaWindow                *window, | ||||
|     { | ||||
|       meta_error_trap_push (window->display); | ||||
|  | ||||
|       if (window == window->display->grab_window && | ||||
|           meta_grab_op_is_resizing (window->display->grab_op) && | ||||
|       if ((window->constructing || | ||||
|           (window == window->display->grab_window && | ||||
|            meta_grab_op_is_resizing (window->display->grab_op))) && | ||||
|           !window->disable_sync && | ||||
|           window->sync_request_counter != None && | ||||
|           window->sync_request_alarm != None && | ||||
| @@ -3496,27 +3497,32 @@ meta_window_x11_update_sync_request_counter (MetaWindow *window, | ||||
|   window->sync_request_serial = new_counter_value; | ||||
|   meta_compositor_sync_updates_frozen (window->display->compositor, window); | ||||
|  | ||||
|   if (window == window->display->grab_window && | ||||
|       meta_grab_op_is_resizing (window->display->grab_op) && | ||||
|       new_counter_value >= window->sync_request_wait_serial && | ||||
|       (!window->extended_sync_request_counter || new_counter_value % 2 == 0) && | ||||
|       window->sync_request_timeout_id) | ||||
|   if (new_counter_value >= window->sync_request_wait_serial && window->sync_request_timeout_id) | ||||
|     { | ||||
|       meta_topic (META_DEBUG_RESIZING, | ||||
|                   "Alarm event received last motion x = %d y = %d\n", | ||||
|                   window->display->grab_latest_motion_x, | ||||
|                   window->display->grab_latest_motion_y); | ||||
| 	if (!window->extended_sync_request_counter || new_counter_value % 2 == 0) | ||||
|          { | ||||
| 	   g_source_remove (window->sync_request_timeout_id); | ||||
| 	   window->sync_request_timeout_id = 0; | ||||
| 	 } | ||||
|  | ||||
|       g_source_remove (window->sync_request_timeout_id); | ||||
|       window->sync_request_timeout_id = 0; | ||||
| 	if (window == window->display->grab_window && | ||||
| 	    meta_grab_op_is_resizing (window->display->grab_op) && | ||||
|             !meta_window_resize_is_pending (window) && | ||||
| 	    (!window->extended_sync_request_counter || new_counter_value % 2 == 0)) | ||||
| 	  { | ||||
| 	    meta_topic (META_DEBUG_RESIZING, | ||||
| 			"Alarm event received last motion x = %d y = %d\n", | ||||
| 			 window->display->grab_latest_motion_x, | ||||
| 			 window->display->grab_latest_motion_y); | ||||
|  | ||||
|       /* This means we are ready for another configure; | ||||
|        * no pointer round trip here, to keep in sync */ | ||||
|       meta_window_update_resize (window, | ||||
|                                  window->display->grab_last_user_action_was_snap, | ||||
|                                  window->display->grab_latest_motion_x, | ||||
|                                  window->display->grab_latest_motion_y, | ||||
|                                  TRUE); | ||||
| 	    /* This means we are ready for another configure; | ||||
| 	     * no pointer round trip here, to keep in sync */ | ||||
| 	    meta_window_update_resize (window, | ||||
|                                        window->display->grab_last_user_action_was_snap, | ||||
|                                        window->display->grab_latest_motion_x, | ||||
|                                        window->display->grab_latest_motion_y, | ||||
|                                        TRUE); | ||||
| 	  } | ||||
|     } | ||||
|  | ||||
|   /* If sync was previously disabled, turn it back on and hope | ||||
|   | ||||
		Reference in New Issue
	
	Block a user