mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
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:
parent
4179679239
commit
a36616f81d
@ -1613,7 +1613,6 @@ meta_display_timestamp_too_old (MetaDisplay *display,
|
||||
void
|
||||
meta_display_set_input_focus (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
gboolean focus_frame,
|
||||
guint32 timestamp)
|
||||
{
|
||||
if (meta_display_timestamp_too_old (display, ×tamp))
|
||||
@ -1623,7 +1622,7 @@ meta_display_set_input_focus (MetaDisplay *display,
|
||||
if (display->x11_display)
|
||||
{
|
||||
meta_x11_display_set_input_focus (display->x11_display, window,
|
||||
focus_frame, timestamp);
|
||||
timestamp);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1639,7 +1638,7 @@ void
|
||||
meta_display_unset_input_focus (MetaDisplay *display,
|
||||
guint32 timestamp)
|
||||
{
|
||||
meta_display_set_input_focus (display, NULL, FALSE, timestamp);
|
||||
meta_display_set_input_focus (display, NULL, timestamp);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -302,7 +302,6 @@ MetaSelection * meta_display_get_selection (MetaDisplay *display);
|
||||
META_EXPORT
|
||||
void meta_display_set_input_focus (MetaDisplay *display,
|
||||
MetaWindow *window,
|
||||
gboolean focus_frame,
|
||||
guint32 timestamp);
|
||||
META_EXPORT
|
||||
void meta_display_unset_input_focus (MetaDisplay *display,
|
||||
|
@ -185,7 +185,6 @@ meta_window_wayland_focus (MetaWindow *window,
|
||||
{
|
||||
meta_display_set_input_focus (window->display,
|
||||
window,
|
||||
FALSE,
|
||||
timestamp);
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +247,6 @@ void meta_x11_display_update_focus_window (MetaX11Display *x11_display,
|
||||
gboolean focused_by_us);
|
||||
void meta_x11_display_set_input_focus (MetaX11Display *x11_display,
|
||||
MetaWindow *window,
|
||||
gboolean focus_frame,
|
||||
uint32_t timestamp);
|
||||
|
||||
MetaDisplay * meta_x11_display_get_display (MetaX11Display *x11_display);
|
||||
|
@ -2089,16 +2089,28 @@ meta_x11_display_set_input_focus_internal (MetaX11Display *x11_display,
|
||||
void
|
||||
meta_x11_display_set_input_focus (MetaX11Display *x11_display,
|
||||
MetaWindow *window,
|
||||
gboolean focus_frame,
|
||||
uint32_t timestamp)
|
||||
{
|
||||
Window xwindow;
|
||||
gulong serial;
|
||||
|
||||
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
|
||||
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",
|
||||
window ? window->desc : "none", xwindow);
|
||||
|
@ -985,64 +985,59 @@ meta_window_x11_focus (MetaWindow *window,
|
||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv =
|
||||
meta_window_x11_get_instance_private (window_x11);
|
||||
/* 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))
|
||||
{
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Focusing frame of %s", window->desc);
|
||||
meta_display_set_input_focus (window->display,
|
||||
window,
|
||||
TRUE,
|
||||
timestamp);
|
||||
}
|
||||
else
|
||||
gboolean is_output_only_with_frame;
|
||||
|
||||
is_output_only_with_frame =
|
||||
window->frame && !meta_window_is_focusable (window);
|
||||
|
||||
if (window->input || is_output_only_with_frame)
|
||||
{
|
||||
if (window->input)
|
||||
{
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Setting input focus on %s since input = true",
|
||||
window->desc);
|
||||
meta_display_set_input_focus (window->display,
|
||||
window,
|
||||
FALSE,
|
||||
timestamp);
|
||||
}
|
||||
|
||||
if (priv->wm_take_focus)
|
||||
else if (is_output_only_with_frame)
|
||||
{
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Sending WM_TAKE_FOCUS to %s since take_focus = true",
|
||||
window->desc);
|
||||
|
||||
if (!window->input)
|
||||
{
|
||||
/* The "Globally Active Input" window case, where the window
|
||||
* doesn't want us to call XSetInputFocus on it, but does
|
||||
* want us to send a WM_TAKE_FOCUS.
|
||||
*
|
||||
* Normally, we want to just leave the focus undisturbed until
|
||||
* the window responds to WM_TAKE_FOCUS, but if we're unmanaging
|
||||
* the current focus window we *need* to move the focus away, so
|
||||
* we focus the no focus window before sending WM_TAKE_FOCUS,
|
||||
* and eventually the default focus window excluding this one,
|
||||
* if meanwhile we don't get any focus request.
|
||||
*/
|
||||
if (window->display->focus_window != NULL &&
|
||||
window->display->focus_window->unmanaging)
|
||||
{
|
||||
meta_display_unset_input_focus (window->display, timestamp);
|
||||
maybe_focus_default_window (window->display, window,
|
||||
timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
request_take_focus (window, timestamp);
|
||||
"Focusing frame of %s", window->desc);
|
||||
}
|
||||
|
||||
meta_display_set_input_focus (window->display,
|
||||
window,
|
||||
timestamp);
|
||||
}
|
||||
|
||||
if (priv->wm_take_focus)
|
||||
{
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Sending WM_TAKE_FOCUS to %s since take_focus = true",
|
||||
window->desc);
|
||||
|
||||
if (!window->input)
|
||||
{
|
||||
/* The "Globally Active Input" window case, where the window
|
||||
* doesn't want us to call XSetInputFocus on it, but does
|
||||
* want us to send a WM_TAKE_FOCUS.
|
||||
*
|
||||
* Normally, we want to just leave the focus undisturbed until
|
||||
* the window responds to WM_TAKE_FOCUS, but if we're unmanaging
|
||||
* the current focus window we *need* to move the focus away, so
|
||||
* we focus the no focus window before sending WM_TAKE_FOCUS,
|
||||
* and eventually the default focus window excluding this one,
|
||||
* if meanwhile we don't get any focus request.
|
||||
*/
|
||||
if (window->display->focus_window != NULL &&
|
||||
window->display->focus_window->unmanaging)
|
||||
{
|
||||
meta_display_unset_input_focus (window->display, timestamp);
|
||||
maybe_focus_default_window (window->display, window,
|
||||
timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
request_take_focus (window, timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user