All the window properties are now handled using simple

        window property handlers.  Closes #549886.
	* src/core/window-private.h:
	* src/core/window-props.c:
	* src/core/window.c:


svn path=/trunk/; revision=4090
parent 8cbcbb06
2009-01-27 Thomas Thurman <tthurman@gnome.org>
All the window properties are now handled using simple
window property handlers. Closes #549886.
* src/core/window-private.h:
* src/core/window-props.c:
* src/core/window.c:
2009-01-26 Thomas Thurman <tthurman@gnome.org>
More of the window properties are checked using simple
......
......@@ -629,4 +629,7 @@ void meta_window_unset_demands_attention (MetaWindow *window);
void meta_window_update_icon_now (MetaWindow *window);
void meta_window_update_role (MetaWindow *window);
void meta_window_update_net_wm_type (MetaWindow *window);
#endif
......@@ -195,6 +195,65 @@ reload_wm_client_machine (MetaWindow *window,
window->wm_client_machine ? window->wm_client_machine : "unset");
}
static void
complain_about_broken_client (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
meta_warning ("Broken client! Window %s changed client leader window or SM client ID\n",
window->desc);
}
static void
reload_net_wm_window_type (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
meta_window_update_net_wm_type (window);
}
static void
reload_icon (MetaWindow *window,
Atom atom)
{
meta_icon_cache_property_changed (&window->icon_cache,
window->display,
atom);
meta_window_queue(window, META_QUEUE_UPDATE_ICON);
}
static void
reload_net_wm_icon (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
reload_icon (window, window->display->atom__NET_WM_ICON);
}
static void
reload_kwm_win_icon (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
reload_icon (window, window->display->atom__KWM_WIN_ICON);
}
static void
reload_struts (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
meta_window_update_struts (window);
}
static void
reload_wm_window_role (MetaWindow *window,
MetaPropValue *value,
gboolean initial)
{
meta_window_update_role (window);
}
static void
init_net_wm_pid (MetaDisplay *display,
Atom property,
......@@ -565,6 +624,13 @@ reload_net_wm_state (MetaWindow *window,
* clients don't change the property.
*/
if (!initial) {
/* no, they DON'T change the property */
meta_verbose ("Ignoring _NET_WM_STATE: we should be the one who set "
"the property in the first place\n");
return;
}
window->shaded = FALSE;
window->maximized_horizontally = FALSE;
window->maximized_vertically = FALSE;
......@@ -1488,7 +1554,7 @@ reload_transient_for (MetaWindow *window,
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
}
#define N_HOOKS 26
#define N_HOOKS 28
void
meta_display_init_window_prop_hooks (MetaDisplay *display)
......@@ -1533,6 +1599,16 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
hooks[i].reload_func = reload_wm_name;
++i;
hooks[i].property = display->atom__NET_WM_ICON;
hooks[i].init_func = NULL;
hooks[i].reload_func = reload_net_wm_icon;
++i;
hooks[i].property = display->atom__KWM_WIN_ICON;
hooks[i].init_func = NULL;
hooks[i].reload_func = reload_kwm_win_icon;
++i;
hooks[i].property = display->atom__NET_WM_ICON_NAME;
hooks[i].init_func = init_net_wm_icon_name;
hooks[i].reload_func = reload_net_wm_icon_name;
......@@ -1565,22 +1641,22 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
hooks[i].property = display->atom_WM_CLIENT_LEADER;
hooks[i].init_func = NULL;
hooks[i].reload_func = NULL;
hooks[i].reload_func = complain_about_broken_client;
++i;
hooks[i].property = display->atom_SM_CLIENT_ID;
hooks[i].init_func = NULL;
hooks[i].reload_func = NULL;
hooks[i].reload_func = complain_about_broken_client;
++i;
hooks[i].property = display->atom_WM_WINDOW_ROLE;
hooks[i].init_func = NULL;
hooks[i].reload_func = NULL;
hooks[i].reload_func = reload_wm_window_role;
++i;
hooks[i].property = display->atom__NET_WM_WINDOW_TYPE;
hooks[i].init_func = NULL;
hooks[i].reload_func = NULL;
hooks[i].reload_func = reload_net_wm_window_type;
++i;
hooks[i].property = display->atom__NET_WM_DESKTOP;
......@@ -1590,12 +1666,12 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
hooks[i].property = display->atom__NET_WM_STRUT;
hooks[i].init_func = NULL;
hooks[i].reload_func = NULL;
hooks[i].reload_func = reload_struts;
++i;
hooks[i].property = display->atom__NET_WM_STRUT_PARTIAL;
hooks[i].init_func = NULL;
hooks[i].reload_func = NULL;
hooks[i].reload_func = reload_struts;
++i;
hooks[i].property = display->atom__NET_STARTUP_ID;
......
......@@ -57,8 +57,6 @@ static int destroying_windows_disallowed = 0;
static void update_sm_hints (MetaWindow *window);
static void update_role (MetaWindow *window);
static void update_net_wm_type (MetaWindow *window);
static void update_net_frame_extents (MetaWindow *window);
static void recalc_window_type (MetaWindow *window);
static void recalc_window_features (MetaWindow *window);
......@@ -598,8 +596,8 @@ meta_window_new_with_attrs (MetaDisplay *display,
meta_window_reload_properties (window, initial_props, N_INITIAL_PROPS, TRUE);
update_sm_hints (window); /* must come after transient_for */
update_role (window);
update_net_wm_type (window);
meta_window_update_role (window);
meta_window_update_net_wm_type (window);
meta_window_update_icon_now (window);
if (window->initially_iconic)
......@@ -5431,11 +5429,7 @@ static gboolean
process_property_notify (MetaWindow *window,
XPropertyEvent *event)
{
/* Property notifies we want to use.
* FIXME once we move entirely to the window-props.h framework, we
* can just call reload on the property in the event and get rid of
* this if-else chain.
*/
Window xid = window->xwindow;
if (meta_is_verbose ()) /* avoid looking up the name if we don't have to */
{
......@@ -5447,62 +5441,13 @@ process_property_notify (MetaWindow *window,
XFree (property_name);
}
if (event->atom == window->display->atom_WM_WINDOW_ROLE)
{
update_role (window);
}
else if (event->atom ==
window->display->atom_WM_CLIENT_LEADER ||
event->atom ==
window->display->atom_SM_CLIENT_ID)
{
meta_warning ("Broken client! Window %s changed client leader window or SM client ID\n", window->desc);
}
else if (event->atom ==
window->display->atom__NET_WM_STATE)
{
meta_verbose ("Ignoring _NET_WM_STATE: we should be the one who set the property in the first place\n");
}
else if (event->atom ==
window->display->atom__NET_WM_WINDOW_TYPE)
{
update_net_wm_type (window);
}
else if (event->atom == window->display->atom__NET_WM_ICON)
{
meta_icon_cache_property_changed (&window->icon_cache,
window->display,
event->atom);
meta_window_queue(window, META_QUEUE_UPDATE_ICON);
}
else if (event->atom == window->display->atom__KWM_WIN_ICON)
if (event->atom == window->display->atom__NET_WM_USER_TIME &&
window->user_time_window)
{
meta_icon_cache_property_changed (&window->icon_cache,
window->display,
event->atom);
meta_window_queue(window, META_QUEUE_UPDATE_ICON);
xid = window->user_time_window;
}
else if ((event->atom == window->display->atom__NET_WM_STRUT) ||
(event->atom == window->display->atom__NET_WM_STRUT_PARTIAL))
{
meta_window_update_struts (window);
}
else if (event->atom == window->display->atom__NET_WM_USER_TIME)
{
Window xid;
Atom atom__NET_WM_USER_TIME;
atom__NET_WM_USER_TIME = window->display->atom__NET_WM_USER_TIME;
if (window->user_time_window)
xid = window->user_time_window;
else
xid = window->xwindow;
meta_window_reload_property_from_xwindow (window,
xid,
atom__NET_WM_USER_TIME, FALSE);
}
else
meta_window_reload_property (window, event->atom, FALSE);
meta_window_reload_property (window, event->atom, FALSE);
return TRUE;
}
......@@ -5692,8 +5637,8 @@ update_sm_hints (MetaWindow *window)
window->sm_client_id ? window->sm_client_id : "none");
}
static void
update_role (MetaWindow *window)
void
meta_window_update_role (MetaWindow *window)
{
char *str;
......@@ -5713,8 +5658,8 @@ update_role (MetaWindow *window)
window->desc, window->role ? window->role : "null");
}
static void
update_net_wm_type (MetaWindow *window)
void
meta_window_update_net_wm_type (MetaWindow *window)
{
int n_atoms;
Atom *atoms;
......@@ -5771,7 +5716,7 @@ update_net_wm_type (MetaWindow *window)
meta_XFree (str);
}
recalc_window_type (window);
meta_window_recalc_window_type (window);
}
static void
......
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