X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=spectrwm.c;h=dff8f8da49a34f8f563eaea77b2de1d9b92be07c;hb=409634cf4a48d8f63c3d85728923ea4ae92cbc58;hp=16308093df37ad83cdc9d9811a1d891820f669cd;hpb=9bd2ca7222d945f669e160239c615a9bcec34bb3;p=spectrwm.git diff --git a/spectrwm.c b/spectrwm.c index 1630809..dff8f8d 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -157,7 +157,7 @@ static const char *buildstr = SPECTRWM_VERSION; #define SWM_DEBUG #ifdef SWM_DEBUG #define DPRINTF(x...) do { if (swm_debug) fprintf(stderr, x); } while (0) -#define DNPRINTF(n,x...) do { if (swm_debug & n) fprintf(stderr, x); } while (0) +#define DNPRINTF(n,x...) do { if (swm_debug & n) { fprintf(stderr, "%ld ", (long)time(NULL)); fprintf(stderr, x); } } while (0) #define SWM_D_MISC 0x0001 #define SWM_D_EVENT 0x0002 #define SWM_D_WS 0x0004 @@ -249,7 +249,7 @@ xcb_atom_t a_swm_iconic; volatile sig_atomic_t running = 1; volatile sig_atomic_t restart_wm = 0; int outputs = 0; -int last_focus_event = FocusOut; +/*int last_focus_event = FocusOut;*/ int (*xerrorxlib)(Display *, XErrorEvent *); int other_wm; int ss_enabled = 0; @@ -2477,11 +2477,11 @@ focus_win(struct ws_win *win) unfocus_win(cfw); else { /* use larger hammer since the window was killed somehow */ - TAILQ_FOREACH(cfw, &win->ws->winlist, entry) + /* TAILQ_FOREACH(cfw, &win->ws->winlist, entry) if (cfw->ws && cfw->ws->r && cfw->ws->r->s) xcb_change_window_attributes(conn, cfw->id, XCB_CW_BORDER_PIXEL, - &cfw->ws->r->s->c[SWM_S_COLOR_UNFOCUS].color); + &cfw->ws->r->s->c[SWM_S_COLOR_UNFOCUS].color);*/ } win->ws->focus = win; @@ -4152,7 +4152,7 @@ update_window(struct ws_win *win) void resize(struct ws_win *win, union arg *args) { - xcb_timestamp_t time = 0; + xcb_timestamp_t timestamp = 0; struct swm_region *r = NULL; int resize_step = 0; struct swm_geometry g; @@ -4316,8 +4316,8 @@ resize(struct ws_win *win, union arg *args) constrain_window(win, r, 1); /* not free, don't sync more than 120 times / second */ - if ((mne->time - time) > (1000 / 120) ) { - time = mne->time; + if ((mne->time - timestamp) > (1000 / 120) ) { + timestamp = mne->time; do_sync(); update_window(win); } @@ -4328,7 +4328,7 @@ resize(struct ws_win *win, union arg *args) } free(evt); } - if (time) { + if (timestamp) { do_sync(); update_window(win); } @@ -4359,7 +4359,7 @@ resize_step(struct swm_region *r, union arg *args) void move(struct ws_win *win, union arg *args) { - xcb_timestamp_t time = 0; + xcb_timestamp_t timestamp = 0; int move_step = 0, buttonrelease; struct swm_region *r = NULL; xcb_font_t cursor_font; @@ -4468,8 +4468,8 @@ move(struct ws_win *win, union arg *args) constrain_window(win, r, 0); /* not free, don't sync more than 120 times / second */ - if ((mne->time - time) > (1000 / 120) ) { - time = mne->time; + if ((mne->time - timestamp) > (1000 / 120) ) { + timestamp = mne->time; do_sync(); update_window(win); } @@ -4480,7 +4480,7 @@ move(struct ws_win *win, union arg *args) } free(evt); } - if (time) { + if (timestamp) { do_sync(); update_window(win); } @@ -6541,9 +6541,6 @@ free_window(struct ws_win *win) if (win == NULL) return; - /* needed for restart wm */ - set_win_state(win, XCB_ICCCM_WM_STATE_WITHDRAWN); - TAILQ_REMOVE(&win->ws->unmanagedlist, win, entry); if (win->wa) @@ -7539,73 +7536,11 @@ workaround(void) void event_error(xcb_generic_error_t *e) { - const char *estr; - - switch (e->error_code) { - case 0: - estr = "Success"; - break; - case XCB_REQUEST: - estr = "BadRequest"; - break; - case XCB_VALUE: - estr = "BadValue"; - break; - case XCB_WINDOW: - estr = "BadWindow"; - break; - case XCB_PIXMAP: - estr = "BadPixmap"; - break; - case XCB_ATOM: - estr = "BadAtom"; - break; - case XCB_CURSOR: - estr = "BadCursor"; - break; - case XCB_FONT: - estr = "BadFont"; - break; - case XCB_MATCH: - estr = "BadMatch"; - break; - case XCB_DRAWABLE: - estr = "BadDrawable"; - break; - case XCB_ACCESS: - estr = "BadAccess"; - break; - case XCB_ALLOC: - estr = "BadAlloc"; - break; - case XCB_COLORMAP: - estr = "BadColor"; - break; - case XCB_G_CONTEXT: - estr = "BadGC"; - break; - case XCB_ID_CHOICE: - estr = "BadIdChoice"; - break; - case XCB_NAME: - estr = "BadName"; - break; - case XCB_LENGTH: - estr = "BadLength"; - break; - case XCB_IMPLEMENTATION: - estr = "BadImplementation"; - break; - default: - estr = "Unknown"; - break; - } - - DNPRINTF(SWM_D_EVENT, "event_error: %s: response_type:%u error_code:%u " - "sequence:%u resource_id:%u minor_code:%u major_code:%u\n", estr, - e->response_type, e->error_code, e->sequence, e->resource_id, - e->minor_code, e->major_code - ); + DNPRINTF(SWM_D_EVENT, "event_error: %s(%u) from %s(%u), sequence: %u, " + "resource_id: %u, minor_code: %u\n", + xcb_event_get_error_label(e->error_code), e->error_code, + xcb_event_get_request_label(e->major_code), e->major_code, + e->sequence, e->resource_id, e->minor_code); } void @@ -7617,18 +7552,35 @@ event_handle(xcb_generic_event_t *evt) EVENT(0, event_error); EVENT(XCB_BUTTON_PRESS, buttonpress); /*EVENT(XCB_BUTTON_RELEASE, buttonpress);*/ + /*EVENT(XCB_CIRCULATE_NOTIFY, );*/ + /*EVENT(XCB_CIRCULATE_REQUEST, );*/ EVENT(XCB_CLIENT_MESSAGE, clientmessage); + /*EVENT(XCB_COLORMAP_NOTIFY, );*/ EVENT(XCB_CONFIGURE_NOTIFY, configurenotify); EVENT(XCB_CONFIGURE_REQUEST, configurerequest); + /*EVENT(XCB_CREATE_NOTIFY, );*/ EVENT(XCB_DESTROY_NOTIFY, destroynotify); EVENT(XCB_ENTER_NOTIFY, enternotify); EVENT(XCB_EXPOSE, expose); + /*EVENT(XCB_FOCUS_IN, );*/ + /*EVENT(XCB_FOCUS_OUT, );*/ + /*EVENT(XCB_GRAPHICS_EXPOSURE, );*/ + /*EVENT(XCB_GRAVITY_NOTIFY, );*/ EVENT(XCB_KEY_PRESS, keypress); /*EVENT(XCB_KEY_RELEASE, keypress);*/ + /*EVENT(XCB_KEYMAP_NOTIFY, );*/ + /*EVENT(XCB_LEAVE_NOTIFY, );*/ EVENT(XCB_MAP_NOTIFY, mapnotify); EVENT(XCB_MAP_REQUEST, maprequest); EVENT(XCB_MAPPING_NOTIFY, mappingnotify); + /*EVENT(XCB_MOTION_NOTIFY, );*/ + /*EVENT(XCB_NO_EXPOSURE, );*/ EVENT(XCB_PROPERTY_NOTIFY, propertynotify); + /*EVENT(XCB_REPARENT_NOTIFY, );*/ + /*EVENT(XCB_RESIZE_REQUEST, );*/ + /*EVENT(XCB_SELECTION_CLEAR, );*/ + /*EVENT(XCB_SELECTION_NOTIFY, );*/ + /*EVENT(XCB_SELECTION_REQUEST, );*/ EVENT(XCB_UNMAP_NOTIFY, unmapnotify); EVENT(XCB_VISIBILITY_NOTIFY, visibilitynotify); #undef EVENT @@ -7791,7 +7743,7 @@ noconfig: while (running) { while ((evt = xcb_poll_for_event(conn))) { - DNPRINTF(SWM_D_EVENT, "XCB Event: %s (%d)\n", + DNPRINTF(SWM_D_EVENT, "XCB Event: %s(%d)\n", xcb_event_get_label(XCB_EVENT_RESPONSE_TYPE(evt)), XCB_EVENT_RESPONSE_TYPE(evt)); if (running == 0)