Compare commits

..

9 Commits

Author SHA1 Message Date
38a772bce7 Bump version to 3.25.2
Update NEWS.
2017-05-24 21:04:07 +02:00
dd451547a5 tests: Fix actor-anchors test
Since commit 5cb5baa7d4, we skip transitions when updating an
actor's scale/position to the existing value. As a result, we
don't get change notification on those properties either - given
that the properties did not actually change, that behavior seems
fine, so just modify the test to not expect a notify signal for
unchanged properties.
2017-05-24 21:04:07 +02:00
270da95cbc window: Notify about size-change when tiling
Call meta_compositor_size_change_window while tiling in order
to emit the size-change signal. Since the untiling action is
considered a unmaximize size change, treat tiling as a maximize
size change for consistency.

https://bugzilla.gnome.org/show_bug.cgi?id=782968
2017-05-24 09:51:29 +02:00
76198e0b3b Implements disable-while-typing in mutter.
Disable-while-typing disables the touchpad while the user is typing.

This patch introduces the necessary backend code to implement the
org.gnome.desktop.peripherals.touchpad.disable-while-typing setting of
gsettings-desktop-schemas which was implemented in commit
4c5b1c1df399d6afaaccb237e299ccd1d5d29ddd and released as part of 3.24.
This is known as dwt in libinput.

This patch has been tested on X11 and Wayland.

https://bugzilla.gnome.org/show_bug.cgi?id=764852
2017-05-24 11:56:54 +08:00
efc190789f backend: Couple of whitespace fixes
https://bugzilla.gnome.org/show_bug.cgi?id=782152
2017-05-24 11:18:56 +08:00
81e99c2680 input-settings: Minor structural cleanup
Let the backend implementations create their own input settings
backend, as is done with other backend specific special purpose
backends. Also use the macro for declaring the GType.

https://bugzilla.gnome.org/show_bug.cgi?id=782152
2017-05-24 11:18:56 +08:00
755755a2f3 backend: Move out some code from post_init()
meta_backend_real_post_init() had some open coded initialization with
some unexpected interdependencies. Split these up and move them to their
own functions in order to make meta_backend_real_post_init() a bit more
readable.

https://bugzilla.gnome.org/show_bug.cgi?id=782152
2017-05-24 11:17:46 +08:00
4b23eb064c clutter: Update pointer position on master clock's update stage
Ensure the pointer position is up-to-date for the pointers inside
the clip area after the stage got actors relayout.

https://bugzilla.gnome.org/show_bug.cgi?id=755164
2017-05-23 16:37:53 +02:00
498200776c wayland: Ensure we repick the pointer on synthesized crossing events
Relayouts in clutter may trigger synthesized crossing events if the
actor below the pointer changes. In that situation we do need to
repick() the MetaWaylandPointer to end up with the right current
wayland surface.

https://bugzilla.gnome.org/show_bug.cgi?id=755164
2017-05-22 17:45:17 +02:00
34 changed files with 559 additions and 407 deletions

26
NEWS
View File

