diff --git a/src/core/display.c b/src/core/display.c index 2ddcbbc1f..82c9cd108 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -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); diff --git a/src/x11/meta-x11-display-private.h b/src/x11/meta-x11-display-private.h index 92951844e..7c61d7b0d 100644 --- a/src/x11/meta-x11-display-private.h +++ b/src/x11/meta-x11-display-private.h @@ -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); diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c index 5f2e71c44..77283d323 100644 --- a/src/x11/meta-x11-display.c +++ b/src/x11/meta-x11-display.c @@ -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); }