Commit f798912c authored by Marco Trevisan's avatar Marco Trevisan 🎺 Committed by Marco Trevisan

window: Move can_ping to a function and implement in X11

!421
parent 3bf80a96
Pipeline #58722 passed with stages
in 3 minutes and 7 seconds
......@@ -1992,7 +1992,7 @@ meta_display_ping_window (MetaWindow *window,
return;
}
if (!window->can_ping)
if (!meta_window_can_ping (window))
return;
ping_data = g_new (MetaPingData, 1);
......
......@@ -326,8 +326,6 @@ struct _MetaWindow
/* whether net_wm_icon_geometry has been set */
guint icon_geometry_set : 1;
/* These are the flags from WM_PROTOCOLS */
guint can_ping : 1;
/* Globally active / No input */
guint input : 1;
......@@ -570,6 +568,7 @@ struct _MetaWindowClass
ClutterInputDevice *source);
gboolean (*is_focusable) (MetaWindow *window);
gboolean (*is_stackable) (MetaWindow *window);
gboolean (*can_ping) (MetaWindow *window);
gboolean (*are_updates_frozen) (MetaWindow *window);
};
......@@ -665,6 +664,8 @@ void meta_window_set_focused_internal (MetaWindow *window,
gboolean meta_window_is_focusable (MetaWindow *window);
gboolean meta_window_can_ping (MetaWindow *window);
void meta_window_current_workspace_changed (MetaWindow *window);
void meta_window_show_menu (MetaWindow *window,
......
......@@ -1079,7 +1079,6 @@ _meta_window_shared_new (MetaDisplay *display,
window->initial_timestamp_set = FALSE;
window->net_wm_user_time_set = FALSE;
window->user_time_window = None;
window->can_ping = FALSE;
window->input = TRUE;
window->calc_placement = FALSE;
window->shaken_loose = FALSE;
......@@ -8536,6 +8535,12 @@ meta_window_is_focusable (MetaWindow *window)
return META_WINDOW_GET_CLASS (window)->is_focusable (window);
}
gboolean
meta_window_can_ping (MetaWindow *window)
{
return META_WINDOW_GET_CLASS (window)->can_ping (window);
}
gboolean
meta_window_is_stackable (MetaWindow *window)
{
......
......@@ -591,6 +591,12 @@ meta_window_wayland_is_focusable (MetaWindow *window)
return window->input;
}
static gboolean
meta_window_wayland_can_ping (MetaWindow *window)
{
return TRUE;
}
static gboolean
meta_window_wayland_is_stackable (MetaWindow *window)
{
......@@ -626,6 +632,7 @@ meta_window_wayland_class_init (MetaWindowWaylandClass *klass)
window_class->shortcuts_inhibited = meta_window_wayland_shortcuts_inhibited;
window_class->is_focusable = meta_window_wayland_is_focusable;
window_class->is_stackable = meta_window_wayland_is_stackable;
window_class->can_ping = meta_window_wayland_can_ping;
window_class->are_updates_frozen = meta_window_wayland_are_updates_frozen;
}
......@@ -665,7 +672,6 @@ meta_window_wayland_new (MetaDisplay *display,
WithdrawnState,
META_COMP_EFFECT_CREATE,
&attrs);
window->can_ping = TRUE;
meta_x11_error_trap_pop (display->x11_display); /* pop the XSync()-reducing trap */
......
......@@ -1531,8 +1531,8 @@ reload_wm_protocols (MetaWindow *window,
{
int i;
window->can_ping = FALSE;
meta_window_x11_set_wm_take_focus (window, FALSE);
meta_window_x11_set_wm_ping (window, FALSE);
meta_window_x11_set_wm_delete_window (window, FALSE);
if (value->type == META_PROP_VALUE_INVALID)
......@@ -1549,7 +1549,7 @@ reload_wm_protocols (MetaWindow *window,
meta_window_x11_set_wm_delete_window (window, TRUE);
else if (value->v.atom_list.atoms[i] ==
window->display->x11_display->atom__NET_WM_PING)
window->can_ping = TRUE;
meta_window_x11_set_wm_ping (window, TRUE);
++i;
}
......
......@@ -48,6 +48,7 @@ struct _MetaWindowX11Private
guint wm_state_skip_taskbar : 1;
guint wm_state_skip_pager : 1;
guint wm_take_focus : 1;
guint wm_ping : 1;
guint wm_delete_window : 1;
/* Weird "_NET_WM_STATE_MODAL" flag */
......
......@@ -682,6 +682,27 @@ meta_window_x11_unmanage (MetaWindow *window)
}
}
void
meta_window_x11_set_wm_ping (MetaWindow *window,
gboolean ping)
{
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv =
meta_window_x11_get_instance_private (window_x11);
priv->wm_ping = ping;
}
static gboolean
meta_window_x11_can_ping (MetaWindow *window)
{
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv =
meta_window_x11_get_instance_private (window_x11);
return priv->wm_ping;
}
static void
meta_window_x11_ping (MetaWindow *window,
guint32 serial)
......@@ -1710,6 +1731,7 @@ meta_window_x11_class_init (MetaWindowX11Class *klass)
window_class->shortcuts_inhibited = meta_window_x11_shortcuts_inhibited;
window_class->is_focusable = meta_window_x11_is_focusable;
window_class->is_stackable = meta_window_x11_is_stackable;
window_class->can_ping = meta_window_x11_can_ping;
window_class->are_updates_frozen = meta_window_x11_are_updates_frozen;
}
......
......@@ -53,6 +53,8 @@ void meta_window_x11_set_net_wm_state (MetaWindow *window);
void meta_window_x11_set_wm_state (MetaWindow *window);
void meta_window_x11_set_wm_take_focus (MetaWindow *window,
gboolean take_focus);
void meta_window_x11_set_wm_ping (MetaWindow *window,
gboolean ping);
void meta_window_x11_set_wm_delete_window (MetaWindow *window,
gboolean delete_window);
void meta_window_x11_set_allowed_actions_hint (MetaWindow *window);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment