Auto-scrolling not working after upgrade to Catalina

An instant messenger which can connect to AIM, GTalk, Jabber, ICQ, and more.
doomsday
Harmless
Posts: 10
Joined: Mon Oct 14, 2019 11:59 am

Re: Auto-scrolling not working after upgrade to Catalina

Post by doomsday »

thanks a lot
waiting for fix! :D
Incognitus
Harmless
Posts: 8
Joined: Tue Oct 15, 2019 1:23 pm

Re: Auto-scrolling not working after upgrade to Catalina

Post by Incognitus »

Robby wrote:I've filed a formal bug report here: https://trac.adium.im/ticket/16744

If anyone here is into programming Objective-C and able to fix the bug, please don't hesitate to contact me.
I was going to take a crack at it. I'm fairly good at Objective-C. However, I can't even get Adium to compile with the newest Xcode. What a mess. File encoding issues galore.
spelunker
Harmless
Posts: 11
Joined: Tue Oct 08, 2019 8:11 pm

Re: Auto-scrolling not working after upgrade to Catalina

Post by spelunker »

That sounds discouraging. Please try to battle through the forest
User avatar
Robby
Cocoaforge Admin
Posts: 2610
Joined: Mon May 01, 2006 3:00 am

Re: Auto-scrolling not working after upgrade to Catalina

Post by Robby »

Incognitus wrote:
Robby wrote:I've filed a formal bug report here: https://trac.adium.im/ticket/16744

If anyone here is into programming Objective-C and able to fix the bug, please don't hesitate to contact me.
I was going to take a crack at it. I'm fairly good at Objective-C. However, I can't even get Adium to compile with the newest Xcode. What a mess. File encoding issues galore.
Yes, getting it to build with a newer version of Xcode will probably have to be first step.
Incognitus
Harmless
Posts: 8
Joined: Tue Oct 15, 2019 1:23 pm

Re: Auto-scrolling not working after upgrade to Catalina

Post by Incognitus »

Robby wrote: Yes, getting it to build with a newer version of Xcode will probably have to be first step.
Which branch should I even use? Currently working off of adium-1.5.10 (since the current version is 1.5.10.4). Should I be using adium-1.6 as my base instead? Probably won't matter as far as the work needed to get it compiled.
User avatar
Robby
Cocoaforge Admin
Posts: 2610
Joined: Mon May 01, 2006 3:00 am

Re: Auto-scrolling not working after upgrade to Catalina

Post by Robby »

