-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Gnome Shell 46 support. #64
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @glerroo)
[email protected]/extension.js
line 265 at r1 (raw file):
let mainContentBox = new St.BoxLayout({style_class: 'prompt-dialog-main-layout', vertical: false}); this.contentLayout.add_child(mainContentBox,
I'm still trying to understand this change. The GS 46 extension porting guide mentions Clutter.Container
(Clutter.Container.add_actor
being of particular interest to us), but I'm not seeing anything about an .add()
method going away... And I'm actually not even sure which .add()
method is being called here. I can't find an .add()
in the St.BoxLayout
inheritance chain in the gjs docs but I might just be missing it. 😬
[email protected]/extension.js
line 353 at r1 (raw file):
Clutter.cairo_set_source_color(cr, this.extension._Background); else cr.setSourceColor(this.extension._Background);
I think this pattern is repeated enough to warrant a helper function. Something like:
// Gnome 45 Clutter.cairo_set_color compatibility
function sm_cairo_set_source_color(cr, bg_color) {
if (Clutter.cairo_set_source_color)
Clutter.cairo_set_source_color(cr, bg_color);
else
cr.setSourceColor(bc_color);
}
[email protected]/metadata.json
line 2 at r1 (raw file):
{ "shell-version": ["45","46"],
nit: space after comma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @glerroo)
a discussion (no related file):
Thanks for the patch!!!
Could you please also share which versions of GS you tested this on?
Thanks for the pull request. I noticed the following error when running (8832b56) under Gnome 46:
with the commented-out function calls: diff --git a/[email protected]/extension.js b/[email protected]/extension.js
index 7354ddc..8f5b363 100644
--- a/[email protected]/extension.js
+++ b/[email protected]/extension.js
@@ -2448,9 +2448,6 @@ export default class SystemMonitorExtension extends Extension {
if (this._Schema.get_boolean('move-clock')) {
let dateMenu = Main.panel.statusArea.dateMenu;
- Main.panel._centerBox.remove_actor(dateMenu.container);
- Main.panel._addToPanelBox('dateMenu', dateMenu, -1, Main.panel._rightBox);
- tray.clockMoved = true;
}
this._Schema.connect('changed::background', (schema, key) => {
@@ -2548,8 +2545,6 @@ export default class SystemMonitorExtension extends Extension {
// restore clock
if (this.__sm.tray.clockMoved) {
let dateMenu = Main.panel.statusArea.dateMenu;
- Main.panel._rightBox.remove_actor(dateMenu.container);
- Main.panel._addToPanelBox('dateMenu', dateMenu, Main.sessionMode.panel.center.indexOf('dateMenu'), Main.panel._centerBox);
}
// restore system power icon if necessary
// workaround bug introduced by multiple cpus init : I've got a working extension, yay! |
Hi. I tried the changes in this PR in Gnome-Shell 46 and it's working nicely (I didn't have to apply @marxin's changes). |
You're likely going to hit the issue once you enable "Move the Clonk" in Extension settings. |
Hello, According to: https://gjs.guide/extensions/upgrading/gnome-shell-46.html#clutter-container The function Hope this will help. Cordially, -- |
Yep, thanks, the following patch works for me: diff --git a/[email protected]/extension.js b/[email protected]/extension.js
index 7354ddc..058f334 100644
--- a/[email protected]/extension.js
+++ b/[email protected]/extension.js
@@ -2448,7 +2448,7 @@ export default class SystemMonitorExtension extends Extension {
if (this._Schema.get_boolean('move-clock')) {
let dateMenu = Main.panel.statusArea.dateMenu;
- Main.panel._centerBox.remove_actor(dateMenu.container);
+ Main.panel._centerBox.remove_child(dateMenu.container);
Main.panel._addToPanelBox('dateMenu', dateMenu, -1, Main.panel._rightBox);
tray.clockMoved = true;
}
@@ -2548,7 +2548,7 @@ export default class SystemMonitorExtension extends Extension {
// restore clock
if (this.__sm.tray.clockMoved) {
let dateMenu = Main.panel.statusArea.dateMenu;
- Main.panel._rightBox.remove_actor(dateMenu.container);
+ Main.panel._rightBox.remove_child(dateMenu.container);
Main.panel._addToPanelBox('dateMenu', dateMenu, Main.sessionMode.panel.center.indexOf('dateMenu'), Main.panel._centerBox);
}
// restore system power icon if necessary |
@marxin, @NVieville Bug resolved, can confirm that is ok. I tested this pr in Fedora 40. |
Got it, thanks. I think this is mergeable once we get test results on GS 45, verifying no regressions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @glerroo)
[email protected]/extension.js
line 265 at r1 (raw file):
Previously, mgalgs (Mitchel Humpherys) wrote…
I'm still trying to understand this change. The GS 46 extension porting guide mentions
Clutter.Container
(Clutter.Container.add_actor
being of particular interest to us), but I'm not seeing anything about an.add()
method going away... And I'm actually not even sure which.add()
method is being called here. I can't find an.add()
in theSt.BoxLayout
inheritance chain in the gjs docs but I might just be missing it. 😬
Hold on, what about the second argument? Looks like the old monkey-patched .add()
method took a second argument of props to copy over, which clutter.Actor.add_child()
doesn't seem to do.
I think the second argument is optional, if present assign properties to actor. // "monkey patch" in some varargs ClutterContainer methods; we need
// to do this per-container class since there is no representation
// of interfaces in Javascript
function _patchContainerClass(containerClass) {
// This one is a straightforward mapping of the C method
containerClass.prototype.child_set = function (actor, props) {
let meta = this.get_child_meta(actor);
for (let prop in props)
meta[prop] = props[prop];
};
// clutter_container_add() actually is a an add-many-actors
// method. We conveniently, but somewhat dubiously, take the
// this opportunity to make it do something more useful.
containerClass.prototype.add = function (actor, props) {
this.add_actor(actor);
if (props)
this.child_set(actor, props);
};
} if props is present call this.child_set(actor, props); |
Right, it's optional, but we are using it. So with your patch it seems like we're missing that part (copying the props in the second argument to the child). |
In this part there is some problem:
can you verify and make some test? |
any progress on this last remaining issue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @glerroo)
[email protected]/extension.js
line 265 at r1 (raw file):
Previously, mgalgs (Mitchel Humpherys) wrote…
Hold on, what about the second argument? Looks like the old monkey-patched
.add()
method took a second argument of props to copy over, whichclutter.Actor.add_child()
doesn't seem to do.
@glerroo just to re-iterate, it looks like by moving from .add()
to add_child()
we're now losing the second argument (the props to copy to the child). Maybe we need to make a separate call to copy the props (or add an internal helper to do so)? I haven't hunted everything down yet but clutter.Container.child_set_property
looks promising?
@mgalgs Ok I make some test, but smDialog class is never used becase smDepsGtop and smDepsNM are always true. I think we can remove that class. |
I just pulled this PR and everything worked great. I checked the logs for errors, saw none. I clicked through all the menus, flipping things on and off. No issues found. |
@mgalgs Clutter.Container was removed from GS46. |
The interface will be gone in GNOME 46. Prepare for that by switching from `add()` to Clutter.Actor's `add_child()`. The replacement has been around forever, so this does not affect compatibility with the current stable version.
If you are using Clutter.cairo_set_source_color() in St.DrawingArea, cairo.Context can use setSourceColor() instead (cr.setSourceColor()).
Use Clutter.Actor.remove_child() instead of Clutter.Container.remove_action().
Our system dependency pop-up dialog (smDialog) is currently using some private APIs which are being removed in Gnome Shell 46 [1]. Rather than fixing this let's just tie it up and throw it overboard. This is a reasonable course of action because: (1) It's not clear which replacement APIs we should be moving to. We could figure this out with a bit of research and testing, but it may not be worth it because: (2) The smDialog dependency checks have actually been hard-coded out since the port to Gnome Shell 45 [2] (since the old dependency check method relied on a try/catch of the library imports, which isn't supported in es6). So even if we figure out a new API for copying props to the child, we'd still never be using any of that new code anyway since we're hard-coding an assumption of the dependencies being present. Ultimately we *should* fix this for the best possible user experience, but in the interest of keeping things moving with Gnome Shell updates we'll defer that work to the back burner (#69). [1] #64 (comment) [2] (f838b97: "extension: Update for Gnome Shell 45")
@glerroo aaah now I see what you're saying. You're 100% right. I tossed it out and pushed the result. Working fine on my Gnome Shell 46 box, I'll test on 45 a bit later but if anyone else could please test the latest from this PR that would be fantastic! I don't think there's anything else blocking this other than test results, but please chime in if I'm missing anything. |
Hmm my changes don't seem to be showing up... Currently mobile but I'll check my refs in an hour or so... Stand by... Edit: ok, branch looks good now. |
The PR from @glerroo works fine on my Arch Linux with Gnome 46 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @glerroo)
Thanks, @jonnedeprez. Unfortunately, as of the time of your comment the PR branch didn't contain all of the changes 😭 (that was my bad). Can you please re-fetch and try again? Anyone who wants to test this PR can quickly check it out with:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @glerroo)
@mgalgs I'm sorry, but at this point I don't understand what I should do. |
@glerroo I just need GS 46 and 45 testing results. I know people have been testing throughout the discussion but I want to make sure the latest changes get tested. |
All right, I've tested on 45 and 46. If someone else could please confirm these test results on the latest version of this PR then we can ship this. 🚢
|
Ok, i have also tested on Fedora 39 - GS45 and Fedora 40 - GS46 with no error. |
Our system dependency pop-up dialog (smDialog) is currently using some private APIs which are being removed in Gnome Shell 46 [1]. Rather than fixing this let's just tie it up and throw it overboard. This is a reasonable course of action because: (1) It's not clear which replacement APIs we should be moving to. We could figure this out with a bit of research and testing, but it may not be worth it because: (2) The smDialog dependency checks have actually been hard-coded out since the port to Gnome Shell 45 [2] (since the old dependency check method relied on a try/catch of the library imports, which isn't supported in es6). So even if we figure out a new API for copying props to the child, we'd still never be using any of that new code anyway since we're hard-coding an assumption of the dependencies being present. Ultimately we *should* fix this for the best possible user experience, but in the interest of keeping things moving with Gnome Shell updates we'll defer that work to the back burner (mgalgs#69). [1] mgalgs#64 (comment) [2] (f838b97: "extension: Update for Gnome Shell 45")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @glerroo)
Thanks a bunch, @glerroo, and everyone else who provided feedback and test results! I'll get this tagged and shipped to extensions.gnome.org right now, they typically approve within a couple of hours. |
This close issue #61.
This change is