X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=spectrwm.c;h=0ddc31adfa89bb211b4b7b046db90887b8bfe0a7;hb=78bdc9baaa972d32fbcf344a51f29c9e3cb528b0;hp=039411b8b582442183ab0c695b1ece9d6883df40;hpb=e88b44bce416d8e0564674f38a51ce4bf179af6b;p=spectrwm.git diff --git a/spectrwm.c b/spectrwm.c index 039411b..0ddc31a 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -156,8 +156,16 @@ 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 DPRINTF(x...) do { \ + if (swm_debug) \ + fprintf(stderr, x); \ +} while (0) +#define DNPRINTF(n,x...) do { \ + if (swm_debug & n) { \ + fprintf(stderr, "%ld ", (long)(time(NULL) - time_started)); \ + fprintf(stderr, x); \ + } \ +} while (0) #define SWM_D_MISC 0x0001 #define SWM_D_EVENT 0x0002 #define SWM_D_WS 0x0004 @@ -249,7 +257,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; @@ -343,6 +351,7 @@ int spawn_position = SWM_STACK_TOP; int disable_border = 0; int border_width = 1; int verbose_layout = 0; +time_t time_started; pid_t bar_pid; XFontSet bar_fs; XFontSetExtents *bar_fs_extents; @@ -711,7 +720,6 @@ map_window_raised(xcb_window_t win) XCB_CONFIG_WINDOW_STACK_MODE, &val); xcb_map_window(conn, win); - xcb_flush(conn); } xcb_atom_t @@ -834,33 +842,33 @@ teardown_ewmh(void) void ewmh_autoquirk(struct ws_win *win) { - int i; - unsigned long n; - xcb_atom_t type; + uint32_t i, n; + xcb_atom_t *type; xcb_get_property_cookie_t c; xcb_get_property_reply_t *r; c = xcb_get_property(conn, False, win->id, - ewmh[_NET_WM_WINDOW_TYPE].atom, XCB_ATOM_ATOM, 0, (~0L)); + ewmh[_NET_WM_WINDOW_TYPE].atom, XCB_ATOM_ATOM, 0, UINT32_MAX); r = xcb_get_property_reply(conn, c, NULL); if (!r) return; - n = xcb_get_property_value_length(r); + n = xcb_get_property_value_length(r); + type = xcb_get_property_value(r); + for (i = 0; i < n; i++) { - type = *((xcb_atom_t *)xcb_get_property_value(r)); - if (type == ewmh[_NET_WM_WINDOW_TYPE_NORMAL].atom) + if (type[i] == ewmh[_NET_WM_WINDOW_TYPE_NORMAL].atom) break; - if (type == ewmh[_NET_WM_WINDOW_TYPE_DOCK].atom || - type == ewmh[_NET_WM_WINDOW_TYPE_TOOLBAR].atom || - type == ewmh[_NET_WM_WINDOW_TYPE_UTILITY].atom) { + if (type[i] == ewmh[_NET_WM_WINDOW_TYPE_DOCK].atom || + type[i] == ewmh[_NET_WM_WINDOW_TYPE_TOOLBAR].atom || + type[i] == ewmh[_NET_WM_WINDOW_TYPE_UTILITY].atom) { win->floating = 1; win->quirks = SWM_Q_FLOAT | SWM_Q_ANYWHERE; break; } - if (type == ewmh[_NET_WM_WINDOW_TYPE_SPLASH].atom || - type == ewmh[_NET_WM_WINDOW_TYPE_DIALOG].atom) { + if (type[i] == ewmh[_NET_WM_WINDOW_TYPE_SPLASH].atom || + type[i] == ewmh[_NET_WM_WINDOW_TYPE_DIALOG].atom) { win->floating = 1; win->quirks = SWM_Q_FLOAT; break; @@ -1040,119 +1048,6 @@ ewmh_get_win_state(struct ws_win *win) /* events */ #ifdef SWM_DEBUG -char * -geteventname(xcb_generic_event_t *e) -{ - char *name = NULL; - - switch (XCB_EVENT_RESPONSE_TYPE(e)) { - case XCB_KEY_PRESS: - name = "KeyPress"; - break; - case XCB_KEY_RELEASE: - name = "KeyRelease"; - break; - case XCB_BUTTON_PRESS: - name = "ButtonPress"; - break; - case XCB_BUTTON_RELEASE: - name = "ButtonRelease"; - break; - case XCB_MOTION_NOTIFY: - name = "MotionNotify"; - break; - case XCB_ENTER_NOTIFY: - name = "EnterNotify"; - break; - case XCB_LEAVE_NOTIFY: - name = "LeaveNotify"; - break; - case XCB_FOCUS_IN: - name = "FocusIn"; - break; - case XCB_FOCUS_OUT: - name = "FocusOut"; - break; - case XCB_KEYMAP_NOTIFY: - name = "KeymapNotify"; - break; - case XCB_EXPOSE: - name = "Expose"; - break; - case XCB_GRAPHICS_EXPOSURE: - name = "GraphicsExposure"; - break; - case XCB_NO_EXPOSURE: - name = "NoExposure"; - break; - case XCB_VISIBILITY_NOTIFY: - name = "VisibilityNotify"; - break; - case XCB_CREATE_NOTIFY: - name = "CreateNotify"; - break; - case XCB_DESTROY_NOTIFY: - name = "DestroyNotify"; - break; - case XCB_UNMAP_NOTIFY: - name = "UnmapNotify"; - break; - case XCB_MAP_NOTIFY: - name = "MapNotify"; - break; - case XCB_MAP_REQUEST: - name = "MapRequest"; - break; - case XCB_REPARENT_NOTIFY: - name = "ReparentNotify"; - break; - case XCB_CONFIGURE_NOTIFY: - name = "ConfigureNotify"; - break; - case XCB_CONFIGURE_REQUEST: - name = "ConfigureRequest"; - break; - case XCB_GRAVITY_NOTIFY: - name = "GravityNotify"; - break; - case XCB_RESIZE_REQUEST: - name = "ResizeRequest"; - break; - case XCB_CIRCULATE_NOTIFY: - name = "CirculateNotify"; - break; - case XCB_CIRCULATE_REQUEST: - name = "CirculateRequest"; - break; - case XCB_PROPERTY_NOTIFY: - name = "PropertyNotify"; - break; - case XCB_SELECTION_CLEAR: - name = "SelectionClear"; - break; - case XCB_SELECTION_REQUEST: - name = "SelectionRequest"; - break; - case XCB_SELECTION_NOTIFY: - name = "SelectionNotify"; - break; - case XCB_COLORMAP_NOTIFY: - name = "ColormapNotify"; - break; - case XCB_CLIENT_MESSAGE: - name = "ClientMessage"; - break; - case XCB_MAPPING_NOTIFY: - name = "MappingNotify"; - break; - default: - name = "Unknown"; - break; - } - - return (name); -} - void dumpwins(struct swm_region *r, union arg *args) { @@ -1218,7 +1113,7 @@ void mappingnotify(xcb_mapping_notify_event_t *); void maprequest(xcb_map_request_event_t *); void propertynotify(xcb_property_notify_event_t *); void unmapnotify(xcb_unmap_notify_event_t *); -void visibilitynotify(xcb_visibility_notify_event_t *); +/*void visibilitynotify(xcb_visibility_notify_event_t *);*/ void clientmessage(xcb_client_message_event_t *); void screenchange(xcb_randr_screen_change_notify_event_t *); @@ -1881,6 +1776,8 @@ bar_toggle(struct swm_region *r, union arg *args) stack(); /* must be after stack */ bar_update(); + + xcb_flush(conn); } void @@ -1940,7 +1837,7 @@ bar_setup(struct swm_region *r) int num_missing_charsets = 0; int i; xcb_screen_t *screen = get_screen(r->s->idx); - uint32_t wa[2]; + uint32_t wa[3]; if (bar_fs) { XFreeFontSet(display, bar_fs); @@ -1989,10 +1886,12 @@ bar_setup(struct swm_region *r) r->bar->id = xcb_generate_id(conn); wa[0] = r->s->c[SWM_S_COLOR_BAR].color; wa[1] = r->s->c[SWM_S_COLOR_BAR_BORDER].color; + wa[2] = XCB_EVENT_MASK_EXPOSURE; xcb_create_window(conn, XCB_COPY_FROM_PARENT, r->bar->id, r->s->root, X(r->bar), Y(r->bar), WIDTH(r->bar), HEIGHT(r->bar), bar_border_width, XCB_WINDOW_CLASS_INPUT_OUTPUT, - XCB_COPY_FROM_PARENT, XCB_CW_BACK_PIXEL | XCB_CW_BORDER_PIXEL, wa); + XCB_COPY_FROM_PARENT, XCB_CW_BACK_PIXEL | XCB_CW_BORDER_PIXEL + | XCB_CW_EVENT_MASK, wa); r->bar->buffer = xcb_generate_id(conn); xcb_create_pixmap(conn, screen->root_depth, r->bar->buffer, r->bar->id, @@ -2068,6 +1967,8 @@ version(struct swm_region *r, union arg *args) else strlcpy(bar_vertext, "", sizeof bar_vertext); bar_update(); + + xcb_flush(conn); } void @@ -2590,11 +2491,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; @@ -2672,6 +2573,8 @@ switchws(struct swm_region *r, union arg *args) if (unmap_old) TAILQ_FOREACH(win, &old_ws->winlist, entry) unmap_window(win); + + xcb_flush(conn); } void @@ -2876,6 +2779,8 @@ swapwin(struct swm_region *r, union arg *args) sort_windows(wl); stack(); + + xcb_flush(conn); } void @@ -3064,6 +2969,8 @@ focus(struct swm_region *r, union arg *args) } focus_magic(winfocus); + + xcb_flush(conn); } void @@ -3693,6 +3600,8 @@ send_to_ws(struct swm_region *r, union arg *args) stack(); bar_update(); + + xcb_flush(conn); } void @@ -3715,6 +3624,8 @@ raise_toggle(struct swm_region *r, union arg *args) /* bring floaters back to top */ if (r->ws->always_raise == 0) stack(); + + xcb_flush(conn); } void @@ -3731,6 +3642,8 @@ iconify(struct swm_region *r, union arg *args) r->ws->focus = NULL; a.id = SWM_ARG_ID_FOCUSCUR; focus(r, &a); + + xcb_flush(conn); } char * @@ -3803,6 +3716,7 @@ uniconify(struct swm_region *r, union arg *args) } fclose(lfile); + xcb_flush(conn); } void @@ -3945,6 +3859,8 @@ search_win(struct swm_region *r, union arg *args) } fclose(lfile); + + xcb_flush(conn); } void @@ -4137,6 +4053,8 @@ wkill(struct swm_region *r, union arg *args) else if (r->ws->focus->can_delete) client_msg(r->ws->focus, adelete); + + xcb_flush(conn); } @@ -4197,6 +4115,8 @@ floating_toggle(struct swm_region *r, union arg *args) a.id = SWM_ARG_ID_FOCUSCUR; focus(win->ws->r, &a); } + + xcb_flush(conn); } void @@ -4265,11 +4185,11 @@ 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; - int top = 0, left = 0, buttonrelease; + int top = 0, left = 0, resizing; int dx, dy; unsigned int shape; /* cursor style */ xcb_cursor_t cursor; @@ -4287,7 +4207,7 @@ resize(struct ws_win *win, union arg *args) if (win->ewmh_flags & EWMH_F_FULLSCREEN) return; - DNPRINTF(SWM_D_MOUSE, "resize: window: 0x%x, floating: %s, " + DNPRINTF(SWM_D_EVENT, "resize: window: 0x%x, floating: %s, " "transient: 0x%x\n", win->id, YESNO(win->floating), win->transient); @@ -4370,15 +4290,17 @@ resize(struct ws_win *win, union arg *args) return; } - buttonrelease = 0; - while ((evt = xcb_poll_for_event(conn)) && buttonrelease != 1) { + xcb_flush(conn); + resizing = 1; + while ((evt = xcb_wait_for_event(conn)) && resizing) { /* XMaskEvent(display, MOUSEMASK | ExposureMask | SubstructureRedirectMask, &ev); */ switch (XCB_EVENT_RESPONSE_TYPE(evt)) { case XCB_BUTTON_RELEASE: - buttonrelease = 1; + DNPRINTF(SWM_D_EVENT, "resize: BUTTON_RELEASE\n"); + resizing = 0; break; case XCB_MOTION_NOTIFY: mne = (xcb_motion_notify_event_t *)evt; @@ -4429,8 +4351,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); } @@ -4441,7 +4363,7 @@ resize(struct ws_win *win, union arg *args) } free(evt); } - if (time) { + if (timestamp) { do_sync(); update_window(win); } @@ -4452,6 +4374,7 @@ resize(struct ws_win *win, union arg *args) xcb_close_font(conn, cursor_font); free(gpr); free(xpr); + DNPRINTF(SWM_D_EVENT, "resize: done\n"); } void @@ -4472,8 +4395,8 @@ resize_step(struct swm_region *r, union arg *args) void move(struct ws_win *win, union arg *args) { - xcb_timestamp_t time = 0; - int move_step = 0, buttonrelease; + xcb_timestamp_t timestamp = 0; + int move_step = 0, moving; struct swm_region *r = NULL; xcb_font_t cursor_font; xcb_cursor_t cursor; @@ -4490,7 +4413,7 @@ move(struct ws_win *win, union arg *args) if (win->ewmh_flags & EWMH_F_FULLSCREEN) return; - DNPRINTF(SWM_D_MOUSE, "move: window: 0x%x, floating: %s, transient: " + DNPRINTF(SWM_D_EVENT, "move: window: 0x%x, floating: %s, transient: " "0x%x\n", win->id, YESNO(win->floating), win->transient); /* in max_stack mode should only move transients */ @@ -4563,15 +4486,13 @@ move(struct ws_win *win, union arg *args) return; } - buttonrelease = 0; - while ((evt = xcb_poll_for_event(conn)) && buttonrelease != 1) { - /* - XMaskEvent(display, MOUSEMASK | ExposureMask | - SubstructureRedirectMask, &ev); - */ + xcb_flush(conn); + moving = 1; + while ((evt = xcb_wait_for_event(conn)) && moving) { switch (XCB_EVENT_RESPONSE_TYPE(evt)) { case XCB_BUTTON_RELEASE: - buttonrelease = 1; + DNPRINTF(SWM_D_EVENT, "move: BUTTON_RELEASE\n"); + moving = 0; break; case XCB_MOTION_NOTIFY: mne = (xcb_motion_notify_event_t *)evt; @@ -4581,8 +4502,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); } @@ -4593,7 +4514,7 @@ move(struct ws_win *win, union arg *args) } free(evt); } - if (time) { + if (timestamp) { do_sync(); update_window(win); } @@ -4602,6 +4523,7 @@ move(struct ws_win *win, union arg *args) xcb_free_cursor(conn, cursor); xcb_close_font(conn, cursor_font); xcb_ungrab_pointer(conn, XCB_CURRENT_TIME); + DNPRINTF(SWM_D_EVENT, "move: done\n"); } void @@ -6654,9 +6576,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) @@ -6670,6 +6589,7 @@ free_window(struct ws_win *win) memset(win, 0xff, sizeof *win); /* XXX kill later */ free(win); + DNPRINTF(SWM_D_MISC, "free_window: done\n"); } void @@ -6741,7 +6661,18 @@ focus_magic(struct ws_win *win) void expose(xcb_expose_event_t *e) { + int i, num_screens; + struct swm_region *r; + DNPRINTF(SWM_D_EVENT, "expose: window: 0x%x\n", e->window); + + num_screens = xcb_setup_roots_length(xcb_get_setup(conn)); + for (i = 0; i < num_screens; i++) + TAILQ_FOREACH(r, &screens[i].rl, entry) + if (e->window == WINID(r->bar)) + bar_update(); + + xcb_flush(conn); } void @@ -6773,7 +6704,8 @@ buttonpress(xcb_button_press_event_t *e) struct ws_win *win; int i, action; - DNPRINTF(SWM_D_EVENT, "buttonpress: window 0x%x\n", e->event); + DNPRINTF(SWM_D_EVENT, "buttonpress: window 0x%x, detail: %u\n", + e->event, e->detail); if ((win = find_window(e->event)) == NULL) return; @@ -7151,26 +7083,16 @@ unmapnotify(xcb_unmap_notify_event_t *e) /* resend unmap because we ated it */ xcb_unmap_window(conn, e->window); + xcb_flush(conn); } } -void +/*void visibilitynotify(xcb_visibility_notify_event_t *e) { - int i, num_screens; - struct swm_region *r; - DNPRINTF(SWM_D_EVENT, "visibilitynotify: window: 0x%x\n", e->window); - - if (e->state == XCB_VISIBILITY_UNOBSCURED) { - num_screens = xcb_setup_roots_length(xcb_get_setup(conn)); - for (i = 0; i < num_screens; i++) - TAILQ_FOREACH(r, &screens[i].rl, entry) - if (e->window == WINID(r->bar)) - bar_update(); - } -} +}*/ void clientmessage(xcb_client_message_event_t *e) @@ -7183,20 +7105,20 @@ clientmessage(xcb_client_message_event_t *e) } DNPRINTF(SWM_D_EVENT, "clientmessage: window: 0x%x, type: %u\n", - e->window, e->response_type); + e->window, e->type); - if (e->response_type == ewmh[_NET_ACTIVE_WINDOW].atom) { + if (e->type == ewmh[_NET_ACTIVE_WINDOW].atom) { DNPRINTF(SWM_D_EVENT, "clientmessage: _NET_ACTIVE_WINDOW\n"); focus_win(win); } - if (e->response_type == ewmh[_NET_CLOSE_WINDOW].atom) { + if (e->type == ewmh[_NET_CLOSE_WINDOW].atom) { DNPRINTF(SWM_D_EVENT, "clientmessage: _NET_CLOSE_WINDOW\n"); if (win->can_delete) client_msg(win, adelete); else xcb_kill_client(conn, win->id); } - if (e->response_type == ewmh[_NET_MOVERESIZE_WINDOW].atom) { + if (e->type == ewmh[_NET_MOVERESIZE_WINDOW].atom) { DNPRINTF(SWM_D_EVENT, "clientmessage: _NET_MOVERESIZE_WINDOW\n"); if (win->floating) { @@ -7217,7 +7139,7 @@ clientmessage(xcb_client_message_event_t *e) config_win(win, NULL); } } - if (e->response_type == ewmh[_NET_WM_STATE].atom) { + if (e->type == ewmh[_NET_WM_STATE].atom) { DNPRINTF(SWM_D_EVENT, "clientmessage: _NET_WM_STATE\n"); ewmh_update_win_state(win, e->data.data32[1], e->data.data32[0]); if (e->data.data32[2]) @@ -7651,98 +7573,58 @@ 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 event_handle(xcb_generic_event_t *evt) { uint8_t type = XCB_EVENT_RESPONSE_TYPE(evt); + + DNPRINTF(SWM_D_EVENT, "XCB Event: %s(%d)\n", + xcb_event_get_label(XCB_EVENT_RESPONSE_TYPE(evt)), + XCB_EVENT_RESPONSE_TYPE(evt)); + switch (type) { #define EVENT(type, callback) case type: callback((void *)evt); return 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); + /*EVENT(XCB_VISIBILITY_NOTIFY, visibilitynotify);*/ #undef EVENT } if (type - xrandr_eventbase == XCB_RANDR_SCREEN_CHANGE_NOTIFY) @@ -7754,14 +7636,18 @@ main(int argc, char *argv[]) { struct swm_region *r, *rr; struct ws_win *winfocus = NULL; - struct timeval tv; union arg a; char conf[PATH_MAX], *cfile = NULL; struct stat sb; int xfd, i, num_screens; - fd_set rd; struct sigaction sact; xcb_generic_event_t *evt; +#if 0 + struct timeval tv; + fd_set rd; +#endif + + time_started = time(NULL); start_argv = argv; warnx("Welcome to spectrwm V%s Build: %s", SPECTRWM_VERSION, buildstr); @@ -7818,8 +7704,7 @@ main(int argc, char *argv[]) /* flush all events */ while ((evt = xcb_poll_for_event(conn))) { - uint8_t type = XCB_EVENT_RESPONSE_TYPE(evt); - if (type == 0) + if (XCB_EVENT_RESPONSE_TYPE(evt) == 0) event_handle(evt); free(evt); } @@ -7903,8 +7788,6 @@ noconfig: while (running) { while ((evt = xcb_poll_for_event(conn))) { - DNPRINTF(SWM_D_EVENT, "XCB Event: %s\n", - geteventname(evt)); if (running == 0) goto done; event_handle(evt); @@ -7931,6 +7814,7 @@ noconfig: continue; } +#if 0 FD_ZERO(&rd); FD_SET(xfd, &rd); tv.tv_sec = 1; @@ -7938,6 +7822,7 @@ noconfig: if (select(xfd + 1, &rd, NULL, NULL, &tv) == -1) if (errno != EINTR) DNPRINTF(SWM_D_MISC, "select failed"); +#endif if (restart_wm == 1) restart(NULL, NULL); if (search_resp == 1)