Update to new xcb-util library.
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
56471ca618
commit
00d8a0cddd
|
@ -149,7 +149,7 @@ scan(void)
|
||||||
|
|
||||||
if(!attr_r || attr_r->override_redirect
|
if(!attr_r || attr_r->override_redirect
|
||||||
|| (attr_r->map_state != XCB_MAP_STATE_VIEWABLE && !has_awesome_prop)
|
|| (attr_r->map_state != XCB_MAP_STATE_VIEWABLE && !has_awesome_prop)
|
||||||
|| (state == XCB_WM_WITHDRAWN_STATE && !has_awesome_prop))
|
|| (state == XCB_WM_STATE_WITHDRAWN && !has_awesome_prop))
|
||||||
{
|
{
|
||||||
geom_wins[i] = NULL;
|
geom_wins[i] = NULL;
|
||||||
p_delete(&attr_r);
|
p_delete(&attr_r);
|
||||||
|
|
|
@ -137,11 +137,11 @@ pkg_check_modules(AWESOME_REQUIRED REQUIRED
|
||||||
pangocairo
|
pangocairo
|
||||||
xcb-randr
|
xcb-randr
|
||||||
xcb-xinerama
|
xcb-xinerama
|
||||||
xcb-event>=0.2.1
|
xcb-event>=0.3.0
|
||||||
xcb-aux>=0.2.1
|
xcb-aux>=0.3.0
|
||||||
xcb-atom>=0.2.1
|
xcb-atom>=0.3.0
|
||||||
xcb-keysyms>=0.2.1
|
xcb-keysyms>=0.3.0
|
||||||
xcb-icccm>=0.2.1
|
xcb-icccm>=0.3.0
|
||||||
cairo-xcb)
|
cairo-xcb)
|
||||||
|
|
||||||
if(NOT AWESOME_REQUIRED_FOUND OR NOT AWESOME_COMMON_REQUIRED_FOUND)
|
if(NOT AWESOME_REQUIRED_FOUND OR NOT AWESOME_COMMON_REQUIRED_FOUND)
|
||||||
|
|
147
client.c
147
client.c
|
@ -103,16 +103,19 @@ client_loadprops(client_t * c, screen_t *screen)
|
||||||
static bool
|
static bool
|
||||||
window_isprotodel(xcb_window_t win)
|
window_isprotodel(xcb_window_t win)
|
||||||
{
|
{
|
||||||
uint32_t i, n;
|
uint32_t i;
|
||||||
xcb_atom_t *protocols;
|
xcb_get_wm_protocols_reply_t protocols;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
if(xcb_get_wm_protocols(globalconf.connection, win, &n, &protocols))
|
if(xcb_get_wm_protocols_reply(globalconf.connection,
|
||||||
|
xcb_get_wm_protocols_unchecked(globalconf.connection,
|
||||||
|
win, WM_PROTOCOLS),
|
||||||
|
&protocols, NULL))
|
||||||
{
|
{
|
||||||
for(i = 0; !ret && i < n; i++)
|
for(i = 0; !ret && i < protocols.atoms_len; i++)
|
||||||
if(protocols[i] == WM_DELETE_WINDOW)
|
if(protocols.atoms[i] == WM_DELETE_WINDOW)
|
||||||
ret = true;
|
ret = true;
|
||||||
p_delete(&protocols);
|
xcb_get_wm_protocols_reply_wipe(&protocols);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -216,9 +219,9 @@ client_ban(client_t *c)
|
||||||
client_unfocus(c);
|
client_unfocus(c);
|
||||||
xcb_unmap_window(globalconf.connection, c->win);
|
xcb_unmap_window(globalconf.connection, c->win);
|
||||||
if(c->ishidden)
|
if(c->ishidden)
|
||||||
window_state_set(c->win, XCB_WM_ICONIC_STATE);
|
window_state_set(c->win, XCB_WM_STATE_ICONIC);
|
||||||
else
|
else
|
||||||
window_state_set(c->win, XCB_WM_WITHDRAWN_STATE);
|
window_state_set(c->win, XCB_WM_STATE_WITHDRAWN);
|
||||||
if(c->titlebar && c->titlebar->position && c->titlebar->sw)
|
if(c->titlebar && c->titlebar->position && c->titlebar->sw)
|
||||||
xcb_unmap_window(globalconf.connection, c->titlebar->sw->window);
|
xcb_unmap_window(globalconf.connection, c->titlebar->sw->window);
|
||||||
}
|
}
|
||||||
|
@ -355,8 +358,8 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen)
|
||||||
xcb_get_property_cookie_t ewmh_icon_cookie;
|
xcb_get_property_cookie_t ewmh_icon_cookie;
|
||||||
client_t *c, *t = NULL;
|
client_t *c, *t = NULL;
|
||||||
xcb_window_t trans;
|
xcb_window_t trans;
|
||||||
bool rettrans, retloadprops;
|
bool rettrans, retloadprops, is_size_hints;
|
||||||
xcb_size_hints_t *u_size_hints;
|
xcb_size_hints_t size_hints;
|
||||||
const uint32_t select_input_val[] =
|
const uint32_t select_input_val[] =
|
||||||
{
|
{
|
||||||
XCB_EVENT_MASK_STRUCTURE_NOTIFY
|
XCB_EVENT_MASK_STRUCTURE_NOTIFY
|
||||||
|
@ -394,7 +397,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen)
|
||||||
c->icon = ewmh_window_icon_get_reply(ewmh_icon_cookie);
|
c->icon = ewmh_window_icon_get_reply(ewmh_icon_cookie);
|
||||||
|
|
||||||
/* update hints */
|
/* update hints */
|
||||||
u_size_hints = client_updatesizehints(c);
|
is_size_hints = client_updatesizehints(c, &size_hints);
|
||||||
client_updatewmhints(c);
|
client_updatewmhints(c);
|
||||||
|
|
||||||
/* Try to load props if any */
|
/* Try to load props if any */
|
||||||
|
@ -405,7 +408,10 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen)
|
||||||
ewmh_check_client_hints(c);
|
ewmh_check_client_hints(c);
|
||||||
|
|
||||||
/* check for transient and set tags like its parent */
|
/* check for transient and set tags like its parent */
|
||||||
if((rettrans = xcb_get_wm_transient_for(globalconf.connection, w, &trans))
|
if((rettrans = xcb_get_wm_transient_for_reply(globalconf.connection,
|
||||||
|
xcb_get_wm_transient_for_unchecked(globalconf.connection,
|
||||||
|
w),
|
||||||
|
&trans, NULL))
|
||||||
&& (t = client_getbywin(trans)))
|
&& (t = client_getbywin(trans)))
|
||||||
{
|
{
|
||||||
tag_array_t *tags = &globalconf.screens[c->screen].tags;
|
tag_array_t *tags = &globalconf.screens[c->screen].tags;
|
||||||
|
@ -436,18 +442,15 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen)
|
||||||
|
|
||||||
if(c->floating_placement
|
if(c->floating_placement
|
||||||
&& !retloadprops
|
&& !retloadprops
|
||||||
&& u_size_hints
|
&& is_size_hints
|
||||||
&& !(xcb_size_hints_get_flags(u_size_hints) & (XCB_SIZE_US_POSITION_HINT
|
&& !(size_hints.flags & (XCB_SIZE_HINT_US_POSITION
|
||||||
| XCB_SIZE_P_POSITION_HINT)))
|
| XCB_SIZE_HINT_P_POSITION)))
|
||||||
{
|
{
|
||||||
if(c->isfloating)
|
if(c->isfloating)
|
||||||
client_resize(c, c->floating_placement(c), false);
|
client_resize(c, c->floating_placement(c), false);
|
||||||
else
|
else
|
||||||
c->f_geometry = c->floating_placement(c);
|
c->f_geometry = c->floating_placement(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(u_size_hints)
|
|
||||||
xcb_free_size_hints(u_size_hints);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Compute client geometry with respect to its geometry hints.
|
/** Compute client geometry with respect to its geometry hints.
|
||||||
|
@ -653,7 +656,7 @@ void
|
||||||
client_unban(client_t *c)
|
client_unban(client_t *c)
|
||||||
{
|
{
|
||||||
xcb_map_window(globalconf.connection, c->win);
|
xcb_map_window(globalconf.connection, c->win);
|
||||||
window_state_set(c->win, XCB_WM_NORMAL_STATE);
|
window_state_set(c->win, XCB_WM_STATE_NORMAL);
|
||||||
if(c->titlebar && c->titlebar->sw && c->titlebar->position)
|
if(c->titlebar && c->titlebar->sw && c->titlebar->position)
|
||||||
xcb_map_window(globalconf.connection, c->titlebar->sw->window);
|
xcb_map_window(globalconf.connection, c->titlebar->sw->window);
|
||||||
}
|
}
|
||||||
|
@ -682,7 +685,7 @@ client_unmanage(client_t *c)
|
||||||
|
|
||||||
xcb_ungrab_button(globalconf.connection, XCB_BUTTON_INDEX_ANY, c->win,
|
xcb_ungrab_button(globalconf.connection, XCB_BUTTON_INDEX_ANY, c->win,
|
||||||
XCB_BUTTON_MASK_ANY);
|
XCB_BUTTON_MASK_ANY);
|
||||||
window_state_set(c->win, XCB_WM_WITHDRAWN_STATE);
|
window_state_set(c->win, XCB_WM_STATE_WITHDRAWN);
|
||||||
|
|
||||||
xcb_flush(globalconf.connection);
|
xcb_flush(globalconf.connection);
|
||||||
xcb_ungrab_server(globalconf.connection);
|
xcb_ungrab_server(globalconf.connection);
|
||||||
|
@ -717,14 +720,13 @@ client_unmanage(client_t *c)
|
||||||
void
|
void
|
||||||
client_updatewmhints(client_t *c)
|
client_updatewmhints(client_t *c)
|
||||||
{
|
{
|
||||||
xcb_wm_hints_t *wmh;
|
xcb_wm_hints_t wmh;
|
||||||
uint32_t wm_hints_flags;
|
|
||||||
|
|
||||||
if((wmh = xcb_get_wm_hints(globalconf.connection, c->win)))
|
if(xcb_get_wm_hints_reply(globalconf.connection,
|
||||||
|
xcb_get_wm_hints_unchecked(globalconf.connection, c->win),
|
||||||
|
&wmh, NULL))
|
||||||
{
|
{
|
||||||
bool isurgent;
|
bool isurgent = xcb_wm_hints_get_urgency(&wmh);
|
||||||
wm_hints_flags = xcb_wm_hints_get_flags(wmh);
|
|
||||||
isurgent = xcb_wm_hints_get_urgency(wmh);
|
|
||||||
if(isurgent != c->isurgent)
|
if(isurgent != c->isurgent)
|
||||||
{
|
{
|
||||||
c->isurgent = isurgent;
|
c->isurgent = isurgent;
|
||||||
|
@ -735,13 +737,12 @@ client_updatewmhints(client_t *c)
|
||||||
|
|
||||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||||
}
|
}
|
||||||
if((wm_hints_flags & XCB_WM_STATE_HINT) &&
|
if((wmh.flags & XCB_WM_HINT_STATE) &&
|
||||||
(xcb_wm_hints_get_initial_state(wmh) == XCB_WM_WITHDRAWN_STATE))
|
wmh.initial_state == XCB_WM_STATE_WITHDRAWN)
|
||||||
{
|
{
|
||||||
client_setborder(c, 0);
|
client_setborder(c, 0);
|
||||||
c->skip = true;
|
c->skip = true;
|
||||||
}
|
}
|
||||||
xcb_free_wm_hints(wmh);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -749,45 +750,63 @@ client_updatewmhints(client_t *c)
|
||||||
* \param c The client.
|
* \param c The client.
|
||||||
* \return A pointer to a xcb_size_hints_t.
|
* \return A pointer to a xcb_size_hints_t.
|
||||||
*/
|
*/
|
||||||
xcb_size_hints_t *
|
bool
|
||||||
client_updatesizehints(client_t *c)
|
client_updatesizehints(client_t *c, xcb_size_hints_t *size_hints)
|
||||||
{
|
{
|
||||||
long msize;
|
if(!xcb_get_wm_normal_hints_reply(globalconf.connection,
|
||||||
xcb_size_hints_t *size;
|
xcb_get_wm_normal_hints_unchecked(globalconf.connection,
|
||||||
uint32_t size_flags;
|
c->win),
|
||||||
|
size_hints, NULL))
|
||||||
|
return false;
|
||||||
|
|
||||||
if(!(size = xcb_get_wm_normal_hints(globalconf.connection, c->win, &msize)))
|
if((size_hints->flags & XCB_SIZE_HINT_P_SIZE))
|
||||||
return NULL;
|
{
|
||||||
|
c->basew = size_hints->base_width;
|
||||||
size_flags = xcb_size_hints_get_flags(size);
|
c->baseh = size_hints->base_height;
|
||||||
|
}
|
||||||
if((size_flags & XCB_SIZE_P_SIZE_HINT))
|
else if((size_hints->flags & XCB_SIZE_HINT_P_MIN_SIZE))
|
||||||
xcb_size_hints_get_base_size(size, &c->basew, &c->baseh);
|
{
|
||||||
else if((size_flags & XCB_SIZE_P_MIN_SIZE_HINT))
|
c->basew = size_hints->min_width;
|
||||||
xcb_size_hints_get_min_size(size, &c->basew, &c->baseh);
|
c->baseh = size_hints->min_height;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
c->basew = c->baseh = 0;
|
c->basew = c->baseh = 0;
|
||||||
if((size_flags & XCB_SIZE_P_RESIZE_INC_HINT))
|
|
||||||
xcb_size_hints_get_increase(size, &c->incw, &c->inch);
|
if((size_hints->flags & XCB_SIZE_HINT_P_RESIZE_INC))
|
||||||
|
{
|
||||||
|
c->incw = size_hints->width_inc;
|
||||||
|
c->inch = size_hints->height_inc;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
c->incw = c->inch = 0;
|
c->incw = c->inch = 0;
|
||||||
|
|
||||||
if((size_flags & XCB_SIZE_P_MAX_SIZE_HINT))
|
if((size_hints->flags & XCB_SIZE_HINT_P_MAX_SIZE))
|
||||||
xcb_size_hints_get_max_size(size, &c->maxw, &c->maxh);
|
{
|
||||||
|
c->maxw = size_hints->max_width;
|
||||||
|
c->maxh = size_hints->max_height;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
c->maxw = c->maxh = 0;
|
c->maxw = c->maxh = 0;
|
||||||
|
|
||||||
if((size_flags & XCB_SIZE_P_MIN_SIZE_HINT))
|
if((size_hints->flags & XCB_SIZE_HINT_P_MIN_SIZE))
|
||||||
xcb_size_hints_get_min_size(size, &c->minw, &c->minh);
|
{
|
||||||
else if((size_flags & XCB_SIZE_BASE_SIZE_HINT))
|
c->minw = size_hints->min_width;
|
||||||
xcb_size_hints_get_base_size(size, &c->minw, &c->minh);
|
c->minh = size_hints->min_height;
|
||||||
|
}
|
||||||
|
else if((size_hints->flags & XCB_SIZE_HINT_BASE_SIZE))
|
||||||
|
{
|
||||||
|
c->minw = size_hints->base_width;
|
||||||
|
c->minh = size_hints->base_height;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
c->minw = c->minh = 0;
|
c->minw = c->minh = 0;
|
||||||
|
|
||||||
if((size_flags & XCB_SIZE_P_ASPECT_HINT))
|
if((size_hints->flags & XCB_SIZE_HINT_P_ASPECT))
|
||||||
{
|
{
|
||||||
xcb_size_hints_get_min_aspect(size, &c->minax, &c->minay);
|
c->minax = size_hints->min_aspect_num;
|
||||||
xcb_size_hints_get_max_aspect(size, &c->maxax, &c->maxay);
|
c->minay = size_hints->min_aspect_den;
|
||||||
|
c->maxax = size_hints->max_aspect_num;
|
||||||
|
c->maxay = size_hints->max_aspect_den;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
c->minax = c->maxax = c->minay = c->maxay = 0;
|
c->minax = c->maxax = c->minay = c->maxay = 0;
|
||||||
|
@ -799,7 +818,7 @@ client_updatesizehints(client_t *c)
|
||||||
c->hassizehints = !(!c->basew && !c->baseh && !c->incw && !c->inch
|
c->hassizehints = !(!c->basew && !c->baseh && !c->incw && !c->inch
|
||||||
&& !c->maxw && !c->maxh && !c->minw && !c->minh
|
&& !c->maxw && !c->maxh && !c->minw && !c->minh
|
||||||
&& !c->minax && !c->maxax && !c->minax && !c->minay);
|
&& !c->minax && !c->maxax && !c->minax && !c->minay);
|
||||||
return size;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Kill a client via a WM_DELETE_WINDOW request or XKillClient if not
|
/** Kill a client via a WM_DELETE_WINDOW request or XKillClient if not
|
||||||
|
@ -1275,7 +1294,7 @@ luaA_client_index(lua_State *L)
|
||||||
const char *buf = luaL_checklstring(L, 2, &len);
|
const char *buf = luaL_checklstring(L, 2, &len);
|
||||||
char *value;
|
char *value;
|
||||||
void *data;
|
void *data;
|
||||||
xutil_class_hint_t hint;
|
xcb_get_wm_class_reply_t hint;
|
||||||
xcb_get_property_cookie_t prop_c;
|
xcb_get_property_cookie_t prop_c;
|
||||||
xcb_get_property_reply_t *prop_r = NULL;
|
xcb_get_property_reply_t *prop_r = NULL;
|
||||||
double d;
|
double d;
|
||||||
|
@ -1292,16 +1311,20 @@ luaA_client_index(lua_State *L)
|
||||||
lua_pushstring(L, (*c)->name);
|
lua_pushstring(L, (*c)->name);
|
||||||
break;
|
break;
|
||||||
case A_TK_CLASS:
|
case A_TK_CLASS:
|
||||||
if(!xutil_class_hint_get(globalconf.connection, (*c)->win, &hint))
|
if(!xcb_get_wm_class_reply(globalconf.connection,
|
||||||
|
xcb_get_wm_class_unchecked(globalconf.connection, (*c)->win),
|
||||||
|
&hint, NULL))
|
||||||
return 0;
|
return 0;
|
||||||
lua_pushstring(L, hint.res_class);
|
lua_pushstring(L, hint.class);
|
||||||
xutil_class_hint_wipe(&hint);
|
xcb_get_wm_class_reply_wipe(&hint);
|
||||||
break;
|
break;
|
||||||
case A_TK_INSTANCE:
|
case A_TK_INSTANCE:
|
||||||
if(!xutil_class_hint_get(globalconf.connection, (*c)->win, &hint))
|
if(!xcb_get_wm_class_reply(globalconf.connection,
|
||||||
|
xcb_get_wm_class_unchecked(globalconf.connection, (*c)->win),
|
||||||
|
&hint, NULL))
|
||||||
return 0;
|
return 0;
|
||||||
lua_pushstring(L, hint.res_name);
|
lua_pushstring(L, hint.name);
|
||||||
xutil_class_hint_wipe(&hint);
|
xcb_get_wm_class_reply_wipe(&hint);
|
||||||
break;
|
break;
|
||||||
case A_TK_ROLE:
|
case A_TK_ROLE:
|
||||||
if(!xutil_text_prop_get(globalconf.connection, (*c)->win,
|
if(!xutil_text_prop_get(globalconf.connection, (*c)->win,
|
||||||
|
|
2
client.h
2
client.h
|
@ -39,7 +39,7 @@ area_t client_geometry_hints(client_t *, area_t);
|
||||||
bool client_resize(client_t *, area_t, bool);
|
bool client_resize(client_t *, area_t, bool);
|
||||||
void client_unmanage(client_t *);
|
void client_unmanage(client_t *);
|
||||||
void client_updatewmhints(client_t *);
|
void client_updatewmhints(client_t *);
|
||||||
xcb_size_hints_t *client_updatesizehints(client_t *);
|
bool client_updatesizehints(client_t *, xcb_size_hints_t *);
|
||||||
bool client_updatetitle(client_t *);
|
bool client_updatetitle(client_t *);
|
||||||
void client_saveprops(client_t *);
|
void client_saveprops(client_t *);
|
||||||
void client_kill(client_t *);
|
void client_kill(client_t *);
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <xcb/xcb_atom.h>
|
#include <xcb/xcb_atom.h>
|
||||||
|
#include <xcb/xcb_icccm.h>
|
||||||
|
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "common/xutil.h"
|
#include "common/xutil.h"
|
||||||
|
@ -43,19 +44,14 @@ bool
|
||||||
xutil_text_prop_get(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom,
|
xutil_text_prop_get(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom,
|
||||||
char **text, ssize_t *len)
|
char **text, ssize_t *len)
|
||||||
{
|
{
|
||||||
xcb_get_property_cookie_t prop_c;
|
xcb_get_text_property_reply_t reply;
|
||||||
xcb_get_property_reply_t *prop_r;
|
if(!xcb_get_text_property_reply(conn,
|
||||||
|
xcb_get_text_property_unchecked(conn, w,
|
||||||
prop_c = xcb_get_property_unchecked(conn, false,
|
atom),
|
||||||
w, atom,
|
&reply, NULL) ||
|
||||||
XCB_GET_PROPERTY_TYPE_ANY,
|
!reply.name_len || reply.format != 8)
|
||||||
0L, 1000000L);
|
|
||||||
|
|
||||||
prop_r = xcb_get_property_reply(conn, prop_c, NULL);
|
|
||||||
|
|
||||||
if(!prop_r || !prop_r->value_len || prop_r->format != 8)
|
|
||||||
{
|
{
|
||||||
p_delete(&prop_r);
|
xcb_get_text_property_reply_wipe(&reply);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,14 +60,14 @@ xutil_text_prop_get(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom,
|
||||||
/* Check whether the returned property value is just an ascii
|
/* Check whether the returned property value is just an ascii
|
||||||
* string or utf8 string. At the moment it doesn't handle
|
* string or utf8 string. At the moment it doesn't handle
|
||||||
* COMPOUND_TEXT and multibyte but it's not needed... */
|
* COMPOUND_TEXT and multibyte but it's not needed... */
|
||||||
if(prop_r->type == STRING || prop_r->type == UTF8_STRING)
|
if(reply.encoding == STRING || reply.encoding == UTF8_STRING)
|
||||||
{
|
{
|
||||||
void *prop_val = xcb_get_property_value(prop_r);
|
*text = p_new(char, reply.name_len + 1);
|
||||||
*text = p_new(char, prop_r->value_len + 1);
|
/* Use memcpy() because the property name is not be \0
|
||||||
/* use memcpy() because prop_val may not be \0 terminated */
|
* terminated */
|
||||||
memcpy(*text, prop_val, prop_r->value_len);
|
memcpy(*text, reply.name, reply.name_len);
|
||||||
(*text)[prop_r->value_len] = '\0';
|
(*text)[reply.name_len] = '\0';
|
||||||
*len = prop_r->value_len;
|
*len = reply.name_len;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -80,7 +76,7 @@ xutil_text_prop_get(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p_delete(&prop_r);
|
xcb_get_text_property_reply_wipe(&reply);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,41 +124,6 @@ xutil_lock_mask_get(xcb_connection_t *connection,
|
||||||
p_delete(&modmap_r);
|
p_delete(&modmap_r);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
xutil_class_hint_get(xcb_connection_t *conn, xcb_window_t win,
|
|
||||||
xutil_class_hint_t *ch)
|
|
||||||
{
|
|
||||||
xcb_get_property_reply_t *class_hint_r;
|
|
||||||
xcb_get_property_cookie_t class_hint_c;
|
|
||||||
char *data;
|
|
||||||
int len_name, len_class;
|
|
||||||
|
|
||||||
class_hint_c = xcb_get_property_unchecked(conn, false, win, WM_CLASS,
|
|
||||||
STRING, 0L, 2048L);
|
|
||||||
|
|
||||||
class_hint_r = xcb_get_property_reply(conn, class_hint_c, NULL);
|
|
||||||
|
|
||||||
if(!class_hint_r
|
|
||||||
|| class_hint_r->type != STRING
|
|
||||||
|| class_hint_r->format != 8)
|
|
||||||
{
|
|
||||||
p_delete(&class_hint_r);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
data = xcb_get_property_value(class_hint_r);
|
|
||||||
|
|
||||||
len_name = a_strlen(data);
|
|
||||||
len_class = a_strlen(data + len_name + 1);
|
|
||||||
|
|
||||||
ch->res_name = a_strndup(data, len_name);
|
|
||||||
ch->res_class = a_strndup(data + len_name + 1, len_class);
|
|
||||||
|
|
||||||
p_delete(&class_hint_r);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Number of different errors */
|
/* Number of different errors */
|
||||||
#define ERRORS_NBR 256
|
#define ERRORS_NBR 256
|
||||||
|
|
||||||
|
|
|
@ -94,21 +94,6 @@
|
||||||
/* Server is defective */
|
/* Server is defective */
|
||||||
#define XUTIL_BAD_IMPLEMENTATION 17
|
#define XUTIL_BAD_IMPLEMENTATION 17
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
char *res_name;
|
|
||||||
char *res_class;
|
|
||||||
} xutil_class_hint_t;
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
xutil_class_hint_wipe(xutil_class_hint_t *c)
|
|
||||||
{
|
|
||||||
p_delete(&c->res_name);
|
|
||||||
p_delete(&c->res_class);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool xutil_class_hint_get(xcb_connection_t *, xcb_window_t, xutil_class_hint_t *);
|
|
||||||
|
|
||||||
bool xutil_text_prop_get(xcb_connection_t *, xcb_window_t, xcb_atom_t, char **, ssize_t *);
|
bool xutil_text_prop_get(xcb_connection_t *, xcb_window_t, xcb_atom_t, char **, ssize_t *);
|
||||||
|
|
||||||
void xutil_lock_mask_get(xcb_connection_t *, xcb_get_modifier_mapping_cookie_t,
|
void xutil_lock_mask_get(xcb_connection_t *, xcb_get_modifier_mapping_cookie_t,
|
||||||
|
|
12
event.c
12
event.c
|
@ -519,6 +519,7 @@ event_handle_propertynotify(void *data __attribute__ ((unused)),
|
||||||
client_t *c;
|
client_t *c;
|
||||||
xcb_window_t trans;
|
xcb_window_t trans;
|
||||||
xembed_window_t *emwin;
|
xembed_window_t *emwin;
|
||||||
|
xcb_size_hints_t size_hints;
|
||||||
|
|
||||||
if(ev->state == XCB_PROPERTY_DELETE)
|
if(ev->state == XCB_PROPERTY_DELETE)
|
||||||
return 0; /* ignore */
|
return 0; /* ignore */
|
||||||
|
@ -528,13 +529,16 @@ event_handle_propertynotify(void *data __attribute__ ((unused)),
|
||||||
{
|
{
|
||||||
if(ev->atom == WM_TRANSIENT_FOR)
|
if(ev->atom == WM_TRANSIENT_FOR)
|
||||||
{
|
{
|
||||||
xcb_get_wm_transient_for(connection, c->win, &trans);
|
xcb_get_wm_transient_for_reply(connection,
|
||||||
|
xcb_get_wm_transient_for_unchecked(connection,
|
||||||
|
c->win),
|
||||||
|
&trans, NULL);
|
||||||
if(!c->isfloating
|
if(!c->isfloating
|
||||||
&& (c->isfloating = (client_getbywin(trans) != NULL)))
|
&& (c->isfloating = (client_getbywin(trans) != NULL)))
|
||||||
globalconf.screens[c->screen].need_arrange = true;
|
globalconf.screens[c->screen].need_arrange = true;
|
||||||
}
|
}
|
||||||
else if (ev->atom == WM_NORMAL_HINTS)
|
else if (ev->atom == WM_NORMAL_HINTS)
|
||||||
xcb_free_size_hints(client_updatesizehints(c));
|
client_updatesizehints(c, &size_hints);
|
||||||
else if (ev->atom == WM_HINTS)
|
else if (ev->atom == WM_HINTS)
|
||||||
client_updatewmhints(c);
|
client_updatewmhints(c);
|
||||||
else if(ev->atom == WM_NAME || ev->atom == _NET_WM_NAME)
|
else if(ev->atom == WM_NAME || ev->atom == _NET_WM_NAME)
|
||||||
|
@ -573,7 +577,7 @@ event_handle_unmapnotify(void *data __attribute__ ((unused)),
|
||||||
{
|
{
|
||||||
if(ev->event == xutil_screen_get(connection, c->phys_screen)->root
|
if(ev->event == xutil_screen_get(connection, c->phys_screen)->root
|
||||||
&& send_event
|
&& send_event
|
||||||
&& window_state_get_reply(window_state_get_unchecked(c->win)) == XCB_WM_NORMAL_STATE)
|
&& window_state_get_reply(window_state_get_unchecked(c->win)) == XCB_WM_STATE_NORMAL)
|
||||||
client_unmanage(c);
|
client_unmanage(c);
|
||||||
}
|
}
|
||||||
else if((em = xembed_getbywin(globalconf.embedded, ev->window)))
|
else if((em = xembed_getbywin(globalconf.embedded, ev->window)))
|
||||||
|
@ -637,7 +641,7 @@ event_handle_clientmessage(void *data __attribute__ ((unused)),
|
||||||
{
|
{
|
||||||
if((c = client_getbywin(ev->window))
|
if((c = client_getbywin(ev->window))
|
||||||
&& ev->format == 32
|
&& ev->format == 32
|
||||||
&& ev->data.data32[0] == XCB_WM_ICONIC_STATE)
|
&& ev->data.data32[0] == XCB_WM_STATE_ICONIC)
|
||||||
{
|
{
|
||||||
c->ishidden = true;
|
c->ishidden = true;
|
||||||
globalconf.screens[c->screen].need_arrange = true;
|
globalconf.screens[c->screen].need_arrange = true;
|
||||||
|
|
|
@ -140,7 +140,7 @@ systray_request_handle(xcb_window_t embed_win, int phys_screen, xembed_info_t *i
|
||||||
|
|
||||||
xcb_change_window_attributes(globalconf.connection, embed_win, XCB_CW_EVENT_MASK,
|
xcb_change_window_attributes(globalconf.connection, embed_win, XCB_CW_EVENT_MASK,
|
||||||
select_input_val);
|
select_input_val);
|
||||||
window_state_set(embed_win, XCB_WM_WITHDRAWN_STATE);
|
window_state_set(embed_win, XCB_WM_STATE_WITHDRAWN);
|
||||||
|
|
||||||
xcb_reparent_window(globalconf.connection, embed_win,
|
xcb_reparent_window(globalconf.connection, embed_win,
|
||||||
globalconf.screens[phys_screen].systray.window,
|
globalconf.screens[phys_screen].systray.window,
|
||||||
|
|
Loading…
Reference in New Issue