From afae967b5fb8f0f0bf32fefe33da13a2dd9f1ea7 Mon Sep 17 00:00:00 2001 From: Cecil Date: Fri, 29 Sep 2017 21:40:34 -0600 Subject: [PATCH] on #329 - restore old click method as default. * build with -DNEWCLICK --- bugs/bug329.rb | 25 +++++++++++++++++++++++++ shoes/native/gtk.c | 15 ++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 bugs/bug329.rb diff --git a/bugs/bug329.rb b/bugs/bug329.rb new file mode 100644 index 00000000..b20479d8 --- /dev/null +++ b/bugs/bug329.rb @@ -0,0 +1,25 @@ +Shoes.app do + stack do + @p = para + end + + stack(left: self.width / 4, top: 10) do + button("hello") + flow { check; para "check?" } + edit_box + edit_line + list_box :items => ["one", "two", "three"] + progress + stack do + radio; para strong("one") + radio; para strong("two") + end + slider + spinner + switch + end + + click do |btn, left, top| + @p.text = "click: #{btn}, #{left}, #{top}\n" + end +end diff --git a/shoes/native/gtk.c b/shoes/native/gtk.c index 27a7fb77..db0ef92b 100644 --- a/shoes/native/gtk.c +++ b/shoes/native/gtk.c @@ -274,7 +274,7 @@ static gboolean shoes_app_gtk_motion(GtkWidget *widget, GdkEventMotion *event, g } return TRUE; } - +#ifdef NEWCLICK static gboolean shoes_app_gtk_button(GtkWidget *widget, GdkEventButton *event, gpointer data) { shoes_app *app = (shoes_app *)data; shoes_canvas *canvas; @@ -292,6 +292,19 @@ static gboolean shoes_app_gtk_button(GtkWidget *widget, GdkEventButton *event, g } return TRUE; } +#else +static gboolean shoes_app_gtk_button(GtkWidget *widget, GdkEventButton *event, gpointer data) { + shoes_app *app = (shoes_app *)data; + shoes_canvas *canvas; + Data_Get_Struct(app->canvas, shoes_canvas, canvas); + if (event->type == GDK_BUTTON_PRESS) { + shoes_app_click(app, event->button, event->x, event->y + canvas->slot->scrolly); + } else if (event->type == GDK_BUTTON_RELEASE) { + shoes_app_release(app, event->button, event->x, event->y + canvas->slot->scrolly); + } + return TRUE; +} +#endif static gboolean shoes_app_gtk_wheel(GtkWidget *widget, GdkEventScroll *event, gpointer data) { ID wheel;