Re: overridding WorkspacesDisplay



On Tue, Aug 14, 2012 at 2:45 AM, Amy C <mathematical coffee gmail com> wrote:
> Hi all,
>
> For some reason, I can't seem to patch WorkspacesDisplay. (I'm trying
> to define what happens when you scroll your mouse button over the
> workspace thumbnail sidebar in the overview):
>
> const WorkspacesView = imports.ui.workspacesView;
> const WDproto = WorkspacesView.WorkspacesView.prototype;
>
> let storage;
> function enable () {
>     storage._onScrollEvent = WDproto._onScrollEvent; // store the original
>     WDproto._onScrollEvent = function () {
>         log('stole the scroll event');
>     };
> }

When you connect to a signal, it passes the function object, not the
prototype and function name.

> When I put this into an extension (with corresponding disable() and
> init()), it doesn't work - scrolling over the workspace thumbnail
> sidebar just does the usual (changes the workspace) rather than
> logging 'stole the scroll event' to the terminal.
>
> (And to verify that I have chosen to override the right function, if I
> sudo modify ._onScrollEvent in
> /usr/share/gnome-shell/js/ui/workspacesView.js to log to the terminal,
> it works).
>
> I had similar problems overridding ._getPreferredHeight,
> ._getPreferredWidth and ._allocate of
> imports.ui.workspaceThumbnails.ThumbnailsBox.
>
> Can anyone tell me what's going on here?
>
> cheers.
> _______________________________________________
> gnome-shell-list mailing list
> gnome-shell-list gnome org
> https://mail.gnome.org/mailman/listinfo/gnome-shell-list



-- 
  Jasper


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