core: Drop focus_frame argument from meta_display_set_input_focus()

Sort that out in the X11 display, where it matters, without the need
of this argument in generic API.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3269>
This commit is contained in:
Carlos Garnacho 2023-09-05 12:54:55 +02:00 committed by Georges Basile Stavracas Neto
parent 4179679239
commit a36616f81d
6 changed files with 60 additions and 57 deletions

View File

@ -1613,7 +1613,6 @@ meta_display_timestamp_too_old (MetaDisplay *display,
void void
meta_display_set_input_focus (MetaDisplay *display, meta_display_set_input_focus (MetaDisplay *display,
MetaWindow *window, MetaWindow *window,
gboolean focus_frame,
guint32 timestamp) guint32 timestamp)
{ {
if (meta_display_timestamp_too_old (display, &timestamp)) if (meta_display_timestamp_too_old (display, &timestamp))
@ -1623,7 +1622,7 @@ meta_display_set_input_focus (MetaDisplay *display,
if (display->x11_display) if (display->x11_display)
{ {
meta_x11_display_set_input_focus (display->x11_display, window, meta_x11_display_set_input_focus (display->x11_display, window,
focus_frame, timestamp); timestamp);
} }
#endif #endif
@ -1639,7 +1638,7 @@ void
meta_display_unset_input_focus (MetaDisplay *display, meta_display_unset_input_focus (MetaDisplay *display,
guint32 timestamp) guint32 timestamp)
{ {
meta_display_set_input_focus (display, NULL, FALSE, timestamp); meta_display_set_input_focus (display, NULL, timestamp);
} }
void void

View File

@ -302,7 +302,6 @@ MetaSelection * meta_display_get_selection (MetaDisplay *display);
META_EXPORT META_EXPORT
void meta_display_set_input_focus (MetaDisplay *display, void meta_display_set_input_focus (MetaDisplay *display,
MetaWindow *window, MetaWindow *window,
gboolean focus_frame,
guint32 timestamp); guint32 timestamp);
META_EXPORT META_EXPORT
void meta_display_unset_input_focus (MetaDisplay *display, void meta_display_unset_input_focus (MetaDisplay *display,

View File

@ -185,7 +185,6 @@ meta_window_wayland_focus (MetaWindow *window,
{ {
meta_display_set_input_focus (window->display, meta_display_set_input_focus (window->display,
window, window,
FALSE,
timestamp); timestamp);
} }
} }

View File

@ -247,7 +247,6 @@ void meta_x11_display_update_focus_window (MetaX11Display *x11_display,
gboolean focused_by_us); gboolean focused_by_us);
void meta_x11_display_set_input_focus (MetaX11Display *x11_display, void meta_x11_display_set_input_focus (MetaX11Display *x11_display,
MetaWindow *window, MetaWindow *window,
gboolean focus_frame,
uint32_t timestamp); uint32_t timestamp);
MetaDisplay * meta_x11_display_get_display (MetaX11Display *x11_display); MetaDisplay * meta_x11_display_get_display (MetaX11Display *x11_display);

View File

@ -2089,16 +2089,28 @@ meta_x11_display_set_input_focus_internal (MetaX11Display *x11_display,
void void
meta_x11_display_set_input_focus (MetaX11Display *x11_display, meta_x11_display_set_input_focus (MetaX11Display *x11_display,
MetaWindow *window, MetaWindow *window,
gboolean focus_frame,
uint32_t timestamp) uint32_t timestamp)
{ {
Window xwindow; Window xwindow;
gulong serial; gulong serial;
if (window) if (window)
xwindow = focus_frame ? window->frame->xwindow : window->xwindow; {
/* For output-only windows, focus the frame.
* This seems to result in the client window getting key events
* though, so I don't know if it's icccm-compliant.
*
* Still, we have to do this or keynav breaks for these windows.
*/
if (window->frame && !meta_window_is_focusable (window))
xwindow = window->frame->xwindow;
else else
xwindow = window->xwindow;
}
else
{
xwindow = x11_display->no_focus_window; xwindow = x11_display->no_focus_window;
}
meta_topic (META_DEBUG_FOCUS, "Setting X11 input focus for window %s to 0x%lx", meta_topic (META_DEBUG_FOCUS, "Setting X11 input focus for window %s to 0x%lx",
window ? window->desc : "none", xwindow); window ? window->desc : "none", xwindow);

View File

@ -985,31 +985,27 @@ meta_window_x11_focus (MetaWindow *window,
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv = MetaWindowX11Private *priv =
meta_window_x11_get_instance_private (window_x11); meta_window_x11_get_instance_private (window_x11);
/* For output-only windows, focus the frame. gboolean is_output_only_with_frame;
* This seems to result in the client window getting key events
* though, so I don't know if it's icccm-compliant. is_output_only_with_frame =
* window->frame && !meta_window_is_focusable (window);
* Still, we have to do this or keynav breaks for these windows.
*/ if (window->input || is_output_only_with_frame)
if (window->frame && !meta_window_is_focusable (window))
{
meta_topic (META_DEBUG_FOCUS,
"Focusing frame of %s", window->desc);
meta_display_set_input_focus (window->display,
window,
TRUE,
timestamp);
}
else
{ {
if (window->input) if (window->input)
{ {
meta_topic (META_DEBUG_FOCUS, meta_topic (META_DEBUG_FOCUS,
"Setting input focus on %s since input = true", "Setting input focus on %s since input = true",
window->desc); window->desc);
}
else if (is_output_only_with_frame)
{
meta_topic (META_DEBUG_FOCUS,
"Focusing frame of %s", window->desc);
}
meta_display_set_input_focus (window->display, meta_display_set_input_focus (window->display,
window, window,
FALSE,
timestamp); timestamp);
} }
@ -1043,7 +1039,6 @@ meta_window_x11_focus (MetaWindow *window,
request_take_focus (window, timestamp); request_take_focus (window, timestamp);
} }
}
} }
static void static void