Move focus to be a vfunc
This commit is contained in:
parent
14f424cd02
commit
0808adefaf
@ -476,6 +476,8 @@ struct _MetaWindowClass
|
|||||||
void (*delete) (MetaWindow *window,
|
void (*delete) (MetaWindow *window,
|
||||||
guint32 timestamp);
|
guint32 timestamp);
|
||||||
void (*kill) (MetaWindow *window);
|
void (*kill) (MetaWindow *window);
|
||||||
|
void (*focus) (MetaWindow *window,
|
||||||
|
guint32 timestamp);
|
||||||
void (*move_resize_internal) (MetaWindow *window,
|
void (*move_resize_internal) (MetaWindow *window,
|
||||||
int gravity,
|
int gravity,
|
||||||
MetaRectangle requested_rect,
|
MetaRectangle requested_rect,
|
||||||
|
@ -5090,69 +5090,7 @@ meta_window_focus (MetaWindow *window,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For output-only or shaded windows, focus the frame.
|
META_WINDOW_GET_CLASS (window)->focus (window, timestamp);
|
||||||
* 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 &&
|
|
||||||
(window->shaded ||
|
|
||||||
!(window->input || window->take_focus)))
|
|
||||||
{
|
|
||||||
if (window->frame)
|
|
||||||
{
|
|
||||||
meta_topic (META_DEBUG_FOCUS,
|
|
||||||
"Focusing frame of %s\n", window->desc);
|
|
||||||
meta_display_set_input_focus_window (window->display,
|
|
||||||
window,
|
|
||||||
TRUE,
|
|
||||||
timestamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (window->input)
|
|
||||||
{
|
|
||||||
meta_topic (META_DEBUG_FOCUS,
|
|
||||||
"Setting input focus on %s since input = true\n",
|
|
||||||
window->desc);
|
|
||||||
meta_display_set_input_focus_window (window->display,
|
|
||||||
window,
|
|
||||||
FALSE,
|
|
||||||
timestamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window->take_focus)
|
|
||||||
{
|
|
||||||
meta_topic (META_DEBUG_FOCUS,
|
|
||||||
"Sending WM_TAKE_FOCUS to %s since take_focus = true\n",
|
|
||||||
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 respnds 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 now (and set
|
|
||||||
* display->focus_window to that) before sending WM_TAKE_FOCUS.
|
|
||||||
*/
|
|
||||||
if (window->display->focus_window != NULL &&
|
|
||||||
window->display->focus_window->unmanaging)
|
|
||||||
meta_display_focus_the_no_focus_window (window->display,
|
|
||||||
window->screen,
|
|
||||||
timestamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_display_request_take_focus (window->display,
|
|
||||||
window,
|
|
||||||
timestamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window->wm_state_demands_attention)
|
if (window->wm_state_demands_attention)
|
||||||
meta_window_unset_demands_attention(window);
|
meta_window_unset_demands_attention(window);
|
||||||
|
@ -95,6 +95,16 @@ meta_window_wayland_kill (MetaWindow *window)
|
|||||||
/* TODO */
|
/* TODO */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_window_wayland_focus (MetaWindow *window,
|
||||||
|
guint32 timestamp)
|
||||||
|
{
|
||||||
|
meta_display_set_input_focus_window (window->display,
|
||||||
|
window,
|
||||||
|
FALSE,
|
||||||
|
timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_window_wayland_move_resize_internal (MetaWindow *window,
|
meta_window_wayland_move_resize_internal (MetaWindow *window,
|
||||||
int gravity,
|
int gravity,
|
||||||
@ -199,5 +209,6 @@ meta_window_wayland_class_init (MetaWindowWaylandClass *klass)
|
|||||||
window_class->ping = meta_window_wayland_ping;
|
window_class->ping = meta_window_wayland_ping;
|
||||||
window_class->delete = meta_window_wayland_delete;
|
window_class->delete = meta_window_wayland_delete;
|
||||||
window_class->kill = meta_window_wayland_kill;
|
window_class->kill = meta_window_wayland_kill;
|
||||||
|
window_class->focus = meta_window_wayland_focus;
|
||||||
window_class->move_resize_internal = meta_window_wayland_move_resize_internal;
|
window_class->move_resize_internal = meta_window_wayland_move_resize_internal;
|
||||||
}
|
}
|
||||||
|
@ -386,6 +386,75 @@ meta_window_x11_kill (MetaWindow *window)
|
|||||||
meta_error_trap_pop (window->display);
|
meta_error_trap_pop (window->display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_window_x11_focus (MetaWindow *window,
|
||||||
|
guint32 timestamp)
|
||||||
|
{
|
||||||
|
/* For output-only or shaded 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 &&
|
||||||
|
(window->shaded ||
|
||||||
|
!(window->input || window->take_focus)))
|
||||||
|
{
|
||||||
|
if (window->frame)
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_FOCUS,
|
||||||
|
"Focusing frame of %s\n", window->desc);
|
||||||
|
meta_display_set_input_focus_window (window->display,
|
||||||
|
window,
|
||||||
|
TRUE,
|
||||||
|
timestamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (window->input)
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_FOCUS,
|
||||||
|
"Setting input focus on %s since input = true\n",
|
||||||
|
window->desc);
|
||||||
|
meta_display_set_input_focus_window (window->display,
|
||||||
|
window,
|
||||||
|
FALSE,
|
||||||
|
timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->take_focus)
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_FOCUS,
|
||||||
|
"Sending WM_TAKE_FOCUS to %s since take_focus = true\n",
|
||||||
|
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 respnds 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 now (and set
|
||||||
|
* display->focus_window to that) before sending WM_TAKE_FOCUS.
|
||||||
|
*/
|
||||||
|
if (window->display->focus_window != NULL &&
|
||||||
|
window->display->focus_window->unmanaging)
|
||||||
|
meta_display_focus_the_no_focus_window (window->display,
|
||||||
|
window->screen,
|
||||||
|
timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_display_request_take_focus (window->display,
|
||||||
|
window,
|
||||||
|
timestamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_net_frame_extents (MetaWindow *window)
|
update_net_frame_extents (MetaWindow *window)
|
||||||
{
|
{
|
||||||
@ -811,6 +880,7 @@ meta_window_x11_class_init (MetaWindowX11Class *klass)
|
|||||||
window_class->ping = meta_window_x11_ping;
|
window_class->ping = meta_window_x11_ping;
|
||||||
window_class->delete = meta_window_x11_delete;
|
window_class->delete = meta_window_x11_delete;
|
||||||
window_class->kill = meta_window_x11_kill;
|
window_class->kill = meta_window_x11_kill;
|
||||||
|
window_class->focus = meta_window_x11_focus;
|
||||||
window_class->move_resize_internal = meta_window_x11_move_resize_internal;
|
window_class->move_resize_internal = meta_window_x11_move_resize_internal;
|
||||||
window_class->get_default_skip_hints = meta_window_x11_get_default_skip_hints;
|
window_class->get_default_skip_hints = meta_window_x11_get_default_skip_hints;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user