Fix handling of _NET_CURRENT_DESKTOP messages (FS#1219,FS#1217)
Instead of having the C code mess with which tags are selected, we now emit a signal on the tag that says that something requested it to be selected. Lua can then handle this by only switching tags on the correct monitor and by updating the focus history correctly. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
1b21dce46c
commit
2ac95b4ae8
10
ewmh.c
10
ewmh.c
|
@ -365,7 +365,15 @@ ewmh_process_client_message(xcb_client_message_event_t *ev)
|
|||
client_t *c;
|
||||
|
||||
if(ev->type == _NET_CURRENT_DESKTOP)
|
||||
tag_view_only_byindex(ev->data.data32[0]);
|
||||
{
|
||||
int idx = ev->data.data32[0];
|
||||
if (idx >= 0 && idx < globalconf.tags.len)
|
||||
{
|
||||
luaA_object_push(globalconf.L, globalconf.tags.tab[idx]);
|
||||
luaA_object_emit_signal(globalconf.L, -1, "request::select", 0);
|
||||
lua_pop(globalconf.L, 1);
|
||||
}
|
||||
}
|
||||
else if(ev->type == _NET_CLOSE_WINDOW)
|
||||
{
|
||||
if((c = client_getbywin(ev->window)))
|
||||
|
|
|
@ -571,6 +571,7 @@ capi.client.connect_signal("manage", function(c, startup)
|
|||
end)
|
||||
|
||||
capi.client.connect_signal("manage", tag.withcurrent)
|
||||
capi.tag.connect_signal("request::select", tag.viewonly)
|
||||
|
||||
capi.tag.add_signal("property::hide")
|
||||
capi.tag.add_signal("property::icon")
|
||||
|
|
|
@ -161,23 +161,6 @@ tags_get_first_selected_index(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/** View only a tag, selected by its index.
|
||||
* \param dindex The index.
|
||||
*/
|
||||
void
|
||||
tag_view_only_byindex(int dindex)
|
||||
{
|
||||
if(dindex < 0 || dindex >= globalconf.tags.len)
|
||||
return;
|
||||
|
||||
foreach(tag, globalconf.tags)
|
||||
{
|
||||
luaA_object_push(globalconf.L, *tag);
|
||||
tag_view(globalconf.L, -1, *tag == globalconf.tags.tab[dindex]);
|
||||
lua_pop(globalconf.L, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/** Create a new tag.
|
||||
* \param L The Lua VM state.
|
||||
* \luastack
|
||||
|
@ -365,6 +348,7 @@ tag_class_setup(lua_State *L)
|
|||
signal_add(&tag_class.signals, "property::name");
|
||||
signal_add(&tag_class.signals, "property::selected");
|
||||
signal_add(&tag_class.signals, "property::activated");
|
||||
signal_add(&tag_class.signals, "request::select");
|
||||
signal_add(&tag_class.signals, "tagged");
|
||||
signal_add(&tag_class.signals, "untagged");
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ int tags_get_first_selected_index(void);
|
|||
void tag_client(client_t *);
|
||||
void untag_client(client_t *, tag_t *);
|
||||
bool is_client_tagged(client_t *, tag_t *);
|
||||
void tag_view_only_byindex(int);
|
||||
void tag_unref_simplified(tag_t **);
|
||||
|
||||
ARRAY_FUNCS(tag_t *, tag, tag_unref_simplified)
|
||||
|
|
Loading…
Reference in New Issue