Skip to content
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

List of GTK-related issues and deprecations #2014

Open
11 of 13 tasks
mathiascode opened this issue May 6, 2022 · 24 comments
Open
11 of 13 tasks

List of GTK-related issues and deprecations #2014

mathiascode opened this issue May 6, 2022 · 24 comments
Labels

Comments

@mathiascode
Copy link
Member

mathiascode commented May 6, 2022

Note: Upstream reports need minimal reproducers, e.g. instructions for reproducing the issue in gtk-demo/gtk-widget-factory, or a small .ui file or Python application

General Issues

GTK 4

Windows-specific Issues

Deprecations

  • Gtk.Assistant -> Gtk.Window
  • Gtk.FileChooserNative -> Gtk.FileDialog
  • Gtk.Dialog -> Gtk.Window
  • Gtk.Widget.show/hide() -> Gtk.Widget.set_visible()
  • Gtk.StyleContext
  • Gtk.ColorButton -> Gtk.ColorDialogButton
  • Gtk.FontButton -> Gtk.FontDialogButton
  • Gtk.CssProvider.load_from_data() -> Gtk.CssProvider.load_from_bytes()
  • Gtk.ComboBox -> Gtk.Entry + Gtk.DropDown
  • Gtk.InfoBar -> Gtk.Box
  • Gtk.MessageDialog -> Gtk.Window
  • Gtk.TreeView -> Gtk.ColumnView
  • Gtk.EntryCompletion -> ?

Uncertain Future

  • Gtk.Notebook
@mathiascode
Copy link
Member Author

Most of the Windows-exclusive issues should be fixed once https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4252 is merged.

@francisuk1989
Copy link

francisuk1989 commented May 26, 2022

GTK 4.6.4 (Arch Linux, gtk4 1:4.6.4-1)

The two only errors i got now @mathiascode

(org.nicotine_plus.Nicotine:36095): Gtk-WARNING **: 16:34:01.720: GtkGizmo 0x55fcbf0ba6b0 (progress) reported min width -2, but sizes must be >= 0

Still missing logos but will report to arch repos as a bug report, possible missing logos? https://bugs.archlinux.org/?project=1&string=gtk4
https://i.ibb.co/YZy3hsJ/logos.png

@layercak3
Copy link
Contributor

layercak3 commented Jun 15, 2022

When I press enter to enter a search query in someone's share list when using GTK 4.6.5 (from Arch 1:4.6.5-1) (libadwaita or not), the tree view does not jump to the folder. Instead, it just jumps down the page a little bit like when you press space on a long web page. Then if you do it enough times the behaviour is a little bit weird in a way I can't describe well. Otherwise, it works well for my use cases but I had to switch back because of this. Also, I needed to check "Prefer Dark Mode" to get a dark mode in libadwaita (I have Adwaita-dark set as my GTK theme), that might just be the expected behaviour and the theming system might be a little different in libadwaita, I didn't look into it.

@mathiascode
Copy link
Member Author

When I press enter to enter a search query in someone's share list when using GTK 4.6.5 (from Arch 1:4.6.5-1) (libadwaita or not), the tree view does not jump to the folder. Instead, it just jumps down the page a little bit like when you press space on a long web page. Then if you do it enough times the behaviour is a little bit weird in a way I can't describe well.

I believe there was an issue report related to this for GTK 4. I'll have to check if there's a workaround, but the long-term solution is to stop using the unmaintained GtkTreeView widget in favor of GtkColumnView.

Also, I needed to check "Prefer Dark Mode" to get a dark mode in libadwaita (I have Adwaita-dark set as my GTK theme), that might just be the expected behaviour and the theming system might be a little different in libadwaita, I didn't look into it.

Libadwaita uses a new Freedesktop color scheme spec, which is only available in recent GNOME and KDE releases afaik.

@mathiascode
Copy link
Member Author

@AtticFinder65536 I came up with a workaround for the scrolling issue in 92f9859

@slook slook mentioned this issue Jul 31, 2022
@mathiascode
Copy link
Member Author

mathiascode commented Aug 10, 2022

@AtticFinder65536 I came up with a workaround for the scrolling issue in 92f9859

Upstream fix submitted in https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4940

Edit: the fix will be included in GTK 4.6.7

@mathiascode
Copy link
Member Author

