Remove support for zaphod mode
This makes awesome support only a single X11 protocol screen. If you are still using zaphod mode, you can run multiple instances of awesome on the single screens, e.g.: DISPLAY=:1.0 awesome & DISPLAY=:1.1 awesome & Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
27f9c0177a
commit
32d9a5b2ab
55
awesome.c
55
awesome.c
|
@ -66,19 +66,11 @@ typedef struct
|
|||
void
|
||||
awesome_atexit(void)
|
||||
{
|
||||
int screen_nbr, nscreens;
|
||||
|
||||
signal_object_emit(globalconf.L, &global_signals, "exit", 0);
|
||||
|
||||
a_dbus_cleanup();
|
||||
|
||||
/* do this only for real screen */
|
||||
const xcb_setup_t *setup = xcb_get_setup(globalconf.connection);
|
||||
nscreens = setup ? xcb_setup_roots_length(setup) : -1;
|
||||
for(screen_nbr = 0;
|
||||
screen_nbr < nscreens;
|
||||
screen_nbr++)
|
||||
systray_cleanup(screen_nbr);
|
||||
systray_cleanup();
|
||||
|
||||
/* Close Lua */
|
||||
lua_close(globalconf.L);
|
||||
|
@ -96,33 +88,27 @@ awesome_atexit(void)
|
|||
static void
|
||||
scan(void)
|
||||
{
|
||||
int i, phys_screen, tree_c_len;
|
||||
const int screen_max = xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
root_win_t root_wins[screen_max];
|
||||
int i, tree_c_len;
|
||||
root_win_t root_win;
|
||||
xcb_query_tree_reply_t *tree_r;
|
||||
xcb_window_t *wins = NULL;
|
||||
xcb_get_window_attributes_reply_t *attr_r;
|
||||
xcb_get_geometry_reply_t *geom_r;
|
||||
long state;
|
||||
|
||||
for(phys_screen = 0; phys_screen < screen_max; phys_screen++)
|
||||
{
|
||||
/* Get the root window ID associated to this screen */
|
||||
root_wins[phys_screen].id = xutil_screen_get(globalconf.connection, phys_screen)->root;
|
||||
root_win.id = xutil_screen_get(globalconf.connection, globalconf.default_screen)->root;
|
||||
|
||||
/* Get the window tree associated to this screen */
|
||||
root_wins[phys_screen].tree_cookie = xcb_query_tree_unchecked(globalconf.connection,
|
||||
root_wins[phys_screen].id);
|
||||
}
|
||||
root_win.tree_cookie = xcb_query_tree_unchecked(globalconf.connection,
|
||||
root_win.id);
|
||||
|
||||
for(phys_screen = 0; phys_screen < screen_max; phys_screen++)
|
||||
{
|
||||
tree_r = xcb_query_tree_reply(globalconf.connection,
|
||||
root_wins[phys_screen].tree_cookie,
|
||||
root_win.tree_cookie,
|
||||
NULL);
|
||||
|
||||
if(!tree_r)
|
||||
continue;
|
||||
return;
|
||||
|
||||
/* Get the tree of the children windows of the current root window */
|
||||
if(!(wins = xcb_query_tree_children(tree_r)))
|
||||
|
@ -172,14 +158,13 @@ scan(void)
|
|||
*(geom_wins[i]), NULL)))
|
||||
continue;
|
||||
|
||||
client_manage(wins[i], geom_r, phys_screen, true);
|
||||
client_manage(wins[i], geom_r, true);
|
||||
|
||||
p_delete(&geom_r);
|
||||
}
|
||||
|
||||
p_delete(&tree_r);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
a_refresh_cb(EV_P_ ev_prepare *w, int revents)
|
||||
|
@ -283,7 +268,7 @@ int
|
|||
main(int argc, char **argv)
|
||||
{
|
||||
char *confpath = NULL;
|
||||
int xfd, i, screen_nbr, opt, colors_nbr;
|
||||
int xfd, i, opt, colors_nbr;
|
||||
xcolor_init_request_t colors_reqs[2];
|
||||
ssize_t cmdlen = 1;
|
||||
xdgHandle xdg;
|
||||
|
@ -408,15 +393,12 @@ main(int argc, char **argv)
|
|||
ev_prepare_start(globalconf.loop, &a_refresh);
|
||||
ev_unref(globalconf.loop);
|
||||
|
||||
for(screen_nbr = 0;
|
||||
screen_nbr < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
screen_nbr++)
|
||||
{
|
||||
const uint32_t select_input_val = XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT;
|
||||
|
||||
/* This causes an error if some other window manager is running */
|
||||
xcb_change_window_attributes(globalconf.connection,
|
||||
xutil_screen_get(globalconf.connection, screen_nbr)->root,
|
||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
||||
XCB_CW_EVENT_MASK, &select_input_val);
|
||||
}
|
||||
|
||||
|
@ -465,13 +447,8 @@ main(int argc, char **argv)
|
|||
&globalconf.modeswitchmask);
|
||||
|
||||
/* do this only for real screen */
|
||||
for(screen_nbr = 0;
|
||||
screen_nbr < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
screen_nbr++)
|
||||
{
|
||||
ewmh_init(screen_nbr);
|
||||
systray_init(screen_nbr);
|
||||
}
|
||||
ewmh_init();
|
||||
systray_init();
|
||||
|
||||
/* init spawn (sn) */
|
||||
spawn_init();
|
||||
|
@ -487,10 +464,6 @@ main(int argc, char **argv)
|
|||
/* scan existing windows */
|
||||
scan();
|
||||
|
||||
/* do this only for real screen */
|
||||
for(screen_nbr = 0;
|
||||
screen_nbr < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
screen_nbr++)
|
||||
{
|
||||
/* select for events */
|
||||
const uint32_t change_win_vals[] =
|
||||
|
@ -505,7 +478,7 @@ main(int argc, char **argv)
|
|||
};
|
||||
|
||||
xcb_change_window_attributes(globalconf.connection,
|
||||
xutil_screen_get(globalconf.connection, screen_nbr)->root,
|
||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
||||
XCB_CW_EVENT_MASK,
|
||||
change_win_vals);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ typedef struct xembed_window xembed_window_t;
|
|||
struct xembed_window
|
||||
{
|
||||
xcb_window_t win;
|
||||
int phys_screen;
|
||||
xembed_info_t info;
|
||||
};
|
||||
|
||||
|
|
|
@ -136,21 +136,4 @@ xutil_key_mask_tostr(uint16_t mask, const char **name, size_t *len)
|
|||
}
|
||||
}
|
||||
|
||||
/** Convert a root window a physical screen ID.
|
||||
* \param connection The connection to the X server.
|
||||
* \param root Root window.
|
||||
* \return A physical screen number.
|
||||
*/
|
||||
int
|
||||
xutil_root2screen(xcb_connection_t *connection, xcb_window_t root)
|
||||
{
|
||||
xcb_screen_iterator_t iter;
|
||||
int phys_screen = 0;
|
||||
|
||||
for(iter = xcb_setup_roots_iterator(xcb_get_setup(connection));
|
||||
iter.rem && iter.data->root != root; xcb_screen_next(&iter), ++phys_screen);
|
||||
|
||||
return phys_screen;
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
|
@ -80,7 +80,5 @@ xutil_screen_get(xcb_connection_t *c, int screen)
|
|||
return s;
|
||||
}
|
||||
|
||||
int xutil_root2screen(xcb_connection_t *, xcb_window_t);
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
9
draw.c
9
draw.c
|
@ -126,16 +126,15 @@ draw_text_context_init(draw_text_context_t *data, const char *str, ssize_t slen)
|
|||
* \param bg Background color.
|
||||
*/
|
||||
void
|
||||
draw_context_init(draw_context_t *d, int phys_screen,
|
||||
draw_context_init(draw_context_t *d,
|
||||
int width, int height, xcb_pixmap_t px,
|
||||
const xcolor_t *fg, const xcolor_t *bg)
|
||||
{
|
||||
d->phys_screen = phys_screen;
|
||||
d->width = width;
|
||||
d->height = height;
|
||||
d->pixmap = px;
|
||||
d->surface = cairo_xcb_surface_create(globalconf.connection,
|
||||
px, globalconf.screens.tab[phys_screen].visual,
|
||||
px, globalconf.screens.tab[0].visual,
|
||||
width, height);
|
||||
d->cr = cairo_create(d->surface);
|
||||
d->layout = pango_cairo_create_layout(d->cr);
|
||||
|
@ -308,10 +307,10 @@ draw_rotate(draw_context_t *ctx,
|
|||
cairo_t *cr;
|
||||
|
||||
surface = cairo_xcb_surface_create(globalconf.connection, dest,
|
||||
globalconf.screens.tab[ctx->phys_screen].visual,
|
||||
globalconf.screens.tab[0].visual,
|
||||
dest_w, dest_h);
|
||||
source = cairo_xcb_surface_create(globalconf.connection, src,
|
||||
globalconf.screens.tab[ctx->phys_screen].visual,
|
||||
globalconf.screens.tab[0].visual,
|
||||
src_w, src_h);
|
||||
cr = cairo_create (surface);
|
||||
|
||||
|
|
3
draw.h
3
draw.h
|
@ -61,7 +61,6 @@ typedef struct
|
|||
xcb_pixmap_t pixmap;
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
int phys_screen;
|
||||
cairo_t *cr;
|
||||
cairo_surface_t *surface;
|
||||
PangoLayout *layout;
|
||||
|
@ -69,7 +68,7 @@ typedef struct
|
|||
xcolor_t bg;
|
||||
} draw_context_t;
|
||||
|
||||
void draw_context_init(draw_context_t *, int, int, int,
|
||||
void draw_context_init(draw_context_t *, int, int,
|
||||
xcb_pixmap_t, const xcolor_t *, const xcolor_t *);
|
||||
|
||||
/** Wipe a draw context.
|
||||
|
|
26
event.c
26
event.c
|
@ -133,8 +133,6 @@ event_handle_mousegrabber(int x, int y, uint16_t mask)
|
|||
static void
|
||||
event_handle_button(xcb_button_press_event_t *ev)
|
||||
{
|
||||
int screen;
|
||||
const int nb_screen = xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
client_t *c;
|
||||
wibox_t *wibox;
|
||||
|
||||
|
@ -194,8 +192,7 @@ event_handle_button(xcb_button_press_event_t *ev)
|
|||
XCB_CURRENT_TIME);
|
||||
}
|
||||
else if(ev->child == XCB_NONE)
|
||||
for(screen = 0; screen < nb_screen; screen++)
|
||||
if(xutil_screen_get(globalconf.connection, screen)->root == ev->event)
|
||||
if(xutil_screen_get(globalconf.connection, globalconf.default_screen)->root == ev->event)
|
||||
{
|
||||
event_button_callback(ev, &globalconf.buttons, 0, 0, NULL);
|
||||
return;
|
||||
|
@ -290,12 +287,9 @@ event_handle_configurerequest(xcb_configure_request_event_t *ev)
|
|||
static void
|
||||
event_handle_configurenotify(xcb_configure_notify_event_t *ev)
|
||||
{
|
||||
int screen_nbr;
|
||||
const xcb_screen_t *screen;
|
||||
const xcb_screen_t *screen = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
|
||||
for(screen_nbr = 0; screen_nbr < xcb_setup_roots_length(xcb_get_setup(globalconf.connection)); screen_nbr++)
|
||||
if((screen = xutil_screen_get(globalconf.connection, screen_nbr)) != NULL
|
||||
&& ev->window == screen->root
|
||||
if(ev->window == screen->root
|
||||
&& (ev->width != screen->width_in_pixels
|
||||
|| ev->height != screen->height_in_pixels))
|
||||
/* it's not that we panic, but restart */
|
||||
|
@ -578,7 +572,6 @@ event_handle_key(xcb_key_press_event_t *ev)
|
|||
static void
|
||||
event_handle_maprequest(xcb_map_request_event_t *ev)
|
||||
{
|
||||
int phys_screen;
|
||||
client_t *c;
|
||||
xcb_get_window_attributes_cookie_t wa_c;
|
||||
xcb_get_window_attributes_reply_t *wa_r;
|
||||
|
@ -619,9 +612,7 @@ event_handle_maprequest(xcb_map_request_event_t *ev)
|
|||
goto bailout;
|
||||
}
|
||||
|
||||
phys_screen = xutil_root2screen(globalconf.connection, geom_r->root);
|
||||
|
||||
client_manage(ev->window, geom_r, phys_screen, false);
|
||||
client_manage(ev->window, geom_r, false);
|
||||
|
||||
p_delete(&geom_r);
|
||||
}
|
||||
|
@ -729,16 +720,11 @@ event_handle_mappingnotify(xcb_mapping_notify_event_t *ev)
|
|||
&globalconf.shiftlockmask, &globalconf.capslockmask,
|
||||
&globalconf.modeswitchmask);
|
||||
|
||||
int nscreen = xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
|
||||
/* regrab everything */
|
||||
for(int phys_screen = 0; phys_screen < nscreen; phys_screen++)
|
||||
{
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, phys_screen);
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
/* yes XCB_BUTTON_MASK_ANY is also for grab_key even if it's look weird */
|
||||
xcb_ungrab_key(globalconf.connection, XCB_GRAB_ANY, s->root, XCB_BUTTON_MASK_ANY);
|
||||
xwindow_grabkeys(s->root, &globalconf.keys);
|
||||
}
|
||||
|
||||
foreach(_c, globalconf.clients)
|
||||
{
|
||||
|
@ -758,7 +744,7 @@ event_handle_reparentnotify(xcb_reparent_notify_event_t *ev)
|
|||
{
|
||||
/* Ignore reparents to the root window, they *might* be caused by
|
||||
* ourselves if a client quickly unmaps and maps itself again. */
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, c->phys_screen);
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
if (ev->parent != s->root)
|
||||
client_unmanage(c);
|
||||
}
|
||||
|
|
57
ewmh.c
57
ewmh.c
|
@ -98,43 +98,40 @@ ewmh_signal_on_client_new(lua_State *L)
|
|||
}
|
||||
|
||||
/** Update the desktop geometry.
|
||||
* \param phys_screen The physical screen id.
|
||||
*/
|
||||
static void
|
||||
ewmh_update_desktop_geometry(int phys_screen)
|
||||
ewmh_update_desktop_geometry(void)
|
||||
{
|
||||
area_t geom = screen_area_get(&globalconf.screens.tab[phys_screen], false);
|
||||
area_t geom = screen_area_get(&globalconf.screens.tab[0], false);
|
||||
uint32_t sizes[] = { geom.width, geom.height };
|
||||
|
||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||
xutil_screen_get(globalconf.connection, phys_screen)->root,
|
||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
||||
_NET_DESKTOP_GEOMETRY, XCB_ATOM_CARDINAL, 32, countof(sizes), sizes);
|
||||
}
|
||||
|
||||
static int
|
||||
ewmh_update_net_active_window(lua_State *L)
|
||||
{
|
||||
client_t *c = luaA_checkudata(L, 1, &client_class);
|
||||
xcb_window_t win;
|
||||
|
||||
if(globalconf.screen_focus->client_focus
|
||||
&& globalconf.screen_focus->client_focus->phys_screen == c->phys_screen)
|
||||
if(globalconf.screen_focus->client_focus)
|
||||
win = globalconf.screen_focus->client_focus->window;
|
||||
else
|
||||
win = XCB_NONE;
|
||||
|
||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||
xutil_screen_get(globalconf.connection, c->phys_screen)->root,
|
||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
||||
_NET_ACTIVE_WINDOW, XCB_ATOM_WINDOW, 32, 1, &win);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ewmh_init(int phys_screen)
|
||||
ewmh_init(void)
|
||||
{
|
||||
xcb_window_t father;
|
||||
xcb_screen_t *xscreen = xutil_screen_get(globalconf.connection, phys_screen);
|
||||
xcb_screen_t *xscreen = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
xcb_atom_t atom[] =
|
||||
{
|
||||
_NET_SUPPORTED,
|
||||
|
@ -211,7 +208,7 @@ ewmh_init(int phys_screen)
|
|||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||
father, _NET_WM_PID, XCB_ATOM_CARDINAL, 32, 1, &i);
|
||||
|
||||
ewmh_update_desktop_geometry(phys_screen);
|
||||
ewmh_update_desktop_geometry();
|
||||
|
||||
lua_pushcfunction(globalconf.L, ewmh_signal_on_client_new);
|
||||
luaA_class_add_signal(globalconf.L, &client_class, "new", -1);
|
||||
|
@ -222,7 +219,7 @@ ewmh_init(int phys_screen)
|
|||
}
|
||||
|
||||
void
|
||||
ewmh_update_net_client_list(int phys_screen)
|
||||
ewmh_update_net_client_list(void)
|
||||
{
|
||||
xcb_window_t *wins = p_alloca(xcb_window_t, globalconf.clients.len);
|
||||
|
||||
|
@ -230,68 +227,65 @@ ewmh_update_net_client_list(int phys_screen)
|
|||
foreach(_c, globalconf.clients)
|
||||
{
|
||||
client_t *c = *_c;
|
||||
if(c->phys_screen == phys_screen)
|
||||
wins[n++] = c->window;
|
||||
}
|
||||
|
||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||
xutil_screen_get(globalconf.connection, phys_screen)->root,
|
||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
||||
_NET_CLIENT_LIST, XCB_ATOM_WINDOW, 32, n, wins);
|
||||
}
|
||||
|
||||
/** Set the client list in stacking order, bottom to top.
|
||||
* \param phys_screen The physical screen id.
|
||||
*/
|
||||
void
|
||||
ewmh_update_net_client_list_stacking(int phys_screen)
|
||||
ewmh_update_net_client_list_stacking(void)
|
||||
{
|
||||
int n = 0;
|
||||
xcb_window_t *wins = p_alloca(xcb_window_t, globalconf.stack.len);
|
||||
|
||||
foreach(client, globalconf.stack)
|
||||
if((*client)->phys_screen == phys_screen)
|
||||
wins[n++] = (*client)->window;
|
||||
|
||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||
xutil_screen_get(globalconf.connection, phys_screen)->root,
|
||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
||||
_NET_CLIENT_LIST_STACKING, XCB_ATOM_WINDOW, 32, n, wins);
|
||||
}
|
||||
|
||||
void
|
||||
ewmh_update_net_numbers_of_desktop(int phys_screen)
|
||||
ewmh_update_net_numbers_of_desktop(void)
|
||||
{
|
||||
uint32_t count = globalconf.screens.tab[phys_screen].tags.len;
|
||||
uint32_t count = globalconf.screens.tab[0].tags.len;
|
||||
|
||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||
xutil_screen_get(globalconf.connection, phys_screen)->root,
|
||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
||||
_NET_NUMBER_OF_DESKTOPS, XCB_ATOM_CARDINAL, 32, 1, &count);
|
||||
}
|
||||
|
||||
void
|
||||
ewmh_update_net_current_desktop(int phys_screen)
|
||||
ewmh_update_net_current_desktop(void)
|
||||
{
|
||||
uint32_t idx = tags_get_first_selected_index(&globalconf.screens.tab[phys_screen]);
|
||||
uint32_t idx = tags_get_first_selected_index(&globalconf.screens.tab[0]);
|
||||
|
||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||
xutil_screen_get(globalconf.connection, phys_screen)->root,
|
||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
||||
_NET_CURRENT_DESKTOP, XCB_ATOM_CARDINAL, 32, 1, &idx);
|
||||
}
|
||||
|
||||
void
|
||||
ewmh_update_net_desktop_names(int phys_screen)
|
||||
ewmh_update_net_desktop_names(void)
|
||||
{
|
||||
buffer_t buf;
|
||||
|
||||
buffer_inita(&buf, BUFSIZ);
|
||||
|
||||
foreach(tag, globalconf.screens.tab[phys_screen].tags)
|
||||
foreach(tag, globalconf.screens.tab[0].tags)
|
||||
{
|
||||
buffer_adds(&buf, tag_get_name(*tag));
|
||||
buffer_addc(&buf, '\0');
|
||||
}
|
||||
|
||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||
xutil_screen_get(globalconf.connection, phys_screen)->root,
|
||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
||||
_NET_DESKTOP_NAMES, UTF8_STRING, 8, buf.len, buf.s);
|
||||
buffer_wipe(&buf);
|
||||
}
|
||||
|
@ -399,16 +393,9 @@ int
|
|||
ewmh_process_client_message(xcb_client_message_event_t *ev)
|
||||
{
|
||||
client_t *c;
|
||||
int screen;
|
||||
|
||||
if(ev->type == _NET_CURRENT_DESKTOP)
|
||||
for(screen = 0;
|
||||
screen < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
screen++)
|
||||
{
|
||||
if(ev->window == xutil_screen_get(globalconf.connection, screen)->root)
|
||||
tag_view_only_byindex(&globalconf.screens.tab[screen], ev->data.data32[0]);
|
||||
}
|
||||
tag_view_only_byindex(&globalconf.screens.tab[0], ev->data.data32[0]);
|
||||
else if(ev->type == _NET_CLOSE_WINDOW)
|
||||
{
|
||||
if((c = client_getbywin(ev->window)))
|
||||
|
|
12
ewmh.h
12
ewmh.h
|
@ -25,13 +25,13 @@
|
|||
#include "globalconf.h"
|
||||
#include "strut.h"
|
||||
|
||||
void ewmh_init(int);
|
||||
void ewmh_update_net_client_list(int);
|
||||
void ewmh_update_net_numbers_of_desktop(int);
|
||||
void ewmh_update_net_current_desktop(int);
|
||||
void ewmh_update_net_desktop_names(int);
|
||||
void ewmh_init(void);
|
||||
void ewmh_update_net_client_list(void);
|
||||
void ewmh_update_net_numbers_of_desktop(void);
|
||||
void ewmh_update_net_current_desktop(void);
|
||||
void ewmh_update_net_desktop_names(void);
|
||||
int ewmh_process_client_message(xcb_client_message_event_t *);
|
||||
void ewmh_update_net_client_list_stacking(int);
|
||||
void ewmh_update_net_client_list_stacking(void);
|
||||
void ewmh_client_check_hints(client_t *);
|
||||
void ewmh_client_update_desktop(client_t *);
|
||||
void ewmh_process_client_strut(client_t *);
|
||||
|
|
15
mouse.c
15
mouse.c
|
@ -71,18 +71,13 @@ mouse_query_pointer(xcb_window_t window, int16_t *x, int16_t *y, xcb_window_t *c
|
|||
static bool
|
||||
mouse_query_pointer_root(screen_t **s, int16_t *x, int16_t *y, xcb_window_t *child, uint16_t *mask)
|
||||
{
|
||||
for(int screen = 0;
|
||||
screen < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
screen++)
|
||||
{
|
||||
xcb_window_t root = xutil_screen_get(globalconf.connection, screen)->root;
|
||||
xcb_window_t root = xutil_screen_get(globalconf.connection, globalconf.default_screen)->root;
|
||||
|
||||
if(mouse_query_pointer(root, x, y, child, mask))
|
||||
{
|
||||
*s = &globalconf.screens.tab[screen];
|
||||
*s = &globalconf.screens.tab[0];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -141,7 +136,7 @@ luaA_mouse_newindex(lua_State *L)
|
|||
const char *attr = luaL_checklstring(L, 2, &len);
|
||||
int x, y = 0;
|
||||
xcb_window_t root;
|
||||
int screen, phys_screen;
|
||||
int screen;
|
||||
|
||||
switch(a_tokenize(attr, len))
|
||||
{
|
||||
|
@ -149,9 +144,7 @@ luaA_mouse_newindex(lua_State *L)
|
|||
screen = luaL_checknumber(L, 3) - 1;
|
||||
luaA_checkscreen(screen);
|
||||
|
||||
/* we need the physical one to get the root window */
|
||||
phys_screen = screen_virttophys(screen);
|
||||
root = xutil_screen_get(globalconf.connection, phys_screen)->root;
|
||||
root = xutil_screen_get(globalconf.connection, globalconf.default_screen)->root;
|
||||
|
||||
x = globalconf.screens.tab[screen].geometry.x;
|
||||
y = globalconf.screens.tab[screen].geometry.y;
|
||||
|
|
|
@ -35,19 +35,7 @@
|
|||
static bool
|
||||
mousegrabber_grab(xcb_cursor_t cursor)
|
||||
{
|
||||
xcb_window_t root = XCB_NONE;
|
||||
|
||||
for(int screen = 0;
|
||||
screen < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
screen++)
|
||||
{
|
||||
int16_t x, y;
|
||||
uint16_t mask;
|
||||
|
||||
root = xutil_screen_get(globalconf.connection, screen)->root;
|
||||
if(mouse_query_pointer(root, &x, &y, NULL, &mask))
|
||||
break;
|
||||
}
|
||||
xcb_window_t root = xutil_screen_get(globalconf.connection, globalconf.default_screen)->root;
|
||||
|
||||
for(int i = 1000; i; i--)
|
||||
{
|
||||
|
|
|
@ -253,7 +253,7 @@ client_getbyframewin(xcb_window_t w)
|
|||
void
|
||||
client_unfocus_update(client_t *c)
|
||||
{
|
||||
globalconf.screens.tab[c->phys_screen].client_focus = NULL;
|
||||
globalconf.screens.tab[0].client_focus = NULL;
|
||||
|
||||
luaA_object_push(globalconf.L, c);
|
||||
luaA_class_emit_signal(globalconf.L, &client_class, "unfocus", 1);
|
||||
|
@ -266,7 +266,7 @@ void
|
|||
client_unfocus(client_t *c)
|
||||
{
|
||||
|
||||
xcb_window_t root_win = xutil_screen_get(globalconf.connection, c->phys_screen)->root;
|
||||
xcb_window_t root_win = xutil_screen_get(globalconf.connection, globalconf.default_screen)->root;
|
||||
/* Set focus on root window, so no events leak to the current window.
|
||||
* This kind of inlines client_set_focus(), but a root window will never have
|
||||
* the WM_TAKE_FOCUS protocol.
|
||||
|
@ -311,11 +311,11 @@ client_set_focus(client_t *c, bool set_input_focus)
|
|||
*/
|
||||
void client_ban_unfocus(client_t *c)
|
||||
{
|
||||
if(globalconf.screens.tab[c->phys_screen].prev_client_focus == c)
|
||||
globalconf.screens.tab[c->phys_screen].prev_client_focus = NULL;
|
||||
if(globalconf.screens.tab[0].prev_client_focus == c)
|
||||
globalconf.screens.tab[0].prev_client_focus = NULL;
|
||||
|
||||
/* Wait until the last moment to take away the focus from the window. */
|
||||
if(globalconf.screens.tab[c->phys_screen].client_focus == c)
|
||||
if(globalconf.screens.tab[0].client_focus == c)
|
||||
client_unfocus(c);
|
||||
}
|
||||
|
||||
|
@ -393,7 +393,7 @@ client_focus_update(client_t *c)
|
|||
return;
|
||||
}
|
||||
|
||||
globalconf.screen_focus = &globalconf.screens.tab[c->phys_screen];
|
||||
globalconf.screen_focus = &globalconf.screens.tab[0];
|
||||
globalconf.screen_focus->prev_client_focus = c;
|
||||
globalconf.screen_focus->client_focus = c;
|
||||
|
||||
|
@ -467,17 +467,16 @@ client_update_properties(client_t *c)
|
|||
/** Manage a new client.
|
||||
* \param w The window.
|
||||
* \param wgeom Window geometry.
|
||||
* \param phys_screen Physical screen number.
|
||||
* \param startup True if we are managing at startup time.
|
||||
*/
|
||||
void
|
||||
client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen, bool startup)
|
||||
client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, bool startup)
|
||||
{
|
||||
const uint32_t select_input_val[] = { CLIENT_SELECT_INPUT_EVENT_MASK };
|
||||
|
||||
if(systray_iskdedockapp(w))
|
||||
{
|
||||
systray_request_handle(w, phys_screen, NULL);
|
||||
systray_request_handle(w, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -492,10 +491,8 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
|
|||
xcb_change_save_set(globalconf.connection, XCB_SET_MODE_INSERT, w);
|
||||
|
||||
client_t *c = client_new(globalconf.L);
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, phys_screen);
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
|
||||
/* This cannot change, ever. */
|
||||
c->phys_screen = phys_screen;
|
||||
/* consider the window banned */
|
||||
c->isbanned = true;
|
||||
/* Store window */
|
||||
|
@ -542,7 +539,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
|
|||
client_array_push(&globalconf.clients, luaA_object_ref(globalconf.L, -1));
|
||||
|
||||
/* Set the right screen */
|
||||
screen_client_moveto(c, screen_getbycoord(&globalconf.screens.tab[phys_screen], wgeom->x, wgeom->y), false);
|
||||
screen_client_moveto(c, screen_getbycoord(&globalconf.screens.tab[0], wgeom->x, wgeom->y), false);
|
||||
|
||||
/* Store initial geometry and emits signals so we inform that geometry have
|
||||
* been set. */
|
||||
|
@ -573,7 +570,7 @@ HANDLE_GEOM(height)
|
|||
/* Push client in stack */
|
||||
client_raise(c);
|
||||
|
||||
ewmh_update_net_client_list(c->phys_screen);
|
||||
ewmh_update_net_client_list();
|
||||
|
||||
/* Always stay in NORMAL_STATE. Even though iconified seems more
|
||||
* appropriate sometimes. The only possible loss is that clients not using
|
||||
|
@ -730,7 +727,7 @@ client_resize(client_t *c, area_t geometry, bool hints)
|
|||
area_t area;
|
||||
|
||||
/* offscreen appearance fixes */
|
||||
area = display_area_get(c->phys_screen);
|
||||
area = display_area_get();
|
||||
|
||||
if(geometry.x > area.width)
|
||||
geometry.x = area.width - geometry.width;
|
||||
|
@ -1041,10 +1038,10 @@ client_unmanage(client_t *c)
|
|||
tc->transient_for = NULL;
|
||||
}
|
||||
|
||||
if(globalconf.screens.tab[c->phys_screen].prev_client_focus == c)
|
||||
globalconf.screens.tab[c->phys_screen].prev_client_focus = NULL;
|
||||
if(globalconf.screens.tab[0].prev_client_focus == c)
|
||||
globalconf.screens.tab[0].prev_client_focus = NULL;
|
||||
|
||||
if(globalconf.screens.tab[c->phys_screen].client_focus == c)
|
||||
if(globalconf.screens.tab[0].client_focus == c)
|
||||
client_unfocus(c);
|
||||
|
||||
/* remove client from global list and everywhere else */
|
||||
|
@ -1066,7 +1063,7 @@ client_unmanage(client_t *c)
|
|||
if(strut_has_value(&c->strut))
|
||||
screen_emit_signal(globalconf.L, c->screen, "property::workarea", 0);
|
||||
|
||||
ewmh_update_net_client_list(c->phys_screen);
|
||||
ewmh_update_net_client_list();
|
||||
|
||||
/* Clear our event mask so that we don't receive any events from now on,
|
||||
* especially not for the following requests. */
|
||||
|
@ -1079,7 +1076,7 @@ client_unmanage(client_t *c)
|
|||
XCB_CW_EVENT_MASK,
|
||||
(const uint32_t []) { 0 });
|
||||
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, c->phys_screen);
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
xcb_unmap_window(globalconf.connection, c->window);
|
||||
xcb_reparent_window(globalconf.connection, c->window, s->root,
|
||||
c->geometry.x, c->geometry.y);
|
||||
|
|
|
@ -111,8 +111,6 @@ struct client_t
|
|||
xcb_window_t leader_window;
|
||||
/** Client's WM_PROTOCOLS property */
|
||||
xcb_get_wm_protocols_reply_t protocols;
|
||||
/** Client physical screen */
|
||||
int phys_screen;
|
||||
/** Key bindings */
|
||||
key_array_t keys;
|
||||
/** Icon */
|
||||
|
@ -144,7 +142,7 @@ client_t * client_getbyframewin(xcb_window_t);
|
|||
void client_ban(client_t *);
|
||||
void client_ban_unfocus(client_t *);
|
||||
void client_unban(client_t *);
|
||||
void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, int, bool);
|
||||
void client_manage(xcb_window_t, xcb_get_geometry_reply_t *, bool);
|
||||
area_t client_geometry_hints(client_t *, area_t);
|
||||
bool client_resize(client_t *, area_t, bool);
|
||||
void client_unmanage(client_t *);
|
||||
|
|
|
@ -75,11 +75,9 @@ tag_view(lua_State *L, int udx, bool view)
|
|||
|
||||
if(tag->screen)
|
||||
{
|
||||
int screen_index = screen_array_indexof(&globalconf.screens, tag->screen);
|
||||
|
||||
banning_need_update(tag->screen);
|
||||
|
||||
ewmh_update_net_current_desktop(screen_virttophys(screen_index));
|
||||
ewmh_update_net_current_desktop();
|
||||
}
|
||||
|
||||
luaA_object_emit_signal(L, udx, "property::selected", 0);
|
||||
|
@ -103,13 +101,10 @@ tag_append_to_screen(lua_State *L, int udx, screen_t *s)
|
|||
return;
|
||||
}
|
||||
|
||||
int screen_index = screen_array_indexof(&globalconf.screens, s);
|
||||
int phys_screen = screen_virttophys(screen_index);
|
||||
|
||||
tag->screen = s;
|
||||
tag_array_append(&s->tags, luaA_object_ref_class(globalconf.L, udx, &tag_class));
|
||||
ewmh_update_net_numbers_of_desktop(phys_screen);
|
||||
ewmh_update_net_desktop_names(phys_screen);
|
||||
ewmh_update_net_numbers_of_desktop();
|
||||
ewmh_update_net_desktop_names();
|
||||
|
||||
luaA_object_push(globalconf.L, tag);
|
||||
luaA_object_emit_signal(L, -1, "property::screen", 0);
|
||||
|
@ -128,8 +123,6 @@ tag_remove_from_screen(tag_t *tag)
|
|||
if(!tag->screen)
|
||||
return;
|
||||
|
||||
int screen_index = screen_array_indexof(&globalconf.screens, tag->screen);
|
||||
int phys_screen = screen_virttophys(screen_index);
|
||||
tag_array_t *tags = &tag->screen->tags;
|
||||
|
||||
for(int i = 0; i < tags->len; i++)
|
||||
|
@ -143,8 +136,8 @@ tag_remove_from_screen(tag_t *tag)
|
|||
if(tag->selected)
|
||||
banning_need_update(tag->screen);
|
||||
|
||||
ewmh_update_net_numbers_of_desktop(phys_screen);
|
||||
ewmh_update_net_desktop_names(phys_screen);
|
||||
ewmh_update_net_numbers_of_desktop();
|
||||
ewmh_update_net_desktop_names();
|
||||
|
||||
screen_t *s = tag->screen;
|
||||
tag->screen = NULL;
|
||||
|
|
|
@ -34,23 +34,22 @@
|
|||
LUA_OBJECT_FUNCS(wibox_class, wibox_t, wibox)
|
||||
|
||||
/** Kick out systray windows.
|
||||
* \param phys_screen Physical screen number.
|
||||
*/
|
||||
static void
|
||||
wibox_systray_kickout(int phys_screen)
|
||||
wibox_systray_kickout(void)
|
||||
{
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, phys_screen);
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
|
||||
if(globalconf.screens.tab[phys_screen].systray.parent != s->root)
|
||||
if(globalconf.screens.tab[0].systray.parent != s->root)
|
||||
{
|
||||
/* Who! Check that we're not deleting a wibox with a systray, because it
|
||||
* may be its parent. If so, we reparent to root before, otherwise it will
|
||||
* hurt very much. */
|
||||
xcb_reparent_window(globalconf.connection,
|
||||
globalconf.screens.tab[phys_screen].systray.window,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
s->root, -512, -512);
|
||||
|
||||
globalconf.screens.tab[phys_screen].systray.parent = s->root;
|
||||
globalconf.screens.tab[0].systray.parent = s->root;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,13 +61,11 @@ wibox_wipe_resources(wibox_t *w)
|
|||
{
|
||||
if(w->window)
|
||||
{
|
||||
int phys_screen = w->ctx.phys_screen;
|
||||
|
||||
/* Activate BMA */
|
||||
client_ignore_enterleave_events();
|
||||
/* Make sure we don't accidentally kill the systray window */
|
||||
if(globalconf.screens.tab[phys_screen].systray.parent == w->window)
|
||||
wibox_systray_kickout(phys_screen);
|
||||
if(globalconf.screens.tab[0].systray.parent == w->window)
|
||||
wibox_systray_kickout();
|
||||
xcb_destroy_window(globalconf.connection, w->window);
|
||||
/* Deactivate BMA */
|
||||
client_restore_enterleave_events();
|
||||
|
@ -182,7 +179,6 @@ static void
|
|||
wibox_draw_context_update(wibox_t *w, xcb_screen_t *s)
|
||||
{
|
||||
xcolor_t fg = w->ctx.fg, bg = w->ctx.bg;
|
||||
int phys_screen = w->ctx.phys_screen;
|
||||
|
||||
draw_context_wipe(&w->ctx);
|
||||
|
||||
|
@ -198,13 +194,13 @@ wibox_draw_context_update(wibox_t *w, xcb_screen_t *s)
|
|||
w->ctx.pixmap, s->root,
|
||||
w->geometry.height,
|
||||
w->geometry.width);
|
||||
draw_context_init(&w->ctx, phys_screen,
|
||||
draw_context_init(&w->ctx,
|
||||
w->geometry.height,
|
||||
w->geometry.width,
|
||||
w->ctx.pixmap, &fg, &bg);
|
||||
break;
|
||||
case East:
|
||||
draw_context_init(&w->ctx, phys_screen,
|
||||
draw_context_init(&w->ctx,
|
||||
w->geometry.width,
|
||||
w->geometry.height,
|
||||
w->pixmap, &fg, &bg);
|
||||
|
@ -214,12 +210,11 @@ wibox_draw_context_update(wibox_t *w, xcb_screen_t *s)
|
|||
|
||||
/** Initialize a wibox.
|
||||
* \param w The wibox to initialize.
|
||||
* \param phys_screen Physical screen number.
|
||||
*/
|
||||
static void
|
||||
wibox_init(wibox_t *w, int phys_screen)
|
||||
wibox_init(wibox_t *w)
|
||||
{
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, phys_screen);
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
|
||||
w->window = xcb_generate_id(globalconf.connection);
|
||||
xcb_create_window(globalconf.connection, s->root_depth, w->window, s->root,
|
||||
|
@ -247,7 +242,6 @@ wibox_init(wibox_t *w, int phys_screen)
|
|||
w->geometry.width, w->geometry.height);
|
||||
|
||||
/* Update draw context physical screen, important for Zaphod. */
|
||||
w->ctx.phys_screen = phys_screen;
|
||||
wibox_draw_context_update(w, s);
|
||||
|
||||
/* The default GC is just a newly created associated to the root window */
|
||||
|
@ -312,7 +306,7 @@ wibox_moveresize(lua_State *L, int udx, area_t geometry)
|
|||
if(w->pixmap != w->ctx.pixmap)
|
||||
xcb_free_pixmap(globalconf.connection, w->ctx.pixmap);
|
||||
w->pixmap = xcb_generate_id(globalconf.connection);
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, w->ctx.phys_screen);
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
xcb_create_pixmap(globalconf.connection, s->root_depth, w->pixmap, s->root,
|
||||
w->geometry.width, w->geometry.height);
|
||||
wibox_draw_context_update(w, s);
|
||||
|
@ -384,7 +378,7 @@ wibox_set_orientation(lua_State *L, int udx, orientation_t o)
|
|||
wibox_t *w = luaA_checkudata(L, udx, &wibox_class);
|
||||
if(o != w->orientation)
|
||||
{
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, w->ctx.phys_screen);
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
w->orientation = o;
|
||||
/* orientation != East */
|
||||
if(w->pixmap != w->ctx.pixmap)
|
||||
|
@ -426,7 +420,6 @@ wibox_systray_refresh(wibox_t *wibox)
|
|||
uint32_t config_win_vals[4];
|
||||
uint32_t config_win_vals_off[2] = { -512, -512 };
|
||||
xembed_window_t *em;
|
||||
int phys_screen = wibox->ctx.phys_screen;
|
||||
|
||||
wibox->has_systray = true;
|
||||
|
||||
|
@ -436,10 +429,10 @@ wibox_systray_refresh(wibox_t *wibox)
|
|||
{
|
||||
/* Set background of the systray window. */
|
||||
xcb_change_window_attributes(globalconf.connection,
|
||||
globalconf.screens.tab[phys_screen].systray.window,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
XCB_CW_BACK_PIXEL, config_back);
|
||||
/* Map it. */
|
||||
xcb_map_window(globalconf.connection, globalconf.screens.tab[phys_screen].systray.window);
|
||||
xcb_map_window(globalconf.connection, globalconf.screens.tab[0].systray.window);
|
||||
/* Move it. */
|
||||
switch(wibox->orientation)
|
||||
{
|
||||
|
@ -463,16 +456,16 @@ wibox_systray_refresh(wibox_t *wibox)
|
|||
break;
|
||||
}
|
||||
/* reparent */
|
||||
if(globalconf.screens.tab[phys_screen].systray.parent != wibox->window)
|
||||
if(globalconf.screens.tab[0].systray.parent != wibox->window)
|
||||
{
|
||||
xcb_reparent_window(globalconf.connection,
|
||||
globalconf.screens.tab[phys_screen].systray.window,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
wibox->window,
|
||||
config_win_vals[0], config_win_vals[1]);
|
||||
globalconf.screens.tab[phys_screen].systray.parent = wibox->window;
|
||||
globalconf.screens.tab[0].systray.parent = wibox->window;
|
||||
}
|
||||
xcb_configure_window(globalconf.connection,
|
||||
globalconf.screens.tab[phys_screen].systray.window,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
XCB_CONFIG_WINDOW_X
|
||||
| XCB_CONFIG_WINDOW_Y
|
||||
| XCB_CONFIG_WINDOW_WIDTH
|
||||
|
@ -483,7 +476,7 @@ wibox_systray_refresh(wibox_t *wibox)
|
|||
config_win_vals[0] = 0;
|
||||
}
|
||||
else
|
||||
return wibox_systray_kickout(phys_screen);
|
||||
return wibox_systray_kickout();
|
||||
|
||||
switch(wibox->orientation)
|
||||
{
|
||||
|
@ -492,8 +485,6 @@ wibox_systray_refresh(wibox_t *wibox)
|
|||
for(int j = 0; j < globalconf.embedded.len; j++)
|
||||
{
|
||||
em = &globalconf.embedded.tab[j];
|
||||
if(em->phys_screen == phys_screen)
|
||||
{
|
||||
if(config_win_vals[1] - config_win_vals[2] >= (uint32_t) wibox->geometry.y)
|
||||
{
|
||||
xcb_map_window(globalconf.connection, em->win);
|
||||
|
@ -511,15 +502,12 @@ wibox_systray_refresh(wibox_t *wibox)
|
|||
| XCB_CONFIG_WINDOW_Y,
|
||||
config_win_vals_off);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case South:
|
||||
config_win_vals[1] = 0;
|
||||
for(int j = 0; j < globalconf.embedded.len; j++)
|
||||
{
|
||||
em = &globalconf.embedded.tab[j];
|
||||
if(em->phys_screen == phys_screen)
|
||||
{
|
||||
/* if(y + width <= wibox.y + systray.right) */
|
||||
if(config_win_vals[1] + config_win_vals[3] <= (uint32_t) wibox->geometry.y + AREA_RIGHT(systray->geometry))
|
||||
{
|
||||
|
@ -538,15 +526,12 @@ wibox_systray_refresh(wibox_t *wibox)
|
|||
| XCB_CONFIG_WINDOW_Y,
|
||||
config_win_vals_off);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case East:
|
||||
config_win_vals[1] = 0;
|
||||
for(int j = 0; j < globalconf.embedded.len; j++)
|
||||
{
|
||||
em = &globalconf.embedded.tab[j];
|
||||
if(em->phys_screen == phys_screen)
|
||||
{
|
||||
/* if(x + width < systray.x + systray.width) */
|
||||
if(config_win_vals[0] + config_win_vals[2] <= (uint32_t) AREA_RIGHT(systray->geometry) + wibox->geometry.x)
|
||||
{
|
||||
|
@ -565,7 +550,6 @@ wibox_systray_refresh(wibox_t *wibox)
|
|||
| XCB_CONFIG_WINDOW_Y,
|
||||
config_win_vals_off);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -714,8 +698,6 @@ wibox_detach(lua_State *L, int udx)
|
|||
static void
|
||||
wibox_attach(lua_State *L, int udx, screen_t *s)
|
||||
{
|
||||
int phys_screen = screen_virttophys(screen_array_indexof(&globalconf.screens, s));
|
||||
|
||||
/* duplicate wibox */
|
||||
lua_pushvalue(L, udx);
|
||||
/* ref it */
|
||||
|
@ -739,7 +721,7 @@ wibox_attach(lua_State *L, int udx, screen_t *s)
|
|||
|
||||
wibox_array_append(&globalconf.wiboxes, wibox);
|
||||
|
||||
wibox_init(wibox, phys_screen);
|
||||
wibox_init(wibox);
|
||||
|
||||
xwindow_set_cursor(wibox->window,
|
||||
xcursor_new(globalconf.connection, xcursor_font_fromstr(wibox->cursor)));
|
||||
|
|
|
@ -251,7 +251,7 @@ widget_render(wibox_t *wibox)
|
|||
char *data;
|
||||
xcb_pixmap_t rootpix;
|
||||
xcb_get_property_cookie_t prop_c;
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, ctx->phys_screen);
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
prop_c = xcb_get_property_unchecked(globalconf.connection, false, s->root, _XROOTPMAP_ID,
|
||||
XCB_ATOM_PIXMAP, 0, 1);
|
||||
if((prop_r = xcb_get_property_reply(globalconf.connection, prop_c, NULL)))
|
||||
|
|
|
@ -46,11 +46,10 @@ systray_extents(lua_State *L, widget_t *widget)
|
|||
luaA_checkscreen(screen);
|
||||
|
||||
area_t geometry;
|
||||
int phys_screen = screen_virttophys(screen), n = 0;
|
||||
int n = 0;
|
||||
systray_data_t *d = widget->data;
|
||||
|
||||
for(int i = 0; i < globalconf.embedded.len; i++)
|
||||
if(globalconf.embedded.tab[i].phys_screen == phys_screen)
|
||||
n++;
|
||||
|
||||
/** \todo use class hints */
|
||||
|
@ -73,7 +72,7 @@ systray_draw(widget_t *widget, draw_context_t *ctx,
|
|||
/* set wibox orientation */
|
||||
/** \todo stop setting that property on each redraw */
|
||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||
globalconf.screens.tab[p->ctx.phys_screen].systray.window,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
_NET_SYSTEM_TRAY_ORIENTATION, XCB_ATOM_CARDINAL, 32, 1, &orient);
|
||||
}
|
||||
|
||||
|
|
|
@ -337,9 +337,7 @@ property_handle_xrootpmap_id(uint8_t state,
|
|||
(*w)->need_update = true;
|
||||
else
|
||||
{
|
||||
int screen = xutil_root2screen(globalconf.connection, window);
|
||||
foreach(w, globalconf.wiboxes)
|
||||
if(screen == screen_array_indexof(&globalconf.screens, (*w)->screen))
|
||||
(*w)->need_update = true;
|
||||
}
|
||||
|
||||
|
|
12
root.c
12
root.c
|
@ -128,14 +128,9 @@ luaA_root_keys(lua_State *L)
|
|||
while(lua_next(L, 1))
|
||||
key_array_append(&globalconf.keys, luaA_object_ref_class(L, -1, &key_class));
|
||||
|
||||
int nscreen = xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
|
||||
for(int phys_screen = 0; phys_screen < nscreen; phys_screen++)
|
||||
{
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, phys_screen);
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
xcb_ungrab_key(globalconf.connection, XCB_GRAB_ANY, s->root, XCB_BUTTON_MASK_ANY);
|
||||
xwindow_grabkeys(s->root, &globalconf.keys);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -204,11 +199,8 @@ luaA_root_cursor(lua_State *L)
|
|||
{
|
||||
uint32_t change_win_vals[] = { xcursor_new(globalconf.connection, cursor_font) };
|
||||
|
||||
for(int screen_nbr = 0;
|
||||
screen_nbr < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
screen_nbr++)
|
||||
xcb_change_window_attributes(globalconf.connection,
|
||||
xutil_screen_get(globalconf.connection, screen_nbr)->root,
|
||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
||||
XCB_CW_CURSOR,
|
||||
change_win_vals);
|
||||
}
|
||||
|
|
25
screen.c
25
screen.c
|
@ -225,11 +225,7 @@ screen_scan_xinerama(void)
|
|||
static void screen_scan_x11(void)
|
||||
{
|
||||
/* One screen only / Zaphod mode */
|
||||
for(int screen = 0;
|
||||
screen < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
screen++)
|
||||
{
|
||||
xcb_screen_t *xcb_screen = xutil_screen_get(globalconf.connection, screen);
|
||||
xcb_screen_t *xcb_screen = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
screen_t s;
|
||||
p_clear(&s, 1);
|
||||
s.geometry.x = 0;
|
||||
|
@ -239,7 +235,6 @@ static void screen_scan_x11(void)
|
|||
s.visual = screen_default_visual(xcb_screen);
|
||||
screen_array_append(&globalconf.screens, s);
|
||||
}
|
||||
}
|
||||
|
||||
/** Get screens informations and fill global configuration.
|
||||
*/
|
||||
|
@ -339,13 +334,12 @@ screen_area_get(screen_t *screen, bool strut)
|
|||
}
|
||||
|
||||
/** Get display info.
|
||||
* \param phys_screen Physical screen number.
|
||||
* \return The display area.
|
||||
*/
|
||||
area_t
|
||||
display_area_get(int phys_screen)
|
||||
display_area_get(void)
|
||||
{
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, phys_screen);
|
||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
area_t area = { .x = 0,
|
||||
.y = 0,
|
||||
.width = s->width_in_pixels,
|
||||
|
@ -353,19 +347,6 @@ display_area_get(int phys_screen)
|
|||
return area;
|
||||
}
|
||||
|
||||
/** This returns the real X screen number for a logical
|
||||
* screen if Xinerama is active.
|
||||
* \param screen The logical screen.
|
||||
* \return The X screen.
|
||||
*/
|
||||
int
|
||||
screen_virttophys(int screen)
|
||||
{
|
||||
if(globalconf.xinerama_is_active)
|
||||
return globalconf.default_screen;
|
||||
return screen;
|
||||
}
|
||||
|
||||
/** Move a client to a virtual screen.
|
||||
* \param c The client to move.
|
||||
* \param new_screen The destination screen.
|
||||
|
|
3
screen.h
3
screen.h
|
@ -64,8 +64,7 @@ void screen_emit_signal(lua_State *, screen_t *, const char *, int);
|
|||
void screen_scan(void);
|
||||
screen_t *screen_getbycoord(screen_t *, int, int);
|
||||
area_t screen_area_get(screen_t *, bool);
|
||||
area_t display_area_get(int);
|
||||
int screen_virttophys(int);
|
||||
area_t display_area_get(void);
|
||||
void screen_client_moveto(client_t *, screen_t *, bool);
|
||||
|
||||
#endif
|
||||
|
|
9
spawn.c
9
spawn.c
|
@ -236,11 +236,8 @@ spawn_init(void)
|
|||
{
|
||||
globalconf.sndisplay = sn_xcb_display_new(globalconf.connection, NULL, NULL);
|
||||
|
||||
const int screen_max = xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
|
||||
for(int screen = 0; screen < screen_max; screen++)
|
||||
globalconf.screens.tab[screen].snmonitor = sn_monitor_context_new(globalconf.sndisplay,
|
||||
screen,
|
||||
globalconf.screens.tab[0].snmonitor = sn_monitor_context_new(globalconf.sndisplay,
|
||||
globalconf.default_screen,
|
||||
spawn_monitor_event,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
@ -330,7 +327,7 @@ luaA_spawn(lua_State *L)
|
|||
else
|
||||
cmdname = a_strdup(cmd);
|
||||
|
||||
context = sn_launcher_context_new(globalconf.sndisplay, screen_virttophys(screen));
|
||||
context = sn_launcher_context_new(globalconf.sndisplay, globalconf.default_screen);
|
||||
sn_launcher_context_set_name(context, "awesome");
|
||||
sn_launcher_context_set_description(context, "awesome spawn");
|
||||
sn_launcher_context_set_binary_name(context, cmdname);
|
||||
|
|
6
stack.c
6
stack.c
|
@ -34,7 +34,7 @@ stack_client_remove(client_t *c)
|
|||
client_array_remove(&globalconf.stack, client);
|
||||
break;
|
||||
}
|
||||
ewmh_update_net_client_list_stacking(c->phys_screen);
|
||||
ewmh_update_net_client_list_stacking();
|
||||
stack_windows();
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ stack_client_push(client_t *c)
|
|||
{
|
||||
stack_client_remove(c);
|
||||
client_array_push(&globalconf.stack, c);
|
||||
ewmh_update_net_client_list_stacking(c->phys_screen);
|
||||
ewmh_update_net_client_list_stacking();
|
||||
stack_windows();
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ stack_client_append(client_t *c)
|
|||
{
|
||||
stack_client_remove(c);
|
||||
client_array_append(&globalconf.stack, c);
|
||||
ewmh_update_net_client_list_stacking(c->phys_screen);
|
||||
ewmh_update_net_client_list_stacking();
|
||||
stack_windows();
|
||||
}
|
||||
|
||||
|
|
63
systray.c
63
systray.c
|
@ -35,16 +35,15 @@
|
|||
#define SYSTEM_TRAY_REQUEST_DOCK 0 /* Begin icon docking */
|
||||
|
||||
/** Initialize systray information in X.
|
||||
* \param phys_screen Physical screen.
|
||||
*/
|
||||
void
|
||||
systray_init(int phys_screen)
|
||||
systray_init(void)
|
||||
{
|
||||
xcb_screen_t *xscreen = xutil_screen_get(globalconf.connection, phys_screen);
|
||||
xcb_screen_t *xscreen = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
|
||||
globalconf.screens.tab[phys_screen].systray.window = xcb_generate_id(globalconf.connection);
|
||||
globalconf.screens.tab[0].systray.window = xcb_generate_id(globalconf.connection);
|
||||
xcb_create_window(globalconf.connection, xscreen->root_depth,
|
||||
globalconf.screens.tab[phys_screen].systray.window,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
xscreen->root,
|
||||
-1, -1, 1, 1, 0,
|
||||
XCB_COPY_FROM_PARENT, xscreen->root_visual, 0, NULL);
|
||||
|
@ -54,46 +53,40 @@ systray_init(int phys_screen)
|
|||
/** Refresh all systrays registrations per physical screen
|
||||
*/
|
||||
void
|
||||
systray_refresh()
|
||||
{
|
||||
int nscreen = xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||
|
||||
for(int phys_screen = 0; phys_screen < nscreen; phys_screen++)
|
||||
systray_refresh(void)
|
||||
{
|
||||
bool has_systray = false;
|
||||
foreach(w, globalconf.wiboxes)
|
||||
if(phys_screen == (*w)->ctx.phys_screen && (*w)->has_systray)
|
||||
if((*w)->has_systray)
|
||||
/* Can't use "break" with foreach() :( */
|
||||
has_systray = true;
|
||||
|
||||
if(has_systray)
|
||||
systray_register(phys_screen);
|
||||
systray_register();
|
||||
else
|
||||
systray_cleanup(phys_screen);
|
||||
}
|
||||
systray_cleanup();
|
||||
}
|
||||
|
||||
|
||||
/** Register systray in X.
|
||||
* \param phys_screen Physical screen.
|
||||
*/
|
||||
void
|
||||
systray_register(int phys_screen)
|
||||
systray_register(void)
|
||||
{
|
||||
xcb_client_message_event_t ev;
|
||||
xcb_screen_t *xscreen = xutil_screen_get(globalconf.connection, phys_screen);
|
||||
xcb_screen_t *xscreen = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
||||
char *atom_name;
|
||||
xcb_intern_atom_cookie_t atom_systray_q;
|
||||
xcb_intern_atom_reply_t *atom_systray_r;
|
||||
xcb_atom_t atom_systray;
|
||||
|
||||
/* Set registered even if it fails to don't try again unless forced */
|
||||
if(globalconf.screens.tab[phys_screen].systray.registered)
|
||||
if(globalconf.screens.tab[0].systray.registered)
|
||||
return;
|
||||
globalconf.screens.tab[phys_screen].systray.registered = true;
|
||||
globalconf.screens.tab[0].systray.registered = true;
|
||||
|
||||
/* Send requests */
|
||||
if(!(atom_name = xcb_atom_name_by_screen("_NET_SYSTEM_TRAY", phys_screen)))
|
||||
if(!(atom_name = xcb_atom_name_by_screen("_NET_SYSTEM_TRAY", globalconf.default_screen)))
|
||||
{
|
||||
warn("error getting systray atom");
|
||||
return;
|
||||
|
@ -111,7 +104,7 @@ systray_register(int phys_screen)
|
|||
ev.format = 32;
|
||||
ev.type = MANAGER;
|
||||
ev.data.data32[0] = XCB_CURRENT_TIME;
|
||||
ev.data.data32[2] = globalconf.screens.tab[phys_screen].systray.window;
|
||||
ev.data.data32[2] = globalconf.screens.tab[0].systray.window;
|
||||
ev.data.data32[3] = ev.data.data32[4] = 0;
|
||||
|
||||
if(!(atom_systray_r = xcb_intern_atom_reply(globalconf.connection, atom_systray_q, NULL)))
|
||||
|
@ -125,7 +118,7 @@ systray_register(int phys_screen)
|
|||
p_delete(&atom_systray_r);
|
||||
|
||||
xcb_set_selection_owner(globalconf.connection,
|
||||
globalconf.screens.tab[phys_screen].systray.window,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
atom_systray,
|
||||
XCB_CURRENT_TIME);
|
||||
|
||||
|
@ -133,19 +126,18 @@ systray_register(int phys_screen)
|
|||
}
|
||||
|
||||
/** Remove systray information in X.
|
||||
* \param phys_screen Physical screen.
|
||||
*/
|
||||
void
|
||||
systray_cleanup(int phys_screen)
|
||||
systray_cleanup(void)
|
||||
{
|
||||
xcb_intern_atom_reply_t *atom_systray_r;
|
||||
char *atom_name;
|
||||
|
||||
if(!globalconf.screens.tab[phys_screen].systray.registered)
|
||||
if(!globalconf.screens.tab[0].systray.registered)
|
||||
return;
|
||||
globalconf.screens.tab[phys_screen].systray.registered = false;
|
||||
globalconf.screens.tab[0].systray.registered = false;
|
||||
|
||||
if(!(atom_name = xcb_atom_name_by_screen("_NET_SYSTEM_TRAY", phys_screen))
|
||||
if(!(atom_name = xcb_atom_name_by_screen("_NET_SYSTEM_TRAY", globalconf.default_screen))
|
||||
|| !(atom_systray_r = xcb_intern_atom_reply(globalconf.connection,
|
||||
xcb_intern_atom_unchecked(globalconf.connection,
|
||||
false,
|
||||
|
@ -170,12 +162,11 @@ systray_cleanup(int phys_screen)
|
|||
|
||||
/** Handle a systray request.
|
||||
* \param embed_win The window to embed.
|
||||
* \param phys_screen The physical monitor to display on.
|
||||
* \param info The embedding info
|
||||
* \return 0 on no error.
|
||||
*/
|
||||
int
|
||||
systray_request_handle(xcb_window_t embed_win, int phys_screen, xembed_info_t *info)
|
||||
systray_request_handle(xcb_window_t embed_win, xembed_info_t *info)
|
||||
{
|
||||
xembed_window_t em;
|
||||
xcb_get_property_cookie_t em_cookie;
|
||||
|
@ -204,11 +195,10 @@ systray_request_handle(xcb_window_t embed_win, int phys_screen, xembed_info_t *i
|
|||
*/
|
||||
xcb_change_save_set(globalconf.connection, XCB_SET_MODE_INSERT, embed_win);
|
||||
xcb_reparent_window(globalconf.connection, embed_win,
|
||||
globalconf.screens.tab[phys_screen].systray.window,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
0, 0);
|
||||
|
||||
em.win = embed_win;
|
||||
em.phys_screen = phys_screen;
|
||||
|
||||
if(info)
|
||||
em.info = *info;
|
||||
|
@ -216,7 +206,7 @@ systray_request_handle(xcb_window_t embed_win, int phys_screen, xembed_info_t *i
|
|||
xembed_info_get_reply(globalconf.connection, em_cookie, &em.info);
|
||||
|
||||
xembed_embedded_notify(globalconf.connection, em.win,
|
||||
globalconf.screens.tab[phys_screen].systray.window,
|
||||
globalconf.screens.tab[0].systray.window,
|
||||
MIN(XEMBED_VERSION, em.info.version));
|
||||
|
||||
xembed_window_array_append(&globalconf.embedded, em);
|
||||
|
@ -233,10 +223,9 @@ systray_request_handle(xcb_window_t embed_win, int phys_screen, xembed_info_t *i
|
|||
int
|
||||
systray_process_client_message(xcb_client_message_event_t *ev)
|
||||
{
|
||||
int screen_nbr = 0, ret = 0;
|
||||
int ret = 0;
|
||||
xcb_get_geometry_cookie_t geom_c;
|
||||
xcb_get_geometry_reply_t *geom_r;
|
||||
xcb_screen_iterator_t iter;
|
||||
|
||||
switch(ev->data.data32[1])
|
||||
{
|
||||
|
@ -246,12 +235,10 @@ systray_process_client_message(xcb_client_message_event_t *ev)
|
|||
if(!(geom_r = xcb_get_geometry_reply(globalconf.connection, geom_c, NULL)))
|
||||
return -1;
|
||||
|
||||
for(iter = xcb_setup_roots_iterator(xcb_get_setup(globalconf.connection)), screen_nbr = 0;
|
||||
iter.rem && iter.data->root != geom_r->root; xcb_screen_next (&iter), ++screen_nbr);
|
||||
if(xutil_screen_get(globalconf.connection, globalconf.default_screen)->root == geom_r->root)
|
||||
ret = systray_request_handle(ev->data.data32[2], NULL);
|
||||
|
||||
p_delete(&geom_r);
|
||||
|
||||
ret = systray_request_handle(ev->data.data32[2], screen_nbr, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
#include <xcb/xcb.h>
|
||||
#include "common/xembed.h"
|
||||
|
||||
void systray_init(int);
|
||||
void systray_init(void);
|
||||
void systray_refresh(void);
|
||||
void systray_register(int);
|
||||
void systray_cleanup(int);
|
||||
int systray_request_handle(xcb_window_t, int, xembed_info_t *);
|
||||
void systray_register(void);
|
||||
void systray_cleanup(void);
|
||||
int systray_request_handle(xcb_window_t, xembed_info_t *);
|
||||
bool systray_iskdedockapp(xcb_window_t);
|
||||
int systray_process_client_message(xcb_client_message_event_t *);
|
||||
int xembed_process_client_message(xcb_client_message_event_t *);
|
||||
|
|
Loading…
Reference in New Issue