Skip to content

Commit

Permalink
on #329 - restore old click method as default.
Browse files Browse the repository at this point in the history
* build with -DNEWCLICK
  • Loading branch information
Cecil committed Sep 30, 2017
1 parent 5c73fa3 commit afae967
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
25 changes: 25 additions & 0 deletions bugs/bug329.rb
Original file line number Diff line number Diff line change
@@ -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
15 changes: 14 additions & 1 deletion shoes/native/gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit afae967

Please sign in to comment.