The new tray icon implementation compatible with GTK 4 is done. I've also done some work in the past two months to fix a few bugs in GTK 4, and we've almost reached parity with GTK 3!

Things left to do before we can consider making the GTK 4 version of Nicotine+ the default:

@slook
Copy link
Member

slook commented Sep 11, 2022

No support for tray icons

  • Affected GTK versions: 4
  • Find an alternative to GtkStatusIcon? (use Windows API directly?)

Interacting with the Windows API poses complicated security implications that increase the attack surface of the program, a direct implementation from the core would not be justifiable for a non-essential feature in my opinion.

I believe it is (was?) best practice for Windows applications to package a separate tray icon applet executable which runs as a separate process. Often these serve(d) as a launcher type arrangement which is capable of nothing more than spawning/activating the main process and allowing only a limited subset of defined signals from it, in order to avoid having the main process be the host for the applet.

@mathiascode
Copy link
Member Author

Interacting with the Windows API poses complicated security implications that increase the attack surface of the program, a direct implementation from the core would not be justifiable for a non-essential feature in my opinion.

Do you have any concrete examples? I don't see how a tray icon with a simple menu and a few callbacks could cause many issues.

In any case, the notification bubbles currently depend on the tray icon, so it will probably have to remain in the core:

class WinNotify:
""" Implements a Windows balloon tip for GtkStatusIcon """
NIF_INFO = NIIF_NOSOUND = 0x10
NIM_MODIFY = 1
def __init__(self, tray_icon):
from ctypes import windll
from ctypes.wintypes import DWORD, HICON, HWND, UINT, WCHAR
class NOTIFYICONDATA(Structure):
_fields_ = [
("cb_size", DWORD),
("h_wnd", HWND),
("u_id", UINT),
("u_flags", UINT),
("u_callback_message", UINT),
("h_icon", HICON),
("sz_tip", WCHAR * 128),
("dw_state", DWORD),
("dw_state_mask", DWORD),
("sz_info", WCHAR * 256),
("u_version", UINT),
("sz_info_title", WCHAR * 64),
("dw_info_flags", DWORD)
]
self.tray_icon = tray_icon
self.queue = []
self.worker = None
self.nid = NOTIFYICONDATA()
self.nid.cb_size = sizeof(NOTIFYICONDATA)
self.nid.h_wnd = windll.user32.FindWindowW("gtkstatusicon-observer", None)
self.nid.u_flags = self.NIF_INFO
self.nid.dw_info_flags = self.NIIF_NOSOUND
self.nid.sz_info_title = ""
self.nid.sz_info = ""
def notify(self, **kwargs):
self.queue.append(kwargs)
if self.worker and self.worker.is_alive():
return
self.worker = threading.Thread(target=self.work)
self.worker.name = "WinNotify"
self.worker.daemon = True
self.worker.start()
def work(self):
while self.queue:
kwargs = self.queue.pop(0)
self._notify(**kwargs)
def _notify(self, title="", message="", timeout=10):
from ctypes import windll
has_tray_icon = config.sections["ui"]["trayicon"]
if not has_tray_icon:
# Tray icon was disabled by the user. Enable it temporarily to show a notification.
self.tray_icon.show()
# Need to account for the null terminated character appended to the message length by Windows
self.nid.sz_info_title = (title[:62].strip() + "…") if len(title) > 63 else title
self.nid.sz_info = (message[:254].strip() + "…") if len(message) > 255 else message
windll.shell32.Shell_NotifyIconW(self.NIM_MODIFY, byref(self.nid))
time.sleep(timeout)
if not has_tray_icon:
self.tray_icon.hide()

I haven't explored alternatives for implementing a tray icon on Windows yet, though, so it's all up in the air right now.

@slook
Copy link
Member

slook commented Sep 11, 2022

Do you have any concrete examples?

Nothing specific. Reading any of the Windows security updates KB's gives an idea of the scale of the problem.

@critkitten
Copy link

Is the following error related to Popover cannot be closed after opening a child popover?

Nicotine+ Version: 3.3.0.dev5
GTK Version: 4.10.4
Python Version: 3.11.3 (linux)

Type: <class 'AttributeError'>
Value: 'NoneType' object has no attribute 'get_focusable'
Traceback:   File "/usr/lib/python3.11/site-packages/pynicotine/gtkgui/widgets/window.py", line 96, in on_popover_closed
    if focus_widget.get_focusable():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^