@ -1,3 +1,29 @@
3.25.2
======
* Fix frame updates on hide-titlebar-when-maximized changes [Florian; #781862]
* Fix accessible screen coordinates on X11 [Florian; #781902]
* Use less CPU when rendering fast-updating windows [Carlos, Emmanuele; #782344]
* Compute geometry of clients that don't set one explicitly [Olivier; #782213]
* Fix copy+paste of UTF8 strings between X11 and wayland [Carlos; #782472]
* Fix non-wayland builds [Chris; #780533]
* Add plugin vfunc to implement a custom force-quit dialog [Carlos; #711619]
* Fix swapped red and blue channels in CoglTexture data [Carlos; #779234
* Fix build where libtool's link_all_deplibs defaults to 'no' [Marco; #782821]
* Fix glitches when opening a window maximized [Olivier; #781353, #782183]
* Fix wrong cursor after window underneath the pointer changed [Carlos; #755164]
* Implement support for disable-while-typing option [Evan; #764852]
* Emit size-change signal when tiling [Alessandro; #782968]
* Misc. bug fixes [Nigel, Matthias, Jonas; #759085, #780215, #782156, #782152]
Contributors:
Jonas Ådahl, Emmanuele Bassi, Alessandro Bono, Olivier Fourdan,
Carlos Garnacho, Matthias Liertzer, Florian Müllner, Nigel Taylor,
Marco Trevisan (Treviño), Chris Vine, Evan Welsh
Translations:
Fabio Tomat [fur], Jordi Mas [ca], Mario Blättermann [de],
Emin Tufan Çetin [tr], Balázs Úr [hu]
3.25.1
======
* Always sync window geometry on state changes [Jonas; #780292]

View File

@ -283,6 +283,9 @@ void _clutter_actor_queue_redraw_full
ClutterPaintVolume *volume,
ClutterEffect *effect);
ClutterPaintVolume * _clutter_actor_get_queue_redraw_clip (ClutterActor *self);
void _clutter_actor_set_queue_redraw_clip (ClutterActor *self,
ClutterPaintVolume *clip_volume);
void _clutter_actor_finish_queue_redraw (ClutterActor *self,
ClutterPaintVolume *clip);

View File

@ -840,7 +840,6 @@ struct _ClutterActorPrivate
guint needs_compute_expand : 1;
guint needs_x_expand : 1;
guint needs_y_expand : 1;
guint needs_paint_volume_update : 1;
};
enum
@ -2620,7 +2619,6 @@ clutter_actor_real_allocate (ClutterActor *self,
g_object_freeze_notify (G_OBJECT (self));
changed = clutter_actor_set_allocation_internal (self, box, flags);
priv->needs_paint_volume_update = changed;
/* we allocate our children before we notify changes in our geometry,
* so that people connecting to properties will be able to get valid
@ -2643,12 +2641,9 @@ clutter_actor_real_allocate (ClutterActor *self,
}
static void
_clutter_actor_propagate_queue_redraw (ClutterActor *self,
ClutterActor *origin,
ClutterPaintVolume *pv)
_clutter_actor_signal_queue_redraw (ClutterActor *self,
ClutterActor *origin)
{
gboolean stop = FALSE;
/* no point in queuing a redraw on a destroyed actor */
if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
return;
@ -2657,33 +2652,27 @@ _clutter_actor_propagate_queue_redraw (ClutterActor *self,
* the actor bas been cloned. In this case the clone will need to
* receive the signal so it can queue its own redraw.
*/
while (self)
{
_clutter_actor_queue_redraw_on_clones (self);
/* calls klass->queue_redraw in default handler */
if (g_signal_has_handler_pending (self, actor_signals[QUEUE_REDRAW],
_clutter_actor_queue_redraw_on_clones (self);
/* calls klass->queue_redraw in default handler */
if (g_signal_has_handler_pending (self, actor_signals[QUEUE_REDRAW],
0, TRUE))
{
g_signal_emit (self, actor_signals[QUEUE_REDRAW], 0, origin, pv, &stop);
}
else
{
stop = CLUTTER_ACTOR_GET_CLASS (self)->queue_redraw (self, origin, pv);
}
if (stop)
break;
self = clutter_actor_get_parent (self);
{
g_signal_emit (self, actor_signals[QUEUE_REDRAW], 0, origin);
}
else
{
CLUTTER_ACTOR_GET_CLASS (self)->queue_redraw (self, origin);
}
}
static gboolean
clutter_actor_real_queue_redraw (ClutterActor *self,
ClutterActor *origin,
ClutterPaintVolume *paint_volume)
static void
clutter_actor_real_queue_redraw (ClutterActor *self,
ClutterActor *origin)
{
ClutterActor *parent;
CLUTTER_NOTE (PAINT, "Redraw queued on '%s' (from: '%s')",
_clutter_actor_get_debug_name (self),
origin != NULL ? _clutter_actor_get_debug_name (origin)
@ -2691,14 +2680,13 @@ clutter_actor_real_queue_redraw (ClutterActor *self,
/* no point in queuing a redraw on a destroyed actor */
if (CLUTTER_ACTOR_IN_DESTRUCTION (self))
return TRUE;
return;
/* If the queue redraw is coming from a child then the actor has
become dirty and any queued effect is no longer valid */
if (self != origin)
{
self->priv->is_dirty = TRUE;
self->priv->needs_paint_volume_update = TRUE;
self->priv->effect_to_redraw = NULL;
}
@ -2707,7 +2695,7 @@ clutter_actor_real_queue_redraw (ClutterActor *self,
* won't change so we don't have to propagate up the hierarchy.
*/
if (!CLUTTER_ACTOR_IS_VISIBLE (self))
return TRUE;
return;
/* Although we could determine here that a full stage redraw
* has already been queued and immediately bail out, we actually
@ -2721,7 +2709,7 @@ clutter_actor_real_queue_redraw (ClutterActor *self,
ClutterActor *stage = _clutter_actor_get_stage_internal (self);
if (stage != NULL &&
_clutter_stage_has_full_redraw_queued (CLUTTER_STAGE (stage)))
return TRUE;
return;
}
self->priv->propagated_one_redraw = TRUE;
@ -2729,7 +2717,12 @@ clutter_actor_real_queue_redraw (ClutterActor *self,
/* notify parents, if they are all visible eventually we'll
* queue redraw on the stage, which queues the redraw idle.
*/
return FALSE;
parent = clutter_actor_get_parent (self);
if (parent != NULL)
{
/* this will go up recursively */
_clutter_actor_signal_queue_redraw (parent, origin);
}
}
static void
@ -8018,12 +8011,10 @@ clutter_actor_class_init (ClutterActorClass *klass)
G_SIGNAL_RUN_LAST |
G_SIGNAL_NO_HOOKS,
G_STRUCT_OFFSET (ClutterActorClass, queue_redraw),
g_signal_accumulator_true_handled,
NULL,
_clutter_marshal_BOOLEAN__OBJECT_BOXED,
G_TYPE_BOOLEAN, 2,
CLUTTER_TYPE_ACTOR,
CLUTTER_TYPE_PAINT_VOLUME);
NULL, NULL,
_clutter_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CLUTTER_TYPE_ACTOR);
/**
* ClutterActor::queue-relayout:
@ -8528,7 +8519,6 @@ clutter_actor_init (ClutterActor *self)
priv->needs_width_request = TRUE;
priv->needs_height_request = TRUE;
priv->needs_allocation = TRUE;
priv->needs_paint_volume_update = TRUE;
priv->cached_width_age = 1;
priv->cached_height_age = 1;
@ -8622,7 +8612,8 @@ _clutter_actor_finish_queue_redraw (ClutterActor *self,
ClutterPaintVolume *clip)
{
ClutterActorPrivate *priv = self->priv;
ClutterPaintVolume *pv = NULL;
ClutterPaintVolume *pv;
gboolean clipped;
/* Remove queue entry early in the process, otherwise a new
queue_redraw() during signal handling could put back this
@ -8649,7 +8640,8 @@ _clutter_actor_finish_queue_redraw (ClutterActor *self,
*/
if (clip)
{
pv = clip;
_clutter_actor_set_queue_redraw_clip (self, clip);
clipped = TRUE;
}
else if (G_LIKELY (priv->last_paint_volume_valid))
{
@ -8659,12 +8651,36 @@ _clutter_actor_finish_queue_redraw (ClutterActor *self,
ClutterActor *stage = _clutter_actor_get_stage_internal (self);
/* make sure we redraw the actors old position... */
_clutter_actor_propagate_queue_redraw (stage, stage,
&priv->last_paint_volume);
}
}
_clutter_actor_set_queue_redraw_clip (stage,
&priv->last_paint_volume);
_clutter_actor_signal_queue_redraw (stage, stage);
_clutter_actor_set_queue_redraw_clip (stage, NULL);
_clutter_actor_propagate_queue_redraw (self, self, pv);
/* XXX: Ideally the redraw signal would take a clip volume
* argument, but that would be an ABI break. Until we can
* break the ABI we pass the argument out-of-band
*/
/* setup the clip for the actors new position... */
_clutter_actor_set_queue_redraw_clip (self, pv);
clipped = TRUE;
}
else
clipped = FALSE;
}
else
clipped = FALSE;
_clutter_actor_signal_queue_redraw (self, self);
/* Just in case anyone is manually firing redraw signals without
* using the public queue_redraw() API we are careful to ensure that
* our out-of-band clip member is cleared before returning...
*
* Note: A NULL clip denotes a full-stage, un-clipped redraw
*/
if (G_LIKELY (clipped))
_clutter_actor_set_queue_redraw_clip (self, NULL);
}
static void
@ -8825,7 +8841,8 @@ _clutter_actor_queue_redraw_full (ClutterActor *self,
{
/* NB: NULL denotes an undefined clip which will result in a
* full redraw... */
_clutter_actor_propagate_queue_redraw (self, self, NULL);
_clutter_actor_set_queue_redraw_clip (self, NULL);
_clutter_actor_signal_queue_redraw (self, self);
return;
}
@ -8899,7 +8916,6 @@ _clutter_actor_queue_redraw_full (ClutterActor *self,
}
priv->is_dirty = TRUE;
priv->needs_paint_volume_update = TRUE;
}
/**
@ -12957,7 +12973,6 @@ clutter_actor_add_child_internal (ClutterActor *self,
child->priv->needs_width_request = TRUE;
child->priv->needs_height_request = TRUE;
child->priv->needs_allocation = TRUE;
child->priv->needs_paint_volume_update = TRUE;
/* we only queue a relayout here, because any possible
* redraw has already been queued either by show() or
@ -16635,6 +16650,26 @@ clutter_actor_has_pointer (ClutterActor *self)
return self->priv->has_pointer;
}
/* XXX: This is a workaround for not being able to break the ABI of
* the QUEUE_REDRAW signal. It is an out-of-band argument. See
* clutter_actor_queue_clipped_redraw() for details.
*/
ClutterPaintVolume *
_clutter_actor_get_queue_redraw_clip (ClutterActor *self)
{
return g_object_get_data (G_OBJECT (self),
"-clutter-actor-queue-redraw-clip");
}
void
_clutter_actor_set_queue_redraw_clip (ClutterActor *self,
ClutterPaintVolume *clip)
{
g_object_set_data (G_OBJECT (self),
"-clutter-actor-queue-redraw-clip",
clip);
}
/**
* clutter_actor_has_allocation:
* @self: a #ClutterActor
@ -17481,22 +17516,16 @@ _clutter_actor_get_paint_volume_mutable (ClutterActor *self)
priv = self->priv;
if (priv->paint_volume_valid)
{
if (!priv->needs_paint_volume_update)
return &priv->paint_volume;
clutter_paint_volume_free (&priv->paint_volume);
}
clutter_paint_volume_free (&priv->paint_volume);
if (_clutter_actor_get_paint_volume_real (self, &priv->paint_volume))
{
priv->paint_volume_valid = TRUE;
priv->needs_paint_volume_update = FALSE;
return &priv->paint_volume;
}
else
{
priv->paint_volume_valid = FALSE;
priv->needs_paint_volume_update = FALSE;
return NULL;
}
}

View File

@ -236,9 +236,8 @@ struct _ClutterActorClass
void (* pick) (ClutterActor *actor,
const ClutterColor *color);
gboolean (* queue_redraw) (ClutterActor *actor,
ClutterActor *leaf_that_queued,
ClutterPaintVolume *paint_volume);
void (* queue_redraw) (ClutterActor *actor,
ClutterActor *leaf_that_queued);
/* size negotiation */
void (* get_preferred_width) (ClutterActor *self,

View File

@ -1,7 +1,6 @@
BOOLEAN:BOXED
BOOLEAN:BOXED,INT,INT
BOOLEAN:OBJECT,BOOLEAN
BOOLEAN:OBJECT,BOXED
BOOLEAN:OBJECT,BOXED,DOUBLE
BOOLEAN:OBJECT,DOUBLE
BOOLEAN:OBJECT,ENUM

View File

@ -1166,21 +1166,6 @@ _clutter_paint_volume_get_stage_paint_box (ClutterPaintVolume *pv,
_clutter_paint_volume_get_bounding_box (&projected_pv, box);
if (pv->is_2d && pv->actor &&
clutter_actor_get_z_position (pv->actor) == 0)
{
/* If the volume/actor are perfectly 2D, take the bounding box as
* good. We won't need to add any extra room for sub-pixel positioning
* in this case.
*/
clutter_paint_volume_free (&projected_pv);
box->x1 = CLUTTER_NEARBYINT (box->x1);
box->y1 = CLUTTER_NEARBYINT (box->y1);
box->x2 = CLUTTER_NEARBYINT (box->x2);
box->y2 = CLUTTER_NEARBYINT (box->y2);
return;
}
/* The aim here is that for a given rectangle defined with floating point
* coordinates we want to determine a stable quantized size in pixels
* that doesn't vary due to the original box's sub-pixel position.

View File

@ -231,35 +231,19 @@ _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window)
return TRUE;
}
cairo_region_t *
_clutter_stage_window_get_redraw_clip (ClutterStageWindow *window)
gboolean
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *stage_clip)
{
ClutterStageWindowIface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->get_redraw_clip != NULL)
return iface->get_redraw_clip (window);
if (iface->get_redraw_clip_bounds != NULL)
return iface->get_redraw_clip_bounds (window, stage_clip);
return NULL;
}
gboolean
_clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *stage_clip)
{
cairo_region_t *redraw_clip;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), FALSE);
redraw_clip = _clutter_stage_window_get_redraw_clip (window);
if (!redraw_clip)
return FALSE;
cairo_region_get_extents (redraw_clip, stage_clip);
cairo_region_destroy (redraw_clip);
return TRUE;
return FALSE;
}
void

View File

@ -68,7 +68,9 @@ struct _ClutterStageWindowIface
cairo_rectangle_int_t *stage_rectangle);
gboolean (* has_redraw_clips) (ClutterStageWindow *stage_window);
gboolean (* ignoring_redraw_clips) (ClutterStageWindow *stage_window);
cairo_region_t * (* get_redraw_clip) (ClutterStageWindow *stage_window);
gboolean (* get_redraw_clip_bounds) (ClutterStageWindow *stage_window,
cairo_rectangle_int_t *clip);
void (* set_accept_focus) (ClutterStageWindow *stage_window,
gboolean accept_focus);
@ -123,7 +125,6 @@ gboolean _clutter_stage_window_has_redraw_clips (ClutterStageWin
gboolean _clutter_stage_window_ignoring_redraw_clips (ClutterStageWindow *window);
gboolean _clutter_stage_window_get_redraw_clip_bounds (ClutterStageWindow *window,
cairo_rectangle_int_t *clip);
cairo_region_t * _clutter_stage_window_get_redraw_clip (ClutterStageWindow *window);
void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
gboolean accept_focus);

View File

@ -161,6 +161,7 @@ struct _ClutterStagePrivate
guint accept_focus : 1;
guint motion_events_enabled : 1;
guint has_custom_perspective : 1;
guint stage_was_relayout : 1;
};
enum
@ -1059,6 +1060,7 @@ _clutter_stage_maybe_relayout (ClutterActor *actor)
if (!CLUTTER_ACTOR_IN_RELAYOUT (stage))
{
priv->relayout_pending = FALSE;
priv->stage_was_relayout = TRUE;
CLUTTER_NOTE (ACTOR, "Recomputing layout");
@ -1129,6 +1131,58 @@ clutter_stage_do_redraw (ClutterStage *stage)
stage);
}
static GSList *
_clutter_stage_check_updated_pointers (ClutterStage *stage)
{
ClutterStagePrivate *priv = stage->priv;
ClutterDeviceManager *device_manager;
GSList *updating = NULL;
const GSList *devices;
cairo_rectangle_int_t clip;
ClutterPoint point;
gboolean has_clip;
has_clip = _clutter_stage_window_get_redraw_clip_bounds (priv->impl, &clip);
device_manager = clutter_device_manager_get_default ();
devices = clutter_device_manager_peek_devices (device_manager);
for (; devices != NULL; devices = devices->next)
{
ClutterInputDevice *dev = devices->data;
if (clutter_input_device_get_device_mode (dev) !=
CLUTTER_INPUT_MODE_MASTER)
continue;
switch (clutter_input_device_get_device_type (dev))
{
case CLUTTER_POINTER_DEVICE:
case CLUTTER_TABLET_DEVICE:
case CLUTTER_PEN_DEVICE:
case CLUTTER_ERASER_DEVICE:
case CLUTTER_CURSOR_DEVICE:
if (!clutter_input_device_get_coords (dev, NULL, &point))
continue;
if (!has_clip ||
(point.x >= clip.x && point.x < clip.x + clip.width &&
point.y >= clip.y && point.y < clip.y + clip.height))
updating = g_slist_prepend (updating, dev);
break;
default:
/* Any other devices don't need checking, either because they
* don't have x/y coordinates, or because they're implicitly
* grabbed on an actor by default as it's the case of
* touch(screens).
*/
break;
}
}
return updating;
}
/**
* _clutter_stage_do_update:
* @stage: A #ClutterStage
@ -1141,6 +1195,10 @@ gboolean
_clutter_stage_do_update (ClutterStage *stage)
{
ClutterStagePrivate *priv = stage->priv;
gboolean stage_was_relayout = priv->stage_was_relayout;
GSList *pointers = NULL;
priv->stage_was_relayout = FALSE;
/* if the stage is being destroyed, or if the destruction already
* happened and we don't have an StageWindow any more, then we
@ -1161,6 +1219,9 @@ _clutter_stage_do_update (ClutterStage *stage)
if (!priv->redraw_pending)
return FALSE;
if (stage_was_relayout)
pointers = _clutter_stage_check_updated_pointers (stage);
clutter_stage_maybe_finish_queue_redraws (stage);
clutter_stage_do_redraw (stage);
@ -1178,6 +1239,12 @@ _clutter_stage_do_update (ClutterStage *stage)
}
#endif /* CLUTTER_ENABLE_DEBUG */
while (pointers)
{
_clutter_input_device_update (pointers->data, NULL, TRUE);
pointers = g_slist_delete_link (pointers, pointers);
}
return TRUE;
}
@ -1199,44 +1266,45 @@ clutter_stage_real_queue_relayout (ClutterActor *self)
parent_class->queue_relayout (self);
}
static gboolean
clutter_stage_real_queue_redraw (ClutterActor *actor,
ClutterActor *leaf,
ClutterPaintVolume *redraw_clip)
static void
clutter_stage_real_queue_redraw (ClutterActor *actor,
ClutterActor *leaf)
{
ClutterStage *stage = CLUTTER_STAGE (actor);
ClutterStageWindow *stage_window;
ClutterPaintVolume *redraw_clip;
ClutterActorBox bounding_box;
ClutterActorBox intersection_box;
cairo_rectangle_int_t geom, stage_clip;
if (CLUTTER_ACTOR_IN_DESTRUCTION (actor))
return TRUE;
return;
/* If the backend can't do anything with redraw clips (e.g. it already knows
* it needs to redraw everything anyway) then don't spend time transforming
* any clip volume into stage coordinates... */
stage_window = _clutter_stage_get_window (stage);
if (stage_window == NULL)
return TRUE;
return;
if (_clutter_stage_window_ignoring_redraw_clips (stage_window))
{
_clutter_stage_window_add_redraw_clip (stage_window, NULL);
return FALSE;
return;
}
/* Convert the clip volume into stage coordinates and then into an
* axis aligned stage coordinates bounding box...
*/
redraw_clip = _clutter_actor_get_queue_redraw_clip (leaf);
if (redraw_clip == NULL)
{
_clutter_stage_window_add_redraw_clip (stage_window, NULL);
return FALSE;
return;
}
if (redraw_clip->is_empty)
return TRUE;
return;
_clutter_paint_volume_get_stage_paint_box (redraw_clip,
stage,
@ -1252,7 +1320,7 @@ clutter_stage_real_queue_redraw (ClutterActor *actor,
/* There is no need to track degenerate/empty redraw clips */
if (intersection_box.x2 <= intersection_box.x1 ||
intersection_box.y2 <= intersection_box.y1)
return TRUE;
return;
/* when converting to integer coordinates make sure we round the edges of the
* clip rectangle outwards... */
@ -1262,7 +1330,6 @@ clutter_stage_real_queue_redraw (ClutterActor *actor,
stage_clip.height = intersection_box.y2 - stage_clip.y;
_clutter_stage_window_add_redraw_clip (stage_window, &stage_clip);
return FALSE;
}
gboolean
@ -1315,31 +1382,6 @@ clutter_stage_get_redraw_clip_bounds (ClutterStage *stage,
}
}
cairo_region_t *
clutter_stage_get_redraw_clip (ClutterStage *stage)
{
ClutterStagePrivate *priv;
cairo_rectangle_int_t clip;
cairo_region_t *region;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
priv = stage->priv;
region = _clutter_stage_window_get_redraw_clip (priv->impl);
if (region)
return region;
if (!region)
{
/* Set clip to the full extents of the stage */
_clutter_stage_window_get_geometry (priv->impl, &clip);
region = cairo_region_create_rectangle (&clip);
}
return region;
}
static void
read_pixels_to_file (char *filename_stem,
int x,

View File

@ -245,9 +245,6 @@ guchar * clutter_stage_read_pixels (ClutterStage
CLUTTER_AVAILABLE_IN_ALL
void clutter_stage_get_redraw_clip_bounds (ClutterStage *stage,
cairo_rectangle_int_t *clip);
CLUTTER_AVAILABLE_IN_MUTTER
cairo_region_t * clutter_stage_get_redraw_clip (ClutterStage *stage);
CLUTTER_AVAILABLE_IN_ALL
void clutter_stage_ensure_viewport (ClutterStage *stage);
CLUTTER_AVAILABLE_IN_ALL

View File

@ -54,7 +54,7 @@ typedef struct _ClutterStageViewCoglPrivate
/* Stores a list of previous damaged areas in the stage coordinate space */
#define DAMAGE_HISTORY_MAX 16
#define DAMAGE_HISTORY(x) ((x) & (DAMAGE_HISTORY_MAX - 1))
cairo_region_t * damage_history[DAMAGE_HISTORY_MAX];
cairo_rectangle_int_t damage_history[DAMAGE_HISTORY_MAX];
unsigned int damage_index;
} ClutterStageViewCoglPrivate;
@ -246,10 +246,13 @@ clutter_stage_cogl_has_redraw_clips (ClutterStageWindow *stage_window)
/* NB: at the start of each new frame there is an implied clip that
* clips everything (i.e. nothing would be drawn) so we need to make
* sure we return True in the un-initialized case here.
*
* NB: a clip width of 0 means a full stage redraw has been queued
* so we effectively don't have any redraw clips in that case.
*/
if (!stage_cogl->initialized_redraw_clip ||
(stage_cogl->initialized_redraw_clip &&
stage_cogl->redraw_clip))
stage_cogl->bounding_redraw_clip.width != 0))
return TRUE;
else
return FALSE;
@ -260,9 +263,9 @@ clutter_stage_cogl_ignoring_redraw_clips (ClutterStageWindow *stage_window)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
/* NB: a NULL clip means a full stage redraw is required */
/* NB: a clip width of 0 means a full stage redraw is required */
if (stage_cogl->initialized_redraw_clip &&
!stage_cogl->redraw_clip)
stage_cogl->bounding_redraw_clip.width == 0)
return TRUE;
else
return FALSE;
@ -293,11 +296,11 @@ clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
return;
/* A NULL stage clip means a full stage redraw has been queued and
* we keep track of this by setting a NULL redraw_clip.
*/
* we keep track of this by setting a zero width
* stage_cogl->bounding_redraw_clip */
if (stage_clip == NULL)
{
g_clear_pointer (&stage_cogl->redraw_clip, cairo_region_destroy);
stage_cogl->bounding_redraw_clip.width = 0;
stage_cogl->initialized_redraw_clip = TRUE;
return;
}
@ -306,27 +309,34 @@ clutter_stage_cogl_add_redraw_clip (ClutterStageWindow *stage_window,
if (stage_clip->width == 0 || stage_clip->height == 0)
return;
if (!stage_cogl->redraw_clip)
if (!stage_cogl->initialized_redraw_clip)
{
stage_cogl->redraw_clip = cairo_region_create_rectangle (stage_clip);
stage_cogl->bounding_redraw_clip = *stage_clip;
}
else
else if (stage_cogl->bounding_redraw_clip.width > 0)
{
cairo_region_union_rectangle (stage_cogl->redraw_clip, stage_clip);
_clutter_util_rectangle_union (&stage_cogl->bounding_redraw_clip,
stage_clip,
&stage_cogl->bounding_redraw_clip);
}
stage_cogl->initialized_redraw_clip = TRUE;
}
static cairo_region_t *
clutter_stage_cogl_get_redraw_clip (ClutterStageWindow *stage_window)
static gboolean
clutter_stage_cogl_get_redraw_clip_bounds (ClutterStageWindow *stage_window,
cairo_rectangle_int_t *stage_clip)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
if (stage_cogl->using_clipped_redraw && stage_cogl->redraw_clip)
return cairo_region_copy (stage_cogl->redraw_clip);
if (stage_cogl->using_clipped_redraw)
{
*stage_clip = stage_cogl->bounding_redraw_clip;
return NULL;
return TRUE;
}
return FALSE;
}
static inline gboolean
@ -404,51 +414,37 @@ swap_framebuffer (ClutterStageWindow *stage_window,
static void
paint_stage (ClutterStageCogl *stage_cogl,
ClutterStageView *view,
cairo_region_t *clip)
const cairo_rectangle_int_t *clip)
{
ClutterStage *stage = stage_cogl->wrapper;
cairo_rectangle_int_t clip_rect;
cairo_region_get_extents (clip, &clip_rect);
_clutter_stage_maybe_setup_viewport (stage, view);
_clutter_stage_paint_view (stage, view, &clip_rect);
_clutter_stage_paint_view (stage, view, clip);
if (clutter_stage_view_get_onscreen (view) !=
clutter_stage_view_get_framebuffer (view))
{
clutter_stage_view_blit_offscreen (view, &clip_rect);
clutter_stage_view_blit_offscreen (view, clip);
}
}
static void
fill_current_damage_history (ClutterStageView *view,
cairo_region_t *damage)
fill_current_damage_history_and_step (ClutterStageView *view)
{
ClutterStageViewCogl *view_cogl = CLUTTER_STAGE_VIEW_COGL (view);
ClutterStageViewCoglPrivate *view_priv =
clutter_stage_view_cogl_get_instance_private (view_cogl);
cairo_region_t **current_damage;
cairo_rectangle_int_t view_rect;
cairo_rectangle_int_t *current_damage;
current_damage =
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index)];
clutter_stage_view_get_layout (view, &view_rect);
g_clear_pointer (current_damage, cairo_region_destroy);
*current_damage = cairo_region_copy (damage);
*current_damage = view_rect;
view_priv->damage_index++;
}
static void
fill_current_damage_history_rectangle (ClutterStageView *view,
const cairo_rectangle_int_t *rect)
{
cairo_region_t *damage;
damage = cairo_region_create_rectangle (rect);
fill_current_damage_history (view, damage);
cairo_region_destroy (damage);
}
static void
transform_swap_region_to_onscreen (ClutterStageView *view,
cairo_rectangle_int_t *swap_region)
@ -503,11 +499,9 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
gboolean do_swap_buffer;
gboolean swap_with_damage;
ClutterActor *wrapper;
cairo_region_t *redraw_clip;
cairo_region_t *clip_region;
cairo_rectangle_int_t redraw_clip;
cairo_rectangle_int_t swap_region;
cairo_rectangle_int_t clip_rect;
cairo_rectangle_int_t redraw_rect;
cairo_rectangle_int_t clip_region;
gboolean clip_region_empty;
int fb_scale;
@ -523,19 +517,20 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
cogl_is_onscreen (fb) &&
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE);
/* NB: a NULL redraw clip == full stage redraw */
if (!stage_cogl->redraw_clip)
/* NB: a zero width redraw clip == full stage redraw */
if (stage_cogl->bounding_redraw_clip.width == 0)
have_clip = FALSE;
else
{
cairo_region_t *view_region;
redraw_clip = cairo_region_copy (stage_cogl->redraw_clip);
redraw_clip = stage_cogl->bounding_redraw_clip;
_clutter_util_rectangle_intersection (&redraw_clip,
&view_rect,
&redraw_clip);
view_region = cairo_region_create_rectangle (&view_rect);
cairo_region_intersect (redraw_clip, view_region);
have_clip = !cairo_region_equal (redraw_clip, view_region);
cairo_region_destroy (view_region);
have_clip = !(redraw_clip.x == view_rect.x &&
redraw_clip.y == view_rect.y &&
redraw_clip.width == view_rect.width &&
redraw_clip.height == view_rect.height);
}
may_use_clipped_redraw = FALSE;
@ -547,12 +542,11 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
cogl_onscreen_get_frame_counter (COGL_ONSCREEN (fb)) > 3)
{
may_use_clipped_redraw = TRUE;
clip_region = cairo_region_reference (redraw_clip);
clip_region = redraw_clip;
}
else
{
clip_region = cairo_region_create ();
redraw_clip = cairo_region_reference (clip_region);
clip_region = (cairo_rectangle_int_t){ 0 };
}
if (may_use_clipped_redraw &&
@ -561,7 +555,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
else
use_clipped_redraw = FALSE;
clip_region_empty = may_use_clipped_redraw && cairo_region_is_empty (clip_region);
clip_region_empty = may_use_clipped_redraw && clip_region.width == 0;
fb_scale = clutter_stage_view_get_scale (view);
@ -571,26 +565,34 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
if (use_clipped_redraw && !clip_region_empty)
{
int age, i;
cairo_rectangle_int_t *current_damage =
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index++)];
age = cogl_onscreen_get_buffer_age (COGL_ONSCREEN (fb));
if (valid_buffer_age (view_cogl, age))
{
fill_current_damage_history (view, clip_region);
*current_damage = clip_region;
for (i = 1; i <= age; i++)
{
cairo_region_t *damage =
view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - i - 1)];
cairo_region_union (clip_region, damage);
cairo_rectangle_int_t *damage =
&view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - i - 1)];
_clutter_util_rectangle_union (&clip_region, damage, &clip_region);
}
/* Update the redraw clip state with the extra damage. */
cairo_region_union (stage_cogl->redraw_clip, clip_region);
/* Update the bounding redraw clip state with the extra damage. */
_clutter_util_rectangle_union (&stage_cogl->bounding_redraw_clip,
&clip_region,
&stage_cogl->bounding_redraw_clip);
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: num rects: %d\n",
CLUTTER_NOTE (CLIPPING, "Reusing back buffer(age=%d) - repairing region: x=%d, y=%d, width=%d, height=%d\n",
age,
cairo_region_num_rectangles (clip_region));
clip_region.x,
clip_region.y,
clip_region.width,
clip_region.height);
swap_with_damage = TRUE;
}
@ -598,17 +600,15 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
{
CLUTTER_NOTE (CLIPPING, "Invalid back buffer(age=%d): forcing full redraw\n", age);
use_clipped_redraw = FALSE;
fill_current_damage_history_rectangle (view, &view_rect);
*current_damage = view_rect;
}
}
else if (!use_clipped_redraw)
{
fill_current_damage_history_rectangle (view, &view_rect);
fill_current_damage_history_and_step (view);
}
}
cairo_region_get_extents (clip_region, &clip_rect);
cogl_push_framebuffer (fb);
if (use_clipped_redraw && clip_region_empty)
{
@ -621,21 +621,21 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
CLUTTER_NOTE (CLIPPING,
"Stage clip pushed: x=%d, y=%d, width=%d, height=%d\n",
clip_rect.x,
clip_rect.y,
clip_rect.width,
clip_rect.height);
clip_region.x,
clip_region.y,
clip_region.width,
clip_region.height);
stage_cogl->using_clipped_redraw = TRUE;
scissor_x = (clip_rect.x - view_rect.x) * fb_scale;
scissor_y = (clip_rect.y - view_rect.y) * fb_scale;
scissor_x = (clip_region.x - view_rect.x) * fb_scale;
scissor_y = (clip_region.y - view_rect.y) * fb_scale;
cogl_framebuffer_push_scissor_clip (fb,
scissor_x,
scissor_y,
clip_rect.width * fb_scale,
clip_rect.height * fb_scale);
paint_stage (stage_cogl, view, clip_region);
clip_region.width * fb_scale,
clip_region.height * fb_scale);
paint_stage (stage_cogl, view, &clip_region);
cogl_framebuffer_pop_clip (fb);
stage_cogl->using_clipped_redraw = FALSE;
@ -645,7 +645,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
CLUTTER_NOTE (CLIPPING, "Unclipped stage paint\n");
/* If we are trying to debug redraw issues then we want to pass
* the redraw_clip so it can be visualized */
* the bounding_redraw_clip so it can be visualized */
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS) &&
may_use_clipped_redraw &&
!clip_region_empty)
@ -653,39 +653,31 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
int scissor_x;
int scissor_y;
scissor_x = (clip_rect.x - view_rect.x) * fb_scale;;
scissor_y = (clip_rect.y - view_rect.y) * fb_scale;
scissor_x = (clip_region.x - view_rect.x) * fb_scale;;
scissor_y = (clip_region.y - view_rect.y) * fb_scale;
cogl_framebuffer_push_scissor_clip (fb,
scissor_x,
scissor_y,
clip_rect.width * fb_scale,
clip_rect.height * fb_scale);
paint_stage (stage_cogl, view, clip_region);
clip_region.width * fb_scale,
clip_region.height * fb_scale);
paint_stage (stage_cogl, view, &clip_region);
cogl_framebuffer_pop_clip (fb);
}
else
{
cairo_region_t *view_region;
view_region = cairo_region_create_rectangle (&view_rect);
paint_stage (stage_cogl, view, view_region);
cairo_region_destroy (view_region);
}
paint_stage (stage_cogl, view, &view_rect);
}
cogl_pop_framebuffer ();
cairo_region_get_extents (redraw_clip, &redraw_rect);
if (may_use_clipped_redraw &&
G_UNLIKELY ((clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS)))
{
CoglContext *ctx = cogl_framebuffer_get_context (fb);
static CoglPipeline *outline = NULL;
ClutterActor *actor = CLUTTER_ACTOR (wrapper);
float x_1 = redraw_rect.x;
float x_2 = redraw_rect.x + redraw_rect.width;
float y_1 = redraw_rect.y;
float y_2 = redraw_rect.y + redraw_rect.height;
float x_1 = redraw_clip.x;
float x_2 = redraw_clip.x + redraw_clip.width;
float y_1 = redraw_clip.y;
float y_2 = redraw_clip.y + redraw_clip.height;
CoglVertexP2 quad[4] = {
{ x_1, y_1 },
{ x_2, y_1 },
@ -732,10 +724,10 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
else if (use_clipped_redraw)
{
swap_region = (cairo_rectangle_int_t) {
.x = (clip_rect.x - view_rect.x) * fb_scale,
.y = (clip_rect.y - view_rect.y) * fb_scale,
.width = clip_rect.width * fb_scale,
.height = clip_rect.height * fb_scale,
.x = (clip_region.x - view_rect.x) * fb_scale,
.y = (clip_region.y - view_rect.y) * fb_scale,
.width = clip_region.width * fb_scale,
.height = clip_region.height * fb_scale,
};
g_assert (swap_region.width > 0);
do_swap_buffer = TRUE;
@ -757,11 +749,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
do_swap_buffer = TRUE;
}
if (redraw_clip)
cairo_region_destroy (redraw_clip);
if (clip_region)
cairo_region_destroy (clip_region);
if (do_swap_buffer)
{
if (clutter_stage_view_get_onscreen (view) !=
@ -809,7 +796,6 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
/* reset the redraw clipping for the next paint... */
stage_cogl->initialized_redraw_clip = FALSE;
g_clear_pointer (&stage_cogl->redraw_clip, cairo_region_destroy);
stage_cogl->frame_count++;
}
@ -824,7 +810,7 @@ clutter_stage_cogl_get_dirty_pixel (ClutterStageWindow *stage_window,
gboolean has_buffer_age =
cogl_is_onscreen (framebuffer) &&
cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_BUFFER_AGE);
cairo_rectangle_int_t rect;
cairo_rectangle_int_t *rect;
if (!has_buffer_age)
{
@ -837,18 +823,12 @@ clutter_stage_cogl_get_dirty_pixel (ClutterStageWindow *stage_window,
ClutterStageViewCoglPrivate *view_priv =
clutter_stage_view_cogl_get_instance_private (view_cogl);
cairo_rectangle_int_t view_layout;
cairo_region_t *damage;
clutter_stage_view_get_layout (view, &view_layout);
damage = view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - 1)];
if (damage)
cairo_region_get_rectangle (damage, 0, &rect);
else
rect.x = rect.y = 0;
*x = rect.x - view_layout.x;
*y = rect.y - view_layout.y;
rect = &view_priv->damage_history[DAMAGE_HISTORY (view_priv->damage_index - 1)];
*x = rect->x - view_layout.x;
*y = rect->y - view_layout.y;
}
}
@ -867,7 +847,7 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
iface->add_redraw_clip = clutter_stage_cogl_add_redraw_clip;
iface->has_redraw_clips = clutter_stage_cogl_has_redraw_clips;
iface->ignoring_redraw_clips = clutter_stage_cogl_ignoring_redraw_clips;
iface->get_redraw_clip = clutter_stage_cogl_get_redraw_clip;
iface->get_redraw_clip_bounds = clutter_stage_cogl_get_redraw_clip_bounds;
iface->redraw = clutter_stage_cogl_redraw;
iface->get_dirty_pixel = clutter_stage_cogl_get_dirty_pixel;
}

