handlers.c: remove unused arguments from cb_property_handler_t
Also, use `conn` global variable instead of passing it as an argument.
This commit is contained in:
parent
6e24e2ad6f
commit
148ff54f18
|
@ -558,8 +558,7 @@ static bool window_name_changed(i3Window *window, char *old_name) {
|
||||||
* Called when a window changes its title
|
* Called when a window changes its title
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static bool handle_windowname_change(void *data, xcb_connection_t *conn, uint8_t state,
|
static bool handle_windowname_change(xcb_window_t window, xcb_get_property_reply_t *prop) {
|
||||||
xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *prop) {
|
|
||||||
Con *con;
|
Con *con;
|
||||||
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
@ -585,8 +584,7 @@ static bool handle_windowname_change(void *data, xcb_connection_t *conn, uint8_t
|
||||||
* window_update_name_legacy().
|
* window_update_name_legacy().
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static bool handle_windowname_change_legacy(void *data, xcb_connection_t *conn, uint8_t state,
|
static bool handle_windowname_change_legacy(xcb_window_t window, xcb_get_property_reply_t *prop) {
|
||||||
xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *prop) {
|
|
||||||
Con *con;
|
Con *con;
|
||||||
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
@ -611,8 +609,7 @@ static bool handle_windowname_change_legacy(void *data, xcb_connection_t *conn,
|
||||||
* Called when a window changes its WM_WINDOW_ROLE.
|
* Called when a window changes its WM_WINDOW_ROLE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static bool handle_windowrole_change(void *data, xcb_connection_t *conn, uint8_t state,
|
static bool handle_windowrole_change(xcb_window_t window, xcb_get_property_reply_t *prop) {
|
||||||
xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *prop) {
|
|
||||||
Con *con;
|
Con *con;
|
||||||
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
@ -956,8 +953,7 @@ static void handle_client_message(xcb_client_message_event_t *event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool handle_window_type(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window,
|
static bool handle_window_type(xcb_window_t window, xcb_get_property_reply_t *reply) {
|
||||||
xcb_atom_t atom, xcb_get_property_reply_t *reply) {
|
|
||||||
Con *con;
|
Con *con;
|
||||||
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
@ -973,8 +969,7 @@ static bool handle_window_type(void *data, xcb_connection_t *conn, uint8_t state
|
||||||
* See ICCCM 4.1.2.3 for more details
|
* See ICCCM 4.1.2.3 for more details
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static bool handle_normal_hints(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window,
|
static bool handle_normal_hints(xcb_window_t window, xcb_get_property_reply_t *reply) {
|
||||||
xcb_atom_t name, xcb_get_property_reply_t *reply) {
|
|
||||||
Con *con = con_by_window_id(window);
|
Con *con = con_by_window_id(window);
|
||||||
if (con == NULL) {
|
if (con == NULL) {
|
||||||
DLOG("Received WM_NORMAL_HINTS for unknown client\n");
|
DLOG("Received WM_NORMAL_HINTS for unknown client\n");
|
||||||
|
@ -999,8 +994,7 @@ static bool handle_normal_hints(void *data, xcb_connection_t *conn, uint8_t stat
|
||||||
* Handles the WM_HINTS property for extracting the urgency state of the window.
|
* Handles the WM_HINTS property for extracting the urgency state of the window.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static bool handle_hints(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window,
|
static bool handle_hints(xcb_window_t window, xcb_get_property_reply_t *reply) {
|
||||||
xcb_atom_t name, xcb_get_property_reply_t *reply) {
|
|
||||||
Con *con = con_by_window_id(window);
|
Con *con = con_by_window_id(window);
|
||||||
if (con == NULL) {
|
if (con == NULL) {
|
||||||
DLOG("Received WM_HINTS for unknown client\n");
|
DLOG("Received WM_HINTS for unknown client\n");
|
||||||
|
@ -1024,8 +1018,7 @@ static bool handle_hints(void *data, xcb_connection_t *conn, uint8_t state, xcb_
|
||||||
* See ICCCM 4.1.2.6 for more details
|
* See ICCCM 4.1.2.6 for more details
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static bool handle_transient_for(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window,
|
static bool handle_transient_for(xcb_window_t window, xcb_get_property_reply_t *prop) {
|
||||||
xcb_atom_t name, xcb_get_property_reply_t *prop) {
|
|
||||||
Con *con;
|
Con *con;
|
||||||
|
|
||||||
if ((con = con_by_window_id(window)) == NULL || con->window == NULL) {
|
if ((con = con_by_window_id(window)) == NULL || con->window == NULL) {
|
||||||
|
@ -1050,8 +1043,7 @@ static bool handle_transient_for(void *data, xcb_connection_t *conn, uint8_t sta
|
||||||
* toolwindow (or similar) and to which window it belongs (logical parent).
|
* toolwindow (or similar) and to which window it belongs (logical parent).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static bool handle_clientleader_change(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window,
|
static bool handle_clientleader_change(xcb_window_t window, xcb_get_property_reply_t *prop) {
|
||||||
xcb_atom_t name, xcb_get_property_reply_t *prop) {
|
|
||||||
Con *con;
|
Con *con;
|
||||||
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1144,8 +1136,7 @@ static void handle_configure_notify(xcb_configure_notify_event_t *event) {
|
||||||
* Handles the WM_CLASS property for assignments and criteria selection.
|
* Handles the WM_CLASS property for assignments and criteria selection.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static bool handle_class_change(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window,
|
static bool handle_class_change(xcb_window_t window, xcb_get_property_reply_t *prop) {
|
||||||
xcb_atom_t name, xcb_get_property_reply_t *prop) {
|
|
||||||
Con *con;
|
Con *con;
|
||||||
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1169,8 +1160,7 @@ static bool handle_class_change(void *data, xcb_connection_t *conn, uint8_t stat
|
||||||
* Handles the _MOTIF_WM_HINTS property of specifing window deocration settings.
|
* Handles the _MOTIF_WM_HINTS property of specifing window deocration settings.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static bool handle_motif_hints_change(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window,
|
static bool handle_motif_hints_change(xcb_window_t window, xcb_get_property_reply_t *prop) {
|
||||||
xcb_atom_t name, xcb_get_property_reply_t *prop) {
|
|
||||||
Con *con;
|
Con *con;
|
||||||
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1200,8 +1190,7 @@ static bool handle_motif_hints_change(void *data, xcb_connection_t *conn, uint8_
|
||||||
* Handles the _NET_WM_STRUT_PARTIAL property for allocating space for dock clients.
|
* Handles the _NET_WM_STRUT_PARTIAL property for allocating space for dock clients.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static bool handle_strut_partial_change(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window,
|
static bool handle_strut_partial_change(xcb_window_t window, xcb_get_property_reply_t *prop) {
|
||||||
xcb_atom_t name, xcb_get_property_reply_t *prop) {
|
|
||||||
DLOG("strut partial change for window 0x%08x\n", window);
|
DLOG("strut partial change for window 0x%08x\n", window);
|
||||||
|
|
||||||
Con *con;
|
Con *con;
|
||||||
|
@ -1279,7 +1268,7 @@ static bool handle_strut_partial_change(void *data, xcb_connection_t *conn, uint
|
||||||
|
|
||||||
/* Returns false if the event could not be processed (e.g. the window could not
|
/* Returns false if the event could not be processed (e.g. the window could not
|
||||||
* be found), true otherwise */
|
* be found), true otherwise */
|
||||||
typedef bool (*cb_property_handler_t)(void *data, xcb_connection_t *c, uint8_t state, xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *property);
|
typedef bool (*cb_property_handler_t)(xcb_window_t window, xcb_get_property_reply_t *property);
|
||||||
|
|
||||||
struct property_handler_t {
|
struct property_handler_t {
|
||||||
xcb_atom_t atom;
|
xcb_atom_t atom;
|
||||||
|
@ -1345,7 +1334,7 @@ static void property_notify(uint8_t state, xcb_window_t window, xcb_atom_t atom)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the handler will free() the reply unless it returns false */
|
/* the handler will free() the reply unless it returns false */
|
||||||
if (!handler->cb(NULL, conn, state, window, atom, propr))
|
if (!handler->cb(window, propr))
|
||||||
FREE(propr);
|
FREE(propr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue