checkbutton: Only andle arrow focus if we're in a group
authorBenjamin Otte <otte@redhat.com>
Tue, 21 Mar 2023 13:06:33 +0000 (14:06 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 21 Apr 2023 06:31:32 +0000 (08:31 +0200)
If there is no other widget in the group that we can focus, don't focus
and activate ourselves.

Otherwise the arrow keys on checkbuttons toggle the checkbutton.

gtk/gtkcheckbutton.c

index 7b45cdf91f56407306d0a596d113ef6db58833c7..a4a24fa8be14f160fead728597bd036253a8ef8f 100644 (file)
@@ -481,16 +481,15 @@ gtk_check_button_focus (GtkWidget         *widget,
             }
         }
 
+      g_ptr_array_free (child_array, TRUE);
 
-      if (new_focus)
+      if (new_focus && new_focus != widget)
         {
           gtk_widget_grab_focus (new_focus);
           gtk_widget_activate (new_focus);
+          return TRUE;
         }
-
-      g_ptr_array_free (child_array, TRUE);
-
-      return TRUE;
+      return FALSE;
     }
   else
     {