Commit 628ffde1 authored by Iulian Radu's avatar Iulian Radu

Make 'Next Level' button the default widget

Currently, when a level is completed, the focus is set on the Next
Level button so by pressing Enter the user can immediately start the
next level. This can sometimes lead to problems if the focus is changed.

Instead of relying on the widget's focus, make the 'Next Level' button
the default widget so by pressing enter with no focus, the next level
is always started.
parent bdda55bc
......@@ -32,6 +32,7 @@
<object class="GtkOverlay" id="main_overlay">
<property name="visible">True</property>
<property name="can-default">True</property>
<object class="GtkBox" id="vbox">
<property name="visible">True</property>
......@@ -893,6 +893,7 @@ public class Nibbles : Gtk.Application
button.valign = Gtk.Align.END;
button.set_margin_bottom (100);
button.get_style_context ().add_class ("suggested-action");
button.set_can_default (true);
button.clicked.connect (() => {
label.destroy ();
button.destroy ();
......@@ -906,10 +907,11 @@ public class Nibbles : Gtk.Application
overlay.add_overlay (button); ();
overlay.grab_default ();
Timeout.add (500, () => { ();
button.grab_focus ();
button.grab_default ();
return Source.REMOVE;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment