From 24ead2f125464a8e1faef3248523f5d42e9898ef Mon Sep 17 00:00:00 2001 From: lizhuoheng <114734429+LiZhuoheng-coder@users.noreply.github.com> Date: Sun, 23 Apr 2023 14:33:56 +0800 Subject: Added more gtk3 wrapped functions (#727) --- src/include/gtkclass.h | 68 ++++++++++++++ src/tools/gtkclass.c | 190 ++++++++++++++++++++++++++++++++++++++ src/wrapped/wrappedgio2_private.h | 20 ++-- src/wrapped/wrappedgtk3.c | 10 ++ src/wrapped/wrappedgtk3_private.h | 16 ++++ 5 files changed, 294 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/include/gtkclass.h b/src/include/gtkclass.h index beebbda8..a87408d6 100755 --- a/src/include/gtkclass.h +++ b/src/include/gtkclass.h @@ -369,6 +369,15 @@ typedef struct my_GtkBin2Class_s void (*_gtk_reserved4) (void); } my_GtkBin2Class_t; +typedef struct my_GtkBin3Class_s +{ + my_GtkContainer3Class_t parent_class; + void (*_gtk_reserved1) (void); + void (*_gtk_reserved2) (void); + void (*_gtk_reserved3) (void); + void (*_gtk_reserved4) (void); +} my_GtkBin3Class_t; + typedef struct my_GtkWindow2Class_s { my_GtkBin2Class_t parent_class; void (* set_focus) (void* window, void* focus); @@ -383,6 +392,47 @@ typedef struct my_GtkWindow2Class_s { void (*_gtk_reserved4) (void); } my_GtkWindow2Class_t; +typedef struct my_GtkWindow3Class_s +{ + my_GtkBin3Class_t parent_class; + void (* set_focus) (void* window, void* focus); + void (* activate_focus) (void* window); + void (* activate_default) (void* window); + void (* keys_changed) (void* window); + int (* enable_debugging) (void* window, int toggle); + void (* _gtk_reserved1) (void); + void (* _gtk_reserved2) (void); + void (* _gtk_reserved3) (void); +}my_GtkWindow3Class_t; + +typedef struct my_GtkApplicationWindowClass_s +{ + my_GtkWindow3Class_t parent_class; +}my_GtkApplicationWindowClass_t; + +typedef struct my_GtkListBoxClass_s +{ + my_GtkContainer3Class_t parent_class; + void (*row_selected) (void *box, void *row); + void (*row_activated) (void *box, void *row); + void (*activate_cursor_row) (void *box); + void (*toggle_cursor_row) (void *box); + void (*move_cursor) (void *box, int step, int count); + void (*selected_rows_changed) (void *box); + void (*select_all) (void *box); + void (*unselect_all) (void *box); + void (* _gtk_reserved1) (void); + void (* _gtk_reserved2) (void); + void (* _gtk_reserved3) (void); +}my_GtkListBoxClass_t; + +typedef struct my_GtkListBoxRowClass_s { + my_GtkBin3Class_t parent_class; + void (* activate) (void* row); + void (* _gtk_reserved1) (void); + void (* _gtk_reserved2) (void); +}my_GtkListBoxRowClass_t; + typedef struct my_GtkButton2Class_s { my_GtkBin2Class_t parent_class; void (* pressed) (void *button); @@ -546,6 +596,18 @@ typedef struct my_GtkTextView3Class_s { void (*_gtk_reserved4) (void); } my_GtkTextView3Class_t; +typedef struct my_GtkGrid3Class_s { + my_GtkContainer3Class_t parent_class; + void (* _gtk_reserved1) (void); + void (* _gtk_reserved2) (void); + void (* _gtk_reserved3) (void); + void (* _gtk_reserved4) (void); + void (* _gtk_reserved5) (void); + void (* _gtk_reserved6) (void); + void (* _gtk_reserved7) (void); + void (* _gtk_reserved8) (void); +}my_GtkGrid3Class_t; + typedef struct my_MetaFrames2Class_s { my_GtkWindow2Class_t parent_class; @@ -698,9 +760,14 @@ GTKCLASS(GtkLabel2) \ GTKCLASS(GtkMisc2) \ GTKCLASS(GtkTreeView2) \ GTKCLASS(GtkBin2) \ +GTKCLASS(GtkBin3) \ GTKCLASS(GtkWindow2) \ +GTKCLASS(GtkWindow3) \ GTKCLASS(GtkTable2) \ GTKCLASS(GtkFixed2) \ +GTKCLASS(GtkApplicationWindow) \ +GTKCLASS(GtkListBox) \ +GTKCLASS(GtkListBoxRow) \ GTKCLASS(GtkButton2) \ GTKCLASS(GtkComboBox2) \ GTKCLASS(GtkToggleButton2) \ @@ -714,6 +781,7 @@ GTKCLASS(GtkMenuShell2) \ GTKCLASS(GtkMenuBar2) \ GTKCLASS(GtkTextView2) \ GTKCLASS(GtkTextView3) \ +GTKCLASS(GtkGrid3) \ GTKCLASS(MetaFrames2) \ GTKCLASS(GDBusObjectManagerClient) \ GTKCLASS(AtkObject) \ diff --git a/src/tools/gtkclass.c b/src/tools/gtkclass.c index bdb771a1..ee22a59c 100755 --- a/src/tools/gtkclass.c +++ b/src/tools/gtkclass.c @@ -998,6 +998,22 @@ static void bridgeGtkBin2Class(my_GtkBin2Class_t* class) bridgeGtkContainer2Class(&class->parent_class); } +// ----- GtkBin3Class ------ +static void wrapGtkBin3Class(my_GtkBin3Class_t* class) +{ + wrapGtkContainer3Class(&class->parent_class); +} +// unwrap (and use callback if not a native call anymore) +static void unwrapGtkBin3Class(my_GtkBin3Class_t* class) +{ + unwrapGtkContainer3Class(&class->parent_class); +} +// autobridge +static void bridgeGtkBin3Class(my_GtkBin3Class_t* class) +{ + bridgeGtkContainer3Class(&class->parent_class); +} + // ----- GtkWindow2Class ------ // wrapper x86 -> natives of callbacks WRAPPER(GtkWindow2, set_focus, void, (void* window, void* focus), 2, window, focus); @@ -1043,6 +1059,148 @@ static void bridgeGtkWindow2Class(my_GtkWindow2Class_t* class) #undef SUPERGO +// ----- GtkWindow3Class ------ +// wrapper x86 -> natives of callbacks +WRAPPER(GtkWindow3, set_focus, void, (void* window, void* focus), 2, window, focus); +WRAPPER(GtkWindow3, activate_focus, void, (void* window), 1, window); +WRAPPER(GtkWindow3, activate_default, void, (void* window), 1, window); +WRAPPER(GtkWindow3, keys_changed, void, (void* window), 1, window); +WRAPPER(GtkWindow3, enable_debugging, int, (void* window, int toggle), 2, window, toggle); + +#define SUPERGO() \ + GO(set_focus, vFpp); \ + GO(activate_focus, vFp); \ + GO(activate_default, vFp); \ + GO(keys_changed, vFp); \ + GO(enable_debugging, iFpi); + + +// wrap (so bridge all calls, just in case) +static void wrapGtkWindow3Class(my_GtkWindow3Class_t* class) +{ + wrapGtkBin3Class(&class->parent_class); + #define GO(A, W) class->A = reverse_##A##_GtkWindow3 (W, class->A) + SUPERGO() + #undef GO +} +// unwrap (and use callback if not a native call anymore) +static void unwrapGtkWindow3Class(my_GtkWindow3Class_t* class) +{ + unwrapGtkBin3Class(&class->parent_class); + #define GO(A, W) class->A = find_##A##_GtkWindow3 (class->A) + SUPERGO() + #undef GO +} +// autobridge +static void bridgeGtkWindow3Class(my_GtkWindow3Class_t* class) +{ + bridgeGtkBin3Class(&class->parent_class); + #define GO(A, W) autobridge_##A##_GtkWindow3 (W, class->A) + SUPERGO() + #undef GO +} + +#undef SUPERGO + +// ----- GtkApplicationWindowClass ------ +// wrap (so bridge all calls, just in case) +static void wrapGtkApplicationWindowClass(my_GtkApplicationWindowClass_t* class) +{ + wrapGtkWindow3Class(&class->parent_class); +} +// unwrap (and use callback if not a native call anymore) +static void unwrapGtkApplicationWindowClass(my_GtkApplicationWindowClass_t* class) +{ + unwrapGtkWindow3Class(&class->parent_class); +} +// autobridge +static void bridgeGtkApplicationWindowClass(my_GtkApplicationWindowClass_t* class) +{ + bridgeGtkWindow3Class(&class->parent_class); +} + +// ----- GtkListBoxClass ------ +// wrapper x86 -> natives of callbacks +WRAPPER(GtkListBoxClass,row_selected, void, (void *box, void *row), 2, box, row); +WRAPPER(GtkListBoxClass,row_activated, void, (void *box, void *row), 2, box, row); +WRAPPER(GtkListBoxClass,activate_cursor_row, void, (void *box), 1, box); +WRAPPER(GtkListBoxClass,toggle_cursor_row, void, (void *box), 1, box); +WRAPPER(GtkListBoxClass,move_cursor, void, (void *box, int step, int count), 3, box, step, count); +WRAPPER(GtkListBoxClass,selected_rows_changed, void, (void *box), 1, box); +WRAPPER(GtkListBoxClass,select_all, void, (void *box), 1, box); +WRAPPER(GtkListBoxClass,unselect_all, void, (void *box), 1, box); + +#define SUPERGO() \ + GO(row_selected, vFpp); \ + GO(row_activated, vFpp); \ + GO(activate_cursor_row, vFp); \ + GO(toggle_cursor_row, vFp); \ + GO(move_cursor, vFpii); \ + GO(selected_rows_changed, vFp); \ + GO(select_all, vFp); \ + GO(unselect_all, vFp); + +// wrap (so bridge all calls, just in case) +static void wrapGtkListBoxClass(my_GtkListBoxClass_t* class) +{ + wrapGtkContainer3Class(&class->parent_class); + #define GO(A, W) class->A = reverse_##A##_GtkListBoxClass (W, class->A) + SUPERGO() + #undef GO +} +// unwrap (and use callback if not a native call anymore) +static void unwrapGtkListBoxClass(my_GtkListBoxClass_t* class) +{ + unwrapGtkContainer3Class(&class->parent_class); + #define GO(A, W) class->A = find_##A##_GtkListBoxClass (class->A) + SUPERGO() + #undef GO +} +// autobridge +static void bridgeGtkListBoxClass(my_GtkListBoxClass_t* class) +{ + bridgeGtkContainer3Class(&class->parent_class); + #define GO(A, W) autobridge_##A##_GtkListBoxClass (W, class->A) + SUPERGO() + #undef GO +} + +#undef SUPERGO + +// ----- GtkListBoxRowClass ------ +// wrapper x86 -> natives of callbacks +WRAPPER(GtkListBoxRowClass, activate, void, (void *row), 1, row); + +#define SUPERGO() \ + GO(activate, vFpp); + +// wrap (so bridge all calls, just in case) +static void wrapGtkListBoxRowClass(my_GtkListBoxRowClass_t* class) +{ + wrapGtkBin3Class(&class->parent_class); + #define GO(A, W) class->A = reverse_##A##_GtkListBoxRowClass (W, class->A) + SUPERGO() + #undef GO +} +// unwrap (and use callback if not a native call anymore) +static void unwrapGtkListBoxRowClass(my_GtkListBoxRowClass_t* class) +{ + unwrapGtkBin3Class(&class->parent_class); + #define GO(A, W) class->A = find_##A##_GtkListBoxRowClass (class->A) + SUPERGO() + #undef GO +} +// autobridge +static void bridgeGtkListBoxRowClass(my_GtkListBoxRowClass_t* class) +{ + bridgeGtkBin3Class(&class->parent_class); + #define GO(A, W) autobridge_##A##_GtkListBoxRowClass (W, class->A) + SUPERGO() + #undef GO +} + +#undef SUPERGO + // ----- GtkTable2Class ------ // wrap (so bridge all calls, just in case) static void wrapGtkTable2Class(my_GtkTable2Class_t* class) @@ -1685,6 +1843,38 @@ static void bridgeGtkTextView3Class(my_GtkTextView3Class_t* class) #undef SUPERGO +// ----- GtkGrid3Class ------ +// no wrapper x86 -> natives of callbacks + +#define SUPERGO() \ + +// wrap (so bridge all calls, just in case) +static void wrapGtkGrid3Class(my_GtkGrid3Class_t* class) +{ + wrapGtkContainer3Class(&class->parent_class); + #define GO(A, W) class->A = reverse_##A##_GtkGrid3 (W, class->A) + SUPERGO() + #undef GO +} +// unwrap (and use callback if not a native call anymore) +static void unwrapGtkGrid3Class(my_GtkGrid3Class_t* class) +{ + unwrapGtkContainer3Class(&class->parent_class); + #define GO(A, W) class->A = find_##A##_GtkGrid3 (class->A) + SUPERGO() + #undef GO +} +// autobridge +static void bridgeGtkGrid3Class(my_GtkGrid3Class_t* class) +{ + bridgeGtkContainer3Class(&class->parent_class); + #define GO(A, W) autobridge_##A##_GtkGrid3 (W, class->A) + SUPERGO() + #undef GO +} + +#undef SUPERGO + // ----- AtkObjectClass ------ // wrapper x86 -> natives of callbacks WRAPPER(AtkObject, get_name, void*, (void* accessible), 1, accessible); diff --git a/src/wrapped/wrappedgio2_private.h b/src/wrapped/wrappedgio2_private.h index 148759ae..46a8ca7a 100755 --- a/src/wrapped/wrappedgio2_private.h +++ b/src/wrapped/wrappedgio2_private.h @@ -27,10 +27,10 @@ GO(g_action_group_get_type, LFv) GO(g_action_group_has_action, iFpp) GO(g_action_group_list_actions, pFp) GO(g_action_group_query_action, iFppppppp) -//GO(g_action_map_add_action, +GO(g_action_map_add_action, vFpp) //GO(g_action_map_add_action_entries, //GO(g_action_map_get_type, -//GO(g_action_map_lookup_action, +GO(g_action_map_lookup_action, pFpp) //GO(g_action_map_remove_action, //GO(g_action_name_is_valid, //GO(g_action_parse_detailed_name, @@ -1027,9 +1027,9 @@ GO(g_list_model_get_object, pFpu) //GO(g_memory_output_stream_steal_as_bytes, //GO(g_memory_output_stream_steal_data, //GO(g_memory_settings_backend_new, -//GO(g_menu_append, +GO(g_menu_append, vFppp) //GO(g_menu_append_item, -//GO(g_menu_append_section, +GO(g_menu_append_section, vFppp) //GO(g_menu_append_submenu, //GO(g_menu_attribute_iter_get_name, //GO(g_menu_attribute_iter_get_next, @@ -1074,7 +1074,7 @@ GO(g_list_model_get_object, pFpu) //GO(g_menu_model_items_changed, //GO(g_menu_model_iterate_item_attributes, //GO(g_menu_model_iterate_item_links, -//GO(g_menu_new, +GO(g_menu_new, pFv) //GO(g_menu_prepend, //GO(g_menu_prepend_item, //GO(g_menu_prepend_section, @@ -1306,7 +1306,7 @@ GO(g_settings_apply, vFp) //GO(g_settings_bind_flags_get_type, //GO(g_settings_bind_with_mapping, //GO(g_settings_bind_writable, -//GO(g_settings_create_action, +GO(g_settings_create_action, pFpp) GO(g_settings_delay, vFp) //GO(g_settings_get, GO(g_settings_get_boolean, iFpp) @@ -1362,18 +1362,18 @@ GO(g_settings_schema_source_ref, pFp) GO(g_settings_schema_source_unref, vFp) GO(g_settings_schema_unref, vFp) //GO(g_settings_set, -//GO(g_settings_set_boolean, +GO(g_settings_set_boolean, iFppi) //GO(g_settings_set_double, //GO(g_settings_set_enum, //GO(g_settings_set_flags, -//GO(g_settings_set_int, +GO(g_settings_set_int, iFppi) //GO(g_settings_set_string, //GO(g_settings_set_strv, //GO(g_settings_set_uint, GO(g_settings_set_value, iFppp) GO(g_settings_sync, vFv) //GO(g_settings_unbind, -//GO(g_simple_action_get_type, +GO(g_simple_action_get_type, LFv) //GO(g_simple_action_group_add_entries, //GO(g_simple_action_group_get_type, //GO(g_simple_action_group_insert, @@ -1382,7 +1382,7 @@ GO(g_settings_sync, vFv) //GO(g_simple_action_group_remove, //GO(g_simple_action_new, //GO(g_simple_action_new_stateful, -//GO(g_simple_action_set_enabled, +GO(g_simple_action_set_enabled, vFpi) //GO(g_simple_action_set_state, GOM(g_simple_async_report_error_in_idle, vFEpppuipV) GOM(g_simple_async_report_gerror_in_idle, vFEpppp) diff --git a/src/wrapped/wrappedgtk3.c b/src/wrapped/wrappedgtk3.c index edf0dec0..64ced1ac 100755 --- a/src/wrapped/wrappedgtk3.c +++ b/src/wrapped/wrappedgtk3.c @@ -38,12 +38,15 @@ typedef void (*vFpipV_t)(void*, int, void*, ...); #define ADDED_FUNCTIONS() \ GO(g_type_class_ref, pFL_t) \ GO(g_type_class_unref, vFp_t) \ +GO(gtk_application_window_get_type, LFv_t) \ GO(gtk_bin_get_type, LFv_t) \ GO(gtk_widget_get_type, LFv_t) \ GO(gtk_button_get_type, LFv_t) \ GO(gtk_container_get_type, LFv_t) \ GO(gtk_misc_get_type, LFv_t) \ GO(gtk_label_get_type, LFv_t) \ +GO(gtk_list_box_get_type, LFv_t) \ +GO(gtk_list_box_row_get_type, LFv_t) \ GO(gtk_tree_view_get_type, LFv_t) \ GO(gtk_window_get_type, LFv_t) \ GO(gtk_table_get_type, LFv_t) \ @@ -61,6 +64,7 @@ GO(gtk_menu_shell_get_type, LFv_t) \ GO(gtk_menu_bar_get_type, LFv_t) \ GO(gtk_action_get_type, LFv_t) \ GO(gtk_application_get_type, LFv_t) \ +GO(gtk_grid_get_type, LFv_t) \ GO(gtk_dialog_add_button, pFppi_t) \ GO(gtk_spin_button_get_value, dFp_t) \ GO(gtk_builder_lookup_callback_symbol, pFpp_t) \ @@ -726,7 +730,13 @@ EXPORT void my3_gtk_container_foreach(x64emu_t* emu, void* container, void* cb, SetGtkApplicationID(my->gtk_application_get_type()); \ SetGtkWidget3ID(my->gtk_widget_get_type()); \ SetGtkContainer3ID(my->gtk_container_get_type()); \ + SetGtkBin3ID(my->gtk_bin_get_type()); \ + SetGtkWindow3ID(my->gtk_window_get_type()); \ + SetGtkApplicationWindowID(my->gtk_application_window_get_type());\ + SetGtkListBoxID(my->gtk_list_box_get_type()); \ + SetGtkListBoxRowID(my->gtk_list_box_row_get_type()); \ SetGtkTextView3ID(my->gtk_text_view_get_type()); \ + SetGtkGrid3ID(my->gtk_grid_get_type()); \ SetGtkActionID(my->gtk_action_get_type()); \ setNeededLibs(lib, 3, "libgdk-3.so.0", "libpangocairo-1.0.so.0", "libgio-2.0.so.0"); diff --git a/src/wrapped/wrappedgtk3_private.h b/src/wrapped/wrappedgtk3_private.h index bbc80b43..2b0269ab 100755 --- a/src/wrapped/wrappedgtk3_private.h +++ b/src/wrapped/wrappedgtk3_private.h @@ -191,8 +191,11 @@ GO(gtk_alignment_set_padding, vFpuuuu) GO(gtk_align_get_type, pFv) GO(gtk_alternative_dialog_button_order, iFp) GO(gtk_anchor_type_get_type, pFv) +GO(gtk_application_add_window, vFpp) GO(gtk_application_get_new, pFpi) GO(gtk_application_get_type, pFv) +GO(gtk_application_new, pFpi) +GO(gtk_application_set_accels_for_action, vFppp) GO(gtk_application_window_new, pFp) GO(gtk_application_window_get_type, pFv) GO(gtk_app_chooser_button_get_type, pFv) @@ -1204,6 +1207,10 @@ GO(gtk_grab_add, vFp) GO(gtk_grab_get_current, pFv) GO(gtk_grab_remove, vFp) GO(gtk_grid_get_type, pFv) +GO(gtk_grid_set_column_homogeneous, vFpi) +GO(gtk_grid_set_column_spacing, vFpu) +GO(gtk_grid_set_row_homogeneous, vFpi) +GO(gtk_grid_set_row_spacing, vFpu) GO(gtk_handle_box_get_child_detached, iFp) GO(gtk_handle_box_get_handle_position, iFp) GO(gtk_handle_box_get_shadow_type, iFp) @@ -1221,7 +1228,11 @@ GO(gtk_hbutton_box_get_type, pFv) GO(gtk_hbutton_box_new, pFv) GO(gtk_hbutton_box_set_layout_default, vFi) GO(gtk_hbutton_box_set_spacing_default, vFi) +GO(gtk_header_bar_new, pFv) GO(gtk_header_bar_get_type, lFv) +GO(gtk_header_bar_pack_end, vFpp) +GO(gtk_header_bar_set_show_close_button, vFpi) +GO(gtk_header_bar_set_title, vFpp) GO(gtk_hpaned_get_type, pFv) //GO(gtk_hpaned_new, GO(gtk_hruler_get_type, pFv) @@ -1600,6 +1611,7 @@ GO(gtk_link_button_get_type, pFv) GO(gtk_list_append_items, vFpp) GO(gtk_list_box_get_type, pFv) GO(gtk_list_box_row_get_type, pFv) +GO(gtk_list_box_set_header_func, vFppp) GO(gtk_list_child_position, iFpp) GO(gtk_list_clear_items, vFpii) GO(gtk_list_end_drag_selection, vFp) @@ -1693,6 +1705,8 @@ GO(gtk_menu_bar_get_type, pFv) GO(gtk_menu_bar_new, pFv) GO(gtk_menu_bar_set_child_pack_direction, vFpi) GO(gtk_menu_bar_set_pack_direction, vFpi) +GO(gtk_menu_button_new, pFv) +GO(gtk_menu_button_set_menu_model, vFpp) GO(gtk_menu_button_get_type, pFv) GO(gtk_menu_detach, vFp) GO(gtk_menu_direction_type_get_type, pFv) @@ -1884,6 +1898,7 @@ GO(gtk_orientable_get_orientation, iFp) GO(gtk_orientable_get_type, pFv) GO(gtk_orientable_set_orientation, vFpi) GO(gtk_orientation_get_type, pFv) +GO(gtk_overlay_add_overlay, vFpp) GO(gtk_overlay_get_type, pFv) GO(gtk_pack_direction_get_type, pFv) GO(gtk_pack_type_get_type, pFv) @@ -4172,6 +4187,7 @@ GO(gtk_window_set_startup_id, vFpp) GO(gtk_window_set_title, vFpp) GO(gtk_window_set_transient_for, vFpp) GO(gtk_window_set_type_hint, vFpi) +GO(gtk_window_set_titlebar, vFpp) GO(gtk_window_set_urgency_hint, vFpi) GO(gtk_widget_set_visual, vFpp) GO(gtk_window_set_wmclass, vFppp) -- cgit 1.4.1