[xutil/awesome] Cosmetic
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
ef07db2bd4
commit
a664203639
|
@ -1353,8 +1353,8 @@ main(int argc, char **argv)
|
||||||
globalconf.keysyms = xcb_key_symbols_alloc(globalconf.connection);
|
globalconf.keysyms = xcb_key_symbols_alloc(globalconf.connection);
|
||||||
|
|
||||||
/* Get the numlock, capslock and shiftlock mask */
|
/* Get the numlock, capslock and shiftlock mask */
|
||||||
xutil_get_lock_mask(globalconf.connection, globalconf.keysyms, &globalconf.numlockmask,
|
xutil_getlockmask(globalconf.connection, globalconf.keysyms, &globalconf.numlockmask,
|
||||||
&globalconf.shiftlockmask, &globalconf.capslockmask);
|
&globalconf.shiftlockmask, &globalconf.capslockmask);
|
||||||
|
|
||||||
xutil_map_raised(globalconf.connection, globalconf.sw->window);
|
xutil_map_raised(globalconf.connection, globalconf.sw->window);
|
||||||
|
|
||||||
|
|
73
awesome.c
73
awesome.c
|
@ -172,8 +172,8 @@ scan()
|
||||||
static xcb_cursor_t
|
static xcb_cursor_t
|
||||||
create_font_cursor(unsigned int cursor_font)
|
create_font_cursor(unsigned int cursor_font)
|
||||||
{
|
{
|
||||||
xcb_font_t font;
|
xcb_font_t font;
|
||||||
xcb_cursor_t cursor;
|
xcb_cursor_t cursor;
|
||||||
|
|
||||||
/* Get the font for the cursor*/
|
/* Get the font for the cursor*/
|
||||||
font = xcb_generate_id(globalconf.connection);
|
font = xcb_generate_id(globalconf.connection);
|
||||||
|
@ -213,6 +213,9 @@ uicb_quit(int screen __attribute__ ((unused)), char *arg __attribute__ ((unused)
|
||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Function to exit on some signals.
|
||||||
|
* \param sig the signal received, unused
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
exit_on_signal(int sig __attribute__ ((unused)))
|
exit_on_signal(int sig __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
|
@ -242,7 +245,7 @@ xerror(void *data __attribute__ ((unused)),
|
||||||
xutil_delete_error(err);
|
xutil_delete_error(err);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
warn("fatal error: request=%s, error=%s\n", err->request_label, err->error_label);
|
warn("fatal error: request=%s, error=%s\n", err->request_label, err->error_label);
|
||||||
xutil_delete_error(err);
|
xutil_delete_error(err);
|
||||||
|
|
||||||
|
@ -252,8 +255,7 @@ xerror(void *data __attribute__ ((unused)),
|
||||||
* error and also exit if 'error_code'' equals to
|
* error and also exit if 'error_code'' equals to
|
||||||
* 'BadImplementation'
|
* 'BadImplementation'
|
||||||
*
|
*
|
||||||
* TODO: display more informations about the error (like the Xlib
|
* \todo display more informations about the error (like the Xlib default error handler)
|
||||||
* default error handler)
|
|
||||||
*/
|
*/
|
||||||
if(e->error_code == BadImplementation)
|
if(e->error_code == BadImplementation)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -262,6 +264,7 @@ xerror(void *data __attribute__ ((unused)),
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Print help and exit(2) with given exit_code.
|
/** Print help and exit(2) with given exit_code.
|
||||||
|
* \param exit_code the exit code
|
||||||
*/
|
*/
|
||||||
static void __attribute__ ((noreturn))
|
static void __attribute__ ((noreturn))
|
||||||
exit_help(int exit_code)
|
exit_help(int exit_code)
|
||||||
|
@ -276,13 +279,13 @@ exit_help(int exit_code)
|
||||||
exit(exit_code);
|
exit(exit_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Hello, this is main
|
/** Hello, this is main.
|
||||||
* \param argc who knows
|
* \param argc who knows
|
||||||
* \param argv who knows
|
* \param argv who knows
|
||||||
* \return EXIT_SUCCESS I hope
|
* \return EXIT_SUCCESS I hope
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
const char *confpath = NULL;
|
const char *confpath = NULL;
|
||||||
|
@ -292,7 +295,6 @@ main(int argc, char *argv[])
|
||||||
Statusbar *statusbar;
|
Statusbar *statusbar;
|
||||||
fd_set rd;
|
fd_set rd;
|
||||||
xcb_generic_event_t *ev;
|
xcb_generic_event_t *ev;
|
||||||
xcb_connection_t *conn;
|
|
||||||
struct sockaddr_un *addr;
|
struct sockaddr_un *addr;
|
||||||
Client *c;
|
Client *c;
|
||||||
bool confcheck = false;
|
bool confcheck = false;
|
||||||
|
@ -347,50 +349,48 @@ main(int argc, char *argv[])
|
||||||
return config_check(confpath);
|
return config_check(confpath);
|
||||||
|
|
||||||
/* X stuff */
|
/* X stuff */
|
||||||
conn = xcb_connect(NULL, &(globalconf.default_screen));
|
globalconf.connection = xcb_connect(NULL, &globalconf.default_screen);
|
||||||
if(xcb_connection_has_error(conn))
|
if(xcb_connection_has_error(globalconf.connection))
|
||||||
eprint("cannot open display\n");
|
eprint("cannot open display\n");
|
||||||
|
|
||||||
xfd = xcb_get_file_descriptor(conn);
|
/* Get the file descriptor corresponding to the X connection */
|
||||||
|
xfd = xcb_get_file_descriptor(globalconf.connection);
|
||||||
|
|
||||||
/* Allocate a handler which will holds all errors and events */
|
/* Allocate a handler which will holds all errors and events */
|
||||||
globalconf.evenths = xcb_alloc_event_handlers(conn);
|
globalconf.evenths = xcb_alloc_event_handlers(globalconf.connection);
|
||||||
xutil_set_error_handler_catch_all(globalconf.evenths, xerrorstart, NULL);
|
xutil_set_error_handler_catch_all(globalconf.evenths, xerrorstart, NULL);
|
||||||
|
|
||||||
const uint32_t select_input_val = XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT;
|
const uint32_t select_input_val = XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT;
|
||||||
|
|
||||||
for(screen_nbr = 0;
|
for(screen_nbr = 0;
|
||||||
screen_nbr < xcb_setup_roots_length(xcb_get_setup(conn));
|
screen_nbr < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||||
screen_nbr++)
|
screen_nbr++)
|
||||||
/* 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(conn,
|
xcb_change_window_attributes(globalconf.connection,
|
||||||
xcb_aux_get_screen(conn, screen_nbr)->root,
|
xcb_aux_get_screen(globalconf.connection, screen_nbr)->root,
|
||||||
XCB_CW_EVENT_MASK, &select_input_val);
|
XCB_CW_EVENT_MASK, &select_input_val);
|
||||||
|
|
||||||
/* need to xcb_flush to validate error handler */
|
/* Need to xcb_flush to validate error handler */
|
||||||
xcb_aux_sync(conn);
|
xcb_aux_sync(globalconf.connection);
|
||||||
|
|
||||||
/* process all errors in the queue if any */
|
/* Process all errors in the queue if any */
|
||||||
xcb_poll_for_event_loop(globalconf.evenths);
|
xcb_poll_for_event_loop(globalconf.evenths);
|
||||||
|
|
||||||
/* set the default xerror handler */
|
/* Set the default xerror handler */
|
||||||
xutil_set_error_handler_catch_all(globalconf.evenths, xerror, NULL);
|
xutil_set_error_handler_catch_all(globalconf.evenths, xerror, NULL);
|
||||||
|
|
||||||
/* Allocate the key symbols */
|
/* Allocate the key symbols */
|
||||||
globalconf.keysyms = xcb_key_symbols_alloc(conn);
|
globalconf.keysyms = xcb_key_symbols_alloc(globalconf.connection);
|
||||||
|
|
||||||
/* Get the NumLock, ShiftLock and CapsLock masks */
|
/* Get the NumLock, ShiftLock and CapsLock masks */
|
||||||
xutil_get_lock_mask(conn, globalconf.keysyms, &globalconf.numlockmask,
|
xutil_getlockmask(globalconf.connection, globalconf.keysyms, &globalconf.numlockmask,
|
||||||
&globalconf.shiftlockmask, &globalconf.capslockmask);
|
&globalconf.shiftlockmask, &globalconf.capslockmask);
|
||||||
|
|
||||||
/* store connection */
|
|
||||||
globalconf.connection = conn;
|
|
||||||
|
|
||||||
/* init EWMH atoms */
|
/* init EWMH atoms */
|
||||||
ewmh_init_atoms();
|
ewmh_init_atoms();
|
||||||
|
|
||||||
/* init screens struct */
|
/* init screens struct */
|
||||||
globalconf.screens_info = screensinfo_new(conn);
|
globalconf.screens_info = screensinfo_new(globalconf.connection);
|
||||||
globalconf.screens = p_new(VirtScreen, globalconf.screens_info->nscreen);
|
globalconf.screens = p_new(VirtScreen, globalconf.screens_info->nscreen);
|
||||||
focus_add_client(NULL);
|
focus_add_client(NULL);
|
||||||
|
|
||||||
|
@ -423,7 +423,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
/* do this only for real screen */
|
/* do this only for real screen */
|
||||||
for(screen_nbr = 0;
|
for(screen_nbr = 0;
|
||||||
screen_nbr < xcb_setup_roots_length(xcb_get_setup(conn));
|
screen_nbr < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
|
||||||
screen_nbr++)
|
screen_nbr++)
|
||||||
{
|
{
|
||||||
xcb_change_window_attributes(globalconf.connection,
|
xcb_change_window_attributes(globalconf.connection,
|
||||||
|
@ -456,19 +456,19 @@ main(int argc, char *argv[])
|
||||||
set_client_message_event_handler(globalconf.evenths, event_handle_clientmessage, NULL);
|
set_client_message_event_handler(globalconf.evenths, event_handle_clientmessage, NULL);
|
||||||
|
|
||||||
/* check for shape extension */
|
/* check for shape extension */
|
||||||
shape_query = xcb_get_extension_data(conn, &xcb_shape_id);
|
shape_query = xcb_get_extension_data(globalconf.connection, &xcb_shape_id);
|
||||||
if((globalconf.have_shape = shape_query->present))
|
if((globalconf.have_shape = shape_query->present))
|
||||||
xcb_set_event_handler(globalconf.evenths, (shape_query->first_event + XCB_SHAPE_NOTIFY),
|
xcb_set_event_handler(globalconf.evenths, (shape_query->first_event + XCB_SHAPE_NOTIFY),
|
||||||
(xcb_generic_event_handler_t) event_handle_shape, NULL);
|
(xcb_generic_event_handler_t) event_handle_shape, NULL);
|
||||||
|
|
||||||
/* check for randr extension */
|
/* check for randr extension */
|
||||||
randr_query = xcb_get_extension_data(conn, &xcb_randr_id);
|
randr_query = xcb_get_extension_data(globalconf.connection, &xcb_randr_id);
|
||||||
if((globalconf.have_randr = randr_query->present))
|
if((globalconf.have_randr = randr_query->present))
|
||||||
xcb_set_event_handler(globalconf.evenths, (randr_query->first_event + XCB_RANDR_SCREEN_CHANGE_NOTIFY),
|
xcb_set_event_handler(globalconf.evenths, (randr_query->first_event + XCB_RANDR_SCREEN_CHANGE_NOTIFY),
|
||||||
(xcb_generic_event_handler_t) event_handle_randr_screen_change_notify,
|
(xcb_generic_event_handler_t) event_handle_randr_screen_change_notify,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
xcb_aux_sync(conn);
|
xcb_aux_sync(globalconf.connection);
|
||||||
|
|
||||||
/* get socket fd */
|
/* get socket fd */
|
||||||
csfd = socket_getclient();
|
csfd = socket_getclient();
|
||||||
|
@ -533,23 +533,23 @@ main(int argc, char *argv[])
|
||||||
* are available and select() won't tell us, so let's check
|
* are available and select() won't tell us, so let's check
|
||||||
* with XPending() again.
|
* with XPending() again.
|
||||||
*/
|
*/
|
||||||
while((ev = xcb_poll_for_event(conn)))
|
while((ev = xcb_poll_for_event(globalconf.connection)))
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
xcb_handle_event(globalconf.evenths, ev);
|
xcb_handle_event(globalconf.evenths, ev);
|
||||||
|
|
||||||
/* need to resync */
|
/* need to resync */
|
||||||
xcb_aux_sync(conn);
|
xcb_aux_sync(globalconf.connection);
|
||||||
|
|
||||||
p_delete(&ev);
|
p_delete(&ev);
|
||||||
} while((ev = xcb_poll_for_event(conn)));
|
} while((ev = xcb_poll_for_event(globalconf.connection)));
|
||||||
|
|
||||||
statusbar_refresh();
|
statusbar_refresh();
|
||||||
layout_refresh();
|
layout_refresh();
|
||||||
|
|
||||||
/* need to resync */
|
/* need to resync */
|
||||||
xcb_aux_sync(conn);
|
xcb_aux_sync(globalconf.connection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,8 +566,9 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
xcb_aux_sync(globalconf.connection);
|
xcb_aux_sync(globalconf.connection);
|
||||||
|
|
||||||
xcb_disconnect(conn);
|
xcb_disconnect(globalconf.connection);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
|
|
@ -71,9 +71,9 @@ xgettextprop(xcb_connection_t *conn, xcb_window_t w, xcb_atom_t atom,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xutil_get_lock_mask(xcb_connection_t *conn, xcb_key_symbols_t *keysyms,
|
xutil_getlockmask(xcb_connection_t *conn, xcb_key_symbols_t *keysyms,
|
||||||
unsigned int *numlockmask, unsigned int *shiftlockmask,
|
unsigned int *numlockmask, unsigned int *shiftlockmask,
|
||||||
unsigned int *capslockmask)
|
unsigned int *capslockmask)
|
||||||
{
|
{
|
||||||
xcb_get_modifier_mapping_reply_t *modmap_r;
|
xcb_get_modifier_mapping_reply_t *modmap_r;
|
||||||
xcb_keycode_t *modmap, kc;
|
xcb_keycode_t *modmap, kc;
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
|
|
||||||
bool xgettextprop(xcb_connection_t *, xcb_window_t, xcb_atom_t, char *, ssize_t);
|
bool xgettextprop(xcb_connection_t *, xcb_window_t, xcb_atom_t, char *, ssize_t);
|
||||||
void xutil_get_lock_mask(xcb_connection_t *, xcb_key_symbols_t *,
|
void xutil_getlockmask(xcb_connection_t *, xcb_key_symbols_t *,
|
||||||
unsigned int *, unsigned int *, unsigned int *);
|
unsigned int *, unsigned int *, unsigned int *);
|
||||||
|
|
||||||
/* See http://tronche.com/gui/x/xlib/appendix/b/ for values */
|
/* See http://tronche.com/gui/x/xlib/appendix/b/ for values */
|
||||||
#define CURSOR_FLEUR 52
|
#define CURSOR_FLEUR 52
|
||||||
|
|
Loading…
Reference in New Issue