Score:2

How can I revert from using GTK 3 to GTK 2 on Kunbuntu 20.04?

in flag

I am using OpenCPN 5.2.4 with OpenGL (required for overlaying radar over charts) under Kubuntu 20.04. A tracked OpenCPN bug related to using GTK3 prevents OpenCPN from scaling the display appropriately when the display scaling is used (I use 200% to scale on a 15.6-inch 4k display).

A temporary workaround is to use GTK2 instead of GTK3.

My question is: How can I revert down to GTK2 on my system?

Any hints on how to proceed would greatly be appreciated.

System Info:

  • Operating System: Kubuntu 20.04
  • KDE Plasma Version: 5.18.5
  • KDE Frameworks Version: 5.68.0
  • Qt Version: 5.12.8
  • Kernel Version: 5.4.0-77-generic
  • OS Type: 64-bit
  • Processors: 4 × Intel® Core™ i5-4570T CPU @ 2.90GHz
  • OpenGL: 3.0 Mesa 20.2.6

$ apt-cache policy opencpn 
opencpn: 
Installed: 5.2.4.0-0~focal1 
Candidate: 5.2.4.0-0~focal1 
Version table:
 *** 5.2.4.0-0~focal1 500 
500 ppa.launchpad.net/opencpn/opencpn/ubuntu focal/main amd64 Packages 
100 /var/lib/dpkg/status 5.0.0+dfsg-1 500 
500 nz.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
guiverc avatar
cn flag
Download the source code, ensure all GTK3 calls are GTK2 compatible and adjust/recode those that use GTK3 features to limit themselves (& code functionality) to GTK2 compatible ones, then re-compile code. GTK3 & GTK2 APIs differ so you can't replace GTK3 with GTK2 packages... all programs need to be ported which is a load of work (why MATE took a long time to port, as did XFCE etc... let alone GNOME)
guiverc avatar
cn flag
Your alternative is creating a program like `wine` that catches all GTK3 calls, and tries to convert them to GTK2 calls & calls the GTK2 libs to do what GTK2 can do... What it does with the GTK2/GTK3 differences is the hard part; it can either ignore that (which will likely create segfaults or have an *unreliable* or *unstable* effect on the calling program, OpenCPN in your case) and won't be very reliable with a load of constant & future tweaking as GTK3 changes occur into the future...
N0rbert avatar
zw flag
Why do you really think that issues are caused by GTK2? You are probably using non-standard version of OpenCPN, the default repository provides [5.0.0 version](https://packages.ubuntu.com/focal/opencpn). Did you have problems with OpenCPN while using older versions [from 2019](https://changelogs.ubuntu.com/changelogs/pool/universe/o/opencpn/opencpn_5.0.0+dfsg-1/changelog) which are probably GTK2 based? Which installation source do you use for OpenCPN? What is the output of `apt-cache policy opencpn` ?
Sergio avatar
in flag
The issue is with GTK3 (https://github.com/OpenCPN/OpenCPN/issues/1927#issuecomment-868587708). OpenCPN, the default repository provides 5.2.4. apt-cache policy opencpn opencpn: Installed: 5.2.4.0-0~focal1 Candidate: 5.2.4.0-0~focal1 Version table: *** 5.2.4.0-0~focal1 500 500 http://ppa.launchpad.net/opencpn/opencpn/ubuntu focal/main amd64 Packages 100 /var/lib/dpkg/status 5.0.0+dfsg-1 500 500 http://nz.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
Score:1
cn flag
  • download the source code [to OpenCPN 5.2.4]
  • ensure all GTK3 calls are GTK2 compatible
  • adjust/recode those that use GTK3 features so they are limited to GTK2 functionality and make GTK2 calls
  • re-compile code.

GTK3 & GTK2 APIs differ so you can't replace GTK3 with GTK2 packages (what I suspect you were hoping).

Programs need to be ported which is a load of work (why MATE took a long time to port, as did XFCE etc... let alone GNOME when it ported from GTK2 to GTK3, and now currently in the move to GTK4)

If it wasn't clear - the work that needs to be done is done in the OpenCPN program and OpenGL; ie. the end-user programs that currently call GTK3 - those need the change.

A system can have GTK3 & GTK2 co-existing; eg. my Lubuntu impish system has both Qt5, GTK3 & GTK2 libs installed and they'll happily co-exist.

  • hexchat (my chosen IRC client) calls GTK2 libs
  • liferea & evolution (my chosen RSS & MUA) call GTK3 libs
  • my Lubuntu LXQt desktop, it's programs eg. featherpad call Qt5 libraries, just like your KDE desktop will (many KDE apps also need KF5).

It's the end-user program that needs to be changed. You can install all the GTK2 toolkit/library in your system, but if nothing calls it, it won't be used.

Also note: Scaling doesn't exist in GTK2 so I don't see what you hope to achieve.

guiverc avatar
cn flag
FYI: Why my chosen apps... I used to be a GNOME user long ago (GTK2) days, and some end-user apps I've just not kicked...
Sergio avatar
in flag
Ok that clarifies a lot of things for me. Looks like I am gonna have to wait for the OpenCPN developers to fix this on a future release. It's way above my competencies to 'recode' and 'recompile' as suggested. p.s.: Meanwhile, I am stuck with a system migration and display update that OpenCPN can't handle (Window to Kunbutu with a 15.6inch 4k display that needs the scale set at 200% in order to be usable).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.