JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
convert a XSelectInput to XCB
[spectrwm.git] / spectrwm.c
index d63e6e8..530c942 100644 (file)
@@ -1502,10 +1502,11 @@ int             urgent[SWM_WS_MAX];
 void
 bar_urgent(char *s, size_t sz)
 {
-       XWMHints                *wmh = NULL;
        struct ws_win           *win;
        int                     i, j, num_screens;
        char                    b[8];
+       xcb_get_property_cookie_t       c;
+       xcb_wm_hints_t          hints;
 
        for (i = 0; i < workspace_limit; i++)
                urgent[i] = 0;
@@ -1514,13 +1515,12 @@ bar_urgent(char *s, size_t sz)
        for (i = 0; i < num_screens; i++)
                for (j = 0; j < workspace_limit; j++)
                        TAILQ_FOREACH(win, &screens[i].ws[j].winlist, entry) {
-                               wmh = XGetWMHints(display, win->id);
-                               if (wmh == NULL)
+                               c = xcb_get_wm_hints(conn, win->id);
+                               if (xcb_get_wm_hints_reply(conn, c,
+                                               &hints, NULL) == 0)
                                        continue;
-
-                               if (wmh->flags & XUrgencyHint)
+                               if (hints.flags & XCB_WM_HINT_X_URGENCY)
                                        urgent[j] = 1;
-                               XFree(wmh);
                        }
 
        for (i = 0; i < workspace_limit; i++) {
@@ -6287,7 +6287,8 @@ manage_window(xcb_window_t id)
        const char              *errstr;
        struct pid_e            *p;
        struct quirk            *qp;
-
+       uint32_t                event_mask;
+       
        if ((win = find_window(id)) != NULL)
                return (win);   /* already being managed */
 
@@ -6506,9 +6507,12 @@ manage_window(xcb_window_t id)
                update_window(win);
        }
 
-       XSelectInput(display, id, EnterWindowMask | FocusChangeMask |
-           PropertyChangeMask | StructureNotifyMask);
+       event_mask = XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_FOCUS_CHANGE |
+                       XCB_EVENT_MASK_PROPERTY_CHANGE |
+                       XCB_EVENT_MASK_STRUCTURE_NOTIFY;
 
+       xcb_change_window_attributes(conn, id, XCB_CW_EVENT_MASK, &event_mask);
+       
        /* floaters need to be mapped if they are in the current workspace */
        if ((win->floating || win->transient) && (ws->idx == r->ws->idx))
                map_window_raised(win->id);