@slook
Copy link
Member

slook commented Jun 25, 2023

If the action which leads to the error is as described in #2539 , then yes.

@mathiascode
Copy link
Member Author

@critkitten What did you do to get the error?

@mathiascode
Copy link
Member Author

For lack of a better place to write this, I plan on supporting GTK 3 for about two more years, possibly three depending on how much demand there is once we reach that point.

@mathiascode
Copy link
Member Author

Ubuntu 22.04 (LTS) is finally upgrading from GTK 4.6.6 to 4.6.9, so I'm going to support GTK 4.6.9 in Nicotine+ once again (assuming we don't run into major issues that require 4.8).

@mathiascode
Copy link
Member Author

Once https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6052 is merged and a new GTK release is tagged, our GTK 4 Windows builds should be on par with GTK 3 (i.e. no longer blocking a Nicotine+ 3.3.0 release).

macOS has not been tested to the same extent yet, I need to reserve time for that.

@clawth0rne
Copy link

Regarding the spell checking, you can use libspelling as an alternative to gspell.

https://gitlab.gnome.org/chergert/libspelling

@mathiascode
Copy link
Member Author

Regarding the spell checking, you can use libspelling as an alternative to gspell.

https://gitlab.gnome.org/chergert/libspelling

libspelling needs to support GtkEntry/GtkEntryBuffer first (currently it only supports GtkTextView).

@mathiascode
Copy link
Member Author

A bunch of issues were recently fixed in GTK (and Nicotine+ 3.3.3rc2 as a result):

  • Cannot click taskbar icon to minimize application
  • Missing Super+M shortcut to minimize window
  • Nicotine+ window popping up unexpectedly when opening other programs

https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7072

@DeathStalker77
Copy link

@mathiascode @slook - Been away for a while, just wondering how things are progressing with the GTK4 TreeView issues? Thanks for all the work you do! 🥇

--- DS

@mathiascode
Copy link
Member Author

Work on porting to Gtk.ColumnView hasn't started yet. Right now we're only doing bug fixes for Nicotine+ 3.3.x to get it in great shape, development on 3.4.x will start sometime later this year.

@francisuk1989
Copy link

francisuk1989 commented May 27, 2024

@mathiascode
Do you know if there issue with KDE Plasma 6 with GTK 4.14.4? seems to load fine on XFCE.

In Alpine linux, i get theses errors

with KDE 6

05/27/24 23:43:15] Loading Python 3.12.3
[05/27/24 23:43:15] Loading Nicotine+ 3.3.4
libEGL warning: DRI2: failed to authenticate
MESA: error: ZINK: vkCreateInstance failed (VK_ERROR_INCOMPATIBLE_DRIVER)
libEGL warning: egl: failed to create dri2 screen
[05/27/24 23:43:15] Loading GTK 4.14.4

(org.nicotine_plus.Nicotine:2950): Gtk-WARNING **: 23:43:15.537: Unknown key gtk-modules in /home/XXXX/.config/gtk-4.0/settings.ini
[05/27/24 23:43:15] Loading plugin system
[05/27/24 23:43:15] Loaded plugin Nicotine+ Commands
[05/27/24 23:43:15] You need to specify a username and password before connecting…
Couldn't open libGLESv2.so.2: Error loading shared library libGLESv2.so.2: No such file or directory
Fatal Python error: Aborted

Thread 0x00007f7c61c10b38 (most recent call first):
  File "/usr/lib/python3.12/site-packages/pynicotine/shares.py", line 1003 in process_scanner_messages
  File "/usr/lib/python3.12/site-packages/pynicotine/shares.py", line 1083 in _process_scanner
  File "/usr/lib/python3.12/threading.py", line 1010 in run
  File "/usr/lib/python3.12/threading.py", line 1073 in _bootstrap_inner
  File "/usr/lib/python3.12/threading.py", line 1030 in _bootstrap

Thread 0x00007f7c61f5cb38 (most recent call first):
  File "/usr/lib/python3.12/site-packages/pynicotine/slskproto.py", line 2697 in run
  File "/usr/lib/python3.12/threading.py", line 1073 in _bootstrap_inner
  File "/usr/lib/python3.12/threading.py", line 1030 in _bootstrap

