From simon at ruderich.org Sat Feb 1 21:54:53 2014 From: simon at ruderich.org (Simon Ruderich) Date: Sat, 1 Feb 2014 21:54:53 +0100 Subject: [PATCH 00/10] Misc patches Message-ID: Hello, The following patches perform miscellaneous cleanups and fix some minor bugs. Regards Simon Simon Ruderich (10): Use void as "parameter" for functions without arguments. Refactor smart window surrounding check. NEWS: Remove duplicate line. main.c: Fix yoda condition. colors.mk: No duplicate make output in verbose mode. Makefile: Use $(CFLAGS) when linking. command: Replace incorrect use of LENGTH(). settings: Fix indentation. doc: Fix ## hack. Remove unused functions. Makefile | 2 +- NEWS | 1 - colors.mk | 2 ++ doc/herbstclient.txt | 5 ++--- doc/herbstluftwm.txt | 16 ++++++++-------- ipc-client/ipc-client.c | 2 +- ipc-client/main.c | 4 ++-- src/clientlist.c | 27 ++++++++++---------------- src/clientlist.h | 14 +++++++------- src/command.c | 2 +- src/ewmh.c | 18 ++++++++--------- src/ewmh.h | 18 ++++++++--------- src/hook.c | 4 ++-- src/hook.h | 4 ++-- src/ipc-server.c | 4 ++-- src/ipc-server.h | 4 ++-- src/key.c | 12 ++++++------ src/key.h | 12 ++++++------ src/layout.c | 32 ++++++++++++++----------------- src/layout.h | 16 ++++++++-------- src/main.c | 32 ++++++++++++++----------------- src/monitor.c | 51 ++++++++++++------------------------------------- src/monitor.h | 27 ++++++++++++-------------- src/mouse.c | 16 ++++++---------- src/mouse.h | 11 +++++------ src/object.c | 25 ++++-------------------- src/object.h | 10 ++++------ src/rules.c | 6 +++--- src/rules.h | 6 +++--- src/settings.c | 8 ++++---- src/settings.h | 8 ++++---- src/stack.c | 39 ++++--------------------------------- src/stack.h | 8 +++----- src/tag.c | 18 ++++++++--------- src/tag.h | 18 ++++++++--------- src/utils.c | 34 +-------------------------------- src/utils.h | 6 +----- 37 files changed, 192 insertions(+), 330 deletions(-) -- 1.8.5.3 -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From simon at ruderich.org Sat Feb 1 21:55:14 2014 From: simon at ruderich.org (Simon Ruderich) Date: Sat, 1 Feb 2014 21:55:14 +0100 Subject: [PATCH 01/10] Use void as "parameter" for functions without arguments. In-Reply-To: References: Message-ID: <805122f7059195a02e9de6f342216061dc9c49d1.1391287795.git.simon@ruderich.org> If nothing is specified, the function can take any number of arguments. --- ipc-client/ipc-client.c | 2 +- ipc-client/main.c | 4 ++-- src/clientlist.c | 16 ++++++++-------- src/clientlist.h | 14 +++++++------- src/ewmh.c | 18 +++++++++--------- src/ewmh.h | 18 +++++++++--------- src/hook.c | 4 ++-- src/hook.h | 4 ++-- src/ipc-server.c | 4 ++-- src/ipc-server.h | 4 ++-- src/key.c | 12 ++++++------ src/key.h | 12 ++++++------ src/layout.c | 14 +++++++------- src/layout.h | 12 ++++++------ src/main.c | 26 +++++++++++++------------- src/monitor.c | 24 ++++++++++++------------ src/monitor.h | 24 ++++++++++++------------ src/mouse.c | 12 ++++++------ src/mouse.h | 10 +++++----- src/object.c | 8 ++++---- src/object.h | 8 ++++---- src/rules.c | 6 +++--- src/rules.h | 6 +++--- src/settings.c | 6 +++--- src/settings.h | 8 ++++---- src/stack.c | 8 ++++---- src/stack.h | 6 +++--- src/tag.c | 18 +++++++++--------- src/tag.h | 18 +++++++++--------- src/utils.c | 2 +- src/utils.h | 2 +- 31 files changed, 165 insertions(+), 165 deletions(-) diff --git a/ipc-client/ipc-client.c b/ipc-client/ipc-client.c index d899351..37f4f52 100644 --- a/ipc-client/ipc-client.c +++ b/ipc-client/ipc-client.c @@ -31,7 +31,7 @@ struct HCConnection { Window root; }; -HCConnection* hc_connect() { +HCConnection* hc_connect(void) { Display* display = XOpenDisplay(NULL); if (display == NULL) { return NULL; diff --git a/ipc-client/main.c b/ipc-client/main.c index 678c55b..6039e23 100644 --- a/ipc-client/main.c +++ b/ipc-client/main.c @@ -18,7 +18,7 @@ void print_help(char* command, FILE* file); void init_hook_regex(int argc, char* argv[]); -void destroy_hook_regex(); +void destroy_hook_regex(void); int g_ensure_newline = 1; // if set, output ends with a newline int g_wait_for_hook = 0; // if set, do not execute command but wait @@ -53,7 +53,7 @@ void init_hook_regex(int argc, char* argv[]) { g_hook_regex_count = argc; } -void destroy_hook_regex() { +void destroy_hook_regex(void) { int i; for (i = 0; i < g_hook_regex_count; i++) { regfree(g_hook_regex + i); diff --git a/src/clientlist.c b/src/clientlist.c index 34331ab..36dde75 100644 --- a/src/clientlist.c +++ b/src/clientlist.c @@ -53,7 +53,7 @@ static Atom g_wmatom[WMLast]; static void client_set_urgent_force(HSClient* client, bool state); -static HSClient* create_client() { +static HSClient* create_client(void) { HSClient* hc = g_new0(HSClient, 1); hsobject_init(&hc->object); hc->window_str = NULL; @@ -71,7 +71,7 @@ static HSClient* create_client() { return hc; } -static void fetch_colors() { +static void fetch_colors(void) { g_window_border_width = &(settings_find("window_border_width")->value.i); g_window_border_inner_width = &(settings_find("window_border_inner_width")->value.i); g_window_gap = &(settings_find("window_gap")->value.i); @@ -89,7 +89,7 @@ static void fetch_colors() { g_pseudotile_center_threshold = &(settings_find("pseudotile_center_threshold")->value.i); } -void clientlist_init() { +void clientlist_init(void) { // init regex simple.. fetch_colors(); g_wmatom[WMProtocols] = XInternAtom(g_display, "WM_PROTOCOLS", False); @@ -102,7 +102,7 @@ void clientlist_init() { NULL, (GDestroyNotify)client_destroy); } -void reset_client_colors() { +void reset_client_colors(void) { fetch_colors(); all_monitors_apply_layout(); } @@ -127,7 +127,7 @@ static void client_show_window(void* key, void* client_void, void* data) { window_show(client->window); } -void clientlist_destroy() { +void clientlist_destroy(void) { // move all clients to their original floating position g_hash_table_foreach(g_clients, client_move_to_floatpos, NULL); g_hash_table_foreach(g_clients, client_show_window, NULL); @@ -382,7 +382,7 @@ void window_unfocus(Window window) { } static Window lastfocus = 0; -void window_unfocus_last() { +void window_unfocus_last(void) { if (lastfocus) { window_unfocus(lastfocus); } @@ -887,7 +887,7 @@ void client_update_title(HSClient* client) { } } -HSClient* get_current_client() { +HSClient* get_current_client(void) { return frame_focused_client(g_cur_frame); } @@ -980,7 +980,7 @@ static bool is_client_urgent(void* key, HSClient* client, void* data) { return client->urgent; } -HSClient* get_urgent_client() { +HSClient* get_urgent_client(void) { return g_hash_table_find(g_clients, (GHRFunc)is_client_urgent, NULL); } diff --git a/src/clientlist.h b/src/clientlist.h index 9f3947d..196ffa4 100644 --- a/src/clientlist.h +++ b/src/clientlist.h @@ -46,17 +46,17 @@ typedef struct HSClient { struct HSSlice* slice; } HSClient; -void clientlist_init(); -void clientlist_destroy(); +void clientlist_init(void); +void clientlist_destroy(void); void clientlist_foreach(GHFunc func, gpointer data); void window_focus(Window window); void window_unfocus(Window window); -void window_unfocus_last(); +void window_unfocus_last(void); -void reset_client_colors(); -void reset_client_settings(); +void reset_client_colors(void); +void reset_client_settings(void); // adds a new client to list of managed client windows HSClient* manage_client(Window win); @@ -68,8 +68,8 @@ void window_enforce_last_size(Window in); void client_destroy(HSClient* client); HSClient* get_client_from_window(Window window); -HSClient* get_current_client(); -HSClient* get_urgent_client(); +HSClient* get_current_client(void); +HSClient* get_urgent_client(void); Rectangle client_outer_floating_rect(HSClient* client); Window string_to_client(char* str, HSClient** ret_client); diff --git a/src/ewmh.c b/src/ewmh.c index 5a818f2..c1104a9 100644 --- a/src/ewmh.c +++ b/src/ewmh.c @@ -65,7 +65,7 @@ char* g_netatom_names[NetCOUNT] = { [ NetWmWindowTypeNormal ] = "_NET_WM_WINDOW_TYPE_NORMAL" , }; -void ewmh_init() { +void ewmh_init(void) { /* init globals */ g_focus_stealing_prevention = &(settings_find("focus_stealing_prevention")->value.i); @@ -108,7 +108,7 @@ void ewmh_init() { XA_CARDINAL, 32, PropModeReplace, (unsigned char *) buf, LENGTH(buf)); } -void ewmh_update_all() { +void ewmh_update_all(void) { /* init many properties */ ewmh_update_client_list(); ewmh_update_client_list_stacking(); @@ -117,7 +117,7 @@ void ewmh_update_all() { ewmh_update_desktop_names(); } -void ewmh_destroy() { +void ewmh_destroy(void) { g_free(g_windows); if (g_original_clients) { XFree(g_original_clients); @@ -135,11 +135,11 @@ void ewmh_set_wmname(char* name) { (unsigned char*)name, strlen(name)); } -void ewmh_update_wmname() { +void ewmh_update_wmname(void) { ewmh_set_wmname(settings_find("wmname")->value.s); } -void ewmh_update_client_list() { +void ewmh_update_client_list(void) { XChangeProperty(g_display, g_root, g_netatom[NetClientList], XA_WINDOW, 32, PropModeReplace, (unsigned char *) g_windows, g_window_count); @@ -188,7 +188,7 @@ static void ewmh_add_tag_stack(HSTag* tag, void* data) { } } -void ewmh_update_client_list_stacking() { +void ewmh_update_client_list_stacking(void) { // First: get the windows in the current stack struct ewmhstack stack; stack.count = g_window_count; @@ -232,12 +232,12 @@ void ewmh_remove_client(Window win) { ewmh_update_client_list_stacking(); } -void ewmh_update_desktops() { +void ewmh_update_desktops(void) { XChangeProperty(g_display, g_root, g_netatom[NetNumberOfDesktops], XA_CARDINAL, 32, PropModeReplace, (unsigned char*)&(g_tags->len), 1); } -void ewmh_update_desktop_names() { +void ewmh_update_desktop_names(void) { char** names = g_new(char*, g_tags->len); for (int i = 0; i < g_tags->len; i++) { names[i] = g_array_index(g_tags, HSTag*,i)->name->str; @@ -250,7 +250,7 @@ void ewmh_update_desktop_names() { g_free(names); } -void ewmh_update_current_desktop() { +void ewmh_update_current_desktop(void) { HSTag* tag = get_current_monitor()->tag; int index = array_find(g_tags->data, g_tags->len, sizeof(HSTag*), &tag); if (index < 0) { diff --git a/src/ewmh.h b/src/ewmh.h index 013a781..6a7bba5 100644 --- a/src/ewmh.h +++ b/src/ewmh.h @@ -63,22 +63,22 @@ Atom g_netatom[NetCOUNT]; extern char* g_netatom_names[]; -void ewmh_init(); -void ewmh_destroy(); -void ewmh_update_all(); +void ewmh_init(void); +void ewmh_destroy(void); +void ewmh_update_all(void); void ewmh_add_client(Window win); void ewmh_remove_client(Window win); void ewmh_set_wmname(char* name); -void ewmh_update_wmname(); +void ewmh_update_wmname(void); -void ewmh_update_client_list(); +void ewmh_update_client_list(void); void ewmh_get_original_client_list(Window** buf, unsigned long *count); -void ewmh_update_client_list_stacking(); -void ewmh_update_desktops(); -void ewmh_update_desktop_names(); +void ewmh_update_client_list_stacking(void); +void ewmh_update_desktops(void); +void ewmh_update_desktop_names(void); void ewmh_update_active_window(Window win); -void ewmh_update_current_desktop(); +void ewmh_update_current_desktop(void); void ewmh_update_window_state(struct HSClient* client); bool ewmh_is_window_state_set(Window win, Atom hint); bool ewmh_is_fullscreen_set(Window win); diff --git a/src/hook.c b/src/hook.c index 5f9959a..84ccf31 100644 --- a/src/hook.c +++ b/src/hook.c @@ -21,7 +21,7 @@ static Window g_event_window; -void hook_init() { +void hook_init(void) { g_event_window = XCreateSimpleWindow(g_display, g_root, 42, 42, 42, 42, 0, 0, 0); // set wm_class for window XClassHint *hint = XAllocClassHint(); @@ -36,7 +36,7 @@ void hook_init() { XA_ATOM, 32, PropModeReplace, (unsigned char*)&g_event_window, 1); } -void hook_destroy() { +void hook_destroy(void) { // remove property from root window XDeleteProperty(g_display, g_root, ATOM(HERBST_HOOK_WIN_ID_ATOM)); XDestroyWindow(g_display, g_event_window); diff --git a/src/hook.h b/src/hook.h index 16c947f..bb66479 100644 --- a/src/hook.h +++ b/src/hook.h @@ -8,8 +8,8 @@ #include "layout.h" -void hook_init(); -void hook_destroy(); +void hook_init(void); +void hook_destroy(void); void hook_emit(int argc, char** argv); void emit_tag_changed(HSTag* tag, int monitor); diff --git a/src/ipc-server.c b/src/ipc-server.c index 58fc62f..430cc78 100644 --- a/src/ipc-server.c +++ b/src/ipc-server.c @@ -20,10 +20,10 @@ // public callable functions // -void ipc_init() { +void ipc_init(void) { } -void ipc_destroy() { +void ipc_destroy(void) { } void ipc_add_connection(Window window) { diff --git a/src/ipc-server.h b/src/ipc-server.h index 11de995..53d6851 100644 --- a/src/ipc-server.h +++ b/src/ipc-server.h @@ -9,8 +9,8 @@ #include #include -void ipc_init(); -void ipc_destroy(); +void ipc_init(void); +void ipc_destroy(void); void ipc_add_connection(Window win); // returns true if property was received successfully diff --git a/src/key.c b/src/key.c index d6a0c22..3e1d452 100644 --- a/src/key.c +++ b/src/key.c @@ -18,21 +18,21 @@ static unsigned int numlockmask = 0; #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) -unsigned int* get_numlockmask_ptr() { +unsigned int* get_numlockmask_ptr(void) { return &numlockmask; } GList* g_key_binds = NULL; -void key_init() { +void key_init(void) { update_numlockmask(); } -void key_destroy() { +void key_destroy(void) { key_remove_all_binds(); } -void key_remove_all_binds() { +void key_remove_all_binds(void) { g_list_free_full(g_key_binds, (GDestroyNotify)keybinding_free); g_key_binds = NULL; regrab_keys(); @@ -219,7 +219,7 @@ bool key_remove_bind_with_keysym(unsigned int modifiers, KeySym keysym){ return true; } -void regrab_keys() { +void regrab_keys(void) { update_numlockmask(); // init modifiers after updating numlockmask XUngrabKey(g_display, AnyKey, AnyModifier, g_root); // remove all current grabs @@ -242,7 +242,7 @@ void grab_keybind(KeyBinding* binding, void* useless_pointer) { // update the numlockmask // from dwm.c -void update_numlockmask() { +void update_numlockmask(void) { unsigned int i, j; XModifierKeymap *modmap; diff --git a/src/key.h b/src/key.h index e99004d..275ea26 100644 --- a/src/key.h +++ b/src/key.h @@ -31,21 +31,21 @@ void keybinding_free(KeyBinding* binding); int key_list_binds(int argc, char** argv, GString* output); int list_keysyms(int argc, char** argv, GString* output); bool key_remove_bind_with_keysym(unsigned int modifiers, KeySym sym); -void key_remove_all_binds(); +void key_remove_all_binds(void); GString* keybinding_to_g_string(KeyBinding* binding); void key_find_binds(char* needle, GString* output); void complete_against_modifiers(char* needle, char seperator, char* prefix, GString* output); void complete_against_keysyms(char* needle, char* prefix, GString* output); -void regrab_keys(); +void regrab_keys(void); void grab_keybind(KeyBinding* binding, void* useless_pointer); -void update_numlockmask(); -unsigned int* get_numlockmask_ptr(); +void update_numlockmask(void); +unsigned int* get_numlockmask_ptr(void); void handle_key_press(XEvent* ev); -void key_init(); -void key_destroy(); +void key_init(void); +void key_destroy(void); #endif diff --git a/src/layout.c b/src/layout.c index 2853379..c7e8ffe 100644 --- a/src/layout.c +++ b/src/layout.c @@ -64,7 +64,7 @@ char* g_layout_names[] = { NULL, }; -static void fetch_frame_colors() { +static void fetch_frame_colors(void) { // load settings g_frame_gap = &(settings_find("frame_gap")->value.i); g_frame_padding = &(settings_find("frame_padding")->value.i); @@ -104,15 +104,15 @@ static void fetch_frame_colors() { } } -void layout_init() { +void layout_init(void) { fetch_frame_colors(); } -void reset_frame_colors() { +void reset_frame_colors(void) { fetch_frame_colors(); all_monitors_apply_layout(); } -void layout_destroy() { +void layout_destroy(void) { } @@ -912,7 +912,7 @@ HSFrame* frame_current_selection_below(HSFrame* frame) { return frame; } -HSFrame* frame_current_selection() { +HSFrame* frame_current_selection(void) { HSMonitor* m = get_current_monitor(); if (!m->tag) return NULL; return frame_current_selection_below(m->tag->frame); @@ -1599,7 +1599,7 @@ int frame_move_window_command(int argc, char** argv, GString* output) { return 0; } -void frame_unfocus() { +void frame_unfocus(void) { //XSetInputFocus(g_display, g_root, RevertToPointerRoot, CurrentTime); } @@ -1817,7 +1817,7 @@ static void frame_rotate(HSFrame* frame) { } } -int layout_rotate_command() { +int layout_rotate_command(int argc, char** argv) { frame_do_recursive(get_current_monitor()->tag->frame, frame_rotate, -1); monitor_apply_layout(get_current_monitor()); return 0; diff --git a/src/layout.h b/src/layout.h index 97a4fd8..964a646 100644 --- a/src/layout.h +++ b/src/layout.h @@ -97,13 +97,13 @@ int* g_frame_gap; int* g_window_gap; // functions -void layout_init(); -void layout_destroy(); +void layout_init(void); +void layout_destroy(void); // for frames HSFrame* frame_create_empty(HSFrame* parent, HSTag* parenttag); void frame_insert_client(HSFrame* frame, struct HSClient* client); HSFrame* lookup_frame(HSFrame* root, char* path); -HSFrame* frame_current_selection(); +HSFrame* frame_current_selection(void); HSFrame* frame_current_selection_below(HSFrame* frame); // finds the subframe of frame that contains the window HSFrame* find_frame_with_client(HSFrame* frame, struct HSClient* client); @@ -121,7 +121,7 @@ int frame_change_fraction_command(int argc, char** argv, GString* output); void frame_apply_layout(HSFrame* frame, Rectangle rect); void frame_apply_floating_layout(HSFrame* frame, struct HSMonitor* m); void frame_update_frame_window_visibility(HSFrame* frame); -void reset_frame_colors(); +void reset_frame_colors(void); HSFrame* get_toplevel_frame(HSFrame* frame); void print_frame_tree(HSFrame* frame, GString* output); @@ -140,7 +140,7 @@ int cycle_all_command(int argc, char** argv); int cycle_frame_command(int argc, char** argv); void cycle_frame(int direction, int new_window_index, bool skip_invisible); -void frame_unfocus(); // unfocus currently focused window +void frame_unfocus(void); // unfocus currently focused window // get neighbour in a specific direction 'l' 'r' 'u' 'd' (left, right,...) // returns the neighbour or NULL if there is no one @@ -155,7 +155,7 @@ void frame_do_recursive_data(HSFrame* frame, void (*action)(HSFrame*,void*), int order, void* data); void frame_hide_recursive(HSFrame* frame); void frame_show_recursive(HSFrame* frame); -int layout_rotate_command(); +int layout_rotate_command(int argc, char** argv); // do an action for each client in frame tree // returns success or failure int frame_foreach_client(HSFrame* frame, ClientAction action, void* data); diff --git a/src/main.c b/src/main.c index 22fc4c9..5d93bf3 100644 --- a/src/main.c +++ b/src/main.c @@ -49,16 +49,16 @@ static int* g_raise_on_click = NULL; typedef void (*HandlerTable[LASTEvent]) (XEvent*); -int quit(); -int reload(); +int quit(int argc, char* argv[]); +int reload(int argc, char* argv[]); int version(int argc, char* argv[], GString* output); int echo(int argc, char* argv[], GString* output); -int true_command(); -int false_command(); +int true_command(int argc, char* argv[]); +int false_command(int argc, char* argv[]); int print_layout_command(int argc, char** argv, GString* output); int load_command(int argc, char** argv, GString* output); int print_tag_status_command(int argc, char** argv, GString* output); -void execute_autostart_file(); +void execute_autostart_file(void); int raise_command(int argc, char** argv, GString* output); int spawn(int argc, char** argv); int wmexec(int argc, char** argv); @@ -187,13 +187,13 @@ CommandBinding g_commands[] = { }; // core functions -int quit() { +int quit(int argc, char* argv[]) { g_aboutToQuit = true; return 0; } // reload config -int reload() { +int reload(int argc, char* argv[]) { execute_autostart_file(); return 0; } @@ -218,11 +218,11 @@ int echo(int argc, char* argv[], GString* output) { return 0; } -int true_command() { +int true_command(int argc, char* argv[]) { return 0; } -int false_command() { +int false_command(int argc, char* argv[]) { return 1; } @@ -600,7 +600,7 @@ void scan(void) { } } -void execute_autostart_file() { +void execute_autostart_file(void) { GString* path = NULL; if (g_autostart_path) { path = g_string_new(g_autostart_path); @@ -695,7 +695,7 @@ static void sigaction_signal(int signum, void (*handler)(int)) { sigaction(signum, &act, NULL); } -static void fetch_settings() { +static void fetch_settings(void) { // fetch settings only for this main.c file from settings table g_focus_follows_mouse = &(settings_find("focus_follows_mouse")->value.i); g_raise_on_click = &(settings_find("raise_on_click")->value.i); @@ -722,8 +722,8 @@ static HandlerTable g_default_handler = { }; static struct { - void (*init)(); - void (*destroy)(); + void (*init)(void); + void (*destroy)(void); } g_modules[] = { { ipc_init, ipc_destroy }, { object_tree_init, object_tree_destroy }, diff --git a/src/monitor.c b/src/monitor.c index cb4d4c0..a3f9cd0 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -41,7 +41,7 @@ typedef struct RectList { static RectList* reclist_insert_disjoint(RectList* head, RectList* mt); -void monitor_init() { +void monitor_init(void) { g_monitors_locked = &(settings_find("monitors_locked")->value.i); g_cur_monitor = 0; g_monitors = g_array_new(false, false, sizeof(HSMonitor*)); @@ -53,7 +53,7 @@ void monitor_init() { g_monitor_by_name_object = hsobject_create_and_link(g_monitor_object, "by-name"); } -void monitor_destroy() { +void monitor_destroy(void) { for (int i = 0; i < g_monitors->len; i++) { HSMonitor* m = monitor_with_index(i); stack_remove_slice(g_monitor_stack, m->slice); @@ -710,7 +710,7 @@ HSMonitor* find_monitor_with_tag(HSTag* tag) { return NULL; } -void ensure_monitors_are_available() { +void ensure_monitors_are_available(void) { if (g_monitors->len > 0) { // nothing to do return; @@ -739,15 +739,15 @@ HSMonitor* monitor_with_frame(HSFrame* frame) { return find_monitor_with_tag(tag); } -HSMonitor* get_current_monitor() { +HSMonitor* get_current_monitor(void) { return g_array_index(g_monitors, HSMonitor*, g_cur_monitor); } -int monitor_count() { +int monitor_count(void) { return g_monitors->len; } -void all_monitors_apply_layout() { +void all_monitors_apply_layout(void) { monitor_foreach(monitor_apply_layout); } @@ -994,7 +994,7 @@ void monitor_focus_by_index(int new_selection) { emit_tag_changed(monitor->tag, new_selection); } -void monitor_update_focus_objects() { +void monitor_update_focus_objects(void) { hsobject_link(g_monitor_object, &get_current_monitor()->object, "focus"); tag_update_focus_objects(); } @@ -1033,7 +1033,7 @@ int monitors_lock_command(int argc, char** argv) { return 0; } -void monitors_lock() { +void monitors_lock(void) { // lock-number must never be negative // ensure that lock value is valid if (*g_monitors_locked < 0) { @@ -1049,7 +1049,7 @@ int monitors_unlock_command(int argc, char** argv) { return 0; } -void monitors_unlock() { +void monitors_unlock(void) { // lock-number must never be lower than 1 if unlocking // so: ensure that lock value is valid if (*g_monitors_locked < 1) { @@ -1060,7 +1060,7 @@ void monitors_unlock() { monitors_lock_changed(); } -void monitors_lock_changed() { +void monitors_lock_changed(void) { if (*g_monitors_locked < 0) { *g_monitors_locked = 0; HSDebug("fixing invalid monitors_locked value to 0\n"); @@ -1210,7 +1210,7 @@ void monitor_stack_to_window_buf(Window* buf, int len, bool only_clients, stack_to_window_buf(g_monitor_stack, buf, len, only_clients, remain_len); } -HSStack* get_monitor_stack() { +HSStack* get_monitor_stack(void) { return g_monitor_stack; } @@ -1275,7 +1275,7 @@ void all_monitors_replace_previous_tag(HSTag *old, HSTag *new) { } } -void drop_enternotify_events() { +void drop_enternotify_events(void) { XEvent ev; XSync(g_display, False); while(XCheckMaskEvent(g_display, EnterWindowMask, &ev)); diff --git a/src/monitor.h b/src/monitor.h index 0cec4e5..f2fd4b6 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -47,8 +47,8 @@ typedef struct HSMonitor { // globals int g_cur_monitor; -void monitor_init(); -void monitor_destroy(); +void monitor_init(void); +void monitor_destroy(void); // adds a new monitor to g_monitors and returns a pointer to it HSMonitor* monitor_with_frame(struct HSFrame* frame); @@ -78,34 +78,34 @@ int set_monitor_rects(Rectangle* templates, size_t count); int move_monitor_command(int argc, char** argv, GString* output); int rename_monitor_command(int argc, char** argv, GString* output); int monitor_rect_command(int argc, char** argv, GString* output); -HSMonitor* get_current_monitor(); -int monitor_count(); +HSMonitor* get_current_monitor(void); +int monitor_count(void); int monitor_set_tag(HSMonitor* monitor, struct HSTag* tag); int monitor_set_pad_command(int argc, char** argv, GString* output); int monitor_set_tag_command(int argc, char** argv, GString* output); int monitor_set_tag_by_index_command(int argc, char** argv, GString* output); int monitor_set_previous_tag_command(int argc, char** argv, GString* output); -void monitors_lock(); -void monitors_unlock(); +void monitors_lock(void); +void monitors_unlock(void); int monitors_lock_command(int argc, char** argv); int monitors_unlock_command(int argc, char** argv); -void monitors_lock_changed(); +void monitors_lock_changed(void); int monitor_lock_tag_command(int argc, char** argv, GString* output); int monitor_unlock_tag_command(int argc, char** argv, GString* output); void monitor_apply_layout(HSMonitor* monitor); -void all_monitors_apply_layout(); -void ensure_monitors_are_available(); +void all_monitors_apply_layout(void); +void ensure_monitors_are_available(void); void all_monitors_replace_previous_tag(struct HSTag* old, struct HSTag* new); -void drop_enternotify_events(); +void drop_enternotify_events(void); void monitor_restack(HSMonitor* monitor); int monitor_stack_window_count(bool only_clients); void monitor_stack_to_window_buf(Window* buf, int len, bool only_clients, int* remain_len); -struct HSStack* get_monitor_stack(); +struct HSStack* get_monitor_stack(void); -void monitor_update_focus_objects(); +void monitor_update_focus_objects(void); typedef bool (*MonitorDetection)(Rectangle**, size_t*); bool detect_monitors_xinerama(Rectangle** ret_rects, size_t* ret_count); diff --git a/src/mouse.c b/src/mouse.c index 15f07ea..620032c 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -44,7 +44,7 @@ static int* g_snap_gap; | Button4Mask \ | Button5Mask )) -void mouse_init() { +void mouse_init(void) { g_numlockmask_ptr = get_numlockmask_ptr(); g_snap_distance = &(settings_find("snap_distance")->value.i); g_snap_gap = &(settings_find("snap_gap")->value.i); @@ -53,8 +53,8 @@ void mouse_init() { XDefineCursor(g_display, g_root, g_cursor); } -void mouse_destroy() { - mouse_unbind_all(); +void mouse_destroy(void) { + mouse_unbind_all(0, NULL); XFreeCursor(g_display, g_cursor); } @@ -86,7 +86,7 @@ void mouse_start_drag(XEvent* ev) { GrabModeAsync, None, None, CurrentTime); } -void mouse_stop_drag() { +void mouse_stop_drag(void) { if (g_win_drag_client) { g_win_drag_client->dragged = false; // resend last size @@ -119,7 +119,7 @@ void handle_motion_event(XEvent* ev) { function(&(ev->xmotion)); } -bool mouse_is_dragging() { +bool mouse_is_dragging(void) { return g_drag_bind != NULL; } @@ -136,7 +136,7 @@ void mouse_bind_function(unsigned int modifiers, unsigned int button, } } -int mouse_unbind_all() { +int mouse_unbind_all(int argc, char** argv) { g_list_free_full(g_mouse_binds, g_free); g_mouse_binds = NULL; HSClient* client = get_current_client(); diff --git a/src/mouse.h b/src/mouse.h index 0c7cf5c..ce037e5 100644 --- a/src/mouse.h +++ b/src/mouse.h @@ -25,8 +25,8 @@ enum SnapFlags { struct HSClient; struct HSTag; -void mouse_init(); -void mouse_destroy(); +void mouse_init(void); +void mouse_destroy(void); typedef void (*MouseFunction)(XMotionEvent*); @@ -41,7 +41,7 @@ int mouse_binding_equals(MouseBinding* a, MouseBinding* b); void mouse_bind_function(unsigned int modifiers, unsigned int button, MouseFunction function); int mouse_bind_command(int argc, char** argv, GString* output); -int mouse_unbind_all(); +int mouse_unbind_all(int argc, char** argv); MouseBinding* mouse_binding_find(unsigned int modifiers, unsigned int button); unsigned int string2button(char* name); @@ -50,8 +50,8 @@ MouseFunction string2mousefunction(char* name); void grab_client_buttons(struct HSClient* client, bool focused); void mouse_start_drag(XEvent* ev); -void mouse_stop_drag(); -bool mouse_is_dragging(); +void mouse_stop_drag(void); +bool mouse_is_dragging(void); void handle_motion_event(XEvent* ev); // get the vector to snap a client to it's neighbour diff --git a/src/object.c b/src/object.c index cb08f1c..478e106 100644 --- a/src/object.c +++ b/src/object.c @@ -25,18 +25,18 @@ static void hsattribute_free(HSAttribute* attr); static HSObject g_root_object; static HSObject* g_tmp_object; -void object_tree_init() { +void object_tree_init(void) { hsobject_init(&g_root_object); g_tmp_object = hsobject_create_and_link(&g_root_object, TMP_OBJECT_PATH); } -void object_tree_destroy() { +void object_tree_destroy(void) { hsobject_unlink_and_destroy(&g_root_object, g_tmp_object); hsobject_free(&g_root_object); } -HSObject* hsobject_root() { +HSObject* hsobject_root(void) { return &g_root_object; } @@ -65,7 +65,7 @@ static void hsattribute_free(HSAttribute* attr) { } } -HSObject* hsobject_create() { +HSObject* hsobject_create(void) { HSObject* obj = g_new(HSObject, 1); hsobject_init(obj); return obj; diff --git a/src/object.h b/src/object.h index f421ef6..bc1d261 100644 --- a/src/object.h +++ b/src/object.h @@ -82,14 +82,14 @@ typedef struct HSAttribute { #define ATTRIBUTE_LAST { .name = NULL } -void object_tree_init(); -void object_tree_destroy(); +void object_tree_init(void); +void object_tree_destroy(void); -HSObject* hsobject_root(); +HSObject* hsobject_root(void); bool hsobject_init(HSObject* obj); void hsobject_free(HSObject* obj); -HSObject* hsobject_create(); +HSObject* hsobject_create(void); HSObject* hsobject_create_and_link(HSObject* parent, char* name); void hsobject_destroy(HSObject* obj); void hsobject_link(HSObject* parent, HSObject* child, char* name); diff --git a/src/rules.c b/src/rules.c index f4da9fb..ee4632c 100644 --- a/src/rules.c +++ b/src/rules.c @@ -97,12 +97,12 @@ static GQueue g_rules = G_QUEUE_INIT; // a list of HSRule* elements /// FUNCTIONS /// // RULES // -void rules_init() { +void rules_init(void) { g_maxage_type = find_condition_type("maxage"); g_rule_label_index = 0; } -void rules_destroy() { +void rules_destroy(void) { g_queue_foreach(&g_rules, (GFunc)rule_destroy, NULL); g_queue_clear(&g_rules); } @@ -258,7 +258,7 @@ static bool rule_label_replace(HSRule* rule, char op, char* value, GString* outp // rules parsing // -HSRule* rule_create() { +HSRule* rule_create(void) { HSRule* rule = g_new0(HSRule, 1); rule->once = false; rule->birth_time = get_monotonic_timestamp(); diff --git a/src/rules.h b/src/rules.h index 5cdf739..a52a9ad 100644 --- a/src/rules.h +++ b/src/rules.h @@ -65,14 +65,14 @@ typedef struct { bool ewmhnotify; // whether to send ewmh-notifications } HSClientChanges; -void rules_init(); -void rules_destroy(); +void rules_init(void); +void rules_destroy(void); void rules_apply(struct HSClient* client, HSClientChanges* changes); void client_changes_init(HSClientChanges* changes, struct HSClient* client); void client_changes_free_members(HSClientChanges* changes); -HSRule* rule_create(); +HSRule* rule_create(void); void rule_destroy(HSRule* rule); void rule_complete(int argc, char** argv, int pos, GString* output); diff --git a/src/settings.c b/src/settings.c index 1017202..108a041 100644 --- a/src/settings.c +++ b/src/settings.c @@ -83,11 +83,11 @@ SettingsPair g_settings[] = { int g_initial_monitors_locked = 0; -int settings_count() { +int settings_count(void) { return LENGTH(g_settings); } -void settings_init() { +void settings_init(void) { // recreate all strings -> move them to heap int i; for (i = 0; i < LENGTH(g_settings); i++) { @@ -101,7 +101,7 @@ void settings_init() { settings_find("monitors_locked")->value.i = g_initial_monitors_locked; } -void settings_destroy() { +void settings_destroy(void) { // free all strings int i; for (i = 0; i < LENGTH(g_settings); i++) { diff --git a/src/settings.h b/src/settings.h index d2e2776..4cea157 100644 --- a/src/settings.h +++ b/src/settings.h @@ -21,14 +21,14 @@ typedef struct { } value; int old_value_i; int type; - void (*on_change)(); // what to call on change + void (*on_change)(void); // what to call on change } SettingsPair; extern SettingsPair g_settings[]; int g_initial_monitors_locked; -void settings_init(); -void settings_destroy(); +void settings_init(void); +void settings_destroy(void); SettingsPair* settings_find(char* name); @@ -36,7 +36,7 @@ int settings_set(SettingsPair* pair, char* value); int settings_set_command(int argc, char** argv, GString* output); int settings_toggle(int argc, char** argv, GString* output); int settings_cycle_value(int argc, char** argv, GString* output); -int settings_count(); +int settings_count(void); int settings_get(int argc, char** argv, GString* output); #endif diff --git a/src/stack.c b/src/stack.c index 5ca8e61..d44e1ca 100644 --- a/src/stack.c +++ b/src/stack.c @@ -20,14 +20,14 @@ char* g_layer_names[LAYER_COUNT] = { [ LAYER_FRAMES ] = "Frame Layer" , }; -void stacklist_init() { +void stacklist_init(void) { } -void stacklist_destroy() { +void stacklist_destroy(void) { } -HSStack* stack_create() { +HSStack* stack_create(void) { return g_new0(HSStack, 1); } @@ -41,7 +41,7 @@ void stack_destroy(HSStack* s) { g_free(s); } -static HSSlice* slice_create() { +static HSSlice* slice_create(void) { HSSlice* s = g_new0(HSSlice, 1); s->layer[0] = LAYER_NORMAL; s->layer_count = 1; diff --git a/src/stack.h b/src/stack.h index fca3168..fb2cf60 100644 --- a/src/stack.h +++ b/src/stack.h @@ -47,8 +47,8 @@ typedef struct HSStack { bool dirty; /* stacking order changed but it wasn't restacked yet */ } HSStack; -void stacklist_init(); -void stacklist_destroy(); +void stacklist_init(void); +void stacklist_destroy(void); HSSlice* slice_create_window(Window window); HSSlice* slice_create_frame(Window window); @@ -75,7 +75,7 @@ void stack_to_window_buf(HSStack* stack, Window* buf, int len, bool only_clients void stack_restack(HSStack* stack); Window stack_lowest_window(HSStack* stack); -HSStack* stack_create(); +HSStack* stack_create(void); void stack_destroy(HSStack* s); #endif diff --git a/src/tag.c b/src/tag.c index 134c36f..2b835bc 100644 --- a/src/tag.c +++ b/src/tag.c @@ -27,7 +27,7 @@ int* g_raise_on_focus_temporarily; static int tag_rename(HSTag* tag, char* name, GString* output); -void tag_init() { +void tag_init(void) { g_tags = g_array_new(false, false, sizeof(HSTag*)); g_raise_on_focus_temporarily = &(settings_find("raise_on_focus_temporarily") ->value.i); @@ -56,7 +56,7 @@ static void tag_free(HSTag* tag) { g_free(tag); } -void tag_destroy() { +void tag_destroy(void) { int i; for (i = 0; i < g_tags->len; i++) { HSTag* tag = g_array_index(g_tags, HSTag*, i); @@ -127,7 +127,7 @@ HSTag* get_tag_by_index_str(char* index_str, bool skip_visible_tags) { return g_array_index(g_tags, HSTag*, index); } -HSTag* find_unused_tag() { +HSTag* find_unused_tag(void) { for (int i = 0; i < g_tags->len; i++) { if (!find_monitor_with_tag(g_array_index(g_tags, HSTag*, i))) { return g_array_index(g_tags, HSTag*, i); @@ -391,7 +391,7 @@ static void client_update_tag_flags(void* key, void* client_void, void* data) { } } -void tag_force_update_flags() { +void tag_force_update_flags(void) { g_tag_flags_dirty = false; // unset all tags for (int i = 0; i < g_tags->len; i++) { @@ -401,18 +401,18 @@ void tag_force_update_flags() { clientlist_foreach(client_update_tag_flags, NULL); } -void tag_update_flags() { +void tag_update_flags(void) { if (g_tag_flags_dirty) { tag_force_update_flags(); } } -void tag_set_flags_dirty() { +void tag_set_flags_dirty(void) { g_tag_flags_dirty = true; hook_emit_list("tag_flags", NULL); } -void ensure_tags_are_available() { +void ensure_tags_are_available(void) { if (g_tags->len > 0) { // nothing to do return; @@ -539,11 +539,11 @@ static void tag_update_focus_layer_helper(HSTag* tag, void* data) { (void) data; tag_update_focus_layer(tag); } -void tag_update_each_focus_layer() { +void tag_update_each_focus_layer(void) { tag_foreach(tag_update_focus_layer_helper, NULL); } -void tag_update_focus_objects() { +void tag_update_focus_objects(void) { hsobject_link(g_tag_object, get_current_monitor()->tag->object, "focus"); } diff --git a/src/tag.h b/src/tag.h index cef1d93..0c47dbf 100644 --- a/src/tag.h +++ b/src/tag.h @@ -27,14 +27,14 @@ typedef struct HSTag { GArray* g_tags; // Array of HSTag* bool g_tag_flags_dirty; -void tag_init(); -void tag_destroy(); +void tag_init(void); +void tag_destroy(void); // for tags HSTag* add_tag(char* name); HSTag* find_tag(char* name); int tag_index_of(HSTag* tag); -HSTag* find_unused_tag(); +HSTag* find_unused_tag(void); HSTag* find_tag_with_toplevel_frame(struct HSFrame* frame); HSTag* get_tag_by_index(int index); HSTag* get_tag_by_index_str(char* index_str, bool skip_visible_tags); @@ -48,12 +48,12 @@ int tag_remove_command(int argc, char** argv, GString* output); int tag_set_floating_command(int argc, char** argv, GString* output); void tag_update_focus_layer(HSTag* tag); void tag_foreach(void (*action)(HSTag*,void*), void* data); -void tag_update_each_focus_layer(); -void tag_update_focus_objects(); -void tag_force_update_flags(); -void tag_update_flags(); -void tag_set_flags_dirty(); -void ensure_tags_are_available(); +void tag_update_each_focus_layer(void); +void tag_update_focus_objects(void); +void tag_force_update_flags(void); +void tag_update_flags(void); +void tag_set_flags_dirty(void); +void ensure_tags_are_available(void); #endif diff --git a/src/utils.c b/src/utils.c index b885784..5f7e3d7 100644 --- a/src/utils.c +++ b/src/utils.c @@ -27,7 +27,7 @@ char* g_tree_style; /* the one from layout.c */ -time_t get_monotonic_timestamp() { +time_t get_monotonic_timestamp(void) { struct timespec ts; #if defined(__MACH__) && ! defined(CLOCK_REALTIME) // OS X does not have clock_gettime, use clock_get_time clock_serv_t cclock; diff --git a/src/utils.h b/src/utils.h index 7cfe7ce..b07bd28 100644 --- a/src/utils.h +++ b/src/utils.h @@ -58,7 +58,7 @@ bool string_to_bool(char* string, bool oldvalue); char* strlasttoken(char* str, char* delim); -time_t get_monotonic_timestamp(); +time_t get_monotonic_timestamp(void); // duplicates an argument-vector char** argv_duplicate(int argc, char** argv); -- 1.8.5.3 -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From simon at ruderich.org Sat Feb 1 21:55:49 2014 From: simon at ruderich.org (Simon Ruderich) Date: Sat, 1 Feb 2014 21:55:49 +0100 Subject: [PATCH 02/10] Refactor smart window surrounding check. In-Reply-To: References: Message-ID: This modifies the second check in client_resize_tiling() to the state before cde1a2c ("Do not apply window_gap to pseudotiled clients"). I assume the change of meaning was not intentional because it was applied in only a single location. --- src/clientlist.c | 11 ++--------- src/layout.c | 10 +++++++--- src/layout.h | 2 ++ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/clientlist.c b/src/clientlist.c index 36dde75..06a9649 100644 --- a/src/clientlist.c +++ b/src/clientlist.c @@ -36,7 +36,6 @@ int* g_window_border_width; int* g_window_border_inner_width; int* g_raise_on_focus; int* g_snap_gap; -int* g_smart_window_surroundings; int* g_pseudotile_center_threshold; unsigned long g_window_border_active_color; unsigned long g_window_border_normal_color; @@ -76,7 +75,6 @@ static void fetch_colors(void) { g_window_border_inner_width = &(settings_find("window_border_inner_width")->value.i); g_window_gap = &(settings_find("window_gap")->value.i); g_snap_gap = &(settings_find("snap_gap")->value.i); - g_smart_window_surroundings = &(settings_find("smart_window_surroundings")->value.i); g_raise_on_focus = &(settings_find("raise_on_focus")->value.i); char* str = settings_find("window_border_normal_color")->value.s; g_window_border_normal_color = getcolor(str); @@ -493,17 +491,12 @@ void client_resize_tiling(HSClient* client, Rectangle rect, HSFrame* frame) { } Window win = client->window; int border_width = *g_window_border_width; - if (*g_smart_window_surroundings && !client->pseudotile - && (frame->content.clients.count == 1 - || frame->content.clients.layout == LAYOUT_MAX)) { + if (!client->pseudotile && smart_window_surroundings_active(frame)) { border_width = 0; } // apply border width - bool is_max_layout = frame->content.clients.layout != LAYOUT_MAX; - bool only_one_client = frame->content.clients.count != 1; - bool smart_surroundings_are_applied = *g_smart_window_surroundings && is_max_layout && only_one_client; - if (!client->pseudotile && !smart_surroundings_are_applied) { + if (!client->pseudotile && !smart_window_surroundings_active(frame)) { // apply window gap rect.width -= *g_window_gap; rect.height -= *g_window_gap; diff --git a/src/layout.c b/src/layout.c index c7e8ffe..bee6853 100644 --- a/src/layout.c +++ b/src/layout.c @@ -847,9 +847,7 @@ void frame_apply_layout(HSFrame* frame, Rectangle rect) { return; } - if (!*g_smart_window_surroundings - || (frame->content.clients.count != 1 - && frame->content.clients.layout != LAYOUT_MAX)) { + if (!smart_window_surroundings_active(frame)) { // apply window gap rect.x += *g_window_gap; rect.y += *g_window_gap; @@ -1953,3 +1951,9 @@ int frame_move_window_edge(int argc, char** argv, GString* output) { return 0; } +bool smart_window_surroundings_active(HSFrame* frame) { + return *g_smart_window_surroundings + && (frame->content.clients.count == 1 + || frame->content.clients.layout == LAYOUT_MAX); +} + diff --git a/src/layout.h b/src/layout.h index 964a646..0f7bbed 100644 --- a/src/layout.h +++ b/src/layout.h @@ -183,5 +183,7 @@ void frame_update_border(Window window, unsigned long color); int frame_focus_edge(int argc, char** argv, GString* output); int frame_move_window_edge(int argc, char** argv, GString* output); +bool smart_window_surroundings_active(HSFrame* frame); + #endif -- 1.8.5.3 -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From simon at ruderich.org Sat Feb 1 21:56:01 2014 From: simon at ruderich.org (Simon Ruderich) Date: Sat, 1 Feb 2014 21:56:01 +0100 Subject: [PATCH 03/10] NEWS: Remove duplicate line. In-Reply-To: References: Message-ID: <9a690327a8059af6c8497b6de15e09d8d8f7d9f7.1391287795.git.simon@ruderich.org> --- NEWS | 1 - 1 file changed, 1 deletion(-) diff --git a/NEWS b/NEWS index b11da85..8bc6b3c 100644 --- a/NEWS +++ b/NEWS @@ -151,7 +151,6 @@ Other changes: * cycle_layout now offers to cycle through a custom list of layouts * add completion for +1 and -1 to many commands: cycle, cycle_all, cycle_monitor, cycle_layout, split and use_index - * new settings: smart_frame_surroundings and smart_window_borders * start system wide autostart file if there is no working user defined one * clients are restored (i.e. managed) from _NET_CLIENT_LIST even if they are not visible -- 1.8.5.3 -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From simon at ruderich.org Sat Feb 1 21:56:11 2014 From: simon at ruderich.org (Simon Ruderich) Date: Sat, 1 Feb 2014 21:56:11 +0100 Subject: [PATCH 04/10] main.c: Fix yoda condition. In-Reply-To: References: Message-ID: --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 5d93bf3..ee3495f 100644 --- a/src/main.c +++ b/src/main.c @@ -797,7 +797,7 @@ void enternotify(XEvent* event) { HSDebug("name is: EnterNotify, focus = %d\n", event->xcrossing.focus); if (!mouse_is_dragging() && *g_focus_follows_mouse - && false == ce->focus) { + && ce->focus == false) { HSClient* c = get_client_from_window(ce->window); HSFrame* target; if (c && c->tag->floating == false -- 1.8.5.3 -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From simon at ruderich.org Sat Feb 1 21:56:23 2014 From: simon at ruderich.org (Simon Ruderich) Date: Sat, 1 Feb 2014 21:56:23 +0100 Subject: [PATCH 05/10] colors.mk: No duplicate make output in verbose mode. In-Reply-To: References: Message-ID: --- colors.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/colors.mk b/colors.mk index 824fbf0..446f41b 100644 --- a/colors.mk +++ b/colors.mk @@ -8,6 +8,8 @@ COLOR_FILE = `$(TPUT) bold``$(TPUT) setaf 2` COLOR_BRACKET = $(COLOR_CLEAR)`$(TPUT) setaf 4` endif +ifneq ($(VERBOSE),) define colorecho @echo $(COLOR_BRACKET)" ["$(COLOR_ACTION)$1$(COLOR_BRACKET)"] " $(COLOR_FILE)$2$(COLOR_BRACKET)... $(COLOR_NORMAL) endef +endif -- 1.8.5.3 -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From simon at ruderich.org Sat Feb 1 21:56:33 2014 From: simon at ruderich.org (Simon Ruderich) Date: Sat, 1 Feb 2014 21:56:33 +0100 Subject: [PATCH 06/10] Makefile: Use $(CFLAGS) when linking. In-Reply-To: References: Message-ID: <49e9e0c0290d5ce8351902c5f322e6d49d933e37.1391287795.git.simon@ruderich.org> Required for options like -flto which compile while linking. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8288299..1e1b4eb 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ $(HCTARGET): $(HCOBJ) $(TARGETS): $(call colorecho,LD,$@) - $(VERBOSE) $(LD) -o $@ $(LDFLAGS) $^ $(LIBS) + $(VERBOSE) $(LD) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -include $(DEPS) -- 1.8.5.3 -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From simon at ruderich.org Sat Feb 1 21:56:42 2014 From: simon at ruderich.org (Simon Ruderich) Date: Sat, 1 Feb 2014 21:56:42 +0100 Subject: [PATCH 07/10] command: Replace incorrect use of LENGTH(). In-Reply-To: References: Message-ID: <86d7908520996abbe45c26b65e959c81599c6529.1391287795.git.simon@ruderich.org> LENGTH() has no negative effects because sizeof(char) == 1, but sizeof() makes the intention clear. --- src/command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command.c b/src/command.c index acdf994..ea9060c 100644 --- a/src/command.c +++ b/src/command.c @@ -571,7 +571,7 @@ struct wcd { /* window id completion data */ static void add_winid_completion(void* key, HSClient* client, struct wcd* data) { char buf[100]; - snprintf(buf, LENGTH(buf), "0x%lx", client->window); + snprintf(buf, sizeof(buf), "0x%lx", client->window); try_complete(data->needle, buf, data->output); } -- 1.8.5.3 -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From simon at ruderich.org Sat Feb 1 21:56:53 2014 From: simon at ruderich.org (Simon Ruderich) Date: Sat, 1 Feb 2014 21:56:53 +0100 Subject: [PATCH 08/10] settings: Fix indentation. In-Reply-To: References: Message-ID: <8a1295fdc57a5ce4a6bb16e01798cfa82f359d6c.1391287795.git.simon@ruderich.org> --- src/settings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings.c b/src/settings.c index 108a041..7e13b8b 100644 --- a/src/settings.c +++ b/src/settings.c @@ -76,7 +76,7 @@ SettingsPair g_settings[] = { SET_INT( "smart_window_surroundings", 0, RELAYOUT ), SET_INT( "monitors_locked", 0, LOCK_CHANGED), SET_INT( "auto_detect_monitors", 0, NULL ), - SET_INT( "pseudotile_center_threshold", 10, RELAYOUT ), + SET_INT( "pseudotile_center_threshold", 10, RELAYOUT ), SET_STRING( "tree_style", "*| +`--.", FR_COLORS ), SET_STRING( "wmname", WINDOW_MANAGER_NAME, WMNAME ), }; -- 1.8.5.3 -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From simon at ruderich.org Sat Feb 1 21:57:05 2014 From: simon at ruderich.org (Simon Ruderich) Date: Sat, 1 Feb 2014 21:57:05 +0100 Subject: [PATCH 09/10] doc: Fix ## hack. In-Reply-To: References: Message-ID: <654c6d07e77fc31336b060c2e61043f2f639d9ad.1391287795.git.simon@ruderich.org> __...__ has the same effect as '...' but can be used "inside" a word, in contrast to '...' which must be a separate word. --- This is not much better than ##s## but at least a little shorter. Feel free to drop this patch. doc/herbstclient.txt | 5 ++--- doc/herbstluftwm.txt | 16 ++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/doc/herbstclient.txt b/doc/herbstclient.txt index b36cd52..f0800aa 100644 --- a/doc/herbstclient.txt +++ b/doc/herbstclient.txt @@ -23,12 +23,11 @@ link:herbstluftwm.html[*herbstluftwm*(1)] instance via Xlib. If 'COMMAND' has an output, it is printed by *herbstclient*. If output does not end with a newline, then a newline is added to improve readability. -// FIXME: this ##s## is an ugly hack... is there an other solution? See link:herbstluftwm.html[*herbstluftwm*(1)] for a list of available -'COMMAND'##s## and their 'ARGS'. +__COMMAND__s and their 'ARGS'. If '--wait' or '--idle' is passed, then it waits for hooks from *herbstluftwm*. -The hook is printed, if it matches the optional 'FILTER'. 'FILTER'##s## are +The hook is printed, if it matches the optional 'FILTER'. __FILTER__s are regular expressions. For a list of available hooks see *herbstluftwm*(1). OPTIONS diff --git a/doc/herbstluftwm.txt b/doc/herbstluftwm.txt index 737b8aa..b1d4d06 100644 --- a/doc/herbstluftwm.txt +++ b/doc/herbstluftwm.txt @@ -786,12 +786,12 @@ compare 'ATTRIBUTE' 'OPERATOR' 'VALUE':: Compares the value of 'ATTRIBUTE' with 'VALUE' using the comparation method 'OPERATOR'. If the comparation succeeds, it returns 0, else 1. The operators are: - - *=*: 'ATTRIBUTE'##\'s## value equals 'VALUE' - - *!=*: 'ATTRIBUTE'##\'s## value does not equal 'VALUE' - - *le*: 'ATTRIBUTE'##\'s## value \<= 'VALUE' - - *lt*: 'ATTRIBUTE'##\'s## value < 'VALUE' - - *ge*: 'ATTRIBUTE'##\'s## value >= 'VALUE' - - *gt*: 'ATTRIBUTE'##\'s## value > 'VALUE' + - *=*: __ATTRIBUTE__'s value equals 'VALUE' + - *!=*: __ATTRIBUTE__'s value does not equal 'VALUE' + - *le*: __ATTRIBUTE__'s value \<= 'VALUE' + - *lt*: __ATTRIBUTE__'s value < 'VALUE' + - *ge*: __ATTRIBUTE__'s value >= 'VALUE' + - *gt*: __ATTRIBUTE__'s value > 'VALUE' :: The 'OPERATORs' *le*,*lt*,*ge*,*gt* can only be used if 'ATTRIBUTE' is of @@ -1020,12 +1020,12 @@ RULES Rules are used to change default properties for certain clients when they appear. Each rule matches against a certain subset of all clients and defines a -set of properties for them (called 'CONSEQUENCE'##s##). A rule can be defined +set of properties for them (called __CONSEQUENCE__s). A rule can be defined with this command: +rule+ [\[--]'FLAG'|\[--]'LABEL'|\[--]'CONDITION'|\[--]'CONSEQUENCE' ...] -Each rule consists of a list of 'FLAG'##s##, 'CONDITION'##s## 'CONSEQUENCE'##s## +Each rule consists of a list of __FLAG__s, __CONDITION__s, __CONSEQUENCE__s and, optionally, a 'LABEL'. (each of them can be optionally prefixed with two dashes (+--+) to provide a more *iptables*(8)-like feeling). -- 1.8.5.3 -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From simon at ruderich.org Sat Feb 1 21:57:14 2014 From: simon at ruderich.org (Simon Ruderich) Date: Sat, 1 Feb 2014 21:57:14 +0100 Subject: [PATCH 10/10] Remove unused functions. In-Reply-To: References: Message-ID: <3ffc2c56cc2793c14b1b2bd07632f1f30bf1b735.1391287795.git.simon@ruderich.org> --- src/layout.c | 8 -------- src/layout.h | 2 -- src/main.c | 4 ---- src/monitor.c | 27 --------------------------- src/monitor.h | 3 --- src/mouse.c | 4 ---- src/mouse.h | 1 - src/object.c | 17 ----------------- src/object.h | 2 -- src/stack.c | 31 ------------------------------- src/stack.h | 2 -- src/utils.c | 32 -------------------------------- src/utils.h | 4 ---- 13 files changed, 137 deletions(-) diff --git a/src/layout.c b/src/layout.c index bee6853..e0acbd7 100644 --- a/src/layout.c +++ b/src/layout.c @@ -711,14 +711,6 @@ void frame_apply_client_layout_linear(HSFrame* frame, Rectangle rect, bool verti } } -void frame_apply_client_layout_horizontal(HSFrame* frame, Rectangle rect) { - frame_apply_client_layout_linear(frame, rect, false); -} - -void frame_apply_client_layout_vertical(HSFrame* frame, Rectangle rect) { - frame_apply_client_layout_linear(frame, rect, true); -} - void frame_apply_client_layout_max(HSFrame* frame, Rectangle rect) { HSClient** buf = frame->content.clients.buf; size_t count = frame->content.clients.count; diff --git a/src/layout.h b/src/layout.h index 0f7bbed..ce282b0 100644 --- a/src/layout.h +++ b/src/layout.h @@ -161,8 +161,6 @@ int layout_rotate_command(int argc, char** argv); int frame_foreach_client(HSFrame* frame, ClientAction action, void* data); void frame_apply_client_layout_linear(HSFrame* frame, Rectangle rect, bool vertical); -void frame_apply_client_layout_horizontal(HSFrame* frame, Rectangle rect); -void frame_apply_client_layout_vertical(HSFrame* frame, Rectangle rect); int frame_current_cycle_client_layout(int argc, char** argv, GString* output); int frame_current_set_client_layout(int argc, char** argv, GString* output); int frame_split_count_to_root(HSFrame* frame, int align); diff --git a/src/main.c b/src/main.c index ee3495f..30e37ec 100644 --- a/src/main.c +++ b/src/main.c @@ -545,10 +545,6 @@ int xerror(Display *dpy, XErrorEvent *ee) { return g_xerrorxlib(dpy, ee); /* may call exit */ } -int xerrordummy(Display *dpy, XErrorEvent *ee) { - return 0; -} - // from dwm.c /* Startup Error handler to check if another window manager * is already running. */ diff --git a/src/monitor.c b/src/monitor.c index a3f9cd0..5c5116e 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -730,15 +730,6 @@ void ensure_monitors_are_available(void) { monitor_update_focus_objects(); } -HSMonitor* monitor_with_frame(HSFrame* frame) { - // find toplevel Frame - while (frame->parent) { - frame = frame->parent; - } - HSTag* tag = find_tag_with_toplevel_frame(frame); - return find_monitor_with_tag(tag); -} - HSMonitor* get_current_monitor(void) { return g_array_index(g_monitors, HSMonitor*, g_cur_monitor); } @@ -1007,20 +998,6 @@ int monitor_get_relative_y(HSMonitor* m, int y_root) { return y_root - m->rect.y - m->pad_up; } -HSMonitor* monitor_with_coordinate(int x, int y) { - int i; - for (i = 0; i < g_monitors->len; i++) { - HSMonitor* m = monitor_with_index(i); - if (m->rect.x + m->pad_left <= x - && m->rect.x + m->rect.width - m->pad_right > x - && m->rect.y + m->pad_up <= y - && m->rect.y + m->rect.height - m->pad_down > y) { - return m; - } - } - return NULL; -} - HSMonitor* monitor_with_index(int index) { if (index < 0 || index >= g_monitors->len) { return NULL; @@ -1201,10 +1178,6 @@ int detect_monitors_command(int argc, char **argv, GString* output) { return ret; } -int monitor_stack_window_count(bool only_clients) { - return stack_window_count(g_monitor_stack, only_clients); -} - void monitor_stack_to_window_buf(Window* buf, int len, bool only_clients, int* remain_len) { stack_to_window_buf(g_monitor_stack, buf, len, only_clients, remain_len); diff --git a/src/monitor.h b/src/monitor.h index f2fd4b6..7c9b26b 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -51,8 +51,6 @@ void monitor_init(void); void monitor_destroy(void); // adds a new monitor to g_monitors and returns a pointer to it -HSMonitor* monitor_with_frame(struct HSFrame* frame); -HSMonitor* monitor_with_coordinate(int x, int y); HSMonitor* monitor_with_index(int index); HSMonitor* find_monitor_with_tag(struct HSTag* tag); HSMonitor* add_monitor(Rectangle rect, struct HSTag* tag, char* name); @@ -100,7 +98,6 @@ void all_monitors_replace_previous_tag(struct HSTag* old, struct HSTag* new); void drop_enternotify_events(void); void monitor_restack(HSMonitor* monitor); -int monitor_stack_window_count(bool only_clients); void monitor_stack_to_window_buf(Window* buf, int len, bool only_clients, int* remain_len); struct HSStack* get_monitor_stack(void); diff --git a/src/mouse.c b/src/mouse.c index 620032c..35e0328 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -397,10 +397,6 @@ struct SnapData { int dx, dy; // the vector from client to other to make them snap }; -bool is_point_between(int point, int left, int right) { - return (point < right && point >= left); -} - bool intervals_intersect(int a_left, int a_right, int b_left, int b_right) { return (b_left < a_right) && (a_left < b_right); } diff --git a/src/mouse.h b/src/mouse.h index ce037e5..58b8432 100644 --- a/src/mouse.h +++ b/src/mouse.h @@ -59,7 +59,6 @@ void client_snap_vector(struct HSClient* client, struct HSTag* tag, enum SnapFlags flags, int* return_dx, int* return_dy); -bool is_point_between(int point, int left, int right); bool intervals_intersect(int a_left, int a_right, int b_left, int b_right); /* some mouse functions */ diff --git a/src/object.c b/src/object.c index 478e106..ce04780 100644 --- a/src/object.c +++ b/src/object.c @@ -199,13 +199,6 @@ void hsobject_link_rename(HSObject* parent, char* oldname, char* newname) { child->name = g_strdup(newname); } -void hsobject_link_rename_object(HSObject* parent, HSObject* child, char* newname) { - // remove occurrences of that object - hsobject_unlink(parent, child); - // link it again (replacing any object with newname) - hsobject_link(parent, child, newname); -} - HSObject* hsobject_find_child(HSObject* obj, char* name) { GList* elem = g_list_find_custom(obj->children, name, (GCompareFunc)child_check_name); @@ -351,16 +344,6 @@ static HSTreeInterface object_nth_child(HSTree tree, size_t idx) { return intf; } -HSObject* hsobject_by_path(char* path) { - HSObject* obj = hsobject_parse_path(path, &path); - if (!strcmp("", path)) { - return obj; - } else { - // an invalid path was given if it was not parsed entirely - return NULL; - } -} - HSObject* hsobject_parse_path_verbose(char* path, char** unparsable, GString* output) { char* origpath = path; diff --git a/src/object.h b/src/object.h index bc1d261..c2944b5 100644 --- a/src/object.h +++ b/src/object.h @@ -96,10 +96,8 @@ void hsobject_link(HSObject* parent, HSObject* child, char* name); void hsobject_unlink(HSObject* parent, HSObject* child); void hsobject_unlink_by_name(HSObject* parent, char* name); void hsobject_link_rename(HSObject* parent, char* oldname, char* newname); -void hsobject_link_rename_object(HSObject* parent, HSObject* child, char* newname); void hsobject_unlink_and_destroy(HSObject* parent, HSObject* child); -HSObject* hsobject_by_path(char* path); HSObject* hsobject_parse_path(char* path, char** unparsable); HSObject* hsobject_parse_path_verbose(char* path, char** unparsable, GString* output); diff --git a/src/stack.c b/src/stack.c index d44e1ca..ab47022 100644 --- a/src/stack.c +++ b/src/stack.c @@ -334,10 +334,6 @@ void stack_raise_slide(HSStack* stack, HSSlice* slice) { stack_restack(stack); } -void stack_mark_dirty(HSStack* s) { - s->dirty = true; -} - void stack_slice_add_layer(HSStack* stack, HSSlice* slice, HSLayer layer) { for (int i = 0; i < slice->layer_count; i++) { if (slice->layer[i] == layer) { @@ -372,33 +368,6 @@ void stack_slice_remove_layer(HSStack* stack, HSSlice* slice, HSLayer layer) { memmove(slice->layer + i, slice->layer + i + 1, len); } -Window stack_lowest_window(HSStack* stack) { - for (int i = LAYER_COUNT - 1; i >= 0; i--) { - GList* last = g_list_last(stack->top[i]); - while (last) { - HSSlice* slice = (HSSlice*)last->data; - Window w = 0; - switch (slice->type) { - case SLICE_CLIENT: - w = slice->data.client->window; - break; - case SLICE_WINDOW: - w = slice->data.window; - break; - case SLICE_MONITOR: - w = stack_lowest_window(slice->data.monitor->tag->stack); - break; - } - if (w) { - return w; - } - last = g_list_previous(last); - } - } - // if no window was found - return 0; -} - bool stack_is_layer_empty(HSStack* s, HSLayer layer) { return s->top[layer] == NULL; } diff --git a/src/stack.h b/src/stack.h index fb2cf60..53c2fd1 100644 --- a/src/stack.h +++ b/src/stack.h @@ -60,7 +60,6 @@ HSLayer slice_highest_layer(HSSlice* slice); void stack_insert_slice(HSStack* s, HSSlice* elem); void stack_remove_slice(HSStack* s, HSSlice* elem); void stack_raise_slide(HSStack* stack, HSSlice* slice); -void stack_mark_dirty(HSStack* s); void stack_slice_add_layer(HSStack* stack, HSSlice* slice, HSLayer layer); void stack_slice_remove_layer(HSStack* stack, HSSlice* slice, HSLayer layer); bool stack_is_layer_empty(HSStack* s, HSLayer layer); @@ -73,7 +72,6 @@ int stack_window_count(HSStack* stack, bool only_clients); void stack_to_window_buf(HSStack* stack, Window* buf, int len, bool only_clients, int* remain_len); void stack_restack(HSStack* stack); -Window stack_lowest_window(HSStack* stack); HSStack* stack_create(void); void stack_destroy(HSStack* s); diff --git a/src/utils.c b/src/utils.c index 5f7e3d7..536fed3 100644 --- a/src/utils.c +++ b/src/utils.c @@ -122,37 +122,12 @@ bool is_herbstluft_window(Display* dpy, Window window) { return result; } -bool is_window_mapable(Display* dpy, Window window) { - XWindowAttributes wa; - XGetWindowAttributes(dpy, window, &wa); - return (wa.map_state == IsUnmapped); -} bool is_window_mapped(Display* dpy, Window window) { XWindowAttributes wa; XGetWindowAttributes(dpy, window, &wa); return (wa.map_state == IsViewable); } -bool window_has_property(Display* dpy, Window window, char* prop_name) { - // find the properties this window has - int num_properties_ret; - Atom* properties= XListProperties(g_display, window, &num_properties_ret); - - bool atom_found = false; - char* name; - for(int i = 0; i < num_properties_ret; i++) { - name = XGetAtomName(g_display, properties[i]); - if(!strcmp(prop_name, name)) { - atom_found = true; - break; - } - XFree(name); - } - XFree(properties); - - return atom_found; -} - // duplicates an argument-vector char** argv_duplicate(int argc, char** argv) { char** new_argv = malloc(sizeof(char*) * argc); @@ -287,13 +262,6 @@ bool memberequals_string(void* pmember, void* needle) { } /** - * \brief tells if the ints pointed by pmember and needle are identical - */ -bool memberequals_int(void* pmember, void* needle) { - return (*(int*)pmember) == (*(int*)needle); -} - -/** * \brief finds an element in a table (i.e. array of structs) * * it consecutively searches from the beginning of the table for a diff --git a/src/utils.h b/src/utils.h index b07bd28..207c84c 100644 --- a/src/utils.h +++ b/src/utils.h @@ -48,11 +48,8 @@ void tree_print_to(HSTreeInterface* intface, GString* output); bool is_herbstluft_window(Display* dpy, Window window); -bool is_window_mapable(Display* dpy, Window window); bool is_window_mapped(Display* dpy, Window window); -bool window_has_property(Display* dpy, Window window, char* prop_name); - bool string_to_bool_error(char* string, bool oldvalue, bool* error); bool string_to_bool(char* string, bool oldvalue); @@ -85,7 +82,6 @@ int min(int a, int b); // utils for tables typedef bool (*MemberEquals)(void* pmember, void* needle); bool memberequals_string(void* pmember, void* needle); -bool memberequals_int(void* pmember, void* needle); void* table_find(void* start, size_t elem_size, size_t count, size_t member_offset, MemberEquals equals, void* needle); -- 1.8.5.3 -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From edu at thorsten-wissmann.de Tue Feb 4 08:17:05 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Tue, 4 Feb 2014 08:17:05 +0100 Subject: [PATCH 01/10] Use void as "parameter" for functions without arguments. In-Reply-To: <805122f7059195a02e9de6f342216061dc9c49d1.1391287795.git.simon@ruderich.org> References: <805122f7059195a02e9de6f342216061dc9c49d1.1391287795.git.simon@ruderich.org> Message-ID: <20140204071705.GA3535@ghul> On Sat, Feb 01, 2014 at 09:55:14PM +0100, Simon Ruderich wrote: > If nothing is specified, the function can take any number of arguments. I know and I totally get your point and from the technical point of view you are absolutely right, but ... - I'm too lazy to continue writing void everywhere. - It looks totally ugly... - I don't see how ignoring that and writing ambigous fkt() causes any issues regarding security or stability. One will notice it if parameters to a function are ignored. > // core functions > -int quit() { > +int quit(int argc, char* argv[]) { > g_aboutToQuit = true; > return 0; > } I really prefer the previous version, because in the other case there are parameters of that function which aren't used. Same for reload, true, false, etc. Is there any advantage of writing (void), except that it is more "conform"? BTW I will look at the other patches later, I'd just like to reject patches which should be rejected IMO as early as possible. Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From edu at thorsten-wissmann.de Tue Feb 4 13:52:30 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Tue, 4 Feb 2014 13:52:30 +0100 Subject: [PATCH 07/10] command: Replace incorrect use of LENGTH(). In-Reply-To: <86d7908520996abbe45c26b65e959c81599c6529.1391287795.git.simon@ruderich.org> References: <86d7908520996abbe45c26b65e959c81599c6529.1391287795.git.simon@ruderich.org> Message-ID: <20140204125230.GA17972@ghul> Hi, On Sat, Feb 01, 2014 at 09:56:42PM +0100, Simon Ruderich wrote: > LENGTH() has no negative effects because sizeof(char) == 1, but sizeof() > makes the intention clear. > > - snprintf(buf, LENGTH(buf), "0x%lx", client->window); > + snprintf(buf, sizeof(buf), "0x%lx", client->window); I mean both is right, but the question is what this parameter means. E.g. in wchar versions it seems this is the length of the buffer and not the total size in bytes of the underlying data structure, of course they coincide in the case of ordinary chars. I personally find LENGTH more readable because it is really the length of the array, while sizeof gives it's total size. So I would not agree that sizeof makes the intention clear. Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From edu at thorsten-wissmann.de Tue Feb 4 14:08:42 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Tue, 4 Feb 2014 14:08:42 +0100 Subject: [PATCH 10/10] Remove unused functions. In-Reply-To: <3ffc2c56cc2793c14b1b2bd07632f1f30bf1b735.1391287795.git.simon@ruderich.org> References: <3ffc2c56cc2793c14b1b2bd07632f1f30bf1b735.1391287795.git.simon@ruderich.org> Message-ID: <20140204130842.GB17972@ghul> Hi, I read about your intention of increasing the maintainability. But I see most of these function as a library (A library won't delete a function f() if the maintainers guess no application uses it). For example, I will need.. - monitor_with_coordinate to implement monitor focussing with focus_follows_mouse being enabled. - monitor_with_frame for the same feature if hlwm receives a click event on a frame window. - hsobject_link_rename_object to rename a object, e.g. I could use it for renaming tag/monitor objects in the future. It might be that we don't need the other functions anymore. Do you really think we should remove them? Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From edu at thorsten-wissmann.de Tue Feb 4 17:22:50 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Tue, 4 Feb 2014 17:22:50 +0100 Subject: [PATCH 00/10] Misc patches In-Reply-To: References: Message-ID: <20140204162250.GA1146@ghul> Hi Simon, On Sat, Feb 01, 2014 at 09:54:53PM +0100, Simon Ruderich wrote: > The following patches perform miscellaneous cleanups and fix some > minor bugs. > > Simon Ruderich (10): Out of these 10 patches, I merged these 7 by fair dice roll^W^W^W^Wfor the following reasons: - 52dac55 doc: Fix ## hack. => Cool, I've been looking for that for a long time - df8bb30 settings: Fix indentation. => I wonder I didn't notice that, fine. - f64e7a5 Makefile: Use $(CFLAGS) when linking. => Did not know that, is that the normal usage of CLFAGS? Christoph? - 5e32daa colors.mk: No duplicate make output in verbose mode. => Looks much better now - f9a893a main.c: Fix yoda condition. => Yeah why not. - df3f716 NEWS: Remove duplicate line. => Good - a40b30c Refactor smart window surrounding check. => The refactoring looks OK. Regarding the rejected patches: I answered to the respective mail, please tell if some patch was missed. Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From edu at thorsten-wissmann.de Tue Feb 4 17:35:39 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Tue, 4 Feb 2014 17:35:39 +0100 Subject: [PATCH] Fix make uninstall In-Reply-To: <20140109064620.GJ22910@lupin> References: <20140109064620.GJ22910@lupin> Message-ID: <20140204163539.GB1146@ghul> On Thu, Jan 09, 2014 at 07:46:21AM +0100, Florian Bruhin wrote: > I noticed I forgot to use $(DESTDIR) in make uninstall. I bet nobody cares > anyway, but it was a quick fix :) > > are available in the git repository at: > > git://cmpl.cc/herbstluftwm uninstall ... please send patches directly via mail. It makes everything so much easier. debe66a Fix 'make uninstall' Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From edu at thorsten-wissmann.de Tue Feb 4 17:43:26 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Tue, 4 Feb 2014 17:43:26 +0100 Subject: [PATCH] 'auto' split alignment In-Reply-To: <20140108200019.GH22910@lupin> References: <20140108200019.GH22910@lupin> Message-ID: <20140204164326.GC1146@ghul> On Wed, Jan 08, 2014 at 09:00:19PM +0100, Florian Bruhin wrote: > This adds a new split alignment 'auto' which splits the frame along the longest > side. Okay, enough coding now. I'm addicted. :D Do you really use it or do you have any application for it? I mean does it have any advantage over explode? Anyway, I added a NEWS entry to your patch and merged it. > git://cmpl.cc/herbstluftwm autosplit > ... patches would make it so much easier. Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From me at the-compiler.org Tue Feb 4 17:58:52 2014 From: me at the-compiler.org (Florian Bruhin) Date: Tue, 4 Feb 2014 17:58:52 +0100 Subject: [PATCH] 'auto' split alignment In-Reply-To: <20140204164326.GC1146@ghul> References: <20140108200019.GH22910@lupin> <20140204164326.GC1146@ghul> Message-ID: <20140204165851.GI9412@lupin> * Thorsten Wi?mann [2014-02-04 17:43:26 +0100]: > On Wed, Jan 08, 2014 at 09:00:19PM +0100, Florian Bruhin wrote: > > This adds a new split alignment 'auto' which splits the frame along the longest > > side. Okay, enough coding now. I'm addicted. :D > > Do you really use it or do you have any application for it? I mean does > it have any advantage over explode? I remember someone requested it somewhen. I don't need it myself, but maybe someone is happier now :P I'd use an auto layout though ;) > > git://cmpl.cc/herbstluftwm autosplit > > > ... patches would make it so much easier. Shouldn't have told me pull requests are okay as well then :P As said before, I'll remember for the future :) Flo -- () ascii ribbon campaign - stop html mail www.asciiribbon.org /\ www.the-compiler.org | I love long mails http://email.is-not-s.ms/ phosflink: To flick a bulb on and off when it burns out (as if, somehow, that will bring it back to life). -- "Sniglets", Rich Hall & Friends -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: not available URL: From edu at thorsten-wissmann.de Tue Feb 4 18:03:14 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Tue, 4 Feb 2014 18:03:14 +0100 Subject: [PATCH] Add version output to herbstclient In-Reply-To: <20140108194708.GG22910@lupin> References: <20140108194708.GG22910@lupin> Message-ID: <20140204170314.GD1146@ghul> On Wed, Jan 08, 2014 at 08:47:09PM +0100, Florian Bruhin wrote: > This adds a herbstclient version output which is independent from the > hlwm version. This was requested by HolySmoke in the IRC some while > ago. Here, I'd like to do some inline comments... +*-v*, *--version*:: + Print the herbstclient version. To get the herbstluftwm version, use + *herbstclient version*. Actually this is ambiguous. At first there aren't any own herbstclient versions. The second thing is, herbstclient version gives the version of the *running* herbstluftwm instance, herbstluftwm --version the version of the specified herbstluftwm binary. Don't know how we should clarify that. And btw herbstclient -v did not work, therefore I added the following hunk to your commit: --- a/ipc-client/main.c +++ b/ipc-client/main.c @@ -162,7 +162,7 @@ int main(int argc, char* argv[]) { // parse options while (1) { int option_index = 0; - int c = getopt_long(argc, argv, "+nwc:iqh", long_options, &option_index); + int c = getopt_long(argc, argv, "+nwc:iqhv", long_options, &option_index); For this commit, it's OK, not to mention it in the NEWS as it is not a real new feature. So it's online now. We can ?Clarify herbstclient man page? later so it is online now as: cb62c8f Add version output to herbstclient. Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From edu at thorsten-wissmann.de Tue Feb 4 18:05:08 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Tue, 4 Feb 2014 18:05:08 +0100 Subject: [PATCH] Mousewheel tag switching for panel In-Reply-To: <20140108190023.GE22910@lupin> References: <20140108190023.GE22910@lupin> Message-ID: <20140204170508.GE1146@ghul> On Wed, Jan 08, 2014 at 08:00:24PM +0100, Florian Bruhin wrote: > Add tag-switching by mousewheel to panel Sounds OK: acfe7bf Add tag-switching by mousewheel to panel Cheers, Thorste -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From edu at thorsten-wissmann.de Tue Feb 4 18:22:01 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Tue, 4 Feb 2014 18:22:01 +0100 Subject: [PATCH] Avoid unnecessary binary calls in makefiles In-Reply-To: <20140108170031.GD22910@lupin> References: <20140108170031.GD22910@lupin> Message-ID: <20140204172201.GF1146@ghul> On Wed, Jan 08, 2014 at 06:00:31PM +0100, Florian Bruhin wrote: > This avoids calling binaries from the Makefile more often than they > need to. > > before: > > $ make clean > /dev/null; strace -f make 2>&1 | grep -c 'execve(.* = 0' > 558 > > after: > > $ make clean > /dev/null; strace -f make 2>&1 | grep -c 'execve(.* = 0' > 153 Is this really of relevance? -INCS = -Isrc/ -I/usr/include -I${X11INC} `pkg-config --cflags glib-2.0` -LIBS = -lc -L${X11LIB} -lXext -lX11 $(XINERAMALIBS) `pkg-config --libs glib-2.0` +INCS := -Isrc/ -I/usr/include -I${X11INC} $(shell pkg-config --cflags glib-2.0) +LIBS := -lc -L${X11LIB} -lXext -lX11 $(XINERAMALIBS) $(shell pkg-config --libs glib-2.0) IMO the first one looks more compact and more make'ish, as everything with parenthesis $(...) is GNU Make only. Our makefile is gnu make only, anyway, but is it such important for you? I mean it only affects build performance and is not run regularly. Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From edu at thorsten-wissmann.de Tue Feb 4 18:36:24 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Tue, 4 Feb 2014 18:36:24 +0100 Subject: [PATCH] Spelling/grammar/other fixes for manpages In-Reply-To: <20140108143630.GC22910@lupin> References: <20140108141823.GB22910@lupin> <20140108143630.GC22910@lupin> Message-ID: <20140204173624.GG1146@ghul> Hi, On Wed, Jan 08, 2014 at 03:36:31PM +0100, Florian Bruhin wrote: > Ohshit, I just noticed I accidentally removed an 'f' for > always_show_frame. I pushed a fixup, please rebase-fixup it before > pushing it :) No problem, just sent an updated patch :P... I updated it for you and merged it as: 7f4f6da Spelling fixes for manpages Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From me at the-compiler.org Wed Feb 5 08:02:23 2014 From: me at the-compiler.org (Florian Bruhin) Date: Wed, 5 Feb 2014 08:02:23 +0100 Subject: [PATCH] Avoid unnecessary binary calls in makefiles In-Reply-To: <20140204172201.GF1146@ghul> References: <20140108170031.GD22910@lupin> <20140204172201.GF1146@ghul> Message-ID: <20140205070223.GJ9412@lupin> * Thorsten Wi?mann [2014-02-04 18:22:01 +0100]: > On Wed, Jan 08, 2014 at 06:00:31PM +0100, Florian Bruhin wrote: > > This avoids calling binaries from the Makefile more often than they > > need to. > > > > before: > > > > $ make clean > /dev/null; strace -f make 2>&1 | grep -c 'execve(.* = 0' > > 558 > > > > after: > > > > $ make clean > /dev/null; strace -f make 2>&1 | grep -c 'execve(.* = 0' > > 153 > > Is this really of relevance? > > -INCS = -Isrc/ -I/usr/include -I${X11INC} `pkg-config --cflags glib-2.0` > -LIBS = -lc -L${X11LIB} -lXext -lX11 $(XINERAMALIBS) `pkg-config --libs glib-2.0` > +INCS := -Isrc/ -I/usr/include -I${X11INC} $(shell pkg-config --cflags glib-2.0) > +LIBS := -lc -L${X11LIB} -lXext -lX11 $(XINERAMALIBS) $(shell pkg-config --libs glib-2.0) > > IMO the first one looks more compact and more make'ish, as everything > with parenthesis $(...) is GNU Make only. Our makefile is gnu make only, > anyway, but is it such important for you? I mean it only affects build > performance and is not run regularly. I don't care at all ;) Usually I do such stuff because I want to learn something and do something useful at the same time. If the patch isn't accepted then that's fine (you're the BDFL[1] after all), I still learned something :) Flo [1] Benevolent Dictator for Life, https://en.wikipedia.org/wiki/Benevolent_Dictator_For_Life -- () ascii ribbon campaign - stop html mail www.asciiribbon.org /\ www.the-compiler.org | I love long mails http://email.is-not-s.ms/ "There are things that are so serious that you can only joke about them" - Heisenberg -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: not available URL: From edu at thorsten-wissmann.de Wed Feb 5 10:19:37 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Wed, 5 Feb 2014 10:19:37 +0100 Subject: [PATCH] Avoid unnecessary binary calls in makefiles In-Reply-To: <20140205070223.GJ9412@lupin> References: <20140108170031.GD22910@lupin> <20140204172201.GF1146@ghul> <20140205070223.GJ9412@lupin> Message-ID: <20140205091936.GA1487@hoth.roethelheim.stw.uni-erlangen.de> On Wed, Feb 05, 2014 at 08:02:23AM +0100, Florian Bruhin wrote: > * Thorsten Wi?mann [2014-02-04 18:22:01 +0100]: > > On Wed, Jan 08, 2014 at 06:00:31PM +0100, Florian Bruhin wrote: > > > This avoids calling binaries from the Makefile more often than they > > > need to. > > > > > > before: > > > > > > $ make clean > /dev/null; strace -f make 2>&1 | grep -c 'execve(.* = 0' > > > 558 > > > > > > after: > > > > > > $ make clean > /dev/null; strace -f make 2>&1 | grep -c 'execve(.* = 0' > > > 153 > > > > Is this really of relevance? > > > > -INCS = -Isrc/ -I/usr/include -I${X11INC} `pkg-config --cflags glib-2.0` > > -LIBS = -lc -L${X11LIB} -lXext -lX11 $(XINERAMALIBS) `pkg-config --libs glib-2.0` > > +INCS := -Isrc/ -I/usr/include -I${X11INC} $(shell pkg-config --cflags glib-2.0) > > +LIBS := -lc -L${X11LIB} -lXext -lX11 $(XINERAMALIBS) $(shell pkg-config --libs glib-2.0) > > > > IMO the first one looks more compact and more make'ish, as everything > > with parenthesis $(...) is GNU Make only. Our makefile is gnu make only, > > anyway, but is it such important for you? I mean it only affects build > > performance and is not run regularly. > > I don't care at all ;) > > Usually I do such stuff because I want to learn something and do > something useful at the same time. If the patch isn't accepted then > that's fine (you're the BDFL[1] after all), I still learned something > :) The decisions still should be more or less reasonable ;). In this case I could not imagine how makes a real performance difference. I would keep it as it is because it's less syntax and because there weren't other people voting for $(shell ...). Cheers, Thorsten > [1] Benevolent Dictator for Life, https://en.wikipedia.org/wiki/Benevolent_Dictator_For_Life -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From simon at ruderich.org Wed Feb 5 14:49:57 2014 From: simon at ruderich.org (Simon Ruderich) Date: Wed, 5 Feb 2014 14:49:57 +0100 Subject: [PATCH 01/10] Use void as "parameter" for functions without arguments. In-Reply-To: <20140204071705.GA3535@ghul> References: <805122f7059195a02e9de6f342216061dc9c49d1.1391287795.git.simon@ruderich.org> <20140204071705.GA3535@ghul> Message-ID: <20140205134957.GA24992@ruderich.org> On Tue, Feb 04, 2014 at 08:17:05AM +0100, Thorsten Wi?mann wrote: > - I'm too lazy to continue writing void everywhere. > - It looks totally ugly... > - I don't see how ignoring that and writing ambigous fkt() causes any > issues regarding security or stability. One will notice it if > parameters to a function are ignored. But one might not immediately notice missing parameters to a function, i.e. the caller forgot an argument. >> // core functions >> -int quit() { >> +int quit(int argc, char* argv[]) { >> g_aboutToQuit = true; >> return 0; >> } > > I really prefer the previous version, because in the other case there > are parameters of that function which aren't used. Same for reload, > true, false, etc. But a reader immediately knows that the function takes arguments which are at the moment unused. I find that clearer. > Is there any advantage of writing (void), except that it is more > "conform"? See above. It's not a big advantage, but it's clearer and can prevent problems in the future. And to me the void doesn't look too bad, but that's a matter of opinion of course. Regards Simon -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From simon at ruderich.org Wed Feb 5 14:50:39 2014 From: simon at ruderich.org (Simon Ruderich) Date: Wed, 5 Feb 2014 14:50:39 +0100 Subject: [PATCH 10/10] Remove unused functions. In-Reply-To: <20140204130842.GB17972@ghul> References: <3ffc2c56cc2793c14b1b2bd07632f1f30bf1b735.1391287795.git.simon@ruderich.org> <20140204130842.GB17972@ghul> Message-ID: <20140205135039.GA25050@ruderich.org> On Tue, Feb 04, 2014 at 02:08:42PM +0100, Thorsten Wi?mann wrote: > Hi, > > I read about your intention of increasing the maintainability. But I see > most of these function as a library (A library won't delete a function > f() if the maintainers guess no application uses it). Well, hlwm is no library so changing the API is not a problem. I just noticed that those functions were unused at the moment and thought unused code doesn't have to be kept around. > For example, I will need.. > > - monitor_with_coordinate to implement monitor focussing with > focus_follows_mouse being enabled. > - monitor_with_frame for the same feature if hlwm receives a click event > on a frame window. > - hsobject_link_rename_object to rename a object, e.g. I could use it > for renaming tag/monitor objects in the future. But in this case, just keep them or drop only those which won't be useful in the near future. > It might be that we don't need the other functions anymore. Do you > really think we should remove them? If they are not used I see no reason to keep them. If they become useful in the future, the commit can always be reverted. Regards Simon -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From simon at ruderich.org Wed Feb 5 14:51:30 2014 From: simon at ruderich.org (Simon Ruderich) Date: Wed, 5 Feb 2014 14:51:30 +0100 Subject: [PATCH 07/10] command: Replace incorrect use of LENGTH(). In-Reply-To: <20140204125230.GA17972@ghul> References: <86d7908520996abbe45c26b65e959c81599c6529.1391287795.git.simon@ruderich.org> <20140204125230.GA17972@ghul> Message-ID: <20140205135130.GA25020@ruderich.org> On Tue, Feb 04, 2014 at 01:52:30PM +0100, Thorsten Wi?mann wrote: > On Sat, Feb 01, 2014 at 09:56:42PM +0100, Simon Ruderich wrote: >> LENGTH() has no negative effects because sizeof(char) == 1, but sizeof() >> makes the intention clear. >> >> - snprintf(buf, LENGTH(buf), "0x%lx", client->window); >> + snprintf(buf, sizeof(buf), "0x%lx", client->window); > > I mean both is right, but the question is what this parameter means. snprintf() takes the length of the buffer in bytes as second argument, not the number of elements. Of course in this case it's the same, but why introduce a level of indirection here? sizeof() is what everybody expects. > E.g. in wchar versions it seems this is the length of the buffer and not > the total size in bytes of the underlying data structure, of course they > coincide in the case of ordinary chars. > I personally find LENGTH more readable because it is really the length > of the array, while sizeof gives it's total size. Exactly, which is what snprintf() takes as argument. The length of the array in bytes, which is not always the same as LENGTH(). > So I would not agree that sizeof makes the intention clear. It's not a big issue, I just noticed it and it didn't seem clear to be because of the element vs. byte count difference so I changed it. Regards Simon -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From simon at ruderich.org Wed Feb 5 15:21:46 2014 From: simon at ruderich.org (Simon Ruderich) Date: Wed, 5 Feb 2014 15:21:46 +0100 Subject: [PATCH 00/10] Misc patches In-Reply-To: <20140204162250.GA1146@ghul> References: <20140204162250.GA1146@ghul> Message-ID: <20140205142146.GA25074@ruderich.org> On Tue, Feb 04, 2014 at 05:22:50PM +0100, Thorsten Wi?mann wrote: > Out of these 10 patches, I merged these 7 by fair dice roll^W^W^W^Wfor > the following reasons: Hi Thorsten, Thanks for merging the patches so quickly. > - f64e7a5 Makefile: Use $(CFLAGS) when linking. > => Did not know that, is that the normal usage of CLFAGS? Christoph? Yes, it is. Compiling: CPPFLAGS + CFLAGS Linking: CFLAGS + LDFLAGS GNU autotools handles it in the same way. See also the gcc man page regarding -flto: Additionally, the optimization flags used to compile individual files are not necessarily related to those used at link time. For instance, gcc -c -O0 -flto foo.c gcc -c -O0 -flto bar.c gcc -o myprog -flto -O3 foo.o bar.o This produces individual object files with unoptimized assembler code, but the resulting binary myprog is optimized at -O3. If, instead, the final binary is generated without -flto, then myprog is not optimized. Therefore CFLAGS is required while linking. Regards Simon -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From edu at thorsten-wissmann.de Wed Feb 5 15:22:57 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Wed, 5 Feb 2014 15:22:57 +0100 Subject: [PATCH 01/10] Use void as "parameter" for functions without arguments. In-Reply-To: <20140205134957.GA24992@ruderich.org> References: <805122f7059195a02e9de6f342216061dc9c49d1.1391287795.git.simon@ruderich.org> <20140204071705.GA3535@ghul> <20140205134957.GA24992@ruderich.org> Message-ID: <20140205142257.GE1487@hoth.roethelheim.stw.uni-erlangen.de> On Wed, Feb 05, 2014 at 02:49:57PM +0100, Simon Ruderich wrote: > On Tue, Feb 04, 2014 at 08:17:05AM +0100, Thorsten Wi?mann wrote: > > - I'm too lazy to continue writing void everywhere. > > - It looks totally ugly... > > - I don't see how ignoring that and writing ambigous fkt() causes any > > issues regarding security or stability. One will notice it if > > parameters to a function are ignored. > > But one might not immediately notice missing parameters to a > function, i.e. the caller forgot an argument. This won't ever happen. When calling a function like ?void quit()?, you can't forget to pass a parameter. And if you change the signature to something else the compiler will complain if the caller forgets an argument. > >> // core functions > >> -int quit() { > >> +int quit(int argc, char* argv[]) { > >> g_aboutToQuit = true; > >> return 0; > >> } > > > > I really prefer the previous version, because in the other case there > > are parameters of that function which aren't used. Same for reload, > > true, false, etc. > > But a reader immediately knows that the function takes arguments > which are at the moment unused. I find that clearer. Well actually quit does not expect arguments, only after applying your patch. It does not care about arguments at all and needs none, but passing arguments to it does not cause trouble. That's what () is saying and what is happening here. It is OK to use quit as a command but it is also OK to call quit() directly without passing anything. > > Is there any advantage of writing (void), except that it is more > > "conform"? > > See above. It's not a big advantage, but it's clearer and can > prevent problems in the future. And to me the void doesn't look > too bad, but that's a matter of opinion of course. Well to me it looks bad, and it seems that language designers prefer an empty argument list "" to encode "does not need/expect/take any arguments" and not "void" (or something similar). It's just a hack in C. Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From edu at thorsten-wissmann.de Wed Feb 5 15:35:03 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Wed, 5 Feb 2014 15:35:03 +0100 Subject: [PATCH 10/10] Remove unused functions. In-Reply-To: <20140205135039.GA25050@ruderich.org> References: <3ffc2c56cc2793c14b1b2bd07632f1f30bf1b735.1391287795.git.simon@ruderich.org> <20140204130842.GB17972@ghul> <20140205135039.GA25050@ruderich.org> Message-ID: <20140205143503.GF1487@hoth.roethelheim.stw.uni-erlangen.de> On Wed, Feb 05, 2014 at 02:50:39PM +0100, Simon Ruderich wrote: > On Tue, Feb 04, 2014 at 02:08:42PM +0100, Thorsten Wi?mann wrote: > > I read about your intention of increasing the maintainability. But I see > > most of these function as a library (A library won't delete a function > > f() if the maintainers guess no application uses it). > > Well, hlwm is no library so changing the API is not a problem. It was not about changing the library. I wanted to describe the order in which I write code: Normally I create a struct with it's operations (like objects, monitors, settings...) and then I use it and call some of these operations. And some of the operations aren't used but when writing the "library"="object"={struct + operations on it} I found them being usefull and added them. > I just noticed that those functions were unused at the moment and > thought unused code doesn't have to be kept around. > > > For example, I will need.. > > > > - monitor_with_coordinate to implement monitor focussing with > > focus_follows_mouse being enabled. > > - monitor_with_frame for the same feature if hlwm receives a click event > > on a frame window. > > - hsobject_link_rename_object to rename a object, e.g. I could use it > > for renaming tag/monitor objects in the future. > > But in this case, just keep them or drop only those which won't > be useful in the near future. Looks like a reasonable compromise. > > It might be that we don't need the other functions anymore. Do you > > really think we should remove them? > > If they are not used I see no reason to keep them. If they become > useful in the future, the commit can always be reverted. Technically yes, realistically no: If somebody writes code and uses some structs from a certain header file, he looks at the header file to get a list of operations working on that struct. If the operation he's looking for is not there, he will write it from scratch but he surely won't browse the git history looking for an appropriate function which could be brought back to the code base. Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From simon at ruderich.org Wed Feb 5 20:51:04 2014 From: simon at ruderich.org (Simon Ruderich) Date: Wed, 5 Feb 2014 20:51:04 +0100 Subject: [PATCH 01/10] Use void as "parameter" for functions without arguments. In-Reply-To: <20140205142257.GE1487@hoth.roethelheim.stw.uni-erlangen.de> References: <805122f7059195a02e9de6f342216061dc9c49d1.1391287795.git.simon@ruderich.org> <20140204071705.GA3535@ghul> <20140205134957.GA24992@ruderich.org> <20140205142257.GE1487@hoth.roethelheim.stw.uni-erlangen.de> Message-ID: <20140205195104.GA2719@ruderich.org> On Wed, Feb 05, 2014 at 03:22:57PM +0100, Thorsten Wi?mann wrote: > This won't ever happen. When calling a function like ?void quit()?, you > can't forget to pass a parameter. And if you change the signature to > something else the compiler will complain if the caller forgets an > argument. Of course, you're right. I got confused, sorry. > Well actually quit does not expect arguments, only after applying your > patch. It does not care about arguments at all and needs none, but > passing arguments to it does not cause trouble. That's what () is > saying and what is happening here. It is OK to use quit as a command > but it is also OK to call quit() directly without passing anything. True. But the way these functions are called, it should expect arguments. > Well to me it looks bad, and it seems that language designers prefer an > empty argument list "" to encode "does not need/expect/take any > arguments" and not "void" (or something similar). It's just a hack in C. Well, yeah. But that's just how it works in C. But I don't care that much and if you don't like the patch, don't apply it. I'd prefer the "correct" solution which specifies which functions take no arguments, but if you don't, that's fine by me. Regards Simon -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From stettberger at dokucode.de Sun Feb 9 17:37:51 2014 From: stettberger at dokucode.de (Christian Dietrich) Date: Sun, 09 Feb 2014 17:37:51 +0100 Subject: Patch: keymasks Message-ID: <52F7AEDF.8040306@dokucode.de> Hi, since I'm a heavy emacs user (sounds like taking drugs...) I want as many keybindings as possible. But herbstluftwm is stealing so many of them for managing my windows, which is kind of useless, since my emacs is always fullscreen on a single tag. Therefore there is no reason why herbstluftwm should bind most of the keys, when Emacs is focused. I wrote a patch, that does exactly that. Each client has a keymask (which is matched against the keybindings as a regular expression): All matching keybindings are enabled, all others are disabled. Keymasks can be applied by client rules, so hc rule class~'Emacs' keymask="Mod4.[1-5qweras]" applies the keymask, that only enables monitor and tag switching bindings when Emacs is focused. When refocusing only the wrongly disabled or enabled keybindings are regrabbed. So it should be kind of fast. When not using keybindings no performance impact should be measurable. chris -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Adding-keymask-feature-to-disable-keybindings-tempor.patch Type: text/x-patch Size: 11085 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 884 bytes Desc: OpenPGP digital signature URL: From bartoszp92 at gmail.com Thu Feb 27 02:38:49 2014 From: bartoszp92 at gmail.com (Bartosz P) Date: Thu, 27 Feb 2014 02:38:49 +0100 Subject: your wm In-Reply-To: References: Message-ID: And: on what license you distribute this wm? 2014-02-27 2:11 GMT+01:00 Bartosz P : > For what system you wrote this WM? > Just do not ask for what is available, only for what you wrote it :) > > thanks! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bartoszp92 at gmail.com Thu Feb 27 02:11:07 2014 From: bartoszp92 at gmail.com (Bartosz P) Date: Thu, 27 Feb 2014 02:11:07 +0100 Subject: your wm Message-ID: For what system you wrote this WM? Just do not ask for what is available, only for what you wrote it :) thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From me at the-compiler.org Thu Feb 27 09:01:00 2014 From: me at the-compiler.org (Florian Bruhin) Date: Thu, 27 Feb 2014 09:01:00 +0100 Subject: your wm In-Reply-To: Message-ID: <20140227080100.GM15775@lupin> Hi, first of all, please subscribe[1] to the mailinglist before posting so I don't have to approve your mails by hand. * Bartosz P [2014-02-27 02:11:07 +0100]: > For what system you wrote this WM? > Just do not ask for what is available, only for what you wrote it :) How does it matter? You don't usually write a WM for just one system (unless you're Ubuntu). Well, I guess Thorsten will have to answer on that, I think he uses Archlinux. * Bartosz P [2014-02-27 02:38:49 +0100]: > And: on what license you distribute this wm? You could've easily found that out yourself by looking at the manpage, or in the gitrepo, or probably some other places. COPYING Copyright 2011-2013 Thorsten Wi?mann. All rights reserved. This software is licensed under the "Simplified BSD License". See LICENSE for details Florian [1] https://lists.schokokeks.org/mailman/listinfo.cgi/hlwm -- () ascii ribbon campaign - stop html mail www.asciiribbon.org /\ www.the-compiler.org | I love long mails http://email.is-not-s.ms/ Awright, which one of you hid my PENIS ENVY? -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: not available URL: From edu at thorsten-wissmann.de Thu Feb 27 13:36:22 2014 From: edu at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Thu, 27 Feb 2014 13:36:22 +0100 Subject: your wm In-Reply-To: <20140227080100.GM15775@lupin> References: <20140227080100.GM15775@lupin> Message-ID: <20140227123622.GA9977@hoth.roethelheim.stw.uni-erlangen.de> Hi, just another discussion: On Thu, Feb 27, 2014 at 09:01:00AM +0100, Florian Bruhin wrote: > first of all, please subscribe[1] to the mailinglist before posting so > I don't have to approve your mails by hand. Did we ever had this policy? I thought I configured the sourceforge mailing list in such a way that it accepts all text-mails with patches attached. Cheers, Thorsten -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 230 bytes Desc: not available URL: From me at the-compiler.org Thu Feb 27 13:43:47 2014 From: me at the-compiler.org (Florian Bruhin) Date: Thu, 27 Feb 2014 13:43:47 +0100 Subject: mailinglist policy (was: Re: your wm) In-Reply-To: <20140227123622.GA9977@hoth.roethelheim.stw.uni-erlangen.de> References: <20140227080100.GM15775@lupin> <20140227123622.GA9977@hoth.roethelheim.stw.uni-erlangen.de> Message-ID: <20140227124347.GN15775@lupin> * Thorsten Wi?mann [2014-02-27 13:36:22 +0100]: > On Thu, Feb 27, 2014 at 09:01:00AM +0100, Florian Bruhin wrote: > > first of all, please subscribe[1] to the mailinglist before posting so > > I don't have to approve your mails by hand. > > Did we ever had this policy? I thought I configured the sourceforge > mailing list in such a way that it accepts all text-mails with patches > attached. I guess that's just the mailman default. I gave you the mailman password some time ago, so feel free to customize it to your needs ;) Flo -- () ascii ribbon campaign - stop html mail www.asciiribbon.org /\ www.the-compiler.org | I love long mails http://email.is-not-s.ms/ Trust your husband, adore your husband, and get as much as you can in your own name. -- Joan Rivers -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: not available URL: From s-itsnoteasybeinganonmember at thorsten-wissmann.de Thu Feb 27 13:52:57 2014 From: s-itsnoteasybeinganonmember at thorsten-wissmann.de (Thorsten =?iso-8859-1?Q?Wi=DFmann?=) Date: Thu, 27 Feb 2014 13:52:57 +0100 Subject: mailinglist policy (was: Re: your wm) In-Reply-To: <20140227124347.GN15775@lupin> References: <20140227080100.GM15775@lupin> <20140227123622.GA9977@hoth.roethelheim.stw.uni-erlangen.de> <20140227124347.GN15775@lupin> Message-ID: <20140227125257.GB9977@hoth.roethelheim.stw.uni-erlangen.de> On Thu, Feb 27, 2014 at 01:43:47PM +0100, Florian Bruhin wrote: > * Thorsten Wi?mann [2014-02-27 13:36:22 +0100]: > > On Thu, Feb 27, 2014 at 09:01:00AM +0100, Florian Bruhin wrote: > > > first of all, please subscribe[1] to the mailinglist before posting so > > > I don't have to approve your mails by hand. > > > > Did we ever had this policy? I thought I configured the sourceforge > > mailing list in such a way that it accepts all text-mails with patches > > attached. > > I guess that's just the mailman default. I gave you the mailman > password some time ago, so feel free to customize it to your needs ;) OK, I've changed that setting. (I don't remember the other options. But it did not seem to me that a lot of spam arrives here, so no need to restrict the other options about allowed mail contents). Thorsten