franglais125 / no-title-bar

Integrates maximized windows with the top panel
https://extensions.gnome.org/extension/1267/no-title-bar/
GNU General Public License v2.0
279 stars 40 forks source link

Not working after 7th version #41

Closed dincercelik closed 6 years ago

dincercelik commented 6 years ago

It's not working on Ubuntu 17.10 anymore. Having error below.

Nov 21 09:09:01 dincer-latitude gnome-shell[16709]: Extension "no-title-bar@franglais125.gmail.com" had error: Error: second argument to Lang.bind() must be a function, not undefined

szuliq commented 6 years ago

Same issue here.

nhinds commented 6 years ago

Looking at the changes between v6 and v7, it seems like the issue is the new _enableDragOnPanel / _disableDragOnPanel functions in buttons.js that was introduced in 52ad939a08710cfcb62892418c44e4e385be9cd7

If the 'button-position' setting is "HIDDEN" then the Buttons constructor calls into the this._disable() method, which blindly calls this._disableDragOnPanel(). This "helpfully" sets the global Main.panel._onButtonPress to null, because this._originalFunction was never initialized, and then tries to bind null to Main.panel.

In the meantime, if you edit ~/.local/share/gnome-shell/extensions/no-title-bar@franglais125.gmail.com/buttons.js and add return to the top of the _enableDragOnPanel and _disableDragOnPanel functions to disable them, then restart gnome-shell, the extension seems to work fine for me.

    _enableDragOnPanel: function() {
        print('IGNORING BUGGY FUNCTION');
        return;
        this._originalFunction = Main.panel._onButtonPress;

        Main.panel._onButtonPress = function(actor, event) {
            if (Main.modalCount > 0)
                return Clutter.EVENT_PROPAGATE;

            if (event.get_source() != actor)
                return Clutter.EVENT_PROPAGATE;

            let button = event.get_button();
            if (button != 1)
                return Clutter.EVENT_PROPAGATE;

            let focusWindow = Utils.getWindow(true);
            if (!focusWindow)
                return Clutter.EVENT_PROPAGATE;

            let dragWindow = focusWindow.is_attached_dialog() ? focusWindow.get_transient_for()
                                                              : focusWindow;
            if (!dragWindow)
                return Clutter.EVENT_PROPAGATE;

            let rect = dragWindow.get_frame_rect();
            let [stageX, stageY] = event.get_coords();

            let allowDrag = dragWindow.maximized_vertically &&
                            stageX > rect.x && stageX < rect.x + rect.width;

            if (!allowDrag)
                return Clutter.EVENT_PROPAGATE;

            global.display.begin_grab_op(global.screen,
                                         dragWindow,
                                         Meta.GrabOp.MOVING,
                                         false, /* pointer grab */
                                         true, /* frame action */
                                         button,
                                         event.get_state(),
                                         event.get_time(),
                                         stageX, stageY);

            return Clutter.EVENT_STOP;
        };

        Main.panel.actor.connect('button-press-event', Lang.bind(Main.panel, Main.panel._onButtonPress));
    },
    _disableDragOnPanel: function() {
        print('IGNORING BUGGY FUNCTION');
        return;
        Main.panel._onButtonPress = this._originalFunction;
        Main.panel.actor.connect('button-press-event', Lang.bind(Main.panel, Main.panel._onButtonPress));
    },
franglais125 commented 6 years ago

Hello all, thanks a lot for the prompt reporting of this problem! It was not obvious to trigger (in my usage at least).

Thanks a lot @nhinds for looking into this, as I actually didn't have that much time to investigate.

I uploaded a new version to e.g.o with the fix. If anyone could confirm that the latest git code works it would be great.

I have to say I'm flattered by the great response to this issue.

Cheers everyone, Fran

nhinds commented 6 years ago

After installing the current master, can confirm the extension works for me and no longer throws the Lang.bind error on startup. Thanks for the quick response :)

szuliq commented 6 years ago

I didn't get any info about update.

I've uninstalled and installed the extension again.

The issue is still there.

Oddly enough in the dropdown I see only the version 6.

I don't know how to check the version which I've installed.

From my experience some tools don't re-fetch the package if the version didn't change.

franglais125 commented 6 years ago

@szuliq I inactivated version 7, hence the extension website should offer version 6 as an "update" (since 7 is faulty). Perhaps it isn't doing that.

  1. If you want, you can install from git, like so:
git clone https://github.com/franglais125/no-title-bar
cd no-title-bar
make && make install install

You might need some tools for this in Ubuntu:

sudo apt install git make gettext

  1. If you want to check the version information, you can run:

cat ~/.local/share/gnome-shell/extensions/no-title-bar@franglais125.gmail.com/metadata.json

maweki commented 6 years ago

I've approved the new version on e.g.o. The bugfix is now available via the known distribution channel.

It's quite hard for us to spot such issues beforehand during the review process.

szuliq commented 6 years ago

It is working great now!

franglais125 commented 6 years ago

@maweki thanks for the quick reviews. I certainly don't expect you guys to catch all the bugs! With many features come many corner cases :)

Thanks everyone for the quick feedback! Closing this now.