@@ -1423,19 +1423,19 @@ image_window_properties( GSimpleAction *action,
14231423 GVariant * state , gpointer user_data )
14241424{
14251425 ImageWindow * win = VIPSDISP_IMAGE_WINDOW ( user_data );
1426+ gboolean revealed = g_variant_get_boolean ( state );
14261427
14271428#ifdef DEBUG
14281429 puts ("image_window_properties" );
14291430#endif /* DEBUG */
14301431
14311432 g_object_set ( win -> properties_pane ,
1432- "revealed" , g_variant_get_boolean ( state ) ,
1433+ "revealed" , revealed ,
14331434 NULL );
14341435
14351436 g_simple_action_set_state ( action , state );
14361437}
14371438
1438-
14391439static GActionEntry image_window_entries [] = {
14401440 { "magin" , image_window_magin_action },
14411441 { "magout" , image_window_magout_action },
@@ -1470,6 +1470,23 @@ static GActionEntry image_window_entries[] = {
14701470 { "reset" , image_window_reset },
14711471};
14721472
1473+ static void
1474+ image_window_properties_leave ( GtkEventControllerFocus * self ,
1475+ gpointer user_data )
1476+ {
1477+ ImageWindow * win = VIPSDISP_IMAGE_WINDOW ( user_data );
1478+
1479+ gboolean revealed ;
1480+
1481+ g_object_get ( win -> properties_pane ,
1482+ "revealed" , & revealed ,
1483+ NULL );
1484+
1485+ // if the props pane had the focus, and it's being hidden, we must refocus
1486+ if ( !revealed )
1487+ gtk_widget_grab_focus ( win -> imagedisplay );
1488+ }
1489+
14731490static void
14741491image_window_init ( ImageWindow * win )
14751492{
@@ -1546,6 +1563,14 @@ image_window_init( ImageWindow *win )
15461563 G_CALLBACK ( image_window_drag_update ), win );
15471564 gtk_widget_add_controller ( win -> imagedisplay , controller );
15481565
1566+ /* We need to know if the props pane has the focus so we can refocus on
1567+ * hide.
1568+ */
1569+ controller = GTK_EVENT_CONTROLLER ( gtk_event_controller_focus_new () );
1570+ g_signal_connect ( controller , "leave" ,
1571+ G_CALLBACK ( image_window_properties_leave ), win );
1572+ gtk_widget_add_controller ( win -> properties , controller );
1573+
15491574 g_settings_bind ( win -> settings , "control" ,
15501575 G_OBJECT ( win -> display_bar ),
15511576 "revealed" ,
0 commit comments