[mutter/wip/dnd-surface2: 2/7] stage: Add overlay for the DnD surface



commit ad5ce7eee8c12e72c046d732a273f21d9a8b99df
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Sep 26 18:52:30 2014 +0200

    stage: Add overlay for the DnD surface
    
    This will be rendered similarly to the pointer cursor.

 src/backends/meta-stage.c |   17 +++++++++++++++++
 src/backends/meta-stage.h |    4 ++++
 2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/backends/meta-stage.c b/src/backends/meta-stage.c
index e304441..c0cbd76 100644
--- a/src/backends/meta-stage.c
+++ b/src/backends/meta-stage.c
@@ -40,6 +40,7 @@ typedef struct {
 } MetaOverlay;
 
 struct _MetaStagePrivate {
+  MetaOverlay dnd_overlay;
   MetaOverlay cursor_overlay;
 };
 typedef struct _MetaStagePrivate MetaStagePrivate;
@@ -112,6 +113,7 @@ meta_stage_finalize (GObject *object)
   MetaStage *stage = META_STAGE (object);
   MetaStagePrivate *priv = meta_stage_get_instance_private (stage);
 
+  meta_overlay_free (&priv->dnd_overlay);
   meta_overlay_free (&priv->cursor_overlay);
 }
 
@@ -123,6 +125,7 @@ meta_stage_paint (ClutterActor *actor)
 
   CLUTTER_ACTOR_CLASS (meta_stage_parent_class)->paint (actor);
 
+  meta_overlay_paint (&priv->dnd_overlay);
   meta_overlay_paint (&priv->cursor_overlay);
 }
 
@@ -142,6 +145,7 @@ meta_stage_init (MetaStage *stage)
 {
   MetaStagePrivate *priv = meta_stage_get_instance_private (stage);
 
+  meta_overlay_init (&priv->dnd_overlay);
   meta_overlay_init (&priv->cursor_overlay);
 
   clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), FALSE);
@@ -184,6 +188,19 @@ queue_redraw_for_overlay (MetaStage   *stage,
 }
 
 void
+meta_stage_set_dnd_surface (MetaStage     *stage,
+                            CoglTexture   *texture,
+                            MetaRectangle *rect)
+{
+  MetaStagePrivate *priv = meta_stage_get_instance_private (stage);
+
+  g_assert (meta_is_wayland_compositor ());
+
+  meta_overlay_set (&priv->dnd_overlay, texture, rect);
+  queue_redraw_for_overlay (stage, &priv->dnd_overlay);
+}
+
+void
 meta_stage_set_cursor (MetaStage     *stage,
                        CoglTexture   *texture,
                        MetaRectangle *rect)
diff --git a/src/backends/meta-stage.h b/src/backends/meta-stage.h
index 742d14f..572530d 100644
--- a/src/backends/meta-stage.h
+++ b/src/backends/meta-stage.h
@@ -51,6 +51,10 @@ GType             meta_stage_get_type                (void) G_GNUC_CONST;
 
 ClutterActor     *meta_stage_new                     (void);
 
+void meta_stage_set_dnd_surface (MetaStage     *stage,
+                                 CoglTexture   *texture,
+                                 MetaRectangle *rect);
+
 void meta_stage_set_cursor (MetaStage     *stage,
                             CoglTexture   *texture,
                             MetaRectangle *rect);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]