1
0
Fork 0
forked from Miroirs/x49gp

button->box isn't necessary

This commit is contained in:
Gwenhael Le Moine 2024-11-10 11:17:23 +01:00
parent 3b8474337d
commit a2f5b119bf
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
2 changed files with 3 additions and 13 deletions

View file

@ -1726,28 +1726,19 @@ static int ui_load( x49gp_module_t* module, GKeyFile* keyfile )
for ( int row = 0; row < 10; row++ ) { for ( int row = 0; row < 10; row++ ) {
for ( int column = 0; column < ( ( row == 0 ) ? 6 : 5 ); column++ ) { for ( int column = 0; column < ( ( row == 0 ) ? 6 : 5 ); column++ ) {
button = &ui->buttons[ key_index ]; button = &ui->buttons[ key_index ];
button->x49gp = x49gp; button->x49gp = x49gp;
button->key = &ui_keys[ key_index ]; button->key = &ui_keys[ key_index ];
button->button = gtk_button_new(); button->button = gtk_button_new();
gtk_style_context_add_class( gtk_widget_get_style_context( button->button ), button->key->css_class );
gtk_widget_set_size_request( button->button, button->key->width, button->key->height ); gtk_widget_set_size_request( button->button, button->key->width, button->key->height );
gtk_widget_set_can_focus( button->button, false ); gtk_widget_set_can_focus( button->button, false );
gtk_style_context_add_class( gtk_widget_get_style_context( button->button ), button->key->css_class ); gtk_widget_add_events( button->button, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK );
button->box = gtk_event_box_new();
gtk_event_box_set_visible_window( GTK_EVENT_BOX( button->box ), true );
gtk_event_box_set_above_child( GTK_EVENT_BOX( button->box ), false );
gtk_container_add( GTK_CONTAINER( button->box ), button->button );
g_signal_connect( G_OBJECT( button->button ), "button-press-event", G_CALLBACK( react_to_button_press ), button ); g_signal_connect( G_OBJECT( button->button ), "button-press-event", G_CALLBACK( react_to_button_press ), button );
g_signal_connect( G_OBJECT( button->button ), "button-release-event", G_CALLBACK( react_to_button_release ), button ); g_signal_connect( G_OBJECT( button->button ), "button-release-event", G_CALLBACK( react_to_button_release ), button );
g_signal_connect( G_OBJECT( button->button ), "leave-notify-event", G_CALLBACK( react_to_button_leave ), button ); g_signal_connect( G_OBJECT( button->button ), "leave-notify-event", G_CALLBACK( react_to_button_leave ), button );
gtk_widget_add_events( button->button, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK ); gtk_fixed_put( GTK_FIXED( keyboard_container ), button->button, button->key->x, KEYBOARD_PADDING + button->key->y );
gtk_widget_set_size_request( button->box, button->key->width, button->key->height );
gtk_fixed_put( GTK_FIXED( keyboard_container ), button->box, button->key->x, KEYBOARD_PADDING + button->key->y );
if ( button->key->label ) { if ( button->key->label ) {
ui_label = gtk_label_new( NULL ); ui_label = gtk_label_new( NULL );

View file

@ -58,7 +58,6 @@ typedef struct {
x49gp_t* x49gp; x49gp_t* x49gp;
const x49gp_ui_key_t* key; const x49gp_ui_key_t* key;
GtkWidget* button; GtkWidget* button;
GtkWidget* box;
gboolean down; gboolean down;
gboolean hold; gboolean hold;
} x49gp_ui_button_t; } x49gp_ui_button_t;