After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 628520 - unfortunate namespacing
unfortunate namespacing
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Colin Walters
mutter-maint
Depends on:
Blocks: 632500
 
 
Reported: 2010-09-01 15:07 UTC by Colin Walters
Modified: 2010-10-23 19:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Remove Mutter namespace prefix (226.45 KB, patch)
2010-10-18 17:38 UTC, Owen Taylor
committed Details | Review

Description Colin Walters 2010-09-01 15:07:51 UTC
Most of mutter has a namespace prefix of "Meta", which works fine.  But the way Mutter is used breaks the GI naming rules, because:

MetaWindow => Meta.Window
MutterWindow => Meta.Window

Possible solutions:
1) s/Mutter/Meta/ and rename MutterWindow to say MetaWindowActor.  This would have a fairly large one time hit to library consumers.  On the other hand, the code would be less of a mess.
2) Pretend Mutter is a separate library at the introspection level (doable, not pretty)
3) Add an option --accept-unprefixed to g-ir-scanner to accept this.

I am working on a patch for 3).  But I did also start on a patch for 1).  Would the first be accepted?
Comment 1 Dan Winship 2010-09-01 15:42:20 UTC
if we were going to change things in mutter, it would be nice to just merge MetaWindow and MutterWindow, so you don't have to look at a JS variable named "window" and try to figure out which kind it is (which is sometimes tricky because certain methods exist on both objects)
Comment 2 Colin Walters 2010-09-01 15:55:57 UTC
(In reply to comment #1)
> if we were going to change things in mutter, it would be nice to just merge
> MetaWindow and MutterWindow

Hmm, yes, more invasive but also better.  Are we sure though that there are no cases where we have a MetaWindow but don't want an actor for it?
Comment 3 Tomas Frydrych 2010-09-01 16:01:33 UTC
(In reply to comment #1)
> if we were going to change things in mutter, it would be nice to just merge
> MetaWindow and MutterWindow, so you don't have to look at a JS variable named
> "window" and try to figure out which kind it is (which is sometimes tricky
> because certain methods exist on both objects)

That would mean getting rid of the wm/compositor distinction; though this is there for historical reasons from days we have multiple compositor backends, it is a fairly clear logical distinction that provides for a more manageable codebase I think.
Comment 4 Owen Taylor 2010-09-01 16:28:59 UTC
(In reply to comment #1)
> if we were going to change things in mutter, it would be nice to just merge
> MetaWindow and MutterWindow, so you don't have to look at a JS variable named
> "window" and try to figure out which kind it is (which is sometimes tricky
> because certain methods exist on both objects)

MetaWindow has a large API and complex behavior - I think having it derive from ClutterActor - which also has a large API and a complex behavior would be a mistake. MetaWindow is an object that represents a toplevel window.

I'd be more in favor of Window => WindowActor
Comment 5 Colin Walters 2010-09-01 16:46:26 UTC
(In reply to comment #4)
> (In reply to comment #1)
> > if we were going to change things in mutter, it would be nice to just merge
> > MetaWindow and MutterWindow, so you don't have to look at a JS variable named
> > "window" and try to figure out which kind it is (which is sometimes tricky
> > because certain methods exist on both objects)
> 
> MetaWindow has a large API and complex behavior - I think having it derive from
> ClutterActor - which also has a large API and a complex behavior would be a
> mistake. MetaWindow is an object that represents a toplevel window.
> 
> I'd be more in favor of Window => WindowActor

Ok; any other naming suggestions anyone feels strongly about?

We should have some long term plan here as we eventually move towards libmutter.  Should we keep the "Mutter" prefix as a duplicate namespace?  If we did MutterWindow -> MetaWindowActor, then the only remaining major bits would be the plugin goo, which would probably go away for the most part.
Comment 6 Tomas Frydrych 2010-09-02 06:29:00 UTC
(In reply to comment #4)
> I'd be more in favor of Window => WindowActor

MetaWindowActor is bit awkward (e.g., MutterWindowGroup would then become MetaWindowActorGroup ?). Can anybody think of a suitable name that would consist of just one word + the prefix ? Maybe just MetaActor, MetaActorGroup ?
Comment 7 Owen Taylor 2010-10-18 17:35:37 UTC
(In reply to comment #6)
> (In reply to comment #4)
> > I'd be more in favor of Window => WindowActor
> 
> MetaWindowActor is bit awkward (e.g., MutterWindowGroup would then become
> MetaWindowActorGroup ?). Can anybody think of a suitable name that would
> consist of just one word + the prefix ? Maybe just MetaActor, MetaActorGroup ?

MetaActor is going to produce a lot of constructions like:

 MetaActor *meta_actor = META_ACTOR (actor);

In the patch I'm going to attach I went with MetaWindowActor and left MutterWindowGroup as MetaWindowGroup - it's not a very important object, so I didn't think it mattered much if it was a bit confusing with MetaGroup (a group of windows, another not very important object)

If I was going to rename it I'd probably rename it to MetaWindowStack or something that doens't have 'group' in the name.
Comment 8 Owen Taylor 2010-10-18 17:38:54 UTC
Created attachment 172628 [details] [review]
Remove Mutter namespace prefix

Move all objects and functions namespaced with Mutter into the Meta namespace
to get a single consistent namespace. Changes that aren't simply changing mutter
to meta:

 MutterWindow              => MetaWindowActor
 mutter_get_windows        => meta_get_window_actors
 mutter_plugin_get_windows => meta_plugin_get_window_actors
Comment 9 Tomas Frydrych 2010-10-19 07:49:07 UTC
Patch looks fine to me.
Comment 10 Colin Walters 2010-10-19 19:28:20 UTC
Review of attachment 172628 [details] [review]:

Looks straightforward to me as well.
Comment 11 Owen Taylor 2010-10-23 19:52:02 UTC
Attachment 172628 [details] pushed as 1920f21 - Remove Mutter namespace prefix