window: Move user_time_window to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3211>
This commit is contained in:
parent
9e150fda42
commit
5e098eadce
@ -275,9 +275,6 @@ struct _MetaWindow
|
||||
know about for this window */
|
||||
guint32 net_wm_user_time;
|
||||
|
||||
/* window that gets updated net_wm_user_time values */
|
||||
Window user_time_window;
|
||||
|
||||
gboolean has_custom_frame_extents;
|
||||
MetaFrameBorder custom_frame_extents;
|
||||
|
||||
|
@ -1058,7 +1058,6 @@ meta_window_constructed (GObject *object)
|
||||
window->initial_workspace_set = FALSE;
|
||||
window->initial_timestamp_set = FALSE;
|
||||
window->net_wm_user_time_set = FALSE;
|
||||
window->user_time_window = None;
|
||||
window->input = TRUE;
|
||||
window->calc_placement = FALSE;
|
||||
window->have_focus_click_grab = FALSE;
|
||||
|
@ -1287,7 +1287,7 @@ handle_other_xevent (MetaX11Display *x11_display,
|
||||
* responding to UnmapNotify events is kind of bad.
|
||||
*/
|
||||
property_for_window = NULL;
|
||||
if (window && modified == window->user_time_window)
|
||||
if (window && modified == meta_window_x11_get_user_time_window (window))
|
||||
{
|
||||
property_for_window = window;
|
||||
window = NULL;
|
||||
|
@ -419,17 +419,20 @@ reload_net_wm_user_time_window (MetaWindow *window,
|
||||
{
|
||||
if (value->type != META_PROP_VALUE_INVALID)
|
||||
{
|
||||
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_private (window_x11);
|
||||
MetaWindow *prev_owner;
|
||||
MetaWindowX11Private *prev_owner_priv;
|
||||
|
||||
/* Unregister old NET_WM_USER_TIME_WINDOW */
|
||||
if (window->user_time_window != None)
|
||||
if (priv->user_time_window != None)
|
||||
{
|
||||
/* See the comment to the meta_display_register_x_window call below. */
|
||||
meta_x11_display_unregister_x_window (window->display->x11_display,
|
||||
window->user_time_window);
|
||||
priv->user_time_window);
|
||||
/* Don't get events on not-managed windows */
|
||||
XSelectInput (window->display->x11_display->xdisplay,
|
||||
window->user_time_window,
|
||||
priv->user_time_window,
|
||||
NoEventMask);
|
||||
}
|
||||
|
||||
@ -438,16 +441,17 @@ reload_net_wm_user_time_window (MetaWindow *window,
|
||||
*/
|
||||
prev_owner = meta_x11_display_lookup_x_window (window->display->x11_display,
|
||||
value->v.xwindow);
|
||||
if (prev_owner && prev_owner->user_time_window == value->v.xwindow)
|
||||
prev_owner_priv = meta_window_x11_get_private (META_WINDOW_X11 (prev_owner));
|
||||
if (prev_owner && prev_owner_priv->user_time_window == value->v.xwindow)
|
||||
{
|
||||
meta_x11_display_unregister_x_window (window->display->x11_display,
|
||||
value->v.xwindow);
|
||||
prev_owner->user_time_window = None;
|
||||
value->v.xwindow);
|
||||
prev_owner_priv->user_time_window = None;
|
||||
}
|
||||
|
||||
/* Obtain the new NET_WM_USER_TIME_WINDOW and register it */
|
||||
window->user_time_window = value->v.xwindow;
|
||||
if (window->user_time_window != None)
|
||||
priv->user_time_window = value->v.xwindow;
|
||||
if (priv->user_time_window != None)
|
||||
{
|
||||
/* Kind of a hack; display.c:event_callback() ignores events
|
||||
* for unknown windows. We make window->user_time_window
|
||||
@ -462,11 +466,11 @@ reload_net_wm_user_time_window (MetaWindow *window,
|
||||
* and it's not specified in the spec anyway.
|
||||
*/
|
||||
meta_x11_display_register_x_window (window->display->x11_display,
|
||||
&window->user_time_window,
|
||||
&priv->user_time_window,
|
||||
window);
|
||||
/* Just listen for property notify events */
|
||||
XSelectInput (window->display->x11_display->xdisplay,
|
||||
window->user_time_window,
|
||||
priv->user_time_window,
|
||||
PropertyChangeMask);
|
||||
|
||||
/* Manually load the _NET_WM_USER_TIME field from the given window
|
||||
@ -475,7 +479,7 @@ reload_net_wm_user_time_window (MetaWindow *window,
|
||||
*/
|
||||
meta_window_reload_property_from_xwindow (
|
||||
window,
|
||||
window->user_time_window,
|
||||
priv->user_time_window,
|
||||
window->display->x11_display->atom__NET_WM_USER_TIME,
|
||||
initial);
|
||||
}
|
||||
|
@ -81,6 +81,9 @@ struct _MetaWindowX11Private
|
||||
Window xclient_leader;
|
||||
Window xgroup_leader;
|
||||
|
||||
/* window that gets updated net_wm_user_time values */
|
||||
Window user_time_window;
|
||||
|
||||
/* Bypass compositor hints */
|
||||
MetaBypassCompositorHint bypass_compositor;
|
||||
|
||||
@ -93,4 +96,6 @@ void meta_window_x11_initialize_state (MetaWindow *window);
|
||||
|
||||
Window meta_window_x11_get_xgroup_leader (MetaWindow *window);
|
||||
|
||||
Window meta_window_x11_get_user_time_window (MetaWindow *window);
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -699,11 +699,11 @@ meta_window_x11_unmanage (MetaWindow *window)
|
||||
* _NET_WM_USER_TIME_WINDOW and IPC, perhaps.
|
||||
*/
|
||||
|
||||
if (window->user_time_window != None)
|
||||
if (priv->user_time_window != None)
|
||||
{
|
||||
meta_x11_display_unregister_x_window (x11_display,
|
||||
window->user_time_window);
|
||||
window->user_time_window = None;
|
||||
priv->user_time_window);
|
||||
priv->user_time_window = None;
|
||||
}
|
||||
|
||||
if (META_X11_DISPLAY_HAS_SHAPE (x11_display))
|
||||
@ -2074,6 +2074,8 @@ meta_window_x11_constructed (GObject *object)
|
||||
priv->xvisual = attrs.visual;
|
||||
window->mapped = attrs.map_state != IsUnmapped;
|
||||
|
||||
priv->user_time_window = None;
|
||||
|
||||
window->decorated = TRUE;
|
||||
window->hidden = FALSE;
|
||||
priv->border_width = attrs.border_width;
|
||||
@ -2883,6 +2885,7 @@ meta_window_x11_impl_process_property_notify (MetaWindow *window,
|
||||
XPropertyEvent *event)
|
||||
{
|
||||
Window xid = meta_window_x11_get_xwindow (window);
|
||||
Window user_time_window = meta_window_x11_get_user_time_window (window);
|
||||
|
||||
if (meta_is_verbose ()) /* avoid looking up the name if we don't have to */
|
||||
{
|
||||
@ -2895,9 +2898,9 @@ meta_window_x11_impl_process_property_notify (MetaWindow *window,
|
||||
}
|
||||
|
||||
if (event->atom == window->display->x11_display->atom__NET_WM_USER_TIME &&
|
||||
window->user_time_window)
|
||||
user_time_window)
|
||||
{
|
||||
xid = window->user_time_window;
|
||||
xid = user_time_window;
|
||||
}
|
||||
|
||||
meta_window_reload_property_from_xwindow (window, xid, event->atom, FALSE);
|
||||
@ -4430,3 +4433,17 @@ meta_window_x11_get_xgroup_leader (MetaWindow *window)
|
||||
|
||||
return priv->xgroup_leader;
|
||||
}
|
||||
|
||||
Window
|
||||
meta_window_x11_get_user_time_window (MetaWindow *window)
|
||||
{
|
||||
MetaWindowX11 *window_x11;
|
||||
MetaWindowX11Private *priv;
|
||||
|
||||
g_return_val_if_fail (META_IS_WINDOW (window), None);
|
||||
|
||||
window_x11 = META_WINDOW_X11 (window);
|
||||
priv = meta_window_x11_get_instance_private (window_x11);
|
||||
|
||||
return priv->user_time_window;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user