property: macrotify a bunch of handling functions

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-24 11:22:28 +02:00
parent 06155cf621
commit 271063cc34
1 changed files with 26 additions and 136 deletions

View File

@ -72,6 +72,32 @@ HANDLE_TEXT_PROPERTY(wm_window_role, WM_WINDOW_ROLE, client_set_role)
#undef HANDLE_TEXT_PROPERTY
#define HANDLE_PROPERTY(name) \
static int \
property_handle_##name(void *data, \
xcb_connection_t *connection, \
uint8_t state, \
xcb_window_t window, \
xcb_atom_t name, \
xcb_get_property_reply_t *reply) \
{ \
client_t *c = client_getbywin(window); \
if(c) \
property_update_##name(c, reply); \
return 0; \
}
HANDLE_PROPERTY(wm_protocols)
HANDLE_PROPERTY(wm_transient_for)
HANDLE_PROPERTY(wm_client_leader)
HANDLE_PROPERTY(wm_normal_hints)
HANDLE_PROPERTY(wm_hints)
HANDLE_PROPERTY(wm_class)
HANDLE_PROPERTY(net_wm_icon)
HANDLE_PROPERTY(net_wm_pid)
#undef HANDLE_PROPERTY
void
property_update_wm_transient_for(client_t *c, xcb_get_property_reply_t *reply)
{
@ -98,22 +124,6 @@ property_update_wm_transient_for(client_t *c, xcb_get_property_reply_t *reply)
lua_pop(globalconf.L, 1);
}
static int
property_handle_wm_transient_for(void *data,
xcb_connection_t *connection,
uint8_t state,
xcb_window_t window,
xcb_atom_t name,
xcb_get_property_reply_t *reply)
{
client_t *c = client_getbywin(window);
if(c)
property_update_wm_transient_for(c, reply);
return 0;
}
/** Update leader hint of a client.
* \param c The client.
* \param reply (Optional) An existing reply.
@ -141,22 +151,6 @@ property_update_wm_client_leader(client_t *c, xcb_get_property_reply_t *reply)
p_delete(&reply);
}
static int
property_handle_wm_client_leader(void *data,
xcb_connection_t *connection,
uint8_t state,
xcb_window_t window,
xcb_atom_t name,
xcb_get_property_reply_t *reply)
{
client_t *c = client_getbywin(window);
if(c)
property_update_wm_client_leader(c, reply);
return 0;
}
/** Update the size hints of a client.
* \param c The client.
* \param reply (Optional) An existing reply.
@ -179,22 +173,6 @@ property_update_wm_normal_hints(client_t *c, xcb_get_property_reply_t *reply)
}
}
static int
property_handle_wm_normal_hints(void *data,
xcb_connection_t *connection,
uint8_t state,
xcb_window_t window,
xcb_atom_t name,
xcb_get_property_reply_t *reply)
{
client_t *c = client_getbywin(window);
if(c)
property_update_wm_normal_hints(c, reply);
return 0;
}
/** Update the WM hints of a client.
* \param c The client.
* \param reply (Optional) An existing reply.
@ -230,22 +208,6 @@ property_update_wm_hints(client_t *c, xcb_get_property_reply_t *reply)
client_set_group_window(globalconf.L, -1, wmh.window_group);
}
static int
property_handle_wm_hints(void *data,
xcb_connection_t *connection,
uint8_t state,
xcb_window_t window,
xcb_atom_t name,
xcb_get_property_reply_t *reply)
{
client_t *c = client_getbywin(window);
if(c)
property_update_wm_hints(c, reply);
return 0;
}
/** Update WM_CLASS of a client.
* \param c The client.
* \param reply The reply to get property request, or NULL if none.
@ -277,22 +239,6 @@ property_update_wm_class(client_t *c, xcb_get_property_reply_t *reply)
xcb_get_wm_class_reply_wipe(&hint);
}
static int
property_handle_wm_class(void *data,
xcb_connection_t *connection,
uint8_t state,
xcb_window_t window,
xcb_atom_t name,
xcb_get_property_reply_t *reply)
{
client_t *c = client_getbywin(window);
if(c)
property_update_wm_class(c, reply);
return 0;
}
static int
property_handle_net_wm_strut_partial(void *data,
xcb_connection_t *connection,
@ -327,22 +273,6 @@ property_update_net_wm_icon(client_t *c,
lua_pop(globalconf.L, 1);
}
static int
property_handle_net_wm_icon(void *data,
xcb_connection_t *connection,
uint8_t state,
xcb_window_t window,
xcb_atom_t name,
xcb_get_property_reply_t *reply)
{
client_t *c = client_getbywin(window);
if(c)
property_update_net_wm_icon(c, reply);
return 0;
}
void
property_update_net_wm_pid(client_t *c,
xcb_get_property_reply_t *reply)
@ -371,22 +301,6 @@ property_update_net_wm_pid(client_t *c,
p_delete(&reply);
}
static int
property_handle_net_wm_pid(void *data,
xcb_connection_t *connection,
uint8_t state,
xcb_window_t window,
xcb_atom_t name,
xcb_get_property_reply_t *reply)
{
client_t *c = client_getbywin(window);
if(c)
property_update_net_wm_pid(c, reply);
return 0;
}
/** Update the list of supported protocols for a client.
* \param c The client.
*/
@ -414,30 +328,6 @@ property_update_wm_protocols(client_t *c, xcb_get_property_reply_t *reply)
memcpy(&c->protocols, &protocols, sizeof(protocols));
}
/** The property notify event handler.
* \param data currently unused.
* \param connection currently unusued.
* \param state currently unused.
* \param window The window to obtain update protocols from.
* \param name currently unused.
* \param reply currently unused.
*/
static int
property_handle_wm_protocols(void *data,
xcb_connection_t *connection,
uint8_t state,
xcb_window_t window,
xcb_atom_t name,
xcb_get_property_reply_t *reply)
{
client_t *c = client_getbywin(window);
if(c)
property_update_wm_protocols(c, reply);
return 0;
}
/** The property notify event handler.
* \param data currently unused.
* \param connection The connection to the X server.