client: port to new object system

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-17 17:02:45 +02:00
parent 84839d456d
commit a02d026f77
10 changed files with 1078 additions and 758 deletions

1125
client.c

File diff suppressed because it is too large Load Diff

View File

@ -91,46 +91,46 @@ struct client_t
/** Strut */
strut_t strut;
/** Border width and pre-fullscreen border width */
int border, border_fs;
int border_width, border_width_fs;
xcolor_t border_color;
/** True if the client is sticky */
bool issticky;
bool sticky;
/** Has urgency hint */
bool isurgent;
bool urgent;
/** True if the client is hidden */
bool ishidden;
bool hidden;
/** True if the client is minimized */
bool isminimized;
bool minimized;
/** True if the client is fullscreen */
bool isfullscreen;
bool fullscreen;
/** True if the client is maximized horizontally */
bool ismaxhoriz;
bool maximized_horizontal;
/** True if the client is maximized vertically */
bool ismaxvert;
bool maximized_vertical;
/** True if the client is above others */
bool isabove;
bool above;
/** True if the client is below others */
bool isbelow;
bool below;
/** True if the client is modal */
bool ismodal;
bool modal;
/** True if the client is on top */
bool isontop;
bool ontop;
/** True if a client is banned to a position outside the viewport.
* Note that the geometry remains unchanged and that the window is still mapped.
*/
bool isbanned;
/** true if the client must be skipped from task bar client list */
bool skiptb;
bool skip_taskbar;
/** True if the client cannot have focus */
bool nofocus;
/** The window type */
window_type_t type;
/** Window of the client */
xcb_window_t win;
xcb_window_t window;
/** Window of the group leader */
xcb_window_t group_win;
xcb_window_t group_window;
/** Window holding command needed to start it (session management related) */
xcb_window_t leader_win;
xcb_window_t leader_window;
/** Client's WM_PROTOCOLS property */
xcb_get_wm_protocols_reply_t protocols;
/** Client logical screen */
@ -185,26 +185,39 @@ area_t client_geometry_hints(client_t *, area_t);
bool client_resize(client_t *, area_t, bool);
void client_unmanage(client_t *);
void client_kill(client_t *);
void client_setsticky(client_t *, bool);
void client_setabove(client_t *, bool);
void client_setbelow(client_t *, bool);
void client_setmodal(client_t *, bool);
void client_setontop(client_t *, bool);
void client_setfullscreen(client_t *, bool);
void client_setmaxhoriz(client_t *, bool);
void client_setmaxvert(client_t *, bool);
void client_setminimized(client_t *, bool);
void client_setborder(client_t *, int);
void client_seturgent(client_t *, bool);
void client_set_sticky(lua_State *, int, bool);
void client_set_above(lua_State *, int, bool);
void client_set_below(lua_State *, int, bool);
void client_set_modal(lua_State *, int, bool);
void client_set_ontop(lua_State *, int, bool);
void client_set_fullscreen(lua_State *, int, bool);
void client_set_maximized_horizontal(lua_State *, int, bool);
void client_set_maximized_vertical(lua_State *, int, bool);
void client_set_minimized(lua_State *, int, bool);
void client_set_border_width(lua_State *, int, int);
void client_set_urgent(lua_State *, int, bool);
void client_set_pid(lua_State *, int, uint32_t);
void client_set_role(lua_State *, int, const char *);
void client_set_machine(lua_State *, int, const char *);
void client_set_icon_name(lua_State *, int, const char *);
void client_set_class_instance(lua_State *, int, const char *, const char *);
void client_set_type(lua_State *L, int, window_type_t);
void client_set_transient_for(lua_State *L, int, client_t *);
void client_set_name(lua_State *L, int, const char *);
void client_set_group_window(lua_State *, int, xcb_window_t);
void client_set_icon(lua_State *, int, int);
void client_set_skip_taskbar(lua_State *, int, bool);
void client_set_opacity(lua_State *, int, double);
void client_focus(client_t *);
void client_focus_update(client_t *);
void client_unfocus(client_t *);
void client_unfocus_update(client_t *);
void client_stack_refresh(void);
bool client_hasproto(client_t *, xcb_atom_t);
void client_setfocus(client_t *, bool);
void client_set_focus(client_t *, bool);
void client_ignore_enterleave_events(void);
void client_restore_enterleave_events(void);
void client_class_setup(lua_State *);
static inline void
client_stack(void)
@ -278,7 +291,7 @@ client_isfixed(client_t *c)
static inline bool
client_isvisible(client_t *c, screen_t *screen)
{
return (!c->ishidden && !c->isminimized && client_maybevisible(c, screen));
return (!c->hidden && !c->minimized && client_maybevisible(c, screen));
}
/** Check if a client has strut information.

View File

@ -37,13 +37,12 @@ fullscreen
gap
geometry
graph
group_id
group_window
grow
height
hide
hidden
icon
icon_name
id
image
imagebox
index
@ -52,7 +51,7 @@ key
key_press
key_release
keysym
leader_id
leader_window
left
len
line
@ -68,6 +67,7 @@ Mod2
Mod3
Mod4
Mod5
modal
modifiers
motion_notify
mouse_enter
@ -116,6 +116,7 @@ vertical
visible
widgets
width
window
word
word_char
workarea

32
event.c
View File

@ -254,7 +254,7 @@ event_handle_configurerequest(void *data __attribute__ ((unused)),
if((c = client_getbywin(ev->window)))
{
geometry = titlebar_geometry_remove(c->titlebar, c->border, c->geometry);
geometry = titlebar_geometry_remove(c->titlebar, c->border_width, c->geometry);
if(ev->value_mask & XCB_CONFIG_WINDOW_X)
geometry.x = ev->x;
@ -266,7 +266,11 @@ event_handle_configurerequest(void *data __attribute__ ((unused)),
geometry.height = ev->height;
if(ev->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH)
client_setborder(c, ev->border_width);
{
luaA_object_push(globalconf.L, c);
client_set_border_width(globalconf.L, -1, ev->border_width);
lua_pop(globalconf.L, 1);
}
/* Clients are not allowed to directly mess with stacking parameters. */
ev->value_mask &= ~(XCB_CONFIG_WINDOW_SIBLING |
@ -274,13 +278,13 @@ event_handle_configurerequest(void *data __attribute__ ((unused)),
/** Configure request are sent with size relative to real (internal)
* window size, i.e. without titlebars and borders. */
geometry = titlebar_geometry_add(c->titlebar, c->border, geometry);
geometry = titlebar_geometry_add(c->titlebar, c->border_width, geometry);
if(!client_resize(c, geometry, false))
{
/* Resize wasn't officially needed, but we don't want to break expectations. */
geometry = titlebar_geometry_remove(c->titlebar, c->border, c->geometry);
window_configure(c->win, geometry, c->border);
geometry = titlebar_geometry_remove(c->titlebar, c->border_width, c->geometry);
window_configure(c->window, geometry, c->border_width);
}
}
else
@ -607,9 +611,11 @@ event_handle_maprequest(void *data __attribute__ ((unused)),
else if((c = client_getbywin(ev->window)))
{
/* Check that it may be visible, but not asked to be hidden */
if(client_maybevisible(c, c->screen) && !c->ishidden)
if(client_maybevisible(c, c->screen) && !c->hidden)
{
client_setminimized(c, false);
luaA_object_push(globalconf.L, c);
client_set_minimized(globalconf.L, -1, false);
lua_pop(globalconf.L, 1);
/* it will be raised, so just update ourself */
client_raise(c);
}
@ -651,7 +657,7 @@ event_handle_unmapnotify(void *data __attribute__ ((unused)),
{
if(ev->event == xutil_screen_get(connection, c->phys_screen)->root
&& XCB_EVENT_SENT(ev)
&& window_state_get_reply(window_state_get_unchecked(c->win)) == XCB_WM_STATE_NORMAL)
&& window_state_get_reply(window_state_get_unchecked(c->window)) == XCB_WM_STATE_NORMAL)
client_unmanage(c);
}
else
@ -717,7 +723,11 @@ event_handle_clientmessage(void *data __attribute__ ((unused)),
if((c = client_getbywin(ev->window))
&& ev->format == 32
&& ev->data.data32[0] == XCB_WM_STATE_ICONIC)
client_setminimized(c, true);
{
luaA_object_push(globalconf.L, c);
client_set_minimized(globalconf.L, -1, true);
lua_pop(globalconf.L, 1);
}
}
else if(ev->type == _XEMBED)
return xembed_process_client_message(ev);
@ -766,8 +776,8 @@ event_handle_mappingnotify(void *data,
foreach(_c, globalconf.clients)
{
client_t *c = *_c;
xcb_ungrab_key(connection, XCB_GRAB_ANY, c->win, XCB_BUTTON_MASK_ANY);
window_grabkeys(c->win, &c->keys);
xcb_ungrab_key(connection, XCB_GRAB_ANY, c->window, XCB_BUTTON_MASK_ANY);
window_grabkeys(c->window, &c->keys);
}
}

106
ewmh.c
View File

@ -149,7 +149,7 @@ ewmh_update_net_client_list(int phys_screen)
{
client_t *c = *_c;
if(c->phys_screen == phys_screen)
wins[n++] = c->win;
wins[n++] = c->window;
}
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
@ -168,7 +168,7 @@ ewmh_update_net_client_list_stacking(int phys_screen)
foreach(client, globalconf.stack)
if((*client)->phys_screen == phys_screen)
wins[n++] = (*client)->win;
wins[n++] = (*client)->window;
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
xutil_screen_get(globalconf.connection, phys_screen)->root,
@ -244,7 +244,7 @@ ewmh_update_net_active_window(int phys_screen)
if(globalconf.screen_focus->client_focus
&& globalconf.screen_focus->client_focus->phys_screen == phys_screen)
win = globalconf.screen_focus->client_focus->win;
win = globalconf.screen_focus->client_focus->window;
else
win = XCB_NONE;
@ -256,104 +256,106 @@ ewmh_update_net_active_window(int phys_screen)
static void
ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set)
{
luaA_object_push(globalconf.L, c);
if(state == _NET_WM_STATE_STICKY)
{
if(set == _NET_WM_STATE_REMOVE)
client_setsticky(c, false);
client_set_sticky(globalconf.L, -1, false);
else if(set == _NET_WM_STATE_ADD)
client_setsticky(c, true);
client_set_sticky(globalconf.L, -1, true);
else if(set == _NET_WM_STATE_TOGGLE)
client_setsticky(c, !c->issticky);
client_set_sticky(globalconf.L, -1, !c->sticky);
}
else if(state == _NET_WM_STATE_SKIP_TASKBAR)
{
if(set == _NET_WM_STATE_REMOVE)
{
c->skiptb = false;
client_set_skip_taskbar(globalconf.L, -1, false);
ewmh_client_update_hints(c);
}
else if(set == _NET_WM_STATE_ADD)
{
c->skiptb = true;
client_set_skip_taskbar(globalconf.L, -1, true);
ewmh_client_update_hints(c);
}
else if(set == _NET_WM_STATE_TOGGLE)
{
c->skiptb = !c->skiptb;
client_set_skip_taskbar(globalconf.L, -1, !c->skip_taskbar);
ewmh_client_update_hints(c);
}
}
else if(state == _NET_WM_STATE_FULLSCREEN)
{
if(set == _NET_WM_STATE_REMOVE)
client_setfullscreen(c, false);
client_set_fullscreen(globalconf.L, -1, false);
else if(set == _NET_WM_STATE_ADD)
client_setfullscreen(c, true);
client_set_fullscreen(globalconf.L, -1, true);
else if(set == _NET_WM_STATE_TOGGLE)
client_setfullscreen(c, !c->isfullscreen);
client_set_fullscreen(globalconf.L, -1, !c->fullscreen);
}
else if(state == _NET_WM_STATE_MAXIMIZED_HORZ)
{
if(set == _NET_WM_STATE_REMOVE)
client_setmaxhoriz(c, false);
client_set_maximized_horizontal(globalconf.L, -1, false);
else if(set == _NET_WM_STATE_ADD)
client_setmaxhoriz(c, true);
client_set_maximized_horizontal(globalconf.L, -1, true);
else if(set == _NET_WM_STATE_TOGGLE)
client_setmaxhoriz(c, !c->ismaxhoriz);
client_set_maximized_horizontal(globalconf.L, -1, c->maximized_horizontal);
}
else if(state == _NET_WM_STATE_MAXIMIZED_VERT)
{
if(set == _NET_WM_STATE_REMOVE)
client_setmaxvert(c, false);
client_set_maximized_vertical(globalconf.L, -1, false);
else if(set == _NET_WM_STATE_ADD)
client_setmaxvert(c, true);
client_set_maximized_vertical(globalconf.L, -1, true);
else if(set == _NET_WM_STATE_TOGGLE)
client_setmaxvert(c, !c->ismaxvert);
client_set_maximized_vertical(globalconf.L, -1, !c->maximized_vertical);
}
else if(state == _NET_WM_STATE_ABOVE)
{
if(set == _NET_WM_STATE_REMOVE)
client_setabove(c, false);
client_set_above(globalconf.L, -1, false);
else if(set == _NET_WM_STATE_ADD)
client_setabove(c, true);
client_set_above(globalconf.L, -1, true);
else if(set == _NET_WM_STATE_TOGGLE)
client_setabove(c, !c->isabove);
client_set_above(globalconf.L, -1, !c->above);
}
else if(state == _NET_WM_STATE_BELOW)
{
if(set == _NET_WM_STATE_REMOVE)
client_setbelow(c, false);
client_set_below(globalconf.L, -1, false);
else if(set == _NET_WM_STATE_ADD)
client_setbelow(c, true);
client_set_below(globalconf.L, -1, true);
else if(set == _NET_WM_STATE_TOGGLE)
client_setbelow(c, !c->isbelow);
client_set_below(globalconf.L, -1, !c->below);
}
else if(state == _NET_WM_STATE_MODAL)
{
if(set == _NET_WM_STATE_REMOVE)
client_setmodal(c, false);
client_set_modal(globalconf.L, -1, false);
else if(set == _NET_WM_STATE_ADD)
client_setmodal(c, true);
client_set_modal(globalconf.L, -1, true);
else if(set == _NET_WM_STATE_TOGGLE)
client_setmodal(c, !c->ismodal);
client_set_modal(globalconf.L, -1, !c->modal);
}
else if(state == _NET_WM_STATE_HIDDEN)
{
if(set == _NET_WM_STATE_REMOVE)
client_setminimized(c, false);
client_set_minimized(globalconf.L, -1, false);
else if(set == _NET_WM_STATE_ADD)
client_setminimized(c, true);
client_set_minimized(globalconf.L, -1, true);
else if(set == _NET_WM_STATE_TOGGLE)
client_setminimized(c, !c->isminimized);
client_set_minimized(globalconf.L, -1, !c->minimized);
}
else if(state == _NET_WM_STATE_DEMANDS_ATTENTION)
{
if(set == _NET_WM_STATE_REMOVE)
client_seturgent(c, false);
client_set_urgent(globalconf.L, -1, false);
else if(set == _NET_WM_STATE_ADD)
client_seturgent(c, true);
client_set_urgent(globalconf.L, -1, true);
else if(set == _NET_WM_STATE_TOGGLE)
client_seturgent(c, !c->isurgent);
client_set_urgent(globalconf.L, -1, !c->urgent);
}
}
@ -383,7 +385,7 @@ ewmh_process_client_message(xcb_client_message_event_t *ev)
tag_array_t *tags = &c->screen->tags;
if(ev->data.data32[0] == 0xffffffff)
c->issticky = true;
c->sticky = true;
else
for(int i = 0; i < tags->len; i++)
if((int)ev->data.data32[0] == i)
@ -423,29 +425,29 @@ ewmh_client_update_hints(client_t *c)
xcb_atom_t state[10]; /* number of defined state atoms */
int i = 0;
if(c->ismodal)
if(c->modal)
state[i++] = _NET_WM_STATE_MODAL;
if(c->isfullscreen)
if(c->fullscreen)
state[i++] = _NET_WM_STATE_FULLSCREEN;
if(c->ismaxvert)
if(c->maximized_vertical)
state[i++] = _NET_WM_STATE_MAXIMIZED_VERT;
if(c->ismaxhoriz)
if(c->maximized_horizontal)
state[i++] = _NET_WM_STATE_MAXIMIZED_HORZ;
if(c->issticky)
if(c->sticky)
state[i++] = _NET_WM_STATE_STICKY;
if(c->skiptb)
if(c->skip_taskbar)
state[i++] = _NET_WM_STATE_SKIP_TASKBAR;
if(c->isabove)
if(c->above)
state[i++] = _NET_WM_STATE_ABOVE;
if(c->isbelow)
if(c->below)
state[i++] = _NET_WM_STATE_BELOW;
if(c->isminimized)
if(c->minimized)
state[i++] = _NET_WM_STATE_HIDDEN;
if(c->isurgent)
if(c->urgent)
state[i++] = _NET_WM_STATE_DEMANDS_ATTENTION;
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
c->win, _NET_WM_STATE, ATOM, 32, i, state);
c->window, _NET_WM_STATE, ATOM, 32, i, state);
}
/** Update the client active desktop.
@ -463,7 +465,7 @@ ewmh_client_update_desktop(client_t *c)
if(is_client_tagged(c, tags->tab[i]))
{
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
c->win, _NET_WM_DESKTOP, CARDINAL, 32, 1, &i);
c->window, _NET_WM_DESKTOP, CARDINAL, 32, 1, &i);
return;
}
}
@ -491,7 +493,7 @@ ewmh_update_client_strut(client_t *c)
};
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
c->win, _NET_WM_STRUT_PARTIAL, CARDINAL, 32, countof(state), state);
c->window, _NET_WM_STRUT_PARTIAL, CARDINAL, 32, countof(state), state);
}
void
@ -504,13 +506,13 @@ ewmh_client_check_hints(client_t *c)
xcb_get_property_reply_t *reply;
/* Send the GetProperty requests which will be processed later */
c0 = xcb_get_property_unchecked(globalconf.connection, false, c->win,
c0 = xcb_get_property_unchecked(globalconf.connection, false, c->window,
_NET_WM_DESKTOP, XCB_GET_PROPERTY_TYPE_ANY, 0, 1);
c1 = xcb_get_property_unchecked(globalconf.connection, false, c->win,
c1 = xcb_get_property_unchecked(globalconf.connection, false, c->window,
_NET_WM_STATE, ATOM, 0, UINT32_MAX);
c2 = xcb_get_property_unchecked(globalconf.connection, false, c->win,
c2 = xcb_get_property_unchecked(globalconf.connection, false, c->window,
_NET_WM_WINDOW_TYPE, ATOM, 0, UINT32_MAX);
reply = xcb_get_property_reply(globalconf.connection, c0, NULL);
@ -520,7 +522,7 @@ ewmh_client_check_hints(client_t *c)
desktop = *(uint32_t *) data;
if(desktop == -1)
c->issticky = true;
c->sticky = true;
else
for(int i = 0; i < tags->len; i++)
if(desktop == i)
@ -580,7 +582,7 @@ ewmh_process_client_strut(client_t *c, xcb_get_property_reply_t *strut_r)
if(!strut_r)
{
xcb_get_property_cookie_t strut_q = xcb_get_property_unchecked(globalconf.connection, false, c->win,
xcb_get_property_cookie_t strut_q = xcb_get_property_unchecked(globalconf.connection, false, c->window,
_NET_WM_STRUT_PARTIAL, CARDINAL, 0, 12);
strut_r = mstrut_r = xcb_get_property_reply(globalconf.connection, strut_q, NULL);
}

5
luaa.c
View File

@ -55,8 +55,6 @@ extern const struct luaL_reg awesome_mouse_methods[];
extern const struct luaL_reg awesome_mouse_meta[];
extern const struct luaL_reg awesome_screen_methods[];
extern const struct luaL_reg awesome_screen_meta[];
extern const struct luaL_reg awesome_client_methods[];
extern const struct luaL_reg awesome_client_meta[];
/** Quit awesome.
* \param L The Lua VM state.
@ -745,8 +743,7 @@ luaA_init(xdgHandle* xdg)
widget_class_setup(L);
/* Export client */
luaA_class_setup(L, &client_class, "client", (lua_class_allocator_t) client_new,
awesome_client_methods, awesome_client_meta);
client_class_setup(L);
/* Export keys */
key_class_setup(L);

View File

@ -45,14 +45,16 @@ property_update_wm_transient_for(client_t *c, xcb_get_property_reply_t *reply)
{
if(!xcb_get_wm_transient_for_reply(globalconf.connection,
xcb_get_wm_transient_for_unchecked(globalconf.connection,
c->win),
c->window),
&trans, NULL))
return;
}
c->type = WINDOW_TYPE_DIALOG;
c->transient_for = client_getbywin(trans);
client_setabove(c, false);
luaA_object_push(globalconf.L, c);
client_set_type(globalconf.L, -1, WINDOW_TYPE_DIALOG);
client_set_above(globalconf.L, -1, false);
client_set_transient_for(globalconf.L, -1, client_getbywin(trans));
lua_pop(globalconf.L, 1);
}
static int
@ -77,12 +79,13 @@ property_update_wm_client_machine(client_t *c)
ssize_t slen;
char *value;
if(!xutil_text_prop_get(globalconf.connection, c->win,
if(!xutil_text_prop_get(globalconf.connection, c->window,
WM_CLIENT_MACHINE, &value, &slen))
return;
p_delete(&c->machine);
c->machine = a_strdup(value);
luaA_object_push(globalconf.L, c);
client_set_machine(globalconf.L, -1, value);
lua_pop(globalconf.L, 1);
}
static int
@ -107,12 +110,13 @@ property_update_wm_window_role(client_t *c)
ssize_t slen;
char *value;
if(!xutil_text_prop_get(globalconf.connection, c->win,
if(!xutil_text_prop_get(globalconf.connection, c->window,
WM_WINDOW_ROLE, &value, &slen))
return;
p_delete(&c->role);
c->role = a_strdup(value);
luaA_object_push(globalconf.L, c);
client_set_role(globalconf.L, -1, value);
lua_pop(globalconf.L, 1);
}
static int
@ -144,14 +148,14 @@ property_update_wm_client_leader(client_t *c, xcb_get_property_reply_t *reply)
if(no_reply)
{
client_leader_q = xcb_get_property_unchecked(globalconf.connection, false, c->win,
client_leader_q = xcb_get_property_unchecked(globalconf.connection, false, c->window,
WM_CLIENT_LEADER, WINDOW, 0, 32);
reply = xcb_get_property_reply(globalconf.connection, client_leader_q, NULL);
}
if(reply && reply->value_len && (data = xcb_get_property_value(reply)))
c->leader_win = *(xcb_window_t *) data;
c->leader_window = *(xcb_window_t *) data;
/* Only free when we created a reply ourselves. */
if(no_reply)
@ -190,7 +194,7 @@ property_update_wm_normal_hints(client_t *c, xcb_get_property_reply_t *reply)
{
if(!xcb_get_wm_normal_hints_reply(globalconf.connection,
xcb_get_wm_normal_hints_unchecked(globalconf.connection,
c->win),
c->window),
&c->size_hints, NULL))
return;
}
@ -229,22 +233,22 @@ property_update_wm_hints(client_t *c, xcb_get_property_reply_t *reply)
else
{
if(!xcb_get_wm_hints_reply(globalconf.connection,
xcb_get_wm_hints_unchecked(globalconf.connection, c->win),
xcb_get_wm_hints_unchecked(globalconf.connection, c->window),
&wmh, NULL))
return;
}
bool isurgent = xcb_wm_hints_get_urgency(&wmh);
client_seturgent(c, isurgent);
luaA_object_push(globalconf.L, c);
client_set_urgent(globalconf.L, -1, xcb_wm_hints_get_urgency(&wmh));
if(wmh.flags & XCB_WM_HINT_STATE &&
wmh.initial_state == XCB_WM_STATE_WITHDRAWN)
client_setborder(c, 0);
client_set_border_width(globalconf.L, -1, 0);
if(wmh.flags & XCB_WM_HINT_INPUT)
c->nofocus = !wmh.input;
if(wmh.flags & XCB_WM_HINT_WINDOW_GROUP)
c->group_win = wmh.window_group;
client_set_group_window(globalconf.L, -1, wmh.window_group);
}
static int
@ -272,16 +276,13 @@ property_update_wm_name(client_t *c)
char *name;
ssize_t len;
if(!xutil_text_prop_get(globalconf.connection, c->win, _NET_WM_NAME, &name, &len))
if(!xutil_text_prop_get(globalconf.connection, c->win, WM_NAME, &name, &len))
if(!xutil_text_prop_get(globalconf.connection, c->window, _NET_WM_NAME, &name, &len))
if(!xutil_text_prop_get(globalconf.connection, c->window, WM_NAME, &name, &len))
return;
p_delete(&c->name);
c->name = name;
/* call hook */
hook_property(c, "name");
luaA_object_push(globalconf.L, c);
client_set_name(globalconf.L, -1, name);
lua_pop(globalconf.L, 1);
}
/** Update WM_CLASS of a client.
@ -301,16 +302,15 @@ property_update_wm_class(client_t *c, xcb_get_property_reply_t *reply)
else
{
if(!xcb_get_wm_class_reply(globalconf.connection,
xcb_get_wm_class_unchecked(globalconf.connection, c->win),
xcb_get_wm_class_unchecked(globalconf.connection, c->window),
&hint, NULL))
return;
}
p_delete(&c->instance);
p_delete(&c->class);
luaA_object_push(globalconf.L, c);
client_set_class_instance(globalconf.L, -1, hint.instance_name, hint.class_name);
lua_pop(globalconf.L, 1);
c->instance = a_strdup(hint.instance_name);
c->class = a_strdup(hint.class_name);
/* only delete reply if we get it ourselves */
if(!reply)
xcb_get_wm_class_reply_wipe(&hint);
@ -325,16 +325,13 @@ property_update_wm_icon_name(client_t *c)
char *name;
ssize_t len;
if(!xutil_text_prop_get(globalconf.connection, c->win, _NET_WM_ICON_NAME, &name, &len))
if(!xutil_text_prop_get(globalconf.connection, c->win, WM_ICON_NAME, &name, &len))
if(!xutil_text_prop_get(globalconf.connection, c->window, _NET_WM_ICON_NAME, &name, &len))
if(!xutil_text_prop_get(globalconf.connection, c->window, WM_ICON_NAME, &name, &len))
return;
p_delete(&c->icon_name);
c->icon_name = name;
/* call hook */
hook_property(c, "icon_name");
luaA_object_push(globalconf.L, c);
client_set_icon_name(globalconf.L, -1, name);
lua_pop(globalconf.L, 1);
}
static int
@ -401,6 +398,31 @@ property_handle_net_wm_strut_partial(void *data,
return 0;
}
void
property_update_net_wm_icon(client_t *c,
xcb_get_property_reply_t *reply)
{
luaA_object_push(globalconf.L, c);
if(reply)
{
if(ewmh_window_icon_from_reply(reply))
{
client_set_icon(globalconf.L, -2, -1);
/* remove icon */
lua_pop(globalconf.L, 1);
}
}
else if(ewmh_window_icon_get_reply(ewmh_window_icon_get_unchecked(c->window)))
{
client_set_icon(globalconf.L, -2, -1);
/* remove icon */
lua_pop(globalconf.L, 1);
}
lua_pop(globalconf.L, 1);
}
static int
property_handle_net_wm_icon(void *data,
xcb_connection_t *connection,
@ -412,18 +434,7 @@ property_handle_net_wm_icon(void *data,
client_t *c = client_getbywin(window);
if(c)
{
luaA_object_push(globalconf.L, c);
luaA_object_unref_item(globalconf.L, -1, c->icon);
if(ewmh_window_icon_from_reply(reply))
c->icon = luaA_object_ref_item(globalconf.L, -2, -1);
else
c->icon = NULL;
/* remove client */
lua_pop(globalconf.L, 1);
/* execute hook */
hook_property(c, "icon");
}
property_update_net_wm_icon(c, reply);
return 0;
}
@ -437,7 +448,7 @@ property_update_net_wm_pid(client_t *c,
if(no_reply)
{
xcb_get_property_cookie_t prop_c =
xcb_get_property_unchecked(globalconf.connection, false, c->win, _NET_WM_PID, CARDINAL, 0L, 1L);
xcb_get_property_unchecked(globalconf.connection, false, c->window, _NET_WM_PID, CARDINAL, 0L, 1L);
reply = xcb_get_property_reply(globalconf.connection, prop_c, NULL);
}
@ -445,7 +456,11 @@ property_update_net_wm_pid(client_t *c,
{
uint32_t *rdata = xcb_get_property_value(reply);
if(rdata)
c->pid = *rdata;
{
luaA_object_push(globalconf.L, c);
client_set_pid(globalconf.L, -1, *rdata);
lua_pop(globalconf.L, 1);
}
}
if(no_reply)
@ -479,7 +494,7 @@ property_update_wm_protocols(client_t *c)
/* If this fails for any reason, we still got the old value */
if(xcb_get_wm_protocols_reply(globalconf.connection,
xcb_get_wm_protocols_unchecked(globalconf.connection,
c->win, WM_PROTOCOLS),
c->window, WM_PROTOCOLS),
&protocols, NULL))
{
xcb_get_wm_protocols_reply_wipe(&c->protocols);
@ -577,7 +592,11 @@ property_handle_net_wm_opacity(void *data __attribute__ ((unused)),
{
client_t *c = client_getbywin(window);
if(c)
c->opacity = window_opacity_get_from_reply(reply);
{
luaA_object_push(globalconf.L, c);
client_set_opacity(globalconf.L, -1, window_opacity_get_from_reply(reply));
lua_pop(globalconf.L, 1);
}
}
return 0;

View File

@ -35,6 +35,7 @@ void property_update_wm_protocols(client_t *);
void property_update_wm_client_machine(client_t *);
void property_update_wm_window_role(client_t *);
void property_update_net_wm_pid(client_t *, xcb_get_property_reply_t *);
void property_update_net_wm_icon(client_t *, xcb_get_property_reply_t *);
void a_xcb_set_property_handlers(void);
#endif

View File

@ -272,7 +272,7 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool dotag, bool doresiz
untag_client(c, *old_tag);
/* \todo move this to Lua */
if(!c->issticky)
if(!c->sticky)
/* add new tags */
foreach(new_tag, new_screen->tags)
if(tag_get_selected(*new_tag))
@ -293,7 +293,7 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool dotag, bool doresiz
area_t new_geometry = c->geometry;
if(c->isfullscreen)
if(c->fullscreen)
{
new_geometry = to;
area_t new_f_geometry = c->geometries.fullscreen;

View File

@ -43,7 +43,7 @@ titlebar_isvisible(client_t *c, screen_t *screen)
{
if(client_isvisible(c, screen))
{
if(c->isfullscreen)
if(c->fullscreen)
return false;
if(!c->titlebar || !c->titlebar->visible)
return false;