core: Untangle input focus management

In all places (including src/wayland) we tap into meta_x11_display* focus
API, which then calls meta_display* API. This relation is backwards, so
rework input focus management so it's the other way around.

We now have high-level meta_display_(un)set_input_focus functions, which
perform the backend-independent maintenance, and calls into the X11
functions where relevant. These functions are what callers should use.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/420
This commit is contained in:
Carlos Garnacho
2018-12-30 21:23:07 +01:00
committed by Jonas Ådahl
parent 1d77641f0b
commit 86de79cfc5
9 changed files with 89 additions and 91 deletions

View File

@ -297,4 +297,13 @@ MetaSoundPlayer * meta_display_get_sound_player (MetaDisplay *display);
META_EXPORT
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,
guint32 timestamp);
#endif

View File

@ -63,27 +63,4 @@ META_EXPORT
gboolean meta_x11_display_xwindow_is_a_no_focus_window (MetaX11Display *x11_display,
Window xwindow);
/* meta_x11_display_set_input_focus_window is like XSetInputFocus, except
* that (a) it can't detect timestamps later than the current time,
* since Mutter isn't part of the XServer, and thus gives erroneous
* behavior in this circumstance (so don't do it), (b) it uses
* display->last_focus_time since we don't have access to the true
* Xserver one, (c) it makes use of display->user_time since checking
* whether a window should be allowed to be focused should depend
* on user_time events (see bug 167358, comment 15 in particular)
*/
META_EXPORT
void meta_x11_display_set_input_focus_window (MetaX11Display *x11_display,
MetaWindow *window,
gboolean focus_frame,
guint32 timestamp);
/* meta_x11_display_focus_the_no_focus_window is called when the
* designated no_focus_window should be focused, but is otherwise the
* same as meta_display_set_input_focus_window
*/
META_EXPORT
void meta_x11_display_focus_the_no_focus_window (MetaX11Display *x11_display,
guint32 timestamp);
#endif /* META_X11_DISPLAY_H */