From: Michael D. Lowis Date: Thu, 23 May 2019 03:08:46 +0000 (-0400) Subject: remove debug stuff X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=b33046290c801ab18a89b3864657f73bb18973f5;p=proto%2Fwindowlab.git remove debug stuff --- diff --git a/client.c b/client.c index 4455168..46fa54b 100644 --- a/client.c +++ b/client.c @@ -122,10 +122,6 @@ void remove_client(Client *c, int mode) XGrabServer(dsply); XSetErrorHandler(ignore_xerror); -#ifdef DEBUG - err("removing %s, %d: %d left", c->name, mode, XPending(dsply)); -#endif - if (mode == WITHDRAW) { set_wm_state(c, WithdrawnState); @@ -163,10 +159,6 @@ void remove_client(Client *c, int mode) { XFree(c->size); } - if (c == fullscreen_client) - { - fullscreen_client = NULL; - } if (c == focused_client) { focused_client = NULL; @@ -181,10 +173,6 @@ void remove_client(Client *c, int mode) void redraw(Client *c) { - if (c == fullscreen_client) - { - return; - } XDrawLine(dsply, c->frame, border_gc, 0, BARHEIGHT() - DEF_BORDERWIDTH + DEF_BORDERWIDTH / 2, c->width, BARHEIGHT() - DEF_BORDERWIDTH + DEF_BORDERWIDTH / 2); // clear text part of bar if (c == focused_client) diff --git a/events.c b/events.c index 50a06af..31943ec 100644 --- a/events.c +++ b/events.c @@ -46,9 +46,6 @@ void do_event_loop(void) for (;;) { interruptible_XNextEvent(&ev); -#ifdef DEBUG - show_event(ev); -#endif switch (ev.type) { case ButtonPress: @@ -93,28 +90,22 @@ static void handle_button_press(XButtonEvent *e) if (e->state & MODIFIER) { - if (focused_client != NULL && focused_client != fullscreen_client) - { + if (focused_client != NULL) resize(focused_client, e->x_root, e->y_root); - } - else - { - // pass event on + else // pass event on XAllowEvents(dsply, ReplayPointer, CurrentTime); - } } else { // pass event on XAllowEvents(dsply, ReplayPointer, CurrentTime); - if (e->button == Button1) - { + if (e->button == Button1) { c = find_client(e->window, FRAME); if (c != NULL) { // click-to-focus check_focus(c); - if (e->y < BARHEIGHT() && c != fullscreen_client) + if (e->y < BARHEIGHT()) { handle_windowbar_click(e, c); } @@ -216,9 +207,8 @@ static unsigned int box_clicked(Client *c, int x) static void draw_button(Client *c, GC *detail_gc, GC *background_gc, unsigned int which_box) { - if (which_box == 0) { + if (which_box == 0) draw_close_button(c, detail_gc, background_gc); - } } /* Because we are redirecting the root window, we get ConfigureRequest @@ -245,27 +235,6 @@ static void handle_configure_request(XConfigureRequestEvent *e) Client *c = find_client(e->window, WINDOW); XWindowChanges wc; - if (fullscreen_client != NULL && c == fullscreen_client) - { - if (e->value_mask & CWX) - { - fs_prevdims.x = e->x; - } - if (e->value_mask & CWY) - { - fs_prevdims.y = e->y; - } - if (e->value_mask & CWWidth) - { - fs_prevdims.width = e->width; - } - if (e->value_mask & CWHeight) - { - fs_prevdims.height = e->height; - } - return; - } - if (c != NULL) { gravitate(c, REMOVE_GRAVITY); diff --git a/main.c b/main.c index 5696be2..517c2ac 100644 --- a/main.c +++ b/main.c @@ -33,7 +33,7 @@ GC string_gc, border_gc, text_gc, active_gc, depressed_gc, inactive_gc, selected XColor border_col, text_col, active_col, depressed_col, inactive_col, selected_col, empty_col; Cursor resize_curs; Atom wm_state, wm_change_state, wm_protos, wm_delete, wm_cmapwins; -Client *head_client = NULL, *focused_client = NULL, *topmost_client = NULL, *fullscreen_client = NULL; +Client *head_client = NULL, *focused_client = NULL, *topmost_client = NULL; unsigned int focus_count = 0; Rect fs_prevdims; char *opt_font = DEF_FONT; @@ -148,9 +148,6 @@ static void setup_display(void) if (modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dsply, XK_Num_Lock)) { numlockmask = (1 << i); -#ifdef DEBUG - fprintf(stderr, "setup_display() : XK_Num_Lock is (1<<0x%02x)\n", i); -#endif } } } diff --git a/manage.c b/manage.c index 26879d3..ad6a74f 100644 --- a/manage.c +++ b/manage.c @@ -90,9 +90,6 @@ void move(Client *c) bounddims.height += c->height - ((BARHEIGHT() * 2) - DEF_BORDERWIDTH); constraint_win = XCreateWindow(dsply, root, bounddims.x, bounddims.y, bounddims.width, bounddims.height, 0, CopyFromParent, InputOnly, CopyFromParent, 0, &pattr); -#ifdef DEBUG - fprintf(stderr, "move() : constraint_win is (%d, %d)-(%d, %d)\n", bounddims.x, bounddims.y, bounddims.x + bounddims.width, bounddims.y + bounddims.height); -#endif XMapWindow(dsply, constraint_win); if (!(XGrabPointer(dsply, root, False, MouseMask, GrabModeAsync, GrabModeAsync, constraint_win, None, CurrentTime) == GrabSuccess)) diff --git a/misc.c b/misc.c index c30be84..1d57fee 100644 --- a/misc.c +++ b/misc.c @@ -165,11 +165,7 @@ void fix_position(Client *c) int ymax = DisplayHeight(dsply, screen); int titlebarheight; -#ifdef DEBUG - fprintf(stderr, "fix_position(): client was (%d, %d)-(%d, %d)\n", c->x, c->y, c->x + c->width, c->y + c->height); -#endif - - titlebarheight = (fullscreen_client == c) ? 0 : BARHEIGHT(); + titlebarheight = BARHEIGHT(); if (c->width < MINWINWIDTH) { @@ -207,10 +203,6 @@ void fix_position(Client *c) c->y = (ymax - c->height) - BARHEIGHT(); } -#ifdef DEBUG - fprintf(stderr, "fix_position(): client is (%d, %d)-(%d, %d)\n", c->x, c->y, c->x + c->width, c->y + c->height); -#endif - c->x -= BORDERWIDTH(c); c->y -= BORDERWIDTH(c); } @@ -249,118 +241,6 @@ void copy_dims(Rect *sourcedims, Rect *destdims) destdims->height = sourcedims->height; } -#ifdef DEBUG - -/* Bleh, stupid macro names. I'm not feeling creative today. */ - -#define SHOW_EV(name, memb) \ - case name: \ - s = #name; \ - w = e.memb.window; \ - break; -#define SHOW(name) \ - case name: \ - return #name; - -void show_event(XEvent e) -{ - char *s, buf[20]; - Window w; - Client *c; - - switch (e.type) - { - SHOW_EV(ButtonPress, xbutton) - SHOW_EV(ButtonRelease, xbutton) - SHOW_EV(ClientMessage, xclient) - SHOW_EV(ColormapNotify, xcolormap) - SHOW_EV(ConfigureNotify, xconfigure) - SHOW_EV(ConfigureRequest, xconfigurerequest) - SHOW_EV(CreateNotify, xcreatewindow) - SHOW_EV(DestroyNotify, xdestroywindow) - SHOW_EV(EnterNotify, xcrossing) - SHOW_EV(Expose, xexpose) - SHOW_EV(MapNotify, xmap) - SHOW_EV(MapRequest, xmaprequest) - SHOW_EV(MappingNotify, xmapping) - SHOW_EV(MotionNotify, xmotion) - SHOW_EV(PropertyNotify, xproperty) - SHOW_EV(ReparentNotify, xreparent) - SHOW_EV(ResizeRequest, xresizerequest) - SHOW_EV(UnmapNotify, xunmap) - default: - if (shape && e.type == shape_event) - { - s = "ShapeNotify"; - w = ((XShapeEvent *)&e)->window; - } - else - { - s = "unknown event"; - w = None; - } - break; - } - - c = find_client(w, WINDOW); - snprintf(buf, sizeof buf, c != NULL ? c->name : "(none)"); - err("%#-10lx: %-20s: %s", w, buf, s); -} - -static const char *show_state(Client *c) -{ - switch (get_wm_state(c)) - { - SHOW(WithdrawnState) - SHOW(NormalState) - SHOW(IconicState) - default: return "unknown state"; - } -} - -static const char *show_grav(Client *c) -{ - if (c->size == NULL || !(c->size->flags & PWinGravity)) - { - return "no grav (NW)"; - } - - switch (c->size->win_gravity) - { - SHOW(UnmapGravity) - SHOW(NorthWestGravity) - SHOW(NorthGravity) - SHOW(NorthEastGravity) - SHOW(WestGravity) - SHOW(CenterGravity) - SHOW(EastGravity) - SHOW(SouthWestGravity) - SHOW(SouthGravity) - SHOW(SouthEastGravity) - SHOW(StaticGravity) - default: return "unknown grav"; - } -} - -void dump(Client *c) -{ - if (c != NULL) - { - err("%s\n\t%s, %s, ignore %d, was_hidden %d\n\tframe %#lx, win %#lx, geom %dx%d+%d+%d", c->name, show_state(c), show_grav(c), c->ignore_unmap, c->was_hidden, c->frame, c->window, c->width, c->height, c->x, c->y); - } -} - -void dump_clients(void) -{ - Client *c = head_client; - while (c != NULL) - { - dump(c); - c = c->next; - } -} -#endif - /* We use XQueryTree here to preserve the window stacking order, * since the order in our linked list is different. */ diff --git a/windowlab.h b/windowlab.h index e004540..b6499f4 100644 --- a/windowlab.h +++ b/windowlab.h @@ -236,10 +236,5 @@ extern void get_mouse_position(int *, int *); extern void fix_position(Client *); extern void refix_position(Client *, XConfigureRequestEvent *); extern void copy_dims(Rect *, Rect *); -#ifdef DEBUG -extern void show_event(XEvent); -extern void dump(Client *); -extern void dump_clients(void); -#endif #endif /* WINDOWLAB_H */