JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fix some sign compare warnings
[spectrwm.git] / spectrwm.c
index e54a743..ab82ff1 100644 (file)
 #include <util.h>
 #include <X11/cursorfont.h>
 #include <X11/keysym.h>
-#include <X11/Xatom.h>
-#include <X11/XKBlib.h>
-#include <X11/Xlib-xcb.h>
-#include <X11/Xproto.h>
-#include <X11/Xutil.h>
+#include <X11/Xlib.h>
 #include <X11/extensions/Xrandr.h>
 #include <X11/extensions/XTest.h>
-#include <xcb/randr.h>
+#include <xcb/xcb.h>
 #include <xcb/xcb_atom.h>
 #include <xcb/xcb_aux.h>
 #include <xcb/xcb_event.h>
 #include <xcb/xcb_icccm.h>
 #include <xcb/xcb_keysyms.h>
 #include <xcb/xtest.h>
+#include <xcb/randr.h>
 
 /* local includes */
 #include "version.h"
@@ -359,12 +356,6 @@ XFontSetExtents            *bar_fs_extents;
 char                   *bar_fonts;
 struct passwd          *pwd;
 
-#define SWM_MENU_FN    (2)
-#define SWM_MENU_NB    (4)
-#define SWM_MENU_NF    (6)
-#define SWM_MENU_SB    (8)
-#define SWM_MENU_SF    (10)
-
 /* layout manager data */
 struct swm_geometry {
        int                     x;
@@ -1281,12 +1272,12 @@ plain_stacker(struct workspace *ws)
 void
 custom_region(char *val)
 {
-       unsigned int                    sidx, x, y, w, h;
-       int                             num_screens;
+       unsigned int                    x, y, w, h;
+       int                             sidx, num_screens;
        xcb_screen_t                    *screen;
 
        num_screens = xcb_setup_roots_length(xcb_get_setup(conn));
-       if (sscanf(val, "screen[%u]:%ux%u+%u+%u", &sidx, &w, &h, &x, &y) != 5)
+       if (sscanf(val, "screen[%d]:%ux%u+%u+%u", &sidx, &w, &h, &x, &y) != 5)
                errx(1, "invalid custom region, "
                    "should be 'screen[<n>]:<n>x<n>+<n>+<n>");
        if (sidx < 1 || sidx > num_screens)
@@ -5484,8 +5475,8 @@ updatenumlockmask(void)
 void
 grabkeys(void)
 {
-       int                     num_screens;
-       unsigned int            j, k;
+       int                     num_screens, k;
+       unsigned int            j;
        xcb_keycode_t           *code;
        unsigned int            modifiers[] =
            { 0, LockMask, numlockmask, numlockmask | LockMask };
@@ -6341,7 +6332,7 @@ manage_window(xcb_window_t id)
        xcb_window_t            trans = XCB_WINDOW_NONE;
        struct workspace        *ws;
        struct ws_win           *win, *ww;
-       int                     i, ws_idx, border_me = 0;
+       int                     ws_idx, border_me = 0;
        xcb_atom_t              ws_idx_atom = XCB_ATOM_NONE;
        char                    ws_idx_str[SWM_PROPLEN], *prop = NULL;
        size_t                  proplen;
@@ -6349,7 +6340,7 @@ manage_window(xcb_window_t id)
        const char              *errstr;
        struct pid_e            *p;
        struct quirk            *qp;
-       uint32_t                event_mask;
+       uint32_t                event_mask, i;
        xcb_atom_t              prot;
        xcb_get_property_reply_t        *gpr;
        xcb_icccm_get_wm_protocols_reply_t      wpr;
@@ -6746,7 +6737,8 @@ void
 buttonpress(xcb_button_press_event_t *e)
 {
        struct ws_win           *win;
-       int                     i, action;
+       int                     i;
+       unsigned int            action;
 
        DNPRINTF(SWM_D_EVENT, "buttonpress: window 0x%x, detail: %u\n",
            e->event, e->detail);
@@ -7115,20 +7107,6 @@ clientmessage(xcb_client_message_event_t *e)
        xcb_flush(conn);
 }
 
-int
-xerror_start(Display *d, XErrorEvent *ee)
-{
-       other_wm = 1;
-       return (-1);
-}
-
-int
-xerror(Display *d, XErrorEvent *ee)
-{
-       /* warnx("error: %p %p", display, ee); */
-       return (-1);
-}
-
 void
 active_wm(void)
 {
@@ -7625,13 +7603,9 @@ main(int argc, char *argv[])
 
        start_argv = argv;
        warnx("Welcome to spectrwm V%s Build: %s", SPECTRWM_VERSION, buildstr);
-       if (!setlocale(LC_CTYPE, "") || !setlocale(LC_TIME, "") ||
-           !XSupportsLocale())
+       if (!setlocale(LC_CTYPE, "") || !setlocale(LC_TIME, "")) 
                warnx("no locale support");
 
-       if (!X_HAVE_UTF8_STRING)
-               warnx("no UTF-8 support");
-
        /* handle some signals */
        bzero(&sact, sizeof(sact));
        sigemptyset(&sact.sa_mask);
@@ -7650,6 +7624,7 @@ main(int argc, char *argv[])
        if (xcb_connection_has_error(conn))
                errx(1, "can not get XCB connection");
 
+       xcb_prefetch_extension_data(conn, &xcb_randr_id);
        xfd = xcb_get_file_descriptor(conn);
 
        /* look for local and global conf file */