GnomeSnapExtensions / gSnap

Gnome-shell extension that allows you to move windows into specific regions similiar to FancyZones on windows.
https://extensions.gnome.org/extension/4442/gsnap/
Other
166 stars 23 forks source link

Gnome shell crash #10

Closed andreastedile closed 3 years ago

andreastedile commented 3 years ago

The crash occurs as soon as I click on an item of the dropdown menu. Sometimes after the crash the login screen does not even appear.

https://user-images.githubusercontent.com/39307731/129707276-496b7485-7e6b-48d2-8cc4-e4882b7fba64.mp4

andreastedile commented 3 years ago

I discoved that the same issue occurs even if I click outside the dropdown menu.

https://user-images.githubusercontent.com/39307731/129708993-aecbed8a-32b3-4d47-8d5a-669f9df3c518.mp4

meronz commented 3 years ago

Can confirm this, it happens on every dropdown menu in the system.

meronz commented 3 years ago

I do not have time to debug this further today, but it happens only when using wayland. Seems like the creation of the dropdown triggers the preview. After that by giving any input (either by mouse or keyboard) triggers a wayland crash. I'm glad to contribute any way I can @micahosborne though I lack knowledge about gnome-shell :)

micahosborne commented 3 years ago

This would be most likely grab-operation-begin call back in app.ts. Probably need to filter which windows are activated. Maybe if the window is borderless or not sizeable then don't show the preview. I'm limited on time at the moment, but i'm guessing this would be where to start.

meronz commented 3 years ago

This bug can be fixed by filtering the windows by their window_type.

In the meantime as a workaround (that should solve also #11), i filtered out every window that does not have type '0' (META_WINDOW_NORMAL). This is needed on each event callback and in TabbedZoneManager::layoutWindows().

Callbacks like 'window-created' become:

global.display.connect('window-created', (_display, win, op) => {
    log('window-created ' + _display + 'win ' + win);
    if (win != null && win.get_window_type() == 0) {
        if (this.tabManager) {
            this.tabManager.layoutWindows();
        }
    }
});

and TabbedZoneManager::layoutWindows():

let wsm = (global.workspace_manager);
let ws = wsm.get_n_workspaces();
log("Workspace Index " + ws);
let windows = wsm
    .get_active_workspace()
    .list_windows()
    .filter(w => w.get_window_type() == 0);

edit: i found out what that 0 means. Let me know if you are okay with the fix and i'll open you a PR later.

micahosborne commented 3 years ago

Cool thanks for the effort, and for sure, submit a pull request and i'll pull it in :) contributions always welcome. I never planned on doing this extension all by myself :)