Incognitus wrote:Which branch should I even use? Currently working off of adium-1.5.10 (since the current version is 1.5.10.4). Should I be using adium-1.6 as my base instead? Probably won't matter as far as the work needed to get it compiled.
I would suggest working off of 1.5.10.4, yeah. If you could submit a pull request at Bitbucket (https://bitbucket.org/adium/adium), that would make code review easier. I'm confident I could get someone who knows Adium code well to have a look. =-)
Incognitus
Harmless
Posts: 8
Joined: Tue Oct 15, 2019 1:23 pm

Re: Auto-scrolling not working after upgrade to Catalina

Post by Incognitus »

What currently has me mind boggled are the errors about sFlags being undefined. Google is no help. Greping the source isn't particularly helpful. The specific error is:

JVMarkedScroller.m:58:24: Use of undeclared identifier 'sFlags'

I can't seem to find where sFlags used to be declared in the first place. Most of the other warnings and errors are fairly easy to fix, but I find myself stumped here. Not sure if we're missing a library or what.
Trolan
Harmless
Posts: 7
Joined: Wed Oct 16, 2019 5:13 pm

Re: Auto-scrolling not working after upgrade to Catalina

Post by Trolan »

sFlags looks to have been a private member of NSScroller, and is now totally hidden.

As the only member used is isHoriz, it would seem checking if the JVMarkedScroller's enclosing NSScrollView's horizontal controller is this one might be a suitable equivalent.

Perhaps creating and using the following property would do it

Code: Select all

- (BOOL)isHorizontalScroller {
    return self.enclosingScrollView.horizontalScroller == self;
}
Incognitus
Harmless
Posts: 8
Joined: Tue Oct 15, 2019 1:23 pm

Re: Auto-scrolling not working after upgrade to Catalina

Post by Incognitus »

Trolan wrote:sFlags looks to have been a private member of NSScroller, and is now totally hidden.

As the only member used is isHoriz, it would seem checking if the JVMarkedScroller's enclosing NSScrollView's horizontal controller is this one might be a suitable equivalent.

Perhaps creating and using the following property would do it

Code: Select all

- (BOOL)isHorizontalScroller {
    return self.enclosingScrollView.horizontalScroller == self;
}
Good idea. I'll give it a try.
User avatar
Robby
Cocoaforge Admin
Posts: 2610
Joined: Mon May 01, 2006 3:00 am

Re: Auto-scrolling not working after upgrade to Catalina

Post by Robby »

I've created a new branch called "adium-1.5.10.5". =-)
doomsday
Harmless
Posts: 10
Joined: Mon Oct 14, 2019 11:59 am

Re: Auto-scrolling not working after upgrade to Catalina

Post by doomsday »

fingers crossed
User avatar
Robby
Cocoaforge Admin
Posts: 2610
Joined: Mon May 01, 2006 3:00 am

Re: Auto-scrolling not working after upgrade to Catalina

Post by Robby »

Incognitus, feel free to contact on XMPP: robbie@xmpp.is
Trolan
Harmless
Posts: 7
Joined: Wed Oct 16, 2019 5:13 pm

Re: Auto-scrolling not working after upgrade to Catalina

Post by Trolan »

Of all the places, it looks to be in the HTML used by AIWebKitMessageViewController. The elements previously referenced in the JS either don't return useful information (case for nearBottom()), or don't act as they used to (case for scrollToBottom()). Now, how far back these specific alternates work, I do not know, but MozDev indicates they've been in Safari for ages, so they're likely to work for older macOS revisions as well.

Code: Select all

diff --git a/Plugins/WebKit Message View/Template.html b/Plugins/WebKit Message View/Template.html
--- a/Plugins/WebKit Message View/Template.html	
+++ b/Plugins/WebKit Message View/Template.html	
@@ -214,10 +214,10 @@
 
 		//Auto-scroll to bottom.  Use nearBottom to determine if a scrollToBottom is desired.
 		function nearBottom() {
-			return ( document.body.scrollTop >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );
+			return ( document.documentElement.scrollTop >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );
 		}
 		function scrollToBottom() {
-			document.body.scrollTop = document.body.offsetHeight;
+			window.scrollTo(0, document.body.scrollHeight);
 		}
 
 		//Dynamically exchange the active stylesheet
Incognitus
Harmless
Posts: 8
Joined: Tue Oct 15, 2019 1:23 pm

Re: Auto-scrolling not working after upgrade to Catalina

Post by Incognitus »

Trolan wrote:Of all the places, it looks to be in the HTML used by AIWebKitMessageViewController. The elements previously referenced in the JS either don't return useful information (case for nearBottom()), or don't act as they used to (case for scrollToBottom()). Now, how far back these specific alternates work, I do not know, but MozDev indicates they've been in Safari for ages, so they're likely to work for older macOS revisions as well.

Code: Select all

diff --git a/Plugins/WebKit Message View/Template.html b/Plugins/WebKit Message View/Template.html
--- a/Plugins/WebKit Message View/Template.html	
+++ b/Plugins/WebKit Message View/Template.html	
@@ -214,10 +214,10 @@
 
 		//Auto-scroll to bottom.  Use nearBottom to determine if a scrollToBottom is desired.
 		function nearBottom() {
-			return ( document.body.scrollTop >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );
+			return ( document.documentElement.scrollTop >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );
 		}
 		function scrollToBottom() {
-			document.body.scrollTop = document.body.offsetHeight;
+			window.scrollTo(0, document.body.scrollHeight);
 		}
 
 		//Dynamically exchange the active stylesheet
The bigger problem is there needs to be some serious code updates to get it to even compile. It looks like a huge job.
drbobbeaty
Harmless
Posts: 3
Joined: Fri Oct 18, 2019 1:45 pm

Re: Auto-scrolling not working after upgrade to Catalina

Post by drbobbeaty »

Trolan wrote:Of all the places, it looks to be in the HTML used by AIWebKitMessageViewController. The elements previously referenced in the JS either don't return useful information (case for nearBottom()), or don't act as they used to (case for scrollToBottom()). Now, how far back these specific alternates work, I do not know, but MozDev indicates they've been in Safari for ages, so they're likely to work for older macOS revisions as well.

Code: Select all

diff --git a/Plugins/WebKit Message View/Template.html b/Plugins/WebKit Message View/Template.html
--- a/Plugins/WebKit Message View/Template.html	
+++ b/Plugins/WebKit Message View/Template.html	
@@ -214,10 +214,10 @@
 
 		//Auto-scroll to bottom.  Use nearBottom to determine if a scrollToBottom is desired.
 		function nearBottom() {
-			return ( document.body.scrollTop >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );
+			return ( document.documentElement.scrollTop >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );
 		}
 		function scrollToBottom() {
-			document.body.scrollTop = document.body.offsetHeight;
+			window.scrollTo(0, document.body.scrollHeight);
 		}
 
 		//Dynamically exchange the active stylesheet
I tried editing

Code: Select all

/Applications/Adium.app/Contents/Resources/Template.html
with these changes and restarting Adium, and the scrolling wasn't fixed. Should this have worked? Or is there something in the compiled code that also explicitly references this?
Incognitus
Harmless
Posts: 8
Joined: Tue Oct 15, 2019 1:23 pm

Re: Auto-scrolling not working after upgrade to Catalina

Post by Incognitus »

I think Trolan is on to something. Here is my current change:

Code: Select all

		//Auto-scroll to bottom.  Use nearBottom to determine if a scrollToBottom is desired.
		function nearBottom() {
			//return ( document.body.scrollTop >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );
			return 1;
		}
		function scrollToBottom() {
			window.scrollTo(0, document.body.scrollHeight);
			//document.body.scrollTop = document.body.offsetHeight;
		}
I changed nearBottom to just return 1, just to see if we're modifying the right stuff, and auto scroll is now working for me. So just need to find the correct check for nearBottom. Or not. I don't really see a negative to just have it return 1 and always scroll.

So I guess we don't need to recompile Adium. That is going to be a huge undertaking.
drbobbeaty
Harmless
Posts: 3
Joined: Fri Oct 18, 2019 1:45 pm

Re: Auto-scrolling not working after upgrade to Catalina

Post by drbobbeaty »

Incognitus wrote:I think Trolan is on to something. Here is my current change:

Code: Select all

		//Auto-scroll to bottom.  Use nearBottom to determine if a scrollToBottom is desired.
		function nearBottom() {
			//return ( document.body.scrollTop >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );
			return 1;
		}
		function scrollToBottom() {
			window.scrollTo(0, document.body.scrollHeight);
			//document.body.scrollTop = document.body.offsetHeight;
		}
I changed nearBottom to just return 1, just to see if we're modifying the right stuff, and auto scroll is now working for me. So just need to find the correct check for nearBottom. Or not. I don't really see a negative to just have it return 1 and always scroll.

So I guess we don't need to recompile Adium. That is going to be a huge undertaking.
I tried these changes on

Code: Select all

/Applications/Adium.app/Contents/Resources/Template.html
on the 1.5.10.3b1 version... it didn't solve my scrolling issues.
Incognitus
Harmless
Posts: 8
Joined: Tue Oct 15, 2019 1:23 pm

Re: Auto-scrolling not working after upgrade to Catalina

Post by Incognitus »

drbobbeaty wrote:
Incognitus wrote:I think Trolan is on to something. Here is my current change:

Code: Select all

		//Auto-scroll to bottom.  Use nearBottom to determine if a scrollToBottom is desired.
		function nearBottom() {
			//return ( document.body.scrollTop >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );
			return 1;
		}
		function scrollToBottom() {
			window.scrollTo(0, document.body.scrollHeight);
			//document.body.scrollTop = document.body.offsetHeight;
		}
I changed nearBottom to just return 1, just to see if we're modifying the right stuff, and auto scroll is now working for me. So just need to find the correct check for nearBottom. Or not. I don't really see a negative to just have it return 1 and always scroll.

So I guess we don't need to recompile Adium. That is going to be a huge undertaking.
I tried these changes on

Code: Select all

/Applications/Adium.app/Contents/Resources/Template.html
on the 1.5.10.3b1 version... it didn't solve my scrolling issues.
Make sure you're restarting Adium completely. Also you might need to upgrade to 10.5.10.4 (the latest). Other than that, not sure. It's working for me. I have 10% less work rage today already.
Trolan
Harmless
Posts: 7
Joined: Wed Oct 16, 2019 5:13 pm

Re: Auto-scrolling not working after upgrade to Catalina

Post by Trolan »

I actually do have it compiling on Catalina, Xcode 11.1. The changes to sFlags fixes the syntax problems. There's a XIB which needs updating, but the build will complain about it. Find it, it'll ask if you want to update it, do so, and change the XIB to build for the Deployment Target. This is actually the case for many XIBs, but only resulting in a hard error for one. Past that point there's code signing issues, which can be worked through for the moment by setting code signing to automatic and then turning it off for each framework target and Adium.app, as well as the embedded AutoHyperlink.framework project. Then add in "--deep" for the additional code signing arguments in Build Settings for Adium.app. Additionally, I had code sign trip on unexpected resource data on items, so an 'xattr -rc' on the build directory sorted that.

It's definitely not perfect, and the codesgining is a problem for any actual distribution, but it's a start. Dark Mode with it is... interesting with all the custom UI styles. The rest of the issues are currently deprecations, and most of those are relatively simple changes from old APIs to more modern ones, or elimination of older functionality (such as IM attributes to Contacts).
drbobbeaty
Harmless
Posts: 3
Joined: Fri Oct 18, 2019 1:45 pm

Re: Auto-scrolling not working after upgrade to Catalina

Post by drbobbeaty »

Incognitus wrote:
drbobbeaty wrote:
Incognitus wrote:I think Trolan is on to something. Here is my current change:

I tried these changes on

Code: Select all

/Applications/Adium.app/Contents/Resources/Template.html
on the 1.5.10.3b1 version... it didn't solve my scrolling issues.
Make sure you're restarting Adium completely. Also you might need to upgrade to 10.5.10.4 (the latest). Other than that, not sure. It's working for me. I have 10% less work rage today already.
The

Code: Select all

scrollToBottom()
function was repeated in my Message Theme file... updated to 1.5.10.4, fixed that, and I'm back scrolling!

Thanks for the tip!
Post Reply