mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
x11: Implement the set_accept_focus() vfunc
Actually set the InputHint flag and set the input field of the WM_SPEC hints depending on the value of the accept-focus bitfield. http://bugzilla.clutter-project.org/show_bug.cgi?id=2500
This commit is contained in:
parent
bbede9fef5
commit
497f39e2f4
@ -537,7 +537,7 @@ clutter_stage_x11_set_user_resizable (ClutterStageWindow *stage_window,
|
||||
stage_x11->xwin_height);
|
||||
}
|
||||
|
||||
static void
|
||||
static inline void
|
||||
update_wm_hints (ClutterStageX11 *stage_x11)
|
||||
{
|
||||
ClutterBackend *backend;
|
||||
@ -551,16 +551,26 @@ update_wm_hints (ClutterStageX11 *stage_x11)
|
||||
return;
|
||||
|
||||
backend = clutter_get_default_backend ();
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_BACKEND_X11 (backend));
|
||||
g_assert (CLUTTER_IS_BACKEND_X11 (backend));
|
||||
backend_x11 = CLUTTER_BACKEND_X11 (backend);
|
||||
|
||||
wm_hints.flags = StateHint;
|
||||
wm_hints.flags = StateHint | InputHint;
|
||||
wm_hints.initial_state = NormalState;
|
||||
wm_hints.input = stage_x11->accept_focus ? True : False;
|
||||
|
||||
XSetWMHints (backend_x11->xdpy, stage_x11->xwin, &wm_hints);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_x11_set_accept_focus (ClutterStageWindow *stage_window,
|
||||
gboolean accept_focus)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
|
||||
|
||||
stage_x11->accept_focus = !!accept_focus;
|
||||
update_wm_hints (stage_x11);
|
||||
}
|
||||
|
||||
static void
|
||||
set_stage_state (ClutterStageX11 *stage_x11,
|
||||
ClutterStageX11State unset_flags,
|
||||
@ -691,6 +701,7 @@ clutter_stage_x11_init (ClutterStageX11 *stage)
|
||||
stage->is_foreign_xwin = FALSE;
|
||||
stage->fullscreening = FALSE;
|
||||
stage->is_cursor_visible = TRUE;
|
||||
stage->accept_focus = TRUE;
|
||||
|
||||
stage->title = NULL;
|
||||
|
||||
@ -705,6 +716,7 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
||||
iface->set_fullscreen = clutter_stage_x11_set_fullscreen;
|
||||
iface->set_cursor_visible = clutter_stage_x11_set_cursor_visible;
|
||||
iface->set_user_resizable = clutter_stage_x11_set_user_resizable;
|
||||
iface->set_accept_focus = clutter_stage_x11_set_accept_focus;
|
||||
iface->show = clutter_stage_x11_show;
|
||||
iface->hide = clutter_stage_x11_hide;
|
||||
iface->resize = clutter_stage_x11_resize;
|
||||
|
@ -54,6 +54,7 @@ struct _ClutterStageX11
|
||||
guint fullscreening : 1;
|
||||
guint is_cursor_visible : 1;
|
||||
guint viewport_initialized : 1;
|
||||
guint accept_focus : 1;
|
||||
|
||||
Window xwin;
|
||||
gint xwin_width;
|
||||
|
Loading…
Reference in New Issue
Block a user