fix the rest of errors with CFLAGS+="-DGSEAL_ENABLE" except accel_label->accel_string required hack

This commit is contained in:
Garux
2020-05-20 02:51:37 +03:00
parent 50e1af1a16
commit 4f8e6e7ee5
12 changed files with 22 additions and 33 deletions

View File

@@ -243,7 +243,7 @@ bool Buttons_press( ButtonMask& buttons, guint button, guint state ){
{
GtkWindow* toplevel = *i;
ASSERT_MESSAGE( window_has_accel( toplevel ), "ERROR" );
ASSERT_MESSAGE( GTK_WIDGET_TOPLEVEL( toplevel ), "disabling accel for non-toplevel window" );
ASSERT_MESSAGE( gtk_widget_is_toplevel( GTK_WIDGET( toplevel ) ), "disabling accel for non-toplevel window" );
gtk_window_remove_accel_group( toplevel, global_accel );
#if 0
globalOutputStream() << reinterpret_cast<unsigned int>( toplevel ) << ": disabled global accelerators\n";
@@ -269,7 +269,7 @@ bool Buttons_release( ButtonMask& buttons, guint button, guint state ){
{
GtkWindow* toplevel = *i;
ASSERT_MESSAGE( !window_has_accel( toplevel ), "ERROR" );
ASSERT_MESSAGE( GTK_WIDGET_TOPLEVEL( toplevel ), "enabling accel for non-toplevel window" );
ASSERT_MESSAGE( gtk_widget_is_toplevel( GTK_WIDGET( toplevel ) ), "enabling accel for non-toplevel window" );
gtk_window_add_accel_group( toplevel, global_accel );
#if 0
globalOutputStream() << reinterpret_cast<unsigned int>( toplevel ) << ": enabled global accelerators\n";

View File

@@ -227,23 +227,13 @@ void accelerator_name( const Accelerator& accelerator, GString* gstring ){
}
void menu_item_set_accelerator( GtkMenuItem* item, Accelerator accelerator ){
GtkAccelLabel* accel_label = GTK_ACCEL_LABEL( gtk_bin_get_child( GTK_BIN( item ) ) );
g_free( accel_label->accel_string );
accel_label->accel_string = 0;
GString* gstring = g_string_new( accel_label->accel_string );
GString* gstring = g_string_new( nullptr );
g_string_append( gstring, " " );
accelerator_name( accelerator, gstring );
GtkAccelLabel* accel_label = GTK_ACCEL_LABEL( gtk_bin_get_child( GTK_BIN( item ) ) );
g_free( accel_label->accel_string );
accel_label->accel_string = gstring->str;
g_string_free( gstring, FALSE );
if ( !accel_label->accel_string ) {
accel_label->accel_string = g_strdup( "" );
}
accel_label->accel_string = g_string_free( gstring, FALSE );
gtk_widget_queue_resize( GTK_WIDGET( accel_label ) );
}