forked from Miroirs/x49gp
replace deprecated gtk_button_pressed()/released()
This commit is contained in:
parent
e58bd6b9ca
commit
1f118799db
1 changed files with 86 additions and 78 deletions
|
@ -983,6 +983,14 @@ static inline int _tiny_text_width( const char* text )
|
|||
|
||||
static int _tiny_text_height = 10;
|
||||
|
||||
static void key_to_button( GtkWidget* button, bool is_press )
|
||||
{
|
||||
GdkEventButton event = { .type = GDK_BUTTON_PRESS, .state = 0 };
|
||||
static gboolean unused_but_needed_return_value;
|
||||
g_signal_emit_by_name( GTK_BUTTON( button ), is_press ? "button-press-event" : "button-release-event", &event,
|
||||
&unused_but_needed_return_value );
|
||||
}
|
||||
|
||||
static gboolean react_to_button_press( GtkWidget* widget, GdkEventButton* event, gpointer user_data )
|
||||
{
|
||||
x49gp_ui_button_t* button = user_data;
|
||||
|
@ -1008,7 +1016,7 @@ static gboolean react_to_button_press( GtkWidget* widget, GdkEventButton* event,
|
|||
button->hold = true;
|
||||
if ( button->down )
|
||||
return false;
|
||||
gtk_button_pressed( GTK_BUTTON( button->button ) );
|
||||
key_to_button( button->button, true );
|
||||
button->down = true;
|
||||
break;
|
||||
default:
|
||||
|
@ -1032,7 +1040,7 @@ static void ui_release_button( x49gp_ui_button_t* button, x49gp_ui_button_t* cau
|
|||
{
|
||||
x49gp_t* x49gp = button->x49gp;
|
||||
const x49gp_ui_key_t* key = button->key;
|
||||
GtkButton* gtkbutton = GTK_BUTTON( button->button );
|
||||
/* GtkButton* gtkbutton = GTK_BUTTON( button->button ); */
|
||||
|
||||
/* #ifdef DEBUG_X49GP_UI */
|
||||
/* printf( "%s: button %u: col %u, row %u, eint %u\n", __FUNCTION__, event->button, button->key->column, button->key->row, */
|
||||
|
@ -1044,7 +1052,7 @@ static void ui_release_button( x49gp_ui_button_t* button, x49gp_ui_button_t* cau
|
|||
|
||||
/* if ( button != cause ) */
|
||||
/* gtkbutton->in_button = false; */
|
||||
gtk_button_released( gtkbutton );
|
||||
key_to_button( button->button, false );
|
||||
|
||||
if ( key->rowbit )
|
||||
s3c2410_io_port_g_update( x49gp, key->column, key->row, key->columnbit, key->rowbit, 0 );
|
||||
|
@ -1485,13 +1493,13 @@ static gboolean react_to_key_event( GtkWidget* widget, GdkEventKey* event, gpoin
|
|||
bev.type = GDK_BUTTON_PRESS;
|
||||
react_to_button_press( button->button, &bev, button );
|
||||
/* GTK_BUTTON( button->button )->in_button = true; */
|
||||
gtk_button_pressed( GTK_BUTTON( button->button ) );
|
||||
key_to_button( button->button, true );
|
||||
/* GTK_BUTTON( button->button )->in_button = save_in; */
|
||||
break;
|
||||
case GDK_KEY_RELEASE:
|
||||
bev.type = GDK_BUTTON_RELEASE;
|
||||
/* GTK_BUTTON( button->button )->in_button = true; */
|
||||
gtk_button_released( GTK_BUTTON( button->button ) );
|
||||
key_to_button( button->button, false );
|
||||
/* GTK_BUTTON( button->button )->in_button = save_in; */
|
||||
react_to_button_release( button->button, &bev, button );
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue