mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
x11: Minor refactor of input focus handling code
Instead of open coding the X11 focus management in display.c, expose it as a single function with similar arguments to its MetaDisplay counterpart. This just means less X11 specifics in display.c. Closes: https://gitlab.gnome.org/GNOME/mutter/issues/751
This commit is contained in:
parent
31df06d94e
commit
6922f0e16a
@ -1372,23 +1372,8 @@ meta_display_set_input_focus (MetaDisplay *display,
|
||||
|
||||
if (display->x11_display)
|
||||
{
|
||||
MetaX11Display *x11_display = display->x11_display;
|
||||
Window xwindow;
|
||||
gulong serial;
|
||||
|
||||
meta_x11_error_trap_push (x11_display);
|
||||
|
||||
if (window)
|
||||
xwindow = focus_frame ? window->frame->xwindow : window->xwindow;
|
||||
else
|
||||
xwindow = x11_display->no_focus_window;
|
||||
|
||||
meta_x11_display_set_input_focus (x11_display, xwindow, timestamp);
|
||||
serial = XNextRequest (x11_display->xdisplay);
|
||||
|
||||
meta_x11_display_update_focus_window (x11_display, xwindow, serial, TRUE);
|
||||
|
||||
meta_x11_error_trap_pop (display->x11_display);
|
||||
meta_x11_display_set_input_focus (display->x11_display, window,
|
||||
focus_frame, timestamp);
|
||||
}
|
||||
|
||||
meta_display_update_focus_window (display, window);
|
||||
|
@ -224,7 +224,6 @@ void meta_x11_display_create_guard_window (MetaX11Display *x11_display);
|
||||
|
||||
/* make a request to ensure the event serial has changed */
|
||||
void meta_x11_display_increment_event_serial (MetaX11Display *x11_display);
|
||||
void meta_x11_display_update_active_window_hint (MetaX11Display *x11_display);
|
||||
|
||||
guint32 meta_x11_display_get_current_time_roundtrip (MetaX11Display *x11_display);
|
||||
|
||||
@ -250,8 +249,9 @@ void meta_x11_display_update_focus_window (MetaX11Display *x11_display,
|
||||
gulong serial,
|
||||
gboolean focused_by_us);
|
||||
void meta_x11_display_set_input_focus (MetaX11Display *x11_display,
|
||||
Window xwindow,
|
||||
guint32 timestamp);
|
||||
MetaWindow *window,
|
||||
gboolean focus_frame,
|
||||
uint32_t timestamp);
|
||||
|
||||
const gchar * meta_x11_get_display_name (void);
|
||||
|
||||
|
@ -1825,7 +1825,7 @@ meta_x11_display_increment_event_serial (MetaX11Display *x11_display)
|
||||
x11_display->atom__MOTIF_WM_HINTS);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
meta_x11_display_update_active_window_hint (MetaX11Display *x11_display)
|
||||
{
|
||||
MetaWindow *focus_window;
|
||||
@ -1867,10 +1867,10 @@ meta_x11_display_update_focus_window (MetaX11Display *x11_display,
|
||||
meta_x11_display_update_active_window_hint (x11_display);
|
||||
}
|
||||
|
||||
void
|
||||
meta_x11_display_set_input_focus (MetaX11Display *x11_display,
|
||||
Window xwindow,
|
||||
guint32 timestamp)
|
||||
static void
|
||||
meta_x11_display_set_input_focus_internal (MetaX11Display *x11_display,
|
||||
Window xwindow,
|
||||
uint32_t timestamp)
|
||||
{
|
||||
meta_x11_error_trap_push (x11_display);
|
||||
|
||||
@ -1900,6 +1900,27 @@ meta_x11_display_set_input_focus (MetaX11Display *x11_display,
|
||||
meta_x11_error_trap_pop (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;
|
||||
else
|
||||
xwindow = x11_display->no_focus_window;
|
||||
|
||||
meta_x11_error_trap_push (x11_display);
|
||||
meta_x11_display_set_input_focus_internal (x11_display, xwindow, timestamp);
|
||||
serial = XNextRequest (x11_display->xdisplay);
|
||||
meta_x11_display_update_focus_window (x11_display, xwindow, serial, TRUE);
|
||||
meta_x11_error_trap_pop (x11_display);
|
||||
}
|
||||
|
||||
void
|
||||
meta_x11_display_set_input_focus_xwindow (MetaX11Display *x11_display,
|
||||
Window window,
|
||||
@ -1909,7 +1930,7 @@ meta_x11_display_set_input_focus_xwindow (MetaX11Display *x11_display,
|
||||
|
||||
meta_display_unset_input_focus (x11_display->display, timestamp);
|
||||
serial = XNextRequest (x11_display->xdisplay);
|
||||
meta_x11_display_set_input_focus (x11_display, window, timestamp);
|
||||
meta_x11_display_set_input_focus_internal (x11_display, window, timestamp);
|
||||
meta_x11_display_update_focus_window (x11_display, window, serial, TRUE);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user