Commit Graph

1367605 Commits

Author SHA1 Message Date
Giuliano Procida d8f26717c9 gendwarfksyms: order -T symtypes output by name
When writing symtypes information, we iterate through the entire hash
table containing type expansions. The key order varies unpredictably
as new entries are added, making it harder to compare symtypes between
builds.

Resolve this by sorting the type expansions by name before output.

Signed-off-by: Giuliano Procida <gprocida@google.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26 15:31:30 +09:00
Giuliano Procida e06aa69de2 gendwarfksyms: use preferred form of sizeof for allocation
The preferred form is to use the variable being allocated to, rather
than explicitly supplying a type name which might become stale.

Also do this for memset.

Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Giuliano Procida <gprocida@google.com>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26 15:31:30 +09:00
Masahiro Yamada 87433e3e06 kconfig: qconf: confine {begin,end}Group to constructor and destructor
Call beginGroup() in the the constructor and endGroup() in the
destructor. This looks cleaner.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26 15:31:30 +09:00
Masahiro Yamada 721bfe583c kconfig: qconf: fix ConfigList::updateListAllforAll()
ConfigList::updateListForAll() and ConfigList::updateListAllforAll()
are identical.

Commit f9b918fae6 ("kconfig: qconf: move ConfigView::updateList(All)
to ConfigList class") was a misconversion.

Fixes: f9b918fae6 ("kconfig: qconf: move ConfigView::updateList(All) to ConfigList class")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26 15:31:30 +09:00
Masahiro Yamada 263e70bc42 kconfig: add a function to dump all menu entries in a tree-like format
This is useful for debugging purposes. menu_finalize() re-parents menu
entries, and this function can be used to dump the final structure of
the menu tree.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26 15:31:30 +09:00
Masahiro Yamada 65056488e8 kconfig: gconf: show GTK version in About dialog
Likewise xconfig, it is useful to display the GTK version in the About
dialog.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-26 15:31:29 +09:00
Masahiro Yamada bfa7375c10 kconfig: gconf: replace GtkHPaned and GtkVPaned with GtkPaned
GtkHPaned and GtkVPaned are deprecated with GTK 3.2. [1] [2]

Use GtkPaned instead.

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/3.2.0/gtk/gtkhpaned.c#L44
[2]: https://gitlab.gnome.org/GNOME/gtk/-/blob/3.2.0/gtk/gtkvpaned.c#L44

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26 15:31:29 +09:00
Masahiro Yamada d6f0b652d9 kconfig: gconf: replace GdkColor with GdkRGBA
GdkColor is deprecated with GTK 3.14. [1]

Use GdkRGBA instead.

This fixes warnings such as:

scripts/kconfig/gconf.c: In function ‘set_node’:
scripts/kconfig/gconf.c:138:9: warning: ‘gdk_color_parse’ is deprecated: Use 'gdk_rgba_parse' instead [-Wdeprecated-declarations]
  138 |         gdk_color_parse(menu_is_visible(menu) ? "Black" : "DarkGray", &color);
      |         ^~~~~~~~~~~~~~~

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/3.14.0/gdk/deprecated/gdkcolor.h#L52

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-26 15:31:29 +09:00
Masahiro Yamada df889fdbb8 kconfig: gconf: replace GtkVbox with GtkBox
GtkVBox is deprecated with GTK 3.2. [1]

Use GtkBox instead.

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/3.2.0/gtk/gtkvbox.c#L47

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26 15:31:29 +09:00
Masahiro Yamada 9755d167bf kconfig: gconf: migrate to GTK 3
This commit switches from GTK 2.x to GTK 3, applying the following
necessary changes:

 - Do not include individual headers
 - GtkObject is gone
 - Convert Glade to GtkBuilder

Link: https://docs.gtk.org/gtk3/migrating-2to3.html
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-26 15:31:29 +09:00
Masahiro Yamada e06030c1ae kconfig: gconf: rename gconf.glade to gconf.ui
The next commit will convert this file to GtkBuilder format. Rename
it in advance to reflect the intended format.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-26 15:31:29 +09:00
Masahiro Yamada 894ad40343 kconfig: gconf: rename display_tree_part()
This function recreates the tree store to update the menu content.
Rename it to recreate_tree() to better reflect its purpose.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26 15:31:29 +09:00
Masahiro Yamada 06ba76dc82 kconfig: gconf: use configure-event handler to adjust pane separator
The size-request event handler is currently used to adjust the position
of the horizontal separator in the right pane.

However, the size-request signal is not available in GTK 3. Use the
configure-event signal instead.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-26 15:31:29 +09:00
Masahiro Yamada 0c82f50a06 kconfig: gconf: fix behavior of a menu under a symbol in split view
A menu can be created under a symbol.

[Example]

  menu "outer menu"

  config A
          bool "A"

  menu "inner menu"
          depends on A

  config B
          bool "B"

  endmenu

  endmenu

After being re-parented by menu_finalize(), the menu tree is structured
like follows:

  menu "outer menu"
  \-- A
      \-- menu "inner menu"
          \-- B

In split view, the symbol A is shown in the right pane, so all of its
descendants must also be shown there. This has never worked correctly.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26 15:31:29 +09:00
Randy Dunlap 1f937cdf32 docs: kconfig: add alldefconfig to the all*configs
Add "alldefconfig" to the explanation of the KCONFIG_ALLCONFIG
environment variable usage so that all targets that use KCONFIG_ALLCONFIG
are listed.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-26 15:31:29 +09:00
Shankari Anand f468992936 kconfig: nconf: Ensure null termination where strncpy is used
strncpy() does not guarantee null-termination if the source string is
longer than the destination buffer.

Ensure the buffer is explicitly null-terminated to prevent potential
string overflows or undefined behavior.

Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Nicolas Schier <n.schier@avm.de>
Acked-by: Nicolas Schier <n.schier@avm.de>
2025-07-26 15:31:17 +09:00
Masahiro Yamada 9e0bd6db62 kconfig: gconf: remove GtkHandleBox from glade
GtkHandleBox is deprecated with GTK 3.4. [1]

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/3.4.0/gtk/deprecated/gtkhandlebox.c#L426

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:36:06 +09:00
Masahiro Yamada c34d632370 kconfig: gconf: use gtk_dialog_get_content_area() accessor
GTK 3 removes many implementation details and struct members from its
public headers.

Use the gtk_check_menu_item_get_active() accessor.

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/docs/reference/gtk/compiling.sgml#L85

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:36:06 +09:00
Masahiro Yamada 07944f94fc kconfig: gconf: use gtk_check_menu_item_get_active() accessor
GTK 3 removes many implementation details and struct members from its
public headers.

Use the gtk_check_menu_item_get_active() accessor.

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/docs/reference/gtk/compiling.sgml#L85

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:36:06 +09:00
Masahiro Yamada ea1438f720 kconfig: gconf: remove unnecessary default message in text view
This message looks odd because it is displayed when nothing is selected.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:36:06 +09:00
Masahiro Yamada 9d0e47c4c8 kconfig: gconf: replace "tooltip" property with "tooltip-text"
This is no longer available in GTK 3. Use "tooltip-text" instead.

Also reword "Goes up of one level" to "Goes up one level" while I am
here.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:33:47 +09:00
Masahiro Yamada ad452c27ae kconfig: gconf: remove "tooltips" property from glade
The tips are still displayed without this.

This property does not exist in GtkBuilder with GTK 3.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:11:52 +09:00
Masahiro Yamada 7783290143 kconfig: gconf: replace GTK_STOCK_{OK,NO,CANCEL}
These are deprecated with GTK 3.10. [1]

Use "_OK", "_no", "_Cancel".

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/3.10.0/gtk/deprecated/gtkstock.h#L827

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:11:52 +09:00
Masahiro Yamada 475c878f97 kconfig: gconf: replace GDK_space with GDK_KEY_space
In GTK3, keysyms changed to have a KEY_ prefix.

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gdk/gdkkeysyms-compat.h#L24

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:11:52 +09:00
Masahiro Yamada bf5792da5a kconfig: gconf: remove dead code in display_tree_part()
This function is no longer called in the FULL_VIEW mode, so remove the
dead code.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:11:52 +09:00
Masahiro Yamada 063a274a5e kconfig: gconf: inline display_list() into set_view_mode()
This function is now only called by set_view_mode(), so inline it
for simplicity.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:11:52 +09:00
Masahiro Yamada 035c2f56f5 kconfig: gconf: do not reconstruct tree store when a symbol is changed
There is no need to reconstruct the entire tree store when a symbol's
value changes. Simply call gtk_tree_store_set() to update the row data.

Introduce update_trees() to factor out the common update logic.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:11:52 +09:00
Masahiro Yamada 64285dc5c4 kconfig: gconf: inline fill_row() into set_node()
The row[] array is used to prepare data passed to set_node(), but this
indirection is unnecessary. Squash fill_row() into set_node() and call
gtk_tree_store_set() directly.

Also, calling gdk_pixbuf_new_from_xpm_data() for every row is
inefficient. Call it once and store the resulting pixbuf in a global
variable.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:11:52 +09:00
Masahiro Yamada ed332436f3 kconfig: gconf: remove init_tree_model()
Move the relevant code into init_left_tree() or init_right_tree().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:11:52 +09:00
Masahiro Yamada b674af6ec8 kconfig: gconf: remove global 'model1' and 'model2' variables
These variables are unnecessary because the current model can be
retrieved using gtk_tree_view_get_model().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02 11:11:52 +09:00
Masahiro Yamada e379547936 kconfig: gconf: use GtkTreeModelFilter to control row visibility
Currently, update_tree() adds/removes entries to show/hide rows.
This approach is extremely complicated.

Use the tree model filter to control row visibility instead.

Do not toggle the MENU_CHANGED flag, as it is hard to control this
correctly.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:11:52 +09:00
Masahiro Yamada ab026457d3 kconfig: gconf: preserve menu selection when switching view mode
Preserve the current menu selection when switching to a different view
mode, as it improves usability.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 11:11:48 +09:00
Masahiro Yamada ecaa87d4e9 kconfig: gconf: merge 'current' and 'browsed' global variables
The 'current' (SINGLE view) and 'browsed' (SPLIT_VIEW) variables serve
similar purposes and are not needed at the same time. Merge them.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:39:31 +09:00
Masahiro Yamada 1bd81df0b1 kconfig: gconf: remove global 'tree' variable
Pass the tree store as a function parameter to make it clearer which
tree is being updated.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:38:28 +09:00
Masahiro Yamada 20f375cbfe kconfig: gconf: make introduction, about, license dialogs modal
These are modal dialogs in xconfig. Make them modal in gconfig as well.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02 10:36:15 +09:00
Masahiro Yamada b8f660aabc kconfig: gconf: refactor replace_button_icon()
The "window" and "style" arguments for replace_button_icon() are
now unused. Remove them and refactor the function accordingly.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:15 +09:00
Masahiro Yamada 9517f47dbf kconfig: gconf: use GdkPixbuf in replace_button_icon()
gdk_pixmap_create_from_xpm_d has been deprecated since version 2.22.
Use a GdkPixbuf instead. You can use gdk_pixbuf_new_from_xpm_data() to
create it. [1]

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/gdk/gdkpixmap.c#L742

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:15 +09:00
Masahiro Yamada fd7fd8024c kconfig: gconf: use GtkFileChooser in on_save_as1_activate()
gtk_file_selection_new() is deprecated, and gtk_file_chooser_dialog_new()
should be used instead. [1]

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/docs/reference/gtk/tmpl/gtkfilesel.sgml?ref_type=tags#L156

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02 10:36:15 +09:00
Masahiro Yamada 30dda0fdf7 kconfig: gconf: use GtkFileChooser in on_load1_activate()
gtk_file_selection_new() is deprecated, and gtk_file_chooser_dialog_new()
should be used instead. [1]

[1]: https://gitlab.gnome.org/GNOME/gtk/-/blob/2.24.33/docs/reference/gtk/tmpl/gtkfilesel.sgml?ref_type=tags#L156

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02 10:36:15 +09:00
Masahiro Yamada 4d89059a72 kconfig: gconf: add on_save_clicked() event handler
The "clicked" event handler for GtkToolButton takes the GtkToolButton*
as the first parameter.

This is different from the existing on_save_activate() handler.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:15 +09:00
Masahiro Yamada 59adbcd805 kconfig: gconf: avoid hardcoding model* in on_treeview*_button_press_event()
It is better not to hardcode model1 or model2 for consistency.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:15 +09:00
Masahiro Yamada e6991e8004 kconfig: gconf: avoid hardcoding model2 in renderer_edited()
Although this is only used in the right tree view, it is better not to
hardcode model2 for consistency.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:14 +09:00
Masahiro Yamada cae9cdbcd9 kconfig: gconf: avoid hardcoding model2 in on_treeview2_cursor_changed()
The on_treeview2_cursor_changed() handler is connected to both the left
and right tree views, but it hardcodes model2 (the GtkTreeModel of the
right tree view). This is incorrect. Get the associated model from the
view.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:14 +09:00
Masahiro Yamada 3beae86595 kconfig: gconf: make key_press_event work in left pane too
Currently, on_treeview2_key_press_event() returns early for the tree1
widget. We can make it work on the left pane as well by avoiding the
hardcoded use of model2.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:14 +09:00
Masahiro Yamada e06b176bf1 kconfig: gconf: remove glade_xml_signal_autoconnect() call
Now that all signals are connected manually, this is no longer
necessary.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:14 +09:00
Masahiro Yamada 77e8ff9889 kconfig: gconf: add static qualifiers to event handlers
This fixes several -Wmissing-prototypes warnings.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02 10:36:14 +09:00
Masahiro Yamada f0049c937d kconfig: gconf: move button1 and save1 initialization code
Move the relevant initialization code closer together.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:14 +09:00
Masahiro Yamada 3e0fb3ef01 kconfig: gconf: move the main window event handlers below
This allows removal of the forward delcaration of on_save_activate().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2025-07-02 10:36:13 +09:00
Masahiro Yamada b22bbaea7f kconfig: gconf: grey out button for current view
This clarifies which view is currently selected.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02 10:34:57 +09:00
Masahiro Yamada 8d6b5c14ab kconfig: gconf: refactor view setting code
Factor out common code for setting the view into a new function,
set_view_mode().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
2025-07-02 10:34:02 +09:00