De-duplicate "actor contains actor" code

Add _st_actor_contains() in st-private for use within St, and
monkey-patch in a Clutter.Actor.contains() for use by javascript, and
then replace all the duplicate implementations with one or the other
of those.

https://bugzilla.gnome.org/show_bug.cgi?id=621197
This commit is contained in:
Dan Winship
2010-06-10 08:15:02 -04:00
parent e6a70e4676
commit a4befeba53
10 changed files with 38 additions and 81 deletions

View File

@ -1,5 +1,6 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Clutter = imports.gi.Clutter;;
const Shell = imports.gi.Shell;
const St = imports.gi.St;
const Gettext_gtk20 = imports.gettext.domain('gtk20');
@ -70,6 +71,12 @@ function init() {
_patchContainerClass(St.BoxLayout);
_patchContainerClass(St.Table);
Clutter.Actor.prototype.contains = function(child) {
while (child != null && child != this)
child = child.get_parent();
return child != null;
};
_blockMethod('Clutter.Event.get_state', 'Shell.get_event_state',
'gjs\'s handling of Clutter.ModifierType is broken. See bug 597292.');
_blockMethod('Gdk.Display.get_pointer', 'global.get_pointer',