[PATCH 10/10] Remove unused functions.
Simon Ruderich
simon at ruderich.org
Sat Feb 1 21:57:14 CET 2014
---
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: <https://listi.jpberlin.de/pipermail/hlwm/attachments/20140201/b90e25ee/attachment.asc>
More information about the hlwm
mailing list