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

Remove libgnomekbd #5417

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions anaconda.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ BuildRequires: gobject-introspection-devel
%if %{with glade}
BuildRequires: glade-devel
%endif
BuildRequires: libgnomekbd-devel
BuildRequires: libxklavier-devel >= %{libxklavierver}
BuildRequires: make
BuildRequires: pango-devel
Expand Down Expand Up @@ -273,9 +272,9 @@ Requires: anaconda-core = %{version}-%{release}
Requires: anaconda-widgets = %{version}-%{release}
Requires: python3-meh-gui >= %{mehver}
Requires: adwaita-icon-theme
Requires: tecla
Requires: tigervnc-server-minimal
Requires: libxklavier >= %{libxklavierver}
Requires: libgnomekbd
Requires: nm-connection-editor
%ifnarch s390 s390x
Requires: NetworkManager-wifi
Expand Down
11 changes: 11 additions & 0 deletions docs/release-notes/remove-libgnomekbd.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:Type: GUI
:Summary: Remove libgnomekbd

:Description:
libgnomekbd is a C library used by Anaconda to display the keyboard
preview widget. It is stuck in GTK 3 and X11 (libxklavier).

Replace it with Tecla.

:Links:
- https://github.com/rhinstaller/anaconda/pull/5417
43 changes: 28 additions & 15 deletions pyanaconda/ui/gui/spokes/keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
# Red Hat, Inc.
#

import gi
gi.require_version("Gkbd", "3.0")
gi.require_version("Gtk", "3.0")

from gi.repository import Gkbd, Gtk
import locale as locale_mod

from pyanaconda.ui.gui import GUIObject
Expand All @@ -39,6 +34,8 @@
from pyanaconda.modules.common.constants.services import LOCALIZATION
from pyanaconda.modules.common.util import is_module_available
from pyanaconda.core.threads import thread_manager
from pyanaconda.core.process_watchers import PidWatcher
from pyanaconda.core.util import startProgram

from pyanaconda.anaconda_loggers import get_module_logger
log = get_module_logger(__name__)
Expand Down Expand Up @@ -323,6 +320,8 @@ def __init__(self, *args):
self._xkl_wrapper = XklWrapper.get_instance()
self._add_dialog = None
self._ready = False
self._running_tecla = None
self._focus_in_signal_id = None

self._upButton = self.builder.get_object("upButton")
self._downButton = self.builder.get_object("downButton")
Expand Down Expand Up @@ -612,19 +611,33 @@ def on_preview_clicked(self, button):
layout, variant = keyboard.parse_layout_variant(layout_row[0])

if variant:
lay_var_spec = "%s\t%s" % (layout, variant)
lay_var_spec = "%s+%s" % (layout, variant)
else:
lay_var_spec = layout

dialog = Gkbd.KeyboardDrawing.dialog_new()
Gkbd.KeyboardDrawing.dialog_set_layout(dialog, self._xkl_wrapper.configreg,
lay_var_spec)
dialog.set_size_request(750, 350)
dialog.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
with self.main_window.enlightbox(dialog):
dialog.show_all()
dialog.run()
dialog.destroy()
self.kill_tecla(msg="keyboard preview button clicked")
self.main_window.lightbox_on()
self._focus_in_signal_id = self.main_window.connect("focus-in-event", self._on_focus_in)
self._running_tecla = startProgram(["tecla", lay_var_spec], reset_lang=False)
PidWatcher().watch_process(self._running_tecla.pid, self.on_tecla_exited)

def kill_tecla(self, msg=""):
if not self._running_tecla:
return False

log.debug("killing running tecla %s: %s", self._running_tecla.pid, msg)
self._running_tecla.kill()
self._running_tecla = None
return True

def on_tecla_exited(self, pid, condition):
self.main_window.disconnect(self._focus_in_signal_id)
self._focus_in_signal_id = None
self._running_tecla = None
self.main_window.lightbox_off()

def _on_focus_in(self, widget, event):
self.kill_tecla(msg="keyboard spoke on focus in event")

def on_selection_changed(self, selection, *args):
# We don't have to worry about multiple rows being selected in this
Expand Down
1 change: 0 additions & 1 deletion pyanaconda/ui/gui/xkl_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def __init__(self):
# really wrong
raise XklWrapperError("Failed to initialize layouts")

#needed also for Gkbd.KeyboardDrawingDialog
self.configreg = Xkl.ConfigRegistry.get_instance(self._engine)
self.configreg.load(False)

Expand Down