View File

@ -59,7 +59,7 @@ struct _ClutterStageCogl
* junk frames to start with. */
unsigned int frame_count;
cairo_region_t *redraw_clip;
cairo_rectangle_int_t bounding_redraw_clip;
guint initialized_redraw_clip : 1;

View File

@ -407,8 +407,7 @@ test_scale_center (TestState *state)
g_assert (scale_x == 4.0);
g_assert (scale_y == 2.0);
g_assert (gravity == CLUTTER_GRAVITY_NONE);
assert_notifications (NOTIFY_SCALE_X | NOTIFY_SCALE_Y
| NOTIFY_SCALE_CENTER_X | NOTIFY_SCALE_CENTER_Y
assert_notifications (NOTIFY_SCALE_CENTER_X | NOTIFY_SCALE_CENTER_Y
| NOTIFY_SCALE_GRAVITY);
assert_coords (state, 100 + 10 - 10 * 4, 200 + 20 - 20 * 2,
100 + 10 + (RECT_WIDTH - 10) * 4,

View File

@ -193,11 +193,6 @@ struct _CoglFramebuffer
CoglFramebufferBits bits;
int samples_per_pixel;
/* Whether the depth buffer was enabled for this framebuffer,
* usually means it needs to be cleared before being reused next.
*/
CoglBool depth_buffer_clear_needed;
};
typedef enum {

View File

@ -117,7 +117,6 @@ _cogl_framebuffer_init (CoglFramebuffer *framebuffer,
framebuffer->viewport_age_for_scissor_workaround = -1;
framebuffer->dither_enabled = TRUE;
framebuffer->depth_writing_enabled = TRUE;
framebuffer->depth_buffer_clear_needed = TRUE;
framebuffer->modelview_stack = cogl_matrix_stack_new (ctx);
framebuffer->projection_stack = cogl_matrix_stack_new (ctx);
@ -269,13 +268,6 @@ cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer,
int scissor_y1;
CoglBool saved_viewport_scissor_workaround;
if (!framebuffer->depth_buffer_clear_needed &&
(buffers & COGL_BUFFER_BIT_DEPTH))
buffers &= ~(COGL_BUFFER_BIT_DEPTH);
if (buffers == 0)
return;
_cogl_clip_stack_get_bounds (clip_stack,
&scissor_x0, &scissor_y0,
&scissor_x1, &scissor_y1);
@ -423,9 +415,6 @@ cleared:
_cogl_framebuffer_mark_mid_scene (framebuffer);
_cogl_framebuffer_mark_clear_clip_dirty (framebuffer);
if (buffers & COGL_BUFFER_BIT_DEPTH)
framebuffer->depth_buffer_clear_needed = FALSE;
if (buffers & COGL_BUFFER_BIT_COLOR && buffers & COGL_BUFFER_BIT_DEPTH)
{
/* For our fast-path for reading back a single pixel of simple

View File

@ -418,11 +418,7 @@ flush_depth_state (CoglContext *ctx,
if (ctx->depth_test_enabled_cache != depth_state->test_enabled)
{
if (depth_state->test_enabled == TRUE)
{
GE (ctx, glEnable (GL_DEPTH_TEST));
if (ctx->current_draw_buffer)
ctx->current_draw_buffer->depth_buffer_clear_needed = TRUE;
}
GE (ctx, glEnable (GL_DEPTH_TEST));
else
GE (ctx, glDisable (GL_DEPTH_TEST));
ctx->depth_test_enabled_cache = depth_state->test_enabled;

View File

@ -2,7 +2,7 @@ AC_PREREQ(2.62)
m4_define([mutter_major_version], [3])
m4_define([mutter_minor_version], [25])
m4_define([mutter_micro_version], [1])
m4_define([mutter_micro_version], [2])
m4_define([mutter_version],
[mutter_major_version.mutter_minor_version.mutter_micro_version])

View File

@ -59,6 +59,7 @@ struct _MetaBackendClass
MetaMonitorManager * (* create_monitor_manager) (MetaBackend *backend);
MetaCursorRenderer * (* create_cursor_renderer) (MetaBackend *backend);
MetaRenderer * (* create_renderer) (MetaBackend *backend);
MetaInputSettings * (* create_input_settings) (MetaBackend *backend);
gboolean (* grab_device) (MetaBackend *backend,
int device_id,

View File

@ -45,6 +45,8 @@
#include "backends/meta-monitor-manager-dummy.h"
#include "ui/theme-private.h"
#define META_IDLE_MONITOR_CORE_DEVICE 0
enum
{
KEYMAP_CHANGED,
@ -245,6 +247,16 @@ destroy_device_monitor (MetaBackend *backend,
g_hash_table_remove (priv->device_monitors, &device_id);
}
static void
meta_backend_monitor_device (MetaBackend *backend,
ClutterInputDevice *device)
{
int device_id;
device_id = clutter_input_device_get_device_id (device);
create_device_monitor (backend, device_id);
}
static void
on_device_added (ClutterDeviceManager *device_manager,
ClutterInputDevice *device,
@ -352,10 +364,56 @@ create_monitor_manager (MetaBackend *backend)
return META_BACKEND_GET_CLASS (backend)->create_monitor_manager (backend);
}
static void
create_device_monitors (MetaBackend *backend,
ClutterDeviceManager *device_manager)
{
const GSList *devices;
const GSList *l;
create_device_monitor (backend, META_IDLE_MONITOR_CORE_DEVICE);
devices = clutter_device_manager_peek_devices (device_manager);
for (l = devices; l; l = l->next)
{
ClutterInputDevice *device = l->data;
meta_backend_monitor_device (backend, device);
}
}
static void
set_initial_pointer_visibility (MetaBackend *backend,
ClutterDeviceManager *device_manager)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
const GSList *devices;
const GSList *l;
gboolean has_touchscreen = FALSE;
devices = clutter_device_manager_peek_devices (device_manager);
for (l = devices; l; l = l->next)
{
ClutterInputDevice *device = l->data;
has_touchscreen |= device_is_slave_touchscreen (device);
}
meta_cursor_tracker_set_pointer_visible (priv->cursor_tracker,
!has_touchscreen);
}
static MetaInputSettings *
meta_backend_create_input_settings (MetaBackend *backend)
{
return META_BACKEND_GET_CLASS (backend)->create_input_settings (backend);
}
static void
meta_backend_real_post_init (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
ClutterDeviceManager *device_manager = clutter_device_manager_get_default ();
priv->stage = meta_stage_new ();
clutter_actor_realize (priv->stage);
@ -373,37 +431,16 @@ meta_backend_real_post_init (MetaBackend *backend)
g_hash_table_new_full (g_int_hash, g_int_equal,
NULL, (GDestroyNotify) g_object_unref);
{
MetaCursorTracker *cursor_tracker;
ClutterDeviceManager *manager;
gboolean has_touchscreen = FALSE;
GSList *devices, *l;
create_device_monitors (backend, device_manager);
/* Create the core device monitor. */
create_device_monitor (backend, 0);
g_signal_connect_object (device_manager, "device-added",
G_CALLBACK (on_device_added), backend, 0);
g_signal_connect_object (device_manager, "device-removed",
G_CALLBACK (on_device_removed), backend, 0);
manager = clutter_device_manager_get_default ();
g_signal_connect_object (manager, "device-added",
G_CALLBACK (on_device_added), backend, 0);
g_signal_connect_object (manager, "device-removed",
G_CALLBACK (on_device_removed), backend, 0);
set_initial_pointer_visibility (backend, device_manager);
devices = clutter_device_manager_list_devices (manager);
for (l = devices; l != NULL; l = l->next)
{
ClutterInputDevice *device = l->data;
on_device_added (manager, device, backend);
has_touchscreen |= device_is_slave_touchscreen (device);
}
cursor_tracker = priv->cursor_tracker;
meta_cursor_tracker_set_pointer_visible (cursor_tracker, !has_touchscreen);
g_slist_free (devices);
}
priv->input_settings = meta_input_settings_create ();
priv->input_settings = meta_backend_create_input_settings (backend);
center_pointer (backend);
}
@ -698,7 +735,8 @@ meta_backend_get_cursor_renderer (MetaBackend *backend)
/**
* meta_backend_get_renderer: (skip)
*/
MetaRenderer * meta_backend_get_renderer (MetaBackend *backend)
MetaRenderer *
meta_backend_get_renderer (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
@ -708,7 +746,8 @@ MetaRenderer * meta_backend_get_renderer (MetaBackend *backend)
/**
* meta_backend_get_egl: (skip)
*/
MetaEgl * meta_backend_get_egl (MetaBackend *backend)
MetaEgl *
meta_backend_get_egl (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);

View File

@ -31,20 +31,9 @@
#include <libwacom/libwacom.h>
#endif
#define META_TYPE_INPUT_SETTINGS (meta_input_settings_get_type ())
#define META_INPUT_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_INPUT_SETTINGS, MetaInputSettings))
#define META_INPUT_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_INPUT_SETTINGS, MetaInputSettingsClass))
#define META_IS_INPUT_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_INPUT_SETTINGS))
#define META_IS_INPUT_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_INPUT_SETTINGS))
#define META_INPUT_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_INPUT_SETTINGS, MetaInputSettingsClass))
typedef struct _MetaInputSettings MetaInputSettings;
typedef struct _MetaInputSettingsClass MetaInputSettingsClass;
struct _MetaInputSettings
{
GObject parent_instance;
};
#define META_TYPE_INPUT_SETTINGS (meta_input_settings_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaInputSettings, meta_input_settings,
META, INPUT_SETTINGS, GObject)
struct _MetaInputSettingsClass
{
@ -65,6 +54,9 @@ struct _MetaInputSettingsClass
void (* set_tap_enabled) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled);
void (* set_disable_while_typing) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled);
void (* set_invert_scroll) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean inverted);
@ -117,15 +109,10 @@ struct _MetaInputSettingsClass
ClutterInputDeviceTool *tool,
GDesktopStylusButtonAction primary,
GDesktopStylusButtonAction secondary);
gboolean (* has_two_finger_scroll) (MetaInputSettings *settings,
ClutterInputDevice *device);
};
GType meta_input_settings_get_type (void) G_GNUC_CONST;
MetaInputSettings * meta_input_settings_create (void);
GSettings * meta_input_settings_get_tablet_settings (MetaInputSettings *settings,
ClutterInputDevice *device);
MetaLogicalMonitor * meta_input_settings_get_tablet_logical_monitor (MetaInputSettings *settings,

View File

@ -33,12 +33,6 @@
#include "meta-input-settings-private.h"
#include "backends/meta-logical-monitor.h"
#include "backends/meta-monitor.h"
#include "x11/meta-input-settings-x11.h"
#ifdef HAVE_NATIVE_BACKEND
#include "native/meta-backend-native.h"
#include "native/meta-input-settings-native.h"
#endif
#include <glib/gi18n-lib.h>
#include <meta/util.h>
@ -448,6 +442,44 @@ update_device_natural_scroll (MetaInputSettings *input_settings,
}
}
static void
update_touchpad_disable_while_typing (MetaInputSettings *input_settings,
ClutterInputDevice *device)
{
GSettings *settings;
MetaInputSettingsClass *input_settings_class;
MetaInputSettingsPrivate *priv;
gboolean enabled;
const gchar *key = "disable-while-typing";
if (device &&
clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
return;
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
enabled = g_settings_get_boolean (priv->touchpad_settings, key);
if (device)
{
settings = get_settings_for_device_type (input_settings,
clutter_input_device_get_device_type (device));
if (!settings)
return;
settings_device_set_bool_setting (input_settings, device,
input_settings_class->set_disable_while_typing,
enabled);
}
else
{
settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
input_settings_class->set_disable_while_typing,
enabled);
}
}
static void
update_touchpad_tap_enabled (MetaInputSettings *input_settings,
ClutterInputDevice *device)
@ -989,6 +1021,8 @@ meta_input_settings_changed_cb (GSettings *settings,
update_device_natural_scroll (input_settings, NULL);
else if (strcmp (key, "tap-to-click") == 0)
update_touchpad_tap_enabled (input_settings, NULL);
else if (strcmp(key, "disable-while-typing") == 0)
update_touchpad_disable_while_typing (input_settings, NULL);
else if (strcmp (key, "send-events") == 0)
update_touchpad_send_events (input_settings, NULL);
else if (strcmp (key, "edge-scrolling-enabled") == 0)
@ -1234,6 +1268,7 @@ apply_device_settings (MetaInputSettings *input_settings,
update_touchpad_left_handed (input_settings, device);
update_touchpad_tap_enabled (input_settings, device);
update_touchpad_disable_while_typing (input_settings, device);
update_touchpad_send_events (input_settings, device);
update_touchpad_two_finger_scroll (input_settings, device);
update_touchpad_edge_scroll (input_settings, device);
@ -1478,23 +1513,6 @@ meta_input_settings_init (MetaInputSettings *settings)
priv->two_finger_devices = g_hash_table_new (NULL, NULL);
}
MetaInputSettings *
meta_input_settings_create (void)
{
#ifdef HAVE_NATIVE_BACKEND
MetaBackend *backend;
backend = meta_get_backend ();
if (META_IS_BACKEND_NATIVE (backend))
return g_object_new (META_TYPE_INPUT_SETTINGS_NATIVE, NULL);
#endif
if (!meta_is_wayland_compositor ())
return g_object_new (META_TYPE_INPUT_SETTINGS_X11, NULL);
return NULL;
}
GSettings *
meta_input_settings_get_tablet_settings (MetaInputSettings *settings,
ClutterInputDevice *device)

View File

@ -45,6 +45,7 @@
#include "backends/meta-pointer-constraint.h"
#include "backends/meta-stage.h"
#include "backends/native/meta-clutter-backend-native.h"
#include "backends/native/meta-input-settings-native.h"
#include "backends/native/meta-renderer-native.h"
#include "backends/native/meta-stage-native.h"
@ -431,6 +432,12 @@ meta_backend_native_create_renderer (MetaBackend *backend)
return META_RENDERER (renderer_native);
}
static MetaInputSettings *
meta_backend_native_create_input_settings (MetaBackend *backend)
{
return g_object_new (META_TYPE_INPUT_SETTINGS_NATIVE, NULL);
}
static void
meta_backend_native_warp_pointer (MetaBackend *backend,
int x,
@ -561,6 +568,7 @@ meta_backend_native_class_init (MetaBackendNativeClass *klass)
backend_class->create_monitor_manager = meta_backend_native_create_monitor_manager;
backend_class->create_cursor_renderer = meta_backend_native_create_cursor_renderer;
backend_class->create_renderer = meta_backend_native_create_renderer;
backend_class->create_input_settings = meta_backend_native_create_input_settings;
backend_class->warp_pointer = meta_backend_native_warp_pointer;

View File

@ -121,6 +121,25 @@ meta_input_settings_native_set_tap_enabled (MetaInputSettings *settings,
LIBINPUT_CONFIG_TAP_DISABLED);
}
static void
meta_input_settings_native_set_disable_while_typing (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled)
{
struct libinput_device *libinput_device;
libinput_device = clutter_evdev_input_device_get_libinput_device (device);
if (!libinput_device)
return;
if (libinput_device_config_dwt_is_available (libinput_device))
libinput_device_config_dwt_set_enabled (libinput_device,
enabled ?
LIBINPUT_CONFIG_DWT_ENABLED :
LIBINPUT_CONFIG_DWT_DISABLED);
}
static void
meta_input_settings_native_set_invert_scroll (MetaInputSettings *settings,
ClutterInputDevice *device,
@ -507,6 +526,7 @@ meta_input_settings_native_class_init (MetaInputSettingsNativeClass *klass)
input_settings_class->set_scroll_button = meta_input_settings_native_set_scroll_button;
input_settings_class->set_click_method = meta_input_settings_native_set_click_method;
input_settings_class->set_keyboard_repeat = meta_input_settings_native_set_keyboard_repeat;
input_settings_class->set_disable_while_typing = meta_input_settings_native_set_disable_while_typing;
input_settings_class->set_tablet_mapping = meta_input_settings_native_set_tablet_mapping;
input_settings_class->set_tablet_keep_aspect = meta_input_settings_native_set_tablet_keep_aspect;

View File

@ -28,6 +28,7 @@
#include "backends/meta-backend-private.h"
#include "backends/x11/meta-cursor-renderer-x11.h"
#include "backends/x11/meta-input-settings-x11.h"
#include "backends/x11/meta-monitor-manager-xrandr.h"
#include "backends/x11/cm/meta-renderer-x11-cm.h"
@ -108,6 +109,12 @@ meta_backend_x11_cm_create_cursor_renderer (MetaBackend *backend)
return g_object_new (META_TYPE_CURSOR_RENDERER_X11, NULL);
}
static MetaInputSettings *
meta_backend_x11_cm_create_input_settings (MetaBackend *backend)
{
return g_object_new (META_TYPE_INPUT_SETTINGS_X11, NULL);
}
static void
meta_backend_x11_cm_update_screen_size (MetaBackend *backend,
int width,
@ -390,6 +397,7 @@ meta_backend_x11_cm_class_init (MetaBackendX11CmClass *klass)
backend_class->create_renderer = meta_backend_x11_cm_create_renderer;
backend_class->create_monitor_manager = meta_backend_x11_cm_create_monitor_manager;
backend_class->create_cursor_renderer = meta_backend_x11_cm_create_cursor_renderer;
backend_class->create_input_settings = meta_backend_x11_cm_create_input_settings;
backend_class->update_screen_size = meta_backend_x11_cm_update_screen_size;
backend_class->select_stage_events = meta_backend_x11_cm_select_stage_events;
backend_class->lock_layout_group = meta_backend_x11_cm_lock_layout_group;

View File

@ -205,6 +205,17 @@ meta_input_settings_x11_set_left_handed (MetaInputSettings *settings,
}
}
static void
meta_input_settings_x11_set_disable_while_typing (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled)
{
guchar value = (enabled) ? 1 : 0;
change_property (device, "libinput Disable While Typing Enabled",
XA_INTEGER, 8, &value, 1);
}
static void
meta_input_settings_x11_set_tap_enabled (MetaInputSettings *settings,
ClutterInputDevice *device,
@ -744,6 +755,7 @@ meta_input_settings_x11_class_init (MetaInputSettingsX11Class *klass)
input_settings_class->set_speed = meta_input_settings_x11_set_speed;
input_settings_class->set_left_handed = meta_input_settings_x11_set_left_handed;
input_settings_class->set_tap_enabled = meta_input_settings_x11_set_tap_enabled;
input_settings_class->set_disable_while_typing = meta_input_settings_x11_set_disable_while_typing;
input_settings_class->set_invert_scroll = meta_input_settings_x11_set_invert_scroll;
input_settings_class->set_edge_scroll = meta_input_settings_x11_set_edge_scroll;
input_settings_class->set_two_finger_scroll = meta_input_settings_x11_set_two_finger_scroll;

View File

@ -49,6 +49,12 @@ meta_backend_x11_nested_create_cursor_renderer (MetaBackend *backend)
return g_object_new (META_TYPE_CURSOR_RENDERER_X11_NESTED, NULL);
}
static MetaInputSettings *
meta_backend_x11_nested_create_input_settings (MetaBackend *backend)
{
return NULL;
}
static void
meta_backend_x11_nested_update_screen_size (MetaBackend *backend,
int width,
@ -177,6 +183,7 @@ meta_backend_x11_nested_class_init (MetaBackendX11NestedClass *klass)
backend_class->create_renderer = meta_backend_x11_nested_create_renderer;
backend_class->create_monitor_manager = meta_backend_x11_nested_create_monitor_manager;
backend_class->create_cursor_renderer = meta_backend_x11_nested_create_cursor_renderer;
backend_class->create_input_settings = meta_backend_x11_nested_create_input_settings;
backend_class->update_screen_size = meta_backend_x11_nested_update_screen_size;
backend_class->select_stage_events = meta_backend_x11_nested_select_stage_events;
backend_class->lock_layout_group = meta_backend_x11_nested_lock_layout_group;

View File

@ -220,7 +220,11 @@ meta_shadow_paint (MetaShadow *shadow,
int dest_x[4];
int dest_y[4];
int n_x, n_y;
gboolean source_updated = FALSE;
cogl_pipeline_set_color4ub (shadow->pipeline,
opacity, opacity, opacity, opacity);
cogl_set_source (shadow->pipeline);
if (shadow->scale_width)
{
@ -296,17 +300,6 @@ meta_shadow_paint (MetaShadow *shadow,
else
overlap = CAIRO_REGION_OVERLAP_IN;
if (overlap == CAIRO_REGION_OVERLAP_OUT)
continue;
if (!source_updated)
{
cogl_pipeline_set_color4ub (shadow->pipeline,
opacity, opacity, opacity, opacity);
cogl_set_source (shadow->pipeline);
source_updated = TRUE;
}
/* There's quite a bit of overhead from allocating a new
* region in order to find an exact intersection and
* generating more geometry - we make the assumption that

View File

@ -35,6 +35,7 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaSurfaceActor, meta_surface_actor, CLUTTER_
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
enum {
REPAINT_SCHEDULED,
SIZE_CHANGED,
LAST_SIGNAL,
@ -120,6 +121,13 @@ meta_surface_actor_class_init (MetaSurfaceActorClass *klass)
object_class->dispose = meta_surface_actor_dispose;
actor_class->pick = meta_surface_actor_pick;
signals[REPAINT_SCHEDULED] = g_signal_new ("repaint-scheduled",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[SIZE_CHANGED] = g_signal_new ("size-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@ -193,7 +201,8 @@ meta_surface_actor_update_area (MetaSurfaceActor *self,
{
MetaSurfaceActorPrivate *priv = self->priv;
meta_shaped_texture_update_area (priv->texture, x, y, width, height);
if (meta_shaped_texture_update_area (priv->texture, x, y, width, height))
g_signal_emit (self, signals[REPAINT_SCHEDULED], 0);
}
gboolean

View File

@ -82,6 +82,7 @@ struct _MetaWindowActorPrivate
guint send_frame_messages_timer;
gint64 frame_drawn_time;
guint repaint_scheduled_id;
guint size_changed_id;
/*
@ -193,18 +194,6 @@ frame_data_free (FrameData *frame)
g_slice_free (FrameData, frame);
}
static gboolean
meta_window_actor_queue_redraw (ClutterActor *actor,
ClutterActor *leaf,
ClutterPaintVolume *paint_volume)
{
MetaWindowActor *self = META_WINDOW_ACTOR (actor);
MetaWindowActorPrivate *priv = self->priv;
priv->repaint_scheduled = TRUE;
return CLUTTER_ACTOR_CLASS (meta_window_actor_parent_class)->queue_redraw (actor, leaf, paint_volume);
}
static void
meta_window_actor_class_init (MetaWindowActorClass *klass)
{
@ -222,7 +211,6 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
actor_class->paint = meta_window_actor_paint;
actor_class->get_paint_volume = meta_window_actor_get_paint_volume;
actor_class->queue_redraw = meta_window_actor_queue_redraw;
/**
* MetaWindowActor::first-frame:
@ -309,6 +297,16 @@ surface_size_changed (MetaSurfaceActor *actor,
meta_window_actor_update_shape (self);
}
static void
surface_repaint_scheduled (MetaSurfaceActor *actor,
gpointer user_data)
{
MetaWindowActor *self = META_WINDOW_ACTOR (user_data);
MetaWindowActorPrivate *priv = self->priv;
priv->repaint_scheduled = TRUE;
}
static gboolean
is_argb32 (MetaWindowActor *self)
{
@ -398,7 +396,9 @@ set_surface (MetaWindowActor *self,
if (priv->surface)
{
g_signal_handler_disconnect (priv->surface, priv->repaint_scheduled_id);
g_signal_handler_disconnect (priv->surface, priv->size_changed_id);
priv->repaint_scheduled_id = 0;
clutter_actor_remove_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));
g_object_unref (priv->surface);
}
@ -408,6 +408,8 @@ set_surface (MetaWindowActor *self,
if (priv->surface)
{
g_object_ref_sink (priv->surface);
priv->repaint_scheduled_id = g_signal_connect (priv->surface, "repaint-scheduled",
G_CALLBACK (surface_repaint_scheduled), self);
priv->size_changed_id = g_signal_connect (priv->surface, "size-changed",
G_CALLBACK (surface_size_changed), self);
clutter_actor_add_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));
@ -715,7 +717,6 @@ meta_window_actor_paint (ClutterActor *actor)
cairo_rectangle_int_t shape_bounds;
cairo_region_t *clip = priv->shadow_clip;
MetaWindow *window = priv->window;
gboolean partially_drawn = FALSE;
meta_window_actor_get_shape_bounds (self, &shape_bounds);
meta_window_actor_get_shadow_params (self, appears_focused, &params);
@ -733,17 +734,6 @@ meta_window_actor_paint (ClutterActor *actor)
cairo_region_subtract (clip, frame_bounds);
}
else if (clip)
{
cairo_rectangle_int_t shadow_bounds;
cairo_region_t *shadow_region;
meta_window_actor_get_shadow_bounds (self, appears_focused, &shadow_bounds);
shadow_region = cairo_region_create_rectangle (&shadow_bounds);
cairo_region_intersect (shadow_region, clip);
partially_drawn = !cairo_region_is_empty (shadow_region);
cairo_region_destroy (shadow_region);
}
meta_shadow_paint (shadow,
params.x_offset + shape_bounds.x,
@ -752,7 +742,7 @@ meta_window_actor_paint (ClutterActor *actor)
shape_bounds.height,
(clutter_actor_get_paint_opacity (actor) * params.opacity * window->opacity) / (255 * 255),
clip,
clip_shadow_under_window (self) || partially_drawn);
clip_shadow_under_window (self)); /* clip_strictly - not just as an optimization */
if (clip && clip != priv->shadow_clip)
cairo_region_destroy (clip);

View File

@ -57,7 +57,7 @@ meta_window_group_paint (ClutterActor *actor)
{
cairo_region_t *clip_region;
cairo_region_t *unobscured_region;
cairo_rectangle_int_t visible_rect;
cairo_rectangle_int_t visible_rect, clip_rect;
int paint_x_origin, paint_y_origin;
int screen_width, screen_height;
@ -109,7 +109,11 @@ meta_window_group_paint (ClutterActor *actor)
* sizes, we could intersect this with an accurate union of the
* monitors to avoid painting shadows that are visible only in the
* holes. */
clip_region = clutter_stage_get_redraw_clip (CLUTTER_STAGE (stage));
clutter_stage_get_redraw_clip_bounds (CLUTTER_STAGE (stage),
&clip_rect);
clip_region = cairo_region_create_rectangle (&clip_rect);
cairo_region_translate (clip_region, -paint_x_origin, -paint_y_origin);
meta_cullable_cull_out (META_CULLABLE (window_group), unobscured_region, clip_region);

View File

@ -2890,6 +2890,7 @@ void
meta_window_tile (MetaWindow *window)
{
MetaMaximizeFlags directions;
MetaRectangle old_frame_rect, old_buffer_rect;
/* Don't do anything if no tiling is requested */
if (window->tile_mode == META_TILE_NONE)
@ -2903,6 +2904,13 @@ meta_window_tile (MetaWindow *window)
meta_window_maximize_internal (window, directions, NULL);
meta_screen_update_tile_preview (window->screen, FALSE);
meta_window_get_frame_rect (window, &old_frame_rect);
meta_window_get_buffer_rect (window, &old_buffer_rect);
meta_compositor_size_change_window (window->display->compositor, window,
META_SIZE_CHANGE_MAXIMIZE,
&old_frame_rect, &old_buffer_rect);
meta_window_move_resize_now (window);
if (window->frame)

View File

@ -264,6 +264,18 @@ meta_wayland_seat_free (MetaWaylandSeat *seat)
g_slice_free (MetaWaylandSeat, seat);
}
static gboolean
event_is_synthesized_crossing (const ClutterEvent *event)
{
ClutterInputDevice *device;
if (event->type != CLUTTER_ENTER && event->type != CLUTTER_LEAVE)
return FALSE;
device = clutter_event_get_source_device (event);
return clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_MASTER;
}
static gboolean
event_from_supported_hardware_device (MetaWaylandSeat *seat,
const ClutterEvent *event)
@ -310,7 +322,8 @@ void
meta_wayland_seat_update (MetaWaylandSeat *seat,
const ClutterEvent *event)
{
if (!event_from_supported_hardware_device (seat, event))
if (!event_from_supported_hardware_device (seat, event) &&
!event_is_synthesized_crossing (event))
return;
switch (event->type)
@ -319,6 +332,8 @@ meta_wayland_seat_update (MetaWaylandSeat *seat,
case CLUTTER_BUTTON_PRESS:
case CLUTTER_BUTTON_RELEASE:
case CLUTTER_SCROLL:
case CLUTTER_ENTER:
case CLUTTER_LEAVE:
if (meta_wayland_seat_has_pointer (seat))
meta_wayland_pointer_update (seat->pointer, event);
break;

View File

@ -470,6 +470,14 @@ queue_surface_actor_frame_callbacks (MetaWaylandSurface *surface,
wl_list_init (&pending->frame_callback_list);
}
static void
pending_buffer_resource_destroyed (MetaWaylandBuffer *buffer,
MetaWaylandPendingState *pending)
{
g_signal_handler_disconnect (buffer, pending->buffer_destroy_handler_id);
pending->buffer = NULL;
}
static void
pending_state_init (MetaWaylandPendingState *state)
{
@ -502,9 +510,8 @@ pending_state_destroy (MetaWaylandPendingState *state)
g_clear_pointer (&state->opaque_region, cairo_region_destroy);
if (state->buffer)
g_object_remove_weak_pointer (G_OBJECT (state->buffer),
(gpointer *) &state->buffer);
g_signal_handler_disconnect (state->buffer,
state->buffer_destroy_handler_id);
wl_list_for_each_safe (cb, next, &state->frame_callback_list, link)
wl_resource_destroy (cb->resource);
}
@ -521,10 +528,7 @@ move_pending_state (MetaWaylandPendingState *from,
MetaWaylandPendingState *to)
{
if (from->buffer)
{
g_object_remove_weak_pointer (G_OBJECT (from->buffer),
(gpointer *) &from->buffer);
}
g_signal_handler_disconnect (from->buffer, from->buffer_destroy_handler_id);
to->newly_attached = from->newly_attached;
to->buffer = from->buffer;
@ -550,8 +554,10 @@ move_pending_state (MetaWaylandPendingState *from,
if (to->buffer)
{
g_object_add_weak_pointer (G_OBJECT (to->buffer),
(gpointer *) &to->buffer);
to->buffer_destroy_handler_id =
g_signal_connect (to->buffer, "resource-destroyed",
G_CALLBACK (pending_buffer_resource_destroyed),
to);
}
pending_state_init (from);
@ -907,8 +913,8 @@ wl_surface_attach (struct wl_client *client,
if (surface->pending->buffer)
{
g_object_remove_weak_pointer (G_OBJECT (surface->pending->buffer),
(gpointer *) &surface->pending->buffer);
g_signal_handler_disconnect (surface->pending->buffer,
surface->pending->buffer_destroy_handler_id);
}
surface->pending->newly_attached = TRUE;
@ -918,8 +924,10 @@ wl_surface_attach (struct wl_client *client,
if (buffer)
{
g_object_add_weak_pointer (G_OBJECT (surface->pending->buffer),
(gpointer *) &surface->pending->buffer);
surface->pending->buffer_destroy_handler_id =
g_signal_connect (buffer, "resource-destroyed",
G_CALLBACK (pending_buffer_resource_destroyed),
surface->pending);
}
}

View File

@ -123,6 +123,7 @@ struct _MetaWaylandPendingState
/* wl_surface.attach */
gboolean newly_attached;
MetaWaylandBuffer *buffer;
gulong buffer_destroy_handler_id;
int32_t dx;
int32_t dy;