Thread 0x00007f7c62162b38 (most recent call first):
  File "/usr/lib/python3.12/site-packages/pynicotine/cli.py", line 54 in run
  File "/usr/lib/python3.12/threading.py", line 1073 in _bootstrap_inner
  File "/usr/lib/python3.12/threading.py", line 1030 in _bootstrap

Thread 0x00007f7c74c3fb38 (most recent call first):
  File "/usr/lib/python3.12/site-packages/pynicotine/events.py", line 330 in _run_scheduler
  File "/usr/lib/python3.12/threading.py", line 1010 in run
  File "/usr/lib/python3.12/threading.py", line 1073 in _bootstrap_inner
  File "/usr/lib/python3.12/threading.py", line 1030 in _bootstrap

Current thread 0x00007f7c75c76b28 (most recent call first):
  File "/usr/lib/python3.12/site-packages/pynicotine/gtkgui/widgets/window.py", line 78 in present
  File "/usr/lib/python3.12/site-packages/pynicotine/gtkgui/application.py", line 1008 in on_activate
  File "/usr/lib/python3.12/site-packages/gi/overrides/Gio.py", line 42 in run
  File "/usr/lib/python3.12/site-packages/pynicotine/gtkgui/application.py", line 112 in run
  File "/usr/lib/python3.12/site-packages/pynicotine/gtkgui/__init__.py", line 156 in run
  File "/usr/lib/python3.12/site-packages/pynicotine/__init__.py", line 224 in run
  File "/usr/bin/nicotine", line 35 in load_module
  File "/usr/bin/nicotine", line 39 in <module>
Extension modules: gi._gi (total: 1)
Aborted

XFCE

[05/28/24 02:19:50] Loading Python 3.12.3
[05/28/24 02:19:50] Loading Nicotine+ 3.3.4
**libEGL warning: DRI2: failed to authenticate
MESA: error: ZINK: vkCreateInstance failed (VK_ERROR_INCOMPATIBLE_DRIVER)
libEGL warning: egl: failed to create dri2 screen**
[05/28/24 02:19:50] Loading GTK 4.14.4
[05/28/24 02:19:50] Loading plugin system
[05/28/24 02:19:50] Loaded plugin Nicotine+ Commands
[05/28/24 02:19:50] You need to specify a username and password before connecting…
[05/28/24 02:19:55] Quitting Nicotine+ 3.3.4, application closing…
[05/28/24 02:19:55] Quit Nicotine+ 3.3.4!

@mathiascode
Copy link
Member Author

Couldn't open libGLESv2.so.2: Error loading shared library libGLESv2.so.2: No such file or directory

Perhaps try installing the mesa-gles package.

@francisuk1989
Copy link

francisuk1989 commented May 28, 2024

mesa-gles

Works nicely on KDE 6, The GUI opens up fine however there is a warning.

(org.nicotine_plus.Nicotine:3176): Gtk-WARNING **: 17:55:38.223: Unknown key gtk-modules in /home/kittydoodoo/.config/gtk-4.0/settings.ini

~ $ nicotine

[05/28/24 17:55:37] Loading Python 3.12.3
[05/28/24 17:55:37] Loading Nicotine+ 3.3.4
libEGL warning: DRI2: failed to authenticate MESA: error: ZINK: vkCreateInstance failed (VK_ERROR_INCOMPATIBLE_DRIVER)
libEGL warning: egl: failed to create dri2 screen
[05/28/24 17:55:38] Loading GTK 4.14.4

(org.nicotine_plus.Nicotine:3176): Gtk-WARNING **: 17:55:38.223: Unknown key gtk-modules in /home/francis/.config/gtk-4.0/settings.ini
[05/28/24 17:55:38] Loading plugin system
[05/28/24 17:55:38] Loaded plugin Nicotine+ Commands
[05/28/24 17:55:38] You need to specify a username and password before connecting…
[05/28/24 17:55:57] Quitting Nicotine+ 3.3.4, application closing…
[05/28/24 17:55:57] Quit Nicotine+ 3.3.4!

My Alpine Linux APKBUILD file for 3.3.4 as the default is still 3.3.2.
https://github.com/francisuk1989/alpinelinux-aports/blob/master/testing/nicotine-plus/APKBUILD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

7 participants