Save the screen in globalconf.
There can only be on xcb_screen_t now, so we can save it in globalconf. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
cc4e8d57d5
commit
5d35771673
|
@ -97,7 +97,7 @@ scan(void)
|
||||||
long state;
|
long state;
|
||||||
|
|
||||||
/* Get the root window ID associated to this screen */
|
/* Get the root window ID associated to this screen */
|
||||||
root_win.id = xutil_screen_get(globalconf.connection, globalconf.default_screen)->root;
|
root_win.id = globalconf.screen->root;
|
||||||
|
|
||||||
/* Get the window tree associated to this screen */
|
/* Get the window tree associated to this screen */
|
||||||
root_win.tree_cookie = xcb_query_tree_unchecked(globalconf.connection,
|
root_win.tree_cookie = xcb_query_tree_unchecked(globalconf.connection,
|
||||||
|
@ -368,6 +368,8 @@ main(int argc, char **argv)
|
||||||
if(xcb_connection_has_error(globalconf.connection))
|
if(xcb_connection_has_error(globalconf.connection))
|
||||||
fatal("cannot open display");
|
fatal("cannot open display");
|
||||||
|
|
||||||
|
globalconf.screen = xcb_aux_get_screen(globalconf.connection, globalconf.default_screen);
|
||||||
|
|
||||||
/* Prefetch all the extensions we might need */
|
/* Prefetch all the extensions we might need */
|
||||||
xcb_prefetch_extension_data(globalconf.connection, &xcb_big_requests_id);
|
xcb_prefetch_extension_data(globalconf.connection, &xcb_big_requests_id);
|
||||||
xcb_prefetch_extension_data(globalconf.connection, &xcb_test_id);
|
xcb_prefetch_extension_data(globalconf.connection, &xcb_test_id);
|
||||||
|
@ -398,7 +400,7 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
/* This causes an error if some other window manager is running */
|
/* This causes an error if some other window manager is running */
|
||||||
xcb_change_window_attributes(globalconf.connection,
|
xcb_change_window_attributes(globalconf.connection,
|
||||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
globalconf.screen->root,
|
||||||
XCB_CW_EVENT_MASK, &select_input_val);
|
XCB_CW_EVENT_MASK, &select_input_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +480,7 @@ main(int argc, char **argv)
|
||||||
};
|
};
|
||||||
|
|
||||||
xcb_change_window_attributes(globalconf.connection,
|
xcb_change_window_attributes(globalconf.connection,
|
||||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
globalconf.screen->root,
|
||||||
XCB_CW_EVENT_MASK,
|
XCB_CW_EVENT_MASK,
|
||||||
change_win_vals);
|
change_win_vals);
|
||||||
}
|
}
|
||||||
|
|
9
color.c
9
color.c
|
@ -87,7 +87,6 @@ color_parse(const char *colstr, ssize_t len,
|
||||||
color_init_cookie_t
|
color_init_cookie_t
|
||||||
color_init_unchecked(color_t *color, const char *colstr, ssize_t len)
|
color_init_unchecked(color_t *color, const char *colstr, ssize_t len)
|
||||||
{
|
{
|
||||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
|
||||||
color_init_cookie_t req;
|
color_init_cookie_t req;
|
||||||
|
|
||||||
p_clear(&req, 1);
|
p_clear(&req, 1);
|
||||||
|
@ -117,7 +116,8 @@ color_init_unchecked(color_t *color, const char *colstr, ssize_t len)
|
||||||
req.color = color;
|
req.color = color;
|
||||||
req.colstr = colstr;
|
req.colstr = colstr;
|
||||||
req.cookie = xcb_alloc_named_color_unchecked(globalconf.connection,
|
req.cookie = xcb_alloc_named_color_unchecked(globalconf.connection,
|
||||||
s->default_colormap, len,
|
globalconf.screen->default_colormap,
|
||||||
|
len,
|
||||||
colstr);
|
colstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,6 @@ color_init_reply(color_init_cookie_t req)
|
||||||
xcolor_init_request_t
|
xcolor_init_request_t
|
||||||
xcolor_init_unchecked(xcolor_t *color, const char *colstr, ssize_t len)
|
xcolor_init_unchecked(xcolor_t *color, const char *colstr, ssize_t len)
|
||||||
{
|
{
|
||||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
|
||||||
xcolor_init_request_t req;
|
xcolor_init_request_t req;
|
||||||
uint8_t red, green, blue, alpha;
|
uint8_t red, green, blue, alpha;
|
||||||
|
|
||||||
|
@ -197,7 +196,7 @@ xcolor_init_unchecked(xcolor_t *color, const char *colstr, ssize_t len)
|
||||||
|
|
||||||
req.is_hexa = true;
|
req.is_hexa = true;
|
||||||
req.cookie_hexa = xcb_alloc_color_unchecked(globalconf.connection,
|
req.cookie_hexa = xcb_alloc_color_unchecked(globalconf.connection,
|
||||||
s->default_colormap,
|
globalconf.screen->default_colormap,
|
||||||
RGB_8TO16(red),
|
RGB_8TO16(red),
|
||||||
RGB_8TO16(green),
|
RGB_8TO16(green),
|
||||||
RGB_8TO16(blue));
|
RGB_8TO16(blue));
|
||||||
|
@ -206,7 +205,7 @@ xcolor_init_unchecked(xcolor_t *color, const char *colstr, ssize_t len)
|
||||||
{
|
{
|
||||||
req.is_hexa = false;
|
req.is_hexa = false;
|
||||||
req.cookie_named = xcb_alloc_named_color_unchecked(globalconf.connection,
|
req.cookie_named = xcb_alloc_named_color_unchecked(globalconf.connection,
|
||||||
s->default_colormap, len,
|
globalconf.screen->default_colormap, len,
|
||||||
colstr);
|
colstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,25 +60,5 @@ void xutil_lock_mask_get(xcb_connection_t *, xcb_get_modifier_mapping_cookie_t,
|
||||||
uint16_t xutil_key_mask_fromstr(const char *, size_t);
|
uint16_t xutil_key_mask_fromstr(const char *, size_t);
|
||||||
void xutil_key_mask_tostr(uint16_t, const char **, size_t *);
|
void xutil_key_mask_tostr(uint16_t, const char **, size_t *);
|
||||||
|
|
||||||
/* Get the informations about the screen.
|
|
||||||
* \param c X connection.
|
|
||||||
* \param screen Screen number.
|
|
||||||
* \return Screen informations (must not be freed!).
|
|
||||||
*/
|
|
||||||
static inline xcb_screen_t *
|
|
||||||
xutil_screen_get(xcb_connection_t *c, int screen)
|
|
||||||
{
|
|
||||||
xcb_screen_t *s;
|
|
||||||
|
|
||||||
if(xcb_connection_has_error(c))
|
|
||||||
fatal("X connection invalid");
|
|
||||||
|
|
||||||
s = xcb_aux_get_screen(c, screen);
|
|
||||||
|
|
||||||
assert(s);
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||||
|
|
5
draw.c
5
draw.c
|
@ -336,7 +336,6 @@ draw_text_extents(draw_text_context_t *data)
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
PangoRectangle ext;
|
PangoRectangle ext;
|
||||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
|
||||||
area_t geom = { 0, 0, 0, 0 };
|
area_t geom = { 0, 0, 0, 0 };
|
||||||
|
|
||||||
if(data->len <= 0)
|
if(data->len <= 0)
|
||||||
|
@ -345,8 +344,8 @@ draw_text_extents(draw_text_context_t *data)
|
||||||
surface = cairo_xcb_surface_create(globalconf.connection,
|
surface = cairo_xcb_surface_create(globalconf.connection,
|
||||||
globalconf.default_screen,
|
globalconf.default_screen,
|
||||||
globalconf.visual,
|
globalconf.visual,
|
||||||
s->width_in_pixels,
|
globalconf.screen->width_in_pixels,
|
||||||
s->height_in_pixels);
|
globalconf.screen->height_in_pixels);
|
||||||
|
|
||||||
cr = cairo_create(surface);
|
cr = cairo_create(surface);
|
||||||
layout = pango_cairo_create_layout(cr);
|
layout = pango_cairo_create_layout(cr);
|
||||||
|
|
9
event.c
9
event.c
|
@ -192,7 +192,7 @@ event_handle_button(xcb_button_press_event_t *ev)
|
||||||
XCB_CURRENT_TIME);
|
XCB_CURRENT_TIME);
|
||||||
}
|
}
|
||||||
else if(ev->child == XCB_NONE)
|
else if(ev->child == XCB_NONE)
|
||||||
if(xutil_screen_get(globalconf.connection, globalconf.default_screen)->root == ev->event)
|
if(globalconf.screen->root == ev->event)
|
||||||
{
|
{
|
||||||
event_button_callback(ev, &globalconf.buttons, 0, 0, NULL);
|
event_button_callback(ev, &globalconf.buttons, 0, 0, NULL);
|
||||||
return;
|
return;
|
||||||
|
@ -287,7 +287,7 @@ event_handle_configurerequest(xcb_configure_request_event_t *ev)
|
||||||
static void
|
static void
|
||||||
event_handle_configurenotify(xcb_configure_notify_event_t *ev)
|
event_handle_configurenotify(xcb_configure_notify_event_t *ev)
|
||||||
{
|
{
|
||||||
const xcb_screen_t *screen = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
const xcb_screen_t *screen = globalconf.screen;
|
||||||
|
|
||||||
if(ev->window == screen->root
|
if(ev->window == screen->root
|
||||||
&& (ev->width != screen->width_in_pixels
|
&& (ev->width != screen->width_in_pixels
|
||||||
|
@ -721,7 +721,7 @@ event_handle_mappingnotify(xcb_mapping_notify_event_t *ev)
|
||||||
&globalconf.modeswitchmask);
|
&globalconf.modeswitchmask);
|
||||||
|
|
||||||
/* regrab everything */
|
/* regrab everything */
|
||||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
xcb_screen_t *s = globalconf.screen;
|
||||||
/* yes XCB_BUTTON_MASK_ANY is also for grab_key even if it's look weird */
|
/* 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);
|
xcb_ungrab_key(globalconf.connection, XCB_GRAB_ANY, s->root, XCB_BUTTON_MASK_ANY);
|
||||||
xwindow_grabkeys(s->root, &globalconf.keys);
|
xwindow_grabkeys(s->root, &globalconf.keys);
|
||||||
|
@ -744,8 +744,7 @@ event_handle_reparentnotify(xcb_reparent_notify_event_t *ev)
|
||||||
{
|
{
|
||||||
/* Ignore reparents to the root window, they *might* be caused by
|
/* Ignore reparents to the root window, they *might* be caused by
|
||||||
* ourselves if a client quickly unmaps and maps itself again. */
|
* ourselves if a client quickly unmaps and maps itself again. */
|
||||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
if (ev->parent != globalconf.screen->root)
|
||||||
if (ev->parent != s->root)
|
|
||||||
client_unmanage(c);
|
client_unmanage(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
16
ewmh.c
16
ewmh.c
|
@ -106,7 +106,7 @@ ewmh_update_desktop_geometry(void)
|
||||||
uint32_t sizes[] = { geom.width, geom.height };
|
uint32_t sizes[] = { geom.width, geom.height };
|
||||||
|
|
||||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
globalconf.screen->root,
|
||||||
_NET_DESKTOP_GEOMETRY, XCB_ATOM_CARDINAL, 32, countof(sizes), sizes);
|
_NET_DESKTOP_GEOMETRY, XCB_ATOM_CARDINAL, 32, countof(sizes), sizes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ ewmh_update_net_active_window(lua_State *L)
|
||||||
win = XCB_NONE;
|
win = XCB_NONE;
|
||||||
|
|
||||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
globalconf.screen->root,
|
||||||
_NET_ACTIVE_WINDOW, XCB_ATOM_WINDOW, 32, 1, &win);
|
_NET_ACTIVE_WINDOW, XCB_ATOM_WINDOW, 32, 1, &win);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -131,7 +131,7 @@ void
|
||||||
ewmh_init(void)
|
ewmh_init(void)
|
||||||
{
|
{
|
||||||
xcb_window_t father;
|
xcb_window_t father;
|
||||||
xcb_screen_t *xscreen = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
xcb_screen_t *xscreen = globalconf.screen;
|
||||||
xcb_atom_t atom[] =
|
xcb_atom_t atom[] =
|
||||||
{
|
{
|
||||||
_NET_SUPPORTED,
|
_NET_SUPPORTED,
|
||||||
|
@ -231,7 +231,7 @@ ewmh_update_net_client_list(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
globalconf.screen->root,
|
||||||
_NET_CLIENT_LIST, XCB_ATOM_WINDOW, 32, n, wins);
|
_NET_CLIENT_LIST, XCB_ATOM_WINDOW, 32, n, wins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ ewmh_update_net_client_list_stacking(void)
|
||||||
wins[n++] = (*client)->window;
|
wins[n++] = (*client)->window;
|
||||||
|
|
||||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
globalconf.screen->root,
|
||||||
_NET_CLIENT_LIST_STACKING, XCB_ATOM_WINDOW, 32, n, wins);
|
_NET_CLIENT_LIST_STACKING, XCB_ATOM_WINDOW, 32, n, wins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ ewmh_update_net_numbers_of_desktop(void)
|
||||||
uint32_t count = globalconf.screens.tab[0].tags.len;
|
uint32_t count = globalconf.screens.tab[0].tags.len;
|
||||||
|
|
||||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
globalconf.screen->root,
|
||||||
_NET_NUMBER_OF_DESKTOPS, XCB_ATOM_CARDINAL, 32, 1, &count);
|
_NET_NUMBER_OF_DESKTOPS, XCB_ATOM_CARDINAL, 32, 1, &count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ ewmh_update_net_current_desktop(void)
|
||||||
uint32_t idx = tags_get_first_selected_index(&globalconf.screens.tab[0]);
|
uint32_t idx = tags_get_first_selected_index(&globalconf.screens.tab[0]);
|
||||||
|
|
||||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
globalconf.screen->root,
|
||||||
_NET_CURRENT_DESKTOP, XCB_ATOM_CARDINAL, 32, 1, &idx);
|
_NET_CURRENT_DESKTOP, XCB_ATOM_CARDINAL, 32, 1, &idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ ewmh_update_net_desktop_names(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
globalconf.screen->root,
|
||||||
_NET_DESKTOP_NAMES, UTF8_STRING, 8, buf.len, buf.s);
|
_NET_DESKTOP_NAMES, UTF8_STRING, 8, buf.len, buf.s);
|
||||||
buffer_wipe(&buf);
|
buffer_wipe(&buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,8 @@ typedef struct
|
||||||
SnMonitorContext *snmonitor;
|
SnMonitorContext *snmonitor;
|
||||||
/** The default visual, used to draw */
|
/** The default visual, used to draw */
|
||||||
xcb_visualtype_t *visual;
|
xcb_visualtype_t *visual;
|
||||||
|
/** The screen's information */
|
||||||
|
xcb_screen_t *screen;
|
||||||
} awesome_t;
|
} awesome_t;
|
||||||
|
|
||||||
extern awesome_t globalconf;
|
extern awesome_t globalconf;
|
||||||
|
|
|
@ -41,8 +41,7 @@ keygrabber_grab(void)
|
||||||
{
|
{
|
||||||
if((xgb = xcb_grab_keyboard_reply(globalconf.connection,
|
if((xgb = xcb_grab_keyboard_reply(globalconf.connection,
|
||||||
xcb_grab_keyboard(globalconf.connection, true,
|
xcb_grab_keyboard(globalconf.connection, true,
|
||||||
xutil_screen_get(globalconf.connection,
|
globalconf.screen->root,
|
||||||
globalconf.default_screen)->root,
|
|
||||||
XCB_CURRENT_TIME, XCB_GRAB_MODE_ASYNC,
|
XCB_CURRENT_TIME, XCB_GRAB_MODE_ASYNC,
|
||||||
XCB_GRAB_MODE_ASYNC),
|
XCB_GRAB_MODE_ASYNC),
|
||||||
NULL)))
|
NULL)))
|
||||||
|
|
14
mouse.c
14
mouse.c
|
@ -71,7 +71,7 @@ mouse_query_pointer(xcb_window_t window, int16_t *x, int16_t *y, xcb_window_t *c
|
||||||
static bool
|
static bool
|
||||||
mouse_query_pointer_root(screen_t **s, int16_t *x, int16_t *y, xcb_window_t *child, uint16_t *mask)
|
mouse_query_pointer_root(screen_t **s, int16_t *x, int16_t *y, xcb_window_t *child, uint16_t *mask)
|
||||||
{
|
{
|
||||||
xcb_window_t root = xutil_screen_get(globalconf.connection, globalconf.default_screen)->root;
|
xcb_window_t root = globalconf.screen->root;
|
||||||
|
|
||||||
if(mouse_query_pointer(root, x, y, child, mask))
|
if(mouse_query_pointer(root, x, y, child, mask))
|
||||||
{
|
{
|
||||||
|
@ -135,7 +135,6 @@ luaA_mouse_newindex(lua_State *L)
|
||||||
size_t len;
|
size_t len;
|
||||||
const char *attr = luaL_checklstring(L, 2, &len);
|
const char *attr = luaL_checklstring(L, 2, &len);
|
||||||
int x, y = 0;
|
int x, y = 0;
|
||||||
xcb_window_t root;
|
|
||||||
int screen;
|
int screen;
|
||||||
|
|
||||||
switch(a_tokenize(attr, len))
|
switch(a_tokenize(attr, len))
|
||||||
|
@ -144,12 +143,10 @@ luaA_mouse_newindex(lua_State *L)
|
||||||
screen = luaL_checknumber(L, 3) - 1;
|
screen = luaL_checknumber(L, 3) - 1;
|
||||||
luaA_checkscreen(screen);
|
luaA_checkscreen(screen);
|
||||||
|
|
||||||
root = xutil_screen_get(globalconf.connection, globalconf.default_screen)->root;
|
|
||||||
|
|
||||||
x = globalconf.screens.tab[screen].geometry.x;
|
x = globalconf.screens.tab[screen].geometry.x;
|
||||||
y = globalconf.screens.tab[screen].geometry.y;
|
y = globalconf.screens.tab[screen].geometry.y;
|
||||||
|
|
||||||
mouse_warp_pointer(root, x, y);
|
mouse_warp_pointer(globalconf.screen->root, x, y);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -203,8 +200,6 @@ luaA_mouse_coords(lua_State *L)
|
||||||
|
|
||||||
if(lua_gettop(L) >= 1)
|
if(lua_gettop(L) >= 1)
|
||||||
{
|
{
|
||||||
xcb_window_t root;
|
|
||||||
|
|
||||||
luaA_checktable(L, 1);
|
luaA_checktable(L, 1);
|
||||||
bool ignore_enter_notify = (lua_gettop(L) == 2 && luaA_checkboolean(L, 2));
|
bool ignore_enter_notify = (lua_gettop(L) == 2 && luaA_checkboolean(L, 2));
|
||||||
|
|
||||||
|
@ -214,13 +209,10 @@ luaA_mouse_coords(lua_State *L)
|
||||||
x = luaA_getopt_number(L, 1, "x", mouse_x);
|
x = luaA_getopt_number(L, 1, "x", mouse_x);
|
||||||
y = luaA_getopt_number(L, 1, "y", mouse_y);
|
y = luaA_getopt_number(L, 1, "y", mouse_y);
|
||||||
|
|
||||||
root = xutil_screen_get(globalconf.connection,
|
|
||||||
screen_array_indexof(&globalconf.screens, screen))->root;
|
|
||||||
|
|
||||||
if(ignore_enter_notify)
|
if(ignore_enter_notify)
|
||||||
client_ignore_enterleave_events();
|
client_ignore_enterleave_events();
|
||||||
|
|
||||||
mouse_warp_pointer(root, x, y);
|
mouse_warp_pointer(globalconf.screen->root, x, y);
|
||||||
|
|
||||||
if(ignore_enter_notify)
|
if(ignore_enter_notify)
|
||||||
client_restore_enterleave_events();
|
client_restore_enterleave_events();
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
static bool
|
static bool
|
||||||
mousegrabber_grab(xcb_cursor_t cursor)
|
mousegrabber_grab(xcb_cursor_t cursor)
|
||||||
{
|
{
|
||||||
xcb_window_t root = xutil_screen_get(globalconf.connection, globalconf.default_screen)->root;
|
xcb_window_t root = globalconf.screen->root;
|
||||||
|
|
||||||
for(int i = 1000; i; i--)
|
for(int i = 1000; i; i--)
|
||||||
{
|
{
|
||||||
|
|
|
@ -266,7 +266,7 @@ void
|
||||||
client_unfocus(client_t *c)
|
client_unfocus(client_t *c)
|
||||||
{
|
{
|
||||||
|
|
||||||
xcb_window_t root_win = xutil_screen_get(globalconf.connection, globalconf.default_screen)->root;
|
xcb_window_t root_win = globalconf.screen->root;
|
||||||
/* Set focus on root window, so no events leak to the current window.
|
/* 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
|
* This kind of inlines client_set_focus(), but a root window will never have
|
||||||
* the WM_TAKE_FOCUS protocol.
|
* the WM_TAKE_FOCUS protocol.
|
||||||
|
@ -491,7 +491,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, bool startup)
|
||||||
xcb_change_save_set(globalconf.connection, XCB_SET_MODE_INSERT, w);
|
xcb_change_save_set(globalconf.connection, XCB_SET_MODE_INSERT, w);
|
||||||
|
|
||||||
client_t *c = client_new(globalconf.L);
|
client_t *c = client_new(globalconf.L);
|
||||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
xcb_screen_t *s = globalconf.screen;
|
||||||
|
|
||||||
/* consider the window banned */
|
/* consider the window banned */
|
||||||
c->isbanned = true;
|
c->isbanned = true;
|
||||||
|
@ -1076,9 +1076,8 @@ client_unmanage(client_t *c)
|
||||||
XCB_CW_EVENT_MASK,
|
XCB_CW_EVENT_MASK,
|
||||||
(const uint32_t []) { 0 });
|
(const uint32_t []) { 0 });
|
||||||
|
|
||||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
|
||||||
xcb_unmap_window(globalconf.connection, c->window);
|
xcb_unmap_window(globalconf.connection, c->window);
|
||||||
xcb_reparent_window(globalconf.connection, c->window, s->root,
|
xcb_reparent_window(globalconf.connection, c->window, globalconf.screen->root,
|
||||||
c->geometry.x, c->geometry.y);
|
c->geometry.x, c->geometry.y);
|
||||||
xcb_destroy_window(globalconf.connection, c->frame_window);
|
xcb_destroy_window(globalconf.connection, c->frame_window);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ LUA_OBJECT_FUNCS(wibox_class, wibox_t, wibox)
|
||||||
static void
|
static void
|
||||||
wibox_systray_kickout(void)
|
wibox_systray_kickout(void)
|
||||||
{
|
{
|
||||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
xcb_screen_t *s = globalconf.screen;
|
||||||
|
|
||||||
if(globalconf.systray.parent != s->root)
|
if(globalconf.systray.parent != s->root)
|
||||||
{
|
{
|
||||||
|
@ -214,7 +214,7 @@ wibox_draw_context_update(wibox_t *w, xcb_screen_t *s)
|
||||||
static void
|
static void
|
||||||
wibox_init(wibox_t *w)
|
wibox_init(wibox_t *w)
|
||||||
{
|
{
|
||||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
xcb_screen_t *s = globalconf.screen;
|
||||||
|
|
||||||
w->window = xcb_generate_id(globalconf.connection);
|
w->window = xcb_generate_id(globalconf.connection);
|
||||||
xcb_create_window(globalconf.connection, s->root_depth, w->window, s->root,
|
xcb_create_window(globalconf.connection, s->root_depth, w->window, s->root,
|
||||||
|
@ -306,7 +306,7 @@ wibox_moveresize(lua_State *L, int udx, area_t geometry)
|
||||||
if(w->pixmap != w->ctx.pixmap)
|
if(w->pixmap != w->ctx.pixmap)
|
||||||
xcb_free_pixmap(globalconf.connection, w->ctx.pixmap);
|
xcb_free_pixmap(globalconf.connection, w->ctx.pixmap);
|
||||||
w->pixmap = xcb_generate_id(globalconf.connection);
|
w->pixmap = xcb_generate_id(globalconf.connection);
|
||||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
xcb_screen_t *s = globalconf.screen;
|
||||||
xcb_create_pixmap(globalconf.connection, s->root_depth, w->pixmap, s->root,
|
xcb_create_pixmap(globalconf.connection, s->root_depth, w->pixmap, s->root,
|
||||||
w->geometry.width, w->geometry.height);
|
w->geometry.width, w->geometry.height);
|
||||||
wibox_draw_context_update(w, s);
|
wibox_draw_context_update(w, s);
|
||||||
|
@ -378,7 +378,7 @@ wibox_set_orientation(lua_State *L, int udx, orientation_t o)
|
||||||
wibox_t *w = luaA_checkudata(L, udx, &wibox_class);
|
wibox_t *w = luaA_checkudata(L, udx, &wibox_class);
|
||||||
if(o != w->orientation)
|
if(o != w->orientation)
|
||||||
{
|
{
|
||||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
xcb_screen_t *s = globalconf.screen;
|
||||||
w->orientation = o;
|
w->orientation = o;
|
||||||
/* orientation != East */
|
/* orientation != East */
|
||||||
if(w->pixmap != w->ctx.pixmap)
|
if(w->pixmap != w->ctx.pixmap)
|
||||||
|
|
|
@ -251,7 +251,7 @@ widget_render(wibox_t *wibox)
|
||||||
char *data;
|
char *data;
|
||||||
xcb_pixmap_t rootpix;
|
xcb_pixmap_t rootpix;
|
||||||
xcb_get_property_cookie_t prop_c;
|
xcb_get_property_cookie_t prop_c;
|
||||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
xcb_screen_t *s = globalconf.screen;
|
||||||
prop_c = xcb_get_property_unchecked(globalconf.connection, false, s->root, _XROOTPMAP_ID,
|
prop_c = xcb_get_property_unchecked(globalconf.connection, false, s->root, _XROOTPMAP_ID,
|
||||||
XCB_ATOM_PIXMAP, 0, 1);
|
XCB_ATOM_PIXMAP, 0, 1);
|
||||||
if((prop_r = xcb_get_property_reply(globalconf.connection, prop_c, NULL)))
|
if((prop_r = xcb_get_property_reply(globalconf.connection, prop_c, NULL)))
|
||||||
|
|
6
root.c
6
root.c
|
@ -86,7 +86,7 @@ luaA_root_fake_input(lua_State *L)
|
||||||
{
|
{
|
||||||
int screen = luaL_checknumber(L, 5) - 1;
|
int screen = luaL_checknumber(L, 5) - 1;
|
||||||
luaA_checkscreen(screen);
|
luaA_checkscreen(screen);
|
||||||
root = xutil_screen_get(globalconf.connection, screen)->root;
|
root = globalconf.screen->root;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -128,7 +128,7 @@ luaA_root_keys(lua_State *L)
|
||||||
while(lua_next(L, 1))
|
while(lua_next(L, 1))
|
||||||
key_array_append(&globalconf.keys, luaA_object_ref_class(L, -1, &key_class));
|
key_array_append(&globalconf.keys, luaA_object_ref_class(L, -1, &key_class));
|
||||||
|
|
||||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
xcb_screen_t *s = globalconf.screen;
|
||||||
xcb_ungrab_key(globalconf.connection, XCB_GRAB_ANY, s->root, XCB_BUTTON_MASK_ANY);
|
xcb_ungrab_key(globalconf.connection, XCB_GRAB_ANY, s->root, XCB_BUTTON_MASK_ANY);
|
||||||
xwindow_grabkeys(s->root, &globalconf.keys);
|
xwindow_grabkeys(s->root, &globalconf.keys);
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ luaA_root_cursor(lua_State *L)
|
||||||
uint32_t change_win_vals[] = { xcursor_new(globalconf.connection, cursor_font) };
|
uint32_t change_win_vals[] = { xcursor_new(globalconf.connection, cursor_font) };
|
||||||
|
|
||||||
xcb_change_window_attributes(globalconf.connection,
|
xcb_change_window_attributes(globalconf.connection,
|
||||||
xutil_screen_get(globalconf.connection, globalconf.default_screen)->root,
|
globalconf.screen->root,
|
||||||
XCB_CW_CURSOR,
|
XCB_CW_CURSOR,
|
||||||
change_win_vals);
|
change_win_vals);
|
||||||
}
|
}
|
||||||
|
|
10
screen.c
10
screen.c
|
@ -86,9 +86,7 @@ screen_scan_randr(void)
|
||||||
/* A quick XRandR recall:
|
/* A quick XRandR recall:
|
||||||
* You have CRTC that manages a part of a SCREEN.
|
* You have CRTC that manages a part of a SCREEN.
|
||||||
* Each CRTC can draw stuff on one or more OUTPUT. */
|
* Each CRTC can draw stuff on one or more OUTPUT. */
|
||||||
xcb_screen_t *screen = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
xcb_randr_get_screen_resources_cookie_t screen_res_c = xcb_randr_get_screen_resources(globalconf.connection, globalconf.screen->root);
|
||||||
|
|
||||||
xcb_randr_get_screen_resources_cookie_t screen_res_c = xcb_randr_get_screen_resources(globalconf.connection, screen->root);
|
|
||||||
xcb_randr_get_screen_resources_reply_t *screen_res_r = xcb_randr_get_screen_resources_reply(globalconf.connection, screen_res_c, NULL);
|
xcb_randr_get_screen_resources_reply_t *screen_res_r = xcb_randr_get_screen_resources_reply(globalconf.connection, screen_res_c, NULL);
|
||||||
|
|
||||||
/* Only use the data from XRandR if there is more than one screen
|
/* Only use the data from XRandR if there is more than one screen
|
||||||
|
@ -220,7 +218,7 @@ screen_scan_xinerama(void)
|
||||||
static void screen_scan_x11(void)
|
static void screen_scan_x11(void)
|
||||||
{
|
{
|
||||||
/* One screen only / Zaphod mode */
|
/* One screen only / Zaphod mode */
|
||||||
xcb_screen_t *xcb_screen = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
xcb_screen_t *xcb_screen = globalconf.screen;
|
||||||
screen_t s;
|
screen_t s;
|
||||||
p_clear(&s, 1);
|
p_clear(&s, 1);
|
||||||
s.geometry.x = 0;
|
s.geometry.x = 0;
|
||||||
|
@ -239,7 +237,7 @@ screen_scan(void)
|
||||||
screen_scan_x11();
|
screen_scan_x11();
|
||||||
|
|
||||||
globalconf.screen_focus = globalconf.screens.tab;
|
globalconf.screen_focus = globalconf.screens.tab;
|
||||||
globalconf.visual = screen_default_visual(xutil_screen_get(globalconf.connection, globalconf.default_screen));
|
globalconf.visual = screen_default_visual(globalconf.screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the Xinerama screen number where the coordinates belongs to.
|
/** Return the Xinerama screen number where the coordinates belongs to.
|
||||||
|
@ -334,7 +332,7 @@ screen_area_get(screen_t *screen, bool strut)
|
||||||
area_t
|
area_t
|
||||||
display_area_get(void)
|
display_area_get(void)
|
||||||
{
|
{
|
||||||
xcb_screen_t *s = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
xcb_screen_t *s = globalconf.screen;
|
||||||
area_t area = { .x = 0,
|
area_t area = { .x = 0,
|
||||||
.y = 0,
|
.y = 0,
|
||||||
.width = s->width_in_pixels,
|
.width = s->width_in_pixels,
|
||||||
|
|
|
@ -40,7 +40,7 @@ luaA_selection_get(lua_State *L)
|
||||||
{
|
{
|
||||||
if(selection_window == XCB_NONE)
|
if(selection_window == XCB_NONE)
|
||||||
{
|
{
|
||||||
xcb_screen_t *screen = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
xcb_screen_t *screen = globalconf.screen;
|
||||||
uint32_t mask = XCB_CW_BACK_PIXEL | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK;
|
uint32_t mask = XCB_CW_BACK_PIXEL | XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK;
|
||||||
uint32_t values[] = { screen->black_pixel, 1, XCB_EVENT_MASK_PROPERTY_CHANGE };
|
uint32_t values[] = { screen->black_pixel, 1, XCB_EVENT_MASK_PROPERTY_CHANGE };
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
void
|
void
|
||||||
systray_init(void)
|
systray_init(void)
|
||||||
{
|
{
|
||||||
xcb_screen_t *xscreen = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
xcb_screen_t *xscreen = globalconf.screen;
|
||||||
|
|
||||||
globalconf.systray.window = xcb_generate_id(globalconf.connection);
|
globalconf.systray.window = xcb_generate_id(globalconf.connection);
|
||||||
xcb_create_window(globalconf.connection, xscreen->root_depth,
|
xcb_create_window(globalconf.connection, xscreen->root_depth,
|
||||||
|
@ -74,7 +74,7 @@ void
|
||||||
systray_register(void)
|
systray_register(void)
|
||||||
{
|
{
|
||||||
xcb_client_message_event_t ev;
|
xcb_client_message_event_t ev;
|
||||||
xcb_screen_t *xscreen = xutil_screen_get(globalconf.connection, globalconf.default_screen);
|
xcb_screen_t *xscreen = globalconf.screen;
|
||||||
char *atom_name;
|
char *atom_name;
|
||||||
xcb_intern_atom_cookie_t atom_systray_q;
|
xcb_intern_atom_cookie_t atom_systray_q;
|
||||||
xcb_intern_atom_reply_t *atom_systray_r;
|
xcb_intern_atom_reply_t *atom_systray_r;
|
||||||
|
@ -235,7 +235,7 @@ systray_process_client_message(xcb_client_message_event_t *ev)
|
||||||
if(!(geom_r = xcb_get_geometry_reply(globalconf.connection, geom_c, NULL)))
|
if(!(geom_r = xcb_get_geometry_reply(globalconf.connection, geom_c, NULL)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if(xutil_screen_get(globalconf.connection, globalconf.default_screen)->root == geom_r->root)
|
if(globalconf.screen->root == geom_r->root)
|
||||||
ret = systray_request_handle(ev->data.data32[2], NULL);
|
ret = systray_request_handle(ev->data.data32[2], NULL);
|
||||||
|
|
||||||
p_delete(&geom_r);
|
p_delete(&geom_r);
|
||||||
|
|
Loading…
Reference in New Issue