Move groups and window/group prop hooks to MetaX11Display

https://bugzilla.gnome.org/show_bug.cgi?id=759538
This commit is contained in:
Armin Krezović 2017-08-26 18:58:29 +02:00 committed by Jonas Ådahl
parent 722c975aca
commit 9e5ea8def4
12 changed files with 152 additions and 145 deletions

View File

@ -50,9 +50,6 @@
typedef struct _MetaStack MetaStack; typedef struct _MetaStack MetaStack;
typedef struct _MetaUISlave MetaUISlave; typedef struct _MetaUISlave MetaUISlave;
typedef struct _MetaGroupPropHooks MetaGroupPropHooks;
typedef struct _MetaWindowPropHooks MetaWindowPropHooks;
typedef struct MetaEdgeResistanceData MetaEdgeResistanceData; typedef struct MetaEdgeResistanceData MetaEdgeResistanceData;
typedef enum { typedef enum {
@ -235,17 +232,6 @@ struct _MetaDisplay
/* Closing down the display */ /* Closing down the display */
int closing; int closing;
/* Managed by group.c */
GHashTable *groups_by_leader;
/* Managed by window-props.c */
MetaWindowPropHooks *prop_hooks_table;
GHashTable *prop_hooks;
int n_prop_hooks;
/* Managed by group-props.c */
MetaGroupPropHooks *group_prop_hooks;
/* Managed by compositor.c */ /* Managed by compositor.c */
MetaCompositor *compositor; MetaCompositor *compositor;

View File

@ -72,8 +72,6 @@
#include "x11/events.h" #include "x11/events.h"
#include "x11/window-x11.h" #include "x11/window-x11.h"
#include "x11/window-props.h"
#include "x11/group-props.h"
#include "x11/xprops.h" #include "x11/xprops.h"
#include "x11/meta-x11-display-private.h" #include "x11/meta-x11-display-private.h"
@ -717,19 +715,12 @@ meta_display_open (void)
meta_bell_init (display); meta_bell_init (display);
display->prop_hooks = NULL;
meta_display_init_window_prop_hooks (display);
display->group_prop_hooks = NULL;
meta_display_init_group_prop_hooks (display);
/* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK, /* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK,
* created in screen_new * created in screen_new
*/ */
display->leader_window = None; display->leader_window = None;
display->timestamp_pinging_window = None; display->timestamp_pinging_window = None;
display->groups_by_leader = NULL;
meta_display_init_events_x11 (display); meta_display_init_events_x11 (display);
/* Create the leader window here. Set its properties and /* Create the leader window here. Set its properties and
@ -1020,9 +1011,6 @@ meta_display_close (MetaDisplay *display,
if (display->leader_window != None) if (display->leader_window != None)
XDestroyWindow (display->x11_display->xdisplay, display->leader_window); XDestroyWindow (display->x11_display->xdisplay, display->leader_window);
meta_display_free_window_prop_hooks (display);
meta_display_free_group_prop_hooks (display);
if (display->x11_display) if (display->x11_display)
{ {
g_signal_emit (display, display_signals[X11_DISPLAY_CLOSING], 0); g_signal_emit (display, display_signals[X11_DISPLAY_CLOSING], 0);

View File

@ -34,7 +34,7 @@ void meta_window_shutdown_group (MetaWindow *window);
void meta_window_group_leader_changed (MetaWindow *window); void meta_window_group_leader_changed (MetaWindow *window);
/* note, can return NULL */ /* note, can return NULL */
MetaGroup* meta_display_lookup_group (MetaDisplay *display, MetaGroup *meta_x11_display_lookup_group (MetaX11Display *x11_display,
Window group_leader); Window group_leader);
GSList* meta_group_list_windows (MetaGroup *group); GSList* meta_group_list_windows (MetaGroup *group);
@ -49,7 +49,3 @@ gboolean meta_group_property_notify (MetaGroup *group,
XEvent *event); XEvent *event);
#endif #endif

View File

@ -1480,7 +1480,7 @@ handle_other_xevent (MetaDisplay *display,
else if (property_for_window && !frame_was_receiver) else if (property_for_window && !frame_was_receiver)
meta_window_x11_property_notify (property_for_window, event); meta_window_x11_property_notify (property_for_window, event);
group = meta_display_lookup_group (display, group = meta_x11_display_lookup_group (x11_display,
event->xproperty.window); event->xproperty.window);
if (group != NULL) if (group != NULL)
meta_group_property_notify (group, event); meta_group_property_notify (group, event);

View File

@ -27,7 +27,7 @@
struct _MetaGroup struct _MetaGroup
{ {
int refcount; int refcount;
MetaDisplay *display; MetaX11Display *x11_display;
GSList *windows; GSList *windows;
Window group_leader; Window group_leader;
char *startup_id; char *startup_id;

View File

@ -26,7 +26,7 @@
#include "x11/meta-x11-display-private.h" #include "x11/meta-x11-display-private.h"
#include <X11/Xatom.h> #include <X11/Xatom.h>
typedef void (* InitValueFunc) (MetaDisplay *display, typedef void (* InitValueFunc) (MetaX11Display *x11_display,
Atom property, Atom property,
MetaPropValue *value); MetaPropValue *value);
typedef void (* ReloadValueFunc) (MetaGroup *group, typedef void (* ReloadValueFunc) (MetaGroup *group,
@ -39,16 +39,14 @@ struct _MetaGroupPropHooks
ReloadValueFunc reload_func; ReloadValueFunc reload_func;
}; };
static void init_prop_value (MetaDisplay *display, static void init_prop_value (MetaX11Display *x11_display,
Atom property, Atom property,
MetaPropValue *value); MetaPropValue *value);
static void reload_prop_value (MetaGroup *group, static void reload_prop_value (MetaGroup *group,
MetaPropValue *value); MetaPropValue *value);
static MetaGroupPropHooks* find_hooks (MetaDisplay *display, static MetaGroupPropHooks *find_hooks (MetaX11Display *x11_display,
Atom property); Atom property);
void void
meta_group_reload_property (MetaGroup *group, meta_group_reload_property (MetaGroup *group,
Atom property) Atom property)
@ -72,11 +70,12 @@ meta_group_reload_properties (MetaGroup *group,
i = 0; i = 0;
while (i < n_properties) while (i < n_properties)
{ {
init_prop_value (group->display, properties[i], &values[i]); init_prop_value (group->x11_display, properties[i], &values[i]);
++i; ++i;
} }
meta_prop_get_values (group->display, group->group_leader, meta_prop_get_values (group->x11_display->display,
group->group_leader,
values, n_properties); values, n_properties);
i = 0; i = 0;
@ -94,7 +93,7 @@ meta_group_reload_properties (MetaGroup *group,
/* Fill in the MetaPropValue used to get the value of "property" */ /* Fill in the MetaPropValue used to get the value of "property" */
static void static void
init_prop_value (MetaDisplay *display, init_prop_value (MetaX11Display *x11_display,
Atom property, Atom property,
MetaPropValue *value) MetaPropValue *value)
{ {
@ -103,9 +102,9 @@ init_prop_value (MetaDisplay *display,
value->type = META_PROP_VALUE_INVALID; value->type = META_PROP_VALUE_INVALID;
value->atom = None; value->atom = None;
hooks = find_hooks (display, property); hooks = find_hooks (x11_display, property);
if (hooks && hooks->init_func != NULL) if (hooks && hooks->init_func != NULL)
(* hooks->init_func) (display, property, value); (* hooks->init_func) (x11_display, property, value);
} }
static void static void
@ -114,18 +113,18 @@ reload_prop_value (MetaGroup *group,
{ {
MetaGroupPropHooks *hooks; MetaGroupPropHooks *hooks;
hooks = find_hooks (group->display, value->atom); hooks = find_hooks (group->x11_display, value->atom);
if (hooks && hooks->reload_func != NULL) if (hooks && hooks->reload_func != NULL)
(* hooks->reload_func) (group, value); (* hooks->reload_func) (group, value);
} }
static void static void
init_wm_client_machine (MetaDisplay *display, init_wm_client_machine (MetaX11Display *x11_display,
Atom property, Atom property,
MetaPropValue *value) MetaPropValue *value)
{ {
value->type = META_PROP_VALUE_STRING; value->type = META_PROP_VALUE_STRING;
value->atom = display->x11_display->atom_WM_CLIENT_MACHINE; value->atom = x11_display->atom_WM_CLIENT_MACHINE;
} }
static void static void
@ -143,12 +142,12 @@ reload_wm_client_machine (MetaGroup *group,
} }
static void static void
init_net_startup_id (MetaDisplay *display, init_net_startup_id (MetaX11Display *x11_display,
Atom property, Atom property,
MetaPropValue *value) MetaPropValue *value)
{ {
value->type = META_PROP_VALUE_UTF8; value->type = META_PROP_VALUE_UTF8;
value->atom = display->x11_display->atom__NET_STARTUP_ID; value->atom = x11_display->atom__NET_STARTUP_ID;
} }
static void static void
@ -168,29 +167,29 @@ reload_net_startup_id (MetaGroup *group,
#define N_HOOKS 3 #define N_HOOKS 3
void void
meta_display_init_group_prop_hooks (MetaDisplay *display) meta_x11_display_init_group_prop_hooks (MetaX11Display *x11_display)
{ {
int i; int i;
MetaGroupPropHooks *hooks; MetaGroupPropHooks *hooks;
g_assert (display->group_prop_hooks == NULL); g_assert (x11_display->group_prop_hooks == NULL);
display->group_prop_hooks = g_new0 (MetaGroupPropHooks, N_HOOKS); x11_display->group_prop_hooks = g_new0 (MetaGroupPropHooks, N_HOOKS);
hooks = display->group_prop_hooks; hooks = x11_display->group_prop_hooks;
i = 0; i = 0;
hooks[i].property = display->x11_display->atom_WM_CLIENT_MACHINE; hooks[i].property = x11_display->atom_WM_CLIENT_MACHINE;
hooks[i].init_func = init_wm_client_machine; hooks[i].init_func = init_wm_client_machine;
hooks[i].reload_func = reload_wm_client_machine; hooks[i].reload_func = reload_wm_client_machine;
++i; ++i;
hooks[i].property = display->x11_display->atom__NET_WM_PID; hooks[i].property = x11_display->atom__NET_WM_PID;
hooks[i].init_func = NULL; hooks[i].init_func = NULL;
hooks[i].reload_func = NULL; hooks[i].reload_func = NULL;
++i; ++i;
hooks[i].property = display->x11_display->atom__NET_STARTUP_ID; hooks[i].property = x11_display->atom__NET_STARTUP_ID;
hooks[i].init_func = init_net_startup_id; hooks[i].init_func = init_net_startup_id;
hooks[i].reload_func = reload_net_startup_id; hooks[i].reload_func = reload_net_startup_id;
++i; ++i;
@ -202,16 +201,16 @@ meta_display_init_group_prop_hooks (MetaDisplay *display)
} }
void void
meta_display_free_group_prop_hooks (MetaDisplay *display) meta_x11_display_free_group_prop_hooks (MetaX11Display *x11_display)
{ {
g_assert (display->group_prop_hooks != NULL); g_assert (x11_display->group_prop_hooks != NULL);
g_free (display->group_prop_hooks); g_free (x11_display->group_prop_hooks);
display->group_prop_hooks = NULL; x11_display->group_prop_hooks = NULL;
} }
static MetaGroupPropHooks* static MetaGroupPropHooks*
find_hooks (MetaDisplay *display, find_hooks (MetaX11Display *x11_display,
Atom property) Atom property)
{ {
int i; int i;
@ -223,8 +222,8 @@ find_hooks (MetaDisplay *display,
i = 0; i = 0;
while (i < N_HOOKS) while (i < N_HOOKS)
{ {
if (display->group_prop_hooks[i].property == property) if (x11_display->group_prop_hooks[i].property == property)
return &display->group_prop_hooks[i]; return &x11_display->group_prop_hooks[i];
++i; ++i;
} }

View File

@ -30,7 +30,8 @@ void meta_group_reload_property (MetaGroup *group,
void meta_group_reload_properties (MetaGroup *group, void meta_group_reload_properties (MetaGroup *group,
const Atom *properties, const Atom *properties,
int n_properties); int n_properties);
void meta_display_init_group_prop_hooks (MetaDisplay *display);
void meta_display_free_group_prop_hooks (MetaDisplay *display); void meta_x11_display_init_group_prop_hooks (MetaX11Display *x11_display);
void meta_x11_display_free_group_prop_hooks (MetaX11Display *x11_display);
#endif /* META_GROUP_PROPS_H */ #endif /* META_GROUP_PROPS_H */

View File

@ -35,7 +35,7 @@
#include <X11/Xlib-xcb.h> #include <X11/Xlib-xcb.h>
static MetaGroup* static MetaGroup*
meta_group_new (MetaDisplay *display, meta_group_new (MetaX11Display *x11_display,
Window group_leader) Window group_leader)
{ {
MetaGroup *group; MetaGroup *group;
@ -47,12 +47,12 @@ meta_group_new (MetaDisplay *display,
group = g_new0 (MetaGroup, 1); group = g_new0 (MetaGroup, 1);
group->display = display; group->x11_display = x11_display;
group->windows = NULL; group->windows = NULL;
group->group_leader = group_leader; group->group_leader = group_leader;
group->refcount = 1; /* owned by caller, hash table has only weak ref */ group->refcount = 1; /* owned by caller, hash table has only weak ref */
xcb_connection_t *xcb_conn = XGetXCBConnection (display->x11_display->xdisplay); xcb_connection_t *xcb_conn = XGetXCBConnection (x11_display->xdisplay);
xcb_generic_error_t *e; xcb_generic_error_t *e;
g_autofree xcb_get_window_attributes_reply_t *attrs = g_autofree xcb_get_window_attributes_reply_t *attrs =
xcb_get_window_attributes_reply (xcb_conn, xcb_get_window_attributes_reply (xcb_conn,
@ -65,21 +65,21 @@ meta_group_new (MetaDisplay *display,
xcb_change_window_attributes (xcb_conn, group_leader, xcb_change_window_attributes (xcb_conn, group_leader,
XCB_CW_EVENT_MASK, events); XCB_CW_EVENT_MASK, events);
if (display->groups_by_leader == NULL) if (x11_display->groups_by_leader == NULL)
display->groups_by_leader = g_hash_table_new (meta_unsigned_long_hash, x11_display->groups_by_leader = g_hash_table_new (meta_unsigned_long_hash,
meta_unsigned_long_equal); meta_unsigned_long_equal);
g_assert (g_hash_table_lookup (display->groups_by_leader, &group_leader) == NULL); g_assert (g_hash_table_lookup (x11_display->groups_by_leader, &group_leader) == NULL);
g_hash_table_insert (display->groups_by_leader, g_hash_table_insert (x11_display->groups_by_leader,
&group->group_leader, &group->group_leader,
group); group);
/* Fill these in the order we want them to be gotten */ /* Fill these in the order we want them to be gotten */
i = 0; i = 0;
initial_props[i++] = display->x11_display->atom_WM_CLIENT_MACHINE; initial_props[i++] = x11_display->atom_WM_CLIENT_MACHINE;
initial_props[i++] = display->x11_display->atom__NET_WM_PID; initial_props[i++] = x11_display->atom__NET_WM_PID;
initial_props[i++] = display->x11_display->atom__NET_STARTUP_ID; initial_props[i++] = x11_display->atom__NET_STARTUP_ID;
g_assert (N_INITIAL_PROPS == i); g_assert (N_INITIAL_PROPS == i);
meta_group_reload_properties (group, initial_props, N_INITIAL_PROPS); meta_group_reload_properties (group, initial_props, N_INITIAL_PROPS);
@ -103,16 +103,16 @@ meta_group_unref (MetaGroup *group)
"Destroying group with leader 0x%lx\n", "Destroying group with leader 0x%lx\n",
group->group_leader); group->group_leader);
g_assert (group->display->groups_by_leader != NULL); g_assert (group->x11_display->groups_by_leader != NULL);
g_hash_table_remove (group->display->groups_by_leader, g_hash_table_remove (group->x11_display->groups_by_leader,
&group->group_leader); &group->group_leader);
/* mop up hash table, this is how it gets freed on display close */ /* mop up hash table, this is how it gets freed on display close */
if (g_hash_table_size (group->display->groups_by_leader) == 0) if (g_hash_table_size (group->x11_display->groups_by_leader) == 0)
{ {
g_hash_table_destroy (group->display->groups_by_leader); g_hash_table_destroy (group->x11_display->groups_by_leader);
group->display->groups_by_leader = NULL; group->x11_display->groups_by_leader = NULL;
} }
g_free (group->wm_client_machine); g_free (group->wm_client_machine);
@ -141,6 +141,7 @@ meta_window_compute_group (MetaWindow* window)
{ {
MetaGroup *group; MetaGroup *group;
MetaWindow *ancestor; MetaWindow *ancestor;
MetaX11Display *x11_display = window->display->x11_display;
/* use window->xwindow if no window->xgroup_leader */ /* use window->xwindow if no window->xgroup_leader */
@ -151,15 +152,15 @@ meta_window_compute_group (MetaWindow* window)
*/ */
ancestor = meta_window_find_root_ancestor (window); ancestor = meta_window_find_root_ancestor (window);
if (window->display->groups_by_leader) if (x11_display->groups_by_leader)
{ {
if (ancestor != window) if (ancestor != window)
group = ancestor->group; group = ancestor->group;
else if (window->xgroup_leader != None) else if (window->xgroup_leader != None)
group = g_hash_table_lookup (window->display->groups_by_leader, group = g_hash_table_lookup (x11_display->groups_by_leader,
&window->xgroup_leader); &window->xgroup_leader);
else else
group = g_hash_table_lookup (window->display->groups_by_leader, group = g_hash_table_lookup (x11_display->groups_by_leader,
&window->xwindow); &window->xwindow);
} }
@ -171,13 +172,13 @@ meta_window_compute_group (MetaWindow* window)
else else
{ {
if (ancestor != window && ancestor->xgroup_leader != None) if (ancestor != window && ancestor->xgroup_leader != None)
group = meta_group_new (window->display, group = meta_group_new (x11_display,
ancestor->xgroup_leader); ancestor->xgroup_leader);
else if (window->xgroup_leader != None) else if (window->xgroup_leader != None)
group = meta_group_new (window->display, group = meta_group_new (x11_display,
window->xgroup_leader); window->xgroup_leader);
else else
group = meta_group_new (window->display, group = meta_group_new (x11_display,
window->xwindow); window->xwindow);
window->group = group; window->group = group;
@ -224,21 +225,21 @@ meta_window_shutdown_group (MetaWindow *window)
} }
/** /**
* meta_display_lookup_group: (skip) * meta_x11_display_lookup_group: (skip)
* @display: a #MetaDisplay * @x11_display: a #MetaX11Display
* @group_leader: a X window * @group_leader: a X window
* *
*/ */
MetaGroup * MetaGroup *
meta_display_lookup_group (MetaDisplay *display, meta_x11_display_lookup_group (MetaX11Display *x11_display,
Window group_leader) Window group_leader)
{ {
MetaGroup *group; MetaGroup *group;
group = NULL; group = NULL;
if (display->groups_by_leader) if (x11_display->groups_by_leader)
group = g_hash_table_lookup (display->groups_by_leader, group = g_hash_table_lookup (x11_display->groups_by_leader,
&group_leader); &group_leader);
return group; return group;

View File

@ -33,6 +33,9 @@
#include "meta/types.h" #include "meta/types.h"
#include "meta/meta-x11-display.h" #include "meta/meta-x11-display.h"
typedef struct _MetaGroupPropHooks MetaGroupPropHooks;
typedef struct _MetaWindowPropHooks MetaWindowPropHooks;
typedef gboolean (*MetaAlarmFilter) (MetaX11Display *x11_display, typedef gboolean (*MetaAlarmFilter) (MetaX11Display *x11_display,
XSyncAlarmNotifyEvent *event, XSyncAlarmNotifyEvent *event,
gpointer data); gpointer data);
@ -60,6 +63,17 @@ struct _MetaX11Display
GHashTable *xids; GHashTable *xids;
/* Managed by group.c */
GHashTable *groups_by_leader;
/* Managed by window-props.c */
MetaWindowPropHooks *prop_hooks_table;
GHashTable *prop_hooks;
int n_prop_hooks;
/* Managed by group-props.c */
MetaGroupPropHooks *group_prop_hooks;
MetaAlarmFilter alarm_filter; MetaAlarmFilter alarm_filter;
gpointer alarm_filter_data; gpointer alarm_filter_data;

View File

@ -52,6 +52,9 @@
#include "core/util-private.h" #include "core/util-private.h"
#include "meta/errors.h" #include "meta/errors.h"
#include "x11/group-props.h"
#include "x11/window-props.h"
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
#include "wayland/meta-xwayland-private.h" #include "wayland/meta-xwayland-private.h"
#endif #endif
@ -68,6 +71,18 @@ meta_x11_display_dispose (GObject *object)
{ {
MetaX11Display *x11_display = META_X11_DISPLAY (object); MetaX11Display *x11_display = META_X11_DISPLAY (object);
if (x11_display->prop_hooks)
{
meta_x11_display_free_window_prop_hooks (x11_display);
x11_display->prop_hooks = NULL;
}
if (x11_display->group_prop_hooks)
{
meta_x11_display_free_group_prop_hooks (x11_display);
x11_display->group_prop_hooks = NULL;
}
if (x11_display->xids) if (x11_display->xids)
{ {
/* Must be after all calls to meta_window_unmanage() since they /* Must be after all calls to meta_window_unmanage() since they
@ -409,6 +424,13 @@ meta_x11_display_new (MetaDisplay *display, GError **error)
x11_display->xids = g_hash_table_new (meta_unsigned_long_hash, x11_display->xids = g_hash_table_new (meta_unsigned_long_hash,
meta_unsigned_long_equal); meta_unsigned_long_equal);
x11_display->groups_by_leader = NULL;
x11_display->prop_hooks = NULL;
meta_x11_display_init_window_prop_hooks (x11_display);
x11_display->group_prop_hooks = NULL;
meta_x11_display_init_group_prop_hooks (x11_display);
return x11_display; return x11_display;
} }

View File

@ -82,7 +82,7 @@ static void reload_prop_value (MetaWindow *window,
MetaWindowPropHooks *hooks, MetaWindowPropHooks *hooks,
MetaPropValue *value, MetaPropValue *value,
gboolean initial); gboolean initial);
static MetaWindowPropHooks* find_hooks (MetaDisplay *display, static MetaWindowPropHooks *find_hooks (MetaX11Display *x11_display,
Atom property); Atom property);
@ -95,7 +95,7 @@ meta_window_reload_property_from_xwindow (MetaWindow *window,
MetaPropValue value = { 0, }; MetaPropValue value = { 0, };
MetaWindowPropHooks *hooks; MetaWindowPropHooks *hooks;
hooks = find_hooks (window->display, property); hooks = find_hooks (window->display->x11_display, property);
if (!hooks) if (!hooks)
return; return;
@ -130,13 +130,14 @@ meta_window_load_initial_properties (MetaWindow *window)
int i, j; int i, j;
MetaPropValue *values; MetaPropValue *values;
int n_properties = 0; int n_properties = 0;
MetaX11Display *x11_display = window->display->x11_display;
values = g_new0 (MetaPropValue, window->display->n_prop_hooks); values = g_new0 (MetaPropValue, x11_display->n_prop_hooks);
j = 0; j = 0;
for (i = 0; i < window->display->n_prop_hooks; i++) for (i = 0; i < x11_display->n_prop_hooks; i++)
{ {
MetaWindowPropHooks *hooks = &window->display->prop_hooks_table[i]; MetaWindowPropHooks *hooks = &x11_display->prop_hooks_table[i];
if (hooks->flags & LOAD_INIT) if (hooks->flags & LOAD_INIT)
{ {
init_prop_value (window, hooks, &values[j]); init_prop_value (window, hooks, &values[j]);
@ -149,9 +150,9 @@ meta_window_load_initial_properties (MetaWindow *window)
values, n_properties); values, n_properties);
j = 0; j = 0;
for (i = 0; i < window->display->n_prop_hooks; i++) for (i = 0; i < x11_display->n_prop_hooks; i++)
{ {
MetaWindowPropHooks *hooks = &window->display->prop_hooks_table[i]; MetaWindowPropHooks *hooks = &x11_display->prop_hooks_table[i];
if (hooks->flags & LOAD_INIT) if (hooks->flags & LOAD_INIT)
{ {
/* If we didn't actually manage to load anything then we don't need /* If we didn't actually manage to load anything then we don't need
@ -1799,8 +1800,8 @@ RELOAD_STRING (gtk_menubar_object_path, "gtk-menubar-object-path")
#undef RELOAD_STRING #undef RELOAD_STRING
/** /**
* meta_display_init_window_prop_hooks: * meta_x11_display_init_window_prop_hooks:
* @display: The #MetaDisplay * @x11_display: The #MetaDX11isplay
* *
* Initialises the property hooks system. Each row in the table named "hooks" * Initialises the property hooks system. Each row in the table named "hooks"
* represents an action to take when a property is found on a newly-created * represents an action to take when a property is found on a newly-created
@ -1816,9 +1817,8 @@ RELOAD_STRING (gtk_menubar_object_path, "gtk-menubar-object-path")
* This value may be NULL, in which case no callback will be called. * This value may be NULL, in which case no callback will be called.
*/ */
void void
meta_display_init_window_prop_hooks (MetaDisplay *display) meta_x11_display_init_window_prop_hooks (MetaX11Display *x11_display)
{ {
MetaX11Display *x11_display = display->x11_display;
/* The ordering here is significant for the properties we load /* The ordering here is significant for the properties we load
* initially: they are roughly ordered in the order we want them to * initially: they are roughly ordered in the order we want them to
* be gotten. We want to get window name and class first so we can * be gotten. We want to get window name and class first so we can
@ -1877,10 +1877,10 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
MetaWindowPropHooks *table = g_memdup (hooks, sizeof (hooks)), MetaWindowPropHooks *table = g_memdup (hooks, sizeof (hooks)),
*cursor = table; *cursor = table;
g_assert (display->prop_hooks == NULL); g_assert (x11_display->prop_hooks == NULL);
display->prop_hooks_table = (gpointer) table; x11_display->prop_hooks_table = (gpointer) table;
display->prop_hooks = g_hash_table_new (NULL, NULL); x11_display->prop_hooks = g_hash_table_new (NULL, NULL);
while (cursor->property) while (cursor->property)
{ {
@ -1894,28 +1894,28 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
* anything 32 bits or less, and atoms are 32 bits with the top three * anything 32 bits or less, and atoms are 32 bits with the top three
* bits clear. (Scheifler & Gettys, 2e, p372) * bits clear. (Scheifler & Gettys, 2e, p372)
*/ */
g_hash_table_insert (display->prop_hooks, g_hash_table_insert (x11_display->prop_hooks,
GINT_TO_POINTER (cursor->property), GINT_TO_POINTER (cursor->property),
cursor); cursor);
cursor++; cursor++;
} }
display->n_prop_hooks = cursor - table; x11_display->n_prop_hooks = cursor - table;
} }
void void
meta_display_free_window_prop_hooks (MetaDisplay *display) meta_x11_display_free_window_prop_hooks (MetaX11Display *x11_display)
{ {
g_hash_table_unref (display->prop_hooks); g_hash_table_unref (x11_display->prop_hooks);
display->prop_hooks = NULL; x11_display->prop_hooks = NULL;
g_free (display->prop_hooks_table); g_free (x11_display->prop_hooks_table);
display->prop_hooks_table = NULL; x11_display->prop_hooks_table = NULL;
} }
static MetaWindowPropHooks * static MetaWindowPropHooks *
find_hooks (MetaDisplay *display, find_hooks (MetaX11Display *x11_display,
Atom property) Atom property)
{ {
return g_hash_table_lookup (display->prop_hooks, return g_hash_table_lookup (x11_display->prop_hooks,
GINT_TO_POINTER (property)); GINT_TO_POINTER (property));
} }

View File

@ -60,22 +60,22 @@ void meta_window_reload_property_from_xwindow (MetaWindow *window,
void meta_window_load_initial_properties (MetaWindow *window); void meta_window_load_initial_properties (MetaWindow *window);
/** /**
* meta_display_init_window_prop_hooks: * meta_x11_display_init_window_prop_hooks:
* @display: The display. * @x11_display: The X11 display.
* *
* Initialises the hooks used for the reload_propert* functions * Initialises the hooks used for the reload_propert* functions
* on a particular display, and stores a pointer to them in the * on a particular display, and stores a pointer to them in the
* display. * x11_display.
*/ */
void meta_display_init_window_prop_hooks (MetaDisplay *display); void meta_x11_display_init_window_prop_hooks (MetaX11Display *x11_display);
/** /**
* meta_display_free_window_prop_hooks: * meta_x11_display_free_window_prop_hooks:
* @display: The display. * @x11_display: The X11 display.
* Frees the hooks used for the reload_propert* functions * Frees the hooks used for the reload_propert* functions
* for a particular display. * for a particular display.
*/ */
void meta_display_free_window_prop_hooks (MetaDisplay *display); void meta_x11_display_free_window_prop_hooks (MetaX11Display *x11_display);
/** /**
* meta_set_normal_hints: * meta_set_normal_hints: